From da8639aee819c458774ce092912ff0a63156b25d Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 9 Aug 2025 10:08:45 -0500 Subject: [PATCH] fixed folders again, bug fixes for gpt-5, adjusted response length calculation, cosmetic UI changes, other bug fixes --- .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 40346 -> 41162 bytes backend/app/models/focus_group.py | 19 + .../__pycache__/focus_groups.cpython-313.pyc | Bin 67886 -> 70737 bytes backend/app/routes/focus_groups.py | 56 ++- backend/app/routes/folders.py | 36 +- ...cus_group_response_service.cpython-313.pyc | Bin 23115 -> 23128 bytes .../focus_group_service.cpython-313.pyc | Bin 18759 -> 17449 bytes .../__pycache__/llm_service.cpython-313.pyc | Bin 29452 -> 29620 bytes .../services/focus_group_response_service.py | 64 +-- backend/app/services/focus_group_service.py | 115 +++--- backend/app/services/llm_service.py | 28 +- .../prompts/discussion-guide-generation.md | 36 +- backend/test_asset.txt | 1 + backend/test_image.png | Bin 0 -> 70 bytes .../{index-ULt1o08x.js => index-DHXCQiw7.js} | 371 +++++++++--------- dist/index.html | 2 +- src/components/FocusGroupModerator.tsx | 128 +++--- .../ai-recruiter/AIRecruiterForm.tsx | 1 + .../focus-group-session/DiscussionPanel.tsx | 4 +- src/lib/api.ts | 12 +- 23 files changed, 436 insertions(+), 437 deletions(-) create mode 100644 backend/test_asset.txt create mode 100644 backend/test_image.png rename dist/assets/{index-ULt1o08x.js => index-DHXCQiw7.js} (56%) diff --git a/.DS_Store b/.DS_Store index e9cbbe13a46a666e8257aeed9d3c55d7832484ce..24f9b3586f34237285e5fa0d9752a4a750a1e3ef 100644 GIT binary patch delta 16 XcmZoEXerpROmXry0r$;s6~)B>K|==a delta 33 ocmZoEXerpROi{$x#85}U$k3!#N1@un#7IZM#KdItE=4af0I^;PrvLx| diff --git a/backend/.DS_Store b/backend/.DS_Store index 1c50d7296f473c00d5b8776049310e1a3de10874..338de40130326918021a3624279fc9c561e5d96d 100644 GIT binary patch delta 20 bcmZoEXerp>rNnM%uA^XLWVAU@X|pH*M@R-n delta 20 bcmZoEXerp>rNnM(uA^XLVX`?;X|pH*N3I4^ diff --git a/backend/app/.DS_Store b/backend/app/.DS_Store index 0b3a9084d20c9ab8ae98396b5871c69711b3b9af..827ff6a86eef58d72cd2f0da5fad20f759761983 100644 GIT binary patch delta 24 fcmZoEXerpRK!DxQTt~sg$Y}B^4TsIo1!UC$YvBkl delta 24 fcmZoEXerpRK!DxULPx>W#CY;54TsIo1!UC$Y+ML9 diff --git a/backend/app/models/__pycache__/focus_group.cpython-313.pyc b/backend/app/models/__pycache__/focus_group.cpython-313.pyc index 0af547b74166389eb7a755f8a50d37f481a9c179..bf46171b0bf671d1f9e764bee73e3c62ee317225 100644 GIT binary patch delta 782 zcmZvY%}*0S7>DPhl!8(~yV#aWm(mt{0R@TCNWzz3q5`s_L`^nJX)C5uoZZHxpn-$& zGc@fhS_tUDi`+=|VAL3_Bpy8J!Nl-4cxc3fiIO;jfk@&Up8e&WXWn^t=HHNyd17BL zD=S5Ot#&=RQt~)sU&dXTmBUg%vAEGy+# zv$rjSWMDUZ?s34ONtZ+~RsJ0iA*FZ_*^y!!q@Ygr`DiU6dUhs^VL!W8c_U*G>tu@_#>v{@Z|L?*$;%mCJ)Kb^5Sc>%PE zD)U!5P4))Gb_+)@tK|$)=7Ys-HLinK*-ktS8`(T=f)!ZC33L3>H&W>p2ex00xiQ>$ z@`AEz49&S7{17H`UvMp)os)1q#O6K>RSLgKz$5Tnyls<6tpaTvYm%z!hGvY0Rn0Ki z=y1}A=&HIo533P=wLtL}Y&_`C%&GYfQeIKyTBpdmr$Bfr_~GqBn%{nA(TPt(bTLqV M!H!+uk>F;hKTy-qumAu6 delta 447 zcmX?gkZIO#Cce+Syj%=G@FZa@|Chj*8RS9O1V#s1N1xW!x5qk_vu*zf( z#$ra*$u&SyW%36`V<20F$yih^SPDh03{b7=D@4dcroS%2C=MxDtYr)^-2*}Q1_8zyN&Z)W?vNto67jo2&9 0 + except Exception as e: + print(f"Error clearing uploaded assets for focus group {focus_group_id}: {e}") + print(traceback.format_exc()) + return False + @staticmethod def _activate_visual_assets(focus_group_id, asset_filenames, message_id): """Internal method to activate visual assets in conversation context.""" diff --git a/backend/app/routes/__pycache__/focus_groups.cpython-313.pyc b/backend/app/routes/__pycache__/focus_groups.cpython-313.pyc index a08dea9158033bfc968fcdbee385313f01cbeffb..f50d50385f7f67416ad543e926ad4184cfed201d 100644 GIT binary patch delta 5927 zcmai1c~BeY72iWEgb)a!1CT&kZp0yTn8O(C2-|>b4qNL@?I;NrNCIIj+!Yjuw$V&G z?bOX5wez(xv`q+^w6k9H|?F-LR>qfNvtQ!TN%twnqGor1w zG^Ci#({QSmE`kWsJmu1&x9atDDo>-i`W&?Sm->P{oTy z>1hol)=v;D;m$(aoiicqlT1EIPGStnBeL1 zjpI(r(~ZqVTtUBJQxz=1GuYt*-6o=eitq)MyfRLtASP0u<+jMCc%^J6gW&Y_w7dh2 zNCKI3CSV=c;&>tknyadaU5CF_`MkN6uzFsYcmfvZ6ny8#D*bL>)=P zM9NiyPX0_^6b*{3#ZyfXR>BQ>B0pCt`pd9UALU~S&J;|I!d>_RV~&p+pDHWz-XaKW z$>6G#b;aiYd0_e^33nChy;(q}%ZQYGI%jU6koHTZ5rFSR0czs`YUL2hetinSC|@GL zG7GOttcw^z4^2QydS-Ac(SprbmY>WEr{@VGO{zE4cf{~C6QYz zOR@N7#;3K-VbQta#@8iKJ&x>#PQb8B#t=K@DLHKkh;1=z_WDopcXPbIeY!}=Z)u46 z7K@-)3)bVK)0!L|cPH*oj9QKo-^QyG>tYiTG{T>W*GYZP1AQ+W(C?Np@!7KF3Fv#l zoM0}WBS+6$2zX4cJ-EZs*{*JM;$`EGZG0|Ri0i05t>9%}OrHzdc=AuS5j68=*FIb` z8QZzL`OP+Gq16f5;t%GHm_#wa;x5IX&S{-V89h_&k82h@C@!^G5m`Z;W~i z*M~RBJ5OdpDSU=EaeExmSC*45XH2$}^wdO3QFb*lqYvttP2EzAd*aH|D0>3F_0}`; zj*Y&?`F*@Gv8>z>%gE2=hdyk|qc^k@#!H#a%1u6_5es?w2h| zEhC0`7{5JCk<4f3QDRuQgK_fl*|?{k{-hHep1TV})FvWC zL7+@HP<$b0z_EeZy)oarG2e%0?tX`2FV&Mn5clJUG(-gpxqb&7EQu>J+`mkG33mwI zAOdDj8`VZh!UJ(`nBo8q*3;GL1QDV`lq9q9`Nn(W_~QZj;sX-vZG4HWlk?+urhstE zxg}Bv5A>m+CekVGIr!s%%jKaT#9tvBe!4YIO=n7PZDfUNUd~PVxMbd^N-BFt<0Ol~ zraoe`vWC|uCCn7e0$!bDRqxbyDtf134=Zdn6)s=U0O^*hdsicGNR*D@=9;)>ZVPAP zS{%`Kz-`@3g(yk0!D)~_Nni%O`HWT8Y23kE6Llu{>873T`yh$ZkB@!~flOTImTXv^ z)=mX(Kj1&CCI8`)K)g3PzHN7$CXJjYtSML^Th$iGbQU*_THHxD$I+tMQS|&ovILp( zlYXL&wh?}^0P4|3bW%Of66os7rc@}yV6hCf?*Lz%2vt&6>@4o2dh5VxSjAL@s7Pu1 zlS^oy1Zg8B+Mz^9sJ7pr0E36|%XDx!h9xdjfkcr=WVw;JCJe1(BX59C%3A_T`(gC_ z??-Bc-SAZ=*g<|xF)mE_rmQaC(NWK!kM$i3gvJBGA=VQL`Nl)6f7CP7!lJ5Ij)tcy zWhP8y;h3#v2S6SgJ(ZcvEi{8G9s8#$Bp#nP z>74ZoV@JYlXkx${5PXB9-@W4)en&wwZ7o2rh1l0qAcM2nn}1b*A6@<-T(X^8Cnqputx$*U-B@zMFSi-%~G z@#?v{6SxFU;^AQ!>MY|F{1O2C^!BXG@HwyvMX9DOO2YZG|{wKY}h4k?hp-~%c?GP^hz-N4<(_=Th(NJbIqcF|UQ zzGBJNcB1QQw(Z2RH_NJ~HNa5XbpFAml8$NhdX?i`=h@D4-DkU>F)vm1hQ%EFx+Q=9bImmS?st znLl$Pz2aDJH_f=v8Zp!vR8ERqJ~sCdz9;1VCa;y>q={L&w6gg%NSDSM>Qs?~qtOyiy#vTpYk6 z!1mFdE|SR1{g9wjb8#j09`6q*#OfTg+@$Q!u zRf8;b$+RN{Hovh}d9~DU)eNkEYjBpq^m1!^3rw#xIW698#G>Ar2h-&mD~wAS7C2d| za9Vv1;#Cz1n^#kHcx^V~b&Vay*USyWB()OOQm|Rkwd-JarAX(mq^@jkr(pAXVFX>$yFdoU{v!HDJ_+j^Rt3;+6ft;Rj(KiWs)x2QHyYZ8wlHtkDFDjbjhO!S z76#~VZ=-?o4yg|4nRn7!4+Jupn<+TPH!~O@-PB{&nUZeg|__z=*pa-wlF+T_L;j4H!jE6ILh_+s`y(Ka|w=rGw=S}1&aAKEdM%h_~*Bk%(^b delta 3599 zcmai032aA>-`@6mFYm5*eP4APAMx6C;@EN5ZsUaF*x8pUbvE{T8{18&y>{N( zP-sP}A`p?FO*4wp7El$b6)k}Vv_%F=6H3|?n#jdbLh#l{3<#k}s7B>TA!_*Nt!EDt z2}}OxpMU=O=KGJCxAU)RUO%C+e4LYGMDTZ{>BOPix6qF*7tRScE%fTS5WPKY@U^ft z_=}1}yeFxmh!Y_q1Pyf6Z+B^ln2Y>E3r;SUpgt>Kqf>(hp#;(X+eLJ^KZm{`n}u>j zOE0=bJwf!e-%XEy>M+YfRFch6E#D^Qglx1k;G@5N*NW9c#9XkP52q~-0SvYAw88Gm z3whV+p^%MhvX%B3n4~!sr+4z z(Eq`t{qI@mkNk!b*&sU`F;9=2-z-#Q5KPjbALTgc(Od%^c*X3ExDX0ea>lZ&01?TK z)H=|;a}JhJ$RKvpJ3~&FL3VEhPo>clsy_8g2|KFf0>8)!lmObnV^BYBs+v!yt7$1r z`xOCAwG4gr23-gtxhOer+Ya0!JwURSlT2rd2rWX=8kLBYI-)pzgjl>zOCy)~MSAOe zIeq;}LnGtG-A60{Zsp*Rz-ZcyzY=(%o za8zREkL#LAJQw$N_wL(Ig+?WqXieiR{M4nD|sx@??h3Hl%GKIY*}c|;w= zN-V?yd;6*Oa=Cqr%1Q_Y`FX*h%8Aha%U+XBZmQQtoy3^Trp1{)iC6BZpI9L5W@3ft zH0kvo+fJ;!!p%0xE zb!Ob9``BZ|8F~WgDB&daqrmbJJOEh5QUUj?>B`7c0pA08>dw3$-23SLq#!#Ud1uD{ z%slt_#k;Mr_#g7bga#B7AQSm46T~C$Vz&pz-Rt9L*2f3gD1WwI(=YV85gKAG6ceHz zxwl@7`ZC&wy-6nGllQQy!`Rm$bO`F^{tOzXi~#rg#kw4XVq#2C_pG;q9L(^~3`ovQ zNcuq|K8`8xV+ANhA>Ii{ha%+=ppG6t@2d3@-GiB}s*EF*gMiQOcZ%N25^?31hNQ};`*ZWdyK3ZoC`D;OM%DhRwBQ9B25HV}I@ zg^e#`Yh$Pv@~8e0I}Z%@WW1H?Irf0PN7Ji;+6Yn5;jBU_AKnr5eJyUuK*`TUiMsfS zbi!&DS#axuaelSKkA~ zn;n-5<_&mz@Sdx{5VSN@48FNBXrZxRa`5e7Hv-cxQa(`UJ+`r+@tYck#aXQwzhQq&yFh z^v2@Z?yaCG&%iGhMn*S|P8 zU`Q`A@ogr)&P0HI>x>&~=)ac(dGItLg}pq=qfE%OeWkQYDT4zOnwgoyBMFJg=7e}? z^l>G|T&9`$A_zLU5-@8=A3q#}^PXUavnyU#q4ERfpq{&rX?AuUdpxboBJ9PxyjB z&mSI(@BWiR zh=>3DGLB1sc?k=9HSwIAui>MQ0?Mf_(~t}Os=TWWhIfks-T?_+Yzz2c__eEu$rdlH z{Kgt68fZc9H(;2&-)IH>5_W=q$yEdLGHyPg7cRF5OmFS7!sG*kb$^raK|z-QlX+hm ztju?I>0r333!uS5;o4E117_EJRwnBM`oSvnyL){wxo#^Qvgxlk1lR!!l5wC(T(GzY z>coX=Ewj`~%+e$>y~Vh{L0ssp+`maoRAA5(l^U=oHc3oxU_OZ^;{i!Zw09gp(udnL zKP6(mP<>;s=dlMWD%Dd z9YaQOS;Gh|8zrzTTl7qK8N*HDa%n&tt`k?PF-%tKB#^YYEkAzxua5}rYBBH9m&$Wc zj~eN2Et^~tphG*?CTz#RFJV-hHarfUq@1DW)|#X^n7iWtSo>7MC+Oe*c>zz+pZ;sy z%r1h$eoXIFo}rDmzJXt&Kf6`4oq;H4nD`nKtj!YE*vum%hn3NT)04`V!c&pyL(0>v z-HxzD!`OIaS~XI`CpFSrU>k|IesVzzfd9GET9Gi19UdPIkBp9wPLGbLfXbT;It8Kp z;$$!0EWHiJlRx-eJT_K_v9;6O$t| diff --git a/backend/app/routes/focus_groups.py b/backend/app/routes/focus_groups.py index 1b7bf122..d4b015f8 100644 --- a/backend/app/routes/focus_groups.py +++ b/backend/app/routes/focus_groups.py @@ -423,7 +423,8 @@ def update_focus_group(focus_group_id): with open('/tmp/focus_group_debug.log', 'a') as f: f.write(log_msg) f.flush() - print(f"🔧 FOCUS GROUP UPDATE DATA: {data}") + # Removed verbose data logging to reduce log noise + # print(f"🔧 FOCUS GROUP UPDATE DATA: {data}") except: pass @@ -1162,6 +1163,10 @@ def upload_assets(focus_group_id): try: logger.debug(f"=== UPLOAD ASSETS API called for focus group {focus_group_id} ===") + # Check for replace flag + replace_existing = request.form.get('replace', '').lower() == 'true' + logger.info(f"Replace existing assets flag: {replace_existing}") + # Set up temporary directory for file processing (optional) temp_dir = setup_temp_directory() if temp_dir: @@ -1175,6 +1180,55 @@ def upload_assets(focus_group_id): logger.warning(f"Focus group not found: {focus_group_id}") return jsonify({"error": "Focus group not found"}), 404 + # If replace flag is set, clear existing assets first + if replace_existing: + logger.info("Replace flag set - clearing existing assets") + existing_assets = focus_group.get('uploaded_assets', []) + if existing_assets: + logger.info(f"Deleting {len(existing_assets)} existing assets") + + # Delete existing files from disk + for existing_asset in existing_assets: + filename = existing_asset.get('filename') + if filename: + # Try to delete from both possible locations + file_deleted = False + + # Try subdirectory location first + upload_dir = get_upload_folder(focus_group_id) + subdirectory_path = os.path.join(upload_dir, filename) + if os.path.exists(subdirectory_path): + try: + os.remove(subdirectory_path) + file_deleted = True + logger.info(f"Deleted existing asset from subdirectory: {filename}") + except Exception as e: + logger.warning(f"Failed to delete {filename} from subdirectory: {e}") + + # Try flat storage location + if not file_deleted: + base_dir = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) + main_upload_dir = os.path.join(base_dir, 'uploads') + flat_path = os.path.join(main_upload_dir, filename) + if os.path.exists(flat_path): + try: + os.remove(flat_path) + file_deleted = True + logger.info(f"Deleted existing asset from main uploads: {filename}") + except Exception as e: + logger.warning(f"Failed to delete {filename} from main uploads: {e}") + + if not file_deleted: + logger.warning(f"Could not find or delete existing asset file: {filename}") + + # Clear assets from database + success = FocusGroup.clear_uploaded_assets(focus_group_id) + if success: + logger.info("Successfully cleared existing assets from database") + else: + logger.error("Failed to clear existing assets from database") + return jsonify({"error": "Failed to clear existing assets"}), 500 + # Try standard Flask file processing first (since temp directories are now working) files = None flask_processing_failed = False diff --git a/backend/app/routes/folders.py b/backend/app/routes/folders.py index fb8330a9..0355d83f 100644 --- a/backend/app/routes/folders.py +++ b/backend/app/routes/folders.py @@ -23,15 +23,10 @@ folders_bp = Blueprint('folders', __name__) @folders_bp.route('/', methods=['GET']) @jwt_required(optional=True) # Make JWT optional for development def get_folders(): - """Get all folders for the current user.""" + """Get all folders - shared across all users.""" try: - user_id = get_jwt_identity() - if user_id: - # If authenticated, get user's folders - folders = Folder.find_by_user(user_id) - else: - # For development, return all folders if not authenticated - folders = Folder.get_all() + # Always return all folders - this is a shared persona system + folders = Folder.get_all() # Make folders serializable serializable_folders = make_serializable(folders) @@ -91,10 +86,7 @@ def update_folder(folder_id): if not folder: return jsonify({"message": "Folder not found"}), 404 - # Ensure user owns the folder - user_id = get_jwt_identity() - if folder.get('created_by') != user_id: - return jsonify({"message": "Unauthorized"}), 403 + # Folder operations are shared across all users in this system # Ensure _id is not being modified if '_id' in data: @@ -153,10 +145,7 @@ def add_persona_to_folder(folder_id): if not folder: return jsonify({"message": "Folder not found"}), 404 - # Ensure user owns the folder - user_id = get_jwt_identity() - if folder.get('created_by') != user_id: - return jsonify({"message": "Unauthorized"}), 403 + # Folder operations are shared across all users in this system persona_id = data['persona_id'] success = Folder.add_persona(folder_id, persona_id) @@ -178,10 +167,7 @@ def remove_persona_from_folder(folder_id, persona_id): if not folder: return jsonify({"message": "Folder not found"}), 404 - # Ensure user owns the folder - user_id = get_jwt_identity() - if folder.get('created_by') != user_id: - return jsonify({"message": "Unauthorized"}), 403 + # Folder operations are shared across all users in this system success = Folder.remove_persona(folder_id, persona_id) @@ -207,10 +193,7 @@ def add_personas_to_folder_batch(folder_id): if not folder: return jsonify({"message": "Folder not found"}), 404 - # Ensure user owns the folder - user_id = get_jwt_identity() - if folder.get('created_by') != user_id: - return jsonify({"message": "Unauthorized"}), 403 + # Folder operations are shared across all users in this system persona_ids = data['persona_ids'] if not isinstance(persona_ids, list): @@ -245,10 +228,7 @@ def remove_personas_from_folder_batch(folder_id): if not folder: return jsonify({"message": "Folder not found"}), 404 - # Ensure user owns the folder - user_id = get_jwt_identity() - if folder.get('created_by') != user_id: - return jsonify({"message": "Unauthorized"}), 403 + # Folder operations are shared across all users in this system persona_ids = data['persona_ids'] if not isinstance(persona_ids, list): 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 4e85b496a3cdff7246fac6202a6e89d231ef8d4a..4b645102252fc8fa831bbd0241fbaa0db2d7b386 100644 GIT binary patch delta 1018 zcmaJ0*PqcX6fqMn!b^zWayv)-sM^H12t@?KOF})M zKqW#F+<3r5@FqddB3X!~?l$D?kmHEen+{PWFW405_=)@_|&Ho4n0U z+2&ddu7sHiN1~0S#%0hmZU?pdl1A*3m1*fq1`TO(EC5b7a9l^mKWb+hwVMlxV@D0= zjvB6b4MU%yB}=3{ztTAYPHaZ)*Sky+=cV0&0kPhP>l@*MAU1*(?S^rSsC;ssgh zi;A*B9W^V5y<*WZaZo-V6l38)OzaCr2SO1sFg&ctf!?sMC=m#4;h@+n56VhZ><%spc6F>^iO%1lZg!%t{iODUdH zFSpEK{G1k%-FQK5Cgq&)f~6Pf)%I4rL_fAq2=G%NWtyJr7;?@sI0x>txkr`NFm|q{q>X#VqvNHc-5SRNYcBW1p{b0i-l?p~lkZ)-G@eB@0cE;0 hiw>Ge~u{s07^^xgmf delta 1018 zcmZuvUr19?7(eI!+nn2+`{UHPoK4H&{)pRBXS5Qbz)JLR)gYtkY6ZH{m582xM4=$Cpy(m-$%kHg2rei=LC`t(uIWSH!|(j=_x--_{LaVS$iej- zG;fpRBdrVYbLqC;9xQn-5MHYBybtStW^3N~t{P<9GsC`Th9f^i z^CuK$?7pR}QZp#RdSZe`VwyY#A}1=xxuB1&KxVuZyaL;CPbhqqVZ!chF5J<0 z+36Ka`y&C;qIx5}soGSX?|}Ta@dPAJX?%*OG_r;3n%Z>_W@-GwX~Hk6@e{8$MFRA1 zN`3r5W9MIo5|<9rbXbk;cuH&j9+&?#1tCny{>TKxU!xYh79GM3QLF4fGz^7Xq$hD5 zXJgg)O|#Y5;<=WQlB1rC(Kg`KzQHT{@(()@j)!PGC@VDL>VS*;+@XfxF$Redn1U9+BOlDZh z(eD)sbg7b)LOFp={o#>J^6Kz~BhowB+wX>b0}z&Nm`W$TlcSUMx6dgoO>8+`GaXr5 wb|_mud-}7pLE&ju5rEyP=v1l)LeWlgG*2c{uA_p%Gb0pdOehm+;d8}m!OX%mqSq|cCXjm z9nf!fxfEr`KzjuA?aVjdeD9h0X7t{-sW&cB=6fcS0m1M04!ykk_oHu{=V{-+?=0($@VKHyf*hA}pko+-)i+Md-rl=B~(;gtR;U}7zVzFpN<1Udtq~9}I z0HuMyd*3UQ-qv)|UY+z)O>2>Mfy|eGY(Art>a?|#Rw~ohNvqnzBK^M6eCauD?L#xJ zYme9qdV3M#CO{E`U|uLtIWk7+EnO{DDE)(O&SMlTj8Q0IOoEj$3#C)9g1n;ayyAWH zEPL~6Eilgl^GaZz5$26E)_t_4d$dKRKwFxjwFsq>MQ4+xpOBjLB{bJB_31mzGSF`woIh~oP*T> zbg~5iF>3%=%NhZ?*g}AHtQlZETMV#)wE%2nO8_>pR)EcHDL^+{4zNYKVJItT?foVq z^4g$RN(U%{bhh^X0l1e2_j;x%raedhdBAlLm2Bl!G+Pm+J5ZFiqLHHr2^CByTOo0d zGD{cJeE?>YpBXV;1*_>%z7q%bMsuhRdUYr1iDL*E5eA+@g=#Wr@K}xpWe6=)E4&e! zc1m4_(zYDZL(JiJjh_rvyd37oej2OF6 zz0j1MZDwH!c%ZBDu%h9-kw!4M#(~&M!NKaY;e8GvRzK~QZfLA^CsdBv(KQ&|ONAgp z#Mu_b*>m7npWtMjOh3`BZosSYm_P=>3}#y3@)0myr~q8X)ph$_-J#B!a43!hNTc>Y35QS^=|Ix=~W2t7U5y%c>rK$g)zf ztd<#L?2^Um)YneAv$W$6(OP9%i$W`N?I8ZDdK9IdnIK%LS`s<$6abk!UxtjnjuArLC0A&BQXZYSt+nI_8)sR19Nh=Cz19O=8F_w9_hYj3yQ` z(U-YYE#~Od%C^cn!}ct+v2BmgS@_L$w&dsxad}dau^;Qz{J*SO&sd{q`&5oK9@YaM zj)1o9Z2NEG;r)84+FJM95b$ah?)FD|Upi1ROr0V7iJk+i&w4e|YkIeCiES_=iL+Fh za`qRtQTmUHR!?v*UJFOmY-Jl&EZEhLkerttLJP@R`wH8k>_i}8m2F`{sq`ARb{vdH;<{eN}tX zB2|0RVD&zzc}+~^yH8qN=C?uk6>aYA;vl<$_)LFsPo5?UH3&pSzs1&o4jU3z-C^3! z*-zvZ?#o%>szjiEI(L6zT~QjNdc^z|TMz!Hg{pnp!us`BsdIC+WwThJ8qSW4ZD=Uckrabdo3k@nYTdmTOJQBKc?68r2$kwHf@3W&zvN#UZz^5x6 z$hL%yR5(lpYa`tEI627~YxCKL^^?0wD@X-VpT>!T6!9!M{)4C%Ex2+dc!>n&c#iHi zmE%J(uqpGT#|)<9S)cE-AdBUx2Q>h>d#A@S=~buQZDXGKKgsQr_wFjlvNFm?*4z27 z!MSK>5?T_s)44gcw_UC! z&HdZg{~f8cgB&^`&P;@CCjfNruUWtd6`Ci<#t!cu|+uF5|Annuz>J8I; zObqcG{4(CIz+5!S$D%kG5#bMJ;uSFxUzeN>UDTu$ZTKWn6kiWVxMhAhppd2vt6VhG z7U6J2DWg0PSc=4j*metU-VBAqSmZCnLn4otL>?5|-~q7_;x{q31ier!#7EsJl%fn@ z(jJ`34~D|Lz^(BqeOx#%L^g#lY22JLMZ{2IB_wd+fIMh{zS7OoQ||4O$%tx&s_K_V z0GE}VF>#dxEza`1fK@Wt>ey0#P1piwM#Wn;cZ5v{6^@=*8Ow8Qt1&O25npxp+9Xorl*V%Y0aR+wH!tX$e!( zpR{_UU$yq+>+#YmCq~`ZJKAVUpEm>^UB=ftJvO>vTc2Sh4R;8-6xFd^FWqf#knVPT z)Mr)W4?*W*F@9}5Mg#{r@ai(?P)H)aMY1C#;B8|RH)pBbgVM8g)zYD^MygHz~mwl=Ze6Jl4pD-{Hn#G7KWvQ?q~A#o17?sAn9A(ja0Yv zX7`~4snSJKUyHEAA(51^DKq$#3lYLVEVRaptpuryMb<-0VjH0%^^(|5KnDS2t)~p~ zxa@Kf78WEApVG;$Pnn3#VJ^l8Ho$%202wWijR;)-3vWK9?FNi=tEWTybDkyrv_`ES$-jh7wPxcJ$EZuCrS(#+!lBG}F&Y!=oJ^1HT;wMIXn%0>(>aMHp zj_btxt`j?sUDwGMi+*Bt-7T$rdF-XJD=lv_*POc^U$U(~*?&5@5K5jtm&E69mxj{@ zT+o!(+G@-n6uXl3J!uUzKPtvo+S58{rSp)b{>sej^RLZc-QI2JP3s9VA6cp{kE9Do zJ7GYUn#MY(AQ{kxm7&v?kjI({|FSL>5o7eI#8)I@Otx8qz6nD6E|}>B8Z%8G>?w z7T=3rIlk-krt1K4zaA}6Pf^LI)^<+|$qVA{Y4KLeZ1Upv&$Vb+Gpo50dwuJ*t2?!8;5HXvE;_ncQz8YHWGmJ(K9rBX6XP8^qbTf@>!%ff?S}^ zlFwOsi6FhpbcQi}fbo5Vng=v6zNlH(e9W!ic6sl(#&5aCZw79=o&@|R6{ElKfYz5L z?suc|+GOpq9n)^v)a0e1yM-k$j6FY=tUU3qbtkavW0NOlle2;3nb4gx8_BheWMDJ7 z`Ao9nYqtv%;QsQ;ONP6)>dU9D7_V}#72UCQUK&o*gS5%{k*itK^!=6eVV{Femt3zp z_Gdb(Qu^_LqdR={@YU993p=)(T{o(BOgB&6eEQ~Ea$zx9{p9W9r|uS)zHIom;qu`- z#SNd&X;DR2dQqwwJlMFFhq}*G|MP|Uflv7q^^5x@sI=xDqD-8$HCS!CQ+($A;xoTY zYXCw0>Wd!YlwaI8OScCfqei4cKc4^v?-rN8Y<|g{tnIlrcWv~Y`FEo?yZ(A(XEo`Z zx?OzogBr(o4Zlq5fbh%cJFswmaNHiOFuz-357wCf#%T|_%zx{!2b;9-X?#?$4c*lB zqm_E}cRHVD#aZ~nd|w^(enj~#=Zfj~t^F;l_4Ged{W|#EG4#_3`2JJz;}|~w>TLk{ zahqYKTJ!P2sui2&6Ppg&pEz~E;gfp9YOUsz_V(3k&8O8mXn$H?dd{T#^pMYRE?@T< ztp)y{+W2eC-K z`7c9%g<8lGvq-I61d5@huKZGX^nv#jdf$5r&1hJ9T1UzVtCrEJ*FGpD@>IM|ueK8K zn5I&wU!W{_;8i7iNfb1Ufu(@LD8oWl18tMsHhT-|p#+o5Fgl3bMcad!Gl0jjRbD+0 zGba*WiU=`YD2QbaJYL#yS0viSK5&Fc-Uh{k1UyE-Ap#B)0MB zcoh#!kIsw^_{QZ&h+A$2aZt;RRZ4r{k^kx|8d+LEpvmWTntaJ%nTgM za5OE2m+R}tlxwIP$EiDti$wA-D)bu=v_4{T_0>;PZ@%B7+sgeUq3F69`iamI0(vOFxrm^2QFoJyy{RBnA96kw{d498@$1T{oK;3T2XD`*w#9qb?3uYH$w%3U6FNO2waHsQBtb7FqD0q zu!SR#G@{JFZSW*;*6Y1^R1S-hRs2QJP|2-5m7t`MGft`NwlcXEBidc$;8f;`F>73` z7rRb|c`gd9xbu*qI2?(bhjK-pt%gWuo``{e@Kz));wTL8LK}{SVo=K9CONDDH41?d z|FplU9nXLgB$2*(wo&4{=h1r^soiwK5_c=@;sG#v!D zilMV{m;|;YK*zl@6);c{udGIZ+j1xvLBR`tAW?-fWQhkSVqZ8M z*~DJY0U`!CNAWtiIBV$sa(IhOSYF0mo^HIJ5F@Z2)EGrE7mUG7Fl6boEVsQ}| z6URX2krfjp`2pJQ-PnNJNs>N$$|^St4A}_+RzgcM2NDIyHjxkW8yw`KTo-3E5}5cC zLNxyH-3#0m5t<;2Bao4@wV=hGbl3~ea$!yY`Es0zP=t2 zVHLn-g%?(VLqc9hnAG^W0%S#_ZjA`I1V66E)^Jl;_na? z2O!llMDA(BbFQqZQ$lBg_=Oyv%!)SWGtp^zeG+#gidq&1}RQAJf+M;c&3wKJ`koB7CEo-UA^22@^^HpAi~@oDlvVw3(Q9g>4m-K!K5>4hf?awcujrgviDm7Ri+2 zfEZ~+4^=@*m?e=_Sy4u-WL^_l*Ju2Ps7WvF>A|qj7>1Emv?5TMp9>=y;}%>EEgHr{bxcU&Rn$>+&UK8Tvl#QfkdV|;8x&ZFfJv!chEld3!vZzD zJyad@L7kRS$|~%gc%C?plR7k!9}^gGi2m6+v}-1QjZ*3E;jB7@M^IMJ@bKB zQ)ehD8P^rL%m>OElQEC4C=pQc(6=kW~g1I^ll*2;R zmcub)Z5U~%upmx0Q8=^?(m7#go>OWVRfR0&qJ%(erYfOrp`_5ZQdQ8pDH*gLN&&5x zQbF5BsiAGBs-fLTX`t<(w9x9QT4*-~s(9E`Ef0`v==my!R_=TpH;7ZUssjEI$f~Y9 zFnz5C+gBeKc(J%ZgY9g^FuI=HOw~^~kT*43$nH)-elf`M9-f}sT1FRji1!G_JQ!Am z5uk^z=RrYWw>=IHfPDdi3!2I8AhY9hWDcy$Jb`4$Ub4?4^5L{0fHA)mn(%&huz-tqJ~>7ic<<0gE_eJ0 z0X~je{hku5jQo7?;$G%nbsgiW(c%+~TB;F~{GP!lQRdZC9YS83z)G@i7ngN<$T|p_ zsSvUz2$_j84oE z%^V4G!hL`;7p%5W7V=;ZiW4}BGLuib!8x>rGE!#BBEsnWjtYQ3ob?pJDiKp@m>-`eDlUCJIRL6a3R*~+#yo;D7Wiy5dvwW8v^Zx zSSl$osYK}cIT~zu!_E{~V>6@T<~~B%Ab2543_wcDf{|{dB!#W@ZE%BRq62N7;iLRw z1@3v^7R$(4D2tEZ$!K#d!RDBv?UbE)U2U)l-Ei)p5jnHogDlu-1X?}N3LDl|zG1sM z*5{3x^HB%cS(Id^V>|~a5neZCT$NcQj&T>yGsJi;1%GM4Ukz#keC6V(Fav)oZ}u0zac0z{~_uy1C#qoU;xi_CzJ zPh6^%r-H%#7{(=TC(~YQRez1@%-29z;OkTy`3>f&>UP^7LGRhmo`Yk9>xt1qHZb3- z*5KUz3qOy5;TI6xb;?C#gbf*SsjM^^+-SwjB{%p~N1CFv$;+|?KiUgEQ-jMYh zpPk|Df$eGGndA#RHH?qHPPH&^X&iYxl0W7g_#(n-p~@UsL^S$^h`LG;wS5+m=_P*c zGDMfTbwiwgt}t(D-I6~kA`t=-bo5nzlRsvdP_xfxF+cPNn#J$R~h{K-YTGN}=zKl2e>)AZ@!}AJcm`UoXPUvRSO9L;1z;Tr z7#S?FSjX%BOtcK#Eaulrd8!zlGQ$fo3*(Psfpv?A+YpbS_y#9Y9G0v93oJsk;UINz zDjM9}Y_Rgb=xvt$fqrV`)n;F8=*hI`kV}v6qcM#6$g;*#NiPAkpQa&G{TZu&U zWMnGdLu7HL%NR@?jX zxoBuQJRJgKWWIbV&OzA5?&0=5s6r6 zDtt6Fb)tu0{@wVi5$Ul|eBHQg6=!5{3Q#7pxHKtn6WNNH$Xu8X&4;s+1^NUXJw+!4 zgfpv-#v-#3Iy4vL`OMR1Z7QibZ6_i#L{TYWKa<6hQXq%t;$avit5Bbw1}Xa)mnf?# zcU5pM5>I3`$0PLdP%ttRENaS1^F*X4TeaRtdXm=d+qV;gzJ4k-+(S(I#`cW%P5Ov^ zeG?;n{i8mT0CrMVRD_bG#8Md6JO)D#5!(tbOx8RG3h?0c!;-QhA|P$YYJny%K?X#0 z^<;31S-Xi`n3@X5<1-6$b4x@%tC*)Px)hNJ&!3zNCBn%z-VQKhU>wZwff;)ypf^eM z`$qi31nKin5|iV^=;#<{m2yukI)5@jK!|1&$H0;*V(M53LYxT4;>lVhHXof1&k;w% z5qg$bh=->^NH-mx2`$Ve2p3A2|uO^bJgo z4EV^N-~2Z`kzd0Zl}fsh*^ka9eIPmRCr13d2T&Bd9~CQIgouZyP!T9@8Ds{S1s<{{ zjc64PS}{dX&RB*yPwEic=O5(qXt-oe=BULbNH#LO9LEX9+-SJ*e8ZYjBs#wvt4n3(RW}r%hr(20rp-2J=CUwYjQF=NKX#)7efF==J@_0N+7c!eU z*yMnZv*((+9MYKxJsmu{6pTz~Mchsmp?aB>oC?Kg(3KT)5SYJhvbI(hN=;S@TIWNF zVECD-tmt?<81uu!IO@kO-+{WR5e;C5Ii~!rXLhQ8fc2)`A*z0LR>yoLWEpP=#g1 zTwRZ$OGgZj8Z3r>3W#k)4IIx{R?6|Y8WKal_+*t_r44c=KL|B7i-%)Jfx(PAjs18i zTRRmC!^yE24z4FpFrEm-5?SqM=uonEaoum8GJ+luT%Ig^x7rZjb1gQf`=GZ zIVQNlH2(lky;r5r3AAzwzuVAyyJ7R&4V!N&(hb8Gl)un4+|ky*wEN<2wqeK3FR?rP zEHR$Z?kNyA{WCTFHAJ0Vbmps7 zSE|^i;af`fKxB32ad!9w+c@`*ZvL(=WxlGoqF`OYcXXk8PLGE&M~2ZIj`D+ z`UGHkd1~34HgCMXch%gLvm$B(pn5sJ{6yN)k+T8eqbBTxASqZ*yt?$t(mf2@CkP83 zVA#eP!TtPT17yUQV1oI3w>9+)^iSi1NZ=6eL%9;bhtO+CFpP*DI|b`1-~}omjhwTH z-z%IH-t8S&8Bh04vilFDdk?HSwy}qg-0`$u_ohAlE1|S!_{!X^i8V{>eJ{W|JNB>( zlWWfJKDV3IZOzEG-H}zFPr>MN>++fFhgKc^Y|{X%8_dXjh=UmJYx3*!tIk2z;bV0} z8QJhUgRS>om$N&_)wW62OR>6r8QK2d&3fEAsn1#HZVka&cdW?MHU6_h1=aqHY|q0D z1tWH4WV?B&-tXG3&3vcjn(6upR@a}A4HPD|UDw}kKfvxdz_uM^bx&qwfdXsG4^x_( z!F2Z+yTyNNHgCr-lx9BNqu}yB_@NfU;N6RYhX(BFXK(hs;rqUCr8&KAj13&R9XPTY zIKqY!>A*t9ySP3FUN8sZsn-l_Cz*ClvZ|&v zhx^sjubgH(2HBxQX~$Ens&P%@xVAB^aj&)XtqiWV>}0jhHJgiVhSEc^wtcLMSjWm5 zhcl|3g+c2(D)(L3w2F%g*79UV6)1YGzAGc!!h5at`0|EjNuT3u(s~+vI0; zB&mIh>+m5i_5UV?y zkxkvr=Mk&hn2~ib-|*;dBLcaFM``X~*}USq)qX2*Ym7A_l;9kji+SDihN)1$M*h)u zE1KSQm>mhSL7HuhW^^Z+Ij`CL5DGvYs!FVR`wyp9oIjYq8N4;j8YeR<}1qYB?qXi7;JzZiacOvr7=F zVE(DoFx`r2O%E_3)Mx}(c2UM!Ms9i7k%R0(D11+`fy1mRm{A@1mwX5~fu5V)x3`Y3 zZXHi=-OKh&uqN`hYVvK>hUKWWe> zb}0VAs$UR_-jod1E>vJ|nfpBOED`a~y0eSINL4ReWqgD&0GvoqZDZ%@SRF!cLf3dYtqW}SsW48Duuk}w0e>qHFwZ#afNHDl<% zvauJKZ}u5dFG3ggD2y4@z&V|7&_6okSD<+w`?<*dzE};1iQcegBGwGXHD~LZ&2dkC zMkIEv)thoc)OlZL$ca%0647YMNw{tWrm4+Ua$PA_Ysgh`T^UxZ&&j#&hyv4Fmo-=9 zIVCq%VOrzmfs5O7oN_piq>8gs7dp-!J7<2VK@tyy*oNu{0@RHy^I%=|v6q>@?*DFT z4pHLJWF>RaS@<5C%?hINY$aT-MqvzhvCBw;L=sg;;p#ax5T$1#vsuxIe`q{!J@QCi zHS$QdVjJ9C7v{n{V(=q4hQnX{NoaCHxPRUgh;Y$|G7N8f59@yy8)Dua*sAOk%u;Kam92zfb)4<{p-kOh)JpcpU-rGhS< z*eY!;>%#eitOyCD4P{K4sN5C0Lf4kAP|7+x>LZFe38^b|f6WxMs@+37=h`7ba25Uh z`@Zwt^L^(#=l)J!z6)Q!2UQQ0N;#m9H*k87i@c_K$-r%t67z-zvS`=~4W!vPs4N8l z%TZ3#RshCMkTb?tNss9?uf}4eA@@wq%3=(V#?RG3HW2_e8jaN$BCTH(%fnn*#tp{A z0Bo&9xa|NgylO9=8#c)19Vf=Cob6!iAagN2KFbmxc@DJg=D~U1jfk?&sqMV z47jREOW2b*TmB;`eU1aV@^n1m@M7rftm}4hw_NhDnZM-^Il?;rFIo-5S~JCub$r;I zc-8ke5o}8wtv)G+yAqQ6=fvjPn*|r4Lcv=kVDZ|H^tl00u+GTnyH;eY zg2;yK$U%Rdeh#_(;+Q(>C36-N`N>eR4sEOgSltfmVN4U1W%~yrwFFv<%$k)($BH{) z|7GM@DKw_VTJmm-hRA}d3O&|l3dbCB(~VGL(W8x^^m z#hOSHTNk+)?9O3{e3c-kBmWJa<@Hz}X=h`~(xzwWnJA#s=_8%YlUMqvI6cu zG?TAd>+)EuOsrMN*T}^*#1pbA*0hMAkW=r+3Kc*yEKz}4@tT>6$txkdw3+!)3%MNf z!65l66qNp_S!4y1kZg<^$)+}w)etqWYy$FN6^$;B_N{oZf&92lFEX?m$k{e?fdLz0 z(#J+WYI8#ix!gB z&C}lVkuhQSFNLI*TG3O(USADU1|D0?{g9eG-yt>A>1?1A_8p@|2$N63Nswu+r!{fD zBgwUo(FHHdr(y?ZrbnkIj!yrUi;qxOyoA9h1N!BFWkn`pYX8{oiTE&cZ)1=NB_}tR zNOm&2KXHBY2awElt7Xd)I@?5SocyMH2HJ?Rrx{))!#zDpI@kW)qq`2o=;$>0bx$`P z{b!GZoor8VkLGSl{H;*SL_N6vGlkC`^^2Cy52j-PuR;-`zSu%MR z>?xCXVK`-K_}tWzGPNv~)h+qfUoob99q&w}e7*O1(MD+b7Z91P_eH?lm{t*K*v&uG zQ6WpTgujE*10p73dq~Sbv!X`~EbBfq*M9$PcjCo?VK}SiuG=aH#M1ZkI_d`1+%3LU zHc%%1NZASpilw(zCTiR+4_W9?QY;@RQY2L}#*5_xZbj0@Vv}X^!2)Tr#xR&GP37{G zrwT+gCZ(2RC7-f{99YJGBGoW-nkjxNA_{gBB(6m+aB!K7<1-MQ z8tQ^465T_3==~Yp)e=;S^H7-}lO91PjaZwNNfS0^1QPN5DWi54m17gK3)<)q(DhV> z%%`taV7?iy$kjN`pT7m1LVs;G~usGq8+Iod=Ig78EFD@^z$ZwK}H4uHC- zUYG@GwL~4{uR)UuTUO3@%-a7CBwkrj%!X|we^^6~ZB^BkU>g!vNcFUm>Z$n&*)pRl zK~Gl;XeX})i%4p#ntc0%qNnCAek}KKoJS?kj_pF${^50Q2dWlC()mO-C#n%d(h=zq z#L!Nz4%g+e#W@8rtfgXTIknBIShF}%zRd~Ok?=OVsSX!VEnItNTMu(K;9|EF86D9{ z+i@Y4i4Jmcn-6XxOB6fF0PTe_YJ;0eAZmwgWJk0g?jygCMtK*OMxw%%P>(hAJ)`h; z1MzQn2G?WPBUx+Aawcm{SR2A`tL*jhz4FDJ4Oujex>eEtw?aaM_qbasDHbbyfWg2-HEFsH#y1M^gzVlBtQS* z%kYm0?N|-0Wik|}f(GJ$U?2$38;q@L&1Gg@VUU%Y_|6ZZ|1IWdV{nauF!P@n%VF>i zgAW+oU~rR6jh9jxnj3c%y-OX-vfUHYN5-C+nTTJfCeuyg1QryUOT?6qe!CvSjDXkCBFb0k}6Yz0U?`gWP*1t%ZYL{`z{^V32#CQ&GHO+*}j! zaw)HTFp!g~7g1L#AYf1)@$ic|>WGV9bn%RPVtvRtWamG%X&45~6hE``bRe#w z-SEJ$M{;jccgVynYd{TAF1|VC;^?acg2*s=fgXSvdGVTS*Y) delta 3187 zcmai0du&tJ8NcV+*LLjKdD)2{*KZv1@*^(@Ax^NJ6q1maFDD~$lQw_@jADkN*-&X& z{;M_~%08*enpR7tsiK>vj$KMS*a{u2jI@QAG02dnr5bFS)@jz5idw2^=Um%KXx8oi z@$>IH=iK}KzVDv%yFU9Dbo|dq_du&vGvs>b_)B|?Q)hJFHM4_C_@a3|+%$h3c_3&R z(AF^wRttH}+Zkr;B+OV|F2-yHy@_07a)#ON7xYle&u|7T7fK<;yZvRD5lVe*Bg(9D zkOyErMuO2NOBAfWTXb8i5h@e=Y@e}650g$4>~PvpK%8`bN5&@mK;>x^!=8sSWQFF+ z33M3FRK8mHse<9l7wUtvEh#>5&mDkMy_Mq8suz&*d6qF&r6)vGgOPg+)8%L9{OaBc zZf--^)$8Uyav3PLS_xivbG;Sf5$_*ls6+f(?Fl)Gi}xFk$k7RSs(A)|8y+>^L!Gd= zu@l`Et6Hw2l06I~m`HtQAL~bnVq6^c!X#e;$~J8sE*2~TA3y>xSOpXLwfR`V?vp1< zuxzPi9OGWeqH zRnCZw(RMngUDNzcvNwuIp~mRu%*c{nBQ66+t6ol~I-y8yhQd%S*=gZWsM;)4U^ajf zmQ~%d2$i&3m?16aF`q5)lkNF3b98_g73^WXl@hWZ0=}rsKj!I2ZP6TVg%A99RicSP$}uUHM5+ zW@p9`oQYYWBf{HFF>7v>P>yxv?zJoKGr??3zsOLE%L~7DF8fP*+u51-&JLXxwoD}^An;aoO zNy?K$6ox5`z}YS3g?*HcQFw~N4smhI`$%virk}{!l6b23Go;)tqn7kEoazs1B67yoaNAn{`NObyr+)|? zle3o{{=Np~m4Xh>fSkS77*h2c<#WLh>Q^W~Xyr-pp*d_LQ#Tsa{W8ssRu$p%3U$9h zGhay8&KuPONICB^_qQnLTR6f~NJiGALZP#IJ z5!PZZh;sh6i)9!GBUA(sR;(TsWP+UdVkPm#D&mX$s*}zO)#Ri@q0{b*ZX)mQOBb=l z&E!n;k}XVm&|4jNq}hrWe~3+!df9R5=3iYa>RgM zf*T{Iyf#Vjrh1t)_A@$$LPST|_eN`ETgHyT$4-mbHTq*#@eA^Hl5fMKr;np|#23fv zP~}-VvTPG?(eNCFRaWu$9oJCP&*@Zz!UYP_^L|NL9))))T%qu53hz@0Q|N%&t`f}z zrQ{39B+o;B+*NXs(7USL@xv2i&paDXzDGi6iJKu7?^k(}^qZ1Q!O>k-n2%R0enZ2L z0FAddoTv0EfxBq$UB!-P$H(KzlHDI7v>z7t%$P6jOL?R7HNtey0$+KD50HOQKegWC+lY%@+Z&)R=BQd&ADUIn z9!)tK?yYSQ|GjqAJua=^&H_hdG%l^ce6a~9xUR1S7@ME zV`bp}0Y-{Syd@g=3>E*NYYkOVTolEgH;ePGV^V zW3WyOQ$1;ACRXL*yiBZSjE-5^)bnXgCeCLp?%De9d(+xXtYh^2bYv=+F37}%j9UAz zB8fkcF^b|eOE^iM-o%M-9yow@9%Q+pj1-A28cfsfsi8C{MMO@iB~6-0)})uEWMXwr znkEzH(^OiCXH#Xy$6@kd*|BaJr;{qCWYOlDZ8$AEEu2=p)|#@_r8zp9%_h<1WKy`C zOA42(mcr$tr7%-7rIL;ZETMW`lBfN*6R5N$&6Hn&>f|@j@8Ol?DEbFHO8%%o$Va+= JG8CoN{{f1B 0.7: # High extraversion - short_prob *= 0.6 # Reduce short response probability - medium_prob *= 0.9 # Slightly reduce medium - long_prob *= 1.8 # Increase long response probability - elif extraversion < 0.3: # Low extraversion - short_prob *= 1.6 # Increase short response probability - medium_prob *= 1.1 # Slightly increase medium - long_prob *= 0.5 # Reduce long response probability + if extraversion > 0.7: # High extraversion (>70%) + short_prob *= 0.6 # Short probability × 0.6 + medium_prob *= 0.9 # Medium probability × 0.9 + long_prob *= 1.8 # Long probability × 1.8 + elif extraversion < 0.3: # Low extraversion (<30%) + short_prob *= 1.3 # Short probability × 1.3 + medium_prob *= 1.1 # Medium probability × 1.1 + long_prob *= 0.7 # Long probability × 0.7 # Adjust based on communication preferences comm_prefs = persona.get('communicationPreferences', '').lower() if 'brief' in comm_prefs or 'concise' in comm_prefs or 'direct' in comm_prefs: - short_prob *= 1.4 - medium_prob *= 1.1 - long_prob *= 0.6 + short_prob *= 1.2 # Short ×1.2 + medium_prob *= 1.1 # Medium ×1.1 + long_prob *= 0.8 # Long ×0.8 elif 'detailed' in comm_prefs or 'verbose' in comm_prefs or 'elaborate' in comm_prefs: - short_prob *= 0.7 - medium_prob *= 0.9 - long_prob *= 1.5 + short_prob *= 0.7 # Short ×0.7 + medium_prob *= 0.9 # Medium ×0.9 + long_prob *= 1.5 # Long ×1.5 # Analyze recent message context if previous_messages: @@ -318,24 +318,22 @@ def _determine_response_length_preference( if recent_lengths: avg_recent_length = sum(recent_lengths) / len(recent_lengths) - # If recent messages are short, sometimes match the brevity - if avg_recent_length < 10: # Very short recent messages - short_prob *= 1.3 - medium_prob *= 1.0 - long_prob *= 0.7 - # If recent messages are long, sometimes provide contrast with shorter response - elif avg_recent_length > 50: # Long recent messages - short_prob *= 1.2 - medium_prob *= 1.1 - long_prob *= 0.8 + # Very short recent messages (<18 words avg) + if avg_recent_length < 18: + short_prob *= 1.3 # Short ×1.3 + long_prob *= 0.7 # Long ×0.7 + # Long recent messages (>60 words avg) + elif avg_recent_length > 60: + short_prob *= 1.2 # Short ×1.2 + medium_prob *= 1.1 # Medium ×1.1 + long_prob *= 0.8 # Long ×0.8 - # Consider topic complexity (simple heuristic) + # Consider topic complexity (>15 words or multiple questions) topic_words = current_topic.split() if len(topic_words) > 15 or current_topic.count('?') > 1: # Complex topics may warrant longer responses - short_prob *= 0.8 - medium_prob *= 1.0 - long_prob *= 1.3 + short_prob *= 0.8 # Short ×0.8 + long_prob *= 1.3 # Long ×1.3 # Normalize probabilities total_prob = short_prob + medium_prob + long_prob @@ -365,7 +363,7 @@ def _get_length_specific_instructions(length_preference: str) -> str: """ if length_preference == 'short': return """ -RESPONSE LENGTH: Provide a SHORT response (1-8 words or a brief phrase). +RESPONSE LENGTH: Provide a SHORT response (1-18 words or brief phrase). Examples of appropriate short responses: - "Absolutely!" - "I disagree." @@ -374,12 +372,14 @@ Examples of appropriate short responses: - "Exactly my point." - "Makes sense to me." - "I'm not sure about that." +- "I love that design approach." +- "The colors feel too bright for me." Keep it natural and conversational, but brief. Sometimes a simple reaction or acknowledgment is all that's needed. """ elif length_preference == 'medium': return """ -RESPONSE LENGTH: Provide a MEDIUM response (1-3 sentences). +RESPONSE LENGTH: Provide a MEDIUM response (1-5 sentences). This should be conversational but not overly detailed. Share your perspective clearly and concisely. Example length: "I think that's a great point about mobile payments. I've had similar experiences with apps that make checkout too complicated." """ diff --git a/backend/app/services/focus_group_service.py b/backend/app/services/focus_group_service.py index a4556642..ae4dc74f 100644 --- a/backend/app/services/focus_group_service.py +++ b/backend/app/services/focus_group_service.py @@ -51,7 +51,7 @@ class FocusGroupService: Raises: Exception: If all retry attempts fail """ - logger.info(f"Starting discussion guide generation for '{focus_group_name}' (duration: {duration}min, topics: {discussion_topics})") + logger.info(f"Generating discussion guide: '{focus_group_name}' ({duration}min)") # Calculate approximate section times based on duration total_minutes = int(duration) @@ -94,26 +94,11 @@ class FocusGroupService: uploaded_assets = [] if focus_group_id: try: - # DEBUG: Check if focus group exists and log its data - focus_group_doc = FocusGroup.find_by_id(focus_group_id) - if focus_group_doc: - logger.info(f"Found focus group document: {focus_group_id}") - logger.info(f"Focus group keys: {list(focus_group_doc.keys()) if focus_group_doc else 'None'}") - if 'uploaded_assets' in focus_group_doc: - logger.info(f"Raw uploaded_assets in document: {focus_group_doc['uploaded_assets']}") - else: - logger.warning(f"No 'uploaded_assets' key found in focus group document") - else: - logger.error(f"Focus group document not found: {focus_group_id}") - uploaded_assets = FocusGroup.get_uploaded_assets(focus_group_id) - logger.info(f"Found {len(uploaded_assets)} uploaded assets for focus group {focus_group_id}") if uploaded_assets: - logger.info(f"Asset details: {uploaded_assets}") + logger.info(f"Retrieved {len(uploaded_assets)} assets for focus group {focus_group_id}") except Exception as e: logger.error(f"Could not retrieve assets for focus group {focus_group_id}: {e}") - import traceback - logger.error(f"Asset retrieval traceback: {traceback.format_exc()}") # Load and format the discussion guide prompt try: @@ -136,53 +121,15 @@ class FocusGroupService: 'uploaded_assets': uploaded_assets, 'has_assets': len(uploaded_assets) > 0, 'asset_count': len(uploaded_assets), + 'asset_requirement_note': ' (will require creative review activities)' if len(uploaded_assets) > 0 else '', # Create a formatted list of asset filenames for the LLM - 'uploaded_asset_list': '\n'.join([f"- {asset.get('filename', 'unknown')} ({asset.get('original_filename', 'unknown')})" for asset in uploaded_assets]) if uploaded_assets else 'No assets uploaded', - # Jinja2-style template variables to avoid conflicts with Python formatting - 'jinja_if_has_assets': '{% if has_assets %}' if len(uploaded_assets) > 0 else '', - 'jinja_else': '{% else %}' if len(uploaded_assets) == 0 else '', - 'jinja_endif': '{% endif %}' + 'uploaded_asset_list': '\n'.join([f"- {asset.get('filename', 'unknown')} ({asset.get('original_name', asset.get('original_filename', 'unknown'))})" for asset in uploaded_assets]) if uploaded_assets else 'No assets uploaded', + # Conditional content for asset sections + 'assets_section': FocusGroupService._generate_assets_section(uploaded_assets) if uploaded_assets else 'No creative assets have been uploaded for this focus group.' } - # DEBUG: Log template variables before prompt generation - logger.info("=== DEBUG: TEMPLATE VARIABLES ===") - logger.info(f"has_assets: {template_vars['has_assets']}") - logger.info(f"asset_count: {template_vars['asset_count']}") - logger.info(f"uploaded_asset_list: {template_vars['uploaded_asset_list']}") - logger.info(f"jinja_if_has_assets: {template_vars['jinja_if_has_assets']}") - logger.info(f"jinja_else: {template_vars['jinja_else']}") - logger.info(f"jinja_endif: {template_vars['jinja_endif']}") - prompt = load_prompt('discussion-guide-generation', template_vars) - logger.info(f"Successfully loaded discussion guide prompt template") - - # 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]}") - - # Log sections around creative assets to verify template population - if "CREATIVE ASSETS REQUIREMENTS" in prompt: - creative_section_start = prompt.find("CREATIVE ASSETS REQUIREMENTS") - creative_section_end = prompt.find("BEST PRACTICES:", creative_section_start) - if creative_section_end == -1: - creative_section_end = creative_section_start + 1000 - creative_section = prompt[creative_section_start:creative_section_end] - logger.info("=== CREATIVE ASSETS SECTION IN PROMPT ===") - logger.info(creative_section) - 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 ===") + logger.info(f"Starting discussion guide generation: {len(uploaded_assets)} assets, {llm_model or 'default'} model") except PromptLoaderError as e: error_msg = f"Error loading discussion guide prompt: {str(e)}" logger.error(error_msg) @@ -192,8 +139,6 @@ class FocusGroupService: last_error = None for attempt in range(1, max_retries + 1): 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'): @@ -207,7 +152,6 @@ class FocusGroupService: 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( @@ -217,7 +161,6 @@ class FocusGroupService: model_name=llm_model ) - logger.info(f"Received LLM response (length: {len(response)} chars)") # Clean up the response to remove code fences if present clean_response = response.strip() @@ -326,17 +269,55 @@ class FocusGroupService: last_error = Exception(error_msg) except Exception as e: - error_msg = f"LLM service error during generation: {str(e)}" - logger.warning(error_msg) + logger.warning(f"Generation attempt {attempt} failed: {str(e)}") last_error = e # If this wasn't the last attempt, wait before retrying (exponential backoff) if attempt < max_retries: wait_time = 2 ** (attempt - 1) # 1, 2, 4 seconds - logger.info(f"Attempt {attempt} failed, waiting {wait_time} seconds before retry...") + logger.info(f"Retrying in {wait_time}s (attempt {attempt + 1}/{max_retries})") time.sleep(wait_time) # All attempts failed final_error_msg = f"Discussion guide generation failed after {max_retries} attempts. Last error: {str(last_error)}" logger.error(final_error_msg) raise Exception(final_error_msg) + + @staticmethod + def _generate_assets_section(uploaded_assets: List[Dict[str, Any]]) -> str: + """Generate the assets section content for the discussion guide prompt.""" + if not uploaded_assets: + return 'No creative assets have been uploaded for this focus group.' + + asset_count = len(uploaded_assets) + uploaded_asset_list = '\n'.join([f"- {asset.get('filename', 'unknown')} ({asset.get('original_name', asset.get('original_filename', 'unknown'))})" for asset in uploaded_assets]) + + return f"""🚨 CRITICAL REQUIREMENT: This focus group has {asset_count} uploaded creative asset(s) that MUST be included in the discussion guide. + +**MANDATORY CREATIVE REVIEW ACTIVITIES:** +YOU MUST CREATE EXACTLY {asset_count} "creative_review" ACTIVITIES - ONE FOR EACH ASSET BELOW: + +**UPLOADED ASSET FILENAMES:** +{uploaded_asset_list} + +**CREATIVE REVIEW ACTIVITY REQUIREMENTS:** +- CREATE one "creative_review" activity for EACH asset filename listed above +- Each activity type MUST be "creative_review" (not "open_question" or any other type) +- MANDATORY: Include the exact asset filename in the activity content +- Example format: "Please take a look at the creative asset on your screen, titled 'EXACT_FILENAME_HERE'. What is your immediate gut reaction? What words come to mind?" +- Distribute these activities throughout different sections (not all in one place) +- Allow 3-5 minutes per creative review activity +- Add 1-2 probe questions after each creative review + +**VALIDATION CHECKLIST:** +Before finalizing your JSON, verify: +□ You have created exactly {asset_count} activities with type "creative_review" +□ Each creative_review activity includes an exact filename from the asset list above +□ Creative review activities are spread across different sections of the guide +□ Each creative review activity has adequate time allocation + +**CREATIVE ASSET INTEGRATION:** +- Integrate creative review activities naturally into the flow of discussion +- Place creative assets strategically within relevant topic sections +- Ensure creative reviews don't dominate the discussion - balance with other questions +- Use creative assets to support and enhance the main discussion topics""" diff --git a/backend/app/services/llm_service.py b/backend/app/services/llm_service.py index 5a6fa5b7..c1774b85 100644 --- a/backend/app/services/llm_service.py +++ b/backend/app/services/llm_service.py @@ -231,9 +231,7 @@ class LLMService: text_config["verbosity"] = "medium" # Default kwargs["text"] = text_config - # Add max_tokens if specified (Responses API uses max_tokens in text config) - if max_tokens: - kwargs["max_tokens"] = max_tokens + # Note: GPT-5 Responses API does not support max_tokens parameter response = openai_client.responses.create(**kwargs) result = LLMService._extract_responses_api_content(response) @@ -508,8 +506,13 @@ class LLMService: if actual_model == 'gpt-5': # Use Responses API for GPT-5 multimodal # Note: GPT-5 Responses API supports multimodal input - input_content = [{"type": "text", "text": prompt}] - input_content.extend(image_content) + input_content = [{"role": "user", "content": [{"type": "input_text", "text": prompt}]}] + # Add images to the content array + for img_content in image_content: + input_content[0]["content"].append({ + "type": "input_image", + "image_url": img_content["image_url"]["url"] + }) kwargs = { "model": actual_model, @@ -521,8 +524,7 @@ class LLMService: } } - if max_tokens: - kwargs["max_tokens"] = max_tokens + # Note: GPT-5 Responses API does not support max_tokens parameter response = openai_client.responses.create(**kwargs) result = LLMService._extract_responses_api_content(response) @@ -721,8 +723,13 @@ class LLMService: if actual_model == 'gpt-5': # Use Responses API for GPT-5 contextual multimodal - input_content = [{"type": "text", "text": full_prompt}] - input_content.extend(image_content) + input_content = [{"role": "user", "content": [{"type": "input_text", "text": full_prompt}]}] + # Add images to the content array + for img_content in image_content: + input_content[0]["content"].append({ + "type": "input_image", + "image_url": img_content["image_url"]["url"] + }) kwargs = { "model": actual_model, @@ -734,8 +741,7 @@ class LLMService: } } - if max_tokens: - kwargs["max_tokens"] = max_tokens + # Note: GPT-5 Responses API does not support max_tokens parameter response = openai_client.responses.create(**kwargs) result = LLMService._extract_responses_api_content(response) diff --git a/backend/prompts/discussion-guide-generation.md b/backend/prompts/discussion-guide-generation.md index f2605c9c..b67cd2e6 100644 --- a/backend/prompts/discussion-guide-generation.md +++ b/backend/prompts/discussion-guide-generation.md @@ -14,7 +14,7 @@ FOCUS GROUP DETAILS: - Research Brief: {research_brief} - Key Discussion Topics: {discussion_topics} - Total Duration: {duration} minutes -- Creative Assets: {asset_count} uploaded asset(s){jinja_if_has_assets} (will require creative review activities){jinja_endif} +- Creative Assets: {asset_count} uploaded asset(s){asset_requirement_note} TIME ALLOCATION (approximate): - Introduction: {intro_time} minutes @@ -275,39 +275,7 @@ When assets are uploaded, you MUST include activities like this: **FLEXIBILITY NOTE:** Types can be used in either array based on context and flow. **CREATIVE ASSETS REQUIREMENTS:** -{jinja_if_has_assets} -🚨 CRITICAL REQUIREMENT: This focus group has {asset_count} uploaded creative asset(s) that MUST be included in the discussion guide. - -**MANDATORY CREATIVE REVIEW ACTIVITIES:** -YOU MUST CREATE EXACTLY {asset_count} "creative_review" ACTIVITIES - ONE FOR EACH ASSET BELOW: - -**UPLOADED ASSET FILENAMES:** -{uploaded_asset_list} - -**CREATIVE REVIEW ACTIVITY REQUIREMENTS:** -- CREATE one "creative_review" activity for EACH asset filename listed above -- Each activity type MUST be "creative_review" (not "open_question" or any other type) -- MANDATORY: Include the exact asset filename in the activity content -- Example format: "Please take a look at the creative asset on your screen, titled 'EXACT_FILENAME_HERE'. What is your immediate gut reaction? What words come to mind?" -- Distribute these activities throughout different sections (not all in one place) -- Allow 3-5 minutes per creative review activity -- Add 1-2 probe questions after each creative review - -**VALIDATION CHECKLIST:** -Before finalizing your JSON, verify: -□ You have created exactly {asset_count} activities with type "creative_review" -□ Each creative_review activity includes an exact filename from the asset list above -□ Creative review activities are spread across different sections of the guide -□ Each creative review activity has adequate time allocation - -**CREATIVE ASSET INTEGRATION:** -- Integrate creative review activities naturally into the flow of discussion -- Place creative assets strategically within relevant topic sections -- Ensure creative reviews don't dominate the discussion - balance with other questions -- Use creative assets to support and enhance the main discussion topics -{jinja_else} -No creative assets have been uploaded for this focus group. -{jinja_endif} +{assets_section} BEST PRACTICES: - Use clear, specific questions optimized for flowing conversation diff --git a/backend/test_asset.txt b/backend/test_asset.txt new file mode 100644 index 00000000..d7ab9a8d --- /dev/null +++ b/backend/test_asset.txt @@ -0,0 +1 @@ +test file content diff --git a/backend/test_image.png b/backend/test_image.png new file mode 100644 index 0000000000000000000000000000000000000000..0f2de3749df299a6b84bf6ff1a0b393a1c1fd22b GIT binary patch literal 70 zcmeAS@N?(olHy`uVBq!ia0vp^j3CUx1|;Q0k92}1TpU9xZYBTuKYyVd1A7xwz3mB) Q_dp2-Pgg&ebxsLQ0NDZ%{throw TypeError(t)};var Cw=(t,e,n)=>e.has(t)||gP("Cannot "+n);var ye=(t,e,n)=>(Cw(t,e,"read from private field"),n?n.call(t):e.get(t)),nn=(t,e,n)=>e.has(t)?gP("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Lt=(t,e,n,r)=>(Cw(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),$r=(t,e,n)=>(Cw(t,e,"access private method"),n);var gg=(t,e,n,r)=>({set _(i){Lt(t,e,i,n)},get _(){return ye(t,e,r)}});function _K(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var vg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function en(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var qD={exports:{}},mb={},YD={exports:{}},zt={};/** +var mP=t=>{throw TypeError(t)};var Sw=(t,e,n)=>e.has(t)||mP("Cannot "+n);var ye=(t,e,n)=>(Sw(t,e,"read from private field"),n?n.call(t):e.get(t)),nn=(t,e,n)=>e.has(t)?mP("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Lt=(t,e,n,r)=>(Sw(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),$r=(t,e,n)=>(Sw(t,e,"access private method"),n);var mg=(t,e,n,r)=>({set _(i){Lt(t,e,i,n)},get _(){return ye(t,e,r)}});function AK(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var gg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function en(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var WD={exports:{}},pb={},qD={exports:{}},zt={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var gP=t=>{throw TypeError(t)};var Cw=(t,e,n)=>e.has(t)||gP("Cannot "+n);var ye= * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Lm=Symbol.for("react.element"),jK=Symbol.for("react.portal"),EK=Symbol.for("react.fragment"),NK=Symbol.for("react.strict_mode"),TK=Symbol.for("react.profiler"),PK=Symbol.for("react.provider"),kK=Symbol.for("react.context"),OK=Symbol.for("react.forward_ref"),IK=Symbol.for("react.suspense"),RK=Symbol.for("react.memo"),MK=Symbol.for("react.lazy"),vP=Symbol.iterator;function DK(t){return t===null||typeof t!="object"?null:(t=vP&&t[vP]||t["@@iterator"],typeof t=="function"?t:null)}var QD={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},XD=Object.assign,ZD={};function cf(t,e,n){this.props=t,this.context=e,this.refs=ZD,this.updater=n||QD}cf.prototype.isReactComponent={};cf.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};cf.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function JD(){}JD.prototype=cf.prototype;function P_(t,e,n){this.props=t,this.context=e,this.refs=ZD,this.updater=n||QD}var k_=P_.prototype=new JD;k_.constructor=P_;XD(k_,cf.prototype);k_.isPureReactComponent=!0;var yP=Array.isArray,e$=Object.prototype.hasOwnProperty,O_={current:null},t$={key:!0,ref:!0,__self:!0,__source:!0};function n$(t,e,n){var r,i={},o=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(o=""+e.key),e)e$.call(e,r)&&!t$.hasOwnProperty(r)&&(i[r]=e[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1{throw TypeError(t)};var Cw=(t,e,n)=>e.has(t)||gP("Cannot "+n);var ye= * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var BK=y,HK=Symbol.for("react.element"),zK=Symbol.for("react.fragment"),VK=Object.prototype.hasOwnProperty,GK=BK.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,KK={key:!0,ref:!0,__self:!0,__source:!0};function o$(t,e,n){var r,i={},o=null,s=null;n!==void 0&&(o=""+n),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(s=e.ref);for(r in e)VK.call(e,r)&&!KK.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:HK,type:t,key:o,ref:s,props:i,_owner:GK.current}}mb.Fragment=zK;mb.jsx=o$;mb.jsxs=o$;qD.exports=mb;var a=qD.exports,s$={exports:{}},Gi={},a$={exports:{}},l$={};/** + */var UK=y,BK=Symbol.for("react.element"),HK=Symbol.for("react.fragment"),zK=Object.prototype.hasOwnProperty,VK=UK.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,GK={key:!0,ref:!0,__self:!0,__source:!0};function i$(t,e,n){var r,i={},o=null,s=null;n!==void 0&&(o=""+n),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(s=e.ref);for(r in e)zK.call(e,r)&&!GK.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:BK,type:t,key:o,ref:s,props:i,_owner:VK.current}}pb.Fragment=HK;pb.jsx=i$;pb.jsxs=i$;WD.exports=pb;var a=WD.exports,o$={exports:{}},Gi={},s$={exports:{}},a$={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ var gP=t=>{throw TypeError(t)};var Cw=(t,e,n)=>e.has(t)||gP("Cannot "+n);var ye= * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(t){function e(M,U){var K=M.length;M.push(U);e:for(;0>>1,re=M[X];if(0>>1;Xi(ue,K))iei(ce,ue)?(M[X]=ce,M[ie]=K,X=ie):(M[X]=ue,M[F]=K,X=F);else if(iei(ce,K))M[X]=ce,M[ie]=K,X=ie;else break e}}return U}function i(M,U){var K=M.sortIndex-U.sortIndex;return K!==0?K:M.id-U.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,g=!1,m=!1,v=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,x=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(M){for(var U=n(u);U!==null;){if(U.callback===null)r(u);else if(U.startTime<=M)r(u),U.sortIndex=U.expirationTime,e(c,U);else break;U=n(u)}}function S(M){if(m=!1,w(M),!g)if(n(c)!==null)g=!0,$(C);else{var U=n(u);U!==null&&z(S,U.startTime-M)}}function C(M,U){g=!1,m&&(m=!1,b(j),j=-1),p=!0;var K=h;try{for(w(U),f=n(c);f!==null&&(!(f.expirationTime>U)||M&&!R());){var X=f.callback;if(typeof X=="function"){f.callback=null,h=f.priorityLevel;var re=X(f.expirationTime<=U);U=t.unstable_now(),typeof re=="function"?f.callback=re:f===n(c)&&r(c),w(U)}else r(c);f=n(c)}if(f!==null)var xe=!0;else{var F=n(u);F!==null&&z(S,F.startTime-U),xe=!1}return xe}finally{f=null,h=K,p=!1}}var A=!1,_=null,j=-1,k=5,P=-1;function R(){return!(t.unstable_now()-PM||125X?(M.sortIndex=K,e(u,M),n(c)===null&&M===n(u)&&(m?(b(j),j=-1):m=!0,z(S,K-X))):(M.sortIndex=re,e(c,M),g||p||(g=!0,$(C))),M},t.unstable_shouldYield=R,t.unstable_wrapCallback=function(M){var U=h;return function(){var K=h;h=U;try{return M.apply(this,arguments)}finally{h=K}}}})(l$);a$.exports=l$;var WK=a$.exports;/** + */(function(t){function e(M,U){var W=M.length;M.push(U);e:for(;0>>1,re=M[X];if(0>>1;Xi(fe,W))oei(de,fe)?(M[X]=de,M[oe]=W,X=oe):(M[X]=fe,M[F]=W,X=F);else if(oei(de,W))M[X]=de,M[oe]=W,X=oe;else break e}}return U}function i(M,U){var W=M.sortIndex-U.sortIndex;return W!==0?W:M.id-U.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,g=!1,m=!1,v=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,x=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(M){for(var U=n(u);U!==null;){if(U.callback===null)r(u);else if(U.startTime<=M)r(u),U.sortIndex=U.expirationTime,e(c,U);else break;U=n(u)}}function S(M){if(m=!1,w(M),!g)if(n(c)!==null)g=!0,$(C);else{var U=n(u);U!==null&&z(S,U.startTime-M)}}function C(M,U){g=!1,m&&(m=!1,b(j),j=-1),p=!0;var W=h;try{for(w(U),f=n(c);f!==null&&(!(f.expirationTime>U)||M&&!I());){var X=f.callback;if(typeof X=="function"){f.callback=null,h=f.priorityLevel;var re=X(f.expirationTime<=U);U=t.unstable_now(),typeof re=="function"?f.callback=re:f===n(c)&&r(c),w(U)}else r(c);f=n(c)}if(f!==null)var xe=!0;else{var F=n(u);F!==null&&z(S,F.startTime-U),xe=!1}return xe}finally{f=null,h=W,p=!1}}var A=!1,_=null,j=-1,k=5,P=-1;function I(){return!(t.unstable_now()-PM||125X?(M.sortIndex=W,e(u,M),n(c)===null&&M===n(u)&&(m?(b(j),j=-1):m=!0,z(S,W-X))):(M.sortIndex=re,e(c,M),g||p||(g=!0,$(C))),M},t.unstable_shouldYield=I,t.unstable_wrapCallback=function(M){var U=h;return function(){var W=h;h=U;try{return M.apply(this,arguments)}finally{h=W}}}})(a$);s$.exports=a$;var KK=s$.exports;/** * @license React * react-dom.production.min.js * @@ -30,15 +30,15 @@ var gP=t=>{throw TypeError(t)};var Cw=(t,e,n)=>e.has(t)||gP("Cannot "+n);var ye= * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var qK=y,Vi=WK;function _e(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),JS=Object.prototype.hasOwnProperty,YK=/^[: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]*$/,bP={},wP={};function QK(t){return JS.call(wP,t)?!0:JS.call(bP,t)?!1:YK.test(t)?wP[t]=!0:(bP[t]=!0,!1)}function XK(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function ZK(t,e,n,r){if(e===null||typeof e>"u"||XK(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function ui(t,e,n,r,i,o,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=s}var Ir={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ir[t]=new ui(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ir[e]=new ui(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ir[t]=new ui(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ir[t]=new ui(t,2,!1,t,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(t){Ir[t]=new ui(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ir[t]=new ui(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ir[t]=new ui(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ir[t]=new ui(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ir[t]=new ui(t,5,!1,t.toLowerCase(),null,!1,!1)});var R_=/[\-:]([a-z])/g;function M_(t){return t[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(t){var e=t.replace(R_,M_);Ir[e]=new ui(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(R_,M_);Ir[e]=new ui(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(R_,M_);Ir[e]=new ui(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ir[t]=new ui(t,1,!1,t.toLowerCase(),null,!1,!1)});Ir.xlinkHref=new ui("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ir[t]=new ui(t,1,!1,t.toLowerCase(),null,!0,!0)});function D_(t,e,n,r){var i=Ir.hasOwnProperty(e)?Ir[e]:null;(i!==null?i.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),JS=Object.prototype.hasOwnProperty,qK=/^[: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]*$/,xP={},bP={};function YK(t){return JS.call(bP,t)?!0:JS.call(xP,t)?!1:qK.test(t)?bP[t]=!0:(xP[t]=!0,!1)}function QK(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function XK(t,e,n,r){if(e===null||typeof e>"u"||QK(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function ui(t,e,n,r,i,o,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=s}var Ir={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ir[t]=new ui(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ir[e]=new ui(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ir[t]=new ui(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ir[t]=new ui(t,2,!1,t,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(t){Ir[t]=new ui(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ir[t]=new ui(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ir[t]=new ui(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ir[t]=new ui(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ir[t]=new ui(t,5,!1,t.toLowerCase(),null,!1,!1)});var I_=/[\-:]([a-z])/g;function R_(t){return t[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(t){var e=t.replace(I_,R_);Ir[e]=new ui(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(I_,R_);Ir[e]=new ui(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(I_,R_);Ir[e]=new ui(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ir[t]=new ui(t,1,!1,t.toLowerCase(),null,!1,!1)});Ir.xlinkHref=new ui("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ir[t]=new ui(t,1,!1,t.toLowerCase(),null,!0,!0)});function M_(t,e,n,r){var i=Ir.hasOwnProperty(e)?Ir[e]:null;(i!==null?i.type!==0:r||!(2l||i[s]!==o[l]){var c=` -`+i[s].replace(" at new "," at ");return t.displayName&&c.includes("")&&(c=c.replace("",t.displayName)),c}while(1<=s&&0<=l);break}}}finally{jw=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?vh(t):""}function JK(t){switch(t.tag){case 5:return vh(t.type);case 16:return vh("Lazy");case 13:return vh("Suspense");case 19:return vh("SuspenseList");case 0:case 2:case 15:return t=Ew(t.type,!1),t;case 11:return t=Ew(t.type.render,!1),t;case 1:return t=Ew(t.type,!0),t;default:return""}}function rC(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case ku:return"Fragment";case Pu:return"Portal";case eC:return"Profiler";case $_:return"StrictMode";case tC:return"Suspense";case nC:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case d$:return(t.displayName||"Context")+".Consumer";case u$:return(t._context.displayName||"Context")+".Provider";case L_:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case F_:return e=t.displayName||null,e!==null?e:rC(t.type)||"Memo";case Fa:e=t._payload,t=t._init;try{return rC(t(e))}catch{}}return null}function eW(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return rC(e);case 8:return e===$_?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function jl(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function h$(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function tW(t){var e=h$(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function bg(t){t._valueTracker||(t._valueTracker=tW(t))}function p$(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=h$(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Lv(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function iC(t,e){var n=e.checked;return Ln({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function CP(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=jl(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function m$(t,e){e=e.checked,e!=null&&D_(t,"checked",e,!1)}function oC(t,e){m$(t,e);var n=jl(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?sC(t,e.type,n):e.hasOwnProperty("defaultValue")&&sC(t,e.type,jl(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function AP(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function sC(t,e,n){(e!=="number"||Lv(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var yh=Array.isArray;function Wu(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=wg.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function tp(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Ph={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},nW=["Webkit","ms","Moz","O"];Object.keys(Ph).forEach(function(t){nW.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Ph[e]=Ph[t]})});function x$(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Ph.hasOwnProperty(t)&&Ph[t]?(""+e).trim():e+"px"}function b$(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=x$(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var rW=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 cC(t,e){if(e){if(rW[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(_e(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(_e(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(_e(61))}if(e.style!=null&&typeof e.style!="object")throw Error(_e(62))}}function uC(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 dC=null;function U_(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var fC=null,qu=null,Yu=null;function EP(t){if(t=Bm(t)){if(typeof fC!="function")throw Error(_e(280));var e=t.stateNode;e&&(e=bb(e),fC(t.stateNode,t.type,e))}}function w$(t){qu?Yu?Yu.push(t):Yu=[t]:qu=t}function S$(){if(qu){var t=qu,e=Yu;if(Yu=qu=null,EP(t),e)for(t=0;t>>=0,t===0?32:31-(pW(t)/mW|0)|0}var Sg=64,Cg=4194304;function xh(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Hv(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,o=t.pingedLanes,s=n&268435455;if(s!==0){var l=s&~i;l!==0?r=xh(l):(o&=s,o!==0&&(r=xh(o)))}else s=n&~i,s!==0?r=xh(s):o!==0&&(r=xh(o));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function Fm(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Ro(e),t[e]=n}function xW(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=Oh),DP=" ",$P=!1;function H$(t,e){switch(t){case"keyup":return WW.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function z$(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ou=!1;function YW(t,e){switch(t){case"compositionend":return z$(e);case"keypress":return e.which!==32?null:($P=!0,DP);case"textInput":return t=e.data,t===DP&&$P?null:t;default:return null}}function QW(t,e){if(Ou)return t==="compositionend"||!q_&&H$(t,e)?(t=U$(),pv=G_=el=null,Ou=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=BP(n)}}function W$(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?W$(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function q$(){for(var t=window,e=Lv();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Lv(t.document)}return e}function Y_(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function o7(t){var e=q$(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&W$(n.ownerDocument.documentElement,n)){if(r!==null&&Y_(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!t.extend&&o>r&&(i=r,r=o,o=i),i=HP(n,o);var s=HP(n,r);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Iu=null,yC=null,Rh=null,xC=!1;function zP(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;xC||Iu==null||Iu!==Lv(r)||(r=Iu,"selectionStart"in r&&Y_(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}),Rh&&ap(Rh,r)||(Rh=r,r=Gv(yC,"onSelect"),0Du||(t.current=_C[Du],_C[Du]=null,Du--)}function wn(t,e){Du++,_C[Du]=t.current,t.current=e}var El={},Wr=Bl(El),xi=Bl(!1),Mc=El;function Sd(t,e){var n=t.type.contextTypes;if(!n)return El;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function bi(t){return t=t.childContextTypes,t!=null}function Wv(){Pn(xi),Pn(Wr)}function QP(t,e,n){if(Wr.current!==El)throw Error(_e(168));wn(Wr,e),wn(xi,n)}function rL(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(_e(108,eW(t)||"Unknown",i));return Ln({},n,r)}function qv(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||El,Mc=Wr.current,wn(Wr,t),wn(xi,xi.current),!0}function XP(t,e,n){var r=t.stateNode;if(!r)throw Error(_e(169));n?(t=rL(t,e,Mc),r.__reactInternalMemoizedMergedChildContext=t,Pn(xi),Pn(Wr),wn(Wr,t)):Pn(xi),wn(xi,n)}var Ys=null,wb=!1,Bw=!1;function iL(t){Ys===null?Ys=[t]:Ys.push(t)}function v7(t){wb=!0,iL(t)}function Hl(){if(!Bw&&Ys!==null){Bw=!0;var t=0,e=ln;try{var n=Ys;for(ln=1;t>=s,i-=s,Zs=1<<32-Ro(e)+i|n<j?(k=_,_=null):k=_.sibling;var P=h(b,_,w[j],S);if(P===null){_===null&&(_=k);break}t&&_&&P.alternate===null&&e(b,_),x=o(P,x,j),A===null?C=P:A.sibling=P,A=P,_=k}if(j===w.length)return n(b,_),In&&nc(b,j),C;if(_===null){for(;jj?(k=_,_=null):k=_.sibling;var R=h(b,_,P.value,S);if(R===null){_===null&&(_=k);break}t&&_&&R.alternate===null&&e(b,_),x=o(R,x,j),A===null?C=R:A.sibling=R,A=R,_=k}if(P.done)return n(b,_),In&&nc(b,j),C;if(_===null){for(;!P.done;j++,P=w.next())P=f(b,P.value,S),P!==null&&(x=o(P,x,j),A===null?C=P:A.sibling=P,A=P);return In&&nc(b,j),C}for(_=r(b,_);!P.done;j++,P=w.next())P=p(_,b,j,P.value,S),P!==null&&(t&&P.alternate!==null&&_.delete(P.key===null?j:P.key),x=o(P,x,j),A===null?C=P:A.sibling=P,A=P);return t&&_.forEach(function(E){return e(b,E)}),In&&nc(b,j),C}function v(b,x,w,S){if(typeof w=="object"&&w!==null&&w.type===ku&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case xg:e:{for(var C=w.key,A=x;A!==null;){if(A.key===C){if(C=w.type,C===ku){if(A.tag===7){n(b,A.sibling),x=i(A,w.props.children),x.return=b,b=x;break e}}else if(A.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Fa&&ek(C)===A.type){n(b,A.sibling),x=i(A,w.props),x.ref=Xf(b,A,w),x.return=b,b=x;break e}n(b,A);break}else e(b,A);A=A.sibling}w.type===ku?(x=Nc(w.props.children,b.mode,S,w.key),x.return=b,b=x):(S=Sv(w.type,w.key,w.props,null,b.mode,S),S.ref=Xf(b,x,w),S.return=b,b=S)}return s(b);case Pu:e:{for(A=w.key;x!==null;){if(x.key===A)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(b,x.sibling),x=i(x,w.children||[]),x.return=b,b=x;break e}else{n(b,x);break}else e(b,x);x=x.sibling}x=Yw(w,b.mode,S),x.return=b,b=x}return s(b);case Fa:return A=w._init,v(b,x,A(w._payload),S)}if(yh(w))return g(b,x,w,S);if(Kf(w))return m(b,x,w,S);Pg(b,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(n(b,x.sibling),x=i(x,w),x.return=b,b=x):(n(b,x),x=qw(w,b.mode,S),x.return=b,b=x),s(b)):n(b,x)}return v}var Ad=lL(!0),cL=lL(!1),Xv=Bl(null),Zv=null,Fu=null,J_=null;function ej(){J_=Fu=Zv=null}function tj(t){var e=Xv.current;Pn(Xv),t._currentValue=e}function NC(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Xu(t,e){Zv=t,J_=Fu=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(vi=!0),t.firstContext=null)}function ho(t){var e=t._currentValue;if(J_!==t)if(t={context:t,memoizedValue:e,next:null},Fu===null){if(Zv===null)throw Error(_e(308));Fu=t,Zv.dependencies={lanes:0,firstContext:t}}else Fu=Fu.next=t;return e}var uc=null;function nj(t){uc===null?uc=[t]:uc.push(t)}function uL(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,nj(e)):(n.next=i.next,i.next=n),e.interleaved=n,ha(t,r)}function ha(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Ua=!1;function rj(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function dL(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function sa(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function ul(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,qt&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,ha(t,n)}return i=r.interleaved,i===null?(e.next=e,nj(r)):(e.next=i.next,i.next=e),r.interleaved=e,ha(t,n)}function gv(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,H_(t,n)}}function tk(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?i=o=e:o=o.next=e}else i=o=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Jv(t,e,n,r){var i=t.updateQueue;Ua=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,s===null?o=u:s.next=u,s=c;var d=t.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==s&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(o!==null){var f=i.baseState;s=0,d=u=c=null,l=o;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=t,m=l;switch(h=e,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:Ua=!0}}l.callback!==null&&l.lane!==0&&(t.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,s|=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,e=i.shared.interleaved,e!==null){i=e;do s|=i.lane,i=i.next;while(i!==e)}else o===null&&(i.shared.lanes=0);Lc|=s,t.lanes=s,t.memoizedState=f}}function nk(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=zw.transition;zw.transition={};try{t(!1),e()}finally{ln=n,zw.transition=r}}function NL(){return po().memoizedState}function w7(t,e,n){var r=fl(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},TL(t))PL(e,n);else if(n=uL(t,e,n,r),n!==null){var i=ai();Mo(n,t,r,i),kL(n,e,r)}}function S7(t,e,n){var r=fl(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(TL(t))PL(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,l=o(s,n);if(i.hasEagerState=!0,i.eagerState=l,zo(l,s)){var c=e.interleaved;c===null?(i.next=i,nj(e)):(i.next=c.next,c.next=i),e.interleaved=i;return}}catch{}finally{}n=uL(t,e,i,r),n!==null&&(i=ai(),Mo(n,t,r,i),kL(n,e,r))}}function TL(t){var e=t.alternate;return t===$n||e!==null&&e===$n}function PL(t,e){Mh=ty=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function kL(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,H_(t,n)}}var ny={readContext:ho,useCallback:Lr,useContext:Lr,useEffect:Lr,useImperativeHandle:Lr,useInsertionEffect:Lr,useLayoutEffect:Lr,useMemo:Lr,useReducer:Lr,useRef:Lr,useState:Lr,useDebugValue:Lr,useDeferredValue:Lr,useTransition:Lr,useMutableSource:Lr,useSyncExternalStore:Lr,useId:Lr,unstable_isNewReconciler:!1},C7={readContext:ho,useCallback:function(t,e){return os().memoizedState=[t,e===void 0?null:e],t},useContext:ho,useEffect:ik,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,yv(4194308,4,CL.bind(null,e,t),n)},useLayoutEffect:function(t,e){return yv(4194308,4,t,e)},useInsertionEffect:function(t,e){return yv(4,2,t,e)},useMemo:function(t,e){var n=os();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=os();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=w7.bind(null,$n,t),[r.memoizedState,t]},useRef:function(t){var e=os();return t={current:t},e.memoizedState=t},useState:rk,useDebugValue:dj,useDeferredValue:function(t){return os().memoizedState=t},useTransition:function(){var t=rk(!1),e=t[0];return t=b7.bind(null,t[1]),os().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=$n,i=os();if(In){if(n===void 0)throw Error(_e(407));n=n()}else{if(n=e(),Sr===null)throw Error(_e(349));$c&30||mL(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,ik(vL.bind(null,r,o,t),[t]),r.flags|=2048,mp(9,gL.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=os(),e=Sr.identifierPrefix;if(In){var n=Js,r=Zs;n=(r&~(1<<32-Ro(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=hp++,0")&&(c=c.replace("",t.displayName)),c}while(1<=s&&0<=l);break}}}finally{_w=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?gh(t):""}function JK(t){switch(t.tag){case 5:return gh(t.type);case 16:return gh("Lazy");case 13:return gh("Suspense");case 19:return gh("SuspenseList");case 0:case 2:case 15:return t=jw(t.type,!1),t;case 11:return t=jw(t.type.render,!1),t;case 1:return t=jw(t.type,!0),t;default:return""}}function nC(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case ku:return"Fragment";case Pu:return"Portal";case ZS:return"Profiler";case D_:return"StrictMode";case eC:return"Suspense";case tC:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case u$:return(t.displayName||"Context")+".Consumer";case c$:return(t._context.displayName||"Context")+".Provider";case $_:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case L_:return e=t.displayName||null,e!==null?e:nC(t.type)||"Memo";case Fa:e=t._payload,t=t._init;try{return nC(t(e))}catch{}}return null}function ZK(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return nC(e);case 8:return e===D_?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function jl(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function f$(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function eW(t){var e=f$(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function xg(t){t._valueTracker||(t._valueTracker=eW(t))}function h$(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=f$(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function $v(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function rC(t,e){var n=e.checked;return Ln({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function SP(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=jl(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function p$(t,e){e=e.checked,e!=null&&M_(t,"checked",e,!1)}function iC(t,e){p$(t,e);var n=jl(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?oC(t,e.type,n):e.hasOwnProperty("defaultValue")&&oC(t,e.type,jl(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function CP(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function oC(t,e,n){(e!=="number"||$v(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var vh=Array.isArray;function Wu(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=bg.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function ep(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Th={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},tW=["Webkit","ms","Moz","O"];Object.keys(Th).forEach(function(t){tW.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Th[e]=Th[t]})});function y$(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Th.hasOwnProperty(t)&&Th[t]?(""+e).trim():e+"px"}function x$(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=y$(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var nW=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 lC(t,e){if(e){if(nW[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(_e(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(_e(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(_e(61))}if(e.style!=null&&typeof e.style!="object")throw Error(_e(62))}}function cC(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 uC=null;function F_(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var dC=null,qu=null,Yu=null;function jP(t){if(t=Um(t)){if(typeof dC!="function")throw Error(_e(280));var e=t.stateNode;e&&(e=xb(e),dC(t.stateNode,t.type,e))}}function b$(t){qu?Yu?Yu.push(t):Yu=[t]:qu=t}function w$(){if(qu){var t=qu,e=Yu;if(Yu=qu=null,jP(t),e)for(t=0;t>>=0,t===0?32:31-(hW(t)/pW|0)|0}var wg=64,Sg=4194304;function yh(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Bv(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,o=t.pingedLanes,s=n&268435455;if(s!==0){var l=s&~i;l!==0?r=yh(l):(o&=s,o!==0&&(r=yh(o)))}else s=n&~i,s!==0?r=yh(s):o!==0&&(r=yh(o));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function Lm(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Ro(e),t[e]=n}function yW(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=kh),MP=" ",DP=!1;function B$(t,e){switch(t){case"keyup":return KW.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function H$(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ou=!1;function qW(t,e){switch(t){case"compositionend":return H$(e);case"keypress":return e.which!==32?null:(DP=!0,MP);case"textInput":return t=e.data,t===MP&&DP?null:t;default:return null}}function YW(t,e){if(Ou)return t==="compositionend"||!W_&&B$(t,e)?(t=F$(),hv=V_=el=null,Ou=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=UP(n)}}function K$(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?K$(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function W$(){for(var t=window,e=$v();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=$v(t.document)}return e}function q_(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function i7(t){var e=W$(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&K$(n.ownerDocument.documentElement,n)){if(r!==null&&q_(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!t.extend&&o>r&&(i=r,r=o,o=i),i=BP(n,o);var s=BP(n,r);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Iu=null,vC=null,Ih=null,yC=!1;function HP(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;yC||Iu==null||Iu!==$v(r)||(r=Iu,"selectionStart"in r&&q_(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}),Ih&&sp(Ih,r)||(Ih=r,r=Vv(vC,"onSelect"),0Du||(t.current=AC[Du],AC[Du]=null,Du--)}function wn(t,e){Du++,AC[Du]=t.current,t.current=e}var El={},Wr=Bl(El),xi=Bl(!1),Mc=El;function Sd(t,e){var n=t.type.contextTypes;if(!n)return El;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function bi(t){return t=t.childContextTypes,t!=null}function Kv(){Pn(xi),Pn(Wr)}function YP(t,e,n){if(Wr.current!==El)throw Error(_e(168));wn(Wr,e),wn(xi,n)}function nL(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(_e(108,ZK(t)||"Unknown",i));return Ln({},n,r)}function Wv(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||El,Mc=Wr.current,wn(Wr,t),wn(xi,xi.current),!0}function QP(t,e,n){var r=t.stateNode;if(!r)throw Error(_e(169));n?(t=nL(t,e,Mc),r.__reactInternalMemoizedMergedChildContext=t,Pn(xi),Pn(Wr),wn(Wr,t)):Pn(xi),wn(xi,n)}var Ys=null,bb=!1,Uw=!1;function rL(t){Ys===null?Ys=[t]:Ys.push(t)}function g7(t){bb=!0,rL(t)}function Hl(){if(!Uw&&Ys!==null){Uw=!0;var t=0,e=ln;try{var n=Ys;for(ln=1;t>=s,i-=s,Js=1<<32-Ro(e)+i|n<j?(k=_,_=null):k=_.sibling;var P=h(b,_,w[j],S);if(P===null){_===null&&(_=k);break}t&&_&&P.alternate===null&&e(b,_),x=o(P,x,j),A===null?C=P:A.sibling=P,A=P,_=k}if(j===w.length)return n(b,_),In&&nc(b,j),C;if(_===null){for(;jj?(k=_,_=null):k=_.sibling;var I=h(b,_,P.value,S);if(I===null){_===null&&(_=k);break}t&&_&&I.alternate===null&&e(b,_),x=o(I,x,j),A===null?C=I:A.sibling=I,A=I,_=k}if(P.done)return n(b,_),In&&nc(b,j),C;if(_===null){for(;!P.done;j++,P=w.next())P=f(b,P.value,S),P!==null&&(x=o(P,x,j),A===null?C=P:A.sibling=P,A=P);return In&&nc(b,j),C}for(_=r(b,_);!P.done;j++,P=w.next())P=p(_,b,j,P.value,S),P!==null&&(t&&P.alternate!==null&&_.delete(P.key===null?j:P.key),x=o(P,x,j),A===null?C=P:A.sibling=P,A=P);return t&&_.forEach(function(E){return e(b,E)}),In&&nc(b,j),C}function v(b,x,w,S){if(typeof w=="object"&&w!==null&&w.type===ku&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case yg:e:{for(var C=w.key,A=x;A!==null;){if(A.key===C){if(C=w.type,C===ku){if(A.tag===7){n(b,A.sibling),x=i(A,w.props.children),x.return=b,b=x;break e}}else if(A.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Fa&&ZP(C)===A.type){n(b,A.sibling),x=i(A,w.props),x.ref=Xf(b,A,w),x.return=b,b=x;break e}n(b,A);break}else e(b,A);A=A.sibling}w.type===ku?(x=Nc(w.props.children,b.mode,S,w.key),x.return=b,b=x):(S=wv(w.type,w.key,w.props,null,b.mode,S),S.ref=Xf(b,x,w),S.return=b,b=S)}return s(b);case Pu:e:{for(A=w.key;x!==null;){if(x.key===A)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(b,x.sibling),x=i(x,w.children||[]),x.return=b,b=x;break e}else{n(b,x);break}else e(b,x);x=x.sibling}x=qw(w,b.mode,S),x.return=b,b=x}return s(b);case Fa:return A=w._init,v(b,x,A(w._payload),S)}if(vh(w))return g(b,x,w,S);if(Kf(w))return m(b,x,w,S);Tg(b,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(n(b,x.sibling),x=i(x,w),x.return=b,b=x):(n(b,x),x=Ww(w,b.mode,S),x.return=b,b=x),s(b)):n(b,x)}return v}var Ad=aL(!0),lL=aL(!1),Qv=Bl(null),Xv=null,Fu=null,J_=null;function Z_(){J_=Fu=Xv=null}function ej(t){var e=Qv.current;Pn(Qv),t._currentValue=e}function EC(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Xu(t,e){Xv=t,J_=Fu=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(vi=!0),t.firstContext=null)}function ho(t){var e=t._currentValue;if(J_!==t)if(t={context:t,memoizedValue:e,next:null},Fu===null){if(Xv===null)throw Error(_e(308));Fu=t,Xv.dependencies={lanes:0,firstContext:t}}else Fu=Fu.next=t;return e}var uc=null;function tj(t){uc===null?uc=[t]:uc.push(t)}function cL(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,tj(e)):(n.next=i.next,i.next=n),e.interleaved=n,ha(t,r)}function ha(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Ua=!1;function nj(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function uL(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function sa(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function ul(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,qt&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,ha(t,n)}return i=r.interleaved,i===null?(e.next=e,tj(r)):(e.next=i.next,i.next=e),r.interleaved=e,ha(t,n)}function mv(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,B_(t,n)}}function ek(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?i=o=e:o=o.next=e}else i=o=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Jv(t,e,n,r){var i=t.updateQueue;Ua=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,s===null?o=u:s.next=u,s=c;var d=t.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==s&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(o!==null){var f=i.baseState;s=0,d=u=c=null,l=o;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=t,m=l;switch(h=e,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:Ua=!0}}l.callback!==null&&l.lane!==0&&(t.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,s|=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,e=i.shared.interleaved,e!==null){i=e;do s|=i.lane,i=i.next;while(i!==e)}else o===null&&(i.shared.lanes=0);Lc|=s,t.lanes=s,t.memoizedState=f}}function tk(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=Hw.transition;Hw.transition={};try{t(!1),e()}finally{ln=n,Hw.transition=r}}function EL(){return po().memoizedState}function b7(t,e,n){var r=fl(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},NL(t))TL(e,n);else if(n=cL(t,e,n,r),n!==null){var i=ai();Mo(n,t,r,i),PL(n,e,r)}}function w7(t,e,n){var r=fl(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(NL(t))TL(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,l=o(s,n);if(i.hasEagerState=!0,i.eagerState=l,zo(l,s)){var c=e.interleaved;c===null?(i.next=i,tj(e)):(i.next=c.next,c.next=i),e.interleaved=i;return}}catch{}finally{}n=cL(t,e,i,r),n!==null&&(i=ai(),Mo(n,t,r,i),PL(n,e,r))}}function NL(t){var e=t.alternate;return t===$n||e!==null&&e===$n}function TL(t,e){Rh=ey=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function PL(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,B_(t,n)}}var ty={readContext:ho,useCallback:Lr,useContext:Lr,useEffect:Lr,useImperativeHandle:Lr,useInsertionEffect:Lr,useLayoutEffect:Lr,useMemo:Lr,useReducer:Lr,useRef:Lr,useState:Lr,useDebugValue:Lr,useDeferredValue:Lr,useTransition:Lr,useMutableSource:Lr,useSyncExternalStore:Lr,useId:Lr,unstable_isNewReconciler:!1},S7={readContext:ho,useCallback:function(t,e){return os().memoizedState=[t,e===void 0?null:e],t},useContext:ho,useEffect:rk,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,vv(4194308,4,SL.bind(null,e,t),n)},useLayoutEffect:function(t,e){return vv(4194308,4,t,e)},useInsertionEffect:function(t,e){return vv(4,2,t,e)},useMemo:function(t,e){var n=os();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=os();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=b7.bind(null,$n,t),[r.memoizedState,t]},useRef:function(t){var e=os();return t={current:t},e.memoizedState=t},useState:nk,useDebugValue:uj,useDeferredValue:function(t){return os().memoizedState=t},useTransition:function(){var t=nk(!1),e=t[0];return t=x7.bind(null,t[1]),os().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=$n,i=os();if(In){if(n===void 0)throw Error(_e(407));n=n()}else{if(n=e(),Sr===null)throw Error(_e(349));$c&30||pL(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,rk(gL.bind(null,r,o,t),[t]),r.flags|=2048,pp(9,mL.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=os(),e=Sr.identifierPrefix;if(In){var n=Zs,r=Js;n=(r&~(1<<32-Ro(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=fp++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[fs]=e,t[up]=r,BL(t,e,!1,!1),e.stateNode=t;e:{switch(s=uC(n,r),n){case"dialog":An("cancel",t),An("close",t),i=r;break;case"iframe":case"object":case"embed":An("load",t),i=r;break;case"video":case"audio":for(i=0;iEd&&(e.flags|=128,r=!0,Zf(o,!1),e.lanes=4194304)}else{if(!r)if(t=ey(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Zf(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!In)return Fr(e),null}else 2*Wn()-o.renderingStartTime>Ed&&n!==1073741824&&(e.flags|=128,r=!0,Zf(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(n=o.last,n!==null?n.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=Wn(),e.sibling=null,n=Dn.current,wn(Dn,r?n&1|2:n&1),e):(Fr(e),null);case 22:case 23:return vj(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Ii&1073741824&&(Fr(e),e.subtreeFlags&6&&(e.flags|=8192)):Fr(e),null;case 24:return null;case 25:return null}throw Error(_e(156,e.tag))}function k7(t,e){switch(X_(e),e.tag){case 1:return bi(e.type)&&Wv(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return _d(),Pn(xi),Pn(Wr),sj(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return oj(e),null;case 13:if(Pn(Dn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(_e(340));Cd()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Pn(Dn),null;case 4:return _d(),null;case 10:return tj(e.type._context),null;case 22:case 23:return vj(),null;case 24:return null;default:return null}}var Og=!1,Vr=!1,O7=typeof WeakSet=="function"?WeakSet:Set,Ge=null;function Uu(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Bn(t,e,r)}else n.current=null}function $C(t,e,n){try{n()}catch(r){Bn(t,e,r)}}var mk=!1;function I7(t,e){if(bC=zv,t=q$(),Y_(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,l=-1,c=-1,u=0,d=0,f=t,h=null;t:for(;;){for(var p;f!==n||i!==0&&f.nodeType!==3||(l=s+i),f!==o||r!==0&&f.nodeType!==3||(c=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===t)break t;if(h===n&&++u===i&&(l=s),h===o&&++d===r&&(c=s),(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(wC={focusedElem:t,selectionRange:n},zv=!1,Ge=e;Ge!==null;)if(e=Ge,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Ge=t;else for(;Ge!==null;){e=Ge;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,v=g.memoizedState,b=e.stateNode,x=b.getSnapshotBeforeUpdate(e.elementType===e.type?m:Co(e.type,m),v);b.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=e.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(_e(163))}}catch(S){Bn(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,Ge=t;break}Ge=e.return}return g=mk,mk=!1,g}function Dh(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&$C(e,n,o)}i=i.next}while(i!==r)}}function Ab(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function LC(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function VL(t){var e=t.alternate;e!==null&&(t.alternate=null,VL(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[fs],delete e[up],delete e[AC],delete e[m7],delete e[g7])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function GL(t){return t.tag===5||t.tag===3||t.tag===4}function gk(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||GL(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function FC(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Kv));else if(r!==4&&(t=t.child,t!==null))for(FC(t,e,n),t=t.sibling;t!==null;)FC(t,e,n),t=t.sibling}function UC(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(UC(t,e,n),t=t.sibling;t!==null;)UC(t,e,n),t=t.sibling}var Nr=null,jo=!1;function Oa(t,e,n){for(n=n.child;n!==null;)KL(t,e,n),n=n.sibling}function KL(t,e,n){if(xs&&typeof xs.onCommitFiberUnmount=="function")try{xs.onCommitFiberUnmount(gb,n)}catch{}switch(n.tag){case 5:Vr||Uu(n,e);case 6:var r=Nr,i=jo;Nr=null,Oa(t,e,n),Nr=r,jo=i,Nr!==null&&(jo?(t=Nr,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Nr.removeChild(n.stateNode));break;case 18:Nr!==null&&(jo?(t=Nr,n=n.stateNode,t.nodeType===8?Uw(t.parentNode,n):t.nodeType===1&&Uw(t,n),op(t)):Uw(Nr,n.stateNode));break;case 4:r=Nr,i=jo,Nr=n.stateNode.containerInfo,jo=!0,Oa(t,e,n),Nr=r,jo=i;break;case 0:case 11:case 14:case 15:if(!Vr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&$C(n,e,s),i=i.next}while(i!==r)}Oa(t,e,n);break;case 1:if(!Vr&&(Uu(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Bn(n,e,l)}Oa(t,e,n);break;case 21:Oa(t,e,n);break;case 22:n.mode&1?(Vr=(r=Vr)||n.memoizedState!==null,Oa(t,e,n),Vr=r):Oa(t,e,n);break;default:Oa(t,e,n)}}function vk(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new O7),e.forEach(function(r){var i=H7.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function xo(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=Wn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*M7(r/1960))-r,10t?16:t,tl===null)var r=!1;else{if(t=tl,tl=null,oy=0,qt&6)throw Error(_e(331));var i=qt;for(qt|=4,Ge=t.current;Ge!==null;){var o=Ge,s=o.child;if(Ge.flags&16){var l=o.deletions;if(l!==null){for(var c=0;cWn()-mj?Ec(t,0):pj|=n),wi(t,e)}function eF(t,e){e===0&&(t.mode&1?(e=Cg,Cg<<=1,!(Cg&130023424)&&(Cg=4194304)):e=1);var n=ai();t=ha(t,e),t!==null&&(Fm(t,e,n),wi(t,n))}function B7(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),eF(t,n)}function H7(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(_e(314))}r!==null&&r.delete(e),eF(t,n)}var tF;tF=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||xi.current)vi=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return vi=!1,T7(t,e,n);vi=!!(t.flags&131072)}else vi=!1,In&&e.flags&1048576&&oL(e,Qv,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;xv(t,e),t=e.pendingProps;var i=Sd(e,Wr.current);Xu(e,n),i=lj(null,e,r,t,i,n);var o=cj();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,bi(r)?(o=!0,qv(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,rj(e),i.updater=Cb,e.stateNode=i,i._reactInternals=e,PC(e,r,t,n),e=IC(null,e,r,!0,o,n)):(e.tag=0,In&&o&&Q_(e),Jr(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(xv(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=V7(r),t=Co(r,t),i){case 0:e=OC(null,e,r,t,n);break e;case 1:e=fk(null,e,r,t,n);break e;case 11:e=uk(null,e,r,t,n);break e;case 14:e=dk(null,e,r,Co(r.type,t),n);break e}throw Error(_e(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Co(r,i),OC(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Co(r,i),fk(t,e,r,i,n);case 3:e:{if(LL(e),t===null)throw Error(_e(387));r=e.pendingProps,o=e.memoizedState,i=o.element,dL(t,e),Jv(e,r,null,n);var s=e.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=jd(Error(_e(423)),e),e=hk(t,e,r,n,i);break e}else if(r!==i){i=jd(Error(_e(424)),e),e=hk(t,e,r,n,i);break e}else for(Li=cl(e.stateNode.containerInfo.firstChild),Fi=e,In=!0,To=null,n=cL(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Cd(),r===i){e=pa(t,e,n);break e}Jr(t,e,r,n)}e=e.child}return e;case 5:return fL(e),t===null&&EC(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,SC(r,i)?s=null:o!==null&&SC(r,o)&&(e.flags|=32),$L(t,e),Jr(t,e,s,n),e.child;case 6:return t===null&&EC(e),null;case 13:return FL(t,e,n);case 4:return ij(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Ad(e,null,r,n):Jr(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Co(r,i),uk(t,e,r,i,n);case 7:return Jr(t,e,e.pendingProps,n),e.child;case 8:return Jr(t,e,e.pendingProps.children,n),e.child;case 12:return Jr(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,wn(Xv,r._currentValue),r._currentValue=s,o!==null)if(zo(o.value,s)){if(o.children===i.children&&!xi.current){e=pa(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var l=o.dependencies;if(l!==null){s=o.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(o.tag===1){c=sa(-1,n&-n),c.tag=2;var u=o.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}}o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),NC(o.return,n,e),l.lanes|=n;break}c=c.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(_e(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),NC(s,n,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Jr(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Xu(e,n),i=ho(i),r=r(i),e.flags|=1,Jr(t,e,r,n),e.child;case 14:return r=e.type,i=Co(r,e.pendingProps),i=Co(r.type,i),dk(t,e,r,i,n);case 15:return ML(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Co(r,i),xv(t,e),e.tag=1,bi(r)?(t=!0,qv(e)):t=!1,Xu(e,n),OL(e,r,i),PC(e,r,i,n),IC(null,e,r,!0,t,n);case 19:return UL(t,e,n);case 22:return DL(t,e,n)}throw Error(_e(156,e.tag))};function nF(t,e){return T$(t,e)}function z7(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,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 ao(t,e,n,r){return new z7(t,e,n,r)}function xj(t){return t=t.prototype,!(!t||!t.isReactComponent)}function V7(t){if(typeof t=="function")return xj(t)?1:0;if(t!=null){if(t=t.$$typeof,t===L_)return 11;if(t===F_)return 14}return 2}function hl(t,e){var n=t.alternate;return n===null?(n=ao(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Sv(t,e,n,r,i,o){var s=2;if(r=t,typeof t=="function")xj(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case ku:return Nc(n.children,i,o,e);case $_:s=8,i|=8;break;case eC:return t=ao(12,n,e,i|2),t.elementType=eC,t.lanes=o,t;case tC:return t=ao(13,n,e,i),t.elementType=tC,t.lanes=o,t;case nC:return t=ao(19,n,e,i),t.elementType=nC,t.lanes=o,t;case f$:return jb(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case u$:s=10;break e;case d$:s=9;break e;case L_:s=11;break e;case F_:s=14;break e;case Fa:s=16,r=null;break e}throw Error(_e(130,t==null?t:typeof t,""))}return e=ao(s,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function Nc(t,e,n,r){return t=ao(7,t,r,e),t.lanes=n,t}function jb(t,e,n,r){return t=ao(22,t,r,e),t.elementType=f$,t.lanes=n,t.stateNode={isHidden:!1},t}function qw(t,e,n){return t=ao(6,t,null,e),t.lanes=n,t}function Yw(t,e,n){return e=ao(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function G7(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Tw(0),this.expirationTimes=Tw(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tw(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function bj(t,e,n,r,i,o,s,l,c){return t=new G7(t,e,n,l,c),e===1?(e=1,o===!0&&(e|=8)):e=0,o=ao(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},rj(o),t}function K7(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(sF)}catch(t){console.error(t)}}sF(),s$.exports=Gi;var ff=s$.exports;const aF=en(ff);var lF,_k=ff;lF=_k.createRoot,_k.hydrateRoot;var jk=["light","dark"],X7="(prefers-color-scheme: dark)",Z7=y.createContext(void 0),J7={setTheme:t=>{},themes:[]},eq=()=>{var t;return(t=y.useContext(Z7))!=null?t:J7};y.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:o,value:s,attrs:l,nonce:c})=>{let u=o==="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?jk.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",h=(g,m=!1,v=!0)=>{let b=s?s[g]:g,x=m?g+"|| ''":`'${b}'`,w="";return i&&v&&!m&&jk.includes(g)&&(w+=`d.style.colorScheme = '${g}';`),n==="class"?m||b?w+=`c.add(${x})`:w+="null":b&&(w+=`d[s](n,${x})`),w},p=t?`!function(){${d}${h(t)}}()`:r?`!function(){try{${d}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${u})){var t='${X7}',m=window.matchMedia(t);if(m.media!==t||m.matches){${h("dark")}}else{${h("light")}}}else if(e){${s?`var x=${JSON.stringify(s)};`:""}${h(s?"x[e]":"e",!0)}}${u?"":"else{"+h(o,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${e}');if(e){${s?`var x=${JSON.stringify(s)};`:""}${h(s?"x[e]":"e",!0)}}else{${h(o,!1,!1)};}${f}}catch(t){}}();`;return y.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:p}})});var tq=t=>{switch(t){case"success":return iq;case"info":return sq;case"warning":return oq;case"error":return aq;default:return null}},nq=Array(12).fill(0),rq=({visible:t})=>T.createElement("div",{className:"sonner-loading-wrapper","data-visible":t},T.createElement("div",{className:"sonner-spinner"},nq.map((e,n)=>T.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),iq=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.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"})),oq=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},T.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"})),sq=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.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"})),aq=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.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"})),lq=()=>{let[t,e]=T.useState(document.hidden);return T.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},GC=1,cq=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:n,...r}=t,i=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:GC++,o=this.toasts.find(l=>l.id===i),s=t.dismissible===void 0?!0:t.dismissible;return o?this.toasts=this.toasts.map(l=>l.id===i?(this.publish({...l,...t,id:i,title:n}),{...l,...t,id:i,dismissible:s,title:n}):l):this.addToast({title:n,...r,dismissible:s,id:i}),i},this.dismiss=t=>(t||this.toasts.forEach(e=>{this.subscribers.forEach(n=>n({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let n;e.loading!==void 0&&(n=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let r=t instanceof Promise?t:t(),i=n!==void 0;return r.then(async o=>{if(dq(o)&&!o.ok){i=!1;let s=typeof e.error=="function"?await e.error(`HTTP error! status: ${o.status}`):e.error,l=typeof e.description=="function"?await e.description(`HTTP error! status: ${o.status}`):e.description;this.create({id:n,type:"error",message:s,description:l})}else if(e.success!==void 0){i=!1;let s=typeof e.success=="function"?await e.success(o):e.success,l=typeof e.description=="function"?await e.description(o):e.description;this.create({id:n,type:"success",message:s,description:l})}}).catch(async o=>{if(e.error!==void 0){i=!1;let s=typeof e.error=="function"?await e.error(o):e.error,l=typeof e.description=="function"?await e.description(o):e.description;this.create({id:n,type:"error",message:s,description:l})}}).finally(()=>{var o;i&&(this.dismiss(n),n=void 0),(o=e.finally)==null||o.call(e)}),n},this.custom=(t,e)=>{let n=(e==null?void 0:e.id)||GC++;return this.create({jsx:t(n),id:n,...e}),n},this.subscribers=[],this.toasts=[]}},Oi=new cq,uq=(t,e)=>{let n=(e==null?void 0:e.id)||GC++;return Oi.addToast({title:t,...e,id:n}),n},dq=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",fq=uq,hq=()=>Oi.toasts,se=Object.assign(fq,{success:Oi.success,info:Oi.info,warning:Oi.warning,error:Oi.error,custom:Oi.custom,message:Oi.message,promise:Oi.promise,dismiss:Oi.dismiss,loading:Oi.loading},{getHistory:hq});function pq(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}pq(`: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 Mg(t){return t.label!==void 0}var mq=3,gq="32px",vq=4e3,yq=356,xq=14,bq=20,wq=200;function Sq(...t){return t.filter(Boolean).join(" ")}var Cq=t=>{var e,n,r,i,o,s,l,c,u,d;let{invert:f,toast:h,unstyled:p,interacting:g,setHeights:m,visibleToasts:v,heights:b,index:x,toasts:w,expanded:S,removeToast:C,defaultRichColors:A,closeButton:_,style:j,cancelButtonStyle:k,actionButtonStyle:P,className:R="",descriptionClassName:E="",duration:I,position:L,gap:V,loadingIcon:$,expandByDefault:z,classNames:M,icons:U,closeButtonAriaLabel:K="Close toast",pauseWhenPageIsHidden:X,cn:re}=t,[xe,F]=T.useState(!1),[ue,ie]=T.useState(!1),[ce,Me]=T.useState(!1),[pe,Se]=T.useState(!1),[Te,ne]=T.useState(0),[rt,Fe]=T.useState(0),vt=T.useRef(null),mt=T.useRef(null),Bt=x===0,N=x+1<=v,D=h.type,H=h.dismissible!==!1,Q=h.className||"",Z=h.descriptionClassName||"",B=T.useMemo(()=>b.findIndex(yt=>yt.toastId===h.id)||0,[b,h.id]),ee=T.useMemo(()=>{var yt;return(yt=h.closeButton)!=null?yt:_},[h.closeButton,_]),me=T.useMemo(()=>h.duration||I||vq,[h.duration,I]),Ce=T.useRef(0),De=T.useRef(0),we=T.useRef(0),We=T.useRef(null),[St,Tt]=L.split("-"),Ze=T.useMemo(()=>b.reduce((yt,Xe,ft)=>ft>=B?yt:yt+Xe.height,0),[b,B]),Qe=lq(),$t=h.invert||f,Yt=D==="loading";De.current=T.useMemo(()=>B*V+Ze,[B,Ze]),T.useEffect(()=>{F(!0)},[]),T.useLayoutEffect(()=>{if(!xe)return;let yt=mt.current,Xe=yt.style.height;yt.style.height="auto";let ft=yt.getBoundingClientRect().height;yt.style.height=Xe,Fe(ft),m(Vt=>Vt.find(vn=>vn.toastId===h.id)?Vt.map(vn=>vn.toastId===h.id?{...vn,height:ft}:vn):[{toastId:h.id,height:ft,position:h.position},...Vt])},[xe,h.title,h.description,m,h.id]);let _r=T.useCallback(()=>{ie(!0),ne(De.current),m(yt=>yt.filter(Xe=>Xe.toastId!==h.id)),setTimeout(()=>{C(h)},wq)},[h,C,m,De]);T.useEffect(()=>{if(h.promise&&D==="loading"||h.duration===1/0||h.type==="loading")return;let yt,Xe=me;return S||g||X&&Qe?(()=>{if(we.current{var ft;(ft=h.onAutoClose)==null||ft.call(h,h),_r()},Xe)),()=>clearTimeout(yt)},[S,g,z,h,me,_r,h.promise,D,X,Qe]),T.useEffect(()=>{let yt=mt.current;if(yt){let Xe=yt.getBoundingClientRect().height;return Fe(Xe),m(ft=>[{toastId:h.id,height:Xe,position:h.position},...ft]),()=>m(ft=>ft.filter(Vt=>Vt.toastId!==h.id))}},[m,h.id]),T.useEffect(()=>{h.delete&&_r()},[_r,h.delete]);function Sn(){return U!=null&&U.loading?T.createElement("div",{className:"sonner-loader","data-visible":D==="loading"},U.loading):$?T.createElement("div",{className:"sonner-loader","data-visible":D==="loading"},$):T.createElement(rq,{visible:D==="loading"})}return T.createElement("li",{"aria-live":h.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:mt,className:re(R,Q,M==null?void 0:M.toast,(e=h==null?void 0:h.classNames)==null?void 0:e.toast,M==null?void 0:M.default,M==null?void 0:M[D],(n=h==null?void 0:h.classNames)==null?void 0:n[D]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:A,"data-styled":!(h.jsx||h.unstyled||p),"data-mounted":xe,"data-promise":!!h.promise,"data-removed":ue,"data-visible":N,"data-y-position":St,"data-x-position":Tt,"data-index":x,"data-front":Bt,"data-swiping":ce,"data-dismissible":H,"data-type":D,"data-invert":$t,"data-swipe-out":pe,"data-expanded":!!(S||z&&xe),style:{"--index":x,"--toasts-before":x,"--z-index":w.length-x,"--offset":`${ue?Te:De.current}px`,"--initial-height":z?"auto":`${rt}px`,...j,...h.style},onPointerDown:yt=>{Yt||!H||(vt.current=new Date,ne(De.current),yt.target.setPointerCapture(yt.pointerId),yt.target.tagName!=="BUTTON"&&(Me(!0),We.current={x:yt.clientX,y:yt.clientY}))},onPointerUp:()=>{var yt,Xe,ft,Vt;if(pe||!H)return;We.current=null;let vn=Number(((yt=mt.current)==null?void 0:yt.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Wi=new Date().getTime()-((Xe=vt.current)==null?void 0:Xe.getTime()),Ls=Math.abs(vn)/Wi;if(Math.abs(vn)>=bq||Ls>.11){ne(De.current),(ft=h.onDismiss)==null||ft.call(h,h),_r(),Se(!0);return}(Vt=mt.current)==null||Vt.style.setProperty("--swipe-amount","0px"),Me(!1)},onPointerMove:yt=>{var Xe;if(!We.current||!H)return;let ft=yt.clientY-We.current.y,Vt=yt.clientX-We.current.x,vn=(St==="top"?Math.min:Math.max)(0,ft),Wi=yt.pointerType==="touch"?10:2;Math.abs(vn)>Wi?(Xe=mt.current)==null||Xe.style.setProperty("--swipe-amount",`${ft}px`):Math.abs(Vt)>Wi&&(We.current=null)}},ee&&!h.jsx?T.createElement("button",{"aria-label":K,"data-disabled":Yt,"data-close-button":!0,onClick:Yt||!H?()=>{}:()=>{var yt;_r(),(yt=h.onDismiss)==null||yt.call(h,h)},className:re(M==null?void 0:M.closeButton,(i=h==null?void 0:h.classNames)==null?void 0:i.closeButton)},T.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"},T.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),T.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,h.jsx||T.isValidElement(h.title)?h.jsx||h.title:T.createElement(T.Fragment,null,D||h.icon||h.promise?T.createElement("div",{"data-icon":"",className:re(M==null?void 0:M.icon,(o=h==null?void 0:h.classNames)==null?void 0:o.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Sn():null,h.type!=="loading"?h.icon||(U==null?void 0:U[D])||tq(D):null):null,T.createElement("div",{"data-content":"",className:re(M==null?void 0:M.content,(s=h==null?void 0:h.classNames)==null?void 0:s.content)},T.createElement("div",{"data-title":"",className:re(M==null?void 0:M.title,(l=h==null?void 0:h.classNames)==null?void 0:l.title)},h.title),h.description?T.createElement("div",{"data-description":"",className:re(E,Z,M==null?void 0:M.description,(c=h==null?void 0:h.classNames)==null?void 0:c.description)},h.description):null),T.isValidElement(h.cancel)?h.cancel:h.cancel&&Mg(h.cancel)?T.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||k,onClick:yt=>{var Xe,ft;Mg(h.cancel)&&H&&((ft=(Xe=h.cancel).onClick)==null||ft.call(Xe,yt),_r())},className:re(M==null?void 0:M.cancelButton,(u=h==null?void 0:h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,T.isValidElement(h.action)?h.action:h.action&&Mg(h.action)?T.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||P,onClick:yt=>{var Xe,ft;Mg(h.action)&&(yt.defaultPrevented||((ft=(Xe=h.action).onClick)==null||ft.call(Xe,yt),_r()))},className:re(M==null?void 0:M.actionButton,(d=h==null?void 0:h.classNames)==null?void 0:d.actionButton)},h.action.label):null))};function Ek(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}var Aq=t=>{let{invert:e,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:i,closeButton:o,className:s,offset:l,theme:c="light",richColors:u,duration:d,style:f,visibleToasts:h=mq,toastOptions:p,dir:g=Ek(),gap:m=xq,loadingIcon:v,icons:b,containerAriaLabel:x="Notifications",pauseWhenPageIsHidden:w,cn:S=Sq}=t,[C,A]=T.useState([]),_=T.useMemo(()=>Array.from(new Set([n].concat(C.filter(X=>X.position).map(X=>X.position)))),[C,n]),[j,k]=T.useState([]),[P,R]=T.useState(!1),[E,I]=T.useState(!1),[L,V]=T.useState(c!=="system"?c:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),$=T.useRef(null),z=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=T.useRef(null),U=T.useRef(!1),K=T.useCallback(X=>{var re;(re=C.find(xe=>xe.id===X.id))!=null&&re.delete||Oi.dismiss(X.id),A(xe=>xe.filter(({id:F})=>F!==X.id))},[C]);return T.useEffect(()=>Oi.subscribe(X=>{if(X.dismiss){A(re=>re.map(xe=>xe.id===X.id?{...xe,delete:!0}:xe));return}setTimeout(()=>{aF.flushSync(()=>{A(re=>{let xe=re.findIndex(F=>F.id===X.id);return xe!==-1?[...re.slice(0,xe),{...re[xe],...X},...re.slice(xe+1)]:[X,...re]})})})}),[]),T.useEffect(()=>{if(c!=="system"){V(c);return}c==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?V("dark"):V("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:X})=>{V(X?"dark":"light")})},[c]),T.useEffect(()=>{C.length<=1&&R(!1)},[C]),T.useEffect(()=>{let X=re=>{var xe,F;r.every(ue=>re[ue]||re.code===ue)&&(R(!0),(xe=$.current)==null||xe.focus()),re.code==="Escape"&&(document.activeElement===$.current||(F=$.current)!=null&&F.contains(document.activeElement))&&R(!1)};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[r]),T.useEffect(()=>{if($.current)return()=>{M.current&&(M.current.focus({preventScroll:!0}),M.current=null,U.current=!1)}},[$.current]),C.length?T.createElement("section",{"aria-label":`${x} ${z}`,tabIndex:-1},_.map((X,re)=>{var xe;let[F,ue]=X.split("-");return T.createElement("ol",{key:X,dir:g==="auto"?Ek():g,tabIndex:-1,ref:$,className:s,"data-sonner-toaster":!0,"data-theme":L,"data-y-position":F,"data-x-position":ue,style:{"--front-toast-height":`${((xe=j[0])==null?void 0:xe.height)||0}px`,"--offset":typeof l=="number"?`${l}px`:l||gq,"--width":`${yq}px`,"--gap":`${m}px`,...f},onBlur:ie=>{U.current&&!ie.currentTarget.contains(ie.relatedTarget)&&(U.current=!1,M.current&&(M.current.focus({preventScroll:!0}),M.current=null))},onFocus:ie=>{ie.target instanceof HTMLElement&&ie.target.dataset.dismissible==="false"||U.current||(U.current=!0,M.current=ie.relatedTarget)},onMouseEnter:()=>R(!0),onMouseMove:()=>R(!0),onMouseLeave:()=>{E||R(!1)},onPointerDown:ie=>{ie.target instanceof HTMLElement&&ie.target.dataset.dismissible==="false"||I(!0)},onPointerUp:()=>I(!1)},C.filter(ie=>!ie.position&&re===0||ie.position===X).map((ie,ce)=>{var Me,pe;return T.createElement(Cq,{key:ie.id,icons:b,index:ce,toast:ie,defaultRichColors:u,duration:(Me=p==null?void 0:p.duration)!=null?Me:d,className:p==null?void 0:p.className,descriptionClassName:p==null?void 0:p.descriptionClassName,invert:e,visibleToasts:h,closeButton:(pe=p==null?void 0:p.closeButton)!=null?pe:o,interacting:E,position:X,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:K,toasts:C.filter(Se=>Se.position==ie.position),heights:j.filter(Se=>Se.position==ie.position),setHeights:k,expandByDefault:i,gap:m,loadingIcon:v,expanded:P,pauseWhenPageIsHidden:w,cn:S})}))})):null};const _q=({...t})=>{const{theme:e="system"}=eq();return a.jsx(Aq,{theme:e,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"}},...t})};function Pe(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function jq(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function kb(...t){return e=>t.forEach(n=>jq(n,e))}function _t(...t){return y.useCallback(kb(...t),t)}function Eq(t,e){const n=y.createContext(e),r=o=>{const{children:s,...l}=o,c=y.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:s})};r.displayName=t+"Provider";function i(o){const s=y.useContext(n);if(s)return s;if(e!==void 0)return e;throw new Error(`\`${o}\` must be used within \`${t}\``)}return[r,i]}function ji(t,e=[]){let n=[];function r(o,s){const l=y.createContext(s),c=n.length;n=[...n,s];const u=f=>{var b;const{scope:h,children:p,...g}=f,m=((b=h==null?void 0:h[t])==null?void 0:b[c])||l,v=y.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:v,children:p})};u.displayName=o+"Provider";function d(f,h){var m;const p=((m=h==null?void 0:h[t])==null?void 0:m[c])||l,g=y.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[u,d]}const i=()=>{const o=n.map(s=>y.createContext(s));return function(l){const c=(l==null?void 0:l[t])||o;return y.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,Nq(i,...e)]}function Nq(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(o)[`__scope${u}`];return{...l,...f}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var Es=y.forwardRef((t,e)=>{const{children:n,...r}=t,i=y.Children.toArray(n),o=i.find(Tq);if(o){const s=o.props.children,l=i.map(c=>c===o?y.Children.count(s)>1?y.Children.only(null):y.isValidElement(s)?s.props.children:null:c);return a.jsx(KC,{...r,ref:e,children:y.isValidElement(s)?y.cloneElement(s,void 0,l):null})}return a.jsx(KC,{...r,ref:e,children:n})});Es.displayName="Slot";var KC=y.forwardRef((t,e)=>{const{children:n,...r}=t;if(y.isValidElement(n)){const i=kq(n);return y.cloneElement(n,{...Pq(r,n.props),ref:e?kb(e,i):i})}return y.Children.count(n)>1?y.Children.only(null):null});KC.displayName="SlotClone";var Aj=({children:t})=>a.jsx(a.Fragment,{children:t});function Tq(t){return y.isValidElement(t)&&t.type===Aj}function Pq(t,e){const n={...e};for(const r in e){const i=t[r],o=e[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...l)=>{o(...l),i(...l)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...t,...n}}function kq(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Oq=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],et=Oq.reduce((t,e)=>{const n=y.forwardRef((r,i)=>{const{asChild:o,...s}=r,l=o?Es:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(l,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function cF(t,e){t&&ff.flushSync(()=>t.dispatchEvent(e))}function dr(t){const e=y.useRef(t);return y.useEffect(()=>{e.current=t}),y.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function Iq(t,e=globalThis==null?void 0:globalThis.document){const n=dr(t);y.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var Rq="DismissableLayer",WC="dismissableLayer.update",Mq="dismissableLayer.pointerDownOutside",Dq="dismissableLayer.focusOutside",Nk,uF=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zm=y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:l,...c}=t,u=y.useContext(uF),[d,f]=y.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=y.useState({}),g=_t(e,_=>f(_)),m=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(v),x=d?m.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=x>=b,C=Fq(_=>{const j=_.target,k=[...u.branches].some(P=>P.contains(j));!S||k||(i==null||i(_),s==null||s(_),_.defaultPrevented||l==null||l())},h),A=Uq(_=>{const j=_.target;[...u.branches].some(P=>P.contains(j))||(o==null||o(_),s==null||s(_),_.defaultPrevented||l==null||l())},h);return Iq(_=>{x===u.layers.size-1&&(r==null||r(_),!_.defaultPrevented&&l&&(_.preventDefault(),l()))},h),y.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Nk=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Tk(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Nk)}},[d,h,n,u]),y.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Tk())},[d,u]),y.useEffect(()=>{const _=()=>p({});return document.addEventListener(WC,_),()=>document.removeEventListener(WC,_)},[]),a.jsx(et.div,{...c,ref:g,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:Pe(t.onFocusCapture,A.onFocusCapture),onBlurCapture:Pe(t.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Pe(t.onPointerDownCapture,C.onPointerDownCapture)})});zm.displayName=Rq;var $q="DismissableLayerBranch",Lq=y.forwardRef((t,e)=>{const n=y.useContext(uF),r=y.useRef(null),i=_t(e,r);return y.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),a.jsx(et.div,{...t,ref:i})});Lq.displayName=$q;function Fq(t,e=globalThis==null?void 0:globalThis.document){const n=dr(t),r=y.useRef(!1),i=y.useRef(()=>{});return y.useEffect(()=>{const o=l=>{if(l.target&&!r.current){let c=function(){dF(Mq,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=c,e.addEventListener("click",i.current,{once:!0})):c()}else e.removeEventListener("click",i.current);r.current=!1},s=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",o),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function Uq(t,e=globalThis==null?void 0:globalThis.document){const n=dr(t),r=y.useRef(!1);return y.useEffect(()=>{const i=o=>{o.target&&!r.current&&dF(Dq,n,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Tk(){const t=new CustomEvent(WC);document.dispatchEvent(t)}function dF(t,e,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?cF(i,o):i.dispatchEvent(o)}var Rr=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},Bq=i$.useId||(()=>{}),Hq=0;function Do(t){const[e,n]=y.useState(Bq());return Rr(()=>{n(r=>r??String(Hq++))},[t]),e?`radix-${e}`:""}const zq=["top","right","bottom","left"],Nl=Math.min,Di=Math.max,ly=Math.round,Dg=Math.floor,Tl=t=>({x:t,y:t}),Vq={left:"right",right:"left",bottom:"top",top:"bottom"},Gq={start:"end",end:"start"};function qC(t,e,n){return Di(t,Nl(e,n))}function ma(t,e){return typeof t=="function"?t(e):t}function ga(t){return t.split("-")[0]}function hf(t){return t.split("-")[1]}function _j(t){return t==="x"?"y":"x"}function jj(t){return t==="y"?"height":"width"}function Pl(t){return["top","bottom"].includes(ga(t))?"y":"x"}function Ej(t){return _j(Pl(t))}function Kq(t,e,n){n===void 0&&(n=!1);const r=hf(t),i=Ej(t),o=jj(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=cy(s)),[s,cy(s)]}function Wq(t){const e=cy(t);return[YC(t),e,YC(e)]}function YC(t){return t.replace(/start|end/g,e=>Gq[e])}function qq(t,e,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?o:s;default:return[]}}function Yq(t,e,n,r){const i=hf(t);let o=qq(ga(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(YC)))),o}function cy(t){return t.replace(/left|right|bottom|top/g,e=>Vq[e])}function Qq(t){return{top:0,right:0,bottom:0,left:0,...t}}function fF(t){return typeof t!="number"?Qq(t):{top:t,right:t,bottom:t,left:t}}function uy(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function Pk(t,e,n){let{reference:r,floating:i}=t;const o=Pl(e),s=Ej(e),l=jj(s),c=ga(e),u=o==="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(hf(e)){case"start":p[s]-=h*(n&&u?-1:1);break;case"end":p[s]+=h*(n&&u?-1:1);break}return p}const Xq=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,l=o.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(e));let u=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:d,y:f}=Pk(u,r,c),h=r,p={},g=0;for(let m=0;m({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:s,elements:l,middlewareData:c}=e,{element:u,padding:d=0}=ma(t,e)||{};if(u==null)return{};const f=fF(d),h={x:n,y:r},p=Ej(i),g=jj(p),m=await s.getDimensions(u),v=p==="y",b=v?"top":"left",x=v?"bottom":"right",w=v?"clientHeight":"clientWidth",S=o.reference[g]+o.reference[p]-h[p]-o.floating[g],C=h[p]-o.reference[p],A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let _=A?A[w]:0;(!_||!await(s.isElement==null?void 0:s.isElement(A)))&&(_=l.floating[w]||o.floating[g]);const j=S/2-C/2,k=_/2-m[g]/2-1,P=Nl(f[b],k),R=Nl(f[x],k),E=P,I=_-m[g]-R,L=_/2-m[g]/2+j,V=qC(E,L,I),$=!c.arrow&&hf(i)!=null&&L!==V&&o.reference[g]/2-(LL<=0)){var R,E;const L=(((R=o.flip)==null?void 0:R.index)||0)+1,V=_[L];if(V)return{data:{index:L,overflows:P},reset:{placement:V}};let $=(E=P.filter(z=>z.overflows[0]<=0).sort((z,M)=>z.overflows[1]-M.overflows[1])[0])==null?void 0:E.placement;if(!$)switch(p){case"bestFit":{var I;const z=(I=P.filter(M=>{if(A){const U=Pl(M.placement);return U===x||U==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(U=>U>0).reduce((U,K)=>U+K,0)]).sort((M,U)=>M[1]-U[1])[0])==null?void 0:I[0];z&&($=z);break}case"initialPlacement":$=l;break}if(i!==$)return{reset:{placement:$}}}return{}}}};function kk(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Ok(t){return zq.some(e=>t[e]>=0)}const e9=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=ma(t,e);switch(r){case"referenceHidden":{const o=await vp(e,{...i,elementContext:"reference"}),s=kk(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Ok(s)}}}case"escaped":{const o=await vp(e,{...i,altBoundary:!0}),s=kk(o,n.floating);return{data:{escapedOffsets:s,escaped:Ok(s)}}}default:return{}}}}};async function t9(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=ga(n),l=hf(n),c=Pl(n)==="y",u=["left","top"].includes(s)?-1:1,d=o&&c?-1:1,f=ma(e,t);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 n9=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:o,placement:s,middlewareData:l}=e,c=await t9(e,t);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:o+c.y,data:{...c,placement:s}}}}},r9=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:s=!1,limiter:l={fn:v=>{let{x:b,y:x}=v;return{x:b,y:x}}},...c}=ma(t,e),u={x:n,y:r},d=await vp(e,c),f=Pl(ga(i)),h=_j(f);let p=u[h],g=u[f];if(o){const v=h==="y"?"top":"left",b=h==="y"?"bottom":"right",x=p+d[v],w=p-d[b];p=qC(x,p,w)}if(s){const v=f==="y"?"top":"left",b=f==="y"?"bottom":"right",x=g+d[v],w=g-d[b];g=qC(x,g,w)}const m=l.fn({...e,[h]:p,[f]:g});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:o,[f]:s}}}}}},i9=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:o,middlewareData:s}=e,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=ma(t,e),d={x:n,y:r},f=Pl(i),h=_j(f);let p=d[h],g=d[f];const m=ma(l,e),v=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const w=h==="y"?"height":"width",S=o.reference[h]-o.floating[w]+v.mainAxis,C=o.reference[h]+o.reference[w]-v.mainAxis;pC&&(p=C)}if(u){var b,x;const w=h==="y"?"width":"height",S=["top","left"].includes(ga(i)),C=o.reference[f]-o.floating[w]+(S&&((b=s.offset)==null?void 0:b[f])||0)+(S?0:v.crossAxis),A=o.reference[f]+o.reference[w]+(S?0:((x=s.offset)==null?void 0:x[f])||0)-(S?v.crossAxis:0);gA&&(g=A)}return{[h]:p,[f]:g}}}},o9=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:o,platform:s,elements:l}=e,{apply:c=()=>{},...u}=ma(t,e),d=await vp(e,u),f=ga(i),h=hf(i),p=Pl(i)==="y",{width:g,height:m}=o.floating;let v,b;f==="top"||f==="bottom"?(v=f,b=h===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(b=f,v=h==="end"?"top":"bottom");const x=m-d.top-d.bottom,w=g-d.left-d.right,S=Nl(m-d[v],x),C=Nl(g-d[b],w),A=!e.middlewareData.shift;let _=S,j=C;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(j=w),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(_=x),A&&!h){const P=Di(d.left,0),R=Di(d.right,0),E=Di(d.top,0),I=Di(d.bottom,0);p?j=g-2*(P!==0||R!==0?P+R:Di(d.left,d.right)):_=m-2*(E!==0||I!==0?E+I:Di(d.top,d.bottom))}await c({...e,availableWidth:j,availableHeight:_});const k=await s.getDimensions(l.floating);return g!==k.width||m!==k.height?{reset:{rects:!0}}:{}}}};function Ob(){return typeof window<"u"}function pf(t){return hF(t)?(t.nodeName||"").toLowerCase():"#document"}function Ui(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Rs(t){var e;return(e=(hF(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function hF(t){return Ob()?t instanceof Node||t instanceof Ui(t).Node:!1}function Vo(t){return Ob()?t instanceof Element||t instanceof Ui(t).Element:!1}function Ns(t){return Ob()?t instanceof HTMLElement||t instanceof Ui(t).HTMLElement:!1}function Ik(t){return!Ob()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ui(t).ShadowRoot}function Vm(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=Go(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function s9(t){return["table","td","th"].includes(pf(t))}function Ib(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Nj(t){const e=Tj(),n=Vo(t)?Go(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(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 a9(t){let e=kl(t);for(;Ns(e)&&!Nd(e);){if(Nj(e))return e;if(Ib(e))return null;e=kl(e)}return null}function Tj(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Nd(t){return["html","body","#document"].includes(pf(t))}function Go(t){return Ui(t).getComputedStyle(t)}function Rb(t){return Vo(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function kl(t){if(pf(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ik(t)&&t.host||Rs(t);return Ik(e)?e.host:e}function pF(t){const e=kl(t);return Nd(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ns(e)&&Vm(e)?e:pF(e)}function yp(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=pF(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Ui(i);if(o){const l=QC(s);return e.concat(s,s.visualViewport||[],Vm(i)?i:[],l&&n?yp(l):[])}return e.concat(i,yp(i,[],n))}function QC(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function mF(t){const e=Go(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Ns(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,l=ly(n)!==o||ly(r)!==s;return l&&(n=o,r=s),{width:n,height:r,$:l}}function Pj(t){return Vo(t)?t:t.contextElement}function Ju(t){const e=Pj(t);if(!Ns(e))return Tl(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=mF(e);let s=(o?ly(n.width):n.width)/r,l=(o?ly(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const l9=Tl(0);function gF(t){const e=Ui(t);return!Tj()||!e.visualViewport?l9:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function c9(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Ui(t)?!1:e}function Uc(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=Pj(t);let s=Tl(1);e&&(r?Vo(r)&&(s=Ju(r)):s=Ju(t));const l=c9(o,n,r)?gF(o):Tl(0);let c=(i.left+l.x)/s.x,u=(i.top+l.y)/s.y,d=i.width/s.x,f=i.height/s.y;if(o){const h=Ui(o),p=r&&Vo(r)?Ui(r):r;let g=h,m=QC(g);for(;m&&r&&p!==g;){const v=Ju(m),b=m.getBoundingClientRect(),x=Go(m),w=b.left+(m.clientLeft+parseFloat(x.paddingLeft))*v.x,S=b.top+(m.clientTop+parseFloat(x.paddingTop))*v.y;c*=v.x,u*=v.y,d*=v.x,f*=v.y,c+=w,u+=S,g=Ui(m),m=QC(g)}}return uy({width:d,height:f,x:c,y:u})}function u9(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=Rs(r),l=e?Ib(e.floating):!1;if(r===s||l&&o)return n;let c={scrollLeft:0,scrollTop:0},u=Tl(1);const d=Tl(0),f=Ns(r);if((f||!f&&!o)&&((pf(r)!=="body"||Vm(s))&&(c=Rb(r)),Ns(r))){const h=Uc(r);u=Ju(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 d9(t){return Array.from(t.getClientRects())}function XC(t,e){const n=Rb(t).scrollLeft;return e?e.left+n:Uc(Rs(t)).left+n}function f9(t){const e=Rs(t),n=Rb(t),r=t.ownerDocument.body,i=Di(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=Di(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+XC(t);const l=-n.scrollTop;return Go(r).direction==="rtl"&&(s+=Di(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:l}}function h9(t,e){const n=Ui(t),r=Rs(t),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,l=0,c=0;if(i){o=i.width,s=i.height;const u=Tj();(!u||u&&e==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:l,y:c}}function p9(t,e){const n=Uc(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=Ns(t)?Ju(t):Tl(1),s=t.clientWidth*o.x,l=t.clientHeight*o.y,c=i*o.x,u=r*o.y;return{width:s,height:l,x:c,y:u}}function Rk(t,e,n){let r;if(e==="viewport")r=h9(t,n);else if(e==="document")r=f9(Rs(t));else if(Vo(e))r=p9(e,n);else{const i=gF(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return uy(r)}function vF(t,e){const n=kl(t);return n===e||!Vo(n)||Nd(n)?!1:Go(n).position==="fixed"||vF(n,e)}function m9(t,e){const n=e.get(t);if(n)return n;let r=yp(t,[],!1).filter(l=>Vo(l)&&pf(l)!=="body"),i=null;const o=Go(t).position==="fixed";let s=o?kl(t):t;for(;Vo(s)&&!Nd(s);){const l=Go(s),c=Nj(s);!c&&l.position==="fixed"&&(i=null),(o?!c&&!i:!c&&l.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Vm(s)&&!c&&vF(t,s))?r=r.filter(d=>d!==s):i=l,s=kl(s)}return e.set(t,r),r}function g9(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?Ib(e)?[]:m9(e,this._c):[].concat(n),r],l=s[0],c=s.reduce((u,d)=>{const f=Rk(e,d,i);return u.top=Di(f.top,u.top),u.right=Nl(f.right,u.right),u.bottom=Nl(f.bottom,u.bottom),u.left=Di(f.left,u.left),u},Rk(e,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function v9(t){const{width:e,height:n}=mF(t);return{width:e,height:n}}function y9(t,e,n){const r=Ns(e),i=Rs(e),o=n==="fixed",s=Uc(t,!0,o,e);let l={scrollLeft:0,scrollTop:0};const c=Tl(0);if(r||!r&&!o)if((pf(e)!=="body"||Vm(i))&&(l=Rb(e)),r){const p=Uc(e,!0,o,e);c.x=p.x+e.clientLeft,c.y=p.y+e.clientTop}else i&&(c.x=XC(i));let u=0,d=0;if(i&&!r&&!o){const p=i.getBoundingClientRect();d=p.top+l.scrollTop,u=p.left+l.scrollLeft-XC(i,p)}const f=s.left+l.scrollLeft-c.x-u,h=s.top+l.scrollTop-c.y-d;return{x:f,y:h,width:s.width,height:s.height}}function Qw(t){return Go(t).position==="static"}function Mk(t,e){if(!Ns(t)||Go(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Rs(t)===n&&(n=n.ownerDocument.body),n}function yF(t,e){const n=Ui(t);if(Ib(t))return n;if(!Ns(t)){let i=kl(t);for(;i&&!Nd(i);){if(Vo(i)&&!Qw(i))return i;i=kl(i)}return n}let r=Mk(t,e);for(;r&&s9(r)&&Qw(r);)r=Mk(r,e);return r&&Nd(r)&&Qw(r)&&!Nj(r)?n:r||a9(t)||n}const x9=async function(t){const e=this.getOffsetParent||yF,n=this.getDimensions,r=await n(t.floating);return{reference:y9(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function b9(t){return Go(t).direction==="rtl"}const w9={convertOffsetParentRelativeRectToViewportRelativeRect:u9,getDocumentElement:Rs,getClippingRect:g9,getOffsetParent:yF,getElementRects:x9,getClientRects:d9,getDimensions:v9,getScale:Ju,isElement:Vo,isRTL:b9};function S9(t,e){let n=null,r;const i=Rs(t);function o(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function s(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),o();const{left:u,top:d,width:f,height:h}=t.getBoundingClientRect();if(l||e(),!f||!h)return;const p=Dg(d),g=Dg(i.clientWidth-(u+f)),m=Dg(i.clientHeight-(d+h)),v=Dg(u),x={rootMargin:-p+"px "+-g+"px "+-m+"px "+-v+"px",threshold:Di(0,Nl(1,c))||1};let w=!0;function S(C){const A=C[0].intersectionRatio;if(A!==c){if(!w)return s();A?s(!1,A):r=setTimeout(()=>{s(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(S,{...x,root:i.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(t)}return s(!0),o}function C9(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Pj(t),d=i||o?[...u?yp(u):[],...yp(e)]:[];d.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const f=u&&l?S9(u,n):null;let h=-1,p=null;s&&(p=new ResizeObserver(b=>{let[x]=b;x&&x.target===u&&p&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(e)})),n()}),u&&!c&&p.observe(u),p.observe(e));let g,m=c?Uc(t):null;c&&v();function v(){const b=Uc(t);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&n(),m=b,g=requestAnimationFrame(v)}return n(),()=>{var b;d.forEach(x=>{i&&x.removeEventListener("scroll",n),o&&x.removeEventListener("resize",n)}),f==null||f(),(b=p)==null||b.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const A9=n9,_9=r9,j9=Jq,E9=o9,N9=e9,Dk=Zq,T9=i9,P9=(t,e,n)=>{const r=new Map,i={platform:w9,...n},o={...i.platform,_c:r};return Xq(t,e,{...i,platform:o})};var Cv=typeof document<"u"?y.useLayoutEffect:y.useEffect;function dy(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!dy(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&t.$$typeof)&&!dy(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function xF(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function $k(t,e){const n=xF(t);return Math.round(e*n)/n}function Xw(t){const e=y.useRef(t);return Cv(()=>{e.current=t}),e}function k9(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=t,[d,f]=y.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,p]=y.useState(r);dy(h,r)||p(r);const[g,m]=y.useState(null),[v,b]=y.useState(null),x=y.useCallback(M=>{M!==A.current&&(A.current=M,m(M))},[]),w=y.useCallback(M=>{M!==_.current&&(_.current=M,b(M))},[]),S=o||g,C=s||v,A=y.useRef(null),_=y.useRef(null),j=y.useRef(d),k=c!=null,P=Xw(c),R=Xw(i),E=Xw(u),I=y.useCallback(()=>{if(!A.current||!_.current)return;const M={placement:e,strategy:n,middleware:h};R.current&&(M.platform=R.current),P9(A.current,_.current,M).then(U=>{const K={...U,isPositioned:E.current!==!1};L.current&&!dy(j.current,K)&&(j.current=K,ff.flushSync(()=>{f(K)}))})},[h,e,n,R,E]);Cv(()=>{u===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,f(M=>({...M,isPositioned:!1})))},[u]);const L=y.useRef(!1);Cv(()=>(L.current=!0,()=>{L.current=!1}),[]),Cv(()=>{if(S&&(A.current=S),C&&(_.current=C),S&&C){if(P.current)return P.current(S,C,I);I()}},[S,C,I,P,k]);const V=y.useMemo(()=>({reference:A,floating:_,setReference:x,setFloating:w}),[x,w]),$=y.useMemo(()=>({reference:S,floating:C}),[S,C]),z=y.useMemo(()=>{const M={position:n,left:0,top:0};if(!$.floating)return M;const U=$k($.floating,d.x),K=$k($.floating,d.y);return l?{...M,transform:"translate("+U+"px, "+K+"px)",...xF($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:K}},[n,l,$.floating,d.x,d.y]);return y.useMemo(()=>({...d,update:I,refs:V,elements:$,floatingStyles:z}),[d,I,V,$,z])}const O9=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?Dk({element:r.current,padding:i}).fn(n):{}:r?Dk({element:r,padding:i}).fn(n):{}}}},I9=(t,e)=>({...A9(t),options:[t,e]}),R9=(t,e)=>({..._9(t),options:[t,e]}),M9=(t,e)=>({...T9(t),options:[t,e]}),D9=(t,e)=>({...j9(t),options:[t,e]}),$9=(t,e)=>({...E9(t),options:[t,e]}),L9=(t,e)=>({...N9(t),options:[t,e]}),F9=(t,e)=>({...O9(t),options:[t,e]});var U9="Arrow",bF=y.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...o}=t;return a.jsx(et.svg,{...o,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});bF.displayName=U9;var B9=bF;function H9(t,e=[]){let n=[];function r(o,s){const l=y.createContext(s),c=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][c])||l,v=y.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:v,children:p})}function d(f,h){const p=(h==null?void 0:h[t][c])||l,g=y.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>y.createContext(s));return function(l){const c=(l==null?void 0:l[t])||o;return y.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,z9(i,...e)]}function z9(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(o)[`__scope${u}`];return{...l,...f}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}function Gm(t){const[e,n]=y.useState(void 0);return Rr(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,l;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;s=u.inlineSize,l=u.blockSize}else s=t.offsetWidth,l=t.offsetHeight;n({width:s,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var kj="Popper",[wF,mf]=H9(kj),[V9,SF]=wF(kj),CF=t=>{const{__scopePopper:e,children:n}=t,[r,i]=y.useState(null);return a.jsx(V9,{scope:e,anchor:r,onAnchorChange:i,children:n})};CF.displayName=kj;var AF="PopperAnchor",_F=y.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,o=SF(AF,n),s=y.useRef(null),l=_t(e,s);return y.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:a.jsx(et.div,{...i,ref:l})});_F.displayName=AF;var Oj="PopperContent",[G9,K9]=wF(Oj),jF=y.forwardRef((t,e)=>{var ce,Me,pe,Se,Te,ne;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...m}=t,v=SF(Oj,n),[b,x]=y.useState(null),w=_t(e,rt=>x(rt)),[S,C]=y.useState(null),A=Gm(S),_=(A==null?void 0:A.width)??0,j=(A==null?void 0:A.height)??0,k=r+(o!=="center"?"-"+o:""),P=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},R=Array.isArray(u)?u:[u],E=R.length>0,I={padding:P,boundary:R.filter(q9),altBoundary:E},{refs:L,floatingStyles:V,placement:$,isPositioned:z,middlewareData:M}=k9({strategy:"fixed",placement:k,whileElementsMounted:(...rt)=>C9(...rt,{animationFrame:p==="always"}),elements:{reference:v.anchor},middleware:[I9({mainAxis:i+j,alignmentAxis:s}),c&&R9({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?M9():void 0,...I}),c&&D9({...I}),$9({...I,apply:({elements:rt,rects:Fe,availableWidth:vt,availableHeight:mt})=>{const{width:Bt,height:N}=Fe.reference,D=rt.floating.style;D.setProperty("--radix-popper-available-width",`${vt}px`),D.setProperty("--radix-popper-available-height",`${mt}px`),D.setProperty("--radix-popper-anchor-width",`${Bt}px`),D.setProperty("--radix-popper-anchor-height",`${N}px`)}}),S&&F9({element:S,padding:l}),Y9({arrowWidth:_,arrowHeight:j}),h&&L9({strategy:"referenceHidden",...I})]}),[U,K]=TF($),X=dr(g);Rr(()=>{z&&(X==null||X())},[z,X]);const re=(ce=M.arrow)==null?void 0:ce.x,xe=(Me=M.arrow)==null?void 0:Me.y,F=((pe=M.arrow)==null?void 0:pe.centerOffset)!==0,[ue,ie]=y.useState();return Rr(()=>{b&&ie(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:z?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ue,"--radix-popper-transform-origin":[(Se=M.transformOrigin)==null?void 0:Se.x,(Te=M.transformOrigin)==null?void 0:Te.y].join(" "),...((ne=M.hide)==null?void 0:ne.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:a.jsx(G9,{scope:n,placedSide:U,onArrowChange:C,arrowX:re,arrowY:xe,shouldHideArrow:F,children:a.jsx(et.div,{"data-side":U,"data-align":K,...m,ref:w,style:{...m.style,animation:z?void 0:"none"}})})})});jF.displayName=Oj;var EF="PopperArrow",W9={top:"bottom",right:"left",bottom:"top",left:"right"},NF=y.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,o=K9(EF,r),s=W9[o.placedSide];return a.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:a.jsx(B9,{...i,ref:n,style:{...i.style,display:"block"}})})});NF.displayName=EF;function q9(t){return t!==null}var Y9=t=>({name:"transformOrigin",options:t,fn(e){var v,b,x;const{placement:n,rects:r,middlewareData:i}=e,s=((v=i.arrow)==null?void 0:v.centerOffset)!==0,l=s?0:t.arrowWidth,c=s?0:t.arrowHeight,[u,d]=TF(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((b=i.arrow)==null?void 0:b.x)??0)+l/2,p=(((x=i.arrow)==null?void 0:x.y)??0)+c/2;let g="",m="";return u==="bottom"?(g=s?f:`${h}px`,m=`${-c}px`):u==="top"?(g=s?f:`${h}px`,m=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,m=s?f:`${p}px`):u==="left"&&(g=`${r.floating.width+c}px`,m=s?f:`${p}px`),{data:{x:g,y:m}}}});function TF(t){const[e,n="center"]=t.split("-");return[e,n]}var PF=CF,Ij=_F,Rj=jF,Mj=NF,Q9="Portal",Mb=y.forwardRef((t,e)=>{var l;const{container:n,...r}=t,[i,o]=y.useState(!1);Rr(()=>o(!0),[]);const s=n||i&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?aF.createPortal(a.jsx(et.div,{...r,ref:e}),s):null});Mb.displayName=Q9;function X9(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var Mr=t=>{const{present:e,children:n}=t,r=Z9(e),i=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),o=_t(r.ref,J9(i));return typeof n=="function"||r.isPresent?y.cloneElement(i,{ref:o}):null};Mr.displayName="Presence";function Z9(t){const[e,n]=y.useState(),r=y.useRef({}),i=y.useRef(t),o=y.useRef("none"),s=t?"mounted":"unmounted",[l,c]=X9(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const u=$g(r.current);o.current=l==="mounted"?u:"none"},[l]),Rr(()=>{const u=r.current,d=i.current;if(d!==t){const h=o.current,p=$g(u);t?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,c]),Rr(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,f=p=>{const m=$g(r.current).includes(p.animationName);if(p.target===e&&m&&(c("ANIMATION_END"),!i.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},h=p=>{p.target===e&&(o.current=$g(r.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:y.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function $g(t){return(t==null?void 0:t.animationName)||"none"}function J9(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function Ko({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=eY({defaultProp:e,onChange:n}),o=t!==void 0,s=o?t:r,l=dr(n),c=y.useCallback(u=>{if(o){const f=typeof u=="function"?u(t):u;f!==t&&l(f)}else i(u)},[o,t,i,l]);return[s,c]}function eY({defaultProp:t,onChange:e}){const n=y.useState(t),[r]=n,i=y.useRef(r),o=dr(e);return y.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}var tY="VisuallyHidden",Dj=y.forwardRef((t,e)=>a.jsx(et.span,{...t,ref:e,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",...t.style}}));Dj.displayName=tY;var nY=Dj,[Db,UDe]=ji("Tooltip",[mf]),$j=mf(),kF="TooltipProvider",rY=700,Lk="tooltip.open",[iY,OF]=Db(kF),IF=t=>{const{__scopeTooltip:e,delayDuration:n=rY,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:o}=t,[s,l]=y.useState(!0),c=y.useRef(!1),u=y.useRef(0);return y.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),a.jsx(iY,{scope:e,isOpenDelayed:s,delayDuration:n,onOpen:y.useCallback(()=>{window.clearTimeout(u.current),l(!1)},[]),onClose:y.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>l(!0),r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:y.useCallback(d=>{c.current=d},[]),disableHoverableContent:i,children:o})};IF.displayName=kF;var RF="Tooltip",[BDe,$b]=Db(RF),ZC="TooltipTrigger",oY=y.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=$b(ZC,n),o=OF(ZC,n),s=$j(n),l=y.useRef(null),c=_t(e,l,i.onTriggerChange),u=y.useRef(!1),d=y.useRef(!1),f=y.useCallback(()=>u.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(Ij,{asChild:!0,...s,children:a.jsx(et.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:Pe(t.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:Pe(t.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:Pe(t.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Pe(t.onFocus,()=>{u.current||i.onOpen()}),onBlur:Pe(t.onBlur,i.onClose),onClick:Pe(t.onClick,i.onClose)})})});oY.displayName=ZC;var sY="TooltipPortal",[HDe,aY]=Db(sY,{forceMount:void 0}),Td="TooltipContent",MF=y.forwardRef((t,e)=>{const n=aY(Td,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...o}=t,s=$b(Td,t.__scopeTooltip);return a.jsx(Mr,{present:r||s.open,children:s.disableHoverableContent?a.jsx(DF,{side:i,...o,ref:e}):a.jsx(lY,{side:i,...o,ref:e})})}),lY=y.forwardRef((t,e)=>{const n=$b(Td,t.__scopeTooltip),r=OF(Td,t.__scopeTooltip),i=y.useRef(null),o=_t(e,i),[s,l]=y.useState(null),{trigger:c,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,h=y.useCallback(()=>{l(null),f(!1)},[f]),p=y.useCallback((g,m)=>{const v=g.currentTarget,b={x:g.clientX,y:g.clientY},x=fY(b,v.getBoundingClientRect()),w=hY(b,x),S=pY(m.getBoundingClientRect()),C=gY([...w,...S]);l(C),f(!0)},[f]);return y.useEffect(()=>()=>h(),[h]),y.useEffect(()=>{if(c&&d){const g=v=>p(v,d),m=v=>p(v,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",m)}}},[c,d,p,h]),y.useEffect(()=>{if(s){const g=m=>{const v=m.target,b={x:m.clientX,y:m.clientY},x=(c==null?void 0:c.contains(v))||(d==null?void 0:d.contains(v)),w=!mY(b,s);x?h():w&&(h(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,s,u,h]),a.jsx(DF,{...t,ref:o})}),[cY,uY]=Db(RF,{isInside:!1}),DF=y.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...l}=t,c=$b(Td,n),u=$j(n),{onClose:d}=c;return y.useEffect(()=>(document.addEventListener(Lk,d),()=>document.removeEventListener(Lk,d)),[d]),y.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(zm,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(Rj,{"data-state":c.stateAttribute,...u,...l,ref:e,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(Aj,{children:r}),a.jsx(cY,{scope:n,isInside:!0,children:a.jsx(nY,{id:c.contentId,role:"tooltip",children:i||r})})]})})});MF.displayName=Td;var $F="TooltipArrow",dY=y.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=$j(n);return uY($F,n).isInside?null:a.jsx(Mj,{...i,...r,ref:e})});dY.displayName=$F;function fY(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),o=Math.abs(e.left-t.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function hY(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function pY(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function mY(t,e){const{x:n,y:r}=t;let i=!1;for(let o=0,s=e.length-1;or!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(i=!i)}return i}function gY(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),vY(e)}function vY(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const o=e[e.length-1],s=e[e.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const o=n[n.length-1],s=n[n.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var yY=IF,LF=MF;function FF(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=wY(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:s=>{const l=s.split(Lj);return l[0]===""&&l.length!==1&&l.shift(),UF(l,e)||bY(s)},getConflictingClassGroupIds:(s,l)=>{const c=n[s]||[];return l&&r[s]?[...c,...r[s]]:c}}},UF=(t,e)=>{var s;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?UF(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const o=t.join(Lj);return(s=e.validators.find(({validator:l})=>l(o)))==null?void 0:s.classGroupId},Fk=/^\[(.+)\]$/,bY=t=>{if(Fk.test(t)){const e=Fk.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},wY=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return CY(Object.entries(t.classGroups),n).forEach(([o,s])=>{JC(s,r,o,e)}),r},JC=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const o=i===""?e:Uk(e,i);o.classGroupId=n;return}if(typeof i=="function"){if(SY(i)){JC(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{JC(s,Uk(e,o),n,r)})})},Uk=(t,e)=>{let n=t;return e.split(Lj).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},SY=t=>t.isThemeGetter,CY=(t,e)=>e?t.map(([n,r])=>{const i=r.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,l])=>[e+s,l])):o);return[n,i]}):t,AY=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(o,s)=>{n.set(o,s),e++,e>t&&(e=0,r=n,n=new Map)};return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}},BF="!",_Y=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],o=e.length,s=l=>{const c=[];let u=0,d=0,f;for(let v=0;vd?f-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:m}};return n?l=>n({className:l,parseClassName:s}):s},jY=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},EY=t=>({cache:AY(t.cacheSize),parseClassName:_Y(t),...xY(t)}),NY=/\s+/,TY=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,o=[],s=t.trim().split(NY);let l="";for(let c=s.length-1;c>=0;c-=1){const u=s[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 v=jY(d).join(":"),b=f?v+BF:v,x=b+m;if(o.includes(x))continue;o.push(x);const w=i(m,g);for(let S=0;S0?" "+l:l)}return l};function PY(){let t=0,e,n,r="";for(;t{if(typeof t=="string")return t;let e,n="";for(let r=0;rf(d),t());return n=EY(u),r=n.cache.get,i=n.cache.set,o=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=TY(c,n);return i(c,d),d}return function(){return o(PY.apply(null,arguments))}}const Cn=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},zF=/^\[(?:([a-z-]+):)?(.+)\]$/i,OY=/^\d+\/\d+$/,IY=new Set(["px","full","screen"]),RY=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,MY=/\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$/,DY=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,$Y=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LY=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Fs=t=>ed(t)||IY.has(t)||OY.test(t),Ia=t=>gf(t,"length",KY),ed=t=>!!t&&!Number.isNaN(Number(t)),Zw=t=>gf(t,"number",ed),eh=t=>!!t&&Number.isInteger(Number(t)),FY=t=>t.endsWith("%")&&ed(t.slice(0,-1)),It=t=>zF.test(t),Ra=t=>RY.test(t),UY=new Set(["length","size","percentage"]),BY=t=>gf(t,UY,VF),HY=t=>gf(t,"position",VF),zY=new Set(["image","url"]),VY=t=>gf(t,zY,qY),GY=t=>gf(t,"",WY),th=()=>!0,gf=(t,e,n)=>{const r=zF.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},KY=t=>MY.test(t)&&!DY.test(t),VF=()=>!1,WY=t=>$Y.test(t),qY=t=>LY.test(t),YY=()=>{const t=Cn("colors"),e=Cn("spacing"),n=Cn("blur"),r=Cn("brightness"),i=Cn("borderColor"),o=Cn("borderRadius"),s=Cn("borderSpacing"),l=Cn("borderWidth"),c=Cn("contrast"),u=Cn("grayscale"),d=Cn("hueRotate"),f=Cn("invert"),h=Cn("gap"),p=Cn("gradientColorStops"),g=Cn("gradientColorStopPositions"),m=Cn("inset"),v=Cn("margin"),b=Cn("opacity"),x=Cn("padding"),w=Cn("saturate"),S=Cn("scale"),C=Cn("sepia"),A=Cn("skew"),_=Cn("space"),j=Cn("translate"),k=()=>["auto","contain","none"],P=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto",It,e],E=()=>[It,e],I=()=>["",Fs,Ia],L=()=>["auto",ed,It],V=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],$=()=>["solid","dashed","dotted","double","none"],z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],M=()=>["start","end","center","between","around","evenly","stretch"],U=()=>["","0",It],K=()=>["auto","avoid","all","avoid-page","page","left","right","column"],X=()=>[ed,It];return{cacheSize:500,separator:":",theme:{colors:[th],spacing:[Fs,Ia],blur:["none","",Ra,It],brightness:X(),borderColor:[t],borderRadius:["none","","full",Ra,It],borderSpacing:E(),borderWidth:I(),contrast:X(),grayscale:U(),hueRotate:X(),invert:U(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[FY,Ia],inset:R(),margin:R(),opacity:X(),padding:E(),saturate:X(),scale:X(),sepia:U(),skew:X(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",It]}],container:["container"],columns:[{columns:[Ra]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"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:[...V(),It]}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],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",eh,It]}],basis:[{basis:R()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",It]}],grow:[{grow:U()}],shrink:[{shrink:U()}],order:[{order:["first","last","none",eh,It]}],"grid-cols":[{"grid-cols":[th]}],"col-start-end":[{col:["auto",{span:["full",eh,It]},It]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[th]}],"row-start-end":[{row:["auto",{span:[eh,It]},It]}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",It]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",It]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...M()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...M(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...M(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[_]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[_]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",It,e]}],"min-w":[{"min-w":[It,e,"min","max","fit"]}],"max-w":[{"max-w":[It,e,"none","full","min","max","fit","prose",{screen:[Ra]},Ra]}],h:[{h:[It,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[It,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[It,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[It,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Ra,Ia]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Zw]}],"font-family":[{font:[th]}],"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",It]}],"line-clamp":[{"line-clamp":["none",ed,Zw]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Fs,It]}],"list-image":[{"list-image":["none",It]}],"list-style-type":[{list:["none","disc","decimal",It]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Fs,Ia]}],"underline-offset":[{"underline-offset":["auto",Fs,It]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",It]}],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",It]}],"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:[...V(),HY]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",BY]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},VY]}],"bg-color":[{bg:[t]}],"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:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"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:[...$(),"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:$()}],"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:["",...$()]}],"outline-offset":[{"outline-offset":[Fs,It]}],"outline-w":[{outline:[Fs,Ia]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Fs,Ia]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Ra,GY]}],"shadow-color":[{shadow:[th]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":z()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Ra,It]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"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":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",It]}],duration:[{duration:X()}],ease:[{ease:["linear","in","out","in-out",It]}],delay:[{delay:X()}],animate:[{animate:["none","spin","ping","pulse","bounce",It]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[eh,It]}],"translate-x":[{"translate-x":[j]}],"translate-y":[{"translate-y":[j]}],"skew-x":[{"skew-x":[A]}],"skew-y":[{"skew-y":[A]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",It]}],accent:[{accent:["auto",t]}],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",It]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"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",It]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Fs,Ia,Zw]}],stroke:[{stroke:[t,"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"]}}},QY=kY(YY);function ke(...t){return QY(Nt(t))}const XY=yY,ZY=y.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(LF,{ref:r,sideOffset:e,className:ke("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",t),...n}));ZY.displayName=LF.displayName;var Lb=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Fb=typeof window>"u"||"Deno"in globalThis;function Ao(){}function JY(t,e){return typeof t=="function"?t(e):t}function eQ(t){return typeof t=="number"&&t>=0&&t!==1/0}function tQ(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Bk(t,e){return typeof t=="function"?t(e):t}function nQ(t,e){return typeof t=="function"?t(e):t}function Hk(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:l}=t;if(s){if(r){if(e.queryHash!==Fj(s,e.options))return!1}else if(!bp(e.queryKey,s))return!1}if(n!=="all"){const c=e.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||i&&i!==e.state.fetchStatus||o&&!o(e))}function zk(t,e){const{exact:n,status:r,predicate:i,mutationKey:o}=t;if(o){if(!e.options.mutationKey)return!1;if(n){if(xp(e.options.mutationKey)!==xp(o))return!1}else if(!bp(e.options.mutationKey,o))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function Fj(t,e){return((e==null?void 0:e.queryKeyHashFn)||xp)(t)}function xp(t){return JSON.stringify(t,(e,n)=>e1(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function bp(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(n=>!bp(t[n],e[n])):!1}function GF(t,e){if(t===e)return t;const n=Vk(t)&&Vk(e);if(n||e1(t)&&e1(e)){const r=n?t:Object.keys(t),i=r.length,o=n?e:Object.keys(e),s=o.length,l=n?[]:{};let c=0;for(let u=0;u{setTimeout(e,t)})}function iQ(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?GF(t,e):e}function oQ(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function sQ(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var Uj=Symbol();function KF(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Uj?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Cc,Ya,fd,UD,aQ=(UD=class extends Lb{constructor(){super();nn(this,Cc);nn(this,Ya);nn(this,fd);Lt(this,fd,e=>{if(!Fb&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ye(this,Ya)||this.setEventListener(ye(this,fd))}onUnsubscribe(){var e;this.hasListeners()||((e=ye(this,Ya))==null||e.call(this),Lt(this,Ya,void 0))}setEventListener(e){var n;Lt(this,fd,e),(n=ye(this,Ya))==null||n.call(this),Lt(this,Ya,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){ye(this,Cc)!==e&&(Lt(this,Cc,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof ye(this,Cc)=="boolean"?ye(this,Cc):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Cc=new WeakMap,Ya=new WeakMap,fd=new WeakMap,UD),WF=new aQ,hd,Qa,pd,BD,lQ=(BD=class extends Lb{constructor(){super();nn(this,hd,!0);nn(this,Qa);nn(this,pd);Lt(this,pd,e=>{if(!Fb&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){ye(this,Qa)||this.setEventListener(ye(this,pd))}onUnsubscribe(){var e;this.hasListeners()||((e=ye(this,Qa))==null||e.call(this),Lt(this,Qa,void 0))}setEventListener(e){var n;Lt(this,pd,e),(n=ye(this,Qa))==null||n.call(this),Lt(this,Qa,e(this.setOnline.bind(this)))}setOnline(e){ye(this,hd)!==e&&(Lt(this,hd,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return ye(this,hd)}},hd=new WeakMap,Qa=new WeakMap,pd=new WeakMap,BD),fy=new lQ;function cQ(){let t,e;const n=new Promise((i,o)=>{t=i,e=o});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}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}function uQ(t){return Math.min(1e3*2**t,3e4)}function qF(t){return(t??"online")==="online"?fy.isOnline():!0}var YF=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function Jw(t){return t instanceof YF}function QF(t){let e=!1,n=0,r=!1,i;const o=cQ(),s=m=>{var v;r||(h(new YF(m)),(v=t.abort)==null||v.call(t))},l=()=>{e=!0},c=()=>{e=!1},u=()=>WF.isFocused()&&(t.networkMode==="always"||fy.isOnline())&&t.canRun(),d=()=>qF(t.networkMode)&&t.canRun(),f=m=>{var v;r||(r=!0,(v=t.onSuccess)==null||v.call(t,m),i==null||i(),o.resolve(m))},h=m=>{var v;r||(r=!0,(v=t.onError)==null||v.call(t,m),i==null||i(),o.reject(m))},p=()=>new Promise(m=>{var v;i=b=>{(r||u())&&m(b)},(v=t.onPause)==null||v.call(t)}).then(()=>{var m;i=void 0,r||(m=t.onContinue)==null||m.call(t)}),g=()=>{if(r)return;let m;const v=n===0?t.initialPromise:void 0;try{m=v??t.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(f).catch(b=>{var A;if(r)return;const x=t.retry??(Fb?0:3),w=t.retryDelay??uQ,S=typeof w=="function"?w(n,b):w,C=x===!0||typeof x=="number"&&nu()?void 0:p()).then(()=>{e?h(b):g()})})};return{promise:o,cancel:s,continue:()=>(i==null||i(),o),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?g():p().then(g),o)}}function dQ(){let t=[],e=0,n=l=>{l()},r=l=>{l()},i=l=>setTimeout(l,0);const o=l=>{e?t.push(l):i(()=>{n(l)})},s=()=>{const l=t;t=[],l.length&&i(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;e++;try{c=l()}finally{e--,e||s()}return c},batchCalls:l=>(...c)=>{o(()=>{l(...c)})},schedule:o,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{i=l}}}var ni=dQ(),Ac,HD,XF=(HD=class{constructor(){nn(this,Ac)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),eQ(this.gcTime)&&Lt(this,Ac,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Fb?1/0:5*60*1e3))}clearGcTimeout(){ye(this,Ac)&&(clearTimeout(ye(this,Ac)),Lt(this,Ac,void 0))}},Ac=new WeakMap,HD),md,gd,Xi,Ur,Dm,_c,_o,zs,zD,fQ=(zD=class extends XF{constructor(e){super();nn(this,_o);nn(this,md);nn(this,gd);nn(this,Xi);nn(this,Ur);nn(this,Dm);nn(this,_c);Lt(this,_c,!1),Lt(this,Dm,e.defaultOptions),this.setOptions(e.options),this.observers=[],Lt(this,Xi,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Lt(this,md,pQ(this.options)),this.state=e.state??ye(this,md),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=ye(this,Ur))==null?void 0:e.promise}setOptions(e){this.options={...ye(this,Dm),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ye(this,Xi).remove(this)}setData(e,n){const r=iQ(this.state.data,e,this.options);return $r(this,_o,zs).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){$r(this,_o,zs).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=ye(this,Ur))==null?void 0:r.promise;return(i=ye(this,Ur))==null||i.cancel(e),n?n.then(Ao).catch(Ao):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ye(this,md))}isActive(){return this.observers.some(e=>nQ(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Uj||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!tQ(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=ye(this,Ur))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=ye(this,Ur))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),ye(this,Xi).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(ye(this,Ur)&&(ye(this,_c)?ye(this,Ur).cancel({revert:!0}):ye(this,Ur).cancelRetry()),this.scheduleGc()),ye(this,Xi).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||$r(this,_o,zs).call(this,{type:"invalidate"})}fetch(e,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(ye(this,Ur))return ye(this,Ur).continueRetry(),ye(this,Ur).promise}if(e&&this.setOptions(e),!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:()=>(Lt(this,_c,!0),r.signal)})},o=()=>{const f=KF(this.options,n),h={queryKey:this.queryKey,meta:this.meta};return i(h),Lt(this,_c,!1),this.options.persister?this.options.persister(f,h,this):f(h)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};i(s),(c=this.options.behavior)==null||c.onFetch(s,this),Lt(this,gd,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&$r(this,_o,zs).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const l=f=>{var h,p,g,m;Jw(f)&&f.silent||$r(this,_o,zs).call(this,{type:"error",error:f}),Jw(f)||((p=(h=ye(this,Xi).config).onError)==null||p.call(h,f,this),(m=(g=ye(this,Xi).config).onSettled)==null||m.call(g,this.state.data,f,this)),this.scheduleGc()};return Lt(this,Ur,QF({initialPromise:n==null?void 0:n.initialPromise,fn:s.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(v){l(v);return}(p=(h=ye(this,Xi).config).onSuccess)==null||p.call(h,f,this),(m=(g=ye(this,Xi).config).onSettled)==null||m.call(g,f,this.state.error,this),this.scheduleGc()},onError:l,onFail:(f,h)=>{$r(this,_o,zs).call(this,{type:"failed",failureCount:f,error:h})},onPause:()=>{$r(this,_o,zs).call(this,{type:"pause"})},onContinue:()=>{$r(this,_o,zs).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),ye(this,Ur).start()}},md=new WeakMap,gd=new WeakMap,Xi=new WeakMap,Ur=new WeakMap,Dm=new WeakMap,_c=new WeakMap,_o=new WeakSet,zs=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...hQ(r.data,this.options),fetchMeta:e.meta??null};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return Jw(i)&&i.revert&&ye(this,gd)?{...ye(this,gd),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,...e.state}}};this.state=n(this.state),ni.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ye(this,Xi).notify({query:this,type:"updated",action:e})})},zD);function hQ(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:qF(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function pQ(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,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 as,VD,mQ=(VD=class extends Lb{constructor(e={}){super();nn(this,as);this.config=e,Lt(this,as,new Map)}build(e,n,r){const i=n.queryKey,o=n.queryHash??Fj(i,n);let s=this.get(o);return s||(s=new fQ({cache:this,queryKey:i,queryHash:o,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(s)),s}add(e){ye(this,as).has(e.queryHash)||(ye(this,as).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=ye(this,as).get(e.queryHash);n&&(e.destroy(),n===e&&ye(this,as).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){ni.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return ye(this,as).get(e)}getAll(){return[...ye(this,as).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>Hk(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>Hk(e,r)):n}notify(e){ni.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){ni.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ni.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},as=new WeakMap,VD),ls,Qr,jc,cs,Ma,GD,gQ=(GD=class extends XF{constructor(e){super();nn(this,cs);nn(this,ls);nn(this,Qr);nn(this,jc);this.mutationId=e.mutationId,Lt(this,Qr,e.mutationCache),Lt(this,ls,[]),this.state=e.state||vQ(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){ye(this,ls).includes(e)||(ye(this,ls).push(e),this.clearGcTimeout(),ye(this,Qr).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Lt(this,ls,ye(this,ls).filter(n=>n!==e)),this.scheduleGc(),ye(this,Qr).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ye(this,ls).length||(this.state.status==="pending"?this.scheduleGc():ye(this,Qr).remove(this))}continue(){var e;return((e=ye(this,jc))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,o,s,l,c,u,d,f,h,p,g,m,v,b,x,w,S,C,A,_;Lt(this,jc,QF({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(j,k)=>{$r(this,cs,Ma).call(this,{type:"failed",failureCount:j,error:k})},onPause:()=>{$r(this,cs,Ma).call(this,{type:"pause"})},onContinue:()=>{$r(this,cs,Ma).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ye(this,Qr).canRun(this)}));const n=this.state.status==="pending",r=!ye(this,jc).canStart();try{if(!n){$r(this,cs,Ma).call(this,{type:"pending",variables:e,isPaused:r}),await((o=(i=ye(this,Qr).config).onMutate)==null?void 0:o.call(i,e,this));const k=await((l=(s=this.options).onMutate)==null?void 0:l.call(s,e));k!==this.state.context&&$r(this,cs,Ma).call(this,{type:"pending",context:k,variables:e,isPaused:r})}const j=await ye(this,jc).start();return await((u=(c=ye(this,Qr).config).onSuccess)==null?void 0:u.call(c,j,e,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,j,e,this.state.context)),await((p=(h=ye(this,Qr).config).onSettled)==null?void 0:p.call(h,j,null,this.state.variables,this.state.context,this)),await((m=(g=this.options).onSettled)==null?void 0:m.call(g,j,null,e,this.state.context)),$r(this,cs,Ma).call(this,{type:"success",data:j}),j}catch(j){try{throw await((b=(v=ye(this,Qr).config).onError)==null?void 0:b.call(v,j,e,this.state.context,this)),await((w=(x=this.options).onError)==null?void 0:w.call(x,j,e,this.state.context)),await((C=(S=ye(this,Qr).config).onSettled)==null?void 0:C.call(S,void 0,j,this.state.variables,this.state.context,this)),await((_=(A=this.options).onSettled)==null?void 0:_.call(A,void 0,j,e,this.state.context)),j}finally{$r(this,cs,Ma).call(this,{type:"error",error:j})}}finally{ye(this,Qr).runNext(this)}}},ls=new WeakMap,Qr=new WeakMap,jc=new WeakMap,cs=new WeakSet,Ma=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ni.batch(()=>{ye(this,ls).forEach(r=>{r.onMutationUpdate(e)}),ye(this,Qr).notify({mutation:this,type:"updated",action:e})})},GD);function vQ(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ki,$m,KD,yQ=(KD=class extends Lb{constructor(e={}){super();nn(this,ki);nn(this,$m);this.config=e,Lt(this,ki,new Map),Lt(this,$m,Date.now())}build(e,n,r){const i=new gQ({mutationCache:this,mutationId:++gg(this,$m)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){const n=Lg(e),r=ye(this,ki).get(n)??[];r.push(e),ye(this,ki).set(n,r),this.notify({type:"added",mutation:e})}remove(e){var r;const n=Lg(e);if(ye(this,ki).has(n)){const i=(r=ye(this,ki).get(n))==null?void 0:r.filter(o=>o!==e);i&&(i.length===0?ye(this,ki).delete(n):ye(this,ki).set(n,i))}this.notify({type:"removed",mutation:e})}canRun(e){var r;const n=(r=ye(this,ki).get(Lg(e)))==null?void 0:r.find(i=>i.state.status==="pending");return!n||n===e}runNext(e){var r;const n=(r=ye(this,ki).get(Lg(e)))==null?void 0:r.find(i=>i!==e&&i.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){ni.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}getAll(){return[...ye(this,ki).values()].flat()}find(e){const n={exact:!0,...e};return this.getAll().find(r=>zk(n,r))}findAll(e={}){return this.getAll().filter(n=>zk(e,n))}notify(e){ni.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return ni.batch(()=>Promise.all(e.map(n=>n.continue().catch(Ao))))}},ki=new WeakMap,$m=new WeakMap,KD);function Lg(t){var e;return((e=t.options.scope)==null?void 0:e.id)??String(t.mutationId)}function Kk(t){return{onFetch:(e,n)=>{var d,f,h,p,g;const r=e.options,i=(h=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,o=((p=e.state.data)==null?void 0:p.pages)||[],s=((g=e.state.data)==null?void 0:g.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let m=!1;const v=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(e.signal.aborted?m=!0:e.signal.addEventListener("abort",()=>{m=!0}),e.signal)})},b=KF(e.options,e.fetchOptions),x=async(w,S,C)=>{if(m)return Promise.reject();if(S==null&&w.pages.length)return Promise.resolve(w);const A={queryKey:e.queryKey,pageParam:S,direction:C?"backward":"forward",meta:e.options.meta};v(A);const _=await b(A),{maxPages:j}=e.options,k=C?sQ:oQ;return{pages:k(w.pages,_,j),pageParams:k(w.pageParams,S,j)}};if(i&&o.length){const w=i==="backward",S=w?xQ:Wk,C={pages:o,pageParams:s},A=S(r,C);l=await x(C,A,w)}else{const w=t??o.length;do{const S=c===0?s[0]??r.initialPageParam:Wk(r,l);if(c>0&&S==null)break;l=await x(l,S),c++}while(c{var m,v;return(v=(m=e.options).persister)==null?void 0:v.call(m,u,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=u}}}function Wk(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function xQ(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var Un,Xa,Za,vd,yd,Ja,xd,bd,WD,bQ=(WD=class{constructor(t={}){nn(this,Un);nn(this,Xa);nn(this,Za);nn(this,vd);nn(this,yd);nn(this,Ja);nn(this,xd);nn(this,bd);Lt(this,Un,t.queryCache||new mQ),Lt(this,Xa,t.mutationCache||new yQ),Lt(this,Za,t.defaultOptions||{}),Lt(this,vd,new Map),Lt(this,yd,new Map),Lt(this,Ja,0)}mount(){gg(this,Ja)._++,ye(this,Ja)===1&&(Lt(this,xd,WF.subscribe(async t=>{t&&(await this.resumePausedMutations(),ye(this,Un).onFocus())})),Lt(this,bd,fy.subscribe(async t=>{t&&(await this.resumePausedMutations(),ye(this,Un).onOnline())})))}unmount(){var t,e;gg(this,Ja)._--,ye(this,Ja)===0&&((t=ye(this,xd))==null||t.call(this),Lt(this,xd,void 0),(e=ye(this,bd))==null||e.call(this),Lt(this,bd,void 0))}isFetching(t){return ye(this,Un).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ye(this,Xa).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ye(this,Un).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.getQueryData(t.queryKey);if(e===void 0)return this.fetchQuery(t);{const n=this.defaultQueryOptions(t),r=ye(this,Un).build(this,n);return t.revalidateIfStale&&r.isStaleByTime(Bk(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(e)}}getQueriesData(t){return ye(this,Un).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=ye(this,Un).get(r.queryHash),o=i==null?void 0:i.state.data,s=JY(e,o);if(s!==void 0)return ye(this,Un).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(t,e,n){return ni.batch(()=>ye(this,Un).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ye(this,Un).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=ye(this,Un);ni.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=ye(this,Un),r={type:"active",...t};return ni.batch(()=>(n.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries(r,e)))}cancelQueries(t={},e={}){const n={revert:!0,...e},r=ni.batch(()=>ye(this,Un).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Ao).catch(Ao)}invalidateQueries(t={},e={}){return ni.batch(()=>{if(ye(this,Un).findAll(t).forEach(r=>{r.invalidate()}),t.refetchType==="none")return Promise.resolve();const n={...t,type:t.refetchType??t.type??"active"};return this.refetchQueries(n,e)})}refetchQueries(t={},e){const n={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},r=ni.batch(()=>ye(this,Un).findAll(t).filter(i=>!i.isDisabled()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(Ao)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(Ao)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=ye(this,Un).build(this,e);return n.isStaleByTime(Bk(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Ao).catch(Ao)}fetchInfiniteQuery(t){return t.behavior=Kk(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Ao).catch(Ao)}ensureInfiniteQueryData(t){return t.behavior=Kk(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return fy.isOnline()?ye(this,Xa).resumePausedMutations():Promise.resolve()}getQueryCache(){return ye(this,Un)}getMutationCache(){return ye(this,Xa)}getDefaultOptions(){return ye(this,Za)}setDefaultOptions(t){Lt(this,Za,t)}setQueryDefaults(t,e){ye(this,vd).set(xp(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...ye(this,vd).values()];let n={};return e.forEach(r=>{bp(t,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(t,e){ye(this,yd).set(xp(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...ye(this,yd).values()];let n={};return e.forEach(r=>{bp(t,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...ye(this,Za).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Fj(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.enabled!==!0&&e.queryFn===Uj&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ye(this,Za).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ye(this,Un).clear(),ye(this,Xa).clear()}},Un=new WeakMap,Xa=new WeakMap,Za=new WeakMap,vd=new WeakMap,yd=new WeakMap,Ja=new WeakMap,xd=new WeakMap,bd=new WeakMap,WD),wQ=y.createContext(void 0),SQ=({client:t,children:e})=>(y.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),a.jsx(wQ.Provider,{value:t,children:e}));/** +`+o.stack}return{value:t,source:e,stack:i,digest:null}}function Gw(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function PC(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var _7=typeof WeakMap=="function"?WeakMap:Map;function OL(t,e,n){n=sa(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){ry||(ry=!0,UC=r),PC(t,e)},n}function IL(t,e,n){n=sa(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){PC(t,e)}}var o=t.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){PC(t,e),typeof r!="function"&&(dl===null?dl=new Set([this]):dl.add(this));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),n}function sk(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new _7;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=F7.bind(null,t,e,n),e.then(t,t))}function ak(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function lk(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=sa(-1,1),e.tag=2,ul(n,e,1))),n.lanes|=1),t)}var j7=_a.ReactCurrentOwner,vi=!1;function Zr(t,e,n,r){e.child=t===null?lL(e,null,n,r):Ad(e,t.child,n,r)}function ck(t,e,n,r,i){n=n.render;var o=e.ref;return Xu(e,i),r=aj(t,e,n,r,o,i),n=lj(),t!==null&&!vi?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,pa(t,e,i)):(In&&n&&Y_(e),e.flags|=1,Zr(t,e,r,i),e.child)}function uk(t,e,n,r,i){if(t===null){var o=n.type;return typeof o=="function"&&!yj(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=o,RL(t,e,o,r,i)):(t=wv(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(o=t.child,!(t.lanes&i)){var s=o.memoizedProps;if(n=n.compare,n=n!==null?n:sp,n(s,r)&&t.ref===e.ref)return pa(t,e,i)}return e.flags|=1,t=hl(o,r),t.ref=e.ref,t.return=e,e.child=t}function RL(t,e,n,r,i){if(t!==null){var o=t.memoizedProps;if(sp(o,r)&&t.ref===e.ref)if(vi=!1,e.pendingProps=r=o,(t.lanes&i)!==0)t.flags&131072&&(vi=!0);else return e.lanes=t.lanes,pa(t,e,i)}return kC(t,e,n,r,i)}function ML(t,e,n){var r=e.pendingProps,i=r.children,o=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},wn(Bu,Ii),Ii|=n;else{if(!(n&1073741824))return t=o!==null?o.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,wn(Bu,Ii),Ii|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,wn(Bu,Ii),Ii|=r}else o!==null?(r=o.baseLanes|n,e.memoizedState=null):r=n,wn(Bu,Ii),Ii|=r;return Zr(t,e,i,n),e.child}function DL(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function kC(t,e,n,r,i){var o=bi(n)?Mc:Wr.current;return o=Sd(e,o),Xu(e,i),n=aj(t,e,n,r,o,i),r=lj(),t!==null&&!vi?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,pa(t,e,i)):(In&&r&&Y_(e),e.flags|=1,Zr(t,e,n,i),e.child)}function dk(t,e,n,r,i){if(bi(n)){var o=!0;Wv(e)}else o=!1;if(Xu(e,i),e.stateNode===null)yv(t,e),kL(e,n,r),TC(e,n,r,i),r=!0;else if(t===null){var s=e.stateNode,l=e.memoizedProps;s.props=l;var c=s.context,u=n.contextType;typeof u=="object"&&u!==null?u=ho(u):(u=bi(n)?Mc:Wr.current,u=Sd(e,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function";f||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==r||c!==u)&&ok(e,s,r,u),Ua=!1;var h=e.memoizedState;s.state=h,Jv(e,r,s,i),c=e.memoizedState,l!==r||h!==c||xi.current||Ua?(typeof d=="function"&&(NC(e,n,d,r),c=e.memoizedState),(l=Ua||ik(e,n,l,r,h,c,u))?(f||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(e.flags|=4194308)):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=c),s.props=r,s.state=c,s.context=u,r=l):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{s=e.stateNode,uL(t,e),l=e.memoizedProps,u=e.type===e.elementType?l:Co(e.type,l),s.props=u,f=e.pendingProps,h=s.context,c=n.contextType,typeof c=="object"&&c!==null?c=ho(c):(c=bi(n)?Mc:Wr.current,c=Sd(e,c));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==f||h!==c)&&ok(e,s,r,c),Ua=!1,h=e.memoizedState,s.state=h,Jv(e,r,s,i);var g=e.memoizedState;l!==f||h!==g||xi.current||Ua?(typeof p=="function"&&(NC(e,n,p,r),g=e.memoizedState),(u=Ua||ik(e,n,u,r,h,g,c)||!1)?(d||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,g,c),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,g,c)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||l===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=g),s.props=r,s.state=g,s.context=c,r=u):(typeof s.componentDidUpdate!="function"||l===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),r=!1)}return OC(t,e,n,r,o,i)}function OC(t,e,n,r,i,o){DL(t,e);var s=(e.flags&128)!==0;if(!r&&!s)return i&&QP(e,n,!1),pa(t,e,o);r=e.stateNode,j7.current=e;var l=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&s?(e.child=Ad(e,t.child,null,o),e.child=Ad(e,null,l,o)):Zr(t,e,l,o),e.memoizedState=r.state,i&&QP(e,n,!0),e.child}function $L(t){var e=t.stateNode;e.pendingContext?YP(t,e.pendingContext,e.pendingContext!==e.context):e.context&&YP(t,e.context,!1),rj(t,e.containerInfo)}function fk(t,e,n,r,i){return Cd(),X_(i),e.flags|=256,Zr(t,e,n,r),e.child}var IC={dehydrated:null,treeContext:null,retryLane:0};function RC(t){return{baseLanes:t,cachePool:null,transitions:null}}function LL(t,e,n){var r=e.pendingProps,i=Dn.current,o=!1,s=(e.flags&128)!==0,l;if((l=s)||(l=t!==null&&t.memoizedState===null?!1:(i&2)!==0),l?(o=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),wn(Dn,i&1),t===null)return jC(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(s=r.children,t=r.fallback,o?(r=e.mode,o=e.child,s={mode:"hidden",children:s},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=s):o=_b(s,r,0,null),t=Nc(t,r,n,null),o.return=e,t.return=e,o.sibling=t,e.child=o,e.child.memoizedState=RC(n),e.memoizedState=IC,t):dj(e,s));if(i=t.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return E7(t,e,s,r,l,i,n);if(o){o=r.fallback,s=e.mode,i=t.child,l=i.sibling;var c={mode:"hidden",children:r.children};return!(s&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=c,e.deletions=null):(r=hl(i,c),r.subtreeFlags=i.subtreeFlags&14680064),l!==null?o=hl(l,o):(o=Nc(o,s,n,null),o.flags|=2),o.return=e,r.return=e,r.sibling=o,e.child=r,r=o,o=e.child,s=t.child.memoizedState,s=s===null?RC(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},o.memoizedState=s,o.childLanes=t.childLanes&~n,e.memoizedState=IC,r}return o=t.child,t=o.sibling,r=hl(o,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function dj(t,e){return e=_b({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Pg(t,e,n,r){return r!==null&&X_(r),Ad(e,t.child,null,n),t=dj(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function E7(t,e,n,r,i,o,s){if(n)return e.flags&256?(e.flags&=-257,r=Gw(Error(_e(422))),Pg(t,e,s,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(o=r.fallback,i=e.mode,r=_b({mode:"visible",children:r.children},i,0,null),o=Nc(o,i,s,null),o.flags|=2,r.return=e,o.return=e,r.sibling=o,e.child=r,e.mode&1&&Ad(e,t.child,null,s),e.child.memoizedState=RC(s),e.memoizedState=IC,o);if(!(e.mode&1))return Pg(t,e,s,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var l=r.dgst;return r=l,o=Error(_e(419)),r=Gw(o,r,void 0),Pg(t,e,s,r)}if(l=(s&t.childLanes)!==0,vi||l){if(r=Sr,r!==null){switch(s&-s){case 4:i=2;break;case 16:i=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|s)?0:i,i!==0&&i!==o.retryLane&&(o.retryLane=i,ha(t,i),Mo(r,t,i,-1))}return vj(),r=Gw(Error(_e(421))),Pg(t,e,s,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=U7.bind(null,t),i._reactRetry=e,null):(t=o.treeContext,Li=cl(i.nextSibling),Fi=e,In=!0,To=null,t!==null&&(no[ro++]=Js,no[ro++]=Zs,no[ro++]=Dc,Js=t.id,Zs=t.overflow,Dc=e),e=dj(e,r.children),e.flags|=4096,e)}function hk(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),EC(t.return,e,n)}function Kw(t,e,n,r,i){var o=t.memoizedState;o===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=e,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function FL(t,e,n){var r=e.pendingProps,i=r.revealOrder,o=r.tail;if(Zr(t,e,r.children,n),r=Dn.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&hk(t,n,e);else if(t.tag===19)hk(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(wn(Dn,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&Zv(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),Kw(e,!1,i,n,o);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&Zv(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}Kw(e,!0,n,null,o);break;case"together":Kw(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function yv(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function pa(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Lc|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(_e(153));if(e.child!==null){for(t=e.child,n=hl(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=hl(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function N7(t,e,n){switch(e.tag){case 3:$L(e),Cd();break;case 5:dL(e);break;case 1:bi(e.type)&&Wv(e);break;case 4:rj(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;wn(Qv,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(wn(Dn,Dn.current&1),e.flags|=128,null):n&e.child.childLanes?LL(t,e,n):(wn(Dn,Dn.current&1),t=pa(t,e,n),t!==null?t.sibling:null);wn(Dn,Dn.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return FL(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),wn(Dn,Dn.current),r)break;return null;case 22:case 23:return e.lanes=0,ML(t,e,n)}return pa(t,e,n)}var UL,MC,BL,HL;UL=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};MC=function(){};BL=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,dc(bs.current);var o=null;switch(n){case"input":i=rC(t,i),r=rC(t,r),o=[];break;case"select":i=Ln({},i,{value:void 0}),r=Ln({},r,{value:void 0}),o=[];break;case"textarea":i=sC(t,i),r=sC(t,r),o=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=Gv)}lC(n,r);var s;n=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var l=i[u];for(s in l)l.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Zh.hasOwnProperty(u)?o||(o=[]):(o=o||[]).push(u,null));for(u in r){var c=r[u];if(l=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(s in l)!l.hasOwnProperty(s)||c&&c.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in c)c.hasOwnProperty(s)&&l[s]!==c[s]&&(n||(n={}),n[s]=c[s])}else n||(o||(o=[]),o.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(o=o||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(o=o||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Zh.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&An("scroll",t),o||l===c||(o=[])):(o=o||[]).push(u,c))}n&&(o=o||[]).push("style",n);var u=o;(e.updateQueue=u)&&(e.flags|=4)}};HL=function(t,e,n,r){n!==r&&(e.flags|=4)};function Jf(t,e){if(!In)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Fr(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function T7(t,e,n){var r=e.pendingProps;switch(Q_(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fr(e),null;case 1:return bi(e.type)&&Kv(),Fr(e),null;case 3:return r=e.stateNode,_d(),Pn(xi),Pn(Wr),oj(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Ng(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,To!==null&&(zC(To),To=null))),MC(t,e),Fr(e),null;case 5:ij(e);var i=dc(dp.current);if(n=e.type,t!==null&&e.stateNode!=null)BL(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(_e(166));return Fr(e),null}if(t=dc(bs.current),Ng(e)){r=e.stateNode,n=e.type;var o=e.memoizedProps;switch(r[fs]=e,r[cp]=o,t=(e.mode&1)!==0,n){case"dialog":An("cancel",r),An("close",r);break;case"iframe":case"object":case"embed":An("load",r);break;case"video":case"audio":for(i=0;i<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[fs]=e,t[cp]=r,UL(t,e,!1,!1),e.stateNode=t;e:{switch(s=cC(n,r),n){case"dialog":An("cancel",t),An("close",t),i=r;break;case"iframe":case"object":case"embed":An("load",t),i=r;break;case"video":case"audio":for(i=0;iEd&&(e.flags|=128,r=!0,Jf(o,!1),e.lanes=4194304)}else{if(!r)if(t=Zv(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Jf(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!In)return Fr(e),null}else 2*Wn()-o.renderingStartTime>Ed&&n!==1073741824&&(e.flags|=128,r=!0,Jf(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(n=o.last,n!==null?n.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=Wn(),e.sibling=null,n=Dn.current,wn(Dn,r?n&1|2:n&1),e):(Fr(e),null);case 22:case 23:return gj(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Ii&1073741824&&(Fr(e),e.subtreeFlags&6&&(e.flags|=8192)):Fr(e),null;case 24:return null;case 25:return null}throw Error(_e(156,e.tag))}function P7(t,e){switch(Q_(e),e.tag){case 1:return bi(e.type)&&Kv(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return _d(),Pn(xi),Pn(Wr),oj(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return ij(e),null;case 13:if(Pn(Dn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(_e(340));Cd()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Pn(Dn),null;case 4:return _d(),null;case 10:return ej(e.type._context),null;case 22:case 23:return gj(),null;case 24:return null;default:return null}}var kg=!1,Vr=!1,k7=typeof WeakSet=="function"?WeakSet:Set,Ge=null;function Uu(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Bn(t,e,r)}else n.current=null}function DC(t,e,n){try{n()}catch(r){Bn(t,e,r)}}var pk=!1;function O7(t,e){if(xC=Hv,t=W$(),q_(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,l=-1,c=-1,u=0,d=0,f=t,h=null;t:for(;;){for(var p;f!==n||i!==0&&f.nodeType!==3||(l=s+i),f!==o||r!==0&&f.nodeType!==3||(c=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===t)break t;if(h===n&&++u===i&&(l=s),h===o&&++d===r&&(c=s),(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(bC={focusedElem:t,selectionRange:n},Hv=!1,Ge=e;Ge!==null;)if(e=Ge,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Ge=t;else for(;Ge!==null;){e=Ge;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,v=g.memoizedState,b=e.stateNode,x=b.getSnapshotBeforeUpdate(e.elementType===e.type?m:Co(e.type,m),v);b.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=e.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(_e(163))}}catch(S){Bn(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,Ge=t;break}Ge=e.return}return g=pk,pk=!1,g}function Mh(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&DC(e,n,o)}i=i.next}while(i!==r)}}function Cb(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function $C(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function zL(t){var e=t.alternate;e!==null&&(t.alternate=null,zL(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[fs],delete e[cp],delete e[CC],delete e[p7],delete e[m7])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function VL(t){return t.tag===5||t.tag===3||t.tag===4}function mk(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||VL(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function LC(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Gv));else if(r!==4&&(t=t.child,t!==null))for(LC(t,e,n),t=t.sibling;t!==null;)LC(t,e,n),t=t.sibling}function FC(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(FC(t,e,n),t=t.sibling;t!==null;)FC(t,e,n),t=t.sibling}var Nr=null,jo=!1;function Oa(t,e,n){for(n=n.child;n!==null;)GL(t,e,n),n=n.sibling}function GL(t,e,n){if(xs&&typeof xs.onCommitFiberUnmount=="function")try{xs.onCommitFiberUnmount(mb,n)}catch{}switch(n.tag){case 5:Vr||Uu(n,e);case 6:var r=Nr,i=jo;Nr=null,Oa(t,e,n),Nr=r,jo=i,Nr!==null&&(jo?(t=Nr,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Nr.removeChild(n.stateNode));break;case 18:Nr!==null&&(jo?(t=Nr,n=n.stateNode,t.nodeType===8?Fw(t.parentNode,n):t.nodeType===1&&Fw(t,n),ip(t)):Fw(Nr,n.stateNode));break;case 4:r=Nr,i=jo,Nr=n.stateNode.containerInfo,jo=!0,Oa(t,e,n),Nr=r,jo=i;break;case 0:case 11:case 14:case 15:if(!Vr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&DC(n,e,s),i=i.next}while(i!==r)}Oa(t,e,n);break;case 1:if(!Vr&&(Uu(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Bn(n,e,l)}Oa(t,e,n);break;case 21:Oa(t,e,n);break;case 22:n.mode&1?(Vr=(r=Vr)||n.memoizedState!==null,Oa(t,e,n),Vr=r):Oa(t,e,n);break;default:Oa(t,e,n)}}function gk(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new k7),e.forEach(function(r){var i=B7.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function xo(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=Wn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*R7(r/1960))-r,10t?16:t,tl===null)var r=!1;else{if(t=tl,tl=null,iy=0,qt&6)throw Error(_e(331));var i=qt;for(qt|=4,Ge=t.current;Ge!==null;){var o=Ge,s=o.child;if(Ge.flags&16){var l=o.deletions;if(l!==null){for(var c=0;cWn()-pj?Ec(t,0):hj|=n),wi(t,e)}function ZL(t,e){e===0&&(t.mode&1?(e=Sg,Sg<<=1,!(Sg&130023424)&&(Sg=4194304)):e=1);var n=ai();t=ha(t,e),t!==null&&(Lm(t,e,n),wi(t,n))}function U7(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),ZL(t,n)}function B7(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(_e(314))}r!==null&&r.delete(e),ZL(t,n)}var eF;eF=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||xi.current)vi=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return vi=!1,N7(t,e,n);vi=!!(t.flags&131072)}else vi=!1,In&&e.flags&1048576&&iL(e,Yv,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;yv(t,e),t=e.pendingProps;var i=Sd(e,Wr.current);Xu(e,n),i=aj(null,e,r,t,i,n);var o=lj();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,bi(r)?(o=!0,Wv(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,nj(e),i.updater=Sb,e.stateNode=i,i._reactInternals=e,TC(e,r,t,n),e=OC(null,e,r,!0,o,n)):(e.tag=0,In&&o&&Y_(e),Zr(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(yv(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=z7(r),t=Co(r,t),i){case 0:e=kC(null,e,r,t,n);break e;case 1:e=dk(null,e,r,t,n);break e;case 11:e=ck(null,e,r,t,n);break e;case 14:e=uk(null,e,r,Co(r.type,t),n);break e}throw Error(_e(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Co(r,i),kC(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Co(r,i),dk(t,e,r,i,n);case 3:e:{if($L(e),t===null)throw Error(_e(387));r=e.pendingProps,o=e.memoizedState,i=o.element,uL(t,e),Jv(e,r,null,n);var s=e.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=jd(Error(_e(423)),e),e=fk(t,e,r,n,i);break e}else if(r!==i){i=jd(Error(_e(424)),e),e=fk(t,e,r,n,i);break e}else for(Li=cl(e.stateNode.containerInfo.firstChild),Fi=e,In=!0,To=null,n=lL(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Cd(),r===i){e=pa(t,e,n);break e}Zr(t,e,r,n)}e=e.child}return e;case 5:return dL(e),t===null&&jC(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,wC(r,i)?s=null:o!==null&&wC(r,o)&&(e.flags|=32),DL(t,e),Zr(t,e,s,n),e.child;case 6:return t===null&&jC(e),null;case 13:return LL(t,e,n);case 4:return rj(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Ad(e,null,r,n):Zr(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Co(r,i),ck(t,e,r,i,n);case 7:return Zr(t,e,e.pendingProps,n),e.child;case 8:return Zr(t,e,e.pendingProps.children,n),e.child;case 12:return Zr(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,wn(Qv,r._currentValue),r._currentValue=s,o!==null)if(zo(o.value,s)){if(o.children===i.children&&!xi.current){e=pa(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var l=o.dependencies;if(l!==null){s=o.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(o.tag===1){c=sa(-1,n&-n),c.tag=2;var u=o.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}}o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),EC(o.return,n,e),l.lanes|=n;break}c=c.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(_e(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),EC(s,n,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Zr(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Xu(e,n),i=ho(i),r=r(i),e.flags|=1,Zr(t,e,r,n),e.child;case 14:return r=e.type,i=Co(r,e.pendingProps),i=Co(r.type,i),uk(t,e,r,i,n);case 15:return RL(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Co(r,i),yv(t,e),e.tag=1,bi(r)?(t=!0,Wv(e)):t=!1,Xu(e,n),kL(e,r,i),TC(e,r,i,n),OC(null,e,r,!0,t,n);case 19:return FL(t,e,n);case 22:return ML(t,e,n)}throw Error(_e(156,e.tag))};function tF(t,e){return N$(t,e)}function H7(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,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 ao(t,e,n,r){return new H7(t,e,n,r)}function yj(t){return t=t.prototype,!(!t||!t.isReactComponent)}function z7(t){if(typeof t=="function")return yj(t)?1:0;if(t!=null){if(t=t.$$typeof,t===$_)return 11;if(t===L_)return 14}return 2}function hl(t,e){var n=t.alternate;return n===null?(n=ao(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function wv(t,e,n,r,i,o){var s=2;if(r=t,typeof t=="function")yj(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case ku:return Nc(n.children,i,o,e);case D_:s=8,i|=8;break;case ZS:return t=ao(12,n,e,i|2),t.elementType=ZS,t.lanes=o,t;case eC:return t=ao(13,n,e,i),t.elementType=eC,t.lanes=o,t;case tC:return t=ao(19,n,e,i),t.elementType=tC,t.lanes=o,t;case d$:return _b(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case c$:s=10;break e;case u$:s=9;break e;case $_:s=11;break e;case L_:s=14;break e;case Fa:s=16,r=null;break e}throw Error(_e(130,t==null?t:typeof t,""))}return e=ao(s,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function Nc(t,e,n,r){return t=ao(7,t,r,e),t.lanes=n,t}function _b(t,e,n,r){return t=ao(22,t,r,e),t.elementType=d$,t.lanes=n,t.stateNode={isHidden:!1},t}function Ww(t,e,n){return t=ao(6,t,null,e),t.lanes=n,t}function qw(t,e,n){return e=ao(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function V7(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Nw(0),this.expirationTimes=Nw(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nw(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function xj(t,e,n,r,i,o,s,l,c){return t=new V7(t,e,n,l,c),e===1?(e=1,o===!0&&(e|=8)):e=0,o=ao(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},nj(o),t}function G7(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(oF)}catch(t){console.error(t)}}oF(),o$.exports=Gi;var ff=o$.exports;const sF=en(ff);var aF,Ak=ff;aF=Ak.createRoot,Ak.hydrateRoot;var _k=["light","dark"],Q7="(prefers-color-scheme: dark)",X7=y.createContext(void 0),J7={setTheme:t=>{},themes:[]},Z7=()=>{var t;return(t=y.useContext(X7))!=null?t:J7};y.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:o,value:s,attrs:l,nonce:c})=>{let u=o==="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?_k.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",h=(g,m=!1,v=!0)=>{let b=s?s[g]:g,x=m?g+"|| ''":`'${b}'`,w="";return i&&v&&!m&&_k.includes(g)&&(w+=`d.style.colorScheme = '${g}';`),n==="class"?m||b?w+=`c.add(${x})`:w+="null":b&&(w+=`d[s](n,${x})`),w},p=t?`!function(){${d}${h(t)}}()`:r?`!function(){try{${d}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${u})){var t='${Q7}',m=window.matchMedia(t);if(m.media!==t||m.matches){${h("dark")}}else{${h("light")}}}else if(e){${s?`var x=${JSON.stringify(s)};`:""}${h(s?"x[e]":"e",!0)}}${u?"":"else{"+h(o,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${e}');if(e){${s?`var x=${JSON.stringify(s)};`:""}${h(s?"x[e]":"e",!0)}}else{${h(o,!1,!1)};}${f}}catch(t){}}();`;return y.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:p}})});var eq=t=>{switch(t){case"success":return rq;case"info":return oq;case"warning":return iq;case"error":return sq;default:return null}},tq=Array(12).fill(0),nq=({visible:t})=>T.createElement("div",{className:"sonner-loading-wrapper","data-visible":t},T.createElement("div",{className:"sonner-spinner"},tq.map((e,n)=>T.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),rq=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.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"})),iq=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},T.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"})),oq=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.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"})),sq=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.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"})),aq=()=>{let[t,e]=T.useState(document.hidden);return T.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},VC=1,lq=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:n,...r}=t,i=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:VC++,o=this.toasts.find(l=>l.id===i),s=t.dismissible===void 0?!0:t.dismissible;return o?this.toasts=this.toasts.map(l=>l.id===i?(this.publish({...l,...t,id:i,title:n}),{...l,...t,id:i,dismissible:s,title:n}):l):this.addToast({title:n,...r,dismissible:s,id:i}),i},this.dismiss=t=>(t||this.toasts.forEach(e=>{this.subscribers.forEach(n=>n({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let n;e.loading!==void 0&&(n=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let r=t instanceof Promise?t:t(),i=n!==void 0;return r.then(async o=>{if(uq(o)&&!o.ok){i=!1;let s=typeof e.error=="function"?await e.error(`HTTP error! status: ${o.status}`):e.error,l=typeof e.description=="function"?await e.description(`HTTP error! status: ${o.status}`):e.description;this.create({id:n,type:"error",message:s,description:l})}else if(e.success!==void 0){i=!1;let s=typeof e.success=="function"?await e.success(o):e.success,l=typeof e.description=="function"?await e.description(o):e.description;this.create({id:n,type:"success",message:s,description:l})}}).catch(async o=>{if(e.error!==void 0){i=!1;let s=typeof e.error=="function"?await e.error(o):e.error,l=typeof e.description=="function"?await e.description(o):e.description;this.create({id:n,type:"error",message:s,description:l})}}).finally(()=>{var o;i&&(this.dismiss(n),n=void 0),(o=e.finally)==null||o.call(e)}),n},this.custom=(t,e)=>{let n=(e==null?void 0:e.id)||VC++;return this.create({jsx:t(n),id:n,...e}),n},this.subscribers=[],this.toasts=[]}},Oi=new lq,cq=(t,e)=>{let n=(e==null?void 0:e.id)||VC++;return Oi.addToast({title:t,...e,id:n}),n},uq=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",dq=cq,fq=()=>Oi.toasts,ie=Object.assign(dq,{success:Oi.success,info:Oi.info,warning:Oi.warning,error:Oi.error,custom:Oi.custom,message:Oi.message,promise:Oi.promise,dismiss:Oi.dismiss,loading:Oi.loading},{getHistory:fq});function hq(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}hq(`: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 Rg(t){return t.label!==void 0}var pq=3,mq="32px",gq=4e3,vq=356,yq=14,xq=20,bq=200;function wq(...t){return t.filter(Boolean).join(" ")}var Sq=t=>{var e,n,r,i,o,s,l,c,u,d;let{invert:f,toast:h,unstyled:p,interacting:g,setHeights:m,visibleToasts:v,heights:b,index:x,toasts:w,expanded:S,removeToast:C,defaultRichColors:A,closeButton:_,style:j,cancelButtonStyle:k,actionButtonStyle:P,className:I="",descriptionClassName:E="",duration:R,position:L,gap:V,loadingIcon:$,expandByDefault:z,classNames:M,icons:U,closeButtonAriaLabel:W="Close toast",pauseWhenPageIsHidden:X,cn:re}=t,[xe,F]=T.useState(!1),[fe,oe]=T.useState(!1),[de,Re]=T.useState(!1),[pe,Se]=T.useState(!1),[Ne,ne]=T.useState(0),[nt,Fe]=T.useState(0),vt=T.useRef(null),mt=T.useRef(null),Bt=x===0,N=x+1<=v,D=h.type,H=h.dismissible!==!1,Q=h.className||"",J=h.descriptionClassName||"",B=T.useMemo(()=>b.findIndex(yt=>yt.toastId===h.id)||0,[b,h.id]),ee=T.useMemo(()=>{var yt;return(yt=h.closeButton)!=null?yt:_},[h.closeButton,_]),me=T.useMemo(()=>h.duration||R||gq,[h.duration,R]),Ce=T.useRef(0),Me=T.useRef(0),we=T.useRef(0),We=T.useRef(null),[wt,Nt]=L.split("-"),Je=T.useMemo(()=>b.reduce((yt,qe,ft)=>ft>=B?yt:yt+qe.height,0),[b,B]),Xe=aq(),$t=h.invert||f,Yt=D==="loading";Me.current=T.useMemo(()=>B*V+Je,[B,Je]),T.useEffect(()=>{F(!0)},[]),T.useLayoutEffect(()=>{if(!xe)return;let yt=mt.current,qe=yt.style.height;yt.style.height="auto";let ft=yt.getBoundingClientRect().height;yt.style.height=qe,Fe(ft),m(Vt=>Vt.find(un=>un.toastId===h.id)?Vt.map(un=>un.toastId===h.id?{...un,height:ft}:un):[{toastId:h.id,height:ft,position:h.position},...Vt])},[xe,h.title,h.description,m,h.id]);let _r=T.useCallback(()=>{oe(!0),ne(Me.current),m(yt=>yt.filter(qe=>qe.toastId!==h.id)),setTimeout(()=>{C(h)},bq)},[h,C,m,Me]);T.useEffect(()=>{if(h.promise&&D==="loading"||h.duration===1/0||h.type==="loading")return;let yt,qe=me;return S||g||X&&Xe?(()=>{if(we.current{var ft;(ft=h.onAutoClose)==null||ft.call(h,h),_r()},qe)),()=>clearTimeout(yt)},[S,g,z,h,me,_r,h.promise,D,X,Xe]),T.useEffect(()=>{let yt=mt.current;if(yt){let qe=yt.getBoundingClientRect().height;return Fe(qe),m(ft=>[{toastId:h.id,height:qe,position:h.position},...ft]),()=>m(ft=>ft.filter(Vt=>Vt.toastId!==h.id))}},[m,h.id]),T.useEffect(()=>{h.delete&&_r()},[_r,h.delete]);function Sn(){return U!=null&&U.loading?T.createElement("div",{className:"sonner-loader","data-visible":D==="loading"},U.loading):$?T.createElement("div",{className:"sonner-loader","data-visible":D==="loading"},$):T.createElement(nq,{visible:D==="loading"})}return T.createElement("li",{"aria-live":h.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:mt,className:re(I,Q,M==null?void 0:M.toast,(e=h==null?void 0:h.classNames)==null?void 0:e.toast,M==null?void 0:M.default,M==null?void 0:M[D],(n=h==null?void 0:h.classNames)==null?void 0:n[D]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:A,"data-styled":!(h.jsx||h.unstyled||p),"data-mounted":xe,"data-promise":!!h.promise,"data-removed":fe,"data-visible":N,"data-y-position":wt,"data-x-position":Nt,"data-index":x,"data-front":Bt,"data-swiping":de,"data-dismissible":H,"data-type":D,"data-invert":$t,"data-swipe-out":pe,"data-expanded":!!(S||z&&xe),style:{"--index":x,"--toasts-before":x,"--z-index":w.length-x,"--offset":`${fe?Ne:Me.current}px`,"--initial-height":z?"auto":`${nt}px`,...j,...h.style},onPointerDown:yt=>{Yt||!H||(vt.current=new Date,ne(Me.current),yt.target.setPointerCapture(yt.pointerId),yt.target.tagName!=="BUTTON"&&(Re(!0),We.current={x:yt.clientX,y:yt.clientY}))},onPointerUp:()=>{var yt,qe,ft,Vt;if(pe||!H)return;We.current=null;let un=Number(((yt=mt.current)==null?void 0:yt.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Wi=new Date().getTime()-((qe=vt.current)==null?void 0:qe.getTime()),Ls=Math.abs(un)/Wi;if(Math.abs(un)>=xq||Ls>.11){ne(Me.current),(ft=h.onDismiss)==null||ft.call(h,h),_r(),Se(!0);return}(Vt=mt.current)==null||Vt.style.setProperty("--swipe-amount","0px"),Re(!1)},onPointerMove:yt=>{var qe;if(!We.current||!H)return;let ft=yt.clientY-We.current.y,Vt=yt.clientX-We.current.x,un=(wt==="top"?Math.min:Math.max)(0,ft),Wi=yt.pointerType==="touch"?10:2;Math.abs(un)>Wi?(qe=mt.current)==null||qe.style.setProperty("--swipe-amount",`${ft}px`):Math.abs(Vt)>Wi&&(We.current=null)}},ee&&!h.jsx?T.createElement("button",{"aria-label":W,"data-disabled":Yt,"data-close-button":!0,onClick:Yt||!H?()=>{}:()=>{var yt;_r(),(yt=h.onDismiss)==null||yt.call(h,h)},className:re(M==null?void 0:M.closeButton,(i=h==null?void 0:h.classNames)==null?void 0:i.closeButton)},T.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"},T.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),T.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,h.jsx||T.isValidElement(h.title)?h.jsx||h.title:T.createElement(T.Fragment,null,D||h.icon||h.promise?T.createElement("div",{"data-icon":"",className:re(M==null?void 0:M.icon,(o=h==null?void 0:h.classNames)==null?void 0:o.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Sn():null,h.type!=="loading"?h.icon||(U==null?void 0:U[D])||eq(D):null):null,T.createElement("div",{"data-content":"",className:re(M==null?void 0:M.content,(s=h==null?void 0:h.classNames)==null?void 0:s.content)},T.createElement("div",{"data-title":"",className:re(M==null?void 0:M.title,(l=h==null?void 0:h.classNames)==null?void 0:l.title)},h.title),h.description?T.createElement("div",{"data-description":"",className:re(E,J,M==null?void 0:M.description,(c=h==null?void 0:h.classNames)==null?void 0:c.description)},h.description):null),T.isValidElement(h.cancel)?h.cancel:h.cancel&&Rg(h.cancel)?T.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||k,onClick:yt=>{var qe,ft;Rg(h.cancel)&&H&&((ft=(qe=h.cancel).onClick)==null||ft.call(qe,yt),_r())},className:re(M==null?void 0:M.cancelButton,(u=h==null?void 0:h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,T.isValidElement(h.action)?h.action:h.action&&Rg(h.action)?T.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||P,onClick:yt=>{var qe,ft;Rg(h.action)&&(yt.defaultPrevented||((ft=(qe=h.action).onClick)==null||ft.call(qe,yt),_r()))},className:re(M==null?void 0:M.actionButton,(d=h==null?void 0:h.classNames)==null?void 0:d.actionButton)},h.action.label):null))};function jk(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}var Cq=t=>{let{invert:e,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:i,closeButton:o,className:s,offset:l,theme:c="light",richColors:u,duration:d,style:f,visibleToasts:h=pq,toastOptions:p,dir:g=jk(),gap:m=yq,loadingIcon:v,icons:b,containerAriaLabel:x="Notifications",pauseWhenPageIsHidden:w,cn:S=wq}=t,[C,A]=T.useState([]),_=T.useMemo(()=>Array.from(new Set([n].concat(C.filter(X=>X.position).map(X=>X.position)))),[C,n]),[j,k]=T.useState([]),[P,I]=T.useState(!1),[E,R]=T.useState(!1),[L,V]=T.useState(c!=="system"?c:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),$=T.useRef(null),z=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=T.useRef(null),U=T.useRef(!1),W=T.useCallback(X=>{var re;(re=C.find(xe=>xe.id===X.id))!=null&&re.delete||Oi.dismiss(X.id),A(xe=>xe.filter(({id:F})=>F!==X.id))},[C]);return T.useEffect(()=>Oi.subscribe(X=>{if(X.dismiss){A(re=>re.map(xe=>xe.id===X.id?{...xe,delete:!0}:xe));return}setTimeout(()=>{sF.flushSync(()=>{A(re=>{let xe=re.findIndex(F=>F.id===X.id);return xe!==-1?[...re.slice(0,xe),{...re[xe],...X},...re.slice(xe+1)]:[X,...re]})})})}),[]),T.useEffect(()=>{if(c!=="system"){V(c);return}c==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?V("dark"):V("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:X})=>{V(X?"dark":"light")})},[c]),T.useEffect(()=>{C.length<=1&&I(!1)},[C]),T.useEffect(()=>{let X=re=>{var xe,F;r.every(fe=>re[fe]||re.code===fe)&&(I(!0),(xe=$.current)==null||xe.focus()),re.code==="Escape"&&(document.activeElement===$.current||(F=$.current)!=null&&F.contains(document.activeElement))&&I(!1)};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[r]),T.useEffect(()=>{if($.current)return()=>{M.current&&(M.current.focus({preventScroll:!0}),M.current=null,U.current=!1)}},[$.current]),C.length?T.createElement("section",{"aria-label":`${x} ${z}`,tabIndex:-1},_.map((X,re)=>{var xe;let[F,fe]=X.split("-");return T.createElement("ol",{key:X,dir:g==="auto"?jk():g,tabIndex:-1,ref:$,className:s,"data-sonner-toaster":!0,"data-theme":L,"data-y-position":F,"data-x-position":fe,style:{"--front-toast-height":`${((xe=j[0])==null?void 0:xe.height)||0}px`,"--offset":typeof l=="number"?`${l}px`:l||mq,"--width":`${vq}px`,"--gap":`${m}px`,...f},onBlur:oe=>{U.current&&!oe.currentTarget.contains(oe.relatedTarget)&&(U.current=!1,M.current&&(M.current.focus({preventScroll:!0}),M.current=null))},onFocus:oe=>{oe.target instanceof HTMLElement&&oe.target.dataset.dismissible==="false"||U.current||(U.current=!0,M.current=oe.relatedTarget)},onMouseEnter:()=>I(!0),onMouseMove:()=>I(!0),onMouseLeave:()=>{E||I(!1)},onPointerDown:oe=>{oe.target instanceof HTMLElement&&oe.target.dataset.dismissible==="false"||R(!0)},onPointerUp:()=>R(!1)},C.filter(oe=>!oe.position&&re===0||oe.position===X).map((oe,de)=>{var Re,pe;return T.createElement(Sq,{key:oe.id,icons:b,index:de,toast:oe,defaultRichColors:u,duration:(Re=p==null?void 0:p.duration)!=null?Re:d,className:p==null?void 0:p.className,descriptionClassName:p==null?void 0:p.descriptionClassName,invert:e,visibleToasts:h,closeButton:(pe=p==null?void 0:p.closeButton)!=null?pe:o,interacting:E,position:X,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:W,toasts:C.filter(Se=>Se.position==oe.position),heights:j.filter(Se=>Se.position==oe.position),setHeights:k,expandByDefault:i,gap:m,loadingIcon:v,expanded:P,pauseWhenPageIsHidden:w,cn:S})}))})):null};const Aq=({...t})=>{const{theme:e="system"}=Z7();return a.jsx(Cq,{theme:e,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"}},...t})};function Te(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function _q(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function Pb(...t){return e=>t.forEach(n=>_q(n,e))}function At(...t){return y.useCallback(Pb(...t),t)}function jq(t,e){const n=y.createContext(e),r=o=>{const{children:s,...l}=o,c=y.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:s})};r.displayName=t+"Provider";function i(o){const s=y.useContext(n);if(s)return s;if(e!==void 0)return e;throw new Error(`\`${o}\` must be used within \`${t}\``)}return[r,i]}function ji(t,e=[]){let n=[];function r(o,s){const l=y.createContext(s),c=n.length;n=[...n,s];const u=f=>{var b;const{scope:h,children:p,...g}=f,m=((b=h==null?void 0:h[t])==null?void 0:b[c])||l,v=y.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:v,children:p})};u.displayName=o+"Provider";function d(f,h){var m;const p=((m=h==null?void 0:h[t])==null?void 0:m[c])||l,g=y.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[u,d]}const i=()=>{const o=n.map(s=>y.createContext(s));return function(l){const c=(l==null?void 0:l[t])||o;return y.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,Eq(i,...e)]}function Eq(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(o)[`__scope${u}`];return{...l,...f}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var Es=y.forwardRef((t,e)=>{const{children:n,...r}=t,i=y.Children.toArray(n),o=i.find(Nq);if(o){const s=o.props.children,l=i.map(c=>c===o?y.Children.count(s)>1?y.Children.only(null):y.isValidElement(s)?s.props.children:null:c);return a.jsx(GC,{...r,ref:e,children:y.isValidElement(s)?y.cloneElement(s,void 0,l):null})}return a.jsx(GC,{...r,ref:e,children:n})});Es.displayName="Slot";var GC=y.forwardRef((t,e)=>{const{children:n,...r}=t;if(y.isValidElement(n)){const i=Pq(n);return y.cloneElement(n,{...Tq(r,n.props),ref:e?Pb(e,i):i})}return y.Children.count(n)>1?y.Children.only(null):null});GC.displayName="SlotClone";var Cj=({children:t})=>a.jsx(a.Fragment,{children:t});function Nq(t){return y.isValidElement(t)&&t.type===Cj}function Tq(t,e){const n={...e};for(const r in e){const i=t[r],o=e[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...l)=>{o(...l),i(...l)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...t,...n}}function Pq(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var kq=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],et=kq.reduce((t,e)=>{const n=y.forwardRef((r,i)=>{const{asChild:o,...s}=r,l=o?Es:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(l,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function lF(t,e){t&&ff.flushSync(()=>t.dispatchEvent(e))}function dr(t){const e=y.useRef(t);return y.useEffect(()=>{e.current=t}),y.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function Oq(t,e=globalThis==null?void 0:globalThis.document){const n=dr(t);y.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var Iq="DismissableLayer",KC="dismissableLayer.update",Rq="dismissableLayer.pointerDownOutside",Mq="dismissableLayer.focusOutside",Ek,cF=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Hm=y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:l,...c}=t,u=y.useContext(cF),[d,f]=y.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=y.useState({}),g=At(e,_=>f(_)),m=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(v),x=d?m.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=x>=b,C=Lq(_=>{const j=_.target,k=[...u.branches].some(P=>P.contains(j));!S||k||(i==null||i(_),s==null||s(_),_.defaultPrevented||l==null||l())},h),A=Fq(_=>{const j=_.target;[...u.branches].some(P=>P.contains(j))||(o==null||o(_),s==null||s(_),_.defaultPrevented||l==null||l())},h);return Oq(_=>{x===u.layers.size-1&&(r==null||r(_),!_.defaultPrevented&&l&&(_.preventDefault(),l()))},h),y.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Ek=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Nk(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Ek)}},[d,h,n,u]),y.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Nk())},[d,u]),y.useEffect(()=>{const _=()=>p({});return document.addEventListener(KC,_),()=>document.removeEventListener(KC,_)},[]),a.jsx(et.div,{...c,ref:g,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:Te(t.onFocusCapture,A.onFocusCapture),onBlurCapture:Te(t.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Te(t.onPointerDownCapture,C.onPointerDownCapture)})});Hm.displayName=Iq;var Dq="DismissableLayerBranch",$q=y.forwardRef((t,e)=>{const n=y.useContext(cF),r=y.useRef(null),i=At(e,r);return y.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),a.jsx(et.div,{...t,ref:i})});$q.displayName=Dq;function Lq(t,e=globalThis==null?void 0:globalThis.document){const n=dr(t),r=y.useRef(!1),i=y.useRef(()=>{});return y.useEffect(()=>{const o=l=>{if(l.target&&!r.current){let c=function(){uF(Rq,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=c,e.addEventListener("click",i.current,{once:!0})):c()}else e.removeEventListener("click",i.current);r.current=!1},s=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",o),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function Fq(t,e=globalThis==null?void 0:globalThis.document){const n=dr(t),r=y.useRef(!1);return y.useEffect(()=>{const i=o=>{o.target&&!r.current&&uF(Mq,n,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Nk(){const t=new CustomEvent(KC);document.dispatchEvent(t)}function uF(t,e,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?lF(i,o):i.dispatchEvent(o)}var Rr=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},Uq=r$.useId||(()=>{}),Bq=0;function Do(t){const[e,n]=y.useState(Uq());return Rr(()=>{n(r=>r??String(Bq++))},[t]),e?`radix-${e}`:""}const Hq=["top","right","bottom","left"],Nl=Math.min,Di=Math.max,ay=Math.round,Mg=Math.floor,Tl=t=>({x:t,y:t}),zq={left:"right",right:"left",bottom:"top",top:"bottom"},Vq={start:"end",end:"start"};function WC(t,e,n){return Di(t,Nl(e,n))}function ma(t,e){return typeof t=="function"?t(e):t}function ga(t){return t.split("-")[0]}function hf(t){return t.split("-")[1]}function Aj(t){return t==="x"?"y":"x"}function _j(t){return t==="y"?"height":"width"}function Pl(t){return["top","bottom"].includes(ga(t))?"y":"x"}function jj(t){return Aj(Pl(t))}function Gq(t,e,n){n===void 0&&(n=!1);const r=hf(t),i=jj(t),o=_j(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=ly(s)),[s,ly(s)]}function Kq(t){const e=ly(t);return[qC(t),e,qC(e)]}function qC(t){return t.replace(/start|end/g,e=>Vq[e])}function Wq(t,e,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?o:s;default:return[]}}function qq(t,e,n,r){const i=hf(t);let o=Wq(ga(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(qC)))),o}function ly(t){return t.replace(/left|right|bottom|top/g,e=>zq[e])}function Yq(t){return{top:0,right:0,bottom:0,left:0,...t}}function dF(t){return typeof t!="number"?Yq(t):{top:t,right:t,bottom:t,left:t}}function cy(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function Tk(t,e,n){let{reference:r,floating:i}=t;const o=Pl(e),s=jj(e),l=_j(s),c=ga(e),u=o==="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(hf(e)){case"start":p[s]-=h*(n&&u?-1:1);break;case"end":p[s]+=h*(n&&u?-1:1);break}return p}const Qq=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,l=o.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(e));let u=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:d,y:f}=Tk(u,r,c),h=r,p={},g=0;for(let m=0;m({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:s,elements:l,middlewareData:c}=e,{element:u,padding:d=0}=ma(t,e)||{};if(u==null)return{};const f=dF(d),h={x:n,y:r},p=jj(i),g=_j(p),m=await s.getDimensions(u),v=p==="y",b=v?"top":"left",x=v?"bottom":"right",w=v?"clientHeight":"clientWidth",S=o.reference[g]+o.reference[p]-h[p]-o.floating[g],C=h[p]-o.reference[p],A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let _=A?A[w]:0;(!_||!await(s.isElement==null?void 0:s.isElement(A)))&&(_=l.floating[w]||o.floating[g]);const j=S/2-C/2,k=_/2-m[g]/2-1,P=Nl(f[b],k),I=Nl(f[x],k),E=P,R=_-m[g]-I,L=_/2-m[g]/2+j,V=WC(E,L,R),$=!c.arrow&&hf(i)!=null&&L!==V&&o.reference[g]/2-(LL<=0)){var I,E;const L=(((I=o.flip)==null?void 0:I.index)||0)+1,V=_[L];if(V)return{data:{index:L,overflows:P},reset:{placement:V}};let $=(E=P.filter(z=>z.overflows[0]<=0).sort((z,M)=>z.overflows[1]-M.overflows[1])[0])==null?void 0:E.placement;if(!$)switch(p){case"bestFit":{var R;const z=(R=P.filter(M=>{if(A){const U=Pl(M.placement);return U===x||U==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(U=>U>0).reduce((U,W)=>U+W,0)]).sort((M,U)=>M[1]-U[1])[0])==null?void 0:R[0];z&&($=z);break}case"initialPlacement":$=l;break}if(i!==$)return{reset:{placement:$}}}return{}}}};function Pk(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function kk(t){return Hq.some(e=>t[e]>=0)}const Zq=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=ma(t,e);switch(r){case"referenceHidden":{const o=await gp(e,{...i,elementContext:"reference"}),s=Pk(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:kk(s)}}}case"escaped":{const o=await gp(e,{...i,altBoundary:!0}),s=Pk(o,n.floating);return{data:{escapedOffsets:s,escaped:kk(s)}}}default:return{}}}}};async function e9(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=ga(n),l=hf(n),c=Pl(n)==="y",u=["left","top"].includes(s)?-1:1,d=o&&c?-1:1,f=ma(e,t);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 t9=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:o,placement:s,middlewareData:l}=e,c=await e9(e,t);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:o+c.y,data:{...c,placement:s}}}}},n9=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:s=!1,limiter:l={fn:v=>{let{x:b,y:x}=v;return{x:b,y:x}}},...c}=ma(t,e),u={x:n,y:r},d=await gp(e,c),f=Pl(ga(i)),h=Aj(f);let p=u[h],g=u[f];if(o){const v=h==="y"?"top":"left",b=h==="y"?"bottom":"right",x=p+d[v],w=p-d[b];p=WC(x,p,w)}if(s){const v=f==="y"?"top":"left",b=f==="y"?"bottom":"right",x=g+d[v],w=g-d[b];g=WC(x,g,w)}const m=l.fn({...e,[h]:p,[f]:g});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:o,[f]:s}}}}}},r9=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:o,middlewareData:s}=e,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=ma(t,e),d={x:n,y:r},f=Pl(i),h=Aj(f);let p=d[h],g=d[f];const m=ma(l,e),v=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const w=h==="y"?"height":"width",S=o.reference[h]-o.floating[w]+v.mainAxis,C=o.reference[h]+o.reference[w]-v.mainAxis;pC&&(p=C)}if(u){var b,x;const w=h==="y"?"width":"height",S=["top","left"].includes(ga(i)),C=o.reference[f]-o.floating[w]+(S&&((b=s.offset)==null?void 0:b[f])||0)+(S?0:v.crossAxis),A=o.reference[f]+o.reference[w]+(S?0:((x=s.offset)==null?void 0:x[f])||0)-(S?v.crossAxis:0);gA&&(g=A)}return{[h]:p,[f]:g}}}},i9=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:o,platform:s,elements:l}=e,{apply:c=()=>{},...u}=ma(t,e),d=await gp(e,u),f=ga(i),h=hf(i),p=Pl(i)==="y",{width:g,height:m}=o.floating;let v,b;f==="top"||f==="bottom"?(v=f,b=h===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(b=f,v=h==="end"?"top":"bottom");const x=m-d.top-d.bottom,w=g-d.left-d.right,S=Nl(m-d[v],x),C=Nl(g-d[b],w),A=!e.middlewareData.shift;let _=S,j=C;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(j=w),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(_=x),A&&!h){const P=Di(d.left,0),I=Di(d.right,0),E=Di(d.top,0),R=Di(d.bottom,0);p?j=g-2*(P!==0||I!==0?P+I:Di(d.left,d.right)):_=m-2*(E!==0||R!==0?E+R:Di(d.top,d.bottom))}await c({...e,availableWidth:j,availableHeight:_});const k=await s.getDimensions(l.floating);return g!==k.width||m!==k.height?{reset:{rects:!0}}:{}}}};function kb(){return typeof window<"u"}function pf(t){return fF(t)?(t.nodeName||"").toLowerCase():"#document"}function Ui(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Rs(t){var e;return(e=(fF(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function fF(t){return kb()?t instanceof Node||t instanceof Ui(t).Node:!1}function Vo(t){return kb()?t instanceof Element||t instanceof Ui(t).Element:!1}function Ns(t){return kb()?t instanceof HTMLElement||t instanceof Ui(t).HTMLElement:!1}function Ok(t){return!kb()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ui(t).ShadowRoot}function zm(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=Go(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function o9(t){return["table","td","th"].includes(pf(t))}function Ob(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Ej(t){const e=Nj(),n=Vo(t)?Go(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(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 s9(t){let e=kl(t);for(;Ns(e)&&!Nd(e);){if(Ej(e))return e;if(Ob(e))return null;e=kl(e)}return null}function Nj(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Nd(t){return["html","body","#document"].includes(pf(t))}function Go(t){return Ui(t).getComputedStyle(t)}function Ib(t){return Vo(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function kl(t){if(pf(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ok(t)&&t.host||Rs(t);return Ok(e)?e.host:e}function hF(t){const e=kl(t);return Nd(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ns(e)&&zm(e)?e:hF(e)}function vp(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=hF(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Ui(i);if(o){const l=YC(s);return e.concat(s,s.visualViewport||[],zm(i)?i:[],l&&n?vp(l):[])}return e.concat(i,vp(i,[],n))}function YC(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function pF(t){const e=Go(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Ns(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,l=ay(n)!==o||ay(r)!==s;return l&&(n=o,r=s),{width:n,height:r,$:l}}function Tj(t){return Vo(t)?t:t.contextElement}function Zu(t){const e=Tj(t);if(!Ns(e))return Tl(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=pF(e);let s=(o?ay(n.width):n.width)/r,l=(o?ay(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const a9=Tl(0);function mF(t){const e=Ui(t);return!Nj()||!e.visualViewport?a9:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function l9(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Ui(t)?!1:e}function Uc(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=Tj(t);let s=Tl(1);e&&(r?Vo(r)&&(s=Zu(r)):s=Zu(t));const l=l9(o,n,r)?mF(o):Tl(0);let c=(i.left+l.x)/s.x,u=(i.top+l.y)/s.y,d=i.width/s.x,f=i.height/s.y;if(o){const h=Ui(o),p=r&&Vo(r)?Ui(r):r;let g=h,m=YC(g);for(;m&&r&&p!==g;){const v=Zu(m),b=m.getBoundingClientRect(),x=Go(m),w=b.left+(m.clientLeft+parseFloat(x.paddingLeft))*v.x,S=b.top+(m.clientTop+parseFloat(x.paddingTop))*v.y;c*=v.x,u*=v.y,d*=v.x,f*=v.y,c+=w,u+=S,g=Ui(m),m=YC(g)}}return cy({width:d,height:f,x:c,y:u})}function c9(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=Rs(r),l=e?Ob(e.floating):!1;if(r===s||l&&o)return n;let c={scrollLeft:0,scrollTop:0},u=Tl(1);const d=Tl(0),f=Ns(r);if((f||!f&&!o)&&((pf(r)!=="body"||zm(s))&&(c=Ib(r)),Ns(r))){const h=Uc(r);u=Zu(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 u9(t){return Array.from(t.getClientRects())}function QC(t,e){const n=Ib(t).scrollLeft;return e?e.left+n:Uc(Rs(t)).left+n}function d9(t){const e=Rs(t),n=Ib(t),r=t.ownerDocument.body,i=Di(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=Di(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+QC(t);const l=-n.scrollTop;return Go(r).direction==="rtl"&&(s+=Di(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:l}}function f9(t,e){const n=Ui(t),r=Rs(t),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,l=0,c=0;if(i){o=i.width,s=i.height;const u=Nj();(!u||u&&e==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:l,y:c}}function h9(t,e){const n=Uc(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=Ns(t)?Zu(t):Tl(1),s=t.clientWidth*o.x,l=t.clientHeight*o.y,c=i*o.x,u=r*o.y;return{width:s,height:l,x:c,y:u}}function Ik(t,e,n){let r;if(e==="viewport")r=f9(t,n);else if(e==="document")r=d9(Rs(t));else if(Vo(e))r=h9(e,n);else{const i=mF(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return cy(r)}function gF(t,e){const n=kl(t);return n===e||!Vo(n)||Nd(n)?!1:Go(n).position==="fixed"||gF(n,e)}function p9(t,e){const n=e.get(t);if(n)return n;let r=vp(t,[],!1).filter(l=>Vo(l)&&pf(l)!=="body"),i=null;const o=Go(t).position==="fixed";let s=o?kl(t):t;for(;Vo(s)&&!Nd(s);){const l=Go(s),c=Ej(s);!c&&l.position==="fixed"&&(i=null),(o?!c&&!i:!c&&l.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||zm(s)&&!c&&gF(t,s))?r=r.filter(d=>d!==s):i=l,s=kl(s)}return e.set(t,r),r}function m9(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?Ob(e)?[]:p9(e,this._c):[].concat(n),r],l=s[0],c=s.reduce((u,d)=>{const f=Ik(e,d,i);return u.top=Di(f.top,u.top),u.right=Nl(f.right,u.right),u.bottom=Nl(f.bottom,u.bottom),u.left=Di(f.left,u.left),u},Ik(e,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function g9(t){const{width:e,height:n}=pF(t);return{width:e,height:n}}function v9(t,e,n){const r=Ns(e),i=Rs(e),o=n==="fixed",s=Uc(t,!0,o,e);let l={scrollLeft:0,scrollTop:0};const c=Tl(0);if(r||!r&&!o)if((pf(e)!=="body"||zm(i))&&(l=Ib(e)),r){const p=Uc(e,!0,o,e);c.x=p.x+e.clientLeft,c.y=p.y+e.clientTop}else i&&(c.x=QC(i));let u=0,d=0;if(i&&!r&&!o){const p=i.getBoundingClientRect();d=p.top+l.scrollTop,u=p.left+l.scrollLeft-QC(i,p)}const f=s.left+l.scrollLeft-c.x-u,h=s.top+l.scrollTop-c.y-d;return{x:f,y:h,width:s.width,height:s.height}}function Yw(t){return Go(t).position==="static"}function Rk(t,e){if(!Ns(t)||Go(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Rs(t)===n&&(n=n.ownerDocument.body),n}function vF(t,e){const n=Ui(t);if(Ob(t))return n;if(!Ns(t)){let i=kl(t);for(;i&&!Nd(i);){if(Vo(i)&&!Yw(i))return i;i=kl(i)}return n}let r=Rk(t,e);for(;r&&o9(r)&&Yw(r);)r=Rk(r,e);return r&&Nd(r)&&Yw(r)&&!Ej(r)?n:r||s9(t)||n}const y9=async function(t){const e=this.getOffsetParent||vF,n=this.getDimensions,r=await n(t.floating);return{reference:v9(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function x9(t){return Go(t).direction==="rtl"}const b9={convertOffsetParentRelativeRectToViewportRelativeRect:c9,getDocumentElement:Rs,getClippingRect:m9,getOffsetParent:vF,getElementRects:y9,getClientRects:u9,getDimensions:g9,getScale:Zu,isElement:Vo,isRTL:x9};function w9(t,e){let n=null,r;const i=Rs(t);function o(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function s(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),o();const{left:u,top:d,width:f,height:h}=t.getBoundingClientRect();if(l||e(),!f||!h)return;const p=Mg(d),g=Mg(i.clientWidth-(u+f)),m=Mg(i.clientHeight-(d+h)),v=Mg(u),x={rootMargin:-p+"px "+-g+"px "+-m+"px "+-v+"px",threshold:Di(0,Nl(1,c))||1};let w=!0;function S(C){const A=C[0].intersectionRatio;if(A!==c){if(!w)return s();A?s(!1,A):r=setTimeout(()=>{s(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(S,{...x,root:i.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(t)}return s(!0),o}function S9(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Tj(t),d=i||o?[...u?vp(u):[],...vp(e)]:[];d.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const f=u&&l?w9(u,n):null;let h=-1,p=null;s&&(p=new ResizeObserver(b=>{let[x]=b;x&&x.target===u&&p&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(e)})),n()}),u&&!c&&p.observe(u),p.observe(e));let g,m=c?Uc(t):null;c&&v();function v(){const b=Uc(t);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&n(),m=b,g=requestAnimationFrame(v)}return n(),()=>{var b;d.forEach(x=>{i&&x.removeEventListener("scroll",n),o&&x.removeEventListener("resize",n)}),f==null||f(),(b=p)==null||b.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const C9=t9,A9=n9,_9=Jq,j9=i9,E9=Zq,Mk=Xq,N9=r9,T9=(t,e,n)=>{const r=new Map,i={platform:b9,...n},o={...i.platform,_c:r};return Qq(t,e,{...i,platform:o})};var Sv=typeof document<"u"?y.useLayoutEffect:y.useEffect;function uy(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!uy(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&t.$$typeof)&&!uy(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function yF(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Dk(t,e){const n=yF(t);return Math.round(e*n)/n}function Qw(t){const e=y.useRef(t);return Sv(()=>{e.current=t}),e}function P9(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=t,[d,f]=y.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,p]=y.useState(r);uy(h,r)||p(r);const[g,m]=y.useState(null),[v,b]=y.useState(null),x=y.useCallback(M=>{M!==A.current&&(A.current=M,m(M))},[]),w=y.useCallback(M=>{M!==_.current&&(_.current=M,b(M))},[]),S=o||g,C=s||v,A=y.useRef(null),_=y.useRef(null),j=y.useRef(d),k=c!=null,P=Qw(c),I=Qw(i),E=Qw(u),R=y.useCallback(()=>{if(!A.current||!_.current)return;const M={placement:e,strategy:n,middleware:h};I.current&&(M.platform=I.current),T9(A.current,_.current,M).then(U=>{const W={...U,isPositioned:E.current!==!1};L.current&&!uy(j.current,W)&&(j.current=W,ff.flushSync(()=>{f(W)}))})},[h,e,n,I,E]);Sv(()=>{u===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,f(M=>({...M,isPositioned:!1})))},[u]);const L=y.useRef(!1);Sv(()=>(L.current=!0,()=>{L.current=!1}),[]),Sv(()=>{if(S&&(A.current=S),C&&(_.current=C),S&&C){if(P.current)return P.current(S,C,R);R()}},[S,C,R,P,k]);const V=y.useMemo(()=>({reference:A,floating:_,setReference:x,setFloating:w}),[x,w]),$=y.useMemo(()=>({reference:S,floating:C}),[S,C]),z=y.useMemo(()=>{const M={position:n,left:0,top:0};if(!$.floating)return M;const U=Dk($.floating,d.x),W=Dk($.floating,d.y);return l?{...M,transform:"translate("+U+"px, "+W+"px)",...yF($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:W}},[n,l,$.floating,d.x,d.y]);return y.useMemo(()=>({...d,update:R,refs:V,elements:$,floatingStyles:z}),[d,R,V,$,z])}const k9=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?Mk({element:r.current,padding:i}).fn(n):{}:r?Mk({element:r,padding:i}).fn(n):{}}}},O9=(t,e)=>({...C9(t),options:[t,e]}),I9=(t,e)=>({...A9(t),options:[t,e]}),R9=(t,e)=>({...N9(t),options:[t,e]}),M9=(t,e)=>({..._9(t),options:[t,e]}),D9=(t,e)=>({...j9(t),options:[t,e]}),$9=(t,e)=>({...E9(t),options:[t,e]}),L9=(t,e)=>({...k9(t),options:[t,e]});var F9="Arrow",xF=y.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...o}=t;return a.jsx(et.svg,{...o,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});xF.displayName=F9;var U9=xF;function B9(t,e=[]){let n=[];function r(o,s){const l=y.createContext(s),c=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][c])||l,v=y.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:v,children:p})}function d(f,h){const p=(h==null?void 0:h[t][c])||l,g=y.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>y.createContext(s));return function(l){const c=(l==null?void 0:l[t])||o;return y.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,H9(i,...e)]}function H9(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(o)[`__scope${u}`];return{...l,...f}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}function Vm(t){const[e,n]=y.useState(void 0);return Rr(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,l;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;s=u.inlineSize,l=u.blockSize}else s=t.offsetWidth,l=t.offsetHeight;n({width:s,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var Pj="Popper",[bF,mf]=B9(Pj),[z9,wF]=bF(Pj),SF=t=>{const{__scopePopper:e,children:n}=t,[r,i]=y.useState(null);return a.jsx(z9,{scope:e,anchor:r,onAnchorChange:i,children:n})};SF.displayName=Pj;var CF="PopperAnchor",AF=y.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,o=wF(CF,n),s=y.useRef(null),l=At(e,s);return y.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:a.jsx(et.div,{...i,ref:l})});AF.displayName=CF;var kj="PopperContent",[V9,G9]=bF(kj),_F=y.forwardRef((t,e)=>{var de,Re,pe,Se,Ne,ne;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...m}=t,v=wF(kj,n),[b,x]=y.useState(null),w=At(e,nt=>x(nt)),[S,C]=y.useState(null),A=Vm(S),_=(A==null?void 0:A.width)??0,j=(A==null?void 0:A.height)??0,k=r+(o!=="center"?"-"+o:""),P=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},I=Array.isArray(u)?u:[u],E=I.length>0,R={padding:P,boundary:I.filter(W9),altBoundary:E},{refs:L,floatingStyles:V,placement:$,isPositioned:z,middlewareData:M}=P9({strategy:"fixed",placement:k,whileElementsMounted:(...nt)=>S9(...nt,{animationFrame:p==="always"}),elements:{reference:v.anchor},middleware:[O9({mainAxis:i+j,alignmentAxis:s}),c&&I9({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?R9():void 0,...R}),c&&M9({...R}),D9({...R,apply:({elements:nt,rects:Fe,availableWidth:vt,availableHeight:mt})=>{const{width:Bt,height:N}=Fe.reference,D=nt.floating.style;D.setProperty("--radix-popper-available-width",`${vt}px`),D.setProperty("--radix-popper-available-height",`${mt}px`),D.setProperty("--radix-popper-anchor-width",`${Bt}px`),D.setProperty("--radix-popper-anchor-height",`${N}px`)}}),S&&L9({element:S,padding:l}),q9({arrowWidth:_,arrowHeight:j}),h&&$9({strategy:"referenceHidden",...R})]}),[U,W]=NF($),X=dr(g);Rr(()=>{z&&(X==null||X())},[z,X]);const re=(de=M.arrow)==null?void 0:de.x,xe=(Re=M.arrow)==null?void 0:Re.y,F=((pe=M.arrow)==null?void 0:pe.centerOffset)!==0,[fe,oe]=y.useState();return Rr(()=>{b&&oe(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:z?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:fe,"--radix-popper-transform-origin":[(Se=M.transformOrigin)==null?void 0:Se.x,(Ne=M.transformOrigin)==null?void 0:Ne.y].join(" "),...((ne=M.hide)==null?void 0:ne.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:a.jsx(V9,{scope:n,placedSide:U,onArrowChange:C,arrowX:re,arrowY:xe,shouldHideArrow:F,children:a.jsx(et.div,{"data-side":U,"data-align":W,...m,ref:w,style:{...m.style,animation:z?void 0:"none"}})})})});_F.displayName=kj;var jF="PopperArrow",K9={top:"bottom",right:"left",bottom:"top",left:"right"},EF=y.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,o=G9(jF,r),s=K9[o.placedSide];return a.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:a.jsx(U9,{...i,ref:n,style:{...i.style,display:"block"}})})});EF.displayName=jF;function W9(t){return t!==null}var q9=t=>({name:"transformOrigin",options:t,fn(e){var v,b,x;const{placement:n,rects:r,middlewareData:i}=e,s=((v=i.arrow)==null?void 0:v.centerOffset)!==0,l=s?0:t.arrowWidth,c=s?0:t.arrowHeight,[u,d]=NF(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((b=i.arrow)==null?void 0:b.x)??0)+l/2,p=(((x=i.arrow)==null?void 0:x.y)??0)+c/2;let g="",m="";return u==="bottom"?(g=s?f:`${h}px`,m=`${-c}px`):u==="top"?(g=s?f:`${h}px`,m=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,m=s?f:`${p}px`):u==="left"&&(g=`${r.floating.width+c}px`,m=s?f:`${p}px`),{data:{x:g,y:m}}}});function NF(t){const[e,n="center"]=t.split("-");return[e,n]}var TF=SF,Oj=AF,Ij=_F,Rj=EF,Y9="Portal",Rb=y.forwardRef((t,e)=>{var l;const{container:n,...r}=t,[i,o]=y.useState(!1);Rr(()=>o(!0),[]);const s=n||i&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?sF.createPortal(a.jsx(et.div,{...r,ref:e}),s):null});Rb.displayName=Y9;function Q9(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var Mr=t=>{const{present:e,children:n}=t,r=X9(e),i=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),o=At(r.ref,J9(i));return typeof n=="function"||r.isPresent?y.cloneElement(i,{ref:o}):null};Mr.displayName="Presence";function X9(t){const[e,n]=y.useState(),r=y.useRef({}),i=y.useRef(t),o=y.useRef("none"),s=t?"mounted":"unmounted",[l,c]=Q9(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const u=Dg(r.current);o.current=l==="mounted"?u:"none"},[l]),Rr(()=>{const u=r.current,d=i.current;if(d!==t){const h=o.current,p=Dg(u);t?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,c]),Rr(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,f=p=>{const m=Dg(r.current).includes(p.animationName);if(p.target===e&&m&&(c("ANIMATION_END"),!i.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},h=p=>{p.target===e&&(o.current=Dg(r.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:y.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Dg(t){return(t==null?void 0:t.animationName)||"none"}function J9(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function Ko({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=Z9({defaultProp:e,onChange:n}),o=t!==void 0,s=o?t:r,l=dr(n),c=y.useCallback(u=>{if(o){const f=typeof u=="function"?u(t):u;f!==t&&l(f)}else i(u)},[o,t,i,l]);return[s,c]}function Z9({defaultProp:t,onChange:e}){const n=y.useState(t),[r]=n,i=y.useRef(r),o=dr(e);return y.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}var eY="VisuallyHidden",Mj=y.forwardRef((t,e)=>a.jsx(et.span,{...t,ref:e,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",...t.style}}));Mj.displayName=eY;var tY=Mj,[Mb,FDe]=ji("Tooltip",[mf]),Dj=mf(),PF="TooltipProvider",nY=700,$k="tooltip.open",[rY,kF]=Mb(PF),OF=t=>{const{__scopeTooltip:e,delayDuration:n=nY,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:o}=t,[s,l]=y.useState(!0),c=y.useRef(!1),u=y.useRef(0);return y.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),a.jsx(rY,{scope:e,isOpenDelayed:s,delayDuration:n,onOpen:y.useCallback(()=>{window.clearTimeout(u.current),l(!1)},[]),onClose:y.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>l(!0),r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:y.useCallback(d=>{c.current=d},[]),disableHoverableContent:i,children:o})};OF.displayName=PF;var IF="Tooltip",[UDe,Db]=Mb(IF),XC="TooltipTrigger",iY=y.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=Db(XC,n),o=kF(XC,n),s=Dj(n),l=y.useRef(null),c=At(e,l,i.onTriggerChange),u=y.useRef(!1),d=y.useRef(!1),f=y.useCallback(()=>u.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(Oj,{asChild:!0,...s,children:a.jsx(et.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:Te(t.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:Te(t.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:Te(t.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Te(t.onFocus,()=>{u.current||i.onOpen()}),onBlur:Te(t.onBlur,i.onClose),onClick:Te(t.onClick,i.onClose)})})});iY.displayName=XC;var oY="TooltipPortal",[BDe,sY]=Mb(oY,{forceMount:void 0}),Td="TooltipContent",RF=y.forwardRef((t,e)=>{const n=sY(Td,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...o}=t,s=Db(Td,t.__scopeTooltip);return a.jsx(Mr,{present:r||s.open,children:s.disableHoverableContent?a.jsx(MF,{side:i,...o,ref:e}):a.jsx(aY,{side:i,...o,ref:e})})}),aY=y.forwardRef((t,e)=>{const n=Db(Td,t.__scopeTooltip),r=kF(Td,t.__scopeTooltip),i=y.useRef(null),o=At(e,i),[s,l]=y.useState(null),{trigger:c,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,h=y.useCallback(()=>{l(null),f(!1)},[f]),p=y.useCallback((g,m)=>{const v=g.currentTarget,b={x:g.clientX,y:g.clientY},x=dY(b,v.getBoundingClientRect()),w=fY(b,x),S=hY(m.getBoundingClientRect()),C=mY([...w,...S]);l(C),f(!0)},[f]);return y.useEffect(()=>()=>h(),[h]),y.useEffect(()=>{if(c&&d){const g=v=>p(v,d),m=v=>p(v,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",m)}}},[c,d,p,h]),y.useEffect(()=>{if(s){const g=m=>{const v=m.target,b={x:m.clientX,y:m.clientY},x=(c==null?void 0:c.contains(v))||(d==null?void 0:d.contains(v)),w=!pY(b,s);x?h():w&&(h(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,s,u,h]),a.jsx(MF,{...t,ref:o})}),[lY,cY]=Mb(IF,{isInside:!1}),MF=y.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...l}=t,c=Db(Td,n),u=Dj(n),{onClose:d}=c;return y.useEffect(()=>(document.addEventListener($k,d),()=>document.removeEventListener($k,d)),[d]),y.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(Hm,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(Ij,{"data-state":c.stateAttribute,...u,...l,ref:e,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(Cj,{children:r}),a.jsx(lY,{scope:n,isInside:!0,children:a.jsx(tY,{id:c.contentId,role:"tooltip",children:i||r})})]})})});RF.displayName=Td;var DF="TooltipArrow",uY=y.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=Dj(n);return cY(DF,n).isInside?null:a.jsx(Rj,{...i,...r,ref:e})});uY.displayName=DF;function dY(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),o=Math.abs(e.left-t.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function fY(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function hY(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function pY(t,e){const{x:n,y:r}=t;let i=!1;for(let o=0,s=e.length-1;or!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(i=!i)}return i}function mY(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),gY(e)}function gY(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const o=e[e.length-1],s=e[e.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const o=n[n.length-1],s=n[n.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var vY=OF,$F=RF;function LF(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=bY(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:s=>{const l=s.split($j);return l[0]===""&&l.length!==1&&l.shift(),FF(l,e)||xY(s)},getConflictingClassGroupIds:(s,l)=>{const c=n[s]||[];return l&&r[s]?[...c,...r[s]]:c}}},FF=(t,e)=>{var s;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?FF(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const o=t.join($j);return(s=e.validators.find(({validator:l})=>l(o)))==null?void 0:s.classGroupId},Lk=/^\[(.+)\]$/,xY=t=>{if(Lk.test(t)){const e=Lk.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},bY=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return SY(Object.entries(t.classGroups),n).forEach(([o,s])=>{JC(s,r,o,e)}),r},JC=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const o=i===""?e:Fk(e,i);o.classGroupId=n;return}if(typeof i=="function"){if(wY(i)){JC(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{JC(s,Fk(e,o),n,r)})})},Fk=(t,e)=>{let n=t;return e.split($j).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},wY=t=>t.isThemeGetter,SY=(t,e)=>e?t.map(([n,r])=>{const i=r.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,l])=>[e+s,l])):o);return[n,i]}):t,CY=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(o,s)=>{n.set(o,s),e++,e>t&&(e=0,r=n,n=new Map)};return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}},UF="!",AY=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],o=e.length,s=l=>{const c=[];let u=0,d=0,f;for(let v=0;vd?f-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:m}};return n?l=>n({className:l,parseClassName:s}):s},_Y=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},jY=t=>({cache:CY(t.cacheSize),parseClassName:AY(t),...yY(t)}),EY=/\s+/,NY=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,o=[],s=t.trim().split(EY);let l="";for(let c=s.length-1;c>=0;c-=1){const u=s[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 v=_Y(d).join(":"),b=f?v+UF:v,x=b+m;if(o.includes(x))continue;o.push(x);const w=i(m,g);for(let S=0;S0?" "+l:l)}return l};function TY(){let t=0,e,n,r="";for(;t{if(typeof t=="string")return t;let e,n="";for(let r=0;rf(d),t());return n=jY(u),r=n.cache.get,i=n.cache.set,o=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=NY(c,n);return i(c,d),d}return function(){return o(TY.apply(null,arguments))}}const Cn=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},HF=/^\[(?:([a-z-]+):)?(.+)\]$/i,kY=/^\d+\/\d+$/,OY=new Set(["px","full","screen"]),IY=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RY=/\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$/,MY=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,DY=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$Y=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Fs=t=>ed(t)||OY.has(t)||kY.test(t),Ia=t=>gf(t,"length",GY),ed=t=>!!t&&!Number.isNaN(Number(t)),Xw=t=>gf(t,"number",ed),eh=t=>!!t&&Number.isInteger(Number(t)),LY=t=>t.endsWith("%")&&ed(t.slice(0,-1)),It=t=>HF.test(t),Ra=t=>IY.test(t),FY=new Set(["length","size","percentage"]),UY=t=>gf(t,FY,zF),BY=t=>gf(t,"position",zF),HY=new Set(["image","url"]),zY=t=>gf(t,HY,WY),VY=t=>gf(t,"",KY),th=()=>!0,gf=(t,e,n)=>{const r=HF.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},GY=t=>RY.test(t)&&!MY.test(t),zF=()=>!1,KY=t=>DY.test(t),WY=t=>$Y.test(t),qY=()=>{const t=Cn("colors"),e=Cn("spacing"),n=Cn("blur"),r=Cn("brightness"),i=Cn("borderColor"),o=Cn("borderRadius"),s=Cn("borderSpacing"),l=Cn("borderWidth"),c=Cn("contrast"),u=Cn("grayscale"),d=Cn("hueRotate"),f=Cn("invert"),h=Cn("gap"),p=Cn("gradientColorStops"),g=Cn("gradientColorStopPositions"),m=Cn("inset"),v=Cn("margin"),b=Cn("opacity"),x=Cn("padding"),w=Cn("saturate"),S=Cn("scale"),C=Cn("sepia"),A=Cn("skew"),_=Cn("space"),j=Cn("translate"),k=()=>["auto","contain","none"],P=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto",It,e],E=()=>[It,e],R=()=>["",Fs,Ia],L=()=>["auto",ed,It],V=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],$=()=>["solid","dashed","dotted","double","none"],z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],M=()=>["start","end","center","between","around","evenly","stretch"],U=()=>["","0",It],W=()=>["auto","avoid","all","avoid-page","page","left","right","column"],X=()=>[ed,It];return{cacheSize:500,separator:":",theme:{colors:[th],spacing:[Fs,Ia],blur:["none","",Ra,It],brightness:X(),borderColor:[t],borderRadius:["none","","full",Ra,It],borderSpacing:E(),borderWidth:R(),contrast:X(),grayscale:U(),hueRotate:X(),invert:U(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[LY,Ia],inset:I(),margin:I(),opacity:X(),padding:E(),saturate:X(),scale:X(),sepia:U(),skew:X(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",It]}],container:["container"],columns:[{columns:[Ra]}],"break-after":[{"break-after":W()}],"break-before":[{"break-before":W()}],"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:[...V(),It]}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],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",eh,It]}],basis:[{basis:I()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",It]}],grow:[{grow:U()}],shrink:[{shrink:U()}],order:[{order:["first","last","none",eh,It]}],"grid-cols":[{"grid-cols":[th]}],"col-start-end":[{col:["auto",{span:["full",eh,It]},It]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[th]}],"row-start-end":[{row:["auto",{span:[eh,It]},It]}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",It]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",It]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...M()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...M(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...M(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[_]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[_]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",It,e]}],"min-w":[{"min-w":[It,e,"min","max","fit"]}],"max-w":[{"max-w":[It,e,"none","full","min","max","fit","prose",{screen:[Ra]},Ra]}],h:[{h:[It,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[It,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[It,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[It,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Ra,Ia]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Xw]}],"font-family":[{font:[th]}],"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",It]}],"line-clamp":[{"line-clamp":["none",ed,Xw]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Fs,It]}],"list-image":[{"list-image":["none",It]}],"list-style-type":[{list:["none","disc","decimal",It]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Fs,Ia]}],"underline-offset":[{"underline-offset":["auto",Fs,It]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",It]}],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",It]}],"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:[...V(),BY]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",UY]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},zY]}],"bg-color":[{bg:[t]}],"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:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"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:[...$(),"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:$()}],"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:["",...$()]}],"outline-offset":[{"outline-offset":[Fs,It]}],"outline-w":[{outline:[Fs,Ia]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:R()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Fs,Ia]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Ra,VY]}],"shadow-color":[{shadow:[th]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":z()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Ra,It]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"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":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",It]}],duration:[{duration:X()}],ease:[{ease:["linear","in","out","in-out",It]}],delay:[{delay:X()}],animate:[{animate:["none","spin","ping","pulse","bounce",It]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[eh,It]}],"translate-x":[{"translate-x":[j]}],"translate-y":[{"translate-y":[j]}],"skew-x":[{"skew-x":[A]}],"skew-y":[{"skew-y":[A]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",It]}],accent:[{accent:["auto",t]}],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",It]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"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",It]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Fs,Ia,Xw]}],stroke:[{stroke:[t,"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"]}}},YY=PY(qY);function Pe(...t){return YY(Et(t))}const QY=vY,XY=y.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx($F,{ref:r,sideOffset:e,className:Pe("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",t),...n}));XY.displayName=$F.displayName;var $b=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Lb=typeof window>"u"||"Deno"in globalThis;function Ao(){}function JY(t,e){return typeof t=="function"?t(e):t}function ZY(t){return typeof t=="number"&&t>=0&&t!==1/0}function eQ(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Uk(t,e){return typeof t=="function"?t(e):t}function tQ(t,e){return typeof t=="function"?t(e):t}function Bk(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:l}=t;if(s){if(r){if(e.queryHash!==Lj(s,e.options))return!1}else if(!xp(e.queryKey,s))return!1}if(n!=="all"){const c=e.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||i&&i!==e.state.fetchStatus||o&&!o(e))}function Hk(t,e){const{exact:n,status:r,predicate:i,mutationKey:o}=t;if(o){if(!e.options.mutationKey)return!1;if(n){if(yp(e.options.mutationKey)!==yp(o))return!1}else if(!xp(e.options.mutationKey,o))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function Lj(t,e){return((e==null?void 0:e.queryKeyHashFn)||yp)(t)}function yp(t){return JSON.stringify(t,(e,n)=>ZC(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function xp(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(n=>!xp(t[n],e[n])):!1}function VF(t,e){if(t===e)return t;const n=zk(t)&&zk(e);if(n||ZC(t)&&ZC(e)){const r=n?t:Object.keys(t),i=r.length,o=n?e:Object.keys(e),s=o.length,l=n?[]:{};let c=0;for(let u=0;u{setTimeout(e,t)})}function rQ(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?VF(t,e):e}function iQ(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function oQ(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var Fj=Symbol();function GF(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Fj?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Cc,Ya,fd,FD,sQ=(FD=class extends $b{constructor(){super();nn(this,Cc);nn(this,Ya);nn(this,fd);Lt(this,fd,e=>{if(!Lb&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ye(this,Ya)||this.setEventListener(ye(this,fd))}onUnsubscribe(){var e;this.hasListeners()||((e=ye(this,Ya))==null||e.call(this),Lt(this,Ya,void 0))}setEventListener(e){var n;Lt(this,fd,e),(n=ye(this,Ya))==null||n.call(this),Lt(this,Ya,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){ye(this,Cc)!==e&&(Lt(this,Cc,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof ye(this,Cc)=="boolean"?ye(this,Cc):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Cc=new WeakMap,Ya=new WeakMap,fd=new WeakMap,FD),KF=new sQ,hd,Qa,pd,UD,aQ=(UD=class extends $b{constructor(){super();nn(this,hd,!0);nn(this,Qa);nn(this,pd);Lt(this,pd,e=>{if(!Lb&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){ye(this,Qa)||this.setEventListener(ye(this,pd))}onUnsubscribe(){var e;this.hasListeners()||((e=ye(this,Qa))==null||e.call(this),Lt(this,Qa,void 0))}setEventListener(e){var n;Lt(this,pd,e),(n=ye(this,Qa))==null||n.call(this),Lt(this,Qa,e(this.setOnline.bind(this)))}setOnline(e){ye(this,hd)!==e&&(Lt(this,hd,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return ye(this,hd)}},hd=new WeakMap,Qa=new WeakMap,pd=new WeakMap,UD),dy=new aQ;function lQ(){let t,e;const n=new Promise((i,o)=>{t=i,e=o});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}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}function cQ(t){return Math.min(1e3*2**t,3e4)}function WF(t){return(t??"online")==="online"?dy.isOnline():!0}var qF=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function Jw(t){return t instanceof qF}function YF(t){let e=!1,n=0,r=!1,i;const o=lQ(),s=m=>{var v;r||(h(new qF(m)),(v=t.abort)==null||v.call(t))},l=()=>{e=!0},c=()=>{e=!1},u=()=>KF.isFocused()&&(t.networkMode==="always"||dy.isOnline())&&t.canRun(),d=()=>WF(t.networkMode)&&t.canRun(),f=m=>{var v;r||(r=!0,(v=t.onSuccess)==null||v.call(t,m),i==null||i(),o.resolve(m))},h=m=>{var v;r||(r=!0,(v=t.onError)==null||v.call(t,m),i==null||i(),o.reject(m))},p=()=>new Promise(m=>{var v;i=b=>{(r||u())&&m(b)},(v=t.onPause)==null||v.call(t)}).then(()=>{var m;i=void 0,r||(m=t.onContinue)==null||m.call(t)}),g=()=>{if(r)return;let m;const v=n===0?t.initialPromise:void 0;try{m=v??t.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(f).catch(b=>{var A;if(r)return;const x=t.retry??(Lb?0:3),w=t.retryDelay??cQ,S=typeof w=="function"?w(n,b):w,C=x===!0||typeof x=="number"&&nu()?void 0:p()).then(()=>{e?h(b):g()})})};return{promise:o,cancel:s,continue:()=>(i==null||i(),o),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?g():p().then(g),o)}}function uQ(){let t=[],e=0,n=l=>{l()},r=l=>{l()},i=l=>setTimeout(l,0);const o=l=>{e?t.push(l):i(()=>{n(l)})},s=()=>{const l=t;t=[],l.length&&i(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;e++;try{c=l()}finally{e--,e||s()}return c},batchCalls:l=>(...c)=>{o(()=>{l(...c)})},schedule:o,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{i=l}}}var ni=uQ(),Ac,BD,QF=(BD=class{constructor(){nn(this,Ac)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ZY(this.gcTime)&&Lt(this,Ac,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Lb?1/0:5*60*1e3))}clearGcTimeout(){ye(this,Ac)&&(clearTimeout(ye(this,Ac)),Lt(this,Ac,void 0))}},Ac=new WeakMap,BD),md,gd,Xi,Ur,Mm,_c,_o,zs,HD,dQ=(HD=class extends QF{constructor(e){super();nn(this,_o);nn(this,md);nn(this,gd);nn(this,Xi);nn(this,Ur);nn(this,Mm);nn(this,_c);Lt(this,_c,!1),Lt(this,Mm,e.defaultOptions),this.setOptions(e.options),this.observers=[],Lt(this,Xi,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Lt(this,md,hQ(this.options)),this.state=e.state??ye(this,md),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=ye(this,Ur))==null?void 0:e.promise}setOptions(e){this.options={...ye(this,Mm),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ye(this,Xi).remove(this)}setData(e,n){const r=rQ(this.state.data,e,this.options);return $r(this,_o,zs).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){$r(this,_o,zs).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=ye(this,Ur))==null?void 0:r.promise;return(i=ye(this,Ur))==null||i.cancel(e),n?n.then(Ao).catch(Ao):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ye(this,md))}isActive(){return this.observers.some(e=>tQ(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Fj||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!eQ(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=ye(this,Ur))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=ye(this,Ur))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),ye(this,Xi).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(ye(this,Ur)&&(ye(this,_c)?ye(this,Ur).cancel({revert:!0}):ye(this,Ur).cancelRetry()),this.scheduleGc()),ye(this,Xi).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||$r(this,_o,zs).call(this,{type:"invalidate"})}fetch(e,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(ye(this,Ur))return ye(this,Ur).continueRetry(),ye(this,Ur).promise}if(e&&this.setOptions(e),!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:()=>(Lt(this,_c,!0),r.signal)})},o=()=>{const f=GF(this.options,n),h={queryKey:this.queryKey,meta:this.meta};return i(h),Lt(this,_c,!1),this.options.persister?this.options.persister(f,h,this):f(h)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};i(s),(c=this.options.behavior)==null||c.onFetch(s,this),Lt(this,gd,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&$r(this,_o,zs).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const l=f=>{var h,p,g,m;Jw(f)&&f.silent||$r(this,_o,zs).call(this,{type:"error",error:f}),Jw(f)||((p=(h=ye(this,Xi).config).onError)==null||p.call(h,f,this),(m=(g=ye(this,Xi).config).onSettled)==null||m.call(g,this.state.data,f,this)),this.scheduleGc()};return Lt(this,Ur,YF({initialPromise:n==null?void 0:n.initialPromise,fn:s.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(v){l(v);return}(p=(h=ye(this,Xi).config).onSuccess)==null||p.call(h,f,this),(m=(g=ye(this,Xi).config).onSettled)==null||m.call(g,f,this.state.error,this),this.scheduleGc()},onError:l,onFail:(f,h)=>{$r(this,_o,zs).call(this,{type:"failed",failureCount:f,error:h})},onPause:()=>{$r(this,_o,zs).call(this,{type:"pause"})},onContinue:()=>{$r(this,_o,zs).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),ye(this,Ur).start()}},md=new WeakMap,gd=new WeakMap,Xi=new WeakMap,Ur=new WeakMap,Mm=new WeakMap,_c=new WeakMap,_o=new WeakSet,zs=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...fQ(r.data,this.options),fetchMeta:e.meta??null};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return Jw(i)&&i.revert&&ye(this,gd)?{...ye(this,gd),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,...e.state}}};this.state=n(this.state),ni.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ye(this,Xi).notify({query:this,type:"updated",action:e})})},HD);function fQ(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:WF(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function hQ(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,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 as,zD,pQ=(zD=class extends $b{constructor(e={}){super();nn(this,as);this.config=e,Lt(this,as,new Map)}build(e,n,r){const i=n.queryKey,o=n.queryHash??Lj(i,n);let s=this.get(o);return s||(s=new dQ({cache:this,queryKey:i,queryHash:o,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(s)),s}add(e){ye(this,as).has(e.queryHash)||(ye(this,as).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=ye(this,as).get(e.queryHash);n&&(e.destroy(),n===e&&ye(this,as).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){ni.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return ye(this,as).get(e)}getAll(){return[...ye(this,as).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>Bk(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>Bk(e,r)):n}notify(e){ni.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){ni.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ni.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},as=new WeakMap,zD),ls,Qr,jc,cs,Ma,VD,mQ=(VD=class extends QF{constructor(e){super();nn(this,cs);nn(this,ls);nn(this,Qr);nn(this,jc);this.mutationId=e.mutationId,Lt(this,Qr,e.mutationCache),Lt(this,ls,[]),this.state=e.state||gQ(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){ye(this,ls).includes(e)||(ye(this,ls).push(e),this.clearGcTimeout(),ye(this,Qr).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Lt(this,ls,ye(this,ls).filter(n=>n!==e)),this.scheduleGc(),ye(this,Qr).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ye(this,ls).length||(this.state.status==="pending"?this.scheduleGc():ye(this,Qr).remove(this))}continue(){var e;return((e=ye(this,jc))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,o,s,l,c,u,d,f,h,p,g,m,v,b,x,w,S,C,A,_;Lt(this,jc,YF({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(j,k)=>{$r(this,cs,Ma).call(this,{type:"failed",failureCount:j,error:k})},onPause:()=>{$r(this,cs,Ma).call(this,{type:"pause"})},onContinue:()=>{$r(this,cs,Ma).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ye(this,Qr).canRun(this)}));const n=this.state.status==="pending",r=!ye(this,jc).canStart();try{if(!n){$r(this,cs,Ma).call(this,{type:"pending",variables:e,isPaused:r}),await((o=(i=ye(this,Qr).config).onMutate)==null?void 0:o.call(i,e,this));const k=await((l=(s=this.options).onMutate)==null?void 0:l.call(s,e));k!==this.state.context&&$r(this,cs,Ma).call(this,{type:"pending",context:k,variables:e,isPaused:r})}const j=await ye(this,jc).start();return await((u=(c=ye(this,Qr).config).onSuccess)==null?void 0:u.call(c,j,e,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,j,e,this.state.context)),await((p=(h=ye(this,Qr).config).onSettled)==null?void 0:p.call(h,j,null,this.state.variables,this.state.context,this)),await((m=(g=this.options).onSettled)==null?void 0:m.call(g,j,null,e,this.state.context)),$r(this,cs,Ma).call(this,{type:"success",data:j}),j}catch(j){try{throw await((b=(v=ye(this,Qr).config).onError)==null?void 0:b.call(v,j,e,this.state.context,this)),await((w=(x=this.options).onError)==null?void 0:w.call(x,j,e,this.state.context)),await((C=(S=ye(this,Qr).config).onSettled)==null?void 0:C.call(S,void 0,j,this.state.variables,this.state.context,this)),await((_=(A=this.options).onSettled)==null?void 0:_.call(A,void 0,j,e,this.state.context)),j}finally{$r(this,cs,Ma).call(this,{type:"error",error:j})}}finally{ye(this,Qr).runNext(this)}}},ls=new WeakMap,Qr=new WeakMap,jc=new WeakMap,cs=new WeakSet,Ma=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ni.batch(()=>{ye(this,ls).forEach(r=>{r.onMutationUpdate(e)}),ye(this,Qr).notify({mutation:this,type:"updated",action:e})})},VD);function gQ(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ki,Dm,GD,vQ=(GD=class extends $b{constructor(e={}){super();nn(this,ki);nn(this,Dm);this.config=e,Lt(this,ki,new Map),Lt(this,Dm,Date.now())}build(e,n,r){const i=new mQ({mutationCache:this,mutationId:++mg(this,Dm)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){const n=$g(e),r=ye(this,ki).get(n)??[];r.push(e),ye(this,ki).set(n,r),this.notify({type:"added",mutation:e})}remove(e){var r;const n=$g(e);if(ye(this,ki).has(n)){const i=(r=ye(this,ki).get(n))==null?void 0:r.filter(o=>o!==e);i&&(i.length===0?ye(this,ki).delete(n):ye(this,ki).set(n,i))}this.notify({type:"removed",mutation:e})}canRun(e){var r;const n=(r=ye(this,ki).get($g(e)))==null?void 0:r.find(i=>i.state.status==="pending");return!n||n===e}runNext(e){var r;const n=(r=ye(this,ki).get($g(e)))==null?void 0:r.find(i=>i!==e&&i.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){ni.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}getAll(){return[...ye(this,ki).values()].flat()}find(e){const n={exact:!0,...e};return this.getAll().find(r=>Hk(n,r))}findAll(e={}){return this.getAll().filter(n=>Hk(e,n))}notify(e){ni.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return ni.batch(()=>Promise.all(e.map(n=>n.continue().catch(Ao))))}},ki=new WeakMap,Dm=new WeakMap,GD);function $g(t){var e;return((e=t.options.scope)==null?void 0:e.id)??String(t.mutationId)}function Gk(t){return{onFetch:(e,n)=>{var d,f,h,p,g;const r=e.options,i=(h=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,o=((p=e.state.data)==null?void 0:p.pages)||[],s=((g=e.state.data)==null?void 0:g.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let m=!1;const v=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(e.signal.aborted?m=!0:e.signal.addEventListener("abort",()=>{m=!0}),e.signal)})},b=GF(e.options,e.fetchOptions),x=async(w,S,C)=>{if(m)return Promise.reject();if(S==null&&w.pages.length)return Promise.resolve(w);const A={queryKey:e.queryKey,pageParam:S,direction:C?"backward":"forward",meta:e.options.meta};v(A);const _=await b(A),{maxPages:j}=e.options,k=C?oQ:iQ;return{pages:k(w.pages,_,j),pageParams:k(w.pageParams,S,j)}};if(i&&o.length){const w=i==="backward",S=w?yQ:Kk,C={pages:o,pageParams:s},A=S(r,C);l=await x(C,A,w)}else{const w=t??o.length;do{const S=c===0?s[0]??r.initialPageParam:Kk(r,l);if(c>0&&S==null)break;l=await x(l,S),c++}while(c{var m,v;return(v=(m=e.options).persister)==null?void 0:v.call(m,u,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=u}}}function Kk(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function yQ(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var Un,Xa,Ja,vd,yd,Za,xd,bd,KD,xQ=(KD=class{constructor(t={}){nn(this,Un);nn(this,Xa);nn(this,Ja);nn(this,vd);nn(this,yd);nn(this,Za);nn(this,xd);nn(this,bd);Lt(this,Un,t.queryCache||new pQ),Lt(this,Xa,t.mutationCache||new vQ),Lt(this,Ja,t.defaultOptions||{}),Lt(this,vd,new Map),Lt(this,yd,new Map),Lt(this,Za,0)}mount(){mg(this,Za)._++,ye(this,Za)===1&&(Lt(this,xd,KF.subscribe(async t=>{t&&(await this.resumePausedMutations(),ye(this,Un).onFocus())})),Lt(this,bd,dy.subscribe(async t=>{t&&(await this.resumePausedMutations(),ye(this,Un).onOnline())})))}unmount(){var t,e;mg(this,Za)._--,ye(this,Za)===0&&((t=ye(this,xd))==null||t.call(this),Lt(this,xd,void 0),(e=ye(this,bd))==null||e.call(this),Lt(this,bd,void 0))}isFetching(t){return ye(this,Un).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ye(this,Xa).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ye(this,Un).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.getQueryData(t.queryKey);if(e===void 0)return this.fetchQuery(t);{const n=this.defaultQueryOptions(t),r=ye(this,Un).build(this,n);return t.revalidateIfStale&&r.isStaleByTime(Uk(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(e)}}getQueriesData(t){return ye(this,Un).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=ye(this,Un).get(r.queryHash),o=i==null?void 0:i.state.data,s=JY(e,o);if(s!==void 0)return ye(this,Un).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(t,e,n){return ni.batch(()=>ye(this,Un).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ye(this,Un).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=ye(this,Un);ni.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=ye(this,Un),r={type:"active",...t};return ni.batch(()=>(n.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries(r,e)))}cancelQueries(t={},e={}){const n={revert:!0,...e},r=ni.batch(()=>ye(this,Un).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Ao).catch(Ao)}invalidateQueries(t={},e={}){return ni.batch(()=>{if(ye(this,Un).findAll(t).forEach(r=>{r.invalidate()}),t.refetchType==="none")return Promise.resolve();const n={...t,type:t.refetchType??t.type??"active"};return this.refetchQueries(n,e)})}refetchQueries(t={},e){const n={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},r=ni.batch(()=>ye(this,Un).findAll(t).filter(i=>!i.isDisabled()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(Ao)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(Ao)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=ye(this,Un).build(this,e);return n.isStaleByTime(Uk(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Ao).catch(Ao)}fetchInfiniteQuery(t){return t.behavior=Gk(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Ao).catch(Ao)}ensureInfiniteQueryData(t){return t.behavior=Gk(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return dy.isOnline()?ye(this,Xa).resumePausedMutations():Promise.resolve()}getQueryCache(){return ye(this,Un)}getMutationCache(){return ye(this,Xa)}getDefaultOptions(){return ye(this,Ja)}setDefaultOptions(t){Lt(this,Ja,t)}setQueryDefaults(t,e){ye(this,vd).set(yp(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...ye(this,vd).values()];let n={};return e.forEach(r=>{xp(t,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(t,e){ye(this,yd).set(yp(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...ye(this,yd).values()];let n={};return e.forEach(r=>{xp(t,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...ye(this,Ja).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Lj(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.enabled!==!0&&e.queryFn===Fj&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ye(this,Ja).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ye(this,Un).clear(),ye(this,Xa).clear()}},Un=new WeakMap,Xa=new WeakMap,Ja=new WeakMap,vd=new WeakMap,yd=new WeakMap,Za=new WeakMap,xd=new WeakMap,bd=new WeakMap,KD),bQ=y.createContext(void 0),wQ=({client:t,children:e})=>(y.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),a.jsx(bQ.Provider,{value:t,children:e}));/** * @remix-run/router v1.20.0 * * Copyright (c) Remix Software Inc. @@ -47,7 +47,7 @@ Error generating stack: `+o.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function wp(){return wp=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function ZF(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function AQ(){return Math.random().toString(36).substr(2,8)}function Yk(t,e){return{usr:t.state,key:t.key,idx:e}}function t1(t,e,n,r){return n===void 0&&(n=null),wp({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?vf(e):e,{state:n,key:e&&e.key||r||AQ()})}function hy(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function vf(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function _Q(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:o=!1}=r,s=i.history,l=nl.Pop,c=null,u=d();u==null&&(u=0,s.replaceState(wp({},s.state,{idx:u}),""));function d(){return(s.state||{idx:null}).idx}function f(){l=nl.Pop;let v=d(),b=v==null?null:v-u;u=v,c&&c({action:l,location:m.location,delta:b})}function h(v,b){l=nl.Push;let x=t1(m.location,v,b);u=d()+1;let w=Yk(x,u),S=m.createHref(x);try{s.pushState(w,"",S)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;i.location.assign(S)}o&&c&&c({action:l,location:m.location,delta:1})}function p(v,b){l=nl.Replace;let x=t1(m.location,v,b);u=d();let w=Yk(x,u),S=m.createHref(x);s.replaceState(w,"",S),o&&c&&c({action:l,location:m.location,delta:0})}function g(v){let b=i.location.origin!=="null"?i.location.origin:i.location.href,x=typeof v=="string"?v:hy(v);return x=x.replace(/ $/,"%20"),Yn(b,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,b)}let m={get action(){return l},get location(){return t(i,s)},listen(v){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(qk,f),c=v,()=>{i.removeEventListener(qk,f),c=null}},createHref(v){return e(i,v)},createURL:g,encodeLocation(v){let b=g(v);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:h,replace:p,go(v){return s.go(v)}};return m}var Qk;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Qk||(Qk={}));function jQ(t,e,n){return n===void 0&&(n="/"),EQ(t,e,n,!1)}function EQ(t,e,n,r){let i=typeof e=="string"?vf(e):e,o=Bj(i.pathname||"/",n);if(o==null)return null;let s=JF(t);NQ(s);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};c.relativePath.startsWith("/")&&(Yn(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=pl([r,c.relativePath]),d=n.concat(c);o.children&&o.children.length>0&&(Yn(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),JF(o.children,e,d,u)),!(o.path==null&&!o.index)&&e.push({path:u,score:MQ(u,o.index),routesMeta:d})};return t.forEach((o,s)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))i(o,s);else for(let c of e4(o.path))i(o,s,c)}),e}function e4(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return i?[o,""]:[o];let s=e4(r.join("/")),l=[];return l.push(...s.map(c=>c===""?o:[o,c].join("/"))),i&&l.push(...s),l.map(c=>t.startsWith("/")&&c===""?"/":c)}function NQ(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:DQ(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const TQ=/^:[\w-]+$/,PQ=3,kQ=2,OQ=1,IQ=10,RQ=-2,Xk=t=>t==="*";function MQ(t,e){let n=t.split("/"),r=n.length;return n.some(Xk)&&(r+=RQ),e&&(r+=kQ),n.filter(i=>!Xk(i)).reduce((i,o)=>i+(TQ.test(o)?PQ:o===""?OQ:IQ),r)}function DQ(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function $Q(t,e,n){let{routesMeta:r}=t,i={},o="/",s=[];for(let l=0;l{let{paramName:h,isOptional:p}=d;if(h==="*"){let m=l[f]||"";s=o.slice(0,o.length-m.length).replace(/(.)\/+$/,"$1")}const g=l[f];return p&&!g?u[h]=void 0:u[h]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:s,pattern:t}}function LQ(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),ZF(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function FQ(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return ZF(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Bj(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}function UQ(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?vf(t):t;return{pathname:n?n.startsWith("/")?n:BQ(n,e):e,search:VQ(r),hash:GQ(i)}}function BQ(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function eS(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` 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 HQ(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Hj(t,e){let n=HQ(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function zj(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=vf(t):(i=wp({},t),Yn(!i.pathname||!i.pathname.includes("?"),eS("?","pathname","search",i)),Yn(!i.pathname||!i.pathname.includes("#"),eS("#","pathname","hash",i)),Yn(!i.search||!i.search.includes("#"),eS("#","search","hash",i)));let o=t===""||i.pathname==="",s=o?"/":i.pathname,l;if(s==null)l=n;else{let f=e.length-1;if(!r&&s.startsWith("..")){let h=s.split("/");for(;h[0]==="..";)h.shift(),f-=1;i.pathname=h.join("/")}l=f>=0?e[f]:"/"}let c=UQ(i,l),u=s&&s!=="/"&&s.endsWith("/"),d=(o||s===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const pl=t=>t.join("/").replace(/\/\/+/g,"/"),zQ=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),VQ=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,GQ=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function KQ(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const t4=["post","put","patch","delete"];new Set(t4);const WQ=["get",...t4];new Set(WQ);/** + */function bp(){return bp=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function XF(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function CQ(){return Math.random().toString(36).substr(2,8)}function qk(t,e){return{usr:t.state,key:t.key,idx:e}}function e1(t,e,n,r){return n===void 0&&(n=null),bp({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?vf(e):e,{state:n,key:e&&e.key||r||CQ()})}function fy(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function vf(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function AQ(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:o=!1}=r,s=i.history,l=nl.Pop,c=null,u=d();u==null&&(u=0,s.replaceState(bp({},s.state,{idx:u}),""));function d(){return(s.state||{idx:null}).idx}function f(){l=nl.Pop;let v=d(),b=v==null?null:v-u;u=v,c&&c({action:l,location:m.location,delta:b})}function h(v,b){l=nl.Push;let x=e1(m.location,v,b);u=d()+1;let w=qk(x,u),S=m.createHref(x);try{s.pushState(w,"",S)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;i.location.assign(S)}o&&c&&c({action:l,location:m.location,delta:1})}function p(v,b){l=nl.Replace;let x=e1(m.location,v,b);u=d();let w=qk(x,u),S=m.createHref(x);s.replaceState(w,"",S),o&&c&&c({action:l,location:m.location,delta:0})}function g(v){let b=i.location.origin!=="null"?i.location.origin:i.location.href,x=typeof v=="string"?v:fy(v);return x=x.replace(/ $/,"%20"),Yn(b,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,b)}let m={get action(){return l},get location(){return t(i,s)},listen(v){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(Wk,f),c=v,()=>{i.removeEventListener(Wk,f),c=null}},createHref(v){return e(i,v)},createURL:g,encodeLocation(v){let b=g(v);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:h,replace:p,go(v){return s.go(v)}};return m}var Yk;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Yk||(Yk={}));function _Q(t,e,n){return n===void 0&&(n="/"),jQ(t,e,n,!1)}function jQ(t,e,n,r){let i=typeof e=="string"?vf(e):e,o=Uj(i.pathname||"/",n);if(o==null)return null;let s=JF(t);EQ(s);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};c.relativePath.startsWith("/")&&(Yn(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=pl([r,c.relativePath]),d=n.concat(c);o.children&&o.children.length>0&&(Yn(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),JF(o.children,e,d,u)),!(o.path==null&&!o.index)&&e.push({path:u,score:RQ(u,o.index),routesMeta:d})};return t.forEach((o,s)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))i(o,s);else for(let c of ZF(o.path))i(o,s,c)}),e}function ZF(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return i?[o,""]:[o];let s=ZF(r.join("/")),l=[];return l.push(...s.map(c=>c===""?o:[o,c].join("/"))),i&&l.push(...s),l.map(c=>t.startsWith("/")&&c===""?"/":c)}function EQ(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:MQ(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const NQ=/^:[\w-]+$/,TQ=3,PQ=2,kQ=1,OQ=10,IQ=-2,Qk=t=>t==="*";function RQ(t,e){let n=t.split("/"),r=n.length;return n.some(Qk)&&(r+=IQ),e&&(r+=PQ),n.filter(i=>!Qk(i)).reduce((i,o)=>i+(NQ.test(o)?TQ:o===""?kQ:OQ),r)}function MQ(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function DQ(t,e,n){let{routesMeta:r}=t,i={},o="/",s=[];for(let l=0;l{let{paramName:h,isOptional:p}=d;if(h==="*"){let m=l[f]||"";s=o.slice(0,o.length-m.length).replace(/(.)\/+$/,"$1")}const g=l[f];return p&&!g?u[h]=void 0:u[h]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:s,pattern:t}}function $Q(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),XF(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function LQ(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return XF(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Uj(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}function FQ(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?vf(t):t;return{pathname:n?n.startsWith("/")?n:UQ(n,e):e,search:zQ(r),hash:VQ(i)}}function UQ(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Zw(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` 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 BQ(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Bj(t,e){let n=BQ(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Hj(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=vf(t):(i=bp({},t),Yn(!i.pathname||!i.pathname.includes("?"),Zw("?","pathname","search",i)),Yn(!i.pathname||!i.pathname.includes("#"),Zw("#","pathname","hash",i)),Yn(!i.search||!i.search.includes("#"),Zw("#","search","hash",i)));let o=t===""||i.pathname==="",s=o?"/":i.pathname,l;if(s==null)l=n;else{let f=e.length-1;if(!r&&s.startsWith("..")){let h=s.split("/");for(;h[0]==="..";)h.shift(),f-=1;i.pathname=h.join("/")}l=f>=0?e[f]:"/"}let c=FQ(i,l),u=s&&s!=="/"&&s.endsWith("/"),d=(o||s===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const pl=t=>t.join("/").replace(/\/\/+/g,"/"),HQ=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),zQ=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,VQ=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function GQ(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const e4=["post","put","patch","delete"];new Set(e4);const KQ=["get",...e4];new Set(KQ);/** * React Router v6.27.0 * * Copyright (c) Remix Software Inc. @@ -56,7 +56,7 @@ Error generating stack: `+o.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Sp(){return Sp=Object.assign?Object.assign.bind():function(t){for(var e=1;e{l.current=!0}),y.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=zj(u,JSON.parse(s),o,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:pl([e,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[e,r,s,o,t])}function Gj(){let{matches:t}=y.useContext(ja),e=t[t.length-1];return e?e.params:{}}function i4(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=y.useContext(zl),{matches:i}=y.useContext(ja),{pathname:o}=Ei(),s=JSON.stringify(Hj(i,r.v7_relativeSplatPath));return y.useMemo(()=>zj(t,JSON.parse(s),o,n==="path"),[t,s,o,n])}function XQ(t,e){return ZQ(t,e)}function ZQ(t,e,n,r){yf()||Yn(!1);let{navigator:i}=y.useContext(zl),{matches:o}=y.useContext(ja),s=o[o.length-1],l=s?s.params:{};s&&s.pathname;let c=s?s.pathnameBase:"/";s&&s.route;let u=Ei(),d;if(e){var f;let v=typeof e=="string"?vf(e):e;c==="/"||(f=v.pathname)!=null&&f.startsWith(c)||Yn(!1),d=v}else d=u;let h=d.pathname||"/",p=h;if(c!=="/"){let v=c.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(v.length).join("/")}let g=jQ(t,{pathname:p}),m=rX(g&&g.map(v=>Object.assign({},v,{params:Object.assign({},l,v.params),pathname:pl([c,i.encodeLocation?i.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?c:pl([c,i.encodeLocation?i.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),o,n,r);return e&&m?y.createElement(Ub.Provider,{value:{location:Sp({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:nl.Pop}},m):m}function JQ(){let t=aX(),e=KQ(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},e),n?y.createElement("pre",{style:i},n):null,null)}const eX=y.createElement(JQ,null);class tX extends y.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?y.createElement(ja.Provider,{value:this.props.routeContext},y.createElement(n4.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function nX(t){let{routeContext:e,match:n,children:r}=t,i=y.useContext(Vj);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),y.createElement(ja.Provider,{value:e},r)}function rX(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var o;if(!n)return null;if(n.errors)t=n.matches;else if((o=r)!=null&&o.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let s=t,l=(i=n)==null?void 0:i.errors;if(l!=null){let d=s.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||Yn(!1),s=s.slice(0,Math.min(s.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((d,f,h)=>{let p,g=!1,m=null,v=null;n&&(p=l&&f.route.id?l[f.route.id]:void 0,m=f.route.errorElement||eX,c&&(u<0&&h===0?(g=!0,v=null):u===h&&(g=!0,v=f.route.hydrateFallbackElement||null)));let b=e.concat(s.slice(0,h+1)),x=()=>{let w;return p?w=m:g?w=v:f.route.Component?w=y.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,y.createElement(nX,{match:f,routeContext:{outlet:d,matches:b,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?y.createElement(tX,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:x(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):x()},null)}var o4=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(o4||{}),py=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(py||{});function iX(t){let e=y.useContext(Vj);return e||Yn(!1),e}function oX(t){let e=y.useContext(qQ);return e||Yn(!1),e}function sX(t){let e=y.useContext(ja);return e||Yn(!1),e}function s4(t){let e=sX(),n=e.matches[e.matches.length-1];return n.route.id||Yn(!1),n.route.id}function aX(){var t;let e=y.useContext(n4),n=oX(py.UseRouteError),r=s4(py.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function lX(){let{router:t}=iX(o4.UseNavigateStable),e=s4(py.UseNavigateStable),n=y.useRef(!1);return r4(()=>{n.current=!0}),y.useCallback(function(i,o){o===void 0&&(o={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Sp({fromRouteId:e},o)))},[t,e])}function a4(t){let{to:e,replace:n,state:r,relative:i}=t;yf()||Yn(!1);let{future:o,static:s}=y.useContext(zl),{matches:l}=y.useContext(ja),{pathname:c}=Ei(),u=Xn(),d=zj(e,Hj(l,o.v7_relativeSplatPath),c,i==="path"),f=JSON.stringify(d);return y.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function wo(t){Yn(!1)}function cX(t){let{basename:e="/",children:n=null,location:r,navigationType:i=nl.Pop,navigator:o,static:s=!1,future:l}=t;yf()&&Yn(!1);let c=e.replace(/^\/*/,"/"),u=y.useMemo(()=>({basename:c,navigator:o,static:s,future:Sp({v7_relativeSplatPath:!1},l)}),[c,l,o,s]);typeof r=="string"&&(r=vf(r));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:g="default"}=r,m=y.useMemo(()=>{let v=Bj(d,c);return v==null?null:{location:{pathname:v,search:f,hash:h,state:p,key:g},navigationType:i}},[c,d,f,h,p,g,i]);return m==null?null:y.createElement(zl.Provider,{value:u},y.createElement(Ub.Provider,{children:n,value:m}))}function uX(t){let{children:e,location:n}=t;return XQ(n1(e),n)}new Promise(()=>{});function n1(t,e){e===void 0&&(e=[]);let n=[];return y.Children.forEach(t,(r,i)=>{if(!y.isValidElement(r))return;let o=[...e,i];if(r.type===y.Fragment){n.push.apply(n,n1(r.props.children,o));return}r.type!==wo&&Yn(!1),!r.props.index||!r.props.children||Yn(!1);let s={id:r.props.id||o.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&&(s.children=n1(r.props.children,o)),n.push(s)}),n}/** + */function wp(){return wp=Object.assign?Object.assign.bind():function(t){for(var e=1;e{l.current=!0}),y.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=Hj(u,JSON.parse(s),o,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:pl([e,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[e,r,s,o,t])}function Vj(){let{matches:t}=y.useContext(ja),e=t[t.length-1];return e?e.params:{}}function r4(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=y.useContext(zl),{matches:i}=y.useContext(ja),{pathname:o}=Ei(),s=JSON.stringify(Bj(i,r.v7_relativeSplatPath));return y.useMemo(()=>Hj(t,JSON.parse(s),o,n==="path"),[t,s,o,n])}function QQ(t,e){return XQ(t,e)}function XQ(t,e,n,r){yf()||Yn(!1);let{navigator:i}=y.useContext(zl),{matches:o}=y.useContext(ja),s=o[o.length-1],l=s?s.params:{};s&&s.pathname;let c=s?s.pathnameBase:"/";s&&s.route;let u=Ei(),d;if(e){var f;let v=typeof e=="string"?vf(e):e;c==="/"||(f=v.pathname)!=null&&f.startsWith(c)||Yn(!1),d=v}else d=u;let h=d.pathname||"/",p=h;if(c!=="/"){let v=c.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(v.length).join("/")}let g=_Q(t,{pathname:p}),m=nX(g&&g.map(v=>Object.assign({},v,{params:Object.assign({},l,v.params),pathname:pl([c,i.encodeLocation?i.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?c:pl([c,i.encodeLocation?i.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),o,n,r);return e&&m?y.createElement(Fb.Provider,{value:{location:wp({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:nl.Pop}},m):m}function JQ(){let t=sX(),e=GQ(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},e),n?y.createElement("pre",{style:i},n):null,null)}const ZQ=y.createElement(JQ,null);class eX extends y.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?y.createElement(ja.Provider,{value:this.props.routeContext},y.createElement(t4.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function tX(t){let{routeContext:e,match:n,children:r}=t,i=y.useContext(zj);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),y.createElement(ja.Provider,{value:e},r)}function nX(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var o;if(!n)return null;if(n.errors)t=n.matches;else if((o=r)!=null&&o.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let s=t,l=(i=n)==null?void 0:i.errors;if(l!=null){let d=s.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||Yn(!1),s=s.slice(0,Math.min(s.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((d,f,h)=>{let p,g=!1,m=null,v=null;n&&(p=l&&f.route.id?l[f.route.id]:void 0,m=f.route.errorElement||ZQ,c&&(u<0&&h===0?(g=!0,v=null):u===h&&(g=!0,v=f.route.hydrateFallbackElement||null)));let b=e.concat(s.slice(0,h+1)),x=()=>{let w;return p?w=m:g?w=v:f.route.Component?w=y.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,y.createElement(tX,{match:f,routeContext:{outlet:d,matches:b,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?y.createElement(eX,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:x(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):x()},null)}var i4=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(i4||{}),hy=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(hy||{});function rX(t){let e=y.useContext(zj);return e||Yn(!1),e}function iX(t){let e=y.useContext(WQ);return e||Yn(!1),e}function oX(t){let e=y.useContext(ja);return e||Yn(!1),e}function o4(t){let e=oX(),n=e.matches[e.matches.length-1];return n.route.id||Yn(!1),n.route.id}function sX(){var t;let e=y.useContext(t4),n=iX(hy.UseRouteError),r=o4(hy.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function aX(){let{router:t}=rX(i4.UseNavigateStable),e=o4(hy.UseNavigateStable),n=y.useRef(!1);return n4(()=>{n.current=!0}),y.useCallback(function(i,o){o===void 0&&(o={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,wp({fromRouteId:e},o)))},[t,e])}function s4(t){let{to:e,replace:n,state:r,relative:i}=t;yf()||Yn(!1);let{future:o,static:s}=y.useContext(zl),{matches:l}=y.useContext(ja),{pathname:c}=Ei(),u=Xn(),d=Hj(e,Bj(l,o.v7_relativeSplatPath),c,i==="path"),f=JSON.stringify(d);return y.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function wo(t){Yn(!1)}function lX(t){let{basename:e="/",children:n=null,location:r,navigationType:i=nl.Pop,navigator:o,static:s=!1,future:l}=t;yf()&&Yn(!1);let c=e.replace(/^\/*/,"/"),u=y.useMemo(()=>({basename:c,navigator:o,static:s,future:wp({v7_relativeSplatPath:!1},l)}),[c,l,o,s]);typeof r=="string"&&(r=vf(r));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:g="default"}=r,m=y.useMemo(()=>{let v=Uj(d,c);return v==null?null:{location:{pathname:v,search:f,hash:h,state:p,key:g},navigationType:i}},[c,d,f,h,p,g,i]);return m==null?null:y.createElement(zl.Provider,{value:u},y.createElement(Fb.Provider,{children:n,value:m}))}function cX(t){let{children:e,location:n}=t;return QQ(t1(e),n)}new Promise(()=>{});function t1(t,e){e===void 0&&(e=[]);let n=[];return y.Children.forEach(t,(r,i)=>{if(!y.isValidElement(r))return;let o=[...e,i];if(r.type===y.Fragment){n.push.apply(n,t1(r.props.children,o));return}r.type!==wo&&Yn(!1),!r.props.index||!r.props.children||Yn(!1);let s={id:r.props.id||o.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&&(s.children=t1(r.props.children,o)),n.push(s)}),n}/** * React Router DOM v6.27.0 * * Copyright (c) Remix Software Inc. @@ -65,27 +65,27 @@ Error generating stack: `+o.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function r1(){return r1=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}function fX(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function hX(t,e){return t.button===0&&(!e||e==="_self")&&!fX(t)}function i1(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function pX(t,e){let n=i1(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(o=>{n.append(i,o)})}),n}const mX=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],gX="6";try{window.__reactRouterVersion=gX}catch{}const vX="startTransition",Jk=i$[vX];function yX(t){let{basename:e,children:n,future:r,window:i}=t,o=y.useRef();o.current==null&&(o.current=CQ({window:i,v5Compat:!0}));let s=o.current,[l,c]=y.useState({action:s.action,location:s.location}),{v7_startTransition:u}=r||{},d=y.useCallback(f=>{u&&Jk?Jk(()=>c(f)):c(f)},[c,u]);return y.useLayoutEffect(()=>s.listen(d),[s,d]),y.createElement(cX,{basename:e,children:n,location:l.location,navigationType:l.action,navigator:s,future:r})}const xX=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",bX=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,oo=y.forwardRef(function(e,n){let{onClick:r,relative:i,reloadDocument:o,replace:s,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=e,h=dX(e,mX),{basename:p}=y.useContext(zl),g,m=!1;if(typeof u=="string"&&bX.test(u)&&(g=u,xX))try{let w=new URL(window.location.href),S=u.startsWith("//")?new URL(w.protocol+u):new URL(u),C=Bj(S.pathname,p);S.origin===w.origin&&C!=null?u=C+S.search+S.hash:m=!0}catch{}let v=YQ(u,{relative:i}),b=wX(u,{replace:s,state:l,target:c,preventScrollReset:d,relative:i,viewTransition:f});function x(w){r&&r(w),w.defaultPrevented||b(w)}return y.createElement("a",r1({},h,{href:g||v,onClick:m||o?r:x,ref:n,target:c}))});var eO;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(eO||(eO={}));var tO;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(tO||(tO={}));function wX(t,e){let{target:n,replace:r,state:i,preventScrollReset:o,relative:s,viewTransition:l}=e===void 0?{}:e,c=Xn(),u=Ei(),d=i4(t,{relative:s});return y.useCallback(f=>{if(hX(f,n)){f.preventDefault();let h=r!==void 0?r:hy(u)===hy(d);c(t,{replace:h,state:i,preventScrollReset:o,relative:s,viewTransition:l})}},[u,c,d,r,i,n,t,o,s,l])}function SX(t){let e=y.useRef(i1(t)),n=y.useRef(!1),r=Ei(),i=y.useMemo(()=>pX(r.search,n.current?null:e.current),[r.search]),o=Xn(),s=y.useCallback((l,c)=>{const u=i1(typeof l=="function"?l(i):l);n.current=!0,o("?"+u,c)},[o,i]);return[i,s]}/** + */function n1(){return n1=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}function dX(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function fX(t,e){return t.button===0&&(!e||e==="_self")&&!dX(t)}function r1(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function hX(t,e){let n=r1(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(o=>{n.append(i,o)})}),n}const pX=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],mX="6";try{window.__reactRouterVersion=mX}catch{}const gX="startTransition",Jk=r$[gX];function vX(t){let{basename:e,children:n,future:r,window:i}=t,o=y.useRef();o.current==null&&(o.current=SQ({window:i,v5Compat:!0}));let s=o.current,[l,c]=y.useState({action:s.action,location:s.location}),{v7_startTransition:u}=r||{},d=y.useCallback(f=>{u&&Jk?Jk(()=>c(f)):c(f)},[c,u]);return y.useLayoutEffect(()=>s.listen(d),[s,d]),y.createElement(lX,{basename:e,children:n,location:l.location,navigationType:l.action,navigator:s,future:r})}const yX=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",xX=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,oo=y.forwardRef(function(e,n){let{onClick:r,relative:i,reloadDocument:o,replace:s,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=e,h=uX(e,pX),{basename:p}=y.useContext(zl),g,m=!1;if(typeof u=="string"&&xX.test(u)&&(g=u,yX))try{let w=new URL(window.location.href),S=u.startsWith("//")?new URL(w.protocol+u):new URL(u),C=Uj(S.pathname,p);S.origin===w.origin&&C!=null?u=C+S.search+S.hash:m=!0}catch{}let v=qQ(u,{relative:i}),b=bX(u,{replace:s,state:l,target:c,preventScrollReset:d,relative:i,viewTransition:f});function x(w){r&&r(w),w.defaultPrevented||b(w)}return y.createElement("a",n1({},h,{href:g||v,onClick:m||o?r:x,ref:n,target:c}))});var Zk;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Zk||(Zk={}));var eO;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(eO||(eO={}));function bX(t,e){let{target:n,replace:r,state:i,preventScrollReset:o,relative:s,viewTransition:l}=e===void 0?{}:e,c=Xn(),u=Ei(),d=r4(t,{relative:s});return y.useCallback(f=>{if(fX(f,n)){f.preventDefault();let h=r!==void 0?r:fy(u)===fy(d);c(t,{replace:h,state:i,preventScrollReset:o,relative:s,viewTransition:l})}},[u,c,d,r,i,n,t,o,s,l])}function wX(t){let e=y.useRef(r1(t)),n=y.useRef(!1),r=Ei(),i=y.useMemo(()=>hX(r.search,n.current?null:e.current),[r.search]),o=Xn(),s=y.useCallback((l,c)=>{const u=r1(typeof l=="function"?l(i):l);n.current=!0,o("?"+u,c)},[o,i]);return[i,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 CX=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),l4=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/** + */const SX=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a4=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===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 AX={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"};/** + */var CX={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 _X=y.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:s,...l},c)=>y.createElement("svg",{ref:c,...AX,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:l4("lucide",i),...l},[...s.map(([u,d])=>y.createElement(u,d)),...Array.isArray(o)?o:[o]]));/** + */const AX=y.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:s,...l},c)=>y.createElement("svg",{ref:c,...CX,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:a4("lucide",i),...l},[...s.map(([u,d])=>y.createElement(u,d)),...Array.isArray(o)?o:[o]]));/** * @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 $e=(t,e)=>{const n=y.forwardRef(({className:r,...i},o)=>y.createElement(_X,{ref:o,iconNode:e,className:l4(`lucide-${CX(t)}`,r),...i}));return n.displayName=`${t}`,n};/** + */const $e=(t,e)=>{const n=y.forwardRef(({className:r,...i},o)=>y.createElement(AX,{ref:o,iconNode:e,className:a4(`lucide-${SX(t)}`,r),...i}));return n.displayName=`${t}`,n};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. @@ -95,17 +95,17 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nO=$e("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** + */const tO=$e("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 Cp=$e("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + */const Sp=$e("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 tS=$e("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"}]]);/** + */const eS=$e("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. @@ -120,27 +120,27 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rO=$e("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"}]]);/** + */const nO=$e("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 jX=$e("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"}]]);/** + */const _X=$e("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 EX=$e("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"}]]);/** + */const jX=$e("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 o1=$e("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"}]]);/** + */const i1=$e("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 NX=$e("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"}]]);/** + */const EX=$e("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. @@ -155,7 +155,7 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Zi=$e("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const Ji=$e("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. @@ -165,57 +165,57 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const TX=$e("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"}]]);/** + */const NX=$e("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 Kj=$e("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** + */const Gj=$e("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 wh=$e("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const bh=$e("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 c4=$e("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** + */const l4=$e("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 PX=$e("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"}]]);/** + */const TX=$e("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 kX=$e("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"}]]);/** + */const PX=$e("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 Wj=$e("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + */const Kj=$e("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 OX=$e("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"}]]);/** + */const kX=$e("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 Ap=$e("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + */const Cp=$e("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 u4=$e("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"}]]);/** + */const c4=$e("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 iO=$e("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"}]]);/** + */const rO=$e("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. @@ -225,72 +225,72 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const s1=$e("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"}]]);/** + */const o1=$e("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 IX=$e("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"}]]);/** + */const OX=$e("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 a1=$e("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"}]]);/** + */const s1=$e("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 qj=$e("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** + */const Wj=$e("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 d4=$e("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"}]]);/** + */const u4=$e("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 Ji=$e("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"}]]);/** + */const Zi=$e("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 RX=$e("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"}]]);/** + */const IX=$e("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 l1=$e("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"}]]);/** + */const a1=$e("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 my=$e("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"}]]);/** + */const py=$e("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 Av=$e("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"}]]);/** + */const Cv=$e("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 MX=$e("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + */const RX=$e("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 DX=$e("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"}]]);/** + */const MX=$e("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 c1=$e("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"}]]);/** + */const l1=$e("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 $X=$e("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"}]]);/** + */const DX=$e("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. @@ -300,7 +300,7 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Fg=$e("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"}]]);/** + */const Lg=$e("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. @@ -310,27 +310,27 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const LX=$e("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"}]]);/** + */const $X=$e("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 oO=$e("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"}]]);/** + */const iO=$e("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 sO=$e("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"}]]);/** + */const oO=$e("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 FX=$e("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"}]]);/** + */const LX=$e("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 UX=$e("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"}]]);/** + */const FX=$e("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. @@ -345,27 +345,27 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const BX=$e("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"}]]);/** + */const UX=$e("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 aO=$e("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"}]]);/** + */const sO=$e("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 lO=$e("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"}]]);/** + */const aO=$e("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 HX=$e("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"}]]);/** + */const BX=$e("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 zX=$e("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** + */const HX=$e("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. @@ -375,7 +375,7 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const VX=$e("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"}]]);/** + */const zX=$e("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. @@ -385,57 +385,57 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Yj=$e("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"}]]);/** + */const qj=$e("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 Qj=$e("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const Yj=$e("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 Xj=$e("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"}]]);/** + */const Qj=$e("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 GX=$e("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"}]]);/** + */const VX=$e("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 KX=$e("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** + */const GX=$e("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 WX=$e("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"}]]);/** + */const KX=$e("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 qX=$e("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"}]]);/** + */const WX=$e("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 YX=$e("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"}]]);/** + */const qX=$e("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 gy=$e("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"}]]);/** + */const my=$e("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 QX=$e("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"}]]);/** + */const YX=$e("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 _v=$e("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"}]]);/** + */const Av=$e("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. @@ -445,22 +445,22 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const XX=$e("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"}]]);/** + */const QX=$e("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 ZX=$e("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"}]]);/** + */const XX=$e("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 f4=$e("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"}]]);/** + */const d4=$e("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 _p=$e("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"}]]);/** + */const Ap=$e("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. @@ -480,24 +480,24 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const h4=$e("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 p4(t,e){return function(){return t.apply(e,arguments)}}const{toString:eZ}=Object.prototype,{getPrototypeOf:Zj}=Object,{iterator:Bb,toStringTag:m4}=Symbol,Hb=(t=>e=>{const n=eZ.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Zo=t=>(t=t.toLowerCase(),e=>Hb(e)===t),zb=t=>e=>typeof e===t,{isArray:xf}=Array,jp=zb("undefined");function tZ(t){return t!==null&&!jp(t)&&t.constructor!==null&&!jp(t.constructor)&&Si(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const g4=Zo("ArrayBuffer");function nZ(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&g4(t.buffer),e}const rZ=zb("string"),Si=zb("function"),v4=zb("number"),Vb=t=>t!==null&&typeof t=="object",iZ=t=>t===!0||t===!1,jv=t=>{if(Hb(t)!=="object")return!1;const e=Zj(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(m4 in t)&&!(Bb in t)},oZ=Zo("Date"),sZ=Zo("File"),aZ=Zo("Blob"),lZ=Zo("FileList"),cZ=t=>Vb(t)&&Si(t.pipe),uZ=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Si(t.append)&&((e=Hb(t))==="formdata"||e==="object"&&Si(t.toString)&&t.toString()==="[object FormData]"))},dZ=Zo("URLSearchParams"),[fZ,hZ,pZ,mZ]=["ReadableStream","Request","Response","Headers"].map(Zo),gZ=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Km(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,i;if(typeof t!="object"&&(t=[t]),xf(t))for(r=0,i=t.length;r0;)if(i=n[r],e===i.toLowerCase())return i;return null}const fc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,x4=t=>!jp(t)&&t!==fc;function u1(){const{caseless:t}=x4(this)&&this||{},e={},n=(r,i)=>{const o=t&&y4(e,i)||i;jv(e[o])&&jv(r)?e[o]=u1(e[o],r):jv(r)?e[o]=u1({},r):xf(r)?e[o]=r.slice():e[o]=r};for(let r=0,i=arguments.length;r(Km(e,(i,o)=>{n&&Si(i)?t[o]=p4(i,n):t[o]=i},{allOwnKeys:r}),t),yZ=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),xZ=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},bZ=(t,e,n,r)=>{let i,o,s;const l={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],(!r||r(s,t,e))&&!l[s]&&(e[s]=t[s],l[s]=!0);t=n!==!1&&Zj(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},wZ=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},SZ=t=>{if(!t)return null;if(xf(t))return t;let e=t.length;if(!v4(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},CZ=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Zj(Uint8Array)),AZ=(t,e)=>{const r=(t&&t[Bb]).call(t);let i;for(;(i=r.next())&&!i.done;){const o=i.value;e.call(t,o[0],o[1])}},_Z=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},jZ=Zo("HTMLFormElement"),EZ=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),cO=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),NZ=Zo("RegExp"),b4=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Km(n,(i,o)=>{let s;(s=e(i,o,t))!==!1&&(r[o]=s||i)}),Object.defineProperties(t,r)},TZ=t=>{b4(t,(e,n)=>{if(Si(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Si(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},PZ=(t,e)=>{const n={},r=i=>{i.forEach(o=>{n[o]=!0})};return xf(t)?r(t):r(String(t).split(e)),n},kZ=()=>{},OZ=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function IZ(t){return!!(t&&Si(t.append)&&t[m4]==="FormData"&&t[Bb])}const RZ=t=>{const e=new Array(10),n=(r,i)=>{if(Vb(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const o=xf(r)?[]:{};return Km(r,(s,l)=>{const c=n(s,i+1);!jp(c)&&(o[l]=c)}),e[i]=void 0,o}}return r};return n(t,0)},MZ=Zo("AsyncFunction"),DZ=t=>t&&(Vb(t)||Si(t))&&Si(t.then)&&Si(t.catch),w4=((t,e)=>t?setImmediate:e?((n,r)=>(fc.addEventListener("message",({source:i,data:o})=>{i===fc&&o===n&&r.length&&r.shift()()},!1),i=>{r.push(i),fc.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Si(fc.postMessage)),$Z=typeof queueMicrotask<"u"?queueMicrotask.bind(fc):typeof process<"u"&&process.nextTick||w4,LZ=t=>t!=null&&Si(t[Bb]),ae={isArray:xf,isArrayBuffer:g4,isBuffer:tZ,isFormData:uZ,isArrayBufferView:nZ,isString:rZ,isNumber:v4,isBoolean:iZ,isObject:Vb,isPlainObject:jv,isReadableStream:fZ,isRequest:hZ,isResponse:pZ,isHeaders:mZ,isUndefined:jp,isDate:oZ,isFile:sZ,isBlob:aZ,isRegExp:NZ,isFunction:Si,isStream:cZ,isURLSearchParams:dZ,isTypedArray:CZ,isFileList:lZ,forEach:Km,merge:u1,extend:vZ,trim:gZ,stripBOM:yZ,inherits:xZ,toFlatObject:bZ,kindOf:Hb,kindOfTest:Zo,endsWith:wZ,toArray:SZ,forEachEntry:AZ,matchAll:_Z,isHTMLForm:jZ,hasOwnProperty:cO,hasOwnProp:cO,reduceDescriptors:b4,freezeMethods:TZ,toObjectSet:PZ,toCamelCase:EZ,noop:kZ,toFiniteNumber:OZ,findKey:y4,global:fc,isContextDefined:x4,isSpecCompliantForm:IZ,toJSONObject:RZ,isAsyncFn:MZ,isThenable:DZ,setImmediate:w4,asap:$Z,isIterable:LZ};function kt(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}ae.inherits(kt,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 S4=kt.prototype,C4={};["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(t=>{C4[t]={value:t}});Object.defineProperties(kt,C4);Object.defineProperty(S4,"isAxiosError",{value:!0});kt.from=(t,e,n,r,i,o)=>{const s=Object.create(S4);return ae.toFlatObject(t,s,function(c){return c!==Error.prototype},l=>l!=="isAxiosError"),kt.call(s,t.message,e,n,r,i),s.cause=t,s.name=t.name,o&&Object.assign(s,o),s};const FZ=null;function d1(t){return ae.isPlainObject(t)||ae.isArray(t)}function A4(t){return ae.endsWith(t,"[]")?t.slice(0,-2):t}function uO(t,e,n){return t?t.concat(e).map(function(i,o){return i=A4(i),!n&&o?"["+i+"]":i}).join(n?".":""):e}function UZ(t){return ae.isArray(t)&&!t.some(d1)}const BZ=ae.toFlatObject(ae,{},null,function(e){return/^is[A-Z]/.test(e)});function Gb(t,e,n){if(!ae.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=ae.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,v){return!ae.isUndefined(v[m])});const r=n.metaTokens,i=n.visitor||d,o=n.dots,s=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&ae.isSpecCompliantForm(e);if(!ae.isFunction(i))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 kt("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,v){let b=g;if(g&&!v&&typeof g=="object"){if(ae.endsWith(m,"{}"))m=r?m:m.slice(0,-2),g=JSON.stringify(g);else if(ae.isArray(g)&&UZ(g)||(ae.isFileList(g)||ae.endsWith(m,"[]"))&&(b=ae.toArray(g)))return m=A4(m),b.forEach(function(w,S){!(ae.isUndefined(w)||w===null)&&e.append(s===!0?uO([m],S,o):s===null?m:m+"[]",u(w))}),!1}return d1(g)?!0:(e.append(uO(v,m,o),u(g)),!1)}const f=[],h=Object.assign(BZ,{defaultVisitor:d,convertValue:u,isVisitable:d1});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,x){(!(ae.isUndefined(b)||b===null)&&i.call(e,b,ae.isString(x)?x.trim():x,m,h))===!0&&p(b,m?m.concat(x):[x])}),f.pop()}}if(!ae.isObject(t))throw new TypeError("data must be an object");return p(t),e}function dO(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Jj(t,e){this._pairs=[],t&&Gb(t,this,e)}const _4=Jj.prototype;_4.append=function(e,n){this._pairs.push([e,n])};_4.toString=function(e){const n=e?function(r){return e.call(this,r,dO)}:dO;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function HZ(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function j4(t,e,n){if(!e)return t;const r=n&&n.encode||HZ;ae.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(i?o=i(e,n):o=ae.isURLSearchParams(e)?e.toString():new Jj(e,n).toString(r),o){const s=t.indexOf("#");s!==-1&&(t=t.slice(0,s)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class fO{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){ae.forEach(this.handlers,function(r){r!==null&&e(r)})}}const E4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},zZ=typeof URLSearchParams<"u"?URLSearchParams:Jj,VZ=typeof FormData<"u"?FormData:null,GZ=typeof Blob<"u"?Blob:null,KZ={isBrowser:!0,classes:{URLSearchParams:zZ,FormData:VZ,Blob:GZ},protocols:["http","https","file","blob","url","data"]},eE=typeof window<"u"&&typeof document<"u",f1=typeof navigator=="object"&&navigator||void 0,WZ=eE&&(!f1||["ReactNative","NativeScript","NS"].indexOf(f1.product)<0),qZ=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",YZ=eE&&window.location.href||"http://localhost",QZ=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:eE,hasStandardBrowserEnv:WZ,hasStandardBrowserWebWorkerEnv:qZ,navigator:f1,origin:YZ},Symbol.toStringTag,{value:"Module"})),Kr={...QZ,...KZ};function XZ(t,e){return Gb(t,new Kr.classes.URLSearchParams,Object.assign({visitor:function(n,r,i,o){return Kr.isNode&&ae.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},e))}function ZZ(t){return ae.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function JZ(t){const e={},n=Object.keys(t);let r;const i=n.length;let o;for(r=0;r=n.length;return s=!s&&ae.isArray(i)?i.length:s,c?(ae.hasOwnProp(i,s)?i[s]=[i[s],r]:i[s]=r,!l):((!i[s]||!ae.isObject(i[s]))&&(i[s]=[]),e(n,r,i[s],o)&&ae.isArray(i[s])&&(i[s]=JZ(i[s])),!l)}if(ae.isFormData(t)&&ae.isFunction(t.entries)){const n={};return ae.forEachEntry(t,(r,i)=>{e(ZZ(r),i,n,0)}),n}return null}function eJ(t,e,n){if(ae.isString(t))try{return(e||JSON.parse)(t),ae.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(0,JSON.stringify)(t)}const Wm={transitional:E4,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,o=ae.isObject(e);if(o&&ae.isHTMLForm(e)&&(e=new FormData(e)),ae.isFormData(e))return i?JSON.stringify(N4(e)):e;if(ae.isArrayBuffer(e)||ae.isBuffer(e)||ae.isStream(e)||ae.isFile(e)||ae.isBlob(e)||ae.isReadableStream(e))return e;if(ae.isArrayBufferView(e))return e.buffer;if(ae.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return XZ(e,this.formSerializer).toString();if((l=ae.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Gb(l?{"files[]":e}:e,c&&new c,this.formSerializer)}}return o||i?(n.setContentType("application/json",!1),eJ(e)):e}],transformResponse:[function(e){const n=this.transitional||Wm.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(ae.isResponse(e)||ae.isReadableStream(e))return e;if(e&&ae.isString(e)&&(r&&!this.responseType||i)){const s=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(l){if(s)throw l.name==="SyntaxError"?kt.from(l,kt.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Kr.classes.FormData,Blob:Kr.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ae.forEach(["delete","get","head","post","put","patch"],t=>{Wm.headers[t]={}});const tJ=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"]),nJ=t=>{const e={};let n,r,i;return t&&t.split(` -`).forEach(function(s){i=s.indexOf(":"),n=s.substring(0,i).trim().toLowerCase(),r=s.substring(i+1).trim(),!(!n||e[n]&&tJ[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},hO=Symbol("internals");function nh(t){return t&&String(t).trim().toLowerCase()}function Ev(t){return t===!1||t==null?t:ae.isArray(t)?t.map(Ev):String(t)}function rJ(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const iJ=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function nS(t,e,n,r,i){if(ae.isFunction(r))return r.call(this,e,n);if(i&&(e=n),!!ae.isString(e)){if(ae.isString(r))return e.indexOf(r)!==-1;if(ae.isRegExp(r))return r.test(e)}}function oJ(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function sJ(t,e){const n=ae.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(i,o,s){return this[r].call(this,e,i,o,s)},configurable:!0})})}class Ci{constructor(e){e&&this.set(e)}set(e,n,r){const i=this;function o(l,c,u){const d=nh(c);if(!d)throw new Error("header name must be a non-empty string");const f=ae.findKey(i,d);(!f||i[f]===void 0||u===!0||u===void 0&&i[f]!==!1)&&(i[f||c]=Ev(l))}const s=(l,c)=>ae.forEach(l,(u,d)=>o(u,d,c));if(ae.isPlainObject(e)||e instanceof this.constructor)s(e,n);else if(ae.isString(e)&&(e=e.trim())&&!iJ(e))s(nJ(e),n);else if(ae.isObject(e)&&ae.isIterable(e)){let l={},c,u;for(const d of e){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]}s(l,n)}else e!=null&&o(n,e,r);return this}get(e,n){if(e=nh(e),e){const r=ae.findKey(this,e);if(r){const i=this[r];if(!n)return i;if(n===!0)return rJ(i);if(ae.isFunction(n))return n.call(this,i,r);if(ae.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=nh(e),e){const r=ae.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||nS(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let i=!1;function o(s){if(s=nh(s),s){const l=ae.findKey(r,s);l&&(!n||nS(r,r[l],l,n))&&(delete r[l],i=!0)}}return ae.isArray(e)?e.forEach(o):o(e),i}clear(e){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const o=n[r];(!e||nS(this,this[o],o,e,!0))&&(delete this[o],i=!0)}return i}normalize(e){const n=this,r={};return ae.forEach(this,(i,o)=>{const s=ae.findKey(r,o);if(s){n[s]=Ev(i),delete n[o];return}const l=e?oJ(o):String(o).trim();l!==o&&delete n[o],n[l]=Ev(i),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return ae.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=e&&ae.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` -`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[hO]=this[hO]={accessors:{}}).accessors,i=this.prototype;function o(s){const l=nh(s);r[l]||(sJ(i,s),r[l]=!0)}return ae.isArray(e)?e.forEach(o):o(e),this}}Ci.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ae.reduceDescriptors(Ci.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});ae.freezeMethods(Ci);function rS(t,e){const n=this||Wm,r=e||n,i=Ci.from(r.headers);let o=r.data;return ae.forEach(t,function(l){o=l.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function T4(t){return!!(t&&t.__CANCEL__)}function bf(t,e,n){kt.call(this,t??"canceled",kt.ERR_CANCELED,e,n),this.name="CanceledError"}ae.inherits(bf,kt,{__CANCEL__:!0});function P4(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new kt("Request failed with status code "+n.status,[kt.ERR_BAD_REQUEST,kt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function aJ(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function lJ(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,o=0,s;return e=e!==void 0?e:1e3,function(c){const u=Date.now(),d=r[o];s||(s=u),n[i]=c,r[i]=u;let f=o,h=0;for(;f!==i;)h+=n[f++],f=f%t;if(i=(i+1)%t,i===o&&(o=(o+1)%t),u-s{n=d,i=null,o&&(clearTimeout(o),o=null),t.apply(null,u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?s(u,d):(i=u,o||(o=setTimeout(()=>{o=null,s(i)},r-f)))},()=>i&&s(i)]}const vy=(t,e,n=3)=>{let r=0;const i=lJ(50,250);return cJ(o=>{const s=o.loaded,l=o.lengthComputable?o.total:void 0,c=s-r,u=i(c),d=s<=l;r=s;const f={loaded:s,total:l,progress:l?s/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&d?(l-s)/u:void 0,event:o,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(f)},n)},pO=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},mO=t=>(...e)=>ae.asap(()=>t(...e)),uJ=Kr.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Kr.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Kr.origin),Kr.navigator&&/(msie|trident)/i.test(Kr.navigator.userAgent)):()=>!0,dJ=Kr.hasStandardBrowserEnv?{write(t,e,n,r,i,o){const s=[t+"="+encodeURIComponent(e)];ae.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),ae.isString(r)&&s.push("path="+r),ae.isString(i)&&s.push("domain="+i),o===!0&&s.push("secure"),document.cookie=s.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function fJ(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function hJ(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function k4(t,e,n){let r=!fJ(e);return t&&(r||n==!1)?hJ(t,e):e}const gO=t=>t instanceof Ci?{...t}:t;function Gc(t,e){e=e||{};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 i(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 o(u,d){if(!ae.isUndefined(d))return r(void 0,d)}function s(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 e)return r(u,d);if(f in t)return r(void 0,u)}const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:l,headers:(u,d,f)=>i(gO(u),gO(d),f,!0)};return ae.forEach(Object.keys(Object.assign({},t,e)),function(d){const f=c[d]||i,h=f(t[d],e[d],d);ae.isUndefined(h)&&f!==l||(n[d]=h)}),n}const O4=t=>{const e=Gc({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:l}=e;e.headers=s=Ci.from(s),e.url=j4(k4(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&s.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(ae.isFormData(n)){if(Kr.hasStandardBrowserEnv||Kr.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((c=s.getContentType())!==!1){const[u,...d]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];s.setContentType([u||"multipart/form-data",...d].join("; "))}}if(Kr.hasStandardBrowserEnv&&(r&&ae.isFunction(r)&&(r=r(e)),r||r!==!1&&uJ(e.url))){const u=i&&o&&dJ.read(o);u&&s.set(i,u)}return e},pJ=typeof XMLHttpRequest<"u",mJ=pJ&&function(t){return new Promise(function(n,r){const i=O4(t);let o=i.data;const s=Ci.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 v=new XMLHttpRequest;v.open(i.method.toUpperCase(),i.url,!0),v.timeout=i.timeout;function b(){if(!v)return;const w=Ci.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),C={data:!l||l==="text"||l==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:w,config:t,request:v};P4(function(_){n(_),m()},function(_){r(_),m()},C),v=null}"onloadend"in v?v.onloadend=b:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(b)},v.onabort=function(){v&&(r(new kt("Request aborted",kt.ECONNABORTED,t,v)),v=null)},v.onerror=function(){r(new kt("Network Error",kt.ERR_NETWORK,t,v)),v=null},v.ontimeout=function(){let S=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const C=i.transitional||E4;i.timeoutErrorMessage&&(S=i.timeoutErrorMessage),r(new kt(S,C.clarifyTimeoutError?kt.ETIMEDOUT:kt.ECONNABORTED,t,v)),v=null},o===void 0&&s.setContentType(null),"setRequestHeader"in v&&ae.forEach(s.toJSON(),function(S,C){v.setRequestHeader(C,S)}),ae.isUndefined(i.withCredentials)||(v.withCredentials=!!i.withCredentials),l&&l!=="json"&&(v.responseType=i.responseType),u&&([h,g]=vy(u,!0),v.addEventListener("progress",h)),c&&v.upload&&([f,p]=vy(c),v.upload.addEventListener("progress",f),v.upload.addEventListener("loadend",p)),(i.cancelToken||i.signal)&&(d=w=>{v&&(r(!w||w.type?new bf(null,t,v):w),v.abort(),v=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const x=aJ(i.url);if(x&&Kr.protocols.indexOf(x)===-1){r(new kt("Unsupported protocol "+x+":",kt.ERR_BAD_REQUEST,t));return}v.send(o||null)})},gJ=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i;const o=function(u){if(!i){i=!0,l();const d=u instanceof Error?u:this.reason;r.abort(d instanceof kt?d:new bf(d instanceof Error?d.message:d))}};let s=e&&setTimeout(()=>{s=null,o(new kt(`timeout ${e} of ms exceeded`,kt.ETIMEDOUT))},e);const l=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),t=null)};t.forEach(u=>u.addEventListener("abort",o));const{signal:c}=r;return c.unsubscribe=()=>ae.asap(l),c}},vJ=function*(t,e){let n=t.byteLength;if(n{const i=yJ(t,e);let o=0,s,l=c=>{s||(s=!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=o+=f;n(h)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),i.return()}},{highWaterMark:2})},Kb=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",I4=Kb&&typeof ReadableStream=="function",bJ=Kb&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),R4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},wJ=I4&&R4(()=>{let t=!1;const e=new Request(Kr.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),yO=64*1024,h1=I4&&R4(()=>ae.isReadableStream(new Response("").body)),yy={stream:h1&&(t=>t.body)};Kb&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!yy[e]&&(yy[e]=ae.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new kt(`Response type '${e}' is not supported`,kt.ERR_NOT_SUPPORT,r)})})})(new Response);const SJ=async t=>{if(t==null)return 0;if(ae.isBlob(t))return t.size;if(ae.isSpecCompliantForm(t))return(await new Request(Kr.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(ae.isArrayBufferView(t)||ae.isArrayBuffer(t))return t.byteLength;if(ae.isURLSearchParams(t)&&(t=t+""),ae.isString(t))return(await bJ(t)).byteLength},CJ=async(t,e)=>{const n=ae.toFiniteNumber(t.getContentLength());return n??SJ(e)},AJ=Kb&&(async t=>{let{url:e,method:n,data:r,signal:i,cancelToken:o,timeout:s,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:d,withCredentials:f="same-origin",fetchOptions:h}=O4(t);u=u?(u+"").toLowerCase():"text";let p=gJ([i,o&&o.toAbortSignal()],s),g;const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let v;try{if(c&&wJ&&n!=="get"&&n!=="head"&&(v=await CJ(d,r))!==0){let C=new Request(e,{method:"POST",body:r,duplex:"half"}),A;if(ae.isFormData(r)&&(A=C.headers.get("content-type"))&&d.setContentType(A),C.body){const[_,j]=pO(v,vy(mO(c)));r=vO(C.body,yO,_,j)}}ae.isString(f)||(f=f?"include":"omit");const b="credentials"in Request.prototype;g=new Request(e,{...h,signal:p,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:b?f:void 0});let x=await fetch(g);const w=h1&&(u==="stream"||u==="response");if(h1&&(l||w&&m)){const C={};["status","statusText","headers"].forEach(k=>{C[k]=x[k]});const A=ae.toFiniteNumber(x.headers.get("content-length")),[_,j]=l&&pO(A,vy(mO(l),!0))||[];x=new Response(vO(x.body,yO,_,()=>{j&&j(),m&&m()}),C)}u=u||"text";let S=await yy[ae.findKey(yy,u)||"text"](x,t);return!w&&m&&m(),await new Promise((C,A)=>{P4(C,A,{data:S,headers:Ci.from(x.headers),status:x.status,statusText:x.statusText,config:t,request:g})})}catch(b){throw m&&m(),b&&b.name==="TypeError"&&/Load failed|fetch/i.test(b.message)?Object.assign(new kt("Network Error",kt.ERR_NETWORK,t,g),{cause:b.cause||b}):kt.from(b,b&&b.code,t,g)}}),p1={http:FZ,xhr:mJ,fetch:AJ};ae.forEach(p1,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const xO=t=>`- ${t}`,_J=t=>ae.isFunction(t)||t===null||t===!1,M4={getAdapter:t=>{t=ae.isArray(t)?t:[t];const{length:e}=t;let n,r;const i={};for(let o=0;o`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let s=e?o.length>1?`since : -`+o.map(xO).join(` -`):" "+xO(o[0]):"as no adapter specified";throw new kt("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:p1};function iS(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new bf(null,t)}function bO(t){return iS(t),t.headers=Ci.from(t.headers),t.data=rS.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),M4.getAdapter(t.adapter||Wm.adapter)(t).then(function(r){return iS(t),r.data=rS.call(t,t.transformResponse,r),r.headers=Ci.from(r.headers),r},function(r){return T4(r)||(iS(t),r&&r.response&&(r.response.data=rS.call(t,t.transformResponse,r.response),r.response.headers=Ci.from(r.response.headers))),Promise.reject(r)})}const D4="1.9.0",Wb={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Wb[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const wO={};Wb.transitional=function(e,n,r){function i(o,s){return"[Axios v"+D4+"] Transitional option '"+o+"'"+s+(r?". "+r:"")}return(o,s,l)=>{if(e===!1)throw new kt(i(s," has been removed"+(n?" in "+n:"")),kt.ERR_DEPRECATED);return n&&!wO[s]&&(wO[s]=!0,console.warn(i(s," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(o,s,l):!0}};Wb.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function jJ(t,e,n){if(typeof t!="object")throw new kt("options must be an object",kt.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const o=r[i],s=e[o];if(s){const l=t[o],c=l===void 0||s(l,o,t);if(c!==!0)throw new kt("option "+o+" must be "+c,kt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new kt("Unknown option "+o,kt.ERR_BAD_OPTION)}}const Nv={assertOptions:jJ,validators:Wb},rs=Nv.validators;class Tc{constructor(e){this.defaults=e||{},this.interceptors={request:new fO,response:new fO}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+o):r.stack=o}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Gc(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:o}=n;r!==void 0&&Nv.assertOptions(r,{silentJSONParsing:rs.transitional(rs.boolean),forcedJSONParsing:rs.transitional(rs.boolean),clarifyTimeoutError:rs.transitional(rs.boolean)},!1),i!=null&&(ae.isFunction(i)?n.paramsSerializer={serialize:i}:Nv.assertOptions(i,{encode:rs.function,serialize:rs.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Nv.assertOptions(n,{baseUrl:rs.spelling("baseURL"),withXsrfToken:rs.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=o&&ae.merge(o.common,o[n.method]);o&&ae.forEach(["delete","get","head","post","put","patch","common"],g=>{delete o[g]}),n.headers=Ci.concat(s,o);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=[bO.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 o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o;const s=new Promise(l=>{r.subscribe(l),o=l}).then(i);return s.cancel=function(){r.unsubscribe(o)},s},e(function(o,s,l){r.reason||(r.reason=new bf(o,s,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new tE(function(i){e=i}),cancel:e}}}function EJ(t){return function(n){return t.apply(null,n)}}function NJ(t){return ae.isObject(t)&&t.isAxiosError===!0}const m1={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(m1).forEach(([t,e])=>{m1[e]=t});function $4(t){const e=new Tc(t),n=p4(Tc.prototype.request,e);return ae.extend(n,Tc.prototype,e,{allOwnKeys:!0}),ae.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return $4(Gc(t,i))},n}const ir=$4(Wm);ir.Axios=Tc;ir.CanceledError=bf;ir.CancelToken=tE;ir.isCancel=T4;ir.VERSION=D4;ir.toFormData=Gb;ir.AxiosError=kt;ir.Cancel=ir.CanceledError;ir.all=function(e){return Promise.all(e)};ir.spread=EJ;ir.isAxiosError=NJ;ir.mergeConfig=Gc;ir.AxiosHeaders=Ci;ir.formToJSON=t=>N4(ae.isHTMLForm(t)?new FormData(t):t);ir.getAdapter=M4.getAdapter;ir.HttpStatusCode=m1;ir.default=ir;const L4="https://ai-sandbox.oliver.solutions/semblance_back/api",Le=ir.create({baseURL:L4,headers:{"Content-Type":"application/json"},timeout:6e5});Le.interceptors.request.use(t=>{var n,r;const e=localStorage.getItem("auth_token");return e&&(t.headers.Authorization=`Bearer ${e}`),t.method==="put"&&((n=t.url)!=null&&n.includes("/focus-groups/"))&&console.log("🌐 API Request:",{method:t.method,url:t.url,baseURL:t.baseURL,fullURL:`${t.baseURL}${t.url}`,data:t.data}),(r=t.url)!=null&&r.includes("/folders/")&&console.log("🌐 API Folder Request:",{method:t.method,url:t.url,baseURL:t.baseURL,fullURL:`${t.baseURL}${t.url}`,data:t.data}),t},t=>Promise.reject(t));const g1="auth_error",TJ=t=>{t!=null&&t.isPersonaCreation||(localStorage.removeItem("auth_token"),localStorage.removeItem("user"));const e=new CustomEvent(g1,{detail:t||{}});window.dispatchEvent(e)};Le.interceptors.response.use(t=>t,t=>{var e,n,r,i,o,s;if(t.response&&t.response.status===401){const l=t.config&&(((e=t.config.url)==null?void 0:e.includes("/personas"))||((n=t.config.url)==null?void 0:n.includes("/personas/batch"))||t.config.method&&((r=t.config.url)==null?void 0:r.startsWith("/personas")));console.log("API Error:",{url:(i=t.config)==null?void 0:i.url,method:(o=t.config)==null?void 0:o.method,isPersonaRequest:l}),l?console.warn("Authentication error in persona request, letting component handle it"):TJ({source:(s=t.config)==null?void 0:s.url,isPersonaCreation:!1})}return Promise.reject(t)});const Tv={login:(t,e)=>Le.post("/auth/login",{username:t,password:e}),loginWithMicrosoft:t=>Le.post("/auth/microsoft",{access_token:t}),register:(t,e,n)=>Le.post("/auth/register",{username:t,email:e,password:n}),getProfile:()=>Le.get("/auth/me")},kr={getAll:()=>Le.get("/personas/all"),getById:t=>Le.get(`/personas/${t}`),create:t=>Le.post("/personas",t),update:(t,e)=>t&&t.startsWith("local-")?(console.log("Cannot update with local ID, creating new instead:",t),Le.post("/personas",e)):Le.put(`/personas/${t}`,e),delete:t=>{const e=typeof t=="object"&&t!==null&&t._id||t;return console.log(`Deleting persona with ID: ${e}`),Le.delete(`/personas/${e}`)},createBatch:t=>Le.post("/personas/batch",t)},Ks={generate:t=>Le.post("/ai-personas/generate",t||{},{timeout:6e5}),generateAndSave:t=>Le.post("/ai-personas/generate-and-save",t||{},{timeout:6e5}),batchGenerate:t=>Le.post("/ai-personas/batch-generate",t,{timeout:6e5}),batchGenerateAndSave:t=>Le.post("/ai-personas/batch-generate-and-save",t,{timeout:6e5}),generateBasicProfiles:(t,e=5,n=.8)=>Le.post("/ai-personas/generate-basic-profiles",{audience_brief:t,count:e,temperature:n},{timeout:6e5}),completePersona:(t,e=.7)=>Le.post("/ai-personas/complete-persona",{basic_profile:t,temperature:e},{timeout:6e5}),completeAndSavePersona:(t,e=.7)=>Le.post("/ai-personas/complete-and-save-persona",{basic_profile:t,temperature:e},{timeout:6e5}),generatePersonaSummary:(t,e=.7)=>Le.post("/ai-personas/generate-persona-summary",{persona_data:t,temperature:e},{timeout:6e5}),batchGenerateWithStages:async(t,e,n=5,r=.7,i,o)=>{var s;try{console.log(`📡 API call to generate-basic-profiles with model: ${o||"gemini-2.5-pro"}`);const c=(await Le.post("/ai-personas/generate-basic-profiles",{audience_brief:t,research_objective:e,count:n,temperature:.7,customer_data_session_id:i,llm_model:o||"gemini-2.5-pro"},{timeout:6e5})).data.profiles,u=[],d=[],f=[];console.log(`📡 API call to complete-and-save-persona with model: ${o||"gemini-2.5-pro"}`);const h=c.map(g=>Le.post("/ai-personas/complete-and-save-persona",{basic_profile:g,temperature:r,customer_data_session_id:i,llm_model:o||"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 v=c[m],b={index:m,name:v.name||`Persona ${m+1}`,error:g.reason};f.push(b),console.error(`Failed to complete persona ${m+1} (${v.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((s=l.response)==null?void 0:s.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:(t,e,n=.7)=>Le.post("/ai-personas/enhance-audience-brief",{audience_brief:t,research_objective:e,temperature:n},{timeout:6e5}),batchGenerateSummaries:(t,e=.7,n)=>(console.log(`📡 Frontend: API call to batch-generate-summaries with model: ${n||"gemini-2.5-pro"}`),Le.post("/ai-personas/batch-generate-summaries",{persona_ids:t,temperature:e,llm_model:n||"gemini-2.5-pro"},{timeout:9e5})),uploadCustomerData:t=>{const e=new FormData;for(let n=0;nLe.delete(`/ai-personas/cleanup-customer-data/${t}`)},jt={getAll:()=>Le.get("/focus-groups"),getById:t=>Le.get(`/focus-groups/${t}`),create:t=>Le.post("/focus-groups",t),update:(t,e)=>Le.put(`/focus-groups/${t}`,e),delete:t=>Le.delete(`/focus-groups/${t}`),addParticipant:(t,e)=>Le.post(`/focus-groups/${t}/participants`,{persona_id:e}),removeParticipant:(t,e)=>Le.delete(`/focus-groups/${t}/participants/${e}`),sendMessage:(t,e)=>Le.post(`/focus-groups/${t}/messages`,e),getMessages:t=>Le.get(`/focus-groups/${t}/messages`),updateMessageHighlight:(t,e,n)=>Le.patch(`/focus-groups/${t}/messages/${e}`,{highlighted:n}),describeAsset:(t,e)=>Le.post(`/focus-groups/${t}/describe-asset`,{asset_filename:e},{timeout:12e4}),generateDiscussionGuide:t=>Le.post("/focus-groups/generate-discussion-guide",t,{timeout:6e5}),generateDiscussionGuideForGroup:(t,e)=>Le.post(`/focus-groups/${t}/generate-discussion-guide`,e,{timeout:6e5}),downloadDiscussionGuide:async t=>{try{const e=await Le.get(`/focus-groups/${t}/discussion-guide/download`,{responseType:"blob",timeout:3e4}),n=e.headers["content-disposition"];let r="discussion-guide.md";if(n){const l=n.match(/filename="([^"]+)"/);l&&(r=l[1])}const i=new Blob([e.data],{type:"text/markdown"}),o=URL.createObjectURL(i),s=document.createElement("a");return s.href=o,s.download=r,s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o),{success:!0,filename:r}}catch(e){throw console.error("Error downloading discussion guide:",e),new Error("Failed to download discussion guide")}},createNote:(t,e)=>Le.post(`/focus-groups/${t}/notes`,e),getNotes:t=>Le.get(`/focus-groups/${t}/notes`),deleteNote:(t,e)=>Le.delete(`/focus-groups/${t}/notes/${e}`),uploadAssets:(t,e)=>Le.post(`/focus-groups/${t}/assets`,e,{headers:{"Content-Type":"multipart/form-data"},timeout:12e4}),getAssets:t=>Le.get(`/focus-groups/${t}/assets`),getAssetUrl:(t,e)=>`${L4}/focus-groups/${t}/assets/${e}`,deleteAsset:(t,e)=>Le.delete(`/focus-groups/${t}/assets/${e}`)},Hn={generateResponse:(t,e,n,r=.7)=>Le.post("/focus-group-ai/generate-response",{focus_group_id:t,persona_id:e,current_topic:n,temperature:r},{timeout:6e5}),generateKeyThemes:(t,e=.7)=>Le.post("/focus-group-ai/generate-key-themes",{focus_group_id:t,temperature:e},{timeout:6e5}),getKeyThemes:t=>Le.get(`/focus-group-ai/key-themes/${t}`),deleteKeyTheme:(t,e)=>Le.delete(`/focus-group-ai/key-themes/${t}/${e}`),getModeratorStatus:t=>Le.get(`/focus-group-ai/moderator/status/${t}`),advanceModeratorDiscussion:t=>Le.post(`/focus-group-ai/moderator/advance/${t}`,{},{timeout:6e5}),setModeratorPosition:(t,e,n)=>Le.put(`/focus-group-ai/moderator/position/${t}`,{section_id:e,item_id:n}),startAutonomousConversation:(t,e)=>Le.post(`/focus-group-ai/autonomous/start/${t}`,{initial_prompt:e},{timeout:6e5}),stopAutonomousConversation:(t,e)=>Le.post(`/focus-group-ai/autonomous/stop/${t}`,{reason:e}),getAutonomousConversationStatus:t=>Le.get(`/focus-group-ai/autonomous/status/${t}`),getConversationState:t=>Le.get(`/focus-group-ai/conversation/state/${t}`),getConversationAnalytics:t=>Le.get(`/focus-group-ai/conversation/analytics/${t}`),makeConversationDecision:(t,e=.7,n="ai")=>Le.post(`/focus-group-ai/conversation/decision/${t}`,{temperature:e,mode:n},{timeout:6e5}),getConversationInsights:t=>Le.get(`/focus-group-ai/conversation/insights/${t}`,{timeout:6e5}),manualIntervention:(t,e,n,r)=>Le.post(`/focus-group-ai/conversation/intervene/${t}`,{action:e,message:n,participant_id:r}),getReasoningHistory:t=>Le.get(`/focus-group-ai/conversation/reasoning-history/${t}`),endSession:(t,e)=>Le.post(`/focus-group-ai/moderator/end-session/${t}`,{reason:e||"session_ended"})},ds={getAll:()=>Le.get("/folders"),getById:t=>Le.get(`/folders/${t}`),create:t=>Le.post("/folders",t),update:(t,e)=>Le.put(`/folders/${t}`,e),delete:t=>Le.delete(`/folders/${t}`),addPersona:(t,e)=>Le.post(`/folders/${t}/personas`,{persona_id:e}),removePersona:(t,e)=>Le.delete(`/folders/${t}/personas/${e}`),addPersonasBatch:(t,e)=>Le.post(`/folders/${t}/personas/batch`,{persona_ids:e}),removePersonasBatch:(t,e)=>(console.log(`🌐 API removePersonasBatch: Sending POST to /folders/${t}/personas/remove-batch with persona_ids:`,e),Le.post(`/folders/${t}/personas/remove-batch`,{persona_ids:e})),addPersonaToMultipleFolders:(t,e)=>{const n=e.map(r=>Le.post(`/folders/${r}/personas`,{persona_id:t}));return Promise.all(n)},removePersonaFromAllFolders:t=>{throw new Error("Use removePersona for specific folders")}};/*! @azure/msal-common v15.10.0 2025-08-05 */const ve={LIBRARY_NAME:"MSAL.JS",SKU:"msal.js.common",DEFAULT_AUTHORITY:"https://login.microsoftonline.com/common/",DEFAULT_AUTHORITY_HOST:"login.microsoftonline.com",DEFAULT_COMMON_TENANT:"common",ADFS:"adfs",DSTS:"dstsv2",AAD_INSTANCE_DISCOVERY_ENDPT:"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",CIAM_AUTH_URL:".ciamlogin.com",AAD_TENANT_DOMAIN_SUFFIX:".onmicrosoft.com",RESOURCE_DELIM:"|",NO_ACCOUNT:"NO_ACCOUNT",CLAIMS:"claims",CONSUMER_UTID:"9188040d-6c67-4c5b-b112-36a304b66dad",OPENID_SCOPE:"openid",PROFILE_SCOPE:"profile",OFFLINE_ACCESS_SCOPE:"offline_access",EMAIL_SCOPE:"email",CODE_GRANT_TYPE:"authorization_code",RT_GRANT_TYPE:"refresh_token",S256_CODE_CHALLENGE_METHOD:"S256",URL_FORM_CONTENT_TYPE:"application/x-www-form-urlencoded;charset=utf-8",AUTHORIZATION_PENDING:"authorization_pending",NOT_DEFINED:"not_defined",EMPTY_STRING:"",NOT_APPLICABLE:"N/A",NOT_AVAILABLE:"Not Available",FORWARD_SLASH:"/",IMDS_ENDPOINT:"http://169.254.169.254/metadata/instance/compute/location",IMDS_VERSION:"2020-06-01",IMDS_TIMEOUT:2e3,AZURE_REGION_AUTO_DISCOVER_FLAG:"TryAutoDetect",REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX:"login.microsoft.com",KNOWN_PUBLIC_CLOUDS:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"],SHR_NONCE_VALIDITY:240,INVALID_INSTANCE:"invalid_instance"},rl={SUCCESS:200,SUCCESS_RANGE_START:200,SUCCESS_RANGE_END:299,REDIRECT:302,CLIENT_ERROR:400,CLIENT_ERROR_RANGE_START:400,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,REQUEST_TIMEOUT:408,GONE:410,TOO_MANY_REQUESTS:429,CLIENT_ERROR_RANGE_END:499,SERVER_ERROR:500,SERVER_ERROR_RANGE_START:500,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,SERVER_ERROR_RANGE_END:599,MULTI_SIDED_ERROR:600},hc={GET:"GET",POST:"POST"},qm=[ve.OPENID_SCOPE,ve.PROFILE_SCOPE,ve.OFFLINE_ACCESS_SCOPE],SO=[...qm,ve.EMAIL_SCOPE],ei={CONTENT_TYPE:"Content-Type",CONTENT_LENGTH:"Content-Length",RETRY_AFTER:"Retry-After",CCS_HEADER:"X-AnchorMailbox",WWWAuthenticate:"WWW-Authenticate",AuthenticationInfo:"Authentication-Info",X_MS_REQUEST_ID:"x-ms-request-id",X_MS_HTTP_VERSION:"x-ms-httpver"},CO={ACTIVE_ACCOUNT_FILTERS:"active-account-filters"},ml={COMMON:"common",ORGANIZATIONS:"organizations",CONSUMERS:"consumers"},Ug={ACCESS_TOKEN:"access_token",XMS_CC:"xms_cc"},ri={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none",CREATE:"create",NO_SESSION:"no_session"},nE={CODE:"code",IDTOKEN_TOKEN:"id_token token",IDTOKEN_TOKEN_REFRESHTOKEN:"id_token token refresh_token"},qb={QUERY:"query",FRAGMENT:"fragment"},PJ={QUERY:"query",FRAGMENT:"fragment",FORM_POST:"form_post"},F4={IMPLICIT_GRANT:"implicit",AUTHORIZATION_CODE_GRANT:"authorization_code",CLIENT_CREDENTIALS_GRANT:"client_credentials",RESOURCE_OWNER_PASSWORD_GRANT:"password",REFRESH_TOKEN_GRANT:"refresh_token",DEVICE_CODE_GRANT:"device_code",JWT_BEARER:"urn:ietf:params:oauth:grant-type:jwt-bearer"},Bg={MSSTS_ACCOUNT_TYPE:"MSSTS",ADFS_ACCOUNT_TYPE:"ADFS",MSAV1_ACCOUNT_TYPE:"MSA",GENERIC_ACCOUNT_TYPE:"Generic"},Ep={CACHE_KEY_SEPARATOR:"-",CLIENT_INFO_SEPARATOR:"."},Pr={ID_TOKEN:"IdToken",ACCESS_TOKEN:"AccessToken",ACCESS_TOKEN_WITH_AUTH_SCHEME:"AccessToken_With_AuthScheme",REFRESH_TOKEN:"RefreshToken"},rE="appmetadata",kJ="client_info",xy="1",by={CACHE_KEY:"authority-metadata",REFRESH_TIME_SECONDS:3600*24},Ti={CONFIG:"config",CACHE:"cache",NETWORK:"network",HARDCODED_VALUES:"hardcoded_values"},jr={SCHEMA_VERSION:5,MAX_LAST_HEADER_BYTES:330,MAX_CACHED_ERRORS:50,CACHE_KEY:"server-telemetry",CATEGORY_SEPARATOR:"|",VALUE_SEPARATOR:",",OVERFLOW_TRUE:"1",OVERFLOW_FALSE:"0",UNKNOWN_ERROR:"unknown_error"},an={BEARER:"Bearer",POP:"pop",SSH:"ssh-cert"},Fh={DEFAULT_THROTTLE_TIME_SECONDS:60,DEFAULT_MAX_THROTTLE_TIME_SECONDS:3600,THROTTLING_PREFIX:"throttling",X_MS_LIB_CAPABILITY_VALUE:"retry-after, h429"},AO={INVALID_GRANT_ERROR:"invalid_grant",CLIENT_MISMATCH_ERROR:"client_mismatch"},vu={FAILED_AUTO_DETECTION:"1",INTERNAL_CACHE:"2",ENVIRONMENT_VARIABLE:"3",IMDS:"4"},oS={CONFIGURED_NO_AUTO_DETECTION:"2",AUTO_DETECTION_REQUESTED_SUCCESSFUL:"4",AUTO_DETECTION_REQUESTED_FAILED:"5"},ic={NOT_APPLICABLE:"0",FORCE_REFRESH_OR_CLAIMS:"1",NO_CACHED_ACCESS_TOKEN:"2",CACHED_ACCESS_TOKEN_EXPIRED:"3",PROACTIVELY_REFRESHED:"4"},OJ={Jwt:"JWT",Jwk:"JWK",Pop:"pop"},U4=300;/*! @azure/msal-common v15.10.0 2025-08-05 */const wy="unexpected_error",IJ="post_request_failed";/*! @azure/msal-common v15.10.0 2025-08-05 */const _O={[wy]:"Unexpected error in authentication.",[IJ]:"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details."};class hn extends Error{constructor(e,n,r){const i=n?`${e}: ${n}`:e;super(i),Object.setPrototypeOf(this,hn.prototype),this.errorCode=e||ve.EMPTY_STRING,this.errorMessage=n||ve.EMPTY_STRING,this.subError=r||ve.EMPTY_STRING,this.name="AuthError"}setCorrelationId(e){this.correlationId=e}}function v1(t,e){return new hn(t,e?`${_O[t]} ${e}`:_O[t])}/*! @azure/msal-common v15.10.0 2025-08-05 */const iE="client_info_decoding_error",B4="client_info_empty_error",oE="token_parsing_error",H4="null_or_empty_token",Ws="endpoints_resolution_error",z4="network_error",V4="openid_config_error",G4="hash_not_deserialized",Pd="invalid_state",K4="state_mismatch",y1="state_not_found",W4="nonce_mismatch",sE="auth_time_not_found",q4="max_age_transpired",RJ="multiple_matching_tokens",MJ="multiple_matching_accounts",Y4="multiple_matching_appMetadata",Q4="request_cannot_be_made",X4="cannot_remove_empty_scope",Z4="cannot_append_scopeset",x1="empty_input_scopeset",DJ="device_code_polling_cancelled",$J="device_code_expired",LJ="device_code_unknown_error",aE="no_account_in_silent_request",J4="invalid_cache_record",lE="invalid_cache_environment",b1="no_account_found",w1="no_crypto_object",FJ="unexpected_credential_type",UJ="invalid_assertion",BJ="invalid_client_credential",gl="token_refresh_required",HJ="user_timeout_reached",e3="token_claims_cnf_required_for_signedjwt",t3="authorization_code_missing_from_server_response",n3="binding_key_not_removed",r3="end_session_endpoint_not_supported",cE="key_id_missing",zJ="no_network_connectivity",VJ="user_canceled",GJ="missing_tenant_id_error",Ft="method_not_implemented",KJ="nested_app_auth_bridge_disabled";/*! @azure/msal-common v15.10.0 2025-08-05 */const jO={[iE]:"The client info could not be parsed/decoded correctly",[B4]:"The client info was empty",[oE]:"Token cannot be parsed",[H4]:"The token is null or empty",[Ws]:"Endpoints cannot be resolved",[z4]:"Network request failed",[V4]:"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints.",[G4]:"The hash parameters could not be deserialized",[Pd]:"State was not the expected format",[K4]:"State mismatch error",[y1]:"State not found",[W4]:"Nonce mismatch error",[sE]:"Max Age was requested and the ID token is missing the auth_time variable. auth_time is an optional claim and is not enabled by default - it must be enabled. See https://aka.ms/msaljs/optional-claims for more information.",[q4]:"Max Age is set to 0, or too much time has elapsed since the last end-user authentication.",[RJ]:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account.",[MJ]:"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account",[Y4]:"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata",[Q4]:"Token request cannot be made without authorization code or refresh token.",[X4]:"Cannot remove null or empty scope from ScopeSet",[Z4]:"Cannot append ScopeSet",[x1]:"Empty input ScopeSet cannot be processed",[DJ]:"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true.",[$J]:"Device code is expired.",[LJ]:"Device code stopped polling for unknown reasons.",[aE]:"Please pass an account object, silent flow is not supported without account information",[J4]:"Cache record object was null or undefined.",[lE]:"Invalid environment when attempting to create cache entry",[b1]:"No account found in cache for given key.",[w1]:"No crypto object detected.",[FJ]:"Unexpected credential type.",[UJ]:"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515",[BJ]:"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential",[gl]:"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired.",[HJ]:"User defined timeout for device code polling reached",[e3]:"Cannot generate a POP jwt if the token_claims are not populated",[t3]:"Server response does not contain an authorization code to proceed",[n3]:"Could not remove the credential's binding key from storage.",[r3]:"The provided authority does not support logout",[cE]:"A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key.",[zJ]:"No network connectivity. Check your internet connection.",[VJ]:"User cancelled the flow.",[GJ]:"A tenant id - not common, organizations, or consumers - must be specified when using the client_credentials flow.",[Ft]:"This method has not been implemented",[KJ]:"The nested app auth bridge is disabled"};class uE extends hn{constructor(e,n){super(e,n?`${jO[e]}: ${n}`:jO[e]),this.name="ClientAuthError",Object.setPrototypeOf(this,uE.prototype)}}function Ae(t,e){return new uE(t,e)}/*! @azure/msal-common v15.10.0 2025-08-05 */const Sy={createNewGuid:()=>{throw Ae(Ft)},base64Decode:()=>{throw Ae(Ft)},base64Encode:()=>{throw Ae(Ft)},base64UrlEncode:()=>{throw Ae(Ft)},encodeKid:()=>{throw Ae(Ft)},async getPublicKeyThumbprint(){throw Ae(Ft)},async removeTokenBindingKey(){throw Ae(Ft)},async clearKeystore(){throw Ae(Ft)},async signJwt(){throw Ae(Ft)},async hashString(){throw Ae(Ft)}};/*! @azure/msal-common v15.10.0 2025-08-05 */var jn;(function(t){t[t.Error=0]="Error",t[t.Warning=1]="Warning",t[t.Info=2]="Info",t[t.Verbose=3]="Verbose",t[t.Trace=4]="Trace"})(jn||(jn={}));class ya{constructor(e,n,r){this.level=jn.Info;const i=()=>{},o=e||ya.createDefaultLoggerOptions();this.localCallback=o.loggerCallback||i,this.piiLoggingEnabled=o.piiLoggingEnabled||!1,this.level=typeof o.logLevel=="number"?o.logLevel:jn.Info,this.correlationId=o.correlationId||ve.EMPTY_STRING,this.packageName=n||ve.EMPTY_STRING,this.packageVersion=r||ve.EMPTY_STRING}static createDefaultLoggerOptions(){return{loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:jn.Info}}clone(e,n,r){return new ya({loggerCallback:this.localCallback,piiLoggingEnabled:this.piiLoggingEnabled,logLevel:this.level,correlationId:r||this.correlationId},e,n)}logMessage(e,n){if(n.logLevel>this.level||!this.piiLoggingEnabled&&n.containsPii)return;const o=`${`[${new Date().toUTCString()}] : [${n.correlationId||this.correlationId||""}]`} : ${this.packageName}@${this.packageVersion} : ${jn[n.logLevel]} - ${e}`;this.executeCallback(n.logLevel,o,n.containsPii||!1)}executeCallback(e,n,r){this.localCallback&&this.localCallback(e,n,r)}error(e,n){this.logMessage(e,{logLevel:jn.Error,containsPii:!1,correlationId:n||ve.EMPTY_STRING})}errorPii(e,n){this.logMessage(e,{logLevel:jn.Error,containsPii:!0,correlationId:n||ve.EMPTY_STRING})}warning(e,n){this.logMessage(e,{logLevel:jn.Warning,containsPii:!1,correlationId:n||ve.EMPTY_STRING})}warningPii(e,n){this.logMessage(e,{logLevel:jn.Warning,containsPii:!0,correlationId:n||ve.EMPTY_STRING})}info(e,n){this.logMessage(e,{logLevel:jn.Info,containsPii:!1,correlationId:n||ve.EMPTY_STRING})}infoPii(e,n){this.logMessage(e,{logLevel:jn.Info,containsPii:!0,correlationId:n||ve.EMPTY_STRING})}verbose(e,n){this.logMessage(e,{logLevel:jn.Verbose,containsPii:!1,correlationId:n||ve.EMPTY_STRING})}verbosePii(e,n){this.logMessage(e,{logLevel:jn.Verbose,containsPii:!0,correlationId:n||ve.EMPTY_STRING})}trace(e,n){this.logMessage(e,{logLevel:jn.Trace,containsPii:!1,correlationId:n||ve.EMPTY_STRING})}tracePii(e,n){this.logMessage(e,{logLevel:jn.Trace,containsPii:!0,correlationId:n||ve.EMPTY_STRING})}isPiiLoggingEnabled(){return this.piiLoggingEnabled||!1}}/*! @azure/msal-common v15.10.0 2025-08-05 */const i3="@azure/msal-common",dE="15.10.0";/*! @azure/msal-common v15.10.0 2025-08-05 */const fE={None:"none",AzurePublic:"https://login.microsoftonline.com",AzurePpe:"https://login.windows-ppe.net",AzureChina:"https://login.chinacloudapi.cn",AzureGermany:"https://login.microsoftonline.de",AzureUsGovernment:"https://login.microsoftonline.us"};/*! @azure/msal-common v15.10.0 2025-08-05 */const o3="redirect_uri_empty",WJ="claims_request_parsing_error",s3="authority_uri_insecure",Sh="url_parse_error",a3="empty_url_error",l3="empty_input_scopes_error",hE="invalid_claims",c3="token_request_empty",u3="logout_request_empty",qJ="invalid_code_challenge_method",pE="pkce_params_missing",mE="invalid_cloud_discovery_metadata",d3="invalid_authority_metadata",f3="untrusted_authority",Yb="missing_ssh_jwk",h3="missing_ssh_kid",YJ="missing_nonce_authentication_header",QJ="invalid_authentication_header",p3="cannot_set_OIDCOptions",m3="cannot_allow_platform_broker",g3="authority_mismatch",v3="invalid_request_method_for_EAR",y3="invalid_authorize_post_body_parameters";/*! @azure/msal-common v15.10.0 2025-08-05 */const XJ={[o3]:"A redirect URI is required for all calls, and none has been set.",[WJ]:"Could not parse the given claims request object.",[s3]:"Authority URIs must use https. Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options",[Sh]:"URL could not be parsed into appropriate segments.",[a3]:"URL was empty or null.",[l3]:"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token.",[hE]:"Given claims parameter must be a stringified JSON object.",[c3]:"Token request was empty and not found in cache.",[u3]:"The logout request was null or undefined.",[qJ]:'code_challenge_method passed is invalid. Valid values are "plain" and "S256".',[pE]:"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request",[mE]:"Invalid cloudDiscoveryMetadata provided. Must be a stringified JSON object containing tenant_discovery_endpoint and metadata fields",[d3]:"Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_endpoint, issuer fields.",[f3]:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.",[Yb]:"Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme.",[h3]:"Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme.",[YJ]:"Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce.",[QJ]:"Invalid authentication header provided",[p3]:"Cannot set OIDCOptions parameter. Please change the protocol mode to OIDC or use a non-Microsoft authority.",[m3]:"Cannot set allowPlatformBroker parameter to true when not in AAD protocol mode.",[g3]:"Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority.",[y3]:"Invalid authorize post body parameters provided. If you are using authorizePostBodyParameters, the request method must be POST. Please check the request method and parameters.",[v3]:"Invalid request method for EAR protocol mode. The request method cannot be GET when using EAR protocol mode. Please change the request method to POST."};class gE extends hn{constructor(e){super(e,XJ[e]),this.name="ClientConfigurationError",Object.setPrototypeOf(this,gE.prototype)}}function mn(t){return new gE(t)}/*! @azure/msal-common v15.10.0 2025-08-05 */class Ss{static isEmptyObj(e){if(e)try{const n=JSON.parse(e);return Object.keys(n).length===0}catch{}return!0}static startsWith(e,n){return e.indexOf(n)===0}static endsWith(e,n){return e.length>=n.length&&e.lastIndexOf(n)===e.length-n.length}static queryStringToObject(e){const n={},r=e.split("&"),i=o=>decodeURIComponent(o.replace(/\+/g," "));return r.forEach(o=>{if(o.trim()){const[s,l]=o.split(/=(.+)/g,2);s&&l&&(n[i(s)]=i(l))}}),n}static trimArrayEntries(e){return e.map(n=>n.trim())}static removeEmptyStringsFromArray(e){return e.filter(n=>!!n)}static jsonParseHelper(e){try{return JSON.parse(e)}catch{return null}}static matchPattern(e,n){return new RegExp(e.replace(/\\/g,"\\\\").replace(/\*/g,"[^ ]*").replace(/\?/g,"\\?")).test(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class hr{constructor(e){const n=e?Ss.trimArrayEntries([...e]):[],r=n?Ss.removeEmptyStringsFromArray(n):[];if(!r||!r.length)throw mn(l3);this.scopes=new Set,r.forEach(i=>this.scopes.add(i))}static fromString(e){const r=(e||ve.EMPTY_STRING).split(" ");return new hr(r)}static createSearchScopes(e){const n=new hr(e);return n.containsOnlyOIDCScopes()?n.removeScope(ve.OFFLINE_ACCESS_SCOPE):n.removeOIDCScopes(),n}containsScope(e){const n=this.printScopesLowerCase().split(" "),r=new hr(n);return e?r.scopes.has(e.toLowerCase()):!1}containsScopeSet(e){return!e||e.scopes.size<=0?!1:this.scopes.size>=e.scopes.size&&e.asArray().every(n=>this.containsScope(n))}containsOnlyOIDCScopes(){let e=0;return SO.forEach(n=>{this.containsScope(n)&&(e+=1)}),this.scopes.size===e}appendScope(e){e&&this.scopes.add(e.trim())}appendScopes(e){try{e.forEach(n=>this.appendScope(n))}catch{throw Ae(Z4)}}removeScope(e){if(!e)throw Ae(X4);this.scopes.delete(e.trim())}removeOIDCScopes(){SO.forEach(e=>{this.scopes.delete(e)})}unionScopeSets(e){if(!e)throw Ae(x1);const n=new Set;return e.scopes.forEach(r=>n.add(r.toLowerCase())),this.scopes.forEach(r=>n.add(r.toLowerCase())),n}intersectingScopeSets(e){if(!e)throw Ae(x1);e.containsOnlyOIDCScopes()||e.removeOIDCScopes();const n=this.unionScopeSets(e),r=e.getScopeCount(),i=this.getScopeCount();return n.sizee.push(n)),e}printScopes(){return this.scopes?this.asArray().join(" "):ve.EMPTY_STRING}printScopesLowerCase(){return this.printScopes().toLowerCase()}}/*! @azure/msal-common v15.10.0 2025-08-05 */function EO(t,e){return!!t&&!!e&&t===e.split(".")[1]}function vE(t,e,n,r){if(r){const{oid:i,sub:o,tid:s,name:l,tfp:c,acr:u,preferred_username:d,upn:f,login_hint:h}=r,p=s||c||u||"";return{tenantId:p,localAccountId:i||o||"",name:l,username:d||f||"",loginHint:h,isHomeTenant:EO(p,t)}}else return{tenantId:n,localAccountId:e,username:"",isHomeTenant:EO(n,t)}}function yE(t,e,n,r){let i=t;if(e){const{isHomeTenant:o,...s}=e;i={...t,...s}}if(n){const{isHomeTenant:o,...s}=vE(t.homeAccountId,t.localAccountId,t.tenantId,n);return i={...i,...s,idTokenClaims:n,idToken:r},i}return i}/*! @azure/msal-common v15.10.0 2025-08-05 */function wf(t,e){const n=ZJ(t);try{const r=e(n);return JSON.parse(r)}catch{throw Ae(oE)}}function ZJ(t){if(!t)throw Ae(H4);const n=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(t);if(!n||n.length<4)throw Ae(oE);return n[2]}function x3(t,e){if(e===0||Date.now()-3e5>t+e)throw Ae(q4)}/*! @azure/msal-common v15.10.0 2025-08-05 */function b3(t){return t.startsWith("#/")?t.substring(2):t.startsWith("#")||t.startsWith("?")?t.substring(1):t}function Cy(t){if(!t||t.indexOf("=")<0)return null;try{const e=b3(t),n=Object.fromEntries(new URLSearchParams(e));if(n.code||n.ear_jwe||n.error||n.error_description||n.state)return n}catch{throw Ae(G4)}return null}function Np(t,e=!0,n){const r=new Array;return t.forEach((i,o)=>{!e&&n&&o in n?r.push(`${o}=${i}`):r.push(`${o}=${encodeURIComponent(i)}`)}),r.join("&")}/*! @azure/msal-common v15.10.0 2025-08-05 */class Kt{get urlString(){return this._urlString}constructor(e){if(this._urlString=e,!this._urlString)throw mn(a3);e.includes("#")||(this._urlString=Kt.canonicalizeUri(e))}static canonicalizeUri(e){if(e){let n=e.toLowerCase();return Ss.endsWith(n,"?")?n=n.slice(0,-1):Ss.endsWith(n,"?/")&&(n=n.slice(0,-2)),Ss.endsWith(n,"/")||(n+="/"),n}return e}validateAsUri(){let e;try{e=this.getUrlComponents()}catch{throw mn(Sh)}if(!e.HostNameAndPort||!e.PathSegments)throw mn(Sh);if(!e.Protocol||e.Protocol.toLowerCase()!=="https:")throw mn(s3)}static appendQueryString(e,n){return n?e.indexOf("?")<0?`${e}?${n}`:`${e}&${n}`:e}static removeHashFromUrl(e){return Kt.canonicalizeUri(e.split("#")[0])}replaceTenantPath(e){const n=this.getUrlComponents(),r=n.PathSegments;return e&&r.length!==0&&(r[0]===ml.COMMON||r[0]===ml.ORGANIZATIONS)&&(r[0]=e),Kt.constructAuthorityUriFromObject(n)}getUrlComponents(){const e=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),n=this.urlString.match(e);if(!n)throw mn(Sh);const r={Protocol:n[1],HostNameAndPort:n[4],AbsolutePath:n[5],QueryString:n[7]};let i=r.AbsolutePath.split("/");return i=i.filter(o=>o&&o.length>0),r.PathSegments=i,r.QueryString&&r.QueryString.endsWith("/")&&(r.QueryString=r.QueryString.substring(0,r.QueryString.length-1)),r}static getDomainFromUrl(e){const n=RegExp("^([^:/?#]+://)?([^/?#]*)"),r=e.match(n);if(!r)throw mn(Sh);return r[2]}static getAbsoluteUrl(e,n){if(e[0]===ve.FORWARD_SLASH){const i=new Kt(n).getUrlComponents();return i.Protocol+"//"+i.HostNameAndPort+e}return e}static constructAuthorityUriFromObject(e){return new Kt(e.Protocol+"//"+e.HostNameAndPort+"/"+e.PathSegments.join("/"))}static hashContainsKnownProperties(e){return!!Cy(e)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const w3={endpointMetadata:{"login.microsoftonline.com":{token_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.com/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.com/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/logout"},"login.chinacloudapi.cn":{token_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.chinacloudapi.cn/{tenantid}/discovery/v2.0/keys",issuer:"https://login.partner.microsoftonline.cn/{tenantid}/v2.0",authorization_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/logout"},"login.microsoftonline.us":{token_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.us/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.us/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/logout"}},instanceDiscoveryMetadata:{metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]}},NO=w3.endpointMetadata,xE=w3.instanceDiscoveryMetadata,S3=new Set;xE.metadata.forEach(t=>{t.aliases.forEach(e=>{S3.add(e)})});function JJ(t,e){var i;let n;const r=t.canonicalAuthority;if(r){const o=new Kt(r).getUrlComponents().HostNameAndPort;n=TO(o,(i=t.cloudDiscoveryMetadata)==null?void 0:i.metadata,Ti.CONFIG,e)||TO(o,xE.metadata,Ti.HARDCODED_VALUES,e)||t.knownAuthorities}return n||[]}function TO(t,e,n,r){if(r==null||r.trace(`getAliasesFromMetadata called with source: ${n}`),t&&e){const i=Ay(e,t);if(i)return r==null||r.trace(`getAliasesFromMetadata: found cloud discovery metadata in ${n}, returning aliases`),i.aliases;r==null||r.trace(`getAliasesFromMetadata: did not find cloud discovery metadata in ${n}`)}return null}function eee(t){return Ay(xE.metadata,t)}function Ay(t,e){for(let n=0;n1?r.sort(o=>o.idTokenClaims?-1:1)[0]:r.length===1?r[0]:null}getBaseAccountInfo(e,n){const r=this.getAccountsFilteredBy(e,n);return r.length>0?r[0].getAccountInfo():null}buildTenantProfiles(e,n,r){return e.flatMap(i=>this.getTenantProfilesFromAccountEntity(i,n,r==null?void 0:r.tenantId,r))}getTenantedAccountInfoByFilter(e,n,r,i,o){let s=null,l;if(o&&!this.tenantProfileMatchesFilter(r,o))return null;const c=this.getIdToken(e,i,n,r.tenantId);return c&&(l=wf(c.secret,this.cryptoImpl.base64Decode),!this.idTokenClaimsMatchTenantProfileFilter(l,o))?null:(s=yE(e,r,l,c==null?void 0:c.secret),s)}getTenantProfilesFromAccountEntity(e,n,r,i){const o=e.getAccountInfo();let s=o.tenantProfiles||new Map;const l=this.getTokenKeys();if(r){const u=s.get(r);if(u)s=new Map([[r,u]]);else return[]}const c=[];return s.forEach(u=>{const d=this.getTenantedAccountInfoByFilter(o,l,u,n,i);d&&c.push(d)}),c}tenantProfileMatchesFilter(e,n){return!(n.localAccountId&&!this.matchLocalAccountIdFromTenantProfile(e,n.localAccountId)||n.name&&e.name!==n.name||n.isHomeTenant!==void 0&&e.isHomeTenant!==n.isHomeTenant)}idTokenClaimsMatchTenantProfileFilter(e,n){return!(n&&(n.localAccountId&&!this.matchLocalAccountIdFromTokenClaims(e,n.localAccountId)||n.loginHint&&!this.matchLoginHintFromTokenClaims(e,n.loginHint)||n.username&&!this.matchUsername(e.preferred_username,n.username)||n.name&&!this.matchName(e,n.name)||n.sid&&!this.matchSid(e,n.sid)))}async saveCacheRecord(e,n,r){var i;if(!e)throw Ae(J4);try{e.account&&await this.setAccount(e.account,n),e.idToken&&(r==null?void 0:r.idToken)!==!1&&await this.setIdTokenCredential(e.idToken,n),e.accessToken&&(r==null?void 0:r.accessToken)!==!1&&await this.saveAccessToken(e.accessToken,n),e.refreshToken&&(r==null?void 0:r.refreshToken)!==!1&&await this.setRefreshTokenCredential(e.refreshToken,n),e.appMetadata&&this.setAppMetadata(e.appMetadata,n)}catch(o){throw(i=this.commonLogger)==null||i.error("CacheManager.saveCacheRecord: failed"),o instanceof hn?o:S1(o)}}async saveAccessToken(e,n){const r={clientId:e.clientId,credentialType:e.credentialType,environment:e.environment,homeAccountId:e.homeAccountId,realm:e.realm,tokenType:e.tokenType,requestedClaimsHash:e.requestedClaimsHash},i=this.getTokenKeys(),o=hr.fromString(e.target);i.accessToken.forEach(s=>{if(!this.accessTokenKeyMatchesFilter(s,r,!1))return;const l=this.getAccessTokenCredential(s,n);l&&this.credentialMatchesFilter(l,r)&&hr.fromString(l.target).intersectingScopeSets(o)&&this.removeAccessToken(s,n)}),await this.setAccessTokenCredential(e,n)}getAccountsFilteredBy(e,n){const r=this.getAccountKeys(),i=[];return r.forEach(o=>{var u;const s=this.getAccount(o,n);if(!s||e.homeAccountId&&!this.matchHomeAccountId(s,e.homeAccountId)||e.username&&!this.matchUsername(s.username,e.username)||e.environment&&!this.matchEnvironment(s,e.environment)||e.realm&&!this.matchRealm(s,e.realm)||e.nativeAccountId&&!this.matchNativeAccountId(s,e.nativeAccountId)||e.authorityType&&!this.matchAuthorityType(s,e.authorityType))return;const l={localAccountId:e==null?void 0:e.localAccountId,name:e==null?void 0:e.name},c=(u=s.tenantProfiles)==null?void 0:u.filter(d=>this.tenantProfileMatchesFilter(d,l));c&&c.length===0||i.push(s)}),i}credentialMatchesFilter(e,n){return!(n.clientId&&!this.matchClientId(e,n.clientId)||n.userAssertionHash&&!this.matchUserAssertionHash(e,n.userAssertionHash)||typeof n.homeAccountId=="string"&&!this.matchHomeAccountId(e,n.homeAccountId)||n.environment&&!this.matchEnvironment(e,n.environment)||n.realm&&!this.matchRealm(e,n.realm)||n.credentialType&&!this.matchCredentialType(e,n.credentialType)||n.familyId&&!this.matchFamilyId(e,n.familyId)||n.target&&!this.matchTarget(e,n.target)||(n.requestedClaimsHash||e.requestedClaimsHash)&&e.requestedClaimsHash!==n.requestedClaimsHash||e.credentialType===Pr.ACCESS_TOKEN_WITH_AUTH_SCHEME&&(n.tokenType&&!this.matchTokenType(e,n.tokenType)||n.tokenType===an.SSH&&n.keyId&&!this.matchKeyId(e,n.keyId)))}getAppMetadataFilteredBy(e){const n=this.getKeys(),r={};return n.forEach(i=>{if(!this.isAppMetadata(i))return;const o=this.getAppMetadata(i);o&&(e.environment&&!this.matchEnvironment(o,e.environment)||e.clientId&&!this.matchClientId(o,e.clientId)||(r[i]=o))}),r}getAuthorityMetadataByAlias(e){const n=this.getAuthorityMetadataKeys();let r=null;return n.forEach(i=>{if(!this.isAuthorityMetadata(i)||i.indexOf(this.clientId)===-1)return;const o=this.getAuthorityMetadata(i);o&&o.aliases.indexOf(e)!==-1&&(r=o)}),r}removeAllAccounts(e){this.getAllAccounts({},e).forEach(r=>{this.removeAccount(r,e)})}removeAccount(e,n){this.removeAccountContext(e,n);const r=this.getAccountKeys(),i=o=>o.includes(e.homeAccountId)&&o.includes(e.environment);r.filter(i).forEach(o=>{this.removeItem(o,n),this.performanceClient.incrementFields({accountsRemoved:1},n)})}removeAccountContext(e,n){const r=this.getTokenKeys(),i=o=>o.includes(e.homeAccountId)&&o.includes(e.environment);r.idToken.filter(i).forEach(o=>{this.removeIdToken(o,n)}),r.accessToken.filter(i).forEach(o=>{this.removeAccessToken(o,n)}),r.refreshToken.filter(i).forEach(o=>{this.removeRefreshToken(o,n)})}removeAccessToken(e,n){const r=this.getAccessTokenCredential(e,n);if(this.removeItem(e,n),this.performanceClient.incrementFields({accessTokensRemoved:1},n),!r||r.credentialType.toLowerCase()!==Pr.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()||r.tokenType!==an.POP)return;const i=r.keyId;i&&this.cryptoImpl.removeTokenBindingKey(i).catch(()=>{var o;this.commonLogger.error(`Failed to remove token binding key ${i}`,n),(o=this.performanceClient)==null||o.incrementFields({removeTokenBindingKeyFailure:1},n)})}removeAppMetadata(e){return this.getKeys().forEach(r=>{this.isAppMetadata(r)&&this.removeItem(r,e)}),!0}getIdToken(e,n,r,i,o){this.commonLogger.trace("CacheManager - getIdToken called");const s={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:Pr.ID_TOKEN,clientId:this.clientId,realm:i},l=this.getIdTokensByFilter(s,n,r),c=l.size;if(c<1)return this.commonLogger.info("CacheManager:getIdToken - No token found"),null;if(c>1){let u=l;if(!i){const d=new Map;l.forEach((h,p)=>{h.realm===e.tenantId&&d.set(p,h)});const f=d.size;if(f<1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account but none match account entity tenant id, returning first result"),l.values().next().value;if(f===1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account, defaulting to home tenant profile"),d.values().next().value;u=d}return this.commonLogger.info("CacheManager:getIdToken - Multiple matching ID tokens found, clearing them"),u.forEach((d,f)=>{this.removeIdToken(f,n)}),o&&n&&o.addFields({multiMatchedID:l.size},n),null}return this.commonLogger.info("CacheManager:getIdToken - Returning ID token"),l.values().next().value}getIdTokensByFilter(e,n,r){const i=r&&r.idToken||this.getTokenKeys().idToken,o=new Map;return i.forEach(s=>{if(!this.idTokenKeyMatchesFilter(s,{clientId:this.clientId,...e}))return;const l=this.getIdTokenCredential(s,n);l&&this.credentialMatchesFilter(l,e)&&o.set(s,l)}),o}idTokenKeyMatchesFilter(e,n){const r=e.toLowerCase();return!(n.clientId&&r.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&r.indexOf(n.homeAccountId.toLowerCase())===-1)}removeIdToken(e,n){this.removeItem(e,n)}removeRefreshToken(e,n){this.removeItem(e,n)}getAccessToken(e,n,r,i){const o=n.correlationId;this.commonLogger.trace("CacheManager - getAccessToken called",o);const s=hr.createSearchScopes(n.scopes),l=n.authenticationScheme||an.BEARER,c=l&&l.toLowerCase()!==an.BEARER.toLowerCase()?Pr.ACCESS_TOKEN_WITH_AUTH_SCHEME:Pr.ACCESS_TOKEN,u={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:c,clientId:this.clientId,realm:i||e.tenantId,target:s,tokenType:l,keyId:n.sshKid,requestedClaimsHash:n.requestedClaimsHash},d=r&&r.accessToken||this.getTokenKeys().accessToken,f=[];d.forEach(p=>{if(this.accessTokenKeyMatchesFilter(p,u,!0)){const g=this.getAccessTokenCredential(p,o);g&&this.credentialMatchesFilter(g,u)&&f.push(g)}});const h=f.length;return h<1?(this.commonLogger.info("CacheManager:getAccessToken - No token found",o),null):h>1?(this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them",o),f.forEach(p=>{this.removeAccessToken(this.generateCredentialKey(p),o)}),this.performanceClient.addFields({multiMatchedAT:f.length},o),null):(this.commonLogger.info("CacheManager:getAccessToken - Returning access token",o),f[0])}accessTokenKeyMatchesFilter(e,n,r){const i=e.toLowerCase();if(n.clientId&&i.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&i.indexOf(n.homeAccountId.toLowerCase())===-1||n.realm&&i.indexOf(n.realm.toLowerCase())===-1||n.requestedClaimsHash&&i.indexOf(n.requestedClaimsHash.toLowerCase())===-1)return!1;if(n.target){const o=n.target.asArray();for(let s=0;s{if(!this.accessTokenKeyMatchesFilter(o,e,!0))return;const s=this.getAccessTokenCredential(o,n);s&&this.credentialMatchesFilter(s,e)&&i.push(s)}),i}getRefreshToken(e,n,r,i,o){this.commonLogger.trace("CacheManager - getRefreshToken called");const s=n?xy:void 0,l={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:Pr.REFRESH_TOKEN,clientId:this.clientId,familyId:s},c=i&&i.refreshToken||this.getTokenKeys().refreshToken,u=[];c.forEach(f=>{if(this.refreshTokenKeyMatchesFilter(f,l)){const h=this.getRefreshTokenCredential(f,r);h&&this.credentialMatchesFilter(h,l)&&u.push(h)}});const d=u.length;return d<1?(this.commonLogger.info("CacheManager:getRefreshToken - No refresh token found."),null):(d>1&&o&&r&&o.addFields({multiMatchedRT:d},r),this.commonLogger.info("CacheManager:getRefreshToken - returning refresh token"),u[0])}refreshTokenKeyMatchesFilter(e,n){const r=e.toLowerCase();return!(n.familyId&&r.indexOf(n.familyId.toLowerCase())===-1||!n.familyId&&n.clientId&&r.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&r.indexOf(n.homeAccountId.toLowerCase())===-1)}readAppMetadataFromCache(e){const n={environment:e,clientId:this.clientId},r=this.getAppMetadataFilteredBy(n),i=Object.keys(r).map(s=>r[s]),o=i.length;if(o<1)return null;if(o>1)throw Ae(Y4);return i[0]}isAppMetadataFOCI(e){const n=this.readAppMetadataFromCache(e);return!!(n&&n.familyId===xy)}matchHomeAccountId(e,n){return typeof e.homeAccountId=="string"&&n===e.homeAccountId}matchLocalAccountIdFromTokenClaims(e,n){const r=e.oid||e.sub;return n===r}matchLocalAccountIdFromTenantProfile(e,n){return e.localAccountId===n}matchName(e,n){var r;return n.toLowerCase()===((r=e.name)==null?void 0:r.toLowerCase())}matchUsername(e,n){return!!(e&&typeof e=="string"&&(n==null?void 0:n.toLowerCase())===e.toLowerCase())}matchUserAssertionHash(e,n){return!!(e.userAssertionHash&&n===e.userAssertionHash)}matchEnvironment(e,n){if(this.staticAuthorityOptions){const i=JJ(this.staticAuthorityOptions,this.commonLogger);if(i.includes(n)&&i.includes(e.environment))return!0}const r=this.getAuthorityMetadataByAlias(n);return!!(r&&r.aliases.indexOf(e.environment)>-1)}matchCredentialType(e,n){return e.credentialType&&n.toLowerCase()===e.credentialType.toLowerCase()}matchClientId(e,n){return!!(e.clientId&&n===e.clientId)}matchFamilyId(e,n){return!!(e.familyId&&n===e.familyId)}matchRealm(e,n){var r;return((r=e.realm)==null?void 0:r.toLowerCase())===n.toLowerCase()}matchNativeAccountId(e,n){return!!(e.nativeAccountId&&n===e.nativeAccountId)}matchLoginHintFromTokenClaims(e,n){return e.login_hint===n||e.preferred_username===n||e.upn===n}matchSid(e,n){return e.sid===n}matchAuthorityType(e,n){return!!(e.authorityType&&n.toLowerCase()===e.authorityType.toLowerCase())}matchTarget(e,n){return e.credentialType!==Pr.ACCESS_TOKEN&&e.credentialType!==Pr.ACCESS_TOKEN_WITH_AUTH_SCHEME||!e.target?!1:hr.fromString(e.target).containsScopeSet(n)}matchTokenType(e,n){return!!(e.tokenType&&e.tokenType===n)}matchKeyId(e,n){return!!(e.keyId&&e.keyId===n)}isAppMetadata(e){return e.indexOf(rE)!==-1}isAuthorityMetadata(e){return e.indexOf(by.CACHE_KEY)!==-1}generateAuthorityMetadataCacheKey(e){return`${by.CACHE_KEY}-${this.clientId}-${e}`}static toObject(e,n){for(const r in n)e[r]=n[r];return e}}class tee extends C1{async setAccount(){throw Ae(Ft)}getAccount(){throw Ae(Ft)}async setIdTokenCredential(){throw Ae(Ft)}getIdTokenCredential(){throw Ae(Ft)}async setAccessTokenCredential(){throw Ae(Ft)}getAccessTokenCredential(){throw Ae(Ft)}async setRefreshTokenCredential(){throw Ae(Ft)}getRefreshTokenCredential(){throw Ae(Ft)}setAppMetadata(){throw Ae(Ft)}getAppMetadata(){throw Ae(Ft)}setServerTelemetry(){throw Ae(Ft)}getServerTelemetry(){throw Ae(Ft)}setAuthorityMetadata(){throw Ae(Ft)}getAuthorityMetadata(){throw Ae(Ft)}getAuthorityMetadataKeys(){throw Ae(Ft)}setThrottlingCache(){throw Ae(Ft)}getThrottlingCache(){throw Ae(Ft)}removeItem(){throw Ae(Ft)}getKeys(){throw Ae(Ft)}getAccountKeys(){throw Ae(Ft)}getTokenKeys(){throw Ae(Ft)}generateCredentialKey(){throw Ae(Ft)}generateAccountKey(){throw Ae(Ft)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Ai={AAD:"AAD",OIDC:"OIDC",EAR:"EAR"};/*! @azure/msal-common v15.10.0 2025-08-05 */const G={AcquireTokenByCode:"acquireTokenByCode",AcquireTokenByRefreshToken:"acquireTokenByRefreshToken",AcquireTokenSilent:"acquireTokenSilent",AcquireTokenSilentAsync:"acquireTokenSilentAsync",AcquireTokenPopup:"acquireTokenPopup",AcquireTokenPreRedirect:"acquireTokenPreRedirect",AcquireTokenRedirect:"acquireTokenRedirect",CryptoOptsGetPublicKeyThumbprint:"cryptoOptsGetPublicKeyThumbprint",CryptoOptsSignJwt:"cryptoOptsSignJwt",SilentCacheClientAcquireToken:"silentCacheClientAcquireToken",SilentIframeClientAcquireToken:"silentIframeClientAcquireToken",AwaitConcurrentIframe:"awaitConcurrentIframe",SilentRefreshClientAcquireToken:"silentRefreshClientAcquireToken",SsoSilent:"ssoSilent",StandardInteractionClientGetDiscoveredAuthority:"standardInteractionClientGetDiscoveredAuthority",FetchAccountIdWithNativeBroker:"fetchAccountIdWithNativeBroker",NativeInteractionClientAcquireToken:"nativeInteractionClientAcquireToken",BaseClientCreateTokenRequestHeaders:"baseClientCreateTokenRequestHeaders",NetworkClientSendPostRequestAsync:"networkClientSendPostRequestAsync",RefreshTokenClientExecutePostToTokenEndpoint:"refreshTokenClientExecutePostToTokenEndpoint",AuthorizationCodeClientExecutePostToTokenEndpoint:"authorizationCodeClientExecutePostToTokenEndpoint",BrokerHandhshake:"brokerHandshake",AcquireTokenByRefreshTokenInBroker:"acquireTokenByRefreshTokenInBroker",AcquireTokenByBroker:"acquireTokenByBroker",RefreshTokenClientExecuteTokenRequest:"refreshTokenClientExecuteTokenRequest",RefreshTokenClientAcquireToken:"refreshTokenClientAcquireToken",RefreshTokenClientAcquireTokenWithCachedRefreshToken:"refreshTokenClientAcquireTokenWithCachedRefreshToken",RefreshTokenClientAcquireTokenByRefreshToken:"refreshTokenClientAcquireTokenByRefreshToken",RefreshTokenClientCreateTokenRequestBody:"refreshTokenClientCreateTokenRequestBody",AcquireTokenFromCache:"acquireTokenFromCache",SilentFlowClientAcquireCachedToken:"silentFlowClientAcquireCachedToken",SilentFlowClientGenerateResultFromCacheRecord:"silentFlowClientGenerateResultFromCacheRecord",AcquireTokenBySilentIframe:"acquireTokenBySilentIframe",InitializeBaseRequest:"initializeBaseRequest",InitializeSilentRequest:"initializeSilentRequest",InitializeClientApplication:"initializeClientApplication",InitializeCache:"initializeCache",SilentIframeClientTokenHelper:"silentIframeClientTokenHelper",SilentHandlerInitiateAuthRequest:"silentHandlerInitiateAuthRequest",SilentHandlerMonitorIframeForHash:"silentHandlerMonitorIframeForHash",SilentHandlerLoadFrame:"silentHandlerLoadFrame",SilentHandlerLoadFrameSync:"silentHandlerLoadFrameSync",StandardInteractionClientCreateAuthCodeClient:"standardInteractionClientCreateAuthCodeClient",StandardInteractionClientGetClientConfiguration:"standardInteractionClientGetClientConfiguration",StandardInteractionClientInitializeAuthorizationRequest:"standardInteractionClientInitializeAuthorizationRequest",GetAuthCodeUrl:"getAuthCodeUrl",GetStandardParams:"getStandardParams",HandleCodeResponseFromServer:"handleCodeResponseFromServer",HandleCodeResponse:"handleCodeResponse",HandleResponseEar:"handleResponseEar",HandleResponsePlatformBroker:"handleResponsePlatformBroker",HandleResponseCode:"handleResponseCode",UpdateTokenEndpointAuthority:"updateTokenEndpointAuthority",AuthClientAcquireToken:"authClientAcquireToken",AuthClientExecuteTokenRequest:"authClientExecuteTokenRequest",AuthClientCreateTokenRequestBody:"authClientCreateTokenRequestBody",PopTokenGenerateCnf:"popTokenGenerateCnf",PopTokenGenerateKid:"popTokenGenerateKid",HandleServerTokenResponse:"handleServerTokenResponse",DeserializeResponse:"deserializeResponse",AuthorityFactoryCreateDiscoveredInstance:"authorityFactoryCreateDiscoveredInstance",AuthorityResolveEndpointsAsync:"authorityResolveEndpointsAsync",AuthorityResolveEndpointsFromLocalSources:"authorityResolveEndpointsFromLocalSources",AuthorityGetCloudDiscoveryMetadataFromNetwork:"authorityGetCloudDiscoveryMetadataFromNetwork",AuthorityUpdateCloudDiscoveryMetadata:"authorityUpdateCloudDiscoveryMetadata",AuthorityGetEndpointMetadataFromNetwork:"authorityGetEndpointMetadataFromNetwork",AuthorityUpdateEndpointMetadata:"authorityUpdateEndpointMetadata",AuthorityUpdateMetadataWithRegionalInformation:"authorityUpdateMetadataWithRegionalInformation",RegionDiscoveryDetectRegion:"regionDiscoveryDetectRegion",RegionDiscoveryGetRegionFromIMDS:"regionDiscoveryGetRegionFromIMDS",RegionDiscoveryGetCurrentVersion:"regionDiscoveryGetCurrentVersion",AcquireTokenByCodeAsync:"acquireTokenByCodeAsync",GetEndpointMetadataFromNetwork:"getEndpointMetadataFromNetwork",GetCloudDiscoveryMetadataFromNetworkMeasurement:"getCloudDiscoveryMetadataFromNetworkMeasurement",HandleRedirectPromiseMeasurement:"handleRedirectPromise",HandleNativeRedirectPromiseMeasurement:"handleNativeRedirectPromise",UpdateCloudDiscoveryMetadataMeasurement:"updateCloudDiscoveryMetadataMeasurement",UsernamePasswordClientAcquireToken:"usernamePasswordClientAcquireToken",NativeMessageHandlerHandshake:"nativeMessageHandlerHandshake",NativeGenerateAuthResult:"nativeGenerateAuthResult",RemoveHiddenIframe:"removeHiddenIframe",ClearTokensAndKeysWithClaims:"clearTokensAndKeysWithClaims",CacheManagerGetRefreshToken:"cacheManagerGetRefreshToken",ImportExistingCache:"importExistingCache",SetUserData:"setUserData",LocalStorageUpdated:"localStorageUpdated",GeneratePkceCodes:"generatePkceCodes",GenerateCodeVerifier:"generateCodeVerifier",GenerateCodeChallengeFromVerifier:"generateCodeChallengeFromVerifier",Sha256Digest:"sha256Digest",GetRandomValues:"getRandomValues",GenerateHKDF:"generateHKDF",GenerateBaseKey:"generateBaseKey",Base64Decode:"base64Decode",UrlEncodeArr:"urlEncodeArr",Encrypt:"encrypt",Decrypt:"decrypt",GenerateEarKey:"generateEarKey",DecryptEarResponse:"decryptEarResponse"},nee={NotStarted:0,InProgress:1,Completed:2};/*! @azure/msal-common v15.10.0 2025-08-05 */class PO{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class C3{generateId(){return"callback-id"}startMeasurement(e,n){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:nee.InProgress,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:n||""},measurement:new PO}}startPerformanceMeasurement(){return new PO}calculateQueuedTime(){return 0}addQueueMeasurement(){}setPreQueueTime(){}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return""}emitEvents(){}addFields(){}incrementFields(){}cacheEventByCorrelationId(){}}/*! @azure/msal-common v15.10.0 2025-08-05 */const A3={tokenRenewalOffsetSeconds:U4,preventCorsPreflight:!1},ree={loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:jn.Info,correlationId:ve.EMPTY_STRING},iee={claimsBasedCachingEnabled:!1},oee={async sendGetRequestAsync(){throw Ae(Ft)},async sendPostRequestAsync(){throw Ae(Ft)}},see={sku:ve.SKU,version:dE,cpu:ve.EMPTY_STRING,os:ve.EMPTY_STRING},aee={clientSecret:ve.EMPTY_STRING,clientAssertion:void 0},lee={azureCloudInstance:fE.None,tenant:`${ve.DEFAULT_COMMON_TENANT}`},cee={application:{appName:"",appVersion:""}};function uee({authOptions:t,systemOptions:e,loggerOptions:n,cacheOptions:r,storageInterface:i,networkInterface:o,cryptoInterface:s,clientCredentials:l,libraryInfo:c,telemetry:u,serverTelemetryManager:d,persistencePlugin:f,serializableCache:h}){const p={...ree,...n};return{authOptions:dee(t),systemOptions:{...A3,...e},loggerOptions:p,cacheOptions:{...iee,...r},storageInterface:i||new tee(t.clientId,Sy,new ya(p),new C3),networkInterface:o||oee,cryptoInterface:s||Sy,clientCredentials:l||aee,libraryInfo:{...see,...c},telemetry:{...cee,...u},serverTelemetryManager:d||null,persistencePlugin:f||null,serializableCache:h||null}}function dee(t){return{clientCapabilities:[],azureCloudOptions:lee,skipAuthorityMetadataCache:!1,instanceAware:!1,encodeExtraQueryParams:!1,...t}}function _3(t){return t.authOptions.authority.options.protocolMode===Ai.OIDC}/*! @azure/msal-common v15.10.0 2025-08-05 */const Oo={HOME_ACCOUNT_ID:"home_account_id",UPN:"UPN"};/*! @azure/msal-common v15.10.0 2025-08-05 */function jy(t,e){if(!t)throw Ae(B4);try{const n=e(t);return JSON.parse(n)}catch{throw Ae(iE)}}function rd(t){if(!t)throw Ae(iE);const e=t.split(Ep.CLIENT_INFO_SEPARATOR,2);return{uid:e[0],utid:e.length<2?ve.EMPTY_STRING:e[1]}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Kc="client_id",j3="redirect_uri",fee="response_type",hee="response_mode",pee="grant_type",mee="claims",gee="scope",vee="refresh_token",yee="state",xee="nonce",bee="prompt",wee="code",See="code_challenge",Cee="code_challenge_method",Aee="code_verifier",_ee="client-request-id",jee="x-client-SKU",Eee="x-client-VER",Nee="x-client-OS",Tee="x-client-CPU",Pee="x-client-current-telemetry",kee="x-client-last-telemetry",Oee="x-ms-lib-capability",Iee="x-app-name",Ree="x-app-ver",Mee="post_logout_redirect_uri",Dee="id_token_hint",$ee="client_secret",Lee="client_assertion",Fee="client_assertion_type",E3="token_type",N3="req_cnf",kO="return_spa_code",Uee="nativebroker",Bee="logout_hint",Hee="sid",zee="login_hint",Vee="domain_hint",Gee="x-client-xtra-sku",Ey="brk_client_id",Ny="brk_redirect_uri",A1="instance_aware",Kee="ear_jwk",Wee="ear_jwe_crypto";/*! @azure/msal-common v15.10.0 2025-08-05 */function Qb(t,e,n){if(!e)return;const r=t.get(Kc);r&&t.has(Ey)&&(n==null||n.addFields({embeddedClientId:r,embeddedRedirectUri:t.get(j3)},e))}function wE(t,e){t.set(fee,e)}function qee(t,e){t.set(hee,e||PJ.QUERY)}function Yee(t){t.set(Uee,"1")}function SE(t,e,n=!0,r=qm){n&&!r.includes("openid")&&!e.includes("openid")&&r.push("openid");const i=n?[...e||[],...r]:e||[],o=new hr(i);t.set(gee,o.printScopes())}function CE(t,e){t.set(Kc,e)}function AE(t,e){t.set(j3,e)}function Qee(t,e){t.set(Mee,e)}function Xee(t,e){t.set(Dee,e)}function Zee(t,e){t.set(Vee,e)}function Hg(t,e){t.set(zee,e)}function Ty(t,e){t.set(ei.CCS_HEADER,`UPN:${e}`)}function Uh(t,e){t.set(ei.CCS_HEADER,`Oid:${e.uid}@${e.utid}`)}function OO(t,e){t.set(Hee,e)}function _E(t,e,n){const r=ite(e,n);try{JSON.parse(r)}catch{throw mn(hE)}t.set(mee,r)}function jE(t,e){t.set(_ee,e)}function EE(t,e){t.set(jee,e.sku),t.set(Eee,e.version),e.os&&t.set(Nee,e.os),e.cpu&&t.set(Tee,e.cpu)}function NE(t,e){e!=null&&e.appName&&t.set(Iee,e.appName),e!=null&&e.appVersion&&t.set(Ree,e.appVersion)}function Jee(t,e){t.set(bee,e)}function T3(t,e){e&&t.set(yee,e)}function ete(t,e){t.set(xee,e)}function P3(t,e,n){if(e&&n)t.set(See,e),t.set(Cee,n);else throw mn(pE)}function tte(t,e){t.set(wee,e)}function nte(t,e){t.set(vee,e)}function rte(t,e){t.set(Aee,e)}function k3(t,e){t.set($ee,e)}function O3(t,e){e&&t.set(Lee,e)}function I3(t,e){e&&t.set(Fee,e)}function R3(t,e){t.set(pee,e)}function TE(t){t.set(kJ,"1")}function M3(t){t.has(A1)||t.set(A1,"true")}function vl(t,e){Object.entries(e).forEach(([n,r])=>{!t.has(n)&&r&&t.set(n,r)})}function ite(t,e){let n;if(!t)n={};else try{n=JSON.parse(t)}catch{throw mn(hE)}return e&&e.length>0&&(n.hasOwnProperty(Ug.ACCESS_TOKEN)||(n[Ug.ACCESS_TOKEN]={}),n[Ug.ACCESS_TOKEN][Ug.XMS_CC]={values:e}),JSON.stringify(n)}function PE(t,e){e&&(t.set(E3,an.POP),t.set(N3,e))}function D3(t,e){e&&(t.set(E3,an.SSH),t.set(N3,e))}function $3(t,e){t.set(Pee,e.generateCurrentRequestHeaderValue()),t.set(kee,e.generateLastRequestHeaderValue())}function L3(t){t.set(Oee,Fh.X_MS_LIB_CAPABILITY_VALUE)}function ote(t,e){t.set(Bee,e)}function Xb(t,e,n){t.has(Ey)||t.set(Ey,e),t.has(Ny)||t.set(Ny,n)}function ste(t,e){t.set(Kee,encodeURIComponent(e)),t.set(Wee,"eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0")}function ate(t,e){Object.entries(e).forEach(([n,r])=>{r&&t.set(n,r)})}/*! @azure/msal-common v15.10.0 2025-08-05 */const Eo={Default:0,Adfs:1,Dsts:2,Ciam:3};/*! @azure/msal-common v15.10.0 2025-08-05 */function lte(t){return t.hasOwnProperty("authorization_endpoint")&&t.hasOwnProperty("token_endpoint")&&t.hasOwnProperty("issuer")&&t.hasOwnProperty("jwks_uri")}/*! @azure/msal-common v15.10.0 2025-08-05 */function cte(t){return t.hasOwnProperty("tenant_discovery_endpoint")&&t.hasOwnProperty("metadata")}/*! @azure/msal-common v15.10.0 2025-08-05 */function ute(t){return t.hasOwnProperty("error")&&t.hasOwnProperty("error_description")}/*! @azure/msal-common v15.10.0 2025-08-05 */const Bi=(t,e,n,r,i)=>(...o)=>{n.trace(`Executing function ${e}`);const s=r==null?void 0:r.startMeasurement(e,i);if(i){const l=e+"CallCount";r==null||r.incrementFields({[l]:1},i)}try{const l=t(...o);return s==null||s.end({success:!0}),n.trace(`Returning result from ${e}`),l}catch(l){n.trace(`Error occurred in ${e}`);try{n.trace(JSON.stringify(l))}catch{n.trace("Unable to print error message.")}throw s==null||s.end({success:!1},l),l}},ge=(t,e,n,r,i)=>(...o)=>{n.trace(`Executing function ${e}`);const s=r==null?void 0:r.startMeasurement(e,i);if(i){const l=e+"CallCount";r==null||r.incrementFields({[l]:1},i)}return r==null||r.setPreQueueTime(e,i),t(...o).then(l=>(n.trace(`Returning result from ${e}`),s==null||s.end({success:!0}),l)).catch(l=>{n.trace(`Error occurred in ${e}`);try{n.trace(JSON.stringify(l))}catch{n.trace("Unable to print error message.")}throw s==null||s.end({success:!1},l),l})};/*! @azure/msal-common v15.10.0 2025-08-05 */class Zb{constructor(e,n,r,i){this.networkInterface=e,this.logger=n,this.performanceClient=r,this.correlationId=i}async detectRegion(e,n){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(G.RegionDiscoveryDetectRegion,this.correlationId);let r=e;if(r)n.region_source=vu.ENVIRONMENT_VARIABLE;else{const o=Zb.IMDS_OPTIONS;try{const s=await ge(this.getRegionFromIMDS.bind(this),G.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(ve.IMDS_VERSION,o);if(s.status===rl.SUCCESS&&(r=s.body,n.region_source=vu.IMDS),s.status===rl.BAD_REQUEST){const l=await ge(this.getCurrentVersion.bind(this),G.RegionDiscoveryGetCurrentVersion,this.logger,this.performanceClient,this.correlationId)(o);if(!l)return n.region_source=vu.FAILED_AUTO_DETECTION,null;const c=await ge(this.getRegionFromIMDS.bind(this),G.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(l,o);c.status===rl.SUCCESS&&(r=c.body,n.region_source=vu.IMDS)}}catch{return n.region_source=vu.FAILED_AUTO_DETECTION,null}}return r||(n.region_source=vu.FAILED_AUTO_DETECTION),r||null}async getRegionFromIMDS(e,n){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(G.RegionDiscoveryGetRegionFromIMDS,this.correlationId),this.networkInterface.sendGetRequestAsync(`${ve.IMDS_ENDPOINT}?api-version=${e}&format=text`,n,ve.IMDS_TIMEOUT)}async getCurrentVersion(e){var n;(n=this.performanceClient)==null||n.addQueueMeasurement(G.RegionDiscoveryGetCurrentVersion,this.correlationId);try{const r=await this.networkInterface.sendGetRequestAsync(`${ve.IMDS_ENDPOINT}?format=json`,e);return r.status===rl.BAD_REQUEST&&r.body&&r.body["newest-versions"]&&r.body["newest-versions"].length>0?r.body["newest-versions"][0]:null}catch{return null}}}Zb.IMDS_OPTIONS={headers:{Metadata:"true"}};/*! @azure/msal-common v15.10.0 2025-08-05 */function _i(){return Math.round(new Date().getTime()/1e3)}function IO(t){return t.getTime()/1e3}function id(t){return t?new Date(Number(t)*1e3):new Date}function Py(t,e){const n=Number(t)||0;return _i()+e>n}function dte(t,e){const n=Number(t)+e*24*60*60*1e3;return Date.now()>n}function fte(t){return Number(t)>_i()}/*! @azure/msal-common v15.10.0 2025-08-05 */function Jb(t,e,n,r,i){return{credentialType:Pr.ID_TOKEN,homeAccountId:t,environment:e,clientId:r,secret:n,realm:i,lastUpdatedAt:Date.now().toString()}}function e0(t,e,n,r,i,o,s,l,c,u,d,f,h,p,g){var v,b;const m={homeAccountId:t,credentialType:Pr.ACCESS_TOKEN,secret:n,cachedAt:_i().toString(),expiresOn:s.toString(),extendedExpiresOn:l.toString(),environment:e,clientId:r,realm:i,target:o,tokenType:d||an.BEARER,lastUpdatedAt:Date.now().toString()};if(f&&(m.userAssertionHash=f),u&&(m.refreshOn=u.toString()),p&&(m.requestedClaims=p,m.requestedClaimsHash=g),((v=m.tokenType)==null?void 0:v.toLowerCase())!==an.BEARER.toLowerCase())switch(m.credentialType=Pr.ACCESS_TOKEN_WITH_AUTH_SCHEME,m.tokenType){case an.POP:const x=wf(n,c);if(!((b=x==null?void 0:x.cnf)!=null&&b.kid))throw Ae(e3);m.keyId=x.cnf.kid;break;case an.SSH:m.keyId=h}return m}function F3(t,e,n,r,i,o,s){const l={credentialType:Pr.REFRESH_TOKEN,homeAccountId:t,environment:e,clientId:r,secret:n,lastUpdatedAt:Date.now().toString()};return o&&(l.userAssertionHash=o),i&&(l.familyId=i),s&&(l.expiresOn=s.toString()),l}function kE(t){return t.hasOwnProperty("homeAccountId")&&t.hasOwnProperty("environment")&&t.hasOwnProperty("credentialType")&&t.hasOwnProperty("clientId")&&t.hasOwnProperty("secret")}function RO(t){return t?kE(t)&&t.hasOwnProperty("realm")&&t.hasOwnProperty("target")&&(t.credentialType===Pr.ACCESS_TOKEN||t.credentialType===Pr.ACCESS_TOKEN_WITH_AUTH_SCHEME):!1}function hte(t){return t?kE(t)&&t.hasOwnProperty("realm")&&t.credentialType===Pr.ID_TOKEN:!1}function MO(t){return t?kE(t)&&t.credentialType===Pr.REFRESH_TOKEN:!1}function pte(t,e){const n=t.indexOf(jr.CACHE_KEY)===0;let r=!0;return e&&(r=e.hasOwnProperty("failedRequests")&&e.hasOwnProperty("errors")&&e.hasOwnProperty("cacheHits")),n&&r}function mte(t,e){let n=!1;t&&(n=t.indexOf(Fh.THROTTLING_PREFIX)===0);let r=!0;return e&&(r=e.hasOwnProperty("throttleTime")),n&&r}function gte({environment:t,clientId:e}){return[rE,t,e].join(Ep.CACHE_KEY_SEPARATOR).toLowerCase()}function vte(t,e){return e?t.indexOf(rE)===0&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("environment"):!1}function yte(t,e){return e?t.indexOf(by.CACHE_KEY)===0&&e.hasOwnProperty("aliases")&&e.hasOwnProperty("preferred_cache")&&e.hasOwnProperty("preferred_network")&&e.hasOwnProperty("canonical_authority")&&e.hasOwnProperty("authorization_endpoint")&&e.hasOwnProperty("token_endpoint")&&e.hasOwnProperty("issuer")&&e.hasOwnProperty("aliasesFromNetwork")&&e.hasOwnProperty("endpointsFromNetwork")&&e.hasOwnProperty("expiresAt")&&e.hasOwnProperty("jwks_uri"):!1}function DO(){return _i()+by.REFRESH_TIME_SECONDS}function zg(t,e,n){t.authorization_endpoint=e.authorization_endpoint,t.token_endpoint=e.token_endpoint,t.end_session_endpoint=e.end_session_endpoint,t.issuer=e.issuer,t.endpointsFromNetwork=n,t.jwks_uri=e.jwks_uri}function aS(t,e,n){t.aliases=e.aliases,t.preferred_cache=e.preferred_cache,t.preferred_network=e.preferred_network,t.aliasesFromNetwork=n}function $O(t){return t.expiresAt<=_i()}/*! @azure/msal-common v15.10.0 2025-08-05 */class Hr{constructor(e,n,r,i,o,s,l,c){this.canonicalAuthority=e,this._canonicalAuthority.validateAsUri(),this.networkInterface=n,this.cacheManager=r,this.authorityOptions=i,this.regionDiscoveryMetadata={region_used:void 0,region_source:void 0,region_outcome:void 0},this.logger=o,this.performanceClient=l,this.correlationId=s,this.managedIdentity=c||!1,this.regionDiscovery=new Zb(n,this.logger,this.performanceClient,this.correlationId)}getAuthorityType(e){if(e.HostNameAndPort.endsWith(ve.CIAM_AUTH_URL))return Eo.Ciam;const n=e.PathSegments;if(n.length)switch(n[0].toLowerCase()){case ve.ADFS:return Eo.Adfs;case ve.DSTS:return Eo.Dsts}return Eo.Default}get authorityType(){return this.getAuthorityType(this.canonicalAuthorityUrlComponents)}get protocolMode(){return this.authorityOptions.protocolMode}get options(){return this.authorityOptions}get canonicalAuthority(){return this._canonicalAuthority.urlString}set canonicalAuthority(e){this._canonicalAuthority=new Kt(e),this._canonicalAuthority.validateAsUri(),this._canonicalAuthorityUrlComponents=null}get canonicalAuthorityUrlComponents(){return this._canonicalAuthorityUrlComponents||(this._canonicalAuthorityUrlComponents=this._canonicalAuthority.getUrlComponents()),this._canonicalAuthorityUrlComponents}get hostnameAndPort(){return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase()}get tenant(){return this.canonicalAuthorityUrlComponents.PathSegments[0]}get authorizationEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.authorization_endpoint);throw Ae(Ws)}get tokenEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint);throw Ae(Ws)}get deviceCodeEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint.replace("/token","/devicecode"));throw Ae(Ws)}get endSessionEndpoint(){if(this.discoveryComplete()){if(!this.metadata.end_session_endpoint)throw Ae(r3);return this.replacePath(this.metadata.end_session_endpoint)}else throw Ae(Ws)}get selfSignedJwtAudience(){if(this.discoveryComplete())return this.replacePath(this.metadata.issuer);throw Ae(Ws)}get jwksUri(){if(this.discoveryComplete())return this.replacePath(this.metadata.jwks_uri);throw Ae(Ws)}canReplaceTenant(e){return e.PathSegments.length===1&&!Hr.reservedTenantDomains.has(e.PathSegments[0])&&this.getAuthorityType(e)===Eo.Default&&this.protocolMode!==Ai.OIDC}replaceTenant(e){return e.replace(/{tenant}|{tenantid}/g,this.tenant)}replacePath(e){let n=e;const i=new Kt(this.metadata.canonical_authority).getUrlComponents(),o=i.PathSegments;return this.canonicalAuthorityUrlComponents.PathSegments.forEach((l,c)=>{let u=o[c];if(c===0&&this.canReplaceTenant(i)){const d=new Kt(this.metadata.authorization_endpoint).getUrlComponents().PathSegments[0];u!==d&&(this.logger.verbose(`Replacing tenant domain name ${u} with id ${d}`),u=d)}l!==u&&(n=n.replace(`/${u}/`,`/${l}/`))}),this.replaceTenant(n)}get defaultOpenIdConfigurationEndpoint(){const e=this.hostnameAndPort;return this.canonicalAuthority.endsWith("v2.0/")||this.authorityType===Eo.Adfs||this.protocolMode===Ai.OIDC&&!this.isAliasOfKnownMicrosoftAuthority(e)?`${this.canonicalAuthority}.well-known/openid-configuration`:`${this.canonicalAuthority}v2.0/.well-known/openid-configuration`}discoveryComplete(){return!!this.metadata}async resolveEndpointsAsync(){var i,o;(i=this.performanceClient)==null||i.addQueueMeasurement(G.AuthorityResolveEndpointsAsync,this.correlationId);const e=this.getCurrentMetadataEntity(),n=await ge(this.updateCloudDiscoveryMetadata.bind(this),G.AuthorityUpdateCloudDiscoveryMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.canonicalAuthority=this.canonicalAuthority.replace(this.hostnameAndPort,e.preferred_network);const r=await ge(this.updateEndpointMetadata.bind(this),G.AuthorityUpdateEndpointMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.updateCachedMetadata(e,n,{source:r}),(o=this.performanceClient)==null||o.addFields({cloudDiscoverySource:n,authorityEndpointSource:r},this.correlationId)}getCurrentMetadataEntity(){let e=this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);return e||(e={aliases:[],preferred_cache:this.hostnameAndPort,preferred_network:this.hostnameAndPort,canonical_authority:this.canonicalAuthority,authorization_endpoint:"",token_endpoint:"",end_session_endpoint:"",issuer:"",aliasesFromNetwork:!1,endpointsFromNetwork:!1,expiresAt:DO(),jwks_uri:""}),e}updateCachedMetadata(e,n,r){n!==Ti.CACHE&&(r==null?void 0:r.source)!==Ti.CACHE&&(e.expiresAt=DO(),e.canonical_authority=this.canonicalAuthority);const i=this.cacheManager.generateAuthorityMetadataCacheKey(e.preferred_cache);this.cacheManager.setAuthorityMetadata(i,e),this.metadata=e}async updateEndpointMetadata(e){var i,o,s;(i=this.performanceClient)==null||i.addQueueMeasurement(G.AuthorityUpdateEndpointMetadata,this.correlationId);const n=this.updateEndpointMetadataFromLocalSources(e);if(n){if(n.source===Ti.HARDCODED_VALUES&&(o=this.authorityOptions.azureRegionConfiguration)!=null&&o.azureRegion&&n.metadata){const l=await ge(this.updateMetadataWithRegionalInformation.bind(this),G.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(n.metadata);zg(e,l,!1),e.canonical_authority=this.canonicalAuthority}return n.source}let r=await ge(this.getEndpointMetadataFromNetwork.bind(this),G.AuthorityGetEndpointMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return(s=this.authorityOptions.azureRegionConfiguration)!=null&&s.azureRegion&&(r=await ge(this.updateMetadataWithRegionalInformation.bind(this),G.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(r)),zg(e,r,!0),Ti.NETWORK;throw Ae(V4,this.defaultOpenIdConfigurationEndpoint)}updateEndpointMetadataFromLocalSources(e){this.logger.verbose("Attempting to get endpoint metadata from authority configuration");const n=this.getEndpointMetadataFromConfig();if(n)return this.logger.verbose("Found endpoint metadata in authority configuration"),zg(e,n,!1),{source:Ti.CONFIG};if(this.logger.verbose("Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values."),this.authorityOptions.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get endpoint metadata from the network metadata cache.");else{const i=this.getEndpointMetadataFromHardcodedValues();if(i)return zg(e,i,!1),{source:Ti.HARDCODED_VALUES,metadata:i};this.logger.verbose("Did not find endpoint metadata in hardcoded values... Attempting to get endpoint metadata from the network metadata cache.")}const r=$O(e);return this.isAuthoritySameType(e)&&e.endpointsFromNetwork&&!r?(this.logger.verbose("Found endpoint metadata in the cache."),{source:Ti.CACHE}):(r&&this.logger.verbose("The metadata entity is expired."),null)}isAuthoritySameType(e){return new Kt(e.canonical_authority).getUrlComponents().PathSegments.length===this.canonicalAuthorityUrlComponents.PathSegments.length}getEndpointMetadataFromConfig(){if(this.authorityOptions.authorityMetadata)try{return JSON.parse(this.authorityOptions.authorityMetadata)}catch{throw mn(d3)}return null}async getEndpointMetadataFromNetwork(){var r;(r=this.performanceClient)==null||r.addQueueMeasurement(G.AuthorityGetEndpointMetadataFromNetwork,this.correlationId);const e={},n=this.defaultOpenIdConfigurationEndpoint;this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: attempting to retrieve OAuth endpoints from ${n}`);try{const i=await this.networkInterface.sendGetRequestAsync(n,e);return lte(i.body)?i.body:(this.logger.verbose("Authority.getEndpointMetadataFromNetwork: could not parse response as OpenID configuration"),null)}catch(i){return this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: ${i}`),null}}getEndpointMetadataFromHardcodedValues(){return this.hostnameAndPort in NO?NO[this.hostnameAndPort]:null}async updateMetadataWithRegionalInformation(e){var r,i,o;(r=this.performanceClient)==null||r.addQueueMeasurement(G.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId);const n=(i=this.authorityOptions.azureRegionConfiguration)==null?void 0:i.azureRegion;if(n){if(n!==ve.AZURE_REGION_AUTO_DISCOVER_FLAG)return this.regionDiscoveryMetadata.region_outcome=oS.CONFIGURED_NO_AUTO_DETECTION,this.regionDiscoveryMetadata.region_used=n,Hr.replaceWithRegionalInformation(e,n);const s=await ge(this.regionDiscovery.detectRegion.bind(this.regionDiscovery),G.RegionDiscoveryDetectRegion,this.logger,this.performanceClient,this.correlationId)((o=this.authorityOptions.azureRegionConfiguration)==null?void 0:o.environmentRegion,this.regionDiscoveryMetadata);if(s)return this.regionDiscoveryMetadata.region_outcome=oS.AUTO_DETECTION_REQUESTED_SUCCESSFUL,this.regionDiscoveryMetadata.region_used=s,Hr.replaceWithRegionalInformation(e,s);this.regionDiscoveryMetadata.region_outcome=oS.AUTO_DETECTION_REQUESTED_FAILED}return e}async updateCloudDiscoveryMetadata(e){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(G.AuthorityUpdateCloudDiscoveryMetadata,this.correlationId);const n=this.updateCloudDiscoveryMetadataFromLocalSources(e);if(n)return n;const r=await ge(this.getCloudDiscoveryMetadataFromNetwork.bind(this),G.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return aS(e,r,!0),Ti.NETWORK;throw mn(f3)}updateCloudDiscoveryMetadataFromLocalSources(e){this.logger.verbose("Attempting to get cloud discovery metadata from authority configuration"),this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities||ve.NOT_APPLICABLE}`),this.logger.verbosePii(`Authority Metadata: ${this.authorityOptions.authorityMetadata||ve.NOT_APPLICABLE}`),this.logger.verbosePii(`Canonical Authority: ${e.canonical_authority||ve.NOT_APPLICABLE}`);const n=this.getCloudDiscoveryMetadataFromConfig();if(n)return this.logger.verbose("Found cloud discovery metadata in authority configuration"),aS(e,n,!1),Ti.CONFIG;if(this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the hardcoded values."),this.options.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded cloud discovery metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get cloud discovery metadata from the network metadata cache.");else{const i=eee(this.hostnameAndPort);if(i)return this.logger.verbose("Found cloud discovery metadata from hardcoded values."),aS(e,i,!1),Ti.HARDCODED_VALUES;this.logger.verbose("Did not find cloud discovery metadata in hardcoded values... Attempting to get cloud discovery metadata from the network metadata cache.")}const r=$O(e);return this.isAuthoritySameType(e)&&e.aliasesFromNetwork&&!r?(this.logger.verbose("Found cloud discovery metadata in the cache."),Ti.CACHE):(r&&this.logger.verbose("The metadata entity is expired."),null)}getCloudDiscoveryMetadataFromConfig(){if(this.authorityType===Eo.Ciam)return this.logger.verbose("CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host."),Hr.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);if(this.authorityOptions.cloudDiscoveryMetadata){this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");try{this.logger.verbose("Attempting to parse the cloud discovery metadata.");const e=JSON.parse(this.authorityOptions.cloudDiscoveryMetadata),n=Ay(e.metadata,this.hostnameAndPort);if(this.logger.verbose("Parsed the cloud discovery metadata."),n)return this.logger.verbose("There is returnable metadata attached to the parsed cloud discovery metadata."),n;this.logger.verbose("There is no metadata attached to the parsed cloud discovery metadata.")}catch{throw this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error."),mn(mE)}}return this.isInKnownAuthorities()?(this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host."),Hr.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)):null}async getCloudDiscoveryMetadataFromNetwork(){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(G.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.correlationId);const e=`${ve.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`,n={};let r=null;try{const o=await this.networkInterface.sendGetRequestAsync(e,n);let s,l;if(cte(o.body))s=o.body,l=s.metadata,this.logger.verbosePii(`tenant_discovery_endpoint is: ${s.tenant_discovery_endpoint}`);else if(ute(o.body)){if(this.logger.warning(`A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: ${o.status}`),s=o.body,s.error===ve.INVALID_INSTANCE)return this.logger.error("The CloudInstanceDiscoveryErrorResponse error is invalid_instance."),null;this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error is ${s.error}`),this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error description is ${s.error_description}`),this.logger.warning("Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []"),l=[]}else return this.logger.error("AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse"),null;this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request."),r=Ay(l,this.hostnameAndPort)}catch(o){if(o instanceof hn)this.logger.error(`There was a network error while attempting to get the cloud discovery instance metadata. + */const f4=$e("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 h4(t,e){return function(){return t.apply(e,arguments)}}const{toString:ZX}=Object.prototype,{getPrototypeOf:Xj}=Object,{iterator:Ub,toStringTag:p4}=Symbol,Bb=(t=>e=>{const n=ZX.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Jo=t=>(t=t.toLowerCase(),e=>Bb(e)===t),Hb=t=>e=>typeof e===t,{isArray:xf}=Array,_p=Hb("undefined");function eJ(t){return t!==null&&!_p(t)&&t.constructor!==null&&!_p(t.constructor)&&Si(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const m4=Jo("ArrayBuffer");function tJ(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&m4(t.buffer),e}const nJ=Hb("string"),Si=Hb("function"),g4=Hb("number"),zb=t=>t!==null&&typeof t=="object",rJ=t=>t===!0||t===!1,_v=t=>{if(Bb(t)!=="object")return!1;const e=Xj(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(p4 in t)&&!(Ub in t)},iJ=Jo("Date"),oJ=Jo("File"),sJ=Jo("Blob"),aJ=Jo("FileList"),lJ=t=>zb(t)&&Si(t.pipe),cJ=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Si(t.append)&&((e=Bb(t))==="formdata"||e==="object"&&Si(t.toString)&&t.toString()==="[object FormData]"))},uJ=Jo("URLSearchParams"),[dJ,fJ,hJ,pJ]=["ReadableStream","Request","Response","Headers"].map(Jo),mJ=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Gm(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,i;if(typeof t!="object"&&(t=[t]),xf(t))for(r=0,i=t.length;r0;)if(i=n[r],e===i.toLowerCase())return i;return null}const fc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,y4=t=>!_p(t)&&t!==fc;function c1(){const{caseless:t}=y4(this)&&this||{},e={},n=(r,i)=>{const o=t&&v4(e,i)||i;_v(e[o])&&_v(r)?e[o]=c1(e[o],r):_v(r)?e[o]=c1({},r):xf(r)?e[o]=r.slice():e[o]=r};for(let r=0,i=arguments.length;r(Gm(e,(i,o)=>{n&&Si(i)?t[o]=h4(i,n):t[o]=i},{allOwnKeys:r}),t),vJ=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),yJ=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},xJ=(t,e,n,r)=>{let i,o,s;const l={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],(!r||r(s,t,e))&&!l[s]&&(e[s]=t[s],l[s]=!0);t=n!==!1&&Xj(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},bJ=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},wJ=t=>{if(!t)return null;if(xf(t))return t;let e=t.length;if(!g4(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},SJ=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Xj(Uint8Array)),CJ=(t,e)=>{const r=(t&&t[Ub]).call(t);let i;for(;(i=r.next())&&!i.done;){const o=i.value;e.call(t,o[0],o[1])}},AJ=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},_J=Jo("HTMLFormElement"),jJ=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),lO=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),EJ=Jo("RegExp"),x4=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Gm(n,(i,o)=>{let s;(s=e(i,o,t))!==!1&&(r[o]=s||i)}),Object.defineProperties(t,r)},NJ=t=>{x4(t,(e,n)=>{if(Si(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Si(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},TJ=(t,e)=>{const n={},r=i=>{i.forEach(o=>{n[o]=!0})};return xf(t)?r(t):r(String(t).split(e)),n},PJ=()=>{},kJ=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function OJ(t){return!!(t&&Si(t.append)&&t[p4]==="FormData"&&t[Ub])}const IJ=t=>{const e=new Array(10),n=(r,i)=>{if(zb(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const o=xf(r)?[]:{};return Gm(r,(s,l)=>{const c=n(s,i+1);!_p(c)&&(o[l]=c)}),e[i]=void 0,o}}return r};return n(t,0)},RJ=Jo("AsyncFunction"),MJ=t=>t&&(zb(t)||Si(t))&&Si(t.then)&&Si(t.catch),b4=((t,e)=>t?setImmediate:e?((n,r)=>(fc.addEventListener("message",({source:i,data:o})=>{i===fc&&o===n&&r.length&&r.shift()()},!1),i=>{r.push(i),fc.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Si(fc.postMessage)),DJ=typeof queueMicrotask<"u"?queueMicrotask.bind(fc):typeof process<"u"&&process.nextTick||b4,$J=t=>t!=null&&Si(t[Ub]),ae={isArray:xf,isArrayBuffer:m4,isBuffer:eJ,isFormData:cJ,isArrayBufferView:tJ,isString:nJ,isNumber:g4,isBoolean:rJ,isObject:zb,isPlainObject:_v,isReadableStream:dJ,isRequest:fJ,isResponse:hJ,isHeaders:pJ,isUndefined:_p,isDate:iJ,isFile:oJ,isBlob:sJ,isRegExp:EJ,isFunction:Si,isStream:lJ,isURLSearchParams:uJ,isTypedArray:SJ,isFileList:aJ,forEach:Gm,merge:c1,extend:gJ,trim:mJ,stripBOM:vJ,inherits:yJ,toFlatObject:xJ,kindOf:Bb,kindOfTest:Jo,endsWith:bJ,toArray:wJ,forEachEntry:CJ,matchAll:AJ,isHTMLForm:_J,hasOwnProperty:lO,hasOwnProp:lO,reduceDescriptors:x4,freezeMethods:NJ,toObjectSet:TJ,toCamelCase:jJ,noop:PJ,toFiniteNumber:kJ,findKey:v4,global:fc,isContextDefined:y4,isSpecCompliantForm:OJ,toJSONObject:IJ,isAsyncFn:RJ,isThenable:MJ,setImmediate:b4,asap:DJ,isIterable:$J};function kt(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}ae.inherits(kt,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 w4=kt.prototype,S4={};["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(t=>{S4[t]={value:t}});Object.defineProperties(kt,S4);Object.defineProperty(w4,"isAxiosError",{value:!0});kt.from=(t,e,n,r,i,o)=>{const s=Object.create(w4);return ae.toFlatObject(t,s,function(c){return c!==Error.prototype},l=>l!=="isAxiosError"),kt.call(s,t.message,e,n,r,i),s.cause=t,s.name=t.name,o&&Object.assign(s,o),s};const LJ=null;function u1(t){return ae.isPlainObject(t)||ae.isArray(t)}function C4(t){return ae.endsWith(t,"[]")?t.slice(0,-2):t}function cO(t,e,n){return t?t.concat(e).map(function(i,o){return i=C4(i),!n&&o?"["+i+"]":i}).join(n?".":""):e}function FJ(t){return ae.isArray(t)&&!t.some(u1)}const UJ=ae.toFlatObject(ae,{},null,function(e){return/^is[A-Z]/.test(e)});function Vb(t,e,n){if(!ae.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=ae.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,v){return!ae.isUndefined(v[m])});const r=n.metaTokens,i=n.visitor||d,o=n.dots,s=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&ae.isSpecCompliantForm(e);if(!ae.isFunction(i))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 kt("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,v){let b=g;if(g&&!v&&typeof g=="object"){if(ae.endsWith(m,"{}"))m=r?m:m.slice(0,-2),g=JSON.stringify(g);else if(ae.isArray(g)&&FJ(g)||(ae.isFileList(g)||ae.endsWith(m,"[]"))&&(b=ae.toArray(g)))return m=C4(m),b.forEach(function(w,S){!(ae.isUndefined(w)||w===null)&&e.append(s===!0?cO([m],S,o):s===null?m:m+"[]",u(w))}),!1}return u1(g)?!0:(e.append(cO(v,m,o),u(g)),!1)}const f=[],h=Object.assign(UJ,{defaultVisitor:d,convertValue:u,isVisitable:u1});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,x){(!(ae.isUndefined(b)||b===null)&&i.call(e,b,ae.isString(x)?x.trim():x,m,h))===!0&&p(b,m?m.concat(x):[x])}),f.pop()}}if(!ae.isObject(t))throw new TypeError("data must be an object");return p(t),e}function uO(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Jj(t,e){this._pairs=[],t&&Vb(t,this,e)}const A4=Jj.prototype;A4.append=function(e,n){this._pairs.push([e,n])};A4.toString=function(e){const n=e?function(r){return e.call(this,r,uO)}:uO;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function BJ(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function _4(t,e,n){if(!e)return t;const r=n&&n.encode||BJ;ae.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(i?o=i(e,n):o=ae.isURLSearchParams(e)?e.toString():new Jj(e,n).toString(r),o){const s=t.indexOf("#");s!==-1&&(t=t.slice(0,s)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class dO{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){ae.forEach(this.handlers,function(r){r!==null&&e(r)})}}const j4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},HJ=typeof URLSearchParams<"u"?URLSearchParams:Jj,zJ=typeof FormData<"u"?FormData:null,VJ=typeof Blob<"u"?Blob:null,GJ={isBrowser:!0,classes:{URLSearchParams:HJ,FormData:zJ,Blob:VJ},protocols:["http","https","file","blob","url","data"]},Zj=typeof window<"u"&&typeof document<"u",d1=typeof navigator=="object"&&navigator||void 0,KJ=Zj&&(!d1||["ReactNative","NativeScript","NS"].indexOf(d1.product)<0),WJ=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",qJ=Zj&&window.location.href||"http://localhost",YJ=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Zj,hasStandardBrowserEnv:KJ,hasStandardBrowserWebWorkerEnv:WJ,navigator:d1,origin:qJ},Symbol.toStringTag,{value:"Module"})),Kr={...YJ,...GJ};function QJ(t,e){return Vb(t,new Kr.classes.URLSearchParams,Object.assign({visitor:function(n,r,i,o){return Kr.isNode&&ae.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},e))}function XJ(t){return ae.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function JJ(t){const e={},n=Object.keys(t);let r;const i=n.length;let o;for(r=0;r=n.length;return s=!s&&ae.isArray(i)?i.length:s,c?(ae.hasOwnProp(i,s)?i[s]=[i[s],r]:i[s]=r,!l):((!i[s]||!ae.isObject(i[s]))&&(i[s]=[]),e(n,r,i[s],o)&&ae.isArray(i[s])&&(i[s]=JJ(i[s])),!l)}if(ae.isFormData(t)&&ae.isFunction(t.entries)){const n={};return ae.forEachEntry(t,(r,i)=>{e(XJ(r),i,n,0)}),n}return null}function ZJ(t,e,n){if(ae.isString(t))try{return(e||JSON.parse)(t),ae.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(0,JSON.stringify)(t)}const Km={transitional:j4,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,o=ae.isObject(e);if(o&&ae.isHTMLForm(e)&&(e=new FormData(e)),ae.isFormData(e))return i?JSON.stringify(E4(e)):e;if(ae.isArrayBuffer(e)||ae.isBuffer(e)||ae.isStream(e)||ae.isFile(e)||ae.isBlob(e)||ae.isReadableStream(e))return e;if(ae.isArrayBufferView(e))return e.buffer;if(ae.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return QJ(e,this.formSerializer).toString();if((l=ae.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Vb(l?{"files[]":e}:e,c&&new c,this.formSerializer)}}return o||i?(n.setContentType("application/json",!1),ZJ(e)):e}],transformResponse:[function(e){const n=this.transitional||Km.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(ae.isResponse(e)||ae.isReadableStream(e))return e;if(e&&ae.isString(e)&&(r&&!this.responseType||i)){const s=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(l){if(s)throw l.name==="SyntaxError"?kt.from(l,kt.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Kr.classes.FormData,Blob:Kr.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ae.forEach(["delete","get","head","post","put","patch"],t=>{Km.headers[t]={}});const eZ=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"]),tZ=t=>{const e={};let n,r,i;return t&&t.split(` +`).forEach(function(s){i=s.indexOf(":"),n=s.substring(0,i).trim().toLowerCase(),r=s.substring(i+1).trim(),!(!n||e[n]&&eZ[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},fO=Symbol("internals");function nh(t){return t&&String(t).trim().toLowerCase()}function jv(t){return t===!1||t==null?t:ae.isArray(t)?t.map(jv):String(t)}function nZ(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const rZ=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function tS(t,e,n,r,i){if(ae.isFunction(r))return r.call(this,e,n);if(i&&(e=n),!!ae.isString(e)){if(ae.isString(r))return e.indexOf(r)!==-1;if(ae.isRegExp(r))return r.test(e)}}function iZ(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function oZ(t,e){const n=ae.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(i,o,s){return this[r].call(this,e,i,o,s)},configurable:!0})})}class Ci{constructor(e){e&&this.set(e)}set(e,n,r){const i=this;function o(l,c,u){const d=nh(c);if(!d)throw new Error("header name must be a non-empty string");const f=ae.findKey(i,d);(!f||i[f]===void 0||u===!0||u===void 0&&i[f]!==!1)&&(i[f||c]=jv(l))}const s=(l,c)=>ae.forEach(l,(u,d)=>o(u,d,c));if(ae.isPlainObject(e)||e instanceof this.constructor)s(e,n);else if(ae.isString(e)&&(e=e.trim())&&!rZ(e))s(tZ(e),n);else if(ae.isObject(e)&&ae.isIterable(e)){let l={},c,u;for(const d of e){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]}s(l,n)}else e!=null&&o(n,e,r);return this}get(e,n){if(e=nh(e),e){const r=ae.findKey(this,e);if(r){const i=this[r];if(!n)return i;if(n===!0)return nZ(i);if(ae.isFunction(n))return n.call(this,i,r);if(ae.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=nh(e),e){const r=ae.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||tS(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let i=!1;function o(s){if(s=nh(s),s){const l=ae.findKey(r,s);l&&(!n||tS(r,r[l],l,n))&&(delete r[l],i=!0)}}return ae.isArray(e)?e.forEach(o):o(e),i}clear(e){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const o=n[r];(!e||tS(this,this[o],o,e,!0))&&(delete this[o],i=!0)}return i}normalize(e){const n=this,r={};return ae.forEach(this,(i,o)=>{const s=ae.findKey(r,o);if(s){n[s]=jv(i),delete n[o];return}const l=e?iZ(o):String(o).trim();l!==o&&delete n[o],n[l]=jv(i),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return ae.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=e&&ae.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[fO]=this[fO]={accessors:{}}).accessors,i=this.prototype;function o(s){const l=nh(s);r[l]||(oZ(i,s),r[l]=!0)}return ae.isArray(e)?e.forEach(o):o(e),this}}Ci.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ae.reduceDescriptors(Ci.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});ae.freezeMethods(Ci);function nS(t,e){const n=this||Km,r=e||n,i=Ci.from(r.headers);let o=r.data;return ae.forEach(t,function(l){o=l.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function N4(t){return!!(t&&t.__CANCEL__)}function bf(t,e,n){kt.call(this,t??"canceled",kt.ERR_CANCELED,e,n),this.name="CanceledError"}ae.inherits(bf,kt,{__CANCEL__:!0});function T4(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new kt("Request failed with status code "+n.status,[kt.ERR_BAD_REQUEST,kt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function sZ(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function aZ(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,o=0,s;return e=e!==void 0?e:1e3,function(c){const u=Date.now(),d=r[o];s||(s=u),n[i]=c,r[i]=u;let f=o,h=0;for(;f!==i;)h+=n[f++],f=f%t;if(i=(i+1)%t,i===o&&(o=(o+1)%t),u-s{n=d,i=null,o&&(clearTimeout(o),o=null),t.apply(null,u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?s(u,d):(i=u,o||(o=setTimeout(()=>{o=null,s(i)},r-f)))},()=>i&&s(i)]}const gy=(t,e,n=3)=>{let r=0;const i=aZ(50,250);return lZ(o=>{const s=o.loaded,l=o.lengthComputable?o.total:void 0,c=s-r,u=i(c),d=s<=l;r=s;const f={loaded:s,total:l,progress:l?s/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&d?(l-s)/u:void 0,event:o,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(f)},n)},hO=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},pO=t=>(...e)=>ae.asap(()=>t(...e)),cZ=Kr.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Kr.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Kr.origin),Kr.navigator&&/(msie|trident)/i.test(Kr.navigator.userAgent)):()=>!0,uZ=Kr.hasStandardBrowserEnv?{write(t,e,n,r,i,o){const s=[t+"="+encodeURIComponent(e)];ae.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),ae.isString(r)&&s.push("path="+r),ae.isString(i)&&s.push("domain="+i),o===!0&&s.push("secure"),document.cookie=s.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function dZ(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function fZ(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function P4(t,e,n){let r=!dZ(e);return t&&(r||n==!1)?fZ(t,e):e}const mO=t=>t instanceof Ci?{...t}:t;function Gc(t,e){e=e||{};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 i(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 o(u,d){if(!ae.isUndefined(d))return r(void 0,d)}function s(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 e)return r(u,d);if(f in t)return r(void 0,u)}const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:l,headers:(u,d,f)=>i(mO(u),mO(d),f,!0)};return ae.forEach(Object.keys(Object.assign({},t,e)),function(d){const f=c[d]||i,h=f(t[d],e[d],d);ae.isUndefined(h)&&f!==l||(n[d]=h)}),n}const k4=t=>{const e=Gc({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:l}=e;e.headers=s=Ci.from(s),e.url=_4(P4(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&s.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(ae.isFormData(n)){if(Kr.hasStandardBrowserEnv||Kr.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((c=s.getContentType())!==!1){const[u,...d]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];s.setContentType([u||"multipart/form-data",...d].join("; "))}}if(Kr.hasStandardBrowserEnv&&(r&&ae.isFunction(r)&&(r=r(e)),r||r!==!1&&cZ(e.url))){const u=i&&o&&uZ.read(o);u&&s.set(i,u)}return e},hZ=typeof XMLHttpRequest<"u",pZ=hZ&&function(t){return new Promise(function(n,r){const i=k4(t);let o=i.data;const s=Ci.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 v=new XMLHttpRequest;v.open(i.method.toUpperCase(),i.url,!0),v.timeout=i.timeout;function b(){if(!v)return;const w=Ci.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),C={data:!l||l==="text"||l==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:w,config:t,request:v};T4(function(_){n(_),m()},function(_){r(_),m()},C),v=null}"onloadend"in v?v.onloadend=b:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(b)},v.onabort=function(){v&&(r(new kt("Request aborted",kt.ECONNABORTED,t,v)),v=null)},v.onerror=function(){r(new kt("Network Error",kt.ERR_NETWORK,t,v)),v=null},v.ontimeout=function(){let S=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const C=i.transitional||j4;i.timeoutErrorMessage&&(S=i.timeoutErrorMessage),r(new kt(S,C.clarifyTimeoutError?kt.ETIMEDOUT:kt.ECONNABORTED,t,v)),v=null},o===void 0&&s.setContentType(null),"setRequestHeader"in v&&ae.forEach(s.toJSON(),function(S,C){v.setRequestHeader(C,S)}),ae.isUndefined(i.withCredentials)||(v.withCredentials=!!i.withCredentials),l&&l!=="json"&&(v.responseType=i.responseType),u&&([h,g]=gy(u,!0),v.addEventListener("progress",h)),c&&v.upload&&([f,p]=gy(c),v.upload.addEventListener("progress",f),v.upload.addEventListener("loadend",p)),(i.cancelToken||i.signal)&&(d=w=>{v&&(r(!w||w.type?new bf(null,t,v):w),v.abort(),v=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const x=sZ(i.url);if(x&&Kr.protocols.indexOf(x)===-1){r(new kt("Unsupported protocol "+x+":",kt.ERR_BAD_REQUEST,t));return}v.send(o||null)})},mZ=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i;const o=function(u){if(!i){i=!0,l();const d=u instanceof Error?u:this.reason;r.abort(d instanceof kt?d:new bf(d instanceof Error?d.message:d))}};let s=e&&setTimeout(()=>{s=null,o(new kt(`timeout ${e} of ms exceeded`,kt.ETIMEDOUT))},e);const l=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),t=null)};t.forEach(u=>u.addEventListener("abort",o));const{signal:c}=r;return c.unsubscribe=()=>ae.asap(l),c}},gZ=function*(t,e){let n=t.byteLength;if(n{const i=vZ(t,e);let o=0,s,l=c=>{s||(s=!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=o+=f;n(h)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),i.return()}},{highWaterMark:2})},Gb=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",O4=Gb&&typeof ReadableStream=="function",xZ=Gb&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),I4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},bZ=O4&&I4(()=>{let t=!1;const e=new Request(Kr.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),vO=64*1024,f1=O4&&I4(()=>ae.isReadableStream(new Response("").body)),vy={stream:f1&&(t=>t.body)};Gb&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!vy[e]&&(vy[e]=ae.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new kt(`Response type '${e}' is not supported`,kt.ERR_NOT_SUPPORT,r)})})})(new Response);const wZ=async t=>{if(t==null)return 0;if(ae.isBlob(t))return t.size;if(ae.isSpecCompliantForm(t))return(await new Request(Kr.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(ae.isArrayBufferView(t)||ae.isArrayBuffer(t))return t.byteLength;if(ae.isURLSearchParams(t)&&(t=t+""),ae.isString(t))return(await xZ(t)).byteLength},SZ=async(t,e)=>{const n=ae.toFiniteNumber(t.getContentLength());return n??wZ(e)},CZ=Gb&&(async t=>{let{url:e,method:n,data:r,signal:i,cancelToken:o,timeout:s,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:d,withCredentials:f="same-origin",fetchOptions:h}=k4(t);u=u?(u+"").toLowerCase():"text";let p=mZ([i,o&&o.toAbortSignal()],s),g;const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let v;try{if(c&&bZ&&n!=="get"&&n!=="head"&&(v=await SZ(d,r))!==0){let C=new Request(e,{method:"POST",body:r,duplex:"half"}),A;if(ae.isFormData(r)&&(A=C.headers.get("content-type"))&&d.setContentType(A),C.body){const[_,j]=hO(v,gy(pO(c)));r=gO(C.body,vO,_,j)}}ae.isString(f)||(f=f?"include":"omit");const b="credentials"in Request.prototype;g=new Request(e,{...h,signal:p,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:b?f:void 0});let x=await fetch(g);const w=f1&&(u==="stream"||u==="response");if(f1&&(l||w&&m)){const C={};["status","statusText","headers"].forEach(k=>{C[k]=x[k]});const A=ae.toFiniteNumber(x.headers.get("content-length")),[_,j]=l&&hO(A,gy(pO(l),!0))||[];x=new Response(gO(x.body,vO,_,()=>{j&&j(),m&&m()}),C)}u=u||"text";let S=await vy[ae.findKey(vy,u)||"text"](x,t);return!w&&m&&m(),await new Promise((C,A)=>{T4(C,A,{data:S,headers:Ci.from(x.headers),status:x.status,statusText:x.statusText,config:t,request:g})})}catch(b){throw m&&m(),b&&b.name==="TypeError"&&/Load failed|fetch/i.test(b.message)?Object.assign(new kt("Network Error",kt.ERR_NETWORK,t,g),{cause:b.cause||b}):kt.from(b,b&&b.code,t,g)}}),h1={http:LJ,xhr:pZ,fetch:CZ};ae.forEach(h1,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const yO=t=>`- ${t}`,AZ=t=>ae.isFunction(t)||t===null||t===!1,R4={getAdapter:t=>{t=ae.isArray(t)?t:[t];const{length:e}=t;let n,r;const i={};for(let o=0;o`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let s=e?o.length>1?`since : +`+o.map(yO).join(` +`):" "+yO(o[0]):"as no adapter specified";throw new kt("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:h1};function rS(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new bf(null,t)}function xO(t){return rS(t),t.headers=Ci.from(t.headers),t.data=nS.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),R4.getAdapter(t.adapter||Km.adapter)(t).then(function(r){return rS(t),r.data=nS.call(t,t.transformResponse,r),r.headers=Ci.from(r.headers),r},function(r){return N4(r)||(rS(t),r&&r.response&&(r.response.data=nS.call(t,t.transformResponse,r.response),r.response.headers=Ci.from(r.response.headers))),Promise.reject(r)})}const M4="1.9.0",Kb={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Kb[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const bO={};Kb.transitional=function(e,n,r){function i(o,s){return"[Axios v"+M4+"] Transitional option '"+o+"'"+s+(r?". "+r:"")}return(o,s,l)=>{if(e===!1)throw new kt(i(s," has been removed"+(n?" in "+n:"")),kt.ERR_DEPRECATED);return n&&!bO[s]&&(bO[s]=!0,console.warn(i(s," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(o,s,l):!0}};Kb.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function _Z(t,e,n){if(typeof t!="object")throw new kt("options must be an object",kt.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const o=r[i],s=e[o];if(s){const l=t[o],c=l===void 0||s(l,o,t);if(c!==!0)throw new kt("option "+o+" must be "+c,kt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new kt("Unknown option "+o,kt.ERR_BAD_OPTION)}}const Ev={assertOptions:_Z,validators:Kb},rs=Ev.validators;class Tc{constructor(e){this.defaults=e||{},this.interceptors={request:new dO,response:new dO}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+o):r.stack=o}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Gc(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:o}=n;r!==void 0&&Ev.assertOptions(r,{silentJSONParsing:rs.transitional(rs.boolean),forcedJSONParsing:rs.transitional(rs.boolean),clarifyTimeoutError:rs.transitional(rs.boolean)},!1),i!=null&&(ae.isFunction(i)?n.paramsSerializer={serialize:i}:Ev.assertOptions(i,{encode:rs.function,serialize:rs.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ev.assertOptions(n,{baseUrl:rs.spelling("baseURL"),withXsrfToken:rs.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=o&&ae.merge(o.common,o[n.method]);o&&ae.forEach(["delete","get","head","post","put","patch","common"],g=>{delete o[g]}),n.headers=Ci.concat(s,o);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=[xO.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 o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o;const s=new Promise(l=>{r.subscribe(l),o=l}).then(i);return s.cancel=function(){r.unsubscribe(o)},s},e(function(o,s,l){r.reason||(r.reason=new bf(o,s,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new eE(function(i){e=i}),cancel:e}}}function jZ(t){return function(n){return t.apply(null,n)}}function EZ(t){return ae.isObject(t)&&t.isAxiosError===!0}const p1={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(p1).forEach(([t,e])=>{p1[e]=t});function D4(t){const e=new Tc(t),n=h4(Tc.prototype.request,e);return ae.extend(n,Tc.prototype,e,{allOwnKeys:!0}),ae.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return D4(Gc(t,i))},n}const ir=D4(Km);ir.Axios=Tc;ir.CanceledError=bf;ir.CancelToken=eE;ir.isCancel=N4;ir.VERSION=M4;ir.toFormData=Vb;ir.AxiosError=kt;ir.Cancel=ir.CanceledError;ir.all=function(e){return Promise.all(e)};ir.spread=jZ;ir.isAxiosError=EZ;ir.mergeConfig=Gc;ir.AxiosHeaders=Ci;ir.formToJSON=t=>E4(ae.isHTMLForm(t)?new FormData(t):t);ir.getAdapter=R4.getAdapter;ir.HttpStatusCode=p1;ir.default=ir;const $4="https://ai-sandbox.oliver.solutions/semblance_back/api",Le=ir.create({baseURL:$4,headers:{"Content-Type":"application/json"},timeout:6e5});Le.interceptors.request.use(t=>{var n,r;const e=localStorage.getItem("auth_token");return e&&(t.headers.Authorization=`Bearer ${e}`),t.method==="put"&&((n=t.url)!=null&&n.includes("/focus-groups/"))&&console.log("🌐 API Request:",{method:t.method,url:t.url,baseURL:t.baseURL,fullURL:`${t.baseURL}${t.url}`,data:t.data}),(r=t.url)!=null&&r.includes("/folders/")&&console.log("🌐 API Folder Request:",{method:t.method,url:t.url,baseURL:t.baseURL,fullURL:`${t.baseURL}${t.url}`,data:t.data}),t},t=>Promise.reject(t));const m1="auth_error",NZ=t=>{t!=null&&t.isPersonaCreation||(localStorage.removeItem("auth_token"),localStorage.removeItem("user"));const e=new CustomEvent(m1,{detail:t||{}});window.dispatchEvent(e)};Le.interceptors.response.use(t=>t,t=>{var e,n,r,i,o,s;if(t.response&&t.response.status===401){const l=t.config&&(((e=t.config.url)==null?void 0:e.includes("/personas"))||((n=t.config.url)==null?void 0:n.includes("/personas/batch"))||t.config.method&&((r=t.config.url)==null?void 0:r.startsWith("/personas")));console.log("API Error:",{url:(i=t.config)==null?void 0:i.url,method:(o=t.config)==null?void 0:o.method,isPersonaRequest:l}),l?console.warn("Authentication error in persona request, letting component handle it"):NZ({source:(s=t.config)==null?void 0:s.url,isPersonaCreation:!1})}return Promise.reject(t)});const Nv={login:(t,e)=>Le.post("/auth/login",{username:t,password:e}),loginWithMicrosoft:t=>Le.post("/auth/microsoft",{access_token:t}),register:(t,e,n)=>Le.post("/auth/register",{username:t,email:e,password:n}),getProfile:()=>Le.get("/auth/me")},kr={getAll:()=>Le.get("/personas/all"),getById:t=>Le.get(`/personas/${t}`),create:t=>Le.post("/personas",t),update:(t,e)=>t&&t.startsWith("local-")?(console.log("Cannot update with local ID, creating new instead:",t),Le.post("/personas",e)):Le.put(`/personas/${t}`,e),delete:t=>{const e=typeof t=="object"&&t!==null&&t._id||t;return console.log(`Deleting persona with ID: ${e}`),Le.delete(`/personas/${e}`)},createBatch:t=>Le.post("/personas/batch",t)},Ks={generate:t=>Le.post("/ai-personas/generate",t||{},{timeout:6e5}),generateAndSave:t=>Le.post("/ai-personas/generate-and-save",t||{},{timeout:6e5}),batchGenerate:t=>Le.post("/ai-personas/batch-generate",t,{timeout:6e5}),batchGenerateAndSave:t=>Le.post("/ai-personas/batch-generate-and-save",t,{timeout:6e5}),generateBasicProfiles:(t,e=5,n=.8)=>Le.post("/ai-personas/generate-basic-profiles",{audience_brief:t,count:e,temperature:n},{timeout:6e5}),completePersona:(t,e=.7)=>Le.post("/ai-personas/complete-persona",{basic_profile:t,temperature:e},{timeout:6e5}),completeAndSavePersona:(t,e=.7)=>Le.post("/ai-personas/complete-and-save-persona",{basic_profile:t,temperature:e},{timeout:6e5}),generatePersonaSummary:(t,e=.7)=>Le.post("/ai-personas/generate-persona-summary",{persona_data:t,temperature:e},{timeout:6e5}),batchGenerateWithStages:async(t,e,n=5,r=.7,i,o)=>{var s;try{console.log(`📡 API call to generate-basic-profiles with model: ${o||"gemini-2.5-pro"}`);const c=(await Le.post("/ai-personas/generate-basic-profiles",{audience_brief:t,research_objective:e,count:n,temperature:.7,customer_data_session_id:i,llm_model:o||"gemini-2.5-pro"},{timeout:6e5})).data.profiles,u=[],d=[],f=[];console.log(`📡 API call to complete-and-save-persona with model: ${o||"gemini-2.5-pro"}`);const h=c.map(g=>Le.post("/ai-personas/complete-and-save-persona",{basic_profile:g,temperature:r,customer_data_session_id:i,llm_model:o||"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 v=c[m],b={index:m,name:v.name||`Persona ${m+1}`,error:g.reason};f.push(b),console.error(`Failed to complete persona ${m+1} (${v.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((s=l.response)==null?void 0:s.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:(t,e,n=.7)=>Le.post("/ai-personas/enhance-audience-brief",{audience_brief:t,research_objective:e,temperature:n},{timeout:6e5}),batchGenerateSummaries:(t,e=.7,n)=>(console.log(`📡 Frontend: API call to batch-generate-summaries with model: ${n||"gemini-2.5-pro"}`),Le.post("/ai-personas/batch-generate-summaries",{persona_ids:t,temperature:e,llm_model:n||"gemini-2.5-pro"},{timeout:9e5})),uploadCustomerData:t=>{const e=new FormData;for(let n=0;nLe.delete(`/ai-personas/cleanup-customer-data/${t}`)},_t={getAll:()=>Le.get("/focus-groups"),getById:t=>Le.get(`/focus-groups/${t}`),create:t=>Le.post("/focus-groups",t),update:(t,e)=>Le.put(`/focus-groups/${t}`,e),delete:t=>Le.delete(`/focus-groups/${t}`),addParticipant:(t,e)=>Le.post(`/focus-groups/${t}/participants`,{persona_id:e}),removeParticipant:(t,e)=>Le.delete(`/focus-groups/${t}/participants/${e}`),sendMessage:(t,e)=>Le.post(`/focus-groups/${t}/messages`,e),getMessages:t=>Le.get(`/focus-groups/${t}/messages`),updateMessageHighlight:(t,e,n)=>Le.patch(`/focus-groups/${t}/messages/${e}`,{highlighted:n}),describeAsset:(t,e)=>Le.post(`/focus-groups/${t}/describe-asset`,{asset_filename:e},{timeout:12e4}),generateDiscussionGuide:t=>Le.post("/focus-groups/generate-discussion-guide",t,{timeout:6e5}),generateDiscussionGuideForGroup:(t,e)=>Le.post(`/focus-groups/${t}/generate-discussion-guide`,e,{timeout:6e5}),downloadDiscussionGuide:async t=>{try{const e=await Le.get(`/focus-groups/${t}/discussion-guide/download`,{responseType:"blob",timeout:3e4}),n=e.headers["content-disposition"];let r="discussion-guide.md";if(n){const l=n.match(/filename="([^"]+)"/);l&&(r=l[1])}const i=new Blob([e.data],{type:"text/markdown"}),o=URL.createObjectURL(i),s=document.createElement("a");return s.href=o,s.download=r,s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o),{success:!0,filename:r}}catch(e){throw console.error("Error downloading discussion guide:",e),new Error("Failed to download discussion guide")}},createNote:(t,e)=>Le.post(`/focus-groups/${t}/notes`,e),getNotes:t=>Le.get(`/focus-groups/${t}/notes`),deleteNote:(t,e)=>Le.delete(`/focus-groups/${t}/notes/${e}`),uploadAssets:(t,e,n)=>(n===!0&&e.append("replace","true"),Le.post(`/focus-groups/${t}/assets`,e,{headers:{"Content-Type":"multipart/form-data"},timeout:12e4})),getAssets:t=>Le.get(`/focus-groups/${t}/assets`),getAssetUrl:(t,e)=>`${$4}/focus-groups/${t}/assets/${e}`,deleteAsset:(t,e)=>Le.delete(`/focus-groups/${t}/assets/${e}`)},Hn={generateResponse:(t,e,n,r=.7)=>Le.post("/focus-group-ai/generate-response",{focus_group_id:t,persona_id:e,current_topic:n,temperature:r},{timeout:6e5}),generateKeyThemes:(t,e=.7)=>Le.post("/focus-group-ai/generate-key-themes",{focus_group_id:t,temperature:e},{timeout:6e5}),getKeyThemes:t=>Le.get(`/focus-group-ai/key-themes/${t}`),deleteKeyTheme:(t,e)=>Le.delete(`/focus-group-ai/key-themes/${t}/${e}`),getModeratorStatus:t=>Le.get(`/focus-group-ai/moderator/status/${t}`),advanceModeratorDiscussion:t=>Le.post(`/focus-group-ai/moderator/advance/${t}`,{},{timeout:6e5}),setModeratorPosition:(t,e,n)=>Le.put(`/focus-group-ai/moderator/position/${t}`,{section_id:e,item_id:n}),startAutonomousConversation:(t,e)=>Le.post(`/focus-group-ai/autonomous/start/${t}`,{initial_prompt:e},{timeout:6e5}),stopAutonomousConversation:(t,e)=>Le.post(`/focus-group-ai/autonomous/stop/${t}`,{reason:e}),getAutonomousConversationStatus:t=>Le.get(`/focus-group-ai/autonomous/status/${t}`),getConversationState:t=>Le.get(`/focus-group-ai/conversation/state/${t}`),getConversationAnalytics:t=>Le.get(`/focus-group-ai/conversation/analytics/${t}`),makeConversationDecision:(t,e=.7,n="ai")=>Le.post(`/focus-group-ai/conversation/decision/${t}`,{temperature:e,mode:n},{timeout:6e5}),getConversationInsights:t=>Le.get(`/focus-group-ai/conversation/insights/${t}`,{timeout:6e5}),manualIntervention:(t,e,n,r)=>Le.post(`/focus-group-ai/conversation/intervene/${t}`,{action:e,message:n,participant_id:r}),getReasoningHistory:t=>Le.get(`/focus-group-ai/conversation/reasoning-history/${t}`),endSession:(t,e)=>Le.post(`/focus-group-ai/moderator/end-session/${t}`,{reason:e||"session_ended"})},ds={getAll:()=>Le.get("/folders"),getById:t=>Le.get(`/folders/${t}`),create:t=>Le.post("/folders",t),update:(t,e)=>Le.put(`/folders/${t}`,e),delete:t=>Le.delete(`/folders/${t}`),addPersona:(t,e)=>Le.post(`/folders/${t}/personas`,{persona_id:e}),removePersona:(t,e)=>Le.delete(`/folders/${t}/personas/${e}`),addPersonasBatch:(t,e)=>Le.post(`/folders/${t}/personas/batch`,{persona_ids:e}),removePersonasBatch:(t,e)=>(console.log(`🌐 API removePersonasBatch: Sending POST to /folders/${t}/personas/remove-batch with persona_ids:`,e),Le.post(`/folders/${t}/personas/remove-batch`,{persona_ids:e})),addPersonaToMultipleFolders:(t,e)=>{const n=e.map(r=>Le.post(`/folders/${r}/personas`,{persona_id:t}));return Promise.all(n)},removePersonaFromAllFolders:t=>{throw new Error("Use removePersona for specific folders")}};/*! @azure/msal-common v15.10.0 2025-08-05 */const ve={LIBRARY_NAME:"MSAL.JS",SKU:"msal.js.common",DEFAULT_AUTHORITY:"https://login.microsoftonline.com/common/",DEFAULT_AUTHORITY_HOST:"login.microsoftonline.com",DEFAULT_COMMON_TENANT:"common",ADFS:"adfs",DSTS:"dstsv2",AAD_INSTANCE_DISCOVERY_ENDPT:"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",CIAM_AUTH_URL:".ciamlogin.com",AAD_TENANT_DOMAIN_SUFFIX:".onmicrosoft.com",RESOURCE_DELIM:"|",NO_ACCOUNT:"NO_ACCOUNT",CLAIMS:"claims",CONSUMER_UTID:"9188040d-6c67-4c5b-b112-36a304b66dad",OPENID_SCOPE:"openid",PROFILE_SCOPE:"profile",OFFLINE_ACCESS_SCOPE:"offline_access",EMAIL_SCOPE:"email",CODE_GRANT_TYPE:"authorization_code",RT_GRANT_TYPE:"refresh_token",S256_CODE_CHALLENGE_METHOD:"S256",URL_FORM_CONTENT_TYPE:"application/x-www-form-urlencoded;charset=utf-8",AUTHORIZATION_PENDING:"authorization_pending",NOT_DEFINED:"not_defined",EMPTY_STRING:"",NOT_APPLICABLE:"N/A",NOT_AVAILABLE:"Not Available",FORWARD_SLASH:"/",IMDS_ENDPOINT:"http://169.254.169.254/metadata/instance/compute/location",IMDS_VERSION:"2020-06-01",IMDS_TIMEOUT:2e3,AZURE_REGION_AUTO_DISCOVER_FLAG:"TryAutoDetect",REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX:"login.microsoft.com",KNOWN_PUBLIC_CLOUDS:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"],SHR_NONCE_VALIDITY:240,INVALID_INSTANCE:"invalid_instance"},rl={SUCCESS:200,SUCCESS_RANGE_START:200,SUCCESS_RANGE_END:299,REDIRECT:302,CLIENT_ERROR:400,CLIENT_ERROR_RANGE_START:400,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,REQUEST_TIMEOUT:408,GONE:410,TOO_MANY_REQUESTS:429,CLIENT_ERROR_RANGE_END:499,SERVER_ERROR:500,SERVER_ERROR_RANGE_START:500,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,SERVER_ERROR_RANGE_END:599,MULTI_SIDED_ERROR:600},hc={GET:"GET",POST:"POST"},Wm=[ve.OPENID_SCOPE,ve.PROFILE_SCOPE,ve.OFFLINE_ACCESS_SCOPE],wO=[...Wm,ve.EMAIL_SCOPE],ei={CONTENT_TYPE:"Content-Type",CONTENT_LENGTH:"Content-Length",RETRY_AFTER:"Retry-After",CCS_HEADER:"X-AnchorMailbox",WWWAuthenticate:"WWW-Authenticate",AuthenticationInfo:"Authentication-Info",X_MS_REQUEST_ID:"x-ms-request-id",X_MS_HTTP_VERSION:"x-ms-httpver"},SO={ACTIVE_ACCOUNT_FILTERS:"active-account-filters"},ml={COMMON:"common",ORGANIZATIONS:"organizations",CONSUMERS:"consumers"},Fg={ACCESS_TOKEN:"access_token",XMS_CC:"xms_cc"},ri={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none",CREATE:"create",NO_SESSION:"no_session"},tE={CODE:"code",IDTOKEN_TOKEN:"id_token token",IDTOKEN_TOKEN_REFRESHTOKEN:"id_token token refresh_token"},Wb={QUERY:"query",FRAGMENT:"fragment"},TZ={QUERY:"query",FRAGMENT:"fragment",FORM_POST:"form_post"},L4={IMPLICIT_GRANT:"implicit",AUTHORIZATION_CODE_GRANT:"authorization_code",CLIENT_CREDENTIALS_GRANT:"client_credentials",RESOURCE_OWNER_PASSWORD_GRANT:"password",REFRESH_TOKEN_GRANT:"refresh_token",DEVICE_CODE_GRANT:"device_code",JWT_BEARER:"urn:ietf:params:oauth:grant-type:jwt-bearer"},Ug={MSSTS_ACCOUNT_TYPE:"MSSTS",ADFS_ACCOUNT_TYPE:"ADFS",MSAV1_ACCOUNT_TYPE:"MSA",GENERIC_ACCOUNT_TYPE:"Generic"},jp={CACHE_KEY_SEPARATOR:"-",CLIENT_INFO_SEPARATOR:"."},Pr={ID_TOKEN:"IdToken",ACCESS_TOKEN:"AccessToken",ACCESS_TOKEN_WITH_AUTH_SCHEME:"AccessToken_With_AuthScheme",REFRESH_TOKEN:"RefreshToken"},nE="appmetadata",PZ="client_info",yy="1",xy={CACHE_KEY:"authority-metadata",REFRESH_TIME_SECONDS:3600*24},Ti={CONFIG:"config",CACHE:"cache",NETWORK:"network",HARDCODED_VALUES:"hardcoded_values"},jr={SCHEMA_VERSION:5,MAX_LAST_HEADER_BYTES:330,MAX_CACHED_ERRORS:50,CACHE_KEY:"server-telemetry",CATEGORY_SEPARATOR:"|",VALUE_SEPARATOR:",",OVERFLOW_TRUE:"1",OVERFLOW_FALSE:"0",UNKNOWN_ERROR:"unknown_error"},an={BEARER:"Bearer",POP:"pop",SSH:"ssh-cert"},Lh={DEFAULT_THROTTLE_TIME_SECONDS:60,DEFAULT_MAX_THROTTLE_TIME_SECONDS:3600,THROTTLING_PREFIX:"throttling",X_MS_LIB_CAPABILITY_VALUE:"retry-after, h429"},CO={INVALID_GRANT_ERROR:"invalid_grant",CLIENT_MISMATCH_ERROR:"client_mismatch"},vu={FAILED_AUTO_DETECTION:"1",INTERNAL_CACHE:"2",ENVIRONMENT_VARIABLE:"3",IMDS:"4"},iS={CONFIGURED_NO_AUTO_DETECTION:"2",AUTO_DETECTION_REQUESTED_SUCCESSFUL:"4",AUTO_DETECTION_REQUESTED_FAILED:"5"},ic={NOT_APPLICABLE:"0",FORCE_REFRESH_OR_CLAIMS:"1",NO_CACHED_ACCESS_TOKEN:"2",CACHED_ACCESS_TOKEN_EXPIRED:"3",PROACTIVELY_REFRESHED:"4"},kZ={Jwt:"JWT",Jwk:"JWK",Pop:"pop"},F4=300;/*! @azure/msal-common v15.10.0 2025-08-05 */const by="unexpected_error",OZ="post_request_failed";/*! @azure/msal-common v15.10.0 2025-08-05 */const AO={[by]:"Unexpected error in authentication.",[OZ]:"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details."};class pn extends Error{constructor(e,n,r){const i=n?`${e}: ${n}`:e;super(i),Object.setPrototypeOf(this,pn.prototype),this.errorCode=e||ve.EMPTY_STRING,this.errorMessage=n||ve.EMPTY_STRING,this.subError=r||ve.EMPTY_STRING,this.name="AuthError"}setCorrelationId(e){this.correlationId=e}}function g1(t,e){return new pn(t,e?`${AO[t]} ${e}`:AO[t])}/*! @azure/msal-common v15.10.0 2025-08-05 */const rE="client_info_decoding_error",U4="client_info_empty_error",iE="token_parsing_error",B4="null_or_empty_token",Ws="endpoints_resolution_error",H4="network_error",z4="openid_config_error",V4="hash_not_deserialized",Pd="invalid_state",G4="state_mismatch",v1="state_not_found",K4="nonce_mismatch",oE="auth_time_not_found",W4="max_age_transpired",IZ="multiple_matching_tokens",RZ="multiple_matching_accounts",q4="multiple_matching_appMetadata",Y4="request_cannot_be_made",Q4="cannot_remove_empty_scope",X4="cannot_append_scopeset",y1="empty_input_scopeset",MZ="device_code_polling_cancelled",DZ="device_code_expired",$Z="device_code_unknown_error",sE="no_account_in_silent_request",J4="invalid_cache_record",aE="invalid_cache_environment",x1="no_account_found",b1="no_crypto_object",LZ="unexpected_credential_type",FZ="invalid_assertion",UZ="invalid_client_credential",gl="token_refresh_required",BZ="user_timeout_reached",Z4="token_claims_cnf_required_for_signedjwt",e3="authorization_code_missing_from_server_response",t3="binding_key_not_removed",n3="end_session_endpoint_not_supported",lE="key_id_missing",HZ="no_network_connectivity",zZ="user_canceled",VZ="missing_tenant_id_error",Ft="method_not_implemented",GZ="nested_app_auth_bridge_disabled";/*! @azure/msal-common v15.10.0 2025-08-05 */const _O={[rE]:"The client info could not be parsed/decoded correctly",[U4]:"The client info was empty",[iE]:"Token cannot be parsed",[B4]:"The token is null or empty",[Ws]:"Endpoints cannot be resolved",[H4]:"Network request failed",[z4]:"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints.",[V4]:"The hash parameters could not be deserialized",[Pd]:"State was not the expected format",[G4]:"State mismatch error",[v1]:"State not found",[K4]:"Nonce mismatch error",[oE]:"Max Age was requested and the ID token is missing the auth_time variable. auth_time is an optional claim and is not enabled by default - it must be enabled. See https://aka.ms/msaljs/optional-claims for more information.",[W4]:"Max Age is set to 0, or too much time has elapsed since the last end-user authentication.",[IZ]:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account.",[RZ]:"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account",[q4]:"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata",[Y4]:"Token request cannot be made without authorization code or refresh token.",[Q4]:"Cannot remove null or empty scope from ScopeSet",[X4]:"Cannot append ScopeSet",[y1]:"Empty input ScopeSet cannot be processed",[MZ]:"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true.",[DZ]:"Device code is expired.",[$Z]:"Device code stopped polling for unknown reasons.",[sE]:"Please pass an account object, silent flow is not supported without account information",[J4]:"Cache record object was null or undefined.",[aE]:"Invalid environment when attempting to create cache entry",[x1]:"No account found in cache for given key.",[b1]:"No crypto object detected.",[LZ]:"Unexpected credential type.",[FZ]:"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515",[UZ]:"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential",[gl]:"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired.",[BZ]:"User defined timeout for device code polling reached",[Z4]:"Cannot generate a POP jwt if the token_claims are not populated",[e3]:"Server response does not contain an authorization code to proceed",[t3]:"Could not remove the credential's binding key from storage.",[n3]:"The provided authority does not support logout",[lE]:"A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key.",[HZ]:"No network connectivity. Check your internet connection.",[zZ]:"User cancelled the flow.",[VZ]:"A tenant id - not common, organizations, or consumers - must be specified when using the client_credentials flow.",[Ft]:"This method has not been implemented",[GZ]:"The nested app auth bridge is disabled"};class cE extends pn{constructor(e,n){super(e,n?`${_O[e]}: ${n}`:_O[e]),this.name="ClientAuthError",Object.setPrototypeOf(this,cE.prototype)}}function Ae(t,e){return new cE(t,e)}/*! @azure/msal-common v15.10.0 2025-08-05 */const wy={createNewGuid:()=>{throw Ae(Ft)},base64Decode:()=>{throw Ae(Ft)},base64Encode:()=>{throw Ae(Ft)},base64UrlEncode:()=>{throw Ae(Ft)},encodeKid:()=>{throw Ae(Ft)},async getPublicKeyThumbprint(){throw Ae(Ft)},async removeTokenBindingKey(){throw Ae(Ft)},async clearKeystore(){throw Ae(Ft)},async signJwt(){throw Ae(Ft)},async hashString(){throw Ae(Ft)}};/*! @azure/msal-common v15.10.0 2025-08-05 */var jn;(function(t){t[t.Error=0]="Error",t[t.Warning=1]="Warning",t[t.Info=2]="Info",t[t.Verbose=3]="Verbose",t[t.Trace=4]="Trace"})(jn||(jn={}));class ya{constructor(e,n,r){this.level=jn.Info;const i=()=>{},o=e||ya.createDefaultLoggerOptions();this.localCallback=o.loggerCallback||i,this.piiLoggingEnabled=o.piiLoggingEnabled||!1,this.level=typeof o.logLevel=="number"?o.logLevel:jn.Info,this.correlationId=o.correlationId||ve.EMPTY_STRING,this.packageName=n||ve.EMPTY_STRING,this.packageVersion=r||ve.EMPTY_STRING}static createDefaultLoggerOptions(){return{loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:jn.Info}}clone(e,n,r){return new ya({loggerCallback:this.localCallback,piiLoggingEnabled:this.piiLoggingEnabled,logLevel:this.level,correlationId:r||this.correlationId},e,n)}logMessage(e,n){if(n.logLevel>this.level||!this.piiLoggingEnabled&&n.containsPii)return;const o=`${`[${new Date().toUTCString()}] : [${n.correlationId||this.correlationId||""}]`} : ${this.packageName}@${this.packageVersion} : ${jn[n.logLevel]} - ${e}`;this.executeCallback(n.logLevel,o,n.containsPii||!1)}executeCallback(e,n,r){this.localCallback&&this.localCallback(e,n,r)}error(e,n){this.logMessage(e,{logLevel:jn.Error,containsPii:!1,correlationId:n||ve.EMPTY_STRING})}errorPii(e,n){this.logMessage(e,{logLevel:jn.Error,containsPii:!0,correlationId:n||ve.EMPTY_STRING})}warning(e,n){this.logMessage(e,{logLevel:jn.Warning,containsPii:!1,correlationId:n||ve.EMPTY_STRING})}warningPii(e,n){this.logMessage(e,{logLevel:jn.Warning,containsPii:!0,correlationId:n||ve.EMPTY_STRING})}info(e,n){this.logMessage(e,{logLevel:jn.Info,containsPii:!1,correlationId:n||ve.EMPTY_STRING})}infoPii(e,n){this.logMessage(e,{logLevel:jn.Info,containsPii:!0,correlationId:n||ve.EMPTY_STRING})}verbose(e,n){this.logMessage(e,{logLevel:jn.Verbose,containsPii:!1,correlationId:n||ve.EMPTY_STRING})}verbosePii(e,n){this.logMessage(e,{logLevel:jn.Verbose,containsPii:!0,correlationId:n||ve.EMPTY_STRING})}trace(e,n){this.logMessage(e,{logLevel:jn.Trace,containsPii:!1,correlationId:n||ve.EMPTY_STRING})}tracePii(e,n){this.logMessage(e,{logLevel:jn.Trace,containsPii:!0,correlationId:n||ve.EMPTY_STRING})}isPiiLoggingEnabled(){return this.piiLoggingEnabled||!1}}/*! @azure/msal-common v15.10.0 2025-08-05 */const r3="@azure/msal-common",uE="15.10.0";/*! @azure/msal-common v15.10.0 2025-08-05 */const dE={None:"none",AzurePublic:"https://login.microsoftonline.com",AzurePpe:"https://login.windows-ppe.net",AzureChina:"https://login.chinacloudapi.cn",AzureGermany:"https://login.microsoftonline.de",AzureUsGovernment:"https://login.microsoftonline.us"};/*! @azure/msal-common v15.10.0 2025-08-05 */const i3="redirect_uri_empty",KZ="claims_request_parsing_error",o3="authority_uri_insecure",wh="url_parse_error",s3="empty_url_error",a3="empty_input_scopes_error",fE="invalid_claims",l3="token_request_empty",c3="logout_request_empty",WZ="invalid_code_challenge_method",hE="pkce_params_missing",pE="invalid_cloud_discovery_metadata",u3="invalid_authority_metadata",d3="untrusted_authority",qb="missing_ssh_jwk",f3="missing_ssh_kid",qZ="missing_nonce_authentication_header",YZ="invalid_authentication_header",h3="cannot_set_OIDCOptions",p3="cannot_allow_platform_broker",m3="authority_mismatch",g3="invalid_request_method_for_EAR",v3="invalid_authorize_post_body_parameters";/*! @azure/msal-common v15.10.0 2025-08-05 */const QZ={[i3]:"A redirect URI is required for all calls, and none has been set.",[KZ]:"Could not parse the given claims request object.",[o3]:"Authority URIs must use https. Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options",[wh]:"URL could not be parsed into appropriate segments.",[s3]:"URL was empty or null.",[a3]:"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token.",[fE]:"Given claims parameter must be a stringified JSON object.",[l3]:"Token request was empty and not found in cache.",[c3]:"The logout request was null or undefined.",[WZ]:'code_challenge_method passed is invalid. Valid values are "plain" and "S256".',[hE]:"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request",[pE]:"Invalid cloudDiscoveryMetadata provided. Must be a stringified JSON object containing tenant_discovery_endpoint and metadata fields",[u3]:"Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_endpoint, issuer fields.",[d3]:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.",[qb]:"Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme.",[f3]:"Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme.",[qZ]:"Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce.",[YZ]:"Invalid authentication header provided",[h3]:"Cannot set OIDCOptions parameter. Please change the protocol mode to OIDC or use a non-Microsoft authority.",[p3]:"Cannot set allowPlatformBroker parameter to true when not in AAD protocol mode.",[m3]:"Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority.",[v3]:"Invalid authorize post body parameters provided. If you are using authorizePostBodyParameters, the request method must be POST. Please check the request method and parameters.",[g3]:"Invalid request method for EAR protocol mode. The request method cannot be GET when using EAR protocol mode. Please change the request method to POST."};class mE extends pn{constructor(e){super(e,QZ[e]),this.name="ClientConfigurationError",Object.setPrototypeOf(this,mE.prototype)}}function gn(t){return new mE(t)}/*! @azure/msal-common v15.10.0 2025-08-05 */class Ss{static isEmptyObj(e){if(e)try{const n=JSON.parse(e);return Object.keys(n).length===0}catch{}return!0}static startsWith(e,n){return e.indexOf(n)===0}static endsWith(e,n){return e.length>=n.length&&e.lastIndexOf(n)===e.length-n.length}static queryStringToObject(e){const n={},r=e.split("&"),i=o=>decodeURIComponent(o.replace(/\+/g," "));return r.forEach(o=>{if(o.trim()){const[s,l]=o.split(/=(.+)/g,2);s&&l&&(n[i(s)]=i(l))}}),n}static trimArrayEntries(e){return e.map(n=>n.trim())}static removeEmptyStringsFromArray(e){return e.filter(n=>!!n)}static jsonParseHelper(e){try{return JSON.parse(e)}catch{return null}}static matchPattern(e,n){return new RegExp(e.replace(/\\/g,"\\\\").replace(/\*/g,"[^ ]*").replace(/\?/g,"\\?")).test(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class hr{constructor(e){const n=e?Ss.trimArrayEntries([...e]):[],r=n?Ss.removeEmptyStringsFromArray(n):[];if(!r||!r.length)throw gn(a3);this.scopes=new Set,r.forEach(i=>this.scopes.add(i))}static fromString(e){const r=(e||ve.EMPTY_STRING).split(" ");return new hr(r)}static createSearchScopes(e){const n=new hr(e);return n.containsOnlyOIDCScopes()?n.removeScope(ve.OFFLINE_ACCESS_SCOPE):n.removeOIDCScopes(),n}containsScope(e){const n=this.printScopesLowerCase().split(" "),r=new hr(n);return e?r.scopes.has(e.toLowerCase()):!1}containsScopeSet(e){return!e||e.scopes.size<=0?!1:this.scopes.size>=e.scopes.size&&e.asArray().every(n=>this.containsScope(n))}containsOnlyOIDCScopes(){let e=0;return wO.forEach(n=>{this.containsScope(n)&&(e+=1)}),this.scopes.size===e}appendScope(e){e&&this.scopes.add(e.trim())}appendScopes(e){try{e.forEach(n=>this.appendScope(n))}catch{throw Ae(X4)}}removeScope(e){if(!e)throw Ae(Q4);this.scopes.delete(e.trim())}removeOIDCScopes(){wO.forEach(e=>{this.scopes.delete(e)})}unionScopeSets(e){if(!e)throw Ae(y1);const n=new Set;return e.scopes.forEach(r=>n.add(r.toLowerCase())),this.scopes.forEach(r=>n.add(r.toLowerCase())),n}intersectingScopeSets(e){if(!e)throw Ae(y1);e.containsOnlyOIDCScopes()||e.removeOIDCScopes();const n=this.unionScopeSets(e),r=e.getScopeCount(),i=this.getScopeCount();return n.sizee.push(n)),e}printScopes(){return this.scopes?this.asArray().join(" "):ve.EMPTY_STRING}printScopesLowerCase(){return this.printScopes().toLowerCase()}}/*! @azure/msal-common v15.10.0 2025-08-05 */function jO(t,e){return!!t&&!!e&&t===e.split(".")[1]}function gE(t,e,n,r){if(r){const{oid:i,sub:o,tid:s,name:l,tfp:c,acr:u,preferred_username:d,upn:f,login_hint:h}=r,p=s||c||u||"";return{tenantId:p,localAccountId:i||o||"",name:l,username:d||f||"",loginHint:h,isHomeTenant:jO(p,t)}}else return{tenantId:n,localAccountId:e,username:"",isHomeTenant:jO(n,t)}}function vE(t,e,n,r){let i=t;if(e){const{isHomeTenant:o,...s}=e;i={...t,...s}}if(n){const{isHomeTenant:o,...s}=gE(t.homeAccountId,t.localAccountId,t.tenantId,n);return i={...i,...s,idTokenClaims:n,idToken:r},i}return i}/*! @azure/msal-common v15.10.0 2025-08-05 */function wf(t,e){const n=XZ(t);try{const r=e(n);return JSON.parse(r)}catch{throw Ae(iE)}}function XZ(t){if(!t)throw Ae(B4);const n=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(t);if(!n||n.length<4)throw Ae(iE);return n[2]}function y3(t,e){if(e===0||Date.now()-3e5>t+e)throw Ae(W4)}/*! @azure/msal-common v15.10.0 2025-08-05 */function x3(t){return t.startsWith("#/")?t.substring(2):t.startsWith("#")||t.startsWith("?")?t.substring(1):t}function Sy(t){if(!t||t.indexOf("=")<0)return null;try{const e=x3(t),n=Object.fromEntries(new URLSearchParams(e));if(n.code||n.ear_jwe||n.error||n.error_description||n.state)return n}catch{throw Ae(V4)}return null}function Ep(t,e=!0,n){const r=new Array;return t.forEach((i,o)=>{!e&&n&&o in n?r.push(`${o}=${i}`):r.push(`${o}=${encodeURIComponent(i)}`)}),r.join("&")}/*! @azure/msal-common v15.10.0 2025-08-05 */class Kt{get urlString(){return this._urlString}constructor(e){if(this._urlString=e,!this._urlString)throw gn(s3);e.includes("#")||(this._urlString=Kt.canonicalizeUri(e))}static canonicalizeUri(e){if(e){let n=e.toLowerCase();return Ss.endsWith(n,"?")?n=n.slice(0,-1):Ss.endsWith(n,"?/")&&(n=n.slice(0,-2)),Ss.endsWith(n,"/")||(n+="/"),n}return e}validateAsUri(){let e;try{e=this.getUrlComponents()}catch{throw gn(wh)}if(!e.HostNameAndPort||!e.PathSegments)throw gn(wh);if(!e.Protocol||e.Protocol.toLowerCase()!=="https:")throw gn(o3)}static appendQueryString(e,n){return n?e.indexOf("?")<0?`${e}?${n}`:`${e}&${n}`:e}static removeHashFromUrl(e){return Kt.canonicalizeUri(e.split("#")[0])}replaceTenantPath(e){const n=this.getUrlComponents(),r=n.PathSegments;return e&&r.length!==0&&(r[0]===ml.COMMON||r[0]===ml.ORGANIZATIONS)&&(r[0]=e),Kt.constructAuthorityUriFromObject(n)}getUrlComponents(){const e=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),n=this.urlString.match(e);if(!n)throw gn(wh);const r={Protocol:n[1],HostNameAndPort:n[4],AbsolutePath:n[5],QueryString:n[7]};let i=r.AbsolutePath.split("/");return i=i.filter(o=>o&&o.length>0),r.PathSegments=i,r.QueryString&&r.QueryString.endsWith("/")&&(r.QueryString=r.QueryString.substring(0,r.QueryString.length-1)),r}static getDomainFromUrl(e){const n=RegExp("^([^:/?#]+://)?([^/?#]*)"),r=e.match(n);if(!r)throw gn(wh);return r[2]}static getAbsoluteUrl(e,n){if(e[0]===ve.FORWARD_SLASH){const i=new Kt(n).getUrlComponents();return i.Protocol+"//"+i.HostNameAndPort+e}return e}static constructAuthorityUriFromObject(e){return new Kt(e.Protocol+"//"+e.HostNameAndPort+"/"+e.PathSegments.join("/"))}static hashContainsKnownProperties(e){return!!Sy(e)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const b3={endpointMetadata:{"login.microsoftonline.com":{token_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.com/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.com/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/logout"},"login.chinacloudapi.cn":{token_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.chinacloudapi.cn/{tenantid}/discovery/v2.0/keys",issuer:"https://login.partner.microsoftonline.cn/{tenantid}/v2.0",authorization_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/logout"},"login.microsoftonline.us":{token_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.us/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.us/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/logout"}},instanceDiscoveryMetadata:{metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]}},EO=b3.endpointMetadata,yE=b3.instanceDiscoveryMetadata,w3=new Set;yE.metadata.forEach(t=>{t.aliases.forEach(e=>{w3.add(e)})});function JZ(t,e){var i;let n;const r=t.canonicalAuthority;if(r){const o=new Kt(r).getUrlComponents().HostNameAndPort;n=NO(o,(i=t.cloudDiscoveryMetadata)==null?void 0:i.metadata,Ti.CONFIG,e)||NO(o,yE.metadata,Ti.HARDCODED_VALUES,e)||t.knownAuthorities}return n||[]}function NO(t,e,n,r){if(r==null||r.trace(`getAliasesFromMetadata called with source: ${n}`),t&&e){const i=Cy(e,t);if(i)return r==null||r.trace(`getAliasesFromMetadata: found cloud discovery metadata in ${n}, returning aliases`),i.aliases;r==null||r.trace(`getAliasesFromMetadata: did not find cloud discovery metadata in ${n}`)}return null}function ZZ(t){return Cy(yE.metadata,t)}function Cy(t,e){for(let n=0;n1?r.sort(o=>o.idTokenClaims?-1:1)[0]:r.length===1?r[0]:null}getBaseAccountInfo(e,n){const r=this.getAccountsFilteredBy(e,n);return r.length>0?r[0].getAccountInfo():null}buildTenantProfiles(e,n,r){return e.flatMap(i=>this.getTenantProfilesFromAccountEntity(i,n,r==null?void 0:r.tenantId,r))}getTenantedAccountInfoByFilter(e,n,r,i,o){let s=null,l;if(o&&!this.tenantProfileMatchesFilter(r,o))return null;const c=this.getIdToken(e,i,n,r.tenantId);return c&&(l=wf(c.secret,this.cryptoImpl.base64Decode),!this.idTokenClaimsMatchTenantProfileFilter(l,o))?null:(s=vE(e,r,l,c==null?void 0:c.secret),s)}getTenantProfilesFromAccountEntity(e,n,r,i){const o=e.getAccountInfo();let s=o.tenantProfiles||new Map;const l=this.getTokenKeys();if(r){const u=s.get(r);if(u)s=new Map([[r,u]]);else return[]}const c=[];return s.forEach(u=>{const d=this.getTenantedAccountInfoByFilter(o,l,u,n,i);d&&c.push(d)}),c}tenantProfileMatchesFilter(e,n){return!(n.localAccountId&&!this.matchLocalAccountIdFromTenantProfile(e,n.localAccountId)||n.name&&e.name!==n.name||n.isHomeTenant!==void 0&&e.isHomeTenant!==n.isHomeTenant)}idTokenClaimsMatchTenantProfileFilter(e,n){return!(n&&(n.localAccountId&&!this.matchLocalAccountIdFromTokenClaims(e,n.localAccountId)||n.loginHint&&!this.matchLoginHintFromTokenClaims(e,n.loginHint)||n.username&&!this.matchUsername(e.preferred_username,n.username)||n.name&&!this.matchName(e,n.name)||n.sid&&!this.matchSid(e,n.sid)))}async saveCacheRecord(e,n,r){var i;if(!e)throw Ae(J4);try{e.account&&await this.setAccount(e.account,n),e.idToken&&(r==null?void 0:r.idToken)!==!1&&await this.setIdTokenCredential(e.idToken,n),e.accessToken&&(r==null?void 0:r.accessToken)!==!1&&await this.saveAccessToken(e.accessToken,n),e.refreshToken&&(r==null?void 0:r.refreshToken)!==!1&&await this.setRefreshTokenCredential(e.refreshToken,n),e.appMetadata&&this.setAppMetadata(e.appMetadata,n)}catch(o){throw(i=this.commonLogger)==null||i.error("CacheManager.saveCacheRecord: failed"),o instanceof pn?o:w1(o)}}async saveAccessToken(e,n){const r={clientId:e.clientId,credentialType:e.credentialType,environment:e.environment,homeAccountId:e.homeAccountId,realm:e.realm,tokenType:e.tokenType,requestedClaimsHash:e.requestedClaimsHash},i=this.getTokenKeys(),o=hr.fromString(e.target);i.accessToken.forEach(s=>{if(!this.accessTokenKeyMatchesFilter(s,r,!1))return;const l=this.getAccessTokenCredential(s,n);l&&this.credentialMatchesFilter(l,r)&&hr.fromString(l.target).intersectingScopeSets(o)&&this.removeAccessToken(s,n)}),await this.setAccessTokenCredential(e,n)}getAccountsFilteredBy(e,n){const r=this.getAccountKeys(),i=[];return r.forEach(o=>{var u;const s=this.getAccount(o,n);if(!s||e.homeAccountId&&!this.matchHomeAccountId(s,e.homeAccountId)||e.username&&!this.matchUsername(s.username,e.username)||e.environment&&!this.matchEnvironment(s,e.environment)||e.realm&&!this.matchRealm(s,e.realm)||e.nativeAccountId&&!this.matchNativeAccountId(s,e.nativeAccountId)||e.authorityType&&!this.matchAuthorityType(s,e.authorityType))return;const l={localAccountId:e==null?void 0:e.localAccountId,name:e==null?void 0:e.name},c=(u=s.tenantProfiles)==null?void 0:u.filter(d=>this.tenantProfileMatchesFilter(d,l));c&&c.length===0||i.push(s)}),i}credentialMatchesFilter(e,n){return!(n.clientId&&!this.matchClientId(e,n.clientId)||n.userAssertionHash&&!this.matchUserAssertionHash(e,n.userAssertionHash)||typeof n.homeAccountId=="string"&&!this.matchHomeAccountId(e,n.homeAccountId)||n.environment&&!this.matchEnvironment(e,n.environment)||n.realm&&!this.matchRealm(e,n.realm)||n.credentialType&&!this.matchCredentialType(e,n.credentialType)||n.familyId&&!this.matchFamilyId(e,n.familyId)||n.target&&!this.matchTarget(e,n.target)||(n.requestedClaimsHash||e.requestedClaimsHash)&&e.requestedClaimsHash!==n.requestedClaimsHash||e.credentialType===Pr.ACCESS_TOKEN_WITH_AUTH_SCHEME&&(n.tokenType&&!this.matchTokenType(e,n.tokenType)||n.tokenType===an.SSH&&n.keyId&&!this.matchKeyId(e,n.keyId)))}getAppMetadataFilteredBy(e){const n=this.getKeys(),r={};return n.forEach(i=>{if(!this.isAppMetadata(i))return;const o=this.getAppMetadata(i);o&&(e.environment&&!this.matchEnvironment(o,e.environment)||e.clientId&&!this.matchClientId(o,e.clientId)||(r[i]=o))}),r}getAuthorityMetadataByAlias(e){const n=this.getAuthorityMetadataKeys();let r=null;return n.forEach(i=>{if(!this.isAuthorityMetadata(i)||i.indexOf(this.clientId)===-1)return;const o=this.getAuthorityMetadata(i);o&&o.aliases.indexOf(e)!==-1&&(r=o)}),r}removeAllAccounts(e){this.getAllAccounts({},e).forEach(r=>{this.removeAccount(r,e)})}removeAccount(e,n){this.removeAccountContext(e,n);const r=this.getAccountKeys(),i=o=>o.includes(e.homeAccountId)&&o.includes(e.environment);r.filter(i).forEach(o=>{this.removeItem(o,n),this.performanceClient.incrementFields({accountsRemoved:1},n)})}removeAccountContext(e,n){const r=this.getTokenKeys(),i=o=>o.includes(e.homeAccountId)&&o.includes(e.environment);r.idToken.filter(i).forEach(o=>{this.removeIdToken(o,n)}),r.accessToken.filter(i).forEach(o=>{this.removeAccessToken(o,n)}),r.refreshToken.filter(i).forEach(o=>{this.removeRefreshToken(o,n)})}removeAccessToken(e,n){const r=this.getAccessTokenCredential(e,n);if(this.removeItem(e,n),this.performanceClient.incrementFields({accessTokensRemoved:1},n),!r||r.credentialType.toLowerCase()!==Pr.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()||r.tokenType!==an.POP)return;const i=r.keyId;i&&this.cryptoImpl.removeTokenBindingKey(i).catch(()=>{var o;this.commonLogger.error(`Failed to remove token binding key ${i}`,n),(o=this.performanceClient)==null||o.incrementFields({removeTokenBindingKeyFailure:1},n)})}removeAppMetadata(e){return this.getKeys().forEach(r=>{this.isAppMetadata(r)&&this.removeItem(r,e)}),!0}getIdToken(e,n,r,i,o){this.commonLogger.trace("CacheManager - getIdToken called");const s={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:Pr.ID_TOKEN,clientId:this.clientId,realm:i},l=this.getIdTokensByFilter(s,n,r),c=l.size;if(c<1)return this.commonLogger.info("CacheManager:getIdToken - No token found"),null;if(c>1){let u=l;if(!i){const d=new Map;l.forEach((h,p)=>{h.realm===e.tenantId&&d.set(p,h)});const f=d.size;if(f<1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account but none match account entity tenant id, returning first result"),l.values().next().value;if(f===1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account, defaulting to home tenant profile"),d.values().next().value;u=d}return this.commonLogger.info("CacheManager:getIdToken - Multiple matching ID tokens found, clearing them"),u.forEach((d,f)=>{this.removeIdToken(f,n)}),o&&n&&o.addFields({multiMatchedID:l.size},n),null}return this.commonLogger.info("CacheManager:getIdToken - Returning ID token"),l.values().next().value}getIdTokensByFilter(e,n,r){const i=r&&r.idToken||this.getTokenKeys().idToken,o=new Map;return i.forEach(s=>{if(!this.idTokenKeyMatchesFilter(s,{clientId:this.clientId,...e}))return;const l=this.getIdTokenCredential(s,n);l&&this.credentialMatchesFilter(l,e)&&o.set(s,l)}),o}idTokenKeyMatchesFilter(e,n){const r=e.toLowerCase();return!(n.clientId&&r.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&r.indexOf(n.homeAccountId.toLowerCase())===-1)}removeIdToken(e,n){this.removeItem(e,n)}removeRefreshToken(e,n){this.removeItem(e,n)}getAccessToken(e,n,r,i){const o=n.correlationId;this.commonLogger.trace("CacheManager - getAccessToken called",o);const s=hr.createSearchScopes(n.scopes),l=n.authenticationScheme||an.BEARER,c=l&&l.toLowerCase()!==an.BEARER.toLowerCase()?Pr.ACCESS_TOKEN_WITH_AUTH_SCHEME:Pr.ACCESS_TOKEN,u={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:c,clientId:this.clientId,realm:i||e.tenantId,target:s,tokenType:l,keyId:n.sshKid,requestedClaimsHash:n.requestedClaimsHash},d=r&&r.accessToken||this.getTokenKeys().accessToken,f=[];d.forEach(p=>{if(this.accessTokenKeyMatchesFilter(p,u,!0)){const g=this.getAccessTokenCredential(p,o);g&&this.credentialMatchesFilter(g,u)&&f.push(g)}});const h=f.length;return h<1?(this.commonLogger.info("CacheManager:getAccessToken - No token found",o),null):h>1?(this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them",o),f.forEach(p=>{this.removeAccessToken(this.generateCredentialKey(p),o)}),this.performanceClient.addFields({multiMatchedAT:f.length},o),null):(this.commonLogger.info("CacheManager:getAccessToken - Returning access token",o),f[0])}accessTokenKeyMatchesFilter(e,n,r){const i=e.toLowerCase();if(n.clientId&&i.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&i.indexOf(n.homeAccountId.toLowerCase())===-1||n.realm&&i.indexOf(n.realm.toLowerCase())===-1||n.requestedClaimsHash&&i.indexOf(n.requestedClaimsHash.toLowerCase())===-1)return!1;if(n.target){const o=n.target.asArray();for(let s=0;s{if(!this.accessTokenKeyMatchesFilter(o,e,!0))return;const s=this.getAccessTokenCredential(o,n);s&&this.credentialMatchesFilter(s,e)&&i.push(s)}),i}getRefreshToken(e,n,r,i,o){this.commonLogger.trace("CacheManager - getRefreshToken called");const s=n?yy:void 0,l={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:Pr.REFRESH_TOKEN,clientId:this.clientId,familyId:s},c=i&&i.refreshToken||this.getTokenKeys().refreshToken,u=[];c.forEach(f=>{if(this.refreshTokenKeyMatchesFilter(f,l)){const h=this.getRefreshTokenCredential(f,r);h&&this.credentialMatchesFilter(h,l)&&u.push(h)}});const d=u.length;return d<1?(this.commonLogger.info("CacheManager:getRefreshToken - No refresh token found."),null):(d>1&&o&&r&&o.addFields({multiMatchedRT:d},r),this.commonLogger.info("CacheManager:getRefreshToken - returning refresh token"),u[0])}refreshTokenKeyMatchesFilter(e,n){const r=e.toLowerCase();return!(n.familyId&&r.indexOf(n.familyId.toLowerCase())===-1||!n.familyId&&n.clientId&&r.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&r.indexOf(n.homeAccountId.toLowerCase())===-1)}readAppMetadataFromCache(e){const n={environment:e,clientId:this.clientId},r=this.getAppMetadataFilteredBy(n),i=Object.keys(r).map(s=>r[s]),o=i.length;if(o<1)return null;if(o>1)throw Ae(q4);return i[0]}isAppMetadataFOCI(e){const n=this.readAppMetadataFromCache(e);return!!(n&&n.familyId===yy)}matchHomeAccountId(e,n){return typeof e.homeAccountId=="string"&&n===e.homeAccountId}matchLocalAccountIdFromTokenClaims(e,n){const r=e.oid||e.sub;return n===r}matchLocalAccountIdFromTenantProfile(e,n){return e.localAccountId===n}matchName(e,n){var r;return n.toLowerCase()===((r=e.name)==null?void 0:r.toLowerCase())}matchUsername(e,n){return!!(e&&typeof e=="string"&&(n==null?void 0:n.toLowerCase())===e.toLowerCase())}matchUserAssertionHash(e,n){return!!(e.userAssertionHash&&n===e.userAssertionHash)}matchEnvironment(e,n){if(this.staticAuthorityOptions){const i=JZ(this.staticAuthorityOptions,this.commonLogger);if(i.includes(n)&&i.includes(e.environment))return!0}const r=this.getAuthorityMetadataByAlias(n);return!!(r&&r.aliases.indexOf(e.environment)>-1)}matchCredentialType(e,n){return e.credentialType&&n.toLowerCase()===e.credentialType.toLowerCase()}matchClientId(e,n){return!!(e.clientId&&n===e.clientId)}matchFamilyId(e,n){return!!(e.familyId&&n===e.familyId)}matchRealm(e,n){var r;return((r=e.realm)==null?void 0:r.toLowerCase())===n.toLowerCase()}matchNativeAccountId(e,n){return!!(e.nativeAccountId&&n===e.nativeAccountId)}matchLoginHintFromTokenClaims(e,n){return e.login_hint===n||e.preferred_username===n||e.upn===n}matchSid(e,n){return e.sid===n}matchAuthorityType(e,n){return!!(e.authorityType&&n.toLowerCase()===e.authorityType.toLowerCase())}matchTarget(e,n){return e.credentialType!==Pr.ACCESS_TOKEN&&e.credentialType!==Pr.ACCESS_TOKEN_WITH_AUTH_SCHEME||!e.target?!1:hr.fromString(e.target).containsScopeSet(n)}matchTokenType(e,n){return!!(e.tokenType&&e.tokenType===n)}matchKeyId(e,n){return!!(e.keyId&&e.keyId===n)}isAppMetadata(e){return e.indexOf(nE)!==-1}isAuthorityMetadata(e){return e.indexOf(xy.CACHE_KEY)!==-1}generateAuthorityMetadataCacheKey(e){return`${xy.CACHE_KEY}-${this.clientId}-${e}`}static toObject(e,n){for(const r in n)e[r]=n[r];return e}}class eee extends S1{async setAccount(){throw Ae(Ft)}getAccount(){throw Ae(Ft)}async setIdTokenCredential(){throw Ae(Ft)}getIdTokenCredential(){throw Ae(Ft)}async setAccessTokenCredential(){throw Ae(Ft)}getAccessTokenCredential(){throw Ae(Ft)}async setRefreshTokenCredential(){throw Ae(Ft)}getRefreshTokenCredential(){throw Ae(Ft)}setAppMetadata(){throw Ae(Ft)}getAppMetadata(){throw Ae(Ft)}setServerTelemetry(){throw Ae(Ft)}getServerTelemetry(){throw Ae(Ft)}setAuthorityMetadata(){throw Ae(Ft)}getAuthorityMetadata(){throw Ae(Ft)}getAuthorityMetadataKeys(){throw Ae(Ft)}setThrottlingCache(){throw Ae(Ft)}getThrottlingCache(){throw Ae(Ft)}removeItem(){throw Ae(Ft)}getKeys(){throw Ae(Ft)}getAccountKeys(){throw Ae(Ft)}getTokenKeys(){throw Ae(Ft)}generateCredentialKey(){throw Ae(Ft)}generateAccountKey(){throw Ae(Ft)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Ai={AAD:"AAD",OIDC:"OIDC",EAR:"EAR"};/*! @azure/msal-common v15.10.0 2025-08-05 */const G={AcquireTokenByCode:"acquireTokenByCode",AcquireTokenByRefreshToken:"acquireTokenByRefreshToken",AcquireTokenSilent:"acquireTokenSilent",AcquireTokenSilentAsync:"acquireTokenSilentAsync",AcquireTokenPopup:"acquireTokenPopup",AcquireTokenPreRedirect:"acquireTokenPreRedirect",AcquireTokenRedirect:"acquireTokenRedirect",CryptoOptsGetPublicKeyThumbprint:"cryptoOptsGetPublicKeyThumbprint",CryptoOptsSignJwt:"cryptoOptsSignJwt",SilentCacheClientAcquireToken:"silentCacheClientAcquireToken",SilentIframeClientAcquireToken:"silentIframeClientAcquireToken",AwaitConcurrentIframe:"awaitConcurrentIframe",SilentRefreshClientAcquireToken:"silentRefreshClientAcquireToken",SsoSilent:"ssoSilent",StandardInteractionClientGetDiscoveredAuthority:"standardInteractionClientGetDiscoveredAuthority",FetchAccountIdWithNativeBroker:"fetchAccountIdWithNativeBroker",NativeInteractionClientAcquireToken:"nativeInteractionClientAcquireToken",BaseClientCreateTokenRequestHeaders:"baseClientCreateTokenRequestHeaders",NetworkClientSendPostRequestAsync:"networkClientSendPostRequestAsync",RefreshTokenClientExecutePostToTokenEndpoint:"refreshTokenClientExecutePostToTokenEndpoint",AuthorizationCodeClientExecutePostToTokenEndpoint:"authorizationCodeClientExecutePostToTokenEndpoint",BrokerHandhshake:"brokerHandshake",AcquireTokenByRefreshTokenInBroker:"acquireTokenByRefreshTokenInBroker",AcquireTokenByBroker:"acquireTokenByBroker",RefreshTokenClientExecuteTokenRequest:"refreshTokenClientExecuteTokenRequest",RefreshTokenClientAcquireToken:"refreshTokenClientAcquireToken",RefreshTokenClientAcquireTokenWithCachedRefreshToken:"refreshTokenClientAcquireTokenWithCachedRefreshToken",RefreshTokenClientAcquireTokenByRefreshToken:"refreshTokenClientAcquireTokenByRefreshToken",RefreshTokenClientCreateTokenRequestBody:"refreshTokenClientCreateTokenRequestBody",AcquireTokenFromCache:"acquireTokenFromCache",SilentFlowClientAcquireCachedToken:"silentFlowClientAcquireCachedToken",SilentFlowClientGenerateResultFromCacheRecord:"silentFlowClientGenerateResultFromCacheRecord",AcquireTokenBySilentIframe:"acquireTokenBySilentIframe",InitializeBaseRequest:"initializeBaseRequest",InitializeSilentRequest:"initializeSilentRequest",InitializeClientApplication:"initializeClientApplication",InitializeCache:"initializeCache",SilentIframeClientTokenHelper:"silentIframeClientTokenHelper",SilentHandlerInitiateAuthRequest:"silentHandlerInitiateAuthRequest",SilentHandlerMonitorIframeForHash:"silentHandlerMonitorIframeForHash",SilentHandlerLoadFrame:"silentHandlerLoadFrame",SilentHandlerLoadFrameSync:"silentHandlerLoadFrameSync",StandardInteractionClientCreateAuthCodeClient:"standardInteractionClientCreateAuthCodeClient",StandardInteractionClientGetClientConfiguration:"standardInteractionClientGetClientConfiguration",StandardInteractionClientInitializeAuthorizationRequest:"standardInteractionClientInitializeAuthorizationRequest",GetAuthCodeUrl:"getAuthCodeUrl",GetStandardParams:"getStandardParams",HandleCodeResponseFromServer:"handleCodeResponseFromServer",HandleCodeResponse:"handleCodeResponse",HandleResponseEar:"handleResponseEar",HandleResponsePlatformBroker:"handleResponsePlatformBroker",HandleResponseCode:"handleResponseCode",UpdateTokenEndpointAuthority:"updateTokenEndpointAuthority",AuthClientAcquireToken:"authClientAcquireToken",AuthClientExecuteTokenRequest:"authClientExecuteTokenRequest",AuthClientCreateTokenRequestBody:"authClientCreateTokenRequestBody",PopTokenGenerateCnf:"popTokenGenerateCnf",PopTokenGenerateKid:"popTokenGenerateKid",HandleServerTokenResponse:"handleServerTokenResponse",DeserializeResponse:"deserializeResponse",AuthorityFactoryCreateDiscoveredInstance:"authorityFactoryCreateDiscoveredInstance",AuthorityResolveEndpointsAsync:"authorityResolveEndpointsAsync",AuthorityResolveEndpointsFromLocalSources:"authorityResolveEndpointsFromLocalSources",AuthorityGetCloudDiscoveryMetadataFromNetwork:"authorityGetCloudDiscoveryMetadataFromNetwork",AuthorityUpdateCloudDiscoveryMetadata:"authorityUpdateCloudDiscoveryMetadata",AuthorityGetEndpointMetadataFromNetwork:"authorityGetEndpointMetadataFromNetwork",AuthorityUpdateEndpointMetadata:"authorityUpdateEndpointMetadata",AuthorityUpdateMetadataWithRegionalInformation:"authorityUpdateMetadataWithRegionalInformation",RegionDiscoveryDetectRegion:"regionDiscoveryDetectRegion",RegionDiscoveryGetRegionFromIMDS:"regionDiscoveryGetRegionFromIMDS",RegionDiscoveryGetCurrentVersion:"regionDiscoveryGetCurrentVersion",AcquireTokenByCodeAsync:"acquireTokenByCodeAsync",GetEndpointMetadataFromNetwork:"getEndpointMetadataFromNetwork",GetCloudDiscoveryMetadataFromNetworkMeasurement:"getCloudDiscoveryMetadataFromNetworkMeasurement",HandleRedirectPromiseMeasurement:"handleRedirectPromise",HandleNativeRedirectPromiseMeasurement:"handleNativeRedirectPromise",UpdateCloudDiscoveryMetadataMeasurement:"updateCloudDiscoveryMetadataMeasurement",UsernamePasswordClientAcquireToken:"usernamePasswordClientAcquireToken",NativeMessageHandlerHandshake:"nativeMessageHandlerHandshake",NativeGenerateAuthResult:"nativeGenerateAuthResult",RemoveHiddenIframe:"removeHiddenIframe",ClearTokensAndKeysWithClaims:"clearTokensAndKeysWithClaims",CacheManagerGetRefreshToken:"cacheManagerGetRefreshToken",ImportExistingCache:"importExistingCache",SetUserData:"setUserData",LocalStorageUpdated:"localStorageUpdated",GeneratePkceCodes:"generatePkceCodes",GenerateCodeVerifier:"generateCodeVerifier",GenerateCodeChallengeFromVerifier:"generateCodeChallengeFromVerifier",Sha256Digest:"sha256Digest",GetRandomValues:"getRandomValues",GenerateHKDF:"generateHKDF",GenerateBaseKey:"generateBaseKey",Base64Decode:"base64Decode",UrlEncodeArr:"urlEncodeArr",Encrypt:"encrypt",Decrypt:"decrypt",GenerateEarKey:"generateEarKey",DecryptEarResponse:"decryptEarResponse"},tee={NotStarted:0,InProgress:1,Completed:2};/*! @azure/msal-common v15.10.0 2025-08-05 */class TO{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class S3{generateId(){return"callback-id"}startMeasurement(e,n){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:tee.InProgress,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:n||""},measurement:new TO}}startPerformanceMeasurement(){return new TO}calculateQueuedTime(){return 0}addQueueMeasurement(){}setPreQueueTime(){}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return""}emitEvents(){}addFields(){}incrementFields(){}cacheEventByCorrelationId(){}}/*! @azure/msal-common v15.10.0 2025-08-05 */const C3={tokenRenewalOffsetSeconds:F4,preventCorsPreflight:!1},nee={loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:jn.Info,correlationId:ve.EMPTY_STRING},ree={claimsBasedCachingEnabled:!1},iee={async sendGetRequestAsync(){throw Ae(Ft)},async sendPostRequestAsync(){throw Ae(Ft)}},oee={sku:ve.SKU,version:uE,cpu:ve.EMPTY_STRING,os:ve.EMPTY_STRING},see={clientSecret:ve.EMPTY_STRING,clientAssertion:void 0},aee={azureCloudInstance:dE.None,tenant:`${ve.DEFAULT_COMMON_TENANT}`},lee={application:{appName:"",appVersion:""}};function cee({authOptions:t,systemOptions:e,loggerOptions:n,cacheOptions:r,storageInterface:i,networkInterface:o,cryptoInterface:s,clientCredentials:l,libraryInfo:c,telemetry:u,serverTelemetryManager:d,persistencePlugin:f,serializableCache:h}){const p={...nee,...n};return{authOptions:uee(t),systemOptions:{...C3,...e},loggerOptions:p,cacheOptions:{...ree,...r},storageInterface:i||new eee(t.clientId,wy,new ya(p),new S3),networkInterface:o||iee,cryptoInterface:s||wy,clientCredentials:l||see,libraryInfo:{...oee,...c},telemetry:{...lee,...u},serverTelemetryManager:d||null,persistencePlugin:f||null,serializableCache:h||null}}function uee(t){return{clientCapabilities:[],azureCloudOptions:aee,skipAuthorityMetadataCache:!1,instanceAware:!1,encodeExtraQueryParams:!1,...t}}function A3(t){return t.authOptions.authority.options.protocolMode===Ai.OIDC}/*! @azure/msal-common v15.10.0 2025-08-05 */const Oo={HOME_ACCOUNT_ID:"home_account_id",UPN:"UPN"};/*! @azure/msal-common v15.10.0 2025-08-05 */function _y(t,e){if(!t)throw Ae(U4);try{const n=e(t);return JSON.parse(n)}catch{throw Ae(rE)}}function rd(t){if(!t)throw Ae(rE);const e=t.split(jp.CLIENT_INFO_SEPARATOR,2);return{uid:e[0],utid:e.length<2?ve.EMPTY_STRING:e[1]}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Kc="client_id",_3="redirect_uri",dee="response_type",fee="response_mode",hee="grant_type",pee="claims",mee="scope",gee="refresh_token",vee="state",yee="nonce",xee="prompt",bee="code",wee="code_challenge",See="code_challenge_method",Cee="code_verifier",Aee="client-request-id",_ee="x-client-SKU",jee="x-client-VER",Eee="x-client-OS",Nee="x-client-CPU",Tee="x-client-current-telemetry",Pee="x-client-last-telemetry",kee="x-ms-lib-capability",Oee="x-app-name",Iee="x-app-ver",Ree="post_logout_redirect_uri",Mee="id_token_hint",Dee="client_secret",$ee="client_assertion",Lee="client_assertion_type",j3="token_type",E3="req_cnf",PO="return_spa_code",Fee="nativebroker",Uee="logout_hint",Bee="sid",Hee="login_hint",zee="domain_hint",Vee="x-client-xtra-sku",jy="brk_client_id",Ey="brk_redirect_uri",C1="instance_aware",Gee="ear_jwk",Kee="ear_jwe_crypto";/*! @azure/msal-common v15.10.0 2025-08-05 */function Yb(t,e,n){if(!e)return;const r=t.get(Kc);r&&t.has(jy)&&(n==null||n.addFields({embeddedClientId:r,embeddedRedirectUri:t.get(_3)},e))}function bE(t,e){t.set(dee,e)}function Wee(t,e){t.set(fee,e||TZ.QUERY)}function qee(t){t.set(Fee,"1")}function wE(t,e,n=!0,r=Wm){n&&!r.includes("openid")&&!e.includes("openid")&&r.push("openid");const i=n?[...e||[],...r]:e||[],o=new hr(i);t.set(mee,o.printScopes())}function SE(t,e){t.set(Kc,e)}function CE(t,e){t.set(_3,e)}function Yee(t,e){t.set(Ree,e)}function Qee(t,e){t.set(Mee,e)}function Xee(t,e){t.set(zee,e)}function Bg(t,e){t.set(Hee,e)}function Ny(t,e){t.set(ei.CCS_HEADER,`UPN:${e}`)}function Fh(t,e){t.set(ei.CCS_HEADER,`Oid:${e.uid}@${e.utid}`)}function kO(t,e){t.set(Bee,e)}function AE(t,e,n){const r=rte(e,n);try{JSON.parse(r)}catch{throw gn(fE)}t.set(pee,r)}function _E(t,e){t.set(Aee,e)}function jE(t,e){t.set(_ee,e.sku),t.set(jee,e.version),e.os&&t.set(Eee,e.os),e.cpu&&t.set(Nee,e.cpu)}function EE(t,e){e!=null&&e.appName&&t.set(Oee,e.appName),e!=null&&e.appVersion&&t.set(Iee,e.appVersion)}function Jee(t,e){t.set(xee,e)}function N3(t,e){e&&t.set(vee,e)}function Zee(t,e){t.set(yee,e)}function T3(t,e,n){if(e&&n)t.set(wee,e),t.set(See,n);else throw gn(hE)}function ete(t,e){t.set(bee,e)}function tte(t,e){t.set(gee,e)}function nte(t,e){t.set(Cee,e)}function P3(t,e){t.set(Dee,e)}function k3(t,e){e&&t.set($ee,e)}function O3(t,e){e&&t.set(Lee,e)}function I3(t,e){t.set(hee,e)}function NE(t){t.set(PZ,"1")}function R3(t){t.has(C1)||t.set(C1,"true")}function vl(t,e){Object.entries(e).forEach(([n,r])=>{!t.has(n)&&r&&t.set(n,r)})}function rte(t,e){let n;if(!t)n={};else try{n=JSON.parse(t)}catch{throw gn(fE)}return e&&e.length>0&&(n.hasOwnProperty(Fg.ACCESS_TOKEN)||(n[Fg.ACCESS_TOKEN]={}),n[Fg.ACCESS_TOKEN][Fg.XMS_CC]={values:e}),JSON.stringify(n)}function TE(t,e){e&&(t.set(j3,an.POP),t.set(E3,e))}function M3(t,e){e&&(t.set(j3,an.SSH),t.set(E3,e))}function D3(t,e){t.set(Tee,e.generateCurrentRequestHeaderValue()),t.set(Pee,e.generateLastRequestHeaderValue())}function $3(t){t.set(kee,Lh.X_MS_LIB_CAPABILITY_VALUE)}function ite(t,e){t.set(Uee,e)}function Qb(t,e,n){t.has(jy)||t.set(jy,e),t.has(Ey)||t.set(Ey,n)}function ote(t,e){t.set(Gee,encodeURIComponent(e)),t.set(Kee,"eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0")}function ste(t,e){Object.entries(e).forEach(([n,r])=>{r&&t.set(n,r)})}/*! @azure/msal-common v15.10.0 2025-08-05 */const Eo={Default:0,Adfs:1,Dsts:2,Ciam:3};/*! @azure/msal-common v15.10.0 2025-08-05 */function ate(t){return t.hasOwnProperty("authorization_endpoint")&&t.hasOwnProperty("token_endpoint")&&t.hasOwnProperty("issuer")&&t.hasOwnProperty("jwks_uri")}/*! @azure/msal-common v15.10.0 2025-08-05 */function lte(t){return t.hasOwnProperty("tenant_discovery_endpoint")&&t.hasOwnProperty("metadata")}/*! @azure/msal-common v15.10.0 2025-08-05 */function cte(t){return t.hasOwnProperty("error")&&t.hasOwnProperty("error_description")}/*! @azure/msal-common v15.10.0 2025-08-05 */const Bi=(t,e,n,r,i)=>(...o)=>{n.trace(`Executing function ${e}`);const s=r==null?void 0:r.startMeasurement(e,i);if(i){const l=e+"CallCount";r==null||r.incrementFields({[l]:1},i)}try{const l=t(...o);return s==null||s.end({success:!0}),n.trace(`Returning result from ${e}`),l}catch(l){n.trace(`Error occurred in ${e}`);try{n.trace(JSON.stringify(l))}catch{n.trace("Unable to print error message.")}throw s==null||s.end({success:!1},l),l}},ge=(t,e,n,r,i)=>(...o)=>{n.trace(`Executing function ${e}`);const s=r==null?void 0:r.startMeasurement(e,i);if(i){const l=e+"CallCount";r==null||r.incrementFields({[l]:1},i)}return r==null||r.setPreQueueTime(e,i),t(...o).then(l=>(n.trace(`Returning result from ${e}`),s==null||s.end({success:!0}),l)).catch(l=>{n.trace(`Error occurred in ${e}`);try{n.trace(JSON.stringify(l))}catch{n.trace("Unable to print error message.")}throw s==null||s.end({success:!1},l),l})};/*! @azure/msal-common v15.10.0 2025-08-05 */class Xb{constructor(e,n,r,i){this.networkInterface=e,this.logger=n,this.performanceClient=r,this.correlationId=i}async detectRegion(e,n){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(G.RegionDiscoveryDetectRegion,this.correlationId);let r=e;if(r)n.region_source=vu.ENVIRONMENT_VARIABLE;else{const o=Xb.IMDS_OPTIONS;try{const s=await ge(this.getRegionFromIMDS.bind(this),G.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(ve.IMDS_VERSION,o);if(s.status===rl.SUCCESS&&(r=s.body,n.region_source=vu.IMDS),s.status===rl.BAD_REQUEST){const l=await ge(this.getCurrentVersion.bind(this),G.RegionDiscoveryGetCurrentVersion,this.logger,this.performanceClient,this.correlationId)(o);if(!l)return n.region_source=vu.FAILED_AUTO_DETECTION,null;const c=await ge(this.getRegionFromIMDS.bind(this),G.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(l,o);c.status===rl.SUCCESS&&(r=c.body,n.region_source=vu.IMDS)}}catch{return n.region_source=vu.FAILED_AUTO_DETECTION,null}}return r||(n.region_source=vu.FAILED_AUTO_DETECTION),r||null}async getRegionFromIMDS(e,n){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(G.RegionDiscoveryGetRegionFromIMDS,this.correlationId),this.networkInterface.sendGetRequestAsync(`${ve.IMDS_ENDPOINT}?api-version=${e}&format=text`,n,ve.IMDS_TIMEOUT)}async getCurrentVersion(e){var n;(n=this.performanceClient)==null||n.addQueueMeasurement(G.RegionDiscoveryGetCurrentVersion,this.correlationId);try{const r=await this.networkInterface.sendGetRequestAsync(`${ve.IMDS_ENDPOINT}?format=json`,e);return r.status===rl.BAD_REQUEST&&r.body&&r.body["newest-versions"]&&r.body["newest-versions"].length>0?r.body["newest-versions"][0]:null}catch{return null}}}Xb.IMDS_OPTIONS={headers:{Metadata:"true"}};/*! @azure/msal-common v15.10.0 2025-08-05 */function _i(){return Math.round(new Date().getTime()/1e3)}function OO(t){return t.getTime()/1e3}function id(t){return t?new Date(Number(t)*1e3):new Date}function Ty(t,e){const n=Number(t)||0;return _i()+e>n}function ute(t,e){const n=Number(t)+e*24*60*60*1e3;return Date.now()>n}function dte(t){return Number(t)>_i()}/*! @azure/msal-common v15.10.0 2025-08-05 */function Jb(t,e,n,r,i){return{credentialType:Pr.ID_TOKEN,homeAccountId:t,environment:e,clientId:r,secret:n,realm:i,lastUpdatedAt:Date.now().toString()}}function Zb(t,e,n,r,i,o,s,l,c,u,d,f,h,p,g){var v,b;const m={homeAccountId:t,credentialType:Pr.ACCESS_TOKEN,secret:n,cachedAt:_i().toString(),expiresOn:s.toString(),extendedExpiresOn:l.toString(),environment:e,clientId:r,realm:i,target:o,tokenType:d||an.BEARER,lastUpdatedAt:Date.now().toString()};if(f&&(m.userAssertionHash=f),u&&(m.refreshOn=u.toString()),p&&(m.requestedClaims=p,m.requestedClaimsHash=g),((v=m.tokenType)==null?void 0:v.toLowerCase())!==an.BEARER.toLowerCase())switch(m.credentialType=Pr.ACCESS_TOKEN_WITH_AUTH_SCHEME,m.tokenType){case an.POP:const x=wf(n,c);if(!((b=x==null?void 0:x.cnf)!=null&&b.kid))throw Ae(Z4);m.keyId=x.cnf.kid;break;case an.SSH:m.keyId=h}return m}function L3(t,e,n,r,i,o,s){const l={credentialType:Pr.REFRESH_TOKEN,homeAccountId:t,environment:e,clientId:r,secret:n,lastUpdatedAt:Date.now().toString()};return o&&(l.userAssertionHash=o),i&&(l.familyId=i),s&&(l.expiresOn=s.toString()),l}function PE(t){return t.hasOwnProperty("homeAccountId")&&t.hasOwnProperty("environment")&&t.hasOwnProperty("credentialType")&&t.hasOwnProperty("clientId")&&t.hasOwnProperty("secret")}function IO(t){return t?PE(t)&&t.hasOwnProperty("realm")&&t.hasOwnProperty("target")&&(t.credentialType===Pr.ACCESS_TOKEN||t.credentialType===Pr.ACCESS_TOKEN_WITH_AUTH_SCHEME):!1}function fte(t){return t?PE(t)&&t.hasOwnProperty("realm")&&t.credentialType===Pr.ID_TOKEN:!1}function RO(t){return t?PE(t)&&t.credentialType===Pr.REFRESH_TOKEN:!1}function hte(t,e){const n=t.indexOf(jr.CACHE_KEY)===0;let r=!0;return e&&(r=e.hasOwnProperty("failedRequests")&&e.hasOwnProperty("errors")&&e.hasOwnProperty("cacheHits")),n&&r}function pte(t,e){let n=!1;t&&(n=t.indexOf(Lh.THROTTLING_PREFIX)===0);let r=!0;return e&&(r=e.hasOwnProperty("throttleTime")),n&&r}function mte({environment:t,clientId:e}){return[nE,t,e].join(jp.CACHE_KEY_SEPARATOR).toLowerCase()}function gte(t,e){return e?t.indexOf(nE)===0&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("environment"):!1}function vte(t,e){return e?t.indexOf(xy.CACHE_KEY)===0&&e.hasOwnProperty("aliases")&&e.hasOwnProperty("preferred_cache")&&e.hasOwnProperty("preferred_network")&&e.hasOwnProperty("canonical_authority")&&e.hasOwnProperty("authorization_endpoint")&&e.hasOwnProperty("token_endpoint")&&e.hasOwnProperty("issuer")&&e.hasOwnProperty("aliasesFromNetwork")&&e.hasOwnProperty("endpointsFromNetwork")&&e.hasOwnProperty("expiresAt")&&e.hasOwnProperty("jwks_uri"):!1}function MO(){return _i()+xy.REFRESH_TIME_SECONDS}function Hg(t,e,n){t.authorization_endpoint=e.authorization_endpoint,t.token_endpoint=e.token_endpoint,t.end_session_endpoint=e.end_session_endpoint,t.issuer=e.issuer,t.endpointsFromNetwork=n,t.jwks_uri=e.jwks_uri}function sS(t,e,n){t.aliases=e.aliases,t.preferred_cache=e.preferred_cache,t.preferred_network=e.preferred_network,t.aliasesFromNetwork=n}function DO(t){return t.expiresAt<=_i()}/*! @azure/msal-common v15.10.0 2025-08-05 */class Hr{constructor(e,n,r,i,o,s,l,c){this.canonicalAuthority=e,this._canonicalAuthority.validateAsUri(),this.networkInterface=n,this.cacheManager=r,this.authorityOptions=i,this.regionDiscoveryMetadata={region_used:void 0,region_source:void 0,region_outcome:void 0},this.logger=o,this.performanceClient=l,this.correlationId=s,this.managedIdentity=c||!1,this.regionDiscovery=new Xb(n,this.logger,this.performanceClient,this.correlationId)}getAuthorityType(e){if(e.HostNameAndPort.endsWith(ve.CIAM_AUTH_URL))return Eo.Ciam;const n=e.PathSegments;if(n.length)switch(n[0].toLowerCase()){case ve.ADFS:return Eo.Adfs;case ve.DSTS:return Eo.Dsts}return Eo.Default}get authorityType(){return this.getAuthorityType(this.canonicalAuthorityUrlComponents)}get protocolMode(){return this.authorityOptions.protocolMode}get options(){return this.authorityOptions}get canonicalAuthority(){return this._canonicalAuthority.urlString}set canonicalAuthority(e){this._canonicalAuthority=new Kt(e),this._canonicalAuthority.validateAsUri(),this._canonicalAuthorityUrlComponents=null}get canonicalAuthorityUrlComponents(){return this._canonicalAuthorityUrlComponents||(this._canonicalAuthorityUrlComponents=this._canonicalAuthority.getUrlComponents()),this._canonicalAuthorityUrlComponents}get hostnameAndPort(){return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase()}get tenant(){return this.canonicalAuthorityUrlComponents.PathSegments[0]}get authorizationEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.authorization_endpoint);throw Ae(Ws)}get tokenEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint);throw Ae(Ws)}get deviceCodeEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint.replace("/token","/devicecode"));throw Ae(Ws)}get endSessionEndpoint(){if(this.discoveryComplete()){if(!this.metadata.end_session_endpoint)throw Ae(n3);return this.replacePath(this.metadata.end_session_endpoint)}else throw Ae(Ws)}get selfSignedJwtAudience(){if(this.discoveryComplete())return this.replacePath(this.metadata.issuer);throw Ae(Ws)}get jwksUri(){if(this.discoveryComplete())return this.replacePath(this.metadata.jwks_uri);throw Ae(Ws)}canReplaceTenant(e){return e.PathSegments.length===1&&!Hr.reservedTenantDomains.has(e.PathSegments[0])&&this.getAuthorityType(e)===Eo.Default&&this.protocolMode!==Ai.OIDC}replaceTenant(e){return e.replace(/{tenant}|{tenantid}/g,this.tenant)}replacePath(e){let n=e;const i=new Kt(this.metadata.canonical_authority).getUrlComponents(),o=i.PathSegments;return this.canonicalAuthorityUrlComponents.PathSegments.forEach((l,c)=>{let u=o[c];if(c===0&&this.canReplaceTenant(i)){const d=new Kt(this.metadata.authorization_endpoint).getUrlComponents().PathSegments[0];u!==d&&(this.logger.verbose(`Replacing tenant domain name ${u} with id ${d}`),u=d)}l!==u&&(n=n.replace(`/${u}/`,`/${l}/`))}),this.replaceTenant(n)}get defaultOpenIdConfigurationEndpoint(){const e=this.hostnameAndPort;return this.canonicalAuthority.endsWith("v2.0/")||this.authorityType===Eo.Adfs||this.protocolMode===Ai.OIDC&&!this.isAliasOfKnownMicrosoftAuthority(e)?`${this.canonicalAuthority}.well-known/openid-configuration`:`${this.canonicalAuthority}v2.0/.well-known/openid-configuration`}discoveryComplete(){return!!this.metadata}async resolveEndpointsAsync(){var i,o;(i=this.performanceClient)==null||i.addQueueMeasurement(G.AuthorityResolveEndpointsAsync,this.correlationId);const e=this.getCurrentMetadataEntity(),n=await ge(this.updateCloudDiscoveryMetadata.bind(this),G.AuthorityUpdateCloudDiscoveryMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.canonicalAuthority=this.canonicalAuthority.replace(this.hostnameAndPort,e.preferred_network);const r=await ge(this.updateEndpointMetadata.bind(this),G.AuthorityUpdateEndpointMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.updateCachedMetadata(e,n,{source:r}),(o=this.performanceClient)==null||o.addFields({cloudDiscoverySource:n,authorityEndpointSource:r},this.correlationId)}getCurrentMetadataEntity(){let e=this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);return e||(e={aliases:[],preferred_cache:this.hostnameAndPort,preferred_network:this.hostnameAndPort,canonical_authority:this.canonicalAuthority,authorization_endpoint:"",token_endpoint:"",end_session_endpoint:"",issuer:"",aliasesFromNetwork:!1,endpointsFromNetwork:!1,expiresAt:MO(),jwks_uri:""}),e}updateCachedMetadata(e,n,r){n!==Ti.CACHE&&(r==null?void 0:r.source)!==Ti.CACHE&&(e.expiresAt=MO(),e.canonical_authority=this.canonicalAuthority);const i=this.cacheManager.generateAuthorityMetadataCacheKey(e.preferred_cache);this.cacheManager.setAuthorityMetadata(i,e),this.metadata=e}async updateEndpointMetadata(e){var i,o,s;(i=this.performanceClient)==null||i.addQueueMeasurement(G.AuthorityUpdateEndpointMetadata,this.correlationId);const n=this.updateEndpointMetadataFromLocalSources(e);if(n){if(n.source===Ti.HARDCODED_VALUES&&(o=this.authorityOptions.azureRegionConfiguration)!=null&&o.azureRegion&&n.metadata){const l=await ge(this.updateMetadataWithRegionalInformation.bind(this),G.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(n.metadata);Hg(e,l,!1),e.canonical_authority=this.canonicalAuthority}return n.source}let r=await ge(this.getEndpointMetadataFromNetwork.bind(this),G.AuthorityGetEndpointMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return(s=this.authorityOptions.azureRegionConfiguration)!=null&&s.azureRegion&&(r=await ge(this.updateMetadataWithRegionalInformation.bind(this),G.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(r)),Hg(e,r,!0),Ti.NETWORK;throw Ae(z4,this.defaultOpenIdConfigurationEndpoint)}updateEndpointMetadataFromLocalSources(e){this.logger.verbose("Attempting to get endpoint metadata from authority configuration");const n=this.getEndpointMetadataFromConfig();if(n)return this.logger.verbose("Found endpoint metadata in authority configuration"),Hg(e,n,!1),{source:Ti.CONFIG};if(this.logger.verbose("Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values."),this.authorityOptions.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get endpoint metadata from the network metadata cache.");else{const i=this.getEndpointMetadataFromHardcodedValues();if(i)return Hg(e,i,!1),{source:Ti.HARDCODED_VALUES,metadata:i};this.logger.verbose("Did not find endpoint metadata in hardcoded values... Attempting to get endpoint metadata from the network metadata cache.")}const r=DO(e);return this.isAuthoritySameType(e)&&e.endpointsFromNetwork&&!r?(this.logger.verbose("Found endpoint metadata in the cache."),{source:Ti.CACHE}):(r&&this.logger.verbose("The metadata entity is expired."),null)}isAuthoritySameType(e){return new Kt(e.canonical_authority).getUrlComponents().PathSegments.length===this.canonicalAuthorityUrlComponents.PathSegments.length}getEndpointMetadataFromConfig(){if(this.authorityOptions.authorityMetadata)try{return JSON.parse(this.authorityOptions.authorityMetadata)}catch{throw gn(u3)}return null}async getEndpointMetadataFromNetwork(){var r;(r=this.performanceClient)==null||r.addQueueMeasurement(G.AuthorityGetEndpointMetadataFromNetwork,this.correlationId);const e={},n=this.defaultOpenIdConfigurationEndpoint;this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: attempting to retrieve OAuth endpoints from ${n}`);try{const i=await this.networkInterface.sendGetRequestAsync(n,e);return ate(i.body)?i.body:(this.logger.verbose("Authority.getEndpointMetadataFromNetwork: could not parse response as OpenID configuration"),null)}catch(i){return this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: ${i}`),null}}getEndpointMetadataFromHardcodedValues(){return this.hostnameAndPort in EO?EO[this.hostnameAndPort]:null}async updateMetadataWithRegionalInformation(e){var r,i,o;(r=this.performanceClient)==null||r.addQueueMeasurement(G.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId);const n=(i=this.authorityOptions.azureRegionConfiguration)==null?void 0:i.azureRegion;if(n){if(n!==ve.AZURE_REGION_AUTO_DISCOVER_FLAG)return this.regionDiscoveryMetadata.region_outcome=iS.CONFIGURED_NO_AUTO_DETECTION,this.regionDiscoveryMetadata.region_used=n,Hr.replaceWithRegionalInformation(e,n);const s=await ge(this.regionDiscovery.detectRegion.bind(this.regionDiscovery),G.RegionDiscoveryDetectRegion,this.logger,this.performanceClient,this.correlationId)((o=this.authorityOptions.azureRegionConfiguration)==null?void 0:o.environmentRegion,this.regionDiscoveryMetadata);if(s)return this.regionDiscoveryMetadata.region_outcome=iS.AUTO_DETECTION_REQUESTED_SUCCESSFUL,this.regionDiscoveryMetadata.region_used=s,Hr.replaceWithRegionalInformation(e,s);this.regionDiscoveryMetadata.region_outcome=iS.AUTO_DETECTION_REQUESTED_FAILED}return e}async updateCloudDiscoveryMetadata(e){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(G.AuthorityUpdateCloudDiscoveryMetadata,this.correlationId);const n=this.updateCloudDiscoveryMetadataFromLocalSources(e);if(n)return n;const r=await ge(this.getCloudDiscoveryMetadataFromNetwork.bind(this),G.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return sS(e,r,!0),Ti.NETWORK;throw gn(d3)}updateCloudDiscoveryMetadataFromLocalSources(e){this.logger.verbose("Attempting to get cloud discovery metadata from authority configuration"),this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities||ve.NOT_APPLICABLE}`),this.logger.verbosePii(`Authority Metadata: ${this.authorityOptions.authorityMetadata||ve.NOT_APPLICABLE}`),this.logger.verbosePii(`Canonical Authority: ${e.canonical_authority||ve.NOT_APPLICABLE}`);const n=this.getCloudDiscoveryMetadataFromConfig();if(n)return this.logger.verbose("Found cloud discovery metadata in authority configuration"),sS(e,n,!1),Ti.CONFIG;if(this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the hardcoded values."),this.options.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded cloud discovery metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get cloud discovery metadata from the network metadata cache.");else{const i=ZZ(this.hostnameAndPort);if(i)return this.logger.verbose("Found cloud discovery metadata from hardcoded values."),sS(e,i,!1),Ti.HARDCODED_VALUES;this.logger.verbose("Did not find cloud discovery metadata in hardcoded values... Attempting to get cloud discovery metadata from the network metadata cache.")}const r=DO(e);return this.isAuthoritySameType(e)&&e.aliasesFromNetwork&&!r?(this.logger.verbose("Found cloud discovery metadata in the cache."),Ti.CACHE):(r&&this.logger.verbose("The metadata entity is expired."),null)}getCloudDiscoveryMetadataFromConfig(){if(this.authorityType===Eo.Ciam)return this.logger.verbose("CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host."),Hr.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);if(this.authorityOptions.cloudDiscoveryMetadata){this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");try{this.logger.verbose("Attempting to parse the cloud discovery metadata.");const e=JSON.parse(this.authorityOptions.cloudDiscoveryMetadata),n=Cy(e.metadata,this.hostnameAndPort);if(this.logger.verbose("Parsed the cloud discovery metadata."),n)return this.logger.verbose("There is returnable metadata attached to the parsed cloud discovery metadata."),n;this.logger.verbose("There is no metadata attached to the parsed cloud discovery metadata.")}catch{throw this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error."),gn(pE)}}return this.isInKnownAuthorities()?(this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host."),Hr.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)):null}async getCloudDiscoveryMetadataFromNetwork(){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(G.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.correlationId);const e=`${ve.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`,n={};let r=null;try{const o=await this.networkInterface.sendGetRequestAsync(e,n);let s,l;if(lte(o.body))s=o.body,l=s.metadata,this.logger.verbosePii(`tenant_discovery_endpoint is: ${s.tenant_discovery_endpoint}`);else if(cte(o.body)){if(this.logger.warning(`A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: ${o.status}`),s=o.body,s.error===ve.INVALID_INSTANCE)return this.logger.error("The CloudInstanceDiscoveryErrorResponse error is invalid_instance."),null;this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error is ${s.error}`),this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error description is ${s.error_description}`),this.logger.warning("Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []"),l=[]}else return this.logger.error("AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse"),null;this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request."),r=Cy(l,this.hostnameAndPort)}catch(o){if(o instanceof pn)this.logger.error(`There was a network error while attempting to get the cloud discovery instance metadata. Error: ${o.errorCode} Error Description: ${o.errorMessage}`);else{const s=o;this.logger.error(`A non-MSALJS error was thrown while attempting to get the cloud instance discovery metadata. Error: ${s.name} -Error Description: ${s.message}`)}return null}return r||(this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request."),this.logger.verbose("Creating custom Authority for custom domain scenario."),r=Hr.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),r}isInKnownAuthorities(){return this.authorityOptions.knownAuthorities.filter(n=>n&&Kt.getDomainFromUrl(n).toLowerCase()===this.hostnameAndPort).length>0}static generateAuthority(e,n){let r;if(n&&n.azureCloudInstance!==fE.None){const i=n.tenant?n.tenant:ve.DEFAULT_COMMON_TENANT;r=`${n.azureCloudInstance}/${i}/`}return r||e}static createCloudDiscoveryMetadataFromHost(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}}getPreferredCache(){if(this.managedIdentity)return ve.DEFAULT_AUTHORITY_HOST;if(this.discoveryComplete())return this.metadata.preferred_cache;throw Ae(Ws)}isAlias(e){return this.metadata.aliases.indexOf(e)>-1}isAliasOfKnownMicrosoftAuthority(e){return S3.has(e)}static isPublicCloudAuthority(e){return ve.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0}static buildRegionalAuthorityString(e,n,r){const i=new Kt(e);i.validateAsUri();const o=i.getUrlComponents();let s=`${n}.${o.HostNameAndPort}`;this.isPublicCloudAuthority(o.HostNameAndPort)&&(s=`${n}.${ve.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`);const l=Kt.constructAuthorityUriFromObject({...i.getUrlComponents(),HostNameAndPort:s}).urlString;return r?`${l}?${r}`:l}static replaceWithRegionalInformation(e,n){const r={...e};return r.authorization_endpoint=Hr.buildRegionalAuthorityString(r.authorization_endpoint,n),r.token_endpoint=Hr.buildRegionalAuthorityString(r.token_endpoint,n),r.end_session_endpoint&&(r.end_session_endpoint=Hr.buildRegionalAuthorityString(r.end_session_endpoint,n)),r}static transformCIAMAuthority(e){let n=e;const i=new Kt(e).getUrlComponents();if(i.PathSegments.length===0&&i.HostNameAndPort.endsWith(ve.CIAM_AUTH_URL)){const o=i.HostNameAndPort.split(".")[0];n=`${n}${o}${ve.AAD_TENANT_DOMAIN_SUFFIX}`}return n}}Hr.reservedTenantDomains=new Set(["{tenant}","{tenantid}",ml.COMMON,ml.CONSUMERS,ml.ORGANIZATIONS]);function xte(t){var i;const r=(i=new Kt(t).getUrlComponents().PathSegments.slice(-1)[0])==null?void 0:i.toLowerCase();switch(r){case ml.COMMON:case ml.ORGANIZATIONS:case ml.CONSUMERS:return;default:return r}}function U3(t){return t.endsWith(ve.FORWARD_SLASH)?t:`${t}${ve.FORWARD_SLASH}`}function bte(t){const e=t.cloudDiscoveryMetadata;let n;if(e)try{n=JSON.parse(e)}catch{throw mn(mE)}return{canonicalAuthority:t.authority?U3(t.authority):void 0,knownAuthorities:t.knownAuthorities,cloudDiscoveryMetadata:n}}/*! @azure/msal-common v15.10.0 2025-08-05 */async function B3(t,e,n,r,i,o,s){s==null||s.addQueueMeasurement(G.AuthorityFactoryCreateDiscoveredInstance,o);const l=Hr.transformCIAMAuthority(U3(t)),c=new Hr(l,e,n,r,i,o,s);try{return await ge(c.resolveEndpointsAsync.bind(c),G.AuthorityResolveEndpointsAsync,i,s,o)(),c}catch{throw Ae(Ws)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class lu extends hn{constructor(e,n,r,i,o){super(e,n,r),this.name="ServerError",this.errorNo=i,this.status=o,Object.setPrototypeOf(this,lu.prototype)}}/*! @azure/msal-common v15.10.0 2025-08-05 */function t0(t,e,n){var r;return{clientId:t,authority:e.authority,scopes:e.scopes,homeAccountIdentifier:n,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid,embeddedClientId:e.embeddedClientId||((r=e.tokenBodyParameters)==null?void 0:r.clientId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class hs{static generateThrottlingStorageKey(e){return`${Fh.THROTTLING_PREFIX}.${JSON.stringify(e)}`}static preProcess(e,n,r){var s;const i=hs.generateThrottlingStorageKey(n),o=e.getThrottlingCache(i);if(o){if(o.throttleTime=500&&e.status<600}static checkResponseForRetryAfter(e){return e.headers?e.headers.hasOwnProperty(ei.RETRY_AFTER)&&(e.status<200||e.status>=300):!1}static calculateThrottleTime(e){const n=e<=0?0:e,r=Date.now()/1e3;return Math.floor(Math.min(r+(n||Fh.DEFAULT_THROTTLE_TIME_SECONDS),r+Fh.DEFAULT_MAX_THROTTLE_TIME_SECONDS)*1e3)}static removeThrottle(e,n,r,i){const o=t0(n,r,i),s=this.generateThrottlingStorageKey(o);e.removeItem(s,r.correlationId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class n0 extends hn{constructor(e,n,r){super(e.errorCode,e.errorMessage,e.subError),Object.setPrototypeOf(this,n0.prototype),this.name="NetworkError",this.error=e,this.httpStatus=n,this.responseHeaders=r}}function Ch(t,e,n,r){return t.errorMessage=`${t.errorMessage}, additionalErrorInfo: error.name:${r==null?void 0:r.name}, error.message:${r==null?void 0:r.message}`,new n0(t,e,n)}/*! @azure/msal-common v15.10.0 2025-08-05 */class OE{constructor(e,n){this.config=uee(e),this.logger=new ya(this.config.loggerOptions,i3,dE),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=n}createTokenRequestHeaders(e){const n={};if(n[ei.CONTENT_TYPE]=ve.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case Oo.HOME_ACCOUNT_ID:try{const r=rd(e.credential);n[ei.CCS_HEADER]=`Oid:${r.uid}@${r.utid}`}catch(r){this.logger.verbose("Could not parse home account ID for CCS Header: "+r)}break;case Oo.UPN:n[ei.CCS_HEADER]=`UPN: ${e.credential}`;break}return n}async executePostToTokenEndpoint(e,n,r,i,o,s){var c;s&&((c=this.performanceClient)==null||c.addQueueMeasurement(s,o));const l=await this.sendPostRequest(i,e,{body:n,headers:r},o);return this.config.serverTelemetryManager&&l.status<500&&l.status!==429&&this.config.serverTelemetryManager.clearTelemetryCache(),l}async sendPostRequest(e,n,r,i){var s,l,c;hs.preProcess(this.cacheManager,e,i);let o;try{o=await ge(this.networkClient.sendPostRequestAsync.bind(this.networkClient),G.NetworkClientSendPostRequestAsync,this.logger,this.performanceClient,i)(n,r);const u=o.headers||{};(l=this.performanceClient)==null||l.addFields({refreshTokenSize:((s=o.body.refresh_token)==null?void 0:s.length)||0,httpVerToken:u[ei.X_MS_HTTP_VERSION]||"",requestId:u[ei.X_MS_REQUEST_ID]||""},i)}catch(u){if(u instanceof n0){const d=u.responseHeaders;throw d&&((c=this.performanceClient)==null||c.addFields({httpVerToken:d[ei.X_MS_HTTP_VERSION]||"",requestId:d[ei.X_MS_REQUEST_ID]||"",contentTypeHeader:d[ei.CONTENT_TYPE]||void 0,contentLengthHeader:d[ei.CONTENT_LENGTH]||void 0,httpStatus:u.httpStatus},i)),u.error}throw u instanceof hn?u:Ae(z4)}return hs.postProcess(this.cacheManager,e,o,i),o}async updateAuthority(e,n){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(G.UpdateTokenEndpointAuthority,n);const r=`https://${e}/${this.authority.tenant}/`,i=await B3(r,this.networkClient,this.cacheManager,this.authority.options,this.logger,n,this.performanceClient);this.authority=i}createTokenQueryParameters(e){const n=new Map;return e.embeddedClientId&&Xb(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenQueryParameters&&vl(n,e.tokenQueryParameters),jE(n,e.correlationId),Qb(n,e.correlationId,this.performanceClient),Np(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */function H3(t){return t&&(t.tid||t.tfp||t.acr)||null}/*! @azure/msal-common v15.10.0 2025-08-05 */class Wo{getAccountInfo(){return{homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId,loginHint:this.loginHint,name:this.name,nativeAccountId:this.nativeAccountId,authorityType:this.authorityType,tenantProfiles:new Map((this.tenantProfiles||[]).map(e=>[e.tenantId,e]))}}isSingleTenant(){return!this.tenantProfiles}static createAccount(e,n,r){var u,d,f,h,p,g,m;const i=new Wo;n.authorityType===Eo.Adfs?i.authorityType=Bg.ADFS_ACCOUNT_TYPE:n.protocolMode===Ai.OIDC?i.authorityType=Bg.GENERIC_ACCOUNT_TYPE:i.authorityType=Bg.MSSTS_ACCOUNT_TYPE;let o;e.clientInfo&&r&&(o=jy(e.clientInfo,r)),i.clientInfo=e.clientInfo,i.homeAccountId=e.homeAccountId,i.nativeAccountId=e.nativeAccountId;const s=e.environment||n&&n.getPreferredCache();if(!s)throw Ae(lE);i.environment=s,i.realm=(o==null?void 0:o.utid)||H3(e.idTokenClaims)||"",i.localAccountId=(o==null?void 0:o.uid)||((u=e.idTokenClaims)==null?void 0:u.oid)||((d=e.idTokenClaims)==null?void 0:d.sub)||"";const l=((f=e.idTokenClaims)==null?void 0:f.preferred_username)||((h=e.idTokenClaims)==null?void 0:h.upn),c=(p=e.idTokenClaims)!=null&&p.emails?e.idTokenClaims.emails[0]:null;if(i.username=l||c||"",i.loginHint=(g=e.idTokenClaims)==null?void 0:g.login_hint,i.name=((m=e.idTokenClaims)==null?void 0:m.name)||"",i.cloudGraphHostName=e.cloudGraphHostName,i.msGraphHost=e.msGraphHost,e.tenantProfiles)i.tenantProfiles=e.tenantProfiles;else{const v=vE(e.homeAccountId,i.localAccountId,i.realm,e.idTokenClaims);i.tenantProfiles=[v]}return i}static createFromAccountInfo(e,n,r){var o;const i=new Wo;return i.authorityType=e.authorityType||Bg.GENERIC_ACCOUNT_TYPE,i.homeAccountId=e.homeAccountId,i.localAccountId=e.localAccountId,i.nativeAccountId=e.nativeAccountId,i.realm=e.tenantId,i.environment=e.environment,i.username=e.username,i.name=e.name,i.loginHint=e.loginHint,i.cloudGraphHostName=n,i.msGraphHost=r,i.tenantProfiles=Array.from(((o=e.tenantProfiles)==null?void 0:o.values())||[]),i}static generateHomeAccountId(e,n,r,i,o){if(!(n===Eo.Adfs||n===Eo.Dsts)){if(e)try{const s=jy(e,i.base64Decode);if(s.uid&&s.utid)return`${s.uid}.${s.utid}`}catch{}r.warning("No client info in response")}return(o==null?void 0:o.sub)||""}static isAccountEntity(e){return e?e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("localAccountId")&&e.hasOwnProperty("username")&&e.hasOwnProperty("authorityType"):!1}static accountInfoIsEqual(e,n,r){if(!e||!n)return!1;let i=!0;if(r){const o=e.idTokenClaims||{},s=n.idTokenClaims||{};i=o.iat===s.iat&&o.nonce===s.nonce}return e.homeAccountId===n.homeAccountId&&e.localAccountId===n.localAccountId&&e.username===n.username&&e.tenantId===n.tenantId&&e.loginHint===n.loginHint&&e.environment===n.environment&&e.nativeAccountId===n.nativeAccountId&&i}}/*! @azure/msal-common v15.10.0 2025-08-05 */const ky="no_tokens_found",z3="native_account_unavailable",IE="refresh_token_expired",RE="ux_not_allowed",wte="interaction_required",Ste="consent_required",Cte="login_required",r0="bad_token";/*! @azure/msal-common v15.10.0 2025-08-05 */const LO=[wte,Ste,Cte,r0,RE],Ate=["message_only","additional_action","basic_action","user_password_expired","consent_required","bad_token"],_te={[ky]:"No refresh token found in the cache. Please sign-in.",[z3]:"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API.",[IE]:"Refresh token has expired.",[r0]:"Identity provider returned bad_token due to an expired or invalid refresh token. Please invoke an interactive API to resolve.",[RE]:"`canShowUI` flag in Edge was set to false. User interaction required on web page. Please invoke an interactive API to resolve."};class qo extends hn{constructor(e,n,r,i,o,s,l,c){super(e,n,r),Object.setPrototypeOf(this,qo.prototype),this.timestamp=i||ve.EMPTY_STRING,this.traceId=o||ve.EMPTY_STRING,this.correlationId=s||ve.EMPTY_STRING,this.claims=l||ve.EMPTY_STRING,this.name="InteractionRequiredAuthError",this.errorNo=c}}function V3(t,e,n){const r=!!t&&LO.indexOf(t)>-1,i=!!n&&Ate.indexOf(n)>-1,o=!!e&&LO.some(s=>e.indexOf(s)>-1);return r||o||i}function Oy(t){return new qo(t,_te[t])}/*! @azure/msal-common v15.10.0 2025-08-05 */class Sf{static setRequestState(e,n,r){const i=Sf.generateLibraryState(e,r);return n?`${i}${ve.RESOURCE_DELIM}${n}`:i}static generateLibraryState(e,n){if(!e)throw Ae(w1);const r={id:e.createNewGuid()};n&&(r.meta=n);const i=JSON.stringify(r);return e.base64Encode(i)}static parseRequestState(e,n){if(!e)throw Ae(w1);if(!n)throw Ae(Pd);try{const r=n.split(ve.RESOURCE_DELIM),i=r[0],o=r.length>1?r.slice(1).join(ve.RESOURCE_DELIM):ve.EMPTY_STRING,s=e.base64Decode(i),l=JSON.parse(s);return{userRequestState:o||ve.EMPTY_STRING,libraryState:l}}catch{throw Ae(Pd)}}}/*! @azure/msal-common v15.10.0 2025-08-05 */const jte={SW:"sw"};class kd{constructor(e,n){this.cryptoUtils=e,this.performanceClient=n}async generateCnf(e,n){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(G.PopTokenGenerateCnf,e.correlationId);const r=await ge(this.generateKid.bind(this),G.PopTokenGenerateCnf,n,this.performanceClient,e.correlationId)(e),i=this.cryptoUtils.base64UrlEncode(JSON.stringify(r));return{kid:r.kid,reqCnfString:i}}async generateKid(e){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(G.PopTokenGenerateKid,e.correlationId),{kid:await this.cryptoUtils.getPublicKeyThumbprint(e),xms_ksl:jte.SW}}async signPopToken(e,n,r){return this.signPayload(e,n,r)}async signPayload(e,n,r,i){const{resourceRequestMethod:o,resourceRequestUri:s,shrClaims:l,shrNonce:c,shrOptions:u}=r,d=s?new Kt(s):void 0,f=d==null?void 0:d.getUrlComponents();return this.cryptoUtils.signJwt({at:e,ts:_i(),m:o==null?void 0:o.toUpperCase(),u:f==null?void 0:f.HostNameAndPort,nonce:c||this.cryptoUtils.createNewGuid(),p:f==null?void 0:f.AbsolutePath,q:f!=null&&f.QueryString?[[],f.QueryString]:void 0,client_claims:l||void 0,...i},n,u,r.correlationId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Ete{constructor(e,n){this.cache=e,this.hasChanged=n}get cacheHasChanged(){return this.hasChanged}get tokenCache(){return this.cache}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Wc{constructor(e,n,r,i,o,s,l){this.clientId=e,this.cacheStorage=n,this.cryptoObj=r,this.logger=i,this.serializableCache=o,this.persistencePlugin=s,this.performanceClient=l}validateTokenResponse(e,n){var r;if(e.error||e.error_description||e.suberror){const i=`Error(s): ${e.error_codes||ve.NOT_AVAILABLE} - Timestamp: ${e.timestamp||ve.NOT_AVAILABLE} - Description: ${e.error_description||ve.NOT_AVAILABLE} - Correlation ID: ${e.correlation_id||ve.NOT_AVAILABLE} - Trace ID: ${e.trace_id||ve.NOT_AVAILABLE}`,o=(r=e.error_codes)!=null&&r.length?e.error_codes[0]:void 0,s=new lu(e.error,i,e.suberror,o,e.status);if(n&&e.status&&e.status>=rl.SERVER_ERROR_RANGE_START&&e.status<=rl.SERVER_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently unavailable and the access token is unable to be refreshed. +Error Description: ${s.message}`)}return null}return r||(this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request."),this.logger.verbose("Creating custom Authority for custom domain scenario."),r=Hr.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),r}isInKnownAuthorities(){return this.authorityOptions.knownAuthorities.filter(n=>n&&Kt.getDomainFromUrl(n).toLowerCase()===this.hostnameAndPort).length>0}static generateAuthority(e,n){let r;if(n&&n.azureCloudInstance!==dE.None){const i=n.tenant?n.tenant:ve.DEFAULT_COMMON_TENANT;r=`${n.azureCloudInstance}/${i}/`}return r||e}static createCloudDiscoveryMetadataFromHost(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}}getPreferredCache(){if(this.managedIdentity)return ve.DEFAULT_AUTHORITY_HOST;if(this.discoveryComplete())return this.metadata.preferred_cache;throw Ae(Ws)}isAlias(e){return this.metadata.aliases.indexOf(e)>-1}isAliasOfKnownMicrosoftAuthority(e){return w3.has(e)}static isPublicCloudAuthority(e){return ve.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0}static buildRegionalAuthorityString(e,n,r){const i=new Kt(e);i.validateAsUri();const o=i.getUrlComponents();let s=`${n}.${o.HostNameAndPort}`;this.isPublicCloudAuthority(o.HostNameAndPort)&&(s=`${n}.${ve.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`);const l=Kt.constructAuthorityUriFromObject({...i.getUrlComponents(),HostNameAndPort:s}).urlString;return r?`${l}?${r}`:l}static replaceWithRegionalInformation(e,n){const r={...e};return r.authorization_endpoint=Hr.buildRegionalAuthorityString(r.authorization_endpoint,n),r.token_endpoint=Hr.buildRegionalAuthorityString(r.token_endpoint,n),r.end_session_endpoint&&(r.end_session_endpoint=Hr.buildRegionalAuthorityString(r.end_session_endpoint,n)),r}static transformCIAMAuthority(e){let n=e;const i=new Kt(e).getUrlComponents();if(i.PathSegments.length===0&&i.HostNameAndPort.endsWith(ve.CIAM_AUTH_URL)){const o=i.HostNameAndPort.split(".")[0];n=`${n}${o}${ve.AAD_TENANT_DOMAIN_SUFFIX}`}return n}}Hr.reservedTenantDomains=new Set(["{tenant}","{tenantid}",ml.COMMON,ml.CONSUMERS,ml.ORGANIZATIONS]);function yte(t){var i;const r=(i=new Kt(t).getUrlComponents().PathSegments.slice(-1)[0])==null?void 0:i.toLowerCase();switch(r){case ml.COMMON:case ml.ORGANIZATIONS:case ml.CONSUMERS:return;default:return r}}function F3(t){return t.endsWith(ve.FORWARD_SLASH)?t:`${t}${ve.FORWARD_SLASH}`}function xte(t){const e=t.cloudDiscoveryMetadata;let n;if(e)try{n=JSON.parse(e)}catch{throw gn(pE)}return{canonicalAuthority:t.authority?F3(t.authority):void 0,knownAuthorities:t.knownAuthorities,cloudDiscoveryMetadata:n}}/*! @azure/msal-common v15.10.0 2025-08-05 */async function U3(t,e,n,r,i,o,s){s==null||s.addQueueMeasurement(G.AuthorityFactoryCreateDiscoveredInstance,o);const l=Hr.transformCIAMAuthority(F3(t)),c=new Hr(l,e,n,r,i,o,s);try{return await ge(c.resolveEndpointsAsync.bind(c),G.AuthorityResolveEndpointsAsync,i,s,o)(),c}catch{throw Ae(Ws)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class lu extends pn{constructor(e,n,r,i,o){super(e,n,r),this.name="ServerError",this.errorNo=i,this.status=o,Object.setPrototypeOf(this,lu.prototype)}}/*! @azure/msal-common v15.10.0 2025-08-05 */function e0(t,e,n){var r;return{clientId:t,authority:e.authority,scopes:e.scopes,homeAccountIdentifier:n,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid,embeddedClientId:e.embeddedClientId||((r=e.tokenBodyParameters)==null?void 0:r.clientId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class hs{static generateThrottlingStorageKey(e){return`${Lh.THROTTLING_PREFIX}.${JSON.stringify(e)}`}static preProcess(e,n,r){var s;const i=hs.generateThrottlingStorageKey(n),o=e.getThrottlingCache(i);if(o){if(o.throttleTime=500&&e.status<600}static checkResponseForRetryAfter(e){return e.headers?e.headers.hasOwnProperty(ei.RETRY_AFTER)&&(e.status<200||e.status>=300):!1}static calculateThrottleTime(e){const n=e<=0?0:e,r=Date.now()/1e3;return Math.floor(Math.min(r+(n||Lh.DEFAULT_THROTTLE_TIME_SECONDS),r+Lh.DEFAULT_MAX_THROTTLE_TIME_SECONDS)*1e3)}static removeThrottle(e,n,r,i){const o=e0(n,r,i),s=this.generateThrottlingStorageKey(o);e.removeItem(s,r.correlationId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class t0 extends pn{constructor(e,n,r){super(e.errorCode,e.errorMessage,e.subError),Object.setPrototypeOf(this,t0.prototype),this.name="NetworkError",this.error=e,this.httpStatus=n,this.responseHeaders=r}}function Sh(t,e,n,r){return t.errorMessage=`${t.errorMessage}, additionalErrorInfo: error.name:${r==null?void 0:r.name}, error.message:${r==null?void 0:r.message}`,new t0(t,e,n)}/*! @azure/msal-common v15.10.0 2025-08-05 */class kE{constructor(e,n){this.config=cee(e),this.logger=new ya(this.config.loggerOptions,r3,uE),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=n}createTokenRequestHeaders(e){const n={};if(n[ei.CONTENT_TYPE]=ve.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case Oo.HOME_ACCOUNT_ID:try{const r=rd(e.credential);n[ei.CCS_HEADER]=`Oid:${r.uid}@${r.utid}`}catch(r){this.logger.verbose("Could not parse home account ID for CCS Header: "+r)}break;case Oo.UPN:n[ei.CCS_HEADER]=`UPN: ${e.credential}`;break}return n}async executePostToTokenEndpoint(e,n,r,i,o,s){var c;s&&((c=this.performanceClient)==null||c.addQueueMeasurement(s,o));const l=await this.sendPostRequest(i,e,{body:n,headers:r},o);return this.config.serverTelemetryManager&&l.status<500&&l.status!==429&&this.config.serverTelemetryManager.clearTelemetryCache(),l}async sendPostRequest(e,n,r,i){var s,l,c;hs.preProcess(this.cacheManager,e,i);let o;try{o=await ge(this.networkClient.sendPostRequestAsync.bind(this.networkClient),G.NetworkClientSendPostRequestAsync,this.logger,this.performanceClient,i)(n,r);const u=o.headers||{};(l=this.performanceClient)==null||l.addFields({refreshTokenSize:((s=o.body.refresh_token)==null?void 0:s.length)||0,httpVerToken:u[ei.X_MS_HTTP_VERSION]||"",requestId:u[ei.X_MS_REQUEST_ID]||""},i)}catch(u){if(u instanceof t0){const d=u.responseHeaders;throw d&&((c=this.performanceClient)==null||c.addFields({httpVerToken:d[ei.X_MS_HTTP_VERSION]||"",requestId:d[ei.X_MS_REQUEST_ID]||"",contentTypeHeader:d[ei.CONTENT_TYPE]||void 0,contentLengthHeader:d[ei.CONTENT_LENGTH]||void 0,httpStatus:u.httpStatus},i)),u.error}throw u instanceof pn?u:Ae(H4)}return hs.postProcess(this.cacheManager,e,o,i),o}async updateAuthority(e,n){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(G.UpdateTokenEndpointAuthority,n);const r=`https://${e}/${this.authority.tenant}/`,i=await U3(r,this.networkClient,this.cacheManager,this.authority.options,this.logger,n,this.performanceClient);this.authority=i}createTokenQueryParameters(e){const n=new Map;return e.embeddedClientId&&Qb(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenQueryParameters&&vl(n,e.tokenQueryParameters),_E(n,e.correlationId),Yb(n,e.correlationId,this.performanceClient),Ep(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */function B3(t){return t&&(t.tid||t.tfp||t.acr)||null}/*! @azure/msal-common v15.10.0 2025-08-05 */class Wo{getAccountInfo(){return{homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId,loginHint:this.loginHint,name:this.name,nativeAccountId:this.nativeAccountId,authorityType:this.authorityType,tenantProfiles:new Map((this.tenantProfiles||[]).map(e=>[e.tenantId,e]))}}isSingleTenant(){return!this.tenantProfiles}static createAccount(e,n,r){var u,d,f,h,p,g,m;const i=new Wo;n.authorityType===Eo.Adfs?i.authorityType=Ug.ADFS_ACCOUNT_TYPE:n.protocolMode===Ai.OIDC?i.authorityType=Ug.GENERIC_ACCOUNT_TYPE:i.authorityType=Ug.MSSTS_ACCOUNT_TYPE;let o;e.clientInfo&&r&&(o=_y(e.clientInfo,r)),i.clientInfo=e.clientInfo,i.homeAccountId=e.homeAccountId,i.nativeAccountId=e.nativeAccountId;const s=e.environment||n&&n.getPreferredCache();if(!s)throw Ae(aE);i.environment=s,i.realm=(o==null?void 0:o.utid)||B3(e.idTokenClaims)||"",i.localAccountId=(o==null?void 0:o.uid)||((u=e.idTokenClaims)==null?void 0:u.oid)||((d=e.idTokenClaims)==null?void 0:d.sub)||"";const l=((f=e.idTokenClaims)==null?void 0:f.preferred_username)||((h=e.idTokenClaims)==null?void 0:h.upn),c=(p=e.idTokenClaims)!=null&&p.emails?e.idTokenClaims.emails[0]:null;if(i.username=l||c||"",i.loginHint=(g=e.idTokenClaims)==null?void 0:g.login_hint,i.name=((m=e.idTokenClaims)==null?void 0:m.name)||"",i.cloudGraphHostName=e.cloudGraphHostName,i.msGraphHost=e.msGraphHost,e.tenantProfiles)i.tenantProfiles=e.tenantProfiles;else{const v=gE(e.homeAccountId,i.localAccountId,i.realm,e.idTokenClaims);i.tenantProfiles=[v]}return i}static createFromAccountInfo(e,n,r){var o;const i=new Wo;return i.authorityType=e.authorityType||Ug.GENERIC_ACCOUNT_TYPE,i.homeAccountId=e.homeAccountId,i.localAccountId=e.localAccountId,i.nativeAccountId=e.nativeAccountId,i.realm=e.tenantId,i.environment=e.environment,i.username=e.username,i.name=e.name,i.loginHint=e.loginHint,i.cloudGraphHostName=n,i.msGraphHost=r,i.tenantProfiles=Array.from(((o=e.tenantProfiles)==null?void 0:o.values())||[]),i}static generateHomeAccountId(e,n,r,i,o){if(!(n===Eo.Adfs||n===Eo.Dsts)){if(e)try{const s=_y(e,i.base64Decode);if(s.uid&&s.utid)return`${s.uid}.${s.utid}`}catch{}r.warning("No client info in response")}return(o==null?void 0:o.sub)||""}static isAccountEntity(e){return e?e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("localAccountId")&&e.hasOwnProperty("username")&&e.hasOwnProperty("authorityType"):!1}static accountInfoIsEqual(e,n,r){if(!e||!n)return!1;let i=!0;if(r){const o=e.idTokenClaims||{},s=n.idTokenClaims||{};i=o.iat===s.iat&&o.nonce===s.nonce}return e.homeAccountId===n.homeAccountId&&e.localAccountId===n.localAccountId&&e.username===n.username&&e.tenantId===n.tenantId&&e.loginHint===n.loginHint&&e.environment===n.environment&&e.nativeAccountId===n.nativeAccountId&&i}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Py="no_tokens_found",H3="native_account_unavailable",OE="refresh_token_expired",IE="ux_not_allowed",bte="interaction_required",wte="consent_required",Ste="login_required",n0="bad_token";/*! @azure/msal-common v15.10.0 2025-08-05 */const $O=[bte,wte,Ste,n0,IE],Cte=["message_only","additional_action","basic_action","user_password_expired","consent_required","bad_token"],Ate={[Py]:"No refresh token found in the cache. Please sign-in.",[H3]:"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API.",[OE]:"Refresh token has expired.",[n0]:"Identity provider returned bad_token due to an expired or invalid refresh token. Please invoke an interactive API to resolve.",[IE]:"`canShowUI` flag in Edge was set to false. User interaction required on web page. Please invoke an interactive API to resolve."};class qo extends pn{constructor(e,n,r,i,o,s,l,c){super(e,n,r),Object.setPrototypeOf(this,qo.prototype),this.timestamp=i||ve.EMPTY_STRING,this.traceId=o||ve.EMPTY_STRING,this.correlationId=s||ve.EMPTY_STRING,this.claims=l||ve.EMPTY_STRING,this.name="InteractionRequiredAuthError",this.errorNo=c}}function z3(t,e,n){const r=!!t&&$O.indexOf(t)>-1,i=!!n&&Cte.indexOf(n)>-1,o=!!e&&$O.some(s=>e.indexOf(s)>-1);return r||o||i}function ky(t){return new qo(t,Ate[t])}/*! @azure/msal-common v15.10.0 2025-08-05 */class Sf{static setRequestState(e,n,r){const i=Sf.generateLibraryState(e,r);return n?`${i}${ve.RESOURCE_DELIM}${n}`:i}static generateLibraryState(e,n){if(!e)throw Ae(b1);const r={id:e.createNewGuid()};n&&(r.meta=n);const i=JSON.stringify(r);return e.base64Encode(i)}static parseRequestState(e,n){if(!e)throw Ae(b1);if(!n)throw Ae(Pd);try{const r=n.split(ve.RESOURCE_DELIM),i=r[0],o=r.length>1?r.slice(1).join(ve.RESOURCE_DELIM):ve.EMPTY_STRING,s=e.base64Decode(i),l=JSON.parse(s);return{userRequestState:o||ve.EMPTY_STRING,libraryState:l}}catch{throw Ae(Pd)}}}/*! @azure/msal-common v15.10.0 2025-08-05 */const _te={SW:"sw"};class kd{constructor(e,n){this.cryptoUtils=e,this.performanceClient=n}async generateCnf(e,n){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(G.PopTokenGenerateCnf,e.correlationId);const r=await ge(this.generateKid.bind(this),G.PopTokenGenerateCnf,n,this.performanceClient,e.correlationId)(e),i=this.cryptoUtils.base64UrlEncode(JSON.stringify(r));return{kid:r.kid,reqCnfString:i}}async generateKid(e){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(G.PopTokenGenerateKid,e.correlationId),{kid:await this.cryptoUtils.getPublicKeyThumbprint(e),xms_ksl:_te.SW}}async signPopToken(e,n,r){return this.signPayload(e,n,r)}async signPayload(e,n,r,i){const{resourceRequestMethod:o,resourceRequestUri:s,shrClaims:l,shrNonce:c,shrOptions:u}=r,d=s?new Kt(s):void 0,f=d==null?void 0:d.getUrlComponents();return this.cryptoUtils.signJwt({at:e,ts:_i(),m:o==null?void 0:o.toUpperCase(),u:f==null?void 0:f.HostNameAndPort,nonce:c||this.cryptoUtils.createNewGuid(),p:f==null?void 0:f.AbsolutePath,q:f!=null&&f.QueryString?[[],f.QueryString]:void 0,client_claims:l||void 0,...i},n,u,r.correlationId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class jte{constructor(e,n){this.cache=e,this.hasChanged=n}get cacheHasChanged(){return this.hasChanged}get tokenCache(){return this.cache}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Wc{constructor(e,n,r,i,o,s,l){this.clientId=e,this.cacheStorage=n,this.cryptoObj=r,this.logger=i,this.serializableCache=o,this.persistencePlugin=s,this.performanceClient=l}validateTokenResponse(e,n){var r;if(e.error||e.error_description||e.suberror){const i=`Error(s): ${e.error_codes||ve.NOT_AVAILABLE} - Timestamp: ${e.timestamp||ve.NOT_AVAILABLE} - Description: ${e.error_description||ve.NOT_AVAILABLE} - Correlation ID: ${e.correlation_id||ve.NOT_AVAILABLE} - Trace ID: ${e.trace_id||ve.NOT_AVAILABLE}`,o=(r=e.error_codes)!=null&&r.length?e.error_codes[0]:void 0,s=new lu(e.error,i,e.suberror,o,e.status);if(n&&e.status&&e.status>=rl.SERVER_ERROR_RANGE_START&&e.status<=rl.SERVER_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently unavailable and the access token is unable to be refreshed. ${s}`);return}else if(n&&e.status&&e.status>=rl.CLIENT_ERROR_RANGE_START&&e.status<=rl.CLIENT_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently available but is unable to refresh the access token. -${s}`);return}throw V3(e.error,e.error_description,e.suberror)?new qo(e.error,e.error_description,e.suberror,e.timestamp||ve.EMPTY_STRING,e.trace_id||ve.EMPTY_STRING,e.correlation_id||ve.EMPTY_STRING,e.claims||ve.EMPTY_STRING,o):s}}async handleServerTokenResponse(e,n,r,i,o,s,l,c,u){var g;(g=this.performanceClient)==null||g.addQueueMeasurement(G.HandleServerTokenResponse,e.correlation_id);let d;if(e.id_token){if(d=wf(e.id_token||ve.EMPTY_STRING,this.cryptoObj.base64Decode),o&&o.nonce&&d.nonce!==o.nonce)throw Ae(W4);if(i.maxAge||i.maxAge===0){const m=d.auth_time;if(!m)throw Ae(sE);x3(m,i.maxAge)}}this.homeAccountIdentifier=Wo.generateHomeAccountId(e.client_info||ve.EMPTY_STRING,n.authorityType,this.logger,this.cryptoObj,d);let f;o&&o.state&&(f=Sf.parseRequestState(this.cryptoObj,o.state)),e.key_id=e.key_id||i.sshKid||void 0;const h=this.generateCacheRecord(e,n,r,i,d,s,o);let p;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),p=new Ete(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(p)),l&&!c&&h.account){const m=this.cacheStorage.generateAccountKey(h.account.getAccountInfo());if(!this.cacheStorage.getAccount(m,i.correlationId))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),await Wc.generateAuthenticationResult(this.cryptoObj,n,h,!1,i,d,f,void 0,u)}await this.cacheStorage.saveCacheRecord(h,i.correlationId,i.storeInCache)}finally{this.persistencePlugin&&this.serializableCache&&p&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(p))}return Wc.generateAuthenticationResult(this.cryptoObj,n,h,!1,i,d,f,e,u)}generateCacheRecord(e,n,r,i,o,s,l){const c=n.getPreferredCache();if(!c)throw Ae(lE);const u=H3(o);let d,f;e.id_token&&o&&(d=Jb(this.homeAccountIdentifier,c,e.id_token,this.clientId,u||""),f=ME(this.cacheStorage,n,this.homeAccountIdentifier,this.cryptoObj.base64Decode,i.correlationId,o,e.client_info,c,u,l,void 0,this.logger));let h=null;if(e.access_token){const m=e.scope?hr.fromString(e.scope):new hr(i.scopes||[]),v=(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,b=(typeof e.ext_expires_in=="string"?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,x=(typeof e.refresh_in=="string"?parseInt(e.refresh_in,10):e.refresh_in)||void 0,w=r+v,S=w+b,C=x&&x>0?r+x:void 0;h=e0(this.homeAccountIdentifier,c,e.access_token,this.clientId,u||n.tenant||"",m.printScopes(),w,S,this.cryptoObj.base64Decode,C,e.token_type,s,e.key_id,i.claims,i.requestedClaimsHash)}let p=null;if(e.refresh_token){let m;if(e.refresh_token_expires_in){const v=typeof e.refresh_token_expires_in=="string"?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in;m=r+v}p=F3(this.homeAccountIdentifier,c,e.refresh_token,this.clientId,e.foci,s,m)}let g=null;return e.foci&&(g={clientId:this.clientId,environment:c,familyId:e.foci}),{account:f,idToken:d,accessToken:h,refreshToken:p,appMetadata:g}}static async generateAuthenticationResult(e,n,r,i,o,s,l,c,u){var w,S,C,A,_;let d=ve.EMPTY_STRING,f=[],h=null,p,g,m=ve.EMPTY_STRING;if(r.accessToken){if(r.accessToken.tokenType===an.POP&&!o.popKid){const j=new kd(e),{secret:k,keyId:P}=r.accessToken;if(!P)throw Ae(cE);d=await j.signPopToken(k,P,o)}else d=r.accessToken.secret;f=hr.fromString(r.accessToken.target).asArray(),h=id(r.accessToken.expiresOn),p=id(r.accessToken.extendedExpiresOn),r.accessToken.refreshOn&&(g=id(r.accessToken.refreshOn))}r.appMetadata&&(m=r.appMetadata.familyId===xy?xy:"");const v=(s==null?void 0:s.oid)||(s==null?void 0:s.sub)||"",b=(s==null?void 0:s.tid)||"";c!=null&&c.spa_accountid&&r.account&&(r.account.nativeAccountId=c==null?void 0:c.spa_accountid);const x=r.account?yE(r.account.getAccountInfo(),void 0,s,(w=r.idToken)==null?void 0:w.secret):null;return{authority:n.canonicalAuthority,uniqueId:v,tenantId:b,scopes:f,account:x,idToken:((S=r==null?void 0:r.idToken)==null?void 0:S.secret)||"",idTokenClaims:s||{},accessToken:d,fromCache:i,expiresOn:h,extExpiresOn:p,refreshOn:g,correlationId:o.correlationId,requestId:u||ve.EMPTY_STRING,familyId:m,tokenType:((C=r.accessToken)==null?void 0:C.tokenType)||ve.EMPTY_STRING,state:l?l.userRequestState:ve.EMPTY_STRING,cloudGraphHostName:((A=r.account)==null?void 0:A.cloudGraphHostName)||ve.EMPTY_STRING,msGraphHost:((_=r.account)==null?void 0:_.msGraphHost)||ve.EMPTY_STRING,code:c==null?void 0:c.spa_code,fromNativeBroker:!1}}}function ME(t,e,n,r,i,o,s,l,c,u,d,f){f==null||f.verbose("setCachedAccount called");const p=t.getAccountKeys().find(x=>x.startsWith(n));let g=null;p&&(g=t.getAccount(p,i));const m=g||Wo.createAccount({homeAccountId:n,idTokenClaims:o,clientInfo:s,environment:l,cloudGraphHostName:u==null?void 0:u.cloud_graph_host_name,msGraphHost:u==null?void 0:u.msgraph_host,nativeAccountId:d},e,r),v=m.tenantProfiles||[],b=c||m.realm;if(b&&!v.find(x=>x.tenantId===b)){const x=vE(n,m.localAccountId,b,o);v.push(x)}return m.tenantProfiles=v,m}/*! @azure/msal-common v15.10.0 2025-08-05 */async function G3(t,e,n){return typeof t=="string"?t:t({clientId:e,tokenEndpoint:n})}/*! @azure/msal-common v15.10.0 2025-08-05 */class K3 extends OE{constructor(e,n){var r;super(e,n),this.includeRedirectUri=!0,this.oidcDefaultScopes=(r=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:r.defaultScopes}async acquireToken(e,n){var l,c;if((l=this.performanceClient)==null||l.addQueueMeasurement(G.AuthClientAcquireToken,e.correlationId),!e.code)throw Ae(Q4);const r=_i(),i=await ge(this.executeTokenRequest.bind(this),G.AuthClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(this.authority,e),o=(c=i.headers)==null?void 0:c[ei.X_MS_REQUEST_ID],s=new Wc(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return s.validateTokenResponse(i.body),ge(s.handleServerTokenResponse.bind(s),G.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(i.body,this.authority,r,e,n,void 0,void 0,void 0,o)}getLogoutUri(e){if(!e)throw mn(u3);const n=this.createLogoutUrlQueryString(e);return Kt.appendQueryString(this.authority.endSessionEndpoint,n)}async executeTokenRequest(e,n){var u;(u=this.performanceClient)==null||u.addQueueMeasurement(G.AuthClientExecuteTokenRequest,n.correlationId);const r=this.createTokenQueryParameters(n),i=Kt.appendQueryString(e.tokenEndpoint,r),o=await ge(this.createTokenRequestBody.bind(this),G.AuthClientCreateTokenRequestBody,this.logger,this.performanceClient,n.correlationId)(n);let s;if(n.clientInfo)try{const d=jy(n.clientInfo,this.cryptoUtils.base64Decode);s={credential:`${d.uid}${Ep.CLIENT_INFO_SEPARATOR}${d.utid}`,type:Oo.HOME_ACCOUNT_ID}}catch(d){this.logger.verbose("Could not parse client info for CCS Header: "+d)}const l=this.createTokenRequestHeaders(s||n.ccsCredential),c=t0(this.config.authOptions.clientId,n);return ge(this.executePostToTokenEndpoint.bind(this),G.AuthorizationCodeClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,n.correlationId)(i,o,l,c,n.correlationId,G.AuthorizationCodeClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var i,o;(i=this.performanceClient)==null||i.addQueueMeasurement(G.AuthClientCreateTokenRequestBody,e.correlationId);const n=new Map;if(CE(n,e.embeddedClientId||((o=e.tokenBodyParameters)==null?void 0:o[Kc])||this.config.authOptions.clientId),this.includeRedirectUri)AE(n,e.redirectUri);else if(!e.redirectUri)throw mn(o3);if(SE(n,e.scopes,!0,this.oidcDefaultScopes),tte(n,e.code),EE(n,this.config.libraryInfo),NE(n,this.config.telemetry.application),L3(n),this.serverTelemetryManager&&!_3(this.config)&&$3(n,this.serverTelemetryManager),e.codeVerifier&&rte(n,e.codeVerifier),this.config.clientCredentials.clientSecret&&k3(n,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const s=this.config.clientCredentials.clientAssertion;O3(n,await G3(s.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),I3(n,s.assertionType)}if(R3(n,F4.AUTHORIZATION_CODE_GRANT),TE(n),e.authenticationScheme===an.POP){const s=new kd(this.cryptoUtils,this.performanceClient);let l;e.popKid?l=this.cryptoUtils.encodeKid(e.popKid):l=(await ge(s.generateCnf.bind(s),G.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,PE(n,l)}else if(e.authenticationScheme===an.SSH)if(e.sshJwk)D3(n,e.sshJwk);else throw mn(Yb);(!Ss.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&_E(n,e.claims,this.config.authOptions.clientCapabilities);let r;if(e.clientInfo)try{const s=jy(e.clientInfo,this.cryptoUtils.base64Decode);r={credential:`${s.uid}${Ep.CLIENT_INFO_SEPARATOR}${s.utid}`,type:Oo.HOME_ACCOUNT_ID}}catch(s){this.logger.verbose("Could not parse client info for CCS Header: "+s)}else r=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&r)switch(r.type){case Oo.HOME_ACCOUNT_ID:try{const s=rd(r.credential);Uh(n,s)}catch(s){this.logger.verbose("Could not parse home account ID for CCS Header: "+s)}break;case Oo.UPN:Ty(n,r.credential);break}return e.embeddedClientId&&Xb(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenBodyParameters&&vl(n,e.tokenBodyParameters),e.enableSpaAuthorizationCode&&(!e.tokenBodyParameters||!e.tokenBodyParameters[kO])&&vl(n,{[kO]:"1"}),Qb(n,e.correlationId,this.performanceClient),Np(n)}createLogoutUrlQueryString(e){const n=new Map;return e.postLogoutRedirectUri&&Qee(n,e.postLogoutRedirectUri),e.correlationId&&jE(n,e.correlationId),e.idTokenHint&&Xee(n,e.idTokenHint),e.state&&T3(n,e.state),e.logoutHint&&ote(n,e.logoutHint),e.extraQueryParameters&&vl(n,e.extraQueryParameters),this.config.authOptions.instanceAware&&M3(n),Np(n,this.config.authOptions.encodeExtraQueryParams,e.extraQueryParameters)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Nte=300;class Tte extends OE{constructor(e,n){super(e,n)}async acquireToken(e){var s,l;(s=this.performanceClient)==null||s.addQueueMeasurement(G.RefreshTokenClientAcquireToken,e.correlationId);const n=_i(),r=await ge(this.executeTokenRequest.bind(this),G.RefreshTokenClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(e,this.authority),i=(l=r.headers)==null?void 0:l[ei.X_MS_REQUEST_ID],o=new Wc(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return o.validateTokenResponse(r.body),ge(o.handleServerTokenResponse.bind(o),G.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(r.body,this.authority,n,e,void 0,void 0,!0,e.forceCache,i)}async acquireTokenByRefreshToken(e){var r;if(!e)throw mn(c3);if((r=this.performanceClient)==null||r.addQueueMeasurement(G.RefreshTokenClientAcquireTokenByRefreshToken,e.correlationId),!e.account)throw Ae(aE);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await ge(this.acquireTokenWithCachedRefreshToken.bind(this),G.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!0)}catch(i){const o=i instanceof qo&&i.errorCode===ky,s=i instanceof lu&&i.errorCode===AO.INVALID_GRANT_ERROR&&i.subError===AO.CLIENT_MISMATCH_ERROR;if(o||s)return ge(this.acquireTokenWithCachedRefreshToken.bind(this),G.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1);throw i}return ge(this.acquireTokenWithCachedRefreshToken.bind(this),G.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1)}async acquireTokenWithCachedRefreshToken(e,n){var o,s,l;(o=this.performanceClient)==null||o.addQueueMeasurement(G.RefreshTokenClientAcquireTokenWithCachedRefreshToken,e.correlationId);const r=Bi(this.cacheManager.getRefreshToken.bind(this.cacheManager),G.CacheManagerGetRefreshToken,this.logger,this.performanceClient,e.correlationId)(e.account,n,e.correlationId,void 0,this.performanceClient);if(!r)throw Oy(ky);if(r.expiresOn&&Py(r.expiresOn,e.refreshTokenExpirationOffsetSeconds||Nte))throw(s=this.performanceClient)==null||s.addFields({rtExpiresOnMs:Number(r.expiresOn)},e.correlationId),Oy(IE);const i={...e,refreshToken:r.secret,authenticationScheme:e.authenticationScheme||an.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:Oo.HOME_ACCOUNT_ID}};try{return await ge(this.acquireToken.bind(this),G.RefreshTokenClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(i)}catch(c){if(c instanceof qo&&((l=this.performanceClient)==null||l.addFields({rtExpiresOnMs:Number(r.expiresOn)},e.correlationId),c.subError===r0)){this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");const u=this.cacheManager.generateCredentialKey(r);this.cacheManager.removeRefreshToken(u,e.correlationId)}throw c}}async executeTokenRequest(e,n){var c;(c=this.performanceClient)==null||c.addQueueMeasurement(G.RefreshTokenClientExecuteTokenRequest,e.correlationId);const r=this.createTokenQueryParameters(e),i=Kt.appendQueryString(n.tokenEndpoint,r),o=await ge(this.createTokenRequestBody.bind(this),G.RefreshTokenClientCreateTokenRequestBody,this.logger,this.performanceClient,e.correlationId)(e),s=this.createTokenRequestHeaders(e.ccsCredential),l=t0(this.config.authOptions.clientId,e);return ge(this.executePostToTokenEndpoint.bind(this),G.RefreshTokenClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,e.correlationId)(i,o,s,l,e.correlationId,G.RefreshTokenClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var r,i,o;(r=this.performanceClient)==null||r.addQueueMeasurement(G.RefreshTokenClientCreateTokenRequestBody,e.correlationId);const n=new Map;if(CE(n,e.embeddedClientId||((i=e.tokenBodyParameters)==null?void 0:i[Kc])||this.config.authOptions.clientId),e.redirectUri&&AE(n,e.redirectUri),SE(n,e.scopes,!0,(o=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:o.defaultScopes),R3(n,F4.REFRESH_TOKEN_GRANT),TE(n),EE(n,this.config.libraryInfo),NE(n,this.config.telemetry.application),L3(n),this.serverTelemetryManager&&!_3(this.config)&&$3(n,this.serverTelemetryManager),nte(n,e.refreshToken),this.config.clientCredentials.clientSecret&&k3(n,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const s=this.config.clientCredentials.clientAssertion;O3(n,await G3(s.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),I3(n,s.assertionType)}if(e.authenticationScheme===an.POP){const s=new kd(this.cryptoUtils,this.performanceClient);let l;e.popKid?l=this.cryptoUtils.encodeKid(e.popKid):l=(await ge(s.generateCnf.bind(s),G.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,PE(n,l)}else if(e.authenticationScheme===an.SSH)if(e.sshJwk)D3(n,e.sshJwk);else throw mn(Yb);if((!Ss.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&_E(n,e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case Oo.HOME_ACCOUNT_ID:try{const s=rd(e.ccsCredential.credential);Uh(n,s)}catch(s){this.logger.verbose("Could not parse home account ID for CCS Header: "+s)}break;case Oo.UPN:Ty(n,e.ccsCredential.credential);break}return e.embeddedClientId&&Xb(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenBodyParameters&&vl(n,e.tokenBodyParameters),Qb(n,e.correlationId,this.performanceClient),Np(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Pte extends OE{constructor(e,n){super(e,n)}async acquireCachedToken(e){var c;(c=this.performanceClient)==null||c.addQueueMeasurement(G.SilentFlowClientAcquireCachedToken,e.correlationId);let n=ic.NOT_APPLICABLE;if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!Ss.isEmptyObj(e.claims))throw this.setCacheOutcome(ic.FORCE_REFRESH_OR_CLAIMS,e.correlationId),Ae(gl);if(!e.account)throw Ae(aE);const r=e.account.tenantId||xte(e.authority),i=this.cacheManager.getTokenKeys(),o=this.cacheManager.getAccessToken(e.account,e,i,r);if(o){if(fte(o.cachedAt)||Py(o.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome(ic.CACHED_ACCESS_TOKEN_EXPIRED,e.correlationId),Ae(gl);o.refreshOn&&Py(o.refreshOn,0)&&(n=ic.PROACTIVELY_REFRESHED)}else throw this.setCacheOutcome(ic.NO_CACHED_ACCESS_TOKEN,e.correlationId),Ae(gl);const s=e.authority||this.authority.getPreferredCache(),l={account:this.cacheManager.getAccount(this.cacheManager.generateAccountKey(e.account),e.correlationId),accessToken:o,idToken:this.cacheManager.getIdToken(e.account,e.correlationId,i,r,this.performanceClient),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(s)};return this.setCacheOutcome(n,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await ge(this.generateResultFromCacheRecord.bind(this),G.SilentFlowClientGenerateResultFromCacheRecord,this.logger,this.performanceClient,e.correlationId)(l,e),n]}setCacheOutcome(e,n){var r,i;(r=this.serverTelemetryManager)==null||r.setCacheOutcome(e),(i=this.performanceClient)==null||i.addFields({cacheOutcome:e},n),e!==ic.NOT_APPLICABLE&&this.logger.info(`Token refresh is required due to cache outcome: ${e}`)}async generateResultFromCacheRecord(e,n){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(G.SilentFlowClientGenerateResultFromCacheRecord,n.correlationId);let r;if(e.idToken&&(r=wf(e.idToken.secret,this.config.cryptoInterface.base64Decode)),n.maxAge||n.maxAge===0){const o=r==null?void 0:r.auth_time;if(!o)throw Ae(sE);x3(o,n.maxAge)}return Wc.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,n,r)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const kte={sendGetRequestAsync:()=>Promise.reject(Ae(Ft)),sendPostRequestAsync:()=>Promise.reject(Ae(Ft))};/*! @azure/msal-common v15.10.0 2025-08-05 */function Ote(t,e,n,r){var l,c;const i=e.correlationId,o=new Map;CE(o,e.embeddedClientId||((l=e.extraQueryParameters)==null?void 0:l[Kc])||t.clientId);const s=[...e.scopes||[],...e.extraScopesToConsent||[]];if(SE(o,s,!0,(c=t.authority.options.OIDCOptions)==null?void 0:c.defaultScopes),AE(o,e.redirectUri),jE(o,i),qee(o,e.responseMode),TE(o),e.prompt&&(Jee(o,e.prompt),r==null||r.addFields({prompt:e.prompt},i)),e.domainHint&&(Zee(o,e.domainHint),r==null||r.addFields({domainHintFromRequest:!0},i)),e.prompt!==ri.SELECT_ACCOUNT)if(e.sid&&e.prompt===ri.NONE)n.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),OO(o,e.sid),r==null||r.addFields({sidFromRequest:!0},i);else if(e.account){const u=Mte(e.account);let d=Dte(e.account);if(d&&e.domainHint&&(n.warning('AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint'),d=null),d){n.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),Hg(o,d),r==null||r.addFields({loginHintFromClaim:!0},i);try{const f=rd(e.account.homeAccountId);Uh(o,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(u&&e.prompt===ri.NONE){n.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),OO(o,u),r==null||r.addFields({sidFromClaim:!0},i);try{const f=rd(e.account.homeAccountId);Uh(o,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e.loginHint)n.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),Hg(o,e.loginHint),Ty(o,e.loginHint),r==null||r.addFields({loginHintFromRequest:!0},i);else if(e.account.username){n.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),Hg(o,e.account.username),r==null||r.addFields({loginHintFromUpn:!0},i);try{const f=rd(e.account.homeAccountId);Uh(o,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else e.loginHint&&(n.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),Hg(o,e.loginHint),Ty(o,e.loginHint),r==null||r.addFields({loginHintFromRequest:!0},i));else n.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");return e.nonce&&ete(o,e.nonce),e.state&&T3(o,e.state),(e.claims||t.clientCapabilities&&t.clientCapabilities.length>0)&&_E(o,e.claims,t.clientCapabilities),e.embeddedClientId&&Xb(o,t.clientId,t.redirectUri),t.instanceAware&&(!e.extraQueryParameters||!Object.keys(e.extraQueryParameters).includes(A1))&&M3(o),o}function DE(t,e,n,r){const i=Np(e,n,r);return Kt.appendQueryString(t.authorizationEndpoint,i)}function Ite(t,e){if(W3(t,e),!t.code)throw Ae(t3);return t}function W3(t,e){if(!t.state||!e)throw t.state?Ae(y1,"Cached State"):Ae(y1,"Server State");let n,r;try{n=decodeURIComponent(t.state)}catch{throw Ae(Pd,t.state)}try{r=decodeURIComponent(e)}catch{throw Ae(Pd,t.state)}if(n!==r)throw Ae(K4);if(t.error||t.error_description||t.suberror){const i=Rte(t);throw V3(t.error,t.error_description,t.suberror)?new qo(t.error||"",t.error_description,t.suberror,t.timestamp||"",t.trace_id||"",t.correlation_id||"",t.claims||"",i):new lu(t.error||"",t.error_description,t.suberror,i)}}function Rte(t){var r,i;const e="code=",n=(r=t.error_uri)==null?void 0:r.lastIndexOf(e);return n&&n>=0?(i=t.error_uri)==null?void 0:i.substring(n+e.length):void 0}function Mte(t){var e;return((e=t.idTokenClaims)==null?void 0:e.sid)||null}function Dte(t){var e;return t.loginHint||((e=t.idTokenClaims)==null?void 0:e.login_hint)||null}/*! @azure/msal-common v15.10.0 2025-08-05 */const FO=",",q3="|";function $te(t){const{skus:e,libraryName:n,libraryVersion:r,extensionName:i,extensionVersion:o}=t,s=new Map([[0,[n,r]],[2,[i,o]]]);let l=[];if(e!=null&&e.length){if(l=e.split(FO),l.length<4)return e}else l=Array.from({length:4},()=>q3);return s.forEach((c,u)=>{var d,f;c.length===2&&((d=c[0])!=null&&d.length)&&((f=c[1])!=null&&f.length)&&Lte({skuArr:l,index:u,skuName:c[0],skuVersion:c[1]})}),l.join(FO)}function Lte(t){const{skuArr:e,index:n,skuName:r,skuVersion:i}=t;n>=e.length||(e[n]=[r,i].join(q3))}class Tp{constructor(e,n){this.cacheOutcome=ic.NOT_APPLICABLE,this.cacheManager=n,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||ve.EMPTY_STRING,this.wrapperVer=e.wrapperVer||ve.EMPTY_STRING,this.telemetryCacheKey=jr.CACHE_KEY+Ep.CACHE_KEY_SEPARATOR+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${jr.VALUE_SEPARATOR}${this.cacheOutcome}`,n=[this.wrapperSKU,this.wrapperVer],r=this.getNativeBrokerErrorCode();r!=null&&r.length&&n.push(`broker_error=${r}`);const i=n.join(jr.VALUE_SEPARATOR),o=this.getRegionDiscoveryFields(),s=[e,o].join(jr.VALUE_SEPARATOR);return[jr.SCHEMA_VERSION,s,i].join(jr.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),n=Tp.maxErrorsToSend(e),r=e.failedRequests.slice(0,2*n).join(jr.VALUE_SEPARATOR),i=e.errors.slice(0,n).join(jr.VALUE_SEPARATOR),o=e.errors.length,s=n=jr.MAX_CACHED_ERRORS&&(n.failedRequests.shift(),n.failedRequests.shift(),n.errors.shift()),n.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof hn?e.subError?n.errors.push(e.subError):e.errorCode?n.errors.push(e.errorCode):n.errors.push(e.toString()):n.errors.push(e.toString()):n.errors.push(jr.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,n,this.correlationId)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e,this.correlationId),e.cacheHits}getLastRequests(){const e={failedRequests:[],errors:[],cacheHits:0};return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e}clearTelemetryCache(){const e=this.getLastRequests(),n=Tp.maxErrorsToSend(e),r=e.errors.length;if(n===r)this.cacheManager.removeItem(this.telemetryCacheKey,this.correlationId);else{const i={failedRequests:e.failedRequests.slice(n*2),errors:e.errors.slice(n),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,i,this.correlationId)}}static maxErrorsToSend(e){let n,r=0,i=0;const o=e.errors.length;for(n=0;nString.fromCodePoint(n)).join("");return btoa(e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Lo(t){return new TextDecoder().decode(yl(t))}function yl(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw Be(S5)}const n=atob(e);return Uint8Array.from(n,r=>r.codePointAt(0)||0)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Qte="RSASSA-PKCS1-v1_5",Cf="AES-GCM",N5="HKDF",GE="SHA-256",Xte=2048,Zte=new Uint8Array([1,0,1]),zO="0123456789abcdef",VO=new Uint32Array(1),KE="raw",T5="encrypt",WE="decrypt",Jte="deriveKey",ene="crypto_subtle_undefined",qE={name:Qte,hash:GE,modulusLength:Xte,publicExponent:Zte};function tne(t){if(!window)throw Be(s0);if(!window.crypto)throw Be(_1);if(!t&&!window.crypto.subtle)throw Be(_1,ene)}async function P5(t,e,n){e==null||e.addQueueMeasurement(G.Sha256Digest,n);const i=new TextEncoder().encode(t);return window.crypto.subtle.digest(GE,i)}function nne(t){return window.crypto.getRandomValues(t)}function lS(){return window.crypto.getRandomValues(VO),VO[0]}function Yo(){const t=Date.now(),e=lS()*1024+(lS()&1023),n=new Uint8Array(16),r=Math.trunc(e/2**30),i=e&2**30-1,o=lS();n[0]=t/2**40,n[1]=t/2**32,n[2]=t/2**24,n[3]=t/2**16,n[4]=t/2**8,n[5]=t,n[6]=112|r>>>8,n[7]=r,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=o>>>24,n[13]=o>>>16,n[14]=o>>>8,n[15]=o;let s="";for(let l=0;l>>4),s+=zO.charAt(n[l]&15),(l===3||l===5||l===7||l===9)&&(s+="-");return s}async function rne(t,e){return window.crypto.subtle.generateKey(qE,t,e)}async function cS(t){return window.crypto.subtle.exportKey(j5,t)}async function ine(t,e,n){return window.crypto.subtle.importKey(j5,t,qE,e,n)}async function one(t,e){return window.crypto.subtle.sign(qE,t,e)}async function YE(){const t=await k5(),n={alg:"dir",kty:"oct",k:Ol(new Uint8Array(t))};return kp(JSON.stringify(n))}async function sne(t){const e=Lo(t),r=JSON.parse(e).k,i=yl(r);return window.crypto.subtle.importKey(KE,i,Cf,!1,[WE])}async function ane(t,e){const n=e.split(".");if(n.length!==5)throw Be(Pv,"jwe_length");const r=await sne(t).catch(()=>{throw Be(Pv,"import_key")});try{const i=new TextEncoder().encode(n[0]),o=yl(n[2]),s=yl(n[3]),l=yl(n[4]),c=l.byteLength*8,u=new Uint8Array(s.length+l.length);u.set(s),u.set(l,s.length);const d=await window.crypto.subtle.decrypt({name:Cf,iv:o,tagLength:c,additionalData:i},r,u);return new TextDecoder().decode(d)}catch{throw Be(Pv,"decrypt")}}async function k5(){const t=await window.crypto.subtle.generateKey({name:Cf,length:256},!0,[T5,WE]);return window.crypto.subtle.exportKey(KE,t)}async function GO(t){return window.crypto.subtle.importKey(KE,t,N5,!1,[Jte])}async function O5(t,e,n){return window.crypto.subtle.deriveKey({name:N5,salt:e,hash:GE,info:new TextEncoder().encode(n)},t,{name:Cf,length:256},!1,[T5,WE])}async function lne(t,e,n){const r=new TextEncoder().encode(e),i=window.crypto.getRandomValues(new Uint8Array(16)),o=await O5(t,i,n),s=await window.crypto.subtle.encrypt({name:Cf,iv:new Uint8Array(12)},o,r);return{data:Ol(new Uint8Array(s)),nonce:Ol(i)}}async function KO(t,e,n,r){const i=yl(r),o=await O5(t,yl(e),n),s=await window.crypto.subtle.decrypt({name:Cf,iv:new Uint8Array(12)},o,i);return new TextDecoder().decode(s)}async function I5(t){const e=await P5(t),n=new Uint8Array(e);return Ol(n)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Op="storage_not_supported",Zn="stubbed_public_client_application_called",My="in_mem_redirect_unavailable";/*! @azure/msal-browser v4.19.0 2025-08-05 */const kv={[Op]:"Given storage configuration option was not supported.",[Zn]:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors",[My]:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."};kv[Op],kv[Zn],kv[My];class QE extends hn{constructor(e,n){super(e,n),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,QE.prototype)}}function Jn(t){return new QE(t,kv[t])}/*! @azure/msal-browser v4.19.0 2025-08-05 */function R5(t){t.location.hash="",typeof t.history.replaceState=="function"&&t.history.replaceState(null,"",`${t.location.origin}${t.location.pathname}${t.location.search}`)}function cne(t){const e=t.split("#");e.shift(),window.location.hash=e.length>0?e.join("#"):""}function XE(){return window.parent!==window}function une(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(`${gi.POPUP_NAME_PREFIX}.`)===0}function ta(){return typeof window<"u"&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function dne(){const e=new Kt(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}function fne(){if(Kt.hashContainsKnownProperties(window.location.hash)&&XE())throw Be(a5)}function hne(t){if(XE()&&!t)throw Be(s5)}function pne(){if(une())throw Be(l5)}function M5(){if(typeof window>"u")throw Be(s0)}function D5(t){if(!t)throw Be(Bh)}function ZE(t){M5(),fne(),pne(),D5(t)}function WO(t,e){if(ZE(t),hne(e.system.allowRedirectInIframe),e.cache.cacheLocation===pr.MemoryStorage&&!e.cache.storeAuthStateInCookie)throw Jn(My)}function $5(t){const e=document.createElement("link");e.rel="preconnect",e.href=new URL(t).origin,e.crossOrigin="anonymous",document.head.appendChild(e),window.setTimeout(()=>{try{document.head.removeChild(e)}catch{}},1e4)}function mne(){return Yo()}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Dy{navigateInternal(e,n){return Dy.defaultNavigateWindow(e,n)}navigateExternal(e,n){return Dy.defaultNavigateWindow(e,n)}static defaultNavigateWindow(e,n){return n.noHistory?window.location.replace(e):window.location.assign(e),new Promise((r,i)=>{setTimeout(()=>{i(Be(Ry,"failed_to_redirect"))},n.timeout)})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class gne{async sendGetRequestAsync(e,n){let r,i={},o=0;const s=qO(n);try{r=await fetch(e,{method:BO.GET,headers:s})}catch(l){throw Ch(Be(window.navigator.onLine?h5:Iy),void 0,void 0,l)}i=YO(r.headers);try{return o=r.status,{headers:i,body:await r.json(),status:o}}catch(l){throw Ch(Be(j1),o,i,l)}}async sendPostRequestAsync(e,n){const r=n&&n.body||"",i=qO(n);let o,s=0,l={};try{o=await fetch(e,{method:BO.POST,headers:i,body:r})}catch(c){throw Ch(Be(window.navigator.onLine?f5:Iy),void 0,void 0,c)}l=YO(o.headers);try{return s=o.status,{headers:l,body:await o.json(),status:s}}catch(c){throw Ch(Be(j1),s,l,c)}}}function qO(t){try{const e=new Headers;if(!(t&&t.headers))return e;const n=t.headers;return Object.entries(n).forEach(([r,i])=>{e.append(r,i)}),e}catch(e){throw Ch(Be(A5),void 0,void 0,e)}}function YO(t){try{const e={};return t.forEach((n,r)=>{e[r]=n}),e}catch{throw Be(_5)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const vne=6e4,N1=1e4,yne=3e4,L5=2e3;function xne({auth:t,cache:e,system:n,telemetry:r},i){const o={clientId:ve.EMPTY_STRING,authority:`${ve.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:ve.EMPTY_STRING,authorityMetadata:ve.EMPTY_STRING,redirectUri:typeof window<"u"?ta():"",postLogoutRedirectUri:ve.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:Ai.AAD,OIDCOptions:{serverResponseType:qb.FRAGMENT,defaultScopes:[ve.OPENID_SCOPE,ve.PROFILE_SCOPE,ve.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:fE.None,tenant:ve.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1,encodeExtraQueryParams:!1},s={cacheLocation:pr.SessionStorage,cacheRetentionDays:5,temporaryCacheLocation:pr.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!!(e&&e.cacheLocation===pr.LocalStorage),claimsBasedCachingEnabled:!1},l={loggerCallback:()=>{},logLevel:jn.Info,piiLoggingEnabled:!1},u={...{...A3,loggerOptions:l,networkClient:i?new gne:kte,navigationClient:new Dy,loadFrameTimeout:0,windowHashTimeout:(n==null?void 0:n.loadFrameTimeout)||vne,iframeHashTimeout:(n==null?void 0:n.loadFrameTimeout)||N1,navigateFrameWait:0,redirectNavigationTimeout:yne,asyncPopups:!1,allowRedirectInIframe:!1,allowPlatformBroker:!1,nativeBrokerHandshakeTimeout:(n==null?void 0:n.nativeBrokerHandshakeTimeout)||L5,pollIntervalMilliseconds:gi.DEFAULT_POLL_INTERVAL_MS},...n,loggerOptions:(n==null?void 0:n.loggerOptions)||l},d={application:{appName:ve.EMPTY_STRING,appVersion:ve.EMPTY_STRING},client:new C3};if((t==null?void 0:t.protocolMode)!==Ai.OIDC&&(t!=null&&t.OIDCOptions)&&new ya(u.loggerOptions).warning(JSON.stringify(mn(p3))),t!=null&&t.protocolMode&&t.protocolMode===Ai.OIDC&&(u!=null&&u.allowPlatformBroker))throw mn(m3);return{auth:{...o,...t,OIDCOptions:{...o.OIDCOptions,...t==null?void 0:t.OIDCOptions}},cache:{...s,...e},system:u,telemetry:{...d,...r}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const bne="@azure/msal-browser",qc="4.19.0";/*! @azure/msal-browser v4.19.0 2025-08-05 */const vr="msal",JE="browser",uS="-",Da=1,T1=1,wne=`${vr}.${JE}.log.level`,Sne=`${vr}.${JE}.log.pii`,Cne=`${vr}.${JE}.platform.auth.dom`,QO=`${vr}.version`,XO="account.keys",ZO="token.keys";function ss(t=T1){return t<1?`${vr}.${XO}`:`${vr}.${t}.${XO}`}function pc(t,e=Da){return e<1?`${vr}.${ZO}.${t}`:`${vr}.${e}.${ZO}.${t}`}/*! @azure/msal-browser v4.19.0 2025-08-05 */class eN{static loggerCallback(e,n){switch(e){case jn.Error:console.error(n);return;case jn.Info:console.info(n);return;case jn.Verbose:console.debug(n);return;case jn.Warning:console.warn(n);return;default:console.log(n);return}}constructor(e){var c;this.browserEnvironment=typeof window<"u",this.config=xne(e,this.browserEnvironment);let n;try{n=window[pr.SessionStorage]}catch{}const r=n==null?void 0:n.getItem(wne),i=(c=n==null?void 0:n.getItem(Sne))==null?void 0:c.toLowerCase(),o=i==="true"?!0:i==="false"?!1:void 0,s={...this.config.system.loggerOptions},l=r&&Object.keys(jn).includes(r)?jn[r]:void 0;l&&(s.loggerCallback=eN.loggerCallback,s.logLevel=l),o!==void 0&&(s.piiLoggingEnabled=o),this.logger=new ya(s,bne,qc),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Yc extends eN{getModuleName(){return Yc.MODULE_NAME}getId(){return Yc.ID}async initialize(){return this.available=typeof window<"u",this.available}}Yc.MODULE_NAME="";Yc.ID="StandardOperatingContext";/*! @azure/msal-browser v4.19.0 2025-08-05 */class Ane{constructor(){this.dbName=E1,this.version=Wte,this.tableName=qte,this.dbOpen=!1}async open(){return new Promise((e,n)=>{const r=window.indexedDB.open(this.dbName,this.version);r.addEventListener("upgradeneeded",i=>{i.target.result.createObjectStore(this.tableName)}),r.addEventListener("success",i=>{const o=i;this.db=o.target.result,this.dbOpen=!0,e()}),r.addEventListener("error",()=>n(Be(zE)))})}closeConnection(){const e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)}async validateDbIsOpen(){if(!this.dbOpen)return this.open()}async getItem(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(Be(Eu));const s=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);s.addEventListener("success",l=>{const c=l;this.closeConnection(),n(c.target.result)}),s.addEventListener("error",l=>{this.closeConnection(),r(l)})})}async setItem(e,n){return await this.validateDbIsOpen(),new Promise((r,i)=>{if(!this.db)return i(Be(Eu));const l=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(n,e);l.addEventListener("success",()=>{this.closeConnection(),r()}),l.addEventListener("error",c=>{this.closeConnection(),i(c)})})}async removeItem(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(Be(Eu));const s=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);s.addEventListener("success",()=>{this.closeConnection(),n()}),s.addEventListener("error",l=>{this.closeConnection(),r(l)})})}async getKeys(){return await this.validateDbIsOpen(),new Promise((e,n)=>{if(!this.db)return n(Be(Eu));const o=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();o.addEventListener("success",s=>{const l=s;this.closeConnection(),e(l.target.result)}),o.addEventListener("error",s=>{this.closeConnection(),n(s)})})}async containsKey(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(Be(Eu));const s=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);s.addEventListener("success",l=>{const c=l;this.closeConnection(),n(c.target.result===1)}),s.addEventListener("error",l=>{this.closeConnection(),r(l)})})}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise((e,n)=>{const r=window.indexedDB.deleteDatabase(E1),i=setTimeout(()=>n(!1),200);r.addEventListener("success",()=>(clearTimeout(i),e(!0))),r.addEventListener("blocked",()=>(clearTimeout(i),e(!0))),r.addEventListener("error",()=>(clearTimeout(i),n(!1)))})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class a0{constructor(){this.cache=new Map}async initialize(){}getItem(e){return this.cache.get(e)||null}getUserData(e){return this.getItem(e)}setItem(e,n){this.cache.set(e,n)}async setUserData(e,n){this.setItem(e,n)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach((n,r)=>{e.push(r)}),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}decryptData(){return Promise.resolve(null)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class _ne{constructor(e){this.inMemoryCache=new a0,this.indexedDBCache=new Ane,this.logger=e}handleDatabaseAccessError(e){if(e instanceof Ym&&e.errorCode===zE)this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.");else throw e}async getItem(e){const n=this.inMemoryCache.getItem(e);if(!n)try{return this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.getItem(e)}catch(r){this.handleDatabaseAccessError(r)}return n}async setItem(e,n){this.inMemoryCache.setItem(e,n);try{await this.indexedDBCache.setItem(e,n)}catch(r){this.handleDatabaseAccessError(r)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(n){this.handleDatabaseAccessError(n)}}async getKeys(){const e=this.inMemoryCache.getKeys();if(e.length===0)try{return this.logger.verbose("In-memory cache is empty, now querying persistent storage."),await this.indexedDBCache.getKeys()}catch(n){this.handleDatabaseAccessError(n)}return e}async containsKey(e){const n=this.inMemoryCache.containsKey(e);if(!n)try{return this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.containsKey(e)}catch(r){this.handleDatabaseAccessError(r)}return n}clearInMemory(){this.logger.verbose("Deleting in-memory keystore"),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore deleted")}async clearPersistent(){try{this.logger.verbose("Deleting persistent keystore");const e=await this.indexedDBCache.deleteDatabase();return e&&this.logger.verbose("Persistent keystore deleted"),e}catch(e){return this.handleDatabaseAccessError(e),!1}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class xa{constructor(e,n,r){this.logger=e,tne(r??!1),this.cache=new _ne(this.logger),this.performanceClient=n}createNewGuid(){return Yo()}base64Encode(e){return kp(e)}base64Decode(e){return Lo(e)}base64UrlEncode(e){return Gg(e)}encodeKid(e){return this.base64UrlEncode(JSON.stringify({kid:e}))}async getPublicKeyThumbprint(e){var d;const n=(d=this.performanceClient)==null?void 0:d.startMeasurement(G.CryptoOptsGetPublicKeyThumbprint,e.correlationId),r=await rne(xa.EXTRACTABLE,xa.POP_KEY_USAGES),i=await cS(r.publicKey),o={e:i.e,kty:i.kty,n:i.n},s=JO(o),l=await this.hashString(s),c=await cS(r.privateKey),u=await ine(c,!1,["sign"]);return await this.cache.setItem(l,{privateKey:u,publicKey:r.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri}),n&&n.end({success:!0}),l}async removeTokenBindingKey(e){if(await this.cache.removeItem(e),await this.cache.containsKey(e))throw Ae(n3)}async clearKeystore(){this.cache.clearInMemory();try{return await this.cache.clearPersistent(),!0}catch(e){return e instanceof Error?this.logger.error(`Clearing keystore failed with error: ${e.message}`):this.logger.error("Clearing keystore failed with unknown error"),!1}}async signJwt(e,n,r,i){var w;const o=(w=this.performanceClient)==null?void 0:w.startMeasurement(G.CryptoOptsSignJwt,i),s=await this.cache.getItem(n);if(!s)throw Be(HE);const l=await cS(s.publicKey),c=JO(l),u=Gg(JSON.stringify({kid:n})),d=LE.getShrHeaderString({...r==null?void 0:r.header,alg:l.alg,kid:u}),f=Gg(d);e.cnf={jwk:JSON.parse(c)};const h=Gg(JSON.stringify(e)),p=`${f}.${h}`,m=new TextEncoder().encode(p),v=await one(s.privateKey,m),b=Ol(new Uint8Array(v)),x=`${p}.${b}`;return o&&o.end({success:!0}),x}async hashString(e){return I5(e)}}xa.POP_KEY_USAGES=["sign","verify"];xa.EXTRACTABLE=!0;function JO(t){return JSON.stringify(t,Object.keys(t).sort())}/*! @azure/msal-browser v4.19.0 2025-08-05 */const jne=24*60*60*1e3,P1={Lax:"Lax",None:"None"};class F5{initialize(){return Promise.resolve()}getItem(e){const n=`${encodeURIComponent(e)}`,r=document.cookie.split(";");for(let i=0;i{const i=decodeURIComponent(r).trim().split("=");n.push(i[0])}),n}containsKey(e){return this.getKeys().includes(e)}decryptData(){return Promise.resolve(null)}}function Ene(t){const e=new Date;return new Date(e.getTime()+t*jne).toUTCString()}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Hh(t,e){const n=t.getItem(ss(e));return n?JSON.parse(n):[]}function zh(t,e,n){const r=e.getItem(pc(t,n));if(r){const i=JSON.parse(r);if(i&&i.hasOwnProperty("idToken")&&i.hasOwnProperty("accessToken")&&i.hasOwnProperty("refreshToken"))return i}return{idToken:[],accessToken:[],refreshToken:[]}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function k1(t){return t.hasOwnProperty("id")&&t.hasOwnProperty("nonce")&&t.hasOwnProperty("data")}/*! @azure/msal-browser v4.19.0 2025-08-05 */const eI="msal.cache.encryption",Nne="msal.broadcast.cache";class Tne{constructor(e,n,r){if(!window.localStorage)throw Jn(Op);this.memoryStorage=new a0,this.initialized=!1,this.clientId=e,this.logger=n,this.performanceClient=r,this.broadcast=new BroadcastChannel(Nne)}async initialize(e){const n=new F5,r=n.getItem(eI);let i={key:"",id:""};if(r)try{i=JSON.parse(r)}catch{}if(i.key&&i.id){const o=Bi(yl,G.Base64Decode,this.logger,this.performanceClient,e)(i.key);this.encryptionCookie={id:i.id,key:await ge(GO,G.GenerateHKDF,this.logger,this.performanceClient,e)(o)}}else{const o=Yo(),s=await ge(k5,G.GenerateBaseKey,this.logger,this.performanceClient,e)(),l=Bi(Ol,G.UrlEncodeArr,this.logger,this.performanceClient,e)(new Uint8Array(s));this.encryptionCookie={id:o,key:await ge(GO,G.GenerateHKDF,this.logger,this.performanceClient,e)(s)};const c={id:o,key:l};n.setItem(eI,JSON.stringify(c),0,!0,P1.None)}await ge(this.importExistingCache.bind(this),G.ImportExistingCache,this.logger,this.performanceClient,e)(e),this.broadcast.addEventListener("message",this.updateCache.bind(this)),this.initialized=!0}getItem(e){return window.localStorage.getItem(e)}getUserData(e){if(!this.initialized)throw Be(Bh);return this.memoryStorage.getItem(e)}async decryptData(e,n,r){if(!this.initialized||!this.encryptionCookie)throw Be(Bh);if(n.id!==this.encryptionCookie.id)return this.performanceClient.incrementFields({encryptedCacheExpiredCount:1},r),null;const i=await ge(KO,G.Decrypt,this.logger,this.performanceClient,r)(this.encryptionCookie.key,n.nonce,this.getContext(e),n.data);if(!i)return null;try{return JSON.parse(i)}catch{return this.performanceClient.incrementFields({encryptedCacheCorruptionCount:1},r),null}}setItem(e,n){window.localStorage.setItem(e,n)}async setUserData(e,n,r,i){if(!this.initialized||!this.encryptionCookie)throw Be(Bh);const{data:o,nonce:s}=await ge(lne,G.Encrypt,this.logger,this.performanceClient,r)(this.encryptionCookie.key,n,this.getContext(e)),l={id:this.encryptionCookie.id,nonce:s,data:o,lastUpdatedAt:i};this.memoryStorage.setItem(e,n),this.setItem(e,JSON.stringify(l)),this.broadcast.postMessage({key:e,value:n,context:this.getContext(e)})}removeItem(e){this.memoryStorage.containsKey(e)&&(this.memoryStorage.removeItem(e),this.broadcast.postMessage({key:e,value:null,context:this.getContext(e)})),window.localStorage.removeItem(e)}getKeys(){return Object.keys(window.localStorage)}containsKey(e){return window.localStorage.hasOwnProperty(e)}clear(){this.memoryStorage.clear(),Hh(this).forEach(r=>this.removeItem(r));const n=zh(this.clientId,this);n.idToken.forEach(r=>this.removeItem(r)),n.accessToken.forEach(r=>this.removeItem(r)),n.refreshToken.forEach(r=>this.removeItem(r)),this.getKeys().forEach(r=>{(r.startsWith(vr)||r.indexOf(this.clientId)!==-1)&&this.removeItem(r)})}async importExistingCache(e){if(!this.encryptionCookie)return;let n=Hh(this);n=await this.importArray(n,e),n.length?this.setItem(ss(),JSON.stringify(n)):this.removeItem(ss());const r=zh(this.clientId,this);r.idToken=await this.importArray(r.idToken,e),r.accessToken=await this.importArray(r.accessToken,e),r.refreshToken=await this.importArray(r.refreshToken,e),r.idToken.length||r.accessToken.length||r.refreshToken.length?this.setItem(pc(this.clientId),JSON.stringify(r)):this.removeItem(pc(this.clientId))}async getItemFromEncryptedCache(e,n){if(!this.encryptionCookie)return null;const r=this.getItem(e);if(!r)return null;let i;try{i=JSON.parse(r)}catch{return null}return k1(i)?i.id!==this.encryptionCookie.id?(this.performanceClient.incrementFields({encryptedCacheExpiredCount:1},n),null):ge(KO,G.Decrypt,this.logger,this.performanceClient,n)(this.encryptionCookie.key,i.nonce,this.getContext(e),i.data):(this.performanceClient.incrementFields({unencryptedCacheCount:1},n),i)}async importArray(e,n){const r=[],i=[];return e.forEach(o=>{const s=this.getItemFromEncryptedCache(o,n).then(l=>{l?(this.memoryStorage.setItem(o,l),r.push(o)):this.removeItem(o)});i.push(s)}),await Promise.all(i),r}getContext(e){let n="";return e.includes(this.clientId)&&(n=this.clientId),n}updateCache(e){this.logger.trace("Updating internal cache from broadcast event");const n=this.performanceClient.startMeasurement(G.LocalStorageUpdated);n.add({isBackground:!0});const{key:r,value:i,context:o}=e.data;if(!r){this.logger.error("Broadcast event missing key"),n.end({success:!1,errorCode:"noKey"});return}if(o&&o!==this.clientId){this.logger.trace(`Ignoring broadcast event from clientId: ${o}`),n.end({success:!1,errorCode:"contextMismatch"});return}i?(this.memoryStorage.setItem(r,i),this.logger.verbose("Updated item in internal cache")):(this.memoryStorage.removeItem(r),this.logger.verbose("Removed item from internal cache")),n.end({success:!0})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Pne{constructor(){if(!window.sessionStorage)throw Jn(Op)}async initialize(){}getItem(e){return window.sessionStorage.getItem(e)}getUserData(e){return this.getItem(e)}setItem(e,n){window.sessionStorage.setItem(e,n)}async setUserData(e,n){this.setItem(e,n)}removeItem(e){window.sessionStorage.removeItem(e)}getKeys(){return Object.keys(window.sessionStorage)}containsKey(e){return window.sessionStorage.hasOwnProperty(e)}decryptData(){return Promise.resolve(null)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Ve={INITIALIZE_START:"msal:initializeStart",INITIALIZE_END:"msal:initializeEnd",ACCOUNT_ADDED:"msal:accountAdded",ACCOUNT_REMOVED:"msal:accountRemoved",ACTIVE_ACCOUNT_CHANGED:"msal:activeAccountChanged",LOGIN_START:"msal:loginStart",LOGIN_SUCCESS:"msal:loginSuccess",LOGIN_FAILURE:"msal:loginFailure",ACQUIRE_TOKEN_START:"msal:acquireTokenStart",ACQUIRE_TOKEN_SUCCESS:"msal:acquireTokenSuccess",ACQUIRE_TOKEN_FAILURE:"msal:acquireTokenFailure",ACQUIRE_TOKEN_NETWORK_START:"msal:acquireTokenFromNetworkStart",SSO_SILENT_START:"msal:ssoSilentStart",SSO_SILENT_SUCCESS:"msal:ssoSilentSuccess",SSO_SILENT_FAILURE:"msal:ssoSilentFailure",ACQUIRE_TOKEN_BY_CODE_START:"msal:acquireTokenByCodeStart",ACQUIRE_TOKEN_BY_CODE_SUCCESS:"msal:acquireTokenByCodeSuccess",ACQUIRE_TOKEN_BY_CODE_FAILURE:"msal:acquireTokenByCodeFailure",HANDLE_REDIRECT_START:"msal:handleRedirectStart",HANDLE_REDIRECT_END:"msal:handleRedirectEnd",POPUP_OPENED:"msal:popupOpened",LOGOUT_START:"msal:logoutStart",LOGOUT_SUCCESS:"msal:logoutSuccess",LOGOUT_FAILURE:"msal:logoutFailure",LOGOUT_END:"msal:logoutEnd",RESTORE_FROM_BFCACHE:"msal:restoreFromBFCache",BROKER_CONNECTION_ESTABLISHED:"msal:brokerConnectionEstablished"};/*! @azure/msal-browser v4.19.0 2025-08-05 */function tI(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class O1 extends C1{constructor(e,n,r,i,o,s,l){super(e,r,i,o,l),this.cacheConfig=n,this.logger=i,this.internalStorage=new a0,this.browserStorage=nI(e,n.cacheLocation,i,o),this.temporaryCacheStorage=nI(e,n.temporaryCacheLocation,i,o),this.cookieStorage=new F5,this.eventHandler=s}async initialize(e){this.performanceClient.addFields({cacheLocation:this.cacheConfig.cacheLocation,cacheRetentionDays:this.cacheConfig.cacheRetentionDays},e),await this.browserStorage.initialize(e),await this.migrateExistingCache(e),this.trackVersionChanges(e)}async migrateExistingCache(e){const n=Hh(this.browserStorage,0),r=zh(this.clientId,this.browserStorage,0);this.performanceClient.addFields({oldAccountCount:n.length,oldAccessCount:r.accessToken.length,oldIdCount:r.idToken.length,oldRefreshCount:r.refreshToken.length},e);const i=Hh(this.browserStorage,1),o=zh(this.clientId,this.browserStorage,1);this.performanceClient.addFields({currAccountCount:i.length,currAccessCount:o.accessToken.length,currIdCount:o.idToken.length,currRefreshCount:o.refreshToken.length},e),await Promise.all([this.updateV0ToCurrent(T1,n,i,e),this.updateV0ToCurrent(Da,r.idToken,o.idToken,e),this.updateV0ToCurrent(Da,r.accessToken,o.accessToken,e),this.updateV0ToCurrent(Da,r.refreshToken,o.refreshToken,e)]),n.length>0?this.browserStorage.setItem(ss(0),JSON.stringify(n)):this.browserStorage.removeItem(ss(0)),i.length>0?this.browserStorage.setItem(ss(1),JSON.stringify(i)):this.browserStorage.removeItem(ss(1)),this.setTokenKeys(r,e,0),this.setTokenKeys(o,e,1)}async updateV0ToCurrent(e,n,r,i){const o=[];for(const s of[...n]){const l=this.browserStorage.getItem(s),c=this.validateAndParseJson(l||"");if(!c){tI(n,s);continue}c.lastUpdatedAt||(c.lastUpdatedAt=Date.now().toString(),this.setItem(s,JSON.stringify(c),i));const u=k1(c)?await this.browserStorage.decryptData(s,c,i):c;let d;if(u&&(RO(u)||MO(u))&&(d=u.expiresOn),!u||dte(c.lastUpdatedAt,this.cacheConfig.cacheRetentionDays)||d&&Py(d,U4)){this.browserStorage.removeItem(s),tI(n,s),this.performanceClient.incrementFields({expiredCacheRemovedCount:1},i);continue}if(this.cacheConfig.cacheLocation!==pr.LocalStorage||k1(c)){const f=`${vr}.${e}${uS}${s}`,h=this.browserStorage.getItem(f);if(h){const p=this.validateAndParseJson(h);if(Number(c.lastUpdatedAt)>Number(p.lastUpdatedAt)){o.push(this.setUserData(f,JSON.stringify(u),i,c.lastUpdatedAt).then(()=>{this.performanceClient.incrementFields({updatedCacheFromV0Count:1},i)}));continue}}else{o.push(this.setUserData(f,JSON.stringify(u),i,c.lastUpdatedAt).then(()=>{r.push(f),this.performanceClient.incrementFields({upgradedCacheCount:1},i)}));continue}}}return Promise.all(o)}trackVersionChanges(e){const n=this.browserStorage.getItem(QO);n&&(this.logger.info(`MSAL.js was last initialized by version: ${n}`),this.performanceClient.addFields({previousLibraryVersion:n},e)),n!==qc&&this.setItem(QO,qc,e)}validateAndParseJson(e){if(!e)return null;try{const n=JSON.parse(e);return n&&typeof n=="object"?n:null}catch{return null}}setItem(e,n,r){let i=0,o=[];const s=20;for(let l=0;l<=s;l++)try{this.browserStorage.setItem(e,n),l>0&&(l<=i?this.removeAccessTokenKeys(o.slice(0,l),r,0):(this.removeAccessTokenKeys(o.slice(0,i),r,0),this.removeAccessTokenKeys(o.slice(i,l),r)));break}catch(c){const u=S1(c);if(u.errorCode===_y&&l0&&(c<=o?this.removeAccessTokenKeys(s.slice(0,c),r,0):(this.removeAccessTokenKeys(s.slice(0,o),r,0),this.removeAccessTokenKeys(s.slice(o,c),r)));break}catch(u){const d=S1(u);if(d.errorCode===_y&&c-1){if(r.splice(i,1),r.length===0){this.removeItem(ss());return}else this.setItem(ss(),JSON.stringify(r),n);this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")}else this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}removeAccount(e,n){const r=this.getActiveAccount(n);(r==null?void 0:r.homeAccountId)===e.homeAccountId&&(r==null?void 0:r.environment)===e.environment&&this.setActiveAccount(null,n),super.removeAccount(e,n),this.removeAccountKeyFromMap(this.generateAccountKey(e),n),this.browserStorage.getKeys().forEach(i=>{i.includes(e.homeAccountId)&&i.includes(e.environment)&&this.browserStorage.removeItem(i)}),this.cacheConfig.cacheLocation===pr.LocalStorage&&this.eventHandler.emitEvent(Ve.ACCOUNT_REMOVED,void 0,e)}removeIdToken(e,n){super.removeIdToken(e,n);const r=this.getTokenKeys(),i=r.idToken.indexOf(e);i>-1&&(this.logger.info("idToken removed from tokenKeys map"),r.idToken.splice(i,1),this.setTokenKeys(r,n))}removeAccessToken(e,n,r=!0){super.removeAccessToken(e,n),r&&this.removeAccessTokenKeys([e],n)}removeAccessTokenKeys(e,n,r=Da){this.logger.trace("removeAccessTokenKey called");const i=this.getTokenKeys(r);let o=0;if(e.forEach(s=>{const l=i.accessToken.indexOf(s);l>-1&&(i.accessToken.splice(l,1),o++)}),o>0){this.logger.info(`removed ${o} accessToken keys from tokenKeys map`),this.setTokenKeys(i,n,r);return}}removeRefreshToken(e,n){super.removeRefreshToken(e,n);const r=this.getTokenKeys(),i=r.refreshToken.indexOf(e);i>-1&&(this.logger.info("refreshToken removed from tokenKeys map"),r.refreshToken.splice(i,1),this.setTokenKeys(r,n))}getTokenKeys(e=Da){return zh(this.clientId,this.browserStorage,e)}setTokenKeys(e,n,r=Da){if(e.idToken.length===0&&e.accessToken.length===0&&e.refreshToken.length===0){this.removeItem(pc(this.clientId,r));return}else this.setItem(pc(this.clientId,r),JSON.stringify(e),n)}getIdTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeIdToken(e,n),null;const i=this.validateAndParseJson(r);return!i||!hte(i)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),i)}async setIdTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const o=this.getTokenKeys();o.idToken.indexOf(r)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),o.idToken.push(r),this.setTokenKeys(o,n))}getAccessTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeAccessTokenKeys([e],n),null;const i=this.validateAndParseJson(r);return!i||!RO(i)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),i)}async setAccessTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const o=this.getTokenKeys(),s=o.accessToken.indexOf(r);s!==-1&&o.accessToken.splice(s,1),this.logger.trace(`access token ${s===-1?"added to":"updated in"} map`),o.accessToken.push(r),this.setTokenKeys(o,n)}getRefreshTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeRefreshToken(e,n),null;const i=this.validateAndParseJson(r);return!i||!MO(i)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),i)}async setRefreshTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const o=this.getTokenKeys();o.refreshToken.indexOf(r)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),o.refreshToken.push(r),this.setTokenKeys(o,n))}getAppMetadata(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!vte(e,r)?(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),r)}setAppMetadata(e,n){this.logger.trace("BrowserCacheManager.setAppMetadata called");const r=gte(e);this.setItem(r,JSON.stringify(e),n)}getServerTelemetry(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!pte(e,r)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),r)}setServerTelemetry(e,n,r){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(n),r)}getAuthorityMetadata(e){const n=this.internalStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(n);return r&&yte(e,r)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),r):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter(n=>this.isAuthorityMetadata(n))}setWrapperMetadata(e,n){this.internalStorage.setItem(Vg.WRAPPER_SKU,e),this.internalStorage.setItem(Vg.WRAPPER_VER,n)}getWrapperMetadata(){const e=this.internalStorage.getItem(Vg.WRAPPER_SKU)||ve.EMPTY_STRING,n=this.internalStorage.getItem(Vg.WRAPPER_VER)||ve.EMPTY_STRING;return[e,n]}setAuthorityMetadata(e,n){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(n))}getActiveAccount(e){const n=this.generateCacheKey(CO.ACTIVE_ACCOUNT_FILTERS),r=this.browserStorage.getItem(n);if(!r)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters found"),null;const i=this.validateAndParseJson(r);return i?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoFilteredBy({homeAccountId:i.homeAccountId,localAccountId:i.localAccountId,tenantId:i.tenantId},e)):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e,n){const r=this.generateCacheKey(CO.ACTIVE_ACCOUNT_FILTERS);if(e){this.logger.verbose("setActiveAccount: Active account set");const i={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId,lastUpdatedAt:_i().toString()};this.setItem(r,JSON.stringify(i),n)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(r);this.eventHandler.emitEvent(Ve.ACTIVE_ACCOUNT_CHANGED)}getThrottlingCache(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!mte(e,r)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),r)}setThrottlingCache(e,n,r){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(n),r)}getTemporaryCache(e,n){const r=n?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){const o=this.cookieStorage.getItem(r);if(o)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),o}const i=this.temporaryCacheStorage.getItem(r);if(!i){if(this.cacheConfig.cacheLocation===pr.LocalStorage){const o=this.browserStorage.getItem(r);if(o)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),o}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),i}setTemporaryCache(e,n,r){const i=r?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(i,n),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.cookieStorage.setItem(i,n,void 0,this.cacheConfig.secureCookies))}removeItem(e){this.browserStorage.removeItem(e)}removeTemporaryItem(e){this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.cookieStorage.removeItem(e))}getKeys(){return this.browserStorage.getKeys()}clear(e){this.removeAllAccounts(e),this.removeAppMetadata(e),this.temporaryCacheStorage.getKeys().forEach(n=>{(n.indexOf(vr)!==-1||n.indexOf(this.clientId)!==-1)&&this.removeTemporaryItem(n)}),this.browserStorage.getKeys().forEach(n=>{(n.indexOf(vr)!==-1||n.indexOf(this.clientId)!==-1)&&this.browserStorage.removeItem(n)}),this.internalStorage.clear()}clearTokensAndKeysWithClaims(e){this.performanceClient.addQueueMeasurement(G.ClearTokensAndKeysWithClaims,e);const n=this.getTokenKeys();let r=0;n.accessToken.forEach(i=>{const o=this.getAccessTokenCredential(i,e);o!=null&&o.requestedClaimsHash&&i.includes(o.requestedClaimsHash.toLowerCase())&&(this.removeAccessToken(i,e),r++)}),r>0&&this.logger.warning(`${r} access tokens with claims in the cache keys have been removed from the cache.`)}generateCacheKey(e){return Ss.startsWith(e,vr)?e:`${vr}.${this.clientId}.${e}`}generateCredentialKey(e){const n=e.credentialType===Pr.REFRESH_TOKEN&&e.familyId||e.clientId,r=e.tokenType&&e.tokenType.toLowerCase()!==an.BEARER.toLowerCase()?e.tokenType.toLowerCase():"";return[`${vr}.${Da}`,e.homeAccountId,e.environment,e.credentialType,n,e.realm||"",e.target||"",e.requestedClaimsHash||"",r].join(uS).toLowerCase()}generateAccountKey(e){const n=e.homeAccountId.split(".")[1];return[`${vr}.${T1}`,e.homeAccountId,e.environment,n||e.tenantId||""].join(uS).toLowerCase()}resetRequestCache(){this.logger.trace("BrowserCacheManager.resetRequestCache called"),this.removeTemporaryItem(this.generateCacheKey(tr.REQUEST_PARAMS)),this.removeTemporaryItem(this.generateCacheKey(tr.VERIFIER)),this.removeTemporaryItem(this.generateCacheKey(tr.ORIGIN_URI)),this.removeTemporaryItem(this.generateCacheKey(tr.URL_HASH)),this.removeTemporaryItem(this.generateCacheKey(tr.NATIVE_REQUEST)),this.setInteractionInProgress(!1)}cacheAuthorizeRequest(e,n){this.logger.trace("BrowserCacheManager.cacheAuthorizeRequest called");const r=kp(JSON.stringify(e));if(this.setTemporaryCache(tr.REQUEST_PARAMS,r,!0),n){const i=kp(n);this.setTemporaryCache(tr.VERIFIER,i,!0)}}getCachedRequest(){this.logger.trace("BrowserCacheManager.getCachedRequest called");const e=this.getTemporaryCache(tr.REQUEST_PARAMS,!0);if(!e)throw Be(u5);const n=this.getTemporaryCache(tr.VERIFIER,!0);let r,i="";try{r=JSON.parse(Lo(e)),n&&(i=Lo(n))}catch(o){throw this.logger.errorPii(`Attempted to parse: ${e}`),this.logger.error(`Parsing cached token request threw with error: ${o}`),Be(d5)}return[r,i]}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache(tr.NATIVE_REQUEST,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;const n=this.validateAndParseJson(e);return n||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){var r;const n=(r=this.getInteractionInProgress())==null?void 0:r.clientId;return e?n===this.clientId:!!n}getInteractionInProgress(){const e=`${vr}.${tr.INTERACTION_STATUS_KEY}`,n=this.getTemporaryCache(e,!1);try{return n?JSON.parse(n):null}catch{return this.logger.error("Cannot parse interaction status. Removing temporary cache items and clearing url hash. Retrying interaction should fix the error"),this.removeTemporaryItem(e),this.resetRequestCache(),R5(window),null}}setInteractionInProgress(e,n=Ga.SIGNIN){var i;const r=`${vr}.${tr.INTERACTION_STATUS_KEY}`;if(e){if(this.getInteractionInProgress())throw Be(n5);this.setTemporaryCache(r,JSON.stringify({clientId:this.clientId,type:n}),!1)}else!e&&((i=this.getInteractionInProgress())==null?void 0:i.clientId)===this.clientId&&this.removeTemporaryItem(r)}async hydrateCache(e,n){var l,c,u;const r=Jb((l=e.account)==null?void 0:l.homeAccountId,(c=e.account)==null?void 0:c.environment,e.idToken,this.clientId,e.tenantId);let i;n.claims&&(i=await this.cryptoImpl.hashString(n.claims));const o=e0((u=e.account)==null?void 0:u.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?IO(e.expiresOn):0,e.extExpiresOn?IO(e.extExpiresOn):0,Lo,void 0,e.tokenType,void 0,n.sshKid,n.claims,i),s={idToken:r,accessToken:o};return this.saveCacheRecord(s,e.correlationId)}async saveCacheRecord(e,n,r){try{await super.saveCacheRecord(e,n,r)}catch(i){if(i instanceof nd&&this.performanceClient&&n)try{const o=this.getTokenKeys();this.performanceClient.addFields({cacheRtCount:o.refreshToken.length,cacheIdCount:o.idToken.length,cacheAtCount:o.accessToken.length},n)}catch{}throw i}}}function nI(t,e,n,r){try{switch(e){case pr.LocalStorage:return new Tne(t,n,r);case pr.SessionStorage:return new Pne;case pr.MemoryStorage:default:break}}catch(i){n.error(i)}return new a0}const kne=(t,e,n,r)=>{const i={cacheLocation:pr.MemoryStorage,cacheRetentionDays:5,temporaryCacheLocation:pr.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};return new O1(t,i,Sy,e,n,r)};/*! @azure/msal-browser v4.19.0 2025-08-05 */function One(t,e,n,r,i){return t.verbose("getAllAccounts called"),n?e.getAllAccounts(i||{},r):[]}function Ine(t,e,n,r){if(e.trace("getAccount called"),Object.keys(t).length===0)return e.warning("getAccount: No accountFilter provided"),null;const i=n.getAccountInfoFilteredBy(t,r);return i?(e.verbose("getAccount: Account matching provided filter found, returning"),i):(e.verbose("getAccount: No matching account found, returning null"),null)}function Rne(t,e,n,r){if(e.trace("getAccountByUsername called"),!t)return e.warning("getAccountByUsername: No username provided"),null;const i=n.getAccountInfoFilteredBy({username:t},r);return i?(e.verbose("getAccountByUsername: Account matching username found, returning"),e.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${t}`),i):(e.verbose("getAccountByUsername: No matching account found, returning null"),null)}function Mne(t,e,n,r){if(e.trace("getAccountByHomeId called"),!t)return e.warning("getAccountByHomeId: No homeAccountId provided"),null;const i=n.getAccountInfoFilteredBy({homeAccountId:t},r);return i?(e.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),e.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${t}`),i):(e.verbose("getAccountByHomeId: No matching account found, returning null"),null)}function Dne(t,e,n,r){if(e.trace("getAccountByLocalId called"),!t)return e.warning("getAccountByLocalId: No localAccountId provided"),null;const i=n.getAccountInfoFilteredBy({localAccountId:t},r);return i?(e.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),e.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${t}`),i):(e.verbose("getAccountByLocalId: No matching account found, returning null"),null)}function $ne(t,e,n){e.setActiveAccount(t,n)}function Lne(t,e){return t.getActiveAccount(e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Fne="msal.broadcast.event";class Une{constructor(e){this.eventCallbacks=new Map,this.logger=e||new ya({}),typeof BroadcastChannel<"u"&&(this.broadcastChannel=new BroadcastChannel(Fne)),this.invokeCrossTabCallbacks=this.invokeCrossTabCallbacks.bind(this)}addEventCallback(e,n,r){if(typeof window<"u"){const i=r||mne();return this.eventCallbacks.has(i)?(this.logger.error(`Event callback with id: ${i} is already registered. Please provide a unique id or remove the existing callback and try again.`),null):(this.eventCallbacks.set(i,[e,n||[]]),this.logger.verbose(`Event callback registered with id: ${i}`),i)}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}emitEvent(e,n,r,i){var s;const o={eventType:e,interactionType:n||null,payload:r||null,error:i||null,timestamp:Date.now()};switch(e){case Ve.ACCOUNT_ADDED:case Ve.ACCOUNT_REMOVED:case Ve.ACTIVE_ACCOUNT_CHANGED:(s=this.broadcastChannel)==null||s.postMessage(o);break;default:this.invokeCallbacks(o);break}}invokeCallbacks(e){this.eventCallbacks.forEach(([n,r],i)=>{(r.length===0||r.includes(e.eventType))&&(this.logger.verbose(`Emitting event to callback ${i}: ${e.eventType}`),n.apply(null,[e]))})}invokeCrossTabCallbacks(e){const n=e.data;this.invokeCallbacks(n)}subscribeCrossTab(){var e;(e=this.broadcastChannel)==null||e.addEventListener("message",this.invokeCrossTabCallbacks)}unsubscribeCrossTab(){var e;(e=this.broadcastChannel)==null||e.removeEventListener("message",this.invokeCrossTabCallbacks)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class U5{constructor(e,n,r,i,o,s,l,c,u){this.config=e,this.browserStorage=n,this.browserCrypto=r,this.networkClient=this.config.system.networkClient,this.eventHandler=o,this.navigationClient=s,this.platformAuthProvider=c,this.correlationId=u||Yo(),this.logger=i.clone(gi.MSAL_SKU,qc,this.correlationId),this.performanceClient=l}async clearCacheOnLogout(e,n){if(n)try{this.browserStorage.removeAccount(n,e),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.")}catch{this.logger.error("Account provided in logout request was not found. Local cache unchanged.")}else try{this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),this.browserStorage.clear(e),await this.browserCrypto.clearKeystore()}catch{this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.")}}getRedirectUri(e){this.logger.verbose("getRedirectUri called");const n=e||this.config.auth.redirectUri;return Kt.getAbsoluteUrl(n,ta())}initializeServerTelemetryManager(e,n){this.logger.verbose("initializeServerTelemetryManager called");const r={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:n||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new Tp(r,this.browserStorage)}async getDiscoveredAuthority(e){const{account:n}=e,r=e.requestExtraQueryParameters&&e.requestExtraQueryParameters.hasOwnProperty("instance_aware")?e.requestExtraQueryParameters.instance_aware:void 0;this.performanceClient.addQueueMeasurement(G.StandardInteractionClientGetDiscoveredAuthority,this.correlationId);const i={protocolMode:this.config.auth.protocolMode,OIDCOptions:this.config.auth.OIDCOptions,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},o=e.requestAuthority||this.config.auth.authority,s=r!=null&&r.length?r==="true":this.config.auth.instanceAware,l=n&&s?this.config.auth.authority.replace(Kt.getDomainFromUrl(o),n.environment):o,c=Hr.generateAuthority(l,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),u=await ge(B3,G.AuthorityFactoryCreateDiscoveredInstance,this.logger,this.performanceClient,this.correlationId)(c,this.config.system.networkClient,this.browserStorage,i,this.logger,this.correlationId,this.performanceClient);if(n&&!u.isAlias(n.environment))throw mn(g3);return u}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function tN(t,e,n,r){n.addQueueMeasurement(G.InitializeBaseRequest,t.correlationId);const i=t.authority||e.auth.authority,o=[...t&&t.scopes||[]],s={...t,correlationId:t.correlationId,authority:i,scopes:o};if(!s.authenticationScheme)s.authenticationScheme=an.BEARER,r.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(s.authenticationScheme===an.SSH){if(!t.sshJwk)throw mn(Yb);if(!t.sshKid)throw mn(h3)}r.verbose(`Authentication Scheme set to "${s.authenticationScheme}" as configured in Auth request`)}return e.cache.claimsBasedCachingEnabled&&t.claims&&!Ss.isEmptyObj(t.claims)&&(s.requestedClaimsHash=await I5(t.claims)),s}async function Bne(t,e,n,r,i){r.addQueueMeasurement(G.InitializeSilentRequest,t.correlationId);const o=await ge(tN,G.InitializeBaseRequest,i,r,t.correlationId)(t,n,r,i);return{...t,...o,account:e,forceRefresh:t.forceRefresh||!1}}function B5(t,e){let n;const r=t.httpMethod;if(e===Ai.EAR){if(n=r||hc.POST,n!==hc.POST)throw mn(v3)}else n=r||hc.GET;if(t.authorizePostBodyParameters&&n!==hc.POST)throw mn(y3);return n}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Af extends U5{initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e==null?void 0:e.correlationId);const n={correlationId:this.correlationId||Yo(),...e};if(e)if(e.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(e.account){const r=this.getLogoutHintFromIdTokenClaims(e.account);r&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),n.logoutHint=r)}else this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");else this.logger.verbose("logoutHint will not be set since no logout request was configured");return!e||e.postLogoutRedirectUri!==null?e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",n.correlationId),n.postLogoutRedirectUri=Kt.getAbsoluteUrl(e.postLogoutRedirectUri,ta())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",n.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",n.correlationId),n.postLogoutRedirectUri=Kt.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,ta())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",n.correlationId),n.postLogoutRedirectUri=Kt.getAbsoluteUrl(ta(),ta())):this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",n.correlationId),n}getLogoutHintFromIdTokenClaims(e){const n=e.idTokenClaims;if(n){if(n.login_hint)return n.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null}async createAuthCodeClient(e){this.performanceClient.addQueueMeasurement(G.StandardInteractionClientCreateAuthCodeClient,this.correlationId);const n=await ge(this.getClientConfiguration.bind(this),G.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)(e);return new K3(n,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:n,requestAuthority:r,requestAzureCloudOptions:i,requestExtraQueryParameters:o,account:s}=e;this.performanceClient.addQueueMeasurement(G.StandardInteractionClientGetClientConfiguration,this.correlationId);const l=await ge(this.getDiscoveredAuthority.bind(this),G.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,this.correlationId)({requestAuthority:r,requestAzureCloudOptions:i,requestExtraQueryParameters:o,account:s}),c=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:l,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:c.loggerCallback,piiLoggingEnabled:c.piiLoggingEnabled,logLevel:c.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:n,libraryInfo:{sku:gi.MSAL_SKU,version:qc,cpu:ve.EMPTY_STRING,os:ve.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,n){this.performanceClient.addQueueMeasurement(G.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId);const r=this.getRedirectUri(e.redirectUri),i={interactionType:n},o=Sf.setRequestState(this.browserCrypto,e&&e.state||ve.EMPTY_STRING,i),l={...await ge(tN,G.InitializeBaseRequest,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:r,state:o,nonce:e.nonce||Yo(),responseMode:this.config.auth.OIDCOptions.serverResponseType},c={...l,httpMethod:B5(l,this.config.auth.protocolMode)};if(e.loginHint||e.sid)return c;const u=e.account||this.browserStorage.getActiveAccount(this.correlationId);return u&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${u.homeAccountId}`,this.correlationId),c.account=u),c}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Hne(t,e){if(!e)return null;try{return Sf.parseRequestState(t,e).libraryState.meta}catch{throw Ae(Pd)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Vh(t,e,n){const r=Cy(t);if(!r)throw b3(t)?(n.error(`A ${e} is present in the iframe but it does not contain known properties. It's likely that the ${e} has been replaced by code running on the redirectUri page.`),n.errorPii(`The ${e} detected is: ${t}`),Be(J3)):(n.error(`The request has returned to the redirectUri but a ${e} is not present. It's likely that the ${e} has been removed or the page has been redirected by code running on the redirectUri page.`),Be(Z3));return r}function zne(t,e,n){if(!t.state)throw Be(BE);const r=Hne(e,t.state);if(!r)throw Be(e5);if(r.interactionType!==n)throw Be(t5)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class H5{constructor(e,n,r,i,o){this.authModule=e,this.browserStorage=n,this.authCodeRequest=r,this.logger=i,this.performanceClient=o}async handleCodeResponse(e,n){this.performanceClient.addQueueMeasurement(G.HandleCodeResponse,n.correlationId);let r;try{r=Ite(e,n.state)}catch(i){throw i instanceof lu&&i.subError===Pp?Be(Pp):i}return ge(this.handleCodeResponseFromServer.bind(this),G.HandleCodeResponseFromServer,this.logger,this.performanceClient,n.correlationId)(r,n)}async handleCodeResponseFromServer(e,n,r=!0){if(this.performanceClient.addQueueMeasurement(G.HandleCodeResponseFromServer,n.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await ge(this.authModule.updateAuthority.bind(this.authModule),G.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,n.correlationId)(e.cloud_instance_host_name,n.correlationId),r&&(e.nonce=n.nonce||void 0),e.state=n.state,e.client_info)this.authCodeRequest.clientInfo=e.client_info;else{const o=this.createCcsCredentials(n);o&&(this.authCodeRequest.ccsCredential=o)}return await ge(this.authModule.acquireToken.bind(this.authModule),G.AuthClientAcquireToken,this.logger,this.performanceClient,n.correlationId)(this.authCodeRequest,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:Oo.HOME_ACCOUNT_ID}:e.loginHint?{credential:e.loginHint,type:Oo.UPN}:null}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Vne="ContentError",z5="user_switch";/*! @azure/msal-browser v4.19.0 2025-08-05 */const Gne="USER_INTERACTION_REQUIRED",Kne="USER_CANCEL",Wne="NO_NETWORK",qne="PERSISTENT_ERROR",Yne="DISABLED",Qne="ACCOUNT_UNAVAILABLE",Xne="UX_NOT_ALLOWED";/*! @azure/msal-browser v4.19.0 2025-08-05 */const Zne=-2147186943,Jne={[z5]:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."};class ps extends hn{constructor(e,n,r){super(e,n),Object.setPrototypeOf(this,ps.prototype),this.name="NativeAuthError",this.ext=r}}function Nu(t){if(t.ext&&t.ext.status&&(t.ext.status===qne||t.ext.status===Yne)||t.ext&&t.ext.error&&t.ext.error===Zne)return!0;switch(t.errorCode){case Vne:return!0;default:return!1}}function $y(t,e,n){if(n&&n.status)switch(n.status){case Qne:return Oy(z3);case Gne:return new qo(t,e);case Kne:return Be(Pp);case Wne:return Be(Iy);case Xne:return Oy(RE)}return new ps(t,Jne[t]||e,n)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class V5 extends Af{async acquireToken(e){this.performanceClient.addQueueMeasurement(G.SilentCacheClientAcquireToken,e.correlationId);const n=this.initializeServerTelemetryManager(fn.acquireTokenSilent_silentFlow),r=await ge(this.getClientConfiguration.bind(this),G.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),i=new Pte(r,this.performanceClient);this.logger.verbose("Silent auth client created");try{const s=(await ge(i.acquireCachedToken.bind(i),G.SilentFlowClientAcquireCachedToken,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),s}catch(o){throw o instanceof Ym&&o.errorCode===HE&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),o}}logout(e){this.logger.verbose("logoutRedirect called");const n=this.initializeLogoutRequest(e);return this.clearCacheOnLogout(n.correlationId,n==null?void 0:n.account)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Ov extends U5{constructor(e,n,r,i,o,s,l,c,u,d,f,h){super(e,n,r,i,o,s,c,u,h),this.apiId=l,this.accountId=d,this.platformAuthProvider=u,this.nativeStorageManager=f,this.silentCacheClient=new V5(e,this.nativeStorageManager,r,i,o,s,c,u,h);const p=this.platformAuthProvider.getExtensionName();this.skus=Tp.makeExtraSkuString({libraryName:gi.MSAL_SKU,libraryVersion:qc,extensionName:p,extensionVersion:this.platformAuthProvider.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[Gee]:this.skus}}async acquireToken(e,n){this.performanceClient.addQueueMeasurement(G.NativeInteractionClientAcquireToken,e.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const r=this.performanceClient.startMeasurement(G.NativeInteractionClientAcquireToken,e.correlationId),i=_i(),o=this.initializeServerTelemetryManager(this.apiId);try{const s=await this.initializeNativeRequest(e);try{const c=await this.acquireTokensFromCache(this.accountId,s);return r.end({success:!0,isNativeBroker:!1,fromCache:!0}),c}catch(c){if(n===Xr.AccessToken)throw this.logger.info("MSAL internal Cache does not contain tokens, return error as per cache policy"),c;this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const l=await this.platformAuthProvider.sendMessage(s);return await this.handleNativeResponse(l,s,i).then(c=>(r.end({success:!0,isNativeBroker:!0,requestId:c.requestId}),o.clearNativeBrokerErrorCode(),c)).catch(c=>{throw r.end({success:!1,errorCode:c.errorCode,subErrorCode:c.subError,isNativeBroker:!0}),c})}catch(s){throw s instanceof ps&&o.setNativeBrokerErrorCode(s.errorCode),s}}createSilentCacheRequest(e,n){return{authority:e.authority,correlationId:this.correlationId,scopes:hr.fromString(e.scope).asArray(),account:n,forceRefresh:!1}}async acquireTokensFromCache(e,n){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),Ae(b1);const r=this.browserStorage.getBaseAccountInfo({nativeAccountId:e},this.correlationId);if(!r)throw Ae(b1);try{const i=this.createSilentCacheRequest(n,r),o=await this.silentCacheClient.acquireToken(i),s={...r,idTokenClaims:o==null?void 0:o.idTokenClaims,idToken:o==null?void 0:o.idToken};return{...o,account:s}}catch(i){throw i}}async acquireTokenRedirect(e,n){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const{...r}=e;delete r.onRedirectNavigate;const i=await this.initializeNativeRequest(r);try{await this.platformAuthProvider.sendMessage(i)}catch(l){if(l instanceof ps&&(this.initializeServerTelemetryManager(this.apiId).setNativeBrokerErrorCode(l.errorCode),Nu(l)))throw l}this.browserStorage.setTemporaryCache(tr.NATIVE_REQUEST,JSON.stringify(i),!0);const o={apiId:fn.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},s=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(e.redirectUri);n.end({success:!0}),await this.navigationClient.navigateExternal(s,o)}async handleRedirectPromise(e,n){if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const r=this.browserStorage.getCachedNativeRequest();if(!r)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),e&&n&&(e==null||e.addFields({errorCode:"no_cached_request"},n)),null;const{prompt:i,...o}=r;i&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(tr.NATIVE_REQUEST));const s=_i();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const l=await this.platformAuthProvider.sendMessage(o),c=await this.handleNativeResponse(l,o,s);return this.initializeServerTelemetryManager(this.apiId).clearNativeBrokerErrorCode(),c}catch(l){throw l}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,n,r){var d,f;this.logger.trace("NativeInteractionClient - handleNativeResponse called.");const i=wf(e.id_token,Lo),o=this.createHomeAccountIdentifier(e,i),s=(d=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:n.accountId},this.correlationId))==null?void 0:d.homeAccountId;if((f=n.extraParameters)!=null&&f.child_client_id&&e.account.id!==n.accountId)this.logger.info("handleNativeServerResponse: Double broker flow detected, ignoring accountId mismatch");else if(o!==s&&e.account.id!==n.accountId)throw $y(z5);const l=await this.getDiscoveredAuthority({requestAuthority:n.authority}),c=ME(this.browserStorage,l,o,Lo,this.correlationId,i,e.client_info,void 0,i.tid,void 0,e.account.id,this.logger);e.expires_in=Number(e.expires_in);const u=await this.generateAuthenticationResult(e,n,i,c,l.canonicalAuthority,r);return await this.cacheAccount(c,this.correlationId),await this.cacheNativeTokens(e,n,o,i,e.access_token,u.tenantId,r),u}createHomeAccountIdentifier(e,n){return Wo.generateHomeAccountId(e.client_info||ve.EMPTY_STRING,Eo.Default,this.logger,this.browserCrypto,n)}generateScopes(e,n){return n?hr.fromString(n):hr.fromString(e)}async generatePopAccessToken(e,n){if(n.tokenType===an.POP&&n.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const r=new kd(this.browserCrypto),i={resourceRequestMethod:n.resourceRequestMethod,resourceRequestUri:n.resourceRequestUri,shrClaims:n.shrClaims,shrNonce:n.shrNonce};if(!n.keyId)throw Ae(cE);return r.signPopToken(e.access_token,n.keyId,i)}else return e.access_token}async generateAuthenticationResult(e,n,r,i,o,s){const l=this.addTelemetryFromNativeResponse(e.properties.MATS),c=this.generateScopes(n.scope,e.scope),u=e.account.properties||{},d=u.UID||r.oid||r.sub||ve.EMPTY_STRING,f=u.TenantId||r.tid||ve.EMPTY_STRING,h=yE(i.getAccountInfo(),void 0,r,e.id_token);h.nativeAccountId!==e.account.id&&(h.nativeAccountId=e.account.id);const p=await this.generatePopAccessToken(e,n),g=n.tokenType===an.POP?an.POP:an.BEARER;return{authority:o,uniqueId:d,tenantId:f,scopes:c.asArray(),account:h,idToken:e.id_token,idTokenClaims:r,accessToken:p,fromCache:l?this.isResponseFromCache(l):!1,expiresOn:id(s+e.expires_in),tokenType:g,correlationId:this.correlationId,state:e.state,fromNativeBroker:!0}}async cacheAccount(e,n){await this.browserStorage.setAccount(e,this.correlationId),this.browserStorage.removeAccountContext(e.getAccountInfo(),n)}cacheNativeTokens(e,n,r,i,o,s,l){const c=Jb(r,n.authority,e.id_token||"",n.clientId,i.tid||""),u=n.tokenType===an.POP?ve.SHR_NONCE_VALIDITY:(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,d=l+u,f=this.generateScopes(e.scope,n.scope),h=e0(r,n.authority,o,n.clientId,i.tid||s,f.printScopes(),d,0,Lo,void 0,n.tokenType,void 0,n.keyId),p={idToken:c,accessToken:h};return this.nativeStorageManager.saveCacheRecord(p,this.correlationId,n.storeInCache)}getExpiresInValue(e,n){return e===an.POP?ve.SHR_NONCE_VALIDITY:(typeof n=="string"?parseInt(n,10):n)||0}addTelemetryFromNativeResponse(e){const n=this.getMATSFromResponse(e);return n?(this.performanceClient.addFields({extensionId:this.platformAuthProvider.getExtensionId(),extensionVersion:this.platformAuthProvider.getExtensionVersion(),matsBrokerVersion:n.broker_version,matsAccountJoinOnStart:n.account_join_on_start,matsAccountJoinOnEnd:n.account_join_on_end,matsDeviceJoin:n.device_join,matsPromptBehavior:n.prompt_behavior,matsApiErrorCode:n.api_error_code,matsUiVisible:n.ui_visible,matsSilentCode:n.silent_code,matsSilentBiSubCode:n.silent_bi_sub_code,matsSilentMessage:n.silent_message,matsSilentStatus:n.silent_status,matsHttpStatus:n.http_status,matsHttpEventCount:n.http_event_count},this.correlationId),n):null}getMATSFromResponse(e){if(e)try{return JSON.parse(e)}catch{this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null}isResponseFromCache(e){return typeof e.is_cached>"u"?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached}async initializeNativeRequest(e){this.logger.trace("NativeInteractionClient - initializeNativeRequest called");const n=await this.getCanonicalAuthority(e),{scopes:r,...i}=e,o=new hr(r||[]);o.appendScopes(qm);const s={...i,accountId:this.accountId,clientId:this.config.auth.clientId,authority:n.urlString,scope:o.printScopes(),redirectUri:this.getRedirectUri(e.redirectUri),prompt:this.getPrompt(e.prompt),correlationId:this.correlationId,tokenType:e.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...e.extraQueryParameters,...e.tokenQueryParameters},extendedExpiryToken:!1,keyId:e.popKid};if(s.signPopToken&&e.popKid)throw Be(C5);if(this.handleExtraBrokerParams(s),s.extraParameters=s.extraParameters||{},s.extraParameters.telemetry=io.MATS_TELEMETRY,e.authenticationScheme===an.POP){const l={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},c=new kd(this.browserCrypto);let u;if(s.keyId)u=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:s.keyId})),s.signPopToken=!1;else{const d=await ge(c.generateCnf.bind(c),G.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(l,this.logger);u=d.reqCnfString,s.keyId=d.kid,s.signPopToken=!0}s.reqCnf=u}return this.addRequestSKUs(s),s}async getCanonicalAuthority(e){const n=e.authority||this.config.auth.authority;e.account&&await this.getDiscoveredAuthority({requestAuthority:n,requestAzureCloudOptions:e.azureCloudOptions,account:e.account});const r=new Kt(n);return r.validateAsUri(),r}getPrompt(e){switch(this.apiId){case fn.ssoSilent:case fn.acquireTokenSilent_silentFlow:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),ri.NONE}if(!e){this.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(e){case ri.NONE:case ri.CONSENT:case ri.LOGIN:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),e;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${e} is not compatible with native flow`),Be(w5)}}handleExtraBrokerParams(e){var o;const n=e.extraParameters&&e.extraParameters.hasOwnProperty(Ey)&&e.extraParameters.hasOwnProperty(Ny)&&e.extraParameters.hasOwnProperty(Kc);if(!e.embeddedClientId&&!n)return;let r="";const i=e.redirectUri;e.embeddedClientId?(e.redirectUri=this.config.auth.redirectUri,r=e.embeddedClientId):e.extraParameters&&(e.redirectUri=e.extraParameters[Ny],r=e.extraParameters[Kc]),e.extraParameters={child_client_id:r,child_redirect_uri:i},(o=this.performanceClient)==null||o.addFields({embeddedClientId:r,embeddedRedirectUri:i},e.correlationId)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function nN(t,e,n,r,i){const o=Ote({...t.auth,authority:e},n,r,i);if(EE(o,{sku:gi.MSAL_SKU,version:qc,os:"",cpu:""}),t.auth.protocolMode!==Ai.OIDC&&NE(o,t.telemetry.application),n.platformBroker&&(Yee(o),n.authenticationScheme===an.POP)){const s=new xa(r,i),l=new kd(s);let c;n.popKid?c=s.encodeKid(n.popKid):c=(await ge(l.generateCnf.bind(l),G.PopTokenGenerateCnf,r,i,n.correlationId)(n,r)).reqCnfString,PE(o,c)}return Qb(o,n.correlationId,i),o}async function rN(t,e,n,r,i){if(!n.codeChallenge)throw mn(pE);const o=await ge(nN,G.GetStandardParams,r,i,n.correlationId)(t,e,n,r,i);return wE(o,nE.CODE),P3(o,n.codeChallenge,ve.S256_CODE_CHALLENGE_METHOD),vl(o,n.extraQueryParameters||{}),DE(e,o,t.auth.encodeExtraQueryParams,n.extraQueryParameters)}async function iN(t,e,n,r,i,o){if(!r.earJwk)throw Be(UE);const s=await nN(e,n,r,i,o);wE(s,nE.IDTOKEN_TOKEN_REFRESHTOKEN),ste(s,r.earJwk);const l=new Map;vl(l,r.extraQueryParameters||{});const c=DE(n,l,e.auth.encodeExtraQueryParams,r.extraQueryParameters);return G5(t,c,s)}async function oN(t,e,n,r,i,o){const s=await nN(e,n,r,i,o);wE(s,nE.CODE),P3(s,r.codeChallenge,r.codeChallengeMethod||ve.S256_CODE_CHALLENGE_METHOD),ate(s,r.authorizePostBodyParameters||{});const l=new Map;vl(l,r.extraQueryParameters||{});const c=DE(n,l,e.auth.encodeExtraQueryParams,r.extraQueryParameters);return G5(t,c,s)}function G5(t,e,n){const r=t.createElement("form");return r.method="post",r.action=e,n.forEach((i,o)=>{const s=t.createElement("input");s.hidden=!0,s.name=o,s.value=i,r.appendChild(s)}),t.body.appendChild(r),r}async function K5(t,e,n,r,i,o,s,l,c,u){if(l.verbose("Account id found, calling WAM for token"),!u)throw Be(VE);const d=new xa(l,c),f=new Ov(r,i,d,l,s,r.system.navigationClient,n,c,u,e,o,t.correlationId),{userRequestState:h}=Sf.parseRequestState(d,t.state);return ge(f.acquireToken.bind(f),G.NativeInteractionClientAcquireToken,l,c,t.correlationId)({...t,state:h,prompt:void 0})}async function Ly(t,e,n,r,i,o,s,l,c,u,d,f){if(hs.removeThrottle(s,i.auth.clientId,t),e.accountId)return ge(K5,G.HandleResponsePlatformBroker,u,d,t.correlationId)(t,e.accountId,r,i,s,l,c,u,d,f);const h={...t,code:e.code||"",codeVerifier:n},p=new H5(o,s,h,u,d);return await ge(p.handleCodeResponse.bind(p),G.HandleCodeResponse,u,d,t.correlationId)(e,t)}async function sN(t,e,n,r,i,o,s,l,c,u,d){if(hs.removeThrottle(o,r.auth.clientId,t),W3(e,t.state),!e.ear_jwe)throw Be(X3);if(!t.earJwk)throw Be(UE);const f=JSON.parse(await ge(ane,G.DecryptEarResponse,c,u,t.correlationId)(t.earJwk,e.ear_jwe));if(f.accountId)return ge(K5,G.HandleResponsePlatformBroker,c,u,t.correlationId)(t,f.accountId,n,r,o,s,l,c,u,d);const h=new Wc(r.auth.clientId,o,new xa(c,u),c,null,null,u);h.validateTokenResponse(f);const p={code:"",state:t.state,nonce:t.nonce,client_info:f.client_info,cloud_graph_host_name:f.cloud_graph_host_name,cloud_instance_host_name:f.cloud_instance_host_name,cloud_instance_name:f.cloud_instance_name,msgraph_host:f.msgraph_host};return await ge(h.handleServerTokenResponse.bind(h),G.HandleServerTokenResponse,c,u,t.correlationId)(f,i,_i(),t,p,void 0,void 0,void 0,void 0)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const ere=32;async function l0(t,e,n){t.addQueueMeasurement(G.GeneratePkceCodes,n);const r=Bi(tre,G.GenerateCodeVerifier,e,t,n)(t,e,n),i=await ge(nre,G.GenerateCodeChallengeFromVerifier,e,t,n)(r,t,e,n);return{verifier:r,challenge:i}}function tre(t,e,n){try{const r=new Uint8Array(ere);return Bi(nne,G.GetRandomValues,e,t,n)(r),Ol(r)}catch{throw Be(FE)}}async function nre(t,e,n,r){e.addQueueMeasurement(G.GenerateCodeChallengeFromVerifier,r);try{const i=await ge(P5,G.Sha256Digest,n,e,r)(t,e,r);return Ol(new Uint8Array(i))}catch{throw Be(FE)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Fy{constructor(e,n,r,i){this.logger=e,this.handshakeTimeoutMs=n,this.extensionId=i,this.resolvers=new Map,this.handshakeResolvers=new Map,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=r,this.handshakeEvent=r.startMeasurement(G.NativeMessageHandlerHandshake),this.platformAuthType=io.PLATFORM_EXTENSION_PROVIDER}async sendMessage(e){this.logger.trace(this.platformAuthType+" - sendMessage called.");const n={method:rh.GetToken,request:e},r={channel:io.CHANNEL_ID,extensionId:this.extensionId,responseId:Yo(),body:n};this.logger.trace(this.platformAuthType+" - Sending request to browser extension"),this.logger.tracePii(this.platformAuthType+` - Sending request to browser extension: ${JSON.stringify(r)}`),this.messageChannel.port1.postMessage(r);const i=await new Promise((s,l)=>{this.resolvers.set(r.responseId,{resolve:s,reject:l})});return this.validatePlatformBrokerResponse(i)}static async createProvider(e,n,r){e.trace("PlatformAuthExtensionHandler - createProvider called.");try{const i=new Fy(e,n,r,io.PREFERRED_EXTENSION_ID);return await i.sendHandshakeRequest(),i}catch{const o=new Fy(e,n,r);return await o.sendHandshakeRequest(),o}}async sendHandshakeRequest(){this.logger.trace(this.platformAuthType+" - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:io.CHANNEL_ID,extensionId:this.extensionId,responseId:Yo(),body:{method:rh.HandshakeRequest}};return this.handshakeEvent.add({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=n=>{this.onChannelMessage(n)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise((n,r)=>{this.handshakeResolvers.set(e.responseId,{resolve:n,reject:r}),this.timeoutId=window.setTimeout(()=>{window.removeEventListener("message",this.windowListener,!1),this.messageChannel.port1.close(),this.messageChannel.port2.close(),this.handshakeEvent.end({extensionHandshakeTimedOut:!0,success:!1}),r(Be(x5)),this.handshakeResolvers.delete(e.responseId)},this.handshakeTimeoutMs)})}onWindowMessage(e){if(this.logger.trace(this.platformAuthType+" - onWindowMessage called"),e.source!==window)return;const n=e.data;if(!(!n.channel||n.channel!==io.CHANNEL_ID)&&!(n.extensionId&&n.extensionId!==this.extensionId)&&n.body.method===rh.HandshakeRequest){const r=this.handshakeResolvers.get(n.responseId);if(!r){this.logger.trace(this.platformAuthType+`.onWindowMessage - resolver can't be found for request ${n.responseId}`);return}this.logger.verbose(n.extensionId?`Extension with id: ${n.extensionId} not installed`:"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),this.handshakeEvent.end({success:!1,extensionInstalled:!1}),r.reject(Be(b5))}}onChannelMessage(e){this.logger.trace(this.platformAuthType+" - onChannelMessage called.");const n=e.data,r=this.resolvers.get(n.responseId),i=this.handshakeResolvers.get(n.responseId);try{const o=n.body.method;if(o===rh.Response){if(!r)return;const s=n.body.response;if(this.logger.trace(this.platformAuthType+" - Received response from browser extension"),this.logger.tracePii(this.platformAuthType+` - Received response from browser extension: ${JSON.stringify(s)}`),s.status!=="Success")r.reject($y(s.code,s.description,s.ext));else if(s.result)s.result.code&&s.result.description?r.reject($y(s.result.code,s.result.description,s.result.ext)):r.resolve(s.result);else throw v1(wy,"Event does not contain result.");this.resolvers.delete(n.responseId)}else if(o===rh.HandshakeResponse){if(!i){this.logger.trace(this.platformAuthType+`.onChannelMessage - resolver can't be found for request ${n.responseId}`);return}clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=n.extensionId,this.extensionVersion=n.body.version,this.logger.verbose(this.platformAuthType+` - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.end({extensionInstalled:!0,success:!0}),i.resolve(),this.handshakeResolvers.delete(n.responseId)}}catch(o){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${o}`),this.logger.errorPii(`Unable to parse ${e}`),r?r.reject(o):i&&i.reject(o)}}validatePlatformBrokerResponse(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw v1(wy,"Response missing expected properties.")}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}getExtensionName(){var e;return this.getExtensionId()===io.PREFERRED_EXTENSION_ID?"chrome":(e=this.getExtensionId())!=null&&e.length?"unknown":void 0}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class aN{constructor(e,n,r){this.logger=e,this.performanceClient=n,this.correlationId=r,this.platformAuthType=io.PLATFORM_DOM_PROVIDER}static async createProvider(e,n,r){var i;if(e.trace("PlatformAuthDOMHandler: createProvider called"),(i=window.navigator)!=null&&i.platformAuthentication){const o=await window.navigator.platformAuthentication.getSupportedContracts(io.MICROSOFT_ENTRA_BROKERID);if(o!=null&&o.includes(io.PLATFORM_DOM_APIS))return e.trace("Platform auth api available in DOM"),new aN(e,n,r)}}getExtensionId(){return io.MICROSOFT_ENTRA_BROKERID}getExtensionVersion(){return""}getExtensionName(){return io.DOM_API_NAME}async sendMessage(e){this.logger.trace(this.platformAuthType+" - Sending request to browser DOM API");try{const n=this.initializePlatformDOMRequest(e),r=await window.navigator.platformAuthentication.executeGetToken(n);return this.validatePlatformBrokerResponse(r)}catch(n){throw this.logger.error(this.platformAuthType+" - executeGetToken DOM API error"),n}}initializePlatformDOMRequest(e){this.logger.trace(this.platformAuthType+" - initializeNativeDOMRequest called");const{accountId:n,clientId:r,authority:i,scope:o,redirectUri:s,correlationId:l,state:c,storeInCache:u,embeddedClientId:d,extraParameters:f,...h}=e,p=this.getDOMExtraParams(h);return{accountId:n,brokerId:this.getExtensionId(),authority:i,clientId:r,correlationId:l||this.correlationId,extraParameters:{...f,...p},isSecurityTokenService:!1,redirectUri:s,scope:o,state:c,storeInCache:u,embeddedClientId:d}}validatePlatformBrokerResponse(e){if(e.hasOwnProperty("isSuccess")){if(e.hasOwnProperty("accessToken")&&e.hasOwnProperty("idToken")&&e.hasOwnProperty("clientInfo")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scopes")&&e.hasOwnProperty("expiresIn"))return this.logger.trace(this.platformAuthType+" - platform broker returned successful and valid response"),this.convertToPlatformBrokerResponse(e);if(e.hasOwnProperty("error")){const n=e;if(n.isSuccess===!1&&n.error&&n.error.code)throw this.logger.trace(this.platformAuthType+" - platform broker returned error response"),$y(n.error.code,n.error.description,{error:parseInt(n.error.errorCode),protocol_error:n.error.protocolError,status:n.error.status,properties:n.error.properties})}}throw v1(wy,"Response missing expected properties.")}convertToPlatformBrokerResponse(e){return this.logger.trace(this.platformAuthType+" - convertToNativeResponse called"),{access_token:e.accessToken,id_token:e.idToken,client_info:e.clientInfo,account:e.account,expires_in:e.expiresIn,scope:e.scopes,state:e.state||"",properties:e.properties||{},extendedLifetimeToken:e.extendedLifetimeToken??!1,shr:e.proofOfPossessionPayload}}getDOMExtraParams(e){return{...Object.entries(e).reduce((i,[o,s])=>(i[o]=String(s),i),{})}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function rre(t,e,n,r){t.trace("getPlatformAuthProvider called",n);const i=ire();t.trace("Has client allowed platform auth via DOM API: "+i);let o;try{i&&(o=await aN.createProvider(t,e,n)),o||(t.trace("Platform auth via DOM API not available, checking for extension"),o=await Fy.createProvider(t,r||L5,e))}catch(s){t.trace("Platform auth not available",s)}return o}function ire(){let t;try{return t=window[pr.SessionStorage],(t==null?void 0:t.getItem(Cne))==="true"}catch{return!1}}function Ip(t,e,n,r){if(e.trace("isPlatformAuthAllowed called"),!t.system.allowPlatformBroker)return e.trace("isPlatformAuthAllowed: allowPlatformBroker is not enabled, returning false"),!1;if(!n)return e.trace("isPlatformAuthAllowed: Platform auth provider is not initialized, returning false"),!1;if(r)switch(r){case an.BEARER:case an.POP:return e.trace("isPlatformAuthAllowed: authenticationScheme is supported, returning true"),!0;default:return e.trace("isPlatformAuthAllowed: authenticationScheme is not supported, returning false"),!1}return!0}/*! @azure/msal-browser v4.19.0 2025-08-05 */class ore extends Af{constructor(e,n,r,i,o,s,l,c,u,d){super(e,n,r,i,o,s,l,u,d),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=c,this.eventHandler=o}acquireToken(e,n){let r;try{if(r={popupName:this.generatePopupName(e.scopes||qm,e.authority||this.config.auth.authority),popupWindowAttributes:e.popupWindowAttributes||{},popupWindowParent:e.popupWindowParent??window},this.performanceClient.addFields({isAsyncPopup:this.config.system.asyncPopups},this.correlationId),this.config.system.asyncPopups)return this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,r,n);{const o={...e,httpMethod:B5(e,this.config.auth.protocolMode)};return this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),r.popup=this.openSizedPopup("about:blank",r),this.acquireTokenPopupAsync(o,r,n)}}catch(i){return Promise.reject(i)}}logout(e){try{this.logger.verbose("logoutPopup called");const n=this.initializeLogoutRequest(e),r={popupName:this.generateLogoutPopupName(n),popupWindowAttributes:(e==null?void 0:e.popupWindowAttributes)||{},popupWindowParent:(e==null?void 0:e.popupWindowParent)??window},i=e&&e.authority,o=e&&e.mainWindowRedirectUri;return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(n,r,i,o)):(this.logger.verbose("asyncPopup set to false, opening popup"),r.popup=this.openSizedPopup("about:blank",r),this.logoutPopupAsync(n,r,i,o))}catch(n){return Promise.reject(n)}}async acquireTokenPopupAsync(e,n,r){this.logger.verbose("acquireTokenPopupAsync called");const i=await ge(this.initializeAuthorizationRequest.bind(this),G.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,pt.Popup);n.popup&&$5(i.authority);const o=Ip(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme);return i.platformBroker=o,this.config.auth.protocolMode===Ai.EAR?this.executeEarFlow(i,n):this.executeCodeFlow(i,n,r)}async executeCodeFlow(e,n,r){var c;const i=e.correlationId,o=this.initializeServerTelemetryManager(fn.acquireTokenPopup),s=r||await ge(l0,G.GeneratePkceCodes,this.logger,this.performanceClient,i)(this.performanceClient,this.logger,i),l={...e,codeChallenge:s.challenge};try{const u=await ge(this.createAuthCodeClient.bind(this),G.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,i)({serverTelemetryManager:o,requestAuthority:l.authority,requestAzureCloudOptions:l.azureCloudOptions,requestExtraQueryParameters:l.extraQueryParameters,account:l.account});if(l.httpMethod===hc.POST)return await this.executeCodeFlowWithPost(l,n,u,s.verifier);{const d=await ge(rN,G.GetAuthCodeUrl,this.logger,this.performanceClient,i)(this.config,u.authority,l,this.logger,this.performanceClient),f=this.initiateAuthRequest(d,n);this.eventHandler.emitEvent(Ve.POPUP_OPENED,pt.Popup,{popupWindow:f},null);const h=await this.monitorPopupForHash(f,n.popupWindowParent),p=Bi(Vh,G.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(h,this.config.auth.OIDCOptions.serverResponseType,this.logger);return await ge(Ly,G.HandleResponseCode,this.logger,this.performanceClient,i)(e,p,s.verifier,fn.acquireTokenPopup,this.config,u,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}}catch(u){throw(c=n.popup)==null||c.close(),u instanceof hn&&(u.setCorrelationId(this.correlationId),o.cacheFailedRequest(u)),u}}async executeEarFlow(e,n){const r=e.correlationId,i=await ge(this.getDiscoveredAuthority.bind(this),G.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,r)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),o=await ge(YE,G.GenerateEarKey,this.logger,this.performanceClient,r)(),s={...e,earJwk:o},l=n.popup||this.openPopup("about:blank",n);(await iN(l.document,this.config,i,s,this.logger,this.performanceClient)).submit();const u=await ge(this.monitorPopupForHash.bind(this),G.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(l,n.popupWindowParent),d=Bi(Vh,G.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(u,this.config.auth.OIDCOptions.serverResponseType,this.logger);return ge(sN,G.HandleResponseEar,this.logger,this.performanceClient,r)(s,d,fn.acquireTokenPopup,this.config,i,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async executeCodeFlowWithPost(e,n,r,i){const o=e.correlationId,s=await ge(this.getDiscoveredAuthority.bind(this),G.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,o)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),l=n.popup||this.openPopup("about:blank",n);(await oN(l.document,this.config,s,e,this.logger,this.performanceClient)).submit();const u=await ge(this.monitorPopupForHash.bind(this),G.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,o)(l,n.popupWindowParent),d=Bi(Vh,G.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(u,this.config.auth.OIDCOptions.serverResponseType,this.logger);return ge(Ly,G.HandleResponseCode,this.logger,this.performanceClient,o)(e,d,i,fn.acquireTokenPopup,this.config,r,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async logoutPopupAsync(e,n,r,i){var s,l,c;this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(Ve.LOGOUT_START,pt.Popup,e);const o=this.initializeServerTelemetryManager(fn.logoutPopup);try{await this.clearCacheOnLogout(this.correlationId,e.account);const u=await ge(this.createAuthCodeClient.bind(this),G.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:o,requestAuthority:r,account:e.account||void 0});try{u.authority.endSessionEndpoint}catch{if((s=e.account)!=null&&s.homeAccountId&&e.postLogoutRedirectUri&&u.authority.protocolMode===Ai.OIDC){if(this.eventHandler.emitEvent(Ve.LOGOUT_SUCCESS,pt.Popup,e),i){const h={apiId:fn.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},p=Kt.getAbsoluteUrl(i,ta());await this.navigationClient.navigateInternal(p,h)}(l=n.popup)==null||l.close();return}}const d=u.getLogoutUri(e);this.eventHandler.emitEvent(Ve.LOGOUT_SUCCESS,pt.Popup,e);const f=this.openPopup(d,n);if(this.eventHandler.emitEvent(Ve.POPUP_OPENED,pt.Popup,{popupWindow:f},null),await this.monitorPopupForHash(f,n.popupWindowParent).catch(()=>{}),i){const h={apiId:fn.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},p=Kt.getAbsoluteUrl(i,ta());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${p}`),await this.navigationClient.navigateInternal(p,h)}else this.logger.verbose("No main window navigation requested")}catch(u){throw(c=n.popup)==null||c.close(),u instanceof hn&&(u.setCorrelationId(this.correlationId),o.cacheFailedRequest(u)),this.eventHandler.emitEvent(Ve.LOGOUT_FAILURE,pt.Popup,null,u),this.eventHandler.emitEvent(Ve.LOGOUT_END,pt.Popup),u}this.eventHandler.emitEvent(Ve.LOGOUT_END,pt.Popup)}initiateAuthRequest(e,n){if(e)return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,n);throw this.logger.error("Navigate url is empty"),Be(i0)}monitorPopupForHash(e,n){return new Promise((r,i)=>{this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const o=setInterval(()=>{if(e.closed){this.logger.error("PopupHandler.monitorPopupForHash - window closed"),clearInterval(o),i(Be(Pp));return}let s="";try{s=e.location.href}catch{}if(!s||s==="about:blank")return;clearInterval(o);let l="";const c=this.config.auth.OIDCOptions.serverResponseType;e&&(c===qb.QUERY?l=e.location.search:l=e.location.hash),this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),r(l)},this.config.system.pollIntervalMilliseconds)}).finally(()=>{this.cleanPopup(e,n)})}openPopup(e,n){try{let r;if(n.popup?(r=n.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),r.location.assign(e)):typeof n.popup>"u"&&(this.logger.verbosePii(`Opening popup window to: ${e}`),r=this.openSizedPopup(e,n)),!r)throw Be(i5);return r.focus&&r.focus(),this.currentWindow=r,n.popupWindowParent.addEventListener("beforeunload",this.unloadWindow),r}catch(r){throw this.logger.error("error opening popup "+r.message),Be(r5)}}openSizedPopup(e,{popupName:n,popupWindowAttributes:r,popupWindowParent:i}){var p,g,m,v;const o=i.screenLeft?i.screenLeft:i.screenX,s=i.screenTop?i.screenTop:i.screenY,l=i.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,c=i.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let u=(p=r.popupSize)==null?void 0:p.width,d=(g=r.popupSize)==null?void 0:g.height,f=(m=r.popupPosition)==null?void 0:m.top,h=(v=r.popupPosition)==null?void 0:v.left;return(!u||u<0||u>l)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),u=gi.POPUP_WIDTH),(!d||d<0||d>c)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),d=gi.POPUP_HEIGHT),(!f||f<0||f>c)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),f=Math.max(0,c/2-gi.POPUP_HEIGHT/2+s)),(!h||h<0||h>l)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),h=Math.max(0,l/2-gi.POPUP_WIDTH/2+o)),i.open(e,n,`width=${u}, height=${d}, top=${f}, left=${h}, scrollbars=yes`)}unloadWindow(e){this.currentWindow&&this.currentWindow.close(),e.preventDefault()}cleanPopup(e,n){e.close(),n.removeEventListener("beforeunload",this.unloadWindow)}generatePopupName(e,n){return`${gi.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${e.join("-")}.${n}.${this.correlationId}`}generateLogoutPopupName(e){const n=e.account&&e.account.homeAccountId;return`${gi.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${n}.${this.correlationId}`}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function sre(){if(typeof window>"u"||typeof window.performance>"u"||typeof window.performance.getEntriesByType!="function")return;const t=window.performance.getEntriesByType("navigation"),e=t.length?t[0]:void 0;return e==null?void 0:e.type}class are extends Af{constructor(e,n,r,i,o,s,l,c,u,d){super(e,n,r,i,o,s,l,u,d),this.nativeStorage=c}async acquireToken(e){const n=await ge(this.initializeAuthorizationRequest.bind(this),G.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,pt.Redirect);n.platformBroker=Ip(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme);const r=o=>{o.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.resetRequestCache(),this.eventHandler.emitEvent(Ve.RESTORE_FROM_BFCACHE,pt.Redirect))},i=this.getRedirectStartPage(e.redirectStartPage);this.logger.verbosePii(`Redirect start page: ${i}`),this.browserStorage.setTemporaryCache(tr.ORIGIN_URI,i,!0),window.addEventListener("pageshow",r);try{this.config.auth.protocolMode===Ai.EAR?await this.executeEarFlow(n):await this.executeCodeFlow(n,e.onRedirectNavigate)}catch(o){throw o instanceof hn&&o.setCorrelationId(this.correlationId),window.removeEventListener("pageshow",r),o}}async executeCodeFlow(e,n){const r=e.correlationId,i=this.initializeServerTelemetryManager(fn.acquireTokenRedirect),o=await ge(l0,G.GeneratePkceCodes,this.logger,this.performanceClient,r)(this.performanceClient,this.logger,r),s={...e,codeChallenge:o.challenge};this.browserStorage.cacheAuthorizeRequest(s,o.verifier);try{if(s.httpMethod===hc.POST)return await this.executeCodeFlowWithPost(s);{const l=await ge(this.createAuthCodeClient.bind(this),G.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:i,requestAuthority:s.authority,requestAzureCloudOptions:s.azureCloudOptions,requestExtraQueryParameters:s.extraQueryParameters,account:s.account}),c=await ge(rN,G.GetAuthCodeUrl,this.logger,this.performanceClient,e.correlationId)(this.config,l.authority,s,this.logger,this.performanceClient);return await this.initiateAuthRequest(c,n)}}catch(l){throw l instanceof hn&&(l.setCorrelationId(this.correlationId),i.cacheFailedRequest(l)),l}}async executeEarFlow(e){const n=e.correlationId,r=await ge(this.getDiscoveredAuthority.bind(this),G.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),i=await ge(YE,G.GenerateEarKey,this.logger,this.performanceClient,n)(),o={...e,earJwk:i};return this.browserStorage.cacheAuthorizeRequest(o),(await iN(document,this.config,r,o,this.logger,this.performanceClient)).submit(),new Promise((l,c)=>{setTimeout(()=>{c(Be(Ry,"failed_to_redirect"))},this.config.system.redirectNavigationTimeout)})}async executeCodeFlowWithPost(e){const n=e.correlationId,r=await ge(this.getDiscoveredAuthority.bind(this),G.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return this.browserStorage.cacheAuthorizeRequest(e),(await oN(document,this.config,r,e,this.logger,this.performanceClient)).submit(),new Promise((o,s)=>{setTimeout(()=>{s(Be(Ry,"failed_to_redirect"))},this.config.system.redirectNavigationTimeout)})}async handleRedirectPromise(e="",n,r,i){const o=this.initializeServerTelemetryManager(fn.handleRedirectPromise);try{const[s,l]=this.getRedirectResponse(e||"");if(!s)return this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache."),this.browserStorage.resetRequestCache(),sre()!=="back_forward"?i.event.errorCode="no_server_response":this.logger.verbose("Back navigation event detected. Muting no_server_response error"),null;const c=this.browserStorage.getTemporaryCache(tr.ORIGIN_URI,!0)||ve.EMPTY_STRING,u=Kt.removeHashFromUrl(c),d=Kt.removeHashFromUrl(window.location.href);if(u===d&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),c.indexOf("#")>-1&&cne(c),await this.handleResponse(s,n,r,o);if(this.config.auth.navigateToLoginRequestUrl){if(!XE()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache(tr.URL_HASH,l,!0);const f={apiId:fn.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let h=!0;if(!c||c==="null"){const p=dne();this.browserStorage.setTemporaryCache(tr.ORIGIN_URI,p,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),h=await this.navigationClient.navigateInternal(p,f)}else this.logger.verbose(`Navigating to loginRequestUrl: ${c}`),h=await this.navigationClient.navigateInternal(c,f);if(!h)return await this.handleResponse(s,n,r,o)}}else return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response"),await this.handleResponse(s,n,r,o);return null}catch(s){throw s instanceof hn&&(s.setCorrelationId(this.correlationId),o.cacheFailedRequest(s)),s}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let n=e;n||(this.config.auth.OIDCOptions.serverResponseType===qb.QUERY?n=window.location.search:n=window.location.hash);let r=Cy(n);if(r){try{zne(r,this.browserCrypto,pt.Redirect)}catch(o){return o instanceof hn&&this.logger.error(`Interaction type validation failed due to ${o.errorCode}: ${o.errorMessage}`),[null,""]}return R5(window),this.logger.verbose("Hash contains known properties, returning response hash"),[r,n]}const i=this.browserStorage.getTemporaryCache(tr.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(tr.URL_HASH)),i&&(r=Cy(i),r)?(this.logger.verbose("Hash does not contain known properties, returning cached hash"),[r,i]):[null,""]}async handleResponse(e,n,r,i){if(!e.state)throw Be(BE);if(e.ear_jwe){const l=await ge(this.getDiscoveredAuthority.bind(this),G.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n.correlationId)({requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account});return ge(sN,G.HandleResponseEar,this.logger,this.performanceClient,n.correlationId)(n,e,fn.acquireTokenRedirect,this.config,l,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}const s=await ge(this.createAuthCodeClient.bind(this),G.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:i,requestAuthority:n.authority});return ge(Ly,G.HandleResponseCode,this.logger,this.performanceClient,n.correlationId)(n,e,r,fn.acquireTokenRedirect,this.config,s,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async initiateAuthRequest(e,n){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),e){this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${e}`);const r={apiId:fn.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},i=n||this.config.auth.onRedirectNavigate;if(typeof i=="function")if(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),i(e)!==!1){this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),await this.navigationClient.navigateExternal(e,r);return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation");return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),await this.navigationClient.navigateExternal(e,r);return}}else throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),Be(i0)}async logout(e){var i;this.logger.verbose("logoutRedirect called");const n=this.initializeLogoutRequest(e),r=this.initializeServerTelemetryManager(fn.logout);try{this.eventHandler.emitEvent(Ve.LOGOUT_START,pt.Redirect,e),await this.clearCacheOnLogout(this.correlationId,n.account);const o={apiId:fn.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},s=await ge(this.createAuthCodeClient.bind(this),G.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:e&&e.authority,requestExtraQueryParameters:e==null?void 0:e.extraQueryParameters,account:e&&e.account||void 0});if(s.authority.protocolMode===Ai.OIDC)try{s.authority.endSessionEndpoint}catch{if((i=n.account)!=null&&i.homeAccountId){this.eventHandler.emitEvent(Ve.LOGOUT_SUCCESS,pt.Redirect,n);return}}const l=s.getLogoutUri(n);if(this.eventHandler.emitEvent(Ve.LOGOUT_SUCCESS,pt.Redirect,n),e&&typeof e.onRedirectNavigate=="function")if(e.onRedirectNavigate(l)!==!1){this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0,Ga.SIGNOUT),await this.navigationClient.navigateExternal(l,o);return}else this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation");else{this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0,Ga.SIGNOUT),await this.navigationClient.navigateExternal(l,o);return}}catch(o){throw o instanceof hn&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),this.eventHandler.emitEvent(Ve.LOGOUT_FAILURE,pt.Redirect,null,o),this.eventHandler.emitEvent(Ve.LOGOUT_END,pt.Redirect),o}this.eventHandler.emitEvent(Ve.LOGOUT_END,pt.Redirect)}getRedirectStartPage(e){const n=e||window.location.href;return Kt.getAbsoluteUrl(n,ta())}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function lre(t,e,n,r,i){if(e.addQueueMeasurement(G.SilentHandlerInitiateAuthRequest,r),!t)throw n.info("Navigate url is empty"),Be(i0);return i?ge(dre,G.SilentHandlerLoadFrame,n,e,r)(t,i,e,r):Bi(fre,G.SilentHandlerLoadFrameSync,n,e,r)(t)}async function cre(t,e,n,r,i){const o=c0();if(!o.contentDocument)throw"No document associated with iframe!";return(await oN(o.contentDocument,t,e,n,r,i)).submit(),o}async function ure(t,e,n,r,i){const o=c0();if(!o.contentDocument)throw"No document associated with iframe!";return(await iN(o.contentDocument,t,e,n,r,i)).submit(),o}async function rI(t,e,n,r,i,o,s){return r.addQueueMeasurement(G.SilentHandlerMonitorIframeForHash,o),new Promise((l,c)=>{e{window.clearInterval(d),c(Be(o5))},e),d=window.setInterval(()=>{let f="";const h=t.contentWindow;try{f=h?h.location.href:""}catch{}if(!f||f==="about:blank")return;let p="";h&&(s===qb.QUERY?p=h.location.search:p=h.location.hash),window.clearTimeout(u),window.clearInterval(d),l(p)},n)}).finally(()=>{Bi(hre,G.RemoveHiddenIframe,i,r,o)(t)})}function dre(t,e,n,r){return n.addQueueMeasurement(G.SilentHandlerLoadFrame,r),new Promise((i,o)=>{const s=c0();window.setTimeout(()=>{if(!s){o("Unable to load iframe");return}s.src=t,i(s)},e)})}function fre(t){const e=c0();return e.src=t,e}function c0(){const t=document.createElement("iframe");return t.className="msalSilentIframe",t.style.visibility="hidden",t.style.position="absolute",t.style.width=t.style.height="0",t.style.border="0",t.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.body.appendChild(t),t}function hre(t){document.body===t.parentNode&&document.body.removeChild(t)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class pre extends Af{constructor(e,n,r,i,o,s,l,c,u,d,f){super(e,n,r,i,o,s,c,d,f),this.apiId=l,this.nativeStorage=u}async acquireToken(e){this.performanceClient.addQueueMeasurement(G.SilentIframeClientAcquireToken,e.correlationId),!e.loginHint&&!e.sid&&(!e.account||!e.account.username)&&this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");const n={...e};n.prompt?n.prompt!==ri.NONE&&n.prompt!==ri.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${n.prompt} with ${ri.NONE}`),n.prompt=ri.NONE):n.prompt=ri.NONE;const r=await ge(this.initializeAuthorizationRequest.bind(this),G.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(n,pt.Silent);return r.platformBroker=Ip(this.config,this.logger,this.platformAuthProvider,r.authenticationScheme),$5(r.authority),this.config.auth.protocolMode===Ai.EAR?this.executeEarFlow(r):this.executeCodeFlow(r)}async executeCodeFlow(e){let n;const r=this.initializeServerTelemetryManager(this.apiId);try{return n=await ge(this.createAuthCodeClient.bind(this),G.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),await ge(this.silentTokenHelper.bind(this),G.SilentIframeClientTokenHelper,this.logger,this.performanceClient,e.correlationId)(n,e)}catch(i){if(i instanceof hn&&(i.setCorrelationId(this.correlationId),r.cacheFailedRequest(i)),!n||!(i instanceof hn)||i.errorCode!==gi.INVALID_GRANT_ERROR)throw i;return this.performanceClient.addFields({retryError:i.errorCode},this.correlationId),await ge(this.silentTokenHelper.bind(this),G.SilentIframeClientTokenHelper,this.logger,this.performanceClient,this.correlationId)(n,e)}}async executeEarFlow(e){const n=e.correlationId,r=await ge(this.getDiscoveredAuthority.bind(this),G.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),i=await ge(YE,G.GenerateEarKey,this.logger,this.performanceClient,n)(),o={...e,earJwk:i},s=await ge(ure,G.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,n)(this.config,r,o,this.logger,this.performanceClient),l=this.config.auth.OIDCOptions.serverResponseType,c=await ge(rI,G.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,n)(s,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,n,l),u=Bi(Vh,G.DeserializeResponse,this.logger,this.performanceClient,n)(c,l,this.logger);return ge(sN,G.HandleResponseEar,this.logger,this.performanceClient,n)(o,u,this.apiId,this.config,r,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}logout(){return Promise.reject(Be(o0))}async silentTokenHelper(e,n){const r=n.correlationId;this.performanceClient.addQueueMeasurement(G.SilentIframeClientTokenHelper,r);const i=await ge(l0,G.GeneratePkceCodes,this.logger,this.performanceClient,r)(this.performanceClient,this.logger,r),o={...n,codeChallenge:i.challenge};let s;if(n.httpMethod===hc.POST)s=await ge(cre,G.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(this.config,e.authority,o,this.logger,this.performanceClient);else{const d=await ge(rN,G.GetAuthCodeUrl,this.logger,this.performanceClient,r)(this.config,e.authority,o,this.logger,this.performanceClient);s=await ge(lre,G.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(d,this.performanceClient,this.logger,r,this.config.system.navigateFrameWait)}const l=this.config.auth.OIDCOptions.serverResponseType,c=await ge(rI,G.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(s,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,r,l),u=Bi(Vh,G.DeserializeResponse,this.logger,this.performanceClient,r)(c,l,this.logger);return ge(Ly,G.HandleResponseCode,this.logger,this.performanceClient,r)(n,u,i.verifier,this.apiId,this.config,e,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class mre extends Af{async acquireToken(e){this.performanceClient.addQueueMeasurement(G.SilentRefreshClientAcquireToken,e.correlationId);const n=await ge(tN,G.InitializeBaseRequest,this.logger,this.performanceClient,e.correlationId)(e,this.config,this.performanceClient,this.logger),r={...e,...n};e.redirectUri&&(r.redirectUri=this.getRedirectUri(e.redirectUri));const i=this.initializeServerTelemetryManager(fn.acquireTokenSilent_silentFlow),o=await this.createRefreshTokenClient({serverTelemetryManager:i,authorityUrl:r.authority,azureCloudOptions:r.azureCloudOptions,account:r.account});return ge(o.acquireTokenByRefreshToken.bind(o),G.RefreshTokenClientAcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(r).catch(s=>{throw s.setCorrelationId(this.correlationId),i.cacheFailedRequest(s),s})}logout(){return Promise.reject(Be(o0))}async createRefreshTokenClient(e){const n=await ge(this.getClientConfiguration.bind(this),G.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new Tte(n,this.performanceClient)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class gre{constructor(e,n,r,i){this.isBrowserEnvironment=typeof window<"u",this.config=e,this.storage=n,this.logger=r,this.cryptoObj=i}async loadExternalTokens(e,n,r){if(!this.isBrowserEnvironment)throw Be(s0);const i=e.correlationId||Yo(),o=n.id_token?wf(n.id_token,Lo):void 0,s={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},l=e.authority?new Hr(Hr.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,s,this.logger,e.correlationId||Yo()):void 0,c=await this.loadAccount(e,r.clientInfo||n.client_info||"",i,o,l),u=await this.loadIdToken(n,c.homeAccountId,c.environment,c.realm,i),d=await this.loadAccessToken(e,n,c.homeAccountId,c.environment,c.realm,r,i),f=await this.loadRefreshToken(n,c.homeAccountId,c.environment,i);return this.generateAuthenticationResult(e,{account:c,idToken:u,accessToken:d,refreshToken:f},o,l)}async loadAccount(e,n,r,i,o){if(this.logger.verbose("TokenCache - loading account"),e.account){const u=Wo.createFromAccountInfo(e.account);return await this.storage.setAccount(u,r),u}else if(!o||!n&&!i)throw this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead."),Be(p5);const s=Wo.generateHomeAccountId(n,o.authorityType,this.logger,this.cryptoObj,i),l=i==null?void 0:i.tid,c=ME(this.storage,o,s,Lo,r,i,n,o.hostnameAndPort,l,void 0,void 0,this.logger);return await this.storage.setAccount(c,r),c}async loadIdToken(e,n,r,i,o){if(!e.id_token)return this.logger.verbose("TokenCache - no id token found in response"),null;this.logger.verbose("TokenCache - loading id token");const s=Jb(n,r,e.id_token,this.config.auth.clientId,i);return await this.storage.setIdTokenCredential(s,o),s}async loadAccessToken(e,n,r,i,o,s,l){if(n.access_token)if(n.expires_in){if(!n.scope&&(!e.scopes||!e.scopes.length))return this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache."),null}else return this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache."),null;else return this.logger.verbose("TokenCache - no access token found in response"),null;this.logger.verbose("TokenCache - loading access token");const c=n.scope?hr.fromString(n.scope):new hr(e.scopes),u=s.expiresOn||n.expires_in+_i(),d=s.extendedExpiresOn||(n.ext_expires_in||n.expires_in)+_i(),f=e0(r,i,n.access_token,this.config.auth.clientId,o,c.printScopes(),u,d,Lo);return await this.storage.setAccessTokenCredential(f,l),f}async loadRefreshToken(e,n,r,i){if(!e.refresh_token)return this.logger.verbose("TokenCache - no refresh token found in response"),null;this.logger.verbose("TokenCache - loading refresh token");const o=F3(n,r,e.refresh_token,this.config.auth.clientId,e.foci,void 0,e.refresh_token_expires_in);return await this.storage.setRefreshTokenCredential(o,i),o}generateAuthenticationResult(e,n,r,i){var d,f,h;let o="",s=[],l=null,c;n!=null&&n.accessToken&&(o=n.accessToken.secret,s=hr.fromString(n.accessToken.target).asArray(),l=id(n.accessToken.expiresOn),c=id(n.accessToken.extendedExpiresOn));const u=n.account;return{authority:i?i.canonicalAuthority:"",uniqueId:n.account.localAccountId,tenantId:n.account.realm,scopes:s,account:u.getAccountInfo(),idToken:((d=n.idToken)==null?void 0:d.secret)||"",idTokenClaims:r||{},accessToken:o,fromCache:!0,expiresOn:l,correlationId:e.correlationId||"",requestId:"",extExpiresOn:c,familyId:((f=n.refreshToken)==null?void 0:f.familyId)||"",tokenType:((h=n==null?void 0:n.accessToken)==null?void 0:h.tokenType)||"",state:e.state||"",cloudGraphHostName:u.cloudGraphHostName||"",msGraphHost:u.msGraphHost||"",fromNativeBroker:!1}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class vre extends K3{constructor(e){super(e),this.includeRedirectUri=!1}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class yre extends Af{constructor(e,n,r,i,o,s,l,c,u,d){super(e,n,r,i,o,s,c,u,d),this.apiId=l}async acquireToken(e){if(!e.code)throw Be(m5);const n=await ge(this.initializeAuthorizationRequest.bind(this),G.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(e,pt.Silent),r=this.initializeServerTelemetryManager(this.apiId);try{const i={...n,code:e.code},o=await ge(this.getClientConfiguration.bind(this),G.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account}),s=new vre(o);this.logger.verbose("Auth code client created");const l=new H5(s,this.browserStorage,i,this.logger,this.performanceClient);return await ge(l.handleCodeResponseFromServer.bind(l),G.HandleCodeResponseFromServer,this.logger,this.performanceClient,e.correlationId)({code:e.code,msgraph_host:e.msGraphHost,cloud_graph_host_name:e.cloudGraphHostName,cloud_instance_host_name:e.cloudInstanceHostName},n,!1)}catch(i){throw i instanceof hn&&(i.setCorrelationId(this.correlationId),r.cacheFailedRequest(i)),i}}logout(){return Promise.reject(Be(o0))}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function xre(t,e,n){var s;const r=((s=window.msal)==null?void 0:s.clientIds)||[],i=r.length,o=r.filter(l=>l===t).length;o>1&&n.warning("There is already an instance of MSAL.js in the window with the same client id."),e.add({msalInstanceCount:i,sameClientIdInstanceCount:o})}/*! @azure/msal-browser v4.19.0 2025-08-05 */function is(t){const e=t==null?void 0:t.idTokenClaims;if(e!=null&&e.tfp||e!=null&&e.acr)return"B2C";if(e!=null&&e.tid){if((e==null?void 0:e.tid)==="9188040d-6c67-4c5b-b112-36a304b66dad")return"MSA"}else return;return"AAD"}function Kg(t,e){try{ZE(t)}catch(n){throw e.end({success:!1},n),n}}class u0{constructor(e){this.operatingContext=e,this.isBrowserEnvironment=this.operatingContext.isBrowserEnvironment(),this.config=e.getConfig(),this.initialized=!1,this.logger=this.operatingContext.getLogger(),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.config.telemetry.client,this.browserCrypto=this.isBrowserEnvironment?new xa(this.logger,this.performanceClient):Sy,this.eventHandler=new Une(this.logger),this.browserStorage=this.isBrowserEnvironment?new O1(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,this.performanceClient,this.eventHandler,bte(this.config.auth)):kne(this.config.auth.clientId,this.logger,this.performanceClient,this.eventHandler);const n={cacheLocation:pr.MemoryStorage,cacheRetentionDays:5,temporaryCacheLocation:pr.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new O1(this.config.auth.clientId,n,this.browserCrypto,this.logger,this.performanceClient,this.eventHandler),this.tokenCache=new gre(this.config,this.browserStorage,this.logger,this.browserCrypto),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this)}static async createController(e,n){const r=new u0(e);return await r.initialize(n),r}trackPageVisibility(e){e&&(this.logger.info("Perf: Visibility change detected"),this.performanceClient.incrementFields({visibilityChangeCount:1},e))}async initialize(e,n){if(this.logger.trace("initialize called"),this.initialized){this.logger.info("initialize has already been called, exiting early.");return}if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, exiting early."),this.initialized=!0,this.eventHandler.emitEvent(Ve.INITIALIZE_END);return}const r=(e==null?void 0:e.correlationId)||this.getRequestCorrelationId(),i=this.config.system.allowPlatformBroker,o=this.performanceClient.startMeasurement(G.InitializeClientApplication,r);if(this.eventHandler.emitEvent(Ve.INITIALIZE_START),!n)try{this.logMultipleInstances(o)}catch{}if(await ge(this.browserStorage.initialize.bind(this.browserStorage),G.InitializeCache,this.logger,this.performanceClient,r)(r),i)try{this.platformAuthProvider=await rre(this.logger,this.performanceClient,r,this.config.system.nativeBrokerHandshakeTimeout)}catch(s){this.logger.verbose(s)}this.config.cache.claimsBasedCachingEnabled||(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),Bi(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),G.ClearTokensAndKeysWithClaims,this.logger,this.performanceClient,r)(r)),this.config.system.asyncPopups&&await this.preGeneratePkceCodes(r),this.initialized=!0,this.eventHandler.emitEvent(Ve.INITIALIZE_END),o.end({allowPlatformBroker:i,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),D5(this.initialized),this.isBrowserEnvironment){const n=e||"";let r=this.redirectResponse.get(n);return typeof r>"u"?(r=this.handleRedirectPromiseInternal(e),this.redirectResponse.set(n,r),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise")):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),r}return this.logger.verbose("handleRedirectPromise returns null, not browser environment"),null}async handleRedirectPromiseInternal(e){var c;if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;if(((c=this.browserStorage.getInteractionInProgress())==null?void 0:c.type)===Ga.SIGNOUT)return this.logger.verbose("handleRedirectPromise removing interaction_in_progress flag and returning null after sign-out"),this.browserStorage.setInteractionInProgress(!1),Promise.resolve(null);const r=this.getAllAccounts(),i=this.browserStorage.getCachedNativeRequest(),o=i&&this.platformAuthProvider&&!e;let s;this.eventHandler.emitEvent(Ve.HANDLE_REDIRECT_START,pt.Redirect);let l;try{if(o&&this.platformAuthProvider){s=this.performanceClient.startMeasurement(G.AcquireTokenRedirect,(i==null?void 0:i.correlationId)||""),this.logger.trace("handleRedirectPromise - acquiring token from native platform");const u=new Ov(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,fn.handleRedirectPromise,this.performanceClient,this.platformAuthProvider,i.accountId,this.nativeInternalStorage,i.correlationId);l=ge(u.handleRedirectPromise.bind(u),G.HandleNativeRedirectPromiseMeasurement,this.logger,this.performanceClient,s.event.correlationId)(this.performanceClient,s.event.correlationId)}else{const[u,d]=this.browserStorage.getCachedRequest(),f=u.correlationId;s=this.performanceClient.startMeasurement(G.AcquireTokenRedirect,f),this.logger.trace("handleRedirectPromise - acquiring token from web flow");const h=this.createRedirectClient(f);l=ge(h.handleRedirectPromise.bind(h),G.HandleRedirectPromiseMeasurement,this.logger,this.performanceClient,s.event.correlationId)(e,u,d,s)}}catch(u){throw this.browserStorage.resetRequestCache(),u}return l.then(u=>(u?(this.browserStorage.resetRequestCache(),r.length{this.browserStorage.resetRequestCache();const d=u;throw r.length>0?this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_FAILURE,pt.Redirect,null,d):this.eventHandler.emitEvent(Ve.LOGIN_FAILURE,pt.Redirect,null,d),this.eventHandler.emitEvent(Ve.HANDLE_REDIRECT_END,pt.Redirect),s.end({success:!1},d),u})}async acquireTokenRedirect(e){const n=this.getRequestCorrelationId(e);this.logger.verbose("acquireTokenRedirect called",n);const r=this.performanceClient.startMeasurement(G.AcquireTokenPreRedirect,n);r.add({accountType:is(e.account),scenarioId:e.scenarioId});const i=e.onRedirectNavigate;if(i)e.onRedirectNavigate=s=>{const l=typeof i=="function"?i(s):void 0;return l!==!1?r.end({success:!0}):r.discard(),l};else{const s=this.config.auth.onRedirectNavigate;this.config.auth.onRedirectNavigate=l=>{const c=typeof s=="function"?s(l):void 0;return c!==!1?r.end({success:!0}):r.discard(),c}}const o=this.getAllAccounts().length>0;try{WO(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0,Ga.SIGNIN),o?this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_START,pt.Redirect,e):this.eventHandler.emitEvent(Ve.LOGIN_START,pt.Redirect,e);let s;return this.platformAuthProvider&&this.canUsePlatformBroker(e)?s=new Ov(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,fn.acquireTokenRedirect,this.performanceClient,this.platformAuthProvider,this.getNativeAccountId(e),this.nativeInternalStorage,n).acquireTokenRedirect(e,r).catch(c=>{if(c instanceof ps&&Nu(c))return this.platformAuthProvider=void 0,this.createRedirectClient(n).acquireToken(e);if(c instanceof qo)return this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createRedirectClient(n).acquireToken(e);throw c}):s=this.createRedirectClient(n).acquireToken(e),await s}catch(s){throw this.browserStorage.resetRequestCache(),r.end({success:!1},s),o?this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_FAILURE,pt.Redirect,null,s):this.eventHandler.emitEvent(Ve.LOGIN_FAILURE,pt.Redirect,null,s),s}}acquireTokenPopup(e){const n=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(G.AcquireTokenPopup,n);r.add({scenarioId:e.scenarioId,accountType:is(e.account)});try{this.logger.verbose("acquireTokenPopup called",n),Kg(this.initialized,r),this.browserStorage.setInteractionInProgress(!0,Ga.SIGNIN)}catch(l){return Promise.reject(l)}const i=this.getAllAccounts();i.length>0?this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_START,pt.Popup,e):this.eventHandler.emitEvent(Ve.LOGIN_START,pt.Popup,e);let o;const s=this.getPreGeneratedPkceCodes(n);return this.canUsePlatformBroker(e)?o=this.acquireTokenNative({...e,correlationId:n},fn.acquireTokenPopup).then(l=>(r.end({success:!0,isNativeBroker:!0,accountType:is(l.account)}),l)).catch(l=>{if(l instanceof ps&&Nu(l))return this.platformAuthProvider=void 0,this.createPopupClient(n).acquireToken(e,s);if(l instanceof qo)return this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createPopupClient(n).acquireToken(e,s);throw l}):o=this.createPopupClient(n).acquireToken(e,s),o.then(l=>(i.length(i.length>0?this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_FAILURE,pt.Popup,null,l):this.eventHandler.emitEvent(Ve.LOGIN_FAILURE,pt.Popup,null,l),r.end({success:!1},l),Promise.reject(l))).finally(async()=>{this.browserStorage.setInteractionInProgress(!1),this.config.system.asyncPopups&&await this.preGeneratePkceCodes(n)})}trackPageVisibilityWithMeasurement(){const e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))}async ssoSilent(e){var o,s;const n=this.getRequestCorrelationId(e),r={...e,prompt:e.prompt,correlationId:n};this.ssoSilentMeasurement=this.performanceClient.startMeasurement(G.SsoSilent,n),(o=this.ssoSilentMeasurement)==null||o.add({scenarioId:e.scenarioId,accountType:is(e.account)}),Kg(this.initialized,this.ssoSilentMeasurement),(s=this.ssoSilentMeasurement)==null||s.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",n),this.eventHandler.emitEvent(Ve.SSO_SILENT_START,pt.Silent,r);let i;return this.canUsePlatformBroker(r)?i=this.acquireTokenNative(r,fn.ssoSilent).catch(l=>{if(l instanceof ps&&Nu(l))return this.platformAuthProvider=void 0,this.createSilentIframeClient(r.correlationId).acquireToken(r);throw l}):i=this.createSilentIframeClient(r.correlationId).acquireToken(r),i.then(l=>{var c;return this.eventHandler.emitEvent(Ve.SSO_SILENT_SUCCESS,pt.Silent,l),(c=this.ssoSilentMeasurement)==null||c.end({success:!0,isNativeBroker:l.fromNativeBroker,accessTokenSize:l.accessToken.length,idTokenSize:l.idToken.length,accountType:is(l.account)}),l}).catch(l=>{var c;throw this.eventHandler.emitEvent(Ve.SSO_SILENT_FAILURE,pt.Silent,null,l),(c=this.ssoSilentMeasurement)==null||c.end({success:!1},l),l}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenByCode(e){const n=this.getRequestCorrelationId(e);this.logger.trace("acquireTokenByCode called",n);const r=this.performanceClient.startMeasurement(G.AcquireTokenByCode,n);Kg(this.initialized,r),this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_BY_CODE_START,pt.Silent,e),r.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw Be(v5);if(e.code){const i=e.code;let o=this.hybridAuthCodeResponses.get(i);return o?(this.logger.verbose("Existing acquireTokenByCode request found",n),r.discard()):(this.logger.verbose("Initiating new acquireTokenByCode request",n),o=this.acquireTokenByCodeAsync({...e,correlationId:n}).then(s=>(this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_BY_CODE_SUCCESS,pt.Silent,s),this.hybridAuthCodeResponses.delete(i),r.end({success:!0,isNativeBroker:s.fromNativeBroker,accessTokenSize:s.accessToken.length,idTokenSize:s.idToken.length,accountType:is(s.account)}),s)).catch(s=>{throw this.hybridAuthCodeResponses.delete(i),this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_BY_CODE_FAILURE,pt.Silent,null,s),r.end({success:!1},s),s}),this.hybridAuthCodeResponses.set(i,o)),await o}else if(e.nativeAccountId)if(this.canUsePlatformBroker(e,e.nativeAccountId)){const i=await this.acquireTokenNative({...e,correlationId:n},fn.acquireTokenByCode,e.nativeAccountId).catch(o=>{throw o instanceof ps&&Nu(o)&&(this.platformAuthProvider=void 0),o});return r.end({accountType:is(i.account),success:!0}),i}else throw Be(y5);else throw Be(g5)}catch(i){throw this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_BY_CODE_FAILURE,pt.Silent,null,i),r.end({success:!1},i),i}}async acquireTokenByCodeAsync(e){var i;return this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(G.AcquireTokenByCodeAsync,e.correlationId),(i=this.acquireTokenByCodeAsyncMeasurement)==null||i.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),await this.createSilentAuthCodeClient(e.correlationId).acquireToken(e).then(o=>{var s;return(s=this.acquireTokenByCodeAsyncMeasurement)==null||s.end({success:!0,fromCache:o.fromCache,isNativeBroker:o.fromNativeBroker}),o}).catch(o=>{var s;throw(s=this.acquireTokenByCodeAsyncMeasurement)==null||s.end({success:!1},o),o}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenFromCache(e,n){switch(this.performanceClient.addQueueMeasurement(G.AcquireTokenFromCache,e.correlationId),n){case Xr.Default:case Xr.AccessToken:case Xr.AccessTokenAndRefreshToken:const r=this.createSilentCacheClient(e.correlationId);return ge(r.acquireToken.bind(r),G.SilentCacheClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Ae(gl)}}async acquireTokenByRefreshToken(e,n){switch(this.performanceClient.addQueueMeasurement(G.AcquireTokenByRefreshToken,e.correlationId),n){case Xr.Default:case Xr.AccessTokenAndRefreshToken:case Xr.RefreshToken:case Xr.RefreshTokenAndNetwork:const r=this.createSilentRefreshClient(e.correlationId);return ge(r.acquireToken.bind(r),G.SilentRefreshClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Ae(gl)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(G.AcquireTokenBySilentIframe,e.correlationId);const n=this.createSilentIframeClient(e.correlationId);return ge(n.acquireToken.bind(n),G.SilentIframeClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e)}async logout(e){const n=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",n),this.logoutRedirect({correlationId:n,...e})}async logoutRedirect(e){const n=this.getRequestCorrelationId(e);return WO(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0,Ga.SIGNOUT),this.createRedirectClient(n).logout(e)}logoutPopup(e){try{const n=this.getRequestCorrelationId(e);return ZE(this.initialized),this.browserStorage.setInteractionInProgress(!0,Ga.SIGNOUT),this.createPopupClient(n).logout(e).finally(()=>{this.browserStorage.setInteractionInProgress(!1)})}catch(n){return Promise.reject(n)}}async clearCache(e){if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, returning early.");return}const n=this.getRequestCorrelationId(e);return this.createSilentCacheClient(n).logout(e)}getAllAccounts(e){const n=this.getRequestCorrelationId();return One(this.logger,this.browserStorage,this.isBrowserEnvironment,n,e)}getAccount(e){const n=this.getRequestCorrelationId();return Ine(e,this.logger,this.browserStorage,n)}getAccountByUsername(e){const n=this.getRequestCorrelationId();return Rne(e,this.logger,this.browserStorage,n)}getAccountByHomeId(e){const n=this.getRequestCorrelationId();return Mne(e,this.logger,this.browserStorage,n)}getAccountByLocalId(e){const n=this.getRequestCorrelationId();return Dne(e,this.logger,this.browserStorage,n)}setActiveAccount(e){const n=this.getRequestCorrelationId();$ne(e,this.browserStorage,n)}getActiveAccount(){const e=this.getRequestCorrelationId();return Lne(this.browserStorage,e)}async hydrateCache(e,n){this.logger.verbose("hydrateCache called");const r=Wo.createFromAccountInfo(e.account,e.cloudGraphHostName,e.msGraphHost);return await this.browserStorage.setAccount(r,e.correlationId),e.fromNativeBroker?(this.logger.verbose("Response was from native broker, storing in-memory"),this.nativeInternalStorage.hydrateCache(e,n)):this.browserStorage.hydrateCache(e,n)}async acquireTokenNative(e,n,r,i){if(this.logger.trace("acquireTokenNative called"),!this.platformAuthProvider)throw Be(VE);return new Ov(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,n,this.performanceClient,this.platformAuthProvider,r||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e,i)}canUsePlatformBroker(e,n){if(this.logger.trace("canUsePlatformBroker called"),!this.platformAuthProvider)return this.logger.trace("canUsePlatformBroker: platform broker unavilable, returning false"),!1;if(!Ip(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme))return this.logger.trace("canUsePlatformBroker: isBrokerAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case ri.NONE:case ri.CONSENT:case ri.LOGIN:this.logger.trace("canUsePlatformBroker: prompt is compatible with platform broker flow");break;default:return this.logger.trace(`canUsePlatformBroker: prompt = ${e.prompt} is not compatible with platform broker flow, returning false`),!1}return!n&&!this.getNativeAccountId(e)?(this.logger.trace("canUsePlatformBroker: nativeAccountId is not available, returning false"),!1):!0}getNativeAccountId(e){const n=e.account||this.getAccount({loginHint:e.loginHint,sid:e.sid})||this.getActiveAccount();return n&&n.nativeAccountId||""}createPopupClient(e){return new ore(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createRedirectClient(e){return new are(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createSilentIframeClient(e){return new pre(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,fn.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createSilentCacheClient(e){return new V5(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.platformAuthProvider,e)}createSilentRefreshClient(e){return new mre(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.platformAuthProvider,e)}createSilentAuthCodeClient(e){return new yre(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,fn.acquireTokenByCode,this.performanceClient,this.platformAuthProvider,e)}addEventCallback(e,n){return this.eventHandler.addEventCallback(e,n)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return M5(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){if(this.config.cache.cacheLocation!==pr.LocalStorage){this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");return}this.eventHandler.subscribeCrossTab()}disableAccountStorageEvents(){if(this.config.cache.cacheLocation!==pr.LocalStorage){this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");return}this.eventHandler.unsubscribeCrossTab()}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,n){this.browserStorage.setWrapperMetadata(e,n)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}isBrowserEnv(){return this.isBrowserEnvironment}getRequestCorrelationId(e){return e!=null&&e.correlationId?e.correlationId:this.isBrowserEnvironment?Yo():ve.EMPTY_STRING}async loginRedirect(e){const n=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",n),this.acquireTokenRedirect({correlationId:n,...e||HO})}loginPopup(e){const n=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",n),this.acquireTokenPopup({correlationId:n,...e||HO})}async acquireTokenSilent(e){const n=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(G.AcquireTokenSilent,n);r.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),Kg(this.initialized,r),this.logger.verbose("acquireTokenSilent called",n);const i=e.account||this.getActiveAccount();if(!i)throw Be(c5);return r.add({accountType:is(i)}),this.acquireTokenSilentDeduped(e,i,n).then(o=>(r.end({success:!0,fromCache:o.fromCache,isNativeBroker:o.fromNativeBroker,accessTokenSize:o.accessToken.length,idTokenSize:o.idToken.length}),{...o,state:e.state,correlationId:n})).catch(o=>{throw o instanceof hn&&o.setCorrelationId(n),r.end({success:!1},o),o})}async acquireTokenSilentDeduped(e,n,r){const i=t0(this.config.auth.clientId,{...e,authority:e.authority||this.config.auth.authority,correlationId:r},n.homeAccountId),o=JSON.stringify(i),s=this.activeSilentTokenRequests.get(o);if(typeof s>"u"){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",r),this.performanceClient.addFields({deduped:!1},r);const l=ge(this.acquireTokenSilentAsync.bind(this),G.AcquireTokenSilentAsync,this.logger,this.performanceClient,r)({...e,correlationId:r},n);return this.activeSilentTokenRequests.set(o,l),l.finally(()=>{this.activeSilentTokenRequests.delete(o)})}else return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",r),this.performanceClient.addFields({deduped:!0},r),s}async acquireTokenSilentAsync(e,n){const r=()=>this.trackPageVisibility(e.correlationId);this.performanceClient.addQueueMeasurement(G.AcquireTokenSilentAsync,e.correlationId),this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_START,pt.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",r);const i=await ge(Bne,G.InitializeSilentRequest,this.logger,this.performanceClient,e.correlationId)(e,n,this.config,this.performanceClient,this.logger),o=e.cacheLookupPolicy||Xr.Default;return this.acquireTokenSilentNoIframe(i,o).catch(async l=>{if(bre(l,o))if(this.activeIframeRequest)if(o!==Xr.Skip){const[u,d]=this.activeIframeRequest;this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${d}`,i.correlationId);const f=this.performanceClient.startMeasurement(G.AwaitConcurrentIframe,i.correlationId);f.add({awaitIframeCorrelationId:d});const h=await u;if(f.end({success:h}),h)return this.logger.verbose(`Parallel iframe request with correlationId: ${d} succeeded. Retrying cache and/or RT redemption`,i.correlationId),this.acquireTokenSilentNoIframe(i,o);throw this.logger.info(`Iframe request with correlationId: ${d} failed. Interaction is required.`),l}else return this.logger.warning("Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.",i.correlationId),ge(this.acquireTokenBySilentIframe.bind(this),G.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i);else{let u;return this.activeIframeRequest=[new Promise(d=>{u=d}),i.correlationId],this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",i.correlationId),ge(this.acquireTokenBySilentIframe.bind(this),G.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i).then(d=>(u(!0),d)).catch(d=>{throw u(!1),d}).finally(()=>{this.activeIframeRequest=void 0})}else throw l}).then(l=>(this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_SUCCESS,pt.Silent,l),e.correlationId&&this.performanceClient.addFields({fromCache:l.fromCache,isNativeBroker:l.fromNativeBroker},e.correlationId),l)).catch(l=>{throw this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_FAILURE,pt.Silent,null,l),l}).finally(()=>{document.removeEventListener("visibilitychange",r)})}async acquireTokenSilentNoIframe(e,n){return Ip(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme)&&e.account.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),this.acquireTokenNative(e,fn.acquireTokenSilent_silentFlow,e.account.nativeAccountId,n).catch(async r=>{throw r instanceof ps&&Nu(r)?(this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.platformAuthProvider=void 0,Ae(gl)):r})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),n===Xr.AccessToken&&this.logger.verbose("acquireTokenSilent - cache lookup policy set to AccessToken, attempting to acquire token from local cache"),ge(this.acquireTokenFromCache.bind(this),G.AcquireTokenFromCache,this.logger,this.performanceClient,e.correlationId)(e,n).catch(r=>{if(n===Xr.AccessToken)throw r;return this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_NETWORK_START,pt.Silent,e),ge(this.acquireTokenByRefreshToken.bind(this),G.AcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,n)}))}async preGeneratePkceCodes(e){return this.logger.verbose("Generating new PKCE codes"),this.pkceCode=await ge(l0,G.GeneratePkceCodes,this.logger,this.performanceClient,e)(this.performanceClient,this.logger,e),Promise.resolve()}getPreGeneratedPkceCodes(e){this.logger.verbose("Attempting to pick up pre-generated PKCE codes");const n=this.pkceCode?{...this.pkceCode}:void 0;return this.pkceCode=void 0,this.logger.verbose(`${n?"Found":"Did not find"} pre-generated PKCE codes`),this.performanceClient.addFields({usePreGeneratedPkce:!!n},e),n}logMultipleInstances(e){const n=this.config.auth.clientId;if(!window)return;window.msal=window.msal||{},window.msal.clientIds=window.msal.clientIds||[],window.msal.clientIds.length>0&&this.logger.verbose("There is already an instance of MSAL.js in the window."),window.msal.clientIds.push(n),xre(n,e,this.logger)}}function bre(t,e){const n=!(t instanceof qo&&t.subError!==r0),r=t.errorCode===gi.INVALID_GRANT_ERROR||t.errorCode===gl,i=n&&r||t.errorCode===ky||t.errorCode===IE,o=Yte.includes(e);return i&&o}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function wre(t,e){const n=new Yc(t);return await n.initialize(),u0.createController(n,e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class lN{static async createPublicClientApplication(e){const n=await wre(e);return new lN(e,n)}constructor(e,n){this.isBroker=!1,this.controller=n||new u0(new Yc(e))}async initialize(e){return this.controller.initialize(e,this.isBroker)}async acquireTokenPopup(e){return this.controller.acquireTokenPopup(e)}acquireTokenRedirect(e){return this.controller.acquireTokenRedirect(e)}acquireTokenSilent(e){return this.controller.acquireTokenSilent(e)}acquireTokenByCode(e){return this.controller.acquireTokenByCode(e)}addEventCallback(e,n){return this.controller.addEventCallback(e,n)}removeEventCallback(e){return this.controller.removeEventCallback(e)}addPerformanceCallback(e){return this.controller.addPerformanceCallback(e)}removePerformanceCallback(e){return this.controller.removePerformanceCallback(e)}enableAccountStorageEvents(){this.controller.enableAccountStorageEvents()}disableAccountStorageEvents(){this.controller.disableAccountStorageEvents()}getAccount(e){return this.controller.getAccount(e)}getAccountByHomeId(e){return this.controller.getAccountByHomeId(e)}getAccountByLocalId(e){return this.controller.getAccountByLocalId(e)}getAccountByUsername(e){return this.controller.getAccountByUsername(e)}getAllAccounts(e){return this.controller.getAllAccounts(e)}handleRedirectPromise(e){return this.controller.handleRedirectPromise(e)}loginPopup(e){return this.controller.loginPopup(e)}loginRedirect(e){return this.controller.loginRedirect(e)}logout(e){return this.controller.logout(e)}logoutRedirect(e){return this.controller.logoutRedirect(e)}logoutPopup(e){return this.controller.logoutPopup(e)}ssoSilent(e){return this.controller.ssoSilent(e)}getTokenCache(){return this.controller.getTokenCache()}getLogger(){return this.controller.getLogger()}setLogger(e){this.controller.setLogger(e)}setActiveAccount(e){this.controller.setActiveAccount(e)}getActiveAccount(){return this.controller.getActiveAccount()}initializeWrapperLibrary(e,n){return this.controller.initializeWrapperLibrary(e,n)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}async hydrateCache(e,n){return this.controller.hydrateCache(e,n)}clearCache(e){return this.controller.clearCache(e)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Sre={initialize:()=>Promise.reject(Jn(Zn)),acquireTokenPopup:()=>Promise.reject(Jn(Zn)),acquireTokenRedirect:()=>Promise.reject(Jn(Zn)),acquireTokenSilent:()=>Promise.reject(Jn(Zn)),acquireTokenByCode:()=>Promise.reject(Jn(Zn)),getAllAccounts:()=>[],getAccount:()=>null,getAccountByHomeId:()=>null,getAccountByUsername:()=>null,getAccountByLocalId:()=>null,handleRedirectPromise:()=>Promise.reject(Jn(Zn)),loginPopup:()=>Promise.reject(Jn(Zn)),loginRedirect:()=>Promise.reject(Jn(Zn)),logout:()=>Promise.reject(Jn(Zn)),logoutRedirect:()=>Promise.reject(Jn(Zn)),logoutPopup:()=>Promise.reject(Jn(Zn)),ssoSilent:()=>Promise.reject(Jn(Zn)),addEventCallback:()=>null,removeEventCallback:()=>{},addPerformanceCallback:()=>"",removePerformanceCallback:()=>!1,enableAccountStorageEvents:()=>{},disableAccountStorageEvents:()=>{},getTokenCache:()=>{throw Jn(Zn)},getLogger:()=>{throw Jn(Zn)},setLogger:()=>{},setActiveAccount:()=>{},getActiveAccount:()=>null,initializeWrapperLibrary:()=>{},setNavigationClient:()=>{},getConfiguration:()=>{throw Jn(Zn)},hydrateCache:()=>Promise.reject(Jn(Zn)),clearCache:()=>Promise.reject(Jn(Zn))};/*! @azure/msal-browser v4.19.0 2025-08-05 */class Cre{static getInteractionStatusFromEvent(e,n){switch(e.eventType){case Ve.LOGIN_START:return ar.Login;case Ve.SSO_SILENT_START:return ar.SsoSilent;case Ve.ACQUIRE_TOKEN_START:if(e.interactionType===pt.Redirect||e.interactionType===pt.Popup)return ar.AcquireToken;break;case Ve.HANDLE_REDIRECT_START:return ar.HandleRedirect;case Ve.LOGOUT_START:return ar.Logout;case Ve.SSO_SILENT_SUCCESS:case Ve.SSO_SILENT_FAILURE:if(n&&n!==ar.SsoSilent)break;return ar.None;case Ve.LOGOUT_END:if(n&&n!==ar.Logout)break;return ar.None;case Ve.HANDLE_REDIRECT_END:if(n&&n!==ar.HandleRedirect)break;return ar.None;case Ve.LOGIN_SUCCESS:case Ve.LOGIN_FAILURE:case Ve.ACQUIRE_TOKEN_SUCCESS:case Ve.ACQUIRE_TOKEN_FAILURE:case Ve.RESTORE_FROM_BFCACHE:if(e.interactionType===pt.Redirect||e.interactionType===pt.Popup){if(n&&n!==ar.Login&&n!==ar.AcquireToken)break;return ar.None}break}return null}}const Are="modulepreload",_re=function(t){return"/semblance/"+t},iI={},jre=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),l=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));i=Promise.allSettled(n.map(c=>{if(c=_re(c),c in iI)return;iI[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":Are,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 o(s){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=s,window.dispatchEvent(l),!l.defaultPrevented)throw s}return i.then(s=>{for(const l of s||[])l.status==="rejected"&&o(l.reason);return e().catch(o)})};/*! @azure/msal-react v3.0.17 2025-08-05 */const Ere={instance:Sre,inProgress:ar.None,accounts:[],logger:new ya({})},cN=y.createContext(Ere);cN.Consumer;/*! @azure/msal-react v3.0.17 2025-08-05 */function oI(t,e){if(t.length!==e.length)return!1;const n=[...e];return t.every(r=>{const i=n.shift();return!r||!i?!1:r.homeAccountId===i.homeAccountId&&r.localAccountId===i.localAccountId&&r.username===i.username})}/*! @azure/msal-react v3.0.17 2025-08-05 */const Nre="@azure/msal-react",sI="3.0.17";/*! @azure/msal-react v3.0.17 2025-08-05 */const Uy={UNBLOCK_INPROGRESS:"UNBLOCK_INPROGRESS",EVENT:"EVENT"},Tre=(t,e)=>{const{type:n,payload:r}=e;let i=t.inProgress;switch(n){case Uy.UNBLOCK_INPROGRESS:t.inProgress===ar.Startup&&(i=ar.None,r.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));break;case Uy.EVENT:const s=r.message,l=Cre.getInteractionStatusFromEvent(s,t.inProgress);l&&(r.logger.info(`MsalProvider - ${s.eventType} results in setting inProgress from ${t.inProgress} to ${l}`),i=l);break;default:throw new Error(`Unknown action type: ${n}`)}if(i===ar.Startup)return t;const o=r.instance.getAllAccounts();return i!==t.inProgress&&!oI(o,t.accounts)?{...t,inProgress:i,accounts:o}:i!==t.inProgress?{...t,inProgress:i}:oI(o,t.accounts)?t:{...t,accounts:o}};function Pre({instance:t,children:e}){y.useEffect(()=>{t.initializeWrapperLibrary(Kte.React,sI)},[t]);const n=y.useMemo(()=>t.getLogger().clone(Nre,sI),[t]),[r,i]=y.useReducer(Tre,void 0,()=>({inProgress:ar.Startup,accounts:[]}));y.useEffect(()=>{const s=t.addEventCallback(l=>{i({payload:{instance:t,logger:n,message:l},type:Uy.EVENT})});return n.verbose(`MsalProvider - Registered event callback with id: ${s}`),t.initialize().then(()=>{t.handleRedirectPromise().catch(()=>{}).finally(()=>{i({payload:{instance:t,logger:n},type:Uy.UNBLOCK_INPROGRESS})})}).catch(()=>{}),()=>{s&&(n.verbose(`MsalProvider - Removing event callback ${s}`),t.removeEventCallback(s))}},[t,n]);const o={instance:t,inProgress:r.inProgress,accounts:r.accounts,logger:n};return T.createElement(cN.Provider,{value:o},e)}/*! @azure/msal-react v3.0.17 2025-08-05 */const kre=()=>y.useContext(cN),Ore={auth:{clientId:"7e9b250a-d984-4fba-8e1c-a0622242a595",authority:"https://login.microsoftonline.com/e519c2e6-bc6d-4fdf-8d9c-923c2f002385",redirectUri:"https://ai-sandbox.oliver.solutions/semblance",postLogoutRedirectUri:"https://ai-sandbox.oliver.solutions/semblance"},cache:{cacheLocation:"localStorage",storeAuthStateInCookie:!1},system:{loggerOptions:{loggerCallback:(t,e,n)=>{n||console.log(e)},logLevel:jn.Verbose,piiLoggingEnabled:!1},allowNativeBroker:!1}},Ire={scopes:["openid","profile","email"],prompt:"select_account",extraQueryParameters:{code_challenge_method:"S256"}},W5=y.createContext(void 0);function Rre({children:t}){const[e,n]=y.useState(null),[r,i]=y.useState(null),[o,s]=y.useState(!0),[l,c]=y.useState(!1),u=Xn(),{instance:d,accounts:f,inProgress:h}=kre();y.useEffect(()=>{const w=S=>{const A=S.detail||{};if(A.isPersonaCreation){console.log("Ignoring auth error from persona creation",A);return}i(null),n(null),se.error("Session expired",{description:"Please log in again"}),u("/login")};return window.addEventListener(g1,w),()=>{window.removeEventListener(g1,w)}},[u]),y.useEffect(()=>{const w=localStorage.getItem("auth_token"),S=localStorage.getItem("user");if(console.log("AuthContext initializing - stored data check:",{hasToken:!!w,hasUser:!!S}),w&&S)try{i(w),n(JSON.parse(S)),console.log("User session restored from localStorage")}catch(C){console.error("Failed to parse stored user data:",C),localStorage.removeItem("auth_token"),localStorage.removeItem("user")}else console.log("No stored authentication data found");s(!1)},[]),y.useEffect(()=>{if(r){console.log("Verifying token...");const w=`token_validated_${r.substring(0,10)}`;if(sessionStorage.getItem(w)==="true"&&e){console.log("Token already validated this session, skipping validation");return}Tv.getProfile().then(C=>{C&&"data"in C&&(console.log("Profile verified successfully"),n(C.data),sessionStorage.setItem(w,"true"))}).catch(C=>{C.response&&C.response.status===401?(console.error("Token invalid (401):",C),localStorage.removeItem("auth_token"),localStorage.removeItem("user"),i(null),n(null)):(console.warn("Profile validation error (not clearing token):",C),sessionStorage.setItem(w,"true"))})}else console.log("No token available, not validating profile")},[r,e]);const p=async(w,S)=>{var C,A;s(!0),console.log("Attempting login for user:",w);try{const _=await Tv.login(w,S);if(console.log("Login API response received"),!_.data.access_token)throw new Error("No access token received from server");return localStorage.setItem("auth_token",_.data.access_token),localStorage.setItem("user",JSON.stringify(_.data.user)),i(_.data.access_token),n(_.data.user),console.log("Authentication state updated"),se.success("Login successful!"),_.data.access_token}catch(_){throw console.error("Login failed:",_),se.error("Login failed",{description:((A=(C=_.response)==null?void 0:C.data)==null?void 0:A.message)||"Invalid username or password"}),_}finally{s(!1)}},g=async()=>{c(!0);try{console.log("Starting Microsoft authentication...");const w=await d.loginPopup(Ire);if(w&&w.account&&w.accessToken){console.log("Microsoft authentication successful",w.account);const S=await Tv.loginWithMicrosoft(w.accessToken);S.data.access_token&&(localStorage.setItem("auth_token",S.data.access_token),localStorage.setItem("user",JSON.stringify(S.data.user)),localStorage.setItem("auth_type","microsoft"),i(S.data.access_token),n(S.data.user),console.log("Microsoft user authenticated and stored"),se.success("Successfully signed in with Microsoft!"))}}catch(w){throw console.error("Microsoft login failed:",w),w.name==="BrowserAuthError"&&w.errorCode==="popup_window_error"?se.error("Sign-in cancelled",{description:"The sign-in popup was closed before completing authentication."}):w.name==="InteractionRequiredAuthError"?se.error("Authentication required",{description:"Please complete the authentication process."}):se.error("Microsoft sign-in failed",{description:w.message||"An error occurred during authentication"}),w}finally{c(!1)}},m=async()=>{const w=localStorage.getItem("auth_type");if(localStorage.removeItem("auth_token"),localStorage.removeItem("user"),localStorage.removeItem("auth_type"),i(null),n(null),w==="microsoft"&&f.length>0)try{await d.logoutPopup({account:f[0],postLogoutRedirectUri:window.location.origin+"/semblance/"})}catch(S){console.error("Microsoft logout error:",S)}se.info("You have been logged out")},v=!!localStorage.getItem("auth_token"),x={user:e,token:r,isLoading:o,login:p,loginWithMicrosoft:g,logout:m,isAuthenticated:!!r||v,isMsalLoading:l};return a.jsx(W5.Provider,{value:x,children:t})}function cu(){const t=y.useContext(W5);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t}function aa(){const[t,e]=y.useState(!1),n=Ei(),r=Xn(),{isAuthenticated:i,logout:o}=cu(),s=[{name:"Home",href:"/",icon:my},{name:"Synthetic Personas",href:"/synthetic-users",icon:Cr},{name:"Focus Groups",href:"/focus-groups",icon:Ps},{name:"Dashboard",href:"/dashboard",icon:c1}],l=()=>{e(!t)},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(oo,{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:[s.map(d=>a.jsx("li",{children:d.href==="/"?a.jsxs(oo,{to:d.href,className:ke("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:ke("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:()=>{o(),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(sO,{className:"mr-1 h-4 w-4"}),"Logout"]}):a.jsxs(oo,{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(oO,{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"}),t?a.jsx($o,{className:"block h-6 w-6","aria-hidden":"true"}):a.jsx(UX,{className:"block h-6 w-6","aria-hidden":"true"})]})})]})}),t&&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:[s.map(d=>a.jsx("div",{children:d.href==="/"?a.jsxs(oo,{to:d.href,className:ke("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:()=>e(!1),children:[a.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]}):a.jsxs("button",{className:ke("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:()=>{e(!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:()=>{o(),e(!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(sO,{className:"mr-3 h-5 w-5"}),"Logout"]}):a.jsxs(oo,{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:()=>e(!1),children:[a.jsx(oO,{className:"mr-3 h-5 w-5"}),"Login"]})]})})]})}const aI=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,lI=Nt,uN=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return lI(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=e,s=Object.keys(i).map(u=>{const d=n==null?void 0:n[u],f=o==null?void 0:o[u];if(d===null)return null;const h=aI(d)||aI(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=e==null||(r=e.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,v]=g;return Array.isArray(v)?v.includes({...o,...l}[m]):{...o,...l}[m]===v})?[...u,f,h]:u},[]);return lI(t,s,c,n==null?void 0:n.class,n==null?void 0:n.className)},dN=uN("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"}}),te=y.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...i},o)=>{const s=r?Es:"button";return a.jsx(s,{className:ke(dN({variant:e,size:n,className:t})),ref:o,...i})});te.displayName="Button";function Mre(){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(oo,{to:"/synthetic-users",children:a.jsxs(te,{className:"px-6 py-6 text-base hover:shadow-lg hover:translate-y-[-2px] button-transition",children:["Create synthetic personas",a.jsx(Zi,{className:"ml-2 h-4 w-4"})]})}),a.jsxs(oo,{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(t=>a.jsx("div",{className:`flex ${t%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 ${t%2===0?"bg-primary text-white":"bg-gray-200 text-gray-800"}`,children:[t===1&&"What qualities do you look for in a premium shampoo brand?",t===2&&"I value natural ingredients and a brand that feels luxurious but still eco-friendly.",t===3&&"How important is fragrance in your shampoo selection?",t===4&&"Very important - it affects my mood and how I feel about the product throughout the day."]})},t))})]})})]}),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 yu({title:t,description:e,icon:n,className:r}){return a.jsxs("div",{className:ke("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:t}),a.jsx("p",{className:"text-gray-600 text-sm",children:e})]})]})}const Dre=()=>(cu(),Xn(),a.jsxs("div",{className:"min-h-screen overflow-hidden bg-background",children:[a.jsx(aa,{}),a.jsx("main",{children:a.jsxs("div",{className:"pt-16",children:[a.jsx(Mre,{}),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(yu,{title:"Scalable Research",description:"Create and test with thousands of synthetic personas, each with unique demographic profiles and behaviors.",icon:Cr}),a.jsx(yu,{title:"AI-Driven Focus Groups",description:"Run autonomous focus groups moderated by AI that adapts to participant responses in real-time.",icon:Ps}),a.jsx(yu,{title:"Instant Analysis",description:"Generate comprehensive reports and visualizations that highlight key insights and patterns.",icon:c1}),a.jsx(yu,{title:"Diverse Perspectives",description:"Access synthetic personas from various backgrounds, ensuring representation across age, gender, and location.",icon:Cr}),a.jsx(yu,{title:"Dynamic Discussions",description:"AI moderators guide conversations naturally, following up on interesting points without bias.",icon:WX}),a.jsx(yu,{title:"Comprehensive Reporting",description:"Export detailed reports with sentiment analysis, key themes, and actionable recommendations.",icon:c1})]})]})}),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(oo,{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(oo,{to:"/",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Home"})}),a.jsx("li",{children:a.jsx(oo,{to:"/synthetic-users",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Synthetic Personas"})}),a.jsx("li",{children:a.jsx(oo,{to:"/focus-groups",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Focus Groups"})}),a.jsx("li",{children:a.jsx(oo,{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."]})})]})]})})]})),$re=()=>{const t=Ei(),e=Xn();y.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname]);const n=t.pathname.startsWith("/synthetic-users/"),i=new URLSearchParams(t.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(te,{onClick:()=>e("/synthetic-users?mode=create&tab=ai&step=review"),className:"mb-2 w-full",children:"Return to Review Page"}):a.jsx(te,{onClick:()=>e("/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(te,{variant:"outline",onClick:()=>e("/"),className:"w-full",children:"Return to Home"})]})})};function Lre(t,e=[]){let n=[];function r(o,s){const l=y.createContext(s),c=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][c])||l,v=y.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:v,children:p})}function d(f,h){const p=(h==null?void 0:h[t][c])||l,g=y.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>y.createContext(s));return function(l){const c=(l==null?void 0:l[t])||o;return y.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,Fre(i,...e)]}function Fre(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(o)[`__scope${u}`];return{...l,...f}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var fN="Progress",hN=100,[Ure,zDe]=Lre(fN),[Bre,Hre]=Ure(fN),q5=y.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:i,getValueLabel:o=zre,...s}=t;(i||i===0)&&!cI(i)&&console.error(Vre(`${i}`,"Progress"));const l=cI(i)?i:hN;r!==null&&!uI(r,l)&&console.error(Gre(`${r}`,"Progress"));const c=uI(r,l)?r:null,u=By(c)?o(c,l):void 0;return a.jsx(Bre,{scope:n,value:c,max:l,children:a.jsx(et.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":By(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":X5(c,l),"data-value":c??void 0,"data-max":l,...s,ref:e})})});q5.displayName=fN;var Y5="ProgressIndicator",Q5=y.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,i=Hre(Y5,n);return a.jsx(et.div,{"data-state":X5(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:e})});Q5.displayName=Y5;function zre(t,e){return`${Math.round(t/e*100)}%`}function X5(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function By(t){return typeof t=="number"}function cI(t){return By(t)&&!isNaN(t)&&t>0}function uI(t,e){return By(t)&&!isNaN(t)&&t<=e&&t>=0}function Vre(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${hN}\`.`}function Gre(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: +${s}`);return}throw z3(e.error,e.error_description,e.suberror)?new qo(e.error,e.error_description,e.suberror,e.timestamp||ve.EMPTY_STRING,e.trace_id||ve.EMPTY_STRING,e.correlation_id||ve.EMPTY_STRING,e.claims||ve.EMPTY_STRING,o):s}}async handleServerTokenResponse(e,n,r,i,o,s,l,c,u){var g;(g=this.performanceClient)==null||g.addQueueMeasurement(G.HandleServerTokenResponse,e.correlation_id);let d;if(e.id_token){if(d=wf(e.id_token||ve.EMPTY_STRING,this.cryptoObj.base64Decode),o&&o.nonce&&d.nonce!==o.nonce)throw Ae(K4);if(i.maxAge||i.maxAge===0){const m=d.auth_time;if(!m)throw Ae(oE);y3(m,i.maxAge)}}this.homeAccountIdentifier=Wo.generateHomeAccountId(e.client_info||ve.EMPTY_STRING,n.authorityType,this.logger,this.cryptoObj,d);let f;o&&o.state&&(f=Sf.parseRequestState(this.cryptoObj,o.state)),e.key_id=e.key_id||i.sshKid||void 0;const h=this.generateCacheRecord(e,n,r,i,d,s,o);let p;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),p=new jte(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(p)),l&&!c&&h.account){const m=this.cacheStorage.generateAccountKey(h.account.getAccountInfo());if(!this.cacheStorage.getAccount(m,i.correlationId))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),await Wc.generateAuthenticationResult(this.cryptoObj,n,h,!1,i,d,f,void 0,u)}await this.cacheStorage.saveCacheRecord(h,i.correlationId,i.storeInCache)}finally{this.persistencePlugin&&this.serializableCache&&p&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(p))}return Wc.generateAuthenticationResult(this.cryptoObj,n,h,!1,i,d,f,e,u)}generateCacheRecord(e,n,r,i,o,s,l){const c=n.getPreferredCache();if(!c)throw Ae(aE);const u=B3(o);let d,f;e.id_token&&o&&(d=Jb(this.homeAccountIdentifier,c,e.id_token,this.clientId,u||""),f=RE(this.cacheStorage,n,this.homeAccountIdentifier,this.cryptoObj.base64Decode,i.correlationId,o,e.client_info,c,u,l,void 0,this.logger));let h=null;if(e.access_token){const m=e.scope?hr.fromString(e.scope):new hr(i.scopes||[]),v=(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,b=(typeof e.ext_expires_in=="string"?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,x=(typeof e.refresh_in=="string"?parseInt(e.refresh_in,10):e.refresh_in)||void 0,w=r+v,S=w+b,C=x&&x>0?r+x:void 0;h=Zb(this.homeAccountIdentifier,c,e.access_token,this.clientId,u||n.tenant||"",m.printScopes(),w,S,this.cryptoObj.base64Decode,C,e.token_type,s,e.key_id,i.claims,i.requestedClaimsHash)}let p=null;if(e.refresh_token){let m;if(e.refresh_token_expires_in){const v=typeof e.refresh_token_expires_in=="string"?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in;m=r+v}p=L3(this.homeAccountIdentifier,c,e.refresh_token,this.clientId,e.foci,s,m)}let g=null;return e.foci&&(g={clientId:this.clientId,environment:c,familyId:e.foci}),{account:f,idToken:d,accessToken:h,refreshToken:p,appMetadata:g}}static async generateAuthenticationResult(e,n,r,i,o,s,l,c,u){var w,S,C,A,_;let d=ve.EMPTY_STRING,f=[],h=null,p,g,m=ve.EMPTY_STRING;if(r.accessToken){if(r.accessToken.tokenType===an.POP&&!o.popKid){const j=new kd(e),{secret:k,keyId:P}=r.accessToken;if(!P)throw Ae(lE);d=await j.signPopToken(k,P,o)}else d=r.accessToken.secret;f=hr.fromString(r.accessToken.target).asArray(),h=id(r.accessToken.expiresOn),p=id(r.accessToken.extendedExpiresOn),r.accessToken.refreshOn&&(g=id(r.accessToken.refreshOn))}r.appMetadata&&(m=r.appMetadata.familyId===yy?yy:"");const v=(s==null?void 0:s.oid)||(s==null?void 0:s.sub)||"",b=(s==null?void 0:s.tid)||"";c!=null&&c.spa_accountid&&r.account&&(r.account.nativeAccountId=c==null?void 0:c.spa_accountid);const x=r.account?vE(r.account.getAccountInfo(),void 0,s,(w=r.idToken)==null?void 0:w.secret):null;return{authority:n.canonicalAuthority,uniqueId:v,tenantId:b,scopes:f,account:x,idToken:((S=r==null?void 0:r.idToken)==null?void 0:S.secret)||"",idTokenClaims:s||{},accessToken:d,fromCache:i,expiresOn:h,extExpiresOn:p,refreshOn:g,correlationId:o.correlationId,requestId:u||ve.EMPTY_STRING,familyId:m,tokenType:((C=r.accessToken)==null?void 0:C.tokenType)||ve.EMPTY_STRING,state:l?l.userRequestState:ve.EMPTY_STRING,cloudGraphHostName:((A=r.account)==null?void 0:A.cloudGraphHostName)||ve.EMPTY_STRING,msGraphHost:((_=r.account)==null?void 0:_.msGraphHost)||ve.EMPTY_STRING,code:c==null?void 0:c.spa_code,fromNativeBroker:!1}}}function RE(t,e,n,r,i,o,s,l,c,u,d,f){f==null||f.verbose("setCachedAccount called");const p=t.getAccountKeys().find(x=>x.startsWith(n));let g=null;p&&(g=t.getAccount(p,i));const m=g||Wo.createAccount({homeAccountId:n,idTokenClaims:o,clientInfo:s,environment:l,cloudGraphHostName:u==null?void 0:u.cloud_graph_host_name,msGraphHost:u==null?void 0:u.msgraph_host,nativeAccountId:d},e,r),v=m.tenantProfiles||[],b=c||m.realm;if(b&&!v.find(x=>x.tenantId===b)){const x=gE(n,m.localAccountId,b,o);v.push(x)}return m.tenantProfiles=v,m}/*! @azure/msal-common v15.10.0 2025-08-05 */async function V3(t,e,n){return typeof t=="string"?t:t({clientId:e,tokenEndpoint:n})}/*! @azure/msal-common v15.10.0 2025-08-05 */class G3 extends kE{constructor(e,n){var r;super(e,n),this.includeRedirectUri=!0,this.oidcDefaultScopes=(r=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:r.defaultScopes}async acquireToken(e,n){var l,c;if((l=this.performanceClient)==null||l.addQueueMeasurement(G.AuthClientAcquireToken,e.correlationId),!e.code)throw Ae(Y4);const r=_i(),i=await ge(this.executeTokenRequest.bind(this),G.AuthClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(this.authority,e),o=(c=i.headers)==null?void 0:c[ei.X_MS_REQUEST_ID],s=new Wc(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return s.validateTokenResponse(i.body),ge(s.handleServerTokenResponse.bind(s),G.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(i.body,this.authority,r,e,n,void 0,void 0,void 0,o)}getLogoutUri(e){if(!e)throw gn(c3);const n=this.createLogoutUrlQueryString(e);return Kt.appendQueryString(this.authority.endSessionEndpoint,n)}async executeTokenRequest(e,n){var u;(u=this.performanceClient)==null||u.addQueueMeasurement(G.AuthClientExecuteTokenRequest,n.correlationId);const r=this.createTokenQueryParameters(n),i=Kt.appendQueryString(e.tokenEndpoint,r),o=await ge(this.createTokenRequestBody.bind(this),G.AuthClientCreateTokenRequestBody,this.logger,this.performanceClient,n.correlationId)(n);let s;if(n.clientInfo)try{const d=_y(n.clientInfo,this.cryptoUtils.base64Decode);s={credential:`${d.uid}${jp.CLIENT_INFO_SEPARATOR}${d.utid}`,type:Oo.HOME_ACCOUNT_ID}}catch(d){this.logger.verbose("Could not parse client info for CCS Header: "+d)}const l=this.createTokenRequestHeaders(s||n.ccsCredential),c=e0(this.config.authOptions.clientId,n);return ge(this.executePostToTokenEndpoint.bind(this),G.AuthorizationCodeClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,n.correlationId)(i,o,l,c,n.correlationId,G.AuthorizationCodeClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var i,o;(i=this.performanceClient)==null||i.addQueueMeasurement(G.AuthClientCreateTokenRequestBody,e.correlationId);const n=new Map;if(SE(n,e.embeddedClientId||((o=e.tokenBodyParameters)==null?void 0:o[Kc])||this.config.authOptions.clientId),this.includeRedirectUri)CE(n,e.redirectUri);else if(!e.redirectUri)throw gn(i3);if(wE(n,e.scopes,!0,this.oidcDefaultScopes),ete(n,e.code),jE(n,this.config.libraryInfo),EE(n,this.config.telemetry.application),$3(n),this.serverTelemetryManager&&!A3(this.config)&&D3(n,this.serverTelemetryManager),e.codeVerifier&&nte(n,e.codeVerifier),this.config.clientCredentials.clientSecret&&P3(n,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const s=this.config.clientCredentials.clientAssertion;k3(n,await V3(s.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),O3(n,s.assertionType)}if(I3(n,L4.AUTHORIZATION_CODE_GRANT),NE(n),e.authenticationScheme===an.POP){const s=new kd(this.cryptoUtils,this.performanceClient);let l;e.popKid?l=this.cryptoUtils.encodeKid(e.popKid):l=(await ge(s.generateCnf.bind(s),G.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,TE(n,l)}else if(e.authenticationScheme===an.SSH)if(e.sshJwk)M3(n,e.sshJwk);else throw gn(qb);(!Ss.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&AE(n,e.claims,this.config.authOptions.clientCapabilities);let r;if(e.clientInfo)try{const s=_y(e.clientInfo,this.cryptoUtils.base64Decode);r={credential:`${s.uid}${jp.CLIENT_INFO_SEPARATOR}${s.utid}`,type:Oo.HOME_ACCOUNT_ID}}catch(s){this.logger.verbose("Could not parse client info for CCS Header: "+s)}else r=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&r)switch(r.type){case Oo.HOME_ACCOUNT_ID:try{const s=rd(r.credential);Fh(n,s)}catch(s){this.logger.verbose("Could not parse home account ID for CCS Header: "+s)}break;case Oo.UPN:Ny(n,r.credential);break}return e.embeddedClientId&&Qb(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenBodyParameters&&vl(n,e.tokenBodyParameters),e.enableSpaAuthorizationCode&&(!e.tokenBodyParameters||!e.tokenBodyParameters[PO])&&vl(n,{[PO]:"1"}),Yb(n,e.correlationId,this.performanceClient),Ep(n)}createLogoutUrlQueryString(e){const n=new Map;return e.postLogoutRedirectUri&&Yee(n,e.postLogoutRedirectUri),e.correlationId&&_E(n,e.correlationId),e.idTokenHint&&Qee(n,e.idTokenHint),e.state&&N3(n,e.state),e.logoutHint&&ite(n,e.logoutHint),e.extraQueryParameters&&vl(n,e.extraQueryParameters),this.config.authOptions.instanceAware&&R3(n),Ep(n,this.config.authOptions.encodeExtraQueryParams,e.extraQueryParameters)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Ete=300;class Nte extends kE{constructor(e,n){super(e,n)}async acquireToken(e){var s,l;(s=this.performanceClient)==null||s.addQueueMeasurement(G.RefreshTokenClientAcquireToken,e.correlationId);const n=_i(),r=await ge(this.executeTokenRequest.bind(this),G.RefreshTokenClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(e,this.authority),i=(l=r.headers)==null?void 0:l[ei.X_MS_REQUEST_ID],o=new Wc(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return o.validateTokenResponse(r.body),ge(o.handleServerTokenResponse.bind(o),G.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(r.body,this.authority,n,e,void 0,void 0,!0,e.forceCache,i)}async acquireTokenByRefreshToken(e){var r;if(!e)throw gn(l3);if((r=this.performanceClient)==null||r.addQueueMeasurement(G.RefreshTokenClientAcquireTokenByRefreshToken,e.correlationId),!e.account)throw Ae(sE);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await ge(this.acquireTokenWithCachedRefreshToken.bind(this),G.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!0)}catch(i){const o=i instanceof qo&&i.errorCode===Py,s=i instanceof lu&&i.errorCode===CO.INVALID_GRANT_ERROR&&i.subError===CO.CLIENT_MISMATCH_ERROR;if(o||s)return ge(this.acquireTokenWithCachedRefreshToken.bind(this),G.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1);throw i}return ge(this.acquireTokenWithCachedRefreshToken.bind(this),G.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1)}async acquireTokenWithCachedRefreshToken(e,n){var o,s,l;(o=this.performanceClient)==null||o.addQueueMeasurement(G.RefreshTokenClientAcquireTokenWithCachedRefreshToken,e.correlationId);const r=Bi(this.cacheManager.getRefreshToken.bind(this.cacheManager),G.CacheManagerGetRefreshToken,this.logger,this.performanceClient,e.correlationId)(e.account,n,e.correlationId,void 0,this.performanceClient);if(!r)throw ky(Py);if(r.expiresOn&&Ty(r.expiresOn,e.refreshTokenExpirationOffsetSeconds||Ete))throw(s=this.performanceClient)==null||s.addFields({rtExpiresOnMs:Number(r.expiresOn)},e.correlationId),ky(OE);const i={...e,refreshToken:r.secret,authenticationScheme:e.authenticationScheme||an.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:Oo.HOME_ACCOUNT_ID}};try{return await ge(this.acquireToken.bind(this),G.RefreshTokenClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(i)}catch(c){if(c instanceof qo&&((l=this.performanceClient)==null||l.addFields({rtExpiresOnMs:Number(r.expiresOn)},e.correlationId),c.subError===n0)){this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");const u=this.cacheManager.generateCredentialKey(r);this.cacheManager.removeRefreshToken(u,e.correlationId)}throw c}}async executeTokenRequest(e,n){var c;(c=this.performanceClient)==null||c.addQueueMeasurement(G.RefreshTokenClientExecuteTokenRequest,e.correlationId);const r=this.createTokenQueryParameters(e),i=Kt.appendQueryString(n.tokenEndpoint,r),o=await ge(this.createTokenRequestBody.bind(this),G.RefreshTokenClientCreateTokenRequestBody,this.logger,this.performanceClient,e.correlationId)(e),s=this.createTokenRequestHeaders(e.ccsCredential),l=e0(this.config.authOptions.clientId,e);return ge(this.executePostToTokenEndpoint.bind(this),G.RefreshTokenClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,e.correlationId)(i,o,s,l,e.correlationId,G.RefreshTokenClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var r,i,o;(r=this.performanceClient)==null||r.addQueueMeasurement(G.RefreshTokenClientCreateTokenRequestBody,e.correlationId);const n=new Map;if(SE(n,e.embeddedClientId||((i=e.tokenBodyParameters)==null?void 0:i[Kc])||this.config.authOptions.clientId),e.redirectUri&&CE(n,e.redirectUri),wE(n,e.scopes,!0,(o=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:o.defaultScopes),I3(n,L4.REFRESH_TOKEN_GRANT),NE(n),jE(n,this.config.libraryInfo),EE(n,this.config.telemetry.application),$3(n),this.serverTelemetryManager&&!A3(this.config)&&D3(n,this.serverTelemetryManager),tte(n,e.refreshToken),this.config.clientCredentials.clientSecret&&P3(n,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const s=this.config.clientCredentials.clientAssertion;k3(n,await V3(s.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),O3(n,s.assertionType)}if(e.authenticationScheme===an.POP){const s=new kd(this.cryptoUtils,this.performanceClient);let l;e.popKid?l=this.cryptoUtils.encodeKid(e.popKid):l=(await ge(s.generateCnf.bind(s),G.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,TE(n,l)}else if(e.authenticationScheme===an.SSH)if(e.sshJwk)M3(n,e.sshJwk);else throw gn(qb);if((!Ss.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&AE(n,e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case Oo.HOME_ACCOUNT_ID:try{const s=rd(e.ccsCredential.credential);Fh(n,s)}catch(s){this.logger.verbose("Could not parse home account ID for CCS Header: "+s)}break;case Oo.UPN:Ny(n,e.ccsCredential.credential);break}return e.embeddedClientId&&Qb(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenBodyParameters&&vl(n,e.tokenBodyParameters),Yb(n,e.correlationId,this.performanceClient),Ep(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Tte extends kE{constructor(e,n){super(e,n)}async acquireCachedToken(e){var c;(c=this.performanceClient)==null||c.addQueueMeasurement(G.SilentFlowClientAcquireCachedToken,e.correlationId);let n=ic.NOT_APPLICABLE;if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!Ss.isEmptyObj(e.claims))throw this.setCacheOutcome(ic.FORCE_REFRESH_OR_CLAIMS,e.correlationId),Ae(gl);if(!e.account)throw Ae(sE);const r=e.account.tenantId||yte(e.authority),i=this.cacheManager.getTokenKeys(),o=this.cacheManager.getAccessToken(e.account,e,i,r);if(o){if(dte(o.cachedAt)||Ty(o.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome(ic.CACHED_ACCESS_TOKEN_EXPIRED,e.correlationId),Ae(gl);o.refreshOn&&Ty(o.refreshOn,0)&&(n=ic.PROACTIVELY_REFRESHED)}else throw this.setCacheOutcome(ic.NO_CACHED_ACCESS_TOKEN,e.correlationId),Ae(gl);const s=e.authority||this.authority.getPreferredCache(),l={account:this.cacheManager.getAccount(this.cacheManager.generateAccountKey(e.account),e.correlationId),accessToken:o,idToken:this.cacheManager.getIdToken(e.account,e.correlationId,i,r,this.performanceClient),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(s)};return this.setCacheOutcome(n,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await ge(this.generateResultFromCacheRecord.bind(this),G.SilentFlowClientGenerateResultFromCacheRecord,this.logger,this.performanceClient,e.correlationId)(l,e),n]}setCacheOutcome(e,n){var r,i;(r=this.serverTelemetryManager)==null||r.setCacheOutcome(e),(i=this.performanceClient)==null||i.addFields({cacheOutcome:e},n),e!==ic.NOT_APPLICABLE&&this.logger.info(`Token refresh is required due to cache outcome: ${e}`)}async generateResultFromCacheRecord(e,n){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(G.SilentFlowClientGenerateResultFromCacheRecord,n.correlationId);let r;if(e.idToken&&(r=wf(e.idToken.secret,this.config.cryptoInterface.base64Decode)),n.maxAge||n.maxAge===0){const o=r==null?void 0:r.auth_time;if(!o)throw Ae(oE);y3(o,n.maxAge)}return Wc.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,n,r)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Pte={sendGetRequestAsync:()=>Promise.reject(Ae(Ft)),sendPostRequestAsync:()=>Promise.reject(Ae(Ft))};/*! @azure/msal-common v15.10.0 2025-08-05 */function kte(t,e,n,r){var l,c;const i=e.correlationId,o=new Map;SE(o,e.embeddedClientId||((l=e.extraQueryParameters)==null?void 0:l[Kc])||t.clientId);const s=[...e.scopes||[],...e.extraScopesToConsent||[]];if(wE(o,s,!0,(c=t.authority.options.OIDCOptions)==null?void 0:c.defaultScopes),CE(o,e.redirectUri),_E(o,i),Wee(o,e.responseMode),NE(o),e.prompt&&(Jee(o,e.prompt),r==null||r.addFields({prompt:e.prompt},i)),e.domainHint&&(Xee(o,e.domainHint),r==null||r.addFields({domainHintFromRequest:!0},i)),e.prompt!==ri.SELECT_ACCOUNT)if(e.sid&&e.prompt===ri.NONE)n.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),kO(o,e.sid),r==null||r.addFields({sidFromRequest:!0},i);else if(e.account){const u=Rte(e.account);let d=Mte(e.account);if(d&&e.domainHint&&(n.warning('AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint'),d=null),d){n.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),Bg(o,d),r==null||r.addFields({loginHintFromClaim:!0},i);try{const f=rd(e.account.homeAccountId);Fh(o,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(u&&e.prompt===ri.NONE){n.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),kO(o,u),r==null||r.addFields({sidFromClaim:!0},i);try{const f=rd(e.account.homeAccountId);Fh(o,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e.loginHint)n.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),Bg(o,e.loginHint),Ny(o,e.loginHint),r==null||r.addFields({loginHintFromRequest:!0},i);else if(e.account.username){n.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),Bg(o,e.account.username),r==null||r.addFields({loginHintFromUpn:!0},i);try{const f=rd(e.account.homeAccountId);Fh(o,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else e.loginHint&&(n.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),Bg(o,e.loginHint),Ny(o,e.loginHint),r==null||r.addFields({loginHintFromRequest:!0},i));else n.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");return e.nonce&&Zee(o,e.nonce),e.state&&N3(o,e.state),(e.claims||t.clientCapabilities&&t.clientCapabilities.length>0)&&AE(o,e.claims,t.clientCapabilities),e.embeddedClientId&&Qb(o,t.clientId,t.redirectUri),t.instanceAware&&(!e.extraQueryParameters||!Object.keys(e.extraQueryParameters).includes(C1))&&R3(o),o}function ME(t,e,n,r){const i=Ep(e,n,r);return Kt.appendQueryString(t.authorizationEndpoint,i)}function Ote(t,e){if(K3(t,e),!t.code)throw Ae(e3);return t}function K3(t,e){if(!t.state||!e)throw t.state?Ae(v1,"Cached State"):Ae(v1,"Server State");let n,r;try{n=decodeURIComponent(t.state)}catch{throw Ae(Pd,t.state)}try{r=decodeURIComponent(e)}catch{throw Ae(Pd,t.state)}if(n!==r)throw Ae(G4);if(t.error||t.error_description||t.suberror){const i=Ite(t);throw z3(t.error,t.error_description,t.suberror)?new qo(t.error||"",t.error_description,t.suberror,t.timestamp||"",t.trace_id||"",t.correlation_id||"",t.claims||"",i):new lu(t.error||"",t.error_description,t.suberror,i)}}function Ite(t){var r,i;const e="code=",n=(r=t.error_uri)==null?void 0:r.lastIndexOf(e);return n&&n>=0?(i=t.error_uri)==null?void 0:i.substring(n+e.length):void 0}function Rte(t){var e;return((e=t.idTokenClaims)==null?void 0:e.sid)||null}function Mte(t){var e;return t.loginHint||((e=t.idTokenClaims)==null?void 0:e.login_hint)||null}/*! @azure/msal-common v15.10.0 2025-08-05 */const LO=",",W3="|";function Dte(t){const{skus:e,libraryName:n,libraryVersion:r,extensionName:i,extensionVersion:o}=t,s=new Map([[0,[n,r]],[2,[i,o]]]);let l=[];if(e!=null&&e.length){if(l=e.split(LO),l.length<4)return e}else l=Array.from({length:4},()=>W3);return s.forEach((c,u)=>{var d,f;c.length===2&&((d=c[0])!=null&&d.length)&&((f=c[1])!=null&&f.length)&&$te({skuArr:l,index:u,skuName:c[0],skuVersion:c[1]})}),l.join(LO)}function $te(t){const{skuArr:e,index:n,skuName:r,skuVersion:i}=t;n>=e.length||(e[n]=[r,i].join(W3))}class Np{constructor(e,n){this.cacheOutcome=ic.NOT_APPLICABLE,this.cacheManager=n,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||ve.EMPTY_STRING,this.wrapperVer=e.wrapperVer||ve.EMPTY_STRING,this.telemetryCacheKey=jr.CACHE_KEY+jp.CACHE_KEY_SEPARATOR+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${jr.VALUE_SEPARATOR}${this.cacheOutcome}`,n=[this.wrapperSKU,this.wrapperVer],r=this.getNativeBrokerErrorCode();r!=null&&r.length&&n.push(`broker_error=${r}`);const i=n.join(jr.VALUE_SEPARATOR),o=this.getRegionDiscoveryFields(),s=[e,o].join(jr.VALUE_SEPARATOR);return[jr.SCHEMA_VERSION,s,i].join(jr.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),n=Np.maxErrorsToSend(e),r=e.failedRequests.slice(0,2*n).join(jr.VALUE_SEPARATOR),i=e.errors.slice(0,n).join(jr.VALUE_SEPARATOR),o=e.errors.length,s=n=jr.MAX_CACHED_ERRORS&&(n.failedRequests.shift(),n.failedRequests.shift(),n.errors.shift()),n.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof pn?e.subError?n.errors.push(e.subError):e.errorCode?n.errors.push(e.errorCode):n.errors.push(e.toString()):n.errors.push(e.toString()):n.errors.push(jr.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,n,this.correlationId)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e,this.correlationId),e.cacheHits}getLastRequests(){const e={failedRequests:[],errors:[],cacheHits:0};return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e}clearTelemetryCache(){const e=this.getLastRequests(),n=Np.maxErrorsToSend(e),r=e.errors.length;if(n===r)this.cacheManager.removeItem(this.telemetryCacheKey,this.correlationId);else{const i={failedRequests:e.failedRequests.slice(n*2),errors:e.errors.slice(n),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,i,this.correlationId)}}static maxErrorsToSend(e){let n,r=0,i=0;const o=e.errors.length;for(n=0;nString.fromCodePoint(n)).join("");return btoa(e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Lo(t){return new TextDecoder().decode(yl(t))}function yl(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw Be(w5)}const n=atob(e);return Uint8Array.from(n,r=>r.codePointAt(0)||0)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Yte="RSASSA-PKCS1-v1_5",Cf="AES-GCM",E5="HKDF",VE="SHA-256",Qte=2048,Xte=new Uint8Array([1,0,1]),HO="0123456789abcdef",zO=new Uint32Array(1),GE="raw",N5="encrypt",KE="decrypt",Jte="deriveKey",Zte="crypto_subtle_undefined",WE={name:Yte,hash:VE,modulusLength:Qte,publicExponent:Xte};function ene(t){if(!window)throw Be(o0);if(!window.crypto)throw Be(A1);if(!t&&!window.crypto.subtle)throw Be(A1,Zte)}async function T5(t,e,n){e==null||e.addQueueMeasurement(G.Sha256Digest,n);const i=new TextEncoder().encode(t);return window.crypto.subtle.digest(VE,i)}function tne(t){return window.crypto.getRandomValues(t)}function aS(){return window.crypto.getRandomValues(zO),zO[0]}function Yo(){const t=Date.now(),e=aS()*1024+(aS()&1023),n=new Uint8Array(16),r=Math.trunc(e/2**30),i=e&2**30-1,o=aS();n[0]=t/2**40,n[1]=t/2**32,n[2]=t/2**24,n[3]=t/2**16,n[4]=t/2**8,n[5]=t,n[6]=112|r>>>8,n[7]=r,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=o>>>24,n[13]=o>>>16,n[14]=o>>>8,n[15]=o;let s="";for(let l=0;l>>4),s+=HO.charAt(n[l]&15),(l===3||l===5||l===7||l===9)&&(s+="-");return s}async function nne(t,e){return window.crypto.subtle.generateKey(WE,t,e)}async function lS(t){return window.crypto.subtle.exportKey(_5,t)}async function rne(t,e,n){return window.crypto.subtle.importKey(_5,t,WE,e,n)}async function ine(t,e){return window.crypto.subtle.sign(WE,t,e)}async function qE(){const t=await P5(),n={alg:"dir",kty:"oct",k:Ol(new Uint8Array(t))};return Pp(JSON.stringify(n))}async function one(t){const e=Lo(t),r=JSON.parse(e).k,i=yl(r);return window.crypto.subtle.importKey(GE,i,Cf,!1,[KE])}async function sne(t,e){const n=e.split(".");if(n.length!==5)throw Be(Tv,"jwe_length");const r=await one(t).catch(()=>{throw Be(Tv,"import_key")});try{const i=new TextEncoder().encode(n[0]),o=yl(n[2]),s=yl(n[3]),l=yl(n[4]),c=l.byteLength*8,u=new Uint8Array(s.length+l.length);u.set(s),u.set(l,s.length);const d=await window.crypto.subtle.decrypt({name:Cf,iv:o,tagLength:c,additionalData:i},r,u);return new TextDecoder().decode(d)}catch{throw Be(Tv,"decrypt")}}async function P5(){const t=await window.crypto.subtle.generateKey({name:Cf,length:256},!0,[N5,KE]);return window.crypto.subtle.exportKey(GE,t)}async function VO(t){return window.crypto.subtle.importKey(GE,t,E5,!1,[Jte])}async function k5(t,e,n){return window.crypto.subtle.deriveKey({name:E5,salt:e,hash:VE,info:new TextEncoder().encode(n)},t,{name:Cf,length:256},!1,[N5,KE])}async function ane(t,e,n){const r=new TextEncoder().encode(e),i=window.crypto.getRandomValues(new Uint8Array(16)),o=await k5(t,i,n),s=await window.crypto.subtle.encrypt({name:Cf,iv:new Uint8Array(12)},o,r);return{data:Ol(new Uint8Array(s)),nonce:Ol(i)}}async function GO(t,e,n,r){const i=yl(r),o=await k5(t,yl(e),n),s=await window.crypto.subtle.decrypt({name:Cf,iv:new Uint8Array(12)},o,i);return new TextDecoder().decode(s)}async function O5(t){const e=await T5(t),n=new Uint8Array(e);return Ol(n)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const kp="storage_not_supported",Jn="stubbed_public_client_application_called",Ry="in_mem_redirect_unavailable";/*! @azure/msal-browser v4.19.0 2025-08-05 */const Pv={[kp]:"Given storage configuration option was not supported.",[Jn]:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors",[Ry]:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."};Pv[kp],Pv[Jn],Pv[Ry];class YE extends pn{constructor(e,n){super(e,n),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,YE.prototype)}}function Zn(t){return new YE(t,Pv[t])}/*! @azure/msal-browser v4.19.0 2025-08-05 */function I5(t){t.location.hash="",typeof t.history.replaceState=="function"&&t.history.replaceState(null,"",`${t.location.origin}${t.location.pathname}${t.location.search}`)}function lne(t){const e=t.split("#");e.shift(),window.location.hash=e.length>0?e.join("#"):""}function QE(){return window.parent!==window}function cne(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(`${gi.POPUP_NAME_PREFIX}.`)===0}function ta(){return typeof window<"u"&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function une(){const e=new Kt(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}function dne(){if(Kt.hashContainsKnownProperties(window.location.hash)&&QE())throw Be(s5)}function fne(t){if(QE()&&!t)throw Be(o5)}function hne(){if(cne())throw Be(a5)}function R5(){if(typeof window>"u")throw Be(o0)}function M5(t){if(!t)throw Be(Uh)}function XE(t){R5(),dne(),hne(),M5(t)}function KO(t,e){if(XE(t),fne(e.system.allowRedirectInIframe),e.cache.cacheLocation===pr.MemoryStorage&&!e.cache.storeAuthStateInCookie)throw Zn(Ry)}function D5(t){const e=document.createElement("link");e.rel="preconnect",e.href=new URL(t).origin,e.crossOrigin="anonymous",document.head.appendChild(e),window.setTimeout(()=>{try{document.head.removeChild(e)}catch{}},1e4)}function pne(){return Yo()}/*! @azure/msal-browser v4.19.0 2025-08-05 */class My{navigateInternal(e,n){return My.defaultNavigateWindow(e,n)}navigateExternal(e,n){return My.defaultNavigateWindow(e,n)}static defaultNavigateWindow(e,n){return n.noHistory?window.location.replace(e):window.location.assign(e),new Promise((r,i)=>{setTimeout(()=>{i(Be(Iy,"failed_to_redirect"))},n.timeout)})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class mne{async sendGetRequestAsync(e,n){let r,i={},o=0;const s=WO(n);try{r=await fetch(e,{method:UO.GET,headers:s})}catch(l){throw Sh(Be(window.navigator.onLine?f5:Oy),void 0,void 0,l)}i=qO(r.headers);try{return o=r.status,{headers:i,body:await r.json(),status:o}}catch(l){throw Sh(Be(_1),o,i,l)}}async sendPostRequestAsync(e,n){const r=n&&n.body||"",i=WO(n);let o,s=0,l={};try{o=await fetch(e,{method:UO.POST,headers:i,body:r})}catch(c){throw Sh(Be(window.navigator.onLine?d5:Oy),void 0,void 0,c)}l=qO(o.headers);try{return s=o.status,{headers:l,body:await o.json(),status:s}}catch(c){throw Sh(Be(_1),s,l,c)}}}function WO(t){try{const e=new Headers;if(!(t&&t.headers))return e;const n=t.headers;return Object.entries(n).forEach(([r,i])=>{e.append(r,i)}),e}catch(e){throw Sh(Be(C5),void 0,void 0,e)}}function qO(t){try{const e={};return t.forEach((n,r)=>{e[r]=n}),e}catch{throw Be(A5)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const gne=6e4,E1=1e4,vne=3e4,$5=2e3;function yne({auth:t,cache:e,system:n,telemetry:r},i){const o={clientId:ve.EMPTY_STRING,authority:`${ve.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:ve.EMPTY_STRING,authorityMetadata:ve.EMPTY_STRING,redirectUri:typeof window<"u"?ta():"",postLogoutRedirectUri:ve.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:Ai.AAD,OIDCOptions:{serverResponseType:Wb.FRAGMENT,defaultScopes:[ve.OPENID_SCOPE,ve.PROFILE_SCOPE,ve.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:dE.None,tenant:ve.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1,encodeExtraQueryParams:!1},s={cacheLocation:pr.SessionStorage,cacheRetentionDays:5,temporaryCacheLocation:pr.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!!(e&&e.cacheLocation===pr.LocalStorage),claimsBasedCachingEnabled:!1},l={loggerCallback:()=>{},logLevel:jn.Info,piiLoggingEnabled:!1},u={...{...C3,loggerOptions:l,networkClient:i?new mne:Pte,navigationClient:new My,loadFrameTimeout:0,windowHashTimeout:(n==null?void 0:n.loadFrameTimeout)||gne,iframeHashTimeout:(n==null?void 0:n.loadFrameTimeout)||E1,navigateFrameWait:0,redirectNavigationTimeout:vne,asyncPopups:!1,allowRedirectInIframe:!1,allowPlatformBroker:!1,nativeBrokerHandshakeTimeout:(n==null?void 0:n.nativeBrokerHandshakeTimeout)||$5,pollIntervalMilliseconds:gi.DEFAULT_POLL_INTERVAL_MS},...n,loggerOptions:(n==null?void 0:n.loggerOptions)||l},d={application:{appName:ve.EMPTY_STRING,appVersion:ve.EMPTY_STRING},client:new S3};if((t==null?void 0:t.protocolMode)!==Ai.OIDC&&(t!=null&&t.OIDCOptions)&&new ya(u.loggerOptions).warning(JSON.stringify(gn(h3))),t!=null&&t.protocolMode&&t.protocolMode===Ai.OIDC&&(u!=null&&u.allowPlatformBroker))throw gn(p3);return{auth:{...o,...t,OIDCOptions:{...o.OIDCOptions,...t==null?void 0:t.OIDCOptions}},cache:{...s,...e},system:u,telemetry:{...d,...r}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const xne="@azure/msal-browser",qc="4.19.0";/*! @azure/msal-browser v4.19.0 2025-08-05 */const vr="msal",JE="browser",cS="-",Da=1,N1=1,bne=`${vr}.${JE}.log.level`,wne=`${vr}.${JE}.log.pii`,Sne=`${vr}.${JE}.platform.auth.dom`,YO=`${vr}.version`,QO="account.keys",XO="token.keys";function ss(t=N1){return t<1?`${vr}.${QO}`:`${vr}.${t}.${QO}`}function pc(t,e=Da){return e<1?`${vr}.${XO}.${t}`:`${vr}.${e}.${XO}.${t}`}/*! @azure/msal-browser v4.19.0 2025-08-05 */class ZE{static loggerCallback(e,n){switch(e){case jn.Error:console.error(n);return;case jn.Info:console.info(n);return;case jn.Verbose:console.debug(n);return;case jn.Warning:console.warn(n);return;default:console.log(n);return}}constructor(e){var c;this.browserEnvironment=typeof window<"u",this.config=yne(e,this.browserEnvironment);let n;try{n=window[pr.SessionStorage]}catch{}const r=n==null?void 0:n.getItem(bne),i=(c=n==null?void 0:n.getItem(wne))==null?void 0:c.toLowerCase(),o=i==="true"?!0:i==="false"?!1:void 0,s={...this.config.system.loggerOptions},l=r&&Object.keys(jn).includes(r)?jn[r]:void 0;l&&(s.loggerCallback=ZE.loggerCallback,s.logLevel=l),o!==void 0&&(s.piiLoggingEnabled=o),this.logger=new ya(s,xne,qc),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Yc extends ZE{getModuleName(){return Yc.MODULE_NAME}getId(){return Yc.ID}async initialize(){return this.available=typeof window<"u",this.available}}Yc.MODULE_NAME="";Yc.ID="StandardOperatingContext";/*! @azure/msal-browser v4.19.0 2025-08-05 */class Cne{constructor(){this.dbName=j1,this.version=Kte,this.tableName=Wte,this.dbOpen=!1}async open(){return new Promise((e,n)=>{const r=window.indexedDB.open(this.dbName,this.version);r.addEventListener("upgradeneeded",i=>{i.target.result.createObjectStore(this.tableName)}),r.addEventListener("success",i=>{const o=i;this.db=o.target.result,this.dbOpen=!0,e()}),r.addEventListener("error",()=>n(Be(HE)))})}closeConnection(){const e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)}async validateDbIsOpen(){if(!this.dbOpen)return this.open()}async getItem(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(Be(Eu));const s=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);s.addEventListener("success",l=>{const c=l;this.closeConnection(),n(c.target.result)}),s.addEventListener("error",l=>{this.closeConnection(),r(l)})})}async setItem(e,n){return await this.validateDbIsOpen(),new Promise((r,i)=>{if(!this.db)return i(Be(Eu));const l=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(n,e);l.addEventListener("success",()=>{this.closeConnection(),r()}),l.addEventListener("error",c=>{this.closeConnection(),i(c)})})}async removeItem(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(Be(Eu));const s=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);s.addEventListener("success",()=>{this.closeConnection(),n()}),s.addEventListener("error",l=>{this.closeConnection(),r(l)})})}async getKeys(){return await this.validateDbIsOpen(),new Promise((e,n)=>{if(!this.db)return n(Be(Eu));const o=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();o.addEventListener("success",s=>{const l=s;this.closeConnection(),e(l.target.result)}),o.addEventListener("error",s=>{this.closeConnection(),n(s)})})}async containsKey(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(Be(Eu));const s=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);s.addEventListener("success",l=>{const c=l;this.closeConnection(),n(c.target.result===1)}),s.addEventListener("error",l=>{this.closeConnection(),r(l)})})}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise((e,n)=>{const r=window.indexedDB.deleteDatabase(j1),i=setTimeout(()=>n(!1),200);r.addEventListener("success",()=>(clearTimeout(i),e(!0))),r.addEventListener("blocked",()=>(clearTimeout(i),e(!0))),r.addEventListener("error",()=>(clearTimeout(i),n(!1)))})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class s0{constructor(){this.cache=new Map}async initialize(){}getItem(e){return this.cache.get(e)||null}getUserData(e){return this.getItem(e)}setItem(e,n){this.cache.set(e,n)}async setUserData(e,n){this.setItem(e,n)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach((n,r)=>{e.push(r)}),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}decryptData(){return Promise.resolve(null)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Ane{constructor(e){this.inMemoryCache=new s0,this.indexedDBCache=new Cne,this.logger=e}handleDatabaseAccessError(e){if(e instanceof qm&&e.errorCode===HE)this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.");else throw e}async getItem(e){const n=this.inMemoryCache.getItem(e);if(!n)try{return this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.getItem(e)}catch(r){this.handleDatabaseAccessError(r)}return n}async setItem(e,n){this.inMemoryCache.setItem(e,n);try{await this.indexedDBCache.setItem(e,n)}catch(r){this.handleDatabaseAccessError(r)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(n){this.handleDatabaseAccessError(n)}}async getKeys(){const e=this.inMemoryCache.getKeys();if(e.length===0)try{return this.logger.verbose("In-memory cache is empty, now querying persistent storage."),await this.indexedDBCache.getKeys()}catch(n){this.handleDatabaseAccessError(n)}return e}async containsKey(e){const n=this.inMemoryCache.containsKey(e);if(!n)try{return this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.containsKey(e)}catch(r){this.handleDatabaseAccessError(r)}return n}clearInMemory(){this.logger.verbose("Deleting in-memory keystore"),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore deleted")}async clearPersistent(){try{this.logger.verbose("Deleting persistent keystore");const e=await this.indexedDBCache.deleteDatabase();return e&&this.logger.verbose("Persistent keystore deleted"),e}catch(e){return this.handleDatabaseAccessError(e),!1}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class xa{constructor(e,n,r){this.logger=e,ene(r??!1),this.cache=new Ane(this.logger),this.performanceClient=n}createNewGuid(){return Yo()}base64Encode(e){return Pp(e)}base64Decode(e){return Lo(e)}base64UrlEncode(e){return Vg(e)}encodeKid(e){return this.base64UrlEncode(JSON.stringify({kid:e}))}async getPublicKeyThumbprint(e){var d;const n=(d=this.performanceClient)==null?void 0:d.startMeasurement(G.CryptoOptsGetPublicKeyThumbprint,e.correlationId),r=await nne(xa.EXTRACTABLE,xa.POP_KEY_USAGES),i=await lS(r.publicKey),o={e:i.e,kty:i.kty,n:i.n},s=JO(o),l=await this.hashString(s),c=await lS(r.privateKey),u=await rne(c,!1,["sign"]);return await this.cache.setItem(l,{privateKey:u,publicKey:r.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri}),n&&n.end({success:!0}),l}async removeTokenBindingKey(e){if(await this.cache.removeItem(e),await this.cache.containsKey(e))throw Ae(t3)}async clearKeystore(){this.cache.clearInMemory();try{return await this.cache.clearPersistent(),!0}catch(e){return e instanceof Error?this.logger.error(`Clearing keystore failed with error: ${e.message}`):this.logger.error("Clearing keystore failed with unknown error"),!1}}async signJwt(e,n,r,i){var w;const o=(w=this.performanceClient)==null?void 0:w.startMeasurement(G.CryptoOptsSignJwt,i),s=await this.cache.getItem(n);if(!s)throw Be(BE);const l=await lS(s.publicKey),c=JO(l),u=Vg(JSON.stringify({kid:n})),d=$E.getShrHeaderString({...r==null?void 0:r.header,alg:l.alg,kid:u}),f=Vg(d);e.cnf={jwk:JSON.parse(c)};const h=Vg(JSON.stringify(e)),p=`${f}.${h}`,m=new TextEncoder().encode(p),v=await ine(s.privateKey,m),b=Ol(new Uint8Array(v)),x=`${p}.${b}`;return o&&o.end({success:!0}),x}async hashString(e){return O5(e)}}xa.POP_KEY_USAGES=["sign","verify"];xa.EXTRACTABLE=!0;function JO(t){return JSON.stringify(t,Object.keys(t).sort())}/*! @azure/msal-browser v4.19.0 2025-08-05 */const _ne=24*60*60*1e3,T1={Lax:"Lax",None:"None"};class L5{initialize(){return Promise.resolve()}getItem(e){const n=`${encodeURIComponent(e)}`,r=document.cookie.split(";");for(let i=0;i{const i=decodeURIComponent(r).trim().split("=");n.push(i[0])}),n}containsKey(e){return this.getKeys().includes(e)}decryptData(){return Promise.resolve(null)}}function jne(t){const e=new Date;return new Date(e.getTime()+t*_ne).toUTCString()}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Bh(t,e){const n=t.getItem(ss(e));return n?JSON.parse(n):[]}function Hh(t,e,n){const r=e.getItem(pc(t,n));if(r){const i=JSON.parse(r);if(i&&i.hasOwnProperty("idToken")&&i.hasOwnProperty("accessToken")&&i.hasOwnProperty("refreshToken"))return i}return{idToken:[],accessToken:[],refreshToken:[]}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function P1(t){return t.hasOwnProperty("id")&&t.hasOwnProperty("nonce")&&t.hasOwnProperty("data")}/*! @azure/msal-browser v4.19.0 2025-08-05 */const ZO="msal.cache.encryption",Ene="msal.broadcast.cache";class Nne{constructor(e,n,r){if(!window.localStorage)throw Zn(kp);this.memoryStorage=new s0,this.initialized=!1,this.clientId=e,this.logger=n,this.performanceClient=r,this.broadcast=new BroadcastChannel(Ene)}async initialize(e){const n=new L5,r=n.getItem(ZO);let i={key:"",id:""};if(r)try{i=JSON.parse(r)}catch{}if(i.key&&i.id){const o=Bi(yl,G.Base64Decode,this.logger,this.performanceClient,e)(i.key);this.encryptionCookie={id:i.id,key:await ge(VO,G.GenerateHKDF,this.logger,this.performanceClient,e)(o)}}else{const o=Yo(),s=await ge(P5,G.GenerateBaseKey,this.logger,this.performanceClient,e)(),l=Bi(Ol,G.UrlEncodeArr,this.logger,this.performanceClient,e)(new Uint8Array(s));this.encryptionCookie={id:o,key:await ge(VO,G.GenerateHKDF,this.logger,this.performanceClient,e)(s)};const c={id:o,key:l};n.setItem(ZO,JSON.stringify(c),0,!0,T1.None)}await ge(this.importExistingCache.bind(this),G.ImportExistingCache,this.logger,this.performanceClient,e)(e),this.broadcast.addEventListener("message",this.updateCache.bind(this)),this.initialized=!0}getItem(e){return window.localStorage.getItem(e)}getUserData(e){if(!this.initialized)throw Be(Uh);return this.memoryStorage.getItem(e)}async decryptData(e,n,r){if(!this.initialized||!this.encryptionCookie)throw Be(Uh);if(n.id!==this.encryptionCookie.id)return this.performanceClient.incrementFields({encryptedCacheExpiredCount:1},r),null;const i=await ge(GO,G.Decrypt,this.logger,this.performanceClient,r)(this.encryptionCookie.key,n.nonce,this.getContext(e),n.data);if(!i)return null;try{return JSON.parse(i)}catch{return this.performanceClient.incrementFields({encryptedCacheCorruptionCount:1},r),null}}setItem(e,n){window.localStorage.setItem(e,n)}async setUserData(e,n,r,i){if(!this.initialized||!this.encryptionCookie)throw Be(Uh);const{data:o,nonce:s}=await ge(ane,G.Encrypt,this.logger,this.performanceClient,r)(this.encryptionCookie.key,n,this.getContext(e)),l={id:this.encryptionCookie.id,nonce:s,data:o,lastUpdatedAt:i};this.memoryStorage.setItem(e,n),this.setItem(e,JSON.stringify(l)),this.broadcast.postMessage({key:e,value:n,context:this.getContext(e)})}removeItem(e){this.memoryStorage.containsKey(e)&&(this.memoryStorage.removeItem(e),this.broadcast.postMessage({key:e,value:null,context:this.getContext(e)})),window.localStorage.removeItem(e)}getKeys(){return Object.keys(window.localStorage)}containsKey(e){return window.localStorage.hasOwnProperty(e)}clear(){this.memoryStorage.clear(),Bh(this).forEach(r=>this.removeItem(r));const n=Hh(this.clientId,this);n.idToken.forEach(r=>this.removeItem(r)),n.accessToken.forEach(r=>this.removeItem(r)),n.refreshToken.forEach(r=>this.removeItem(r)),this.getKeys().forEach(r=>{(r.startsWith(vr)||r.indexOf(this.clientId)!==-1)&&this.removeItem(r)})}async importExistingCache(e){if(!this.encryptionCookie)return;let n=Bh(this);n=await this.importArray(n,e),n.length?this.setItem(ss(),JSON.stringify(n)):this.removeItem(ss());const r=Hh(this.clientId,this);r.idToken=await this.importArray(r.idToken,e),r.accessToken=await this.importArray(r.accessToken,e),r.refreshToken=await this.importArray(r.refreshToken,e),r.idToken.length||r.accessToken.length||r.refreshToken.length?this.setItem(pc(this.clientId),JSON.stringify(r)):this.removeItem(pc(this.clientId))}async getItemFromEncryptedCache(e,n){if(!this.encryptionCookie)return null;const r=this.getItem(e);if(!r)return null;let i;try{i=JSON.parse(r)}catch{return null}return P1(i)?i.id!==this.encryptionCookie.id?(this.performanceClient.incrementFields({encryptedCacheExpiredCount:1},n),null):ge(GO,G.Decrypt,this.logger,this.performanceClient,n)(this.encryptionCookie.key,i.nonce,this.getContext(e),i.data):(this.performanceClient.incrementFields({unencryptedCacheCount:1},n),i)}async importArray(e,n){const r=[],i=[];return e.forEach(o=>{const s=this.getItemFromEncryptedCache(o,n).then(l=>{l?(this.memoryStorage.setItem(o,l),r.push(o)):this.removeItem(o)});i.push(s)}),await Promise.all(i),r}getContext(e){let n="";return e.includes(this.clientId)&&(n=this.clientId),n}updateCache(e){this.logger.trace("Updating internal cache from broadcast event");const n=this.performanceClient.startMeasurement(G.LocalStorageUpdated);n.add({isBackground:!0});const{key:r,value:i,context:o}=e.data;if(!r){this.logger.error("Broadcast event missing key"),n.end({success:!1,errorCode:"noKey"});return}if(o&&o!==this.clientId){this.logger.trace(`Ignoring broadcast event from clientId: ${o}`),n.end({success:!1,errorCode:"contextMismatch"});return}i?(this.memoryStorage.setItem(r,i),this.logger.verbose("Updated item in internal cache")):(this.memoryStorage.removeItem(r),this.logger.verbose("Removed item from internal cache")),n.end({success:!0})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Tne{constructor(){if(!window.sessionStorage)throw Zn(kp)}async initialize(){}getItem(e){return window.sessionStorage.getItem(e)}getUserData(e){return this.getItem(e)}setItem(e,n){window.sessionStorage.setItem(e,n)}async setUserData(e,n){this.setItem(e,n)}removeItem(e){window.sessionStorage.removeItem(e)}getKeys(){return Object.keys(window.sessionStorage)}containsKey(e){return window.sessionStorage.hasOwnProperty(e)}decryptData(){return Promise.resolve(null)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Ve={INITIALIZE_START:"msal:initializeStart",INITIALIZE_END:"msal:initializeEnd",ACCOUNT_ADDED:"msal:accountAdded",ACCOUNT_REMOVED:"msal:accountRemoved",ACTIVE_ACCOUNT_CHANGED:"msal:activeAccountChanged",LOGIN_START:"msal:loginStart",LOGIN_SUCCESS:"msal:loginSuccess",LOGIN_FAILURE:"msal:loginFailure",ACQUIRE_TOKEN_START:"msal:acquireTokenStart",ACQUIRE_TOKEN_SUCCESS:"msal:acquireTokenSuccess",ACQUIRE_TOKEN_FAILURE:"msal:acquireTokenFailure",ACQUIRE_TOKEN_NETWORK_START:"msal:acquireTokenFromNetworkStart",SSO_SILENT_START:"msal:ssoSilentStart",SSO_SILENT_SUCCESS:"msal:ssoSilentSuccess",SSO_SILENT_FAILURE:"msal:ssoSilentFailure",ACQUIRE_TOKEN_BY_CODE_START:"msal:acquireTokenByCodeStart",ACQUIRE_TOKEN_BY_CODE_SUCCESS:"msal:acquireTokenByCodeSuccess",ACQUIRE_TOKEN_BY_CODE_FAILURE:"msal:acquireTokenByCodeFailure",HANDLE_REDIRECT_START:"msal:handleRedirectStart",HANDLE_REDIRECT_END:"msal:handleRedirectEnd",POPUP_OPENED:"msal:popupOpened",LOGOUT_START:"msal:logoutStart",LOGOUT_SUCCESS:"msal:logoutSuccess",LOGOUT_FAILURE:"msal:logoutFailure",LOGOUT_END:"msal:logoutEnd",RESTORE_FROM_BFCACHE:"msal:restoreFromBFCache",BROKER_CONNECTION_ESTABLISHED:"msal:brokerConnectionEstablished"};/*! @azure/msal-browser v4.19.0 2025-08-05 */function eI(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class k1 extends S1{constructor(e,n,r,i,o,s,l){super(e,r,i,o,l),this.cacheConfig=n,this.logger=i,this.internalStorage=new s0,this.browserStorage=tI(e,n.cacheLocation,i,o),this.temporaryCacheStorage=tI(e,n.temporaryCacheLocation,i,o),this.cookieStorage=new L5,this.eventHandler=s}async initialize(e){this.performanceClient.addFields({cacheLocation:this.cacheConfig.cacheLocation,cacheRetentionDays:this.cacheConfig.cacheRetentionDays},e),await this.browserStorage.initialize(e),await this.migrateExistingCache(e),this.trackVersionChanges(e)}async migrateExistingCache(e){const n=Bh(this.browserStorage,0),r=Hh(this.clientId,this.browserStorage,0);this.performanceClient.addFields({oldAccountCount:n.length,oldAccessCount:r.accessToken.length,oldIdCount:r.idToken.length,oldRefreshCount:r.refreshToken.length},e);const i=Bh(this.browserStorage,1),o=Hh(this.clientId,this.browserStorage,1);this.performanceClient.addFields({currAccountCount:i.length,currAccessCount:o.accessToken.length,currIdCount:o.idToken.length,currRefreshCount:o.refreshToken.length},e),await Promise.all([this.updateV0ToCurrent(N1,n,i,e),this.updateV0ToCurrent(Da,r.idToken,o.idToken,e),this.updateV0ToCurrent(Da,r.accessToken,o.accessToken,e),this.updateV0ToCurrent(Da,r.refreshToken,o.refreshToken,e)]),n.length>0?this.browserStorage.setItem(ss(0),JSON.stringify(n)):this.browserStorage.removeItem(ss(0)),i.length>0?this.browserStorage.setItem(ss(1),JSON.stringify(i)):this.browserStorage.removeItem(ss(1)),this.setTokenKeys(r,e,0),this.setTokenKeys(o,e,1)}async updateV0ToCurrent(e,n,r,i){const o=[];for(const s of[...n]){const l=this.browserStorage.getItem(s),c=this.validateAndParseJson(l||"");if(!c){eI(n,s);continue}c.lastUpdatedAt||(c.lastUpdatedAt=Date.now().toString(),this.setItem(s,JSON.stringify(c),i));const u=P1(c)?await this.browserStorage.decryptData(s,c,i):c;let d;if(u&&(IO(u)||RO(u))&&(d=u.expiresOn),!u||ute(c.lastUpdatedAt,this.cacheConfig.cacheRetentionDays)||d&&Ty(d,F4)){this.browserStorage.removeItem(s),eI(n,s),this.performanceClient.incrementFields({expiredCacheRemovedCount:1},i);continue}if(this.cacheConfig.cacheLocation!==pr.LocalStorage||P1(c)){const f=`${vr}.${e}${cS}${s}`,h=this.browserStorage.getItem(f);if(h){const p=this.validateAndParseJson(h);if(Number(c.lastUpdatedAt)>Number(p.lastUpdatedAt)){o.push(this.setUserData(f,JSON.stringify(u),i,c.lastUpdatedAt).then(()=>{this.performanceClient.incrementFields({updatedCacheFromV0Count:1},i)}));continue}}else{o.push(this.setUserData(f,JSON.stringify(u),i,c.lastUpdatedAt).then(()=>{r.push(f),this.performanceClient.incrementFields({upgradedCacheCount:1},i)}));continue}}}return Promise.all(o)}trackVersionChanges(e){const n=this.browserStorage.getItem(YO);n&&(this.logger.info(`MSAL.js was last initialized by version: ${n}`),this.performanceClient.addFields({previousLibraryVersion:n},e)),n!==qc&&this.setItem(YO,qc,e)}validateAndParseJson(e){if(!e)return null;try{const n=JSON.parse(e);return n&&typeof n=="object"?n:null}catch{return null}}setItem(e,n,r){let i=0,o=[];const s=20;for(let l=0;l<=s;l++)try{this.browserStorage.setItem(e,n),l>0&&(l<=i?this.removeAccessTokenKeys(o.slice(0,l),r,0):(this.removeAccessTokenKeys(o.slice(0,i),r,0),this.removeAccessTokenKeys(o.slice(i,l),r)));break}catch(c){const u=w1(c);if(u.errorCode===Ay&&l0&&(c<=o?this.removeAccessTokenKeys(s.slice(0,c),r,0):(this.removeAccessTokenKeys(s.slice(0,o),r,0),this.removeAccessTokenKeys(s.slice(o,c),r)));break}catch(u){const d=w1(u);if(d.errorCode===Ay&&c-1){if(r.splice(i,1),r.length===0){this.removeItem(ss());return}else this.setItem(ss(),JSON.stringify(r),n);this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")}else this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}removeAccount(e,n){const r=this.getActiveAccount(n);(r==null?void 0:r.homeAccountId)===e.homeAccountId&&(r==null?void 0:r.environment)===e.environment&&this.setActiveAccount(null,n),super.removeAccount(e,n),this.removeAccountKeyFromMap(this.generateAccountKey(e),n),this.browserStorage.getKeys().forEach(i=>{i.includes(e.homeAccountId)&&i.includes(e.environment)&&this.browserStorage.removeItem(i)}),this.cacheConfig.cacheLocation===pr.LocalStorage&&this.eventHandler.emitEvent(Ve.ACCOUNT_REMOVED,void 0,e)}removeIdToken(e,n){super.removeIdToken(e,n);const r=this.getTokenKeys(),i=r.idToken.indexOf(e);i>-1&&(this.logger.info("idToken removed from tokenKeys map"),r.idToken.splice(i,1),this.setTokenKeys(r,n))}removeAccessToken(e,n,r=!0){super.removeAccessToken(e,n),r&&this.removeAccessTokenKeys([e],n)}removeAccessTokenKeys(e,n,r=Da){this.logger.trace("removeAccessTokenKey called");const i=this.getTokenKeys(r);let o=0;if(e.forEach(s=>{const l=i.accessToken.indexOf(s);l>-1&&(i.accessToken.splice(l,1),o++)}),o>0){this.logger.info(`removed ${o} accessToken keys from tokenKeys map`),this.setTokenKeys(i,n,r);return}}removeRefreshToken(e,n){super.removeRefreshToken(e,n);const r=this.getTokenKeys(),i=r.refreshToken.indexOf(e);i>-1&&(this.logger.info("refreshToken removed from tokenKeys map"),r.refreshToken.splice(i,1),this.setTokenKeys(r,n))}getTokenKeys(e=Da){return Hh(this.clientId,this.browserStorage,e)}setTokenKeys(e,n,r=Da){if(e.idToken.length===0&&e.accessToken.length===0&&e.refreshToken.length===0){this.removeItem(pc(this.clientId,r));return}else this.setItem(pc(this.clientId,r),JSON.stringify(e),n)}getIdTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeIdToken(e,n),null;const i=this.validateAndParseJson(r);return!i||!fte(i)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),i)}async setIdTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const o=this.getTokenKeys();o.idToken.indexOf(r)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),o.idToken.push(r),this.setTokenKeys(o,n))}getAccessTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeAccessTokenKeys([e],n),null;const i=this.validateAndParseJson(r);return!i||!IO(i)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),i)}async setAccessTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const o=this.getTokenKeys(),s=o.accessToken.indexOf(r);s!==-1&&o.accessToken.splice(s,1),this.logger.trace(`access token ${s===-1?"added to":"updated in"} map`),o.accessToken.push(r),this.setTokenKeys(o,n)}getRefreshTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeRefreshToken(e,n),null;const i=this.validateAndParseJson(r);return!i||!RO(i)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),i)}async setRefreshTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const o=this.getTokenKeys();o.refreshToken.indexOf(r)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),o.refreshToken.push(r),this.setTokenKeys(o,n))}getAppMetadata(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!gte(e,r)?(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),r)}setAppMetadata(e,n){this.logger.trace("BrowserCacheManager.setAppMetadata called");const r=mte(e);this.setItem(r,JSON.stringify(e),n)}getServerTelemetry(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!hte(e,r)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),r)}setServerTelemetry(e,n,r){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(n),r)}getAuthorityMetadata(e){const n=this.internalStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(n);return r&&vte(e,r)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),r):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter(n=>this.isAuthorityMetadata(n))}setWrapperMetadata(e,n){this.internalStorage.setItem(zg.WRAPPER_SKU,e),this.internalStorage.setItem(zg.WRAPPER_VER,n)}getWrapperMetadata(){const e=this.internalStorage.getItem(zg.WRAPPER_SKU)||ve.EMPTY_STRING,n=this.internalStorage.getItem(zg.WRAPPER_VER)||ve.EMPTY_STRING;return[e,n]}setAuthorityMetadata(e,n){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(n))}getActiveAccount(e){const n=this.generateCacheKey(SO.ACTIVE_ACCOUNT_FILTERS),r=this.browserStorage.getItem(n);if(!r)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters found"),null;const i=this.validateAndParseJson(r);return i?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoFilteredBy({homeAccountId:i.homeAccountId,localAccountId:i.localAccountId,tenantId:i.tenantId},e)):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e,n){const r=this.generateCacheKey(SO.ACTIVE_ACCOUNT_FILTERS);if(e){this.logger.verbose("setActiveAccount: Active account set");const i={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId,lastUpdatedAt:_i().toString()};this.setItem(r,JSON.stringify(i),n)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(r);this.eventHandler.emitEvent(Ve.ACTIVE_ACCOUNT_CHANGED)}getThrottlingCache(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!pte(e,r)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),r)}setThrottlingCache(e,n,r){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(n),r)}getTemporaryCache(e,n){const r=n?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){const o=this.cookieStorage.getItem(r);if(o)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),o}const i=this.temporaryCacheStorage.getItem(r);if(!i){if(this.cacheConfig.cacheLocation===pr.LocalStorage){const o=this.browserStorage.getItem(r);if(o)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),o}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),i}setTemporaryCache(e,n,r){const i=r?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(i,n),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.cookieStorage.setItem(i,n,void 0,this.cacheConfig.secureCookies))}removeItem(e){this.browserStorage.removeItem(e)}removeTemporaryItem(e){this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.cookieStorage.removeItem(e))}getKeys(){return this.browserStorage.getKeys()}clear(e){this.removeAllAccounts(e),this.removeAppMetadata(e),this.temporaryCacheStorage.getKeys().forEach(n=>{(n.indexOf(vr)!==-1||n.indexOf(this.clientId)!==-1)&&this.removeTemporaryItem(n)}),this.browserStorage.getKeys().forEach(n=>{(n.indexOf(vr)!==-1||n.indexOf(this.clientId)!==-1)&&this.browserStorage.removeItem(n)}),this.internalStorage.clear()}clearTokensAndKeysWithClaims(e){this.performanceClient.addQueueMeasurement(G.ClearTokensAndKeysWithClaims,e);const n=this.getTokenKeys();let r=0;n.accessToken.forEach(i=>{const o=this.getAccessTokenCredential(i,e);o!=null&&o.requestedClaimsHash&&i.includes(o.requestedClaimsHash.toLowerCase())&&(this.removeAccessToken(i,e),r++)}),r>0&&this.logger.warning(`${r} access tokens with claims in the cache keys have been removed from the cache.`)}generateCacheKey(e){return Ss.startsWith(e,vr)?e:`${vr}.${this.clientId}.${e}`}generateCredentialKey(e){const n=e.credentialType===Pr.REFRESH_TOKEN&&e.familyId||e.clientId,r=e.tokenType&&e.tokenType.toLowerCase()!==an.BEARER.toLowerCase()?e.tokenType.toLowerCase():"";return[`${vr}.${Da}`,e.homeAccountId,e.environment,e.credentialType,n,e.realm||"",e.target||"",e.requestedClaimsHash||"",r].join(cS).toLowerCase()}generateAccountKey(e){const n=e.homeAccountId.split(".")[1];return[`${vr}.${N1}`,e.homeAccountId,e.environment,n||e.tenantId||""].join(cS).toLowerCase()}resetRequestCache(){this.logger.trace("BrowserCacheManager.resetRequestCache called"),this.removeTemporaryItem(this.generateCacheKey(tr.REQUEST_PARAMS)),this.removeTemporaryItem(this.generateCacheKey(tr.VERIFIER)),this.removeTemporaryItem(this.generateCacheKey(tr.ORIGIN_URI)),this.removeTemporaryItem(this.generateCacheKey(tr.URL_HASH)),this.removeTemporaryItem(this.generateCacheKey(tr.NATIVE_REQUEST)),this.setInteractionInProgress(!1)}cacheAuthorizeRequest(e,n){this.logger.trace("BrowserCacheManager.cacheAuthorizeRequest called");const r=Pp(JSON.stringify(e));if(this.setTemporaryCache(tr.REQUEST_PARAMS,r,!0),n){const i=Pp(n);this.setTemporaryCache(tr.VERIFIER,i,!0)}}getCachedRequest(){this.logger.trace("BrowserCacheManager.getCachedRequest called");const e=this.getTemporaryCache(tr.REQUEST_PARAMS,!0);if(!e)throw Be(c5);const n=this.getTemporaryCache(tr.VERIFIER,!0);let r,i="";try{r=JSON.parse(Lo(e)),n&&(i=Lo(n))}catch(o){throw this.logger.errorPii(`Attempted to parse: ${e}`),this.logger.error(`Parsing cached token request threw with error: ${o}`),Be(u5)}return[r,i]}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache(tr.NATIVE_REQUEST,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;const n=this.validateAndParseJson(e);return n||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){var r;const n=(r=this.getInteractionInProgress())==null?void 0:r.clientId;return e?n===this.clientId:!!n}getInteractionInProgress(){const e=`${vr}.${tr.INTERACTION_STATUS_KEY}`,n=this.getTemporaryCache(e,!1);try{return n?JSON.parse(n):null}catch{return this.logger.error("Cannot parse interaction status. Removing temporary cache items and clearing url hash. Retrying interaction should fix the error"),this.removeTemporaryItem(e),this.resetRequestCache(),I5(window),null}}setInteractionInProgress(e,n=Ga.SIGNIN){var i;const r=`${vr}.${tr.INTERACTION_STATUS_KEY}`;if(e){if(this.getInteractionInProgress())throw Be(t5);this.setTemporaryCache(r,JSON.stringify({clientId:this.clientId,type:n}),!1)}else!e&&((i=this.getInteractionInProgress())==null?void 0:i.clientId)===this.clientId&&this.removeTemporaryItem(r)}async hydrateCache(e,n){var l,c,u;const r=Jb((l=e.account)==null?void 0:l.homeAccountId,(c=e.account)==null?void 0:c.environment,e.idToken,this.clientId,e.tenantId);let i;n.claims&&(i=await this.cryptoImpl.hashString(n.claims));const o=Zb((u=e.account)==null?void 0:u.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?OO(e.expiresOn):0,e.extExpiresOn?OO(e.extExpiresOn):0,Lo,void 0,e.tokenType,void 0,n.sshKid,n.claims,i),s={idToken:r,accessToken:o};return this.saveCacheRecord(s,e.correlationId)}async saveCacheRecord(e,n,r){try{await super.saveCacheRecord(e,n,r)}catch(i){if(i instanceof nd&&this.performanceClient&&n)try{const o=this.getTokenKeys();this.performanceClient.addFields({cacheRtCount:o.refreshToken.length,cacheIdCount:o.idToken.length,cacheAtCount:o.accessToken.length},n)}catch{}throw i}}}function tI(t,e,n,r){try{switch(e){case pr.LocalStorage:return new Nne(t,n,r);case pr.SessionStorage:return new Tne;case pr.MemoryStorage:default:break}}catch(i){n.error(i)}return new s0}const Pne=(t,e,n,r)=>{const i={cacheLocation:pr.MemoryStorage,cacheRetentionDays:5,temporaryCacheLocation:pr.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};return new k1(t,i,wy,e,n,r)};/*! @azure/msal-browser v4.19.0 2025-08-05 */function kne(t,e,n,r,i){return t.verbose("getAllAccounts called"),n?e.getAllAccounts(i||{},r):[]}function One(t,e,n,r){if(e.trace("getAccount called"),Object.keys(t).length===0)return e.warning("getAccount: No accountFilter provided"),null;const i=n.getAccountInfoFilteredBy(t,r);return i?(e.verbose("getAccount: Account matching provided filter found, returning"),i):(e.verbose("getAccount: No matching account found, returning null"),null)}function Ine(t,e,n,r){if(e.trace("getAccountByUsername called"),!t)return e.warning("getAccountByUsername: No username provided"),null;const i=n.getAccountInfoFilteredBy({username:t},r);return i?(e.verbose("getAccountByUsername: Account matching username found, returning"),e.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${t}`),i):(e.verbose("getAccountByUsername: No matching account found, returning null"),null)}function Rne(t,e,n,r){if(e.trace("getAccountByHomeId called"),!t)return e.warning("getAccountByHomeId: No homeAccountId provided"),null;const i=n.getAccountInfoFilteredBy({homeAccountId:t},r);return i?(e.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),e.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${t}`),i):(e.verbose("getAccountByHomeId: No matching account found, returning null"),null)}function Mne(t,e,n,r){if(e.trace("getAccountByLocalId called"),!t)return e.warning("getAccountByLocalId: No localAccountId provided"),null;const i=n.getAccountInfoFilteredBy({localAccountId:t},r);return i?(e.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),e.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${t}`),i):(e.verbose("getAccountByLocalId: No matching account found, returning null"),null)}function Dne(t,e,n){e.setActiveAccount(t,n)}function $ne(t,e){return t.getActiveAccount(e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Lne="msal.broadcast.event";class Fne{constructor(e){this.eventCallbacks=new Map,this.logger=e||new ya({}),typeof BroadcastChannel<"u"&&(this.broadcastChannel=new BroadcastChannel(Lne)),this.invokeCrossTabCallbacks=this.invokeCrossTabCallbacks.bind(this)}addEventCallback(e,n,r){if(typeof window<"u"){const i=r||pne();return this.eventCallbacks.has(i)?(this.logger.error(`Event callback with id: ${i} is already registered. Please provide a unique id or remove the existing callback and try again.`),null):(this.eventCallbacks.set(i,[e,n||[]]),this.logger.verbose(`Event callback registered with id: ${i}`),i)}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}emitEvent(e,n,r,i){var s;const o={eventType:e,interactionType:n||null,payload:r||null,error:i||null,timestamp:Date.now()};switch(e){case Ve.ACCOUNT_ADDED:case Ve.ACCOUNT_REMOVED:case Ve.ACTIVE_ACCOUNT_CHANGED:(s=this.broadcastChannel)==null||s.postMessage(o);break;default:this.invokeCallbacks(o);break}}invokeCallbacks(e){this.eventCallbacks.forEach(([n,r],i)=>{(r.length===0||r.includes(e.eventType))&&(this.logger.verbose(`Emitting event to callback ${i}: ${e.eventType}`),n.apply(null,[e]))})}invokeCrossTabCallbacks(e){const n=e.data;this.invokeCallbacks(n)}subscribeCrossTab(){var e;(e=this.broadcastChannel)==null||e.addEventListener("message",this.invokeCrossTabCallbacks)}unsubscribeCrossTab(){var e;(e=this.broadcastChannel)==null||e.removeEventListener("message",this.invokeCrossTabCallbacks)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class F5{constructor(e,n,r,i,o,s,l,c,u){this.config=e,this.browserStorage=n,this.browserCrypto=r,this.networkClient=this.config.system.networkClient,this.eventHandler=o,this.navigationClient=s,this.platformAuthProvider=c,this.correlationId=u||Yo(),this.logger=i.clone(gi.MSAL_SKU,qc,this.correlationId),this.performanceClient=l}async clearCacheOnLogout(e,n){if(n)try{this.browserStorage.removeAccount(n,e),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.")}catch{this.logger.error("Account provided in logout request was not found. Local cache unchanged.")}else try{this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),this.browserStorage.clear(e),await this.browserCrypto.clearKeystore()}catch{this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.")}}getRedirectUri(e){this.logger.verbose("getRedirectUri called");const n=e||this.config.auth.redirectUri;return Kt.getAbsoluteUrl(n,ta())}initializeServerTelemetryManager(e,n){this.logger.verbose("initializeServerTelemetryManager called");const r={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:n||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new Np(r,this.browserStorage)}async getDiscoveredAuthority(e){const{account:n}=e,r=e.requestExtraQueryParameters&&e.requestExtraQueryParameters.hasOwnProperty("instance_aware")?e.requestExtraQueryParameters.instance_aware:void 0;this.performanceClient.addQueueMeasurement(G.StandardInteractionClientGetDiscoveredAuthority,this.correlationId);const i={protocolMode:this.config.auth.protocolMode,OIDCOptions:this.config.auth.OIDCOptions,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},o=e.requestAuthority||this.config.auth.authority,s=r!=null&&r.length?r==="true":this.config.auth.instanceAware,l=n&&s?this.config.auth.authority.replace(Kt.getDomainFromUrl(o),n.environment):o,c=Hr.generateAuthority(l,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),u=await ge(U3,G.AuthorityFactoryCreateDiscoveredInstance,this.logger,this.performanceClient,this.correlationId)(c,this.config.system.networkClient,this.browserStorage,i,this.logger,this.correlationId,this.performanceClient);if(n&&!u.isAlias(n.environment))throw gn(m3);return u}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function eN(t,e,n,r){n.addQueueMeasurement(G.InitializeBaseRequest,t.correlationId);const i=t.authority||e.auth.authority,o=[...t&&t.scopes||[]],s={...t,correlationId:t.correlationId,authority:i,scopes:o};if(!s.authenticationScheme)s.authenticationScheme=an.BEARER,r.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(s.authenticationScheme===an.SSH){if(!t.sshJwk)throw gn(qb);if(!t.sshKid)throw gn(f3)}r.verbose(`Authentication Scheme set to "${s.authenticationScheme}" as configured in Auth request`)}return e.cache.claimsBasedCachingEnabled&&t.claims&&!Ss.isEmptyObj(t.claims)&&(s.requestedClaimsHash=await O5(t.claims)),s}async function Une(t,e,n,r,i){r.addQueueMeasurement(G.InitializeSilentRequest,t.correlationId);const o=await ge(eN,G.InitializeBaseRequest,i,r,t.correlationId)(t,n,r,i);return{...t,...o,account:e,forceRefresh:t.forceRefresh||!1}}function U5(t,e){let n;const r=t.httpMethod;if(e===Ai.EAR){if(n=r||hc.POST,n!==hc.POST)throw gn(g3)}else n=r||hc.GET;if(t.authorizePostBodyParameters&&n!==hc.POST)throw gn(v3);return n}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Af extends F5{initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e==null?void 0:e.correlationId);const n={correlationId:this.correlationId||Yo(),...e};if(e)if(e.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(e.account){const r=this.getLogoutHintFromIdTokenClaims(e.account);r&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),n.logoutHint=r)}else this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");else this.logger.verbose("logoutHint will not be set since no logout request was configured");return!e||e.postLogoutRedirectUri!==null?e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",n.correlationId),n.postLogoutRedirectUri=Kt.getAbsoluteUrl(e.postLogoutRedirectUri,ta())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",n.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",n.correlationId),n.postLogoutRedirectUri=Kt.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,ta())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",n.correlationId),n.postLogoutRedirectUri=Kt.getAbsoluteUrl(ta(),ta())):this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",n.correlationId),n}getLogoutHintFromIdTokenClaims(e){const n=e.idTokenClaims;if(n){if(n.login_hint)return n.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null}async createAuthCodeClient(e){this.performanceClient.addQueueMeasurement(G.StandardInteractionClientCreateAuthCodeClient,this.correlationId);const n=await ge(this.getClientConfiguration.bind(this),G.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)(e);return new G3(n,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:n,requestAuthority:r,requestAzureCloudOptions:i,requestExtraQueryParameters:o,account:s}=e;this.performanceClient.addQueueMeasurement(G.StandardInteractionClientGetClientConfiguration,this.correlationId);const l=await ge(this.getDiscoveredAuthority.bind(this),G.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,this.correlationId)({requestAuthority:r,requestAzureCloudOptions:i,requestExtraQueryParameters:o,account:s}),c=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:l,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:c.loggerCallback,piiLoggingEnabled:c.piiLoggingEnabled,logLevel:c.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:n,libraryInfo:{sku:gi.MSAL_SKU,version:qc,cpu:ve.EMPTY_STRING,os:ve.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,n){this.performanceClient.addQueueMeasurement(G.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId);const r=this.getRedirectUri(e.redirectUri),i={interactionType:n},o=Sf.setRequestState(this.browserCrypto,e&&e.state||ve.EMPTY_STRING,i),l={...await ge(eN,G.InitializeBaseRequest,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:r,state:o,nonce:e.nonce||Yo(),responseMode:this.config.auth.OIDCOptions.serverResponseType},c={...l,httpMethod:U5(l,this.config.auth.protocolMode)};if(e.loginHint||e.sid)return c;const u=e.account||this.browserStorage.getActiveAccount(this.correlationId);return u&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${u.homeAccountId}`,this.correlationId),c.account=u),c}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Bne(t,e){if(!e)return null;try{return Sf.parseRequestState(t,e).libraryState.meta}catch{throw Ae(Pd)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function zh(t,e,n){const r=Sy(t);if(!r)throw x3(t)?(n.error(`A ${e} is present in the iframe but it does not contain known properties. It's likely that the ${e} has been replaced by code running on the redirectUri page.`),n.errorPii(`The ${e} detected is: ${t}`),Be(J3)):(n.error(`The request has returned to the redirectUri but a ${e} is not present. It's likely that the ${e} has been removed or the page has been redirected by code running on the redirectUri page.`),Be(X3));return r}function Hne(t,e,n){if(!t.state)throw Be(UE);const r=Bne(e,t.state);if(!r)throw Be(Z3);if(r.interactionType!==n)throw Be(e5)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class B5{constructor(e,n,r,i,o){this.authModule=e,this.browserStorage=n,this.authCodeRequest=r,this.logger=i,this.performanceClient=o}async handleCodeResponse(e,n){this.performanceClient.addQueueMeasurement(G.HandleCodeResponse,n.correlationId);let r;try{r=Ote(e,n.state)}catch(i){throw i instanceof lu&&i.subError===Tp?Be(Tp):i}return ge(this.handleCodeResponseFromServer.bind(this),G.HandleCodeResponseFromServer,this.logger,this.performanceClient,n.correlationId)(r,n)}async handleCodeResponseFromServer(e,n,r=!0){if(this.performanceClient.addQueueMeasurement(G.HandleCodeResponseFromServer,n.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await ge(this.authModule.updateAuthority.bind(this.authModule),G.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,n.correlationId)(e.cloud_instance_host_name,n.correlationId),r&&(e.nonce=n.nonce||void 0),e.state=n.state,e.client_info)this.authCodeRequest.clientInfo=e.client_info;else{const o=this.createCcsCredentials(n);o&&(this.authCodeRequest.ccsCredential=o)}return await ge(this.authModule.acquireToken.bind(this.authModule),G.AuthClientAcquireToken,this.logger,this.performanceClient,n.correlationId)(this.authCodeRequest,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:Oo.HOME_ACCOUNT_ID}:e.loginHint?{credential:e.loginHint,type:Oo.UPN}:null}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const zne="ContentError",H5="user_switch";/*! @azure/msal-browser v4.19.0 2025-08-05 */const Vne="USER_INTERACTION_REQUIRED",Gne="USER_CANCEL",Kne="NO_NETWORK",Wne="PERSISTENT_ERROR",qne="DISABLED",Yne="ACCOUNT_UNAVAILABLE",Qne="UX_NOT_ALLOWED";/*! @azure/msal-browser v4.19.0 2025-08-05 */const Xne=-2147186943,Jne={[H5]:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."};class ps extends pn{constructor(e,n,r){super(e,n),Object.setPrototypeOf(this,ps.prototype),this.name="NativeAuthError",this.ext=r}}function Nu(t){if(t.ext&&t.ext.status&&(t.ext.status===Wne||t.ext.status===qne)||t.ext&&t.ext.error&&t.ext.error===Xne)return!0;switch(t.errorCode){case zne:return!0;default:return!1}}function Dy(t,e,n){if(n&&n.status)switch(n.status){case Yne:return ky(H3);case Vne:return new qo(t,e);case Gne:return Be(Tp);case Kne:return Be(Oy);case Qne:return ky(IE)}return new ps(t,Jne[t]||e,n)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class z5 extends Af{async acquireToken(e){this.performanceClient.addQueueMeasurement(G.SilentCacheClientAcquireToken,e.correlationId);const n=this.initializeServerTelemetryManager(hn.acquireTokenSilent_silentFlow),r=await ge(this.getClientConfiguration.bind(this),G.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),i=new Tte(r,this.performanceClient);this.logger.verbose("Silent auth client created");try{const s=(await ge(i.acquireCachedToken.bind(i),G.SilentFlowClientAcquireCachedToken,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),s}catch(o){throw o instanceof qm&&o.errorCode===BE&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),o}}logout(e){this.logger.verbose("logoutRedirect called");const n=this.initializeLogoutRequest(e);return this.clearCacheOnLogout(n.correlationId,n==null?void 0:n.account)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class kv extends F5{constructor(e,n,r,i,o,s,l,c,u,d,f,h){super(e,n,r,i,o,s,c,u,h),this.apiId=l,this.accountId=d,this.platformAuthProvider=u,this.nativeStorageManager=f,this.silentCacheClient=new z5(e,this.nativeStorageManager,r,i,o,s,c,u,h);const p=this.platformAuthProvider.getExtensionName();this.skus=Np.makeExtraSkuString({libraryName:gi.MSAL_SKU,libraryVersion:qc,extensionName:p,extensionVersion:this.platformAuthProvider.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[Vee]:this.skus}}async acquireToken(e,n){this.performanceClient.addQueueMeasurement(G.NativeInteractionClientAcquireToken,e.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const r=this.performanceClient.startMeasurement(G.NativeInteractionClientAcquireToken,e.correlationId),i=_i(),o=this.initializeServerTelemetryManager(this.apiId);try{const s=await this.initializeNativeRequest(e);try{const c=await this.acquireTokensFromCache(this.accountId,s);return r.end({success:!0,isNativeBroker:!1,fromCache:!0}),c}catch(c){if(n===Xr.AccessToken)throw this.logger.info("MSAL internal Cache does not contain tokens, return error as per cache policy"),c;this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const l=await this.platformAuthProvider.sendMessage(s);return await this.handleNativeResponse(l,s,i).then(c=>(r.end({success:!0,isNativeBroker:!0,requestId:c.requestId}),o.clearNativeBrokerErrorCode(),c)).catch(c=>{throw r.end({success:!1,errorCode:c.errorCode,subErrorCode:c.subError,isNativeBroker:!0}),c})}catch(s){throw s instanceof ps&&o.setNativeBrokerErrorCode(s.errorCode),s}}createSilentCacheRequest(e,n){return{authority:e.authority,correlationId:this.correlationId,scopes:hr.fromString(e.scope).asArray(),account:n,forceRefresh:!1}}async acquireTokensFromCache(e,n){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),Ae(x1);const r=this.browserStorage.getBaseAccountInfo({nativeAccountId:e},this.correlationId);if(!r)throw Ae(x1);try{const i=this.createSilentCacheRequest(n,r),o=await this.silentCacheClient.acquireToken(i),s={...r,idTokenClaims:o==null?void 0:o.idTokenClaims,idToken:o==null?void 0:o.idToken};return{...o,account:s}}catch(i){throw i}}async acquireTokenRedirect(e,n){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const{...r}=e;delete r.onRedirectNavigate;const i=await this.initializeNativeRequest(r);try{await this.platformAuthProvider.sendMessage(i)}catch(l){if(l instanceof ps&&(this.initializeServerTelemetryManager(this.apiId).setNativeBrokerErrorCode(l.errorCode),Nu(l)))throw l}this.browserStorage.setTemporaryCache(tr.NATIVE_REQUEST,JSON.stringify(i),!0);const o={apiId:hn.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},s=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(e.redirectUri);n.end({success:!0}),await this.navigationClient.navigateExternal(s,o)}async handleRedirectPromise(e,n){if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const r=this.browserStorage.getCachedNativeRequest();if(!r)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),e&&n&&(e==null||e.addFields({errorCode:"no_cached_request"},n)),null;const{prompt:i,...o}=r;i&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(tr.NATIVE_REQUEST));const s=_i();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const l=await this.platformAuthProvider.sendMessage(o),c=await this.handleNativeResponse(l,o,s);return this.initializeServerTelemetryManager(this.apiId).clearNativeBrokerErrorCode(),c}catch(l){throw l}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,n,r){var d,f;this.logger.trace("NativeInteractionClient - handleNativeResponse called.");const i=wf(e.id_token,Lo),o=this.createHomeAccountIdentifier(e,i),s=(d=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:n.accountId},this.correlationId))==null?void 0:d.homeAccountId;if((f=n.extraParameters)!=null&&f.child_client_id&&e.account.id!==n.accountId)this.logger.info("handleNativeServerResponse: Double broker flow detected, ignoring accountId mismatch");else if(o!==s&&e.account.id!==n.accountId)throw Dy(H5);const l=await this.getDiscoveredAuthority({requestAuthority:n.authority}),c=RE(this.browserStorage,l,o,Lo,this.correlationId,i,e.client_info,void 0,i.tid,void 0,e.account.id,this.logger);e.expires_in=Number(e.expires_in);const u=await this.generateAuthenticationResult(e,n,i,c,l.canonicalAuthority,r);return await this.cacheAccount(c,this.correlationId),await this.cacheNativeTokens(e,n,o,i,e.access_token,u.tenantId,r),u}createHomeAccountIdentifier(e,n){return Wo.generateHomeAccountId(e.client_info||ve.EMPTY_STRING,Eo.Default,this.logger,this.browserCrypto,n)}generateScopes(e,n){return n?hr.fromString(n):hr.fromString(e)}async generatePopAccessToken(e,n){if(n.tokenType===an.POP&&n.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const r=new kd(this.browserCrypto),i={resourceRequestMethod:n.resourceRequestMethod,resourceRequestUri:n.resourceRequestUri,shrClaims:n.shrClaims,shrNonce:n.shrNonce};if(!n.keyId)throw Ae(lE);return r.signPopToken(e.access_token,n.keyId,i)}else return e.access_token}async generateAuthenticationResult(e,n,r,i,o,s){const l=this.addTelemetryFromNativeResponse(e.properties.MATS),c=this.generateScopes(n.scope,e.scope),u=e.account.properties||{},d=u.UID||r.oid||r.sub||ve.EMPTY_STRING,f=u.TenantId||r.tid||ve.EMPTY_STRING,h=vE(i.getAccountInfo(),void 0,r,e.id_token);h.nativeAccountId!==e.account.id&&(h.nativeAccountId=e.account.id);const p=await this.generatePopAccessToken(e,n),g=n.tokenType===an.POP?an.POP:an.BEARER;return{authority:o,uniqueId:d,tenantId:f,scopes:c.asArray(),account:h,idToken:e.id_token,idTokenClaims:r,accessToken:p,fromCache:l?this.isResponseFromCache(l):!1,expiresOn:id(s+e.expires_in),tokenType:g,correlationId:this.correlationId,state:e.state,fromNativeBroker:!0}}async cacheAccount(e,n){await this.browserStorage.setAccount(e,this.correlationId),this.browserStorage.removeAccountContext(e.getAccountInfo(),n)}cacheNativeTokens(e,n,r,i,o,s,l){const c=Jb(r,n.authority,e.id_token||"",n.clientId,i.tid||""),u=n.tokenType===an.POP?ve.SHR_NONCE_VALIDITY:(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,d=l+u,f=this.generateScopes(e.scope,n.scope),h=Zb(r,n.authority,o,n.clientId,i.tid||s,f.printScopes(),d,0,Lo,void 0,n.tokenType,void 0,n.keyId),p={idToken:c,accessToken:h};return this.nativeStorageManager.saveCacheRecord(p,this.correlationId,n.storeInCache)}getExpiresInValue(e,n){return e===an.POP?ve.SHR_NONCE_VALIDITY:(typeof n=="string"?parseInt(n,10):n)||0}addTelemetryFromNativeResponse(e){const n=this.getMATSFromResponse(e);return n?(this.performanceClient.addFields({extensionId:this.platformAuthProvider.getExtensionId(),extensionVersion:this.platformAuthProvider.getExtensionVersion(),matsBrokerVersion:n.broker_version,matsAccountJoinOnStart:n.account_join_on_start,matsAccountJoinOnEnd:n.account_join_on_end,matsDeviceJoin:n.device_join,matsPromptBehavior:n.prompt_behavior,matsApiErrorCode:n.api_error_code,matsUiVisible:n.ui_visible,matsSilentCode:n.silent_code,matsSilentBiSubCode:n.silent_bi_sub_code,matsSilentMessage:n.silent_message,matsSilentStatus:n.silent_status,matsHttpStatus:n.http_status,matsHttpEventCount:n.http_event_count},this.correlationId),n):null}getMATSFromResponse(e){if(e)try{return JSON.parse(e)}catch{this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null}isResponseFromCache(e){return typeof e.is_cached>"u"?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached}async initializeNativeRequest(e){this.logger.trace("NativeInteractionClient - initializeNativeRequest called");const n=await this.getCanonicalAuthority(e),{scopes:r,...i}=e,o=new hr(r||[]);o.appendScopes(Wm);const s={...i,accountId:this.accountId,clientId:this.config.auth.clientId,authority:n.urlString,scope:o.printScopes(),redirectUri:this.getRedirectUri(e.redirectUri),prompt:this.getPrompt(e.prompt),correlationId:this.correlationId,tokenType:e.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...e.extraQueryParameters,...e.tokenQueryParameters},extendedExpiryToken:!1,keyId:e.popKid};if(s.signPopToken&&e.popKid)throw Be(S5);if(this.handleExtraBrokerParams(s),s.extraParameters=s.extraParameters||{},s.extraParameters.telemetry=io.MATS_TELEMETRY,e.authenticationScheme===an.POP){const l={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},c=new kd(this.browserCrypto);let u;if(s.keyId)u=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:s.keyId})),s.signPopToken=!1;else{const d=await ge(c.generateCnf.bind(c),G.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(l,this.logger);u=d.reqCnfString,s.keyId=d.kid,s.signPopToken=!0}s.reqCnf=u}return this.addRequestSKUs(s),s}async getCanonicalAuthority(e){const n=e.authority||this.config.auth.authority;e.account&&await this.getDiscoveredAuthority({requestAuthority:n,requestAzureCloudOptions:e.azureCloudOptions,account:e.account});const r=new Kt(n);return r.validateAsUri(),r}getPrompt(e){switch(this.apiId){case hn.ssoSilent:case hn.acquireTokenSilent_silentFlow:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),ri.NONE}if(!e){this.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(e){case ri.NONE:case ri.CONSENT:case ri.LOGIN:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),e;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${e} is not compatible with native flow`),Be(b5)}}handleExtraBrokerParams(e){var o;const n=e.extraParameters&&e.extraParameters.hasOwnProperty(jy)&&e.extraParameters.hasOwnProperty(Ey)&&e.extraParameters.hasOwnProperty(Kc);if(!e.embeddedClientId&&!n)return;let r="";const i=e.redirectUri;e.embeddedClientId?(e.redirectUri=this.config.auth.redirectUri,r=e.embeddedClientId):e.extraParameters&&(e.redirectUri=e.extraParameters[Ey],r=e.extraParameters[Kc]),e.extraParameters={child_client_id:r,child_redirect_uri:i},(o=this.performanceClient)==null||o.addFields({embeddedClientId:r,embeddedRedirectUri:i},e.correlationId)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function tN(t,e,n,r,i){const o=kte({...t.auth,authority:e},n,r,i);if(jE(o,{sku:gi.MSAL_SKU,version:qc,os:"",cpu:""}),t.auth.protocolMode!==Ai.OIDC&&EE(o,t.telemetry.application),n.platformBroker&&(qee(o),n.authenticationScheme===an.POP)){const s=new xa(r,i),l=new kd(s);let c;n.popKid?c=s.encodeKid(n.popKid):c=(await ge(l.generateCnf.bind(l),G.PopTokenGenerateCnf,r,i,n.correlationId)(n,r)).reqCnfString,TE(o,c)}return Yb(o,n.correlationId,i),o}async function nN(t,e,n,r,i){if(!n.codeChallenge)throw gn(hE);const o=await ge(tN,G.GetStandardParams,r,i,n.correlationId)(t,e,n,r,i);return bE(o,tE.CODE),T3(o,n.codeChallenge,ve.S256_CODE_CHALLENGE_METHOD),vl(o,n.extraQueryParameters||{}),ME(e,o,t.auth.encodeExtraQueryParams,n.extraQueryParameters)}async function rN(t,e,n,r,i,o){if(!r.earJwk)throw Be(FE);const s=await tN(e,n,r,i,o);bE(s,tE.IDTOKEN_TOKEN_REFRESHTOKEN),ote(s,r.earJwk);const l=new Map;vl(l,r.extraQueryParameters||{});const c=ME(n,l,e.auth.encodeExtraQueryParams,r.extraQueryParameters);return V5(t,c,s)}async function iN(t,e,n,r,i,o){const s=await tN(e,n,r,i,o);bE(s,tE.CODE),T3(s,r.codeChallenge,r.codeChallengeMethod||ve.S256_CODE_CHALLENGE_METHOD),ste(s,r.authorizePostBodyParameters||{});const l=new Map;vl(l,r.extraQueryParameters||{});const c=ME(n,l,e.auth.encodeExtraQueryParams,r.extraQueryParameters);return V5(t,c,s)}function V5(t,e,n){const r=t.createElement("form");return r.method="post",r.action=e,n.forEach((i,o)=>{const s=t.createElement("input");s.hidden=!0,s.name=o,s.value=i,r.appendChild(s)}),t.body.appendChild(r),r}async function G5(t,e,n,r,i,o,s,l,c,u){if(l.verbose("Account id found, calling WAM for token"),!u)throw Be(zE);const d=new xa(l,c),f=new kv(r,i,d,l,s,r.system.navigationClient,n,c,u,e,o,t.correlationId),{userRequestState:h}=Sf.parseRequestState(d,t.state);return ge(f.acquireToken.bind(f),G.NativeInteractionClientAcquireToken,l,c,t.correlationId)({...t,state:h,prompt:void 0})}async function $y(t,e,n,r,i,o,s,l,c,u,d,f){if(hs.removeThrottle(s,i.auth.clientId,t),e.accountId)return ge(G5,G.HandleResponsePlatformBroker,u,d,t.correlationId)(t,e.accountId,r,i,s,l,c,u,d,f);const h={...t,code:e.code||"",codeVerifier:n},p=new B5(o,s,h,u,d);return await ge(p.handleCodeResponse.bind(p),G.HandleCodeResponse,u,d,t.correlationId)(e,t)}async function oN(t,e,n,r,i,o,s,l,c,u,d){if(hs.removeThrottle(o,r.auth.clientId,t),K3(e,t.state),!e.ear_jwe)throw Be(Q3);if(!t.earJwk)throw Be(FE);const f=JSON.parse(await ge(sne,G.DecryptEarResponse,c,u,t.correlationId)(t.earJwk,e.ear_jwe));if(f.accountId)return ge(G5,G.HandleResponsePlatformBroker,c,u,t.correlationId)(t,f.accountId,n,r,o,s,l,c,u,d);const h=new Wc(r.auth.clientId,o,new xa(c,u),c,null,null,u);h.validateTokenResponse(f);const p={code:"",state:t.state,nonce:t.nonce,client_info:f.client_info,cloud_graph_host_name:f.cloud_graph_host_name,cloud_instance_host_name:f.cloud_instance_host_name,cloud_instance_name:f.cloud_instance_name,msgraph_host:f.msgraph_host};return await ge(h.handleServerTokenResponse.bind(h),G.HandleServerTokenResponse,c,u,t.correlationId)(f,i,_i(),t,p,void 0,void 0,void 0,void 0)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Zne=32;async function a0(t,e,n){t.addQueueMeasurement(G.GeneratePkceCodes,n);const r=Bi(ere,G.GenerateCodeVerifier,e,t,n)(t,e,n),i=await ge(tre,G.GenerateCodeChallengeFromVerifier,e,t,n)(r,t,e,n);return{verifier:r,challenge:i}}function ere(t,e,n){try{const r=new Uint8Array(Zne);return Bi(tne,G.GetRandomValues,e,t,n)(r),Ol(r)}catch{throw Be(LE)}}async function tre(t,e,n,r){e.addQueueMeasurement(G.GenerateCodeChallengeFromVerifier,r);try{const i=await ge(T5,G.Sha256Digest,n,e,r)(t,e,r);return Ol(new Uint8Array(i))}catch{throw Be(LE)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Ly{constructor(e,n,r,i){this.logger=e,this.handshakeTimeoutMs=n,this.extensionId=i,this.resolvers=new Map,this.handshakeResolvers=new Map,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=r,this.handshakeEvent=r.startMeasurement(G.NativeMessageHandlerHandshake),this.platformAuthType=io.PLATFORM_EXTENSION_PROVIDER}async sendMessage(e){this.logger.trace(this.platformAuthType+" - sendMessage called.");const n={method:rh.GetToken,request:e},r={channel:io.CHANNEL_ID,extensionId:this.extensionId,responseId:Yo(),body:n};this.logger.trace(this.platformAuthType+" - Sending request to browser extension"),this.logger.tracePii(this.platformAuthType+` - Sending request to browser extension: ${JSON.stringify(r)}`),this.messageChannel.port1.postMessage(r);const i=await new Promise((s,l)=>{this.resolvers.set(r.responseId,{resolve:s,reject:l})});return this.validatePlatformBrokerResponse(i)}static async createProvider(e,n,r){e.trace("PlatformAuthExtensionHandler - createProvider called.");try{const i=new Ly(e,n,r,io.PREFERRED_EXTENSION_ID);return await i.sendHandshakeRequest(),i}catch{const o=new Ly(e,n,r);return await o.sendHandshakeRequest(),o}}async sendHandshakeRequest(){this.logger.trace(this.platformAuthType+" - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:io.CHANNEL_ID,extensionId:this.extensionId,responseId:Yo(),body:{method:rh.HandshakeRequest}};return this.handshakeEvent.add({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=n=>{this.onChannelMessage(n)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise((n,r)=>{this.handshakeResolvers.set(e.responseId,{resolve:n,reject:r}),this.timeoutId=window.setTimeout(()=>{window.removeEventListener("message",this.windowListener,!1),this.messageChannel.port1.close(),this.messageChannel.port2.close(),this.handshakeEvent.end({extensionHandshakeTimedOut:!0,success:!1}),r(Be(y5)),this.handshakeResolvers.delete(e.responseId)},this.handshakeTimeoutMs)})}onWindowMessage(e){if(this.logger.trace(this.platformAuthType+" - onWindowMessage called"),e.source!==window)return;const n=e.data;if(!(!n.channel||n.channel!==io.CHANNEL_ID)&&!(n.extensionId&&n.extensionId!==this.extensionId)&&n.body.method===rh.HandshakeRequest){const r=this.handshakeResolvers.get(n.responseId);if(!r){this.logger.trace(this.platformAuthType+`.onWindowMessage - resolver can't be found for request ${n.responseId}`);return}this.logger.verbose(n.extensionId?`Extension with id: ${n.extensionId} not installed`:"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),this.handshakeEvent.end({success:!1,extensionInstalled:!1}),r.reject(Be(x5))}}onChannelMessage(e){this.logger.trace(this.platformAuthType+" - onChannelMessage called.");const n=e.data,r=this.resolvers.get(n.responseId),i=this.handshakeResolvers.get(n.responseId);try{const o=n.body.method;if(o===rh.Response){if(!r)return;const s=n.body.response;if(this.logger.trace(this.platformAuthType+" - Received response from browser extension"),this.logger.tracePii(this.platformAuthType+` - Received response from browser extension: ${JSON.stringify(s)}`),s.status!=="Success")r.reject(Dy(s.code,s.description,s.ext));else if(s.result)s.result.code&&s.result.description?r.reject(Dy(s.result.code,s.result.description,s.result.ext)):r.resolve(s.result);else throw g1(by,"Event does not contain result.");this.resolvers.delete(n.responseId)}else if(o===rh.HandshakeResponse){if(!i){this.logger.trace(this.platformAuthType+`.onChannelMessage - resolver can't be found for request ${n.responseId}`);return}clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=n.extensionId,this.extensionVersion=n.body.version,this.logger.verbose(this.platformAuthType+` - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.end({extensionInstalled:!0,success:!0}),i.resolve(),this.handshakeResolvers.delete(n.responseId)}}catch(o){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${o}`),this.logger.errorPii(`Unable to parse ${e}`),r?r.reject(o):i&&i.reject(o)}}validatePlatformBrokerResponse(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw g1(by,"Response missing expected properties.")}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}getExtensionName(){var e;return this.getExtensionId()===io.PREFERRED_EXTENSION_ID?"chrome":(e=this.getExtensionId())!=null&&e.length?"unknown":void 0}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class sN{constructor(e,n,r){this.logger=e,this.performanceClient=n,this.correlationId=r,this.platformAuthType=io.PLATFORM_DOM_PROVIDER}static async createProvider(e,n,r){var i;if(e.trace("PlatformAuthDOMHandler: createProvider called"),(i=window.navigator)!=null&&i.platformAuthentication){const o=await window.navigator.platformAuthentication.getSupportedContracts(io.MICROSOFT_ENTRA_BROKERID);if(o!=null&&o.includes(io.PLATFORM_DOM_APIS))return e.trace("Platform auth api available in DOM"),new sN(e,n,r)}}getExtensionId(){return io.MICROSOFT_ENTRA_BROKERID}getExtensionVersion(){return""}getExtensionName(){return io.DOM_API_NAME}async sendMessage(e){this.logger.trace(this.platformAuthType+" - Sending request to browser DOM API");try{const n=this.initializePlatformDOMRequest(e),r=await window.navigator.platformAuthentication.executeGetToken(n);return this.validatePlatformBrokerResponse(r)}catch(n){throw this.logger.error(this.platformAuthType+" - executeGetToken DOM API error"),n}}initializePlatformDOMRequest(e){this.logger.trace(this.platformAuthType+" - initializeNativeDOMRequest called");const{accountId:n,clientId:r,authority:i,scope:o,redirectUri:s,correlationId:l,state:c,storeInCache:u,embeddedClientId:d,extraParameters:f,...h}=e,p=this.getDOMExtraParams(h);return{accountId:n,brokerId:this.getExtensionId(),authority:i,clientId:r,correlationId:l||this.correlationId,extraParameters:{...f,...p},isSecurityTokenService:!1,redirectUri:s,scope:o,state:c,storeInCache:u,embeddedClientId:d}}validatePlatformBrokerResponse(e){if(e.hasOwnProperty("isSuccess")){if(e.hasOwnProperty("accessToken")&&e.hasOwnProperty("idToken")&&e.hasOwnProperty("clientInfo")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scopes")&&e.hasOwnProperty("expiresIn"))return this.logger.trace(this.platformAuthType+" - platform broker returned successful and valid response"),this.convertToPlatformBrokerResponse(e);if(e.hasOwnProperty("error")){const n=e;if(n.isSuccess===!1&&n.error&&n.error.code)throw this.logger.trace(this.platformAuthType+" - platform broker returned error response"),Dy(n.error.code,n.error.description,{error:parseInt(n.error.errorCode),protocol_error:n.error.protocolError,status:n.error.status,properties:n.error.properties})}}throw g1(by,"Response missing expected properties.")}convertToPlatformBrokerResponse(e){return this.logger.trace(this.platformAuthType+" - convertToNativeResponse called"),{access_token:e.accessToken,id_token:e.idToken,client_info:e.clientInfo,account:e.account,expires_in:e.expiresIn,scope:e.scopes,state:e.state||"",properties:e.properties||{},extendedLifetimeToken:e.extendedLifetimeToken??!1,shr:e.proofOfPossessionPayload}}getDOMExtraParams(e){return{...Object.entries(e).reduce((i,[o,s])=>(i[o]=String(s),i),{})}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function nre(t,e,n,r){t.trace("getPlatformAuthProvider called",n);const i=rre();t.trace("Has client allowed platform auth via DOM API: "+i);let o;try{i&&(o=await sN.createProvider(t,e,n)),o||(t.trace("Platform auth via DOM API not available, checking for extension"),o=await Ly.createProvider(t,r||$5,e))}catch(s){t.trace("Platform auth not available",s)}return o}function rre(){let t;try{return t=window[pr.SessionStorage],(t==null?void 0:t.getItem(Sne))==="true"}catch{return!1}}function Op(t,e,n,r){if(e.trace("isPlatformAuthAllowed called"),!t.system.allowPlatformBroker)return e.trace("isPlatformAuthAllowed: allowPlatformBroker is not enabled, returning false"),!1;if(!n)return e.trace("isPlatformAuthAllowed: Platform auth provider is not initialized, returning false"),!1;if(r)switch(r){case an.BEARER:case an.POP:return e.trace("isPlatformAuthAllowed: authenticationScheme is supported, returning true"),!0;default:return e.trace("isPlatformAuthAllowed: authenticationScheme is not supported, returning false"),!1}return!0}/*! @azure/msal-browser v4.19.0 2025-08-05 */class ire extends Af{constructor(e,n,r,i,o,s,l,c,u,d){super(e,n,r,i,o,s,l,u,d),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=c,this.eventHandler=o}acquireToken(e,n){let r;try{if(r={popupName:this.generatePopupName(e.scopes||Wm,e.authority||this.config.auth.authority),popupWindowAttributes:e.popupWindowAttributes||{},popupWindowParent:e.popupWindowParent??window},this.performanceClient.addFields({isAsyncPopup:this.config.system.asyncPopups},this.correlationId),this.config.system.asyncPopups)return this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,r,n);{const o={...e,httpMethod:U5(e,this.config.auth.protocolMode)};return this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),r.popup=this.openSizedPopup("about:blank",r),this.acquireTokenPopupAsync(o,r,n)}}catch(i){return Promise.reject(i)}}logout(e){try{this.logger.verbose("logoutPopup called");const n=this.initializeLogoutRequest(e),r={popupName:this.generateLogoutPopupName(n),popupWindowAttributes:(e==null?void 0:e.popupWindowAttributes)||{},popupWindowParent:(e==null?void 0:e.popupWindowParent)??window},i=e&&e.authority,o=e&&e.mainWindowRedirectUri;return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(n,r,i,o)):(this.logger.verbose("asyncPopup set to false, opening popup"),r.popup=this.openSizedPopup("about:blank",r),this.logoutPopupAsync(n,r,i,o))}catch(n){return Promise.reject(n)}}async acquireTokenPopupAsync(e,n,r){this.logger.verbose("acquireTokenPopupAsync called");const i=await ge(this.initializeAuthorizationRequest.bind(this),G.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,pt.Popup);n.popup&&D5(i.authority);const o=Op(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme);return i.platformBroker=o,this.config.auth.protocolMode===Ai.EAR?this.executeEarFlow(i,n):this.executeCodeFlow(i,n,r)}async executeCodeFlow(e,n,r){var c;const i=e.correlationId,o=this.initializeServerTelemetryManager(hn.acquireTokenPopup),s=r||await ge(a0,G.GeneratePkceCodes,this.logger,this.performanceClient,i)(this.performanceClient,this.logger,i),l={...e,codeChallenge:s.challenge};try{const u=await ge(this.createAuthCodeClient.bind(this),G.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,i)({serverTelemetryManager:o,requestAuthority:l.authority,requestAzureCloudOptions:l.azureCloudOptions,requestExtraQueryParameters:l.extraQueryParameters,account:l.account});if(l.httpMethod===hc.POST)return await this.executeCodeFlowWithPost(l,n,u,s.verifier);{const d=await ge(nN,G.GetAuthCodeUrl,this.logger,this.performanceClient,i)(this.config,u.authority,l,this.logger,this.performanceClient),f=this.initiateAuthRequest(d,n);this.eventHandler.emitEvent(Ve.POPUP_OPENED,pt.Popup,{popupWindow:f},null);const h=await this.monitorPopupForHash(f,n.popupWindowParent),p=Bi(zh,G.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(h,this.config.auth.OIDCOptions.serverResponseType,this.logger);return await ge($y,G.HandleResponseCode,this.logger,this.performanceClient,i)(e,p,s.verifier,hn.acquireTokenPopup,this.config,u,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}}catch(u){throw(c=n.popup)==null||c.close(),u instanceof pn&&(u.setCorrelationId(this.correlationId),o.cacheFailedRequest(u)),u}}async executeEarFlow(e,n){const r=e.correlationId,i=await ge(this.getDiscoveredAuthority.bind(this),G.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,r)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),o=await ge(qE,G.GenerateEarKey,this.logger,this.performanceClient,r)(),s={...e,earJwk:o},l=n.popup||this.openPopup("about:blank",n);(await rN(l.document,this.config,i,s,this.logger,this.performanceClient)).submit();const u=await ge(this.monitorPopupForHash.bind(this),G.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(l,n.popupWindowParent),d=Bi(zh,G.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(u,this.config.auth.OIDCOptions.serverResponseType,this.logger);return ge(oN,G.HandleResponseEar,this.logger,this.performanceClient,r)(s,d,hn.acquireTokenPopup,this.config,i,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async executeCodeFlowWithPost(e,n,r,i){const o=e.correlationId,s=await ge(this.getDiscoveredAuthority.bind(this),G.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,o)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),l=n.popup||this.openPopup("about:blank",n);(await iN(l.document,this.config,s,e,this.logger,this.performanceClient)).submit();const u=await ge(this.monitorPopupForHash.bind(this),G.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,o)(l,n.popupWindowParent),d=Bi(zh,G.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(u,this.config.auth.OIDCOptions.serverResponseType,this.logger);return ge($y,G.HandleResponseCode,this.logger,this.performanceClient,o)(e,d,i,hn.acquireTokenPopup,this.config,r,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async logoutPopupAsync(e,n,r,i){var s,l,c;this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(Ve.LOGOUT_START,pt.Popup,e);const o=this.initializeServerTelemetryManager(hn.logoutPopup);try{await this.clearCacheOnLogout(this.correlationId,e.account);const u=await ge(this.createAuthCodeClient.bind(this),G.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:o,requestAuthority:r,account:e.account||void 0});try{u.authority.endSessionEndpoint}catch{if((s=e.account)!=null&&s.homeAccountId&&e.postLogoutRedirectUri&&u.authority.protocolMode===Ai.OIDC){if(this.eventHandler.emitEvent(Ve.LOGOUT_SUCCESS,pt.Popup,e),i){const h={apiId:hn.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},p=Kt.getAbsoluteUrl(i,ta());await this.navigationClient.navigateInternal(p,h)}(l=n.popup)==null||l.close();return}}const d=u.getLogoutUri(e);this.eventHandler.emitEvent(Ve.LOGOUT_SUCCESS,pt.Popup,e);const f=this.openPopup(d,n);if(this.eventHandler.emitEvent(Ve.POPUP_OPENED,pt.Popup,{popupWindow:f},null),await this.monitorPopupForHash(f,n.popupWindowParent).catch(()=>{}),i){const h={apiId:hn.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},p=Kt.getAbsoluteUrl(i,ta());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${p}`),await this.navigationClient.navigateInternal(p,h)}else this.logger.verbose("No main window navigation requested")}catch(u){throw(c=n.popup)==null||c.close(),u instanceof pn&&(u.setCorrelationId(this.correlationId),o.cacheFailedRequest(u)),this.eventHandler.emitEvent(Ve.LOGOUT_FAILURE,pt.Popup,null,u),this.eventHandler.emitEvent(Ve.LOGOUT_END,pt.Popup),u}this.eventHandler.emitEvent(Ve.LOGOUT_END,pt.Popup)}initiateAuthRequest(e,n){if(e)return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,n);throw this.logger.error("Navigate url is empty"),Be(r0)}monitorPopupForHash(e,n){return new Promise((r,i)=>{this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const o=setInterval(()=>{if(e.closed){this.logger.error("PopupHandler.monitorPopupForHash - window closed"),clearInterval(o),i(Be(Tp));return}let s="";try{s=e.location.href}catch{}if(!s||s==="about:blank")return;clearInterval(o);let l="";const c=this.config.auth.OIDCOptions.serverResponseType;e&&(c===Wb.QUERY?l=e.location.search:l=e.location.hash),this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),r(l)},this.config.system.pollIntervalMilliseconds)}).finally(()=>{this.cleanPopup(e,n)})}openPopup(e,n){try{let r;if(n.popup?(r=n.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),r.location.assign(e)):typeof n.popup>"u"&&(this.logger.verbosePii(`Opening popup window to: ${e}`),r=this.openSizedPopup(e,n)),!r)throw Be(r5);return r.focus&&r.focus(),this.currentWindow=r,n.popupWindowParent.addEventListener("beforeunload",this.unloadWindow),r}catch(r){throw this.logger.error("error opening popup "+r.message),Be(n5)}}openSizedPopup(e,{popupName:n,popupWindowAttributes:r,popupWindowParent:i}){var p,g,m,v;const o=i.screenLeft?i.screenLeft:i.screenX,s=i.screenTop?i.screenTop:i.screenY,l=i.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,c=i.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let u=(p=r.popupSize)==null?void 0:p.width,d=(g=r.popupSize)==null?void 0:g.height,f=(m=r.popupPosition)==null?void 0:m.top,h=(v=r.popupPosition)==null?void 0:v.left;return(!u||u<0||u>l)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),u=gi.POPUP_WIDTH),(!d||d<0||d>c)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),d=gi.POPUP_HEIGHT),(!f||f<0||f>c)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),f=Math.max(0,c/2-gi.POPUP_HEIGHT/2+s)),(!h||h<0||h>l)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),h=Math.max(0,l/2-gi.POPUP_WIDTH/2+o)),i.open(e,n,`width=${u}, height=${d}, top=${f}, left=${h}, scrollbars=yes`)}unloadWindow(e){this.currentWindow&&this.currentWindow.close(),e.preventDefault()}cleanPopup(e,n){e.close(),n.removeEventListener("beforeunload",this.unloadWindow)}generatePopupName(e,n){return`${gi.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${e.join("-")}.${n}.${this.correlationId}`}generateLogoutPopupName(e){const n=e.account&&e.account.homeAccountId;return`${gi.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${n}.${this.correlationId}`}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function ore(){if(typeof window>"u"||typeof window.performance>"u"||typeof window.performance.getEntriesByType!="function")return;const t=window.performance.getEntriesByType("navigation"),e=t.length?t[0]:void 0;return e==null?void 0:e.type}class sre extends Af{constructor(e,n,r,i,o,s,l,c,u,d){super(e,n,r,i,o,s,l,u,d),this.nativeStorage=c}async acquireToken(e){const n=await ge(this.initializeAuthorizationRequest.bind(this),G.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,pt.Redirect);n.platformBroker=Op(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme);const r=o=>{o.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.resetRequestCache(),this.eventHandler.emitEvent(Ve.RESTORE_FROM_BFCACHE,pt.Redirect))},i=this.getRedirectStartPage(e.redirectStartPage);this.logger.verbosePii(`Redirect start page: ${i}`),this.browserStorage.setTemporaryCache(tr.ORIGIN_URI,i,!0),window.addEventListener("pageshow",r);try{this.config.auth.protocolMode===Ai.EAR?await this.executeEarFlow(n):await this.executeCodeFlow(n,e.onRedirectNavigate)}catch(o){throw o instanceof pn&&o.setCorrelationId(this.correlationId),window.removeEventListener("pageshow",r),o}}async executeCodeFlow(e,n){const r=e.correlationId,i=this.initializeServerTelemetryManager(hn.acquireTokenRedirect),o=await ge(a0,G.GeneratePkceCodes,this.logger,this.performanceClient,r)(this.performanceClient,this.logger,r),s={...e,codeChallenge:o.challenge};this.browserStorage.cacheAuthorizeRequest(s,o.verifier);try{if(s.httpMethod===hc.POST)return await this.executeCodeFlowWithPost(s);{const l=await ge(this.createAuthCodeClient.bind(this),G.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:i,requestAuthority:s.authority,requestAzureCloudOptions:s.azureCloudOptions,requestExtraQueryParameters:s.extraQueryParameters,account:s.account}),c=await ge(nN,G.GetAuthCodeUrl,this.logger,this.performanceClient,e.correlationId)(this.config,l.authority,s,this.logger,this.performanceClient);return await this.initiateAuthRequest(c,n)}}catch(l){throw l instanceof pn&&(l.setCorrelationId(this.correlationId),i.cacheFailedRequest(l)),l}}async executeEarFlow(e){const n=e.correlationId,r=await ge(this.getDiscoveredAuthority.bind(this),G.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),i=await ge(qE,G.GenerateEarKey,this.logger,this.performanceClient,n)(),o={...e,earJwk:i};return this.browserStorage.cacheAuthorizeRequest(o),(await rN(document,this.config,r,o,this.logger,this.performanceClient)).submit(),new Promise((l,c)=>{setTimeout(()=>{c(Be(Iy,"failed_to_redirect"))},this.config.system.redirectNavigationTimeout)})}async executeCodeFlowWithPost(e){const n=e.correlationId,r=await ge(this.getDiscoveredAuthority.bind(this),G.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return this.browserStorage.cacheAuthorizeRequest(e),(await iN(document,this.config,r,e,this.logger,this.performanceClient)).submit(),new Promise((o,s)=>{setTimeout(()=>{s(Be(Iy,"failed_to_redirect"))},this.config.system.redirectNavigationTimeout)})}async handleRedirectPromise(e="",n,r,i){const o=this.initializeServerTelemetryManager(hn.handleRedirectPromise);try{const[s,l]=this.getRedirectResponse(e||"");if(!s)return this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache."),this.browserStorage.resetRequestCache(),ore()!=="back_forward"?i.event.errorCode="no_server_response":this.logger.verbose("Back navigation event detected. Muting no_server_response error"),null;const c=this.browserStorage.getTemporaryCache(tr.ORIGIN_URI,!0)||ve.EMPTY_STRING,u=Kt.removeHashFromUrl(c),d=Kt.removeHashFromUrl(window.location.href);if(u===d&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),c.indexOf("#")>-1&&lne(c),await this.handleResponse(s,n,r,o);if(this.config.auth.navigateToLoginRequestUrl){if(!QE()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache(tr.URL_HASH,l,!0);const f={apiId:hn.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let h=!0;if(!c||c==="null"){const p=une();this.browserStorage.setTemporaryCache(tr.ORIGIN_URI,p,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),h=await this.navigationClient.navigateInternal(p,f)}else this.logger.verbose(`Navigating to loginRequestUrl: ${c}`),h=await this.navigationClient.navigateInternal(c,f);if(!h)return await this.handleResponse(s,n,r,o)}}else return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response"),await this.handleResponse(s,n,r,o);return null}catch(s){throw s instanceof pn&&(s.setCorrelationId(this.correlationId),o.cacheFailedRequest(s)),s}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let n=e;n||(this.config.auth.OIDCOptions.serverResponseType===Wb.QUERY?n=window.location.search:n=window.location.hash);let r=Sy(n);if(r){try{Hne(r,this.browserCrypto,pt.Redirect)}catch(o){return o instanceof pn&&this.logger.error(`Interaction type validation failed due to ${o.errorCode}: ${o.errorMessage}`),[null,""]}return I5(window),this.logger.verbose("Hash contains known properties, returning response hash"),[r,n]}const i=this.browserStorage.getTemporaryCache(tr.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(tr.URL_HASH)),i&&(r=Sy(i),r)?(this.logger.verbose("Hash does not contain known properties, returning cached hash"),[r,i]):[null,""]}async handleResponse(e,n,r,i){if(!e.state)throw Be(UE);if(e.ear_jwe){const l=await ge(this.getDiscoveredAuthority.bind(this),G.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n.correlationId)({requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account});return ge(oN,G.HandleResponseEar,this.logger,this.performanceClient,n.correlationId)(n,e,hn.acquireTokenRedirect,this.config,l,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}const s=await ge(this.createAuthCodeClient.bind(this),G.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:i,requestAuthority:n.authority});return ge($y,G.HandleResponseCode,this.logger,this.performanceClient,n.correlationId)(n,e,r,hn.acquireTokenRedirect,this.config,s,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async initiateAuthRequest(e,n){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),e){this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${e}`);const r={apiId:hn.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},i=n||this.config.auth.onRedirectNavigate;if(typeof i=="function")if(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),i(e)!==!1){this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),await this.navigationClient.navigateExternal(e,r);return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation");return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),await this.navigationClient.navigateExternal(e,r);return}}else throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),Be(r0)}async logout(e){var i;this.logger.verbose("logoutRedirect called");const n=this.initializeLogoutRequest(e),r=this.initializeServerTelemetryManager(hn.logout);try{this.eventHandler.emitEvent(Ve.LOGOUT_START,pt.Redirect,e),await this.clearCacheOnLogout(this.correlationId,n.account);const o={apiId:hn.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},s=await ge(this.createAuthCodeClient.bind(this),G.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:e&&e.authority,requestExtraQueryParameters:e==null?void 0:e.extraQueryParameters,account:e&&e.account||void 0});if(s.authority.protocolMode===Ai.OIDC)try{s.authority.endSessionEndpoint}catch{if((i=n.account)!=null&&i.homeAccountId){this.eventHandler.emitEvent(Ve.LOGOUT_SUCCESS,pt.Redirect,n);return}}const l=s.getLogoutUri(n);if(this.eventHandler.emitEvent(Ve.LOGOUT_SUCCESS,pt.Redirect,n),e&&typeof e.onRedirectNavigate=="function")if(e.onRedirectNavigate(l)!==!1){this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0,Ga.SIGNOUT),await this.navigationClient.navigateExternal(l,o);return}else this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation");else{this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0,Ga.SIGNOUT),await this.navigationClient.navigateExternal(l,o);return}}catch(o){throw o instanceof pn&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),this.eventHandler.emitEvent(Ve.LOGOUT_FAILURE,pt.Redirect,null,o),this.eventHandler.emitEvent(Ve.LOGOUT_END,pt.Redirect),o}this.eventHandler.emitEvent(Ve.LOGOUT_END,pt.Redirect)}getRedirectStartPage(e){const n=e||window.location.href;return Kt.getAbsoluteUrl(n,ta())}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function are(t,e,n,r,i){if(e.addQueueMeasurement(G.SilentHandlerInitiateAuthRequest,r),!t)throw n.info("Navigate url is empty"),Be(r0);return i?ge(ure,G.SilentHandlerLoadFrame,n,e,r)(t,i,e,r):Bi(dre,G.SilentHandlerLoadFrameSync,n,e,r)(t)}async function lre(t,e,n,r,i){const o=l0();if(!o.contentDocument)throw"No document associated with iframe!";return(await iN(o.contentDocument,t,e,n,r,i)).submit(),o}async function cre(t,e,n,r,i){const o=l0();if(!o.contentDocument)throw"No document associated with iframe!";return(await rN(o.contentDocument,t,e,n,r,i)).submit(),o}async function nI(t,e,n,r,i,o,s){return r.addQueueMeasurement(G.SilentHandlerMonitorIframeForHash,o),new Promise((l,c)=>{e{window.clearInterval(d),c(Be(i5))},e),d=window.setInterval(()=>{let f="";const h=t.contentWindow;try{f=h?h.location.href:""}catch{}if(!f||f==="about:blank")return;let p="";h&&(s===Wb.QUERY?p=h.location.search:p=h.location.hash),window.clearTimeout(u),window.clearInterval(d),l(p)},n)}).finally(()=>{Bi(fre,G.RemoveHiddenIframe,i,r,o)(t)})}function ure(t,e,n,r){return n.addQueueMeasurement(G.SilentHandlerLoadFrame,r),new Promise((i,o)=>{const s=l0();window.setTimeout(()=>{if(!s){o("Unable to load iframe");return}s.src=t,i(s)},e)})}function dre(t){const e=l0();return e.src=t,e}function l0(){const t=document.createElement("iframe");return t.className="msalSilentIframe",t.style.visibility="hidden",t.style.position="absolute",t.style.width=t.style.height="0",t.style.border="0",t.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.body.appendChild(t),t}function fre(t){document.body===t.parentNode&&document.body.removeChild(t)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class hre extends Af{constructor(e,n,r,i,o,s,l,c,u,d,f){super(e,n,r,i,o,s,c,d,f),this.apiId=l,this.nativeStorage=u}async acquireToken(e){this.performanceClient.addQueueMeasurement(G.SilentIframeClientAcquireToken,e.correlationId),!e.loginHint&&!e.sid&&(!e.account||!e.account.username)&&this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");const n={...e};n.prompt?n.prompt!==ri.NONE&&n.prompt!==ri.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${n.prompt} with ${ri.NONE}`),n.prompt=ri.NONE):n.prompt=ri.NONE;const r=await ge(this.initializeAuthorizationRequest.bind(this),G.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(n,pt.Silent);return r.platformBroker=Op(this.config,this.logger,this.platformAuthProvider,r.authenticationScheme),D5(r.authority),this.config.auth.protocolMode===Ai.EAR?this.executeEarFlow(r):this.executeCodeFlow(r)}async executeCodeFlow(e){let n;const r=this.initializeServerTelemetryManager(this.apiId);try{return n=await ge(this.createAuthCodeClient.bind(this),G.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),await ge(this.silentTokenHelper.bind(this),G.SilentIframeClientTokenHelper,this.logger,this.performanceClient,e.correlationId)(n,e)}catch(i){if(i instanceof pn&&(i.setCorrelationId(this.correlationId),r.cacheFailedRequest(i)),!n||!(i instanceof pn)||i.errorCode!==gi.INVALID_GRANT_ERROR)throw i;return this.performanceClient.addFields({retryError:i.errorCode},this.correlationId),await ge(this.silentTokenHelper.bind(this),G.SilentIframeClientTokenHelper,this.logger,this.performanceClient,this.correlationId)(n,e)}}async executeEarFlow(e){const n=e.correlationId,r=await ge(this.getDiscoveredAuthority.bind(this),G.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),i=await ge(qE,G.GenerateEarKey,this.logger,this.performanceClient,n)(),o={...e,earJwk:i},s=await ge(cre,G.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,n)(this.config,r,o,this.logger,this.performanceClient),l=this.config.auth.OIDCOptions.serverResponseType,c=await ge(nI,G.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,n)(s,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,n,l),u=Bi(zh,G.DeserializeResponse,this.logger,this.performanceClient,n)(c,l,this.logger);return ge(oN,G.HandleResponseEar,this.logger,this.performanceClient,n)(o,u,this.apiId,this.config,r,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}logout(){return Promise.reject(Be(i0))}async silentTokenHelper(e,n){const r=n.correlationId;this.performanceClient.addQueueMeasurement(G.SilentIframeClientTokenHelper,r);const i=await ge(a0,G.GeneratePkceCodes,this.logger,this.performanceClient,r)(this.performanceClient,this.logger,r),o={...n,codeChallenge:i.challenge};let s;if(n.httpMethod===hc.POST)s=await ge(lre,G.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(this.config,e.authority,o,this.logger,this.performanceClient);else{const d=await ge(nN,G.GetAuthCodeUrl,this.logger,this.performanceClient,r)(this.config,e.authority,o,this.logger,this.performanceClient);s=await ge(are,G.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(d,this.performanceClient,this.logger,r,this.config.system.navigateFrameWait)}const l=this.config.auth.OIDCOptions.serverResponseType,c=await ge(nI,G.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(s,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,r,l),u=Bi(zh,G.DeserializeResponse,this.logger,this.performanceClient,r)(c,l,this.logger);return ge($y,G.HandleResponseCode,this.logger,this.performanceClient,r)(n,u,i.verifier,this.apiId,this.config,e,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class pre extends Af{async acquireToken(e){this.performanceClient.addQueueMeasurement(G.SilentRefreshClientAcquireToken,e.correlationId);const n=await ge(eN,G.InitializeBaseRequest,this.logger,this.performanceClient,e.correlationId)(e,this.config,this.performanceClient,this.logger),r={...e,...n};e.redirectUri&&(r.redirectUri=this.getRedirectUri(e.redirectUri));const i=this.initializeServerTelemetryManager(hn.acquireTokenSilent_silentFlow),o=await this.createRefreshTokenClient({serverTelemetryManager:i,authorityUrl:r.authority,azureCloudOptions:r.azureCloudOptions,account:r.account});return ge(o.acquireTokenByRefreshToken.bind(o),G.RefreshTokenClientAcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(r).catch(s=>{throw s.setCorrelationId(this.correlationId),i.cacheFailedRequest(s),s})}logout(){return Promise.reject(Be(i0))}async createRefreshTokenClient(e){const n=await ge(this.getClientConfiguration.bind(this),G.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new Nte(n,this.performanceClient)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class mre{constructor(e,n,r,i){this.isBrowserEnvironment=typeof window<"u",this.config=e,this.storage=n,this.logger=r,this.cryptoObj=i}async loadExternalTokens(e,n,r){if(!this.isBrowserEnvironment)throw Be(o0);const i=e.correlationId||Yo(),o=n.id_token?wf(n.id_token,Lo):void 0,s={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},l=e.authority?new Hr(Hr.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,s,this.logger,e.correlationId||Yo()):void 0,c=await this.loadAccount(e,r.clientInfo||n.client_info||"",i,o,l),u=await this.loadIdToken(n,c.homeAccountId,c.environment,c.realm,i),d=await this.loadAccessToken(e,n,c.homeAccountId,c.environment,c.realm,r,i),f=await this.loadRefreshToken(n,c.homeAccountId,c.environment,i);return this.generateAuthenticationResult(e,{account:c,idToken:u,accessToken:d,refreshToken:f},o,l)}async loadAccount(e,n,r,i,o){if(this.logger.verbose("TokenCache - loading account"),e.account){const u=Wo.createFromAccountInfo(e.account);return await this.storage.setAccount(u,r),u}else if(!o||!n&&!i)throw this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead."),Be(h5);const s=Wo.generateHomeAccountId(n,o.authorityType,this.logger,this.cryptoObj,i),l=i==null?void 0:i.tid,c=RE(this.storage,o,s,Lo,r,i,n,o.hostnameAndPort,l,void 0,void 0,this.logger);return await this.storage.setAccount(c,r),c}async loadIdToken(e,n,r,i,o){if(!e.id_token)return this.logger.verbose("TokenCache - no id token found in response"),null;this.logger.verbose("TokenCache - loading id token");const s=Jb(n,r,e.id_token,this.config.auth.clientId,i);return await this.storage.setIdTokenCredential(s,o),s}async loadAccessToken(e,n,r,i,o,s,l){if(n.access_token)if(n.expires_in){if(!n.scope&&(!e.scopes||!e.scopes.length))return this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache."),null}else return this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache."),null;else return this.logger.verbose("TokenCache - no access token found in response"),null;this.logger.verbose("TokenCache - loading access token");const c=n.scope?hr.fromString(n.scope):new hr(e.scopes),u=s.expiresOn||n.expires_in+_i(),d=s.extendedExpiresOn||(n.ext_expires_in||n.expires_in)+_i(),f=Zb(r,i,n.access_token,this.config.auth.clientId,o,c.printScopes(),u,d,Lo);return await this.storage.setAccessTokenCredential(f,l),f}async loadRefreshToken(e,n,r,i){if(!e.refresh_token)return this.logger.verbose("TokenCache - no refresh token found in response"),null;this.logger.verbose("TokenCache - loading refresh token");const o=L3(n,r,e.refresh_token,this.config.auth.clientId,e.foci,void 0,e.refresh_token_expires_in);return await this.storage.setRefreshTokenCredential(o,i),o}generateAuthenticationResult(e,n,r,i){var d,f,h;let o="",s=[],l=null,c;n!=null&&n.accessToken&&(o=n.accessToken.secret,s=hr.fromString(n.accessToken.target).asArray(),l=id(n.accessToken.expiresOn),c=id(n.accessToken.extendedExpiresOn));const u=n.account;return{authority:i?i.canonicalAuthority:"",uniqueId:n.account.localAccountId,tenantId:n.account.realm,scopes:s,account:u.getAccountInfo(),idToken:((d=n.idToken)==null?void 0:d.secret)||"",idTokenClaims:r||{},accessToken:o,fromCache:!0,expiresOn:l,correlationId:e.correlationId||"",requestId:"",extExpiresOn:c,familyId:((f=n.refreshToken)==null?void 0:f.familyId)||"",tokenType:((h=n==null?void 0:n.accessToken)==null?void 0:h.tokenType)||"",state:e.state||"",cloudGraphHostName:u.cloudGraphHostName||"",msGraphHost:u.msGraphHost||"",fromNativeBroker:!1}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class gre extends G3{constructor(e){super(e),this.includeRedirectUri=!1}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class vre extends Af{constructor(e,n,r,i,o,s,l,c,u,d){super(e,n,r,i,o,s,c,u,d),this.apiId=l}async acquireToken(e){if(!e.code)throw Be(p5);const n=await ge(this.initializeAuthorizationRequest.bind(this),G.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(e,pt.Silent),r=this.initializeServerTelemetryManager(this.apiId);try{const i={...n,code:e.code},o=await ge(this.getClientConfiguration.bind(this),G.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account}),s=new gre(o);this.logger.verbose("Auth code client created");const l=new B5(s,this.browserStorage,i,this.logger,this.performanceClient);return await ge(l.handleCodeResponseFromServer.bind(l),G.HandleCodeResponseFromServer,this.logger,this.performanceClient,e.correlationId)({code:e.code,msgraph_host:e.msGraphHost,cloud_graph_host_name:e.cloudGraphHostName,cloud_instance_host_name:e.cloudInstanceHostName},n,!1)}catch(i){throw i instanceof pn&&(i.setCorrelationId(this.correlationId),r.cacheFailedRequest(i)),i}}logout(){return Promise.reject(Be(i0))}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function yre(t,e,n){var s;const r=((s=window.msal)==null?void 0:s.clientIds)||[],i=r.length,o=r.filter(l=>l===t).length;o>1&&n.warning("There is already an instance of MSAL.js in the window with the same client id."),e.add({msalInstanceCount:i,sameClientIdInstanceCount:o})}/*! @azure/msal-browser v4.19.0 2025-08-05 */function is(t){const e=t==null?void 0:t.idTokenClaims;if(e!=null&&e.tfp||e!=null&&e.acr)return"B2C";if(e!=null&&e.tid){if((e==null?void 0:e.tid)==="9188040d-6c67-4c5b-b112-36a304b66dad")return"MSA"}else return;return"AAD"}function Gg(t,e){try{XE(t)}catch(n){throw e.end({success:!1},n),n}}class c0{constructor(e){this.operatingContext=e,this.isBrowserEnvironment=this.operatingContext.isBrowserEnvironment(),this.config=e.getConfig(),this.initialized=!1,this.logger=this.operatingContext.getLogger(),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.config.telemetry.client,this.browserCrypto=this.isBrowserEnvironment?new xa(this.logger,this.performanceClient):wy,this.eventHandler=new Fne(this.logger),this.browserStorage=this.isBrowserEnvironment?new k1(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,this.performanceClient,this.eventHandler,xte(this.config.auth)):Pne(this.config.auth.clientId,this.logger,this.performanceClient,this.eventHandler);const n={cacheLocation:pr.MemoryStorage,cacheRetentionDays:5,temporaryCacheLocation:pr.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new k1(this.config.auth.clientId,n,this.browserCrypto,this.logger,this.performanceClient,this.eventHandler),this.tokenCache=new mre(this.config,this.browserStorage,this.logger,this.browserCrypto),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this)}static async createController(e,n){const r=new c0(e);return await r.initialize(n),r}trackPageVisibility(e){e&&(this.logger.info("Perf: Visibility change detected"),this.performanceClient.incrementFields({visibilityChangeCount:1},e))}async initialize(e,n){if(this.logger.trace("initialize called"),this.initialized){this.logger.info("initialize has already been called, exiting early.");return}if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, exiting early."),this.initialized=!0,this.eventHandler.emitEvent(Ve.INITIALIZE_END);return}const r=(e==null?void 0:e.correlationId)||this.getRequestCorrelationId(),i=this.config.system.allowPlatformBroker,o=this.performanceClient.startMeasurement(G.InitializeClientApplication,r);if(this.eventHandler.emitEvent(Ve.INITIALIZE_START),!n)try{this.logMultipleInstances(o)}catch{}if(await ge(this.browserStorage.initialize.bind(this.browserStorage),G.InitializeCache,this.logger,this.performanceClient,r)(r),i)try{this.platformAuthProvider=await nre(this.logger,this.performanceClient,r,this.config.system.nativeBrokerHandshakeTimeout)}catch(s){this.logger.verbose(s)}this.config.cache.claimsBasedCachingEnabled||(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),Bi(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),G.ClearTokensAndKeysWithClaims,this.logger,this.performanceClient,r)(r)),this.config.system.asyncPopups&&await this.preGeneratePkceCodes(r),this.initialized=!0,this.eventHandler.emitEvent(Ve.INITIALIZE_END),o.end({allowPlatformBroker:i,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),M5(this.initialized),this.isBrowserEnvironment){const n=e||"";let r=this.redirectResponse.get(n);return typeof r>"u"?(r=this.handleRedirectPromiseInternal(e),this.redirectResponse.set(n,r),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise")):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),r}return this.logger.verbose("handleRedirectPromise returns null, not browser environment"),null}async handleRedirectPromiseInternal(e){var c;if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;if(((c=this.browserStorage.getInteractionInProgress())==null?void 0:c.type)===Ga.SIGNOUT)return this.logger.verbose("handleRedirectPromise removing interaction_in_progress flag and returning null after sign-out"),this.browserStorage.setInteractionInProgress(!1),Promise.resolve(null);const r=this.getAllAccounts(),i=this.browserStorage.getCachedNativeRequest(),o=i&&this.platformAuthProvider&&!e;let s;this.eventHandler.emitEvent(Ve.HANDLE_REDIRECT_START,pt.Redirect);let l;try{if(o&&this.platformAuthProvider){s=this.performanceClient.startMeasurement(G.AcquireTokenRedirect,(i==null?void 0:i.correlationId)||""),this.logger.trace("handleRedirectPromise - acquiring token from native platform");const u=new kv(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,hn.handleRedirectPromise,this.performanceClient,this.platformAuthProvider,i.accountId,this.nativeInternalStorage,i.correlationId);l=ge(u.handleRedirectPromise.bind(u),G.HandleNativeRedirectPromiseMeasurement,this.logger,this.performanceClient,s.event.correlationId)(this.performanceClient,s.event.correlationId)}else{const[u,d]=this.browserStorage.getCachedRequest(),f=u.correlationId;s=this.performanceClient.startMeasurement(G.AcquireTokenRedirect,f),this.logger.trace("handleRedirectPromise - acquiring token from web flow");const h=this.createRedirectClient(f);l=ge(h.handleRedirectPromise.bind(h),G.HandleRedirectPromiseMeasurement,this.logger,this.performanceClient,s.event.correlationId)(e,u,d,s)}}catch(u){throw this.browserStorage.resetRequestCache(),u}return l.then(u=>(u?(this.browserStorage.resetRequestCache(),r.length{this.browserStorage.resetRequestCache();const d=u;throw r.length>0?this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_FAILURE,pt.Redirect,null,d):this.eventHandler.emitEvent(Ve.LOGIN_FAILURE,pt.Redirect,null,d),this.eventHandler.emitEvent(Ve.HANDLE_REDIRECT_END,pt.Redirect),s.end({success:!1},d),u})}async acquireTokenRedirect(e){const n=this.getRequestCorrelationId(e);this.logger.verbose("acquireTokenRedirect called",n);const r=this.performanceClient.startMeasurement(G.AcquireTokenPreRedirect,n);r.add({accountType:is(e.account),scenarioId:e.scenarioId});const i=e.onRedirectNavigate;if(i)e.onRedirectNavigate=s=>{const l=typeof i=="function"?i(s):void 0;return l!==!1?r.end({success:!0}):r.discard(),l};else{const s=this.config.auth.onRedirectNavigate;this.config.auth.onRedirectNavigate=l=>{const c=typeof s=="function"?s(l):void 0;return c!==!1?r.end({success:!0}):r.discard(),c}}const o=this.getAllAccounts().length>0;try{KO(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0,Ga.SIGNIN),o?this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_START,pt.Redirect,e):this.eventHandler.emitEvent(Ve.LOGIN_START,pt.Redirect,e);let s;return this.platformAuthProvider&&this.canUsePlatformBroker(e)?s=new kv(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,hn.acquireTokenRedirect,this.performanceClient,this.platformAuthProvider,this.getNativeAccountId(e),this.nativeInternalStorage,n).acquireTokenRedirect(e,r).catch(c=>{if(c instanceof ps&&Nu(c))return this.platformAuthProvider=void 0,this.createRedirectClient(n).acquireToken(e);if(c instanceof qo)return this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createRedirectClient(n).acquireToken(e);throw c}):s=this.createRedirectClient(n).acquireToken(e),await s}catch(s){throw this.browserStorage.resetRequestCache(),r.end({success:!1},s),o?this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_FAILURE,pt.Redirect,null,s):this.eventHandler.emitEvent(Ve.LOGIN_FAILURE,pt.Redirect,null,s),s}}acquireTokenPopup(e){const n=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(G.AcquireTokenPopup,n);r.add({scenarioId:e.scenarioId,accountType:is(e.account)});try{this.logger.verbose("acquireTokenPopup called",n),Gg(this.initialized,r),this.browserStorage.setInteractionInProgress(!0,Ga.SIGNIN)}catch(l){return Promise.reject(l)}const i=this.getAllAccounts();i.length>0?this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_START,pt.Popup,e):this.eventHandler.emitEvent(Ve.LOGIN_START,pt.Popup,e);let o;const s=this.getPreGeneratedPkceCodes(n);return this.canUsePlatformBroker(e)?o=this.acquireTokenNative({...e,correlationId:n},hn.acquireTokenPopup).then(l=>(r.end({success:!0,isNativeBroker:!0,accountType:is(l.account)}),l)).catch(l=>{if(l instanceof ps&&Nu(l))return this.platformAuthProvider=void 0,this.createPopupClient(n).acquireToken(e,s);if(l instanceof qo)return this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createPopupClient(n).acquireToken(e,s);throw l}):o=this.createPopupClient(n).acquireToken(e,s),o.then(l=>(i.length(i.length>0?this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_FAILURE,pt.Popup,null,l):this.eventHandler.emitEvent(Ve.LOGIN_FAILURE,pt.Popup,null,l),r.end({success:!1},l),Promise.reject(l))).finally(async()=>{this.browserStorage.setInteractionInProgress(!1),this.config.system.asyncPopups&&await this.preGeneratePkceCodes(n)})}trackPageVisibilityWithMeasurement(){const e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))}async ssoSilent(e){var o,s;const n=this.getRequestCorrelationId(e),r={...e,prompt:e.prompt,correlationId:n};this.ssoSilentMeasurement=this.performanceClient.startMeasurement(G.SsoSilent,n),(o=this.ssoSilentMeasurement)==null||o.add({scenarioId:e.scenarioId,accountType:is(e.account)}),Gg(this.initialized,this.ssoSilentMeasurement),(s=this.ssoSilentMeasurement)==null||s.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",n),this.eventHandler.emitEvent(Ve.SSO_SILENT_START,pt.Silent,r);let i;return this.canUsePlatformBroker(r)?i=this.acquireTokenNative(r,hn.ssoSilent).catch(l=>{if(l instanceof ps&&Nu(l))return this.platformAuthProvider=void 0,this.createSilentIframeClient(r.correlationId).acquireToken(r);throw l}):i=this.createSilentIframeClient(r.correlationId).acquireToken(r),i.then(l=>{var c;return this.eventHandler.emitEvent(Ve.SSO_SILENT_SUCCESS,pt.Silent,l),(c=this.ssoSilentMeasurement)==null||c.end({success:!0,isNativeBroker:l.fromNativeBroker,accessTokenSize:l.accessToken.length,idTokenSize:l.idToken.length,accountType:is(l.account)}),l}).catch(l=>{var c;throw this.eventHandler.emitEvent(Ve.SSO_SILENT_FAILURE,pt.Silent,null,l),(c=this.ssoSilentMeasurement)==null||c.end({success:!1},l),l}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenByCode(e){const n=this.getRequestCorrelationId(e);this.logger.trace("acquireTokenByCode called",n);const r=this.performanceClient.startMeasurement(G.AcquireTokenByCode,n);Gg(this.initialized,r),this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_BY_CODE_START,pt.Silent,e),r.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw Be(g5);if(e.code){const i=e.code;let o=this.hybridAuthCodeResponses.get(i);return o?(this.logger.verbose("Existing acquireTokenByCode request found",n),r.discard()):(this.logger.verbose("Initiating new acquireTokenByCode request",n),o=this.acquireTokenByCodeAsync({...e,correlationId:n}).then(s=>(this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_BY_CODE_SUCCESS,pt.Silent,s),this.hybridAuthCodeResponses.delete(i),r.end({success:!0,isNativeBroker:s.fromNativeBroker,accessTokenSize:s.accessToken.length,idTokenSize:s.idToken.length,accountType:is(s.account)}),s)).catch(s=>{throw this.hybridAuthCodeResponses.delete(i),this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_BY_CODE_FAILURE,pt.Silent,null,s),r.end({success:!1},s),s}),this.hybridAuthCodeResponses.set(i,o)),await o}else if(e.nativeAccountId)if(this.canUsePlatformBroker(e,e.nativeAccountId)){const i=await this.acquireTokenNative({...e,correlationId:n},hn.acquireTokenByCode,e.nativeAccountId).catch(o=>{throw o instanceof ps&&Nu(o)&&(this.platformAuthProvider=void 0),o});return r.end({accountType:is(i.account),success:!0}),i}else throw Be(v5);else throw Be(m5)}catch(i){throw this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_BY_CODE_FAILURE,pt.Silent,null,i),r.end({success:!1},i),i}}async acquireTokenByCodeAsync(e){var i;return this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(G.AcquireTokenByCodeAsync,e.correlationId),(i=this.acquireTokenByCodeAsyncMeasurement)==null||i.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),await this.createSilentAuthCodeClient(e.correlationId).acquireToken(e).then(o=>{var s;return(s=this.acquireTokenByCodeAsyncMeasurement)==null||s.end({success:!0,fromCache:o.fromCache,isNativeBroker:o.fromNativeBroker}),o}).catch(o=>{var s;throw(s=this.acquireTokenByCodeAsyncMeasurement)==null||s.end({success:!1},o),o}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenFromCache(e,n){switch(this.performanceClient.addQueueMeasurement(G.AcquireTokenFromCache,e.correlationId),n){case Xr.Default:case Xr.AccessToken:case Xr.AccessTokenAndRefreshToken:const r=this.createSilentCacheClient(e.correlationId);return ge(r.acquireToken.bind(r),G.SilentCacheClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Ae(gl)}}async acquireTokenByRefreshToken(e,n){switch(this.performanceClient.addQueueMeasurement(G.AcquireTokenByRefreshToken,e.correlationId),n){case Xr.Default:case Xr.AccessTokenAndRefreshToken:case Xr.RefreshToken:case Xr.RefreshTokenAndNetwork:const r=this.createSilentRefreshClient(e.correlationId);return ge(r.acquireToken.bind(r),G.SilentRefreshClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Ae(gl)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(G.AcquireTokenBySilentIframe,e.correlationId);const n=this.createSilentIframeClient(e.correlationId);return ge(n.acquireToken.bind(n),G.SilentIframeClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e)}async logout(e){const n=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",n),this.logoutRedirect({correlationId:n,...e})}async logoutRedirect(e){const n=this.getRequestCorrelationId(e);return KO(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0,Ga.SIGNOUT),this.createRedirectClient(n).logout(e)}logoutPopup(e){try{const n=this.getRequestCorrelationId(e);return XE(this.initialized),this.browserStorage.setInteractionInProgress(!0,Ga.SIGNOUT),this.createPopupClient(n).logout(e).finally(()=>{this.browserStorage.setInteractionInProgress(!1)})}catch(n){return Promise.reject(n)}}async clearCache(e){if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, returning early.");return}const n=this.getRequestCorrelationId(e);return this.createSilentCacheClient(n).logout(e)}getAllAccounts(e){const n=this.getRequestCorrelationId();return kne(this.logger,this.browserStorage,this.isBrowserEnvironment,n,e)}getAccount(e){const n=this.getRequestCorrelationId();return One(e,this.logger,this.browserStorage,n)}getAccountByUsername(e){const n=this.getRequestCorrelationId();return Ine(e,this.logger,this.browserStorage,n)}getAccountByHomeId(e){const n=this.getRequestCorrelationId();return Rne(e,this.logger,this.browserStorage,n)}getAccountByLocalId(e){const n=this.getRequestCorrelationId();return Mne(e,this.logger,this.browserStorage,n)}setActiveAccount(e){const n=this.getRequestCorrelationId();Dne(e,this.browserStorage,n)}getActiveAccount(){const e=this.getRequestCorrelationId();return $ne(this.browserStorage,e)}async hydrateCache(e,n){this.logger.verbose("hydrateCache called");const r=Wo.createFromAccountInfo(e.account,e.cloudGraphHostName,e.msGraphHost);return await this.browserStorage.setAccount(r,e.correlationId),e.fromNativeBroker?(this.logger.verbose("Response was from native broker, storing in-memory"),this.nativeInternalStorage.hydrateCache(e,n)):this.browserStorage.hydrateCache(e,n)}async acquireTokenNative(e,n,r,i){if(this.logger.trace("acquireTokenNative called"),!this.platformAuthProvider)throw Be(zE);return new kv(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,n,this.performanceClient,this.platformAuthProvider,r||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e,i)}canUsePlatformBroker(e,n){if(this.logger.trace("canUsePlatformBroker called"),!this.platformAuthProvider)return this.logger.trace("canUsePlatformBroker: platform broker unavilable, returning false"),!1;if(!Op(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme))return this.logger.trace("canUsePlatformBroker: isBrokerAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case ri.NONE:case ri.CONSENT:case ri.LOGIN:this.logger.trace("canUsePlatformBroker: prompt is compatible with platform broker flow");break;default:return this.logger.trace(`canUsePlatformBroker: prompt = ${e.prompt} is not compatible with platform broker flow, returning false`),!1}return!n&&!this.getNativeAccountId(e)?(this.logger.trace("canUsePlatformBroker: nativeAccountId is not available, returning false"),!1):!0}getNativeAccountId(e){const n=e.account||this.getAccount({loginHint:e.loginHint,sid:e.sid})||this.getActiveAccount();return n&&n.nativeAccountId||""}createPopupClient(e){return new ire(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createRedirectClient(e){return new sre(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createSilentIframeClient(e){return new hre(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,hn.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createSilentCacheClient(e){return new z5(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.platformAuthProvider,e)}createSilentRefreshClient(e){return new pre(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.platformAuthProvider,e)}createSilentAuthCodeClient(e){return new vre(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,hn.acquireTokenByCode,this.performanceClient,this.platformAuthProvider,e)}addEventCallback(e,n){return this.eventHandler.addEventCallback(e,n)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return R5(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){if(this.config.cache.cacheLocation!==pr.LocalStorage){this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");return}this.eventHandler.subscribeCrossTab()}disableAccountStorageEvents(){if(this.config.cache.cacheLocation!==pr.LocalStorage){this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");return}this.eventHandler.unsubscribeCrossTab()}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,n){this.browserStorage.setWrapperMetadata(e,n)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}isBrowserEnv(){return this.isBrowserEnvironment}getRequestCorrelationId(e){return e!=null&&e.correlationId?e.correlationId:this.isBrowserEnvironment?Yo():ve.EMPTY_STRING}async loginRedirect(e){const n=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",n),this.acquireTokenRedirect({correlationId:n,...e||BO})}loginPopup(e){const n=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",n),this.acquireTokenPopup({correlationId:n,...e||BO})}async acquireTokenSilent(e){const n=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(G.AcquireTokenSilent,n);r.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),Gg(this.initialized,r),this.logger.verbose("acquireTokenSilent called",n);const i=e.account||this.getActiveAccount();if(!i)throw Be(l5);return r.add({accountType:is(i)}),this.acquireTokenSilentDeduped(e,i,n).then(o=>(r.end({success:!0,fromCache:o.fromCache,isNativeBroker:o.fromNativeBroker,accessTokenSize:o.accessToken.length,idTokenSize:o.idToken.length}),{...o,state:e.state,correlationId:n})).catch(o=>{throw o instanceof pn&&o.setCorrelationId(n),r.end({success:!1},o),o})}async acquireTokenSilentDeduped(e,n,r){const i=e0(this.config.auth.clientId,{...e,authority:e.authority||this.config.auth.authority,correlationId:r},n.homeAccountId),o=JSON.stringify(i),s=this.activeSilentTokenRequests.get(o);if(typeof s>"u"){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",r),this.performanceClient.addFields({deduped:!1},r);const l=ge(this.acquireTokenSilentAsync.bind(this),G.AcquireTokenSilentAsync,this.logger,this.performanceClient,r)({...e,correlationId:r},n);return this.activeSilentTokenRequests.set(o,l),l.finally(()=>{this.activeSilentTokenRequests.delete(o)})}else return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",r),this.performanceClient.addFields({deduped:!0},r),s}async acquireTokenSilentAsync(e,n){const r=()=>this.trackPageVisibility(e.correlationId);this.performanceClient.addQueueMeasurement(G.AcquireTokenSilentAsync,e.correlationId),this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_START,pt.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",r);const i=await ge(Une,G.InitializeSilentRequest,this.logger,this.performanceClient,e.correlationId)(e,n,this.config,this.performanceClient,this.logger),o=e.cacheLookupPolicy||Xr.Default;return this.acquireTokenSilentNoIframe(i,o).catch(async l=>{if(xre(l,o))if(this.activeIframeRequest)if(o!==Xr.Skip){const[u,d]=this.activeIframeRequest;this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${d}`,i.correlationId);const f=this.performanceClient.startMeasurement(G.AwaitConcurrentIframe,i.correlationId);f.add({awaitIframeCorrelationId:d});const h=await u;if(f.end({success:h}),h)return this.logger.verbose(`Parallel iframe request with correlationId: ${d} succeeded. Retrying cache and/or RT redemption`,i.correlationId),this.acquireTokenSilentNoIframe(i,o);throw this.logger.info(`Iframe request with correlationId: ${d} failed. Interaction is required.`),l}else return this.logger.warning("Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.",i.correlationId),ge(this.acquireTokenBySilentIframe.bind(this),G.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i);else{let u;return this.activeIframeRequest=[new Promise(d=>{u=d}),i.correlationId],this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",i.correlationId),ge(this.acquireTokenBySilentIframe.bind(this),G.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i).then(d=>(u(!0),d)).catch(d=>{throw u(!1),d}).finally(()=>{this.activeIframeRequest=void 0})}else throw l}).then(l=>(this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_SUCCESS,pt.Silent,l),e.correlationId&&this.performanceClient.addFields({fromCache:l.fromCache,isNativeBroker:l.fromNativeBroker},e.correlationId),l)).catch(l=>{throw this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_FAILURE,pt.Silent,null,l),l}).finally(()=>{document.removeEventListener("visibilitychange",r)})}async acquireTokenSilentNoIframe(e,n){return Op(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme)&&e.account.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),this.acquireTokenNative(e,hn.acquireTokenSilent_silentFlow,e.account.nativeAccountId,n).catch(async r=>{throw r instanceof ps&&Nu(r)?(this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.platformAuthProvider=void 0,Ae(gl)):r})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),n===Xr.AccessToken&&this.logger.verbose("acquireTokenSilent - cache lookup policy set to AccessToken, attempting to acquire token from local cache"),ge(this.acquireTokenFromCache.bind(this),G.AcquireTokenFromCache,this.logger,this.performanceClient,e.correlationId)(e,n).catch(r=>{if(n===Xr.AccessToken)throw r;return this.eventHandler.emitEvent(Ve.ACQUIRE_TOKEN_NETWORK_START,pt.Silent,e),ge(this.acquireTokenByRefreshToken.bind(this),G.AcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,n)}))}async preGeneratePkceCodes(e){return this.logger.verbose("Generating new PKCE codes"),this.pkceCode=await ge(a0,G.GeneratePkceCodes,this.logger,this.performanceClient,e)(this.performanceClient,this.logger,e),Promise.resolve()}getPreGeneratedPkceCodes(e){this.logger.verbose("Attempting to pick up pre-generated PKCE codes");const n=this.pkceCode?{...this.pkceCode}:void 0;return this.pkceCode=void 0,this.logger.verbose(`${n?"Found":"Did not find"} pre-generated PKCE codes`),this.performanceClient.addFields({usePreGeneratedPkce:!!n},e),n}logMultipleInstances(e){const n=this.config.auth.clientId;if(!window)return;window.msal=window.msal||{},window.msal.clientIds=window.msal.clientIds||[],window.msal.clientIds.length>0&&this.logger.verbose("There is already an instance of MSAL.js in the window."),window.msal.clientIds.push(n),yre(n,e,this.logger)}}function xre(t,e){const n=!(t instanceof qo&&t.subError!==n0),r=t.errorCode===gi.INVALID_GRANT_ERROR||t.errorCode===gl,i=n&&r||t.errorCode===Py||t.errorCode===OE,o=qte.includes(e);return i&&o}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function bre(t,e){const n=new Yc(t);return await n.initialize(),c0.createController(n,e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class aN{static async createPublicClientApplication(e){const n=await bre(e);return new aN(e,n)}constructor(e,n){this.isBroker=!1,this.controller=n||new c0(new Yc(e))}async initialize(e){return this.controller.initialize(e,this.isBroker)}async acquireTokenPopup(e){return this.controller.acquireTokenPopup(e)}acquireTokenRedirect(e){return this.controller.acquireTokenRedirect(e)}acquireTokenSilent(e){return this.controller.acquireTokenSilent(e)}acquireTokenByCode(e){return this.controller.acquireTokenByCode(e)}addEventCallback(e,n){return this.controller.addEventCallback(e,n)}removeEventCallback(e){return this.controller.removeEventCallback(e)}addPerformanceCallback(e){return this.controller.addPerformanceCallback(e)}removePerformanceCallback(e){return this.controller.removePerformanceCallback(e)}enableAccountStorageEvents(){this.controller.enableAccountStorageEvents()}disableAccountStorageEvents(){this.controller.disableAccountStorageEvents()}getAccount(e){return this.controller.getAccount(e)}getAccountByHomeId(e){return this.controller.getAccountByHomeId(e)}getAccountByLocalId(e){return this.controller.getAccountByLocalId(e)}getAccountByUsername(e){return this.controller.getAccountByUsername(e)}getAllAccounts(e){return this.controller.getAllAccounts(e)}handleRedirectPromise(e){return this.controller.handleRedirectPromise(e)}loginPopup(e){return this.controller.loginPopup(e)}loginRedirect(e){return this.controller.loginRedirect(e)}logout(e){return this.controller.logout(e)}logoutRedirect(e){return this.controller.logoutRedirect(e)}logoutPopup(e){return this.controller.logoutPopup(e)}ssoSilent(e){return this.controller.ssoSilent(e)}getTokenCache(){return this.controller.getTokenCache()}getLogger(){return this.controller.getLogger()}setLogger(e){this.controller.setLogger(e)}setActiveAccount(e){this.controller.setActiveAccount(e)}getActiveAccount(){return this.controller.getActiveAccount()}initializeWrapperLibrary(e,n){return this.controller.initializeWrapperLibrary(e,n)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}async hydrateCache(e,n){return this.controller.hydrateCache(e,n)}clearCache(e){return this.controller.clearCache(e)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const wre={initialize:()=>Promise.reject(Zn(Jn)),acquireTokenPopup:()=>Promise.reject(Zn(Jn)),acquireTokenRedirect:()=>Promise.reject(Zn(Jn)),acquireTokenSilent:()=>Promise.reject(Zn(Jn)),acquireTokenByCode:()=>Promise.reject(Zn(Jn)),getAllAccounts:()=>[],getAccount:()=>null,getAccountByHomeId:()=>null,getAccountByUsername:()=>null,getAccountByLocalId:()=>null,handleRedirectPromise:()=>Promise.reject(Zn(Jn)),loginPopup:()=>Promise.reject(Zn(Jn)),loginRedirect:()=>Promise.reject(Zn(Jn)),logout:()=>Promise.reject(Zn(Jn)),logoutRedirect:()=>Promise.reject(Zn(Jn)),logoutPopup:()=>Promise.reject(Zn(Jn)),ssoSilent:()=>Promise.reject(Zn(Jn)),addEventCallback:()=>null,removeEventCallback:()=>{},addPerformanceCallback:()=>"",removePerformanceCallback:()=>!1,enableAccountStorageEvents:()=>{},disableAccountStorageEvents:()=>{},getTokenCache:()=>{throw Zn(Jn)},getLogger:()=>{throw Zn(Jn)},setLogger:()=>{},setActiveAccount:()=>{},getActiveAccount:()=>null,initializeWrapperLibrary:()=>{},setNavigationClient:()=>{},getConfiguration:()=>{throw Zn(Jn)},hydrateCache:()=>Promise.reject(Zn(Jn)),clearCache:()=>Promise.reject(Zn(Jn))};/*! @azure/msal-browser v4.19.0 2025-08-05 */class Sre{static getInteractionStatusFromEvent(e,n){switch(e.eventType){case Ve.LOGIN_START:return ar.Login;case Ve.SSO_SILENT_START:return ar.SsoSilent;case Ve.ACQUIRE_TOKEN_START:if(e.interactionType===pt.Redirect||e.interactionType===pt.Popup)return ar.AcquireToken;break;case Ve.HANDLE_REDIRECT_START:return ar.HandleRedirect;case Ve.LOGOUT_START:return ar.Logout;case Ve.SSO_SILENT_SUCCESS:case Ve.SSO_SILENT_FAILURE:if(n&&n!==ar.SsoSilent)break;return ar.None;case Ve.LOGOUT_END:if(n&&n!==ar.Logout)break;return ar.None;case Ve.HANDLE_REDIRECT_END:if(n&&n!==ar.HandleRedirect)break;return ar.None;case Ve.LOGIN_SUCCESS:case Ve.LOGIN_FAILURE:case Ve.ACQUIRE_TOKEN_SUCCESS:case Ve.ACQUIRE_TOKEN_FAILURE:case Ve.RESTORE_FROM_BFCACHE:if(e.interactionType===pt.Redirect||e.interactionType===pt.Popup){if(n&&n!==ar.Login&&n!==ar.AcquireToken)break;return ar.None}break}return null}}const Cre="modulepreload",Are=function(t){return"/semblance/"+t},rI={},_re=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),l=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));i=Promise.allSettled(n.map(c=>{if(c=Are(c),c in rI)return;rI[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":Cre,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 o(s){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=s,window.dispatchEvent(l),!l.defaultPrevented)throw s}return i.then(s=>{for(const l of s||[])l.status==="rejected"&&o(l.reason);return e().catch(o)})};/*! @azure/msal-react v3.0.17 2025-08-05 */const jre={instance:wre,inProgress:ar.None,accounts:[],logger:new ya({})},lN=y.createContext(jre);lN.Consumer;/*! @azure/msal-react v3.0.17 2025-08-05 */function iI(t,e){if(t.length!==e.length)return!1;const n=[...e];return t.every(r=>{const i=n.shift();return!r||!i?!1:r.homeAccountId===i.homeAccountId&&r.localAccountId===i.localAccountId&&r.username===i.username})}/*! @azure/msal-react v3.0.17 2025-08-05 */const Ere="@azure/msal-react",oI="3.0.17";/*! @azure/msal-react v3.0.17 2025-08-05 */const Fy={UNBLOCK_INPROGRESS:"UNBLOCK_INPROGRESS",EVENT:"EVENT"},Nre=(t,e)=>{const{type:n,payload:r}=e;let i=t.inProgress;switch(n){case Fy.UNBLOCK_INPROGRESS:t.inProgress===ar.Startup&&(i=ar.None,r.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));break;case Fy.EVENT:const s=r.message,l=Sre.getInteractionStatusFromEvent(s,t.inProgress);l&&(r.logger.info(`MsalProvider - ${s.eventType} results in setting inProgress from ${t.inProgress} to ${l}`),i=l);break;default:throw new Error(`Unknown action type: ${n}`)}if(i===ar.Startup)return t;const o=r.instance.getAllAccounts();return i!==t.inProgress&&!iI(o,t.accounts)?{...t,inProgress:i,accounts:o}:i!==t.inProgress?{...t,inProgress:i}:iI(o,t.accounts)?t:{...t,accounts:o}};function Tre({instance:t,children:e}){y.useEffect(()=>{t.initializeWrapperLibrary(Gte.React,oI)},[t]);const n=y.useMemo(()=>t.getLogger().clone(Ere,oI),[t]),[r,i]=y.useReducer(Nre,void 0,()=>({inProgress:ar.Startup,accounts:[]}));y.useEffect(()=>{const s=t.addEventCallback(l=>{i({payload:{instance:t,logger:n,message:l},type:Fy.EVENT})});return n.verbose(`MsalProvider - Registered event callback with id: ${s}`),t.initialize().then(()=>{t.handleRedirectPromise().catch(()=>{}).finally(()=>{i({payload:{instance:t,logger:n},type:Fy.UNBLOCK_INPROGRESS})})}).catch(()=>{}),()=>{s&&(n.verbose(`MsalProvider - Removing event callback ${s}`),t.removeEventCallback(s))}},[t,n]);const o={instance:t,inProgress:r.inProgress,accounts:r.accounts,logger:n};return T.createElement(lN.Provider,{value:o},e)}/*! @azure/msal-react v3.0.17 2025-08-05 */const Pre=()=>y.useContext(lN),kre={auth:{clientId:"7e9b250a-d984-4fba-8e1c-a0622242a595",authority:"https://login.microsoftonline.com/e519c2e6-bc6d-4fdf-8d9c-923c2f002385",redirectUri:"https://ai-sandbox.oliver.solutions/semblance",postLogoutRedirectUri:"https://ai-sandbox.oliver.solutions/semblance"},cache:{cacheLocation:"localStorage",storeAuthStateInCookie:!1},system:{loggerOptions:{loggerCallback:(t,e,n)=>{n||console.log(e)},logLevel:jn.Verbose,piiLoggingEnabled:!1},allowNativeBroker:!1}},Ore={scopes:["openid","profile","email"],prompt:"select_account",extraQueryParameters:{code_challenge_method:"S256"}},K5=y.createContext(void 0);function Ire({children:t}){const[e,n]=y.useState(null),[r,i]=y.useState(null),[o,s]=y.useState(!0),[l,c]=y.useState(!1),u=Xn(),{instance:d,accounts:f,inProgress:h}=Pre();y.useEffect(()=>{const w=S=>{const A=S.detail||{};if(A.isPersonaCreation){console.log("Ignoring auth error from persona creation",A);return}i(null),n(null),ie.error("Session expired",{description:"Please log in again"}),u("/login")};return window.addEventListener(m1,w),()=>{window.removeEventListener(m1,w)}},[u]),y.useEffect(()=>{const w=localStorage.getItem("auth_token"),S=localStorage.getItem("user");if(console.log("AuthContext initializing - stored data check:",{hasToken:!!w,hasUser:!!S}),w&&S)try{i(w),n(JSON.parse(S)),console.log("User session restored from localStorage")}catch(C){console.error("Failed to parse stored user data:",C),localStorage.removeItem("auth_token"),localStorage.removeItem("user")}else console.log("No stored authentication data found");s(!1)},[]),y.useEffect(()=>{if(r){console.log("Verifying token...");const w=`token_validated_${r.substring(0,10)}`;if(sessionStorage.getItem(w)==="true"&&e){console.log("Token already validated this session, skipping validation");return}Nv.getProfile().then(C=>{C&&"data"in C&&(console.log("Profile verified successfully"),n(C.data),sessionStorage.setItem(w,"true"))}).catch(C=>{C.response&&C.response.status===401?(console.error("Token invalid (401):",C),localStorage.removeItem("auth_token"),localStorage.removeItem("user"),i(null),n(null)):(console.warn("Profile validation error (not clearing token):",C),sessionStorage.setItem(w,"true"))})}else console.log("No token available, not validating profile")},[r,e]);const p=async(w,S)=>{var C,A;s(!0),console.log("Attempting login for user:",w);try{const _=await Nv.login(w,S);if(console.log("Login API response received"),!_.data.access_token)throw new Error("No access token received from server");return localStorage.setItem("auth_token",_.data.access_token),localStorage.setItem("user",JSON.stringify(_.data.user)),i(_.data.access_token),n(_.data.user),console.log("Authentication state updated"),ie.success("Login successful!"),_.data.access_token}catch(_){throw console.error("Login failed:",_),ie.error("Login failed",{description:((A=(C=_.response)==null?void 0:C.data)==null?void 0:A.message)||"Invalid username or password"}),_}finally{s(!1)}},g=async()=>{c(!0);try{console.log("Starting Microsoft authentication...");const w=await d.loginPopup(Ore);if(w&&w.account&&w.accessToken){console.log("Microsoft authentication successful",w.account);const S=await Nv.loginWithMicrosoft(w.accessToken);S.data.access_token&&(localStorage.setItem("auth_token",S.data.access_token),localStorage.setItem("user",JSON.stringify(S.data.user)),localStorage.setItem("auth_type","microsoft"),i(S.data.access_token),n(S.data.user),console.log("Microsoft user authenticated and stored"),ie.success("Successfully signed in with Microsoft!"))}}catch(w){throw console.error("Microsoft login failed:",w),w.name==="BrowserAuthError"&&w.errorCode==="popup_window_error"?ie.error("Sign-in cancelled",{description:"The sign-in popup was closed before completing authentication."}):w.name==="InteractionRequiredAuthError"?ie.error("Authentication required",{description:"Please complete the authentication process."}):ie.error("Microsoft sign-in failed",{description:w.message||"An error occurred during authentication"}),w}finally{c(!1)}},m=async()=>{const w=localStorage.getItem("auth_type");if(localStorage.removeItem("auth_token"),localStorage.removeItem("user"),localStorage.removeItem("auth_type"),i(null),n(null),w==="microsoft"&&f.length>0)try{await d.logoutPopup({account:f[0],postLogoutRedirectUri:window.location.origin+"/semblance/"})}catch(S){console.error("Microsoft logout error:",S)}ie.info("You have been logged out")},v=!!localStorage.getItem("auth_token"),x={user:e,token:r,isLoading:o,login:p,loginWithMicrosoft:g,logout:m,isAuthenticated:!!r||v,isMsalLoading:l};return a.jsx(K5.Provider,{value:x,children:t})}function cu(){const t=y.useContext(K5);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t}function aa(){const[t,e]=y.useState(!1),n=Ei(),r=Xn(),{isAuthenticated:i,logout:o}=cu(),s=[{name:"Home",href:"/",icon:py},{name:"Synthetic Personas",href:"/synthetic-users",icon:Cr},{name:"Focus Groups",href:"/focus-groups",icon:Ps},{name:"Dashboard",href:"/dashboard",icon:l1}],l=()=>{e(!t)},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(oo,{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:[s.map(d=>a.jsx("li",{children:d.href==="/"?a.jsxs(oo,{to:d.href,className:Pe("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:Pe("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:()=>{o(),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(oO,{className:"mr-1 h-4 w-4"}),"Logout"]}):a.jsxs(oo,{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(iO,{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"}),t?a.jsx($o,{className:"block h-6 w-6","aria-hidden":"true"}):a.jsx(FX,{className:"block h-6 w-6","aria-hidden":"true"})]})})]})}),t&&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:[s.map(d=>a.jsx("div",{children:d.href==="/"?a.jsxs(oo,{to:d.href,className:Pe("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:()=>e(!1),children:[a.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]}):a.jsxs("button",{className:Pe("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:()=>{e(!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:()=>{o(),e(!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(oO,{className:"mr-3 h-5 w-5"}),"Logout"]}):a.jsxs(oo,{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:()=>e(!1),children:[a.jsx(iO,{className:"mr-3 h-5 w-5"}),"Login"]})]})})]})}const sI=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,aI=Et,cN=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return aI(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=e,s=Object.keys(i).map(u=>{const d=n==null?void 0:n[u],f=o==null?void 0:o[u];if(d===null)return null;const h=sI(d)||sI(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=e==null||(r=e.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,v]=g;return Array.isArray(v)?v.includes({...o,...l}[m]):{...o,...l}[m]===v})?[...u,f,h]:u},[]);return aI(t,s,c,n==null?void 0:n.class,n==null?void 0:n.className)},uN=cN("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"}}),te=y.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...i},o)=>{const s=r?Es:"button";return a.jsx(s,{className:Pe(uN({variant:e,size:n,className:t})),ref:o,...i})});te.displayName="Button";function Rre(){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(oo,{to:"/synthetic-users",children:a.jsxs(te,{className:"px-6 py-6 text-base hover:shadow-lg hover:translate-y-[-2px] button-transition",children:["Create synthetic personas",a.jsx(Ji,{className:"ml-2 h-4 w-4"})]})}),a.jsxs(oo,{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(t=>a.jsx("div",{className:`flex ${t%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 ${t%2===0?"bg-primary text-white":"bg-gray-200 text-gray-800"}`,children:[t===1&&"What qualities do you look for in a premium shampoo brand?",t===2&&"I value natural ingredients and a brand that feels luxurious but still eco-friendly.",t===3&&"How important is fragrance in your shampoo selection?",t===4&&"Very important - it affects my mood and how I feel about the product throughout the day."]})},t))})]})})]}),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 yu({title:t,description:e,icon:n,className:r}){return a.jsxs("div",{className:Pe("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:t}),a.jsx("p",{className:"text-gray-600 text-sm",children:e})]})]})}const Mre=()=>(cu(),Xn(),a.jsxs("div",{className:"min-h-screen overflow-hidden bg-background",children:[a.jsx(aa,{}),a.jsx("main",{children:a.jsxs("div",{className:"pt-16",children:[a.jsx(Rre,{}),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(yu,{title:"Scalable Research",description:"Create and test with thousands of synthetic personas, each with unique demographic profiles and behaviors.",icon:Cr}),a.jsx(yu,{title:"AI-Driven Focus Groups",description:"Run autonomous focus groups moderated by AI that adapts to participant responses in real-time.",icon:Ps}),a.jsx(yu,{title:"Instant Analysis",description:"Generate comprehensive reports and visualizations that highlight key insights and patterns.",icon:l1}),a.jsx(yu,{title:"Diverse Perspectives",description:"Access synthetic personas from various backgrounds, ensuring representation across age, gender, and location.",icon:Cr}),a.jsx(yu,{title:"Dynamic Discussions",description:"AI moderators guide conversations naturally, following up on interesting points without bias.",icon:KX}),a.jsx(yu,{title:"Comprehensive Reporting",description:"Export detailed reports with sentiment analysis, key themes, and actionable recommendations.",icon:l1})]})]})}),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(oo,{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(oo,{to:"/",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Home"})}),a.jsx("li",{children:a.jsx(oo,{to:"/synthetic-users",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Synthetic Personas"})}),a.jsx("li",{children:a.jsx(oo,{to:"/focus-groups",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Focus Groups"})}),a.jsx("li",{children:a.jsx(oo,{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."]})})]})]})})]})),Dre=()=>{const t=Ei(),e=Xn();y.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname]);const n=t.pathname.startsWith("/synthetic-users/"),i=new URLSearchParams(t.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(te,{onClick:()=>e("/synthetic-users?mode=create&tab=ai&step=review"),className:"mb-2 w-full",children:"Return to Review Page"}):a.jsx(te,{onClick:()=>e("/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(te,{variant:"outline",onClick:()=>e("/"),className:"w-full",children:"Return to Home"})]})})};function $re(t,e=[]){let n=[];function r(o,s){const l=y.createContext(s),c=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][c])||l,v=y.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:v,children:p})}function d(f,h){const p=(h==null?void 0:h[t][c])||l,g=y.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>y.createContext(s));return function(l){const c=(l==null?void 0:l[t])||o;return y.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,Lre(i,...e)]}function Lre(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(o)[`__scope${u}`];return{...l,...f}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var dN="Progress",fN=100,[Fre,HDe]=$re(dN),[Ure,Bre]=Fre(dN),W5=y.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:i,getValueLabel:o=Hre,...s}=t;(i||i===0)&&!lI(i)&&console.error(zre(`${i}`,"Progress"));const l=lI(i)?i:fN;r!==null&&!cI(r,l)&&console.error(Vre(`${r}`,"Progress"));const c=cI(r,l)?r:null,u=Uy(c)?o(c,l):void 0;return a.jsx(Ure,{scope:n,value:c,max:l,children:a.jsx(et.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":Uy(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":Q5(c,l),"data-value":c??void 0,"data-max":l,...s,ref:e})})});W5.displayName=dN;var q5="ProgressIndicator",Y5=y.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,i=Bre(q5,n);return a.jsx(et.div,{"data-state":Q5(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:e})});Y5.displayName=q5;function Hre(t,e){return`${Math.round(t/e*100)}%`}function Q5(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function Uy(t){return typeof t=="number"}function lI(t){return Uy(t)&&!isNaN(t)&&t>0}function cI(t,e){return Uy(t)&&!isNaN(t)&&t<=e&&t>=0}function zre(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${fN}\`.`}function Vre(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: - a positive number - - less than the value passed to \`max\` (or ${hN} if no \`max\` prop is set) + - 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 Z5=q5,Kre=Q5;const mc=y.forwardRef(({className:t,value:e,...n},r)=>a.jsx(Z5,{ref:r,className:ke("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...n,children:a.jsx(Kre,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));mc.displayName=Z5.displayName;var Qm=t=>t.type==="checkbox",gc=t=>t instanceof Date,ti=t=>t==null;const J5=t=>typeof t=="object";var Qn=t=>!ti(t)&&!Array.isArray(t)&&J5(t)&&!gc(t),eU=t=>Qn(t)&&t.target?Qm(t.target)?t.target.checked:t.target.value:t,Wre=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,tU=(t,e)=>t.has(Wre(e)),qre=t=>{const e=t.constructor&&t.constructor.prototype;return Qn(e)&&e.hasOwnProperty("isPrototypeOf")},pN=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function fi(t){let e;const n=Array.isArray(t);if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(pN&&(t instanceof Blob||t instanceof FileList))&&(n||Qn(t)))if(e=n?[]:{},!n&&!qre(t))e=t;else for(const r in t)t.hasOwnProperty(r)&&(e[r]=fi(t[r]));else return t;return e}var d0=t=>Array.isArray(t)?t.filter(Boolean):[],zn=t=>t===void 0,Re=(t,e,n)=>{if(!e||!Qn(t))return n;const r=d0(e.split(/[,[\].]+?/)).reduce((i,o)=>ti(i)?i:i[o],t);return zn(r)||r===t?zn(t[e])?n:t[e]:r},eo=t=>typeof t=="boolean",mN=t=>/^\w*$/.test(t),nU=t=>d0(t.replace(/["|']|\]/g,"").split(/\.|\[/)),rn=(t,e,n)=>{let r=-1;const i=mN(e)?[e]:nU(e),o=i.length,s=o-1;for(;++rT.useContext(rU),Yre=t=>{const{children:e,...n}=t;return T.createElement(rU.Provider,{value:n},e)};var iU=(t,e,n,r=!0)=>{const i={defaultValues:e._defaultValues};for(const o in t)Object.defineProperty(i,o,{get:()=>{const s=o;return e._proxyFormState[s]!==Po.all&&(e._proxyFormState[s]=!r||Po.all),n&&(n[s]=!0),t[s]}});return i},hi=t=>Qn(t)&&!Object.keys(t).length,oU=(t,e,n,r)=>{n(t);const{name:i,...o}=t;return hi(o)||Object.keys(o).length>=Object.keys(e).length||Object.keys(o).find(s=>e[s]===(!r||Po.all))},Gh=t=>Array.isArray(t)?t:[t],sU=(t,e,n)=>!t||!e||t===e||Gh(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r)));function gN(t){const e=T.useRef(t);e.current=t,T.useEffect(()=>{const n=!t.disabled&&e.current.subject&&e.current.subject.subscribe({next:e.current.next});return()=>{n&&n.unsubscribe()}},[t.disabled])}function Qre(t){const e=f0(),{control:n=e.control,disabled:r,name:i,exact:o}=t||{},[s,l]=T.useState(n._formState),c=T.useRef(!0),u=T.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=T.useRef(i);return d.current=i,gN({disabled:r,next:f=>c.current&&sU(d.current,f.name,o)&&oU(f,u.current,n._updateFormState)&&l({...n._formState,...f}),subject:n._subjects.state}),T.useEffect(()=>(c.current=!0,u.current.isValid&&n._updateValid(!0),()=>{c.current=!1}),[n]),iU(s,n,u.current,!1)}var gs=t=>typeof t=="string",aU=(t,e,n,r,i)=>gs(t)?(r&&e.watch.add(t),Re(n,t,i)):Array.isArray(t)?t.map(o=>(r&&e.watch.add(o),Re(n,o))):(r&&(e.watchAll=!0),n);function Xre(t){const e=f0(),{control:n=e.control,name:r,defaultValue:i,disabled:o,exact:s}=t||{},l=T.useRef(r);l.current=r,gN({disabled:o,subject:n._subjects.values,next:d=>{sU(l.current,d.name,s)&&u(fi(aU(l.current,n._names,d.values||n._formValues,!1,i)))}});const[c,u]=T.useState(n._getWatch(r,i));return T.useEffect(()=>n._removeUnmounted()),c}function Zre(t){const e=f0(),{name:n,disabled:r,control:i=e.control,shouldUnregister:o}=t,s=tU(i._names.array,n),l=Xre({control:i,name:n,defaultValue:Re(i._formValues,n,Re(i._defaultValues,n,t.defaultValue)),exact:!0}),c=Qre({control:i,name:n,exact:!0}),u=T.useRef(i.register(n,{...t.rules,value:l,...eo(t.disabled)?{disabled:t.disabled}:{}}));return T.useEffect(()=>{const d=i._options.shouldUnregister||o,f=(h,p)=>{const g=Re(i._fields,h);g&&g._f&&(g._f.mount=p)};if(f(n,!0),d){const h=fi(Re(i._options.defaultValues,n));rn(i._defaultValues,n,h),zn(Re(i._formValues,n))&&rn(i._formValues,n,h)}return()=>{(s?d&&!i._state.action:d)?i.unregister(n):f(n,!1)}},[n,i,s,o]),T.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,...eo(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:T.useCallback(d=>u.current.onChange({target:{value:eU(d),name:n},type:Hy.CHANGE}),[n]),onBlur:T.useCallback(()=>u.current.onBlur({target:{value:Re(i._formValues,n),name:n},type:Hy.BLUR}),[n,i]),ref:T.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 Jre=t=>t.render(Zre(t));var lU=(t,e,n,r,i)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:i||!0}}:{},dI=t=>({isOnSubmit:!t||t===Po.onSubmit,isOnBlur:t===Po.onBlur,isOnChange:t===Po.onChange,isOnAll:t===Po.all,isOnTouch:t===Po.onTouched}),fI=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const Kh=(t,e,n,r)=>{for(const i of n||Object.keys(t)){const o=Re(t,i);if(o){const{_f:s,...l}=o;if(s){if(s.refs&&s.refs[0]&&e(s.refs[0],i)&&!r)return!0;if(s.ref&&e(s.ref,s.name)&&!r)return!0;if(Kh(l,e))break}else if(Qn(l)&&Kh(l,e))break}}};var eie=(t,e,n)=>{const r=Gh(Re(t,n));return rn(r,"root",e[n]),rn(t,n,r),t},vN=t=>t.type==="file",na=t=>typeof t=="function",zy=t=>{if(!pN)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},Iv=t=>gs(t),yN=t=>t.type==="radio",Vy=t=>t instanceof RegExp;const hI={value:!1,isValid:!1},pI={value:!0,isValid:!0};var cU=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!zn(t[0].attributes.value)?zn(t[0].value)||t[0].value===""?pI:{value:t[0].value,isValid:!0}:pI:hI}return hI};const mI={isValid:!1,value:null};var uU=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,mI):mI;function gI(t,e,n="validate"){if(Iv(t)||Array.isArray(t)&&t.every(Iv)||eo(t)&&!t)return{type:n,message:Iv(t)?t:"",ref:e}}var xu=t=>Qn(t)&&!Vy(t)?t:{value:t,message:""},vI=async(t,e,n,r,i)=>{const{ref:o,refs:s,required:l,maxLength:c,minLength:u,min:d,max:f,pattern:h,validate:p,name:g,valueAsNumber:m,mount:v,disabled:b}=t._f,x=Re(e,g);if(!v||b)return{};const w=s?s[0]:o,S=E=>{r&&w.reportValidity&&(w.setCustomValidity(eo(E)?"":E||""),w.reportValidity())},C={},A=yN(o),_=Qm(o),j=A||_,k=(m||vN(o))&&zn(o.value)&&zn(x)||zy(o)&&o.value===""||x===""||Array.isArray(x)&&!x.length,P=lU.bind(null,g,n,C),R=(E,I,L,V=Bs.maxLength,$=Bs.minLength)=>{const z=E?I:L;C[g]={type:E?V:$,message:z,ref:o,...P(E?V:$,z)}};if(i?!Array.isArray(x)||!x.length:l&&(!j&&(k||ti(x))||eo(x)&&!x||_&&!cU(s).isValid||A&&!uU(s).isValid)){const{value:E,message:I}=Iv(l)?{value:!!l,message:l}:xu(l);if(E&&(C[g]={type:Bs.required,message:I,ref:w,...P(Bs.required,I)},!n))return S(I),C}if(!k&&(!ti(d)||!ti(f))){let E,I;const L=xu(f),V=xu(d);if(!ti(x)&&!isNaN(x)){const $=o.valueAsNumber||x&&+x;ti(L.value)||(E=$>L.value),ti(V.value)||(I=$new Date(new Date().toDateString()+" "+K),M=o.type=="time",U=o.type=="week";gs(L.value)&&x&&(E=M?z(x)>z(L.value):U?x>L.value:$>new Date(L.value)),gs(V.value)&&x&&(I=M?z(x)+E.value,V=!ti(I.value)&&x.length<+I.value;if((L||V)&&(R(L,E.message,I.message),!n))return S(C[g].message),C}if(h&&!k&&gs(x)){const{value:E,message:I}=xu(h);if(Vy(E)&&!x.match(E)&&(C[g]={type:Bs.pattern,message:I,ref:o,...P(Bs.pattern,I)},!n))return S(I),C}if(p){if(na(p)){const E=await p(x,e),I=gI(E,w);if(I&&(C[g]={...I,...P(Bs.validate,I.message)},!n))return S(I.message),C}else if(Qn(p)){let E={};for(const I in p){if(!hi(E)&&!n)break;const L=gI(await p[I](x,e),w,I);L&&(E={...L,...P(I,L.message)},S(L.message),n&&(C[g]=E))}if(!hi(E)&&(C[g]={ref:w,...E},!n))return C}}return S(!0),C};function tie(t,e){const n=e.slice(0,-1).length;let r=0;for(;r{let t=[];return{get observers(){return t},next:i=>{for(const o of t)o.next&&o.next(i)},subscribe:i=>(t.push(i),{unsubscribe:()=>{t=t.filter(o=>o!==i)}}),unsubscribe:()=>{t=[]}}},I1=t=>ti(t)||!J5(t);function Ka(t,e){if(I1(t)||I1(e))return t===e;if(gc(t)&&gc(e))return t.getTime()===e.getTime();const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const i of n){const o=t[i];if(!r.includes(i))return!1;if(i!=="ref"){const s=e[i];if(gc(o)&&gc(s)||Qn(o)&&Qn(s)||Array.isArray(o)&&Array.isArray(s)?!Ka(o,s):o!==s)return!1}}return!0}var dU=t=>t.type==="select-multiple",rie=t=>yN(t)||Qm(t),fS=t=>zy(t)&&t.isConnected,fU=t=>{for(const e in t)if(na(t[e]))return!0;return!1};function Gy(t,e={}){const n=Array.isArray(t);if(Qn(t)||n)for(const r in t)Array.isArray(t[r])||Qn(t[r])&&!fU(t[r])?(e[r]=Array.isArray(t[r])?[]:{},Gy(t[r],e[r])):ti(t[r])||(e[r]=!0);return e}function hU(t,e,n){const r=Array.isArray(t);if(Qn(t)||r)for(const i in t)Array.isArray(t[i])||Qn(t[i])&&!fU(t[i])?zn(e)||I1(n[i])?n[i]=Array.isArray(t[i])?Gy(t[i],[]):{...Gy(t[i])}:hU(t[i],ti(e)?{}:e[i],n[i]):n[i]=!Ka(t[i],e[i]);return n}var ih=(t,e)=>hU(t,e,Gy(e)),pU=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>zn(t)?t:e?t===""?NaN:t&&+t:n&&gs(t)?new Date(t):r?r(t):t;function hS(t){const e=t.ref;if(!(t.refs?t.refs.every(n=>n.disabled):e.disabled))return vN(e)?e.files:yN(e)?uU(t.refs).value:dU(e)?[...e.selectedOptions].map(({value:n})=>n):Qm(e)?cU(t.refs).value:pU(zn(e.value)?t.ref.value:e.value,t)}var iie=(t,e,n,r)=>{const i={};for(const o of t){const s=Re(e,o);s&&rn(i,o,s._f)}return{criteriaMode:n,names:[...t],fields:i,shouldUseNativeValidation:r}},oh=t=>zn(t)?t:Vy(t)?t.source:Qn(t)?Vy(t.value)?t.value.source:t.value:t;const yI="AsyncFunction";var oie=t=>(!t||!t.validate)&&!!(na(t.validate)&&t.validate.constructor.name===yI||Qn(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===yI)),sie=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function xI(t,e,n){const r=Re(t,n);if(r||mN(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const o=i.join("."),s=Re(e,o),l=Re(t,o);if(s&&!Array.isArray(s)&&n!==o)return{name:n};if(l&&l.type)return{name:o,error:l};i.pop()}return{name:n}}var aie=(t,e,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(e||t):(n?r.isOnBlur:i.isOnBlur)?!t:(n?r.isOnChange:i.isOnChange)?t:!0,lie=(t,e)=>!d0(Re(t,e)).length&&sr(t,e);const cie={mode:Po.onSubmit,reValidateMode:Po.onChange,shouldFocusError:!0};function uie(t={}){let e={...cie,...t},n={submitCount:0,isDirty:!1,isLoading:na(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},i=Qn(e.defaultValues)||Qn(e.values)?fi(e.defaultValues||e.values)||{}:{},o=e.shouldUnregister?{}:fi(i),s={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:dS(),array:dS(),state:dS()},h=dI(e.mode),p=dI(e.reValidateMode),g=e.criteriaMode===Po.all,m=N=>D=>{clearTimeout(u),u=setTimeout(N,D)},v=async N=>{if(!t.disabled&&(d.isValid||N)){const D=e.resolver?hi((await j()).errors):await P(r,!0);D!==n.isValid&&f.state.next({isValid:D})}},b=(N,D)=>{!t.disabled&&(d.isValidating||d.validatingFields)&&((N||Array.from(l.mount)).forEach(H=>{H&&(D?rn(n.validatingFields,H,D):sr(n.validatingFields,H))}),f.state.next({validatingFields:n.validatingFields,isValidating:!hi(n.validatingFields)}))},x=(N,D=[],H,Q,Z=!0,B=!0)=>{if(Q&&H&&!t.disabled){if(s.action=!0,B&&Array.isArray(Re(r,N))){const ee=H(Re(r,N),Q.argA,Q.argB);Z&&rn(r,N,ee)}if(B&&Array.isArray(Re(n.errors,N))){const ee=H(Re(n.errors,N),Q.argA,Q.argB);Z&&rn(n.errors,N,ee),lie(n.errors,N)}if(d.touchedFields&&B&&Array.isArray(Re(n.touchedFields,N))){const ee=H(Re(n.touchedFields,N),Q.argA,Q.argB);Z&&rn(n.touchedFields,N,ee)}d.dirtyFields&&(n.dirtyFields=ih(i,o)),f.state.next({name:N,isDirty:E(N,D),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else rn(o,N,D)},w=(N,D)=>{rn(n.errors,N,D),f.state.next({errors:n.errors})},S=N=>{n.errors=N,f.state.next({errors:n.errors,isValid:!1})},C=(N,D,H,Q)=>{const Z=Re(r,N);if(Z){const B=Re(o,N,zn(H)?Re(i,N):H);zn(B)||Q&&Q.defaultChecked||D?rn(o,N,D?B:hS(Z._f)):V(N,B),s.mount&&v()}},A=(N,D,H,Q,Z)=>{let B=!1,ee=!1;const me={name:N};if(!t.disabled){const Ce=!!(Re(r,N)&&Re(r,N)._f&&Re(r,N)._f.disabled);if(!H||Q){d.isDirty&&(ee=n.isDirty,n.isDirty=me.isDirty=E(),B=ee!==me.isDirty);const De=Ce||Ka(Re(i,N),D);ee=!!(!Ce&&Re(n.dirtyFields,N)),De||Ce?sr(n.dirtyFields,N):rn(n.dirtyFields,N,!0),me.dirtyFields=n.dirtyFields,B=B||d.dirtyFields&&ee!==!De}if(H){const De=Re(n.touchedFields,N);De||(rn(n.touchedFields,N,H),me.touchedFields=n.touchedFields,B=B||d.touchedFields&&De!==H)}B&&Z&&f.state.next(me)}return B?me:{}},_=(N,D,H,Q)=>{const Z=Re(n.errors,N),B=d.isValid&&eo(D)&&n.isValid!==D;if(t.delayError&&H?(c=m(()=>w(N,H)),c(t.delayError)):(clearTimeout(u),c=null,H?rn(n.errors,N,H):sr(n.errors,N)),(H?!Ka(Z,H):Z)||!hi(Q)||B){const ee={...Q,...B&&eo(D)?{isValid:D}:{},errors:n.errors,name:N};n={...n,...ee},f.state.next(ee)}},j=async N=>{b(N,!0);const D=await e.resolver(o,e.context,iie(N||l.mount,r,e.criteriaMode,e.shouldUseNativeValidation));return b(N),D},k=async N=>{const{errors:D}=await j(N);if(N)for(const H of N){const Q=Re(D,H);Q?rn(n.errors,H,Q):sr(n.errors,H)}else n.errors=D;return D},P=async(N,D,H={valid:!0})=>{for(const Q in N){const Z=N[Q];if(Z){const{_f:B,...ee}=Z;if(B){const me=l.array.has(B.name),Ce=Z._f&&oie(Z._f);Ce&&d.validatingFields&&b([Q],!0);const De=await vI(Z,o,g,e.shouldUseNativeValidation&&!D,me);if(Ce&&d.validatingFields&&b([Q]),De[B.name]&&(H.valid=!1,D))break;!D&&(Re(De,B.name)?me?eie(n.errors,De,B.name):rn(n.errors,B.name,De[B.name]):sr(n.errors,B.name))}!hi(ee)&&await P(ee,D,H)}}return H.valid},R=()=>{for(const N of l.unMount){const D=Re(r,N);D&&(D._f.refs?D._f.refs.every(H=>!fS(H)):!fS(D._f.ref))&&ie(N)}l.unMount=new Set},E=(N,D)=>!t.disabled&&(N&&D&&rn(o,N,D),!Ka(X(),i)),I=(N,D,H)=>aU(N,l,{...s.mount?o:zn(D)?i:gs(N)?{[N]:D}:D},H,D),L=N=>d0(Re(s.mount?o:i,N,t.shouldUnregister?Re(i,N,[]):[])),V=(N,D,H={})=>{const Q=Re(r,N);let Z=D;if(Q){const B=Q._f;B&&(!B.disabled&&rn(o,N,pU(D,B)),Z=zy(B.ref)&&ti(D)?"":D,dU(B.ref)?[...B.ref.options].forEach(ee=>ee.selected=Z.includes(ee.value)):B.refs?Qm(B.ref)?B.refs.length>1?B.refs.forEach(ee=>(!ee.defaultChecked||!ee.disabled)&&(ee.checked=Array.isArray(Z)?!!Z.find(me=>me===ee.value):Z===ee.value)):B.refs[0]&&(B.refs[0].checked=!!Z):B.refs.forEach(ee=>ee.checked=ee.value===Z):vN(B.ref)?B.ref.value="":(B.ref.value=Z,B.ref.type||f.values.next({name:N,values:{...o}})))}(H.shouldDirty||H.shouldTouch)&&A(N,Z,H.shouldTouch,H.shouldDirty,!0),H.shouldValidate&&K(N)},$=(N,D,H)=>{for(const Q in D){const Z=D[Q],B=`${N}.${Q}`,ee=Re(r,B);(l.array.has(N)||Qn(Z)||ee&&!ee._f)&&!gc(Z)?$(B,Z,H):V(B,Z,H)}},z=(N,D,H={})=>{const Q=Re(r,N),Z=l.array.has(N),B=fi(D);rn(o,N,B),Z?(f.array.next({name:N,values:{...o}}),(d.isDirty||d.dirtyFields)&&H.shouldDirty&&f.state.next({name:N,dirtyFields:ih(i,o),isDirty:E(N,B)})):Q&&!Q._f&&!ti(B)?$(N,B,H):V(N,B,H),fI(N,l)&&f.state.next({...n}),f.values.next({name:s.mount?N:void 0,values:{...o}})},M=async N=>{s.mount=!0;const D=N.target;let H=D.name,Q=!0;const Z=Re(r,H),B=()=>D.type?hS(Z._f):eU(N),ee=me=>{Q=Number.isNaN(me)||gc(me)&&isNaN(me.getTime())||Ka(me,Re(o,H,me))};if(Z){let me,Ce;const De=B(),we=N.type===Hy.BLUR||N.type===Hy.FOCUS_OUT,We=!sie(Z._f)&&!e.resolver&&!Re(n.errors,H)&&!Z._f.deps||aie(we,Re(n.touchedFields,H),n.isSubmitted,p,h),St=fI(H,l,we);rn(o,H,De),we?(Z._f.onBlur&&Z._f.onBlur(N),c&&c(0)):Z._f.onChange&&Z._f.onChange(N);const Tt=A(H,De,we,!1),Ze=!hi(Tt)||St;if(!we&&f.values.next({name:H,type:N.type,values:{...o}}),We)return d.isValid&&(t.mode==="onBlur"?we&&v():v()),Ze&&f.state.next({name:H,...St?{}:Tt});if(!we&&St&&f.state.next({...n}),e.resolver){const{errors:Qe}=await j([H]);if(ee(De),Q){const $t=xI(n.errors,r,H),Yt=xI(Qe,r,$t.name||H);me=Yt.error,H=Yt.name,Ce=hi(Qe)}}else b([H],!0),me=(await vI(Z,o,g,e.shouldUseNativeValidation))[H],b([H]),ee(De),Q&&(me?Ce=!1:d.isValid&&(Ce=await P(r,!0)));Q&&(Z._f.deps&&K(Z._f.deps),_(H,Ce,me,Tt))}},U=(N,D)=>{if(Re(n.errors,D)&&N.focus)return N.focus(),1},K=async(N,D={})=>{let H,Q;const Z=Gh(N);if(e.resolver){const B=await k(zn(N)?N:Z);H=hi(B),Q=N?!Z.some(ee=>Re(B,ee)):H}else N?(Q=(await Promise.all(Z.map(async B=>{const ee=Re(r,B);return await P(ee&&ee._f?{[B]:ee}:ee)}))).every(Boolean),!(!Q&&!n.isValid)&&v()):Q=H=await P(r);return f.state.next({...!gs(N)||d.isValid&&H!==n.isValid?{}:{name:N},...e.resolver||!N?{isValid:H}:{},errors:n.errors}),D.shouldFocus&&!Q&&Kh(r,U,N?Z:l.mount),Q},X=N=>{const D={...s.mount?o:i};return zn(N)?D:gs(N)?Re(D,N):N.map(H=>Re(D,H))},re=(N,D)=>({invalid:!!Re((D||n).errors,N),isDirty:!!Re((D||n).dirtyFields,N),error:Re((D||n).errors,N),isValidating:!!Re(n.validatingFields,N),isTouched:!!Re((D||n).touchedFields,N)}),xe=N=>{N&&Gh(N).forEach(D=>sr(n.errors,D)),f.state.next({errors:N?n.errors:{}})},F=(N,D,H)=>{const Q=(Re(r,N,{_f:{}})._f||{}).ref,Z=Re(n.errors,N)||{},{ref:B,message:ee,type:me,...Ce}=Z;rn(n.errors,N,{...Ce,...D,ref:Q}),f.state.next({name:N,errors:n.errors,isValid:!1}),H&&H.shouldFocus&&Q&&Q.focus&&Q.focus()},ue=(N,D)=>na(N)?f.values.subscribe({next:H=>N(I(void 0,D),H)}):I(N,D,!0),ie=(N,D={})=>{for(const H of N?Gh(N):l.mount)l.mount.delete(H),l.array.delete(H),D.keepValue||(sr(r,H),sr(o,H)),!D.keepError&&sr(n.errors,H),!D.keepDirty&&sr(n.dirtyFields,H),!D.keepTouched&&sr(n.touchedFields,H),!D.keepIsValidating&&sr(n.validatingFields,H),!e.shouldUnregister&&!D.keepDefaultValue&&sr(i,H);f.values.next({values:{...o}}),f.state.next({...n,...D.keepDirty?{isDirty:E()}:{}}),!D.keepIsValid&&v()},ce=({disabled:N,name:D,field:H,fields:Q,value:Z})=>{if(eo(N)&&s.mount||N){const B=N?void 0:zn(Z)?hS(H?H._f:Re(Q,D)._f):Z;rn(o,D,B),A(D,B,!1,!1,!0)}},Me=(N,D={})=>{let H=Re(r,N);const Q=eo(D.disabled)||eo(t.disabled);return rn(r,N,{...H||{},_f:{...H&&H._f?H._f:{ref:{name:N}},name:N,mount:!0,...D}}),l.mount.add(N),H?ce({field:H,disabled:eo(D.disabled)?D.disabled:t.disabled,name:N,value:D.value}):C(N,!0,D.value),{...Q?{disabled:D.disabled||t.disabled}:{},...e.progressive?{required:!!D.required,min:oh(D.min),max:oh(D.max),minLength:oh(D.minLength),maxLength:oh(D.maxLength),pattern:oh(D.pattern)}:{},name:N,onChange:M,onBlur:M,ref:Z=>{if(Z){Me(N,D),H=Re(r,N);const B=zn(Z.value)&&Z.querySelectorAll&&Z.querySelectorAll("input,select,textarea")[0]||Z,ee=rie(B),me=H._f.refs||[];if(ee?me.find(Ce=>Ce===B):B===H._f.ref)return;rn(r,N,{_f:{...H._f,...ee?{refs:[...me.filter(fS),B,...Array.isArray(Re(i,N))?[{}]:[]],ref:{type:B.type,name:N}}:{ref:B}}}),C(N,!1,void 0,B)}else H=Re(r,N,{}),H._f&&(H._f.mount=!1),(e.shouldUnregister||D.shouldUnregister)&&!(tU(l.array,N)&&s.action)&&l.unMount.add(N)}}},pe=()=>e.shouldFocusError&&Kh(r,U,l.mount),Se=N=>{eo(N)&&(f.state.next({disabled:N}),Kh(r,(D,H)=>{const Q=Re(r,H);Q&&(D.disabled=Q._f.disabled||N,Array.isArray(Q._f.refs)&&Q._f.refs.forEach(Z=>{Z.disabled=Q._f.disabled||N}))},0,!1))},Te=(N,D)=>async H=>{let Q;H&&(H.preventDefault&&H.preventDefault(),H.persist&&H.persist());let Z=fi(o);if(f.state.next({isSubmitting:!0}),e.resolver){const{errors:B,values:ee}=await j();n.errors=B,Z=ee}else await P(r);if(sr(n.errors,"root"),hi(n.errors)){f.state.next({errors:{}});try{await N(Z,H)}catch(B){Q=B}}else D&&await D({...n.errors},H),pe(),setTimeout(pe);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:hi(n.errors)&&!Q,submitCount:n.submitCount+1,errors:n.errors}),Q)throw Q},ne=(N,D={})=>{Re(r,N)&&(zn(D.defaultValue)?z(N,fi(Re(i,N))):(z(N,D.defaultValue),rn(i,N,fi(D.defaultValue))),D.keepTouched||sr(n.touchedFields,N),D.keepDirty||(sr(n.dirtyFields,N),n.isDirty=D.defaultValue?E(N,fi(Re(i,N))):E()),D.keepError||(sr(n.errors,N),d.isValid&&v()),f.state.next({...n}))},rt=(N,D={})=>{const H=N?fi(N):i,Q=fi(H),Z=hi(N),B=Z?i:Q;if(D.keepDefaultValues||(i=H),!D.keepValues){if(D.keepDirtyValues){const ee=new Set([...l.mount,...Object.keys(ih(i,o))]);for(const me of Array.from(ee))Re(n.dirtyFields,me)?rn(B,me,Re(o,me)):z(me,Re(B,me))}else{if(pN&&zn(N))for(const ee of l.mount){const me=Re(r,ee);if(me&&me._f){const Ce=Array.isArray(me._f.refs)?me._f.refs[0]:me._f.ref;if(zy(Ce)){const De=Ce.closest("form");if(De){De.reset();break}}}}r={}}o=t.shouldUnregister?D.keepDefaultValues?fi(i):{}:fi(B),f.array.next({values:{...B}}),f.values.next({values:{...B}})}l={mount:D.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!D.keepIsValid||!!D.keepDirtyValues,s.watch=!!t.shouldUnregister,f.state.next({submitCount:D.keepSubmitCount?n.submitCount:0,isDirty:Z?!1:D.keepDirty?n.isDirty:!!(D.keepDefaultValues&&!Ka(N,i)),isSubmitted:D.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Z?{}:D.keepDirtyValues?D.keepDefaultValues&&o?ih(i,o):n.dirtyFields:D.keepDefaultValues&&N?ih(i,N):D.keepDirty?n.dirtyFields:{},touchedFields:D.keepTouched?n.touchedFields:{},errors:D.keepErrors?n.errors:{},isSubmitSuccessful:D.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Fe=(N,D)=>rt(na(N)?N(o):N,D);return{control:{register:Me,unregister:ie,getFieldState:re,handleSubmit:Te,setError:F,_executeSchema:j,_getWatch:I,_getDirty:E,_updateValid:v,_removeUnmounted:R,_updateFieldArray:x,_updateDisabledField:ce,_getFieldArray:L,_reset:rt,_resetDefaultValues:()=>na(e.defaultValues)&&e.defaultValues().then(N=>{Fe(N,e.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:N=>{n={...n,...N}},_disableForm:Se,_subjects:f,_proxyFormState:d,_setErrors:S,get _fields(){return r},get _formValues(){return o},get _state(){return s},set _state(N){s=N},get _defaultValues(){return i},get _names(){return l},set _names(N){l=N},get _formState(){return n},set _formState(N){n=N},get _options(){return e},set _options(N){e={...e,...N}}},trigger:K,register:Me,handleSubmit:Te,watch:ue,setValue:z,getValues:X,reset:Fe,resetField:ne,clearErrors:xe,unregister:ie,setError:F,setFocus:(N,D={})=>{const H=Re(r,N),Q=H&&H._f;if(Q){const Z=Q.refs?Q.refs[0]:Q.ref;Z.focus&&(Z.focus(),D.shouldSelect&&Z.select())}},getFieldState:re}}function h0(t={}){const e=T.useRef(),n=T.useRef(),[r,i]=T.useState({isDirty:!1,isValidating:!1,isLoading:na(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:na(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...uie(t),formState:r});const o=e.current.control;return o._options=t,gN({subject:o._subjects.state,next:s=>{oU(s,o._proxyFormState,o._updateFormState,!0)&&i({...o._formState})}}),T.useEffect(()=>o._disableForm(t.disabled),[o,t.disabled]),T.useEffect(()=>{if(o._proxyFormState.isDirty){const s=o._getDirty();s!==r.isDirty&&o._subjects.state.next({isDirty:s})}},[o,r.isDirty]),T.useEffect(()=>{t.values&&!Ka(t.values,n.current)?(o._reset(t.values,o._options.resetOptions),n.current=t.values,i(s=>({...s}))):o._resetDefaultValues()},[t.values,o]),T.useEffect(()=>{t.errors&&o._setErrors(t.errors)},[t.errors,o]),T.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),T.useEffect(()=>{t.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[t.shouldUnregister,o]),T.useEffect(()=>{e.current&&(e.current.watch=e.current.watch.bind({}))},[r]),e.current.formState=iU(r,o),e.current}const bI=(t,e,n)=>{if(t&&"reportValidity"in t){const r=Re(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},mU=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?bI(r.ref,n,t):r.refs&&r.refs.forEach(i=>bI(i,n,t))}},die=(t,e)=>{e.shouldUseNativeValidation&&mU(t,e);const n={};for(const r in t){const i=Re(e.fields,r),o=Object.assign(t[r]||{},{ref:i&&i.ref});if(fie(e.names||Object.keys(t),r)){const s=Object.assign({},Re(n,r));rn(s,"root",o),rn(n,r,s)}else rn(n,r,o)}return n},fie=(t,e)=>t.some(n=>n.startsWith(e+"."));var hie=function(t,e){for(var n={};t.length;){var r=t[0],i=r.code,o=r.message,s=r.path.join(".");if(!n[s])if("unionErrors"in r){var l=r.unionErrors[0].errors[0];n[s]={message:l.message,type:l.code}}else n[s]={message:o,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return t.push(f)})}),e){var c=n[s].types,u=c&&c[r.code];n[s]=lU(s,e,n,i,u?[].concat(u,r.message):r.message)}t.shift()}return n},p0=function(t,e,n){return n===void 0&&(n={}),function(r,i,o){try{return Promise.resolve(function(s,l){try{var c=Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(u){return o.shouldUseNativeValidation&&mU({},o),{errors:{},values:n.raw?r:u}})}catch(u){return l(u)}return c&&c.then?c.then(void 0,l):c}(0,function(s){if(function(l){return Array.isArray(l==null?void 0:l.errors)}(s))return{values:{},errors:die(hie(s.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw s}))}catch(s){return Promise.reject(s)}}},Wt;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const o={};for(const s of i)o[s]=s;return o},t.getValidEnumValues=i=>{const o=t.objectKeys(i).filter(l=>typeof i[i[l]]!="number"),s={};for(const l of o)s[l]=i[l];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(const s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=r,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Wt||(Wt={}));var R1;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(R1||(R1={}));const ze=Wt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Wa=t=>{switch(typeof t){case"undefined":return ze.undefined;case"string":return ze.string;case"number":return isNaN(t)?ze.nan:ze.number;case"boolean":return ze.boolean;case"function":return ze.function;case"bigint":return ze.bigint;case"symbol":return ze.symbol;case"object":return Array.isArray(t)?ze.array:t===null?ze.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ze.promise:typeof Map<"u"&&t instanceof Map?ze.map:typeof Set<"u"&&t instanceof Set?ze.set:typeof Date<"u"&&t instanceof Date?ze.date:ze.object;default:return ze.unknown}},je=Wt.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"]),pie=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class Hi extends Error{constructor(e){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=e}get errors(){return this.issues}format(e){const n=e||function(o){return o.message},r={_errors:[]},i=o=>{for(const s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));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(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Hi.create=t=>new Hi(t);const Od=(t,e)=>{let n;switch(t.code){case je.invalid_type:t.received===ze.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case je.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Wt.jsonStringifyReplacer)}`;break;case je.unrecognized_keys:n=`Unrecognized key(s) in object: ${Wt.joinValues(t.keys,", ")}`;break;case je.invalid_union:n="Invalid input";break;case je.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Wt.joinValues(t.options)}`;break;case je.invalid_enum_value:n=`Invalid enum value. Expected ${Wt.joinValues(t.options)}, received '${t.received}'`;break;case je.invalid_arguments:n="Invalid function arguments";break;case je.invalid_return_type:n="Invalid function return type";break;case je.invalid_date:n="Invalid date";break;case je.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Wt.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case je.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case je.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case je.custom:n="Invalid input";break;case je.invalid_intersection_types:n="Intersection results could not be merged";break;case je.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case je.not_finite:n="Number must be finite";break;default:n=e.defaultError,Wt.assertNever(t)}return{message:n}};let gU=Od;function mie(t){gU=t}function Ky(){return gU}const Wy=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,o=[...n,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let l="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)l=u(s,{data:e,defaultError:l}).message;return{...i,path:o,message:l}},gie=[];function Ue(t,e){const n=Ky(),r=Wy({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Od?void 0:Od].filter(i=>!!i)});t.common.issues.push(r)}class qr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const i of n){if(i.status==="aborted")return At;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n){const o=await i.key,s=await i.value;r.push({key:o,value:s})}return qr.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return At;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(r[o.value]=s.value)}return{status:e.value,value:r}}}const At=Object.freeze({status:"aborted"}),Hu=t=>({status:"dirty",value:t}),li=t=>({status:"valid",value:t}),M1=t=>t.status==="aborted",D1=t=>t.status==="dirty",Rp=t=>t.status==="valid",Mp=t=>typeof Promise<"u"&&t instanceof Promise;function qy(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function vU(t,e,n,r,i){if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var nt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(nt||(nt={}));var Ah,_h;class ks{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,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 wI=(t,e)=>{if(Rp(e))return{success:!0,data:e.value};if(!t.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 Hi(t.common.issues);return this._error=n,this._error}}};function Ot(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,l)=>{var c,u;const{message:d}=t;return s.code==="invalid_enum_value"?{message:d??l.defaultError}:typeof l.data>"u"?{message:(c=d??r)!==null&&c!==void 0?c:l.defaultError}:s.code!=="invalid_type"?{message:l.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:l.defaultError}},description:i}}class Ut{constructor(e){this.spa=this.safeParseAsync,this._def=e,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(e){return Wa(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Wa(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new qr,ctx:{common:e.parent.common,data:e.data,parsedType:Wa(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Mp(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,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:e,parsedType:Wa(e)},o=this._parseSync({data:e,path:i.path,parent:i});return wI(i,o)}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,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:e,parsedType:Wa(e)},i=this._parse({data:e,path:r.path,parent:r}),o=await(Mp(i)?i:Promise.resolve(i));return wI(r,o)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const s=e(i),l=()=>o.addIssue({code:je.custom,...r(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(l(),!1)):s?!0:(l(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new Qo({schema:this,typeName:wt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Cs.create(this,this._def)}nullable(){return Dl.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fo.create(this,this._def)}promise(){return Rd.create(this,this._def)}or(e){return Fp.create([this,e],this._def)}and(e){return Up.create(this,e,this._def)}transform(e){return new Qo({...Ot(this._def),schema:this,typeName:wt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Gp({...Ot(this._def),innerType:this,defaultValue:n,typeName:wt.ZodDefault})}brand(){return new xN({typeName:wt.ZodBranded,type:this,...Ot(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Kp({...Ot(this._def),innerType:this,catchValue:n,typeName:wt.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Xm.create(this,e)}readonly(){return Wp.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const vie=/^c[^\s-]{8,}$/i,yie=/^[0-9a-z]+$/,xie=/^[0-9A-HJKMNP-TV-Z]{26}$/,bie=/^[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,wie=/^[a-z0-9_-]{21}$/i,Sie=/^[-+]?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)?)??$/,Cie=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Aie="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let pS;const _ie=/^(?:(?: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])$/,jie=/^(([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})))$/,Eie=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,yU="((\\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])))",Nie=new RegExp(`^${yU}$`);function xU(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Tie(t){return new RegExp(`^${xU(t)}$`)}function bU(t){let e=`${yU}T${xU(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Pie(t,e){return!!((e==="v4"||!e)&&_ie.test(t)||(e==="v6"||!e)&&jie.test(t))}class Io extends Ut{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ze.string){const o=this._getOrReturnCtx(e);return Ue(o,{code:je.invalid_type,expected:ze.string,received:o.parsedType}),At}const r=new qr;let i;for(const o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(i=this._getOrReturnCtx(e,i),Ue(i,{code:je.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const s=e.data.length>o.value,l=e.data.lengthe.test(i),{validation:n,code:je.invalid_string,...nt.errToObj(r)})}_addCheck(e){return new Io({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...nt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...nt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...nt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...nt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...nt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...nt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...nt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...nt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...nt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...nt.errToObj(e)})}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...nt.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...nt.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...nt.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...nt.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...nt.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...nt.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...nt.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...nt.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...nt.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...nt.errToObj(n)})}nonempty(e){return this.min(1,nt.errToObj(e))}trim(){return new Io({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Io({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Io({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value{var e;return new Io({checks:[],typeName:wt.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Ot(t)})};function kie(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(t.toFixed(i).replace(".","")),s=parseInt(e.toFixed(i).replace(".",""));return o%s/Math.pow(10,i)}class Il extends Ut{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ze.number){const o=this._getOrReturnCtx(e);return Ue(o,{code:je.invalid_type,expected:ze.number,received:o.parsedType}),At}let r;const i=new qr;for(const o of this._def.checks)o.kind==="int"?Wt.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{code:je.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),Ue(r,{code:je.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?kie(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),Ue(r,{code:je.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{code:je.not_finite,message:o.message}),i.dirty()):Wt.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,nt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,nt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,nt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,nt.toString(n))}setLimit(e,n,r,i){return new Il({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:nt.toString(i)}]})}_addCheck(e){return new Il({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:nt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:nt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:nt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:nt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:nt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:nt.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:nt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:nt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:nt.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuee.kind==="int"||e.kind==="multipleOf"&&Wt.isInteger(e.value))}get isFinite(){let e=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"&&(e===null||r.valuenew Il({checks:[],typeName:wt.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Ot(t)});class Rl extends Ut{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==ze.bigint){const o=this._getOrReturnCtx(e);return Ue(o,{code:je.invalid_type,expected:ze.bigint,received:o.parsedType}),At}let r;const i=new qr;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),Ue(r,{code:je.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Ue(r,{code:je.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Wt.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,nt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,nt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,nt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,nt.toString(n))}setLimit(e,n,r,i){return new Rl({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:nt.toString(i)}]})}_addCheck(e){return new Rl({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:nt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:nt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:nt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:nt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:nt.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value{var e;return new Rl({checks:[],typeName:wt.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Ot(t)})};class Dp extends Ut{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ze.boolean){const r=this._getOrReturnCtx(e);return Ue(r,{code:je.invalid_type,expected:ze.boolean,received:r.parsedType}),At}return li(e.data)}}Dp.create=t=>new Dp({typeName:wt.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Ot(t)});class Qc extends Ut{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ze.date){const o=this._getOrReturnCtx(e);return Ue(o,{code:je.invalid_type,expected:ze.date,received:o.parsedType}),At}if(isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return Ue(o,{code:je.invalid_date}),At}const r=new qr;let i;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(i=this._getOrReturnCtx(e,i),Ue(i,{code:je.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Wt.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Qc({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:nt.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:nt.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew Qc({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:wt.ZodDate,...Ot(t)});class Yy extends Ut{_parse(e){if(this._getType(e)!==ze.symbol){const r=this._getOrReturnCtx(e);return Ue(r,{code:je.invalid_type,expected:ze.symbol,received:r.parsedType}),At}return li(e.data)}}Yy.create=t=>new Yy({typeName:wt.ZodSymbol,...Ot(t)});class $p extends Ut{_parse(e){if(this._getType(e)!==ze.undefined){const r=this._getOrReturnCtx(e);return Ue(r,{code:je.invalid_type,expected:ze.undefined,received:r.parsedType}),At}return li(e.data)}}$p.create=t=>new $p({typeName:wt.ZodUndefined,...Ot(t)});class Lp extends Ut{_parse(e){if(this._getType(e)!==ze.null){const r=this._getOrReturnCtx(e);return Ue(r,{code:je.invalid_type,expected:ze.null,received:r.parsedType}),At}return li(e.data)}}Lp.create=t=>new Lp({typeName:wt.ZodNull,...Ot(t)});class Id extends Ut{constructor(){super(...arguments),this._any=!0}_parse(e){return li(e.data)}}Id.create=t=>new Id({typeName:wt.ZodAny,...Ot(t)});class Pc extends Ut{constructor(){super(...arguments),this._unknown=!0}_parse(e){return li(e.data)}}Pc.create=t=>new Pc({typeName:wt.ZodUnknown,...Ot(t)});class ba extends Ut{_parse(e){const n=this._getOrReturnCtx(e);return Ue(n,{code:je.invalid_type,expected:ze.never,received:n.parsedType}),At}}ba.create=t=>new ba({typeName:wt.ZodNever,...Ot(t)});class Qy extends Ut{_parse(e){if(this._getType(e)!==ze.undefined){const r=this._getOrReturnCtx(e);return Ue(r,{code:je.invalid_type,expected:ze.void,received:r.parsedType}),At}return li(e.data)}}Qy.create=t=>new Qy({typeName:wt.ZodVoid,...Ot(t)});class Fo extends Ut{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==ze.array)return Ue(n,{code:je.invalid_type,expected:ze.array,received:n.parsedType}),At;if(i.exactLength!==null){const s=n.data.length>i.exactLength.value,l=n.data.lengthi.maxLength.value&&(Ue(n,{code:je.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((s,l)=>i.type._parseAsync(new ks(n,s,n.path,l)))).then(s=>qr.mergeArray(r,s));const o=[...n.data].map((s,l)=>i.type._parseSync(new ks(n,s,n.path,l)));return qr.mergeArray(r,o)}get element(){return this._def.type}min(e,n){return new Fo({...this._def,minLength:{value:e,message:nt.toString(n)}})}max(e,n){return new Fo({...this._def,maxLength:{value:e,message:nt.toString(n)}})}length(e,n){return new Fo({...this._def,exactLength:{value:e,message:nt.toString(n)}})}nonempty(e){return this.min(1,e)}}Fo.create=(t,e)=>new Fo({type:t,minLength:null,maxLength:null,exactLength:null,typeName:wt.ZodArray,...Ot(e)});function Tu(t){if(t instanceof Mn){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Cs.create(Tu(r))}return new Mn({...t._def,shape:()=>e})}else return t instanceof Fo?new Fo({...t._def,type:Tu(t.element)}):t instanceof Cs?Cs.create(Tu(t.unwrap())):t instanceof Dl?Dl.create(Tu(t.unwrap())):t instanceof Os?Os.create(t.items.map(e=>Tu(e))):t}class Mn extends Ut{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=Wt.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==ze.object){const u=this._getOrReturnCtx(e);return Ue(u,{code:je.invalid_type,expected:ze.object,received:u.parsedType}),At}const{status:r,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),l=[];if(!(this._def.catchall instanceof ba&&this._def.unknownKeys==="strip"))for(const u in i.data)s.includes(u)||l.push(u);const c=[];for(const u of s){const d=o[u],f=i.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new ks(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof ba){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&&(Ue(i,{code:je.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 ks(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=>qr.mergeObjectSync(r,u)):qr.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return nt.errToObj,new Mn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o,s,l;const c=(s=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(l=nt.errToObj(e).message)!==null&&l!==void 0?l:c}:{message:c}}}:{}})}strip(){return new Mn({...this._def,unknownKeys:"strip"})}passthrough(){return new Mn({...this._def,unknownKeys:"passthrough"})}extend(e){return new Mn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Mn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:wt.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Mn({...this._def,catchall:e})}pick(e){const n={};return Wt.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Mn({...this._def,shape:()=>n})}omit(e){const n={};return Wt.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new Mn({...this._def,shape:()=>n})}deepPartial(){return Tu(this)}partial(e){const n={};return Wt.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}),new Mn({...this._def,shape:()=>n})}required(e){const n={};return Wt.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Cs;)o=o._def.innerType;n[r]=o}}),new Mn({...this._def,shape:()=>n})}keyof(){return wU(Wt.objectKeys(this.shape))}}Mn.create=(t,e)=>new Mn({shape:()=>t,unknownKeys:"strip",catchall:ba.create(),typeName:wt.ZodObject,...Ot(e)});Mn.strictCreate=(t,e)=>new Mn({shape:()=>t,unknownKeys:"strict",catchall:ba.create(),typeName:wt.ZodObject,...Ot(e)});Mn.lazycreate=(t,e)=>new Mn({shape:t,unknownKeys:"strip",catchall:ba.create(),typeName:wt.ZodObject,...Ot(e)});class Fp extends Ut{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(o){for(const l of o)if(l.result.status==="valid")return l.result;for(const l of o)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const s=o.map(l=>new Hi(l.ctx.common.issues));return Ue(n,{code:je.invalid_union,unionErrors:s}),At}if(n.common.async)return Promise.all(r.map(async o=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(i);{let o;const s=[];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"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const l=s.map(c=>new Hi(c));return Ue(n,{code:je.invalid_union,unionErrors:l}),At}}get options(){return this._def.options}}Fp.create=(t,e)=>new Fp({options:t,typeName:wt.ZodUnion,...Ot(e)});const Vs=t=>t instanceof Hp?Vs(t.schema):t instanceof Qo?Vs(t.innerType()):t instanceof zp?[t.value]:t instanceof Ml?t.options:t instanceof Vp?Wt.objectValues(t.enum):t instanceof Gp?Vs(t._def.innerType):t instanceof $p?[void 0]:t instanceof Lp?[null]:t instanceof Cs?[void 0,...Vs(t.unwrap())]:t instanceof Dl?[null,...Vs(t.unwrap())]:t instanceof xN||t instanceof Wp?Vs(t.unwrap()):t instanceof Kp?Vs(t._def.innerType):[];class m0 extends Ut{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ze.object)return Ue(n,{code:je.invalid_type,expected:ze.object,received:n.parsedType}),At;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(Ue(n,{code:je.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),At)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const i=new Map;for(const o of n){const s=Vs(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const l of s){if(i.has(l))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);i.set(l,o)}}return new m0({typeName:wt.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...Ot(r)})}}function $1(t,e){const n=Wa(t),r=Wa(e);if(t===e)return{valid:!0,data:t};if(n===ze.object&&r===ze.object){const i=Wt.objectKeys(e),o=Wt.objectKeys(t).filter(l=>i.indexOf(l)!==-1),s={...t,...e};for(const l of o){const c=$1(t[l],e[l]);if(!c.valid)return{valid:!1};s[l]=c.data}return{valid:!0,data:s}}else if(n===ze.array&&r===ze.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let o=0;o{if(M1(o)||M1(s))return At;const l=$1(o.value,s.value);return l.valid?((D1(o)||D1(s))&&n.dirty(),{status:n.value,value:l.data}):(Ue(r,{code:je.invalid_intersection_types}),At)};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(([o,s])=>i(o,s)):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}))}}Up.create=(t,e,n)=>new Up({left:t,right:e,typeName:wt.ZodIntersection,...Ot(n)});class Os extends Ut{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ze.array)return Ue(r,{code:je.invalid_type,expected:ze.array,received:r.parsedType}),At;if(r.data.lengththis._def.items.length&&(Ue(r,{code:je.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((s,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new ks(r,s,r.path,l)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>qr.mergeArray(n,s)):qr.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new Os({...this._def,rest:e})}}Os.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Os({items:t,typeName:wt.ZodTuple,rest:null,...Ot(e)})};class Bp extends Ut{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ze.object)return Ue(r,{code:je.invalid_type,expected:ze.object,received:r.parsedType}),At;const i=[],o=this._def.keyType,s=this._def.valueType;for(const l in r.data)i.push({key:o._parse(new ks(r,l,r.path,l)),value:s._parse(new ks(r,r.data[l],r.path,l)),alwaysSet:l in r.data});return r.common.async?qr.mergeObjectAsync(n,i):qr.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Ut?new Bp({keyType:e,valueType:n,typeName:wt.ZodRecord,...Ot(r)}):new Bp({keyType:Io.create(),valueType:e,typeName:wt.ZodRecord,...Ot(n)})}}class Xy extends Ut{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ze.map)return Ue(r,{code:je.invalid_type,expected:ze.map,received:r.parsedType}),At;const i=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([l,c],u)=>({key:i._parse(new ks(r,l,r.path,[u,"key"])),value:o._parse(new ks(r,c,r.path,[u,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of s){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return At;(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 s){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return At;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}}}}Xy.create=(t,e,n)=>new Xy({valueType:e,keyType:t,typeName:wt.ZodMap,...Ot(n)});class Xc extends Ut{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ze.set)return Ue(r,{code:je.invalid_type,expected:ze.set,received:r.parsedType}),At;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(Ue(r,{code:je.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function s(c){const u=new Set;for(const d of c){if(d.status==="aborted")return At;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const l=[...r.data.values()].map((c,u)=>o._parse(new ks(r,c,r.path,u)));return r.common.async?Promise.all(l).then(c=>s(c)):s(l)}min(e,n){return new Xc({...this._def,minSize:{value:e,message:nt.toString(n)}})}max(e,n){return new Xc({...this._def,maxSize:{value:e,message:nt.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Xc.create=(t,e)=>new Xc({valueType:t,minSize:null,maxSize:null,typeName:wt.ZodSet,...Ot(e)});class od extends Ut{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ze.function)return Ue(n,{code:je.invalid_type,expected:ze.function,received:n.parsedType}),At;function r(l,c){return Wy({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ky(),Od].filter(u=>!!u),issueData:{code:je.invalid_arguments,argumentsError:c}})}function i(l,c){return Wy({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ky(),Od].filter(u=>!!u),issueData:{code:je.invalid_return_type,returnTypeError:c}})}const o={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Rd){const l=this;return li(async function(...c){const u=new Hi([]),d=await l._def.args.parseAsync(c,o).catch(p=>{throw u.addIssue(r(c,p)),u}),f=await Reflect.apply(s,this,d);return await l._def.returns._def.type.parseAsync(f,o).catch(p=>{throw u.addIssue(i(f,p)),u})})}else{const l=this;return li(function(...c){const u=l._def.args.safeParse(c,o);if(!u.success)throw new Hi([r(c,u.error)]);const d=Reflect.apply(s,this,u.data),f=l._def.returns.safeParse(d,o);if(!f.success)throw new Hi([i(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new od({...this._def,args:Os.create(e).rest(Pc.create())})}returns(e){return new od({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new od({args:e||Os.create([]).rest(Pc.create()),returns:n||Pc.create(),typeName:wt.ZodFunction,...Ot(r)})}}class Hp extends Ut{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Hp.create=(t,e)=>new Hp({getter:t,typeName:wt.ZodLazy,...Ot(e)});class zp extends Ut{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Ue(n,{received:n.data,code:je.invalid_literal,expected:this._def.value}),At}return{status:"valid",value:e.data}}get value(){return this._def.value}}zp.create=(t,e)=>new zp({value:t,typeName:wt.ZodLiteral,...Ot(e)});function wU(t,e){return new Ml({values:t,typeName:wt.ZodEnum,...Ot(e)})}class Ml extends Ut{constructor(){super(...arguments),Ah.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return Ue(n,{expected:Wt.joinValues(r),received:n.parsedType,code:je.invalid_type}),At}if(qy(this,Ah)||vU(this,Ah,new Set(this._def.values)),!qy(this,Ah).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return Ue(n,{received:n.data,code:je.invalid_enum_value,options:r}),At}return li(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Ml.create(e,{...this._def,...n})}exclude(e,n=this._def){return Ml.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Ah=new WeakMap;Ml.create=wU;class Vp extends Ut{constructor(){super(...arguments),_h.set(this,void 0)}_parse(e){const n=Wt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ze.string&&r.parsedType!==ze.number){const i=Wt.objectValues(n);return Ue(r,{expected:Wt.joinValues(i),received:r.parsedType,code:je.invalid_type}),At}if(qy(this,_h)||vU(this,_h,new Set(Wt.getValidEnumValues(this._def.values))),!qy(this,_h).has(e.data)){const i=Wt.objectValues(n);return Ue(r,{received:r.data,code:je.invalid_enum_value,options:i}),At}return li(e.data)}get enum(){return this._def.values}}_h=new WeakMap;Vp.create=(t,e)=>new Vp({values:t,typeName:wt.ZodNativeEnum,...Ot(e)});class Rd extends Ut{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ze.promise&&n.common.async===!1)return Ue(n,{code:je.invalid_type,expected:ze.promise,received:n.parsedType}),At;const r=n.parsedType===ze.promise?n.data:Promise.resolve(n.data);return li(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Rd.create=(t,e)=>new Rd({type:t,typeName:wt.ZodPromise,...Ot(e)});class Qo extends Ut{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===wt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{Ue(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const s=i.transform(r.data,o);if(r.common.async)return Promise.resolve(s).then(async l=>{if(n.value==="aborted")return At;const c=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return c.status==="aborted"?At:c.status==="dirty"||n.value==="dirty"?Hu(c.value):c});{if(n.value==="aborted")return At;const l=this._def.schema._parseSync({data:s,path:r.path,parent:r});return l.status==="aborted"?At:l.status==="dirty"||n.value==="dirty"?Hu(l.value):l}}if(i.type==="refinement"){const s=l=>{const c=i.refinement(l,o);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"?At:(l.status==="dirty"&&n.dirty(),s(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"?At:(l.status==="dirty"&&n.dirty(),s(l.value).then(()=>({status:n.value,value:l.value}))))}if(i.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Rp(s))return s;const l=i.transform(s.value,o);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(s=>Rp(s)?Promise.resolve(i.transform(s.value,o)).then(l=>({status:n.value,value:l})):s);Wt.assertNever(i)}}Qo.create=(t,e,n)=>new Qo({schema:t,typeName:wt.ZodEffects,effect:e,...Ot(n)});Qo.createWithPreprocess=(t,e,n)=>new Qo({schema:e,effect:{type:"preprocess",transform:t},typeName:wt.ZodEffects,...Ot(n)});class Cs extends Ut{_parse(e){return this._getType(e)===ze.undefined?li(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Cs.create=(t,e)=>new Cs({innerType:t,typeName:wt.ZodOptional,...Ot(e)});class Dl extends Ut{_parse(e){return this._getType(e)===ze.null?li(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Dl.create=(t,e)=>new Dl({innerType:t,typeName:wt.ZodNullable,...Ot(e)});class Gp extends Ut{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===ze.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Gp.create=(t,e)=>new Gp({innerType:t,typeName:wt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ot(e)});class Kp extends Ut{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Mp(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Hi(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Hi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Kp.create=(t,e)=>new Kp({innerType:t,typeName:wt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ot(e)});class Zy extends Ut{_parse(e){if(this._getType(e)!==ze.nan){const r=this._getOrReturnCtx(e);return Ue(r,{code:je.invalid_type,expected:ze.nan,received:r.parsedType}),At}return{status:"valid",value:e.data}}}Zy.create=t=>new Zy({typeName:wt.ZodNaN,...Ot(t)});const Oie=Symbol("zod_brand");class xN extends Ut{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Xm extends Ut{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?At:o.status==="dirty"?(n.dirty(),Hu(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?At:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new Xm({in:e,out:n,typeName:wt.ZodPipeline})}}class Wp extends Ut{_parse(e){const n=this._def.innerType._parse(e),r=i=>(Rp(i)&&(i.value=Object.freeze(i.value)),i);return Mp(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Wp.create=(t,e)=>new Wp({innerType:t,typeName:wt.ZodReadonly,...Ot(e)});function SU(t,e={},n){return t?Id.create().superRefine((r,i)=>{var o,s;if(!t(r)){const l=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,c=(s=(o=l.fatal)!==null&&o!==void 0?o:n)!==null&&s!==void 0?s:!0,u=typeof l=="string"?{message:l}:l;i.addIssue({code:"custom",...u,fatal:c})}}):Id.create()}const Iie={object:Mn.lazycreate};var wt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(wt||(wt={}));const Rie=(t,e={message:`Input not instance of ${t.name}`})=>SU(n=>n instanceof t,e),CU=Io.create,AU=Il.create,Mie=Zy.create,Die=Rl.create,_U=Dp.create,$ie=Qc.create,Lie=Yy.create,Fie=$p.create,Uie=Lp.create,Bie=Id.create,Hie=Pc.create,zie=ba.create,Vie=Qy.create,Gie=Fo.create,Kie=Mn.create,Wie=Mn.strictCreate,qie=Fp.create,Yie=m0.create,Qie=Up.create,Xie=Os.create,Zie=Bp.create,Jie=Xy.create,eoe=Xc.create,toe=od.create,noe=Hp.create,roe=zp.create,ioe=Ml.create,ooe=Vp.create,soe=Rd.create,SI=Qo.create,aoe=Cs.create,loe=Dl.create,coe=Qo.createWithPreprocess,uoe=Xm.create,doe=()=>CU().optional(),foe=()=>AU().optional(),hoe=()=>_U().optional(),poe={string:t=>Io.create({...t,coerce:!0}),number:t=>Il.create({...t,coerce:!0}),boolean:t=>Dp.create({...t,coerce:!0}),bigint:t=>Rl.create({...t,coerce:!0}),date:t=>Qc.create({...t,coerce:!0})},moe=At;var Ie=Object.freeze({__proto__:null,defaultErrorMap:Od,setErrorMap:mie,getErrorMap:Ky,makeIssue:Wy,EMPTY_PATH:gie,addIssueToContext:Ue,ParseStatus:qr,INVALID:At,DIRTY:Hu,OK:li,isAborted:M1,isDirty:D1,isValid:Rp,isAsync:Mp,get util(){return Wt},get objectUtil(){return R1},ZodParsedType:ze,getParsedType:Wa,ZodType:Ut,datetimeRegex:bU,ZodString:Io,ZodNumber:Il,ZodBigInt:Rl,ZodBoolean:Dp,ZodDate:Qc,ZodSymbol:Yy,ZodUndefined:$p,ZodNull:Lp,ZodAny:Id,ZodUnknown:Pc,ZodNever:ba,ZodVoid:Qy,ZodArray:Fo,ZodObject:Mn,ZodUnion:Fp,ZodDiscriminatedUnion:m0,ZodIntersection:Up,ZodTuple:Os,ZodRecord:Bp,ZodMap:Xy,ZodSet:Xc,ZodFunction:od,ZodLazy:Hp,ZodLiteral:zp,ZodEnum:Ml,ZodNativeEnum:Vp,ZodPromise:Rd,ZodEffects:Qo,ZodTransformer:Qo,ZodOptional:Cs,ZodNullable:Dl,ZodDefault:Gp,ZodCatch:Kp,ZodNaN:Zy,BRAND:Oie,ZodBranded:xN,ZodPipeline:Xm,ZodReadonly:Wp,custom:SU,Schema:Ut,ZodSchema:Ut,late:Iie,get ZodFirstPartyTypeKind(){return wt},coerce:poe,any:Bie,array:Gie,bigint:Die,boolean:_U,date:$ie,discriminatedUnion:Yie,effect:SI,enum:ioe,function:toe,instanceof:Rie,intersection:Qie,lazy:noe,literal:roe,map:Jie,nan:Mie,nativeEnum:ooe,never:zie,null:Uie,nullable:loe,number:AU,object:Kie,oboolean:hoe,onumber:foe,optional:aoe,ostring:doe,pipeline:uoe,preprocess:coe,promise:soe,record:Zie,set:eoe,strictObject:Wie,string:CU,symbol:Lie,transformer:SI,tuple:Xie,undefined:Fie,union:qie,unknown:Hie,void:Vie,NEVER:moe,ZodIssueCode:je,quotelessJson:pie,ZodError:Hi}),goe="Label",jU=y.forwardRef((t,e)=>a.jsx(et.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));jU.displayName=goe;var EU=jU;const voe=uN("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),to=y.forwardRef(({className:t,...e},n)=>a.jsx(EU,{ref:n,className:ke(voe(),t),...e}));to.displayName=EU.displayName;const g0=Yre,NU=y.createContext({}),dt=({...t})=>a.jsx(NU.Provider,{value:{name:t.name},children:a.jsx(Jre,{...t})}),v0=()=>{const t=y.useContext(NU),e=y.useContext(TU),{getFieldState:n,formState:r}=f0(),i=n(t.name,r);if(!t)throw new Error("useFormField should be used within ");const{id:o}=e;return{id:o,name:t.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...i}},TU=y.createContext({}),ot=y.forwardRef(({className:t,...e},n)=>{const r=y.useId();return a.jsx(TU.Provider,{value:{id:r},children:a.jsx("div",{ref:n,className:ke("space-y-2",t),...e})})});ot.displayName="FormItem";const st=y.forwardRef(({className:t,...e},n)=>{const{error:r,formItemId:i}=v0();return a.jsx(to,{ref:n,className:ke(r&&"text-destructive",t),htmlFor:i,...e})});st.displayName="FormLabel";const at=y.forwardRef(({...t},e)=>{const{error:n,formItemId:r,formDescriptionId:i,formMessageId:o}=v0();return a.jsx(Es,{ref:e,id:r,"aria-describedby":n?`${i} ${o}`:`${i}`,"aria-invalid":!!n,...t})});at.displayName="FormControl";const xn=y.forwardRef(({className:t,...e},n)=>{const{formDescriptionId:r}=v0();return a.jsx("p",{ref:n,id:r,className:ke("text-sm text-muted-foreground",t),...e})});xn.displayName="FormDescription";const lt=y.forwardRef(({className:t,children:e,...n},r)=>{const{error:i,formMessageId:o}=v0(),s=i?String(i==null?void 0:i.message):e;return s?a.jsx("p",{ref:r,id:o,className:ke("text-sm font-medium text-destructive",t),...n,children:s}):null});lt.displayName="FormMessage";const Dt=y.forwardRef(({className:t,type:e,...n},r)=>a.jsx("input",{type:e,className:ke("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",t),ref:r,...n}));Dt.displayName="Input";const ct=y.forwardRef(({className:t,...e},n)=>a.jsx("textarea",{className:ke("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",t),ref:n,...e}));ct.displayName="Textarea";function qp(t,[e,n]){return Math.min(n,Math.max(e,t))}function yoe(t,e=[]){let n=[];function r(o,s){const l=y.createContext(s),c=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][c])||l,v=y.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:v,children:p})}function d(f,h){const p=(h==null?void 0:h[t][c])||l,g=y.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>y.createContext(s));return function(l){const c=(l==null?void 0:l[t])||o;return y.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,xoe(i,...e)]}function xoe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(o)[`__scope${u}`];return{...l,...f}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}function y0(t){const e=t+"CollectionProvider",[n,r]=yoe(e),[i,o]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:g,children:m}=p,v=T.useRef(null),b=T.useRef(new Map).current;return a.jsx(i,{scope:g,itemMap:b,collectionRef:v,children:m})};s.displayName=e;const l=t+"CollectionSlot",c=T.forwardRef((p,g)=>{const{scope:m,children:v}=p,b=o(l,m),x=_t(g,b.collectionRef);return a.jsx(Es,{ref:x,children:v})});c.displayName=l;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=T.forwardRef((p,g)=>{const{scope:m,children:v,...b}=p,x=T.useRef(null),w=_t(g,x),S=o(u,m);return T.useEffect(()=>(S.itemMap.set(x,{ref:x,...b}),()=>void S.itemMap.delete(x))),a.jsx(Es,{[d]:"",ref:w,children:v})});f.displayName=u;function h(p){const g=o(t+"CollectionConsumer",p);return T.useCallback(()=>{const v=g.collectionRef.current;if(!v)return[];const b=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((S,C)=>b.indexOf(S.ref.current)-b.indexOf(C.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:c,ItemSlot:f},h,r]}var boe=y.createContext(void 0);function uu(t){const e=y.useContext(boe);return t||e||"ltr"}var mS=0;function bN(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??CI()),document.body.insertAdjacentElement("beforeend",t[1]??CI()),mS++,()=>{mS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),mS--}},[])}function CI(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var gS="focusScope.autoFocusOnMount",vS="focusScope.autoFocusOnUnmount",AI={bubbles:!1,cancelable:!0},woe="FocusScope",x0=y.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=t,[l,c]=y.useState(null),u=dr(i),d=dr(o),f=y.useRef(null),h=_t(e,m=>c(m)),p=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let m=function(w){if(p.paused||!l)return;const S=w.target;l.contains(S)?f.current=S:$a(f.current,{select:!0})},v=function(w){if(p.paused||!l)return;const S=w.relatedTarget;S!==null&&(l.contains(S)||$a(f.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&$a(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",v);const x=new MutationObserver(b);return l&&x.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",v),x.disconnect()}}},[r,l,p.paused]),y.useEffect(()=>{if(l){jI.add(p);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(gS,AI);l.addEventListener(gS,u),l.dispatchEvent(b),b.defaultPrevented||(Soe(Eoe(PU(l)),{select:!0}),document.activeElement===m&&$a(l))}return()=>{l.removeEventListener(gS,u),setTimeout(()=>{const b=new CustomEvent(vS,AI);l.addEventListener(vS,d),l.dispatchEvent(b),b.defaultPrevented||$a(m??document.body,{select:!0}),l.removeEventListener(vS,d),jI.remove(p)},0)}}},[l,u,d,p]);const g=y.useCallback(m=>{if(!n&&!r||p.paused)return;const v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(v&&b){const x=m.currentTarget,[w,S]=Coe(x);w&&S?!m.shiftKey&&b===S?(m.preventDefault(),n&&$a(w,{select:!0})):m.shiftKey&&b===w&&(m.preventDefault(),n&&$a(S,{select:!0})):b===x&&m.preventDefault()}},[n,r,p.paused]);return a.jsx(et.div,{tabIndex:-1,...s,ref:h,onKeyDown:g})});x0.displayName=woe;function Soe(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if($a(r,{select:e}),document.activeElement!==n)return}function Coe(t){const e=PU(t),n=_I(e,t),r=_I(e.reverse(),t);return[n,r]}function PU(t){const e=[],n=document.createTreeWalker(t,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();)e.push(n.currentNode);return e}function _I(t,e){for(const n of t)if(!Aoe(n,{upTo:e}))return n}function Aoe(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function _oe(t){return t instanceof HTMLInputElement&&"select"in t}function $a(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&_oe(t)&&e&&t.select()}}var jI=joe();function joe(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=EI(t,e),t.unshift(e)},remove(e){var n;t=EI(t,e),(n=t[0])==null||n.resume()}}}function EI(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function Eoe(t){return t.filter(e=>e.tagName!=="A")}function Zm(t){const e=y.useRef({value:t,previous:t});return y.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Noe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},bu=new WeakMap,Wg=new WeakMap,qg={},yS=0,kU=function(t){return t&&(t.host||kU(t.parentNode))},Toe=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=kU(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},Poe=function(t,e,n,r){var i=Toe(e,Array.isArray(t)?t:[t]);qg[n]||(qg[n]=new WeakMap);var o=qg[n],s=[],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=(bu.get(h)||0)+1,v=(o.get(h)||0)+1;bu.set(h,m),o.set(h,v),s.push(h),m===1&&g&&Wg.set(h,!0),v===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(e),l.clear(),yS++,function(){s.forEach(function(f){var h=bu.get(f)-1,p=o.get(f)-1;bu.set(f,h),o.set(f,p),h||(Wg.has(f)||f.removeAttribute(r),Wg.delete(f)),p||f.removeAttribute(n)}),yS--,yS||(bu=new WeakMap,bu=new WeakMap,Wg=new WeakMap,qg={})}},wN=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=Noe(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),Poe(r,i,n,"aria-hidden")):function(){return null}},ms=function(){return ms=Object.assign||function(e){for(var n,r=1,i=arguments.length;r"u")return Woe;var e=qoe(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},Qoe=MU(),sd="data-scroll-locked",Xoe=function(t,e,n,r){var i=t.left,o=t.top,s=t.right,l=t.gap;return n===void 0&&(n="margin"),` - .`.concat(Ooe,` { +Defaulting to \`null\`.`}var X5=W5,Gre=Y5;const mc=y.forwardRef(({className:t,value:e,...n},r)=>a.jsx(X5,{ref:r,className:Pe("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...n,children:a.jsx(Gre,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));mc.displayName=X5.displayName;var Ym=t=>t.type==="checkbox",gc=t=>t instanceof Date,ti=t=>t==null;const J5=t=>typeof t=="object";var Qn=t=>!ti(t)&&!Array.isArray(t)&&J5(t)&&!gc(t),Z5=t=>Qn(t)&&t.target?Ym(t.target)?t.target.checked:t.target.value:t,Kre=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,eU=(t,e)=>t.has(Kre(e)),Wre=t=>{const e=t.constructor&&t.constructor.prototype;return Qn(e)&&e.hasOwnProperty("isPrototypeOf")},hN=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function fi(t){let e;const n=Array.isArray(t);if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(hN&&(t instanceof Blob||t instanceof FileList))&&(n||Qn(t)))if(e=n?[]:{},!n&&!Wre(t))e=t;else for(const r in t)t.hasOwnProperty(r)&&(e[r]=fi(t[r]));else return t;return e}var u0=t=>Array.isArray(t)?t.filter(Boolean):[],zn=t=>t===void 0,Ie=(t,e,n)=>{if(!e||!Qn(t))return n;const r=u0(e.split(/[,[\].]+?/)).reduce((i,o)=>ti(i)?i:i[o],t);return zn(r)||r===t?zn(t[e])?n:t[e]:r},eo=t=>typeof t=="boolean",pN=t=>/^\w*$/.test(t),tU=t=>u0(t.replace(/["|']|\]/g,"").split(/\.|\[/)),rn=(t,e,n)=>{let r=-1;const i=pN(e)?[e]:tU(e),o=i.length,s=o-1;for(;++rT.useContext(nU),qre=t=>{const{children:e,...n}=t;return T.createElement(nU.Provider,{value:n},e)};var rU=(t,e,n,r=!0)=>{const i={defaultValues:e._defaultValues};for(const o in t)Object.defineProperty(i,o,{get:()=>{const s=o;return e._proxyFormState[s]!==Po.all&&(e._proxyFormState[s]=!r||Po.all),n&&(n[s]=!0),t[s]}});return i},hi=t=>Qn(t)&&!Object.keys(t).length,iU=(t,e,n,r)=>{n(t);const{name:i,...o}=t;return hi(o)||Object.keys(o).length>=Object.keys(e).length||Object.keys(o).find(s=>e[s]===(!r||Po.all))},Vh=t=>Array.isArray(t)?t:[t],oU=(t,e,n)=>!t||!e||t===e||Vh(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r)));function mN(t){const e=T.useRef(t);e.current=t,T.useEffect(()=>{const n=!t.disabled&&e.current.subject&&e.current.subject.subscribe({next:e.current.next});return()=>{n&&n.unsubscribe()}},[t.disabled])}function Yre(t){const e=d0(),{control:n=e.control,disabled:r,name:i,exact:o}=t||{},[s,l]=T.useState(n._formState),c=T.useRef(!0),u=T.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=T.useRef(i);return d.current=i,mN({disabled:r,next:f=>c.current&&oU(d.current,f.name,o)&&iU(f,u.current,n._updateFormState)&&l({...n._formState,...f}),subject:n._subjects.state}),T.useEffect(()=>(c.current=!0,u.current.isValid&&n._updateValid(!0),()=>{c.current=!1}),[n]),rU(s,n,u.current,!1)}var gs=t=>typeof t=="string",sU=(t,e,n,r,i)=>gs(t)?(r&&e.watch.add(t),Ie(n,t,i)):Array.isArray(t)?t.map(o=>(r&&e.watch.add(o),Ie(n,o))):(r&&(e.watchAll=!0),n);function Qre(t){const e=d0(),{control:n=e.control,name:r,defaultValue:i,disabled:o,exact:s}=t||{},l=T.useRef(r);l.current=r,mN({disabled:o,subject:n._subjects.values,next:d=>{oU(l.current,d.name,s)&&u(fi(sU(l.current,n._names,d.values||n._formValues,!1,i)))}});const[c,u]=T.useState(n._getWatch(r,i));return T.useEffect(()=>n._removeUnmounted()),c}function Xre(t){const e=d0(),{name:n,disabled:r,control:i=e.control,shouldUnregister:o}=t,s=eU(i._names.array,n),l=Qre({control:i,name:n,defaultValue:Ie(i._formValues,n,Ie(i._defaultValues,n,t.defaultValue)),exact:!0}),c=Yre({control:i,name:n,exact:!0}),u=T.useRef(i.register(n,{...t.rules,value:l,...eo(t.disabled)?{disabled:t.disabled}:{}}));return T.useEffect(()=>{const d=i._options.shouldUnregister||o,f=(h,p)=>{const g=Ie(i._fields,h);g&&g._f&&(g._f.mount=p)};if(f(n,!0),d){const h=fi(Ie(i._options.defaultValues,n));rn(i._defaultValues,n,h),zn(Ie(i._formValues,n))&&rn(i._formValues,n,h)}return()=>{(s?d&&!i._state.action:d)?i.unregister(n):f(n,!1)}},[n,i,s,o]),T.useEffect(()=>{Ie(i._fields,n)&&i._updateDisabledField({disabled:r,fields:i._fields,name:n,value:Ie(i._fields,n)._f.value})},[r,n,i]),{field:{name:n,value:l,...eo(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:T.useCallback(d=>u.current.onChange({target:{value:Z5(d),name:n},type:By.CHANGE}),[n]),onBlur:T.useCallback(()=>u.current.onBlur({target:{value:Ie(i._formValues,n),name:n},type:By.BLUR}),[n,i]),ref:T.useCallback(d=>{const f=Ie(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:()=>!!Ie(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!Ie(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Ie(c.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Ie(c.validatingFields,n)},error:{enumerable:!0,get:()=>Ie(c.errors,n)}})}}const Jre=t=>t.render(Xre(t));var aU=(t,e,n,r,i)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:i||!0}}:{},uI=t=>({isOnSubmit:!t||t===Po.onSubmit,isOnBlur:t===Po.onBlur,isOnChange:t===Po.onChange,isOnAll:t===Po.all,isOnTouch:t===Po.onTouched}),dI=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const Gh=(t,e,n,r)=>{for(const i of n||Object.keys(t)){const o=Ie(t,i);if(o){const{_f:s,...l}=o;if(s){if(s.refs&&s.refs[0]&&e(s.refs[0],i)&&!r)return!0;if(s.ref&&e(s.ref,s.name)&&!r)return!0;if(Gh(l,e))break}else if(Qn(l)&&Gh(l,e))break}}};var Zre=(t,e,n)=>{const r=Vh(Ie(t,n));return rn(r,"root",e[n]),rn(t,n,r),t},gN=t=>t.type==="file",na=t=>typeof t=="function",Hy=t=>{if(!hN)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},Ov=t=>gs(t),vN=t=>t.type==="radio",zy=t=>t instanceof RegExp;const fI={value:!1,isValid:!1},hI={value:!0,isValid:!0};var lU=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!zn(t[0].attributes.value)?zn(t[0].value)||t[0].value===""?hI:{value:t[0].value,isValid:!0}:hI:fI}return fI};const pI={isValid:!1,value:null};var cU=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,pI):pI;function mI(t,e,n="validate"){if(Ov(t)||Array.isArray(t)&&t.every(Ov)||eo(t)&&!t)return{type:n,message:Ov(t)?t:"",ref:e}}var xu=t=>Qn(t)&&!zy(t)?t:{value:t,message:""},gI=async(t,e,n,r,i)=>{const{ref:o,refs:s,required:l,maxLength:c,minLength:u,min:d,max:f,pattern:h,validate:p,name:g,valueAsNumber:m,mount:v,disabled:b}=t._f,x=Ie(e,g);if(!v||b)return{};const w=s?s[0]:o,S=E=>{r&&w.reportValidity&&(w.setCustomValidity(eo(E)?"":E||""),w.reportValidity())},C={},A=vN(o),_=Ym(o),j=A||_,k=(m||gN(o))&&zn(o.value)&&zn(x)||Hy(o)&&o.value===""||x===""||Array.isArray(x)&&!x.length,P=aU.bind(null,g,n,C),I=(E,R,L,V=Bs.maxLength,$=Bs.minLength)=>{const z=E?R:L;C[g]={type:E?V:$,message:z,ref:o,...P(E?V:$,z)}};if(i?!Array.isArray(x)||!x.length:l&&(!j&&(k||ti(x))||eo(x)&&!x||_&&!lU(s).isValid||A&&!cU(s).isValid)){const{value:E,message:R}=Ov(l)?{value:!!l,message:l}:xu(l);if(E&&(C[g]={type:Bs.required,message:R,ref:w,...P(Bs.required,R)},!n))return S(R),C}if(!k&&(!ti(d)||!ti(f))){let E,R;const L=xu(f),V=xu(d);if(!ti(x)&&!isNaN(x)){const $=o.valueAsNumber||x&&+x;ti(L.value)||(E=$>L.value),ti(V.value)||(R=$new Date(new Date().toDateString()+" "+W),M=o.type=="time",U=o.type=="week";gs(L.value)&&x&&(E=M?z(x)>z(L.value):U?x>L.value:$>new Date(L.value)),gs(V.value)&&x&&(R=M?z(x)+E.value,V=!ti(R.value)&&x.length<+R.value;if((L||V)&&(I(L,E.message,R.message),!n))return S(C[g].message),C}if(h&&!k&&gs(x)){const{value:E,message:R}=xu(h);if(zy(E)&&!x.match(E)&&(C[g]={type:Bs.pattern,message:R,ref:o,...P(Bs.pattern,R)},!n))return S(R),C}if(p){if(na(p)){const E=await p(x,e),R=mI(E,w);if(R&&(C[g]={...R,...P(Bs.validate,R.message)},!n))return S(R.message),C}else if(Qn(p)){let E={};for(const R in p){if(!hi(E)&&!n)break;const L=mI(await p[R](x,e),w,R);L&&(E={...L,...P(R,L.message)},S(L.message),n&&(C[g]=E))}if(!hi(E)&&(C[g]={ref:w,...E},!n))return C}}return S(!0),C};function eie(t,e){const n=e.slice(0,-1).length;let r=0;for(;r{let t=[];return{get observers(){return t},next:i=>{for(const o of t)o.next&&o.next(i)},subscribe:i=>(t.push(i),{unsubscribe:()=>{t=t.filter(o=>o!==i)}}),unsubscribe:()=>{t=[]}}},O1=t=>ti(t)||!J5(t);function Ka(t,e){if(O1(t)||O1(e))return t===e;if(gc(t)&&gc(e))return t.getTime()===e.getTime();const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const i of n){const o=t[i];if(!r.includes(i))return!1;if(i!=="ref"){const s=e[i];if(gc(o)&&gc(s)||Qn(o)&&Qn(s)||Array.isArray(o)&&Array.isArray(s)?!Ka(o,s):o!==s)return!1}}return!0}var uU=t=>t.type==="select-multiple",nie=t=>vN(t)||Ym(t),dS=t=>Hy(t)&&t.isConnected,dU=t=>{for(const e in t)if(na(t[e]))return!0;return!1};function Vy(t,e={}){const n=Array.isArray(t);if(Qn(t)||n)for(const r in t)Array.isArray(t[r])||Qn(t[r])&&!dU(t[r])?(e[r]=Array.isArray(t[r])?[]:{},Vy(t[r],e[r])):ti(t[r])||(e[r]=!0);return e}function fU(t,e,n){const r=Array.isArray(t);if(Qn(t)||r)for(const i in t)Array.isArray(t[i])||Qn(t[i])&&!dU(t[i])?zn(e)||O1(n[i])?n[i]=Array.isArray(t[i])?Vy(t[i],[]):{...Vy(t[i])}:fU(t[i],ti(e)?{}:e[i],n[i]):n[i]=!Ka(t[i],e[i]);return n}var ih=(t,e)=>fU(t,e,Vy(e)),hU=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>zn(t)?t:e?t===""?NaN:t&&+t:n&&gs(t)?new Date(t):r?r(t):t;function fS(t){const e=t.ref;if(!(t.refs?t.refs.every(n=>n.disabled):e.disabled))return gN(e)?e.files:vN(e)?cU(t.refs).value:uU(e)?[...e.selectedOptions].map(({value:n})=>n):Ym(e)?lU(t.refs).value:hU(zn(e.value)?t.ref.value:e.value,t)}var rie=(t,e,n,r)=>{const i={};for(const o of t){const s=Ie(e,o);s&&rn(i,o,s._f)}return{criteriaMode:n,names:[...t],fields:i,shouldUseNativeValidation:r}},oh=t=>zn(t)?t:zy(t)?t.source:Qn(t)?zy(t.value)?t.value.source:t.value:t;const vI="AsyncFunction";var iie=t=>(!t||!t.validate)&&!!(na(t.validate)&&t.validate.constructor.name===vI||Qn(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===vI)),oie=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function yI(t,e,n){const r=Ie(t,n);if(r||pN(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const o=i.join("."),s=Ie(e,o),l=Ie(t,o);if(s&&!Array.isArray(s)&&n!==o)return{name:n};if(l&&l.type)return{name:o,error:l};i.pop()}return{name:n}}var sie=(t,e,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(e||t):(n?r.isOnBlur:i.isOnBlur)?!t:(n?r.isOnChange:i.isOnChange)?t:!0,aie=(t,e)=>!u0(Ie(t,e)).length&&sr(t,e);const lie={mode:Po.onSubmit,reValidateMode:Po.onChange,shouldFocusError:!0};function cie(t={}){let e={...lie,...t},n={submitCount:0,isDirty:!1,isLoading:na(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},i=Qn(e.defaultValues)||Qn(e.values)?fi(e.defaultValues||e.values)||{}:{},o=e.shouldUnregister?{}:fi(i),s={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:uS(),array:uS(),state:uS()},h=uI(e.mode),p=uI(e.reValidateMode),g=e.criteriaMode===Po.all,m=N=>D=>{clearTimeout(u),u=setTimeout(N,D)},v=async N=>{if(!t.disabled&&(d.isValid||N)){const D=e.resolver?hi((await j()).errors):await P(r,!0);D!==n.isValid&&f.state.next({isValid:D})}},b=(N,D)=>{!t.disabled&&(d.isValidating||d.validatingFields)&&((N||Array.from(l.mount)).forEach(H=>{H&&(D?rn(n.validatingFields,H,D):sr(n.validatingFields,H))}),f.state.next({validatingFields:n.validatingFields,isValidating:!hi(n.validatingFields)}))},x=(N,D=[],H,Q,J=!0,B=!0)=>{if(Q&&H&&!t.disabled){if(s.action=!0,B&&Array.isArray(Ie(r,N))){const ee=H(Ie(r,N),Q.argA,Q.argB);J&&rn(r,N,ee)}if(B&&Array.isArray(Ie(n.errors,N))){const ee=H(Ie(n.errors,N),Q.argA,Q.argB);J&&rn(n.errors,N,ee),aie(n.errors,N)}if(d.touchedFields&&B&&Array.isArray(Ie(n.touchedFields,N))){const ee=H(Ie(n.touchedFields,N),Q.argA,Q.argB);J&&rn(n.touchedFields,N,ee)}d.dirtyFields&&(n.dirtyFields=ih(i,o)),f.state.next({name:N,isDirty:E(N,D),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else rn(o,N,D)},w=(N,D)=>{rn(n.errors,N,D),f.state.next({errors:n.errors})},S=N=>{n.errors=N,f.state.next({errors:n.errors,isValid:!1})},C=(N,D,H,Q)=>{const J=Ie(r,N);if(J){const B=Ie(o,N,zn(H)?Ie(i,N):H);zn(B)||Q&&Q.defaultChecked||D?rn(o,N,D?B:fS(J._f)):V(N,B),s.mount&&v()}},A=(N,D,H,Q,J)=>{let B=!1,ee=!1;const me={name:N};if(!t.disabled){const Ce=!!(Ie(r,N)&&Ie(r,N)._f&&Ie(r,N)._f.disabled);if(!H||Q){d.isDirty&&(ee=n.isDirty,n.isDirty=me.isDirty=E(),B=ee!==me.isDirty);const Me=Ce||Ka(Ie(i,N),D);ee=!!(!Ce&&Ie(n.dirtyFields,N)),Me||Ce?sr(n.dirtyFields,N):rn(n.dirtyFields,N,!0),me.dirtyFields=n.dirtyFields,B=B||d.dirtyFields&&ee!==!Me}if(H){const Me=Ie(n.touchedFields,N);Me||(rn(n.touchedFields,N,H),me.touchedFields=n.touchedFields,B=B||d.touchedFields&&Me!==H)}B&&J&&f.state.next(me)}return B?me:{}},_=(N,D,H,Q)=>{const J=Ie(n.errors,N),B=d.isValid&&eo(D)&&n.isValid!==D;if(t.delayError&&H?(c=m(()=>w(N,H)),c(t.delayError)):(clearTimeout(u),c=null,H?rn(n.errors,N,H):sr(n.errors,N)),(H?!Ka(J,H):J)||!hi(Q)||B){const ee={...Q,...B&&eo(D)?{isValid:D}:{},errors:n.errors,name:N};n={...n,...ee},f.state.next(ee)}},j=async N=>{b(N,!0);const D=await e.resolver(o,e.context,rie(N||l.mount,r,e.criteriaMode,e.shouldUseNativeValidation));return b(N),D},k=async N=>{const{errors:D}=await j(N);if(N)for(const H of N){const Q=Ie(D,H);Q?rn(n.errors,H,Q):sr(n.errors,H)}else n.errors=D;return D},P=async(N,D,H={valid:!0})=>{for(const Q in N){const J=N[Q];if(J){const{_f:B,...ee}=J;if(B){const me=l.array.has(B.name),Ce=J._f&&iie(J._f);Ce&&d.validatingFields&&b([Q],!0);const Me=await gI(J,o,g,e.shouldUseNativeValidation&&!D,me);if(Ce&&d.validatingFields&&b([Q]),Me[B.name]&&(H.valid=!1,D))break;!D&&(Ie(Me,B.name)?me?Zre(n.errors,Me,B.name):rn(n.errors,B.name,Me[B.name]):sr(n.errors,B.name))}!hi(ee)&&await P(ee,D,H)}}return H.valid},I=()=>{for(const N of l.unMount){const D=Ie(r,N);D&&(D._f.refs?D._f.refs.every(H=>!dS(H)):!dS(D._f.ref))&&oe(N)}l.unMount=new Set},E=(N,D)=>!t.disabled&&(N&&D&&rn(o,N,D),!Ka(X(),i)),R=(N,D,H)=>sU(N,l,{...s.mount?o:zn(D)?i:gs(N)?{[N]:D}:D},H,D),L=N=>u0(Ie(s.mount?o:i,N,t.shouldUnregister?Ie(i,N,[]):[])),V=(N,D,H={})=>{const Q=Ie(r,N);let J=D;if(Q){const B=Q._f;B&&(!B.disabled&&rn(o,N,hU(D,B)),J=Hy(B.ref)&&ti(D)?"":D,uU(B.ref)?[...B.ref.options].forEach(ee=>ee.selected=J.includes(ee.value)):B.refs?Ym(B.ref)?B.refs.length>1?B.refs.forEach(ee=>(!ee.defaultChecked||!ee.disabled)&&(ee.checked=Array.isArray(J)?!!J.find(me=>me===ee.value):J===ee.value)):B.refs[0]&&(B.refs[0].checked=!!J):B.refs.forEach(ee=>ee.checked=ee.value===J):gN(B.ref)?B.ref.value="":(B.ref.value=J,B.ref.type||f.values.next({name:N,values:{...o}})))}(H.shouldDirty||H.shouldTouch)&&A(N,J,H.shouldTouch,H.shouldDirty,!0),H.shouldValidate&&W(N)},$=(N,D,H)=>{for(const Q in D){const J=D[Q],B=`${N}.${Q}`,ee=Ie(r,B);(l.array.has(N)||Qn(J)||ee&&!ee._f)&&!gc(J)?$(B,J,H):V(B,J,H)}},z=(N,D,H={})=>{const Q=Ie(r,N),J=l.array.has(N),B=fi(D);rn(o,N,B),J?(f.array.next({name:N,values:{...o}}),(d.isDirty||d.dirtyFields)&&H.shouldDirty&&f.state.next({name:N,dirtyFields:ih(i,o),isDirty:E(N,B)})):Q&&!Q._f&&!ti(B)?$(N,B,H):V(N,B,H),dI(N,l)&&f.state.next({...n}),f.values.next({name:s.mount?N:void 0,values:{...o}})},M=async N=>{s.mount=!0;const D=N.target;let H=D.name,Q=!0;const J=Ie(r,H),B=()=>D.type?fS(J._f):Z5(N),ee=me=>{Q=Number.isNaN(me)||gc(me)&&isNaN(me.getTime())||Ka(me,Ie(o,H,me))};if(J){let me,Ce;const Me=B(),we=N.type===By.BLUR||N.type===By.FOCUS_OUT,We=!oie(J._f)&&!e.resolver&&!Ie(n.errors,H)&&!J._f.deps||sie(we,Ie(n.touchedFields,H),n.isSubmitted,p,h),wt=dI(H,l,we);rn(o,H,Me),we?(J._f.onBlur&&J._f.onBlur(N),c&&c(0)):J._f.onChange&&J._f.onChange(N);const Nt=A(H,Me,we,!1),Je=!hi(Nt)||wt;if(!we&&f.values.next({name:H,type:N.type,values:{...o}}),We)return d.isValid&&(t.mode==="onBlur"?we&&v():v()),Je&&f.state.next({name:H,...wt?{}:Nt});if(!we&&wt&&f.state.next({...n}),e.resolver){const{errors:Xe}=await j([H]);if(ee(Me),Q){const $t=yI(n.errors,r,H),Yt=yI(Xe,r,$t.name||H);me=Yt.error,H=Yt.name,Ce=hi(Xe)}}else b([H],!0),me=(await gI(J,o,g,e.shouldUseNativeValidation))[H],b([H]),ee(Me),Q&&(me?Ce=!1:d.isValid&&(Ce=await P(r,!0)));Q&&(J._f.deps&&W(J._f.deps),_(H,Ce,me,Nt))}},U=(N,D)=>{if(Ie(n.errors,D)&&N.focus)return N.focus(),1},W=async(N,D={})=>{let H,Q;const J=Vh(N);if(e.resolver){const B=await k(zn(N)?N:J);H=hi(B),Q=N?!J.some(ee=>Ie(B,ee)):H}else N?(Q=(await Promise.all(J.map(async B=>{const ee=Ie(r,B);return await P(ee&&ee._f?{[B]:ee}:ee)}))).every(Boolean),!(!Q&&!n.isValid)&&v()):Q=H=await P(r);return f.state.next({...!gs(N)||d.isValid&&H!==n.isValid?{}:{name:N},...e.resolver||!N?{isValid:H}:{},errors:n.errors}),D.shouldFocus&&!Q&&Gh(r,U,N?J:l.mount),Q},X=N=>{const D={...s.mount?o:i};return zn(N)?D:gs(N)?Ie(D,N):N.map(H=>Ie(D,H))},re=(N,D)=>({invalid:!!Ie((D||n).errors,N),isDirty:!!Ie((D||n).dirtyFields,N),error:Ie((D||n).errors,N),isValidating:!!Ie(n.validatingFields,N),isTouched:!!Ie((D||n).touchedFields,N)}),xe=N=>{N&&Vh(N).forEach(D=>sr(n.errors,D)),f.state.next({errors:N?n.errors:{}})},F=(N,D,H)=>{const Q=(Ie(r,N,{_f:{}})._f||{}).ref,J=Ie(n.errors,N)||{},{ref:B,message:ee,type:me,...Ce}=J;rn(n.errors,N,{...Ce,...D,ref:Q}),f.state.next({name:N,errors:n.errors,isValid:!1}),H&&H.shouldFocus&&Q&&Q.focus&&Q.focus()},fe=(N,D)=>na(N)?f.values.subscribe({next:H=>N(R(void 0,D),H)}):R(N,D,!0),oe=(N,D={})=>{for(const H of N?Vh(N):l.mount)l.mount.delete(H),l.array.delete(H),D.keepValue||(sr(r,H),sr(o,H)),!D.keepError&&sr(n.errors,H),!D.keepDirty&&sr(n.dirtyFields,H),!D.keepTouched&&sr(n.touchedFields,H),!D.keepIsValidating&&sr(n.validatingFields,H),!e.shouldUnregister&&!D.keepDefaultValue&&sr(i,H);f.values.next({values:{...o}}),f.state.next({...n,...D.keepDirty?{isDirty:E()}:{}}),!D.keepIsValid&&v()},de=({disabled:N,name:D,field:H,fields:Q,value:J})=>{if(eo(N)&&s.mount||N){const B=N?void 0:zn(J)?fS(H?H._f:Ie(Q,D)._f):J;rn(o,D,B),A(D,B,!1,!1,!0)}},Re=(N,D={})=>{let H=Ie(r,N);const Q=eo(D.disabled)||eo(t.disabled);return rn(r,N,{...H||{},_f:{...H&&H._f?H._f:{ref:{name:N}},name:N,mount:!0,...D}}),l.mount.add(N),H?de({field:H,disabled:eo(D.disabled)?D.disabled:t.disabled,name:N,value:D.value}):C(N,!0,D.value),{...Q?{disabled:D.disabled||t.disabled}:{},...e.progressive?{required:!!D.required,min:oh(D.min),max:oh(D.max),minLength:oh(D.minLength),maxLength:oh(D.maxLength),pattern:oh(D.pattern)}:{},name:N,onChange:M,onBlur:M,ref:J=>{if(J){Re(N,D),H=Ie(r,N);const B=zn(J.value)&&J.querySelectorAll&&J.querySelectorAll("input,select,textarea")[0]||J,ee=nie(B),me=H._f.refs||[];if(ee?me.find(Ce=>Ce===B):B===H._f.ref)return;rn(r,N,{_f:{...H._f,...ee?{refs:[...me.filter(dS),B,...Array.isArray(Ie(i,N))?[{}]:[]],ref:{type:B.type,name:N}}:{ref:B}}}),C(N,!1,void 0,B)}else H=Ie(r,N,{}),H._f&&(H._f.mount=!1),(e.shouldUnregister||D.shouldUnregister)&&!(eU(l.array,N)&&s.action)&&l.unMount.add(N)}}},pe=()=>e.shouldFocusError&&Gh(r,U,l.mount),Se=N=>{eo(N)&&(f.state.next({disabled:N}),Gh(r,(D,H)=>{const Q=Ie(r,H);Q&&(D.disabled=Q._f.disabled||N,Array.isArray(Q._f.refs)&&Q._f.refs.forEach(J=>{J.disabled=Q._f.disabled||N}))},0,!1))},Ne=(N,D)=>async H=>{let Q;H&&(H.preventDefault&&H.preventDefault(),H.persist&&H.persist());let J=fi(o);if(f.state.next({isSubmitting:!0}),e.resolver){const{errors:B,values:ee}=await j();n.errors=B,J=ee}else await P(r);if(sr(n.errors,"root"),hi(n.errors)){f.state.next({errors:{}});try{await N(J,H)}catch(B){Q=B}}else D&&await D({...n.errors},H),pe(),setTimeout(pe);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:hi(n.errors)&&!Q,submitCount:n.submitCount+1,errors:n.errors}),Q)throw Q},ne=(N,D={})=>{Ie(r,N)&&(zn(D.defaultValue)?z(N,fi(Ie(i,N))):(z(N,D.defaultValue),rn(i,N,fi(D.defaultValue))),D.keepTouched||sr(n.touchedFields,N),D.keepDirty||(sr(n.dirtyFields,N),n.isDirty=D.defaultValue?E(N,fi(Ie(i,N))):E()),D.keepError||(sr(n.errors,N),d.isValid&&v()),f.state.next({...n}))},nt=(N,D={})=>{const H=N?fi(N):i,Q=fi(H),J=hi(N),B=J?i:Q;if(D.keepDefaultValues||(i=H),!D.keepValues){if(D.keepDirtyValues){const ee=new Set([...l.mount,...Object.keys(ih(i,o))]);for(const me of Array.from(ee))Ie(n.dirtyFields,me)?rn(B,me,Ie(o,me)):z(me,Ie(B,me))}else{if(hN&&zn(N))for(const ee of l.mount){const me=Ie(r,ee);if(me&&me._f){const Ce=Array.isArray(me._f.refs)?me._f.refs[0]:me._f.ref;if(Hy(Ce)){const Me=Ce.closest("form");if(Me){Me.reset();break}}}}r={}}o=t.shouldUnregister?D.keepDefaultValues?fi(i):{}:fi(B),f.array.next({values:{...B}}),f.values.next({values:{...B}})}l={mount:D.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!D.keepIsValid||!!D.keepDirtyValues,s.watch=!!t.shouldUnregister,f.state.next({submitCount:D.keepSubmitCount?n.submitCount:0,isDirty:J?!1:D.keepDirty?n.isDirty:!!(D.keepDefaultValues&&!Ka(N,i)),isSubmitted:D.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:J?{}:D.keepDirtyValues?D.keepDefaultValues&&o?ih(i,o):n.dirtyFields:D.keepDefaultValues&&N?ih(i,N):D.keepDirty?n.dirtyFields:{},touchedFields:D.keepTouched?n.touchedFields:{},errors:D.keepErrors?n.errors:{},isSubmitSuccessful:D.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Fe=(N,D)=>nt(na(N)?N(o):N,D);return{control:{register:Re,unregister:oe,getFieldState:re,handleSubmit:Ne,setError:F,_executeSchema:j,_getWatch:R,_getDirty:E,_updateValid:v,_removeUnmounted:I,_updateFieldArray:x,_updateDisabledField:de,_getFieldArray:L,_reset:nt,_resetDefaultValues:()=>na(e.defaultValues)&&e.defaultValues().then(N=>{Fe(N,e.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:N=>{n={...n,...N}},_disableForm:Se,_subjects:f,_proxyFormState:d,_setErrors:S,get _fields(){return r},get _formValues(){return o},get _state(){return s},set _state(N){s=N},get _defaultValues(){return i},get _names(){return l},set _names(N){l=N},get _formState(){return n},set _formState(N){n=N},get _options(){return e},set _options(N){e={...e,...N}}},trigger:W,register:Re,handleSubmit:Ne,watch:fe,setValue:z,getValues:X,reset:Fe,resetField:ne,clearErrors:xe,unregister:oe,setError:F,setFocus:(N,D={})=>{const H=Ie(r,N),Q=H&&H._f;if(Q){const J=Q.refs?Q.refs[0]:Q.ref;J.focus&&(J.focus(),D.shouldSelect&&J.select())}},getFieldState:re}}function f0(t={}){const e=T.useRef(),n=T.useRef(),[r,i]=T.useState({isDirty:!1,isValidating:!1,isLoading:na(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:na(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...cie(t),formState:r});const o=e.current.control;return o._options=t,mN({subject:o._subjects.state,next:s=>{iU(s,o._proxyFormState,o._updateFormState,!0)&&i({...o._formState})}}),T.useEffect(()=>o._disableForm(t.disabled),[o,t.disabled]),T.useEffect(()=>{if(o._proxyFormState.isDirty){const s=o._getDirty();s!==r.isDirty&&o._subjects.state.next({isDirty:s})}},[o,r.isDirty]),T.useEffect(()=>{t.values&&!Ka(t.values,n.current)?(o._reset(t.values,o._options.resetOptions),n.current=t.values,i(s=>({...s}))):o._resetDefaultValues()},[t.values,o]),T.useEffect(()=>{t.errors&&o._setErrors(t.errors)},[t.errors,o]),T.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),T.useEffect(()=>{t.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[t.shouldUnregister,o]),T.useEffect(()=>{e.current&&(e.current.watch=e.current.watch.bind({}))},[r]),e.current.formState=rU(r,o),e.current}const xI=(t,e,n)=>{if(t&&"reportValidity"in t){const r=Ie(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},pU=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?xI(r.ref,n,t):r.refs&&r.refs.forEach(i=>xI(i,n,t))}},uie=(t,e)=>{e.shouldUseNativeValidation&&pU(t,e);const n={};for(const r in t){const i=Ie(e.fields,r),o=Object.assign(t[r]||{},{ref:i&&i.ref});if(die(e.names||Object.keys(t),r)){const s=Object.assign({},Ie(n,r));rn(s,"root",o),rn(n,r,s)}else rn(n,r,o)}return n},die=(t,e)=>t.some(n=>n.startsWith(e+"."));var fie=function(t,e){for(var n={};t.length;){var r=t[0],i=r.code,o=r.message,s=r.path.join(".");if(!n[s])if("unionErrors"in r){var l=r.unionErrors[0].errors[0];n[s]={message:l.message,type:l.code}}else n[s]={message:o,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return t.push(f)})}),e){var c=n[s].types,u=c&&c[r.code];n[s]=aU(s,e,n,i,u?[].concat(u,r.message):r.message)}t.shift()}return n},h0=function(t,e,n){return n===void 0&&(n={}),function(r,i,o){try{return Promise.resolve(function(s,l){try{var c=Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(u){return o.shouldUseNativeValidation&&pU({},o),{errors:{},values:n.raw?r:u}})}catch(u){return l(u)}return c&&c.then?c.then(void 0,l):c}(0,function(s){if(function(l){return Array.isArray(l==null?void 0:l.errors)}(s))return{values:{},errors:uie(fie(s.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw s}))}catch(s){return Promise.reject(s)}}},Wt;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const o={};for(const s of i)o[s]=s;return o},t.getValidEnumValues=i=>{const o=t.objectKeys(i).filter(l=>typeof i[i[l]]!="number"),s={};for(const l of o)s[l]=i[l];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(const s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=r,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Wt||(Wt={}));var I1;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(I1||(I1={}));const ze=Wt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Wa=t=>{switch(typeof t){case"undefined":return ze.undefined;case"string":return ze.string;case"number":return isNaN(t)?ze.nan:ze.number;case"boolean":return ze.boolean;case"function":return ze.function;case"bigint":return ze.bigint;case"symbol":return ze.symbol;case"object":return Array.isArray(t)?ze.array:t===null?ze.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ze.promise:typeof Map<"u"&&t instanceof Map?ze.map:typeof Set<"u"&&t instanceof Set?ze.set:typeof Date<"u"&&t instanceof Date?ze.date:ze.object;default:return ze.unknown}},je=Wt.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"]),hie=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class Hi extends Error{constructor(e){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=e}get errors(){return this.issues}format(e){const n=e||function(o){return o.message},r={_errors:[]},i=o=>{for(const s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));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(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Hi.create=t=>new Hi(t);const Od=(t,e)=>{let n;switch(t.code){case je.invalid_type:t.received===ze.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case je.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Wt.jsonStringifyReplacer)}`;break;case je.unrecognized_keys:n=`Unrecognized key(s) in object: ${Wt.joinValues(t.keys,", ")}`;break;case je.invalid_union:n="Invalid input";break;case je.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Wt.joinValues(t.options)}`;break;case je.invalid_enum_value:n=`Invalid enum value. Expected ${Wt.joinValues(t.options)}, received '${t.received}'`;break;case je.invalid_arguments:n="Invalid function arguments";break;case je.invalid_return_type:n="Invalid function return type";break;case je.invalid_date:n="Invalid date";break;case je.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Wt.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case je.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case je.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case je.custom:n="Invalid input";break;case je.invalid_intersection_types:n="Intersection results could not be merged";break;case je.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case je.not_finite:n="Number must be finite";break;default:n=e.defaultError,Wt.assertNever(t)}return{message:n}};let mU=Od;function pie(t){mU=t}function Gy(){return mU}const Ky=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,o=[...n,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let l="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)l=u(s,{data:e,defaultError:l}).message;return{...i,path:o,message:l}},mie=[];function Ue(t,e){const n=Gy(),r=Ky({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Od?void 0:Od].filter(i=>!!i)});t.common.issues.push(r)}class qr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const i of n){if(i.status==="aborted")return Ct;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n){const o=await i.key,s=await i.value;r.push({key:o,value:s})}return qr.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return Ct;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(r[o.value]=s.value)}return{status:e.value,value:r}}}const Ct=Object.freeze({status:"aborted"}),Hu=t=>({status:"dirty",value:t}),li=t=>({status:"valid",value:t}),R1=t=>t.status==="aborted",M1=t=>t.status==="dirty",Ip=t=>t.status==="valid",Rp=t=>typeof Promise<"u"&&t instanceof Promise;function Wy(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function gU(t,e,n,r,i){if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var tt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(tt||(tt={}));var Ch,Ah;class ks{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,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 bI=(t,e)=>{if(Ip(e))return{success:!0,data:e.value};if(!t.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 Hi(t.common.issues);return this._error=n,this._error}}};function Ot(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,l)=>{var c,u;const{message:d}=t;return s.code==="invalid_enum_value"?{message:d??l.defaultError}:typeof l.data>"u"?{message:(c=d??r)!==null&&c!==void 0?c:l.defaultError}:s.code!=="invalid_type"?{message:l.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:l.defaultError}},description:i}}class Ut{constructor(e){this.spa=this.safeParseAsync,this._def=e,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(e){return Wa(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Wa(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new qr,ctx:{common:e.parent.common,data:e.data,parsedType:Wa(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Rp(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,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:e,parsedType:Wa(e)},o=this._parseSync({data:e,path:i.path,parent:i});return bI(i,o)}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,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:e,parsedType:Wa(e)},i=this._parse({data:e,path:r.path,parent:r}),o=await(Rp(i)?i:Promise.resolve(i));return bI(r,o)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const s=e(i),l=()=>o.addIssue({code:je.custom,...r(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(l(),!1)):s?!0:(l(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new Qo({schema:this,typeName:bt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Cs.create(this,this._def)}nullable(){return Dl.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fo.create(this,this._def)}promise(){return Rd.create(this,this._def)}or(e){return Lp.create([this,e],this._def)}and(e){return Fp.create(this,e,this._def)}transform(e){return new Qo({...Ot(this._def),schema:this,typeName:bt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Vp({...Ot(this._def),innerType:this,defaultValue:n,typeName:bt.ZodDefault})}brand(){return new yN({typeName:bt.ZodBranded,type:this,...Ot(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Gp({...Ot(this._def),innerType:this,catchValue:n,typeName:bt.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Qm.create(this,e)}readonly(){return Kp.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const gie=/^c[^\s-]{8,}$/i,vie=/^[0-9a-z]+$/,yie=/^[0-9A-HJKMNP-TV-Z]{26}$/,xie=/^[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,bie=/^[a-z0-9_-]{21}$/i,wie=/^[-+]?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)?)??$/,Sie=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Cie="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let hS;const Aie=/^(?:(?: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])$/,_ie=/^(([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})))$/,jie=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vU="((\\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])))",Eie=new RegExp(`^${vU}$`);function yU(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Nie(t){return new RegExp(`^${yU(t)}$`)}function xU(t){let e=`${vU}T${yU(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Tie(t,e){return!!((e==="v4"||!e)&&Aie.test(t)||(e==="v6"||!e)&&_ie.test(t))}class Io extends Ut{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ze.string){const o=this._getOrReturnCtx(e);return Ue(o,{code:je.invalid_type,expected:ze.string,received:o.parsedType}),Ct}const r=new qr;let i;for(const o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(i=this._getOrReturnCtx(e,i),Ue(i,{code:je.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const s=e.data.length>o.value,l=e.data.lengthe.test(i),{validation:n,code:je.invalid_string,...tt.errToObj(r)})}_addCheck(e){return new Io({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...tt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...tt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...tt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...tt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...tt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...tt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...tt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...tt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...tt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...tt.errToObj(e)})}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...tt.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...tt.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...tt.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...tt.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...tt.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...tt.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...tt.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...tt.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...tt.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...tt.errToObj(n)})}nonempty(e){return this.min(1,tt.errToObj(e))}trim(){return new Io({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Io({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Io({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value{var e;return new Io({checks:[],typeName:bt.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Ot(t)})};function Pie(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(t.toFixed(i).replace(".","")),s=parseInt(e.toFixed(i).replace(".",""));return o%s/Math.pow(10,i)}class Il extends Ut{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ze.number){const o=this._getOrReturnCtx(e);return Ue(o,{code:je.invalid_type,expected:ze.number,received:o.parsedType}),Ct}let r;const i=new qr;for(const o of this._def.checks)o.kind==="int"?Wt.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{code:je.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),Ue(r,{code:je.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Pie(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),Ue(r,{code:je.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{code:je.not_finite,message:o.message}),i.dirty()):Wt.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,tt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,tt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,tt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,tt.toString(n))}setLimit(e,n,r,i){return new Il({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:tt.toString(i)}]})}_addCheck(e){return new Il({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:tt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:tt.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:tt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tt.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuee.kind==="int"||e.kind==="multipleOf"&&Wt.isInteger(e.value))}get isFinite(){let e=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"&&(e===null||r.valuenew Il({checks:[],typeName:bt.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Ot(t)});class Rl extends Ut{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==ze.bigint){const o=this._getOrReturnCtx(e);return Ue(o,{code:je.invalid_type,expected:ze.bigint,received:o.parsedType}),Ct}let r;const i=new qr;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),Ue(r,{code:je.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Ue(r,{code:je.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Wt.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,tt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,tt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,tt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,tt.toString(n))}setLimit(e,n,r,i){return new Rl({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:tt.toString(i)}]})}_addCheck(e){return new Rl({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:tt.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value{var e;return new Rl({checks:[],typeName:bt.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Ot(t)})};class Mp extends Ut{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ze.boolean){const r=this._getOrReturnCtx(e);return Ue(r,{code:je.invalid_type,expected:ze.boolean,received:r.parsedType}),Ct}return li(e.data)}}Mp.create=t=>new Mp({typeName:bt.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Ot(t)});class Qc extends Ut{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ze.date){const o=this._getOrReturnCtx(e);return Ue(o,{code:je.invalid_type,expected:ze.date,received:o.parsedType}),Ct}if(isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return Ue(o,{code:je.invalid_date}),Ct}const r=new qr;let i;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(i=this._getOrReturnCtx(e,i),Ue(i,{code:je.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Wt.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Qc({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:tt.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:tt.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew Qc({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:bt.ZodDate,...Ot(t)});class qy extends Ut{_parse(e){if(this._getType(e)!==ze.symbol){const r=this._getOrReturnCtx(e);return Ue(r,{code:je.invalid_type,expected:ze.symbol,received:r.parsedType}),Ct}return li(e.data)}}qy.create=t=>new qy({typeName:bt.ZodSymbol,...Ot(t)});class Dp extends Ut{_parse(e){if(this._getType(e)!==ze.undefined){const r=this._getOrReturnCtx(e);return Ue(r,{code:je.invalid_type,expected:ze.undefined,received:r.parsedType}),Ct}return li(e.data)}}Dp.create=t=>new Dp({typeName:bt.ZodUndefined,...Ot(t)});class $p extends Ut{_parse(e){if(this._getType(e)!==ze.null){const r=this._getOrReturnCtx(e);return Ue(r,{code:je.invalid_type,expected:ze.null,received:r.parsedType}),Ct}return li(e.data)}}$p.create=t=>new $p({typeName:bt.ZodNull,...Ot(t)});class Id extends Ut{constructor(){super(...arguments),this._any=!0}_parse(e){return li(e.data)}}Id.create=t=>new Id({typeName:bt.ZodAny,...Ot(t)});class Pc extends Ut{constructor(){super(...arguments),this._unknown=!0}_parse(e){return li(e.data)}}Pc.create=t=>new Pc({typeName:bt.ZodUnknown,...Ot(t)});class ba extends Ut{_parse(e){const n=this._getOrReturnCtx(e);return Ue(n,{code:je.invalid_type,expected:ze.never,received:n.parsedType}),Ct}}ba.create=t=>new ba({typeName:bt.ZodNever,...Ot(t)});class Yy extends Ut{_parse(e){if(this._getType(e)!==ze.undefined){const r=this._getOrReturnCtx(e);return Ue(r,{code:je.invalid_type,expected:ze.void,received:r.parsedType}),Ct}return li(e.data)}}Yy.create=t=>new Yy({typeName:bt.ZodVoid,...Ot(t)});class Fo extends Ut{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==ze.array)return Ue(n,{code:je.invalid_type,expected:ze.array,received:n.parsedType}),Ct;if(i.exactLength!==null){const s=n.data.length>i.exactLength.value,l=n.data.lengthi.maxLength.value&&(Ue(n,{code:je.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((s,l)=>i.type._parseAsync(new ks(n,s,n.path,l)))).then(s=>qr.mergeArray(r,s));const o=[...n.data].map((s,l)=>i.type._parseSync(new ks(n,s,n.path,l)));return qr.mergeArray(r,o)}get element(){return this._def.type}min(e,n){return new Fo({...this._def,minLength:{value:e,message:tt.toString(n)}})}max(e,n){return new Fo({...this._def,maxLength:{value:e,message:tt.toString(n)}})}length(e,n){return new Fo({...this._def,exactLength:{value:e,message:tt.toString(n)}})}nonempty(e){return this.min(1,e)}}Fo.create=(t,e)=>new Fo({type:t,minLength:null,maxLength:null,exactLength:null,typeName:bt.ZodArray,...Ot(e)});function Tu(t){if(t instanceof Mn){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Cs.create(Tu(r))}return new Mn({...t._def,shape:()=>e})}else return t instanceof Fo?new Fo({...t._def,type:Tu(t.element)}):t instanceof Cs?Cs.create(Tu(t.unwrap())):t instanceof Dl?Dl.create(Tu(t.unwrap())):t instanceof Os?Os.create(t.items.map(e=>Tu(e))):t}class Mn extends Ut{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=Wt.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==ze.object){const u=this._getOrReturnCtx(e);return Ue(u,{code:je.invalid_type,expected:ze.object,received:u.parsedType}),Ct}const{status:r,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),l=[];if(!(this._def.catchall instanceof ba&&this._def.unknownKeys==="strip"))for(const u in i.data)s.includes(u)||l.push(u);const c=[];for(const u of s){const d=o[u],f=i.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new ks(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof ba){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&&(Ue(i,{code:je.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 ks(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=>qr.mergeObjectSync(r,u)):qr.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return tt.errToObj,new Mn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o,s,l;const c=(s=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(l=tt.errToObj(e).message)!==null&&l!==void 0?l:c}:{message:c}}}:{}})}strip(){return new Mn({...this._def,unknownKeys:"strip"})}passthrough(){return new Mn({...this._def,unknownKeys:"passthrough"})}extend(e){return new Mn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Mn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:bt.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Mn({...this._def,catchall:e})}pick(e){const n={};return Wt.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Mn({...this._def,shape:()=>n})}omit(e){const n={};return Wt.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new Mn({...this._def,shape:()=>n})}deepPartial(){return Tu(this)}partial(e){const n={};return Wt.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}),new Mn({...this._def,shape:()=>n})}required(e){const n={};return Wt.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Cs;)o=o._def.innerType;n[r]=o}}),new Mn({...this._def,shape:()=>n})}keyof(){return bU(Wt.objectKeys(this.shape))}}Mn.create=(t,e)=>new Mn({shape:()=>t,unknownKeys:"strip",catchall:ba.create(),typeName:bt.ZodObject,...Ot(e)});Mn.strictCreate=(t,e)=>new Mn({shape:()=>t,unknownKeys:"strict",catchall:ba.create(),typeName:bt.ZodObject,...Ot(e)});Mn.lazycreate=(t,e)=>new Mn({shape:t,unknownKeys:"strip",catchall:ba.create(),typeName:bt.ZodObject,...Ot(e)});class Lp extends Ut{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(o){for(const l of o)if(l.result.status==="valid")return l.result;for(const l of o)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const s=o.map(l=>new Hi(l.ctx.common.issues));return Ue(n,{code:je.invalid_union,unionErrors:s}),Ct}if(n.common.async)return Promise.all(r.map(async o=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(i);{let o;const s=[];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"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const l=s.map(c=>new Hi(c));return Ue(n,{code:je.invalid_union,unionErrors:l}),Ct}}get options(){return this._def.options}}Lp.create=(t,e)=>new Lp({options:t,typeName:bt.ZodUnion,...Ot(e)});const Vs=t=>t instanceof Bp?Vs(t.schema):t instanceof Qo?Vs(t.innerType()):t instanceof Hp?[t.value]:t instanceof Ml?t.options:t instanceof zp?Wt.objectValues(t.enum):t instanceof Vp?Vs(t._def.innerType):t instanceof Dp?[void 0]:t instanceof $p?[null]:t instanceof Cs?[void 0,...Vs(t.unwrap())]:t instanceof Dl?[null,...Vs(t.unwrap())]:t instanceof yN||t instanceof Kp?Vs(t.unwrap()):t instanceof Gp?Vs(t._def.innerType):[];class p0 extends Ut{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ze.object)return Ue(n,{code:je.invalid_type,expected:ze.object,received:n.parsedType}),Ct;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(Ue(n,{code:je.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ct)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const i=new Map;for(const o of n){const s=Vs(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const l of s){if(i.has(l))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);i.set(l,o)}}return new p0({typeName:bt.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...Ot(r)})}}function D1(t,e){const n=Wa(t),r=Wa(e);if(t===e)return{valid:!0,data:t};if(n===ze.object&&r===ze.object){const i=Wt.objectKeys(e),o=Wt.objectKeys(t).filter(l=>i.indexOf(l)!==-1),s={...t,...e};for(const l of o){const c=D1(t[l],e[l]);if(!c.valid)return{valid:!1};s[l]=c.data}return{valid:!0,data:s}}else if(n===ze.array&&r===ze.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let o=0;o{if(R1(o)||R1(s))return Ct;const l=D1(o.value,s.value);return l.valid?((M1(o)||M1(s))&&n.dirty(),{status:n.value,value:l.data}):(Ue(r,{code:je.invalid_intersection_types}),Ct)};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(([o,s])=>i(o,s)):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}))}}Fp.create=(t,e,n)=>new Fp({left:t,right:e,typeName:bt.ZodIntersection,...Ot(n)});class Os extends Ut{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ze.array)return Ue(r,{code:je.invalid_type,expected:ze.array,received:r.parsedType}),Ct;if(r.data.lengththis._def.items.length&&(Ue(r,{code:je.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((s,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new ks(r,s,r.path,l)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>qr.mergeArray(n,s)):qr.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new Os({...this._def,rest:e})}}Os.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Os({items:t,typeName:bt.ZodTuple,rest:null,...Ot(e)})};class Up extends Ut{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ze.object)return Ue(r,{code:je.invalid_type,expected:ze.object,received:r.parsedType}),Ct;const i=[],o=this._def.keyType,s=this._def.valueType;for(const l in r.data)i.push({key:o._parse(new ks(r,l,r.path,l)),value:s._parse(new ks(r,r.data[l],r.path,l)),alwaysSet:l in r.data});return r.common.async?qr.mergeObjectAsync(n,i):qr.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Ut?new Up({keyType:e,valueType:n,typeName:bt.ZodRecord,...Ot(r)}):new Up({keyType:Io.create(),valueType:e,typeName:bt.ZodRecord,...Ot(n)})}}class Qy extends Ut{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ze.map)return Ue(r,{code:je.invalid_type,expected:ze.map,received:r.parsedType}),Ct;const i=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([l,c],u)=>({key:i._parse(new ks(r,l,r.path,[u,"key"])),value:o._parse(new ks(r,c,r.path,[u,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of s){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return Ct;(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 s){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return Ct;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}}}}Qy.create=(t,e,n)=>new Qy({valueType:e,keyType:t,typeName:bt.ZodMap,...Ot(n)});class Xc extends Ut{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ze.set)return Ue(r,{code:je.invalid_type,expected:ze.set,received:r.parsedType}),Ct;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(Ue(r,{code:je.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function s(c){const u=new Set;for(const d of c){if(d.status==="aborted")return Ct;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const l=[...r.data.values()].map((c,u)=>o._parse(new ks(r,c,r.path,u)));return r.common.async?Promise.all(l).then(c=>s(c)):s(l)}min(e,n){return new Xc({...this._def,minSize:{value:e,message:tt.toString(n)}})}max(e,n){return new Xc({...this._def,maxSize:{value:e,message:tt.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Xc.create=(t,e)=>new Xc({valueType:t,minSize:null,maxSize:null,typeName:bt.ZodSet,...Ot(e)});class od extends Ut{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ze.function)return Ue(n,{code:je.invalid_type,expected:ze.function,received:n.parsedType}),Ct;function r(l,c){return Ky({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Gy(),Od].filter(u=>!!u),issueData:{code:je.invalid_arguments,argumentsError:c}})}function i(l,c){return Ky({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Gy(),Od].filter(u=>!!u),issueData:{code:je.invalid_return_type,returnTypeError:c}})}const o={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Rd){const l=this;return li(async function(...c){const u=new Hi([]),d=await l._def.args.parseAsync(c,o).catch(p=>{throw u.addIssue(r(c,p)),u}),f=await Reflect.apply(s,this,d);return await l._def.returns._def.type.parseAsync(f,o).catch(p=>{throw u.addIssue(i(f,p)),u})})}else{const l=this;return li(function(...c){const u=l._def.args.safeParse(c,o);if(!u.success)throw new Hi([r(c,u.error)]);const d=Reflect.apply(s,this,u.data),f=l._def.returns.safeParse(d,o);if(!f.success)throw new Hi([i(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new od({...this._def,args:Os.create(e).rest(Pc.create())})}returns(e){return new od({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new od({args:e||Os.create([]).rest(Pc.create()),returns:n||Pc.create(),typeName:bt.ZodFunction,...Ot(r)})}}class Bp extends Ut{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Bp.create=(t,e)=>new Bp({getter:t,typeName:bt.ZodLazy,...Ot(e)});class Hp extends Ut{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Ue(n,{received:n.data,code:je.invalid_literal,expected:this._def.value}),Ct}return{status:"valid",value:e.data}}get value(){return this._def.value}}Hp.create=(t,e)=>new Hp({value:t,typeName:bt.ZodLiteral,...Ot(e)});function bU(t,e){return new Ml({values:t,typeName:bt.ZodEnum,...Ot(e)})}class Ml extends Ut{constructor(){super(...arguments),Ch.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return Ue(n,{expected:Wt.joinValues(r),received:n.parsedType,code:je.invalid_type}),Ct}if(Wy(this,Ch)||gU(this,Ch,new Set(this._def.values)),!Wy(this,Ch).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return Ue(n,{received:n.data,code:je.invalid_enum_value,options:r}),Ct}return li(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Ml.create(e,{...this._def,...n})}exclude(e,n=this._def){return Ml.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Ch=new WeakMap;Ml.create=bU;class zp extends Ut{constructor(){super(...arguments),Ah.set(this,void 0)}_parse(e){const n=Wt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ze.string&&r.parsedType!==ze.number){const i=Wt.objectValues(n);return Ue(r,{expected:Wt.joinValues(i),received:r.parsedType,code:je.invalid_type}),Ct}if(Wy(this,Ah)||gU(this,Ah,new Set(Wt.getValidEnumValues(this._def.values))),!Wy(this,Ah).has(e.data)){const i=Wt.objectValues(n);return Ue(r,{received:r.data,code:je.invalid_enum_value,options:i}),Ct}return li(e.data)}get enum(){return this._def.values}}Ah=new WeakMap;zp.create=(t,e)=>new zp({values:t,typeName:bt.ZodNativeEnum,...Ot(e)});class Rd extends Ut{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ze.promise&&n.common.async===!1)return Ue(n,{code:je.invalid_type,expected:ze.promise,received:n.parsedType}),Ct;const r=n.parsedType===ze.promise?n.data:Promise.resolve(n.data);return li(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Rd.create=(t,e)=>new Rd({type:t,typeName:bt.ZodPromise,...Ot(e)});class Qo extends Ut{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===bt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{Ue(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const s=i.transform(r.data,o);if(r.common.async)return Promise.resolve(s).then(async l=>{if(n.value==="aborted")return Ct;const c=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return c.status==="aborted"?Ct:c.status==="dirty"||n.value==="dirty"?Hu(c.value):c});{if(n.value==="aborted")return Ct;const l=this._def.schema._parseSync({data:s,path:r.path,parent:r});return l.status==="aborted"?Ct:l.status==="dirty"||n.value==="dirty"?Hu(l.value):l}}if(i.type==="refinement"){const s=l=>{const c=i.refinement(l,o);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"?Ct:(l.status==="dirty"&&n.dirty(),s(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"?Ct:(l.status==="dirty"&&n.dirty(),s(l.value).then(()=>({status:n.value,value:l.value}))))}if(i.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ip(s))return s;const l=i.transform(s.value,o);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(s=>Ip(s)?Promise.resolve(i.transform(s.value,o)).then(l=>({status:n.value,value:l})):s);Wt.assertNever(i)}}Qo.create=(t,e,n)=>new Qo({schema:t,typeName:bt.ZodEffects,effect:e,...Ot(n)});Qo.createWithPreprocess=(t,e,n)=>new Qo({schema:e,effect:{type:"preprocess",transform:t},typeName:bt.ZodEffects,...Ot(n)});class Cs extends Ut{_parse(e){return this._getType(e)===ze.undefined?li(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Cs.create=(t,e)=>new Cs({innerType:t,typeName:bt.ZodOptional,...Ot(e)});class Dl extends Ut{_parse(e){return this._getType(e)===ze.null?li(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Dl.create=(t,e)=>new Dl({innerType:t,typeName:bt.ZodNullable,...Ot(e)});class Vp extends Ut{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===ze.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Vp.create=(t,e)=>new Vp({innerType:t,typeName:bt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ot(e)});class Gp extends Ut{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Rp(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Hi(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Hi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Gp.create=(t,e)=>new Gp({innerType:t,typeName:bt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ot(e)});class Xy extends Ut{_parse(e){if(this._getType(e)!==ze.nan){const r=this._getOrReturnCtx(e);return Ue(r,{code:je.invalid_type,expected:ze.nan,received:r.parsedType}),Ct}return{status:"valid",value:e.data}}}Xy.create=t=>new Xy({typeName:bt.ZodNaN,...Ot(t)});const kie=Symbol("zod_brand");class yN extends Ut{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Qm extends Ut{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Ct:o.status==="dirty"?(n.dirty(),Hu(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ct:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new Qm({in:e,out:n,typeName:bt.ZodPipeline})}}class Kp extends Ut{_parse(e){const n=this._def.innerType._parse(e),r=i=>(Ip(i)&&(i.value=Object.freeze(i.value)),i);return Rp(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Kp.create=(t,e)=>new Kp({innerType:t,typeName:bt.ZodReadonly,...Ot(e)});function wU(t,e={},n){return t?Id.create().superRefine((r,i)=>{var o,s;if(!t(r)){const l=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,c=(s=(o=l.fatal)!==null&&o!==void 0?o:n)!==null&&s!==void 0?s:!0,u=typeof l=="string"?{message:l}:l;i.addIssue({code:"custom",...u,fatal:c})}}):Id.create()}const Oie={object:Mn.lazycreate};var bt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(bt||(bt={}));const Iie=(t,e={message:`Input not instance of ${t.name}`})=>wU(n=>n instanceof t,e),SU=Io.create,CU=Il.create,Rie=Xy.create,Mie=Rl.create,AU=Mp.create,Die=Qc.create,$ie=qy.create,Lie=Dp.create,Fie=$p.create,Uie=Id.create,Bie=Pc.create,Hie=ba.create,zie=Yy.create,Vie=Fo.create,Gie=Mn.create,Kie=Mn.strictCreate,Wie=Lp.create,qie=p0.create,Yie=Fp.create,Qie=Os.create,Xie=Up.create,Jie=Qy.create,Zie=Xc.create,eoe=od.create,toe=Bp.create,noe=Hp.create,roe=Ml.create,ioe=zp.create,ooe=Rd.create,wI=Qo.create,soe=Cs.create,aoe=Dl.create,loe=Qo.createWithPreprocess,coe=Qm.create,uoe=()=>SU().optional(),doe=()=>CU().optional(),foe=()=>AU().optional(),hoe={string:t=>Io.create({...t,coerce:!0}),number:t=>Il.create({...t,coerce:!0}),boolean:t=>Mp.create({...t,coerce:!0}),bigint:t=>Rl.create({...t,coerce:!0}),date:t=>Qc.create({...t,coerce:!0})},poe=Ct;var Oe=Object.freeze({__proto__:null,defaultErrorMap:Od,setErrorMap:pie,getErrorMap:Gy,makeIssue:Ky,EMPTY_PATH:mie,addIssueToContext:Ue,ParseStatus:qr,INVALID:Ct,DIRTY:Hu,OK:li,isAborted:R1,isDirty:M1,isValid:Ip,isAsync:Rp,get util(){return Wt},get objectUtil(){return I1},ZodParsedType:ze,getParsedType:Wa,ZodType:Ut,datetimeRegex:xU,ZodString:Io,ZodNumber:Il,ZodBigInt:Rl,ZodBoolean:Mp,ZodDate:Qc,ZodSymbol:qy,ZodUndefined:Dp,ZodNull:$p,ZodAny:Id,ZodUnknown:Pc,ZodNever:ba,ZodVoid:Yy,ZodArray:Fo,ZodObject:Mn,ZodUnion:Lp,ZodDiscriminatedUnion:p0,ZodIntersection:Fp,ZodTuple:Os,ZodRecord:Up,ZodMap:Qy,ZodSet:Xc,ZodFunction:od,ZodLazy:Bp,ZodLiteral:Hp,ZodEnum:Ml,ZodNativeEnum:zp,ZodPromise:Rd,ZodEffects:Qo,ZodTransformer:Qo,ZodOptional:Cs,ZodNullable:Dl,ZodDefault:Vp,ZodCatch:Gp,ZodNaN:Xy,BRAND:kie,ZodBranded:yN,ZodPipeline:Qm,ZodReadonly:Kp,custom:wU,Schema:Ut,ZodSchema:Ut,late:Oie,get ZodFirstPartyTypeKind(){return bt},coerce:hoe,any:Uie,array:Vie,bigint:Mie,boolean:AU,date:Die,discriminatedUnion:qie,effect:wI,enum:roe,function:eoe,instanceof:Iie,intersection:Yie,lazy:toe,literal:noe,map:Jie,nan:Rie,nativeEnum:ioe,never:Hie,null:Fie,nullable:aoe,number:CU,object:Gie,oboolean:foe,onumber:doe,optional:soe,ostring:uoe,pipeline:coe,preprocess:loe,promise:ooe,record:Xie,set:Zie,strictObject:Kie,string:SU,symbol:$ie,transformer:wI,tuple:Qie,undefined:Lie,union:Wie,unknown:Bie,void:zie,NEVER:poe,ZodIssueCode:je,quotelessJson:hie,ZodError:Hi}),moe="Label",_U=y.forwardRef((t,e)=>a.jsx(et.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));_U.displayName=moe;var jU=_U;const goe=cN("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),to=y.forwardRef(({className:t,...e},n)=>a.jsx(jU,{ref:n,className:Pe(goe(),t),...e}));to.displayName=jU.displayName;const m0=qre,EU=y.createContext({}),dt=({...t})=>a.jsx(EU.Provider,{value:{name:t.name},children:a.jsx(Jre,{...t})}),g0=()=>{const t=y.useContext(EU),e=y.useContext(NU),{getFieldState:n,formState:r}=d0(),i=n(t.name,r);if(!t)throw new Error("useFormField should be used within ");const{id:o}=e;return{id:o,name:t.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...i}},NU=y.createContext({}),it=y.forwardRef(({className:t,...e},n)=>{const r=y.useId();return a.jsx(NU.Provider,{value:{id:r},children:a.jsx("div",{ref:n,className:Pe("space-y-2",t),...e})})});it.displayName="FormItem";const ot=y.forwardRef(({className:t,...e},n)=>{const{error:r,formItemId:i}=g0();return a.jsx(to,{ref:n,className:Pe(r&&"text-destructive",t),htmlFor:i,...e})});ot.displayName="FormLabel";const st=y.forwardRef(({...t},e)=>{const{error:n,formItemId:r,formDescriptionId:i,formMessageId:o}=g0();return a.jsx(Es,{ref:e,id:r,"aria-describedby":n?`${i} ${o}`:`${i}`,"aria-invalid":!!n,...t})});st.displayName="FormControl";const xn=y.forwardRef(({className:t,...e},n)=>{const{formDescriptionId:r}=g0();return a.jsx("p",{ref:n,id:r,className:Pe("text-sm text-muted-foreground",t),...e})});xn.displayName="FormDescription";const at=y.forwardRef(({className:t,children:e,...n},r)=>{const{error:i,formMessageId:o}=g0(),s=i?String(i==null?void 0:i.message):e;return s?a.jsx("p",{ref:r,id:o,className:Pe("text-sm font-medium text-destructive",t),...n,children:s}):null});at.displayName="FormMessage";const Dt=y.forwardRef(({className:t,type:e,...n},r)=>a.jsx("input",{type:e,className:Pe("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",t),ref:r,...n}));Dt.displayName="Input";const lt=y.forwardRef(({className:t,...e},n)=>a.jsx("textarea",{className:Pe("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",t),ref:n,...e}));lt.displayName="Textarea";function Wp(t,[e,n]){return Math.min(n,Math.max(e,t))}function voe(t,e=[]){let n=[];function r(o,s){const l=y.createContext(s),c=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][c])||l,v=y.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:v,children:p})}function d(f,h){const p=(h==null?void 0:h[t][c])||l,g=y.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>y.createContext(s));return function(l){const c=(l==null?void 0:l[t])||o;return y.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,yoe(i,...e)]}function yoe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(o)[`__scope${u}`];return{...l,...f}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}function v0(t){const e=t+"CollectionProvider",[n,r]=voe(e),[i,o]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:g,children:m}=p,v=T.useRef(null),b=T.useRef(new Map).current;return a.jsx(i,{scope:g,itemMap:b,collectionRef:v,children:m})};s.displayName=e;const l=t+"CollectionSlot",c=T.forwardRef((p,g)=>{const{scope:m,children:v}=p,b=o(l,m),x=At(g,b.collectionRef);return a.jsx(Es,{ref:x,children:v})});c.displayName=l;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=T.forwardRef((p,g)=>{const{scope:m,children:v,...b}=p,x=T.useRef(null),w=At(g,x),S=o(u,m);return T.useEffect(()=>(S.itemMap.set(x,{ref:x,...b}),()=>void S.itemMap.delete(x))),a.jsx(Es,{[d]:"",ref:w,children:v})});f.displayName=u;function h(p){const g=o(t+"CollectionConsumer",p);return T.useCallback(()=>{const v=g.collectionRef.current;if(!v)return[];const b=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((S,C)=>b.indexOf(S.ref.current)-b.indexOf(C.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:c,ItemSlot:f},h,r]}var xoe=y.createContext(void 0);function uu(t){const e=y.useContext(xoe);return t||e||"ltr"}var pS=0;function xN(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??SI()),document.body.insertAdjacentElement("beforeend",t[1]??SI()),pS++,()=>{pS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),pS--}},[])}function SI(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var mS="focusScope.autoFocusOnMount",gS="focusScope.autoFocusOnUnmount",CI={bubbles:!1,cancelable:!0},boe="FocusScope",y0=y.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=t,[l,c]=y.useState(null),u=dr(i),d=dr(o),f=y.useRef(null),h=At(e,m=>c(m)),p=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let m=function(w){if(p.paused||!l)return;const S=w.target;l.contains(S)?f.current=S:$a(f.current,{select:!0})},v=function(w){if(p.paused||!l)return;const S=w.relatedTarget;S!==null&&(l.contains(S)||$a(f.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&$a(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",v);const x=new MutationObserver(b);return l&&x.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",v),x.disconnect()}}},[r,l,p.paused]),y.useEffect(()=>{if(l){_I.add(p);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(mS,CI);l.addEventListener(mS,u),l.dispatchEvent(b),b.defaultPrevented||(woe(joe(TU(l)),{select:!0}),document.activeElement===m&&$a(l))}return()=>{l.removeEventListener(mS,u),setTimeout(()=>{const b=new CustomEvent(gS,CI);l.addEventListener(gS,d),l.dispatchEvent(b),b.defaultPrevented||$a(m??document.body,{select:!0}),l.removeEventListener(gS,d),_I.remove(p)},0)}}},[l,u,d,p]);const g=y.useCallback(m=>{if(!n&&!r||p.paused)return;const v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(v&&b){const x=m.currentTarget,[w,S]=Soe(x);w&&S?!m.shiftKey&&b===S?(m.preventDefault(),n&&$a(w,{select:!0})):m.shiftKey&&b===w&&(m.preventDefault(),n&&$a(S,{select:!0})):b===x&&m.preventDefault()}},[n,r,p.paused]);return a.jsx(et.div,{tabIndex:-1,...s,ref:h,onKeyDown:g})});y0.displayName=boe;function woe(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if($a(r,{select:e}),document.activeElement!==n)return}function Soe(t){const e=TU(t),n=AI(e,t),r=AI(e.reverse(),t);return[n,r]}function TU(t){const e=[],n=document.createTreeWalker(t,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();)e.push(n.currentNode);return e}function AI(t,e){for(const n of t)if(!Coe(n,{upTo:e}))return n}function Coe(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Aoe(t){return t instanceof HTMLInputElement&&"select"in t}function $a(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&Aoe(t)&&e&&t.select()}}var _I=_oe();function _oe(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=jI(t,e),t.unshift(e)},remove(e){var n;t=jI(t,e),(n=t[0])==null||n.resume()}}}function jI(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function joe(t){return t.filter(e=>e.tagName!=="A")}function Xm(t){const e=y.useRef({value:t,previous:t});return y.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Eoe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},bu=new WeakMap,Kg=new WeakMap,Wg={},vS=0,PU=function(t){return t&&(t.host||PU(t.parentNode))},Noe=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=PU(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},Toe=function(t,e,n,r){var i=Noe(e,Array.isArray(t)?t:[t]);Wg[n]||(Wg[n]=new WeakMap);var o=Wg[n],s=[],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=(bu.get(h)||0)+1,v=(o.get(h)||0)+1;bu.set(h,m),o.set(h,v),s.push(h),m===1&&g&&Kg.set(h,!0),v===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(e),l.clear(),vS++,function(){s.forEach(function(f){var h=bu.get(f)-1,p=o.get(f)-1;bu.set(f,h),o.set(f,p),h||(Kg.has(f)||f.removeAttribute(r),Kg.delete(f)),p||f.removeAttribute(n)}),vS--,vS||(bu=new WeakMap,bu=new WeakMap,Kg=new WeakMap,Wg={})}},bN=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=Eoe(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),Toe(r,i,n,"aria-hidden")):function(){return null}},ms=function(){return ms=Object.assign||function(e){for(var n,r=1,i=arguments.length;r"u")return Koe;var e=Woe(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},Yoe=RU(),sd="data-scroll-locked",Qoe=function(t,e,n,r){var i=t.left,o=t.top,s=t.right,l=t.gap;return n===void 0&&(n="margin"),` + .`.concat(koe,` { overflow: hidden `).concat(r,`; padding-right: `).concat(l,"px ").concat(r,`; } @@ -514,115 +514,94 @@ Defaulting to \`null\`.`}var Z5=q5,Kre=Q5;const mc=y.forwardRef(({className:t,va `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),` } - .`).concat(Rv,` { + .`).concat(Iv,` { right: `).concat(l,"px ").concat(r,`; } - .`).concat(Mv,` { + .`).concat(Rv,` { margin-right: `).concat(l,"px ").concat(r,`; } - .`).concat(Rv," .").concat(Rv,` { + .`).concat(Iv," .").concat(Iv,` { right: 0 `).concat(r,`; } - .`).concat(Mv," .").concat(Mv,` { + .`).concat(Rv," .").concat(Rv,` { margin-right: 0 `).concat(r,`; } body[`).concat(sd,`] { - `).concat(Ioe,": ").concat(l,`px; + `).concat(Ooe,": ").concat(l,`px; } -`)},TI=function(){var t=parseInt(document.body.getAttribute(sd)||"0",10);return isFinite(t)?t:0},Zoe=function(){y.useEffect(function(){return document.body.setAttribute(sd,(TI()+1).toString()),function(){var t=TI()-1;t<=0?document.body.removeAttribute(sd):document.body.setAttribute(sd,t.toString())}},[])},Joe=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;Zoe();var o=y.useMemo(function(){return Yoe(i)},[i]);return y.createElement(Qoe,{styles:Xoe(o,!e,i,n?"":"!important")})},L1=!1;if(typeof window<"u")try{var Yg=Object.defineProperty({},"passive",{get:function(){return L1=!0,!0}});window.addEventListener("test",Yg,Yg),window.removeEventListener("test",Yg,Yg)}catch{L1=!1}var wu=L1?{passive:!1}:!1,ese=function(t){return t.tagName==="TEXTAREA"},DU=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!ese(t)&&n[e]==="visible")},tse=function(t){return DU(t,"overflowY")},nse=function(t){return DU(t,"overflowX")},PI=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=$U(t,r);if(i){var o=LU(t,r),s=o[1],l=o[2];if(s>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},rse=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},ise=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},$U=function(t,e){return t==="v"?tse(e):nse(e)},LU=function(t,e){return t==="v"?rse(e):ise(e)},ose=function(t,e){return t==="h"&&e==="rtl"?-1:1},sse=function(t,e,n,r,i){var o=ose(t,window.getComputedStyle(e).direction),s=o*r,l=n.target,c=e.contains(l),u=!1,d=s>0,f=0,h=0;do{var p=LU(t,l),g=p[0],m=p[1],v=p[2],b=m-v-o*g;(g||b)&&$U(t,l)&&(f+=b,h+=g),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(e.contains(l)||e===l));return(d&&(Math.abs(f)<1||!i)||!d&&(Math.abs(h)<1||!i))&&(u=!0),u},Qg=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},kI=function(t){return[t.deltaX,t.deltaY]},OI=function(t){return t&&"current"in t?t.current:t},ase=function(t,e){return t[0]===e[0]&&t[1]===e[1]},lse=function(t){return` +`)},NI=function(){var t=parseInt(document.body.getAttribute(sd)||"0",10);return isFinite(t)?t:0},Xoe=function(){y.useEffect(function(){return document.body.setAttribute(sd,(NI()+1).toString()),function(){var t=NI()-1;t<=0?document.body.removeAttribute(sd):document.body.setAttribute(sd,t.toString())}},[])},Joe=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;Xoe();var o=y.useMemo(function(){return qoe(i)},[i]);return y.createElement(Yoe,{styles:Qoe(o,!e,i,n?"":"!important")})},$1=!1;if(typeof window<"u")try{var qg=Object.defineProperty({},"passive",{get:function(){return $1=!0,!0}});window.addEventListener("test",qg,qg),window.removeEventListener("test",qg,qg)}catch{$1=!1}var wu=$1?{passive:!1}:!1,Zoe=function(t){return t.tagName==="TEXTAREA"},MU=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Zoe(t)&&n[e]==="visible")},ese=function(t){return MU(t,"overflowY")},tse=function(t){return MU(t,"overflowX")},TI=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=DU(t,r);if(i){var o=$U(t,r),s=o[1],l=o[2];if(s>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},nse=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},rse=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},DU=function(t,e){return t==="v"?ese(e):tse(e)},$U=function(t,e){return t==="v"?nse(e):rse(e)},ise=function(t,e){return t==="h"&&e==="rtl"?-1:1},ose=function(t,e,n,r,i){var o=ise(t,window.getComputedStyle(e).direction),s=o*r,l=n.target,c=e.contains(l),u=!1,d=s>0,f=0,h=0;do{var p=$U(t,l),g=p[0],m=p[1],v=p[2],b=m-v-o*g;(g||b)&&DU(t,l)&&(f+=b,h+=g),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(e.contains(l)||e===l));return(d&&(Math.abs(f)<1||!i)||!d&&(Math.abs(h)<1||!i))&&(u=!0),u},Yg=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},PI=function(t){return[t.deltaX,t.deltaY]},kI=function(t){return t&&"current"in t?t.current:t},sse=function(t,e){return t[0]===e[0]&&t[1]===e[1]},ase=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},cse=0,Su=[];function use(t){var e=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),i=y.useState(cse++)[0],o=y.useState(MU)[0],s=y.useRef(t);y.useEffect(function(){s.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var m=koe([t.lockRef.current],(t.shards||[]).map(OI),!0).filter(Boolean);return m.forEach(function(v){return v.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var l=y.useCallback(function(m,v){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var b=Qg(m),x=n.current,w="deltaX"in m?m.deltaX:x[0]-b[0],S="deltaY"in m?m.deltaY:x[1]-b[1],C,A=m.target,_=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in m&&_==="h"&&A.type==="range")return!1;var j=PI(_,A);if(!j)return!0;if(j?C=_:(C=_==="v"?"h":"v",j=PI(_,A)),!j)return!1;if(!r.current&&"changedTouches"in m&&(w||S)&&(r.current=C),!C)return!0;var k=r.current||C;return sse(k,v,m,k==="h"?w:S,!0)},[]),c=y.useCallback(function(m){var v=m;if(!(!Su.length||Su[Su.length-1]!==o)){var b="deltaY"in v?kI(v):Qg(v),x=e.current.filter(function(C){return C.name===v.type&&(C.target===v.target||v.target===C.shadowParent)&&ase(C.delta,b)})[0];if(x&&x.should){v.cancelable&&v.preventDefault();return}if(!x){var w=(s.current.shards||[]).map(OI).filter(Boolean).filter(function(C){return C.contains(v.target)}),S=w.length>0?l(v,w[0]):!s.current.noIsolation;S&&v.cancelable&&v.preventDefault()}}},[]),u=y.useCallback(function(m,v,b,x){var w={name:m,delta:v,target:b,should:x,shadowParent:dse(b)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(S){return S!==w})},1)},[]),d=y.useCallback(function(m){n.current=Qg(m),r.current=void 0},[]),f=y.useCallback(function(m){u(m.type,kI(m),m.target,l(m,t.lockRef.current))},[]),h=y.useCallback(function(m){u(m.type,Qg(m),m.target,l(m,t.lockRef.current))},[]);y.useEffect(function(){return Su.push(o),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,wu),document.addEventListener("touchmove",c,wu),document.addEventListener("touchstart",d,wu),function(){Su=Su.filter(function(m){return m!==o}),document.removeEventListener("wheel",c,wu),document.removeEventListener("touchmove",c,wu),document.removeEventListener("touchstart",d,wu)}},[]);var p=t.removeScrollBar,g=t.inert;return y.createElement(y.Fragment,null,g?y.createElement(o,{styles:lse(i)}):null,p?y.createElement(Joe,{gapMode:t.gapMode}):null)}function dse(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const fse=Uoe(RU,use);var w0=y.forwardRef(function(t,e){return y.createElement(b0,ms({},t,{ref:e,sideCar:fse}))});w0.classNames=b0.classNames;var hse=[" ","Enter","ArrowUp","ArrowDown"],pse=[" ","Enter"],Jm="Select",[S0,C0,mse]=y0(Jm),[_f,VDe]=ji(Jm,[mse,mf]),A0=mf(),[gse,Vl]=_f(Jm),[vse,yse]=_f(Jm),FU=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:o,value:s,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:h,required:p,form:g}=t,m=A0(e),[v,b]=y.useState(null),[x,w]=y.useState(null),[S,C]=y.useState(!1),A=uu(u),[_=!1,j]=Ko({prop:r,defaultProp:i,onChange:o}),[k,P]=Ko({prop:s,defaultProp:l,onChange:c}),R=y.useRef(null),E=v?g||!!v.closest("form"):!0,[I,L]=y.useState(new Set),V=Array.from(I).map($=>$.props.value).join(";");return a.jsx(PF,{...m,children:a.jsxs(gse,{required:p,scope:e,trigger:v,onTriggerChange:b,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Do(),value:k,onValueChange:P,open:_,onOpenChange:j,dir:A,triggerPointerDownPosRef:R,disabled:h,children:[a.jsx(S0.Provider,{scope:e,children:a.jsx(vse,{scope:t.__scopeSelect,onNativeOptionAdd:y.useCallback($=>{L(z=>new Set(z).add($))},[]),onNativeOptionRemove:y.useCallback($=>{L(z=>{const M=new Set(z);return M.delete($),M})},[]),children:n})}),E?a.jsxs(uB,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:k,onChange:$=>P($.target.value),disabled:h,form:g,children:[k===void 0?a.jsx("option",{value:""}):null,Array.from(I)]},V):null]})})};FU.displayName=Jm;var UU="SelectTrigger",BU=y.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,o=A0(n),s=Vl(UU,n),l=s.disabled||r,c=_t(e,s.onTriggerChange),u=C0(n),d=y.useRef("touch"),[f,h,p]=dB(m=>{const v=u().filter(w=>!w.disabled),b=v.find(w=>w.value===s.value),x=fB(v,m,b);x!==void 0&&s.onValueChange(x.value)}),g=m=>{l||(s.onOpenChange(!0),p()),m&&(s.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return a.jsx(Ij,{asChild:!0,...o,children:a.jsx(et.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":cB(s.value)?"":void 0,...i,ref:c,onClick:Pe(i.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&g(m)}),onPointerDown:Pe(i.onPointerDown,m=>{d.current=m.pointerType;const v=m.target;v.hasPointerCapture(m.pointerId)&&v.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:Pe(i.onKeyDown,m=>{const v=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&h(m.key),!(v&&m.key===" ")&&hse.includes(m.key)&&(g(),m.preventDefault())})})})});BU.displayName=UU;var HU="SelectValue",zU=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:o,placeholder:s="",...l}=t,c=Vl(HU,n),{onValueNodeHasChildrenChange:u}=c,d=o!==void 0,f=_t(e,c.onValueNodeChange);return Rr(()=>{u(d)},[u,d]),a.jsx(et.span,{...l,ref:f,style:{pointerEvents:"none"},children:cB(c.value)?a.jsx(a.Fragment,{children:s}):o})});zU.displayName=HU;var xse="SelectIcon",VU=y.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return a.jsx(et.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});VU.displayName=xse;var bse="SelectPortal",GU=t=>a.jsx(Mb,{asChild:!0,...t});GU.displayName=bse;var Zc="SelectContent",KU=y.forwardRef((t,e)=>{const n=Vl(Zc,t.__scopeSelect),[r,i]=y.useState();if(Rr(()=>{i(new DocumentFragment)},[]),!n.open){const o=r;return o?ff.createPortal(a.jsx(WU,{scope:t.__scopeSelect,children:a.jsx(S0.Slot,{scope:t.__scopeSelect,children:a.jsx("div",{children:t.children})})}),o):null}return a.jsx(qU,{...t,ref:e})});KU.displayName=Zc;var So=10,[WU,Gl]=_f(Zc),wse="SelectContentImpl",qU=y.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:s,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:v,...b}=t,x=Vl(Zc,n),[w,S]=y.useState(null),[C,A]=y.useState(null),_=_t(e,ce=>S(ce)),[j,k]=y.useState(null),[P,R]=y.useState(null),E=C0(n),[I,L]=y.useState(!1),V=y.useRef(!1);y.useEffect(()=>{if(w)return wN(w)},[w]),bN();const $=y.useCallback(ce=>{const[Me,...pe]=E().map(ne=>ne.ref.current),[Se]=pe.slice(-1),Te=document.activeElement;for(const ne of ce)if(ne===Te||(ne==null||ne.scrollIntoView({block:"nearest"}),ne===Me&&C&&(C.scrollTop=0),ne===Se&&C&&(C.scrollTop=C.scrollHeight),ne==null||ne.focus(),document.activeElement!==Te))return},[E,C]),z=y.useCallback(()=>$([j,w]),[$,j,w]);y.useEffect(()=>{I&&z()},[I,z]);const{onOpenChange:M,triggerPointerDownPosRef:U}=x;y.useEffect(()=>{if(w){let ce={x:0,y:0};const Me=Se=>{var Te,ne;ce={x:Math.abs(Math.round(Se.pageX)-(((Te=U.current)==null?void 0:Te.x)??0)),y:Math.abs(Math.round(Se.pageY)-(((ne=U.current)==null?void 0:ne.y)??0))}},pe=Se=>{ce.x<=10&&ce.y<=10?Se.preventDefault():w.contains(Se.target)||M(!1),document.removeEventListener("pointermove",Me),U.current=null};return U.current!==null&&(document.addEventListener("pointermove",Me),document.addEventListener("pointerup",pe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Me),document.removeEventListener("pointerup",pe,{capture:!0})}}},[w,M,U]),y.useEffect(()=>{const ce=()=>M(!1);return window.addEventListener("blur",ce),window.addEventListener("resize",ce),()=>{window.removeEventListener("blur",ce),window.removeEventListener("resize",ce)}},[M]);const[K,X]=dB(ce=>{const Me=E().filter(Te=>!Te.disabled),pe=Me.find(Te=>Te.ref.current===document.activeElement),Se=fB(Me,ce,pe);Se&&setTimeout(()=>Se.ref.current.focus())}),re=y.useCallback((ce,Me,pe)=>{const Se=!V.current&&!pe;(x.value!==void 0&&x.value===Me||Se)&&(k(ce),Se&&(V.current=!0))},[x.value]),xe=y.useCallback(()=>w==null?void 0:w.focus(),[w]),F=y.useCallback((ce,Me,pe)=>{const Se=!V.current&&!pe;(x.value!==void 0&&x.value===Me||Se)&&R(ce)},[x.value]),ue=r==="popper"?F1:YU,ie=ue===F1?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:v}:{};return a.jsx(WU,{scope:n,content:w,viewport:C,onViewportChange:A,itemRefCallback:re,selectedItem:j,onItemLeave:xe,itemTextRefCallback:F,focusSelectedItem:z,selectedItemText:P,position:r,isPositioned:I,searchRef:K,children:a.jsx(w0,{as:Es,allowPinchZoom:!0,children:a.jsx(x0,{asChild:!0,trapped:x.open,onMountAutoFocus:ce=>{ce.preventDefault()},onUnmountAutoFocus:Pe(i,ce=>{var Me;(Me=x.trigger)==null||Me.focus({preventScroll:!0}),ce.preventDefault()}),children:a.jsx(zm,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:ce=>ce.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:a.jsx(ue,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:ce=>ce.preventDefault(),...b,...ie,onPlaced:()=>L(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Pe(b.onKeyDown,ce=>{const Me=ce.ctrlKey||ce.altKey||ce.metaKey;if(ce.key==="Tab"&&ce.preventDefault(),!Me&&ce.key.length===1&&X(ce.key),["ArrowUp","ArrowDown","Home","End"].includes(ce.key)){let Se=E().filter(Te=>!Te.disabled).map(Te=>Te.ref.current);if(["ArrowUp","End"].includes(ce.key)&&(Se=Se.slice().reverse()),["ArrowUp","ArrowDown"].includes(ce.key)){const Te=ce.target,ne=Se.indexOf(Te);Se=Se.slice(ne+1)}setTimeout(()=>$(Se)),ce.preventDefault()}})})})})})})});qU.displayName=wse;var Sse="SelectItemAlignedPosition",YU=y.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,o=Vl(Zc,n),s=Gl(Zc,n),[l,c]=y.useState(null),[u,d]=y.useState(null),f=_t(e,_=>d(_)),h=C0(n),p=y.useRef(!1),g=y.useRef(!0),{viewport:m,selectedItem:v,selectedItemText:b,focusSelectedItem:x}=s,w=y.useCallback(()=>{if(o.trigger&&o.valueNode&&l&&u&&m&&v&&b){const _=o.trigger.getBoundingClientRect(),j=u.getBoundingClientRect(),k=o.valueNode.getBoundingClientRect(),P=b.getBoundingClientRect();if(o.dir!=="rtl"){const Te=P.left-j.left,ne=k.left-Te,rt=_.left-ne,Fe=_.width+rt,vt=Math.max(Fe,j.width),mt=window.innerWidth-So,Bt=qp(ne,[So,Math.max(So,mt-vt)]);l.style.minWidth=Fe+"px",l.style.left=Bt+"px"}else{const Te=j.right-P.right,ne=window.innerWidth-k.right-Te,rt=window.innerWidth-_.right-ne,Fe=_.width+rt,vt=Math.max(Fe,j.width),mt=window.innerWidth-So,Bt=qp(ne,[So,Math.max(So,mt-vt)]);l.style.minWidth=Fe+"px",l.style.right=Bt+"px"}const R=h(),E=window.innerHeight-So*2,I=m.scrollHeight,L=window.getComputedStyle(u),V=parseInt(L.borderTopWidth,10),$=parseInt(L.paddingTop,10),z=parseInt(L.borderBottomWidth,10),M=parseInt(L.paddingBottom,10),U=V+$+I+M+z,K=Math.min(v.offsetHeight*5,U),X=window.getComputedStyle(m),re=parseInt(X.paddingTop,10),xe=parseInt(X.paddingBottom,10),F=_.top+_.height/2-So,ue=E-F,ie=v.offsetHeight/2,ce=v.offsetTop+ie,Me=V+$+ce,pe=U-Me;if(Me<=F){const Te=R.length>0&&v===R[R.length-1].ref.current;l.style.bottom="0px";const ne=u.clientHeight-m.offsetTop-m.offsetHeight,rt=Math.max(ue,ie+(Te?xe:0)+ne+z),Fe=Me+rt;l.style.height=Fe+"px"}else{const Te=R.length>0&&v===R[0].ref.current;l.style.top="0px";const rt=Math.max(F,V+m.offsetTop+(Te?re:0)+ie)+pe;l.style.height=rt+"px",m.scrollTop=Me-F+m.offsetTop}l.style.margin=`${So}px 0`,l.style.minHeight=K+"px",l.style.maxHeight=E+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,o.trigger,o.valueNode,l,u,m,v,b,o.dir,r]);Rr(()=>w(),[w]);const[S,C]=y.useState();Rr(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const A=y.useCallback(_=>{_&&g.current===!0&&(w(),x==null||x(),g.current=!1)},[w,x]);return a.jsx(Ase,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:A,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:a.jsx(et.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});YU.displayName=Sse;var Cse="SelectPopperPosition",F1=y.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=So,...o}=t,s=A0(n);return a.jsx(Rj,{...s,...o,ref:e,align:r,collisionPadding:i,style:{boxSizing:"border-box",...o.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)"}})});F1.displayName=Cse;var[Ase,SN]=_f(Zc,{}),U1="SelectViewport",QU=y.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,o=Gl(U1,n),s=SN(U1,n),l=_t(e,o.onViewportChange),c=y.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(S0.Slot,{scope:n,children:a.jsx(et.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Pe(i.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=s;if(h!=null&&h.current&&f){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-So*2,m=parseFloat(f.style.minHeight),v=parseFloat(f.style.height),b=Math.max(m,v);if(b0?S:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});QU.displayName=U1;var XU="SelectGroup",[_se,jse]=_f(XU),Ese=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Do();return a.jsx(_se,{scope:n,id:i,children:a.jsx(et.div,{role:"group","aria-labelledby":i,...r,ref:e})})});Ese.displayName=XU;var ZU="SelectLabel",JU=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=jse(ZU,n);return a.jsx(et.div,{id:i.id,...r,ref:e})});JU.displayName=ZU;var Jy="SelectItem",[Nse,eB]=_f(Jy),tB=y.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:o,...s}=t,l=Vl(Jy,n),c=Gl(Jy,n),u=l.value===r,[d,f]=y.useState(o??""),[h,p]=y.useState(!1),g=_t(e,x=>{var w;return(w=c.itemRefCallback)==null?void 0:w.call(c,x,r,i)}),m=Do(),v=y.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(Nse,{scope:n,value:r,disabled:i,textId:m,isSelected:u,onItemTextChange:y.useCallback(x=>{f(w=>w||((x==null?void 0:x.textContent)??"").trim())},[]),children:a.jsx(S0.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:a.jsx(et.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,...s,ref:g,onFocus:Pe(s.onFocus,()=>p(!0)),onBlur:Pe(s.onBlur,()=>p(!1)),onClick:Pe(s.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:Pe(s.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:Pe(s.onPointerDown,x=>{v.current=x.pointerType}),onPointerMove:Pe(s.onPointerMove,x=>{var w;v.current=x.pointerType,i?(w=c.onItemLeave)==null||w.call(c):v.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Pe(s.onPointerLeave,x=>{var w;x.currentTarget===document.activeElement&&((w=c.onItemLeave)==null||w.call(c))}),onKeyDown:Pe(s.onKeyDown,x=>{var S;((S=c.searchRef)==null?void 0:S.current)!==""&&x.key===" "||(pse.includes(x.key)&&b(),x.key===" "&&x.preventDefault())})})})})});tB.displayName=Jy;var jh="SelectItemText",nB=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...o}=t,s=Vl(jh,n),l=Gl(jh,n),c=eB(jh,n),u=yse(jh,n),[d,f]=y.useState(null),h=_t(e,b=>f(b),c.onItemTextChange,b=>{var x;return(x=l.itemTextRefCallback)==null?void 0:x.call(l,b,c.value,c.disabled)}),p=d==null?void 0:d.textContent,g=y.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:v}=u;return Rr(()=>(m(g),()=>v(g)),[m,v,g]),a.jsxs(a.Fragment,{children:[a.jsx(et.span,{id:c.textId,...o,ref:h}),c.isSelected&&s.valueNode&&!s.valueNodeHasChildren?ff.createPortal(o.children,s.valueNode):null]})});nB.displayName=jh;var rB="SelectItemIndicator",iB=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return eB(rB,n).isSelected?a.jsx(et.span,{"aria-hidden":!0,...r,ref:e}):null});iB.displayName=rB;var B1="SelectScrollUpButton",oB=y.forwardRef((t,e)=>{const n=Gl(B1,t.__scopeSelect),r=SN(B1,t.__scopeSelect),[i,o]=y.useState(!1),s=_t(e,r.onScrollButtonChange);return Rr(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;o(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),i?a.jsx(aB,{...t,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});oB.displayName=B1;var H1="SelectScrollDownButton",sB=y.forwardRef((t,e)=>{const n=Gl(H1,t.__scopeSelect),r=SN(H1,t.__scopeSelect),[i,o]=y.useState(!1),s=_t(e,r.onScrollButtonChange);return Rr(()=>{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(aB,{...t,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});sB.displayName=H1;var aB=y.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,o=Gl("SelectScrollButton",n),s=y.useRef(null),l=C0(n),c=y.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return y.useEffect(()=>()=>c(),[c]),Rr(()=>{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(et.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:Pe(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:Pe(i.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:Pe(i.onPointerLeave,()=>{c()})})}),Tse="SelectSeparator",lB=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return a.jsx(et.div,{"aria-hidden":!0,...r,ref:e})});lB.displayName=Tse;var z1="SelectArrow",Pse=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=A0(n),o=Vl(z1,n),s=Gl(z1,n);return o.open&&s.position==="popper"?a.jsx(Mj,{...i,...r,ref:e}):null});Pse.displayName=z1;function cB(t){return t===""||t===void 0}var uB=y.forwardRef((t,e)=>{const{value:n,...r}=t,i=y.useRef(null),o=_t(e,i),s=Zm(n);return y.useEffect(()=>{const l=i.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(s!==n&&d){const f=new Event("change",{bubbles:!0});d.call(l,n),l.dispatchEvent(f)}},[s,n]),a.jsx(Dj,{asChild:!0,children:a.jsx("select",{...r,ref:o,defaultValue:n})})});uB.displayName="BubbleSelect";function dB(t){const e=dr(t),n=y.useRef(""),r=y.useRef(0),i=y.useCallback(s=>{const l=n.current+s;e(l),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[e]),o=y.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function fB(t,e,n){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,o=n?t.indexOf(n):-1;let s=kse(t,Math.max(o,0));i.length===1&&(s=s.filter(u=>u!==n));const c=s.find(u=>u.textValue.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function kse(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Ose=FU,hB=BU,Ise=zU,Rse=VU,Mse=GU,pB=KU,Dse=QU,mB=JU,gB=tB,$se=nB,Lse=iB,vB=oB,yB=sB,xB=lB;const kn=Ose,On=Ise,Nn=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(hB,{ref:r,className:ke("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",t),...n,children:[e,a.jsx(Rse,{asChild:!0,children:a.jsx(va,{className:"h-4 w-4 opacity-50"})})]}));Nn.displayName=hB.displayName;const bB=y.forwardRef(({className:t,...e},n)=>a.jsx(vB,{ref:n,className:ke("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(Hc,{className:"h-4 w-4"})}));bB.displayName=vB.displayName;const wB=y.forwardRef(({className:t,...e},n)=>a.jsx(yB,{ref:n,className:ke("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(va,{className:"h-4 w-4"})}));wB.displayName=yB.displayName;const Tn=y.forwardRef(({className:t,children:e,position:n="popper",...r},i)=>a.jsx(Mse,{children:a.jsxs(pB,{ref:i,className:ke("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",t),position:n,...r,children:[a.jsx(bB,{}),a.jsx(Dse,{className:ke("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(wB,{})]})}));Tn.displayName=pB.displayName;const Fse=y.forwardRef(({className:t,...e},n)=>a.jsx(mB,{ref:n,className:ke("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));Fse.displayName=mB.displayName;const le=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(gB,{ref:r,className:ke("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",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Lse,{children:a.jsx(Ts,{className:"h-4 w-4"})})}),a.jsx($se,{children:e})]}));le.displayName=gB.displayName;const Use=y.forwardRef(({className:t,...e},n)=>a.jsx(xB,{ref:n,className:ke("-mx-1 my-1 h-px bg-muted",t),...e}));Use.displayName=xB.displayName;const Bse=Ie.object({audienceBrief:Ie.string().min(10,{message:"Audience brief must be at least 10 characters."}),researchObjective:Ie.string().optional(),personaCount:Ie.string().min(1,{message:"Number of personas is required."}),dataFile:Ie.instanceof(FileList).optional(),llm_model:Ie.string().optional()});function Hse({onSubmit:t,isGenerating:e}){const[n,r]=y.useState(!1),[i,o]=y.useState(!1),[s,l]=y.useState({audience_brief:[],research_objective:[]}),[c,u]=y.useState(!1),[d,f]=y.useState(null),h=h0({resolver:p0(Bse),defaultValues:{audienceBrief:"",researchObjective:"",personaCount:"5",llm_model:"gemini-2.5-pro"}}),p=h.watch("audienceBrief"),g=h.watch("researchObjective"),m=async()=>{var w,S,C,A,_,j,k,P,R,E,I;const b=p==null?void 0:p.trim(),x=g==null?void 0:g.trim();if(!b||b.length<10){se.error("Audience brief too short",{description:"Please enter at least 10 characters in the audience brief"});return}if(!x||x.length<10){se.error("Research objective too short",{description:"Please enter at least 10 characters in the research objective"});return}u(!0),f(null);try{const L=await Ks.enhanceAudienceBrief(b,x);l(L.data.suggestions||{audience_brief:[],research_objective:[]}),r(!0),o(!1);const V=(((S=(w=L.data.suggestions)==null?void 0:w.audience_brief)==null?void 0:S.length)||0)+(((A=(C=L.data.suggestions)==null?void 0:C.research_objective)==null?void 0:A.length)||0);se.success("Enhancement suggestions generated",{description:`Generated ${V} suggestions to improve your research inputs`})}catch(L){console.error("Error enhancing audience brief:",L);let V="Please try again or modify your brief",$="Failed to generate suggestions";if(L&&typeof L=="object"){const z=L;z.code==="ECONNABORTED"||(_=z.message)!=null&&_.includes("timeout")?($="Request timeout",V="The AI took too long to analyze your brief. Please try again."):((j=z.response)==null?void 0:j.status)===500?($="Server error",V=((P=(k=z.response)==null?void 0:k.data)==null?void 0:P.message)||"The server encountered an error. Please try again later."):((R=z.response)==null?void 0:R.status)===400?($="Invalid brief",V=((I=(E=z.response)==null?void 0:E.data)==null?void 0:I.message)||"Please check your audience brief and try again."):z.message&&(V=z.message)}else L instanceof Error&&(V=L.message);f(V),se.error($,{description:V,duration:5e3})}finally{u(!1)}},v=()=>{o(!i)};return a.jsx(g0,{...h,children:a.jsxs("form",{onSubmit:h.handleSubmit(t),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(dt,{control:h.control,name:"audienceBrief",render:({field:b})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Audience Brief"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Describe your target audience and research goals...",className:"h-40",...b})}),a.jsx(xn,{children:"Provide details about the demographics, behaviors, and attitudes you want to explore"}),a.jsx(lt,{})]})}),a.jsx(dt,{control:h.control,name:"researchObjective",render:({field:b})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Research Objective"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"What is the main research topic or objective you want to explore?",className:"h-32",...b})}),a.jsx(xn,{children:"Specify your research focus to generate more targeted persona goals, frustrations, and scenarios"}),a.jsx(lt,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx(te,{type:"button",variant:"outline",size:"sm",onClick:m,disabled:!p||p.trim().length<10||!g||g.trim().length<10||c||e,className:"flex items-center gap-2 hover-transition",children:c?a.jsxs(a.Fragment,{children:[a.jsx(td,{className:"h-4 w-4 animate-spin"}),"Analyzing Research Inputs..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Vc,{className:"h-4 w-4"}),"Enhance Brief"]})})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(dt,{control:h.control,name:"dataFile",render:({field:{value:b,onChange:x,...w}})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Customer Data (Optional)"}),a.jsx(at,{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(u4,{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(Dt,{...w,type:"file",multiple:!0,accept:".pdf,.docx,.pptx,.xlsx,.html,.xml,.rtf,.pages,.key,.epub,.txt,.csv,.jpg,.jpeg,.png",onChange:S=>{x(S.target.files)},className:"hidden",id:"data-file-input"}),a.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:()=>{var S;return(S=document.getElementById("data-file-input"))==null?void 0:S.click()},children:[a.jsx(f4,{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(xn,{children:"Upload existing customer data to create more realistic personas"}),a.jsx(lt,{})]})}),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(a1,{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(wh,{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(wh,{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(wh,{className:"h-4 w-4 text-green-500 mr-2"}),"Consumer preferences and interests"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(wh,{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(Vc,{className:"h-4 w-4 text-primary"}),"Enhancement Suggestions:"]}),a.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:v,className:"h-6 w-6 p-0 hover:bg-slate-200",title:i?"Expand suggestions":"Collapse suggestions",children:i?a.jsx(va,{className:"h-4 w-4"}):a.jsx(Hc,{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:s.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(Cr,{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:s.audience_brief.map((b,x)=>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})]},x))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No audience brief suggestions available"})}),a.jsx("div",{children:s.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(a1,{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:s.research_objective.map((b,x)=>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})]},x))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No research objective suggestions available"})}),s.audience_brief.length===0&&s.research_objective.length===0&&a.jsx("div",{className:"col-span-full text-sm text-muted-foreground text-center",children:"No suggestions available"})]})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(dt,{control:h.control,name:"llm_model",render:({field:b})=>a.jsxs(ot,{children:[a.jsx(st,{children:"AI Model"}),a.jsxs(kn,{onValueChange:b.onChange,defaultValue:b.value,children:[a.jsx(at,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select AI model"})})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(le,{value:"gpt-4.1",children:"GPT-4.1"})]})]}),a.jsx(xn,{children:"Choose which AI model to use for generating personas"}),a.jsx(lt,{})]})}),a.jsx(dt,{control:h.control,name:"personaCount",render:({field:b})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Number of Personas to Generate"}),a.jsx(at,{children:a.jsx(Dt,{type:"number",min:"1",max:"20",...b})}),a.jsx(xn,{children:"How many synthetic users do you need for your research?"}),a.jsx(lt,{})]})})]}),a.jsxs("div",{className:"flex flex-col items-end",children:[a.jsx(te,{type:"submit",disabled:e,className:"min-w-36",children:e?a.jsxs(a.Fragment,{children:[a.jsx(td,{className:"mr-2 h-4 w-4 animate-spin"}),"AI Generating..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Cr,{className:"mr-2 h-4 w-4"}),"Generate Personas"]})}),e&&a.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:"Generating multiple personas in parallel. This may take 1-2 minutes..."})]})]})})}const ut=y.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ke("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));ut.displayName="Card";const pi=y.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ke("flex flex-col space-y-1.5 p-6",t),...e}));pi.displayName="CardHeader";const Mi=y.forwardRef(({className:t,...e},n)=>a.jsx("h3",{ref:n,className:ke("text-2xl font-semibold leading-none tracking-tight",t),...e}));Mi.displayName="CardTitle";const CN=y.forwardRef(({className:t,...e},n)=>a.jsx("p",{ref:n,className:ke("text-sm text-muted-foreground",t),...e}));CN.displayName="CardDescription";const Et=y.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ke("p-6 pt-0",t),...e}));Et.displayName="CardContent";const AN=y.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ke("flex items-center p-6 pt-0",t),...e}));AN.displayName="CardFooter";const zse=t=>{const e=t==null?void 0:t.toLowerCase(),n="/semblance/";switch(e){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`}},eg=t=>t.avatar||zse(t.gender);function _N({user:t,selected:e=!1,onClick:n,showDetailedDialog:r=!1,onSelectionToggle:i,showAddToFolderButton:o=!1,onAddToFolder:s,onViewDetails:l,folders:c=[]}){const u=Xn();y.useState(!1);const[d,f]=y.useState(t),h=t._id||t.id,p=v=>{v.stopPropagation(),u(`/synthetic-users/${h}`)};d.oceanTraits&&(d.oceanTraits.openness,d.oceanTraits.conscientiousness,d.oceanTraits.extraversion,d.oceanTraits.agreeableness,d.oceanTraits.neuroticism);const g=v=>{var w,S;const b=v.target;b.closest("button")&&((S=(w=b.closest("button"))==null?void 0:w.textContent)!=null&&S.includes("View Details"))||(i?i(v):n&&n(v))},m=v=>{v.stopPropagation(),l?l(d):p(v)};return a.jsxs("div",{className:ke("persona-card glass-card rounded-xl p-4 cursor-pointer hover:shadow-md button-transition",e&&"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(Ts,{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:eg(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((v,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(QX,{className:"h-3 w-3"}),v]},b))})}),d.folder_ids&&d.folder_ids.length>0&&a.jsx("div",{className:"mt-2",children:a.jsxs("div",{className:"flex flex-wrap gap-1",children:[d.folder_ids.slice(0,2).map(v=>{const b=c.find(x=>x._id===v);return b?a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-gray-100 text-gray-700 text-xs rounded-full",title:`In folder: ${b.name}`,children:[a.jsx(Ji,{className:"h-3 w-3"}),b.name]},v):null}),d.folder_ids.length>2&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-gray-100 text-gray-700 text-xs rounded-full",children:[a.jsx(Tr,{className:"h-3 w-3"}),d.folder_ids.length-2," more"]})]})}),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((v,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(Bc,{className:"h-3 w-3"}),v]},b))})}),a.jsx("div",{className:"mt-3 flex justify-end",children:a.jsx(te,{variant:"ghost",size:"sm",onClick:m,children:"View Details"})})]})]})})]})}var jN="Collapsible",[Vse,GDe]=ji(jN),[Gse,EN]=Vse(jN),SB=y.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:o,onOpenChange:s,...l}=t,[c=!1,u]=Ko({prop:r,defaultProp:i,onChange:s});return a.jsx(Gse,{scope:n,disabled:o,contentId:Do(),open:c,onOpenToggle:y.useCallback(()=>u(d=>!d),[u]),children:a.jsx(et.div,{"data-state":TN(c),"data-disabled":o?"":void 0,...l,ref:e})})});SB.displayName=jN;var CB="CollapsibleTrigger",AB=y.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,i=EN(CB,n);return a.jsx(et.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":TN(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:e,onClick:Pe(t.onClick,i.onOpenToggle)})});AB.displayName=CB;var NN="CollapsibleContent",_B=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=EN(NN,t.__scopeCollapsible);return a.jsx(Mr,{present:n||i.open,children:({present:o})=>a.jsx(Kse,{...r,ref:e,present:o})})});_B.displayName=NN;var Kse=y.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:i,...o}=t,s=EN(NN,n),[l,c]=y.useState(r),u=y.useRef(null),d=_t(e,u),f=y.useRef(0),h=f.current,p=y.useRef(0),g=p.current,m=s.open||l,v=y.useRef(m),b=y.useRef();return y.useEffect(()=>{const x=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(x)},[]),Rr(()=>{const x=u.current;if(x){b.current=b.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const w=x.getBoundingClientRect();f.current=w.height,p.current=w.width,v.current||(x.style.transitionDuration=b.current.transitionDuration,x.style.animationName=b.current.animationName),c(r)}},[s.open,r]),a.jsx(et.div,{"data-state":TN(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!m,...o,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:m&&i})});function TN(t){return t?"open":"closed"}var Wse=SB;const tg=Wse,ng=AB,rg=_B;function qse({generatedPersonas:t,selectedPersonas:e,isGenerating:n,onPersonaSelection:r,onRefinePersonas:i,onApprovePersonas:o,onBackToGenerator:s}){const l=Xn(),[c,u]=y.useState(""),[d,f]=y.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:[e.length," of ",t.length," selected"]})]}),a.jsx("div",{className:"space-y-4",children:t.map(p=>a.jsx(ut,{className:`border ${e.includes(p.id)?"border-primary/50 bg-primary/5":""} cursor-pointer`,onClick:()=>h(p.id),children:a.jsx(Et,{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:e.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(_N,{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(te,{variant:"outline",onClick:s,children:[a.jsx(Cp,{className:"mr-2 h-4 w-4"}),"Back to Generator"]})}),a.jsxs(tg,{open:d,onOpenChange:f,className:"w-full space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx(ng,{asChild:!0,children:a.jsxs(te,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(td,{className:"h-4 w-4"}),"Refine Personas",a.jsx(va,{className:"h-4 w-4 ml-1 transition-transform duration-200",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]})}),a.jsxs(te,{onClick:o,disabled:e.length===0,children:[a.jsx(wh,{className:"mr-2 h-4 w-4"}),"Approve Selected (",e.length,")"]})]}),a.jsx(rg,{children:a.jsx(ut,{className:"border shadow-sm w-full mt-4",children:a.jsx(Et,{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(ct,{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(te,{onClick:()=>i(c),disabled:n||c.trim()==="",className:"w-full",children:[n?a.jsx(td,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(td,{className:"mr-2 h-4 w-4"}),"Apply Refinements"]})]})})})})]})]})})]})}async function Yse(t,e,n,r,i,o){console.log(`generateSyntheticPersonas called with targetFolderId: ${i||"none"}`),console.log(`🔄 generateSyntheticPersonas using model: ${o||"gemini-2.5-pro"}`);try{if(console.log(`Generating ${n} synthetic personas using two-stage approach...`),t.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 Ks.uploadCustomerData(r)).data.session_id,console.log(`Customer data uploaded with session ID: ${s}`)}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 Ks.batchGenerateWithStages(t,e,n,.8,s,o);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)`:""}`),i){const f=l.data.personas,h=f.map(p=>p._id||p.id).filter(Boolean);console.log(`Adding ${h.length} newly generated personas to folder: ${i}`);try{await ds.addPersonasBatch(i,h),console.log(`Added ${h.length} newly generated personas to folder: ${i}`)}catch(p){console.error("Error adding personas to folder:",p)}if(s)try{await Ks.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(p){console.warn("Failed to cleanup customer data:",p)}return c||d?{...l.data,length:f.length}:{...l.data,personas:f}}if(s)try{await Ks.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}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(s)try{await Ks.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}return l.data.personas}else if(d){if(s)try{await Ks.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}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(s){if(customerDataSessionId)try{await Ks.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:",s),s}}function jB(){const[t,e]=y.useState([]),n=async o=>{const s=[];for(const l of o){const c={...l};c._id&&typeof c._id=="string"&&c._id.startsWith("local-")&&delete c._id;const u=await kr.create(c);console.log("Persona saved to database:",u.data),s.push({...l,id:u.data._id||u.data.id,_id:u.data._id||u.data.id,isDbPersona:!0})}e(s)},r=async()=>{const o=await kr.getAll();return o&&o.data&&Array.isArray(o.data)?(console.log("Personas loaded from database:",o.data.length),o.data.map(s=>({...s,id:s._id||s.id,isDbPersona:!0}))):[]};return y.useEffect(()=>{(async()=>{const s=await r();e(s)})()},[]),{storedPersonas:t,savePersonas:n,loadPersonas:r,clearPersonas:async()=>{const o=await r();for(const s of o)s._id&&await kr.delete(s._id);e([])}}}function Qse({targetFolderId:t,targetFolderName:e}){const n=Ei(),r=Xn(),{loadPersonas:i,savePersonas:o}=jB(),[s,l]=y.useState(!1),[c,u]=y.useState([]),[d,f]=y.useState([]),[h,p]=y.useState(!1),[g,m]=y.useState(0);y.useEffect(()=>{const C=new URLSearchParams(n.search),A=C.get("mode"),_=C.get("tab"),j=C.get("step");if(A==="create"&&_==="ai"&&j==="review"){const k=i();k.length>0&&(u(k),f(k.map(P=>P.id)),p(!0))}},[n,i]);async function v(C){var A,_,j,k,P,R,E,I,L,V;try{l(!0),m(0);const $=parseInt(C.personaCount);if(isNaN($)||$<1||$>10){se.error("Invalid number of personas",{description:"Please enter a number between 1 and 10"}),l(!1);return}m(5);const z=setInterval(()=>{m(X=>X<90?X+Math.random()*5:X)},500),M=$<=2?"30-60 seconds":$<=4?"1-2 minutes":$<=6?"2-3 minutes":"3-5 minutes";$>4&&se.info("Generation may take longer",{description:`Generating ${$} personas at once may result in some timeouts. If this happens, the successfully created personas will still be saved.`,duration:8e3}),se.info("Generating AI personas in parallel",{description:`Creating ${$} synthetic personas based on your brief. This may take ${M}. Please be patient.`,duration:1e4}),t&&e?(console.log(`Target folder for new personas: ID=${t}, Name=${e}`),se.info(`Creating personas in "${e}" folder`,{duration:3e3})):console.log("No target folder specified for new personas"),console.log(`🤖 Starting persona generation with model: ${C.llm_model||"gemini-2.5-pro"}`);const U=await Yse(C.audienceBrief,C.researchObjective,$,C.dataFile,t,C.llm_model),K=U.personas||U;if(clearInterval(z),m(100),K&&K.length>0)console.log(`✅ Successfully generated ${K.length} personas using model: ${C.llm_model||"gemini-2.5-pro"}`),U.partial_success||U.errors&&U.errors.length>0?(se.success("Some personas generated successfully",{description:`${K.length} synthetic personas were created using ${C.llm_model||"Gemini 2.5 Pro"}. ${((A=U.errors)==null?void 0:A.length)||0} failed due to timeout or other errors.`,duration:8e3}),U.errors&&U.errors.length>0&&setTimeout(()=>{se.error("Some personas failed to generate",{description:`${U.errors.length} personas timed out. The server took too long to generate them. The successfully generated personas have been saved${t?" in the selected folder":""}.`,duration:1e4})},1e3)):se.success("Personas generated and saved successfully",{description:`${K.length} synthetic personas have been created using ${C.llm_model||"Gemini 2.5 Pro"} and saved ${t?`to the "${e}" folder`:"to the database"}.`}),r("/synthetic-users?mode=view");else throw new Error("No personas were generated")}catch($){console.error(`❌ Error generating personas using model: ${C.llm_model||"gemini-2.5-pro"}:`,$);let z="Please try again or adjust your parameters",M="Failed to generate personas";$.code==="ECONNABORTED"||(_=$.message)!=null&&_.includes("timeout")||((j=$.response)==null?void 0:j.status)===504?(M="Generation timeout",z="AI persona generation timed out. This often happens when generating multiple complex personas. Try generating fewer personas (2-3) or try again later."):((k=$.response)==null?void 0:k.status)===500?(M="Server error",(R=(P=$.response)==null?void 0:P.data)!=null&&R.message?z=$.response.data.message:(I=(E=$.response)==null?void 0:E.data)!=null&&I.error?z=$.response.data.error:z="The server encountered an error processing your request. Please try again later."):((L=$.response)==null?void 0:L.status)===401?(M="Authentication required",z="Please log in to generate personas."):(V=$.message)!=null&&V.includes("504 Deadline Exceeded")?(M="Generation timeout",z="The AI model took too long to generate personas. Try generating fewer personas or simplify your brief."):$ instanceof Error&&(z=$.message),se.error(M,{description:z,duration:6e3})}finally{setTimeout(()=>{l(!1),m(0)},500)}}const b=C=>{f(A=>A.includes(C)?A.filter(_=>_!==C):[...A,C])},x=(C,A)=>{const _=A.toLowerCase();return C.map(j=>{const k={...j};if(_.includes("younger")){const P=parseInt(k.age);k.age=(P-5).toString()}else if(_.includes("older")){const P=parseInt(k.age);k.age=(P+5).toString()}if(_.includes("different locations")&&(k.location=`${k.location} (Diversified)`),_.includes("more extroverted")?k.personality=`Extroverted, ${k.personality.toLowerCase()}`:_.includes("more introverted")&&(k.personality=`Introverted, ${k.personality.toLowerCase()}`),_.includes("diverse")){const P=["tech-savvy","traditional","innovative","conservative","creative"],R=P[Math.floor(Math.random()*P.length)];k.personality=`${R}, ${k.personality}`}return k})},w=C=>{if(!C.trim()){se.error("Please provide refinement instructions");return}l(!0),setTimeout(()=>{try{const A=c.filter(k=>d.includes(k.id)),_=x(A,C),j=c.map(k=>_.find(R=>R.id===k.id)||k);u(j),l(!1),o(j),se.success("Personas refined based on your instructions",{description:"Review the updated profiles"})}catch(A){console.error("Error refining personas:",A),se.error("Failed to refine personas",{description:"Please try different instructions"}),l(!1)}},1500)},S=()=>{const C=c.filter(A=>d.includes(A.id));se.success(`${C.length} personas approved`,{description:"Added to your synthetic persona library"}),o(C),r("/synthetic-users?mode=view")};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(Cr,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Persona Recruiter"})]}),s&&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(mc,{value:g,className:"h-2"})]}),h?a.jsx(qse,{generatedPersonas:c,selectedPersonas:d,isGenerating:s,onPersonaSelection:b,onRefinePersonas:w,onApprovePersonas:S,onBackToGenerator:()=>p(!1)}):a.jsx(Hse,{onSubmit:v,isGenerating:s})]})}const $l=new Map;function EB(t){const{id:e,title:n,description:r,type:i="default",duration:o}=t;let s;switch(i){case"success":s=se.success(n,{description:r,duration:o});break;case"error":s=se.error(n,{description:r,duration:o});break;case"warning":s=se.warning(n,{description:r,duration:o});break;case"info":s=se.info(n,{description:r,duration:o});break;default:s=se(n,{description:r,duration:o});break}return $l.set(e,s.toString()),e}function Xse(t,e){const n=$l.get(t);if(!n)return console.warn(`Toast with ID "${t}" not found. Creating new toast instead.`),EB({id:t,...e,title:e.title||"Updated"}),!1;const{title:r,description:i,type:o="default",duration:s}=e;se.dismiss(n);let l;switch(o){case"success":l=se.success(r,{description:i,duration:s});break;case"error":l=se.error(r,{description:i,duration:s});break;case"warning":l=se.warning(r,{description:i,duration:s});break;case"info":l=se.info(r,{description:i,duration:s});break;default:l=se(r,{description:i,duration:s});break}return $l.set(t,l.toString()),!0}function Zse(t){const e=$l.get(t);return e?(se.dismiss(e),$l.delete(t),!0):(console.warn(`Toast with ID "${t}" not found.`),!1)}function Jse(t){return $l.has(t)}function eae(){$l.forEach(t=>{se.dismiss(t)}),$l.clear()}const qe={success:se.success,error:se.error,warning:se.warning,info:se.info,loading:se.loading,dismiss:se.dismiss,createPersistent:EB,updatePersistent:Xse,dismissPersistent:Zse,hasPersistent:Jse,dismissAllPersistent:eae};var NB=["PageUp","PageDown"],TB=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],PB={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},jf="Slider",[V1,tae,nae]=y0(jf),[kB,KDe]=ji(jf,[nae]),[rae,_0]=kB(jf),OB=y.forwardRef((t,e)=>{const{name:n,min:r=0,max:i=100,step:o=1,orientation:s="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:p=!1,form:g,...m}=t,v=y.useRef(new Set),b=y.useRef(0),w=s==="horizontal"?iae:oae,[S=[],C]=Ko({prop:d,defaultProp:u,onChange:R=>{var I;(I=[...v.current][b.current])==null||I.focus(),f(R)}}),A=y.useRef(S);function _(R){const E=uae(S,R);P(R,E)}function j(R){P(R,b.current)}function k(){const R=A.current[b.current];S[b.current]!==R&&h(S)}function P(R,E,{commit:I}={commit:!1}){const L=pae(o),V=mae(Math.round((R-r)/o)*o+r,L),$=qp(V,[r,i]);C((z=[])=>{const M=lae(z,$,E);if(hae(M,c*o)){b.current=M.indexOf($);const U=String(M)!==String(z);return U&&I&&h(M),U?M:z}else return z})}return a.jsx(rae,{scope:t.__scopeSlider,name:n,disabled:l,min:r,max:i,valueIndexToChangeRef:b,thumbs:v.current,values:S,orientation:s,form:g,children:a.jsx(V1.Provider,{scope:t.__scopeSlider,children:a.jsx(V1.Slot,{scope:t.__scopeSlider,children:a.jsx(w,{"aria-disabled":l,"data-disabled":l?"":void 0,...m,ref:e,onPointerDown:Pe(m.onPointerDown,()=>{l||(A.current=S)}),min:r,max:i,inverted:p,onSlideStart:l?void 0:_,onSlideMove:l?void 0:j,onSlideEnd:l?void 0:k,onHomeKeyDown:()=>!l&&P(r,0,{commit:!0}),onEndKeyDown:()=>!l&&P(i,S.length-1,{commit:!0}),onStepKeyDown:({event:R,direction:E})=>{if(!l){const V=NB.includes(R.key)||R.shiftKey&&TB.includes(R.key)?10:1,$=b.current,z=S[$],M=o*V*E;P(z+M,$,{commit:!0})}}})})})})});OB.displayName=jf;var[IB,RB]=kB(jf,{startEdge:"left",endEdge:"right",size:"width",direction:1}),iae=y.forwardRef((t,e)=>{const{min:n,max:r,dir:i,inverted:o,onSlideStart:s,onSlideMove:l,onSlideEnd:c,onStepKeyDown:u,...d}=t,[f,h]=y.useState(null),p=_t(e,w=>h(w)),g=y.useRef(),m=uu(i),v=m==="ltr",b=v&&!o||!v&&o;function x(w){const S=g.current||f.getBoundingClientRect(),C=[0,S.width],_=PN(C,b?[n,r]:[r,n]);return g.current=S,_(w-S.left)}return a.jsx(IB,{scope:t.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:a.jsx(MB,{dir:m,"data-orientation":"horizontal",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const S=x(w.clientX);s==null||s(S)},onSlideMove:w=>{const S=x(w.clientX);l==null||l(S)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:w=>{const C=PB[b?"from-left":"from-right"].includes(w.key);u==null||u({event:w,direction:C?-1:1})}})})}),oae=y.forwardRef((t,e)=>{const{min:n,max:r,inverted:i,onSlideStart:o,onSlideMove:s,onSlideEnd:l,onStepKeyDown:c,...u}=t,d=y.useRef(null),f=_t(e,d),h=y.useRef(),p=!i;function g(m){const v=h.current||d.current.getBoundingClientRect(),b=[0,v.height],w=PN(b,p?[r,n]:[n,r]);return h.current=v,w(m-v.top)}return a.jsx(IB,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:a.jsx(MB,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:m=>{const v=g(m.clientY);o==null||o(v)},onSlideMove:m=>{const v=g(m.clientY);s==null||s(v)},onSlideEnd:()=>{h.current=void 0,l==null||l()},onStepKeyDown:m=>{const b=PB[p?"from-bottom":"from-top"].includes(m.key);c==null||c({event:m,direction:b?-1:1})}})})}),MB=y.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:o,onHomeKeyDown:s,onEndKeyDown:l,onStepKeyDown:c,...u}=t,d=_0(jf,n);return a.jsx(et.span,{...u,ref:e,onKeyDown:Pe(t.onKeyDown,f=>{f.key==="Home"?(s(f),f.preventDefault()):f.key==="End"?(l(f),f.preventDefault()):NB.concat(TB).includes(f.key)&&(c(f),f.preventDefault())}),onPointerDown:Pe(t.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(f)}),onPointerMove:Pe(t.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&i(f)}),onPointerUp:Pe(t.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),o(f))})})}),DB="SliderTrack",$B=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=_0(DB,n);return a.jsx(et.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:e})});$B.displayName=DB;var G1="SliderRange",LB=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=_0(G1,n),o=RB(G1,n),s=y.useRef(null),l=_t(e,s),c=i.values.length,u=i.values.map(h=>UB(h,i.min,i.max)),d=c>1?Math.min(...u):0,f=100-Math.max(...u);return a.jsx(et.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:l,style:{...t.style,[o.startEdge]:d+"%",[o.endEdge]:f+"%"}})});LB.displayName=G1;var K1="SliderThumb",FB=y.forwardRef((t,e)=>{const n=tae(t.__scopeSlider),[r,i]=y.useState(null),o=_t(e,l=>i(l)),s=y.useMemo(()=>r?n().findIndex(l=>l.ref.current===r):-1,[n,r]);return a.jsx(sae,{...t,ref:o,index:s})}),sae=y.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:i,...o}=t,s=_0(K1,n),l=RB(K1,n),[c,u]=y.useState(null),d=_t(e,x=>u(x)),f=c?s.form||!!c.closest("form"):!0,h=Gm(c),p=s.values[r],g=p===void 0?0:UB(p,s.min,s.max),m=cae(r,s.values.length),v=h==null?void 0:h[l.size],b=v?dae(v,g,l.direction):0;return y.useEffect(()=>{if(c)return s.thumbs.add(c),()=>{s.thumbs.delete(c)}},[c,s.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${g}% + ${b}px)`},children:[a.jsx(V1.ItemSlot,{scope:t.__scopeSlider,children:a.jsx(et.span,{role:"slider","aria-label":t["aria-label"]||m,"aria-valuemin":s.min,"aria-valuenow":p,"aria-valuemax":s.max,"aria-orientation":s.orientation,"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,tabIndex:s.disabled?void 0:0,...o,ref:d,style:p===void 0?{display:"none"}:t.style,onFocus:Pe(t.onFocus,()=>{s.valueIndexToChangeRef.current=r})})}),f&&a.jsx(aae,{name:i??(s.name?s.name+(s.values.length>1?"[]":""):void 0),form:s.form,value:p},r)]})});FB.displayName=K1;var aae=t=>{const{value:e,...n}=t,r=y.useRef(null),i=Zm(e);return y.useEffect(()=>{const o=r.current,s=window.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(s,"value").set;if(i!==e&&c){const u=new Event("input",{bubbles:!0});c.call(o,e),o.dispatchEvent(u)}},[i,e]),a.jsx("input",{style:{display:"none"},...n,ref:r,defaultValue:e})};function lae(t=[],e,n){const r=[...t];return r[n]=e,r.sort((i,o)=>i-o)}function UB(t,e,n){const o=100/(n-e)*(t-e);return qp(o,[0,100])}function cae(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function uae(t,e){if(t.length===1)return 0;const n=t.map(i=>Math.abs(i-e)),r=Math.min(...n);return n.indexOf(r)}function dae(t,e,n){const r=t/2,o=PN([0,50],[0,r]);return(r-o(e)*n)*n}function fae(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function hae(t,e){if(e>0){const n=fae(t);return Math.min(...n)>=e}return!0}function PN(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function pae(t){return(String(t).split(".")[1]||"").length}function mae(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var BB=OB,gae=$B,vae=LB,yae=FB;const lr=y.forwardRef(({className:t,...e},n)=>a.jsxs(BB,{ref:n,className:ke("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(gae,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(vae,{className:"absolute h-full bg-primary"})}),a.jsx(yae,{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"})]}));lr.displayName=BB.displayName;var kN="Switch",[xae,WDe]=ji(kN),[bae,wae]=xae(kN),HB=y.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:o,required:s,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=t,[h,p]=y.useState(null),g=_t(e,w=>p(w)),m=y.useRef(!1),v=h?d||!!h.closest("form"):!0,[b=!1,x]=Ko({prop:i,defaultProp:o,onChange:u});return a.jsxs(bae,{scope:n,checked:b,disabled:l,children:[a.jsx(et.button,{type:"button",role:"switch","aria-checked":b,"aria-required":s,"data-state":GB(b),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:g,onClick:Pe(t.onClick,w=>{x(S=>!S),v&&(m.current=w.isPropagationStopped(),m.current||w.stopPropagation())})}),v&&a.jsx(Sae,{control:h,bubbles:!m.current,name:r,value:c,checked:b,required:s,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});HB.displayName=kN;var zB="SwitchThumb",VB=y.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,i=wae(zB,n);return a.jsx(et.span,{"data-state":GB(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:e})});VB.displayName=zB;var Sae=t=>{const{control:e,checked:n,bubbles:r=!0,...i}=t,o=y.useRef(null),s=Zm(n),l=Gm(e);return y.useEffect(()=>{const c=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});f.call(c,n),c.dispatchEvent(h)}},[s,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:o,style:{...t.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function GB(t){return t?"checked":"unchecked"}var KB=HB,Cae=VB;const Yp=y.forwardRef(({className:t,...e},n)=>a.jsx(KB,{className:ke("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",t),...e,ref:n,children:a.jsx(Cae,{className:ke("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")})}));Yp.displayName=KB.displayName;function Aae(t,e=[]){let n=[];function r(o,s){const l=y.createContext(s),c=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][c])||l,v=y.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:v,children:p})}function d(f,h){const p=(h==null?void 0:h[t][c])||l,g=y.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>y.createContext(s));return function(l){const c=(l==null?void 0:l[t])||o;return y.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,_ae(i,...e)]}function _ae(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(o)[`__scope${u}`];return{...l,...f}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var SS="rovingFocusGroup.onEntryFocus",jae={bubbles:!1,cancelable:!0},j0="RovingFocusGroup",[W1,WB,Eae]=y0(j0),[Nae,Ef]=Aae(j0,[Eae]),[Tae,Pae]=Nae(j0),qB=y.forwardRef((t,e)=>a.jsx(W1.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(W1.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(kae,{...t,ref:e})})}));qB.displayName=j0;var kae=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=t,h=y.useRef(null),p=_t(e,h),g=uu(o),[m=null,v]=Ko({prop:s,defaultProp:l,onChange:c}),[b,x]=y.useState(!1),w=dr(u),S=WB(n),C=y.useRef(!1),[A,_]=y.useState(0);return y.useEffect(()=>{const j=h.current;if(j)return j.addEventListener(SS,w),()=>j.removeEventListener(SS,w)},[w]),a.jsx(Tae,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:m,onItemFocus:y.useCallback(j=>v(j),[v]),onItemShiftTab:y.useCallback(()=>x(!0),[]),onFocusableItemAdd:y.useCallback(()=>_(j=>j+1),[]),onFocusableItemRemove:y.useCallback(()=>_(j=>j-1),[]),children:a.jsx(et.div,{tabIndex:b||A===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...t.style},onMouseDown:Pe(t.onMouseDown,()=>{C.current=!0}),onFocus:Pe(t.onFocus,j=>{const k=!C.current;if(j.target===j.currentTarget&&k&&!b){const P=new CustomEvent(SS,jae);if(j.currentTarget.dispatchEvent(P),!P.defaultPrevented){const R=S().filter($=>$.focusable),E=R.find($=>$.active),I=R.find($=>$.id===m),V=[E,I,...R].filter(Boolean).map($=>$.ref.current);XB(V,d)}}C.current=!1}),onBlur:Pe(t.onBlur,()=>x(!1))})})}),YB="RovingFocusGroupItem",QB=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=t,l=Do(),c=o||l,u=Pae(YB,n),d=u.currentTabStopId===c,f=WB(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=u;return y.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),a.jsx(W1.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:a.jsx(et.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:e,onMouseDown:Pe(t.onMouseDown,g=>{r?u.onItemFocus(c):g.preventDefault()}),onFocus:Pe(t.onFocus,()=>u.onItemFocus(c)),onKeyDown:Pe(t.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const m=Rae(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(x=>x.focusable).map(x=>x.ref.current);if(m==="last")b.reverse();else if(m==="prev"||m==="next"){m==="prev"&&b.reverse();const x=b.indexOf(g.currentTarget);b=u.loop?Mae(b,x+1):b.slice(x+1)}setTimeout(()=>XB(b))}})})})});QB.displayName=YB;var Oae={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Iae(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Rae(t,e,n){const r=Iae(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Oae[r]}function XB(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function Mae(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var ON=qB,IN=QB,RN="Tabs",[Dae,qDe]=ji(RN,[Ef]),ZB=Ef(),[$ae,MN]=Dae(RN),JB=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:l,activationMode:c="automatic",...u}=t,d=uu(l),[f,h]=Ko({prop:r,onChange:i,defaultProp:o});return a.jsx($ae,{scope:n,baseId:Do(),value:f,onValueChange:h,orientation:s,dir:d,activationMode:c,children:a.jsx(et.div,{dir:d,"data-orientation":s,...u,ref:e})})});JB.displayName=RN;var e6="TabsList",t6=y.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...i}=t,o=MN(e6,n),s=ZB(n);return a.jsx(ON,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:a.jsx(et.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:e})})});t6.displayName=e6;var n6="TabsTrigger",r6=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=t,s=MN(n6,n),l=ZB(n),c=s6(s.baseId,r),u=a6(s.baseId,r),d=r===s.value;return a.jsx(IN,{asChild:!0,...l,focusable:!i,active:d,children:a.jsx(et.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,...o,ref:e,onMouseDown:Pe(t.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Pe(t.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Pe(t.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!i&&f&&s.onValueChange(r)})})})});r6.displayName=n6;var i6="TabsContent",o6=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=t,l=MN(i6,n),c=s6(l.baseId,r),u=a6(l.baseId,r),d=r===l.value,f=y.useRef(d);return y.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),a.jsx(Mr,{present:i||d,children:({present:h})=>a.jsx(et.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...s,ref:e,style:{...t.style,animationDuration:f.current?"0s":void 0},children:h&&o})})});o6.displayName=i6;function s6(t,e){return`${t}-trigger-${e}`}function a6(t,e){return`${t}-content-${e}`}var Lae=JB,l6=t6,c6=r6,u6=o6;const Kl=Lae,Ea=y.forwardRef(({className:t,...e},n)=>a.jsx(l6,{ref:n,className:ke("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));Ea.displayName=l6.displayName;const on=y.forwardRef(({className:t,...e},n)=>a.jsx(c6,{ref:n,className:ke("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",t),...e}));on.displayName=c6.displayName;const sn=y.forwardRef(({className:t,...e},n)=>a.jsx(u6,{ref:n,className:ke("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));sn.displayName=u6.displayName;const Fae=Ie.object({name:Ie.string().min(2,{message:"Name must be at least 2 characters."}),age:Ie.string().min(1,{message:"Age is required."}),gender:Ie.string().min(1,{message:"Gender is required."}),occupation:Ie.string().min(2,{message:"Occupation is required."}),education:Ie.string().min(1,{message:"Education is required."}),location:Ie.string().min(2,{message:"Location is required."}),ethnicity:Ie.string().optional(),personality:Ie.string(),interests:Ie.string(),hasPurchasingPower:Ie.boolean().optional(),hasChildren:Ie.boolean().optional(),techSavviness:Ie.number().min(0).max(100),brandLoyalty:Ie.number().min(0).max(100),priceConsciousness:Ie.number().min(0).max(100),environmentalConcern:Ie.number().min(0).max(100),socialGrade:Ie.string().optional(),householdIncome:Ie.string().optional(),householdComposition:Ie.string().optional(),livingSituation:Ie.string().optional(),goals:Ie.array(Ie.string()).optional(),frustrations:Ie.array(Ie.string()).optional(),motivations:Ie.array(Ie.string()).optional(),scenarios:Ie.array(Ie.string()).optional(),scenarioType:Ie.string().optional(),oceanTraits:Ie.object({openness:Ie.number().min(0).max(100),conscientiousness:Ie.number().min(0).max(100),extraversion:Ie.number().min(0).max(100),agreeableness:Ie.number().min(0).max(100),neuroticism:Ie.number().min(0).max(100)}).optional(),thinkFeelDo:Ie.object({thinks:Ie.array(Ie.string()),feels:Ie.array(Ie.string()),does:Ie.array(Ie.string())}).optional(),mediaConsumption:Ie.string().optional(),deviceUsage:Ie.string().optional(),shoppingHabits:Ie.string().optional(),brandPreferences:Ie.string().optional(),communicationPreferences:Ie.string().optional(),paymentMethods:Ie.string().optional(),purchaseBehaviour:Ie.string().optional(),coreValues:Ie.string().optional(),lifestyleChoices:Ie.string().optional(),socialActivities:Ie.string().optional(),categoryKnowledge:Ie.string().optional(),decisionInfluences:Ie.string().optional(),painPoints:Ie.string().optional(),journeyContext:Ie.string().optional(),keyTouchpoints:Ie.string().optional(),selfDeterminationNeeds:Ie.object({autonomy:Ie.string(),competence:Ie.string(),relatedness:Ie.string()}).optional(),fears:Ie.array(Ie.string()).optional(),narrative:Ie.string().optional(),additionalInformation:Ie.string().optional()});function Uae({targetFolderId:t,targetFolderName:e}){const[n,r]=y.useState(1),[i,o]=y.useState(!1),[s,l]=y.useState(!1),[c,u]=y.useState(0),d=Xn(),{isAuthenticated:f,login:h}=cu();y.useEffect(()=>{u(0)},[]),y.useEffect(()=>{(async()=>{if(!f&&!s){l(!0);try{console.log("Attempting auto login with default credentials"),await h("user","pass"),console.log("Auto login successful");const _=localStorage.getItem("auth_token");_?(console.log("Token successfully stored:",_.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(_){console.error("Auto login failed:",_)}finally{l(!1)}}})()},[]);const p=h0({resolver:p0(Fae),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=A=>{const _=p.getValues(A)||[];p.setValue(A,[..._,""])},m=(A,_,j)=>{const P=[...p.getValues(A)||[]];P[_]=j,p.setValue(A,P)},v=(A,_)=>{const k=[...p.getValues(A)||[]];k.splice(_,1),p.setValue(A,k)},b=A=>{const _=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},j={..._,[A]:[..._[A]||[],""]};p.setValue("thinkFeelDo",j)},x=(A,_,j)=>{const k=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},P=[...k[A]||[]];P[_]=j;const R={...k,[A]:P};p.setValue("thinkFeelDo",R)},w=(A,_)=>{const j=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},k=[...j[A]||[]];k.splice(_,1);const P={...j,[A]:k};p.setValue("thinkFeelDo",P)},S=(A,_)=>{const k={...p.getValues("oceanTraits")||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},[A]:_};p.setValue("oceanTraits",k)};async function C(A,_=!1){var j,k,P,R,E;if(_&&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"}}),o(!1);return}_?(u(I=>I+1),console.log(`Retry attempt ${c+1}`)):u(0),o(!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(U){console.error("Login failed before persona creation:",U),qe.error("Authentication required",{description:"Please log in before creating personas. Default: user/pass"}),d("/login",{state:{from:"/synthetic-users"}}),o(!1);return}const I=`persona-generation-${Date.now()}`,L=t&&e?` in "${e}" folder`:"",V=n>1?`${n} personas`:"persona";console.log(`UserCreator - Creating ${V}${L}`),qe.createPersistent({id:I,title:`Generating ${V}...`,description:`Creating synthetic user profile${n>1?"s":""}${L}`,type:"info"});const $={...A,oceanTraits:A.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:A.thinkFeelDo||{thinks:[],feels:[],does:[]},folderId:t||void 0},z={id:`temp-${Date.now()}`,...$},M=JSON.parse(localStorage.getItem("tempPersonas")||"[]");if(M.push(z),localStorage.setItem("tempPersonas",JSON.stringify(M)),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:",((j=localStorage.getItem("auth_token"))==null?void 0:j.substring(0,10))+"...")}catch(X){throw console.error("Login retry failed:",X),new Error("Authentication failed after retry")}}console.log("Sending persona creation request to API with auth token");const K=await kr.create($);console.log("Persona created successfully:",K),qe.updatePersistent(I,{title:"Synthetic user created successfully",description:`Created profile for ${A.name}`,type:"success"})}catch(U){throw console.error("Error creating persona via API:",U),U.response&&U.response.status===401&&qe.error("Authentication error",{description:"Failed to authenticate with server. Please try again."}),U}else{const U=[];U.push($);for(let K=1;K{d("/synthetic-users?mode=view")},300)}catch(I){if(console.error("Error creating personas:",I),I.response&&I.response.status===401||I.message&&I.message.includes("Authentication failed")&&c<1)try{console.log("Got auth error, attempting login retry with default credentials"),localStorage.removeItem("auth_token");const L=await Tv.login("user","pass");if((P=L==null?void 0:L.data)!=null&&P.access_token){localStorage.setItem("auth_token",L.data.access_token),localStorage.setItem("user",JSON.stringify(L.data.user)),console.log("Manual login successful, got new token:",L.data.access_token.substring(0,10)+"..."),qe.info("Logged in with default account, retrying submission..."),setTimeout(()=>{C(A,!0)},500);return}else throw new Error("No access token received")}catch(L){console.error("Login retry failed:",L),qe.error("Authentication error",{description:"Cannot authenticate with server. Please contact support."})}else qe.updatePersistent(generationToastId,{title:"Failed to create synthetic users",description:((E=(R=I.response)==null?void 0:R.data)==null?void 0:E.message)||I.message||"An unexpected error occurred",type:"error"})}finally{o(!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(te,{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(Cr,{size:16,className:"text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:n})]}),a.jsx(te,{variant:"outline",size:"sm",onClick:()=>r(n+1),children:"+"})]})]}),a.jsx(g0,{...p,children:a.jsxs("form",{onSubmit:p.handleSubmit(C),className:"space-y-6",children:[a.jsxs(Kl,{defaultValue:"basic",children:[a.jsxs(Ea,{className:"grid w-full grid-cols-6",children:[a.jsx(on,{value:"basic",children:"Basic"}),a.jsx(on,{value:"cooper",children:"Cooper"}),a.jsx(on,{value:"personality",children:"Personality"}),a.jsx(on,{value:"demographics",children:"Demographics"}),a.jsx(on,{value:"lifestyle",children:"Lifestyle"}),a.jsx(on,{value:"extended",children:"Extended"})]}),a.jsx(sn,{value:"basic",className:"mt-6",children:a.jsx(ut,{children:a.jsx(Et,{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(dt,{control:p.control,name:"name",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Name"}),a.jsx(at,{children:a.jsx(Dt,{placeholder:"Jane Smith",...A})}),a.jsx(lt,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(dt,{control:p.control,name:"age",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Age Range"}),a.jsxs(kn,{onValueChange:A.onChange,defaultValue:A.value,children:[a.jsx(at,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select age range"})})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"18-24",children:"18-24"}),a.jsx(le,{value:"25-34",children:"25-34"}),a.jsx(le,{value:"35-44",children:"35-44"}),a.jsx(le,{value:"45-54",children:"45-54"}),a.jsx(le,{value:"55-64",children:"55-64"}),a.jsx(le,{value:"65+",children:"65+"})]})]}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"gender",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Gender"}),a.jsxs(kn,{onValueChange:A.onChange,defaultValue:A.value,children:[a.jsx(at,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select gender"})})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"Male",children:"Male"}),a.jsx(le,{value:"Female",children:"Female"}),a.jsx(le,{value:"Non-binary",children:"Non-binary"}),a.jsx(le,{value:"Other",children:"Other"})]})]}),a.jsx(lt,{})]})})]}),a.jsx(dt,{control:p.control,name:"occupation",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Occupation"}),a.jsx(at,{children:a.jsx(Dt,{placeholder:"Software Engineer",...A})}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"education",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Education"}),a.jsxs(kn,{onValueChange:A.onChange,defaultValue:A.value,children:[a.jsx(at,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select education level"})})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"High School",children:"High School"}),a.jsx(le,{value:"Some College",children:"Some College"}),a.jsx(le,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(le,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(le,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(le,{value:"PhD",children:"PhD"})]})]}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"location",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Location"}),a.jsx(at,{children:a.jsx(Dt,{placeholder:"New York, USA",...A})}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"ethnicity",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Ethnicity (Optional)"}),a.jsxs(kn,{onValueChange:A.onChange,defaultValue:A.value,children:[a.jsx(at,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select ethnicity"})})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"white",children:"White"}),a.jsx(le,{value:"black",children:"Black"}),a.jsx(le,{value:"asian",children:"Asian"}),a.jsx(le,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(le,{value:"native-american",children:"Native American"}),a.jsx(le,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(le,{value:"mixed",children:"Mixed"}),a.jsx(le,{value:"other",children:"Other"}),a.jsx(le,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]}),a.jsx(lt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(dt,{control:p.control,name:"personality",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Personality Traits"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Curious, analytical, detail-oriented",...A,rows:3})}),a.jsx(xn,{children:"Describe key personality traits that define this user"}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"interests",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Interests"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Technology, fitness, cooking, travel",...A,rows:3})}),a.jsx(xn,{children:"List interests, hobbies and activities this user enjoys"}),a.jsx(lt,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"font-medium text-sm",children:"Behavioral Attributes"}),a.jsx(dt,{control:p.control,name:"techSavviness",render:({field:A})=>a.jsxs(ot,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(st,{children:"Tech Savviness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[A.value,"%"]})]}),a.jsx(at,{children:a.jsx(lr,{min:0,max:100,step:1,value:[A.value],onValueChange:_=>A.onChange(_[0])})}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"brandLoyalty",render:({field:A})=>a.jsxs(ot,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(st,{children:"Brand Loyalty"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[A.value,"%"]})]}),a.jsx(at,{children:a.jsx(lr,{min:0,max:100,step:1,value:[A.value],onValueChange:_=>A.onChange(_[0])})}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"priceConsciousness",render:({field:A})=>a.jsxs(ot,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(st,{children:"Price Consciousness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[A.value,"%"]})]}),a.jsx(at,{children:a.jsx(lr,{min:0,max:100,step:1,value:[A.value],onValueChange:_=>A.onChange(_[0])})}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"environmentalConcern",render:({field:A})=>a.jsxs(ot,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(st,{children:"Environmental Concern"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[A.value,"%"]})]}),a.jsx(at,{children:a.jsx(lr,{min:0,max:100,step:1,value:[A.value],onValueChange:_=>A.onChange(_[0])})}),a.jsx(lt,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[a.jsx(dt,{control:p.control,name:"hasPurchasingPower",render:({field:A})=>a.jsxs(ot,{className:"flex items-center justify-between",children:[a.jsx(st,{children:"Purchasing Power"}),a.jsx(at,{children:a.jsx(Yp,{checked:A.value,onCheckedChange:A.onChange})}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"hasChildren",render:({field:A})=>a.jsxs(ot,{className:"flex items-center justify-between",children:[a.jsx(st,{children:"Has Children"}),a.jsx(at,{children:a.jsx(Yp,{checked:A.value,onCheckedChange:A.onChange})}),a.jsx(lt,{})]})})]})]})]})]})})})}),a.jsxs(sn,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(ut,{children:a.jsxs(Et,{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((A,_)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:A,onChange:j=>m("goals",_,j.target.value),placeholder:"Enter a goal"}),a.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>v("goals",_),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},_)),a.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>g("goals"),className:"mt-2",children:[a.jsx(Tr,{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((A,_)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:A,onChange:j=>m("frustrations",_,j.target.value),placeholder:"Enter a frustration"}),a.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>v("frustrations",_),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},_)),a.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>g("frustrations"),className:"mt-2",children:[a.jsx(Tr,{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((A,_)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:A,onChange:j=>m("motivations",_,j.target.value),placeholder:"Enter a motivation"}),a.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>v("motivations",_),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},_)),a.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>g("motivations"),className:"mt-2",children:[a.jsx(Tr,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(ut,{children:a.jsxs(Et,{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((A,_)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:A,onChange:j=>x("thinks",_,j.target.value),placeholder:"What they think"}),a.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("thinks",_),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},_)),a.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>b("thinks"),className:"mt-2",children:[a.jsx(Tr,{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((A,_)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:A,onChange:j=>x("feels",_,j.target.value),placeholder:"What they feel"}),a.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("feels",_),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},_)),a.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>b("feels"),className:"mt-2",children:[a.jsx(Tr,{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((A,_)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:A,onChange:j=>x("does",_,j.target.value),placeholder:"What they do"}),a.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("does",_),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},_)),a.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>b("does"),className:"mt-2",children:[a.jsx(Tr,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(ut,{children:a.jsx(Et,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(dt,{control:p.control,name:"scenarioType",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Scenario Section Title"}),a.jsx(at,{children:a.jsx(Dt,{placeholder:"Life Scenarios",...A})}),a.jsx(xn,{children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'}),a.jsx(lt,{})]})}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Usage Scenarios"}),(p.watch("scenarios")||[]).map((A,_)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(ct,{value:A,onChange:j=>m("scenarios",_,j.target.value),rows:2,placeholder:"Describe a usage scenario"}),a.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>v("scenarios",_),className:"mt-2",children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},_)),a.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>g("scenarios"),className:"mt-2",children:[a.jsx(Tr,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})]})})})]}),a.jsx(sn,{value:"personality",className:"mt-6",children:a.jsx(ut,{children:a.jsxs(Et,{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(lr,{value:[(p.watch("oceanTraits")||{openness:50}).openness||50],onValueChange:A=>S("openness",A[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(lr,{value:[(p.watch("oceanTraits")||{conscientiousness:50}).conscientiousness||50],onValueChange:A=>S("conscientiousness",A[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(lr,{value:[(p.watch("oceanTraits")||{extraversion:50}).extraversion||50],onValueChange:A=>S("extraversion",A[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(lr,{value:[(p.watch("oceanTraits")||{agreeableness:50}).agreeableness||50],onValueChange:A=>S("agreeableness",A[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(lr,{value:[(p.watch("oceanTraits")||{neuroticism:50}).neuroticism||50],onValueChange:A=>S("neuroticism",A[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(sn,{value:"demographics",className:"mt-6",children:a.jsx(ut,{children:a.jsxs(Et,{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(dt,{control:p.control,name:"socialGrade",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Social Grade"}),a.jsxs(kn,{onValueChange:A.onChange,defaultValue:A.value,children:[a.jsx(at,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select social grade"})})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"A",children:"A - Higher managerial"}),a.jsx(le,{value:"B",children:"B - Intermediate managerial"}),a.jsx(le,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(le,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(le,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(le,{value:"E",children:"E - State pensioners, unemployed"})]})]}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"householdIncome",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Household Income"}),a.jsxs(kn,{onValueChange:A.onChange,defaultValue:A.value,children:[a.jsx(at,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select income range"})})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"Under $25k",children:"Under $25,000"}),a.jsx(le,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(le,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(le,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(le,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(le,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(le,{value:"Over $250k",children:"Over $250,000"}),a.jsx(le,{value:"Prefer not to say",children:"Prefer not to say"})]})]}),a.jsx(lt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(dt,{control:p.control,name:"householdComposition",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Household Composition"}),a.jsxs(kn,{onValueChange:A.onChange,defaultValue:A.value,children:[a.jsx(at,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select household type"})})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"Single person",children:"Single person"}),a.jsx(le,{value:"Couple without children",children:"Couple without children"}),a.jsx(le,{value:"Couple with children",children:"Couple with children"}),a.jsx(le,{value:"Single parent",children:"Single parent"}),a.jsx(le,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(le,{value:"Shared housing",children:"Shared housing"}),a.jsx(le,{value:"Other",children:"Other"})]})]}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"livingSituation",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Living Situation"}),a.jsxs(kn,{onValueChange:A.onChange,defaultValue:A.value,children:[a.jsx(at,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select living situation"})})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"Own home",children:"Own home"}),a.jsx(le,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(le,{value:"Rent house",children:"Rent house"}),a.jsx(le,{value:"Live with family",children:"Live with family"}),a.jsx(le,{value:"Student housing",children:"Student housing"}),a.jsx(le,{value:"Assisted living",children:"Assisted living"}),a.jsx(le,{value:"Other",children:"Other"})]})]}),a.jsx(lt,{})]})})]})]})]})})}),a.jsx(sn,{value:"lifestyle",className:"mt-6",children:a.jsx(ut,{children:a.jsxs(Et,{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(dt,{control:p.control,name:"mediaConsumption",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Media Consumption"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"TV shows, podcasts, news sources, social media platforms",...A,rows:3})}),a.jsx(xn,{children:"Describe media consumption habits and preferences"}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"deviceUsage",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Device Usage"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Smartphone, laptop, tablet, smart TV, gaming console",...A,rows:3})}),a.jsx(xn,{children:"Primary devices and usage patterns"}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"shoppingHabits",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Shopping Habits"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Online vs in-store, frequency, preferred retailers",...A,rows:3})}),a.jsx(xn,{children:"Shopping behavior and preferences"}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"brandPreferences",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Brand Preferences"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Favorite brands, brand values alignment",...A,rows:3})}),a.jsx(xn,{children:"Preferred brands and reasoning"}),a.jsx(lt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(dt,{control:p.control,name:"communicationPreferences",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Communication Preferences"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Email, phone, text, video calls, in-person",...A,rows:3})}),a.jsx(xn,{children:"Preferred communication methods and channels"}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"paymentMethods",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Payment Methods"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Credit cards, digital wallets, cash, BNPL",...A,rows:3})}),a.jsx(xn,{children:"Preferred payment methods and financial tools"}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"purchaseBehaviour",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Purchase Behavior"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Research habits, decision factors, impulse vs planned buying",...A,rows:3})}),a.jsx(xn,{children:"How they approach making purchase decisions"}),a.jsx(lt,{})]})})]})]})]})})}),a.jsxs(sn,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(ut,{children:a.jsxs(Et,{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(dt,{control:p.control,name:"coreValues",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Core Values"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Key principles and values that guide decisions",...A,rows:3})}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"lifestyleChoices",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Lifestyle Choices"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Health, fitness, diet, work-life balance preferences",...A,rows:3})}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"socialActivities",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Social Activities"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Social hobbies, community involvement, networking",...A,rows:3})}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"categoryKnowledge",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Category Knowledge"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Expertise in specific product/service categories",...A,rows:3})}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"decisionInfluences",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Decision Influences"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"What factors most influence their decisions",...A,rows:3})}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"painPoints",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Pain Points"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Common challenges and friction points",...A,rows:3})}),a.jsx(lt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(dt,{control:p.control,name:"journeyContext",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Journey Context"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Current life stage and contextual factors",...A,rows:3})}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"keyTouchpoints",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Key Touchpoints"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Important interaction points and channels",...A,rows:3})}),a.jsx(lt,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),a.jsx(dt,{control:p.control,name:"selfDeterminationNeeds.autonomy",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Autonomy"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Need for independence and self-direction",...A,rows:2})}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"selfDeterminationNeeds.competence",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Competence"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Need to feel capable and effective",...A,rows:2})}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"selfDeterminationNeeds.relatedness",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Relatedness"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Need for connection and belonging",...A,rows:2})}),a.jsx(lt,{})]})})]})]})]})]})}),a.jsx(ut,{children:a.jsx(Et,{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((A,_)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:A,onChange:j=>m("fears",_,j.target.value),placeholder:"Enter a fear or concern"}),a.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>v("fears",_),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},_)),a.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>g("fears"),className:"mt-2",children:[a.jsx(Tr,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),a.jsx(dt,{control:p.control,name:"narrative",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Personal Narrative"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Personal story, background, key life experiences",...A,rows:4})}),a.jsx(xn,{children:"A brief narrative that captures their personal story"}),a.jsx(lt,{})]})}),a.jsx(dt,{control:p.control,name:"additionalInformation",render:({field:A})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Additional Information"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Any other relevant details or context",...A,rows:4})}),a.jsx(xn,{children:"Additional context or details not covered elsewhere"}),a.jsx(lt,{})]})})]})})})]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(te,{variant:"outline",type:"button",onClick:()=>p.reset(),children:"Reset"}),a.jsxs(te,{type:"submit",disabled:i,children:[i?a.jsx(LX,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Yj,{className:"mr-2 h-4 w-4"}),i?"Creating...":`Create ${n>1?`${n} Users`:"User"}`]})]})]})})]})}var q1=["Enter"," "],Bae=["ArrowDown","PageUp","Home"],d6=["ArrowUp","PageDown","End"],Hae=[...Bae,...d6],zae={ltr:[...q1,"ArrowRight"],rtl:[...q1,"ArrowLeft"]},Vae={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ig="Menu",[Qp,Gae,Kae]=y0(ig),[du,f6]=ji(ig,[Kae,mf,Ef]),E0=mf(),h6=Ef(),[Wae,fu]=du(ig),[qae,og]=du(ig),p6=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:o,modal:s=!0}=t,l=E0(e),[c,u]=y.useState(null),d=y.useRef(!1),f=dr(o),h=uu(i);return y.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(PF,{...l,children:a.jsx(Wae,{scope:e,open:n,onOpenChange:f,content:c,onContentChange:u,children:a.jsx(qae,{scope:e,onClose:y.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:s,children:r})})})};p6.displayName=ig;var Yae="MenuAnchor",DN=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=E0(n);return a.jsx(Ij,{...i,...r,ref:e})});DN.displayName=Yae;var $N="MenuPortal",[Qae,m6]=du($N,{forceMount:void 0}),g6=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,o=fu($N,e);return a.jsx(Qae,{scope:e,forceMount:n,children:a.jsx(Mr,{present:n||o.open,children:a.jsx(Mb,{asChild:!0,container:i,children:r})})})};g6.displayName=$N;var uo="MenuContent",[Xae,LN]=du(uo),v6=y.forwardRef((t,e)=>{const n=m6(uo,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,o=fu(uo,t.__scopeMenu),s=og(uo,t.__scopeMenu);return a.jsx(Qp.Provider,{scope:t.__scopeMenu,children:a.jsx(Mr,{present:r||o.open,children:a.jsx(Qp.Slot,{scope:t.__scopeMenu,children:s.modal?a.jsx(Zae,{...i,ref:e}):a.jsx(Jae,{...i,ref:e})})})})}),Zae=y.forwardRef((t,e)=>{const n=fu(uo,t.__scopeMenu),r=y.useRef(null),i=_t(e,r);return y.useEffect(()=>{const o=r.current;if(o)return wN(o)},[]),a.jsx(FN,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Pe(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Jae=y.forwardRef((t,e)=>{const n=fu(uo,t.__scopeMenu);return a.jsx(FN,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),FN=y.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:g,...m}=t,v=fu(uo,n),b=og(uo,n),x=E0(n),w=h6(n),S=Gae(n),[C,A]=y.useState(null),_=y.useRef(null),j=_t(e,_,v.onContentChange),k=y.useRef(0),P=y.useRef(""),R=y.useRef(0),E=y.useRef(null),I=y.useRef("right"),L=y.useRef(0),V=g?w0:y.Fragment,$=g?{as:Es,allowPinchZoom:!0}:void 0,z=U=>{var ce,Me;const K=P.current+U,X=S().filter(pe=>!pe.disabled),re=document.activeElement,xe=(ce=X.find(pe=>pe.ref.current===re))==null?void 0:ce.textValue,F=X.map(pe=>pe.textValue),ue=dle(F,K,xe),ie=(Me=X.find(pe=>pe.textValue===ue))==null?void 0:Me.ref.current;(function pe(Se){P.current=Se,window.clearTimeout(k.current),Se!==""&&(k.current=window.setTimeout(()=>pe(""),1e3))})(K),ie&&setTimeout(()=>ie.focus())};y.useEffect(()=>()=>window.clearTimeout(k.current),[]),bN();const M=y.useCallback(U=>{var X,re;return I.current===((X=E.current)==null?void 0:X.side)&&hle(U,(re=E.current)==null?void 0:re.area)},[]);return a.jsx(Xae,{scope:n,searchRef:P,onItemEnter:y.useCallback(U=>{M(U)&&U.preventDefault()},[M]),onItemLeave:y.useCallback(U=>{var K;M(U)||((K=_.current)==null||K.focus(),A(null))},[M]),onTriggerLeave:y.useCallback(U=>{M(U)&&U.preventDefault()},[M]),pointerGraceTimerRef:R,onPointerGraceIntentChange:y.useCallback(U=>{E.current=U},[]),children:a.jsx(V,{...$,children:a.jsx(x0,{asChild:!0,trapped:i,onMountAutoFocus:Pe(o,U=>{var K;U.preventDefault(),(K=_.current)==null||K.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:a.jsx(zm,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:a.jsx(ON,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:A,onEntryFocus:Pe(c,U=>{b.isUsingKeyboardRef.current||U.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(Rj,{role:"menu","aria-orientation":"vertical","data-state":I6(v.open),"data-radix-menu-content":"",dir:b.dir,...x,...m,ref:j,style:{outline:"none",...m.style},onKeyDown:Pe(m.onKeyDown,U=>{const X=U.target.closest("[data-radix-menu-content]")===U.currentTarget,re=U.ctrlKey||U.altKey||U.metaKey,xe=U.key.length===1;X&&(U.key==="Tab"&&U.preventDefault(),!re&&xe&&z(U.key));const F=_.current;if(U.target!==F||!Hae.includes(U.key))return;U.preventDefault();const ie=S().filter(ce=>!ce.disabled).map(ce=>ce.ref.current);d6.includes(U.key)&&ie.reverse(),cle(ie)}),onBlur:Pe(t.onBlur,U=>{U.currentTarget.contains(U.target)||(window.clearTimeout(k.current),P.current="")}),onPointerMove:Pe(t.onPointerMove,Xp(U=>{const K=U.target,X=L.current!==U.clientX;if(U.currentTarget.contains(K)&&X){const re=U.clientX>L.current?"right":"left";I.current=re,L.current=U.clientX}}))})})})})})})});v6.displayName=uo;var ele="MenuGroup",UN=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(et.div,{role:"group",...r,ref:e})});UN.displayName=ele;var tle="MenuLabel",y6=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(et.div,{...r,ref:e})});y6.displayName=tle;var ex="MenuItem",II="menu.itemSelect",N0=y.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,o=y.useRef(null),s=og(ex,t.__scopeMenu),l=LN(ex,t.__scopeMenu),c=_t(e,o),u=y.useRef(!1),d=()=>{const f=o.current;if(!n&&f){const h=new CustomEvent(II,{bubbles:!0,cancelable:!0});f.addEventListener(II,p=>r==null?void 0:r(p),{once:!0}),cF(f,h),h.defaultPrevented?u.current=!1:s.onClose()}};return a.jsx(x6,{...i,ref:c,disabled:n,onClick:Pe(t.onClick,d),onPointerDown:f=>{var h;(h=t.onPointerDown)==null||h.call(t,f),u.current=!0},onPointerUp:Pe(t.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:Pe(t.onKeyDown,f=>{const h=l.searchRef.current!=="";n||h&&f.key===" "||q1.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});N0.displayName=ex;var x6=y.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=t,s=LN(ex,n),l=h6(n),c=y.useRef(null),u=_t(e,c),[d,f]=y.useState(!1),[h,p]=y.useState("");return y.useEffect(()=>{const g=c.current;g&&p((g.textContent??"").trim())},[o.children]),a.jsx(Qp.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:a.jsx(IN,{asChild:!0,...l,focusable:!r,children:a.jsx(et.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:u,onPointerMove:Pe(t.onPointerMove,Xp(g=>{r?s.onItemLeave(g):(s.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Pe(t.onPointerLeave,Xp(g=>s.onItemLeave(g))),onFocus:Pe(t.onFocus,()=>f(!0)),onBlur:Pe(t.onBlur,()=>f(!1))})})})}),nle="MenuCheckboxItem",b6=y.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return a.jsx(_6,{scope:t.__scopeMenu,checked:n,children:a.jsx(N0,{role:"menuitemcheckbox","aria-checked":tx(n)?"mixed":n,...i,ref:e,"data-state":HN(n),onSelect:Pe(i.onSelect,()=>r==null?void 0:r(tx(n)?!0:!n),{checkForDefaultPrevented:!1})})})});b6.displayName=nle;var w6="MenuRadioGroup",[rle,ile]=du(w6,{value:void 0,onValueChange:()=>{}}),S6=y.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,o=dr(r);return a.jsx(rle,{scope:t.__scopeMenu,value:n,onValueChange:o,children:a.jsx(UN,{...i,ref:e})})});S6.displayName=w6;var C6="MenuRadioItem",A6=y.forwardRef((t,e)=>{const{value:n,...r}=t,i=ile(C6,t.__scopeMenu),o=n===i.value;return a.jsx(_6,{scope:t.__scopeMenu,checked:o,children:a.jsx(N0,{role:"menuitemradio","aria-checked":o,...r,ref:e,"data-state":HN(o),onSelect:Pe(r.onSelect,()=>{var s;return(s=i.onValueChange)==null?void 0:s.call(i,n)},{checkForDefaultPrevented:!1})})})});A6.displayName=C6;var BN="MenuItemIndicator",[_6,ole]=du(BN,{checked:!1}),j6=y.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,o=ole(BN,n);return a.jsx(Mr,{present:r||tx(o.checked)||o.checked===!0,children:a.jsx(et.span,{...i,ref:e,"data-state":HN(o.checked)})})});j6.displayName=BN;var sle="MenuSeparator",E6=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(et.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});E6.displayName=sle;var ale="MenuArrow",N6=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=E0(n);return a.jsx(Mj,{...i,...r,ref:e})});N6.displayName=ale;var lle="MenuSub",[YDe,T6]=du(lle),Eh="MenuSubTrigger",P6=y.forwardRef((t,e)=>{const n=fu(Eh,t.__scopeMenu),r=og(Eh,t.__scopeMenu),i=T6(Eh,t.__scopeMenu),o=LN(Eh,t.__scopeMenu),s=y.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=o,u={__scopeMenu:t.__scopeMenu},d=y.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return y.useEffect(()=>d,[d]),y.useEffect(()=>{const f=l.current;return()=>{window.clearTimeout(f),c(null)}},[l,c]),a.jsx(DN,{asChild:!0,...u,children:a.jsx(x6,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":I6(n.open),...t,ref:kb(e,i.onTriggerChange),onClick:f=>{var h;(h=t.onClick)==null||h.call(t,f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Pe(t.onPointerMove,Xp(f=>{o.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Pe(t.onPointerLeave,Xp(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,v=m==="right",b=v?-5:5,x=h[v?"left":"right"],w=h[v?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+b,y:f.clientY},{x,y:h.top},{x:w,y:h.top},{x:w,y:h.bottom},{x,y:h.bottom}],side:m}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Pe(t.onKeyDown,f=>{var p;const h=o.searchRef.current!=="";t.disabled||h&&f.key===" "||zae[r.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});P6.displayName=Eh;var k6="MenuSubContent",O6=y.forwardRef((t,e)=>{const n=m6(uo,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,o=fu(uo,t.__scopeMenu),s=og(uo,t.__scopeMenu),l=T6(k6,t.__scopeMenu),c=y.useRef(null),u=_t(e,c);return a.jsx(Qp.Provider,{scope:t.__scopeMenu,children:a.jsx(Mr,{present:r||o.open,children:a.jsx(Qp.Slot,{scope:t.__scopeMenu,children:a.jsx(FN,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:u,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;s.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:Pe(t.onFocusOutside,d=>{d.target!==l.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Pe(t.onEscapeKeyDown,d=>{s.onClose(),d.preventDefault()}),onKeyDown:Pe(t.onKeyDown,d=>{var p;const f=d.currentTarget.contains(d.target),h=Vae[s.dir].includes(d.key);f&&h&&(o.onOpenChange(!1),(p=l.trigger)==null||p.focus(),d.preventDefault())})})})})})});O6.displayName=k6;function I6(t){return t?"open":"closed"}function tx(t){return t==="indeterminate"}function HN(t){return tx(t)?"indeterminate":t?"checked":"unchecked"}function cle(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function ule(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function dle(t,e,n){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,o=n?t.indexOf(n):-1;let s=ule(t,Math.max(o,0));i.length===1&&(s=s.filter(u=>u!==n));const c=s.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function fle(t,e){const{x:n,y:r}=t;let i=!1;for(let o=0,s=e.length-1;or!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(i=!i)}return i}function hle(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return fle(n,e)}function Xp(t){return e=>e.pointerType==="mouse"?t(e):void 0}var ple=p6,mle=DN,gle=g6,vle=v6,yle=UN,xle=y6,ble=N0,wle=b6,Sle=S6,Cle=A6,Ale=j6,_le=E6,jle=N6,Ele=P6,Nle=O6,zN="DropdownMenu",[Tle,QDe]=ji(zN,[f6]),di=f6(),[Ple,R6]=Tle(zN),M6=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:l=!0}=t,c=di(e),u=y.useRef(null),[d=!1,f]=Ko({prop:i,defaultProp:o,onChange:s});return a.jsx(Ple,{scope:e,triggerId:Do(),triggerRef:u,contentId:Do(),open:d,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(h=>!h),[f]),modal:l,children:a.jsx(ple,{...c,open:d,onOpenChange:f,dir:r,modal:l,children:n})})};M6.displayName=zN;var D6="DropdownMenuTrigger",$6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,o=R6(D6,n),s=di(n);return a.jsx(mle,{asChild:!0,...s,children:a.jsx(et.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:kb(e,o.triggerRef),onPointerDown:Pe(t.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(o.onOpenToggle(),o.open||l.preventDefault())}),onKeyDown:Pe(t.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&o.onOpenToggle(),l.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});$6.displayName=D6;var kle="DropdownMenuPortal",L6=t=>{const{__scopeDropdownMenu:e,...n}=t,r=di(e);return a.jsx(gle,{...r,...n})};L6.displayName=kle;var F6="DropdownMenuContent",U6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=R6(F6,n),o=di(n),s=y.useRef(!1);return a.jsx(vle,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...r,ref:e,onCloseAutoFocus:Pe(t.onCloseAutoFocus,l=>{var c;s.current||(c=i.triggerRef.current)==null||c.focus(),s.current=!1,l.preventDefault()}),onInteractOutside:Pe(t.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!i.modal||d)&&(s.current=!0)}),style:{...t.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)"}})});U6.displayName=F6;var Ole="DropdownMenuGroup",Ile=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(yle,{...i,...r,ref:e})});Ile.displayName=Ole;var Rle="DropdownMenuLabel",B6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(xle,{...i,...r,ref:e})});B6.displayName=Rle;var Mle="DropdownMenuItem",H6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(ble,{...i,...r,ref:e})});H6.displayName=Mle;var Dle="DropdownMenuCheckboxItem",z6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(wle,{...i,...r,ref:e})});z6.displayName=Dle;var $le="DropdownMenuRadioGroup",Lle=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(Sle,{...i,...r,ref:e})});Lle.displayName=$le;var Fle="DropdownMenuRadioItem",V6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(Cle,{...i,...r,ref:e})});V6.displayName=Fle;var Ule="DropdownMenuItemIndicator",G6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(Ale,{...i,...r,ref:e})});G6.displayName=Ule;var Ble="DropdownMenuSeparator",K6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(_le,{...i,...r,ref:e})});K6.displayName=Ble;var Hle="DropdownMenuArrow",zle=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(jle,{...i,...r,ref:e})});zle.displayName=Hle;var Vle="DropdownMenuSubTrigger",W6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(Ele,{...i,...r,ref:e})});W6.displayName=Vle;var Gle="DropdownMenuSubContent",q6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(Nle,{...i,...r,ref:e,style:{...t.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)"}})});q6.displayName=Gle;var Kle=M6,Wle=$6,qle=L6,Y6=U6,Q6=B6,X6=H6,Z6=z6,J6=V6,eH=G6,tH=K6,nH=W6,rH=q6;const Y1=Kle,Q1=Wle,Yle=y.forwardRef(({className:t,inset:e,children:n,...r},i)=>a.jsxs(nH,{ref:i,className:ke("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",e&&"pl-8",t),...r,children:[n,a.jsx(Zi,{className:"ml-auto h-4 w-4"})]}));Yle.displayName=nH.displayName;const Qle=y.forwardRef(({className:t,...e},n)=>a.jsx(rH,{ref:n,className:ke("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",t),...e}));Qle.displayName=rH.displayName;const nx=y.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(qle,{children:a.jsx(Y6,{ref:r,sideOffset:e,className:ke("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",t),...n})}));nx.displayName=Y6.displayName;const Ba=y.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(X6,{ref:r,className:ke("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",e&&"pl-8",t),...n}));Ba.displayName=X6.displayName;const Xle=y.forwardRef(({className:t,children:e,checked:n,...r},i)=>a.jsxs(Z6,{ref:i,className:ke("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",t),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(eH,{children:a.jsx(Ts,{className:"h-4 w-4"})})}),e]}));Xle.displayName=Z6.displayName;const Zle=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(J6,{ref:r,className:ke("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",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(eH,{children:a.jsx(Wj,{className:"h-2 w-2 fill-current"})})}),e]}));Zle.displayName=J6.displayName;const Jle=y.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(Q6,{ref:r,className:ke("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));Jle.displayName=Q6.displayName;const ece=y.forwardRef(({className:t,...e},n)=>a.jsx(tH,{ref:n,className:ke("-mx-1 my-1 h-px bg-muted",t),...e}));ece.displayName=tH.displayName;var VN="Dialog",[iH,oH]=ji(VN),[tce,Jo]=iH(VN),sH=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=t,l=y.useRef(null),c=y.useRef(null),[u=!1,d]=Ko({prop:r,defaultProp:i,onChange:o});return a.jsx(tce,{scope:e,triggerRef:l,contentRef:c,contentId:Do(),titleId:Do(),descriptionId:Do(),open:u,onOpenChange:d,onOpenToggle:y.useCallback(()=>d(f=>!f),[d]),modal:s,children:n})};sH.displayName=VN;var aH="DialogTrigger",lH=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Jo(aH,n),o=_t(e,i.triggerRef);return a.jsx(et.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":WN(i.open),...r,ref:o,onClick:Pe(t.onClick,i.onOpenToggle)})});lH.displayName=aH;var GN="DialogPortal",[nce,cH]=iH(GN,{forceMount:void 0}),uH=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,o=Jo(GN,e);return a.jsx(nce,{scope:e,forceMount:n,children:y.Children.map(r,s=>a.jsx(Mr,{present:n||o.open,children:a.jsx(Mb,{asChild:!0,container:i,children:s})}))})};uH.displayName=GN;var rx="DialogOverlay",dH=y.forwardRef((t,e)=>{const n=cH(rx,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,o=Jo(rx,t.__scopeDialog);return o.modal?a.jsx(Mr,{present:r||o.open,children:a.jsx(rce,{...i,ref:e})}):null});dH.displayName=rx;var rce=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Jo(rx,n);return a.jsx(w0,{as:Es,allowPinchZoom:!0,shards:[i.contentRef],children:a.jsx(et.div,{"data-state":WN(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Jc="DialogContent",fH=y.forwardRef((t,e)=>{const n=cH(Jc,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,o=Jo(Jc,t.__scopeDialog);return a.jsx(Mr,{present:r||o.open,children:o.modal?a.jsx(ice,{...i,ref:e}):a.jsx(oce,{...i,ref:e})})});fH.displayName=Jc;var ice=y.forwardRef((t,e)=>{const n=Jo(Jc,t.__scopeDialog),r=y.useRef(null),i=_t(e,n.contentRef,r);return y.useEffect(()=>{const o=r.current;if(o)return wN(o)},[]),a.jsx(hH,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Pe(t.onCloseAutoFocus,o=>{var s;o.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:Pe(t.onPointerDownOutside,o=>{const s=o.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0;(s.button===2||l)&&o.preventDefault()}),onFocusOutside:Pe(t.onFocusOutside,o=>o.preventDefault())})}),oce=y.forwardRef((t,e)=>{const n=Jo(Jc,t.__scopeDialog),r=y.useRef(!1),i=y.useRef(!1);return a.jsx(hH,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s,l;(s=t.onCloseAutoFocus)==null||s.call(t,o),o.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var c,u;(c=t.onInteractOutside)==null||c.call(t,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;((u=n.triggerRef.current)==null?void 0:u.contains(s))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),hH=y.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=t,l=Jo(Jc,n),c=y.useRef(null),u=_t(e,c);return bN(),a.jsxs(a.Fragment,{children:[a.jsx(x0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:a.jsx(zm,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":WN(l.open),...s,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(ace,{titleId:l.titleId}),a.jsx(cce,{contentRef:c,descriptionId:l.descriptionId})]})]})}),KN="DialogTitle",pH=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Jo(KN,n);return a.jsx(et.h2,{id:i.titleId,...r,ref:e})});pH.displayName=KN;var mH="DialogDescription",gH=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Jo(mH,n);return a.jsx(et.p,{id:i.descriptionId,...r,ref:e})});gH.displayName=mH;var vH="DialogClose",yH=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Jo(vH,n);return a.jsx(et.button,{type:"button",...r,ref:e,onClick:Pe(t.onClick,()=>i.onOpenChange(!1))})});yH.displayName=vH;function WN(t){return t?"open":"closed"}var xH="DialogTitleWarning",[sce,bH]=Eq(xH,{contentName:Jc,titleName:KN,docsSlug:"dialog"}),ace=({titleId:t})=>{const e=bH(xH),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. +`)},lse=0,Su=[];function cse(t){var e=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),i=y.useState(lse++)[0],o=y.useState(RU)[0],s=y.useRef(t);y.useEffect(function(){s.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var m=Poe([t.lockRef.current],(t.shards||[]).map(kI),!0).filter(Boolean);return m.forEach(function(v){return v.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var l=y.useCallback(function(m,v){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var b=Yg(m),x=n.current,w="deltaX"in m?m.deltaX:x[0]-b[0],S="deltaY"in m?m.deltaY:x[1]-b[1],C,A=m.target,_=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in m&&_==="h"&&A.type==="range")return!1;var j=TI(_,A);if(!j)return!0;if(j?C=_:(C=_==="v"?"h":"v",j=TI(_,A)),!j)return!1;if(!r.current&&"changedTouches"in m&&(w||S)&&(r.current=C),!C)return!0;var k=r.current||C;return ose(k,v,m,k==="h"?w:S,!0)},[]),c=y.useCallback(function(m){var v=m;if(!(!Su.length||Su[Su.length-1]!==o)){var b="deltaY"in v?PI(v):Yg(v),x=e.current.filter(function(C){return C.name===v.type&&(C.target===v.target||v.target===C.shadowParent)&&sse(C.delta,b)})[0];if(x&&x.should){v.cancelable&&v.preventDefault();return}if(!x){var w=(s.current.shards||[]).map(kI).filter(Boolean).filter(function(C){return C.contains(v.target)}),S=w.length>0?l(v,w[0]):!s.current.noIsolation;S&&v.cancelable&&v.preventDefault()}}},[]),u=y.useCallback(function(m,v,b,x){var w={name:m,delta:v,target:b,should:x,shadowParent:use(b)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(S){return S!==w})},1)},[]),d=y.useCallback(function(m){n.current=Yg(m),r.current=void 0},[]),f=y.useCallback(function(m){u(m.type,PI(m),m.target,l(m,t.lockRef.current))},[]),h=y.useCallback(function(m){u(m.type,Yg(m),m.target,l(m,t.lockRef.current))},[]);y.useEffect(function(){return Su.push(o),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,wu),document.addEventListener("touchmove",c,wu),document.addEventListener("touchstart",d,wu),function(){Su=Su.filter(function(m){return m!==o}),document.removeEventListener("wheel",c,wu),document.removeEventListener("touchmove",c,wu),document.removeEventListener("touchstart",d,wu)}},[]);var p=t.removeScrollBar,g=t.inert;return y.createElement(y.Fragment,null,g?y.createElement(o,{styles:ase(i)}):null,p?y.createElement(Joe,{gapMode:t.gapMode}):null)}function use(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const dse=Foe(IU,cse);var b0=y.forwardRef(function(t,e){return y.createElement(x0,ms({},t,{ref:e,sideCar:dse}))});b0.classNames=x0.classNames;var fse=[" ","Enter","ArrowUp","ArrowDown"],hse=[" ","Enter"],Jm="Select",[w0,S0,pse]=v0(Jm),[_f,zDe]=ji(Jm,[pse,mf]),C0=mf(),[mse,Vl]=_f(Jm),[gse,vse]=_f(Jm),LU=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:o,value:s,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:h,required:p,form:g}=t,m=C0(e),[v,b]=y.useState(null),[x,w]=y.useState(null),[S,C]=y.useState(!1),A=uu(u),[_=!1,j]=Ko({prop:r,defaultProp:i,onChange:o}),[k,P]=Ko({prop:s,defaultProp:l,onChange:c}),I=y.useRef(null),E=v?g||!!v.closest("form"):!0,[R,L]=y.useState(new Set),V=Array.from(R).map($=>$.props.value).join(";");return a.jsx(TF,{...m,children:a.jsxs(mse,{required:p,scope:e,trigger:v,onTriggerChange:b,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Do(),value:k,onValueChange:P,open:_,onOpenChange:j,dir:A,triggerPointerDownPosRef:I,disabled:h,children:[a.jsx(w0.Provider,{scope:e,children:a.jsx(gse,{scope:t.__scopeSelect,onNativeOptionAdd:y.useCallback($=>{L(z=>new Set(z).add($))},[]),onNativeOptionRemove:y.useCallback($=>{L(z=>{const M=new Set(z);return M.delete($),M})},[]),children:n})}),E?a.jsxs(cB,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:k,onChange:$=>P($.target.value),disabled:h,form:g,children:[k===void 0?a.jsx("option",{value:""}):null,Array.from(R)]},V):null]})})};LU.displayName=Jm;var FU="SelectTrigger",UU=y.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,o=C0(n),s=Vl(FU,n),l=s.disabled||r,c=At(e,s.onTriggerChange),u=S0(n),d=y.useRef("touch"),[f,h,p]=uB(m=>{const v=u().filter(w=>!w.disabled),b=v.find(w=>w.value===s.value),x=dB(v,m,b);x!==void 0&&s.onValueChange(x.value)}),g=m=>{l||(s.onOpenChange(!0),p()),m&&(s.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return a.jsx(Oj,{asChild:!0,...o,children:a.jsx(et.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":lB(s.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 v=m.target;v.hasPointerCapture(m.pointerId)&&v.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:Te(i.onKeyDown,m=>{const v=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&h(m.key),!(v&&m.key===" ")&&fse.includes(m.key)&&(g(),m.preventDefault())})})})});UU.displayName=FU;var BU="SelectValue",HU=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:o,placeholder:s="",...l}=t,c=Vl(BU,n),{onValueNodeHasChildrenChange:u}=c,d=o!==void 0,f=At(e,c.onValueNodeChange);return Rr(()=>{u(d)},[u,d]),a.jsx(et.span,{...l,ref:f,style:{pointerEvents:"none"},children:lB(c.value)?a.jsx(a.Fragment,{children:s}):o})});HU.displayName=BU;var yse="SelectIcon",zU=y.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return a.jsx(et.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});zU.displayName=yse;var xse="SelectPortal",VU=t=>a.jsx(Rb,{asChild:!0,...t});VU.displayName=xse;var Jc="SelectContent",GU=y.forwardRef((t,e)=>{const n=Vl(Jc,t.__scopeSelect),[r,i]=y.useState();if(Rr(()=>{i(new DocumentFragment)},[]),!n.open){const o=r;return o?ff.createPortal(a.jsx(KU,{scope:t.__scopeSelect,children:a.jsx(w0.Slot,{scope:t.__scopeSelect,children:a.jsx("div",{children:t.children})})}),o):null}return a.jsx(WU,{...t,ref:e})});GU.displayName=Jc;var So=10,[KU,Gl]=_f(Jc),bse="SelectContentImpl",WU=y.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:s,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:v,...b}=t,x=Vl(Jc,n),[w,S]=y.useState(null),[C,A]=y.useState(null),_=At(e,de=>S(de)),[j,k]=y.useState(null),[P,I]=y.useState(null),E=S0(n),[R,L]=y.useState(!1),V=y.useRef(!1);y.useEffect(()=>{if(w)return bN(w)},[w]),xN();const $=y.useCallback(de=>{const[Re,...pe]=E().map(ne=>ne.ref.current),[Se]=pe.slice(-1),Ne=document.activeElement;for(const ne of de)if(ne===Ne||(ne==null||ne.scrollIntoView({block:"nearest"}),ne===Re&&C&&(C.scrollTop=0),ne===Se&&C&&(C.scrollTop=C.scrollHeight),ne==null||ne.focus(),document.activeElement!==Ne))return},[E,C]),z=y.useCallback(()=>$([j,w]),[$,j,w]);y.useEffect(()=>{R&&z()},[R,z]);const{onOpenChange:M,triggerPointerDownPosRef:U}=x;y.useEffect(()=>{if(w){let de={x:0,y:0};const Re=Se=>{var Ne,ne;de={x:Math.abs(Math.round(Se.pageX)-(((Ne=U.current)==null?void 0:Ne.x)??0)),y:Math.abs(Math.round(Se.pageY)-(((ne=U.current)==null?void 0:ne.y)??0))}},pe=Se=>{de.x<=10&&de.y<=10?Se.preventDefault():w.contains(Se.target)||M(!1),document.removeEventListener("pointermove",Re),U.current=null};return U.current!==null&&(document.addEventListener("pointermove",Re),document.addEventListener("pointerup",pe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Re),document.removeEventListener("pointerup",pe,{capture:!0})}}},[w,M,U]),y.useEffect(()=>{const de=()=>M(!1);return window.addEventListener("blur",de),window.addEventListener("resize",de),()=>{window.removeEventListener("blur",de),window.removeEventListener("resize",de)}},[M]);const[W,X]=uB(de=>{const Re=E().filter(Ne=>!Ne.disabled),pe=Re.find(Ne=>Ne.ref.current===document.activeElement),Se=dB(Re,de,pe);Se&&setTimeout(()=>Se.ref.current.focus())}),re=y.useCallback((de,Re,pe)=>{const Se=!V.current&&!pe;(x.value!==void 0&&x.value===Re||Se)&&(k(de),Se&&(V.current=!0))},[x.value]),xe=y.useCallback(()=>w==null?void 0:w.focus(),[w]),F=y.useCallback((de,Re,pe)=>{const Se=!V.current&&!pe;(x.value!==void 0&&x.value===Re||Se)&&I(de)},[x.value]),fe=r==="popper"?L1:qU,oe=fe===L1?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:v}:{};return a.jsx(KU,{scope:n,content:w,viewport:C,onViewportChange:A,itemRefCallback:re,selectedItem:j,onItemLeave:xe,itemTextRefCallback:F,focusSelectedItem:z,selectedItemText:P,position:r,isPositioned:R,searchRef:W,children:a.jsx(b0,{as:Es,allowPinchZoom:!0,children:a.jsx(y0,{asChild:!0,trapped:x.open,onMountAutoFocus:de=>{de.preventDefault()},onUnmountAutoFocus:Te(i,de=>{var Re;(Re=x.trigger)==null||Re.focus({preventScroll:!0}),de.preventDefault()}),children:a.jsx(Hm,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:de=>de.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:a.jsx(fe,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:de=>de.preventDefault(),...b,...oe,onPlaced:()=>L(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Te(b.onKeyDown,de=>{const Re=de.ctrlKey||de.altKey||de.metaKey;if(de.key==="Tab"&&de.preventDefault(),!Re&&de.key.length===1&&X(de.key),["ArrowUp","ArrowDown","Home","End"].includes(de.key)){let Se=E().filter(Ne=>!Ne.disabled).map(Ne=>Ne.ref.current);if(["ArrowUp","End"].includes(de.key)&&(Se=Se.slice().reverse()),["ArrowUp","ArrowDown"].includes(de.key)){const Ne=de.target,ne=Se.indexOf(Ne);Se=Se.slice(ne+1)}setTimeout(()=>$(Se)),de.preventDefault()}})})})})})})});WU.displayName=bse;var wse="SelectItemAlignedPosition",qU=y.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,o=Vl(Jc,n),s=Gl(Jc,n),[l,c]=y.useState(null),[u,d]=y.useState(null),f=At(e,_=>d(_)),h=S0(n),p=y.useRef(!1),g=y.useRef(!0),{viewport:m,selectedItem:v,selectedItemText:b,focusSelectedItem:x}=s,w=y.useCallback(()=>{if(o.trigger&&o.valueNode&&l&&u&&m&&v&&b){const _=o.trigger.getBoundingClientRect(),j=u.getBoundingClientRect(),k=o.valueNode.getBoundingClientRect(),P=b.getBoundingClientRect();if(o.dir!=="rtl"){const Ne=P.left-j.left,ne=k.left-Ne,nt=_.left-ne,Fe=_.width+nt,vt=Math.max(Fe,j.width),mt=window.innerWidth-So,Bt=Wp(ne,[So,Math.max(So,mt-vt)]);l.style.minWidth=Fe+"px",l.style.left=Bt+"px"}else{const Ne=j.right-P.right,ne=window.innerWidth-k.right-Ne,nt=window.innerWidth-_.right-ne,Fe=_.width+nt,vt=Math.max(Fe,j.width),mt=window.innerWidth-So,Bt=Wp(ne,[So,Math.max(So,mt-vt)]);l.style.minWidth=Fe+"px",l.style.right=Bt+"px"}const I=h(),E=window.innerHeight-So*2,R=m.scrollHeight,L=window.getComputedStyle(u),V=parseInt(L.borderTopWidth,10),$=parseInt(L.paddingTop,10),z=parseInt(L.borderBottomWidth,10),M=parseInt(L.paddingBottom,10),U=V+$+R+M+z,W=Math.min(v.offsetHeight*5,U),X=window.getComputedStyle(m),re=parseInt(X.paddingTop,10),xe=parseInt(X.paddingBottom,10),F=_.top+_.height/2-So,fe=E-F,oe=v.offsetHeight/2,de=v.offsetTop+oe,Re=V+$+de,pe=U-Re;if(Re<=F){const Ne=I.length>0&&v===I[I.length-1].ref.current;l.style.bottom="0px";const ne=u.clientHeight-m.offsetTop-m.offsetHeight,nt=Math.max(fe,oe+(Ne?xe:0)+ne+z),Fe=Re+nt;l.style.height=Fe+"px"}else{const Ne=I.length>0&&v===I[0].ref.current;l.style.top="0px";const nt=Math.max(F,V+m.offsetTop+(Ne?re:0)+oe)+pe;l.style.height=nt+"px",m.scrollTop=Re-F+m.offsetTop}l.style.margin=`${So}px 0`,l.style.minHeight=W+"px",l.style.maxHeight=E+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,o.trigger,o.valueNode,l,u,m,v,b,o.dir,r]);Rr(()=>w(),[w]);const[S,C]=y.useState();Rr(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const A=y.useCallback(_=>{_&&g.current===!0&&(w(),x==null||x(),g.current=!1)},[w,x]);return a.jsx(Cse,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:A,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:a.jsx(et.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});qU.displayName=wse;var Sse="SelectPopperPosition",L1=y.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=So,...o}=t,s=C0(n);return a.jsx(Ij,{...s,...o,ref:e,align:r,collisionPadding:i,style:{boxSizing:"border-box",...o.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)"}})});L1.displayName=Sse;var[Cse,wN]=_f(Jc,{}),F1="SelectViewport",YU=y.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,o=Gl(F1,n),s=wN(F1,n),l=At(e,o.onViewportChange),c=y.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(w0.Slot,{scope:n,children:a.jsx(et.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}=s;if(h!=null&&h.current&&f){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-So*2,m=parseFloat(f.style.minHeight),v=parseFloat(f.style.height),b=Math.max(m,v);if(b0?S:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});YU.displayName=F1;var QU="SelectGroup",[Ase,_se]=_f(QU),jse=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Do();return a.jsx(Ase,{scope:n,id:i,children:a.jsx(et.div,{role:"group","aria-labelledby":i,...r,ref:e})})});jse.displayName=QU;var XU="SelectLabel",JU=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=_se(XU,n);return a.jsx(et.div,{id:i.id,...r,ref:e})});JU.displayName=XU;var Jy="SelectItem",[Ese,ZU]=_f(Jy),eB=y.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:o,...s}=t,l=Vl(Jy,n),c=Gl(Jy,n),u=l.value===r,[d,f]=y.useState(o??""),[h,p]=y.useState(!1),g=At(e,x=>{var w;return(w=c.itemRefCallback)==null?void 0:w.call(c,x,r,i)}),m=Do(),v=y.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(Ese,{scope:n,value:r,disabled:i,textId:m,isSelected:u,onItemTextChange:y.useCallback(x=>{f(w=>w||((x==null?void 0:x.textContent)??"").trim())},[]),children:a.jsx(w0.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:a.jsx(et.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,...s,ref:g,onFocus:Te(s.onFocus,()=>p(!0)),onBlur:Te(s.onBlur,()=>p(!1)),onClick:Te(s.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:Te(s.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:Te(s.onPointerDown,x=>{v.current=x.pointerType}),onPointerMove:Te(s.onPointerMove,x=>{var w;v.current=x.pointerType,i?(w=c.onItemLeave)==null||w.call(c):v.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Te(s.onPointerLeave,x=>{var w;x.currentTarget===document.activeElement&&((w=c.onItemLeave)==null||w.call(c))}),onKeyDown:Te(s.onKeyDown,x=>{var S;((S=c.searchRef)==null?void 0:S.current)!==""&&x.key===" "||(hse.includes(x.key)&&b(),x.key===" "&&x.preventDefault())})})})})});eB.displayName=Jy;var _h="SelectItemText",tB=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...o}=t,s=Vl(_h,n),l=Gl(_h,n),c=ZU(_h,n),u=vse(_h,n),[d,f]=y.useState(null),h=At(e,b=>f(b),c.onItemTextChange,b=>{var x;return(x=l.itemTextRefCallback)==null?void 0:x.call(l,b,c.value,c.disabled)}),p=d==null?void 0:d.textContent,g=y.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:v}=u;return Rr(()=>(m(g),()=>v(g)),[m,v,g]),a.jsxs(a.Fragment,{children:[a.jsx(et.span,{id:c.textId,...o,ref:h}),c.isSelected&&s.valueNode&&!s.valueNodeHasChildren?ff.createPortal(o.children,s.valueNode):null]})});tB.displayName=_h;var nB="SelectItemIndicator",rB=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return ZU(nB,n).isSelected?a.jsx(et.span,{"aria-hidden":!0,...r,ref:e}):null});rB.displayName=nB;var U1="SelectScrollUpButton",iB=y.forwardRef((t,e)=>{const n=Gl(U1,t.__scopeSelect),r=wN(U1,t.__scopeSelect),[i,o]=y.useState(!1),s=At(e,r.onScrollButtonChange);return Rr(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;o(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),i?a.jsx(sB,{...t,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});iB.displayName=U1;var B1="SelectScrollDownButton",oB=y.forwardRef((t,e)=>{const n=Gl(B1,t.__scopeSelect),r=wN(B1,t.__scopeSelect),[i,o]=y.useState(!1),s=At(e,r.onScrollButtonChange);return Rr(()=>{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(sB,{...t,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});oB.displayName=B1;var sB=y.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,o=Gl("SelectScrollButton",n),s=y.useRef(null),l=S0(n),c=y.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return y.useEffect(()=>()=>c(),[c]),Rr(()=>{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(et.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:Te(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:Te(i.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:Te(i.onPointerLeave,()=>{c()})})}),Nse="SelectSeparator",aB=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return a.jsx(et.div,{"aria-hidden":!0,...r,ref:e})});aB.displayName=Nse;var H1="SelectArrow",Tse=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=C0(n),o=Vl(H1,n),s=Gl(H1,n);return o.open&&s.position==="popper"?a.jsx(Rj,{...i,...r,ref:e}):null});Tse.displayName=H1;function lB(t){return t===""||t===void 0}var cB=y.forwardRef((t,e)=>{const{value:n,...r}=t,i=y.useRef(null),o=At(e,i),s=Xm(n);return y.useEffect(()=>{const l=i.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(s!==n&&d){const f=new Event("change",{bubbles:!0});d.call(l,n),l.dispatchEvent(f)}},[s,n]),a.jsx(Mj,{asChild:!0,children:a.jsx("select",{...r,ref:o,defaultValue:n})})});cB.displayName="BubbleSelect";function uB(t){const e=dr(t),n=y.useRef(""),r=y.useRef(0),i=y.useCallback(s=>{const l=n.current+s;e(l),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[e]),o=y.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function dB(t,e,n){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,o=n?t.indexOf(n):-1;let s=Pse(t,Math.max(o,0));i.length===1&&(s=s.filter(u=>u!==n));const c=s.find(u=>u.textValue.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function Pse(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var kse=LU,fB=UU,Ose=HU,Ise=zU,Rse=VU,hB=GU,Mse=YU,pB=JU,mB=eB,Dse=tB,$se=rB,gB=iB,vB=oB,yB=aB;const kn=kse,On=Ose,Nn=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(fB,{ref:r,className:Pe("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",t),...n,children:[e,a.jsx(Ise,{asChild:!0,children:a.jsx(va,{className:"h-4 w-4 opacity-50"})})]}));Nn.displayName=fB.displayName;const xB=y.forwardRef(({className:t,...e},n)=>a.jsx(gB,{ref:n,className:Pe("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(Hc,{className:"h-4 w-4"})}));xB.displayName=gB.displayName;const bB=y.forwardRef(({className:t,...e},n)=>a.jsx(vB,{ref:n,className:Pe("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(va,{className:"h-4 w-4"})}));bB.displayName=vB.displayName;const Tn=y.forwardRef(({className:t,children:e,position:n="popper",...r},i)=>a.jsx(Rse,{children:a.jsxs(hB,{ref:i,className:Pe("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",t),position:n,...r,children:[a.jsx(xB,{}),a.jsx(Mse,{className:Pe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(bB,{})]})}));Tn.displayName=hB.displayName;const Lse=y.forwardRef(({className:t,...e},n)=>a.jsx(pB,{ref:n,className:Pe("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));Lse.displayName=pB.displayName;const ce=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(mB,{ref:r,className:Pe("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",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx($se,{children:a.jsx(Ts,{className:"h-4 w-4"})})}),a.jsx(Dse,{children:e})]}));ce.displayName=mB.displayName;const Fse=y.forwardRef(({className:t,...e},n)=>a.jsx(yB,{ref:n,className:Pe("-mx-1 my-1 h-px bg-muted",t),...e}));Fse.displayName=yB.displayName;const Use=Oe.object({audienceBrief:Oe.string().min(10,{message:"Audience brief must be at least 10 characters."}),researchObjective:Oe.string().optional(),personaCount:Oe.string().min(1,{message:"Number of personas is required."}),dataFile:Oe.instanceof(FileList).optional(),llm_model:Oe.string().optional()});function Bse({onSubmit:t,isGenerating:e}){const[n,r]=y.useState(!1),[i,o]=y.useState(!1),[s,l]=y.useState({audience_brief:[],research_objective:[]}),[c,u]=y.useState(!1),[d,f]=y.useState(null),h=f0({resolver:h0(Use),defaultValues:{audienceBrief:"",researchObjective:"",personaCount:"5",llm_model:"gemini-2.5-pro"}}),p=h.watch("audienceBrief"),g=h.watch("researchObjective"),m=async()=>{var w,S,C,A,_,j,k,P,I,E,R;const b=p==null?void 0:p.trim(),x=g==null?void 0:g.trim();if(!b||b.length<10){ie.error("Audience brief too short",{description:"Please enter at least 10 characters in the audience brief"});return}if(!x||x.length<10){ie.error("Research objective too short",{description:"Please enter at least 10 characters in the research objective"});return}u(!0),f(null);try{const L=await Ks.enhanceAudienceBrief(b,x);l(L.data.suggestions||{audience_brief:[],research_objective:[]}),r(!0),o(!1);const V=(((S=(w=L.data.suggestions)==null?void 0:w.audience_brief)==null?void 0:S.length)||0)+(((A=(C=L.data.suggestions)==null?void 0:C.research_objective)==null?void 0:A.length)||0);ie.success("Enhancement suggestions generated",{description:`Generated ${V} suggestions to improve your research inputs`})}catch(L){console.error("Error enhancing audience brief:",L);let V="Please try again or modify your brief",$="Failed to generate suggestions";if(L&&typeof L=="object"){const z=L;z.code==="ECONNABORTED"||(_=z.message)!=null&&_.includes("timeout")?($="Request timeout",V="The AI took too long to analyze your brief. Please try again."):((j=z.response)==null?void 0:j.status)===500?($="Server error",V=((P=(k=z.response)==null?void 0:k.data)==null?void 0:P.message)||"The server encountered an error. Please try again later."):((I=z.response)==null?void 0:I.status)===400?($="Invalid brief",V=((R=(E=z.response)==null?void 0:E.data)==null?void 0:R.message)||"Please check your audience brief and try again."):z.message&&(V=z.message)}else L instanceof Error&&(V=L.message);f(V),ie.error($,{description:V,duration:5e3})}finally{u(!1)}},v=()=>{o(!i)};return a.jsx(m0,{...h,children:a.jsxs("form",{onSubmit:h.handleSubmit(t),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(dt,{control:h.control,name:"audienceBrief",render:({field:b})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Audience Brief"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Describe your target audience and research goals...",className:"h-40",...b})}),a.jsx(xn,{children:"Provide details about the demographics, behaviors, and attitudes you want to explore"}),a.jsx(at,{})]})}),a.jsx(dt,{control:h.control,name:"researchObjective",render:({field:b})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Research Objective"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"What is the main research topic or objective you want to explore?",className:"h-32",...b})}),a.jsx(xn,{children:"Specify your research focus to generate more targeted persona goals, frustrations, and scenarios"}),a.jsx(at,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx(te,{type:"button",variant:"outline",size:"sm",onClick:m,disabled:!p||p.trim().length<10||!g||g.trim().length<10||c||e,className:"flex items-center gap-2 hover-transition",children:c?a.jsxs(a.Fragment,{children:[a.jsx(td,{className:"h-4 w-4 animate-spin"}),"Analyzing Research Inputs..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Vc,{className:"h-4 w-4"}),"Enhance Brief"]})})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(dt,{control:h.control,name:"dataFile",render:({field:{value:b,onChange:x,...w}})=>a.jsxs(it,{children:[a.jsx(ot,{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(c4,{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(Dt,{...w,type:"file",multiple:!0,accept:".pdf,.docx,.pptx,.xlsx,.html,.xml,.rtf,.pages,.key,.epub,.txt,.csv,.jpg,.jpeg,.png",onChange:S=>{x(S.target.files)},className:"hidden",id:"data-file-input"}),a.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:()=>{var S;return(S=document.getElementById("data-file-input"))==null?void 0:S.click()},children:[a.jsx(d4,{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(xn,{children:"Upload existing customer data to create more realistic personas"}),a.jsx(at,{})]})}),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(s1,{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(bh,{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(bh,{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(bh,{className:"h-4 w-4 text-green-500 mr-2"}),"Consumer preferences and interests"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(bh,{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(Vc,{className:"h-4 w-4 text-primary"}),"Enhancement Suggestions:"]}),a.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:v,className:"h-6 w-6 p-0 hover:bg-slate-200",title:i?"Expand suggestions":"Collapse suggestions",children:i?a.jsx(va,{className:"h-4 w-4"}):a.jsx(Hc,{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:s.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(Cr,{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:s.audience_brief.map((b,x)=>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})]},x))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No audience brief suggestions available"})}),a.jsx("div",{children:s.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(s1,{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:s.research_objective.map((b,x)=>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})]},x))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No research objective suggestions available"})}),s.audience_brief.length===0&&s.research_objective.length===0&&a.jsx("div",{className:"col-span-full text-sm text-muted-foreground text-center",children:"No suggestions available"})]})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(dt,{control:h.control,name:"llm_model",render:({field:b})=>a.jsxs(it,{children:[a.jsx(ot,{children:"AI Model"}),a.jsxs(kn,{onValueChange:b.onChange,defaultValue:b.value,children:[a.jsx(st,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select AI model"})})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(ce,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(ce,{value:"gpt-5",children:"GPT-5"})]})]}),a.jsx(xn,{children:"Choose which AI model to use for generating personas"}),a.jsx(at,{})]})}),a.jsx(dt,{control:h.control,name:"personaCount",render:({field:b})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Number of Personas to Generate"}),a.jsx(st,{children:a.jsx(Dt,{type:"number",min:"1",max:"20",...b})}),a.jsx(xn,{children:"How many synthetic users do you need for your research?"}),a.jsx(at,{})]})})]}),a.jsxs("div",{className:"flex flex-col items-end",children:[a.jsx(te,{type:"submit",disabled:e,className:"min-w-36",children:e?a.jsxs(a.Fragment,{children:[a.jsx(td,{className:"mr-2 h-4 w-4 animate-spin"}),"AI Generating..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Cr,{className:"mr-2 h-4 w-4"}),"Generate Personas"]})}),e&&a.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:"Generating multiple personas in parallel. This may take 1-2 minutes..."})]})]})})}const ct=y.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Pe("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));ct.displayName="Card";const pi=y.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Pe("flex flex-col space-y-1.5 p-6",t),...e}));pi.displayName="CardHeader";const Mi=y.forwardRef(({className:t,...e},n)=>a.jsx("h3",{ref:n,className:Pe("text-2xl font-semibold leading-none tracking-tight",t),...e}));Mi.displayName="CardTitle";const SN=y.forwardRef(({className:t,...e},n)=>a.jsx("p",{ref:n,className:Pe("text-sm text-muted-foreground",t),...e}));SN.displayName="CardDescription";const jt=y.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Pe("p-6 pt-0",t),...e}));jt.displayName="CardContent";const CN=y.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Pe("flex items-center p-6 pt-0",t),...e}));CN.displayName="CardFooter";const Hse=t=>{const e=t==null?void 0:t.toLowerCase(),n="/semblance/";switch(e){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`}},Zm=t=>t.avatar||Hse(t.gender);function AN({user:t,selected:e=!1,onClick:n,showDetailedDialog:r=!1,onSelectionToggle:i,showAddToFolderButton:o=!1,onAddToFolder:s,onViewDetails:l,folders:c=[]}){const u=Xn();y.useState(!1);const[d,f]=y.useState(t),h=t._id||t.id,p=v=>{v.stopPropagation(),u(`/synthetic-users/${h}`)};d.oceanTraits&&(d.oceanTraits.openness,d.oceanTraits.conscientiousness,d.oceanTraits.extraversion,d.oceanTraits.agreeableness,d.oceanTraits.neuroticism);const g=v=>{var w,S;const b=v.target;b.closest("button")&&((S=(w=b.closest("button"))==null?void 0:w.textContent)!=null&&S.includes("View Details"))||(i?i(v):n&&n(v))},m=v=>{v.stopPropagation(),l?l(d):p(v)};return a.jsxs("div",{className:Pe("persona-card glass-card rounded-xl p-4 cursor-pointer hover:shadow-md button-transition",e&&"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(Ts,{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:Zm(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((v,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(YX,{className:"h-3 w-3"}),v]},b))})}),d.folder_ids&&d.folder_ids.length>0&&a.jsx("div",{className:"mt-2",children:a.jsxs("div",{className:"flex flex-wrap gap-1",children:[d.folder_ids.slice(0,2).map(v=>{const b=c.find(x=>x._id===v);return b?a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-gray-100 text-gray-700 text-xs rounded-full",title:`In folder: ${b.name}`,children:[a.jsx(Zi,{className:"h-3 w-3"}),b.name]},v):null}),d.folder_ids.length>2&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-gray-100 text-gray-700 text-xs rounded-full",children:[a.jsx(Tr,{className:"h-3 w-3"}),d.folder_ids.length-2," more"]})]})}),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((v,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(Bc,{className:"h-3 w-3"}),v]},b))})}),a.jsx("div",{className:"mt-3 flex justify-end",children:a.jsx(te,{variant:"ghost",size:"sm",onClick:m,children:"View Details"})})]})]})})]})}var _N="Collapsible",[zse,VDe]=ji(_N),[Vse,jN]=zse(_N),wB=y.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:o,onOpenChange:s,...l}=t,[c=!1,u]=Ko({prop:r,defaultProp:i,onChange:s});return a.jsx(Vse,{scope:n,disabled:o,contentId:Do(),open:c,onOpenToggle:y.useCallback(()=>u(d=>!d),[u]),children:a.jsx(et.div,{"data-state":NN(c),"data-disabled":o?"":void 0,...l,ref:e})})});wB.displayName=_N;var SB="CollapsibleTrigger",CB=y.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,i=jN(SB,n);return a.jsx(et.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":NN(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:e,onClick:Te(t.onClick,i.onOpenToggle)})});CB.displayName=SB;var EN="CollapsibleContent",AB=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=jN(EN,t.__scopeCollapsible);return a.jsx(Mr,{present:n||i.open,children:({present:o})=>a.jsx(Gse,{...r,ref:e,present:o})})});AB.displayName=EN;var Gse=y.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:i,...o}=t,s=jN(EN,n),[l,c]=y.useState(r),u=y.useRef(null),d=At(e,u),f=y.useRef(0),h=f.current,p=y.useRef(0),g=p.current,m=s.open||l,v=y.useRef(m),b=y.useRef();return y.useEffect(()=>{const x=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(x)},[]),Rr(()=>{const x=u.current;if(x){b.current=b.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const w=x.getBoundingClientRect();f.current=w.height,p.current=w.width,v.current||(x.style.transitionDuration=b.current.transitionDuration,x.style.animationName=b.current.animationName),c(r)}},[s.open,r]),a.jsx(et.div,{"data-state":NN(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!m,...o,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:m&&i})});function NN(t){return t?"open":"closed"}var Kse=wB;const eg=Kse,tg=CB,ng=AB;function Wse({generatedPersonas:t,selectedPersonas:e,isGenerating:n,onPersonaSelection:r,onRefinePersonas:i,onApprovePersonas:o,onBackToGenerator:s}){const l=Xn(),[c,u]=y.useState(""),[d,f]=y.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:[e.length," of ",t.length," selected"]})]}),a.jsx("div",{className:"space-y-4",children:t.map(p=>a.jsx(ct,{className:`border ${e.includes(p.id)?"border-primary/50 bg-primary/5":""} cursor-pointer`,onClick:()=>h(p.id),children:a.jsx(jt,{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:e.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(AN,{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(te,{variant:"outline",onClick:s,children:[a.jsx(Sp,{className:"mr-2 h-4 w-4"}),"Back to Generator"]})}),a.jsxs(eg,{open:d,onOpenChange:f,className:"w-full space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx(tg,{asChild:!0,children:a.jsxs(te,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(td,{className:"h-4 w-4"}),"Refine Personas",a.jsx(va,{className:"h-4 w-4 ml-1 transition-transform duration-200",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]})}),a.jsxs(te,{onClick:o,disabled:e.length===0,children:[a.jsx(bh,{className:"mr-2 h-4 w-4"}),"Approve Selected (",e.length,")"]})]}),a.jsx(ng,{children:a.jsx(ct,{className:"border shadow-sm w-full mt-4",children:a.jsx(jt,{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(lt,{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(te,{onClick:()=>i(c),disabled:n||c.trim()==="",className:"w-full",children:[n?a.jsx(td,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(td,{className:"mr-2 h-4 w-4"}),"Apply Refinements"]})]})})})})]})]})})]})}async function qse(t,e,n,r,i,o){console.log(`generateSyntheticPersonas called with targetFolderId: ${i||"none"}`),console.log(`🔄 generateSyntheticPersonas using model: ${o||"gemini-2.5-pro"}`);try{if(console.log(`Generating ${n} synthetic personas using two-stage approach...`),t.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 Ks.uploadCustomerData(r)).data.session_id,console.log(`Customer data uploaded with session ID: ${s}`)}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 Ks.batchGenerateWithStages(t,e,n,.8,s,o);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)`:""}`),i){const f=l.data.personas,h=f.map(p=>p._id||p.id).filter(Boolean);console.log(`Adding ${h.length} newly generated personas to folder: ${i}`);try{await ds.addPersonasBatch(i,h),console.log(`Added ${h.length} newly generated personas to folder: ${i}`)}catch(p){console.error("Error adding personas to folder:",p)}if(s)try{await Ks.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(p){console.warn("Failed to cleanup customer data:",p)}return c||d?{...l.data,length:f.length}:{...l.data,personas:f}}if(s)try{await Ks.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}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(s)try{await Ks.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}return l.data.personas}else if(d){if(s)try{await Ks.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}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(s){if(customerDataSessionId)try{await Ks.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:",s),s}}function _B(){const[t,e]=y.useState([]),n=async o=>{const s=[];for(const l of o){const c={...l};c._id&&typeof c._id=="string"&&c._id.startsWith("local-")&&delete c._id;const u=await kr.create(c);console.log("Persona saved to database:",u.data),s.push({...l,id:u.data._id||u.data.id,_id:u.data._id||u.data.id,isDbPersona:!0})}e(s)},r=async()=>{const o=await kr.getAll();return o&&o.data&&Array.isArray(o.data)?(console.log("Personas loaded from database:",o.data.length),o.data.map(s=>({...s,id:s._id||s.id,isDbPersona:!0}))):[]};return y.useEffect(()=>{(async()=>{const s=await r();e(s)})()},[]),{storedPersonas:t,savePersonas:n,loadPersonas:r,clearPersonas:async()=>{const o=await r();for(const s of o)s._id&&await kr.delete(s._id);e([])}}}function Yse({targetFolderId:t,targetFolderName:e}){const n=Ei(),r=Xn(),{loadPersonas:i,savePersonas:o}=_B(),[s,l]=y.useState(!1),[c,u]=y.useState([]),[d,f]=y.useState([]),[h,p]=y.useState(!1),[g,m]=y.useState(0);y.useEffect(()=>{const C=new URLSearchParams(n.search),A=C.get("mode"),_=C.get("tab"),j=C.get("step");if(A==="create"&&_==="ai"&&j==="review"){const k=i();k.length>0&&(u(k),f(k.map(P=>P.id)),p(!0))}},[n,i]);async function v(C){var A,_,j,k,P,I,E,R,L,V;try{l(!0),m(0);const $=parseInt(C.personaCount);if(isNaN($)||$<1||$>10){ie.error("Invalid number of personas",{description:"Please enter a number between 1 and 10"}),l(!1);return}m(5);const z=setInterval(()=>{m(X=>X<90?X+Math.random()*5:X)},500),M=$<=2?"30-60 seconds":$<=4?"1-2 minutes":$<=6?"2-3 minutes":"3-5 minutes";$>4&&ie.info("Generation may take longer",{description:`Generating ${$} personas at once may result in some timeouts. If this happens, the successfully created personas will still be saved.`,duration:8e3}),ie.info("Generating AI personas in parallel",{description:`Creating ${$} synthetic personas based on your brief. This may take ${M}. Please be patient.`,duration:1e4}),t&&e?(console.log(`Target folder for new personas: ID=${t}, Name=${e}`),ie.info(`Creating personas in "${e}" folder`,{duration:3e3})):console.log("No target folder specified for new personas"),console.log(`🤖 Starting persona generation with model: ${C.llm_model||"gemini-2.5-pro"}`);const U=await qse(C.audienceBrief,C.researchObjective,$,C.dataFile,t,C.llm_model),W=U.personas||U;if(clearInterval(z),m(100),W&&W.length>0)console.log(`✅ Successfully generated ${W.length} personas using model: ${C.llm_model||"gemini-2.5-pro"}`),U.partial_success||U.errors&&U.errors.length>0?(ie.success("Some personas generated successfully",{description:`${W.length} synthetic personas were created using ${C.llm_model||"Gemini 2.5 Pro"}. ${((A=U.errors)==null?void 0:A.length)||0} failed due to timeout or other errors.`,duration:8e3}),U.errors&&U.errors.length>0&&setTimeout(()=>{ie.error("Some personas failed to generate",{description:`${U.errors.length} personas timed out. The server took too long to generate them. The successfully generated personas have been saved${t?" in the selected folder":""}.`,duration:1e4})},1e3)):ie.success("Personas generated and saved successfully",{description:`${W.length} synthetic personas have been created using ${C.llm_model||"Gemini 2.5 Pro"} and saved ${t?`to the "${e}" folder`:"to the database"}.`}),r("/synthetic-users?mode=view");else throw new Error("No personas were generated")}catch($){console.error(`❌ Error generating personas using model: ${C.llm_model||"gemini-2.5-pro"}:`,$);let z="Please try again or adjust your parameters",M="Failed to generate personas";$.code==="ECONNABORTED"||(_=$.message)!=null&&_.includes("timeout")||((j=$.response)==null?void 0:j.status)===504?(M="Generation timeout",z="AI persona generation timed out. This often happens when generating multiple complex personas. Try generating fewer personas (2-3) or try again later."):((k=$.response)==null?void 0:k.status)===500?(M="Server error",(I=(P=$.response)==null?void 0:P.data)!=null&&I.message?z=$.response.data.message:(R=(E=$.response)==null?void 0:E.data)!=null&&R.error?z=$.response.data.error:z="The server encountered an error processing your request. Please try again later."):((L=$.response)==null?void 0:L.status)===401?(M="Authentication required",z="Please log in to generate personas."):(V=$.message)!=null&&V.includes("504 Deadline Exceeded")?(M="Generation timeout",z="The AI model took too long to generate personas. Try generating fewer personas or simplify your brief."):$ instanceof Error&&(z=$.message),ie.error(M,{description:z,duration:6e3})}finally{setTimeout(()=>{l(!1),m(0)},500)}}const b=C=>{f(A=>A.includes(C)?A.filter(_=>_!==C):[...A,C])},x=(C,A)=>{const _=A.toLowerCase();return C.map(j=>{const k={...j};if(_.includes("younger")){const P=parseInt(k.age);k.age=(P-5).toString()}else if(_.includes("older")){const P=parseInt(k.age);k.age=(P+5).toString()}if(_.includes("different locations")&&(k.location=`${k.location} (Diversified)`),_.includes("more extroverted")?k.personality=`Extroverted, ${k.personality.toLowerCase()}`:_.includes("more introverted")&&(k.personality=`Introverted, ${k.personality.toLowerCase()}`),_.includes("diverse")){const P=["tech-savvy","traditional","innovative","conservative","creative"],I=P[Math.floor(Math.random()*P.length)];k.personality=`${I}, ${k.personality}`}return k})},w=C=>{if(!C.trim()){ie.error("Please provide refinement instructions");return}l(!0),setTimeout(()=>{try{const A=c.filter(k=>d.includes(k.id)),_=x(A,C),j=c.map(k=>_.find(I=>I.id===k.id)||k);u(j),l(!1),o(j),ie.success("Personas refined based on your instructions",{description:"Review the updated profiles"})}catch(A){console.error("Error refining personas:",A),ie.error("Failed to refine personas",{description:"Please try different instructions"}),l(!1)}},1500)},S=()=>{const C=c.filter(A=>d.includes(A.id));ie.success(`${C.length} personas approved`,{description:"Added to your synthetic persona library"}),o(C),r("/synthetic-users?mode=view")};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(Cr,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Persona Recruiter"})]}),s&&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(mc,{value:g,className:"h-2"})]}),h?a.jsx(Wse,{generatedPersonas:c,selectedPersonas:d,isGenerating:s,onPersonaSelection:b,onRefinePersonas:w,onApprovePersonas:S,onBackToGenerator:()=>p(!1)}):a.jsx(Bse,{onSubmit:v,isGenerating:s})]})}const $l=new Map;function jB(t){const{id:e,title:n,description:r,type:i="default",duration:o}=t;let s;switch(i){case"success":s=ie.success(n,{description:r,duration:o});break;case"error":s=ie.error(n,{description:r,duration:o});break;case"warning":s=ie.warning(n,{description:r,duration:o});break;case"info":s=ie.info(n,{description:r,duration:o});break;default:s=ie(n,{description:r,duration:o});break}return $l.set(e,s.toString()),e}function Qse(t,e){const n=$l.get(t);if(!n)return console.warn(`Toast with ID "${t}" not found. Creating new toast instead.`),jB({id:t,...e,title:e.title||"Updated"}),!1;const{title:r,description:i,type:o="default",duration:s}=e;ie.dismiss(n);let l;switch(o){case"success":l=ie.success(r,{description:i,duration:s});break;case"error":l=ie.error(r,{description:i,duration:s});break;case"warning":l=ie.warning(r,{description:i,duration:s});break;case"info":l=ie.info(r,{description:i,duration:s});break;default:l=ie(r,{description:i,duration:s});break}return $l.set(t,l.toString()),!0}function Xse(t){const e=$l.get(t);return e?(ie.dismiss(e),$l.delete(t),!0):(console.warn(`Toast with ID "${t}" not found.`),!1)}function Jse(t){return $l.has(t)}function Zse(){$l.forEach(t=>{ie.dismiss(t)}),$l.clear()}const Ye={success:ie.success,error:ie.error,warning:ie.warning,info:ie.info,loading:ie.loading,dismiss:ie.dismiss,createPersistent:jB,updatePersistent:Qse,dismissPersistent:Xse,hasPersistent:Jse,dismissAllPersistent:Zse};var EB=["PageUp","PageDown"],NB=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],TB={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},jf="Slider",[z1,eae,tae]=v0(jf),[PB,GDe]=ji(jf,[tae]),[nae,A0]=PB(jf),kB=y.forwardRef((t,e)=>{const{name:n,min:r=0,max:i=100,step:o=1,orientation:s="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:p=!1,form:g,...m}=t,v=y.useRef(new Set),b=y.useRef(0),w=s==="horizontal"?rae:iae,[S=[],C]=Ko({prop:d,defaultProp:u,onChange:I=>{var R;(R=[...v.current][b.current])==null||R.focus(),f(I)}}),A=y.useRef(S);function _(I){const E=cae(S,I);P(I,E)}function j(I){P(I,b.current)}function k(){const I=A.current[b.current];S[b.current]!==I&&h(S)}function P(I,E,{commit:R}={commit:!1}){const L=hae(o),V=pae(Math.round((I-r)/o)*o+r,L),$=Wp(V,[r,i]);C((z=[])=>{const M=aae(z,$,E);if(fae(M,c*o)){b.current=M.indexOf($);const U=String(M)!==String(z);return U&&R&&h(M),U?M:z}else return z})}return a.jsx(nae,{scope:t.__scopeSlider,name:n,disabled:l,min:r,max:i,valueIndexToChangeRef:b,thumbs:v.current,values:S,orientation:s,form:g,children:a.jsx(z1.Provider,{scope:t.__scopeSlider,children:a.jsx(z1.Slot,{scope:t.__scopeSlider,children:a.jsx(w,{"aria-disabled":l,"data-disabled":l?"":void 0,...m,ref:e,onPointerDown:Te(m.onPointerDown,()=>{l||(A.current=S)}),min:r,max:i,inverted:p,onSlideStart:l?void 0:_,onSlideMove:l?void 0:j,onSlideEnd:l?void 0:k,onHomeKeyDown:()=>!l&&P(r,0,{commit:!0}),onEndKeyDown:()=>!l&&P(i,S.length-1,{commit:!0}),onStepKeyDown:({event:I,direction:E})=>{if(!l){const V=EB.includes(I.key)||I.shiftKey&&NB.includes(I.key)?10:1,$=b.current,z=S[$],M=o*V*E;P(z+M,$,{commit:!0})}}})})})})});kB.displayName=jf;var[OB,IB]=PB(jf,{startEdge:"left",endEdge:"right",size:"width",direction:1}),rae=y.forwardRef((t,e)=>{const{min:n,max:r,dir:i,inverted:o,onSlideStart:s,onSlideMove:l,onSlideEnd:c,onStepKeyDown:u,...d}=t,[f,h]=y.useState(null),p=At(e,w=>h(w)),g=y.useRef(),m=uu(i),v=m==="ltr",b=v&&!o||!v&&o;function x(w){const S=g.current||f.getBoundingClientRect(),C=[0,S.width],_=TN(C,b?[n,r]:[r,n]);return g.current=S,_(w-S.left)}return a.jsx(OB,{scope:t.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:a.jsx(RB,{dir:m,"data-orientation":"horizontal",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const S=x(w.clientX);s==null||s(S)},onSlideMove:w=>{const S=x(w.clientX);l==null||l(S)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:w=>{const C=TB[b?"from-left":"from-right"].includes(w.key);u==null||u({event:w,direction:C?-1:1})}})})}),iae=y.forwardRef((t,e)=>{const{min:n,max:r,inverted:i,onSlideStart:o,onSlideMove:s,onSlideEnd:l,onStepKeyDown:c,...u}=t,d=y.useRef(null),f=At(e,d),h=y.useRef(),p=!i;function g(m){const v=h.current||d.current.getBoundingClientRect(),b=[0,v.height],w=TN(b,p?[r,n]:[n,r]);return h.current=v,w(m-v.top)}return a.jsx(OB,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:a.jsx(RB,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:m=>{const v=g(m.clientY);o==null||o(v)},onSlideMove:m=>{const v=g(m.clientY);s==null||s(v)},onSlideEnd:()=>{h.current=void 0,l==null||l()},onStepKeyDown:m=>{const b=TB[p?"from-bottom":"from-top"].includes(m.key);c==null||c({event:m,direction:b?-1:1})}})})}),RB=y.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:o,onHomeKeyDown:s,onEndKeyDown:l,onStepKeyDown:c,...u}=t,d=A0(jf,n);return a.jsx(et.span,{...u,ref:e,onKeyDown:Te(t.onKeyDown,f=>{f.key==="Home"?(s(f),f.preventDefault()):f.key==="End"?(l(f),f.preventDefault()):EB.concat(NB).includes(f.key)&&(c(f),f.preventDefault())}),onPointerDown:Te(t.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(f)}),onPointerMove:Te(t.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&i(f)}),onPointerUp:Te(t.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),o(f))})})}),MB="SliderTrack",DB=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=A0(MB,n);return a.jsx(et.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:e})});DB.displayName=MB;var V1="SliderRange",$B=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=A0(V1,n),o=IB(V1,n),s=y.useRef(null),l=At(e,s),c=i.values.length,u=i.values.map(h=>FB(h,i.min,i.max)),d=c>1?Math.min(...u):0,f=100-Math.max(...u);return a.jsx(et.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:l,style:{...t.style,[o.startEdge]:d+"%",[o.endEdge]:f+"%"}})});$B.displayName=V1;var G1="SliderThumb",LB=y.forwardRef((t,e)=>{const n=eae(t.__scopeSlider),[r,i]=y.useState(null),o=At(e,l=>i(l)),s=y.useMemo(()=>r?n().findIndex(l=>l.ref.current===r):-1,[n,r]);return a.jsx(oae,{...t,ref:o,index:s})}),oae=y.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:i,...o}=t,s=A0(G1,n),l=IB(G1,n),[c,u]=y.useState(null),d=At(e,x=>u(x)),f=c?s.form||!!c.closest("form"):!0,h=Vm(c),p=s.values[r],g=p===void 0?0:FB(p,s.min,s.max),m=lae(r,s.values.length),v=h==null?void 0:h[l.size],b=v?uae(v,g,l.direction):0;return y.useEffect(()=>{if(c)return s.thumbs.add(c),()=>{s.thumbs.delete(c)}},[c,s.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${g}% + ${b}px)`},children:[a.jsx(z1.ItemSlot,{scope:t.__scopeSlider,children:a.jsx(et.span,{role:"slider","aria-label":t["aria-label"]||m,"aria-valuemin":s.min,"aria-valuenow":p,"aria-valuemax":s.max,"aria-orientation":s.orientation,"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,tabIndex:s.disabled?void 0:0,...o,ref:d,style:p===void 0?{display:"none"}:t.style,onFocus:Te(t.onFocus,()=>{s.valueIndexToChangeRef.current=r})})}),f&&a.jsx(sae,{name:i??(s.name?s.name+(s.values.length>1?"[]":""):void 0),form:s.form,value:p},r)]})});LB.displayName=G1;var sae=t=>{const{value:e,...n}=t,r=y.useRef(null),i=Xm(e);return y.useEffect(()=>{const o=r.current,s=window.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(s,"value").set;if(i!==e&&c){const u=new Event("input",{bubbles:!0});c.call(o,e),o.dispatchEvent(u)}},[i,e]),a.jsx("input",{style:{display:"none"},...n,ref:r,defaultValue:e})};function aae(t=[],e,n){const r=[...t];return r[n]=e,r.sort((i,o)=>i-o)}function FB(t,e,n){const o=100/(n-e)*(t-e);return Wp(o,[0,100])}function lae(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function cae(t,e){if(t.length===1)return 0;const n=t.map(i=>Math.abs(i-e)),r=Math.min(...n);return n.indexOf(r)}function uae(t,e,n){const r=t/2,o=TN([0,50],[0,r]);return(r-o(e)*n)*n}function dae(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function fae(t,e){if(e>0){const n=dae(t);return Math.min(...n)>=e}return!0}function TN(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function hae(t){return(String(t).split(".")[1]||"").length}function pae(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var UB=kB,mae=DB,gae=$B,vae=LB;const lr=y.forwardRef(({className:t,...e},n)=>a.jsxs(UB,{ref:n,className:Pe("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(mae,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(gae,{className:"absolute h-full bg-primary"})}),a.jsx(vae,{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"})]}));lr.displayName=UB.displayName;var PN="Switch",[yae,KDe]=ji(PN),[xae,bae]=yae(PN),BB=y.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:o,required:s,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=t,[h,p]=y.useState(null),g=At(e,w=>p(w)),m=y.useRef(!1),v=h?d||!!h.closest("form"):!0,[b=!1,x]=Ko({prop:i,defaultProp:o,onChange:u});return a.jsxs(xae,{scope:n,checked:b,disabled:l,children:[a.jsx(et.button,{type:"button",role:"switch","aria-checked":b,"aria-required":s,"data-state":VB(b),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:g,onClick:Te(t.onClick,w=>{x(S=>!S),v&&(m.current=w.isPropagationStopped(),m.current||w.stopPropagation())})}),v&&a.jsx(wae,{control:h,bubbles:!m.current,name:r,value:c,checked:b,required:s,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});BB.displayName=PN;var HB="SwitchThumb",zB=y.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,i=bae(HB,n);return a.jsx(et.span,{"data-state":VB(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:e})});zB.displayName=HB;var wae=t=>{const{control:e,checked:n,bubbles:r=!0,...i}=t,o=y.useRef(null),s=Xm(n),l=Vm(e);return y.useEffect(()=>{const c=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});f.call(c,n),c.dispatchEvent(h)}},[s,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:o,style:{...t.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function VB(t){return t?"checked":"unchecked"}var GB=BB,Sae=zB;const qp=y.forwardRef(({className:t,...e},n)=>a.jsx(GB,{className:Pe("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",t),...e,ref:n,children:a.jsx(Sae,{className:Pe("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")})}));qp.displayName=GB.displayName;function Cae(t,e=[]){let n=[];function r(o,s){const l=y.createContext(s),c=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][c])||l,v=y.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:v,children:p})}function d(f,h){const p=(h==null?void 0:h[t][c])||l,g=y.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>y.createContext(s));return function(l){const c=(l==null?void 0:l[t])||o;return y.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return i.scopeName=t,[r,Aae(i,...e)]}function Aae(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(o)[`__scope${u}`];return{...l,...f}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var wS="rovingFocusGroup.onEntryFocus",_ae={bubbles:!1,cancelable:!0},_0="RovingFocusGroup",[K1,KB,jae]=v0(_0),[Eae,Ef]=Cae(_0,[jae]),[Nae,Tae]=Eae(_0),WB=y.forwardRef((t,e)=>a.jsx(K1.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(K1.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(Pae,{...t,ref:e})})}));WB.displayName=_0;var Pae=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=t,h=y.useRef(null),p=At(e,h),g=uu(o),[m=null,v]=Ko({prop:s,defaultProp:l,onChange:c}),[b,x]=y.useState(!1),w=dr(u),S=KB(n),C=y.useRef(!1),[A,_]=y.useState(0);return y.useEffect(()=>{const j=h.current;if(j)return j.addEventListener(wS,w),()=>j.removeEventListener(wS,w)},[w]),a.jsx(Nae,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:m,onItemFocus:y.useCallback(j=>v(j),[v]),onItemShiftTab:y.useCallback(()=>x(!0),[]),onFocusableItemAdd:y.useCallback(()=>_(j=>j+1),[]),onFocusableItemRemove:y.useCallback(()=>_(j=>j-1),[]),children:a.jsx(et.div,{tabIndex:b||A===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...t.style},onMouseDown:Te(t.onMouseDown,()=>{C.current=!0}),onFocus:Te(t.onFocus,j=>{const k=!C.current;if(j.target===j.currentTarget&&k&&!b){const P=new CustomEvent(wS,_ae);if(j.currentTarget.dispatchEvent(P),!P.defaultPrevented){const I=S().filter($=>$.focusable),E=I.find($=>$.active),R=I.find($=>$.id===m),V=[E,R,...I].filter(Boolean).map($=>$.ref.current);QB(V,d)}}C.current=!1}),onBlur:Te(t.onBlur,()=>x(!1))})})}),qB="RovingFocusGroupItem",YB=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=t,l=Do(),c=o||l,u=Tae(qB,n),d=u.currentTabStopId===c,f=KB(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=u;return y.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),a.jsx(K1.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:a.jsx(et.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:e,onMouseDown:Te(t.onMouseDown,g=>{r?u.onItemFocus(c):g.preventDefault()}),onFocus:Te(t.onFocus,()=>u.onItemFocus(c)),onKeyDown:Te(t.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const m=Iae(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(x=>x.focusable).map(x=>x.ref.current);if(m==="last")b.reverse();else if(m==="prev"||m==="next"){m==="prev"&&b.reverse();const x=b.indexOf(g.currentTarget);b=u.loop?Rae(b,x+1):b.slice(x+1)}setTimeout(()=>QB(b))}})})})});YB.displayName=qB;var kae={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Oae(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Iae(t,e,n){const r=Oae(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return kae[r]}function QB(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function Rae(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var kN=WB,ON=YB,IN="Tabs",[Mae,WDe]=ji(IN,[Ef]),XB=Ef(),[Dae,RN]=Mae(IN),JB=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:l,activationMode:c="automatic",...u}=t,d=uu(l),[f,h]=Ko({prop:r,onChange:i,defaultProp:o});return a.jsx(Dae,{scope:n,baseId:Do(),value:f,onValueChange:h,orientation:s,dir:d,activationMode:c,children:a.jsx(et.div,{dir:d,"data-orientation":s,...u,ref:e})})});JB.displayName=IN;var ZB="TabsList",e6=y.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...i}=t,o=RN(ZB,n),s=XB(n);return a.jsx(kN,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:a.jsx(et.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:e})})});e6.displayName=ZB;var t6="TabsTrigger",n6=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=t,s=RN(t6,n),l=XB(n),c=o6(s.baseId,r),u=s6(s.baseId,r),d=r===s.value;return a.jsx(ON,{asChild:!0,...l,focusable:!i,active:d,children:a.jsx(et.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,...o,ref:e,onMouseDown:Te(t.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Te(t.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Te(t.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!i&&f&&s.onValueChange(r)})})})});n6.displayName=t6;var r6="TabsContent",i6=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=t,l=RN(r6,n),c=o6(l.baseId,r),u=s6(l.baseId,r),d=r===l.value,f=y.useRef(d);return y.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),a.jsx(Mr,{present:i||d,children:({present:h})=>a.jsx(et.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...s,ref:e,style:{...t.style,animationDuration:f.current?"0s":void 0},children:h&&o})})});i6.displayName=r6;function o6(t,e){return`${t}-trigger-${e}`}function s6(t,e){return`${t}-content-${e}`}var $ae=JB,a6=e6,l6=n6,c6=i6;const Kl=$ae,Ea=y.forwardRef(({className:t,...e},n)=>a.jsx(a6,{ref:n,className:Pe("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));Ea.displayName=a6.displayName;const on=y.forwardRef(({className:t,...e},n)=>a.jsx(l6,{ref:n,className:Pe("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",t),...e}));on.displayName=l6.displayName;const sn=y.forwardRef(({className:t,...e},n)=>a.jsx(c6,{ref:n,className:Pe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));sn.displayName=c6.displayName;const Lae=Oe.object({name:Oe.string().min(2,{message:"Name must be at least 2 characters."}),age:Oe.string().min(1,{message:"Age is required."}),gender:Oe.string().min(1,{message:"Gender is required."}),occupation:Oe.string().min(2,{message:"Occupation is required."}),education:Oe.string().min(1,{message:"Education is required."}),location:Oe.string().min(2,{message:"Location is required."}),ethnicity:Oe.string().optional(),personality:Oe.string(),interests:Oe.string(),hasPurchasingPower:Oe.boolean().optional(),hasChildren:Oe.boolean().optional(),techSavviness:Oe.number().min(0).max(100),brandLoyalty:Oe.number().min(0).max(100),priceConsciousness:Oe.number().min(0).max(100),environmentalConcern:Oe.number().min(0).max(100),socialGrade:Oe.string().optional(),householdIncome:Oe.string().optional(),householdComposition:Oe.string().optional(),livingSituation:Oe.string().optional(),goals:Oe.array(Oe.string()).optional(),frustrations:Oe.array(Oe.string()).optional(),motivations:Oe.array(Oe.string()).optional(),scenarios:Oe.array(Oe.string()).optional(),scenarioType:Oe.string().optional(),oceanTraits:Oe.object({openness:Oe.number().min(0).max(100),conscientiousness:Oe.number().min(0).max(100),extraversion:Oe.number().min(0).max(100),agreeableness:Oe.number().min(0).max(100),neuroticism:Oe.number().min(0).max(100)}).optional(),thinkFeelDo:Oe.object({thinks:Oe.array(Oe.string()),feels:Oe.array(Oe.string()),does:Oe.array(Oe.string())}).optional(),mediaConsumption:Oe.string().optional(),deviceUsage:Oe.string().optional(),shoppingHabits:Oe.string().optional(),brandPreferences:Oe.string().optional(),communicationPreferences:Oe.string().optional(),paymentMethods:Oe.string().optional(),purchaseBehaviour:Oe.string().optional(),coreValues:Oe.string().optional(),lifestyleChoices:Oe.string().optional(),socialActivities:Oe.string().optional(),categoryKnowledge:Oe.string().optional(),decisionInfluences:Oe.string().optional(),painPoints:Oe.string().optional(),journeyContext:Oe.string().optional(),keyTouchpoints:Oe.string().optional(),selfDeterminationNeeds:Oe.object({autonomy:Oe.string(),competence:Oe.string(),relatedness:Oe.string()}).optional(),fears:Oe.array(Oe.string()).optional(),narrative:Oe.string().optional(),additionalInformation:Oe.string().optional()});function Fae({targetFolderId:t,targetFolderName:e}){const[n,r]=y.useState(1),[i,o]=y.useState(!1),[s,l]=y.useState(!1),[c,u]=y.useState(0),d=Xn(),{isAuthenticated:f,login:h}=cu();y.useEffect(()=>{u(0)},[]),y.useEffect(()=>{(async()=>{if(!f&&!s){l(!0);try{console.log("Attempting auto login with default credentials"),await h("user","pass"),console.log("Auto login successful");const _=localStorage.getItem("auth_token");_?(console.log("Token successfully stored:",_.substring(0,10)+"..."),Ye.success("Logged in automatically with default account")):(console.error("Token not stored after successful login"),Ye.error("Authentication problem, token not stored"))}catch(_){console.error("Auto login failed:",_)}finally{l(!1)}}})()},[]);const p=f0({resolver:h0(Lae),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=A=>{const _=p.getValues(A)||[];p.setValue(A,[..._,""])},m=(A,_,j)=>{const P=[...p.getValues(A)||[]];P[_]=j,p.setValue(A,P)},v=(A,_)=>{const k=[...p.getValues(A)||[]];k.splice(_,1),p.setValue(A,k)},b=A=>{const _=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},j={..._,[A]:[..._[A]||[],""]};p.setValue("thinkFeelDo",j)},x=(A,_,j)=>{const k=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},P=[...k[A]||[]];P[_]=j;const I={...k,[A]:P};p.setValue("thinkFeelDo",I)},w=(A,_)=>{const j=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},k=[...j[A]||[]];k.splice(_,1);const P={...j,[A]:k};p.setValue("thinkFeelDo",P)},S=(A,_)=>{const k={...p.getValues("oceanTraits")||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},[A]:_};p.setValue("oceanTraits",k)};async function C(A,_=!1){var j,k,P,I,E;if(_&&c>=1){console.log("Max retry attempts reached, stopping retry loop"),Ye.error("Authentication failed after multiple attempts",{description:"Please try logging in manually (user/pass)"}),d("/login",{state:{from:"/synthetic-users"}}),o(!1);return}_?(u(R=>R+1),console.log(`Retry attempt ${c+1}`)):u(0),o(!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(U){console.error("Login failed before persona creation:",U),Ye.error("Authentication required",{description:"Please log in before creating personas. Default: user/pass"}),d("/login",{state:{from:"/synthetic-users"}}),o(!1);return}const R=`persona-generation-${Date.now()}`,L=t&&e?` in "${e}" folder`:"",V=n>1?`${n} personas`:"persona";console.log(`UserCreator - Creating ${V}${L}`),Ye.createPersistent({id:R,title:`Generating ${V}...`,description:`Creating synthetic user profile${n>1?"s":""}${L}`,type:"info"});const $={...A,oceanTraits:A.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:A.thinkFeelDo||{thinks:[],feels:[],does:[]},folderId:t||void 0},z={id:`temp-${Date.now()}`,...$},M=JSON.parse(localStorage.getItem("tempPersonas")||"[]");if(M.push(z),localStorage.setItem("tempPersonas",JSON.stringify(M)),n===1)try{if(!localStorage.getItem("auth_token")){console.error("No authentication token found"),Ye.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:",((j=localStorage.getItem("auth_token"))==null?void 0:j.substring(0,10))+"...")}catch(X){throw console.error("Login retry failed:",X),new Error("Authentication failed after retry")}}console.log("Sending persona creation request to API with auth token");const W=await kr.create($);console.log("Persona created successfully:",W),Ye.updatePersistent(R,{title:"Synthetic user created successfully",description:`Created profile for ${A.name}`,type:"success"})}catch(U){throw console.error("Error creating persona via API:",U),U.response&&U.response.status===401&&Ye.error("Authentication error",{description:"Failed to authenticate with server. Please try again."}),U}else{const U=[];U.push($);for(let W=1;W{d("/synthetic-users?mode=view")},300)}catch(R){if(console.error("Error creating personas:",R),R.response&&R.response.status===401||R.message&&R.message.includes("Authentication failed")&&c<1)try{console.log("Got auth error, attempting login retry with default credentials"),localStorage.removeItem("auth_token");const L=await Nv.login("user","pass");if((P=L==null?void 0:L.data)!=null&&P.access_token){localStorage.setItem("auth_token",L.data.access_token),localStorage.setItem("user",JSON.stringify(L.data.user)),console.log("Manual login successful, got new token:",L.data.access_token.substring(0,10)+"..."),Ye.info("Logged in with default account, retrying submission..."),setTimeout(()=>{C(A,!0)},500);return}else throw new Error("No access token received")}catch(L){console.error("Login retry failed:",L),Ye.error("Authentication error",{description:"Cannot authenticate with server. Please contact support."})}else Ye.updatePersistent(generationToastId,{title:"Failed to create synthetic users",description:((E=(I=R.response)==null?void 0:I.data)==null?void 0:E.message)||R.message||"An unexpected error occurred",type:"error"})}finally{o(!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(te,{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(Cr,{size:16,className:"text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:n})]}),a.jsx(te,{variant:"outline",size:"sm",onClick:()=>r(n+1),children:"+"})]})]}),a.jsx(m0,{...p,children:a.jsxs("form",{onSubmit:p.handleSubmit(C),className:"space-y-6",children:[a.jsxs(Kl,{defaultValue:"basic",children:[a.jsxs(Ea,{className:"grid w-full grid-cols-6",children:[a.jsx(on,{value:"basic",children:"Basic"}),a.jsx(on,{value:"cooper",children:"Cooper"}),a.jsx(on,{value:"personality",children:"Personality"}),a.jsx(on,{value:"demographics",children:"Demographics"}),a.jsx(on,{value:"lifestyle",children:"Lifestyle"}),a.jsx(on,{value:"extended",children:"Extended"})]}),a.jsx(sn,{value:"basic",className:"mt-6",children:a.jsx(ct,{children:a.jsx(jt,{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(dt,{control:p.control,name:"name",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Name"}),a.jsx(st,{children:a.jsx(Dt,{placeholder:"Jane Smith",...A})}),a.jsx(at,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(dt,{control:p.control,name:"age",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Age Range"}),a.jsxs(kn,{onValueChange:A.onChange,defaultValue:A.value,children:[a.jsx(st,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select age range"})})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"18-24",children:"18-24"}),a.jsx(ce,{value:"25-34",children:"25-34"}),a.jsx(ce,{value:"35-44",children:"35-44"}),a.jsx(ce,{value:"45-54",children:"45-54"}),a.jsx(ce,{value:"55-64",children:"55-64"}),a.jsx(ce,{value:"65+",children:"65+"})]})]}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"gender",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Gender"}),a.jsxs(kn,{onValueChange:A.onChange,defaultValue:A.value,children:[a.jsx(st,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select gender"})})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"Male",children:"Male"}),a.jsx(ce,{value:"Female",children:"Female"}),a.jsx(ce,{value:"Non-binary",children:"Non-binary"}),a.jsx(ce,{value:"Other",children:"Other"})]})]}),a.jsx(at,{})]})})]}),a.jsx(dt,{control:p.control,name:"occupation",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Occupation"}),a.jsx(st,{children:a.jsx(Dt,{placeholder:"Software Engineer",...A})}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"education",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Education"}),a.jsxs(kn,{onValueChange:A.onChange,defaultValue:A.value,children:[a.jsx(st,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select education level"})})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"High School",children:"High School"}),a.jsx(ce,{value:"Some College",children:"Some College"}),a.jsx(ce,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(ce,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(ce,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(ce,{value:"PhD",children:"PhD"})]})]}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"location",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Location"}),a.jsx(st,{children:a.jsx(Dt,{placeholder:"New York, USA",...A})}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"ethnicity",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Ethnicity (Optional)"}),a.jsxs(kn,{onValueChange:A.onChange,defaultValue:A.value,children:[a.jsx(st,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select ethnicity"})})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"white",children:"White"}),a.jsx(ce,{value:"black",children:"Black"}),a.jsx(ce,{value:"asian",children:"Asian"}),a.jsx(ce,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(ce,{value:"native-american",children:"Native American"}),a.jsx(ce,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(ce,{value:"mixed",children:"Mixed"}),a.jsx(ce,{value:"other",children:"Other"}),a.jsx(ce,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]}),a.jsx(at,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(dt,{control:p.control,name:"personality",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Personality Traits"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Curious, analytical, detail-oriented",...A,rows:3})}),a.jsx(xn,{children:"Describe key personality traits that define this user"}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"interests",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Interests"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Technology, fitness, cooking, travel",...A,rows:3})}),a.jsx(xn,{children:"List interests, hobbies and activities this user enjoys"}),a.jsx(at,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"font-medium text-sm",children:"Behavioral Attributes"}),a.jsx(dt,{control:p.control,name:"techSavviness",render:({field:A})=>a.jsxs(it,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(ot,{children:"Tech Savviness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[A.value,"%"]})]}),a.jsx(st,{children:a.jsx(lr,{min:0,max:100,step:1,value:[A.value],onValueChange:_=>A.onChange(_[0])})}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"brandLoyalty",render:({field:A})=>a.jsxs(it,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(ot,{children:"Brand Loyalty"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[A.value,"%"]})]}),a.jsx(st,{children:a.jsx(lr,{min:0,max:100,step:1,value:[A.value],onValueChange:_=>A.onChange(_[0])})}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"priceConsciousness",render:({field:A})=>a.jsxs(it,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(ot,{children:"Price Consciousness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[A.value,"%"]})]}),a.jsx(st,{children:a.jsx(lr,{min:0,max:100,step:1,value:[A.value],onValueChange:_=>A.onChange(_[0])})}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"environmentalConcern",render:({field:A})=>a.jsxs(it,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(ot,{children:"Environmental Concern"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[A.value,"%"]})]}),a.jsx(st,{children:a.jsx(lr,{min:0,max:100,step:1,value:[A.value],onValueChange:_=>A.onChange(_[0])})}),a.jsx(at,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[a.jsx(dt,{control:p.control,name:"hasPurchasingPower",render:({field:A})=>a.jsxs(it,{className:"flex items-center justify-between",children:[a.jsx(ot,{children:"Purchasing Power"}),a.jsx(st,{children:a.jsx(qp,{checked:A.value,onCheckedChange:A.onChange})}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"hasChildren",render:({field:A})=>a.jsxs(it,{className:"flex items-center justify-between",children:[a.jsx(ot,{children:"Has Children"}),a.jsx(st,{children:a.jsx(qp,{checked:A.value,onCheckedChange:A.onChange})}),a.jsx(at,{})]})})]})]})]})]})})})}),a.jsxs(sn,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(ct,{children:a.jsxs(jt,{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((A,_)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:A,onChange:j=>m("goals",_,j.target.value),placeholder:"Enter a goal"}),a.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>v("goals",_),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},_)),a.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>g("goals"),className:"mt-2",children:[a.jsx(Tr,{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((A,_)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:A,onChange:j=>m("frustrations",_,j.target.value),placeholder:"Enter a frustration"}),a.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>v("frustrations",_),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},_)),a.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>g("frustrations"),className:"mt-2",children:[a.jsx(Tr,{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((A,_)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:A,onChange:j=>m("motivations",_,j.target.value),placeholder:"Enter a motivation"}),a.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>v("motivations",_),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},_)),a.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>g("motivations"),className:"mt-2",children:[a.jsx(Tr,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(ct,{children:a.jsxs(jt,{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((A,_)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:A,onChange:j=>x("thinks",_,j.target.value),placeholder:"What they think"}),a.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("thinks",_),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},_)),a.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>b("thinks"),className:"mt-2",children:[a.jsx(Tr,{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((A,_)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:A,onChange:j=>x("feels",_,j.target.value),placeholder:"What they feel"}),a.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("feels",_),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},_)),a.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>b("feels"),className:"mt-2",children:[a.jsx(Tr,{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((A,_)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:A,onChange:j=>x("does",_,j.target.value),placeholder:"What they do"}),a.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("does",_),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},_)),a.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>b("does"),className:"mt-2",children:[a.jsx(Tr,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(ct,{children:a.jsx(jt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(dt,{control:p.control,name:"scenarioType",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Scenario Section Title"}),a.jsx(st,{children:a.jsx(Dt,{placeholder:"Life Scenarios",...A})}),a.jsx(xn,{children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'}),a.jsx(at,{})]})}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Usage Scenarios"}),(p.watch("scenarios")||[]).map((A,_)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(lt,{value:A,onChange:j=>m("scenarios",_,j.target.value),rows:2,placeholder:"Describe a usage scenario"}),a.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>v("scenarios",_),className:"mt-2",children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},_)),a.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>g("scenarios"),className:"mt-2",children:[a.jsx(Tr,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})]})})})]}),a.jsx(sn,{value:"personality",className:"mt-6",children:a.jsx(ct,{children:a.jsxs(jt,{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(lr,{value:[(p.watch("oceanTraits")||{openness:50}).openness||50],onValueChange:A=>S("openness",A[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(lr,{value:[(p.watch("oceanTraits")||{conscientiousness:50}).conscientiousness||50],onValueChange:A=>S("conscientiousness",A[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(lr,{value:[(p.watch("oceanTraits")||{extraversion:50}).extraversion||50],onValueChange:A=>S("extraversion",A[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(lr,{value:[(p.watch("oceanTraits")||{agreeableness:50}).agreeableness||50],onValueChange:A=>S("agreeableness",A[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(lr,{value:[(p.watch("oceanTraits")||{neuroticism:50}).neuroticism||50],onValueChange:A=>S("neuroticism",A[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(sn,{value:"demographics",className:"mt-6",children:a.jsx(ct,{children:a.jsxs(jt,{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(dt,{control:p.control,name:"socialGrade",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Social Grade"}),a.jsxs(kn,{onValueChange:A.onChange,defaultValue:A.value,children:[a.jsx(st,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select social grade"})})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"A",children:"A - Higher managerial"}),a.jsx(ce,{value:"B",children:"B - Intermediate managerial"}),a.jsx(ce,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(ce,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(ce,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(ce,{value:"E",children:"E - State pensioners, unemployed"})]})]}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"householdIncome",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Household Income"}),a.jsxs(kn,{onValueChange:A.onChange,defaultValue:A.value,children:[a.jsx(st,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select income range"})})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"Under $25k",children:"Under $25,000"}),a.jsx(ce,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(ce,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(ce,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(ce,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(ce,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(ce,{value:"Over $250k",children:"Over $250,000"}),a.jsx(ce,{value:"Prefer not to say",children:"Prefer not to say"})]})]}),a.jsx(at,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(dt,{control:p.control,name:"householdComposition",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Household Composition"}),a.jsxs(kn,{onValueChange:A.onChange,defaultValue:A.value,children:[a.jsx(st,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select household type"})})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"Single person",children:"Single person"}),a.jsx(ce,{value:"Couple without children",children:"Couple without children"}),a.jsx(ce,{value:"Couple with children",children:"Couple with children"}),a.jsx(ce,{value:"Single parent",children:"Single parent"}),a.jsx(ce,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(ce,{value:"Shared housing",children:"Shared housing"}),a.jsx(ce,{value:"Other",children:"Other"})]})]}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"livingSituation",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Living Situation"}),a.jsxs(kn,{onValueChange:A.onChange,defaultValue:A.value,children:[a.jsx(st,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select living situation"})})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"Own home",children:"Own home"}),a.jsx(ce,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(ce,{value:"Rent house",children:"Rent house"}),a.jsx(ce,{value:"Live with family",children:"Live with family"}),a.jsx(ce,{value:"Student housing",children:"Student housing"}),a.jsx(ce,{value:"Assisted living",children:"Assisted living"}),a.jsx(ce,{value:"Other",children:"Other"})]})]}),a.jsx(at,{})]})})]})]})]})})}),a.jsx(sn,{value:"lifestyle",className:"mt-6",children:a.jsx(ct,{children:a.jsxs(jt,{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(dt,{control:p.control,name:"mediaConsumption",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Media Consumption"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"TV shows, podcasts, news sources, social media platforms",...A,rows:3})}),a.jsx(xn,{children:"Describe media consumption habits and preferences"}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"deviceUsage",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Device Usage"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Smartphone, laptop, tablet, smart TV, gaming console",...A,rows:3})}),a.jsx(xn,{children:"Primary devices and usage patterns"}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"shoppingHabits",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Shopping Habits"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Online vs in-store, frequency, preferred retailers",...A,rows:3})}),a.jsx(xn,{children:"Shopping behavior and preferences"}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"brandPreferences",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Brand Preferences"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Favorite brands, brand values alignment",...A,rows:3})}),a.jsx(xn,{children:"Preferred brands and reasoning"}),a.jsx(at,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(dt,{control:p.control,name:"communicationPreferences",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Communication Preferences"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Email, phone, text, video calls, in-person",...A,rows:3})}),a.jsx(xn,{children:"Preferred communication methods and channels"}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"paymentMethods",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Payment Methods"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Credit cards, digital wallets, cash, BNPL",...A,rows:3})}),a.jsx(xn,{children:"Preferred payment methods and financial tools"}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"purchaseBehaviour",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Purchase Behavior"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Research habits, decision factors, impulse vs planned buying",...A,rows:3})}),a.jsx(xn,{children:"How they approach making purchase decisions"}),a.jsx(at,{})]})})]})]})]})})}),a.jsxs(sn,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(ct,{children:a.jsxs(jt,{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(dt,{control:p.control,name:"coreValues",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Core Values"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Key principles and values that guide decisions",...A,rows:3})}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"lifestyleChoices",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Lifestyle Choices"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Health, fitness, diet, work-life balance preferences",...A,rows:3})}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"socialActivities",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Social Activities"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Social hobbies, community involvement, networking",...A,rows:3})}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"categoryKnowledge",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Category Knowledge"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Expertise in specific product/service categories",...A,rows:3})}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"decisionInfluences",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Decision Influences"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"What factors most influence their decisions",...A,rows:3})}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"painPoints",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Pain Points"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Common challenges and friction points",...A,rows:3})}),a.jsx(at,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(dt,{control:p.control,name:"journeyContext",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Journey Context"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Current life stage and contextual factors",...A,rows:3})}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"keyTouchpoints",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Key Touchpoints"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Important interaction points and channels",...A,rows:3})}),a.jsx(at,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),a.jsx(dt,{control:p.control,name:"selfDeterminationNeeds.autonomy",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Autonomy"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Need for independence and self-direction",...A,rows:2})}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"selfDeterminationNeeds.competence",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Competence"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Need to feel capable and effective",...A,rows:2})}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"selfDeterminationNeeds.relatedness",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Relatedness"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Need for connection and belonging",...A,rows:2})}),a.jsx(at,{})]})})]})]})]})]})}),a.jsx(ct,{children:a.jsx(jt,{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((A,_)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:A,onChange:j=>m("fears",_,j.target.value),placeholder:"Enter a fear or concern"}),a.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>v("fears",_),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},_)),a.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>g("fears"),className:"mt-2",children:[a.jsx(Tr,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),a.jsx(dt,{control:p.control,name:"narrative",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Personal Narrative"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Personal story, background, key life experiences",...A,rows:4})}),a.jsx(xn,{children:"A brief narrative that captures their personal story"}),a.jsx(at,{})]})}),a.jsx(dt,{control:p.control,name:"additionalInformation",render:({field:A})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Additional Information"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Any other relevant details or context",...A,rows:4})}),a.jsx(xn,{children:"Additional context or details not covered elsewhere"}),a.jsx(at,{})]})})]})})})]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(te,{variant:"outline",type:"button",onClick:()=>p.reset(),children:"Reset"}),a.jsxs(te,{type:"submit",disabled:i,children:[i?a.jsx($X,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(qj,{className:"mr-2 h-4 w-4"}),i?"Creating...":`Create ${n>1?`${n} Users`:"User"}`]})]})]})})]})}var W1=["Enter"," "],Uae=["ArrowDown","PageUp","Home"],u6=["ArrowUp","PageDown","End"],Bae=[...Uae,...u6],Hae={ltr:[...W1,"ArrowRight"],rtl:[...W1,"ArrowLeft"]},zae={ltr:["ArrowLeft"],rtl:["ArrowRight"]},rg="Menu",[Yp,Vae,Gae]=v0(rg),[du,d6]=ji(rg,[Gae,mf,Ef]),j0=mf(),f6=Ef(),[Kae,fu]=du(rg),[Wae,ig]=du(rg),h6=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:o,modal:s=!0}=t,l=j0(e),[c,u]=y.useState(null),d=y.useRef(!1),f=dr(o),h=uu(i);return y.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(TF,{...l,children:a.jsx(Kae,{scope:e,open:n,onOpenChange:f,content:c,onContentChange:u,children:a.jsx(Wae,{scope:e,onClose:y.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:s,children:r})})})};h6.displayName=rg;var qae="MenuAnchor",MN=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=j0(n);return a.jsx(Oj,{...i,...r,ref:e})});MN.displayName=qae;var DN="MenuPortal",[Yae,p6]=du(DN,{forceMount:void 0}),m6=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,o=fu(DN,e);return a.jsx(Yae,{scope:e,forceMount:n,children:a.jsx(Mr,{present:n||o.open,children:a.jsx(Rb,{asChild:!0,container:i,children:r})})})};m6.displayName=DN;var uo="MenuContent",[Qae,$N]=du(uo),g6=y.forwardRef((t,e)=>{const n=p6(uo,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,o=fu(uo,t.__scopeMenu),s=ig(uo,t.__scopeMenu);return a.jsx(Yp.Provider,{scope:t.__scopeMenu,children:a.jsx(Mr,{present:r||o.open,children:a.jsx(Yp.Slot,{scope:t.__scopeMenu,children:s.modal?a.jsx(Xae,{...i,ref:e}):a.jsx(Jae,{...i,ref:e})})})})}),Xae=y.forwardRef((t,e)=>{const n=fu(uo,t.__scopeMenu),r=y.useRef(null),i=At(e,r);return y.useEffect(()=>{const o=r.current;if(o)return bN(o)},[]),a.jsx(LN,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Te(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Jae=y.forwardRef((t,e)=>{const n=fu(uo,t.__scopeMenu);return a.jsx(LN,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),LN=y.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:g,...m}=t,v=fu(uo,n),b=ig(uo,n),x=j0(n),w=f6(n),S=Vae(n),[C,A]=y.useState(null),_=y.useRef(null),j=At(e,_,v.onContentChange),k=y.useRef(0),P=y.useRef(""),I=y.useRef(0),E=y.useRef(null),R=y.useRef("right"),L=y.useRef(0),V=g?b0:y.Fragment,$=g?{as:Es,allowPinchZoom:!0}:void 0,z=U=>{var de,Re;const W=P.current+U,X=S().filter(pe=>!pe.disabled),re=document.activeElement,xe=(de=X.find(pe=>pe.ref.current===re))==null?void 0:de.textValue,F=X.map(pe=>pe.textValue),fe=ule(F,W,xe),oe=(Re=X.find(pe=>pe.textValue===fe))==null?void 0:Re.ref.current;(function pe(Se){P.current=Se,window.clearTimeout(k.current),Se!==""&&(k.current=window.setTimeout(()=>pe(""),1e3))})(W),oe&&setTimeout(()=>oe.focus())};y.useEffect(()=>()=>window.clearTimeout(k.current),[]),xN();const M=y.useCallback(U=>{var X,re;return R.current===((X=E.current)==null?void 0:X.side)&&fle(U,(re=E.current)==null?void 0:re.area)},[]);return a.jsx(Qae,{scope:n,searchRef:P,onItemEnter:y.useCallback(U=>{M(U)&&U.preventDefault()},[M]),onItemLeave:y.useCallback(U=>{var W;M(U)||((W=_.current)==null||W.focus(),A(null))},[M]),onTriggerLeave:y.useCallback(U=>{M(U)&&U.preventDefault()},[M]),pointerGraceTimerRef:I,onPointerGraceIntentChange:y.useCallback(U=>{E.current=U},[]),children:a.jsx(V,{...$,children:a.jsx(y0,{asChild:!0,trapped:i,onMountAutoFocus:Te(o,U=>{var W;U.preventDefault(),(W=_.current)==null||W.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:a.jsx(Hm,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:a.jsx(kN,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:A,onEntryFocus:Te(c,U=>{b.isUsingKeyboardRef.current||U.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(Ij,{role:"menu","aria-orientation":"vertical","data-state":O6(v.open),"data-radix-menu-content":"",dir:b.dir,...x,...m,ref:j,style:{outline:"none",...m.style},onKeyDown:Te(m.onKeyDown,U=>{const X=U.target.closest("[data-radix-menu-content]")===U.currentTarget,re=U.ctrlKey||U.altKey||U.metaKey,xe=U.key.length===1;X&&(U.key==="Tab"&&U.preventDefault(),!re&&xe&&z(U.key));const F=_.current;if(U.target!==F||!Bae.includes(U.key))return;U.preventDefault();const oe=S().filter(de=>!de.disabled).map(de=>de.ref.current);u6.includes(U.key)&&oe.reverse(),lle(oe)}),onBlur:Te(t.onBlur,U=>{U.currentTarget.contains(U.target)||(window.clearTimeout(k.current),P.current="")}),onPointerMove:Te(t.onPointerMove,Qp(U=>{const W=U.target,X=L.current!==U.clientX;if(U.currentTarget.contains(W)&&X){const re=U.clientX>L.current?"right":"left";R.current=re,L.current=U.clientX}}))})})})})})})});g6.displayName=uo;var Zae="MenuGroup",FN=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(et.div,{role:"group",...r,ref:e})});FN.displayName=Zae;var ele="MenuLabel",v6=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(et.div,{...r,ref:e})});v6.displayName=ele;var Zy="MenuItem",OI="menu.itemSelect",E0=y.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,o=y.useRef(null),s=ig(Zy,t.__scopeMenu),l=$N(Zy,t.__scopeMenu),c=At(e,o),u=y.useRef(!1),d=()=>{const f=o.current;if(!n&&f){const h=new CustomEvent(OI,{bubbles:!0,cancelable:!0});f.addEventListener(OI,p=>r==null?void 0:r(p),{once:!0}),lF(f,h),h.defaultPrevented?u.current=!1:s.onClose()}};return a.jsx(y6,{...i,ref:c,disabled:n,onClick:Te(t.onClick,d),onPointerDown:f=>{var h;(h=t.onPointerDown)==null||h.call(t,f),u.current=!0},onPointerUp:Te(t.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:Te(t.onKeyDown,f=>{const h=l.searchRef.current!=="";n||h&&f.key===" "||W1.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});E0.displayName=Zy;var y6=y.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=t,s=$N(Zy,n),l=f6(n),c=y.useRef(null),u=At(e,c),[d,f]=y.useState(!1),[h,p]=y.useState("");return y.useEffect(()=>{const g=c.current;g&&p((g.textContent??"").trim())},[o.children]),a.jsx(Yp.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:a.jsx(ON,{asChild:!0,...l,focusable:!r,children:a.jsx(et.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:u,onPointerMove:Te(t.onPointerMove,Qp(g=>{r?s.onItemLeave(g):(s.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Te(t.onPointerLeave,Qp(g=>s.onItemLeave(g))),onFocus:Te(t.onFocus,()=>f(!0)),onBlur:Te(t.onBlur,()=>f(!1))})})})}),tle="MenuCheckboxItem",x6=y.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return a.jsx(A6,{scope:t.__scopeMenu,checked:n,children:a.jsx(E0,{role:"menuitemcheckbox","aria-checked":ex(n)?"mixed":n,...i,ref:e,"data-state":BN(n),onSelect:Te(i.onSelect,()=>r==null?void 0:r(ex(n)?!0:!n),{checkForDefaultPrevented:!1})})})});x6.displayName=tle;var b6="MenuRadioGroup",[nle,rle]=du(b6,{value:void 0,onValueChange:()=>{}}),w6=y.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,o=dr(r);return a.jsx(nle,{scope:t.__scopeMenu,value:n,onValueChange:o,children:a.jsx(FN,{...i,ref:e})})});w6.displayName=b6;var S6="MenuRadioItem",C6=y.forwardRef((t,e)=>{const{value:n,...r}=t,i=rle(S6,t.__scopeMenu),o=n===i.value;return a.jsx(A6,{scope:t.__scopeMenu,checked:o,children:a.jsx(E0,{role:"menuitemradio","aria-checked":o,...r,ref:e,"data-state":BN(o),onSelect:Te(r.onSelect,()=>{var s;return(s=i.onValueChange)==null?void 0:s.call(i,n)},{checkForDefaultPrevented:!1})})})});C6.displayName=S6;var UN="MenuItemIndicator",[A6,ile]=du(UN,{checked:!1}),_6=y.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,o=ile(UN,n);return a.jsx(Mr,{present:r||ex(o.checked)||o.checked===!0,children:a.jsx(et.span,{...i,ref:e,"data-state":BN(o.checked)})})});_6.displayName=UN;var ole="MenuSeparator",j6=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(et.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});j6.displayName=ole;var sle="MenuArrow",E6=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=j0(n);return a.jsx(Rj,{...i,...r,ref:e})});E6.displayName=sle;var ale="MenuSub",[qDe,N6]=du(ale),jh="MenuSubTrigger",T6=y.forwardRef((t,e)=>{const n=fu(jh,t.__scopeMenu),r=ig(jh,t.__scopeMenu),i=N6(jh,t.__scopeMenu),o=$N(jh,t.__scopeMenu),s=y.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=o,u={__scopeMenu:t.__scopeMenu},d=y.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return y.useEffect(()=>d,[d]),y.useEffect(()=>{const f=l.current;return()=>{window.clearTimeout(f),c(null)}},[l,c]),a.jsx(MN,{asChild:!0,...u,children:a.jsx(y6,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":O6(n.open),...t,ref:Pb(e,i.onTriggerChange),onClick:f=>{var h;(h=t.onClick)==null||h.call(t,f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Te(t.onPointerMove,Qp(f=>{o.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Te(t.onPointerLeave,Qp(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,v=m==="right",b=v?-5:5,x=h[v?"left":"right"],w=h[v?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+b,y:f.clientY},{x,y:h.top},{x:w,y:h.top},{x:w,y:h.bottom},{x,y:h.bottom}],side:m}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Te(t.onKeyDown,f=>{var p;const h=o.searchRef.current!=="";t.disabled||h&&f.key===" "||Hae[r.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});T6.displayName=jh;var P6="MenuSubContent",k6=y.forwardRef((t,e)=>{const n=p6(uo,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,o=fu(uo,t.__scopeMenu),s=ig(uo,t.__scopeMenu),l=N6(P6,t.__scopeMenu),c=y.useRef(null),u=At(e,c);return a.jsx(Yp.Provider,{scope:t.__scopeMenu,children:a.jsx(Mr,{present:r||o.open,children:a.jsx(Yp.Slot,{scope:t.__scopeMenu,children:a.jsx(LN,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:u,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;s.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:Te(t.onFocusOutside,d=>{d.target!==l.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Te(t.onEscapeKeyDown,d=>{s.onClose(),d.preventDefault()}),onKeyDown:Te(t.onKeyDown,d=>{var p;const f=d.currentTarget.contains(d.target),h=zae[s.dir].includes(d.key);f&&h&&(o.onOpenChange(!1),(p=l.trigger)==null||p.focus(),d.preventDefault())})})})})})});k6.displayName=P6;function O6(t){return t?"open":"closed"}function ex(t){return t==="indeterminate"}function BN(t){return ex(t)?"indeterminate":t?"checked":"unchecked"}function lle(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function cle(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function ule(t,e,n){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,o=n?t.indexOf(n):-1;let s=cle(t,Math.max(o,0));i.length===1&&(s=s.filter(u=>u!==n));const c=s.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function dle(t,e){const{x:n,y:r}=t;let i=!1;for(let o=0,s=e.length-1;or!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(i=!i)}return i}function fle(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return dle(n,e)}function Qp(t){return e=>e.pointerType==="mouse"?t(e):void 0}var hle=h6,ple=MN,mle=m6,gle=g6,vle=FN,yle=v6,xle=E0,ble=x6,wle=w6,Sle=C6,Cle=_6,Ale=j6,_le=E6,jle=T6,Ele=k6,HN="DropdownMenu",[Nle,YDe]=ji(HN,[d6]),di=d6(),[Tle,I6]=Nle(HN),R6=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:l=!0}=t,c=di(e),u=y.useRef(null),[d=!1,f]=Ko({prop:i,defaultProp:o,onChange:s});return a.jsx(Tle,{scope:e,triggerId:Do(),triggerRef:u,contentId:Do(),open:d,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(h=>!h),[f]),modal:l,children:a.jsx(hle,{...c,open:d,onOpenChange:f,dir:r,modal:l,children:n})})};R6.displayName=HN;var M6="DropdownMenuTrigger",D6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,o=I6(M6,n),s=di(n);return a.jsx(ple,{asChild:!0,...s,children:a.jsx(et.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:Pb(e,o.triggerRef),onPointerDown:Te(t.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(o.onOpenToggle(),o.open||l.preventDefault())}),onKeyDown:Te(t.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&o.onOpenToggle(),l.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});D6.displayName=M6;var Ple="DropdownMenuPortal",$6=t=>{const{__scopeDropdownMenu:e,...n}=t,r=di(e);return a.jsx(mle,{...r,...n})};$6.displayName=Ple;var L6="DropdownMenuContent",F6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=I6(L6,n),o=di(n),s=y.useRef(!1);return a.jsx(gle,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...r,ref:e,onCloseAutoFocus:Te(t.onCloseAutoFocus,l=>{var c;s.current||(c=i.triggerRef.current)==null||c.focus(),s.current=!1,l.preventDefault()}),onInteractOutside:Te(t.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!i.modal||d)&&(s.current=!0)}),style:{...t.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)"}})});F6.displayName=L6;var kle="DropdownMenuGroup",Ole=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(vle,{...i,...r,ref:e})});Ole.displayName=kle;var Ile="DropdownMenuLabel",U6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(yle,{...i,...r,ref:e})});U6.displayName=Ile;var Rle="DropdownMenuItem",B6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(xle,{...i,...r,ref:e})});B6.displayName=Rle;var Mle="DropdownMenuCheckboxItem",H6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(ble,{...i,...r,ref:e})});H6.displayName=Mle;var Dle="DropdownMenuRadioGroup",$le=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(wle,{...i,...r,ref:e})});$le.displayName=Dle;var Lle="DropdownMenuRadioItem",z6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(Sle,{...i,...r,ref:e})});z6.displayName=Lle;var Fle="DropdownMenuItemIndicator",V6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(Cle,{...i,...r,ref:e})});V6.displayName=Fle;var Ule="DropdownMenuSeparator",G6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(Ale,{...i,...r,ref:e})});G6.displayName=Ule;var Ble="DropdownMenuArrow",Hle=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(_le,{...i,...r,ref:e})});Hle.displayName=Ble;var zle="DropdownMenuSubTrigger",K6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(jle,{...i,...r,ref:e})});K6.displayName=zle;var Vle="DropdownMenuSubContent",W6=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=di(n);return a.jsx(Ele,{...i,...r,ref:e,style:{...t.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)"}})});W6.displayName=Vle;var Gle=R6,Kle=D6,Wle=$6,q6=F6,Y6=U6,Q6=B6,X6=H6,J6=z6,Z6=V6,eH=G6,tH=K6,nH=W6;const q1=Gle,Y1=Kle,qle=y.forwardRef(({className:t,inset:e,children:n,...r},i)=>a.jsxs(tH,{ref:i,className:Pe("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",e&&"pl-8",t),...r,children:[n,a.jsx(Ji,{className:"ml-auto h-4 w-4"})]}));qle.displayName=tH.displayName;const Yle=y.forwardRef(({className:t,...e},n)=>a.jsx(nH,{ref:n,className:Pe("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",t),...e}));Yle.displayName=nH.displayName;const tx=y.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(Wle,{children:a.jsx(q6,{ref:r,sideOffset:e,className:Pe("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",t),...n})}));tx.displayName=q6.displayName;const Ba=y.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(Q6,{ref:r,className:Pe("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",e&&"pl-8",t),...n}));Ba.displayName=Q6.displayName;const Qle=y.forwardRef(({className:t,children:e,checked:n,...r},i)=>a.jsxs(X6,{ref:i,className:Pe("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",t),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(Z6,{children:a.jsx(Ts,{className:"h-4 w-4"})})}),e]}));Qle.displayName=X6.displayName;const Xle=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(J6,{ref:r,className:Pe("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",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Z6,{children:a.jsx(Kj,{className:"h-2 w-2 fill-current"})})}),e]}));Xle.displayName=J6.displayName;const Jle=y.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(Y6,{ref:r,className:Pe("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));Jle.displayName=Y6.displayName;const Zle=y.forwardRef(({className:t,...e},n)=>a.jsx(eH,{ref:n,className:Pe("-mx-1 my-1 h-px bg-muted",t),...e}));Zle.displayName=eH.displayName;var zN="Dialog",[rH,iH]=ji(zN),[ece,Zo]=rH(zN),oH=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=t,l=y.useRef(null),c=y.useRef(null),[u=!1,d]=Ko({prop:r,defaultProp:i,onChange:o});return a.jsx(ece,{scope:e,triggerRef:l,contentRef:c,contentId:Do(),titleId:Do(),descriptionId:Do(),open:u,onOpenChange:d,onOpenToggle:y.useCallback(()=>d(f=>!f),[d]),modal:s,children:n})};oH.displayName=zN;var sH="DialogTrigger",aH=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Zo(sH,n),o=At(e,i.triggerRef);return a.jsx(et.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":KN(i.open),...r,ref:o,onClick:Te(t.onClick,i.onOpenToggle)})});aH.displayName=sH;var VN="DialogPortal",[tce,lH]=rH(VN,{forceMount:void 0}),cH=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,o=Zo(VN,e);return a.jsx(tce,{scope:e,forceMount:n,children:y.Children.map(r,s=>a.jsx(Mr,{present:n||o.open,children:a.jsx(Rb,{asChild:!0,container:i,children:s})}))})};cH.displayName=VN;var nx="DialogOverlay",uH=y.forwardRef((t,e)=>{const n=lH(nx,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,o=Zo(nx,t.__scopeDialog);return o.modal?a.jsx(Mr,{present:r||o.open,children:a.jsx(nce,{...i,ref:e})}):null});uH.displayName=nx;var nce=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Zo(nx,n);return a.jsx(b0,{as:Es,allowPinchZoom:!0,shards:[i.contentRef],children:a.jsx(et.div,{"data-state":KN(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Zc="DialogContent",dH=y.forwardRef((t,e)=>{const n=lH(Zc,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,o=Zo(Zc,t.__scopeDialog);return a.jsx(Mr,{present:r||o.open,children:o.modal?a.jsx(rce,{...i,ref:e}):a.jsx(ice,{...i,ref:e})})});dH.displayName=Zc;var rce=y.forwardRef((t,e)=>{const n=Zo(Zc,t.__scopeDialog),r=y.useRef(null),i=At(e,n.contentRef,r);return y.useEffect(()=>{const o=r.current;if(o)return bN(o)},[]),a.jsx(fH,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Te(t.onCloseAutoFocus,o=>{var s;o.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:Te(t.onPointerDownOutside,o=>{const s=o.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0;(s.button===2||l)&&o.preventDefault()}),onFocusOutside:Te(t.onFocusOutside,o=>o.preventDefault())})}),ice=y.forwardRef((t,e)=>{const n=Zo(Zc,t.__scopeDialog),r=y.useRef(!1),i=y.useRef(!1);return a.jsx(fH,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s,l;(s=t.onCloseAutoFocus)==null||s.call(t,o),o.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var c,u;(c=t.onInteractOutside)==null||c.call(t,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;((u=n.triggerRef.current)==null?void 0:u.contains(s))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),fH=y.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=t,l=Zo(Zc,n),c=y.useRef(null),u=At(e,c);return xN(),a.jsxs(a.Fragment,{children:[a.jsx(y0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:a.jsx(Hm,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":KN(l.open),...s,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(sce,{titleId:l.titleId}),a.jsx(lce,{contentRef:c,descriptionId:l.descriptionId})]})]})}),GN="DialogTitle",hH=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Zo(GN,n);return a.jsx(et.h2,{id:i.titleId,...r,ref:e})});hH.displayName=GN;var pH="DialogDescription",mH=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Zo(pH,n);return a.jsx(et.p,{id:i.descriptionId,...r,ref:e})});mH.displayName=pH;var gH="DialogClose",vH=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Zo(gH,n);return a.jsx(et.button,{type:"button",...r,ref:e,onClick:Te(t.onClick,()=>i.onOpenChange(!1))})});vH.displayName=gH;function KN(t){return t?"open":"closed"}var yH="DialogTitleWarning",[oce,xH]=jq(yH,{contentName:Zc,titleName:GN,docsSlug:"dialog"}),sce=({titleId:t})=>{const e=xH(yH),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. -For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return y.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},lce="DialogDescriptionWarning",cce=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${bH(lce).contentName}}.`;return y.useEffect(()=>{var o;const i=(o=t.current)==null?void 0:o.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},wH=sH,uce=lH,SH=uH,qN=dH,YN=fH,QN=pH,XN=gH,ZN=yH,CH="AlertDialog",[dce,XDe]=ji(CH,[oH]),Na=oH(),AH=t=>{const{__scopeAlertDialog:e,...n}=t,r=Na(e);return a.jsx(wH,{...r,...n,modal:!0})};AH.displayName=CH;var fce="AlertDialogTrigger",hce=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Na(n);return a.jsx(uce,{...i,...r,ref:e})});hce.displayName=fce;var pce="AlertDialogPortal",_H=t=>{const{__scopeAlertDialog:e,...n}=t,r=Na(e);return a.jsx(SH,{...r,...n})};_H.displayName=pce;var mce="AlertDialogOverlay",jH=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Na(n);return a.jsx(qN,{...i,...r,ref:e})});jH.displayName=mce;var ad="AlertDialogContent",[gce,vce]=dce(ad),EH=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...i}=t,o=Na(n),s=y.useRef(null),l=_t(e,s),c=y.useRef(null);return a.jsx(sce,{contentName:ad,titleName:NH,docsSlug:"alert-dialog",children:a.jsx(gce,{scope:n,cancelRef:c,children:a.jsxs(YN,{role:"alertdialog",...o,...i,ref:l,onOpenAutoFocus:Pe(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(Aj,{children:r}),a.jsx(xce,{contentRef:s})]})})})});EH.displayName=ad;var NH="AlertDialogTitle",TH=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Na(n);return a.jsx(QN,{...i,...r,ref:e})});TH.displayName=NH;var PH="AlertDialogDescription",kH=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Na(n);return a.jsx(XN,{...i,...r,ref:e})});kH.displayName=PH;var yce="AlertDialogAction",OH=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Na(n);return a.jsx(ZN,{...i,...r,ref:e})});OH.displayName=yce;var IH="AlertDialogCancel",RH=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:i}=vce(IH,n),o=Na(n),s=_t(e,i);return a.jsx(ZN,{...o,...r,ref:s})});RH.displayName=IH;var xce=({contentRef:t})=>{const e=`\`${ad}\` requires a description for the component to be accessible for screen reader users. +For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return y.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},ace="DialogDescriptionWarning",lce=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${xH(ace).contentName}}.`;return y.useEffect(()=>{var o;const i=(o=t.current)==null?void 0:o.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},bH=oH,cce=aH,wH=cH,WN=uH,qN=dH,YN=hH,QN=mH,XN=vH,SH="AlertDialog",[uce,QDe]=ji(SH,[iH]),Na=iH(),CH=t=>{const{__scopeAlertDialog:e,...n}=t,r=Na(e);return a.jsx(bH,{...r,...n,modal:!0})};CH.displayName=SH;var dce="AlertDialogTrigger",fce=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Na(n);return a.jsx(cce,{...i,...r,ref:e})});fce.displayName=dce;var hce="AlertDialogPortal",AH=t=>{const{__scopeAlertDialog:e,...n}=t,r=Na(e);return a.jsx(wH,{...r,...n})};AH.displayName=hce;var pce="AlertDialogOverlay",_H=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Na(n);return a.jsx(WN,{...i,...r,ref:e})});_H.displayName=pce;var ad="AlertDialogContent",[mce,gce]=uce(ad),jH=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...i}=t,o=Na(n),s=y.useRef(null),l=At(e,s),c=y.useRef(null);return a.jsx(oce,{contentName:ad,titleName:EH,docsSlug:"alert-dialog",children:a.jsx(mce,{scope:n,cancelRef:c,children:a.jsxs(qN,{role:"alertdialog",...o,...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(Cj,{children:r}),a.jsx(yce,{contentRef:s})]})})})});jH.displayName=ad;var EH="AlertDialogTitle",NH=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Na(n);return a.jsx(YN,{...i,...r,ref:e})});NH.displayName=EH;var TH="AlertDialogDescription",PH=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Na(n);return a.jsx(QN,{...i,...r,ref:e})});PH.displayName=TH;var vce="AlertDialogAction",kH=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Na(n);return a.jsx(XN,{...i,...r,ref:e})});kH.displayName=vce;var OH="AlertDialogCancel",IH=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:i}=gce(OH,n),o=Na(n),s=At(e,i);return a.jsx(XN,{...o,...r,ref:s})});IH.displayName=OH;var yce=({contentRef:t})=>{const e=`\`${ad}\` requires a description for the component to be accessible for screen reader users. -You can add a description to the \`${ad}\` by passing a \`${PH}\` component as a child, which also benefits sighted users by adding visible context to the dialog. +You can add a description to the \`${ad}\` by passing a \`${TH}\` 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 \`${ad}\`. 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 y.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},bce=AH,wce=_H,MH=jH,DH=EH,$H=OH,LH=RH,FH=TH,UH=kH;const X1=bce,Sce=wce,BH=y.forwardRef(({className:t,...e},n)=>a.jsx(MH,{className:ke("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",t),...e,ref:n}));BH.displayName=MH.displayName;const ix=y.forwardRef(({className:t,...e},n)=>a.jsxs(Sce,{children:[a.jsx(BH,{}),a.jsx(DH,{ref:n,className:ke("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",t),...e})]}));ix.displayName=DH.displayName;const ox=({className:t,...e})=>a.jsx("div",{className:ke("flex flex-col space-y-2 text-center sm:text-left",t),...e});ox.displayName="AlertDialogHeader";const sx=({className:t,...e})=>a.jsx("div",{className:ke("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});sx.displayName="AlertDialogFooter";const ax=y.forwardRef(({className:t,...e},n)=>a.jsx(FH,{ref:n,className:ke("text-lg font-semibold",t),...e}));ax.displayName=FH.displayName;const lx=y.forwardRef(({className:t,...e},n)=>a.jsx(UH,{ref:n,className:ke("text-sm text-muted-foreground",t),...e}));lx.displayName=UH.displayName;const cx=y.forwardRef(({className:t,...e},n)=>a.jsx($H,{ref:n,className:ke(dN(),t),...e}));cx.displayName=$H.displayName;const ux=y.forwardRef(({className:t,...e},n)=>a.jsx(LH,{ref:n,className:ke(dN({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));ux.displayName=LH.displayName;const kc=wH,Cce=SH,HH=y.forwardRef(({className:t,...e},n)=>a.jsx(qN,{ref:n,className:ke("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",t),...e}));HH.displayName=qN.displayName;const xl=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(Cce,{children:[a.jsx(HH,{}),a.jsxs(YN,{ref:r,className:ke("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",t),...n,children:[e,a.jsxs(ZN,{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($o,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));xl.displayName=YN.displayName;const bl=({className:t,...e})=>a.jsx("div",{className:ke("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});bl.displayName="DialogHeader";const wl=({className:t,...e})=>a.jsx("div",{className:ke("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});wl.displayName="DialogFooter";const Sl=y.forwardRef(({className:t,...e},n)=>a.jsx(QN,{ref:n,className:ke("text-lg font-semibold leading-none tracking-tight",t),...e}));Sl.displayName=QN.displayName;const Oc=y.forwardRef(({className:t,...e},n)=>a.jsx(XN,{ref:n,className:ke("text-sm text-muted-foreground",t),...e}));Oc.displayName=XN.displayName;var JN="Radio",[Ace,zH]=ji(JN),[_ce,jce]=Ace(JN),VH=y.forwardRef((t,e)=>{const{__scopeRadio:n,name:r,checked:i=!1,required:o,disabled:s,value:l="on",onCheck:c,form:u,...d}=t,[f,h]=y.useState(null),p=_t(e,v=>h(v)),g=y.useRef(!1),m=f?u||!!f.closest("form"):!0;return a.jsxs(_ce,{scope:n,checked:i,disabled:s,children:[a.jsx(et.button,{type:"button",role:"radio","aria-checked":i,"data-state":WH(i),"data-disabled":s?"":void 0,disabled:s,value:l,...d,ref:p,onClick:Pe(t.onClick,v=>{i||c==null||c(),m&&(g.current=v.isPropagationStopped(),g.current||v.stopPropagation())})}),m&&a.jsx(Ece,{control:f,bubbles:!g.current,name:r,value:l,checked:i,required:o,disabled:s,form:u,style:{transform:"translateX(-100%)"}})]})});VH.displayName=JN;var GH="RadioIndicator",KH=y.forwardRef((t,e)=>{const{__scopeRadio:n,forceMount:r,...i}=t,o=jce(GH,n);return a.jsx(Mr,{present:r||o.checked,children:a.jsx(et.span,{"data-state":WH(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:e})})});KH.displayName=GH;var Ece=t=>{const{control:e,checked:n,bubbles:r=!0,...i}=t,o=y.useRef(null),s=Zm(n),l=Gm(e);return y.useEffect(()=>{const c=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});f.call(c,n),c.dispatchEvent(h)}},[s,n,r]),a.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:o,style:{...t.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function WH(t){return t?"checked":"unchecked"}var Nce=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],eT="RadioGroup",[Tce,ZDe]=ji(eT,[Ef,zH]),qH=Ef(),YH=zH(),[Pce,kce]=Tce(eT),QH=y.forwardRef((t,e)=>{const{__scopeRadioGroup:n,name:r,defaultValue:i,value:o,required:s=!1,disabled:l=!1,orientation:c,dir:u,loop:d=!0,onValueChange:f,...h}=t,p=qH(n),g=uu(u),[m,v]=Ko({prop:o,defaultProp:i,onChange:f});return a.jsx(Pce,{scope:n,name:r,required:s,disabled:l,value:m,onValueChange:v,children:a.jsx(ON,{asChild:!0,...p,orientation:c,dir:g,loop:d,children:a.jsx(et.div,{role:"radiogroup","aria-required":s,"aria-orientation":c,"data-disabled":l?"":void 0,dir:g,...h,ref:e})})})});QH.displayName=eT;var XH="RadioGroupItem",ZH=y.forwardRef((t,e)=>{const{__scopeRadioGroup:n,disabled:r,...i}=t,o=kce(XH,n),s=o.disabled||r,l=qH(n),c=YH(n),u=y.useRef(null),d=_t(e,u),f=o.value===i.value,h=y.useRef(!1);return y.useEffect(()=>{const p=m=>{Nce.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(IN,{asChild:!0,...l,focusable:!s,active:f,children:a.jsx(VH,{disabled:s,required:o.required,checked:f,...c,...i,name:o.name,ref:d,onCheck:()=>o.onValueChange(i.value),onKeyDown:Pe(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:Pe(i.onFocus,()=>{var p;h.current&&((p=u.current)==null||p.click())})})})});ZH.displayName=XH;var Oce="RadioGroupIndicator",JH=y.forwardRef((t,e)=>{const{__scopeRadioGroup:n,...r}=t,i=YH(n);return a.jsx(KH,{...i,...r,ref:e})});JH.displayName=Oce;var ez=QH,tz=ZH,Ice=JH;const Z1=y.forwardRef(({className:t,...e},n)=>a.jsx(ez,{className:ke("grid gap-2",t),...e,ref:n}));Z1.displayName=ez.displayName;const Nh=y.forwardRef(({className:t,...e},n)=>a.jsx(tz,{ref:n,className:ke("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",t),...e,children:a.jsx(Ice,{className:"flex items-center justify-center",children:a.jsx(Wj,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Nh.displayName=tz.displayName;var tT="Checkbox",[Rce,JDe]=ji(tT),[Mce,Dce]=Rce(tT),nz=y.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=t,[h,p]=y.useState(null),g=_t(e,S=>p(S)),m=y.useRef(!1),v=h?d||!!h.closest("form"):!0,[b=!1,x]=Ko({prop:i,defaultProp:o,onChange:u}),w=y.useRef(b);return y.useEffect(()=>{const S=h==null?void 0:h.form;if(S){const C=()=>x(w.current);return S.addEventListener("reset",C),()=>S.removeEventListener("reset",C)}},[h,x]),a.jsxs(Mce,{scope:n,state:b,disabled:l,children:[a.jsx(et.button,{type:"button",role:"checkbox","aria-checked":Cl(b)?"mixed":b,"aria-required":s,"data-state":oz(b),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:g,onKeyDown:Pe(t.onKeyDown,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:Pe(t.onClick,S=>{x(C=>Cl(C)?!0:!C),v&&(m.current=S.isPropagationStopped(),m.current||S.stopPropagation())})}),v&&a.jsx($ce,{control:h,bubbles:!m.current,name:r,value:c,checked:b,required:s,disabled:l,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Cl(o)?!1:o})]})});nz.displayName=tT;var rz="CheckboxIndicator",iz=y.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:r,...i}=t,o=Dce(rz,n);return a.jsx(Mr,{present:r||Cl(o.state)||o.state===!0,children:a.jsx(et.span,{"data-state":oz(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:e,style:{pointerEvents:"none",...t.style}})})});iz.displayName=rz;var $ce=t=>{const{control:e,checked:n,bubbles:r=!0,defaultChecked:i,...o}=t,s=y.useRef(null),l=Zm(n),c=Gm(e);y.useEffect(()=>{const d=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(l!==n&&p){const g=new Event("click",{bubbles:r});d.indeterminate=Cl(n),p.call(d,Cl(n)?!1:n),d.dispatchEvent(g)}},[l,n,r]);const u=y.useRef(Cl(n)?!1:n);return a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??u.current,...o,tabIndex:-1,ref:s,style:{...t.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Cl(t){return t==="indeterminate"}function oz(t){return Cl(t)?"indeterminate":t?"checked":"unchecked"}var sz=nz,Lce=iz;const vc=y.forwardRef(({className:t,...e},n)=>a.jsx(sz,{ref:n,className:ke("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",t),...e,children:a.jsx(Lce,{className:ke("flex items-center justify-center text-current"),children:a.jsx(Ts,{className:"h-4 w-4"})})}));vc.displayName=sz.displayName;const nT=({isActive:t,isComplete:e,hasError:n,label:r,onComplete:i,className:o})=>{const[s,l]=y.useState(0),[c,u]=y.useState("progressing"),[d,f]=y.useState(!1),h=y.useRef(null),p=y.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)},v=S=>{g(),u("completing");const C=100-S,A=50,_=500/A,j=C/_;let k=0;h.current=setInterval(()=>{k++;const P=S+j*k;P>=100||k>=_?(l(100),u("completed"),g(),p.current=setTimeout(()=>{u("hiding"),setTimeout(()=>{m(),i==null||i()},300)},2e3)):l(P)},A)},b=()=>{c==="progressing"&&v(s)},x=()=>{c==="waiting"&&v(90)},w=()=>{g()};return y.useEffect(()=>{if(t&&!d){f(!0),l(0),u("progressing");const S=90/540;let C=0;h.current=setInterval(()=>{C+=S,C>=90?(l(90),u("waiting"),g()):l(C)},100)}return e&&c==="progressing"&&b(),e&&c==="waiting"&&x(),n&&(c==="progressing"||c==="waiting")&&w(),!t&&d&&m(),()=>{t||g()}},[t,e,n,c,d]),y.useEffect(()=>()=>{g()},[]),d?a.jsxs("div",{className:ke("w-full space-y-2",o),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(s),"%"]})]}),a.jsx(mc,{value:s,className:ke("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},Gn="all",Fce=()=>{var Vt,vn,Wi,Ls;const t=y.useCallback(()=>{document.body.style.pointerEvents==="none"&&(console.log("ensureBodyInteractive: Fixing body pointer-events..."),document.body.style.pointerEvents="auto")},[]),e=Xn(),[n]=SX(),{loadPersonas:r}=jB(),[i,o]=y.useState("view"),[s,l]=y.useState("ai"),[c,u]=y.useState("");y.useState(null);const[d,f]=y.useState(Gn),[h,p]=y.useState(!1),[g,m]=y.useState("");y.useEffect(()=>{const Y=n.get("mode");(Y==="view"||Y==="create")&&o(Y)},[n]);const[v,b]=y.useState([]),[x,w]=y.useState([]),[S,C]=y.useState(!0);y.useState(null);const[A,_]=y.useState(new Set),[j,k]=y.useState(!1),[P,R]=y.useState(null),[E,I]=y.useState(""),[L,V]=y.useState(!1),[$,z]=y.useState(null),[M,U]=y.useState(!1),[K,X]=y.useState(null),[re,xe]=y.useState(!1),[F,ue]=y.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]}),[ie,ce]=y.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]}),[Me,pe]=y.useState(!1),[Se,Te]=y.useState(!1),[ne,rt]=y.useState(!1),[Fe,vt]=y.useState(!1),[mt,Bt]=y.useState("gemini-2.5-pro"),N=()=>{pe(!1),Te(!1),rt(!1)},D=Y=>{const Oe={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return Y.forEach(He=>{if(He.age&&Oe.age.add(He.age),He.gender&&Oe.gender.add(He.gender),He.occupation&&Oe.occupation.add(He.occupation),He.location&&Oe.location.add(He.location),He.techSavviness!==void 0){const ht=He.techSavviness<30?"Low (0-30)":He.techSavviness<70?"Medium (31-70)":"High (71-100)";Oe.techSavviness.add(ht)}He.ethnicity&&Oe.ethnicity.add(He.ethnicity)}),{age:Array.from(Oe.age).sort(),gender:Array.from(Oe.gender).sort(),occupation:Array.from(Oe.occupation).sort(),location:Array.from(Oe.location).sort(),techSavviness:Array.from(Oe.techSavviness).sort((He,ht)=>{const Ye=["Low (0-30)","Medium (31-70)","High (71-100)"];return Ye.indexOf(He)-Ye.indexOf(ht)}),ethnicity:Array.from(Oe.ethnicity).sort()}},H=()=>{xe(!1),setTimeout(()=>{ue({...ie})},0)},Q=()=>{ce({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]})},Z=(Y,Oe)=>{ce(He=>{const ht={...He};return ht[Y].includes(Oe)?ht[Y]=ht[Y].filter(Ye=>Ye!==Oe):ht[Y]=[...ht[Y],Oe],ht})},B=async()=>{try{const He=(await ds.getAll()).data.map(ht=>({...ht,id:ht._id}));return w(He),He}catch(Y){return console.error("Error fetching folders:",Y),qe.error("Failed to load folders"),w([]),[]}},ee=async()=>{C(!0);try{const He=(await kr.getAll()).data;{const Ye=[...He.map(gt=>({...gt,id:gt.id||gt._id}))];try{(async()=>{const tn=await r();console.log("Loaded stored personas (for debugging only):",tn?tn.length:0)})()}catch(gt){console.warn("Error loading stored personas:",gt)}b(Ye)}}catch(Oe){console.error("Error fetching personas:",Oe),qe.error("Failed to load personas"),b([])}finally{C(!1)}};y.useEffect(()=>((async()=>{try{const[,]=await Promise.all([B(),ee()])}catch(Oe){console.error("Error loading data:",Oe)}})(),()=>{}),[t]),y.useEffect(()=>{var Y;if(i==="view")ee();else if(i==="create"&&(console.log(`Switching to create mode with folder: ${d}, ${d!==Gn?"NOT default":"IS default"}`),d!==Gn)){const Oe=(Y=x.find(He=>He.id===d))==null?void 0:Y.name;console.log(`Selected folder for creation: ${d} (${Oe})`)}},[i]),y.useEffect(()=>{ee();const Y=()=>{window.location.pathname.includes("/synthetic-users")&&!window.location.pathname.includes("/synthetic-users/")&&(console.log("Navigation to synthetic users page detected, refreshing data"),ee())},Oe=()=>{console.log("Synthetic users navigation event detected, refreshing data"),ee()};console.log("Setting up MutationObserver for body style");const He=new MutationObserver(ht=>{ht.forEach(Ye=>{Ye.type==="attributes"&&Ye.attributeName==="style"&&document.body.style.pointerEvents==="none"&&(console.log("MutationObserver detected pointer-events: none, fixing..."),t())})});return He.observe(document.body,{attributes:!0,attributeFilter:["style"]}),t(),window.addEventListener("popstate",Y),window.addEventListener("syntheticUsersNavigation",Oe),()=>{window.removeEventListener("popstate",Y),window.removeEventListener("syntheticUsersNavigation",Oe),console.log("Disconnecting MutationObserver"),He.disconnect()}},[]);const me=async()=>{if(!g.trim()){qe.error("Please enter a folder name");return}try{const Y=await ds.create({name:g.trim(),persona_ids:[]});await B(),m(""),p(!1),qe.success(`Folder "${g}" created`)}catch(Y){console.error("Error creating folder:",Y),qe.error("Failed to create folder")}},Ce=()=>{m(""),p(!1)},De=Y=>{R(Y),I(Y.name)},we=async()=>{if(!P||!E.trim()){R(null);return}try{await ds.update(P._id,{name:E.trim()}),await B(),R(null),qe.success(`Folder renamed to "${E}"`)}catch(Y){console.error("Error renaming folder:",Y),qe.error("Failed to rename folder"),R(null)}},We=()=>{R(null),I("")},St=Y=>{z(Y),V(!0)},Tt=async()=>{if($)try{await ds.delete($._id),await B(),(d===$._id||d===$.id)&&f(Gn),V(!1),z(null),qe.success(`Folder "${$.name}" deleted`)}catch(Y){console.error("Error deleting folder:",Y),qe.error("Failed to delete folder")}},Ze=async(Y,Oe)=>{var tn;const He=Y||A,ht=Oe||K;if(!ht||He.size===0)return;const Ye=Array.from(He),gt=Ye.map(it=>{const pn=v.find(Qt=>Qt.id===it);return(pn==null?void 0:pn._id)||(pn==null?void 0:pn.id)||it}).filter(Boolean);try{const it=[],pn=[];if(ht!==Gn)try{await ds.addPersonasBatch(ht,gt),it.push(...Ye)}catch(J){console.error("Error adding personas to folder:",J),pn.push(...Ye)}else it.push(...Ye);await Promise.all([B(),ee()]);const Qt=ht===Gn?"All Personas":((tn=x.find(J=>J._id===ht||J.id===ht))==null?void 0:tn.name)||"folder";return it.length>0&&qe.success(`Added ${it.length} persona${it.length!==1?"s":""} to ${Qt}`),pn.length>0&&qe.error(`Failed to add ${pn.length} persona${pn.length!==1?"s":""} to ${Qt}.`),Y||_(new Set),{success:it.length>0,successCount:it.length,failureCount:pn.length}}catch(it){return console.error("Error moving personas to folder:",it),qe.error("An unexpected error occurred while adding personas to folder."),{success:!1,error:it}}},Qe=async()=>{var He,ht,Ye;if(A.size===0||d===Gn)return;const Y=Array.from(A),Oe=Y.map(gt=>{const tn=v.find(it=>it.id===gt);return(tn==null?void 0:tn._id)||(tn==null?void 0:tn.id)||gt}).filter(Boolean);console.log("Removing personas from folder:",{selectedFolder:d,selectedIds:Y,mongoIds:Oe,folderName:(He=x.find(gt=>gt._id===d))==null?void 0:He.name});try{await ds.removePersonasBatch(d,Oe),await Promise.all([B(),ee()]);const gt=((ht=x.find(tn=>tn._id===d))==null?void 0:ht.name)||"folder";qe.success(`Removed ${Y.length} persona${Y.length!==1?"s":""} from ${gt}`),_(new Set)}catch(gt){console.error("Error removing personas from folder:",gt),console.error("Error details:",((Ye=gt.response)==null?void 0:Ye.data)||gt.message),qe.error("Failed to remove personas from folder")}},$t=Y=>{_(Oe=>{const He=new Set(Oe);return He.has(Y)?He.delete(Y):He.add(Y),He})},Yt=()=>{A.size===Sn.length?_(new Set):_(new Set(Sn.map(Y=>Y.id)))},_r=async()=>{if(A.size===0)return;const Y=Array.from(A);_(new Set),k(!1),C(!0);const Oe=[],He=[];for(const ht of Y)try{const Ye=v.find(tn=>tn.id===ht);if(!Ye){console.error(`Could not find persona with id: ${ht}`),He.push(ht);continue}let gt=ht;Ye._id&&(gt=Ye._id.toString()),console.log(`Attempting to delete persona: ${gt}`),await kr.delete(gt),Oe.push(ht)}catch(Ye){console.error(`Failed to delete persona ${ht}:`,Ye),He.push(ht)}b(ht=>ht.filter(Ye=>!Oe.includes(Ye.id))),await B(),C(!1),setTimeout(()=>{Oe.length>0&&qe.success(`Successfully deleted ${Oe.length} persona${Oe.length!==1?"s":""}`),He.length>0&&qe.error(`Failed to delete ${He.length} persona${He.length!==1?"s":""}`),(Oe.length>0||He.length>0)&&ee()},50)},Sn=v.filter(Y=>{const Oe=Y.name.toLowerCase().includes(c.toLowerCase())||Y.occupation.toLowerCase().includes(c.toLowerCase())||Y.location.toLowerCase().includes(c.toLowerCase()),He=(F.age.length===0||F.age.includes(Y.age))&&(F.gender.length===0||F.gender.includes(Y.gender))&&(F.occupation.length===0||F.occupation.includes(Y.occupation))&&(F.location.length===0||F.location.includes(Y.location))&&(F.ethnicity.length===0||Y.ethnicity&&F.ethnicity.includes(Y.ethnicity))&&(F.techSavviness.length===0||Y.techSavviness!==void 0&&F.techSavviness.includes(Y.techSavviness<30?"Low (0-30)":Y.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&(F.folderStatus.length===0||F.folderStatus.includes("hasFolder")&&F.folderStatus.includes("noFolder")||F.folderStatus.includes("hasFolder")&&!F.folderStatus.includes("noFolder")&&Y.folderId&&Y.folderId!==Gn||F.folderStatus.includes("noFolder")&&!F.folderStatus.includes("hasFolder")&&(!Y.folderId||Y.folderId===Gn));return d===Gn||Y.folder_ids&&Array.isArray(Y.folder_ids)&&Y.folder_ids.includes(d)||Y.folder_id===d||Y.folderId===d?Oe&&He:!1}),yt=(Y,Oe)=>{const He=new Date().toISOString().split("T")[0],ht=Y.length;let Ye=`# Persona Summary Report +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return y.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},xce=CH,bce=AH,RH=_H,MH=jH,DH=kH,$H=IH,LH=NH,FH=PH;const Q1=xce,wce=bce,UH=y.forwardRef(({className:t,...e},n)=>a.jsx(RH,{className:Pe("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",t),...e,ref:n}));UH.displayName=RH.displayName;const rx=y.forwardRef(({className:t,...e},n)=>a.jsxs(wce,{children:[a.jsx(UH,{}),a.jsx(MH,{ref:n,className:Pe("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",t),...e})]}));rx.displayName=MH.displayName;const ix=({className:t,...e})=>a.jsx("div",{className:Pe("flex flex-col space-y-2 text-center sm:text-left",t),...e});ix.displayName="AlertDialogHeader";const ox=({className:t,...e})=>a.jsx("div",{className:Pe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ox.displayName="AlertDialogFooter";const sx=y.forwardRef(({className:t,...e},n)=>a.jsx(LH,{ref:n,className:Pe("text-lg font-semibold",t),...e}));sx.displayName=LH.displayName;const ax=y.forwardRef(({className:t,...e},n)=>a.jsx(FH,{ref:n,className:Pe("text-sm text-muted-foreground",t),...e}));ax.displayName=FH.displayName;const lx=y.forwardRef(({className:t,...e},n)=>a.jsx(DH,{ref:n,className:Pe(uN(),t),...e}));lx.displayName=DH.displayName;const cx=y.forwardRef(({className:t,...e},n)=>a.jsx($H,{ref:n,className:Pe(uN({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));cx.displayName=$H.displayName;const kc=bH,Sce=wH,BH=y.forwardRef(({className:t,...e},n)=>a.jsx(WN,{ref:n,className:Pe("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",t),...e}));BH.displayName=WN.displayName;const xl=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(Sce,{children:[a.jsx(BH,{}),a.jsxs(qN,{ref:r,className:Pe("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",t),...n,children:[e,a.jsxs(XN,{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($o,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));xl.displayName=qN.displayName;const bl=({className:t,...e})=>a.jsx("div",{className:Pe("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});bl.displayName="DialogHeader";const wl=({className:t,...e})=>a.jsx("div",{className:Pe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});wl.displayName="DialogFooter";const Sl=y.forwardRef(({className:t,...e},n)=>a.jsx(YN,{ref:n,className:Pe("text-lg font-semibold leading-none tracking-tight",t),...e}));Sl.displayName=YN.displayName;const Oc=y.forwardRef(({className:t,...e},n)=>a.jsx(QN,{ref:n,className:Pe("text-sm text-muted-foreground",t),...e}));Oc.displayName=QN.displayName;var JN="Radio",[Cce,HH]=ji(JN),[Ace,_ce]=Cce(JN),zH=y.forwardRef((t,e)=>{const{__scopeRadio:n,name:r,checked:i=!1,required:o,disabled:s,value:l="on",onCheck:c,form:u,...d}=t,[f,h]=y.useState(null),p=At(e,v=>h(v)),g=y.useRef(!1),m=f?u||!!f.closest("form"):!0;return a.jsxs(Ace,{scope:n,checked:i,disabled:s,children:[a.jsx(et.button,{type:"button",role:"radio","aria-checked":i,"data-state":KH(i),"data-disabled":s?"":void 0,disabled:s,value:l,...d,ref:p,onClick:Te(t.onClick,v=>{i||c==null||c(),m&&(g.current=v.isPropagationStopped(),g.current||v.stopPropagation())})}),m&&a.jsx(jce,{control:f,bubbles:!g.current,name:r,value:l,checked:i,required:o,disabled:s,form:u,style:{transform:"translateX(-100%)"}})]})});zH.displayName=JN;var VH="RadioIndicator",GH=y.forwardRef((t,e)=>{const{__scopeRadio:n,forceMount:r,...i}=t,o=_ce(VH,n);return a.jsx(Mr,{present:r||o.checked,children:a.jsx(et.span,{"data-state":KH(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:e})})});GH.displayName=VH;var jce=t=>{const{control:e,checked:n,bubbles:r=!0,...i}=t,o=y.useRef(null),s=Xm(n),l=Vm(e);return y.useEffect(()=>{const c=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});f.call(c,n),c.dispatchEvent(h)}},[s,n,r]),a.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:o,style:{...t.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function KH(t){return t?"checked":"unchecked"}var Ece=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ZN="RadioGroup",[Nce,XDe]=ji(ZN,[Ef,HH]),WH=Ef(),qH=HH(),[Tce,Pce]=Nce(ZN),YH=y.forwardRef((t,e)=>{const{__scopeRadioGroup:n,name:r,defaultValue:i,value:o,required:s=!1,disabled:l=!1,orientation:c,dir:u,loop:d=!0,onValueChange:f,...h}=t,p=WH(n),g=uu(u),[m,v]=Ko({prop:o,defaultProp:i,onChange:f});return a.jsx(Tce,{scope:n,name:r,required:s,disabled:l,value:m,onValueChange:v,children:a.jsx(kN,{asChild:!0,...p,orientation:c,dir:g,loop:d,children:a.jsx(et.div,{role:"radiogroup","aria-required":s,"aria-orientation":c,"data-disabled":l?"":void 0,dir:g,...h,ref:e})})})});YH.displayName=ZN;var QH="RadioGroupItem",XH=y.forwardRef((t,e)=>{const{__scopeRadioGroup:n,disabled:r,...i}=t,o=Pce(QH,n),s=o.disabled||r,l=WH(n),c=qH(n),u=y.useRef(null),d=At(e,u),f=o.value===i.value,h=y.useRef(!1);return y.useEffect(()=>{const p=m=>{Ece.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(ON,{asChild:!0,...l,focusable:!s,active:f,children:a.jsx(zH,{disabled:s,required:o.required,checked:f,...c,...i,name:o.name,ref:d,onCheck:()=>o.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())})})})});XH.displayName=QH;var kce="RadioGroupIndicator",JH=y.forwardRef((t,e)=>{const{__scopeRadioGroup:n,...r}=t,i=qH(n);return a.jsx(GH,{...i,...r,ref:e})});JH.displayName=kce;var ZH=YH,ez=XH,Oce=JH;const X1=y.forwardRef(({className:t,...e},n)=>a.jsx(ZH,{className:Pe("grid gap-2",t),...e,ref:n}));X1.displayName=ZH.displayName;const Eh=y.forwardRef(({className:t,...e},n)=>a.jsx(ez,{ref:n,className:Pe("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",t),...e,children:a.jsx(Oce,{className:"flex items-center justify-center",children:a.jsx(Kj,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Eh.displayName=ez.displayName;var eT="Checkbox",[Ice,JDe]=ji(eT),[Rce,Mce]=Ice(eT),tz=y.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=t,[h,p]=y.useState(null),g=At(e,S=>p(S)),m=y.useRef(!1),v=h?d||!!h.closest("form"):!0,[b=!1,x]=Ko({prop:i,defaultProp:o,onChange:u}),w=y.useRef(b);return y.useEffect(()=>{const S=h==null?void 0:h.form;if(S){const C=()=>x(w.current);return S.addEventListener("reset",C),()=>S.removeEventListener("reset",C)}},[h,x]),a.jsxs(Rce,{scope:n,state:b,disabled:l,children:[a.jsx(et.button,{type:"button",role:"checkbox","aria-checked":Cl(b)?"mixed":b,"aria-required":s,"data-state":iz(b),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:g,onKeyDown:Te(t.onKeyDown,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:Te(t.onClick,S=>{x(C=>Cl(C)?!0:!C),v&&(m.current=S.isPropagationStopped(),m.current||S.stopPropagation())})}),v&&a.jsx(Dce,{control:h,bubbles:!m.current,name:r,value:c,checked:b,required:s,disabled:l,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Cl(o)?!1:o})]})});tz.displayName=eT;var nz="CheckboxIndicator",rz=y.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:r,...i}=t,o=Mce(nz,n);return a.jsx(Mr,{present:r||Cl(o.state)||o.state===!0,children:a.jsx(et.span,{"data-state":iz(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:e,style:{pointerEvents:"none",...t.style}})})});rz.displayName=nz;var Dce=t=>{const{control:e,checked:n,bubbles:r=!0,defaultChecked:i,...o}=t,s=y.useRef(null),l=Xm(n),c=Vm(e);y.useEffect(()=>{const d=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(l!==n&&p){const g=new Event("click",{bubbles:r});d.indeterminate=Cl(n),p.call(d,Cl(n)?!1:n),d.dispatchEvent(g)}},[l,n,r]);const u=y.useRef(Cl(n)?!1:n);return a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??u.current,...o,tabIndex:-1,ref:s,style:{...t.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Cl(t){return t==="indeterminate"}function iz(t){return Cl(t)?"indeterminate":t?"checked":"unchecked"}var oz=tz,$ce=rz;const vc=y.forwardRef(({className:t,...e},n)=>a.jsx(oz,{ref:n,className:Pe("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",t),...e,children:a.jsx($ce,{className:Pe("flex items-center justify-center text-current"),children:a.jsx(Ts,{className:"h-4 w-4"})})}));vc.displayName=oz.displayName;const tT=({isActive:t,isComplete:e,hasError:n,label:r,onComplete:i,className:o})=>{const[s,l]=y.useState(0),[c,u]=y.useState("progressing"),[d,f]=y.useState(!1),h=y.useRef(null),p=y.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)},v=S=>{g(),u("completing");const C=100-S,A=50,_=500/A,j=C/_;let k=0;h.current=setInterval(()=>{k++;const P=S+j*k;P>=100||k>=_?(l(100),u("completed"),g(),p.current=setTimeout(()=>{u("hiding"),setTimeout(()=>{m(),i==null||i()},300)},2e3)):l(P)},A)},b=()=>{c==="progressing"&&v(s)},x=()=>{c==="waiting"&&v(90)},w=()=>{g()};return y.useEffect(()=>{if(t&&!d){f(!0),l(0),u("progressing");const S=90/540;let C=0;h.current=setInterval(()=>{C+=S,C>=90?(l(90),u("waiting"),g()):l(C)},100)}return e&&c==="progressing"&&b(),e&&c==="waiting"&&x(),n&&(c==="progressing"||c==="waiting")&&w(),!t&&d&&m(),()=>{t||g()}},[t,e,n,c,d]),y.useEffect(()=>()=>{g()},[]),d?a.jsxs("div",{className:Pe("w-full space-y-2",o),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(s),"%"]})]}),a.jsx(mc,{value:s,className:Pe("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},Gn="all",Lce=()=>{var Vt,un,Wi,Ls;const t=y.useCallback(()=>{document.body.style.pointerEvents==="none"&&(console.log("ensureBodyInteractive: Fixing body pointer-events..."),document.body.style.pointerEvents="auto")},[]),e=Xn(),[n]=wX(),{loadPersonas:r}=_B(),[i,o]=y.useState("view"),[s,l]=y.useState("ai"),[c,u]=y.useState("");y.useState(null);const[d,f]=y.useState(Gn),[h,p]=y.useState(!1),[g,m]=y.useState("");y.useEffect(()=>{const Y=n.get("mode");(Y==="view"||Y==="create")&&o(Y)},[n]);const[v,b]=y.useState([]),[x,w]=y.useState([]),[S,C]=y.useState(!0);y.useState(null);const[A,_]=y.useState(new Set),[j,k]=y.useState(!1),[P,I]=y.useState(null),[E,R]=y.useState(""),[L,V]=y.useState(!1),[$,z]=y.useState(null),[M,U]=y.useState(!1),[W,X]=y.useState(null),[re,xe]=y.useState(!1),[F,fe]=y.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]}),[oe,de]=y.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]}),[Re,pe]=y.useState(!1),[Se,Ne]=y.useState(!1),[ne,nt]=y.useState(!1),[Fe,vt]=y.useState(!1),[mt,Bt]=y.useState("gemini-2.5-pro"),N=()=>{pe(!1),Ne(!1),nt(!1)},D=Y=>{const ke={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return Y.forEach(He=>{if(He.age&&ke.age.add(He.age),He.gender&&ke.gender.add(He.gender),He.occupation&&ke.occupation.add(He.occupation),He.location&&ke.location.add(He.location),He.techSavviness!==void 0){const ht=He.techSavviness<30?"Low (0-30)":He.techSavviness<70?"Medium (31-70)":"High (71-100)";ke.techSavviness.add(ht)}He.ethnicity&&ke.ethnicity.add(He.ethnicity)}),{age:Array.from(ke.age).sort(),gender:Array.from(ke.gender).sort(),occupation:Array.from(ke.occupation).sort(),location:Array.from(ke.location).sort(),techSavviness:Array.from(ke.techSavviness).sort((He,ht)=>{const Qe=["Low (0-30)","Medium (31-70)","High (71-100)"];return Qe.indexOf(He)-Qe.indexOf(ht)}),ethnicity:Array.from(ke.ethnicity).sort()}},H=()=>{xe(!1),setTimeout(()=>{fe({...oe})},0)},Q=()=>{de({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]})},J=(Y,ke)=>{de(He=>{const ht={...He};return ht[Y].includes(ke)?ht[Y]=ht[Y].filter(Qe=>Qe!==ke):ht[Y]=[...ht[Y],ke],ht})},B=async()=>{try{const He=(await ds.getAll()).data.map(ht=>({...ht,id:ht._id}));return w(He),He}catch(Y){return console.error("Error fetching folders:",Y),Ye.error("Failed to load folders"),w([]),[]}},ee=async()=>{C(!0);try{const He=(await kr.getAll()).data;{const Qe=[...He.map(gt=>({...gt,id:gt.id||gt._id}))];try{(async()=>{const tn=await r();console.log("Loaded stored personas (for debugging only):",tn?tn.length:0)})()}catch(gt){console.warn("Error loading stored personas:",gt)}b(Qe)}}catch(ke){console.error("Error fetching personas:",ke),Ye.error("Failed to load personas"),b([])}finally{C(!1)}};y.useEffect(()=>((async()=>{try{const[,]=await Promise.all([B(),ee()])}catch(ke){console.error("Error loading data:",ke)}})(),()=>{}),[t]),y.useEffect(()=>{var Y;if(i==="view")ee();else if(i==="create"&&(console.log(`Switching to create mode with folder: ${d}, ${d!==Gn?"NOT default":"IS default"}`),d!==Gn)){const ke=(Y=x.find(He=>He.id===d))==null?void 0:Y.name;console.log(`Selected folder for creation: ${d} (${ke})`)}},[i]),y.useEffect(()=>{ee();const Y=()=>{window.location.pathname.includes("/synthetic-users")&&!window.location.pathname.includes("/synthetic-users/")&&(console.log("Navigation to synthetic users page detected, refreshing data"),ee())},ke=()=>{console.log("Synthetic users navigation event detected, refreshing data"),ee()};console.log("Setting up MutationObserver for body style");const He=new MutationObserver(ht=>{ht.forEach(Qe=>{Qe.type==="attributes"&&Qe.attributeName==="style"&&document.body.style.pointerEvents==="none"&&(console.log("MutationObserver detected pointer-events: none, fixing..."),t())})});return He.observe(document.body,{attributes:!0,attributeFilter:["style"]}),t(),window.addEventListener("popstate",Y),window.addEventListener("syntheticUsersNavigation",ke),()=>{window.removeEventListener("popstate",Y),window.removeEventListener("syntheticUsersNavigation",ke),console.log("Disconnecting MutationObserver"),He.disconnect()}},[]);const me=async()=>{if(!g.trim()){Ye.error("Please enter a folder name");return}try{const Y=await ds.create({name:g.trim(),persona_ids:[]});await B(),m(""),p(!1),Ye.success(`Folder "${g}" created`)}catch(Y){console.error("Error creating folder:",Y),Ye.error("Failed to create folder")}},Ce=()=>{m(""),p(!1)},Me=Y=>{I(Y),R(Y.name)},we=async()=>{if(!P||!E.trim()){I(null);return}try{await ds.update(P._id,{name:E.trim()}),await B(),I(null),Ye.success(`Folder renamed to "${E}"`)}catch(Y){console.error("Error renaming folder:",Y),Ye.error("Failed to rename folder"),I(null)}},We=()=>{I(null),R("")},wt=Y=>{z(Y),V(!0)},Nt=async()=>{if($)try{await ds.delete($._id),await B(),(d===$._id||d===$.id)&&f(Gn),V(!1),z(null),Ye.success(`Folder "${$.name}" deleted`)}catch(Y){console.error("Error deleting folder:",Y),Ye.error("Failed to delete folder")}},Je=async(Y,ke)=>{var tn;const He=Y||A,ht=ke||W;if(!ht||He.size===0)return;const Qe=Array.from(He),gt=Qe.map(rt=>{const mn=v.find(Qt=>Qt.id===rt);return(mn==null?void 0:mn._id)||(mn==null?void 0:mn.id)||rt}).filter(Boolean);try{const rt=[],mn=[];if(ht!==Gn)try{await ds.addPersonasBatch(ht,gt),rt.push(...Qe)}catch(Z){console.error("Error adding personas to folder:",Z),mn.push(...Qe)}else rt.push(...Qe);await Promise.all([B(),ee()]);const Qt=ht===Gn?"All Personas":((tn=x.find(Z=>Z._id===ht||Z.id===ht))==null?void 0:tn.name)||"folder";return rt.length>0&&Ye.success(`Added ${rt.length} persona${rt.length!==1?"s":""} to ${Qt}`),mn.length>0&&Ye.error(`Failed to add ${mn.length} persona${mn.length!==1?"s":""} to ${Qt}.`),Y||_(new Set),{success:rt.length>0,successCount:rt.length,failureCount:mn.length}}catch(rt){return console.error("Error moving personas to folder:",rt),Ye.error("An unexpected error occurred while adding personas to folder."),{success:!1,error:rt}}},Xe=async()=>{var He,ht,Qe;if(A.size===0||d===Gn)return;const Y=Array.from(A),ke=Y.map(gt=>{const tn=v.find(rt=>rt.id===gt);return(tn==null?void 0:tn._id)||(tn==null?void 0:tn.id)||gt}).filter(Boolean);console.log("Removing personas from folder:",{selectedFolder:d,selectedIds:Y,mongoIds:ke,folderName:(He=x.find(gt=>gt._id===d))==null?void 0:He.name});try{await ds.removePersonasBatch(d,ke),await Promise.all([B(),ee()]);const gt=((ht=x.find(tn=>tn._id===d))==null?void 0:ht.name)||"folder";Ye.success(`Removed ${Y.length} persona${Y.length!==1?"s":""} from ${gt}`),_(new Set)}catch(gt){console.error("Error removing personas from folder:",gt),console.error("Error details:",((Qe=gt.response)==null?void 0:Qe.data)||gt.message),Ye.error("Failed to remove personas from folder")}},$t=Y=>{_(ke=>{const He=new Set(ke);return He.has(Y)?He.delete(Y):He.add(Y),He})},Yt=()=>{A.size===Sn.length?_(new Set):_(new Set(Sn.map(Y=>Y.id)))},_r=async()=>{if(A.size===0)return;const Y=Array.from(A);_(new Set),k(!1),C(!0);const ke=[],He=[];for(const ht of Y)try{const Qe=v.find(tn=>tn.id===ht);if(!Qe){console.error(`Could not find persona with id: ${ht}`),He.push(ht);continue}let gt=ht;Qe._id&&(gt=Qe._id.toString()),console.log(`Attempting to delete persona: ${gt}`),await kr.delete(gt),ke.push(ht)}catch(Qe){console.error(`Failed to delete persona ${ht}:`,Qe),He.push(ht)}b(ht=>ht.filter(Qe=>!ke.includes(Qe.id))),await B(),C(!1),setTimeout(()=>{ke.length>0&&Ye.success(`Successfully deleted ${ke.length} persona${ke.length!==1?"s":""}`),He.length>0&&Ye.error(`Failed to delete ${He.length} persona${He.length!==1?"s":""}`),(ke.length>0||He.length>0)&&ee()},50)},Sn=v.filter(Y=>{const ke=Y.name.toLowerCase().includes(c.toLowerCase())||Y.occupation.toLowerCase().includes(c.toLowerCase())||Y.location.toLowerCase().includes(c.toLowerCase()),He=(F.age.length===0||F.age.includes(Y.age))&&(F.gender.length===0||F.gender.includes(Y.gender))&&(F.occupation.length===0||F.occupation.includes(Y.occupation))&&(F.location.length===0||F.location.includes(Y.location))&&(F.ethnicity.length===0||Y.ethnicity&&F.ethnicity.includes(Y.ethnicity))&&(F.techSavviness.length===0||Y.techSavviness!==void 0&&F.techSavviness.includes(Y.techSavviness<30?"Low (0-30)":Y.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&(F.folderStatus.length===0||F.folderStatus.includes("hasFolder")&&F.folderStatus.includes("noFolder")||F.folderStatus.includes("hasFolder")&&!F.folderStatus.includes("noFolder")&&Y.folderId&&Y.folderId!==Gn||F.folderStatus.includes("noFolder")&&!F.folderStatus.includes("hasFolder")&&(!Y.folderId||Y.folderId===Gn));return d===Gn||Y.folder_ids&&Array.isArray(Y.folder_ids)&&Y.folder_ids.includes(d)||Y.folder_id===d||Y.folderId===d?ke&&He:!1}),yt=(Y,ke)=>{const He=new Date().toISOString().split("T")[0],ht=Y.length;let Qe=`# Persona Summary Report -`;return Ye+=`**Folder:** ${Oe} -`,Ye+=`**Date:** ${He} -`,Ye+=`**Total Personas:** ${ht} +`;return Qe+=`**Folder:** ${ke} +`,Qe+=`**Date:** ${He} +`,Qe+=`**Total Personas:** ${ht} -`,ht===0?(Ye+=`No personas found in this folder. -`,Ye):(Y.forEach((gt,tn)=>{Ye+=`## ${gt.name} +`,ht===0?(Qe+=`No personas found in this folder. +`,Qe):(Y.forEach((gt,tn)=>{Qe+=`## ${gt.name} -`,Ye+=`### Demographics -`,Ye+=`- **Age:** ${gt.age} -`,Ye+=`- **Gender:** ${gt.gender} -`,Ye+=`- **Occupation:** ${gt.occupation} -`,Ye+=`- **Location:** ${gt.location} +`,Qe+=`### Demographics +`,Qe+=`- **Age:** ${gt.age} +`,Qe+=`- **Gender:** ${gt.gender} +`,Qe+=`- **Occupation:** ${gt.occupation} +`,Qe+=`- **Location:** ${gt.location} -`,gt.aiSynthesizedBio&&(Ye+=`### AI-Synthesized Bio -`,Ye+=`${gt.aiSynthesizedBio} +`,gt.aiSynthesizedBio&&(Qe+=`### AI-Synthesized Bio +`,Qe+=`${gt.aiSynthesizedBio} -`),gt.qualitativeAttributes&>.qualitativeAttributes.length>0&&(Ye+=`### Key Attributes -`,gt.qualitativeAttributes.forEach(it=>{Ye+=`- 🏷️ ${it} -`}),Ye+=` -`),gt.topPersonalityTraits&>.topPersonalityTraits.length>0&&(Ye+=`### Top Personality Traits -`,gt.topPersonalityTraits.forEach(it=>{Ye+=`- 🧠 ${it} -`}),Ye+=` -`),tn0&&(Qe+=`### Key Attributes +`,gt.qualitativeAttributes.forEach(rt=>{Qe+=`- 🏷️ ${rt} +`}),Qe+=` +`),gt.topPersonalityTraits&>.topPersonalityTraits.length>0&&(Qe+=`### Top Personality Traits +`,gt.topPersonalityTraits.forEach(rt=>{Qe+=`- 🧠 ${rt} +`}),Qe+=` +`),tn{if(Sn.length===0){qe.error("No personas to download");return}vt(!0)},ft=async()=>{var He,ht,Ye,gt,tn;const Y=d===Gn?"All Personas":((He=x.find(it=>it.id===d))==null?void 0:He.name)||"Unknown Folder",Oe=Sn.map(it=>it._id||it.id);console.log(`🤖 Frontend: User selected ${mt} for persona summary download`),vt(!1),pe(!0),Te(!1),rt(!1),C(!0);try{qe.info("Generating persona summaries...",{description:`Processing ${Sn.length} persona${Sn.length!==1?"s":""} with AI`});const it=await Ks.batchGenerateSummaries(Oe,.7,mt),{summaries:pn,summary_stats:Qt,errors:J}=it.data,oe=new Date().toISOString().split("T")[0],O=`persona-summary-${Y.toLowerCase().replace(/\s+/g,"-")}-${oe}.md`;let q=`# Persona Summary Report +`)}),Qe)},qe=async()=>{if(Sn.length===0){Ye.error("No personas to download");return}vt(!0)},ft=async()=>{var He,ht,Qe,gt,tn;const Y=d===Gn?"All Personas":((He=x.find(rt=>rt.id===d))==null?void 0:He.name)||"Unknown Folder",ke=Sn.map(rt=>rt._id||rt.id);console.log(`🤖 Frontend: User selected ${mt} for persona summary download`),vt(!1),pe(!0),Ne(!1),nt(!1),C(!0);try{Ye.info("Generating persona summaries...",{description:`Processing ${Sn.length} persona${Sn.length!==1?"s":""} with AI`});const rt=await Ks.batchGenerateSummaries(ke,.7,mt),{summaries:mn,summary_stats:Qt,errors:Z}=rt.data,se=new Date().toISOString().split("T")[0],O=`persona-summary-${Y.toLowerCase().replace(/\s+/g,"-")}-${se}.md`;let q=`# Persona Summary Report `;q+=`**Folder:** ${Y} -`,q+=`**Date:** ${oe} +`,q+=`**Date:** ${se} `,q+=`**Total Personas:** ${Qt.total_requested} `,q+=`**Successfully Processed:** ${Qt.total_successful} `,Qt.total_failed>0&&(q+=`**Failed to Process:** ${Qt.total_failed} `),q+=` --- -`,pn.length===0?q+=`No persona summaries could be generated. -`:pn.forEach((Ee,be)=>{q+=`# ${Ee.persona_name} +`,mn.length===0?q+=`No persona summaries could be generated. +`:mn.forEach((De,be)=>{q+=`# ${De.persona_name} -`,q+=`${Ee.summary} +`,q+=`${De.summary} -`,be0||((Ye=J.missing_personas)==null?void 0:Ye.length)>0)&&(q+=` +`)}),Z&&(((ht=Z.failed_summaries)==null?void 0:ht.length)>0||((Qe=Z.missing_personas)==null?void 0:Qe.length)>0)&&(q+=` --- ## Processing Errors -`,((gt=J.failed_summaries)==null?void 0:gt.length)>0&&(q+=`### Failed to Generate Summaries -`,J.failed_summaries.forEach(Ee=>{q+=`- **${Ee.persona_name}** (ID: ${Ee.persona_id}): ${Ee.error} +`,((gt=Z.failed_summaries)==null?void 0:gt.length)>0&&(q+=`### Failed to Generate Summaries +`,Z.failed_summaries.forEach(De=>{q+=`- **${De.persona_name}** (ID: ${De.persona_id}): ${De.error} `}),q+=` -`),((tn=J.missing_personas)==null?void 0:tn.length)>0&&(q+=`### Missing Personas -`,J.missing_personas.forEach(Ee=>{q+=`- ID: ${Ee} -`})));const W=document.createElement("a"),he=new Blob([q],{type:"text/markdown"});W.href=URL.createObjectURL(he),W.download=O,document.body.appendChild(W),W.click(),document.body.removeChild(W),Te(!0);const fe=mt==="gpt-4.1"?"GPT-4.1":"Gemini 2.5 Pro";Qt.total_successful===Qt.total_requested?qe.success("Persona summary downloaded",{description:`Successfully processed all ${Qt.total_successful} persona${Qt.total_successful!==1?"s":""} from "${Y}" using ${fe}`}):qe.success("Persona summary downloaded with warnings",{description:`Processed ${Qt.total_successful} of ${Qt.total_requested} personas from "${Y}" using ${fe}`})}catch(it){console.error("Error generating persona summaries:",it),it.response?(console.error("Error response data:",it.response.data),console.error("Error response status:",it.response.status),console.error("Error response headers:",it.response.headers)):it.request?console.error("Error request:",it.request):console.error("Error message:",it.message),rt(!0),qe.error("AI summary generation failed, creating basic summary",{description:"Using simplified format due to processing error"});try{const pn=new Date().toISOString().split("T")[0],Qt=`persona-summary-basic-${Y.toLowerCase().replace(/\s+/g,"-")}-${pn}.md`,J=yt(Sn,Y),oe=document.createElement("a"),O=new Blob([J],{type:"text/markdown"});oe.href=URL.createObjectURL(O),oe.download=Qt,document.body.appendChild(oe),oe.click(),document.body.removeChild(oe)}catch{qe.error("Failed to create persona summary",{description:"Unable to generate summary in any format"})}}finally{C(!1)}};return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(aa,{}),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:[i==="view"&&Sn.length>0&&a.jsxs(te,{variant:"outline",onClick:Xe,disabled:Me,className:"flex items-center gap-2 hover-transition",children:[a.jsx(zc,{className:"h-4 w-4"}),Me?"Generating Summary...":"Download Persona Summary"]}),a.jsx(te,{onClick:()=>o(i==="view"?"create":"view"),className:"hover-transition",children:i==="view"?"Create New Personas":"View All Personas"})]})})]}),i==="view"&&Sn.length>0&&Me&&a.jsx("div",{className:"mb-6",children:a.jsx(nT,{isActive:Me,isComplete:Se,hasError:ne,label:"Generating comprehensive persona summaries",onComplete:N,className:"max-w-4xl mx-auto"})}),i==="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(te,{variant:"ghost",size:"sm",onClick:()=>p(!0),className:"h-7 w-7 p-0",children:a.jsx(d4,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("button",{onClick:()=>f(Gn),className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${d===Gn?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Ji,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),x.map(Y=>a.jsx("div",{className:"flex items-center justify-between group",children:P&&P._id===Y._id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(Ji,{className:"h-4 w-4"}),a.jsx(Dt,{value:E,onChange:Oe=>I(Oe.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:Oe=>{Oe.key==="Enter"?we():Oe.key==="Escape"&&We()}}),a.jsx(te,{size:"sm",variant:"ghost",onClick:we,className:"h-7 w-7 p-0",children:a.jsx(Ts,{className:"h-4 w-4"})}),a.jsx(te,{size:"sm",variant:"ghost",onClick:We,className:"h-7 w-7 p-0",children:a.jsx($o,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>f(Y._id),className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${d===Y._id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Ji,{className:"h-4 w-4"}),a.jsx("span",{children:Y.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:v.filter(Oe=>Oe.folder_ids&&Oe.folder_ids.includes(Y._id)).length})]}),a.jsxs(Y1,{children:[a.jsx(Q1,{asChild:!0,children:a.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(s1,{className:"h-4 w-4"})})}),a.jsxs(nx,{align:"end",children:[a.jsx(Ba,{onClick:()=>De(Y),children:"Rename"}),a.jsx(Ba,{className:"text-red-600",onClick:()=>St(Y),children:"Delete"})]})]})]})},Y._id)),h&&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(Ji,{className:"h-4 w-4"}),a.jsx(Dt,{value:g,onChange:Y=>m(Y.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:Y=>{Y.key==="Enter"?me():Y.key==="Escape"&&Ce()}})]}),a.jsx(te,{size:"sm",variant:"ghost",onClick:me,className:"h-7 w-7 p-0",children:a.jsx(Ts,{className:"h-4 w-4"})}),a.jsx(te,{size:"sm",variant:"ghost",onClick:Ce,className:"h-7 w-7 p-0",children:a.jsx($o,{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(Qj,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Dt,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:c,onChange:Y=>u(Y.target.value)})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[A.size>0&&a.jsxs(Y1,{children:[a.jsx(Q1,{asChild:!0,children:a.jsxs(te,{variant:"outline",size:"sm",className:"flex items-center gap-2",onClick:Y=>{Y.stopPropagation()},children:[a.jsxs("span",{children:["Actions (",A.size,")"]}),a.jsx(s1,{className:"h-4 w-4"})]})}),a.jsxs(nx,{align:"end",onCloseAutoFocus:Y=>{Y.preventDefault()},children:[a.jsxs(Ba,{className:"flex items-center gap-2 cursor-pointer",onClick:Y=>{Y.preventDefault(),Y.stopPropagation();const Oe=Array.from(A);e("/focus-groups",{state:{mode:"create",preSelectedParticipants:Oe}})},children:[a.jsx(Ps,{className:"h-4 w-4"}),"Create Focus Group with selected Personas"]}),a.jsxs(Ba,{className:"flex items-center gap-2 cursor-pointer",onClick:Y=>{Y.preventDefault(),Y.stopPropagation(),k(!0)},children:[a.jsx(Kn,{className:"h-4 w-4"}),"Delete"]}),a.jsxs(Ba,{className:"flex items-center gap-2 cursor-pointer",onClick:Y=>{Y.preventDefault(),Y.stopPropagation(),U(!0)},children:[a.jsx(Ji,{className:"h-4 w-4"}),"Move to folder"]}),d!==Gn&&a.jsxs(Ba,{className:"flex items-center gap-2 cursor-pointer",onClick:Y=>{Y.preventDefault(),Y.stopPropagation(),Qe()},children:[a.jsx($o,{className:"h-4 w-4"}),"Remove from ",((Vt=x.find(Y=>Y._id===d))==null?void 0:Vt.name)||"folder"]})]})]}),a.jsxs(te,{variant:"outline",className:"flex items-center gap-2",onClick:()=>xe(!0),children:[a.jsx(qj,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(F).some(Y=>Y.length>0)?` (${Object.values(F).reduce((Y,Oe)=>Y+Oe.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(Cr,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:d===Gn?"Your Synthetic Persona Library":((vn=x.find(Y=>Y._id===d))==null?void 0:vn.name)||"Personas"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",Sn.length,")"]})]}),Sn.length>0&&a.jsxs("div",{className:"flex items-center",children:[a.jsx(vc,{id:"select-all",checked:Sn.length>0&&A.size===Sn.length,onCheckedChange:Yt,className:"mr-2"}),a.jsx("label",{htmlFor:"select-all",className:"text-sm cursor-pointer",children:"Select All"})]})]}),Sn.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:Sn.map(Y=>a.jsx("div",{className:"relative group",children:a.jsx(_N,{user:Y,selected:A.has(Y.id),onClick:()=>e(`/synthetic-users/${Y._id||Y.id}`),onSelectionToggle:Oe=>{Oe.stopPropagation(),$t(Y.id)},showAddToFolderButton:!1,folders:x})},Y.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:j,onOpenChange:Y=>{k(Y||!1)},children:a.jsxs(ix,{onInteractOutside:Y=>{Y.preventDefault()},children:[a.jsxs(ox,{children:[a.jsx(ax,{children:"Delete Personas"}),a.jsxs(lx,{children:["Are you sure you want to delete ",A.size," selected persona",A.size!==1?"s":"","? This action cannot be undone."]})]}),a.jsxs(sx,{children:[a.jsx(ux,{onClick:()=>{setTimeout(()=>_(new Set),50)},children:"Cancel"}),a.jsx(cx,{onClick:_r,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(X1,{open:L,onOpenChange:Y=>{V(Y||!1)},children:a.jsxs(ix,{children:[a.jsxs(ox,{children:[a.jsx(ax,{children:"Delete Folder"}),a.jsxs(lx,{children:['Are you sure you want to delete the folder "',$==null?void 0:$.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(sx,{children:[a.jsx(ux,{children:"Cancel"}),a.jsx(cx,{onClick:Tt,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(kc,{open:M,onOpenChange:Y=>{U(Y||!1)},children:a.jsxs(xl,{className:"z-50",children:[a.jsxs(bl,{children:[a.jsx(Sl,{children:"Move to Folder"}),a.jsxs(Oc,{children:["Choose a folder to move ",A.size," selected persona",A.size!==1?"s":""," to."]})]}),a.jsx("div",{className:"py-4",children:a.jsxs(Z1,{value:K||"",onValueChange:X,className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Nh,{value:Gn,id:"folder-all"}),a.jsxs(to,{htmlFor:"folder-all",className:"flex items-center gap-2",children:[a.jsx(Ji,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas (Remove from folders)"})]})]}),x.map(Y=>a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Nh,{value:Y._id,id:`folder-${Y._id}`}),a.jsxs(to,{htmlFor:`folder-${Y._id}`,className:"flex items-center gap-2",children:[a.jsx(Ji,{className:"h-4 w-4"}),a.jsx("span",{children:Y.name})]})]},Y._id))]})}),a.jsxs(wl,{children:[a.jsx(te,{variant:"outline",onClick:Y=>{Y.preventDefault(),Y.stopPropagation(),U(!1),X(null)},children:"Cancel"}),a.jsx(te,{onClick:async Y=>{if(Y.preventDefault(),Y.stopPropagation(),!K)return;const Oe=new Set(A),He=K;if(U(!1),X(null),He&&Oe.size>0){C(!0);try{await Ze(Oe,He)}finally{C(!1),_(new Set)}}},disabled:!K,children:"Move"})]})]})}),a.jsx(kc,{open:re,onOpenChange:Y=>{Y?(xe(Y),ce({...F})):(A.size>0&&_(new Set),xe(!1))},children:a.jsxs(xl,{className:"max-w-4xl max-h-[80vh] flex flex-col",onInteractOutside:Y=>{Y.preventDefault()},children:[a.jsx("div",{className:"sticky top-0 bg-background border-b shadow-sm pb-4 z-10",children:a.jsxs(bl,{children:[a.jsx(Sl,{children:"Filter Personas"}),a.jsx(Oc,{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(ie).some(Y=>Y.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(ie).reduce((Y,Oe)=>Y+Oe.length,0)," active filters"]})}),a.jsx("div",{className:"space-y-4",children:(()=>{const Y=Ye=>{const gt={...ie};gt[Ye]=[];const tn=v.filter(it=>Object.entries(gt).every(([pn,Qt])=>{if(Qt.length===0)return!0;const J=pn;if(J==="techSavviness"&&it.techSavviness!==void 0){const oe=it.techSavviness<30?"Low (0-30)":it.techSavviness<70?"Medium (31-70)":"High (71-100)";return Qt.includes(oe)}else{if(J==="age"&&it.age)return Qt.includes(it.age);if(J==="gender"&&it.gender)return Qt.includes(it.gender);if(J==="occupation"&&it.occupation)return Qt.includes(it.occupation);if(J==="location"&&it.location)return Qt.includes(it.location);if(J==="ethnicity"&&it.ethnicity)return Qt.includes(it.ethnicity)}return!0}));return D(tn)},Oe=Object.values(ie).every(Ye=>Ye.length===0),He=D(v),ht=(Ye,gt,tn,it=1)=>{const pn=ie[gt],Qt=[...new Set([...tn,...pn])].sort();return Qt.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:Ye}),a.jsx("div",{className:`grid grid-cols-1 ${it===2?"sm:grid-cols-2":it===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:Qt.map(J=>{const oe=ie[gt].includes(J),O=tn.includes(J);return a.jsxs("div",{className:`flex items-center space-x-2 ${!O&&!oe?"opacity-50":""}`,children:[a.jsx(vc,{id:`${gt}-${J}`,checked:oe,onCheckedChange:()=>Z(gt,J),disabled:!O&&!oe}),a.jsxs(to,{htmlFor:`${gt}-${J}`,className:"truncate overflow-hidden",children:[J,oe&&!O&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},J)})})]})};return a.jsxs(a.Fragment,{children:[ht("Gender","gender",Oe?He.gender:Y("gender").gender,3),ht("Age","age",Oe?He.age:Y("age").age,3),ht("Ethnicity","ethnicity",Oe?He.ethnicity:Y("ethnicity").ethnicity,2),ht("Location","location",Oe?He.location:Y("location").location,2),ht("Occupation","occupation",Oe?He.occupation:Y("occupation").occupation,2),ht("Tech Savviness","techSavviness",Oe?He.techSavviness:Y("techSavviness").techSavviness,3),a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:"Folder Assignment"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(vc,{id:"folderStatus-hasFolder",checked:ie.folderStatus.includes("hasFolder"),onCheckedChange:()=>Z("folderStatus","hasFolder")}),a.jsx(to,{htmlFor:"folderStatus-hasFolder",className:"truncate overflow-hidden",children:"Has folder assignment"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(vc,{id:"folderStatus-noFolder",checked:ie.folderStatus.includes("noFolder"),onCheckedChange:()=>Z("folderStatus","noFolder")}),a.jsx(to,{htmlFor:"folderStatus-noFolder",className:"truncate overflow-hidden",children:"No folder assignment"})]})]})]}),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(wl,{children:[a.jsx(te,{variant:"outline",onClick:Q,children:"Reset"}),a.jsx(te,{onClick:H,children:"Apply Filters"})]})})]})}),a.jsx(kc,{open:Fe,onOpenChange:vt,children:a.jsxs(xl,{children:[a.jsxs(bl,{children:[a.jsx(Sl,{children:"Select AI Model for Summary Generation"}),a.jsx(Oc,{children:"Choose which AI model to use for generating persona summaries"})]}),a.jsx("div",{className:"py-4",children:a.jsxs(Z1,{value:mt,onValueChange:Bt,className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Nh,{value:"gemini-2.5-pro",id:"download-gemini"}),a.jsx(to,{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(Nh,{value:"gpt-4.1",id:"download-gpt"}),a.jsx(to,{htmlFor:"download-gpt",className:"text-sm font-medium",children:"GPT-4.1"})]})]})}),a.jsxs(wl,{children:[a.jsx(te,{variant:"outline",onClick:()=>vt(!1),children:"Cancel"}),a.jsx(te,{onClick:ft,children:"Generate Summary"})]})]})})]})]})}):a.jsxs(Kl,{defaultValue:"ai",onValueChange:Y=>l(Y),children:[a.jsxs(Ea,{className:"grid w-full grid-cols-2 mb-6",children:[a.jsx(on,{value:"ai",children:"AI Recruiter"}),a.jsx(on,{value:"manual",children:"Manual Creation"})]}),a.jsxs(sn,{value:"ai",children:[console.log(`Rendering AIRecruiter with targetFolderId: ${d!==Gn?d:"null"}`),console.log("Current folders:",x.map(Y=>({id:Y.id,name:Y.name}))),a.jsx(Qse,{targetFolderId:d!==Gn?d:null,targetFolderName:d!==Gn?(Wi=x.find(Y=>Y.id===d))==null?void 0:Wi.name:null})]}),a.jsx(sn,{value:"manual",children:a.jsx(Uae,{targetFolderId:d!==Gn?d:null,targetFolderName:d!==Gn?(Ls=x.find(Y=>Y.id===d))==null?void 0:Ls.name:null})})]})]})]})},az=y.createContext(void 0),CS="synthetic-society-navigation-state",Uce=({children:t})=>{const[e,n]=y.useState(()=>{try{const o=localStorage.getItem(CS);return o?JSON.parse(o):{}}catch{return{}}});y.useEffect(()=>{localStorage.setItem(CS,JSON.stringify(e))},[e]);const r=(o,s)=>{n({...e,previousRoute:o,...s})},i=()=>{n({}),localStorage.removeItem(CS)};return a.jsx(az.Provider,{value:{navigationState:e,setNavigationState:n,clearNavigationState:i,setPreviousRoute:r},children:t})},T0=()=>{const t=y.useContext(az);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t},Bce=uN("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function ur({className:t,variant:e,...n}){return a.jsx("div",{className:ke(Bce({variant:e}),t),...n})}const rT=T.memo(t=>{const{discussionGuide:e,moderatorStatus:n,onSectionSelect:r,onSetPosition:i,onSave:o,showProgress:s=!0,collapsible:l=!0,defaultExpanded:c=!1,className:u,onDownload:d,isDownloading:f=!1,focusGroupId:h,onEditingChange:p}=t,g=typeof e=="string",m=y.useMemo(()=>g?null:e,[e,g]),[v,b]=y.useState(new Set),[x,w]=y.useState(null),[S,C]=y.useState(null),[A,_]=y.useState(!1),[j,k]=y.useState(null),[P,R]=y.useState("");y.useEffect(()=>{p&&p(!!x)},[x,p]),y.useEffect(()=>{if(x&&m){const N=m.sections.find(D=>D.id===x);N&&!S&&C({...N})}},[m,x,S]);const E=N=>{w(N.id),C({...N}),b(D=>new Set(D).add(N.id))},I=()=>{w(null),C(null)},L=y.useCallback(N=>{C(D=>D&&{...D,...N})},[]),V=y.useCallback((N,D,H)=>{C(Q=>{if(!Q)return Q;const Z={...Q};if(H==="question"&&Z.questions){if(Z.questions.findIndex(ee=>ee.id===N)!==-1)return Z.questions=Z.questions.map(ee=>ee.id===N?{...ee,...D}:ee),Z}else if(H==="activity"&&Z.activities&&Z.activities.findIndex(ee=>ee.id===N)!==-1)return Z.activities=Z.activities.map(ee=>ee.id===N?{...ee,...D}:ee),Z;return Z.subsections&&(Z.subsections=Z.subsections.map(B=>{const ee={...B};return H==="question"&&ee.questions?ee.questions.findIndex(Ce=>Ce.id===N)!==-1&&(ee.questions=ee.questions.map(Ce=>Ce.id===N?{...Ce,...D}:Ce)):H==="activity"&&ee.activities&&ee.activities.findIndex(Ce=>Ce.id===N)!==-1&&(ee.activities=ee.activities.map(Ce=>Ce.id===N?{...Ce,...D}:Ce)),ee})),Z})},[]),$=N=>{if(!S)return;const D={id:`${N}-${Date.now()}`,content:`New ${N}`,type:N==="question"?"open_ended":"discussion",time_limit:void 0},H={...S};N==="question"?H.questions=[...H.questions||[],D]:H.activities=[...H.activities||[],D],C(H)},z=(N,D)=>{if(!S||!S.subsections)return;const H={id:`${D}-${Date.now()}`,content:`New ${D}`,type:D==="question"?"open_ended":"discussion",time_limit:void 0},Q=[...S.subsections],Z={...Q[N]};D==="question"?Z.questions=[...Z.questions||[],H]:Z.activities=[...Z.activities||[],H],Q[N]=Z,C(B=>B&&{...B,subsections:Q})},M=()=>{if(!S)return;const N={id:`subsection-${Date.now()}`,title:"New Subsection",questions:[],activities:[]},D=[...S.subsections||[],N];C(H=>H&&{...H,subsections:D})},U=N=>{if(!S||!S.subsections)return;const D=S.subsections.filter((H,Q)=>Q!==N);C(H=>H&&{...H,subsections:D})},K=(N,D)=>{var Q,Z;if(!S)return;const H={...S};D==="question"?H.questions=(Q=H.questions)==null?void 0:Q.filter(B=>B.id!==N):H.activities=(Z=H.activities)==null?void 0:Z.filter(B=>B.id!==N),C(H)},X=async()=>{if(!(!S||!m||!o)){_(!0);try{const N={...m,sections:m.sections.map(D=>D.id===x?S:D)};await o(N),I(),se.success("Section updated successfully")}catch(N){console.error("Error saving section:",N),se.error("Failed to save section")}finally{_(!1)}}},re=N=>{b(D=>{const H=new Set(D);return H.has(N)?H.delete(N):H.add(N),H})};y.useEffect(()=>{m&&m.sections.length>0&&b(c?new Set(m.sections.map(N=>N.id)):new Set)},[c,m]);const xe=(N,D,H,Q)=>{if(!n||n.legacy_format)return null;const Z=n.moderator_position;if(Z.section_index!==N)return Z.section_index>N?"completed":null;if(Q!==void 0){if(Z.subsection_index===void 0)return null;if(Z.subsection_index!==Q)return Z.subsection_index>Q?"completed":null}else if(Z.subsection_index!==void 0)return"completed";return Z.item_type!==H?H==="activity"&&Z.item_type==="question"?"completed":null:Z.item_index===D?"current":Z.item_index>D?"completed":null},F=(N,D)=>N===`New ${D}`,ue=y.useCallback((N,D,H)=>{if(D<0||D>=N.length||H<0||H>=N.length)return N;const Q=[...N],[Z]=Q.splice(D,1);return Q.splice(H,0,Z),Q},[]),ie=y.useCallback((N,D)=>D>0,[]),ce=y.useCallback((N,D)=>D{if(!S||!S.subsections)return;const D=S.subsections;if(ie(D,N)){const H=ue(D,N,N-1);C(Q=>Q&&{...Q,subsections:H})}},[S,ie,ue]),pe=y.useCallback(N=>{if(!S||!S.subsections)return;const D=S.subsections;if(ce(D,N)){const H=ue(D,N,N+1);C(Q=>Q&&{...Q,subsections:H})}},[S,ce,ue]),Se=y.useCallback((N,D)=>{k(N),R(D)},[]),Te=y.useCallback(()=>{k(null),R("")},[]),ne=y.useCallback(()=>{if(!j||!S||!S.subsections)return;const N=S.subsections.map(D=>D.id===j?{...D,title:P.trim()}:D);C(D=>D&&{...D,subsections:N}),Te()},[j,S,P,Te]),rt=y.useCallback((N,D,H,Q)=>{if(!S)return;const Z=D==="question"?"questions":"activities";if(Q!==void 0){const B=S.subsections||[];if(Q>=0&&Qwe&&{...we,subsections:De})}}}else{const B=S[Z]||[];if(ie(B,H)){const ee=ue(B,H,H-1);C(me=>me&&{...me,[Z]:ee})}}},[S,ie,ue]),Fe=y.useCallback((N,D,H,Q)=>{if(!S)return;const Z=D==="question"?"questions":"activities";if(Q!==void 0){const B=S.subsections||[];if(Q>=0&&Qwe&&{...we,subsections:De})}}}else{const B=S[Z]||[];if(ce(B,H)){const ee=ue(B,H,H+1);C(me=>me&&{...me,[Z]:ee})}}},[S,ce,ue]),vt=(N,D,H,Q,Z)=>{var Tt,Ze,Qe,$t,Yt,_r,Sn,yt,Xe;const B=m==null?void 0:m.sections[D],ee=x===(B==null?void 0:B.id),me=xe(D,H,Q,Z),Ce=me==="current",De=me==="completed",We=(ft=>{const Vt=ft.match(/['"`]([^'"`]*fg-[^'"`]*\.(jpe?g|png|gif|webp))['"`]/i);return Vt?Vt[1]:null})(N.content),St=F(N.content,Q);return ee?a.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border bg-white border-blue-200",children:[a.jsxs("div",{className:"flex-shrink-0 flex flex-col gap-1",children:[a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>rt(N.id,Q,H,Z),disabled:(()=>{if(Z!==void 0){const Vt=((S==null?void 0:S.subsections)||[])[Z],vn=(Vt==null?void 0:Vt[Q==="question"?"questions":"activities"])||[];return!ie(vn,H)}else{const ft=(S==null?void 0:S[Q==="question"?"questions":"activities"])||[];return!ie(ft,H)}})(),className:"h-6 w-6 p-0",title:"Move item up",children:a.jsx(Hc,{className:"h-3 w-3"})}),a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Fe(N.id,Q,H,Z),disabled:(()=>{if(Z!==void 0){const Vt=((S==null?void 0:S.subsections)||[])[Z],vn=(Vt==null?void 0:Vt[Q==="question"?"questions":"activities"])||[];return!ce(vn,H)}else{const ft=(S==null?void 0:S[Q==="question"?"questions":"activities"])||[];return!ce(ft,H)}})(),className:"h-6 w-6 p-0",title:"Move item down",children:a.jsx(va,{className:"h-3 w-3"})})]}),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(ur,{variant:"outline",className:"text-xs",children:Q==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(Qs,{className:"h-3 w-3 mr-1"}),typeof N.type=="string"?N.type.replace("_"," "):String(N.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(us,{className:"h-3 w-3 mr-1"}),typeof N.type=="string"?N.type.replace("_"," "):String(N.type||"unknown")]})}),N.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500",children:[a.jsx(Ap,{className:"h-3 w-3"}),a.jsx(Dt,{type:"number",value:N.time_limit,onChange:ft=>V(N.id,{time_limit:parseInt(ft.target.value)||void 0},Q),className:"w-16 h-6 text-xs",placeholder:"min"}),"min"]})]}),a.jsx(ct,{value:St?"":N.content,onChange:ft=>V(N.id,{content:ft.target.value},Q),placeholder:St?N.content:"Enter content...",className:"min-h-[60px]"}),Q==="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(ct,{value:((Tt=N.probes)==null?void 0:Tt.join(` +`),((tn=Z.missing_personas)==null?void 0:tn.length)>0&&(q+=`### Missing Personas +`,Z.missing_personas.forEach(De=>{q+=`- ID: ${De} +`})));const K=document.createElement("a"),le=new Blob([q],{type:"text/markdown"});K.href=URL.createObjectURL(le),K.download=O,document.body.appendChild(K),K.click(),document.body.removeChild(K),Ne(!0);const ue=mt==="gpt-4.1"?"GPT-4.1":"Gemini 2.5 Pro";Qt.total_successful===Qt.total_requested?Ye.success("Persona summary downloaded",{description:`Successfully processed all ${Qt.total_successful} persona${Qt.total_successful!==1?"s":""} from "${Y}" using ${ue}`}):Ye.success("Persona summary downloaded with warnings",{description:`Processed ${Qt.total_successful} of ${Qt.total_requested} personas from "${Y}" using ${ue}`})}catch(rt){console.error("Error generating persona summaries:",rt),rt.response?(console.error("Error response data:",rt.response.data),console.error("Error response status:",rt.response.status),console.error("Error response headers:",rt.response.headers)):rt.request?console.error("Error request:",rt.request):console.error("Error message:",rt.message),nt(!0),Ye.error("AI summary generation failed, creating basic summary",{description:"Using simplified format due to processing error"});try{const mn=new Date().toISOString().split("T")[0],Qt=`persona-summary-basic-${Y.toLowerCase().replace(/\s+/g,"-")}-${mn}.md`,Z=yt(Sn,Y),se=document.createElement("a"),O=new Blob([Z],{type:"text/markdown"});se.href=URL.createObjectURL(O),se.download=Qt,document.body.appendChild(se),se.click(),document.body.removeChild(se)}catch{Ye.error("Failed to create persona summary",{description:"Unable to generate summary in any format"})}}finally{C(!1)}};return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(aa,{}),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:[i==="view"&&Sn.length>0&&a.jsxs(te,{variant:"outline",onClick:qe,disabled:Re,className:"flex items-center gap-2 hover-transition",children:[a.jsx(zc,{className:"h-4 w-4"}),Re?"Generating Summary...":"Download Persona Summary"]}),a.jsx(te,{onClick:()=>o(i==="view"?"create":"view"),className:"hover-transition",children:i==="view"?"Create New Personas":"View All Personas"})]})})]}),i==="view"&&Sn.length>0&&Re&&a.jsx("div",{className:"mb-6",children:a.jsx(tT,{isActive:Re,isComplete:Se,hasError:ne,label:"Generating comprehensive persona summaries",onComplete:N,className:"max-w-4xl mx-auto"})}),i==="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(te,{variant:"ghost",size:"sm",onClick:()=>p(!0),className:"h-7 w-7 p-0",children:a.jsx(u4,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("button",{onClick:()=>f(Gn),className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${d===Gn?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Zi,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),x.map(Y=>a.jsx("div",{className:"flex items-center justify-between group",children:P&&P._id===Y._id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(Zi,{className:"h-4 w-4"}),a.jsx(Dt,{value:E,onChange:ke=>R(ke.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:ke=>{ke.key==="Enter"?we():ke.key==="Escape"&&We()}}),a.jsx(te,{size:"sm",variant:"ghost",onClick:we,className:"h-7 w-7 p-0",children:a.jsx(Ts,{className:"h-4 w-4"})}),a.jsx(te,{size:"sm",variant:"ghost",onClick:We,className:"h-7 w-7 p-0",children:a.jsx($o,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>f(Y._id),className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${d===Y._id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Zi,{className:"h-4 w-4"}),a.jsx("span",{children:Y.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:v.filter(ke=>ke.folder_ids&&ke.folder_ids.includes(Y._id)).length})]}),a.jsxs(q1,{children:[a.jsx(Y1,{asChild:!0,children:a.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(o1,{className:"h-4 w-4"})})}),a.jsxs(tx,{align:"end",children:[a.jsx(Ba,{onClick:()=>Me(Y),children:"Rename"}),a.jsx(Ba,{className:"text-red-600",onClick:()=>wt(Y),children:"Delete"})]})]})]})},Y._id)),h&&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(Zi,{className:"h-4 w-4"}),a.jsx(Dt,{value:g,onChange:Y=>m(Y.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:Y=>{Y.key==="Enter"?me():Y.key==="Escape"&&Ce()}})]}),a.jsx(te,{size:"sm",variant:"ghost",onClick:me,className:"h-7 w-7 p-0",children:a.jsx(Ts,{className:"h-4 w-4"})}),a.jsx(te,{size:"sm",variant:"ghost",onClick:Ce,className:"h-7 w-7 p-0",children:a.jsx($o,{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(Yj,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Dt,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:c,onChange:Y=>u(Y.target.value)})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[A.size>0&&a.jsxs(q1,{children:[a.jsx(Y1,{asChild:!0,children:a.jsxs(te,{variant:"outline",size:"sm",className:"flex items-center gap-2",onClick:Y=>{Y.stopPropagation()},children:[a.jsxs("span",{children:["Actions (",A.size,")"]}),a.jsx(o1,{className:"h-4 w-4"})]})}),a.jsxs(tx,{align:"end",onCloseAutoFocus:Y=>{Y.preventDefault()},children:[a.jsxs(Ba,{className:"flex items-center gap-2 cursor-pointer",onClick:Y=>{Y.preventDefault(),Y.stopPropagation();const ke=Array.from(A);e("/focus-groups",{state:{mode:"create",preSelectedParticipants:ke}})},children:[a.jsx(Ps,{className:"h-4 w-4"}),"Create Focus Group with selected Personas"]}),a.jsxs(Ba,{className:"flex items-center gap-2 cursor-pointer",onClick:Y=>{Y.preventDefault(),Y.stopPropagation(),k(!0)},children:[a.jsx(Kn,{className:"h-4 w-4"}),"Delete"]}),a.jsxs(Ba,{className:"flex items-center gap-2 cursor-pointer",onClick:Y=>{Y.preventDefault(),Y.stopPropagation(),U(!0)},children:[a.jsx(Zi,{className:"h-4 w-4"}),"Move to folder"]}),d!==Gn&&a.jsxs(Ba,{className:"flex items-center gap-2 cursor-pointer",onClick:Y=>{Y.preventDefault(),Y.stopPropagation(),Xe()},children:[a.jsx($o,{className:"h-4 w-4"}),"Remove from ",((Vt=x.find(Y=>Y._id===d))==null?void 0:Vt.name)||"folder"]})]})]}),a.jsxs(te,{variant:"outline",className:"flex items-center gap-2",onClick:()=>xe(!0),children:[a.jsx(Wj,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(F).some(Y=>Y.length>0)?` (${Object.values(F).reduce((Y,ke)=>Y+ke.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(Cr,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:d===Gn?"Your Synthetic Persona Library":((un=x.find(Y=>Y._id===d))==null?void 0:un.name)||"Personas"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",Sn.length,")"]})]}),Sn.length>0&&a.jsxs("div",{className:"flex items-center",children:[a.jsx(vc,{id:"select-all",checked:Sn.length>0&&A.size===Sn.length,onCheckedChange:Yt,className:"mr-2"}),a.jsx("label",{htmlFor:"select-all",className:"text-sm cursor-pointer",children:"Select All"})]})]}),Sn.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:Sn.map(Y=>a.jsx("div",{className:"relative group",children:a.jsx(AN,{user:Y,selected:A.has(Y.id),onClick:()=>e(`/synthetic-users/${Y._id||Y.id}`),onSelectionToggle:ke=>{ke.stopPropagation(),$t(Y.id)},showAddToFolderButton:!1,folders:x})},Y.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(Q1,{open:j,onOpenChange:Y=>{k(Y||!1)},children:a.jsxs(rx,{onInteractOutside:Y=>{Y.preventDefault()},children:[a.jsxs(ix,{children:[a.jsx(sx,{children:"Delete Personas"}),a.jsxs(ax,{children:["Are you sure you want to delete ",A.size," selected persona",A.size!==1?"s":"","? This action cannot be undone."]})]}),a.jsxs(ox,{children:[a.jsx(cx,{onClick:()=>{setTimeout(()=>_(new Set),50)},children:"Cancel"}),a.jsx(lx,{onClick:_r,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(Q1,{open:L,onOpenChange:Y=>{V(Y||!1)},children:a.jsxs(rx,{children:[a.jsxs(ix,{children:[a.jsx(sx,{children:"Delete Folder"}),a.jsxs(ax,{children:['Are you sure you want to delete the folder "',$==null?void 0:$.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(ox,{children:[a.jsx(cx,{children:"Cancel"}),a.jsx(lx,{onClick:Nt,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(kc,{open:M,onOpenChange:Y=>{U(Y||!1)},children:a.jsxs(xl,{className:"z-50",children:[a.jsxs(bl,{children:[a.jsx(Sl,{children:"Move to Folder"}),a.jsxs(Oc,{children:["Choose a folder to move ",A.size," selected persona",A.size!==1?"s":""," to."]})]}),a.jsx("div",{className:"py-4",children:a.jsxs(X1,{value:W||"",onValueChange:X,className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Eh,{value:Gn,id:"folder-all"}),a.jsxs(to,{htmlFor:"folder-all",className:"flex items-center gap-2",children:[a.jsx(Zi,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas (Remove from folders)"})]})]}),x.map(Y=>a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Eh,{value:Y._id,id:`folder-${Y._id}`}),a.jsxs(to,{htmlFor:`folder-${Y._id}`,className:"flex items-center gap-2",children:[a.jsx(Zi,{className:"h-4 w-4"}),a.jsx("span",{children:Y.name})]})]},Y._id))]})}),a.jsxs(wl,{children:[a.jsx(te,{variant:"outline",onClick:Y=>{Y.preventDefault(),Y.stopPropagation(),U(!1),X(null)},children:"Cancel"}),a.jsx(te,{onClick:async Y=>{if(Y.preventDefault(),Y.stopPropagation(),!W)return;const ke=new Set(A),He=W;if(U(!1),X(null),He&&ke.size>0){C(!0);try{await Je(ke,He)}finally{C(!1),_(new Set)}}},disabled:!W,children:"Move"})]})]})}),a.jsx(kc,{open:re,onOpenChange:Y=>{Y?(xe(Y),de({...F})):(A.size>0&&_(new Set),xe(!1))},children:a.jsxs(xl,{className:"max-w-4xl max-h-[80vh] flex flex-col",onInteractOutside:Y=>{Y.preventDefault()},children:[a.jsx("div",{className:"sticky top-0 bg-background border-b shadow-sm pb-4 z-10",children:a.jsxs(bl,{children:[a.jsx(Sl,{children:"Filter Personas"}),a.jsx(Oc,{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(oe).some(Y=>Y.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((Y,ke)=>Y+ke.length,0)," active filters"]})}),a.jsx("div",{className:"space-y-4",children:(()=>{const Y=Qe=>{const gt={...oe};gt[Qe]=[];const tn=v.filter(rt=>Object.entries(gt).every(([mn,Qt])=>{if(Qt.length===0)return!0;const Z=mn;if(Z==="techSavviness"&&rt.techSavviness!==void 0){const se=rt.techSavviness<30?"Low (0-30)":rt.techSavviness<70?"Medium (31-70)":"High (71-100)";return Qt.includes(se)}else{if(Z==="age"&&rt.age)return Qt.includes(rt.age);if(Z==="gender"&&rt.gender)return Qt.includes(rt.gender);if(Z==="occupation"&&rt.occupation)return Qt.includes(rt.occupation);if(Z==="location"&&rt.location)return Qt.includes(rt.location);if(Z==="ethnicity"&&rt.ethnicity)return Qt.includes(rt.ethnicity)}return!0}));return D(tn)},ke=Object.values(oe).every(Qe=>Qe.length===0),He=D(v),ht=(Qe,gt,tn,rt=1)=>{const mn=oe[gt],Qt=[...new Set([...tn,...mn])].sort();return Qt.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:Qe}),a.jsx("div",{className:`grid grid-cols-1 ${rt===2?"sm:grid-cols-2":rt===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:Qt.map(Z=>{const se=oe[gt].includes(Z),O=tn.includes(Z);return a.jsxs("div",{className:`flex items-center space-x-2 ${!O&&!se?"opacity-50":""}`,children:[a.jsx(vc,{id:`${gt}-${Z}`,checked:se,onCheckedChange:()=>J(gt,Z),disabled:!O&&!se}),a.jsxs(to,{htmlFor:`${gt}-${Z}`,className:"truncate overflow-hidden",children:[Z,se&&!O&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},Z)})})]})};return a.jsxs(a.Fragment,{children:[ht("Gender","gender",ke?He.gender:Y("gender").gender,3),ht("Age","age",ke?He.age:Y("age").age,3),ht("Ethnicity","ethnicity",ke?He.ethnicity:Y("ethnicity").ethnicity,2),ht("Location","location",ke?He.location:Y("location").location,2),ht("Occupation","occupation",ke?He.occupation:Y("occupation").occupation,2),ht("Tech Savviness","techSavviness",ke?He.techSavviness:Y("techSavviness").techSavviness,3),a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:"Folder Assignment"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(vc,{id:"folderStatus-hasFolder",checked:oe.folderStatus.includes("hasFolder"),onCheckedChange:()=>J("folderStatus","hasFolder")}),a.jsx(to,{htmlFor:"folderStatus-hasFolder",className:"truncate overflow-hidden",children:"Has folder assignment"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(vc,{id:"folderStatus-noFolder",checked:oe.folderStatus.includes("noFolder"),onCheckedChange:()=>J("folderStatus","noFolder")}),a.jsx(to,{htmlFor:"folderStatus-noFolder",className:"truncate overflow-hidden",children:"No folder assignment"})]})]})]}),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(wl,{children:[a.jsx(te,{variant:"outline",onClick:Q,children:"Reset"}),a.jsx(te,{onClick:H,children:"Apply Filters"})]})})]})}),a.jsx(kc,{open:Fe,onOpenChange:vt,children:a.jsxs(xl,{children:[a.jsxs(bl,{children:[a.jsx(Sl,{children:"Select AI Model for Summary Generation"}),a.jsx(Oc,{children:"Choose which AI model to use for generating persona summaries"})]}),a.jsx("div",{className:"py-4",children:a.jsxs(X1,{value:mt,onValueChange:Bt,className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Eh,{value:"gemini-2.5-pro",id:"download-gemini"}),a.jsx(to,{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(Eh,{value:"gpt-4.1",id:"download-gpt"}),a.jsx(to,{htmlFor:"download-gpt",className:"text-sm font-medium",children:"GPT-4.1"})]})]})}),a.jsxs(wl,{children:[a.jsx(te,{variant:"outline",onClick:()=>vt(!1),children:"Cancel"}),a.jsx(te,{onClick:ft,children:"Generate Summary"})]})]})})]})]})}):a.jsxs(Kl,{defaultValue:"ai",onValueChange:Y=>l(Y),children:[a.jsxs(Ea,{className:"grid w-full grid-cols-2 mb-6",children:[a.jsx(on,{value:"ai",children:"AI Recruiter"}),a.jsx(on,{value:"manual",children:"Manual Creation"})]}),a.jsxs(sn,{value:"ai",children:[console.log(`Rendering AIRecruiter with targetFolderId: ${d!==Gn?d:"null"}`),console.log("Current folders:",x.map(Y=>({id:Y.id,name:Y.name}))),a.jsx(Yse,{targetFolderId:d!==Gn?d:null,targetFolderName:d!==Gn?(Wi=x.find(Y=>Y.id===d))==null?void 0:Wi.name:null})]}),a.jsx(sn,{value:"manual",children:a.jsx(Fae,{targetFolderId:d!==Gn?d:null,targetFolderName:d!==Gn?(Ls=x.find(Y=>Y.id===d))==null?void 0:Ls.name:null})})]})]})]})},sz=y.createContext(void 0),SS="synthetic-society-navigation-state",Fce=({children:t})=>{const[e,n]=y.useState(()=>{try{const o=localStorage.getItem(SS);return o?JSON.parse(o):{}}catch{return{}}});y.useEffect(()=>{localStorage.setItem(SS,JSON.stringify(e))},[e]);const r=(o,s)=>{n({...e,previousRoute:o,...s})},i=()=>{n({}),localStorage.removeItem(SS)};return a.jsx(sz.Provider,{value:{navigationState:e,setNavigationState:n,clearNavigationState:i,setPreviousRoute:r},children:t})},N0=()=>{const t=y.useContext(sz);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t},Uce=cN("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function ur({className:t,variant:e,...n}){return a.jsx("div",{className:Pe(Uce({variant:e}),t),...n})}const nT=T.memo(t=>{const{discussionGuide:e,moderatorStatus:n,onSectionSelect:r,onSetPosition:i,onSave:o,showProgress:s=!0,collapsible:l=!0,defaultExpanded:c=!1,className:u,onDownload:d,isDownloading:f=!1,focusGroupId:h,onEditingChange:p}=t,g=typeof e=="string",m=y.useMemo(()=>g?null:e,[e,g]),[v,b]=y.useState(new Set),[x,w]=y.useState(null),[S,C]=y.useState(null),[A,_]=y.useState(!1),[j,k]=y.useState(null),[P,I]=y.useState("");y.useEffect(()=>{p&&p(!!x)},[x,p]),y.useEffect(()=>{if(x&&m){const N=m.sections.find(D=>D.id===x);N&&!S&&C({...N})}},[m,x,S]);const E=N=>{w(N.id),C({...N}),b(D=>new Set(D).add(N.id))},R=()=>{w(null),C(null)},L=y.useCallback(N=>{C(D=>D&&{...D,...N})},[]),V=y.useCallback((N,D,H)=>{C(Q=>{if(!Q)return Q;const J={...Q};if(H==="question"&&J.questions){if(J.questions.findIndex(ee=>ee.id===N)!==-1)return J.questions=J.questions.map(ee=>ee.id===N?{...ee,...D}:ee),J}else if(H==="activity"&&J.activities&&J.activities.findIndex(ee=>ee.id===N)!==-1)return J.activities=J.activities.map(ee=>ee.id===N?{...ee,...D}:ee),J;return J.subsections&&(J.subsections=J.subsections.map(B=>{const ee={...B};return H==="question"&&ee.questions?ee.questions.findIndex(Ce=>Ce.id===N)!==-1&&(ee.questions=ee.questions.map(Ce=>Ce.id===N?{...Ce,...D}:Ce)):H==="activity"&&ee.activities&&ee.activities.findIndex(Ce=>Ce.id===N)!==-1&&(ee.activities=ee.activities.map(Ce=>Ce.id===N?{...Ce,...D}:Ce)),ee})),J})},[]),$=N=>{if(!S)return;const D={id:`${N}-${Date.now()}`,content:`New ${N}`,type:N==="question"?"open_ended":"discussion",time_limit:void 0},H={...S};N==="question"?H.questions=[...H.questions||[],D]:H.activities=[...H.activities||[],D],C(H)},z=(N,D)=>{if(!S||!S.subsections)return;const H={id:`${D}-${Date.now()}`,content:`New ${D}`,type:D==="question"?"open_ended":"discussion",time_limit:void 0},Q=[...S.subsections],J={...Q[N]};D==="question"?J.questions=[...J.questions||[],H]:J.activities=[...J.activities||[],H],Q[N]=J,C(B=>B&&{...B,subsections:Q})},M=()=>{if(!S)return;const N={id:`subsection-${Date.now()}`,title:"New Subsection",questions:[],activities:[]},D=[...S.subsections||[],N];C(H=>H&&{...H,subsections:D})},U=N=>{if(!S||!S.subsections)return;const D=S.subsections.filter((H,Q)=>Q!==N);C(H=>H&&{...H,subsections:D})},W=(N,D)=>{var Q,J;if(!S)return;const H={...S};D==="question"?H.questions=(Q=H.questions)==null?void 0:Q.filter(B=>B.id!==N):H.activities=(J=H.activities)==null?void 0:J.filter(B=>B.id!==N),C(H)},X=async()=>{if(!(!S||!m||!o)){_(!0);try{const N={...m,sections:m.sections.map(D=>D.id===x?S:D)};await o(N),R(),ie.success("Section updated successfully")}catch(N){console.error("Error saving section:",N),ie.error("Failed to save section")}finally{_(!1)}}},re=N=>{b(D=>{const H=new Set(D);return H.has(N)?H.delete(N):H.add(N),H})};y.useEffect(()=>{m&&m.sections.length>0&&b(c?new Set(m.sections.map(N=>N.id)):new Set)},[c,m]);const xe=(N,D,H,Q)=>{if(!n||n.legacy_format)return null;const J=n.moderator_position;if(J.section_index!==N)return J.section_index>N?"completed":null;if(Q!==void 0){if(J.subsection_index===void 0)return null;if(J.subsection_index!==Q)return J.subsection_index>Q?"completed":null}else if(J.subsection_index!==void 0)return"completed";return J.item_type!==H?H==="activity"&&J.item_type==="question"?"completed":null:J.item_index===D?"current":J.item_index>D?"completed":null},F=(N,D)=>N===`New ${D}`,fe=y.useCallback((N,D,H)=>{if(D<0||D>=N.length||H<0||H>=N.length)return N;const Q=[...N],[J]=Q.splice(D,1);return Q.splice(H,0,J),Q},[]),oe=y.useCallback((N,D)=>D>0,[]),de=y.useCallback((N,D)=>D{if(!S||!S.subsections)return;const D=S.subsections;if(oe(D,N)){const H=fe(D,N,N-1);C(Q=>Q&&{...Q,subsections:H})}},[S,oe,fe]),pe=y.useCallback(N=>{if(!S||!S.subsections)return;const D=S.subsections;if(de(D,N)){const H=fe(D,N,N+1);C(Q=>Q&&{...Q,subsections:H})}},[S,de,fe]),Se=y.useCallback((N,D)=>{k(N),I(D)},[]),Ne=y.useCallback(()=>{k(null),I("")},[]),ne=y.useCallback(()=>{if(!j||!S||!S.subsections)return;const N=S.subsections.map(D=>D.id===j?{...D,title:P.trim()}:D);C(D=>D&&{...D,subsections:N}),Ne()},[j,S,P,Ne]),nt=y.useCallback((N,D,H,Q)=>{if(!S)return;const J=D==="question"?"questions":"activities";if(Q!==void 0){const B=S.subsections||[];if(Q>=0&&Qwe&&{...we,subsections:Me})}}}else{const B=S[J]||[];if(oe(B,H)){const ee=fe(B,H,H-1);C(me=>me&&{...me,[J]:ee})}}},[S,oe,fe]),Fe=y.useCallback((N,D,H,Q)=>{if(!S)return;const J=D==="question"?"questions":"activities";if(Q!==void 0){const B=S.subsections||[];if(Q>=0&&Qwe&&{...we,subsections:Me})}}}else{const B=S[J]||[];if(de(B,H)){const ee=fe(B,H,H+1);C(me=>me&&{...me,[J]:ee})}}},[S,de,fe]),vt=(N,D,H,Q,J)=>{var Nt,Je,Xe,$t,Yt,_r,Sn,yt,qe;const B=m==null?void 0:m.sections[D],ee=x===(B==null?void 0:B.id),me=xe(D,H,Q,J),Ce=me==="current",Me=me==="completed",We=(ft=>{const Vt=ft.match(/['"`]([^'"`]*fg-[^'"`]*\.(jpe?g|png|gif|webp))['"`]/i);return Vt?Vt[1]:null})(N.content),wt=F(N.content,Q);return ee?a.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border bg-white border-blue-200",children:[a.jsxs("div",{className:"flex-shrink-0 flex flex-col gap-1",children:[a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>nt(N.id,Q,H,J),disabled:(()=>{if(J!==void 0){const Vt=((S==null?void 0:S.subsections)||[])[J],un=(Vt==null?void 0:Vt[Q==="question"?"questions":"activities"])||[];return!oe(un,H)}else{const ft=(S==null?void 0:S[Q==="question"?"questions":"activities"])||[];return!oe(ft,H)}})(),className:"h-6 w-6 p-0",title:"Move item up",children:a.jsx(Hc,{className:"h-3 w-3"})}),a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Fe(N.id,Q,H,J),disabled:(()=>{if(J!==void 0){const Vt=((S==null?void 0:S.subsections)||[])[J],un=(Vt==null?void 0:Vt[Q==="question"?"questions":"activities"])||[];return!de(un,H)}else{const ft=(S==null?void 0:S[Q==="question"?"questions":"activities"])||[];return!de(ft,H)}})(),className:"h-6 w-6 p-0",title:"Move item down",children:a.jsx(va,{className:"h-3 w-3"})})]}),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(ur,{variant:"outline",className:"text-xs",children:Q==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(Qs,{className:"h-3 w-3 mr-1"}),typeof N.type=="string"?N.type.replace("_"," "):String(N.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(us,{className:"h-3 w-3 mr-1"}),typeof N.type=="string"?N.type.replace("_"," "):String(N.type||"unknown")]})}),N.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500",children:[a.jsx(Cp,{className:"h-3 w-3"}),a.jsx(Dt,{type:"number",value:N.time_limit,onChange:ft=>V(N.id,{time_limit:parseInt(ft.target.value)||void 0},Q),className:"w-16 h-6 text-xs",placeholder:"min"}),"min"]})]}),a.jsx(lt,{value:wt?"":N.content,onChange:ft=>V(N.id,{content:ft.target.value},Q),placeholder:wt?N.content:"Enter content...",className:"min-h-[60px]"}),Q==="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(lt,{value:((Nt=N.probes)==null?void 0:Nt.join(` `))||"",onChange:ft=>{const Vt=ft.target.value.trim()?ft.target.value.split(` -`).filter(vn=>vn.trim()):[];V(N.id,{probes:Vt},Q)},placeholder:"Enter probe questions, one per line...",className:"min-h-[40px]"})]}),(((Ze=N.metadata)==null?void 0:Ze.image_url)||((Qe=N.metadata)==null?void 0:Qe.image_id)||We)&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Av,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),($t=N.metadata)!=null&&$t.image_url?a.jsx("img",{src:N.metadata.image_url,alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):(Yt=N.metadata)!=null&&Yt.image_id&&h?a.jsx("img",{src:jt.getAssetUrl(h,N.metadata.image_id),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):We&&h?a.jsx("img",{src:jt.getAssetUrl(h,We),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]}),a.jsx("div",{className:"flex-shrink-0",children:a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>K(N.id,Q),className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:a.jsx(Kn,{className:"h-3 w-3"})})})]},`edit-item-${N.id}`):a.jsxs("div",{className:ke("flex items-start gap-3 p-3 rounded-lg border transition-colors",Ce&&"bg-blue-50 border-blue-200",De&&"bg-green-50 border-green-200",!Ce&&!De&&"bg-slate-50 border-slate-200",r&&"cursor-pointer hover:bg-slate-100"),onClick:()=>r==null?void 0:r(m.sections[D].id,N.id),children:[a.jsx("div",{className:"flex-shrink-0 mt-1",children:De?a.jsx(Kj,{className:"h-4 w-4 text-green-600"}):Ce?a.jsx(c4,{className:"h-4 w-4 text-blue-600"}):a.jsx(Wj,{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(ur,{variant:"outline",className:"text-xs whitespace-nowrap",children:Q==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(Qs,{className:"h-3 w-3 mr-1"}),typeof N.type=="string"?N.type.replace("_"," "):String(N.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(us,{className:"h-3 w-3 mr-1"}),typeof N.type=="string"?N.type.replace("_"," "):String(N.type||"unknown")]})}),N.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500 whitespace-nowrap",children:[a.jsx(Ap,{className:"h-3 w-3"}),N.time_limit," min"]}),i&&a.jsxs(te,{size:"sm",variant:"ghost",onClick:ft=>{ft.stopPropagation();const Vt=m.sections[D],vn=Q==="activity"?`Activity ${H+1}`:`Question ${H+1}`;i(Vt.id,N.id,N.content,Vt.title,vn,Q)},className:"h-6 px-2 ml-auto",children:[a.jsx(_v,{className:"h-3 w-3 mr-1"}),"Set Position"]})]}),a.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:N.content}),N.probes&&N.probes.length>0&&a.jsxs("div",{className:"mt-2 pl-4 border-l-2 border-slate-200",children:[a.jsx("p",{className:"text-xs font-medium text-slate-600 mb-1",children:"Probe Questions:"}),a.jsx("ul",{className:"space-y-1",children:N.probes.map((ft,Vt)=>a.jsxs("li",{className:"text-xs text-slate-600",children:["• ",ft]},Vt))})]}),(((_r=N.metadata)==null?void 0:_r.image_url)||((Sn=N.metadata)==null?void 0:Sn.image_id)||We)&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Av,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),(yt=N.metadata)!=null&&yt.image_url?a.jsx("img",{src:N.metadata.image_url,alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):(Xe=N.metadata)!=null&&Xe.image_id&&h?a.jsx("img",{src:jt.getAssetUrl(h,N.metadata.image_id),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):We&&h?a.jsx("img",{src:jt.getAssetUrl(h,We),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]})]},N.id)},mt=(N,D)=>{var ee,me,Ce,De;const H=v.has(N.id),Q=x===N.id,Z=Q?S:N,B=(n==null?void 0:n.moderator_position.section_index)===D;return a.jsxs("div",{className:ke("border rounded-lg overflow-hidden transition-colors",B&&"border-blue-500 shadow-md",!B&&"border-slate-200"),children:[a.jsxs("div",{className:ke("px-4 py-3 flex items-center justify-between cursor-pointer hover:bg-slate-50 transition-colors",B&&"bg-blue-50"),onClick:()=>!Q&&re(N.id),children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"transition-transform",style:{transform:H?"rotate(90deg)":"rotate(0deg)"},children:a.jsx(Zi,{className:"h-5 w-5 text-slate-500"})}),a.jsx("h3",{className:"font-semibold text-slate-800",children:Q?a.jsx(Dt,{value:Z.title,onChange:we=>L({title:we.target.value}),onClick:we=>we.stopPropagation(),className:"font-semibold"}):Z.title}),B&&a.jsx(ur,{variant:"default",className:"text-xs",children:"Current"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[o&&!Q&&a.jsx(te,{size:"sm",variant:"ghost",onClick:we=>{we.stopPropagation(),E(N)},className:"h-8 px-2",children:a.jsx(lO,{className:"h-3 w-3"})}),Q&&a.jsxs("div",{className:"flex items-center gap-2",onClick:we=>we.stopPropagation(),children:[a.jsxs(te,{size:"sm",variant:"default",onClick:X,disabled:A,className:"h-8",children:[A?a.jsx(ws,{className:"h-3 w-3 animate-spin"}):a.jsx(Yj,{className:"h-3 w-3"}),a.jsx("span",{className:"ml-1",children:"Save"})]}),a.jsxs(te,{size:"sm",variant:"ghost",onClick:I,disabled:A,className:"h-8",children:[a.jsx($o,{className:"h-3 w-3"}),a.jsx("span",{className:"ml-1",children:"Cancel"})]})]})]})]}),H&&a.jsxs("div",{className:"px-4 py-3 border-t border-slate-200 space-y-4",children:[Z.content&&a.jsx("div",{className:"prose prose-sm max-w-none",children:Q?a.jsx(ct,{value:Z.content,onChange:we=>L({content:we.target.value}),placeholder:"Section introduction or context...",className:"min-h-[80px] w-full"}):a.jsx("p",{className:"text-slate-700",children:Z.content})}),Z.activities&&Z.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(Qs,{className:"h-4 w-4"}),"Activities"]}),Q&&a.jsxs(te,{size:"sm",variant:"outline",onClick:()=>$("activity"),className:"h-7",children:[a.jsx(Qs,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),a.jsx("div",{className:"space-y-2",children:(ee=Z.activities)==null?void 0:ee.map((we,We)=>vt(we,D,We,"activity"))})]}):null,Z.questions&&Z.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(us,{className:"h-4 w-4"}),"Questions"]}),Q&&a.jsxs(te,{size:"sm",variant:"outline",onClick:()=>$("question"),className:"h-7",children:[a.jsx(us,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),a.jsx("div",{className:"space-y-2",children:(me=Z.questions)==null?void 0:me.map((we,We)=>vt(we,D,We,"question"))})]}):null,Q&&a.jsx("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(_v,{className:"h-4 w-4"}),"Subsections"]}),a.jsxs(te,{size:"sm",variant:"outline",onClick:M,className:"h-7",children:[a.jsx(_v,{className:"h-3 w-3 mr-1"}),"Add Subsection"]})]})}),Z.subsections&&Z.subsections.length>0&&a.jsx("div",{className:"space-y-3 ml-4",children:Z.subsections.map((we,We)=>{var St,Tt;return a.jsxs("div",{className:"border-l-2 border-slate-200 pl-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[Q&&a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Me(We),disabled:!ie(Z.subsections||[],We),className:"h-7 w-7 p-0",title:"Move subsection up",children:a.jsx(Hc,{className:"h-4 w-4"})}),a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>pe(We),disabled:!ce(Z.subsections||[],We),className:"h-7 w-7 p-0",title:"Move subsection down",children:a.jsx(va,{className:"h-4 w-4"})})]}),Q&&j===we.id?a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx(Dt,{value:P,onChange:Ze=>R(Ze.target.value),className:"flex-1",onKeyDown:Ze=>{Ze.key==="Enter"?ne():Ze.key==="Escape"&&Te()},autoFocus:!0}),a.jsx(te,{size:"sm",onClick:ne,children:a.jsx(Ts,{className:"h-3 w-3"})}),a.jsx(te,{size:"sm",variant:"outline",onClick:Te,children:a.jsx($o,{className:"h-3 w-3"})})]}):a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx("h5",{className:ke("font-medium text-slate-700",Q&&"cursor-pointer hover:text-blue-600"),onClick:()=>Q&&Se(we.id,we.title),children:we.title}),Q&&a.jsxs(a.Fragment,{children:[a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Se(we.id,we.title),className:"h-6 w-6 p-0 opacity-60 hover:opacity-100",children:a.jsx(lO,{className:"h-3 w-3"})}),a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>U(We),className:"h-6 w-6 p-0 opacity-60 hover:opacity-100 text-red-600 hover:text-red-700",title:"Delete subsection",children:a.jsx(Kn,{className:"h-3 w-3"})})]})]})]}),we.questions&&we.questions.length>0||Q?a.jsxs("div",{className:"space-y-2 mb-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h6",{className:"text-sm font-medium text-slate-600 flex items-center gap-1",children:[a.jsx(us,{className:"h-3 w-3"}),"Questions"]}),Q&&a.jsxs(te,{size:"sm",variant:"outline",onClick:()=>z(We,"question"),className:"h-6",children:[a.jsx(us,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),a.jsx("div",{className:"space-y-2",children:(St=we.questions)==null?void 0:St.map((Ze,Qe)=>vt(Ze,D,Qe,"question",We))})]}):null,we.activities&&we.activities.length>0||Q?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h6",{className:"text-sm font-medium text-slate-600 flex items-center gap-1",children:[a.jsx(Qs,{className:"h-3 w-3"}),"Activities"]}),Q&&a.jsxs(te,{size:"sm",variant:"outline",onClick:()=>z(We,"activity"),className:"h-6",children:[a.jsx(Qs,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),a.jsx("div",{className:"space-y-2",children:(Tt=we.activities)==null?void 0:Tt.map((Ze,Qe)=>vt(Ze,D,Qe,"activity",We))})]}):null]},we.id)})}),(((Ce=N.metadata)==null?void 0:Ce.image_url)||((De=N.metadata)==null?void 0:De.image_id))&&a.jsxs("div",{className:"mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Av,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),N.metadata.image_url?a.jsx("img",{src:N.metadata.image_url,alt:"Visual aid for section",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):N.metadata.image_id&&h?a.jsx("img",{src:jt.getAssetUrl(h,N.metadata.image_id),alt:"Visual aid for section",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]})]},N.id)};if(g)return a.jsxs("div",{className:ke("space-y-4",u),children:[s&&n&&a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-600 mb-2",children:[a.jsx("span",{children:"Progress"}),a.jsxs("span",{children:[Math.round(n.progress),"%"]})]}),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",style:{width:`${n.progress}%`}})})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h2",{className:"text-xl font-semibold text-slate-800",children:"Discussion Guide"}),d&&a.jsxs(te,{size:"sm",variant:"outline",onClick:d,disabled:f,children:[f?a.jsx(ws,{className:"h-4 w-4 animate-spin mr-2"}):a.jsx(zc,{className:"h-4 w-4 mr-2"}),"Download"]})]}),a.jsx("div",{className:"prose prose-sm max-w-none",children:a.jsx("pre",{className:"whitespace-pre-wrap text-sm text-slate-700 font-sans",children:e})}),n&&a.jsxs("div",{className:"mt-6 p-4 bg-blue-50 rounded-lg border border-blue-200",children:[a.jsx("h3",{className:"font-medium text-blue-900 mb-2",children:"Current Position"}),a.jsx("p",{className:"text-sm text-blue-800",children:n.current_section}),n.current_item&&a.jsx("p",{className:"text-sm text-blue-700 mt-1",children:n.current_item})]})]})]});if(!m)return a.jsx("div",{className:ke("bg-slate-50 rounded-lg p-8 text-center",u),children:a.jsx("p",{className:"text-slate-600",children:"No discussion guide available"})});const Bt=a.jsxs("div",{className:"space-y-4",children:[s&&n&&a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-600 mb-2",children:[a.jsx("span",{children:"Overall Progress"}),a.jsxs("span",{children:[Math.round(n.progress),"%"]})]}),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",style:{width:`${n.progress}%`}})}),a.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-500 mt-2",children:[a.jsxs("span",{children:["Section ",n.moderator_position.section_index+1," of ",n.total_sections]}),a.jsxs("span",{children:[Math.round(n.section_progress),"% of current section"]})]})]}),a.jsx("div",{className:"space-y-3",children:m.sections.map((N,D)=>mt(N,D))})]});return l?a.jsxs(tg,{defaultOpen:c,className:u,children:[a.jsx(ng,{asChild:!0,children:a.jsxs("div",{className:"flex items-center justify-between p-4 bg-white rounded-lg border border-slate-200 cursor-pointer hover:bg-slate-50 transition-colors",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Zi,{className:"h-5 w-5 text-slate-500 transition-transform data-[state=open]:rotate-90"}),a.jsx("h2",{className:"text-lg font-semibold text-slate-800",children:m.title||"Discussion Guide"}),a.jsxs(ur,{variant:"outline",className:"text-xs",children:[m.total_duration," min"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[n&&a.jsxs(ur,{variant:n.progress===100?"success":"default",className:"text-xs",children:[Math.round(n.progress),"% Complete"]}),d&&a.jsx(te,{size:"sm",variant:"outline",onClick:N=>{N.stopPropagation(),d()},disabled:f,children:f?a.jsx(ws,{className:"h-4 w-4 animate-spin"}):a.jsx(zc,{className:"h-4 w-4"})})]})]})}),a.jsx(rg,{className:"mt-4",children:Bt})]}):a.jsx("div",{className:u,children:Bt})});rT.displayName="DiscussionGuideViewer";const Zl="all",Hce=Ie.object({researchBrief:Ie.string().min(10,{message:"Research brief must be at least 10 characters."}),focusGroupName:Ie.string().min(3,{message:"Focus group name must be at least 3 characters."}),discussionTopics:Ie.string().min(10,{message:"Discussion topics are required."}),creativeAssets:Ie.instanceof(FileList).optional(),duration:Ie.string().min(1,{message:"Duration is required."}),llm_model:Ie.string().optional(),reasoning_effort:Ie.string().optional(),verbosity:Ie.string().optional()}),sh={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 zce({draftToEdit:t,onDraftSaved:e,preSelectedParticipants:n=[]}={}){console.log("FocusGroupModerator component rendering, draftToEdit:",t);const r=Xn();Ei();const{setPreviousRoute:i,navigationState:o,clearNavigationState:s}=T0(),[l,c]=y.useState("setup"),[u,d]=y.useState(!1),[f,h]=y.useState(!1),[p,g]=y.useState(!1),[m,v]=y.useState(null),[b,x]=y.useState(null),[w,S]=y.useState(!1),C=y.useRef(m);C.current=m;const A=y.useRef(!1),_=O=>O&&typeof O=="object"&&O.title&&O.sections,[j,k]=y.useState([]),[P,R]=y.useState([]),[E,I]=y.useState([]),[L,V]=y.useState(!1),[$,z]=y.useState(!1),[M,U]=y.useState([]),[K,X]=y.useState(Zl),[re,xe]=y.useState(!1),[F,ue]=y.useState(""),[ie,ce]=y.useState(null),[Me,pe]=y.useState(""),[Se,Te]=y.useState(""),[ne,rt]=y.useState(!1),[Fe,vt]=y.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[mt,Bt]=y.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[N,D]=y.useState("idle"),[H,Q]=y.useState(null),[Z,B]=y.useState(0),ee=y.useRef(null),me=y.useRef(!1),Ce=y.useRef(!1),De=O=>{i("/focus-groups",{focusGroupId:b,focusGroupTab:"participants",isNewFocusGroup:!t,focusGroupData:{name:Xe.getValues("name"),description:Xe.getValues("description"),selectedParticipants:j,discussionGuide:m}}),r(`/synthetic-users/${O.id}`)},we=O=>{const q={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return O.forEach(W=>{if(W.age&&q.age.add(W.age),W.gender&&q.gender.add(W.gender),W.occupation&&q.occupation.add(W.occupation),W.location&&q.location.add(W.location),W.techSavviness!==void 0){const he=W.techSavviness<30?"Low (0-30)":W.techSavviness<70?"Medium (31-70)":"High (71-100)";q.techSavviness.add(he)}W.ethnicity&&q.ethnicity.add(W.ethnicity)}),{age:Array.from(q.age).sort(),gender:Array.from(q.gender).sort(),occupation:Array.from(q.occupation).sort(),location:Array.from(q.location).sort(),techSavviness:Array.from(q.techSavviness).sort((W,he)=>{const fe=["Low (0-30)","Medium (31-70)","High (71-100)"];return fe.indexOf(W)-fe.indexOf(he)}),ethnicity:Array.from(q.ethnicity).sort()}},We=O=>{const q={...mt};q[O]=[];const W=E.filter(he=>{let fe=!0;return K!==Zl&&(fe=!1,he.folder_ids&&Array.isArray(he.folder_ids)&&(fe=he.folder_ids.includes(K)),!fe&&(he.folder_id===K||he.folderId===K)&&(fe=!0)),fe?Object.entries(q).every(([Ee,be])=>{if(be.length===0)return!0;const bt=Ee;if(bt==="techSavviness"&&he.techSavviness!==void 0){const tt=he.techSavviness<30?"Low (0-30)":he.techSavviness<70?"Medium (31-70)":"High (71-100)";return be.includes(tt)}else{if(bt==="age"&&he.age)return be.includes(he.age);if(bt==="gender"&&he.gender)return be.includes(he.gender);if(bt==="occupation"&&he.occupation)return be.includes(he.occupation);if(bt==="location"&&he.location)return be.includes(he.location);if(bt==="ethnicity"&&he.ethnicity)return be.includes(he.ethnicity)}return!0}):!1});return we(W)},St=()=>{rt(!1),setTimeout(()=>{vt({...mt})},0)},Tt=()=>{Bt({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]})},Ze=(O,q)=>{Bt(W=>{const he={...W};return he[O].includes(q)?he[O]=he[O].filter(fe=>fe!==q):he[O]=[...he[O],q],he})},Qe=async()=>{try{const W=(await ds.getAll()).data.map(he=>({...he,id:he._id}));return U(W),W}catch(O){return console.error("Error fetching folders:",O),se.error("Failed to load folders"),U([]),[]}},$t=async()=>{if(!F.trim()){se.error("Please enter a folder name");return}try{const O=await ds.create({name:F.trim()});await Qe(),ue(""),xe(!1),se.success(`Folder "${F}" created`)}catch(O){console.error("Error creating folder:",O),se.error("Failed to create folder")}},Yt=()=>{ue(""),xe(!1)},_r=O=>{ce(O),pe(O.name)},Sn=async()=>{if(!ie||!Me.trim()){ce(null);return}try{await ds.update(ie._id,{name:Me.trim()}),await Qe(),ce(null),se.success(`Folder renamed to "${Me}"`)}catch(O){console.error("Error renaming folder:",O),se.error("Failed to rename folder"),ce(null)}},yt=()=>{ce(null),pe("")};y.useEffect(()=>{const O=async()=>{V(!0);try{const W=await kr.getAll();console.log("Fetched personas for FocusGroupModerator:",W.data),Array.isArray(W.data)&&W.data.length>0?I(W.data):(console.warn("No personas returned from API or invalid format",W.data),se.warning("No participants available"))}catch(W){console.error("Error fetching personas:",W),se.error("Failed to load participants")}finally{V(!1)}};(async()=>{await Promise.all([Qe(),O()])})()},[]),console.log("About to initialize form with useForm hook");const Xe=h0({resolver:p0(Hce),defaultValues:{researchBrief:"",focusGroupName:"",discussionTopics:"",duration:"60",llm_model:"gemini-2.5-pro",reasoning_effort:"medium",verbosity:"medium"}});console.log("Form initialized successfully");const ft=()=>{l!=="setup"||Ce.current||(ee.current&&clearTimeout(ee.current),ee.current=setTimeout(async()=>{if(me.current)return;const O=Xe.getValues(),q={name:O.focusGroupName||"",description:O.researchBrief||"",objective:O.researchBrief||"",topic:O.discussionTopics||"",duration:O.duration?parseInt(O.duration):60,llm_model:O.llm_model||"gemini-2.5-pro",reasoning_effort:O.reasoning_effort||"medium",verbosity:O.verbosity||"medium",participants:j,participants_count:j.length,status:"draft",date:new Date().toISOString(),uploadedAssets:P.map(W=>W.name)};if(!(H&&JSON.stringify(q)===JSON.stringify(H))&&!(!q.name&&!q.description&&!q.topic)){me.current=!0,D("saving");try{let W=b||(t==null?void 0:t.id)||(t==null?void 0:t._id);if(console.log("Auto-save: draftFocusGroupId =",b),console.log("Auto-save: draftToEdit ID =",(t==null?void 0:t.id)||(t==null?void 0:t._id)),console.log("Auto-save: using focusGroupId =",W),console.log("Auto-save: llm_model in currentData =",q.llm_model),console.log("Auto-save: duration in currentData =",q.duration),W)console.log("Auto-save: Updating existing focus group:",W),await jt.update(W,q),console.log("Auto-save: Updated existing draft:",W);else{console.log("Auto-save: Creating NEW focus group (no existing ID)");const he=await jt.create(q);W=he.data.focus_group_id||he.data.id||he.data._id,x(W),console.log("Auto-save: Created new draft with ID:",W)}Q(q),D("saved"),B(0),setTimeout(()=>{D("idle")},2e3)}catch(W){if(console.error("Auto-save failed:",W),D("error"),B(he=>he+1),Z<3){const he=Math.pow(2,Z)*2e3;setTimeout(()=>{ft()},he)}else se.error("Auto-save failed",{description:"Your changes may not be saved. Please check your connection."})}finally{me.current=!1}}},2e3))},Vt=Xe.watch(),vn=y.useRef(""),Wi=y.useRef(""),Ls=y.useRef("");y.useEffect(()=>{const O=JSON.stringify(Vt);l==="setup"&&O!==vn.current&&(vn.current=O,ft())},[Vt,l]),y.useEffect(()=>{const O=JSON.stringify(j);l==="setup"&&O!==Wi.current&&(Wi.current=O,ft())},[j,l]),y.useEffect(()=>{const O=JSON.stringify(P.map(q=>q.name));l==="setup"&&O!==Ls.current&&(Ls.current=O,ft())},[P,l]),y.useEffect(()=>(l!=="setup"&&ee.current&&clearTimeout(ee.current),()=>{ee.current&&clearTimeout(ee.current)}),[l]),y.useEffect(()=>{if(console.log("Draft loading effect - draftToEdit:",t,"draftLoadedRef.current:",A.current),!t){A.current=!1;return}if(t&&!A.current){console.log("Loading draft focus group:",t),Ce.current=!0,A.current=!0;const O=t.id||t._id;x(O),console.log("Setting draft ID from draftToEdit:",O),t.name&&Xe.setValue("focusGroupName",t.name),(t.description||t.objective)&&Xe.setValue("researchBrief",t.description||t.objective||""),t.topic&&Xe.setValue("discussionTopics",t.topic),t.duration&&Xe.setValue("duration",t.duration.toString()),t.llm_model&&Xe.setValue("llm_model",t.llm_model),t.reasoning_effort&&Xe.setValue("reasoning_effort",t.reasoning_effort),t.verbosity&&Xe.setValue("verbosity",t.verbosity),t.discussionGuide&&(v(t.discussionGuide),(!o.focusGroupTab||o.previousRoute!=="/focus-groups")&&c("review")),t.participants&&Array.isArray(t.participants)&&k(t.participants);const q={name:t.name||"",description:t.description||t.objective||"",objective:t.description||t.objective||"",topic:t.topic||"",duration:t.duration||60,llm_model:t.llm_model||"gemini-2.5-pro",reasoning_effort:t.reasoning_effort||"medium",verbosity:t.verbosity||"medium",participants:t.participants||[],participants_count:(t.participants||[]).length,status:"draft",date:t.date||new Date().toISOString(),uploadedAssets:[]};Q(q),console.log("Set lastSavedData to current draft:",q),se.success("Draft focus group loaded",{description:"Continue editing your focus group setup"}),setTimeout(()=>{Ce.current=!1},1e3)}},[t,Xe]),y.useEffect(()=>{n.length>0&&(console.log("Pre-selected participants received:",n),k(n),c("participants"))},[n]),y.useEffect(()=>{o.focusGroupTab&&o.previousRoute==="/focus-groups"&&setTimeout(()=>{c(o.focusGroupTab),s()},0)},[o.focusGroupTab,t,s]),y.useEffect(()=>{t||setTimeout(()=>{Ce.current=!1},500)},[t]);const Y=()=>{if(N==="idle")return null;const q={saving:{text:"Saving...",className:"text-blue-600 bg-blue-50"},saved:{text:"All changes saved",className:"text-green-600 bg-green-50"},error:{text:"Save failed - retrying...",className:"text-red-600 bg-red-50"}}[N];return a.jsx("div",{className:`fixed top-16 left-1/2 transform -translate-x-1/2 z-50 px-3 py-1 rounded-md text-sm font-medium border shadow-sm ${q.className}`,children:q.text})},Oe=async(O,q)=>{var W,he;d(!0),h(!1),g(!1);try{const fe={name:O.focusGroupName,description:O.researchBrief,objective:O.researchBrief,topic:O.discussionTopics,duration:parseInt(O.duration),llm_model:O.llm_model,reasoning_effort:O.reasoning_effort,verbosity:O.verbosity},Ee=q?await jt.generateDiscussionGuideForGroup(q,fe):await jt.generateDiscussionGuide(fe);if(Ee.data&&Ee.data.discussionGuide)return h(!0),Ee.data.discussionGuide;throw new Error("Failed to generate discussion guide")}catch(fe){console.error("Error generating discussion guide:",fe),g(!0);let Ee="Unknown error occurred";return(he=(W=fe==null?void 0:fe.response)==null?void 0:W.data)!=null&&he.error?Ee=fe.response.data.error:fe!=null&&fe.message&&(Ee=fe.message),Ee.includes("500")||Ee.includes("internal error")||Ee.includes("Internal Server Error")?se.error("AI service temporarily unavailable",{description:"The discussion guide generator is experiencing issues. Please try again in a few minutes.",action:{label:"Retry",onClick:()=>Oe(O)}}):se.error("Failed to generate discussion guide",{description:Ee,action:{label:"Retry",onClick:()=>Oe(O)}}),` -# Discussion Guide: ${O.focusGroupName} - -## Introduction (5 minutes) -${sh.introduction} - -## Warm-up Questions (10 minutes) -${sh.warmup} - -## ${O.discussionTopics.split(",")[0]} Exploration (15 minutes) -${sh.exploration} - -## Creative Testing (20 minutes) -${sh.creative} -${O.creativeAssets&&O.creativeAssets.length>0?`We'll be reviewing ${O.creativeAssets.length} creative assets.`:""} - -## Conclusion (10 minutes) -${sh.conclusion} - -## Research Brief Context -${O.researchBrief} - `}},He=()=>{d(!1),h(!1),g(!1)};async function ht(O){var q;try{let W=b;if(!W){const fe={name:O.focusGroupName,status:"draft",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(O.duration),topic:O.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:O.researchBrief,objective:O.researchBrief,llm_model:O.llm_model,reasoning_effort:O.reasoning_effort,verbosity:O.verbosity},Ee=await jt.create(fe);W=Ee.data.focus_group_id||Ee.data.id||Ee.data._id,x(W),console.log("Draft focus group created for asset upload:",Ee,"with ID:",W)}if(O.creativeAssets&&O.creativeAssets.length>0&&W)try{const fe=new FormData;Array.from(O.creativeAssets).forEach(tt=>{fe.append("assets",tt)});const be=(await jt.uploadAssets(W,fe)).data;console.log("Assets uploaded successfully:",be),se.success(`${be.uploaded_assets} asset(s) uploaded successfully`,{description:"Assets will be included in the discussion guide"});const bt=Array.from(O.creativeAssets);R(bt)}catch(fe){console.error("Asset upload failed:",fe);const Ee=(q=fe.response)==null?void 0:q.data;let be="Asset upload failed",bt="Some assets could not be uploaded";(Ee==null?void 0:Ee.code)==="TEMP_DIR_ERROR"?(be="Upload temporarily unavailable",bt="Server storage issue. Please try again in a moment."):(Ee==null?void 0:Ee.code)==="UPLOAD_SYSTEM_FAILURE"?(be="Upload system unavailable",bt="Critical server issue. Please contact support."):Ee!=null&&Ee.can_retry&&(be="Upload failed - can retry",bt=(Ee==null?void 0:Ee.details)||"Please try uploading again."),se.error(be,{description:bt}),console.log("Continuing without assets due to upload failure")}if(W)try{const fe={name:O.focusGroupName,participants:j,participants_count:j.length,duration:parseInt(O.duration),topic:O.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:O.researchBrief,objective:O.researchBrief,llm_model:O.llm_model,reasoning_effort:O.reasoning_effort,verbosity:O.verbosity};await jt.update(W,fe),console.log("Focus group updated with latest form values before guide generation"),console.log(`🔄 Updated focus group ${W} with model: ${O.llm_model}`)}catch(fe){console.error("Failed to update focus group before guide generation:",fe)}const he=await Oe(O,W);v(he);try{const fe={name:O.focusGroupName,status:"draft",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(O.duration),topic:O.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:O.researchBrief,objective:O.researchBrief,llm_model:O.llm_model,reasoning_effort:O.reasoning_effort,verbosity:O.verbosity,discussionGuide:he};await jt.update(W,fe),console.log("Focus group updated with discussion guide"),se.success("Progress saved as draft",{description:"Your focus group setup has been automatically saved"})}catch(fe){console.error("Failed to update focus group with discussion guide:",fe),se.error("Failed to save draft",{description:"Discussion guide generated, but draft save failed"})}c("review"),se.success("Discussion guide generated",{description:"Review and edit before proceeding"})}catch(W){console.error("Error in focus group creation flow:",W),se.error("Focus group creation failed",{description:W.message||"An unexpected error occurred"})}}const Ye=(()=>{var q;const O=E.filter(W=>{const he=W.name.toLowerCase().includes(Se.toLowerCase())||W.occupation&&W.occupation.toLowerCase().includes(Se.toLowerCase())||W.location&&W.location.toLowerCase().includes(Se.toLowerCase()),fe=(Fe.age.length===0||Fe.age.includes(W.age))&&(Fe.gender.length===0||Fe.gender.includes(W.gender))&&(Fe.occupation.length===0||Fe.occupation.includes(W.occupation))&&(Fe.location.length===0||Fe.location.includes(W.location))&&(Fe.ethnicity.length===0||W.ethnicity&&Fe.ethnicity.includes(W.ethnicity))&&(Fe.techSavviness.length===0||W.techSavviness!==void 0&&Fe.techSavviness.includes(W.techSavviness<30?"Low (0-30)":W.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&!0;let Ee=!0;return K!==Zl&&(Ee=!1,W.folder_ids&&Array.isArray(W.folder_ids)&&(Ee=W.folder_ids.includes(K)),Ee||(W.folder_id===K||W.folderId===K)&&(Ee=!0)),he&&fe&&Ee});if(console.log(`Filtered personas: ${O.length}/${E.length}`),console.log(`Selected folder: ${K===Zl?"All Personas":((q=M.find(W=>W._id===K||W.id===K))==null?void 0:q.name)||K}`),K!==Zl){const W=M.find(he=>he._id===K||he.id===K);if(W){const he=E.filter(fe=>fe.folder_ids&&Array.isArray(fe.folder_ids)?fe.folder_ids.includes(K):fe.folder_id===K||fe.folderId===K);console.log(`Folder details: ${W.name}, ID: ${W._id}, Contains: ${he.length} personas`),console.log("Personas in this folder:",he.map(fe=>fe.name))}}return O})(),gt=O=>{console.log("Toggling selection for participant ID:",O),k(q=>{const W=q.includes(O);console.log("Current selection:",{id:O,isCurrentlySelected:W,currentSelections:[...q]});const he=W?q.filter(fe=>fe!==O):[...q,O];return console.log("New selection:",he),he})},tn=async()=>{try{const O=Xe.getValues(),q={name:O.focusGroupName,status:"in-progress",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(O.duration),topic:O.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),discussionGuide:m},he=(await jt.create(q)).data;return console.log("Focus group created successfully:",he),he.focus_group_id}catch(O){throw console.error("Error saving focus group:",O),O}},it=y.useCallback(async()=>{if(!C.current){se.error("No discussion guide available",{description:"Please generate a discussion guide first"});return}z(!0);try{const{downloadDiscussionGuideAsMarkdown:O}=await jre(async()=>{const{downloadDiscussionGuideAsMarkdown:W}=await import("./discussionGuideMarkdown-eMXneipz.js");return{downloadDiscussionGuideAsMarkdown:W}},[]),q=Xe.getValues();O(C.current,q.focusGroupName),se.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(O){console.error("Error downloading discussion guide:",O),se.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{z(!1)}},[Xe]),pn=y.useCallback(async O=>{console.log("📝 handleSaveDiscussionGuide called with:",O),w?(C.current=O,console.log("📝 Skipping discussionGuide state update during editing to preserve focus")):(v(O),se.success("Discussion guide updated",{description:"Your changes have been saved."}))},[w]),Qt=y.useCallback(O=>{console.log("📝 Discussion guide editing state changed:",O),S(O),!O&&C.current&&(console.log("📝 Updating discussionGuide state after editing ended"),v(C.current))},[]),J=y.useCallback(()=>{},[]),oe=async()=>{if(!Xe.getValues().focusGroupName){se.error("Missing focus group name",{description:"Please provide a name for the focus group"});return}if(!m){se.error("Missing discussion guide",{description:"Please generate a discussion guide first"});return}if(j.length<1){se.error("Not enough participants",{description:"Please select at least one participant for the focus group"});return}console.log("Starting focus group with participants:",j);try{se.loading("Creating focus group...");let O;if(b){const q=Xe.getValues(),W={name:q.focusGroupName,status:"in-progress",participants:j,participants_count:j.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,discussionGuide:m},he=await jt.update(b,W);O=b,console.log("Draft focus group updated to in-progress:",he),e&&e()}else O=await tn();se.dismiss(),se.success("Focus group created successfully",{description:"The AI moderator is now running the session"}),r(`/focus-groups/${O}`)}catch(O){se.dismiss(),O!=null&&O.message,console.error("Failed to start focus group:",O),se.error("Failed to create focus group",{description:"Please try again or check your connection"})}};return a.jsxs(a.Fragment,{children:[a.jsx(Y,{}),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(Ps,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Focus Group Moderator"})]}),u&&a.jsx("div",{className:"mb-6",children:a.jsx(nT,{isActive:u,isComplete:f,hasError:p,label:"Generating discussion guide",onComplete:He})}),a.jsxs(Kl,{value:l,onValueChange:c,children:[a.jsxs(Ea,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(on,{value:"setup",children:"Setup"}),a.jsx(on,{value:"review",children:"Review & Edit"}),a.jsx(on,{value:"participants",children:"Participants"})]}),a.jsx(sn,{value:"setup",children:a.jsx(g0,{...Xe,children:a.jsxs("form",{onSubmit:Xe.handleSubmit(ht),className:"space-y-6",children:[a.jsx(dt,{control:Xe.control,name:"focusGroupName",render:({field:O})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Focus Group Name"}),a.jsx(at,{children:a.jsx(Dt,{placeholder:"e.g., Mobile App UX Evaluation",...O})}),a.jsx(xn,{children:"Give your focus group a descriptive name"}),a.jsx(lt,{})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(dt,{control:Xe.control,name:"researchBrief",render:({field:O})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Research Brief"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"Describe your research objectives...",className:"h-36",...O})}),a.jsx(xn,{children:"Provide context about what you want to learn"}),a.jsx(lt,{})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(dt,{control:Xe.control,name:"discussionTopics",render:({field:O})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Discussion Topics"}),a.jsx(at,{children:a.jsx(ct,{placeholder:"List main topics to cover, separated by commas",className:"h-24",...O})}),a.jsx(xn,{children:"E.g., User experience, feature preferences, pain points"}),a.jsx(lt,{})]})}),a.jsx(dt,{control:Xe.control,name:"duration",render:({field:O})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Duration (minutes)"}),a.jsxs(kn,{onValueChange:O.onChange,value:O.value,children:[a.jsx(at,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select duration"})})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"30",children:"30 minutes"}),a.jsx(le,{value:"45",children:"45 minutes"}),a.jsx(le,{value:"60",children:"60 minutes"}),a.jsx(le,{value:"90",children:"90 minutes"}),a.jsx(le,{value:"120",children:"120 minutes"})]})]}),a.jsx(xn,{children:"How long should the focus group session last?"}),a.jsx(lt,{})]})}),a.jsx(dt,{control:Xe.control,name:"llm_model",render:({field:O})=>a.jsxs(ot,{children:[a.jsx(st,{children:"AI Model"}),a.jsxs(kn,{onValueChange:O.onChange,value:O.value,children:[a.jsx(at,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select AI model"})})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(le,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(le,{value:"gpt-5",children:"GPT-5"})]})]}),a.jsx(xn,{children:"Choose which AI model to use for generating responses and discussion guides"}),a.jsx(lt,{})]})}),Xe.watch("llm_model")==="gpt-5"&&a.jsxs(a.Fragment,{children:[a.jsx(dt,{control:Xe.control,name:"reasoning_effort",render:({field:O})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Reasoning Effort"}),a.jsxs(kn,{onValueChange:O.onChange,value:O.value,children:[a.jsx(at,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select reasoning effort"})})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"minimal",children:"Minimal - Fast responses"}),a.jsx(le,{value:"low",children:"Low - Quick thinking"}),a.jsx(le,{value:"medium",children:"Medium - Balanced (default)"}),a.jsx(le,{value:"high",children:"High - Deep reasoning"})]})]}),a.jsx(xn,{children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx("div",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx(lt,{})]})}),a.jsx(dt,{control:Xe.control,name:"verbosity",render:({field:O})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Response Verbosity"}),a.jsxs(kn,{onValueChange:O.onChange,value:O.value,children:[a.jsx(at,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select verbosity level"})})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"low",children:"Low - Concise responses"}),a.jsx(le,{value:"medium",children:"Medium - Balanced length (default)"}),a.jsx(le,{value:"high",children:"High - Detailed responses"})]})]}),a.jsx(xn,{children:"Controls how detailed and lengthy GPT-5's responses will be"}),a.jsx("div",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx(lt,{})]})})]})]})]}),a.jsx(dt,{control:Xe.control,name:"creativeAssets",render:({field:{value:O,onChange:q,...W}})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Creative Assets (Optional)"}),a.jsx(at,{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(u4,{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(Dt,{...W,type:"file",accept:"image/*,.pdf",multiple:!0,onChange:he=>{q(he.target.files)},className:"hidden",id:"assets-file-input"}),a.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:()=>{var he;return(he=document.getElementById("assets-file-input"))==null?void 0:he.click()},children:[a.jsx(f4,{className:"mr-2 h-4 w-4"}),"Select Files"]}),O&&O.length>0&&a.jsxs("p",{className:"text-xs text-primary mt-2",children:[O.length," file(s) selected"]})]})}),a.jsx(xn,{children:"Upload visuals that you want feedback on during the session"}),a.jsx(lt,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx("div",{className:"flex justify-end",children:a.jsxs(te,{type:"submit",disabled:u,className:"min-w-32",children:[a.jsx(Ps,{className:"mr-2 h-4 w-4"}),u?"Generating...":"Generate Discussion Guide"]})})})]})})}),a.jsx(sn,{value:"review",children:a.jsxs("div",{className:"space-y-6",children:[a.jsx(ut,{children:a.jsxs(Et,{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"}),m&&a.jsx(ur,{variant:"outline",className:"text-xs",children:_(m)?"Structured JSON":"Legacy Text"})]})}),a.jsx("div",{className:"prose max-w-none",children:m?a.jsx(rT,{discussionGuide:m,showProgress:!1,collapsible:!0,defaultExpanded:!0,className:"border-0",onSave:pn,onDownload:it,onSectionSelect:J,isDownloading:$,focusGroupId:b,onEditingChange:Qt}):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.'})})]})}),P.length>0&&a.jsx(ut,{children:a.jsxs(Et,{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:P.map((O,q)=>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:O.type.startsWith("image/")?a.jsx("img",{src:URL.createObjectURL(O),alt:`Asset ${q+1}`,className:"max-h-full max-w-full object-contain"}):a.jsx(a1,{className:"h-10 w-10 text-slate-400"})}),a.jsx("p",{className:"text-xs truncate",children:O.name})]},q))})]})}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx(te,{variant:"outline",onClick:()=>c("setup"),children:"Back to Setup"}),a.jsxs(te,{onClick:()=>c("participants"),children:["Select Participants",a.jsx(Cr,{className:"ml-2 h-4 w-4"})]})]})]})}),a.jsxs(sn,{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(te,{variant:"ghost",size:"sm",onClick:()=>{console.log("Clicked 'Create new folder' button"),xe(!0)},className:"h-7 w-7 p-0",children:a.jsx(d4,{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:",E.length),X(Zl),setTimeout(()=>{console.log(`Will show all ${E.length} personas`)},0)},className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${K===Zl?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Ji,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),M.map(O=>a.jsx("div",{className:"flex items-center justify-between group",children:ie&&ie._id===O._id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(Ji,{className:"h-4 w-4"}),a.jsx(Dt,{value:Me,onChange:q=>pe(q.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:q=>{q.key==="Enter"?Sn():q.key==="Escape"&&yt()}}),a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming folder rename: "${ie==null?void 0:ie.name}" to "${Me}"`),Sn()},className:"h-7 w-7 p-0",children:a.jsx(Ts,{className:"h-4 w-4"})}),a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Cancelling rename of folder: "${ie==null?void 0:ie.name}"`),yt()},className:"h-7 w-7 p-0",children:a.jsx($o,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>{console.log(`Clicked folder: ${O.name} (ID: ${O._id})`);const q=E.filter(W=>W.folder_ids&&Array.isArray(W.folder_ids)?W.folder_ids.includes(O._id):W.folder_id===O._id||W.folderId===O._id);console.log(`Current persona count in folder: ${q.length}`),console.log("All personas count:",E.length),X(O._id),setTimeout(()=>{console.log(`Will show ${q.length} personas after filtering`),console.log("Filtered personas:",q.map(W=>W.name))},0)},className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${K===O._id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Ji,{className:"h-4 w-4"}),a.jsx("span",{children:O.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:E.filter(q=>q.folder_ids&&Array.isArray(q.folder_ids)?q.folder_ids.includes(O._id):q.folder_id===O._id||q.folderId===O._id).length})]}),a.jsxs(Y1,{children:[a.jsx(Q1,{asChild:!0,children:a.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(s1,{className:"h-4 w-4"})})}),a.jsx(nx,{align:"end",children:a.jsx(Ba,{onClick:()=>{console.log(`Initiating rename for folder: ${O.name} (ID: ${O.id})`),_r(O)},children:"Rename"})})]})]})},O._id)),re&&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(Ji,{className:"h-4 w-4"}),a.jsx(Dt,{value:F,onChange:O=>ue(O.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:O=>{O.key==="Enter"?$t():O.key==="Escape"&&Yt()}})]}),a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming creation of new folder: "${F}"`),$t()},className:"h-7 w-7 p-0",children:a.jsx(Ts,{className:"h-4 w-4"})}),a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{console.log("Cancelling folder creation"),Yt()},className:"h-7 w-7 p-0",children:a.jsx($o,{className:"h-4 w-4"})})]})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx(ut,{className:"mb-4",children:a.jsx(Et,{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(Cr,{className:"h-5 w-5 mr-2 text-muted-foreground"}),a.jsxs("span",{className:"text-sm font-medium",children:[j.length," of ",Ye.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(Qj,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Dt,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:Se,onChange:O=>Te(O.target.value)})]}),a.jsxs(te,{variant:"outline",className:"flex items-center gap-2",onClick:()=>rt(!0),children:[a.jsx(qj,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(Fe).some(O=>O.length>0)?` (${Object.values(Fe).reduce((O,q)=>O+q.length,0)})`:""]})]})]}),L?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(ws,{className:"h-8 w-8 animate-spin text-primary"})}):Ye.length>0?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Ye.map(O=>{const q=O._id||O.id;return a.jsx(_N,{user:{id:q,_id:O._id,name:O.name,age:O.age,gender:O.gender,occupation:O.occupation,location:O.location||"Unknown",techSavviness:O.techSavviness||50,personality:O.personality||"No description available",oceanTraits:O.oceanTraits,qualitativeAttributes:O.qualitativeAttributes,topPersonalityTraits:O.topPersonalityTraits,aiSynthesizedBio:O.aiSynthesizedBio},selected:j.includes(q),onSelectionToggle:()=>gt(q),onViewDetails:De},q)})}):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(te,{variant:"outline",onClick:()=>c("review"),children:"Back to Review"}),a.jsxs(te,{onClick:oe,disabled:j.length<1||!m,children:[a.jsx(zX,{className:"mr-2 h-4 w-4"}),"Start Focus Group Session"]})]})]})]}),a.jsx(kc,{open:ne,onOpenChange:O=>{O?(rt(O),Bt({...Fe})):rt(!1)},children:a.jsxs(xl,{className:"max-w-4xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(bl,{children:[a.jsx(Sl,{children:"Filter Personas"}),a.jsx(Oc,{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(mt).some(O=>O.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(mt).reduce((O,q)=>O+q.length,0)," active filters"]})}),(()=>{const O=we(E),q=Object.values(mt).every(he=>he.length===0),W=(he,fe,Ee=1)=>{const be=q?O[fe]:We(fe)[fe],bt=mt[fe],tt=[...new Set([...be,...bt])].sort();return tt.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:he}),a.jsx("div",{className:`grid grid-cols-1 ${Ee===2?"sm:grid-cols-2":Ee===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:tt.map(Gt=>{const Zt=mt[fe].includes(Gt),Dr=be.includes(Gt);return a.jsxs("div",{className:`flex items-center space-x-2 ${!Dr&&!Zt?"opacity-50":""}`,children:[a.jsx(vc,{id:`${fe}-${Gt}`,checked:Zt,onCheckedChange:()=>Ze(fe,Gt),disabled:!Dr&&!Zt}),a.jsxs(to,{htmlFor:`${fe}-${Gt}`,className:"truncate overflow-hidden",children:[Gt,Zt&&!Dr&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},Gt)})})]})};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(wl,{children:[a.jsx(te,{variant:"outline",onClick:Tt,children:"Reset"}),a.jsx(te,{onClick:St,children:"Apply Filters"})]})]})})]})]})]})]})}const Vce=[{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"}],Gce={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"},Kce=()=>{console.log("FocusGroups component rendering");const[t,e]=y.useState("view"),[n,r]=y.useState(""),[i,o]=y.useState([]),[s,l]=y.useState(!0),[c,u]=y.useState([]),[d,f]=y.useState(!1),[h,p]=y.useState(!1),[g,m]=y.useState(null),v=Xn(),b=Ei(),[x,w]=y.useState([]),S=y.useRef(!0),C=async(E=!0)=>{if(console.log("fetchFocusGroups called with isMountedCheck:",E),console.log("isMounted.current:",S.current),E&&!S.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 I=await jt.getAll();if(console.log("API response received:",I),!E||S.current){const L=I.data.map(V=>({...V,id:V.id||V._id,participants_count:Array.isArray(V.participants)?V.participants.length:typeof V.participants=="number"?V.participants:0}));o(L)}}catch(I){console.error("Error fetching focus groups:",I),(!E||S.current)&&(qe.error("Failed to load focus groups"),o(Vce))}finally{(!E||S.current)&&l(!1)}},A=async E=>{try{const I=await jt.getById(E);I&&I.data&&(m(I.data),e("create"))}catch(I){console.error("Error fetching focus group for edit:",I),qe.error("Failed to load focus group for editing")}};y.useEffect(()=>(console.log("useEffect running - about to fetch focus groups"),C(),()=>{console.log("useEffect cleanup - setting isMounted to false"),S.current=!1}),[]),y.useEffect(()=>{console.log("Mode change useEffect running, mode:",t),t==="view"&&(console.log("Mode is view, calling fetchFocusGroups"),C())},[t]),y.useEffect(()=>{const E=b.state;(E==null?void 0:E.mode)==="create"&&(E!=null&&E.preSelectedParticipants)&&(w(E.preSelectedParticipants),e("create"),v(b.pathname,{replace:!0,state:null}))},[b.state,b.pathname,v]),y.useEffect(()=>{const E=new URLSearchParams(b.search),I=E.get("mode"),L=E.get("id"),V=E.get("tab");if(I==="create")e("create"),m(null);else if(I==="edit"&&L){const $=i.find(z=>(z._id||z.id)===L);$?(m($),e("create")):A(L)}if(I||L||V){const $=b.pathname;v($,{replace:!0})}},[b.search,i,v,b.pathname]);const _=i.filter(E=>E.name.toLowerCase().includes(n.toLowerCase())||E.topic.toLowerCase().includes(n.toLowerCase())),j=E=>new Date(E).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),k=E=>new Date(E).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),P=E=>{u(I=>I.includes(E)?I.filter(L=>L!==E):[...I,E])},R=async()=>{if(c.length!==0){p(!0);try{const E=c.map(I=>jt.delete(I));await Promise.all(E),o(I=>I.filter(L=>!c.includes(L.id||L._id||""))),u([]),qe.success(`${c.length} focus group${c.length>1?"s":""} deleted successfully`)}catch(E){console.error("Error deleting focus groups:",E),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(aa,{}),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(te,{onClick:()=>{console.log("Create New Focus Group button clicked, current mode:",t);try{t==="view"?(console.log("Setting draft to null and switching to create mode"),m(null),e("create")):(console.log("Switching back to view mode"),e("view"))}catch(E){console.error("Error in Create New Focus Group onClick:",E)}},className:"hover-transition",children:t==="view"?"Create New Focus Group":"View All Focus Groups"})})]}),t==="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(Qj,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Dt,{placeholder:"Search focus groups by name or topic...",className:"pl-10 bg-white",value:n,onChange:E=>r(E.target.value)})]}),a.jsxs(te,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(qj,{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(Ps,{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(te,{variant:"destructive",size:"sm",onClick:()=>f(!0),disabled:h,className:"flex items-center gap-2",children:[a.jsx(Kn,{className:"h-4 w-4"}),"Delete Selected (",c.length,")"]})]}),s?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(ws,{className:"h-8 w-8 animate-spin text-primary"})}):_.length>0?a.jsx("div",{className:"space-y-4",children:_.map(E=>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(vc,{id:`select-${E.id||E._id}`,checked:c.includes(E.id||E._id||""),onCheckedChange:()=>P(E.id||E._id||""),className:"mt-1"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-2",children:E.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(jX,{className:"h-4 w-4 mr-1"}),j(E.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Ap,{className:"h-4 w-4 mr-1"}),k(E.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Cr,{className:"h-4 w-4 mr-1"}),E.participants_count||(Array.isArray(E.participants)?E.participants.length:0)," participant",E.participants_count>1||Array.isArray(E.participants)&&E.participants.length>1?"s":""]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Ap,{className:"h-4 w-4 mr-1"}),E.duration," min"]})]})]})]}),a.jsxs("div",{className:ke("px-3 py-1 rounded-full text-xs font-medium border",Gce[E.status]||"bg-gray-100 text-gray-800 border-gray-200"),children:[E.status==="completed"&&"Completed",E.status==="scheduled"&&"Scheduled",E.status==="in-progress"&&"In Progress",E.status==="active"&&"In Progress",E.status==="ai_mode"&&"In Progress",E.status==="paused"&&"Paused",E.status==="new"&&"Not Started",E.status==="draft"&&"Draft",!["completed","scheduled","in-progress","active","ai_mode","paused","new","draft"].includes(E.status)&&E.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:[E.topic==="user-experience"&&"User Experience",E.topic==="product-feedback"&&"Product Feedback",E.topic==="creative-testing"&&"Creative Testing",E.topic==="messaging-evaluation"&&"Messaging Evaluation",E.topic&&!["user-experience","product-feedback","creative-testing","messaging-evaluation"].includes(E.topic)&&E.topic.charAt(0).toUpperCase()+E.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(te,{variant:E.status==="in-progress"||E.status==="active"||E.status==="ai_mode"?"default":E.status==="new"||E.status==="draft"?"outline":"default",className:ke("w-full hover-transition",E.status==="new"?"bg-slate-200 text-slate-700 hover:bg-slate-300 border-slate-300":"",E.status==="draft"?"bg-gray-200 text-gray-700 hover:bg-gray-300 border-gray-300":""),onClick:()=>{if(E.status==="draft")m(E),e("create");else{const I=E.id||E._id;console.log("Navigating to focus group:",I),v(`/focus-groups/${I}`)}},children:E.status==="completed"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(Zi,{className:"ml-2 h-4 w-4"})]}):E.status==="in-progress"||E.status==="active"||E.status==="ai_mode"?a.jsxs(a.Fragment,{children:["Join Session",a.jsx(Zi,{className:"ml-2 h-4 w-4"})]}):E.status==="paused"?a.jsxs(a.Fragment,{children:["Session Details",a.jsx(Zi,{className:"ml-2 h-4 w-4"})]}):E.status==="scheduled"?a.jsxs(a.Fragment,{children:["View Details",a.jsx(Zi,{className:"ml-2 h-4 w-4"})]}):E.status==="new"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(Zi,{className:"ml-2 h-4 w-4"})]}):E.status==="draft"?a.jsxs(a.Fragment,{children:["Edit",a.jsx(Zi,{className:"ml-2 h-4 w-4"})]}):a.jsxs(a.Fragment,{children:["View Session",a.jsx(Zi,{className:"ml-2 h-4 w-4"})]})})})]})},E.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(zce,{draftToEdit:g,preSelectedParticipants:x,onDraftSaved:()=>{m(null),e("view"),w([]),C()}})]}),a.jsx(X1,{open:d,onOpenChange:f,children:a.jsxs(ix,{children:[a.jsxs(ox,{children:[a.jsxs(ax,{children:["Delete ",c.length," Focus Group",c.length!==1?"s":"","?"]}),a.jsxs(lx,{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(sx,{children:[a.jsx(ux,{disabled:h,children:"Cancel"}),a.jsx(cx,{onClick:E=>{E.preventDefault(),R()},disabled:h,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:h?a.jsxs(a.Fragment,{children:[a.jsx(ws,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):a.jsx(a.Fragment,{children:"Delete"})})]})]})})]})},Wce=({participants:t,selectedParticipantIds:e,onToggleParticipantFilter:n})=>{const r=Xn(),{id:i}=Gj(),{setPreviousRoute:o}=T0(),s=c=>{const u=c.id||c._id;u&&i&&(o(`/focus-groups/${i}`,{focusGroupId:i}),r(`/personas/${u}`))},l=c=>{const u=c.id||c._id;u&&n(u)};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(Cr,{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(ea,{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"})]})]}),t.map(c=>{const u=c.id||c._id,d=e.includes(u);return a.jsxs("div",{className:`flex items-center p-2 rounded-lg transition-colors ${d?"bg-blue-50 border border-blue-200":"hover:bg-slate-100"}`,children:[a.jsx("div",{className:"cursor-pointer mr-3",onClick:()=>s(c),title:`View ${c.name}'s profile`,children:a.jsx("img",{src:eg(c),alt:c.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:()=>l(c),title:`Filter to show only ${c.name}'s messages`,children:c.name}),d&&a.jsx(Ts,{className:"h-4 w-4 text-blue-600 ml-2"})]}),a.jsx("p",{className:"text-xs text-slate-500",children:c.occupation})]})]},c.id)})]})]})})};function qce(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var iT="ScrollArea",[lz,e$e]=ji(iT),[Yce,go]=lz(iT),cz=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:o=600,...s}=t,[l,c]=y.useState(null),[u,d]=y.useState(null),[f,h]=y.useState(null),[p,g]=y.useState(null),[m,v]=y.useState(null),[b,x]=y.useState(0),[w,S]=y.useState(0),[C,A]=y.useState(!1),[_,j]=y.useState(!1),k=_t(e,R=>c(R)),P=uu(i);return a.jsx(Yce,{scope:n,type:r,dir:P,scrollHideDelay:o,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:A,scrollbarY:m,onScrollbarYChange:v,scrollbarYEnabled:_,onScrollbarYEnabledChange:j,onCornerWidthChange:x,onCornerHeightChange:S,children:a.jsx(et.div,{dir:P,...s,ref:k,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});cz.displayName=iT;var uz="ScrollAreaViewport",dz=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,asChild:i,nonce:o,...s}=t,l=go(uz,n),c=y.useRef(null),u=_t(e,c,l.onViewportChange);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:` +`).filter(un=>un.trim()):[];V(N.id,{probes:Vt},Q)},placeholder:"Enter probe questions, one per line...",className:"min-h-[40px]"})]}),(((Je=N.metadata)==null?void 0:Je.image_url)||((Xe=N.metadata)==null?void 0:Xe.image_id)||We)&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Cv,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),($t=N.metadata)!=null&&$t.image_url?a.jsx("img",{src:N.metadata.image_url,alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):(Yt=N.metadata)!=null&&Yt.image_id&&h?a.jsx("img",{src:_t.getAssetUrl(h,N.metadata.image_id),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):We&&h?a.jsx("img",{src:_t.getAssetUrl(h,We),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]}),a.jsx("div",{className:"flex-shrink-0",children:a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>W(N.id,Q),className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:a.jsx(Kn,{className:"h-3 w-3"})})})]},`edit-item-${N.id}`):a.jsxs("div",{className:Pe("flex items-start gap-3 p-3 rounded-lg border transition-colors",Ce&&"bg-blue-50 border-blue-200",Me&&"bg-green-50 border-green-200",!Ce&&!Me&&"bg-slate-50 border-slate-200",r&&"cursor-pointer hover:bg-slate-100"),onClick:()=>r==null?void 0:r(m.sections[D].id,N.id),children:[a.jsx("div",{className:"flex-shrink-0 mt-1",children:Me?a.jsx(Gj,{className:"h-4 w-4 text-green-600"}):Ce?a.jsx(l4,{className:"h-4 w-4 text-blue-600"}):a.jsx(Kj,{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(ur,{variant:"outline",className:"text-xs whitespace-nowrap",children:Q==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(Qs,{className:"h-3 w-3 mr-1"}),typeof N.type=="string"?N.type.replace("_"," "):String(N.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(us,{className:"h-3 w-3 mr-1"}),typeof N.type=="string"?N.type.replace("_"," "):String(N.type||"unknown")]})}),N.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500 whitespace-nowrap",children:[a.jsx(Cp,{className:"h-3 w-3"}),N.time_limit," min"]}),i&&a.jsxs(te,{size:"sm",variant:"ghost",onClick:ft=>{ft.stopPropagation();const Vt=m.sections[D],un=Q==="activity"?`Activity ${H+1}`:`Question ${H+1}`;i(Vt.id,N.id,N.content,Vt.title,un,Q)},className:"h-6 px-2 ml-auto",children:[a.jsx(Av,{className:"h-3 w-3 mr-1"}),"Set Position"]})]}),a.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:N.content}),N.probes&&N.probes.length>0&&a.jsxs("div",{className:"mt-2 pl-4 border-l-2 border-slate-200",children:[a.jsx("p",{className:"text-xs font-medium text-slate-600 mb-1",children:"Probe Questions:"}),a.jsx("ul",{className:"space-y-1",children:N.probes.map((ft,Vt)=>a.jsxs("li",{className:"text-xs text-slate-600",children:["• ",ft]},Vt))})]}),(((_r=N.metadata)==null?void 0:_r.image_url)||((Sn=N.metadata)==null?void 0:Sn.image_id)||We)&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Cv,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),(yt=N.metadata)!=null&&yt.image_url?a.jsx("img",{src:N.metadata.image_url,alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):(qe=N.metadata)!=null&&qe.image_id&&h?a.jsx("img",{src:_t.getAssetUrl(h,N.metadata.image_id),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):We&&h?a.jsx("img",{src:_t.getAssetUrl(h,We),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]})]},N.id)},mt=(N,D)=>{var ee,me,Ce,Me;const H=v.has(N.id),Q=x===N.id,J=Q?S:N,B=(n==null?void 0:n.moderator_position.section_index)===D;return a.jsxs("div",{className:Pe("border rounded-lg overflow-hidden transition-colors",B&&"border-blue-500 shadow-md",!B&&"border-slate-200"),children:[a.jsxs("div",{className:Pe("px-4 py-3 flex items-center justify-between cursor-pointer hover:bg-slate-50 transition-colors",B&&"bg-blue-50"),onClick:()=>!Q&&re(N.id),children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"transition-transform",style:{transform:H?"rotate(90deg)":"rotate(0deg)"},children:a.jsx(Ji,{className:"h-5 w-5 text-slate-500"})}),a.jsx("h3",{className:"font-semibold text-slate-800",children:Q?a.jsx(Dt,{value:J.title,onChange:we=>L({title:we.target.value}),onClick:we=>we.stopPropagation(),className:"font-semibold"}):J.title}),B&&a.jsx(ur,{variant:"default",className:"text-xs",children:"Current"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[o&&!Q&&a.jsx(te,{size:"sm",variant:"ghost",onClick:we=>{we.stopPropagation(),E(N)},className:"h-8 px-2",children:a.jsx(aO,{className:"h-3 w-3"})}),Q&&a.jsxs("div",{className:"flex items-center gap-2",onClick:we=>we.stopPropagation(),children:[a.jsxs(te,{size:"sm",variant:"default",onClick:X,disabled:A,className:"h-8",children:[A?a.jsx(ws,{className:"h-3 w-3 animate-spin"}):a.jsx(qj,{className:"h-3 w-3"}),a.jsx("span",{className:"ml-1",children:"Save"})]}),a.jsxs(te,{size:"sm",variant:"ghost",onClick:R,disabled:A,className:"h-8",children:[a.jsx($o,{className:"h-3 w-3"}),a.jsx("span",{className:"ml-1",children:"Cancel"})]})]})]})]}),H&&a.jsxs("div",{className:"px-4 py-3 border-t border-slate-200 space-y-4",children:[J.content&&a.jsx("div",{className:"prose prose-sm max-w-none",children:Q?a.jsx(lt,{value:J.content,onChange:we=>L({content:we.target.value}),placeholder:"Section introduction or context...",className:"min-h-[80px] w-full"}):a.jsx("p",{className:"text-slate-700",children:J.content})}),J.activities&&J.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(Qs,{className:"h-4 w-4"}),"Activities"]}),Q&&a.jsxs(te,{size:"sm",variant:"outline",onClick:()=>$("activity"),className:"h-7",children:[a.jsx(Qs,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),a.jsx("div",{className:"space-y-2",children:(ee=J.activities)==null?void 0:ee.map((we,We)=>vt(we,D,We,"activity"))})]}):null,J.questions&&J.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(us,{className:"h-4 w-4"}),"Questions"]}),Q&&a.jsxs(te,{size:"sm",variant:"outline",onClick:()=>$("question"),className:"h-7",children:[a.jsx(us,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),a.jsx("div",{className:"space-y-2",children:(me=J.questions)==null?void 0:me.map((we,We)=>vt(we,D,We,"question"))})]}):null,Q&&a.jsx("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(Av,{className:"h-4 w-4"}),"Subsections"]}),a.jsxs(te,{size:"sm",variant:"outline",onClick:M,className:"h-7",children:[a.jsx(Av,{className:"h-3 w-3 mr-1"}),"Add Subsection"]})]})}),J.subsections&&J.subsections.length>0&&a.jsx("div",{className:"space-y-3 ml-4",children:J.subsections.map((we,We)=>{var wt,Nt;return a.jsxs("div",{className:"border-l-2 border-slate-200 pl-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[Q&&a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Re(We),disabled:!oe(J.subsections||[],We),className:"h-7 w-7 p-0",title:"Move subsection up",children:a.jsx(Hc,{className:"h-4 w-4"})}),a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>pe(We),disabled:!de(J.subsections||[],We),className:"h-7 w-7 p-0",title:"Move subsection down",children:a.jsx(va,{className:"h-4 w-4"})})]}),Q&&j===we.id?a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx(Dt,{value:P,onChange:Je=>I(Je.target.value),className:"flex-1",onKeyDown:Je=>{Je.key==="Enter"?ne():Je.key==="Escape"&&Ne()},autoFocus:!0}),a.jsx(te,{size:"sm",onClick:ne,children:a.jsx(Ts,{className:"h-3 w-3"})}),a.jsx(te,{size:"sm",variant:"outline",onClick:Ne,children:a.jsx($o,{className:"h-3 w-3"})})]}):a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx("h5",{className:Pe("font-medium text-slate-700",Q&&"cursor-pointer hover:text-blue-600"),onClick:()=>Q&&Se(we.id,we.title),children:we.title}),Q&&a.jsxs(a.Fragment,{children:[a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Se(we.id,we.title),className:"h-6 w-6 p-0 opacity-60 hover:opacity-100",children:a.jsx(aO,{className:"h-3 w-3"})}),a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>U(We),className:"h-6 w-6 p-0 opacity-60 hover:opacity-100 text-red-600 hover:text-red-700",title:"Delete subsection",children:a.jsx(Kn,{className:"h-3 w-3"})})]})]})]}),we.questions&&we.questions.length>0||Q?a.jsxs("div",{className:"space-y-2 mb-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h6",{className:"text-sm font-medium text-slate-600 flex items-center gap-1",children:[a.jsx(us,{className:"h-3 w-3"}),"Questions"]}),Q&&a.jsxs(te,{size:"sm",variant:"outline",onClick:()=>z(We,"question"),className:"h-6",children:[a.jsx(us,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),a.jsx("div",{className:"space-y-2",children:(wt=we.questions)==null?void 0:wt.map((Je,Xe)=>vt(Je,D,Xe,"question",We))})]}):null,we.activities&&we.activities.length>0||Q?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h6",{className:"text-sm font-medium text-slate-600 flex items-center gap-1",children:[a.jsx(Qs,{className:"h-3 w-3"}),"Activities"]}),Q&&a.jsxs(te,{size:"sm",variant:"outline",onClick:()=>z(We,"activity"),className:"h-6",children:[a.jsx(Qs,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),a.jsx("div",{className:"space-y-2",children:(Nt=we.activities)==null?void 0:Nt.map((Je,Xe)=>vt(Je,D,Xe,"activity",We))})]}):null]},we.id)})}),(((Ce=N.metadata)==null?void 0:Ce.image_url)||((Me=N.metadata)==null?void 0:Me.image_id))&&a.jsxs("div",{className:"mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Cv,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),N.metadata.image_url?a.jsx("img",{src:N.metadata.image_url,alt:"Visual aid for section",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):N.metadata.image_id&&h?a.jsx("img",{src:_t.getAssetUrl(h,N.metadata.image_id),alt:"Visual aid for section",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]})]},N.id)};if(g)return a.jsxs("div",{className:Pe("space-y-4",u),children:[s&&n&&a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-600 mb-2",children:[a.jsx("span",{children:"Progress"}),a.jsxs("span",{children:[Math.round(n.progress),"%"]})]}),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",style:{width:`${n.progress}%`}})})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h2",{className:"text-xl font-semibold text-slate-800",children:"Discussion Guide"}),d&&a.jsxs(te,{size:"sm",variant:"outline",onClick:d,disabled:f,children:[f?a.jsx(ws,{className:"h-4 w-4 animate-spin mr-2"}):a.jsx(zc,{className:"h-4 w-4 mr-2"}),"Download"]})]}),a.jsx("div",{className:"prose prose-sm max-w-none",children:a.jsx("pre",{className:"whitespace-pre-wrap text-sm text-slate-700 font-sans",children:e})}),n&&a.jsxs("div",{className:"mt-6 p-4 bg-blue-50 rounded-lg border border-blue-200",children:[a.jsx("h3",{className:"font-medium text-blue-900 mb-2",children:"Current Position"}),a.jsx("p",{className:"text-sm text-blue-800",children:n.current_section}),n.current_item&&a.jsx("p",{className:"text-sm text-blue-700 mt-1",children:n.current_item})]})]})]});if(!m)return a.jsx("div",{className:Pe("bg-slate-50 rounded-lg p-8 text-center",u),children:a.jsx("p",{className:"text-slate-600",children:"No discussion guide available"})});const Bt=a.jsxs("div",{className:"space-y-4",children:[s&&n&&a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-600 mb-2",children:[a.jsx("span",{children:"Overall Progress"}),a.jsxs("span",{children:[Math.round(n.progress),"%"]})]}),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",style:{width:`${n.progress}%`}})}),a.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-500 mt-2",children:[a.jsxs("span",{children:["Section ",n.moderator_position.section_index+1," of ",n.total_sections]}),a.jsxs("span",{children:[Math.round(n.section_progress),"% of current section"]})]})]}),a.jsx("div",{className:"space-y-3",children:m.sections.map((N,D)=>mt(N,D))})]});return l?a.jsxs(eg,{defaultOpen:c,className:u,children:[a.jsx(tg,{asChild:!0,children:a.jsxs("div",{className:"flex items-center justify-between p-4 bg-white rounded-lg border border-slate-200 cursor-pointer hover:bg-slate-50 transition-colors",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Ji,{className:"h-5 w-5 text-slate-500 transition-transform data-[state=open]:rotate-90"}),a.jsx("h2",{className:"text-lg font-semibold text-slate-800",children:m.title||"Discussion Guide"}),a.jsxs(ur,{variant:"outline",className:"text-xs",children:[m.total_duration," min"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[n&&a.jsxs(ur,{variant:n.progress===100?"success":"default",className:"text-xs",children:[Math.round(n.progress),"% Complete"]}),d&&a.jsx(te,{size:"sm",variant:"outline",onClick:N=>{N.stopPropagation(),d()},disabled:f,children:f?a.jsx(ws,{className:"h-4 w-4 animate-spin"}):a.jsx(zc,{className:"h-4 w-4"})})]})]})}),a.jsx(ng,{className:"mt-4",children:Bt})]}):a.jsx("div",{className:u,children:Bt})});nT.displayName="DiscussionGuideViewer";const Jl="all",Bce=Oe.object({researchBrief:Oe.string().min(10,{message:"Research brief must be at least 10 characters."}),focusGroupName:Oe.string().min(3,{message:"Focus group name must be at least 3 characters."}),discussionTopics:Oe.string().min(10,{message:"Discussion topics are required."}),creativeAssets:Oe.instanceof(FileList).optional(),duration:Oe.string().min(1,{message:"Duration is required."}),llm_model:Oe.string().optional(),reasoning_effort:Oe.string().optional(),verbosity:Oe.string().optional()});function Hce({draftToEdit:t,onDraftSaved:e,preSelectedParticipants:n=[]}={}){console.log("FocusGroupModerator component rendering, draftToEdit:",t);const r=Xn();Ei();const{setPreviousRoute:i,navigationState:o,clearNavigationState:s}=N0(),[l,c]=y.useState("setup"),[u,d]=y.useState(!1),[f,h]=y.useState(!1),[p,g]=y.useState(!1),[m,v]=y.useState(null),[b,x]=y.useState(null),[w,S]=y.useState(!1),C=y.useRef(m);C.current=m;const A=y.useRef(!1),_=O=>O&&typeof O=="object"&&O.title&&O.sections,[j,k]=y.useState([]),[P,I]=y.useState([]),[E,R]=y.useState([]),[L,V]=y.useState(!1),[$,z]=y.useState(!1),[M,U]=y.useState([]),[W,X]=y.useState(Jl),[re,xe]=y.useState(!1),[F,fe]=y.useState(""),[oe,de]=y.useState(null),[Re,pe]=y.useState(""),[Se,Ne]=y.useState(""),[ne,nt]=y.useState(!1),[Fe,vt]=y.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[mt,Bt]=y.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[N,D]=y.useState("idle"),[H,Q]=y.useState(null),[J,B]=y.useState(0),ee=y.useRef(null),me=y.useRef(!1),Ce=y.useRef(!1),Me=O=>{i("/focus-groups",{focusGroupId:b,focusGroupTab:"participants",isNewFocusGroup:!t,focusGroupData:{name:qe.getValues("name"),description:qe.getValues("description"),selectedParticipants:j,discussionGuide:m}}),r(`/synthetic-users/${O.id}`)},we=O=>{const q={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return O.forEach(K=>{if(K.age&&q.age.add(K.age),K.gender&&q.gender.add(K.gender),K.occupation&&q.occupation.add(K.occupation),K.location&&q.location.add(K.location),K.techSavviness!==void 0){const le=K.techSavviness<30?"Low (0-30)":K.techSavviness<70?"Medium (31-70)":"High (71-100)";q.techSavviness.add(le)}K.ethnicity&&q.ethnicity.add(K.ethnicity)}),{age:Array.from(q.age).sort(),gender:Array.from(q.gender).sort(),occupation:Array.from(q.occupation).sort(),location:Array.from(q.location).sort(),techSavviness:Array.from(q.techSavviness).sort((K,le)=>{const ue=["Low (0-30)","Medium (31-70)","High (71-100)"];return ue.indexOf(K)-ue.indexOf(le)}),ethnicity:Array.from(q.ethnicity).sort()}},We=O=>{const q={...mt};q[O]=[];const K=E.filter(le=>{let ue=!0;return W!==Jl&&(ue=!1,le.folder_ids&&Array.isArray(le.folder_ids)&&(ue=le.folder_ids.includes(W)),!ue&&(le.folder_id===W||le.folderId===W)&&(ue=!0)),ue?Object.entries(q).every(([De,be])=>{if(be.length===0)return!0;const Tt=De;if(Tt==="techSavviness"&&le.techSavviness!==void 0){const ut=le.techSavviness<30?"Low (0-30)":le.techSavviness<70?"Medium (31-70)":"High (71-100)";return be.includes(ut)}else{if(Tt==="age"&&le.age)return be.includes(le.age);if(Tt==="gender"&&le.gender)return be.includes(le.gender);if(Tt==="occupation"&&le.occupation)return be.includes(le.occupation);if(Tt==="location"&&le.location)return be.includes(le.location);if(Tt==="ethnicity"&&le.ethnicity)return be.includes(le.ethnicity)}return!0}):!1});return we(K)},wt=()=>{nt(!1),setTimeout(()=>{vt({...mt})},0)},Nt=()=>{Bt({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]})},Je=(O,q)=>{Bt(K=>{const le={...K};return le[O].includes(q)?le[O]=le[O].filter(ue=>ue!==q):le[O]=[...le[O],q],le})},Xe=async()=>{try{const K=(await ds.getAll()).data.map(le=>({...le,id:le._id}));return U(K),K}catch(O){return console.error("Error fetching folders:",O),ie.error("Failed to load folders"),U([]),[]}},$t=async()=>{if(!F.trim()){ie.error("Please enter a folder name");return}try{const O=await ds.create({name:F.trim()});await Xe(),fe(""),xe(!1),ie.success(`Folder "${F}" created`)}catch(O){console.error("Error creating folder:",O),ie.error("Failed to create folder")}},Yt=()=>{fe(""),xe(!1)},_r=O=>{de(O),pe(O.name)},Sn=async()=>{if(!oe||!Re.trim()){de(null);return}try{await ds.update(oe._id,{name:Re.trim()}),await Xe(),de(null),ie.success(`Folder renamed to "${Re}"`)}catch(O){console.error("Error renaming folder:",O),ie.error("Failed to rename folder"),de(null)}},yt=()=>{de(null),pe("")};y.useEffect(()=>{const O=async()=>{V(!0);try{const K=await kr.getAll();console.log("Fetched personas for FocusGroupModerator:",K.data),Array.isArray(K.data)&&K.data.length>0?R(K.data):(console.warn("No personas returned from API or invalid format",K.data),ie.warning("No participants available"))}catch(K){console.error("Error fetching personas:",K),ie.error("Failed to load participants")}finally{V(!1)}};(async()=>{await Promise.all([Xe(),O()])})()},[]),console.log("About to initialize form with useForm hook");const qe=f0({resolver:h0(Bce),defaultValues:{researchBrief:"",focusGroupName:"",discussionTopics:"",duration:"60",llm_model:"gemini-2.5-pro",reasoning_effort:"medium",verbosity:"medium"}});console.log("Form initialized successfully");const ft=()=>{l!=="setup"||Ce.current||(ee.current&&clearTimeout(ee.current),ee.current=setTimeout(async()=>{if(me.current)return;const O=qe.getValues(),q={name:O.focusGroupName||"",description:O.researchBrief||"",objective:O.researchBrief||"",topic:O.discussionTopics||"",duration:O.duration?parseInt(O.duration):60,llm_model:O.llm_model||"gemini-2.5-pro",reasoning_effort:O.reasoning_effort||"medium",verbosity:O.verbosity||"medium",participants:j,participants_count:j.length,status:"draft",date:new Date().toISOString(),uploadedAssets:P.map(K=>K.name)};if(!(H&&JSON.stringify(q)===JSON.stringify(H))&&!(!q.name&&!q.description&&!q.topic)){me.current=!0,D("saving");try{let K=b||(t==null?void 0:t.id)||(t==null?void 0:t._id);if(console.log("Auto-save: draftFocusGroupId =",b),console.log("Auto-save: draftToEdit ID =",(t==null?void 0:t.id)||(t==null?void 0:t._id)),console.log("Auto-save: using focusGroupId =",K),console.log("Auto-save: llm_model in currentData =",q.llm_model),console.log("Auto-save: duration in currentData =",q.duration),K)console.log("Auto-save: Updating existing focus group:",K),await _t.update(K,q),console.log("Auto-save: Updated existing draft:",K);else{console.log("Auto-save: Creating NEW focus group (no existing ID)");const le=await _t.create(q);K=le.data.focus_group_id||le.data.id||le.data._id,x(K),console.log("Auto-save: Created new draft with ID:",K)}Q(q),D("saved"),B(0),setTimeout(()=>{D("idle")},2e3)}catch(K){if(console.error("Auto-save failed:",K),D("error"),B(le=>le+1),J<3){const le=Math.pow(2,J)*2e3;setTimeout(()=>{ft()},le)}else ie.error("Auto-save failed",{description:"Your changes may not be saved. Please check your connection."})}finally{me.current=!1}}},2e3))},Vt=qe.watch(),un=y.useRef(""),Wi=y.useRef(""),Ls=y.useRef("");y.useEffect(()=>{const O=JSON.stringify(Vt);l==="setup"&&O!==un.current&&(un.current=O,ft())},[Vt,l]),y.useEffect(()=>{const O=JSON.stringify(j);l==="setup"&&O!==Wi.current&&(Wi.current=O,ft())},[j,l]),y.useEffect(()=>{const O=JSON.stringify(P.map(q=>q.name));l==="setup"&&O!==Ls.current&&(Ls.current=O,ft())},[P,l]),y.useEffect(()=>(l!=="setup"&&ee.current&&clearTimeout(ee.current),()=>{ee.current&&clearTimeout(ee.current)}),[l]),y.useEffect(()=>{if(console.log("Draft loading effect - draftToEdit:",t,"draftLoadedRef.current:",A.current),!t){A.current=!1;return}if(t&&!A.current){console.log("Loading draft focus group:",t),Ce.current=!0,A.current=!0;const O=t.id||t._id;x(O),console.log("Setting draft ID from draftToEdit:",O),t.name&&qe.setValue("focusGroupName",t.name),(t.description||t.objective)&&qe.setValue("researchBrief",t.description||t.objective||""),t.topic&&qe.setValue("discussionTopics",t.topic),t.duration&&qe.setValue("duration",t.duration.toString()),t.llm_model&&qe.setValue("llm_model",t.llm_model),t.reasoning_effort&&qe.setValue("reasoning_effort",t.reasoning_effort),t.verbosity&&qe.setValue("verbosity",t.verbosity),t.discussionGuide&&(v(t.discussionGuide),(!o.focusGroupTab||o.previousRoute!=="/focus-groups")&&c("review")),t.participants&&Array.isArray(t.participants)&&k(t.participants);const q={name:t.name||"",description:t.description||t.objective||"",objective:t.description||t.objective||"",topic:t.topic||"",duration:t.duration||60,llm_model:t.llm_model||"gemini-2.5-pro",reasoning_effort:t.reasoning_effort||"medium",verbosity:t.verbosity||"medium",participants:t.participants||[],participants_count:(t.participants||[]).length,status:"draft",date:t.date||new Date().toISOString(),uploadedAssets:[]};Q(q),console.log("Set lastSavedData to current draft:",q),ie.success("Draft focus group loaded",{description:"Continue editing your focus group setup"}),setTimeout(()=>{Ce.current=!1;const K=JSON.stringify(qe.getValues());un.current=K},1e3)}},[t,qe]),y.useEffect(()=>{n.length>0&&(console.log("Pre-selected participants received:",n),k(n),c("participants"))},[n]),y.useEffect(()=>{o.focusGroupTab&&o.previousRoute==="/focus-groups"&&setTimeout(()=>{c(o.focusGroupTab),s()},0)},[o.focusGroupTab,t,s]),y.useEffect(()=>{t||setTimeout(()=>{Ce.current=!1;const O=JSON.stringify(qe.getValues());un.current=O},500)},[t,qe]);const Y=()=>{if(N==="idle")return null;const q={saving:{text:"Saving...",className:"text-blue-600 bg-blue-50"},saved:{text:"All changes saved",className:"text-green-600 bg-green-50"},error:{text:"Save failed - retrying...",className:"text-red-600 bg-red-50"}}[N];return a.jsx("div",{className:`fixed top-16 left-1/2 transform -translate-x-1/2 z-50 px-3 py-1 rounded-md text-sm font-medium border shadow-sm ${q.className}`,children:q.text})},ke=async(O,q)=>{var K,le;d(!0),h(!1),g(!1);try{const ue={name:O.focusGroupName,description:O.researchBrief,objective:O.researchBrief,topic:O.discussionTopics,duration:parseInt(O.duration),llm_model:O.llm_model,reasoning_effort:O.reasoning_effort,verbosity:O.verbosity},De=q?await _t.generateDiscussionGuideForGroup(q,ue):await _t.generateDiscussionGuide(ue);if(De.data&&De.data.discussionGuide)return h(!0),De.data.discussionGuide;throw new Error("Failed to generate discussion guide")}catch(ue){console.error("Error generating discussion guide:",ue),g(!0);let De="Unknown error occurred";throw(le=(K=ue==null?void 0:ue.response)==null?void 0:K.data)!=null&&le.error?De=ue.response.data.error:ue!=null&&ue.message&&(De=ue.message),De.includes("500")||De.includes("internal error")||De.includes("Internal Server Error")?ie.error("AI service temporarily unavailable",{description:"The discussion guide generator is experiencing issues. Please try again in a few minutes.",action:{label:"Retry",onClick:()=>ke(O)}}):ie.error("Failed to generate discussion guide",{description:De,action:{label:"Retry",onClick:()=>ke(O)}}),ue}},He=()=>{d(!1),h(!1),g(!1)};async function ht(O){var q;try{let K=b;if(!K){const le={name:O.focusGroupName,status:"draft",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(O.duration),topic:O.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:O.researchBrief,objective:O.researchBrief,llm_model:O.llm_model,reasoning_effort:O.reasoning_effort,verbosity:O.verbosity},ue=await _t.create(le);K=ue.data.focus_group_id||ue.data.id||ue.data._id,x(K),console.log("Draft focus group created for asset upload:",ue,"with ID:",K)}if(O.creativeAssets&&O.creativeAssets.length>0&&K)try{const le=new FormData;Array.from(O.creativeAssets).forEach(Tt=>{le.append("assets",Tt)});const De=(await _t.uploadAssets(K,le,!0)).data;console.log("Assets uploaded successfully:",De),ie.success(`${De.uploaded_assets} asset(s) uploaded successfully`,{description:"Assets will be included in the discussion guide"});const be=Array.from(O.creativeAssets);I(be)}catch(le){console.error("Asset upload failed:",le);const ue=(q=le.response)==null?void 0:q.data;let De="Asset upload failed",be="Some assets could not be uploaded";(ue==null?void 0:ue.code)==="TEMP_DIR_ERROR"?(De="Upload temporarily unavailable",be="Server storage issue. Please try again in a moment."):(ue==null?void 0:ue.code)==="UPLOAD_SYSTEM_FAILURE"?(De="Upload system unavailable",be="Critical server issue. Please contact support."):ue!=null&&ue.can_retry&&(De="Upload failed - can retry",be=(ue==null?void 0:ue.details)||"Please try uploading again."),ie.error(De,{description:be}),console.log("Continuing without assets due to upload failure")}if(K)try{const le={name:O.focusGroupName,participants:j,participants_count:j.length,duration:parseInt(O.duration),topic:O.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:O.researchBrief,objective:O.researchBrief,llm_model:O.llm_model,reasoning_effort:O.reasoning_effort,verbosity:O.verbosity};await _t.update(K,le),console.log("Focus group updated with latest form values before guide generation"),console.log(`🔄 Updated focus group ${K} with model: ${O.llm_model}`)}catch(le){console.error("Failed to update focus group before guide generation:",le)}try{const le=await ke(O,K);v(le);try{const ue={name:O.focusGroupName,status:"draft",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(O.duration),topic:O.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:O.researchBrief,objective:O.researchBrief,llm_model:O.llm_model,reasoning_effort:O.reasoning_effort,verbosity:O.verbosity,discussionGuide:le};await _t.update(K,ue),console.log("Focus group updated with discussion guide"),ie.success("Progress saved as draft",{description:"Your focus group setup has been automatically saved"})}catch(ue){console.error("Failed to update focus group with discussion guide:",ue),ie.error("Failed to save draft",{description:"Discussion guide generated, but draft save failed"})}c("review"),ie.success("Discussion guide generated",{description:"Review and edit before proceeding"})}catch(le){console.error("Discussion guide generation failed:",le),ie.error("Discussion guide generation failed",{description:"Please go back to the setup tab and try generating again. Check your inputs and try a different AI model if the issue persists.",duration:8e3});return}}catch(K){console.error("Error in focus group creation flow:",K),ie.error("Focus group creation failed",{description:K.message||"An unexpected error occurred"})}}const Qe=(()=>{var q;const O=E.filter(K=>{const le=K.name.toLowerCase().includes(Se.toLowerCase())||K.occupation&&K.occupation.toLowerCase().includes(Se.toLowerCase())||K.location&&K.location.toLowerCase().includes(Se.toLowerCase()),ue=(Fe.age.length===0||Fe.age.includes(K.age))&&(Fe.gender.length===0||Fe.gender.includes(K.gender))&&(Fe.occupation.length===0||Fe.occupation.includes(K.occupation))&&(Fe.location.length===0||Fe.location.includes(K.location))&&(Fe.ethnicity.length===0||K.ethnicity&&Fe.ethnicity.includes(K.ethnicity))&&(Fe.techSavviness.length===0||K.techSavviness!==void 0&&Fe.techSavviness.includes(K.techSavviness<30?"Low (0-30)":K.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&!0;let De=!0;return W!==Jl&&(De=!1,K.folder_ids&&Array.isArray(K.folder_ids)&&(De=K.folder_ids.includes(W)),De||(K.folder_id===W||K.folderId===W)&&(De=!0)),le&&ue&&De});if(console.log(`Filtered personas: ${O.length}/${E.length}`),console.log(`Selected folder: ${W===Jl?"All Personas":((q=M.find(K=>K._id===W||K.id===W))==null?void 0:q.name)||W}`),W!==Jl){const K=M.find(le=>le._id===W||le.id===W);if(K){const le=E.filter(ue=>ue.folder_ids&&Array.isArray(ue.folder_ids)?ue.folder_ids.includes(W):ue.folder_id===W||ue.folderId===W);console.log(`Folder details: ${K.name}, ID: ${K._id}, Contains: ${le.length} personas`),console.log("Personas in this folder:",le.map(ue=>ue.name))}}return O})(),gt=O=>{console.log("Toggling selection for participant ID:",O),k(q=>{const K=q.includes(O);console.log("Current selection:",{id:O,isCurrentlySelected:K,currentSelections:[...q]});const le=K?q.filter(ue=>ue!==O):[...q,O];return console.log("New selection:",le),le})},tn=async()=>{try{const O=qe.getValues(),q={name:O.focusGroupName,status:"in-progress",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(O.duration),topic:O.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),discussionGuide:m},le=(await _t.create(q)).data;return console.log("Focus group created successfully:",le),le.focus_group_id}catch(O){throw console.error("Error saving focus group:",O),O}},rt=y.useCallback(async()=>{if(!C.current){ie.error("No discussion guide available",{description:"Please generate a discussion guide first"});return}z(!0);try{const{downloadDiscussionGuideAsMarkdown:O}=await _re(async()=>{const{downloadDiscussionGuideAsMarkdown:K}=await import("./discussionGuideMarkdown-eMXneipz.js");return{downloadDiscussionGuideAsMarkdown:K}},[]),q=qe.getValues();O(C.current,q.focusGroupName),ie.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(O){console.error("Error downloading discussion guide:",O),ie.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{z(!1)}},[qe]),mn=y.useCallback(async O=>{console.log("📝 handleSaveDiscussionGuide called with:",O),w?(C.current=O,console.log("📝 Skipping discussionGuide state update during editing to preserve focus")):(v(O),ie.success("Discussion guide updated",{description:"Your changes have been saved."}))},[w]),Qt=y.useCallback(O=>{console.log("📝 Discussion guide editing state changed:",O),S(O),!O&&C.current&&(console.log("📝 Updating discussionGuide state after editing ended"),v(C.current))},[]),Z=y.useCallback(()=>{},[]),se=async()=>{if(!qe.getValues().focusGroupName){ie.error("Missing focus group name",{description:"Please provide a name for the focus group"});return}if(!m){ie.error("Missing discussion guide",{description:"Please generate a discussion guide first"});return}if(j.length<1){ie.error("Not enough participants",{description:"Please select at least one participant for the focus group"});return}console.log("Starting focus group with participants:",j);try{ie.loading("Creating focus group...");let O;if(b){const q=qe.getValues(),K={name:q.focusGroupName,status:"in-progress",participants:j,participants_count:j.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,discussionGuide:m},le=await _t.update(b,K);O=b,console.log("Draft focus group updated to in-progress:",le),e&&e()}else O=await tn();ie.dismiss(),ie.success("Focus group created successfully",{description:"The AI moderator is now running the session"}),r(`/focus-groups/${O}`)}catch(O){ie.dismiss(),O!=null&&O.message,console.error("Failed to start focus group:",O),ie.error("Failed to create focus group",{description:"Please try again or check your connection"})}};return a.jsxs(a.Fragment,{children:[a.jsx(Y,{}),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(Ps,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Focus Group Moderator"})]}),u&&a.jsx("div",{className:"mb-6",children:a.jsx(tT,{isActive:u,isComplete:f,hasError:p,label:"Generating discussion guide",onComplete:He})}),a.jsxs(Kl,{value:l,onValueChange:c,children:[a.jsxs(Ea,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(on,{value:"setup",children:"Setup"}),a.jsx(on,{value:"review",children:"Review & Edit"}),a.jsx(on,{value:"participants",children:"Participants"})]}),a.jsx(sn,{value:"setup",children:a.jsx(m0,{...qe,children:a.jsxs("form",{onSubmit:qe.handleSubmit(ht),className:"space-y-6",children:[a.jsx(dt,{control:qe.control,name:"focusGroupName",render:({field:O})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Focus Group Name"}),a.jsx(st,{children:a.jsx(Dt,{placeholder:"e.g., Mobile App UX Evaluation",...O})}),a.jsx(xn,{children:"Give your focus group a descriptive name"}),a.jsx(at,{})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(dt,{control:qe.control,name:"researchBrief",render:({field:O})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Research Brief"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"Describe your research objectives...",className:"h-36",...O})}),a.jsx(xn,{children:"Provide context about what you want to learn"}),a.jsx(at,{})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(dt,{control:qe.control,name:"discussionTopics",render:({field:O})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Discussion Topics"}),a.jsx(st,{children:a.jsx(lt,{placeholder:"List main topics to cover, separated by commas",className:"h-24",...O})}),a.jsx(xn,{children:"E.g., User experience, feature preferences, pain points"}),a.jsx(at,{})]})}),a.jsx(dt,{control:qe.control,name:"duration",render:({field:O})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Duration (minutes)"}),a.jsxs(kn,{onValueChange:O.onChange,value:O.value,children:[a.jsx(st,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select duration"})})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"30",children:"30 minutes"}),a.jsx(ce,{value:"45",children:"45 minutes"}),a.jsx(ce,{value:"60",children:"60 minutes"}),a.jsx(ce,{value:"90",children:"90 minutes"}),a.jsx(ce,{value:"120",children:"120 minutes"})]})]}),a.jsx(xn,{children:"How long should the focus group session last?"}),a.jsx(at,{})]})}),a.jsx(dt,{control:qe.control,name:"llm_model",render:({field:O})=>a.jsxs(it,{children:[a.jsx(ot,{children:"AI Model"}),a.jsxs(kn,{onValueChange:O.onChange,value:O.value,children:[a.jsx(st,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select AI model"})})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(ce,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(ce,{value:"gpt-5",children:"GPT-5"})]})]}),a.jsx(xn,{children:"Choose which AI model to use for generating responses and discussion guides"}),a.jsx(at,{})]})}),qe.watch("llm_model")==="gpt-5"&&a.jsxs(a.Fragment,{children:[a.jsx(dt,{control:qe.control,name:"reasoning_effort",render:({field:O})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Reasoning Effort"}),a.jsxs(kn,{onValueChange:O.onChange,value:O.value,children:[a.jsx(st,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select reasoning effort"})})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"minimal",children:"Minimal - Fast responses"}),a.jsx(ce,{value:"low",children:"Low - Quick thinking"}),a.jsx(ce,{value:"medium",children:"Medium - Balanced (default)"}),a.jsx(ce,{value:"high",children:"High - Deep reasoning"})]})]}),a.jsx(xn,{children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx("div",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx(at,{})]})}),a.jsx(dt,{control:qe.control,name:"verbosity",render:({field:O})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Response Verbosity"}),a.jsxs(kn,{onValueChange:O.onChange,value:O.value,children:[a.jsx(st,{children:a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select verbosity level"})})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"low",children:"Low - Concise responses"}),a.jsx(ce,{value:"medium",children:"Medium - Balanced length (default)"}),a.jsx(ce,{value:"high",children:"High - Detailed responses"})]})]}),a.jsx(xn,{children:"Controls how detailed and lengthy GPT-5's responses will be"}),a.jsx("div",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx(at,{})]})})]})]})]}),a.jsx(dt,{control:qe.control,name:"creativeAssets",render:({field:{value:O,onChange:q,...K}})=>a.jsxs(it,{children:[a.jsx(ot,{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(c4,{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(Dt,{...K,type:"file",accept:"image/*,.pdf",multiple:!0,onChange:le=>{q(le.target.files)},className:"hidden",id:"assets-file-input"}),a.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:()=>{var le;return(le=document.getElementById("assets-file-input"))==null?void 0:le.click()},children:[a.jsx(d4,{className:"mr-2 h-4 w-4"}),"Select Files"]}),O&&O.length>0&&a.jsxs("p",{className:"text-xs text-primary mt-2",children:[O.length," file(s) selected"]})]})}),a.jsx(xn,{children:"Upload visuals that you want feedback on during the session"}),a.jsx(at,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx("div",{className:"flex justify-end",children:a.jsxs(te,{type:"submit",disabled:u,className:"min-w-32",children:[a.jsx(Ps,{className:"mr-2 h-4 w-4"}),u?"Generating...":"Generate Discussion Guide"]})})})]})})}),a.jsx(sn,{value:"review",children:a.jsxs("div",{className:"space-y-6",children:[a.jsx(ct,{children:a.jsxs(jt,{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"}),m&&a.jsx(ur,{variant:"outline",className:"text-xs",children:_(m)?"Structured JSON":"Legacy Text"})]})}),a.jsx("div",{className:"prose max-w-none",children:m?a.jsx(nT,{discussionGuide:m,showProgress:!1,collapsible:!0,defaultExpanded:!0,className:"border-0",onSave:mn,onDownload:rt,onSectionSelect:Z,isDownloading:$,focusGroupId:b,onEditingChange:Qt}):a.jsx("div",{className:"bg-slate-50 p-4 rounded border text-center text-slate-600",children:p?a.jsxs("div",{children:[a.jsx("p",{className:"mb-2",children:"Discussion guide generation failed."}),a.jsxs("p",{className:"text-sm",children:["Go back to the ",a.jsx("strong",{children:"Setup"})," tab and try generating again. Check your inputs and try a different AI model if the issue persists."]})]}):a.jsx("p",{children:'No discussion guide generated yet. Complete the setup and click "Generate Discussion Guide" to create one.'})})})]})}),P.length>0&&a.jsx(ct,{children:a.jsxs(jt,{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:P.map((O,q)=>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:O.type.startsWith("image/")?a.jsx("img",{src:URL.createObjectURL(O),alt:`Asset ${q+1}`,className:"max-h-full max-w-full object-contain"}):a.jsx(s1,{className:"h-10 w-10 text-slate-400"})}),a.jsx("p",{className:"text-xs truncate",children:O.name})]},q))})]})}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx(te,{variant:"outline",onClick:()=>c("setup"),children:"Back to Setup"}),a.jsxs(te,{onClick:()=>c("participants"),children:["Select Participants",a.jsx(Cr,{className:"ml-2 h-4 w-4"})]})]})]})}),a.jsxs(sn,{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(te,{variant:"ghost",size:"sm",onClick:()=>{console.log("Clicked 'Create new folder' button"),xe(!0)},className:"h-7 w-7 p-0",children:a.jsx(u4,{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:",E.length),X(Jl),setTimeout(()=>{console.log(`Will show all ${E.length} personas`)},0)},className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${W===Jl?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Zi,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),M.map(O=>a.jsx("div",{className:"flex items-center justify-between group",children:oe&&oe._id===O._id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(Zi,{className:"h-4 w-4"}),a.jsx(Dt,{value:Re,onChange:q=>pe(q.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:q=>{q.key==="Enter"?Sn():q.key==="Escape"&&yt()}}),a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming folder rename: "${oe==null?void 0:oe.name}" to "${Re}"`),Sn()},className:"h-7 w-7 p-0",children:a.jsx(Ts,{className:"h-4 w-4"})}),a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Cancelling rename of folder: "${oe==null?void 0:oe.name}"`),yt()},className:"h-7 w-7 p-0",children:a.jsx($o,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>{console.log(`Clicked folder: ${O.name} (ID: ${O._id})`);const q=E.filter(K=>K.folder_ids&&Array.isArray(K.folder_ids)?K.folder_ids.includes(O._id):K.folder_id===O._id||K.folderId===O._id);console.log(`Current persona count in folder: ${q.length}`),console.log("All personas count:",E.length),X(O._id),setTimeout(()=>{console.log(`Will show ${q.length} personas after filtering`),console.log("Filtered personas:",q.map(K=>K.name))},0)},className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${W===O._id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Zi,{className:"h-4 w-4"}),a.jsx("span",{children:O.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:E.filter(q=>q.folder_ids&&Array.isArray(q.folder_ids)?q.folder_ids.includes(O._id):q.folder_id===O._id||q.folderId===O._id).length})]}),a.jsxs(q1,{children:[a.jsx(Y1,{asChild:!0,children:a.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(o1,{className:"h-4 w-4"})})}),a.jsx(tx,{align:"end",children:a.jsx(Ba,{onClick:()=>{console.log(`Initiating rename for folder: ${O.name} (ID: ${O.id})`),_r(O)},children:"Rename"})})]})]})},O._id)),re&&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(Zi,{className:"h-4 w-4"}),a.jsx(Dt,{value:F,onChange:O=>fe(O.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:O=>{O.key==="Enter"?$t():O.key==="Escape"&&Yt()}})]}),a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming creation of new folder: "${F}"`),$t()},className:"h-7 w-7 p-0",children:a.jsx(Ts,{className:"h-4 w-4"})}),a.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{console.log("Cancelling folder creation"),Yt()},className:"h-7 w-7 p-0",children:a.jsx($o,{className:"h-4 w-4"})})]})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx(ct,{className:"mb-4",children:a.jsx(jt,{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(Cr,{className:"h-5 w-5 mr-2 text-muted-foreground"}),a.jsxs("span",{className:"text-sm font-medium",children:[j.length," of ",Qe.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(Yj,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Dt,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:Se,onChange:O=>Ne(O.target.value)})]}),a.jsxs(te,{variant:"outline",className:"flex items-center gap-2",onClick:()=>nt(!0),children:[a.jsx(Wj,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(Fe).some(O=>O.length>0)?` (${Object.values(Fe).reduce((O,q)=>O+q.length,0)})`:""]})]})]}),L?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(ws,{className:"h-8 w-8 animate-spin text-primary"})}):Qe.length>0?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Qe.map(O=>{const q=O._id||O.id;return a.jsx(AN,{user:{id:q,_id:O._id,name:O.name,age:O.age,gender:O.gender,occupation:O.occupation,location:O.location||"Unknown",techSavviness:O.techSavviness||50,personality:O.personality||"No description available",oceanTraits:O.oceanTraits,qualitativeAttributes:O.qualitativeAttributes,topPersonalityTraits:O.topPersonalityTraits,aiSynthesizedBio:O.aiSynthesizedBio},selected:j.includes(q),onSelectionToggle:()=>gt(q),onViewDetails:Me},q)})}):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(te,{variant:"outline",onClick:()=>c("review"),children:"Back to Review"}),a.jsxs(te,{onClick:se,disabled:j.length<1||!m,children:[a.jsx(HX,{className:"mr-2 h-4 w-4"}),"Start Focus Group Session"]})]})]})]}),a.jsx(kc,{open:ne,onOpenChange:O=>{O?(nt(O),Bt({...Fe})):nt(!1)},children:a.jsxs(xl,{className:"max-w-4xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(bl,{children:[a.jsx(Sl,{children:"Filter Personas"}),a.jsx(Oc,{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(mt).some(O=>O.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(mt).reduce((O,q)=>O+q.length,0)," active filters"]})}),(()=>{const O=we(E),q=Object.values(mt).every(le=>le.length===0),K=(le,ue,De=1)=>{const be=q?O[ue]:We(ue)[ue],Tt=mt[ue],ut=[...new Set([...be,...Tt])].sort();return ut.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:le}),a.jsx("div",{className:`grid grid-cols-1 ${De===2?"sm:grid-cols-2":De===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:ut.map(Gt=>{const Jt=mt[ue].includes(Gt),Dr=be.includes(Gt);return a.jsxs("div",{className:`flex items-center space-x-2 ${!Dr&&!Jt?"opacity-50":""}`,children:[a.jsx(vc,{id:`${ue}-${Gt}`,checked:Jt,onCheckedChange:()=>Je(ue,Gt),disabled:!Dr&&!Jt}),a.jsxs(to,{htmlFor:`${ue}-${Gt}`,className:"truncate overflow-hidden",children:[Gt,Jt&&!Dr&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},Gt)})})]})};return a.jsxs(a.Fragment,{children:[K("Gender","gender",3),K("Age","age",3),K("Ethnicity","ethnicity",2),K("Location","location",2),K("Occupation","occupation",2),K("Tech Savviness","techSavviness",3),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6"})]})})()]}),a.jsxs(wl,{children:[a.jsx(te,{variant:"outline",onClick:Nt,children:"Reset"}),a.jsx(te,{onClick:wt,children:"Apply Filters"})]})]})})]})]})]})]})}const zce=[{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"}],Vce={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"},Gce=()=>{console.log("FocusGroups component rendering");const[t,e]=y.useState("view"),[n,r]=y.useState(""),[i,o]=y.useState([]),[s,l]=y.useState(!0),[c,u]=y.useState([]),[d,f]=y.useState(!1),[h,p]=y.useState(!1),[g,m]=y.useState(null),v=Xn(),b=Ei(),[x,w]=y.useState([]),S=y.useRef(!0),C=async(E=!0)=>{if(console.log("fetchFocusGroups called with isMountedCheck:",E),console.log("isMounted.current:",S.current),E&&!S.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 R=await _t.getAll();if(console.log("API response received:",R),!E||S.current){const L=R.data.map(V=>({...V,id:V.id||V._id,participants_count:Array.isArray(V.participants)?V.participants.length:typeof V.participants=="number"?V.participants:0}));o(L)}}catch(R){console.error("Error fetching focus groups:",R),(!E||S.current)&&(Ye.error("Failed to load focus groups"),o(zce))}finally{(!E||S.current)&&l(!1)}},A=async E=>{try{const R=await _t.getById(E);R&&R.data&&(m(R.data),e("create"))}catch(R){console.error("Error fetching focus group for edit:",R),Ye.error("Failed to load focus group for editing")}};y.useEffect(()=>(console.log("useEffect running - about to fetch focus groups"),C(),()=>{console.log("useEffect cleanup - setting isMounted to false"),S.current=!1}),[]),y.useEffect(()=>{console.log("Mode change useEffect running, mode:",t),t==="view"&&(console.log("Mode is view, calling fetchFocusGroups"),C())},[t]),y.useEffect(()=>{const E=b.state;(E==null?void 0:E.mode)==="create"&&(E!=null&&E.preSelectedParticipants)&&(w(E.preSelectedParticipants),e("create"),v(b.pathname,{replace:!0,state:null}))},[b.state,b.pathname,v]),y.useEffect(()=>{const E=new URLSearchParams(b.search),R=E.get("mode"),L=E.get("id"),V=E.get("tab");if(R==="create")e("create"),m(null);else if(R==="edit"&&L){const $=i.find(z=>(z._id||z.id)===L);$?(m($),e("create")):A(L)}if(R||L||V){const $=b.pathname;v($,{replace:!0})}},[b.search,i,v,b.pathname]);const _=i.filter(E=>E.name.toLowerCase().includes(n.toLowerCase())||E.topic.toLowerCase().includes(n.toLowerCase())),j=E=>new Date(E).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),k=E=>new Date(E).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),P=E=>{u(R=>R.includes(E)?R.filter(L=>L!==E):[...R,E])},I=async()=>{if(c.length!==0){p(!0);try{const E=c.map(R=>_t.delete(R));await Promise.all(E),o(R=>R.filter(L=>!c.includes(L.id||L._id||""))),u([]),Ye.success(`${c.length} focus group${c.length>1?"s":""} deleted successfully`)}catch(E){console.error("Error deleting focus groups:",E),Ye.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(aa,{}),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(te,{onClick:()=>{console.log("Create New Focus Group button clicked, current mode:",t);try{t==="view"?(console.log("Setting draft to null and switching to create mode"),m(null),e("create")):(console.log("Switching back to view mode"),e("view"))}catch(E){console.error("Error in Create New Focus Group onClick:",E)}},className:"hover-transition",children:t==="view"?"Create New Focus Group":"View All Focus Groups"})})]}),t==="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(Yj,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Dt,{placeholder:"Search focus groups by name or topic...",className:"pl-10 bg-white",value:n,onChange:E=>r(E.target.value)})]}),a.jsxs(te,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(Wj,{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(Ps,{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(te,{variant:"destructive",size:"sm",onClick:()=>f(!0),disabled:h,className:"flex items-center gap-2",children:[a.jsx(Kn,{className:"h-4 w-4"}),"Delete Selected (",c.length,")"]})]}),s?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(ws,{className:"h-8 w-8 animate-spin text-primary"})}):_.length>0?a.jsx("div",{className:"space-y-4",children:_.map(E=>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(vc,{id:`select-${E.id||E._id}`,checked:c.includes(E.id||E._id||""),onCheckedChange:()=>P(E.id||E._id||""),className:"mt-1"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-2",children:E.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(_X,{className:"h-4 w-4 mr-1"}),j(E.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Cp,{className:"h-4 w-4 mr-1"}),k(E.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Cr,{className:"h-4 w-4 mr-1"}),E.participants_count||(Array.isArray(E.participants)?E.participants.length:0)," participant",E.participants_count>1||Array.isArray(E.participants)&&E.participants.length>1?"s":""]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Cp,{className:"h-4 w-4 mr-1"}),E.duration," min"]})]})]})]}),a.jsxs("div",{className:Pe("px-3 py-1 rounded-full text-xs font-medium border",Vce[E.status]||"bg-gray-100 text-gray-800 border-gray-200"),children:[E.status==="completed"&&"Completed",E.status==="scheduled"&&"Scheduled",E.status==="in-progress"&&"In Progress",E.status==="active"&&"In Progress",E.status==="ai_mode"&&"In Progress",E.status==="paused"&&"Paused",E.status==="new"&&"Not Started",E.status==="draft"&&"Draft",!["completed","scheduled","in-progress","active","ai_mode","paused","new","draft"].includes(E.status)&&E.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:[E.topic==="user-experience"&&"User Experience",E.topic==="product-feedback"&&"Product Feedback",E.topic==="creative-testing"&&"Creative Testing",E.topic==="messaging-evaluation"&&"Messaging Evaluation",E.topic&&!["user-experience","product-feedback","creative-testing","messaging-evaluation"].includes(E.topic)&&E.topic.charAt(0).toUpperCase()+E.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(te,{variant:E.status==="in-progress"||E.status==="active"||E.status==="ai_mode"?"default":E.status==="new"||E.status==="draft"?"outline":"default",className:Pe("w-full hover-transition",E.status==="new"?"bg-slate-200 text-slate-700 hover:bg-slate-300 border-slate-300":"",E.status==="draft"?"bg-gray-200 text-gray-700 hover:bg-gray-300 border-gray-300":""),onClick:()=>{if(E.status==="draft")m(E),e("create");else{const R=E.id||E._id;console.log("Navigating to focus group:",R),v(`/focus-groups/${R}`)}},children:E.status==="completed"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(Ji,{className:"ml-2 h-4 w-4"})]}):E.status==="in-progress"||E.status==="active"||E.status==="ai_mode"?a.jsxs(a.Fragment,{children:["Join Session",a.jsx(Ji,{className:"ml-2 h-4 w-4"})]}):E.status==="paused"?a.jsxs(a.Fragment,{children:["Session Details",a.jsx(Ji,{className:"ml-2 h-4 w-4"})]}):E.status==="scheduled"?a.jsxs(a.Fragment,{children:["View Details",a.jsx(Ji,{className:"ml-2 h-4 w-4"})]}):E.status==="new"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(Ji,{className:"ml-2 h-4 w-4"})]}):E.status==="draft"?a.jsxs(a.Fragment,{children:["Edit",a.jsx(Ji,{className:"ml-2 h-4 w-4"})]}):a.jsxs(a.Fragment,{children:["View Session",a.jsx(Ji,{className:"ml-2 h-4 w-4"})]})})})]})},E.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(Hce,{draftToEdit:g,preSelectedParticipants:x,onDraftSaved:()=>{m(null),e("view"),w([]),C()}})]}),a.jsx(Q1,{open:d,onOpenChange:f,children:a.jsxs(rx,{children:[a.jsxs(ix,{children:[a.jsxs(sx,{children:["Delete ",c.length," Focus Group",c.length!==1?"s":"","?"]}),a.jsxs(ax,{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(ox,{children:[a.jsx(cx,{disabled:h,children:"Cancel"}),a.jsx(lx,{onClick:E=>{E.preventDefault(),I()},disabled:h,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:h?a.jsxs(a.Fragment,{children:[a.jsx(ws,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):a.jsx(a.Fragment,{children:"Delete"})})]})]})})]})},Kce=({participants:t,selectedParticipantIds:e,onToggleParticipantFilter:n})=>{const r=Xn(),{id:i}=Vj(),{setPreviousRoute:o}=N0(),s=c=>{const u=c.id||c._id;u&&i&&(o(`/focus-groups/${i}`,{focusGroupId:i}),r(`/personas/${u}`))},l=c=>{const u=c.id||c._id;u&&n(u)};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(Cr,{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(ea,{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"})]})]}),t.map(c=>{const u=c.id||c._id,d=e.includes(u);return a.jsxs("div",{className:`flex items-center p-2 rounded-lg transition-colors ${d?"bg-blue-50 border border-blue-200":"hover:bg-slate-100"}`,children:[a.jsx("div",{className:"cursor-pointer mr-3",onClick:()=>s(c),title:`View ${c.name}'s profile`,children:a.jsx("img",{src:Zm(c),alt:c.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:()=>l(c),title:`Filter to show only ${c.name}'s messages`,children:c.name}),d&&a.jsx(Ts,{className:"h-4 w-4 text-blue-600 ml-2"})]}),a.jsx("p",{className:"text-xs text-slate-500",children:c.occupation})]})]},c.id)})]})]})})};function Wce(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var rT="ScrollArea",[az,ZDe]=ji(rT),[qce,go]=az(rT),lz=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:o=600,...s}=t,[l,c]=y.useState(null),[u,d]=y.useState(null),[f,h]=y.useState(null),[p,g]=y.useState(null),[m,v]=y.useState(null),[b,x]=y.useState(0),[w,S]=y.useState(0),[C,A]=y.useState(!1),[_,j]=y.useState(!1),k=At(e,I=>c(I)),P=uu(i);return a.jsx(qce,{scope:n,type:r,dir:P,scrollHideDelay:o,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:A,scrollbarY:m,onScrollbarYChange:v,scrollbarYEnabled:_,onScrollbarYEnabledChange:j,onCornerWidthChange:x,onCornerHeightChange:S,children:a.jsx(et.div,{dir:P,...s,ref:k,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});lz.displayName=rT;var cz="ScrollAreaViewport",uz=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,asChild:i,nonce:o,...s}=t,l=go(cz,n),c=y.useRef(null),u=At(e,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; @@ -639,9 +618,9 @@ ${O.researchBrief} :where([data-radix-scroll-area-content]) { flex-grow: 1; } -`},nonce:o}),a.jsx(et.div,{"data-radix-scroll-area-viewport":"",...s,asChild:i,ref:u,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:oue({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}))})]})});dz.displayName=uz;var Ms="ScrollAreaScrollbar",oT=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=go(Ms,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:s}=i,l=t.orientation==="horizontal";return y.useEffect(()=>(l?o(!0):s(!0),()=>{l?o(!1):s(!1)}),[l,o,s]),i.type==="hover"?a.jsx(Qce,{...r,ref:e,forceMount:n}):i.type==="scroll"?a.jsx(Xce,{...r,ref:e,forceMount:n}):i.type==="auto"?a.jsx(fz,{...r,ref:e,forceMount:n}):i.type==="always"?a.jsx(sT,{...r,ref:e}):null});oT.displayName=Ms;var Qce=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=go(Ms,t.__scopeScrollArea),[o,s]=y.useState(!1);return y.useEffect(()=>{const l=i.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),s(!0)},d=()=>{c=window.setTimeout(()=>s(!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(Mr,{present:n||o,children:a.jsx(fz,{"data-state":o?"visible":"hidden",...r,ref:e})})}),Xce=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=go(Ms,t.__scopeScrollArea),o=t.orientation==="horizontal",s=k0(()=>c("SCROLL_END"),100),[l,c]=qce("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 y.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,i.scrollHideDelay,c]),y.useEffect(()=>{const u=i.viewport,d=o?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const p=u[d];f!==p&&(c("SCROLL"),s()),f=p};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[i.viewport,o,c,s]),a.jsx(Mr,{present:n||l!=="hidden",children:a.jsx(sT,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Pe(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Pe(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),fz=y.forwardRef((t,e)=>{const n=go(Ms,t.__scopeScrollArea),{forceMount:r,...i}=t,[o,s]=y.useState(!1),l=t.orientation==="horizontal",c=k0(()=>{if(n.viewport){const u=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,i=go(Ms,t.__scopeScrollArea),o=y.useRef(null),s=y.useRef(0),[l,c]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=vz(l.viewport,l.content),d={...r,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:h=>o.current=h,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:h=>s.current=h};function f(h,p){return rue(h,s.current,l,p)}return n==="horizontal"?a.jsx(Zce,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&o.current){const h=i.viewport.scrollLeft,p=RI(h,l,i.dir);o.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(Jce,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&o.current){const h=i.viewport.scrollTop,p=RI(h,l);o.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}),Zce=y.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,o=go(Ms,t.__scopeScrollArea),[s,l]=y.useState(),c=y.useRef(null),u=_t(e,c,o.onScrollbarXChange);return y.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(pz,{"data-orientation":"horizontal",...i,ref:u,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":P0(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(o.viewport){const h=o.viewport.scrollLeft+d.deltaX;t.onWheelScroll(h),xz(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&s&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:fx(s.paddingLeft),paddingEnd:fx(s.paddingRight)}})}})}),Jce=y.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,o=go(Ms,t.__scopeScrollArea),[s,l]=y.useState(),c=y.useRef(null),u=_t(e,c,o.onScrollbarYChange);return y.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(pz,{"data-orientation":"vertical",...i,ref:u,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":P0(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(o.viewport){const h=o.viewport.scrollTop+d.deltaY;t.onWheelScroll(h),xz(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&s&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:fx(s.paddingTop),paddingEnd:fx(s.paddingBottom)}})}})}),[eue,hz]=lz(Ms),pz=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:o,onThumbPointerUp:s,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=t,p=go(Ms,n),[g,m]=y.useState(null),v=_t(e,k=>m(k)),b=y.useRef(null),x=y.useRef(""),w=p.viewport,S=r.content-r.viewport,C=dr(d),A=dr(c),_=k0(f,10);function j(k){if(b.current){const P=k.clientX-b.current.left,R=k.clientY-b.current.top;u({x:P,y:R})}}return y.useEffect(()=>{const k=P=>{const R=P.target;(g==null?void 0:g.contains(R))&&C(P,S)};return document.addEventListener("wheel",k,{passive:!1}),()=>document.removeEventListener("wheel",k,{passive:!1})},[w,g,S,C]),y.useEffect(A,[r,A]),Md(g,_),Md(p.content,_),a.jsx(eue,{scope:n,scrollbar:g,hasThumb:i,onThumbChange:dr(o),onThumbPointerUp:dr(s),onThumbPositionChange:A,onThumbPointerDown:dr(l),children:a.jsx(et.div,{...h,ref:v,style:{position:"absolute",...h.style},onPointerDown:Pe(t.onPointerDown,k=>{k.button===0&&(k.target.setPointerCapture(k.pointerId),b.current=g.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),j(k))}),onPointerMove:Pe(t.onPointerMove,j),onPointerUp:Pe(t.onPointerUp,k=>{const P=k.target;P.hasPointerCapture(k.pointerId)&&P.releasePointerCapture(k.pointerId),document.body.style.webkitUserSelect=x.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})}),dx="ScrollAreaThumb",mz=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=hz(dx,t.__scopeScrollArea);return a.jsx(Mr,{present:n||i.hasThumb,children:a.jsx(tue,{ref:e,...r})})}),tue=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...i}=t,o=go(dx,n),s=hz(dx,n),{onThumbPositionChange:l}=s,c=_t(e,f=>s.onThumbChange(f)),u=y.useRef(),d=k0(()=>{u.current&&(u.current(),u.current=void 0)},100);return y.useEffect(()=>{const f=o.viewport;if(f){const h=()=>{if(d(),!u.current){const p=iue(f,l);u.current=p,l()}};return l(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[o.viewport,d,l]),a.jsx(et.div,{"data-state":s.hasThumb?"visible":"hidden",...i,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Pe(t.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),g=f.clientX-p.left,m=f.clientY-p.top;s.onThumbPointerDown({x:g,y:m})}),onPointerUp:Pe(t.onPointerUp,s.onThumbPointerUp)})});mz.displayName=dx;var aT="ScrollAreaCorner",gz=y.forwardRef((t,e)=>{const n=go(aT,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(nue,{...t,ref:e}):null});gz.displayName=aT;var nue=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,i=go(aT,n),[o,s]=y.useState(0),[l,c]=y.useState(0),u=!!(o&&l);return Md(i.scrollbarX,()=>{var f;const d=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(d),c(d)}),Md(i.scrollbarY,()=>{var f;const d=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(d),s(d)}),u?a.jsx(et.div,{...r,ref:e,style:{width:o,height:l,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function fx(t){return t?parseInt(t,10):0}function vz(t,e){const n=t/e;return isNaN(n)?0:n}function P0(t){const e=vz(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function rue(t,e,n,r="ltr"){const i=P0(n),o=i/2,s=e||o,l=i-s,c=n.scrollbar.paddingStart+s,u=n.scrollbar.size-n.scrollbar.paddingEnd-l,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return yz([c,u],f)(t)}function RI(t,e,n="ltr"){const r=P0(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-i,s=e.content-e.viewport,l=o-r,c=n==="ltr"?[0,s]:[s*-1,0],u=qp(t,c);return yz([0,s],[0,l])(u)}function yz(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function xz(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return function i(){const o={left:t.scrollLeft,top:t.scrollTop},s=n.left!==o.left,l=n.top!==o.top;(s||l)&&e(),n=o,r=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(r)};function k0(t,e){const n=dr(t),r=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),y.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function Md(t,e){const n=dr(e);Rr(()=>{let r=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(t),()=>{window.cancelAnimationFrame(r),i.unobserve(t)}}},[t,n])}function oue(t,e){const{asChild:n,children:r}=t;if(!n)return typeof e=="function"?e(r):e;const i=y.Children.only(r);return y.cloneElement(i,{children:typeof e=="function"?e(i.props.children):e})}var bz=cz,sue=dz,aue=gz;const O0=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(bz,{ref:r,className:ke("relative overflow-hidden",t),...n,children:[a.jsx(sue,{className:"h-full w-full rounded-[inherit]",children:e}),a.jsx(wz,{}),a.jsx(aue,{})]}));O0.displayName=bz.displayName;const wz=y.forwardRef(({className:t,orientation:e="vertical",...n},r)=>a.jsx(oT,{ref:r,orientation:e,className:ke("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:a.jsx(mz,{className:"relative flex-1 rounded-full bg-border"})}));wz.displayName=oT.displayName;const lue=({participants:t,isVisible:e,selectedIndex:n,onSelect:r,onClose:i,position:o})=>{const s=y.useRef(null);return y.useEffect(()=>{const l=c=>{s.current&&!s.current.contains(c.target)&&i()};if(e)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[e,i]),y.useEffect(()=>{if(e&&n>=0&&s.current){const l=s.current.children[n];l&&l.scrollIntoView({block:"nearest",behavior:"smooth"})}},[n,e]),!e||t.length===0?null:a.jsxs("div",{ref:s,className:"absolute z-50 w-64 max-h-48 overflow-y-auto bg-white border border-slate-200 rounded-lg shadow-lg",style:{top:o.top,left:o.left},children:[t.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:eg(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)}),t.length===0&&a.jsx("div",{className:"p-3 text-center text-slate-500 text-sm",children:"No participants found"})]})};function J1(t,e){const n=[],r=[],i=/@(\w+(?:\s+\w+)*)/g;let o;for(;(o=i.exec(t))!==null;){const s=o[1],l=o.index,c=o.index+o[0].length,u=e.find(d=>d.name.toLowerCase()===s.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:t,mentions:n,mentionedParticipantIds:r}}function cue(t,e){if(e.length===0)return[t];const n=[];let r=0;return[...e].sort((o,s)=>o.startIndex-s.startIndex).forEach((o,s)=>{o.startIndex>r&&n.push(t.slice(r,o.startIndex)),n.push(T.createElement("span",{key:`mention-${s}`,className:"text-blue-600 bg-blue-50 px-1 rounded font-medium"},`@${o.name}`)),r=o.endIndex}),r=0;n--){const r=t[n];if(r==="@"){if(n===0||/\s/.test(t[n-1]))return n}else if(/\s/.test(r))break}return null}function fue(t,e,n){return t.slice(e+1,n).toLowerCase()}function hue(t,e){return e?t.filter(n=>n.name.toLowerCase().includes(e)):t}const Sz=y.forwardRef(({value:t,onChange:e,participants:n,placeholder:r="Ask a question or provide guidance...",className:i="",disabled:o=!1},s)=>{const[l,c]=y.useState(!1),[u,d]=y.useState(0),[f,h]=y.useState({top:0,left:0}),[p,g]=y.useState(null),[m,v]=y.useState([]),b=y.useRef(null),x=y.useRef(null);y.useEffect(()=>{s&&b.current&&(typeof s=="function"?s(b.current):s.current=b.current)},[s]);const w=()=>{if(b.current&&x.current&&p!==null){const j=b.current,k=x.current,P=document.createElement("div");P.style.position="absolute",P.style.visibility="hidden",P.style.whiteSpace="pre",P.style.font=window.getComputedStyle(j).font,P.textContent=t.slice(0,p),document.body.appendChild(P);const R=P.offsetWidth;document.body.removeChild(P);const E=k.getBoundingClientRect(),I=j.getBoundingClientRect();h({top:I.height+4,left:Math.min(R,E.width-280)})}},S=j=>{const k=j.target.value,P=j.target.selectionStart||0,R=due(k,P);if(R!==null&&n.length>0){const I=fue(k,R,P),L=hue(n,I);g(R),v(L),d(0),c(!0)}else c(!1),g(null);const E=J1(k,n);e(k,E)},C=j=>{if(l&&m.length>0)switch(j.key){case"ArrowDown":j.preventDefault(),d(k=>kk>0?k-1:m.length-1);break;case"Enter":case"Tab":j.preventDefault(),m[u]&&A(m[u]);break;case"Escape":j.preventDefault(),c(!1);break}},A=j=>{if(p!==null&&b.current){const k=b.current.selectionStart||0,{newText:P,newCursorPosition:R}=uue(t,k,j,p),E=J1(P,n);e(P,E),setTimeout(()=>{b.current&&(b.current.focus(),b.current.setSelectionRange(R,R))},0),c(!1),g(null)}},_=()=>{c(!1),g(null)};return y.useEffect(()=>{l&&p!==null&&w()},[l,p,t]),a.jsxs("div",{ref:x,className:`relative ${i}`,children:[a.jsx("input",{ref:b,type:"text",value:t,onChange:S,onKeyDown:C,placeholder:r,disabled:o,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(lue,{participants:m,isVisible:l,selectedIndex:u,onSelect:A,onClose:_,position:f})]})});Sz.displayName="MentionInput";const pue=({message:t,persona:e,toggleHighlight:n,participants:r=[],focusGroupId:i})=>{const[o,s]=y.useState(!1),l=t.senderId==="moderator",c=t.senderId==="facilitator",u=J1(t.text,r),d=cue(t.text,u.mentions),h=(m=>{const v=[/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 v){const x=m.match(b);if(x)return x[1]}return null})(t.text),p=(l||c)&&h&&i,g=()=>{n()};return a.jsxs("div",{id:`message-${t.id}`,className:ke("flex items-start p-3 rounded-lg transition-colors",t.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:()=>s(!0),onMouseLeave:()=>s(!1),"data-highlighted":t.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(ea,{className:"h-6 w-6 text-primary"})}):c?a.jsx("div",{className:"bg-green-100 p-2 rounded-full",children:a.jsx(_p,{className:"h-6 w-6 text-green-600"})}):e?a.jsx("div",{className:"bg-slate-100 p-2 rounded-full",children:a.jsx("img",{src:eg(e),alt:`${e.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(PX,{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":(e==null?void 0:e.name)||"Unknown"}),!l&&!c&&e&&a.jsx(ur,{variant:"outline",className:"text-xs font-normal",children:e.occupation}),a.jsx("span",{className:"text-xs text-slate-500 ml-auto",children:t.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(Av,{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:jt.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:",jt.getAssetUrl(i,h)),m.currentTarget.style.display="none";const v=document.createElement("div");v.className="text-xs text-slate-500 italic p-2 border rounded bg-slate-100",v.textContent=`Creative asset not found: ${h}`,(b=m.currentTarget.parentNode)==null||b.appendChild(v)}})]}),a.jsx("div",{className:ke("flex mt-2 space-x-2",!o&&!t.highlighted&&"hidden"),children:a.jsxs(te,{variant:"ghost",size:"sm",onClick:g,className:"h-8 px-2 text-xs",children:[a.jsx(YX,{className:ke("h-3 w-3 mr-1",t.highlighted?"fill-amber-400 text-amber-400":"text-slate-400")}),t.highlighted?"Highlighted":"Highlight"]})})]})]})},mue=({action:t})=>{switch(t){case"moderator_speak":return a.jsx(Ps,{className:"h-4 w-4 text-blue-500"});case"participant_respond":return a.jsx(Cr,{className:"h-4 w-4 text-green-500"});case"participant_interaction":return a.jsx(Cr,{className:"h-4 w-4 text-purple-500"});case"probe_trigger":return a.jsx(h4,{className:"h-4 w-4 text-orange-500"});case"end_session":return a.jsx(ZX,{className:"h-4 w-4 text-red-500"});default:return a.jsx(Bc,{className:"h-4 w-4 text-gray-500"})}},gue=({status:t})=>{switch(t){case"success":return a.jsx(Kj,{className:"h-3 w-3 text-green-500"});case"error":return a.jsx(kX,{className:"h-3 w-3 text-red-500"});case"pending":return a.jsx(Ap,{className:"h-3 w-3 text-yellow-500 animate-pulse"});default:return null}},vue=({action:t})=>({moderator_speak:"Moderator",participant_respond:"Participant Response",participant_interaction:"Participant Interaction",probe_trigger:"Probe Question",end_session:"End Session"})[t]||t,yue=t=>{try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return t}},xue=({entry:t,isLatest:e})=>{const[n,r]=y.useState(e);return a.jsx(ut,{className:`mb-2 ${e?"ring-2 ring-blue-200 bg-blue-50/50":""}`,children:a.jsxs(tg,{open:n,onOpenChange:r,children:[a.jsx(ng,{asChild:!0,children:a.jsx(pi,{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(mue,{action:t.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(vue,{action:t.action})}),a.jsx(gue,{status:t.execution_status})]}),a.jsx("span",{className:"text-xs text-gray-500",children:yue(t.timestamp)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[e&&a.jsx(ur,{variant:"secondary",className:"text-xs",children:"Latest"}),n?a.jsx(Hc,{className:"h-4 w-4 text-gray-400"}):a.jsx(va,{className:"h-4 w-4 text-gray-400"})]})]})})}),a.jsx(rg,{children:a.jsx(Et,{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:['"',t.reasoning,'"']})]}),t.details&&Object.keys(t.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(t.details,null,2)})]}),t.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:t.execution_result.error?a.jsxs("span",{className:"text-red-600",children:["Error: ",t.execution_result.error]}):a.jsx("span",{className:"text-green-600",children:t.execution_result.message||"Success"})})]})]})})})]})})},bue=({reasoningHistory:t,isVisible:e,onToggle:n,isAiMode:r=!1})=>{const[i,o]=y.useState(!0);return y.useEffect(()=>{if(i&&t.length>0){const s=document.getElementById("reasoning-panel-content");s&&(s.scrollTop=0)}},[t.length,i]),a.jsx("div",{className:"border-t border-gray-200 bg-white",children:a.jsxs(tg,{open:e,onOpenChange:n,children:[a.jsx(ng,{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(Bc,{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&&t.length>0&&a.jsx(ur,{variant:"outline",className:"text-xs",children:t.length}),!r&&a.jsx(ur,{variant:"secondary",className:"text-xs",children:"Manual Mode"})]}),e?a.jsx(Hc,{className:"h-4 w-4 text-gray-400"}):a.jsx(va,{className:"h-4 w-4 text-gray-400"})]})}),a.jsx(rg,{children:a.jsx("div",{className:"border-t border-gray-100",children:r?t.length===0?a.jsxs("div",{className:"p-4 text-center text-gray-500",children:[a.jsx(Bc,{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:t.map((s,l)=>a.jsx(xue,{entry:s,isLatest:l===0},`${s.timestamp}-${l}`))})}):a.jsxs("div",{className:"p-4 text-center text-gray-500",children:[a.jsx(Xj,{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."})]})})})]})})},wue=({modeEvent:t})=>{const e=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";case"ai_session_concluded":return"AI Discussion Concluded";default:return"Mode Changed"}},r=i=>{switch(i){case"ai_mode_started":return"text-blue-600";case"manual_mode_started":return"text-slate-600";case"ai_session_concluded":return"text-green-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(t.event_type)}`,children:a.jsxs("div",{className:"flex items-center space-x-2 text-xs font-medium",children:[a.jsx("span",{children:n(t.event_type)}),a.jsx("span",{className:"text-gray-400",children:"at"}),a.jsx("span",{children:e(t.timestamp)})]})}),a.jsx("div",{className:"flex-1 border-t border-gray-200"})]})},Sue=({messages:t,modeEvents:e,personas:n,isSpeaking:r,focusGroupId:i,isAiModeActive:o=!1,selectedParticipantIds:s,onToggleHighlight:l,onAdvanceDiscussion:c,onNewMessage:u,onStatusChange:d,isEditingDiscussionGuide:f=!1})=>{const[h,p]=y.useState(""),[g,m]=y.useState(null),[v,b]=y.useState(!1),[x,w]=y.useState(null),S=y.useRef(null),[C,A]=y.useState(-1),[_,j]=y.useState(!1),k=y.useRef(0),P=y.useRef(null),R=y.useRef(1e4),E=y.useRef(null),[I,L]=y.useState(!1),[V,$]=y.useState(!1),[z,M]=y.useState(!1),[U,K]=y.useState(null),X=U!==null?U:o,[re,xe]=y.useState([]),[F,ue]=y.useState(!1),ie=F;y.useEffect(()=>{o&&i&&ce()},[o,i]);const ce=async()=>{if(i)try{o&&Me()}catch(B){console.error("Error checking autonomous status:",B)}},Me=async()=>{if(i)try{const B=await Hn.getReasoningHistory(i);xe(B.data.reasoning_history||[])}catch(B){console.error("Error fetching reasoning history:",B)}};y.useEffect(()=>{I&&ne()},[t,I]),y.useEffect(()=>{let B;return o&&i&&(B=setInterval(()=>{Me(),ce()},5e3)),()=>{B&&clearInterval(B)}},[o,i]),y.useEffect(()=>{k.current=t.length},[]),y.useEffect(()=>{const B=t.length,ee=k.current;if(_&&B>ee){const me=Date.now(),Ce=P.current;if(Ce&&me-Ce>=R.current)b(!1),j(!1),P.current=null;else if(Ce){const De=R.current-(me-Ce);setTimeout(()=>{b(!1),j(!1),P.current=null},Math.max(0,De))}else b(!1),j(!1)}k.current=B},[t.length,_]);const pe=B=>n.find(ee=>ee.id===B||ee._id===B),Se=s.length===0?t:t.filter(B=>B.senderId==="moderator"||B.senderId==="facilitator"||s.includes(B.senderId)),Te=()=>{const B=[];return Se.forEach(ee=>{B.push({type:"message",data:ee,timestamp:ee.timestamp})}),e.forEach(ee=>{B.push({type:"mode_event",data:ee,timestamp:ee.timestamp})}),B.sort((ee,me)=>ee.timestamp.getTime()-me.timestamp.getTime())},ne=()=>{if(!f&&E.current){const B=E.current.closest("[data-radix-scroll-area-viewport]");if(B){const ee=E.current.offsetTop-B.clientHeight+50,me=B.scrollTop,Ce=ee-me,De=300;let we=null;const We=St=>{we||(we=St);const Tt=St-we,Ze=Math.min(Tt/De,1),Qe=1-Math.pow(1-Ze,3);B.scrollTop=me+Ce*Qe,Ze<1&&window.requestAnimationFrame(We)};window.requestAnimationFrame(We)}else E.current.scrollIntoView({behavior:"smooth",block:"end"})}},rt=async B=>{var De,we;if(B.preventDefault(),!h.trim())return;let ee=h,me=null;const Ce=g;p(""),m(null),b(!0),j(!0),P.current=Date.now();try{if(x){try{se.info("Uploading creative asset...",{description:"Please wait while we upload your image."});const Tt=new FormData;Tt.append("assets",x);const Ze=await jt.uploadAssets(i,Tt);console.log("Upload response:",Ze==null?void 0:Ze.data);const Qe=Ze==null?void 0:Ze.data;Qe&&Qe.assets&&Qe.assets.length>0?(me=Qe.assets[0].filename,console.log("Successfully got filename from upload response:",me)):console.error("Invalid upload response structure:",Qe),me&&(ee=`Please review this creative asset titled '${me}'. ${h}`,se.success("Creative asset uploaded successfully",{description:"The image has been attached to your message."}))}catch(Tt){console.error("Error uploading file:",Tt),console.error("Upload error details:",(De=Tt.response)==null?void 0:De.data),se.error("Failed to upload creative asset",{description:"Your message will be sent without the attachment."})}H()}const We={id:`msg-${Date.now()}`,senderId:"facilitator",text:ee,timestamp:new Date,type:"question"},St=await jt.sendMessage(i,{text:ee,type:"question",senderId:"facilitator"});console.log("Message sent to API:",St),(we=St==null?void 0:St.data)!=null&&we.message_id&&(We.id=St.data.message_id),u(We),setTimeout(()=>{ne()},100),Ce&&Ce.mentionedParticipantIds.length>0&&setTimeout(()=>{Q(Ce.mentionedParticipantIds,We.text)},500)}catch(We){console.error("Error sending message:",We),b(!1),j(!1),P.current=null;const St={id:`msg-${Date.now()}`,senderId:"facilitator",text:h,timestamp:new Date,type:"question"};u(St),setTimeout(()=>{ne()},100),se.error("Failed to send message to server",{description:"Message will be shown locally but not saved."})}},Fe=()=>{for(let B=t.length-1;B>=0;B--)if(t[B].senderId==="moderator"&&t[B].type==="question")return t[B].text;for(let B=t.length-1;B>=0;B--)if(t[B].senderId==="moderator")return t[B].text;return"What are your thoughts on this topic?"},vt=(B,ee)=>{if(!B||!B.sections||!ee)return null;const{section_index:me,subsection_index:Ce,item_index:De,item_type:we}=ee,We=B.sections,St=Ze=>{const Qe=[];return Ze.questions&&Ze.questions.forEach(($t,Yt)=>{Qe.push({...$t,type:"question",index:Yt})}),Ze.activities&&Ze.activities.forEach(($t,Yt)=>{Qe.push({...$t,type:"activity",index:Yt})}),Qe.sort(($t,Yt)=>$t.type!==Yt.type?$t.type==="question"?-1:1:$t.index-Yt.index)};if(me>=We.length)return{completed:!0};const Tt=We[me];if(Ce!==void 0&&Tt.subsections){if(Ce>=Tt.subsections.length)return vt(B,{section_index:me+1,subsection_index:void 0,item_index:0,item_type:"question"});const Ze=Tt.subsections[Ce],Qe=St(Ze),$t=Qe.findIndex(Yt=>Yt.type===we&&Yt.index===De);if($t0){const Qe=Ze.findIndex($t=>$t.type===we&&$t.index===De);if(Qe0?vt(B,{section_index:me,subsection_index:0,item_index:0,item_type:"question"}):vt(B,{section_index:me+1,subsection_index:void 0,item_index:0,item_type:"question"})}},mt=async()=>{var B,ee,me;if(i)try{b(!0),j(!0),P.current=Date.now(),se.info("Advancing discussion...",{description:"Moving to the next question in the discussion guide."});const[Ce,De]=await Promise.all([Hn.getModeratorStatus(i),jt.getById(i)]);if(!((B=Ce==null?void 0:Ce.data)!=null&&B.status)||!((ee=De==null?void 0:De.data)!=null&&ee.discussionGuide))throw new Error("Could not fetch moderator status or discussion guide");const we=Ce.data.status,We=De.data.discussionGuide;if(!We.sections)throw new Error("Discussion guide does not have a structured format");const St=vt(We,we.moderator_position);if(!St)throw new Error("Could not determine next discussion item");if(St.completed){se.success("Discussion guide completed",{description:"All sections of the discussion guide have been covered."});const Ze={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(Ze);return}await Hn.setModeratorPosition(i,St.sectionId,St.itemId);const Tt={id:`msg-${Date.now()}`,senderId:"moderator",text:St.content,timestamp:new Date,type:"question"};try{const Ze=await jt.sendMessage(i,{senderId:"moderator",text:Tt.text,type:"question"});(me=Ze==null?void 0:Ze.data)!=null&&me.message_id&&(Tt.id=Ze.data.message_id)}catch(Ze){console.warn("Failed to save message to API, showing locally:",Ze)}u(Tt),setTimeout(()=>{ne()},100),se.success("Discussion advanced",{description:`Moved to: ${St.section.title}${St.subsection?` > ${St.subsection.title}`:""}`}),d&&setTimeout(()=>d(),500)}catch(Ce){console.error("Error advancing discussion:",Ce),se.error("Failed to advance discussion",{description:Ce.message||"There was a problem advancing to the next question."}),b(!1),j(!1),P.current=null}},Bt=async()=>{var B,ee,me,Ce;if(i){console.log("Starting AI Mode: setting autonomousLoading to true"),M(!0);try{console.log("Starting AI Mode: calling API...");const we=await Promise.race([Hn.startAutonomousConversation(i),new Promise((We,St)=>setTimeout(()=>St(new Error("API call timeout after 30 seconds")),3e4))]);if(console.log("Starting AI Mode: API response received:",we),we.data.error){se.error("Failed to start autonomous conversation",{description:we.data.error}),M(!1);return}se.success("Autonomous conversation started",{description:"The AI is now managing the focus group conversation"}),K(!0);try{console.log("Starting AI Mode: calling onStatusChange..."),d&&(await d(),console.log("Starting AI Mode: onStatusChange completed successfully"))}catch(We){console.error("Starting AI Mode: onStatusChange failed:",We)}console.log("Starting AI Mode: resetting autonomousLoading to false"),M(!1),setTimeout(()=>{console.log("Starting AI Mode: clearing local AI mode state"),K(null)},1e3),Me()}catch(De){console.error("Error starting autonomous conversation:",De),De.response&&De.response.data&&console.error("Backend error details:",De.response.data);const we=((ee=(B=De.response)==null?void 0:B.data)==null?void 0:ee.message)||((Ce=(me=De.response)==null?void 0:me.data)==null?void 0:Ce.error)||"Please check your connection and try again";se.error("Failed to start autonomous conversation",{description:we}),M(!1)}}},N=async()=>{if(i){console.log("Stopping AI Mode: setting autonomousLoading to true"),M(!0);try{const B=await Hn.stopAutonomousConversation(i,"manual_stop");if(B.data.error){se.error("Failed to stop autonomous conversation",{description:B.data.error}),M(!1);return}xe([]),se.success("Autonomous conversation stopped",{description:"You can now moderate the discussion manually"}),K(!1);try{console.log("Stopping AI Mode: calling onStatusChange..."),d&&(await d(),console.log("Stopping AI Mode: onStatusChange completed successfully"))}catch(ee){console.error("Stopping AI Mode: onStatusChange failed:",ee)}console.log("Stopping AI Mode: resetting autonomousLoading to false"),M(!1),setTimeout(()=>{console.log("Stopping AI Mode: clearing local AI mode state"),K(null)},1e3)}catch(B){console.error("Error stopping autonomous conversation:",B),se.error("Failed to stop autonomous conversation"),M(!1)}}},D=B=>{var me;const ee=(me=B.target.files)==null?void 0:me[0];if(ee){if(!ee.type.startsWith("image/")){se.error("Please select an image file",{description:"Only image files (JPG, PNG, etc.) are supported for creative review."});return}if(ee.size>10*1024*1024){se.error("File too large",{description:"Please select an image smaller than 10MB."});return}w(ee),se.success(`Image selected: ${ee.name}`,{description:"The image will be attached to your next message."})}},H=()=>{w(null),S.current&&(S.current.value="")},Q=async(B,ee)=>{var me;if(!(!i||B.length===0))try{b(!0),j(!0),P.current=Date.now(),se.info("Generating responses from mentioned participants...",{description:`Generating responses from ${B.length} mentioned participant(s).`});for(const Ce of B){const De=n.find(we=>(we._id||we.id)===Ce);if(!De){console.warn(`Mentioned participant ${Ce} not found in focus group`);continue}try{const we=await Hn.generateResponse(i,Ce,ee||"Continue the conversation based on the latest moderator message.");if((me=we==null?void 0:we.data)!=null&&me.response){console.log("Generated response from mentioned participant:",we.data);const We={id:we.data.message_id||`msg-${Date.now()}-${Ce}`,senderId:Ce,text:we.data.response,timestamp:new Date,type:"response"};u(We),se.success(`Response generated from ${De.name}`,{description:we.data.response.substring(0,100)+"..."})}}catch(we){console.error(`Error generating response from ${De.name}:`,we),se.error(`Failed to generate response from ${De.name}`)}}}catch(Ce){console.error("Error generating mentioned responses:",Ce),se.error("Failed to generate responses from mentioned participants"),b(!1),j(!1),P.current=null}},Z=async()=>{var B,ee,me,Ce;if(i){if(n.length===0){se.error("No participants available",{description:"Add participants to the focus group before generating responses."});return}try{b(!0),j(!0),P.current=Date.now(),se.info("AI is selecting participant...",{description:"Analyzing the conversation to choose the best respondent."});const De=await Hn.makeConversationDecision(i,.7,"manual");if(!De||!De.data||!De.data.decision)throw new Error("Empty decision response from AI");const we=De.data.decision;if(we.action==="participant_respond"){const We=we.details.participant_id,St=we.details.topic_context,Tt=we.reasoning,Ze=n.find($t=>($t._id||$t.id)===We);if(!Ze)throw new Error(`Selected participant ${We} not found in focus group`);se.info("Generating response...",{description:`AI selected ${Ze.name}: ${Tt.substring(0,100)}${Tt.length>100?"...":""}`});const Qe=await Hn.generateResponse(i,We,St);if(!Qe||!Qe.data)throw new Error("Empty response from API");if((B=Qe==null?void 0:Qe.data)!=null&&B.message_id&&((ee=Qe==null?void 0:Qe.data)!=null&&ee.response)){const $t={id:Qe.data.message_id,senderId:We,text:Qe.data.response,timestamp:new Date,type:"response",highlighted:!1};u($t),setTimeout(()=>{ne()},100)}else throw new Error("Failed to generate or save AI response")}else{if(console.log("AI suggested different action:",we.action),we.action==="moderator_speak"){se.info("AI suggests moderator intervention",{description:`AI reasoning: ${we.reasoning.substring(0,100)}${we.reasoning.length>100?"...":""}`});return}se.warning("Using fallback participant selection",{description:`AI suggested "${we.action}" but generating participant response anyway.`});const We=(C+1)%n.length,St=n[We],Tt=Fe(),Ze=St._id||St.id,Qe=await Hn.generateResponse(i,Ze,Tt);if((me=Qe==null?void 0:Qe.data)!=null&&me.message_id&&((Ce=Qe==null?void 0:Qe.data)!=null&&Ce.response)){const $t={id:Qe.data.message_id,senderId:Ze,text:Qe.data.response,timestamp:new Date,type:"response",highlighted:!1};u($t),setTimeout(()=>{ne()},100),A(We)}}}catch(De){console.error("Error generating AI response:",De),se.error("Failed to generate AI response",{description:"There was a problem connecting to the server."}),b(!1),j(!1),P.current=null}}};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:[Te().map(B=>B.type==="message"?a.jsx(pue,{message:B.data,persona:B.data.senderId!=="moderator"&&B.data.senderId!=="facilitator"?pe(B.data.senderId):null,toggleHighlight:()=>l(B.data.id),participants:n,focusGroupId:i},B.data.id):a.jsx(wue,{modeEvent:B.data},B.data.id)),(v||o)&&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:o?a.jsx(ea,{className:"h-4 w-4 text-primary animate-spin"}):a.jsx(us,{className:"h-4 w-4 text-primary"})}),a.jsx("span",{children:o?"AI is generating next response...":"Generating AI response..."})]}),a.jsx("div",{className:"h-8"}),a.jsx("div",{ref:E,className:"h-1"})]}),!I&&Se.length>6&&a.jsx("div",{className:"sticky bottom-5 ml-auto mr-5 z-10 w-fit",children:a.jsx(te,{size:"sm",className:"rounded-full shadow-md h-10 w-10 p-0",onClick:ne,title:"Scroll to bottom",children:a.jsx(nO,{className:"h-4 w-4"})})})]})}),a.jsx(bue,{reasoningHistory:re,isVisible:ie,onToggle:()=>ue(!F),isAiMode:o}),a.jsxs("div",{className:"pt-4 border-t border-slate-200 w-full",children:[x&&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(aO,{className:"h-4 w-4 text-blue-600"}),a.jsx("span",{className:"text-sm text-blue-700",children:x.name}),a.jsxs("span",{className:"text-xs text-blue-500",children:["(",(x.size/1024/1024).toFixed(1)," MB)"]})]}),a.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:H,className:"h-6 w-6 p-0 text-blue-600 hover:text-blue-800",children:"×"})]}),a.jsxs("form",{onSubmit:rt,className:"flex items-center gap-2 w-full",children:[a.jsx("input",{ref:S,type:"file",accept:"image/*",onChange:D,className:"hidden"}),a.jsx(Sz,{value:h,onChange:(B,ee)=>{p(B),m(ee||null)},participants:n,placeholder:"Ask a question or provide guidance...",className:"flex-1 min-w-0",disabled:!1}),a.jsx(te,{type:"button",variant:"outline",size:"sm",onClick:()=>{var B;return(B=S.current)==null?void 0:B.click()},className:"hover-transition shrink-0 px-3",disabled:!1,title:"Attach image for creative review",children:a.jsx(aO,{className:"h-4 w-4"})}),a.jsxs(te,{type:"submit",variant:"default",className:"hover-transition shrink-0",disabled:!1,children:[a.jsx(Ps,{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...":o?"AI mode active":"Manual moderation mode"}),a.jsx(te,{variant:"outline",size:"sm",onClick:X?N:Bt,disabled:z,className:`hover-transition ${X?"bg-red-50 text-red-600 hover:bg-red-100":"bg-blue-50 text-blue-600 hover:bg-blue-100"}`,title:X?"Stop AI mode and return to manual":"Start autonomous AI conversation",children:z?a.jsxs(a.Fragment,{children:[a.jsx(ea,{className:"mr-1 h-3 w-3 animate-spin"}),o?"Stopping...":"Starting..."]}):X?a.jsxs(a.Fragment,{children:[a.jsx(ea,{className:"mr-1 h-3 w-3"}),"Stop AI Mode"]}):a.jsxs(a.Fragment,{children:[a.jsx(ea,{className:"mr-1 h-3 w-3"}),"Start AI Mode"]})}),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>{L(!I),I||ne()},className:`hover-transition ${I?"bg-blue-50 text-blue-600 hover:bg-blue-100":""}`,title:I?"Disable auto-scroll":"Enable auto-scroll",children:[a.jsx(nO,{className:`h-3 w-3 ${I?"mr-1":""}`}),I&&"Auto-scroll"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!o&&a.jsxs(a.Fragment,{children:[a.jsxs(te,{variant:"outline",onClick:mt,className:`hover-transition ${n.length===0?"bg-red-50":""}`,disabled:v,title:n.length===0?"Add participants to the focus group first":"Advance to the next part of the discussion guide",children:[a.jsx(Ps,{className:"mr-2 h-4 w-4"}),n.length===0?"No Participants":"Advance Discussion"]}),a.jsxs(te,{variant:"ghost",size:"sm",onClick:Z,className:`hover-transition ${n.length===0?"bg-red-50":""}`,disabled:v||n.length===0,title:"Generate a participant response to the current topic",children:[a.jsx(us,{className:"mr-1 h-3 w-3"}),"Get Response"]})]}),o&&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(te,{variant:"outline",size:"sm",onClick:()=>$(!V),className:"hover-transition",title:"Show autonomous conversation controls",children:a.jsx(Xj,{className:"h-3 w-3"})})]})]})]})]})]})},Cue=({themes:t,messages:e,personas:n=[],onThemeDelete:r,onQuoteClick:i})=>{const o=(d,f)=>{d.stopPropagation(),r&&(r(f),se.success("Theme deleted successfully"))},s=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=t.filter(d=>"source"in d?d.source==="highlight":!0),u=t.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(Vc,{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(Bc,{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(ut,{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=>o(f,d.id),children:a.jsx($o,{className:"h-3 w-3 text-slate-700"})}),a.jsx(pi,{className:"pb-2",children:a.jsx(Mi,{className:"text-base",children:d.title})}),a.jsxs(Et,{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,v=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:x=>{x.stopPropagation(),i&&i(p?f:b,v)},title:v?`Message ID: ${v}`:"Click to find original message",children:[m&&a.jsxs("span",{className:"font-semibold text-slate-700 mr-1",children:[m,":"]}),'"',g,'"',v&&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(HX,{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?e.find(v=>v.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 v=s(g);m=(v==null?void 0:v.name)||"Unknown Participant"}return a.jsxs(ut,{className:"hover:shadow-md hover:bg-slate-50 transition-all cursor-pointer relative group",onClick:v=>{v.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:v=>o(v,d.id),children:a.jsx($o,{className:"h-3 w-3 text-slate-700"})}),a.jsx(pi,{className:"pb-2",children:a.jsx(Mi,{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(Et,{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(us,{className:"h-3 w-3 mr-1"}),"Click to view in discussion"]})]})]},d.id)})})]}),t.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(Vc,{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."})]})]})]})},Aue=({themes:t,messages:e,personas:n,focusGroupId:r,onThemesGenerated:i,onThemeDelete:o,onQuoteClick:s,onGenerateKeyThemes:l})=>{const c=()=>{if(!t||t.length===0){se.warning("No themes to export",{description:"Generate some themes first before exporting."});return}let u=`# Key Themes Analysis +`},nonce:o}),a.jsx(et.div,{"data-radix-scroll-area-viewport":"",...s,asChild:i,ref:u,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:iue({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}))})]})});uz.displayName=cz;var Ms="ScrollAreaScrollbar",iT=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=go(Ms,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:s}=i,l=t.orientation==="horizontal";return y.useEffect(()=>(l?o(!0):s(!0),()=>{l?o(!1):s(!1)}),[l,o,s]),i.type==="hover"?a.jsx(Yce,{...r,ref:e,forceMount:n}):i.type==="scroll"?a.jsx(Qce,{...r,ref:e,forceMount:n}):i.type==="auto"?a.jsx(dz,{...r,ref:e,forceMount:n}):i.type==="always"?a.jsx(oT,{...r,ref:e}):null});iT.displayName=Ms;var Yce=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=go(Ms,t.__scopeScrollArea),[o,s]=y.useState(!1);return y.useEffect(()=>{const l=i.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),s(!0)},d=()=>{c=window.setTimeout(()=>s(!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(Mr,{present:n||o,children:a.jsx(dz,{"data-state":o?"visible":"hidden",...r,ref:e})})}),Qce=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=go(Ms,t.__scopeScrollArea),o=t.orientation==="horizontal",s=P0(()=>c("SCROLL_END"),100),[l,c]=Wce("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 y.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,i.scrollHideDelay,c]),y.useEffect(()=>{const u=i.viewport,d=o?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const p=u[d];f!==p&&(c("SCROLL"),s()),f=p};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[i.viewport,o,c,s]),a.jsx(Mr,{present:n||l!=="hidden",children:a.jsx(oT,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Te(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Te(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),dz=y.forwardRef((t,e)=>{const n=go(Ms,t.__scopeScrollArea),{forceMount:r,...i}=t,[o,s]=y.useState(!1),l=t.orientation==="horizontal",c=P0(()=>{if(n.viewport){const u=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,i=go(Ms,t.__scopeScrollArea),o=y.useRef(null),s=y.useRef(0),[l,c]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=gz(l.viewport,l.content),d={...r,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:h=>o.current=h,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:h=>s.current=h};function f(h,p){return nue(h,s.current,l,p)}return n==="horizontal"?a.jsx(Xce,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&o.current){const h=i.viewport.scrollLeft,p=II(h,l,i.dir);o.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(Jce,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&o.current){const h=i.viewport.scrollTop,p=II(h,l);o.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}),Xce=y.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,o=go(Ms,t.__scopeScrollArea),[s,l]=y.useState(),c=y.useRef(null),u=At(e,c,o.onScrollbarXChange);return y.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(hz,{"data-orientation":"horizontal",...i,ref:u,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":T0(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(o.viewport){const h=o.viewport.scrollLeft+d.deltaX;t.onWheelScroll(h),yz(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&s&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:dx(s.paddingLeft),paddingEnd:dx(s.paddingRight)}})}})}),Jce=y.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,o=go(Ms,t.__scopeScrollArea),[s,l]=y.useState(),c=y.useRef(null),u=At(e,c,o.onScrollbarYChange);return y.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(hz,{"data-orientation":"vertical",...i,ref:u,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":T0(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(o.viewport){const h=o.viewport.scrollTop+d.deltaY;t.onWheelScroll(h),yz(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&s&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:dx(s.paddingTop),paddingEnd:dx(s.paddingBottom)}})}})}),[Zce,fz]=az(Ms),hz=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:o,onThumbPointerUp:s,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=t,p=go(Ms,n),[g,m]=y.useState(null),v=At(e,k=>m(k)),b=y.useRef(null),x=y.useRef(""),w=p.viewport,S=r.content-r.viewport,C=dr(d),A=dr(c),_=P0(f,10);function j(k){if(b.current){const P=k.clientX-b.current.left,I=k.clientY-b.current.top;u({x:P,y:I})}}return y.useEffect(()=>{const k=P=>{const I=P.target;(g==null?void 0:g.contains(I))&&C(P,S)};return document.addEventListener("wheel",k,{passive:!1}),()=>document.removeEventListener("wheel",k,{passive:!1})},[w,g,S,C]),y.useEffect(A,[r,A]),Md(g,_),Md(p.content,_),a.jsx(Zce,{scope:n,scrollbar:g,hasThumb:i,onThumbChange:dr(o),onThumbPointerUp:dr(s),onThumbPositionChange:A,onThumbPointerDown:dr(l),children:a.jsx(et.div,{...h,ref:v,style:{position:"absolute",...h.style},onPointerDown:Te(t.onPointerDown,k=>{k.button===0&&(k.target.setPointerCapture(k.pointerId),b.current=g.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),j(k))}),onPointerMove:Te(t.onPointerMove,j),onPointerUp:Te(t.onPointerUp,k=>{const P=k.target;P.hasPointerCapture(k.pointerId)&&P.releasePointerCapture(k.pointerId),document.body.style.webkitUserSelect=x.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})}),ux="ScrollAreaThumb",pz=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=fz(ux,t.__scopeScrollArea);return a.jsx(Mr,{present:n||i.hasThumb,children:a.jsx(eue,{ref:e,...r})})}),eue=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...i}=t,o=go(ux,n),s=fz(ux,n),{onThumbPositionChange:l}=s,c=At(e,f=>s.onThumbChange(f)),u=y.useRef(),d=P0(()=>{u.current&&(u.current(),u.current=void 0)},100);return y.useEffect(()=>{const f=o.viewport;if(f){const h=()=>{if(d(),!u.current){const p=rue(f,l);u.current=p,l()}};return l(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[o.viewport,d,l]),a.jsx(et.div,{"data-state":s.hasThumb?"visible":"hidden",...i,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Te(t.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),g=f.clientX-p.left,m=f.clientY-p.top;s.onThumbPointerDown({x:g,y:m})}),onPointerUp:Te(t.onPointerUp,s.onThumbPointerUp)})});pz.displayName=ux;var sT="ScrollAreaCorner",mz=y.forwardRef((t,e)=>{const n=go(sT,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(tue,{...t,ref:e}):null});mz.displayName=sT;var tue=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,i=go(sT,n),[o,s]=y.useState(0),[l,c]=y.useState(0),u=!!(o&&l);return Md(i.scrollbarX,()=>{var f;const d=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(d),c(d)}),Md(i.scrollbarY,()=>{var f;const d=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(d),s(d)}),u?a.jsx(et.div,{...r,ref:e,style:{width:o,height:l,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function dx(t){return t?parseInt(t,10):0}function gz(t,e){const n=t/e;return isNaN(n)?0:n}function T0(t){const e=gz(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function nue(t,e,n,r="ltr"){const i=T0(n),o=i/2,s=e||o,l=i-s,c=n.scrollbar.paddingStart+s,u=n.scrollbar.size-n.scrollbar.paddingEnd-l,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return vz([c,u],f)(t)}function II(t,e,n="ltr"){const r=T0(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-i,s=e.content-e.viewport,l=o-r,c=n==="ltr"?[0,s]:[s*-1,0],u=Wp(t,c);return vz([0,s],[0,l])(u)}function vz(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function yz(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return function i(){const o={left:t.scrollLeft,top:t.scrollTop},s=n.left!==o.left,l=n.top!==o.top;(s||l)&&e(),n=o,r=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(r)};function P0(t,e){const n=dr(t),r=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),y.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function Md(t,e){const n=dr(e);Rr(()=>{let r=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(t),()=>{window.cancelAnimationFrame(r),i.unobserve(t)}}},[t,n])}function iue(t,e){const{asChild:n,children:r}=t;if(!n)return typeof e=="function"?e(r):e;const i=y.Children.only(r);return y.cloneElement(i,{children:typeof e=="function"?e(i.props.children):e})}var xz=lz,oue=uz,sue=mz;const k0=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(xz,{ref:r,className:Pe("relative overflow-hidden",t),...n,children:[a.jsx(oue,{className:"h-full w-full rounded-[inherit]",children:e}),a.jsx(bz,{}),a.jsx(sue,{})]}));k0.displayName=xz.displayName;const bz=y.forwardRef(({className:t,orientation:e="vertical",...n},r)=>a.jsx(iT,{ref:r,orientation:e,className:Pe("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:a.jsx(pz,{className:"relative flex-1 rounded-full bg-border"})}));bz.displayName=iT.displayName;const aue=({participants:t,isVisible:e,selectedIndex:n,onSelect:r,onClose:i,position:o})=>{const s=y.useRef(null);return y.useEffect(()=>{const l=c=>{s.current&&!s.current.contains(c.target)&&i()};if(e)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[e,i]),y.useEffect(()=>{if(e&&n>=0&&s.current){const l=s.current.children[n];l&&l.scrollIntoView({block:"nearest",behavior:"smooth"})}},[n,e]),!e||t.length===0?null:a.jsxs("div",{ref:s,className:"absolute z-50 w-64 max-h-48 overflow-y-auto bg-white border border-slate-200 rounded-lg shadow-lg",style:{top:o.top,left:o.left},children:[t.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:Zm(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)}),t.length===0&&a.jsx("div",{className:"p-3 text-center text-slate-500 text-sm",children:"No participants found"})]})};function J1(t,e){const n=[],r=[],i=/@(\w+(?:\s+\w+)*)/g;let o;for(;(o=i.exec(t))!==null;){const s=o[1],l=o.index,c=o.index+o[0].length,u=e.find(d=>d.name.toLowerCase()===s.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:t,mentions:n,mentionedParticipantIds:r}}function lue(t,e){if(e.length===0)return[t];const n=[];let r=0;return[...e].sort((o,s)=>o.startIndex-s.startIndex).forEach((o,s)=>{o.startIndex>r&&n.push(t.slice(r,o.startIndex)),n.push(T.createElement("span",{key:`mention-${s}`,className:"text-blue-600 bg-blue-50 px-1 rounded font-medium"},`@${o.name}`)),r=o.endIndex}),r=0;n--){const r=t[n];if(r==="@"){if(n===0||/\s/.test(t[n-1]))return n}else if(/\s/.test(r))break}return null}function due(t,e,n){return t.slice(e+1,n).toLowerCase()}function fue(t,e){return e?t.filter(n=>n.name.toLowerCase().includes(e)):t}const wz=y.forwardRef(({value:t,onChange:e,participants:n,placeholder:r="Ask a question or provide guidance...",className:i="",disabled:o=!1},s)=>{const[l,c]=y.useState(!1),[u,d]=y.useState(0),[f,h]=y.useState({top:0,left:0}),[p,g]=y.useState(null),[m,v]=y.useState([]),b=y.useRef(null),x=y.useRef(null);y.useEffect(()=>{s&&b.current&&(typeof s=="function"?s(b.current):s.current=b.current)},[s]);const w=()=>{if(b.current&&x.current&&p!==null){const j=b.current,k=x.current,P=document.createElement("div");P.style.position="absolute",P.style.visibility="hidden",P.style.whiteSpace="pre",P.style.font=window.getComputedStyle(j).font,P.textContent=t.slice(0,p),document.body.appendChild(P);const I=P.offsetWidth;document.body.removeChild(P);const E=k.getBoundingClientRect(),R=j.getBoundingClientRect();h({top:R.height+4,left:Math.min(I,E.width-280)})}},S=j=>{const k=j.target.value,P=j.target.selectionStart||0,I=uue(k,P);if(I!==null&&n.length>0){const R=due(k,I,P),L=fue(n,R);g(I),v(L),d(0),c(!0)}else c(!1),g(null);const E=J1(k,n);e(k,E)},C=j=>{if(l&&m.length>0)switch(j.key){case"ArrowDown":j.preventDefault(),d(k=>kk>0?k-1:m.length-1);break;case"Enter":case"Tab":j.preventDefault(),m[u]&&A(m[u]);break;case"Escape":j.preventDefault(),c(!1);break}},A=j=>{if(p!==null&&b.current){const k=b.current.selectionStart||0,{newText:P,newCursorPosition:I}=cue(t,k,j,p),E=J1(P,n);e(P,E),setTimeout(()=>{b.current&&(b.current.focus(),b.current.setSelectionRange(I,I))},0),c(!1),g(null)}},_=()=>{c(!1),g(null)};return y.useEffect(()=>{l&&p!==null&&w()},[l,p,t]),a.jsxs("div",{ref:x,className:`relative ${i}`,children:[a.jsx("input",{ref:b,type:"text",value:t,onChange:S,onKeyDown:C,placeholder:r,disabled:o,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(aue,{participants:m,isVisible:l,selectedIndex:u,onSelect:A,onClose:_,position:f})]})});wz.displayName="MentionInput";const hue=({message:t,persona:e,toggleHighlight:n,participants:r=[],focusGroupId:i})=>{const[o,s]=y.useState(!1),l=t.senderId==="moderator",c=t.senderId==="facilitator",u=J1(t.text,r),d=lue(t.text,u.mentions),h=(m=>{const v=[/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 v){const x=m.match(b);if(x)return x[1]}return null})(t.text),p=(l||c)&&h&&i,g=()=>{n()};return a.jsxs("div",{id:`message-${t.id}`,className:Pe("flex items-start p-3 rounded-lg transition-colors",t.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:()=>s(!0),onMouseLeave:()=>s(!1),"data-highlighted":t.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(ea,{className:"h-6 w-6 text-primary"})}):c?a.jsx("div",{className:"bg-green-100 p-2 rounded-full",children:a.jsx(Ap,{className:"h-6 w-6 text-green-600"})}):e?a.jsx("div",{className:"bg-slate-100 p-2 rounded-full",children:a.jsx("img",{src:Zm(e),alt:`${e.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(TX,{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":(e==null?void 0:e.name)||"Unknown"}),!l&&!c&&e&&a.jsx(ur,{variant:"outline",className:"text-xs font-normal",children:e.occupation}),a.jsx("span",{className:"text-xs text-slate-500 ml-auto",children:t.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(Cv,{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:_t.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:",_t.getAssetUrl(i,h)),m.currentTarget.style.display="none";const v=document.createElement("div");v.className="text-xs text-slate-500 italic p-2 border rounded bg-slate-100",v.textContent=`Creative asset not found: ${h}`,(b=m.currentTarget.parentNode)==null||b.appendChild(v)}})]}),a.jsx("div",{className:Pe("flex mt-2 space-x-2",!o&&!t.highlighted&&"hidden"),children:a.jsxs(te,{variant:"ghost",size:"sm",onClick:g,className:"h-8 px-2 text-xs",children:[a.jsx(qX,{className:Pe("h-3 w-3 mr-1",t.highlighted?"fill-amber-400 text-amber-400":"text-slate-400")}),t.highlighted?"Highlighted":"Highlight"]})})]})]})},pue=({action:t})=>{switch(t){case"moderator_speak":return a.jsx(Ps,{className:"h-4 w-4 text-blue-500"});case"participant_respond":return a.jsx(Cr,{className:"h-4 w-4 text-green-500"});case"participant_interaction":return a.jsx(Cr,{className:"h-4 w-4 text-purple-500"});case"probe_trigger":return a.jsx(f4,{className:"h-4 w-4 text-orange-500"});case"end_session":return a.jsx(XX,{className:"h-4 w-4 text-red-500"});default:return a.jsx(Bc,{className:"h-4 w-4 text-gray-500"})}},mue=({status:t})=>{switch(t){case"success":return a.jsx(Gj,{className:"h-3 w-3 text-green-500"});case"error":return a.jsx(PX,{className:"h-3 w-3 text-red-500"});case"pending":return a.jsx(Cp,{className:"h-3 w-3 text-yellow-500 animate-pulse"});default:return null}},gue=({action:t})=>({moderator_speak:"Moderator",participant_respond:"Participant Response",participant_interaction:"Participant Interaction",probe_trigger:"Probe Question",end_session:"End Session"})[t]||t,vue=t=>{try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return t}},yue=({entry:t,isLatest:e})=>{const[n,r]=y.useState(e);return a.jsx(ct,{className:`mb-2 ${e?"ring-2 ring-blue-200 bg-blue-50/50":""}`,children:a.jsxs(eg,{open:n,onOpenChange:r,children:[a.jsx(tg,{asChild:!0,children:a.jsx(pi,{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(pue,{action:t.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(gue,{action:t.action})}),a.jsx(mue,{status:t.execution_status})]}),a.jsx("span",{className:"text-xs text-gray-500",children:vue(t.timestamp)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[e&&a.jsx(ur,{variant:"secondary",className:"text-xs",children:"Latest"}),n?a.jsx(Hc,{className:"h-4 w-4 text-gray-400"}):a.jsx(va,{className:"h-4 w-4 text-gray-400"})]})]})})}),a.jsx(ng,{children:a.jsx(jt,{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:['"',t.reasoning,'"']})]}),t.details&&Object.keys(t.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(t.details,null,2)})]}),t.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:t.execution_result.error?a.jsxs("span",{className:"text-red-600",children:["Error: ",t.execution_result.error]}):a.jsx("span",{className:"text-green-600",children:t.execution_result.message||"Success"})})]})]})})})]})})},xue=({reasoningHistory:t,isVisible:e,onToggle:n,isAiMode:r=!1})=>{const[i,o]=y.useState(!0);return y.useEffect(()=>{if(i&&t.length>0){const s=document.getElementById("reasoning-panel-content");s&&(s.scrollTop=0)}},[t.length,i]),a.jsx("div",{className:"border-t border-gray-200 bg-white",children:a.jsxs(eg,{open:e,onOpenChange:n,children:[a.jsx(tg,{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(Bc,{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&&t.length>0&&a.jsx(ur,{variant:"outline",className:"text-xs",children:t.length}),!r&&a.jsx(ur,{variant:"secondary",className:"text-xs",children:"Manual Mode"})]}),e?a.jsx(Hc,{className:"h-4 w-4 text-gray-400"}):a.jsx(va,{className:"h-4 w-4 text-gray-400"})]})}),a.jsx(ng,{children:a.jsx("div",{className:"border-t border-gray-100",children:r?t.length===0?a.jsxs("div",{className:"p-4 text-center text-gray-500",children:[a.jsx(Bc,{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(k0,{id:"reasoning-panel-content",className:"h-[25vh] p-3",children:a.jsx("div",{className:"space-y-2",children:t.map((s,l)=>a.jsx(yue,{entry:s,isLatest:l===0},`${s.timestamp}-${l}`))})}):a.jsxs("div",{className:"p-4 text-center text-gray-500",children:[a.jsx(Qj,{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."})]})})})]})})},bue=({modeEvent:t})=>{const e=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";case"ai_session_concluded":return"AI Discussion Concluded";default:return"Mode Changed"}},r=i=>{switch(i){case"ai_mode_started":return"text-blue-600";case"manual_mode_started":return"text-slate-600";case"ai_session_concluded":return"text-green-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(t.event_type)}`,children:a.jsxs("div",{className:"flex items-center space-x-2 text-xs font-medium",children:[a.jsx("span",{children:n(t.event_type)}),a.jsx("span",{className:"text-gray-400",children:"at"}),a.jsx("span",{children:e(t.timestamp)})]})}),a.jsx("div",{className:"flex-1 border-t border-gray-200"})]})},wue=({messages:t,modeEvents:e,personas:n,isSpeaking:r,focusGroupId:i,isAiModeActive:o=!1,selectedParticipantIds:s,onToggleHighlight:l,onAdvanceDiscussion:c,onNewMessage:u,onStatusChange:d,isEditingDiscussionGuide:f=!1})=>{const[h,p]=y.useState(""),[g,m]=y.useState(null),[v,b]=y.useState(!1),[x,w]=y.useState(null),S=y.useRef(null),[C,A]=y.useState(-1),[_,j]=y.useState(!1),k=y.useRef(0),P=y.useRef(null),I=y.useRef(1e4),E=y.useRef(null),[R,L]=y.useState(!1),[V,$]=y.useState(!1),[z,M]=y.useState(!1),[U,W]=y.useState(null),X=U!==null?U:o,[re,xe]=y.useState([]),[F,fe]=y.useState(!1),oe=F;y.useEffect(()=>{o&&i&&de()},[o,i]);const de=async()=>{if(i)try{o&&Re()}catch(B){console.error("Error checking autonomous status:",B)}},Re=async()=>{if(i)try{const B=await Hn.getReasoningHistory(i);xe(B.data.reasoning_history||[])}catch(B){console.error("Error fetching reasoning history:",B)}};y.useEffect(()=>{R&&ne()},[t,R]),y.useEffect(()=>{let B;return o&&i&&(B=setInterval(()=>{Re(),de()},5e3)),()=>{B&&clearInterval(B)}},[o,i]),y.useEffect(()=>{k.current=t.length},[]),y.useEffect(()=>{const B=t.length,ee=k.current;if(_&&B>ee){const me=Date.now(),Ce=P.current;if(Ce&&me-Ce>=I.current)b(!1),j(!1),P.current=null;else if(Ce){const Me=I.current-(me-Ce);setTimeout(()=>{b(!1),j(!1),P.current=null},Math.max(0,Me))}else b(!1),j(!1)}k.current=B},[t.length,_]);const pe=B=>n.find(ee=>ee.id===B||ee._id===B),Se=s.length===0?t:t.filter(B=>B.senderId==="moderator"||B.senderId==="facilitator"||s.includes(B.senderId)),Ne=()=>{const B=[];return Se.forEach(ee=>{B.push({type:"message",data:ee,timestamp:ee.timestamp})}),e.forEach(ee=>{B.push({type:"mode_event",data:ee,timestamp:ee.timestamp})}),B.sort((ee,me)=>ee.timestamp.getTime()-me.timestamp.getTime())},ne=()=>{if(!f&&E.current){const B=E.current.closest("[data-radix-scroll-area-viewport]");if(B){const ee=E.current.offsetTop-B.clientHeight+50,me=B.scrollTop,Ce=ee-me,Me=300;let we=null;const We=wt=>{we||(we=wt);const Nt=wt-we,Je=Math.min(Nt/Me,1),Xe=1-Math.pow(1-Je,3);B.scrollTop=me+Ce*Xe,Je<1&&window.requestAnimationFrame(We)};window.requestAnimationFrame(We)}else E.current.scrollIntoView({behavior:"smooth",block:"end"})}},nt=async B=>{var Me,we;if(B.preventDefault(),!h.trim())return;let ee=h,me=null;const Ce=g;p(""),m(null),b(!0),j(!0),P.current=Date.now();try{if(x){try{ie.info("Uploading creative asset...",{description:"Please wait while we upload your image."});const Nt=new FormData;Nt.append("assets",x);const Je=await _t.uploadAssets(i,Nt);console.log("Upload response:",Je==null?void 0:Je.data);const Xe=Je==null?void 0:Je.data;Xe&&Xe.assets&&Xe.assets.length>0?(me=Xe.assets[0].filename,console.log("Successfully got filename from upload response:",me)):console.error("Invalid upload response structure:",Xe),me&&(ee=`Please review this creative asset titled '${me}'. ${h}`,ie.success("Creative asset uploaded successfully",{description:"The image has been attached to your message."}))}catch(Nt){console.error("Error uploading file:",Nt),console.error("Upload error details:",(Me=Nt.response)==null?void 0:Me.data),ie.error("Failed to upload creative asset",{description:"Your message will be sent without the attachment."})}H()}const We={id:`msg-${Date.now()}`,senderId:"facilitator",text:ee,timestamp:new Date,type:"question"},wt=await _t.sendMessage(i,{text:ee,type:"question",senderId:"facilitator"});console.log("Message sent to API:",wt),(we=wt==null?void 0:wt.data)!=null&&we.message_id&&(We.id=wt.data.message_id),u(We),setTimeout(()=>{ne()},100),Ce&&Ce.mentionedParticipantIds.length>0&&setTimeout(()=>{Q(Ce.mentionedParticipantIds,We.text)},500)}catch(We){console.error("Error sending message:",We),b(!1),j(!1),P.current=null;const wt={id:`msg-${Date.now()}`,senderId:"facilitator",text:h,timestamp:new Date,type:"question"};u(wt),setTimeout(()=>{ne()},100),ie.error("Failed to send message to server",{description:"Message will be shown locally but not saved."})}},Fe=()=>{for(let B=t.length-1;B>=0;B--)if(t[B].senderId==="moderator"&&t[B].type==="question")return t[B].text;for(let B=t.length-1;B>=0;B--)if(t[B].senderId==="moderator")return t[B].text;return"What are your thoughts on this topic?"},vt=(B,ee)=>{if(!B||!B.sections||!ee)return null;const{section_index:me,subsection_index:Ce,item_index:Me,item_type:we}=ee,We=B.sections,wt=Je=>{const Xe=[];return Je.questions&&Je.questions.forEach(($t,Yt)=>{Xe.push({...$t,type:"question",index:Yt})}),Je.activities&&Je.activities.forEach(($t,Yt)=>{Xe.push({...$t,type:"activity",index:Yt})}),Xe.sort(($t,Yt)=>$t.type!==Yt.type?$t.type==="question"?-1:1:$t.index-Yt.index)};if(me>=We.length)return{completed:!0};const Nt=We[me];if(Ce!==void 0&&Nt.subsections){if(Ce>=Nt.subsections.length)return vt(B,{section_index:me+1,subsection_index:void 0,item_index:0,item_type:"question"});const Je=Nt.subsections[Ce],Xe=wt(Je),$t=Xe.findIndex(Yt=>Yt.type===we&&Yt.index===Me);if($t0){const Xe=Je.findIndex($t=>$t.type===we&&$t.index===Me);if(Xe0?vt(B,{section_index:me,subsection_index:0,item_index:0,item_type:"question"}):vt(B,{section_index:me+1,subsection_index:void 0,item_index:0,item_type:"question"})}},mt=async()=>{var B,ee,me;if(i)try{b(!0),j(!0),P.current=Date.now(),ie.info("Advancing discussion...",{description:"Moving to the next question in the discussion guide."});const[Ce,Me]=await Promise.all([Hn.getModeratorStatus(i),_t.getById(i)]);if(!((B=Ce==null?void 0:Ce.data)!=null&&B.status)||!((ee=Me==null?void 0:Me.data)!=null&&ee.discussionGuide))throw new Error("Could not fetch moderator status or discussion guide");const we=Ce.data.status,We=Me.data.discussionGuide;if(!We.sections)throw new Error("Discussion guide does not have a structured format");const wt=vt(We,we.moderator_position);if(!wt)throw new Error("Could not determine next discussion item");if(wt.completed){ie.success("Discussion guide completed",{description:"All sections of the discussion guide have been covered."});const Je={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(Je);return}await Hn.setModeratorPosition(i,wt.sectionId,wt.itemId);const Nt={id:`msg-${Date.now()}`,senderId:"moderator",text:wt.content,timestamp:new Date,type:"question"};try{const Je=await _t.sendMessage(i,{senderId:"moderator",text:Nt.text,type:"question"});(me=Je==null?void 0:Je.data)!=null&&me.message_id&&(Nt.id=Je.data.message_id)}catch(Je){console.warn("Failed to save message to API, showing locally:",Je)}u(Nt),setTimeout(()=>{ne()},100),ie.success("Discussion advanced",{description:`Moved to: ${wt.section.title}${wt.subsection?` > ${wt.subsection.title}`:""}`}),d&&setTimeout(()=>d(),500)}catch(Ce){console.error("Error advancing discussion:",Ce),ie.error("Failed to advance discussion",{description:Ce.message||"There was a problem advancing to the next question."}),b(!1),j(!1),P.current=null}},Bt=async()=>{var B,ee,me,Ce;if(i){console.log("Starting AI Mode: setting autonomousLoading to true"),M(!0);try{console.log("Starting AI Mode: calling API...");const we=await Promise.race([Hn.startAutonomousConversation(i),new Promise((We,wt)=>setTimeout(()=>wt(new Error("API call timeout after 30 seconds")),3e4))]);if(console.log("Starting AI Mode: API response received:",we),we.data.error){ie.error("Failed to start autonomous conversation",{description:we.data.error}),M(!1);return}ie.success("Autonomous conversation started",{description:"The AI is now managing the focus group conversation"}),W(!0);try{console.log("Starting AI Mode: calling onStatusChange..."),d&&(await d(),console.log("Starting AI Mode: onStatusChange completed successfully"))}catch(We){console.error("Starting AI Mode: onStatusChange failed:",We)}console.log("Starting AI Mode: resetting autonomousLoading to false"),M(!1),setTimeout(()=>{console.log("Starting AI Mode: clearing local AI mode state"),W(null)},1e3),Re()}catch(Me){console.error("Error starting autonomous conversation:",Me),Me.response&&Me.response.data&&console.error("Backend error details:",Me.response.data);const we=((ee=(B=Me.response)==null?void 0:B.data)==null?void 0:ee.message)||((Ce=(me=Me.response)==null?void 0:me.data)==null?void 0:Ce.error)||"Please check your connection and try again";ie.error("Failed to start autonomous conversation",{description:we}),M(!1)}}},N=async()=>{if(i){console.log("Stopping AI Mode: setting autonomousLoading to true"),M(!0);try{const B=await Hn.stopAutonomousConversation(i,"manual_stop");if(B.data.error){ie.error("Failed to stop autonomous conversation",{description:B.data.error}),M(!1);return}xe([]),ie.success("Autonomous conversation stopped",{description:"You can now moderate the discussion manually"}),W(!1);try{console.log("Stopping AI Mode: calling onStatusChange..."),d&&(await d(),console.log("Stopping AI Mode: onStatusChange completed successfully"))}catch(ee){console.error("Stopping AI Mode: onStatusChange failed:",ee)}console.log("Stopping AI Mode: resetting autonomousLoading to false"),M(!1),setTimeout(()=>{console.log("Stopping AI Mode: clearing local AI mode state"),W(null)},1e3)}catch(B){console.error("Error stopping autonomous conversation:",B),ie.error("Failed to stop autonomous conversation"),M(!1)}}},D=B=>{var me;const ee=(me=B.target.files)==null?void 0:me[0];if(ee){if(!ee.type.startsWith("image/")){ie.error("Please select an image file",{description:"Only image files (JPG, PNG, etc.) are supported for creative review."});return}if(ee.size>10*1024*1024){ie.error("File too large",{description:"Please select an image smaller than 10MB."});return}w(ee),ie.success(`Image selected: ${ee.name}`,{description:"The image will be attached to your next message."})}},H=()=>{w(null),S.current&&(S.current.value="")},Q=async(B,ee)=>{var me;if(!(!i||B.length===0))try{b(!0),j(!0),P.current=Date.now(),ie.info("Generating responses from mentioned participants...",{description:`Generating responses from ${B.length} mentioned participant(s).`});for(const Ce of B){const Me=n.find(we=>(we._id||we.id)===Ce);if(!Me){console.warn(`Mentioned participant ${Ce} not found in focus group`);continue}try{const we=await Hn.generateResponse(i,Ce,ee||"Continue the conversation based on the latest moderator message.");if((me=we==null?void 0:we.data)!=null&&me.response){console.log("Generated response from mentioned participant:",we.data);const We={id:we.data.message_id||`msg-${Date.now()}-${Ce}`,senderId:Ce,text:we.data.response,timestamp:new Date,type:"response"};u(We),ie.success(`Response generated from ${Me.name}`,{description:we.data.response.substring(0,100)+"..."})}}catch(we){console.error(`Error generating response from ${Me.name}:`,we),ie.error(`Failed to generate response from ${Me.name}`)}}}catch(Ce){console.error("Error generating mentioned responses:",Ce),ie.error("Failed to generate responses from mentioned participants"),b(!1),j(!1),P.current=null}},J=async()=>{var B,ee,me,Ce;if(i){if(n.length===0){ie.error("No participants available",{description:"Add participants to the focus group before generating responses."});return}try{b(!0),j(!0),P.current=Date.now(),ie.info("AI is selecting participant...",{description:"Analyzing the conversation to choose the best respondent."});const Me=await Hn.makeConversationDecision(i,.7,"manual");if(!Me||!Me.data||!Me.data.decision)throw new Error("Empty decision response from AI");const we=Me.data.decision;if(we.action==="participant_respond"){const We=we.details.participant_id,wt=we.details.topic_context,Nt=we.reasoning,Je=n.find($t=>($t._id||$t.id)===We);if(!Je)throw new Error(`Selected participant ${We} not found in focus group`);ie.info("Generating response...",{description:`AI selected ${Je.name}: ${Nt.substring(0,100)}${Nt.length>100?"...":""}`});const Xe=await Hn.generateResponse(i,We,wt);if(!Xe||!Xe.data)throw new Error("Empty response from API");if((B=Xe==null?void 0:Xe.data)!=null&&B.message_id&&((ee=Xe==null?void 0:Xe.data)!=null&&ee.response)){const $t={id:Xe.data.message_id,senderId:We,text:Xe.data.response,timestamp:new Date,type:"response",highlighted:!1};u($t),setTimeout(()=>{ne()},100)}else throw new Error("Failed to generate or save AI response")}else{if(console.log("AI suggested different action:",we.action),we.action==="moderator_speak"){ie.info("AI suggests moderator intervention",{description:`AI reasoning: ${we.reasoning.substring(0,100)}${we.reasoning.length>100?"...":""}`});return}ie.warning("Using fallback participant selection",{description:`AI suggested "${we.action}" but generating participant response anyway.`});const We=(C+1)%n.length,wt=n[We],Nt=Fe(),Je=wt._id||wt.id,Xe=await Hn.generateResponse(i,Je,Nt);if((me=Xe==null?void 0:Xe.data)!=null&&me.message_id&&((Ce=Xe==null?void 0:Xe.data)!=null&&Ce.response)){const $t={id:Xe.data.message_id,senderId:Je,text:Xe.data.response,timestamp:new Date,type:"response",highlighted:!1};u($t),setTimeout(()=>{ne()},100),A(We)}}}catch(Me){console.error("Error generating AI response:",Me),ie.error("Failed to generate AI response",{description:"There was a problem connecting to the server."}),b(!1),j(!1),P.current=null}}};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(k0,{className:"h-full pr-4",children:[a.jsxs("div",{className:"space-y-4",children:[Ne().map(B=>B.type==="message"?a.jsx(hue,{message:B.data,persona:B.data.senderId!=="moderator"&&B.data.senderId!=="facilitator"?pe(B.data.senderId):null,toggleHighlight:()=>l(B.data.id),participants:n,focusGroupId:i},B.data.id):a.jsx(bue,{modeEvent:B.data},B.data.id)),(v||o)&&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:o?a.jsx(ea,{className:"h-4 w-4 text-primary animate-spin"}):a.jsx(us,{className:"h-4 w-4 text-primary"})}),a.jsx("span",{children:o?"AI is generating next response...":"Generating AI response..."})]}),a.jsx("div",{className:"h-8"}),a.jsx("div",{ref:E,className:"h-1"})]}),!R&&Se.length>6&&a.jsx("div",{className:"sticky bottom-5 ml-auto mr-5 z-10 w-fit",children:a.jsx(te,{size:"sm",className:"rounded-full shadow-md h-10 w-10 p-0",onClick:ne,title:"Scroll to bottom",children:a.jsx(tO,{className:"h-4 w-4"})})})]})}),a.jsx(xue,{reasoningHistory:re,isVisible:oe,onToggle:()=>fe(!F),isAiMode:o}),a.jsxs("div",{className:"pt-4 border-t border-slate-200 w-full",children:[x&&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(sO,{className:"h-4 w-4 text-blue-600"}),a.jsx("span",{className:"text-sm text-blue-700",children:x.name}),a.jsxs("span",{className:"text-xs text-blue-500",children:["(",(x.size/1024/1024).toFixed(1)," MB)"]})]}),a.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:H,className:"h-6 w-6 p-0 text-blue-600 hover:text-blue-800",children:"×"})]}),a.jsxs("form",{onSubmit:nt,className:"flex items-center gap-2 w-full",children:[a.jsx("input",{ref:S,type:"file",accept:"image/*",onChange:D,className:"hidden"}),a.jsx(wz,{value:h,onChange:(B,ee)=>{p(B),m(ee||null)},participants:n,placeholder:"Ask a question or provide guidance...",className:"flex-1 min-w-0",disabled:!1}),a.jsx(te,{type:"button",variant:"outline",size:"sm",onClick:()=>{var B;return(B=S.current)==null?void 0:B.click()},className:"hover-transition shrink-0 px-3",disabled:!1,title:"Attach image for creative review",children:a.jsx(sO,{className:"h-4 w-4"})}),a.jsxs(te,{type:"submit",variant:"default",className:"hover-transition shrink-0",disabled:!1,children:[a.jsx(Ps,{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...":o?"AI mode active":"Manual moderation mode"}),a.jsx(te,{variant:"outline",size:"sm",onClick:X?N:Bt,disabled:z,className:`hover-transition ${X?"bg-red-50 text-red-600 hover:bg-red-100":"bg-blue-50 text-blue-600 hover:bg-blue-100"}`,title:X?"Stop AI mode and return to manual":"Start autonomous AI conversation",children:z?a.jsxs(a.Fragment,{children:[a.jsx(ea,{className:"mr-1 h-3 w-3 animate-spin"}),o?"Stopping...":"Starting..."]}):X?a.jsxs(a.Fragment,{children:[a.jsx(ea,{className:"mr-1 h-3 w-3"}),"Stop AI Mode"]}):a.jsxs(a.Fragment,{children:[a.jsx(ea,{className:"mr-1 h-3 w-3"}),"Start AI Mode"]})}),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>{L(!R),R||ne()},className:`hover-transition ${R?"bg-blue-50 text-blue-600 hover:bg-blue-100":""}`,title:R?"Disable auto-scroll":"Enable auto-scroll",children:[a.jsx(tO,{className:"h-3 w-3 mr-1"}),"Auto-scroll"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!o&&a.jsxs(a.Fragment,{children:[a.jsxs(te,{variant:"outline",onClick:mt,className:`hover-transition ${n.length===0?"bg-red-50":""}`,disabled:v,title:n.length===0?"Add participants to the focus group first":"Advance to the next part of the discussion guide",children:[a.jsx(Ps,{className:"mr-2 h-4 w-4"}),n.length===0?"No Participants":"Advance Discussion"]}),a.jsxs(te,{variant:"ghost",size:"sm",onClick:J,className:`hover-transition ${n.length===0?"bg-red-50":""}`,disabled:v||n.length===0,title:"Generate a participant response to the current topic",children:[a.jsx(us,{className:"mr-1 h-3 w-3"}),"Get Response"]})]}),o&&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(te,{variant:"outline",size:"sm",onClick:()=>$(!V),className:"hover-transition",title:"Show autonomous conversation controls",children:a.jsx(Qj,{className:"h-3 w-3"})})]})]})]})]})]})},Sue=({themes:t,messages:e,personas:n=[],onThemeDelete:r,onQuoteClick:i})=>{const o=(d,f)=>{d.stopPropagation(),r&&(r(f),ie.success("Theme deleted successfully"))},s=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=t.filter(d=>"source"in d?d.source==="highlight":!0),u=t.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(Vc,{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(Bc,{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(ct,{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=>o(f,d.id),children:a.jsx($o,{className:"h-3 w-3 text-slate-700"})}),a.jsx(pi,{className:"pb-2",children:a.jsx(Mi,{className:"text-base",children:d.title})}),a.jsxs(jt,{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,v=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:x=>{x.stopPropagation(),i&&i(p?f:b,v)},title:v?`Message ID: ${v}`:"Click to find original message",children:[m&&a.jsxs("span",{className:"font-semibold text-slate-700 mr-1",children:[m,":"]}),'"',g,'"',v&&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(BX,{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?e.find(v=>v.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 v=s(g);m=(v==null?void 0:v.name)||"Unknown Participant"}return a.jsxs(ct,{className:"hover:shadow-md hover:bg-slate-50 transition-all cursor-pointer relative group",onClick:v=>{v.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:v=>o(v,d.id),children:a.jsx($o,{className:"h-3 w-3 text-slate-700"})}),a.jsx(pi,{className:"pb-2",children:a.jsx(Mi,{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(jt,{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(us,{className:"h-3 w-3 mr-1"}),"Click to view in discussion"]})]})]},d.id)})})]}),t.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(Vc,{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."})]})]})]})},Cue=({themes:t,messages:e,personas:n,focusGroupId:r,onThemesGenerated:i,onThemeDelete:o,onQuoteClick:s,onGenerateKeyThemes:l})=>{const c=()=>{if(!t||t.length===0){ie.warning("No themes to export",{description:"Generate some themes first before exporting."});return}let u=`# Key Themes Analysis -`;const d=t.filter(g=>"source"in g&&g.source==="generated");if(d.length===0){se.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} +`;const d=t.filter(g=>"source"in g&&g.source==="generated");if(d.length===0){ie.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} @@ -653,7 +632,7 @@ ${O.researchBrief} `}})),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),se.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(te,{onClick:l,className:"w-full",children:[a.jsx(JX,{className:"mr-2 h-4 w-4"}),"Analyze Discussion for Key Themes"]}),a.jsxs(te,{onClick:c,disabled:!t||t.length===0,variant:"outline",className:"w-full",children:[a.jsx(zc,{className:"mr-2 h-4 w-4"}),"Export Themes"]})]}),a.jsx("div",{className:"flex-grow overflow-hidden",children:a.jsx(Cue,{themes:t,messages:e,personas:n,onThemeDelete:o,focusGroupId:r,onQuoteClick:s})})]})};var _ue=Array.isArray,Ni=_ue,jue=typeof vg=="object"&&vg&&vg.Object===Object&&vg,Cz=jue,Eue=Cz,Nue=typeof self=="object"&&self&&self.Object===Object&&self,Tue=Eue||Nue||Function("return this")(),Ds=Tue,Pue=Ds,kue=Pue.Symbol,sg=kue,MI=sg,Az=Object.prototype,Oue=Az.hasOwnProperty,Iue=Az.toString,ah=MI?MI.toStringTag:void 0;function Rue(t){var e=Oue.call(t,ah),n=t[ah];try{t[ah]=void 0;var r=!0}catch{}var i=Iue.call(t);return r&&(e?t[ah]=n:delete t[ah]),i}var Mue=Rue,Due=Object.prototype,$ue=Due.toString;function Lue(t){return $ue.call(t)}var Fue=Lue,DI=sg,Uue=Mue,Bue=Fue,Hue="[object Null]",zue="[object Undefined]",$I=DI?DI.toStringTag:void 0;function Vue(t){return t==null?t===void 0?zue:Hue:$I&&$I in Object(t)?Uue(t):Bue(t)}var Ta=Vue;function Gue(t){return t!=null&&typeof t=="object"}var Pa=Gue,Kue=Ta,Wue=Pa,que="[object Symbol]";function Yue(t){return typeof t=="symbol"||Wue(t)&&Kue(t)==que}var Nf=Yue,Que=Ni,Xue=Nf,Zue=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Jue=/^\w*$/;function ede(t,e){if(Que(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Xue(t)?!0:Jue.test(t)||!Zue.test(t)||e!=null&&t in Object(e)}var lT=ede;function tde(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Wl=tde;const Tf=en(Wl);var nde=Ta,rde=Wl,ide="[object AsyncFunction]",ode="[object Function]",sde="[object GeneratorFunction]",ade="[object Proxy]";function lde(t){if(!rde(t))return!1;var e=nde(t);return e==ode||e==sde||e==ide||e==ade}var cT=lde;const xt=en(cT);var cde=Ds,ude=cde["__core-js_shared__"],dde=ude,AS=dde,LI=function(){var t=/[^.]+$/.exec(AS&&AS.keys&&AS.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function fde(t){return!!LI&&LI in t}var hde=fde,pde=Function.prototype,mde=pde.toString;function gde(t){if(t!=null){try{return mde.call(t)}catch{}try{return t+""}catch{}}return""}var _z=gde,vde=cT,yde=hde,xde=Wl,bde=_z,wde=/[\\^$.*+?()[\]{}|]/g,Sde=/^\[object .+?Constructor\]$/,Cde=Function.prototype,Ade=Object.prototype,_de=Cde.toString,jde=Ade.hasOwnProperty,Ede=RegExp("^"+_de.call(jde).replace(wde,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Nde(t){if(!xde(t)||yde(t))return!1;var e=vde(t)?Ede:Sde;return e.test(bde(t))}var Tde=Nde;function Pde(t,e){return t==null?void 0:t[e]}var kde=Pde,Ode=Tde,Ide=kde;function Rde(t,e){var n=Ide(t,e);return Ode(n)?n:void 0}var hu=Rde,Mde=hu,Dde=Mde(Object,"create"),I0=Dde,FI=I0;function $de(){this.__data__=FI?FI(null):{},this.size=0}var Lde=$de;function Fde(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Ude=Fde,Bde=I0,Hde="__lodash_hash_undefined__",zde=Object.prototype,Vde=zde.hasOwnProperty;function Gde(t){var e=this.__data__;if(Bde){var n=e[t];return n===Hde?void 0:n}return Vde.call(e,t)?e[t]:void 0}var Kde=Gde,Wde=I0,qde=Object.prototype,Yde=qde.hasOwnProperty;function Qde(t){var e=this.__data__;return Wde?e[t]!==void 0:Yde.call(e,t)}var Xde=Qde,Zde=I0,Jde="__lodash_hash_undefined__";function efe(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Zde&&e===void 0?Jde:e,this}var tfe=efe,nfe=Lde,rfe=Ude,ife=Kde,ofe=Xde,sfe=tfe;function Pf(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1}var Cfe=Sfe,Afe=R0;function _fe(t,e){var n=this.__data__,r=Afe(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var jfe=_fe,Efe=cfe,Nfe=vfe,Tfe=bfe,Pfe=Cfe,kfe=jfe;function kf(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1}var Sfe=wfe,Cfe=I0;function Afe(t,e){var n=this.__data__,r=Cfe(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var _fe=Afe,jfe=lfe,Efe=gfe,Nfe=xfe,Tfe=Sfe,Pfe=_fe;function kf(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e0?1:-1},yc=function(e){return ag(e)&&e.indexOf("%")===e.length-1},Ne=function(e){return Zhe(e)&&!If(e)},mr=function(e){return Ne(e)||ag(e)},npe=0,Rf=function(e){var n=++npe;return"".concat(e||"").concat(n)},oi=function(e,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(!Ne(e)&&!ag(e))return r;var o;if(yc(e)){var s=e.indexOf("%");o=n*parseFloat(e.slice(0,s))/100}else o=+e;return If(o)&&(o=r),i&&o>n&&(o=n),o},qa=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},rpe=function(e){if(!Array.isArray(e))return!1;for(var n=e.length,r={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function cpe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function tA(t){"@babel/helpers - typeof";return tA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tA(t)}var KI={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"},la=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},WI=null,jS=null,xT=function t(e){if(e===WI&&Array.isArray(jS))return jS;var n=[];return y.Children.forEach(e,function(r){Pt(r)||(Rz.isFragment(r)?n=n.concat(t(r.props.children)):n.push(r))}),jS=n,WI=e,n};function fo(t,e){var n=[],r=[];return Array.isArray(e)?r=e.map(function(i){return la(i)}):r=[la(e)],xT(t).forEach(function(i){var o=zi(i,"type.displayName")||zi(i,"type.name");r.indexOf(o)!==-1&&n.push(i)}),n}function Ri(t,e){var n=fo(t,e);return n&&n[0]}var qI=function(e){if(!e||!e.props)return!1;var n=e.props,r=n.width,i=n.height;return!(!Ne(r)||r<=0||!Ne(i)||i<=0)},upe=["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"],dpe=function(e){return e&&e.type&&ag(e.type)&&upe.indexOf(e.type)>=0},fpe=function(e){return e&&tA(e)==="object"&&"clipDot"in e},hpe=function(e,n,r,i){var o,s=(o=_S==null?void 0:_S[i])!==null&&o!==void 0?o:[];return!xt(e)&&(i&&s.includes(n)||ope.includes(n))||r&&yT.includes(n)},Je=function(e,n,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var i=e;if(y.isValidElement(e)&&(i=e.props),!Tf(i))return null;var o={};return Object.keys(i).forEach(function(s){var l;hpe((l=i)===null||l===void 0?void 0:l[s],s,n,r)&&(o[s]=i[s])}),o},nA=function t(e,n){if(e===n)return!0;var r=y.Children.count(e);if(r!==y.Children.count(n))return!1;if(r===0)return!0;if(r===1)return YI(Array.isArray(e)?e[0]:e,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function ype(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function iA(t){var e=t.children,n=t.width,r=t.height,i=t.viewBox,o=t.className,s=t.style,l=t.title,c=t.desc,u=vpe(t,gpe),d=i||{width:n,height:r,x:0,y:0},f=Nt("recharts-surface",o);return T.createElement("svg",rA({},Je(u,!0,"svg"),{className:f,width:n,height:r,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),T.createElement("title",null,l),T.createElement("desc",null,c),e)}var xpe=["children","className"];function oA(){return oA=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function wpe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var Ht=T.forwardRef(function(t,e){var n=t.children,r=t.className,i=bpe(t,xpe),o=Nt("recharts-layer",r);return T.createElement("g",oA({className:o},Je(i,!0),{ref:e}),n)}),Uo=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;oi?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r=r?t:Ape(t,e,n)}var jpe=_pe,Epe="\\ud800-\\udfff",Npe="\\u0300-\\u036f",Tpe="\\ufe20-\\ufe2f",Ppe="\\u20d0-\\u20ff",kpe=Npe+Tpe+Ppe,Ope="\\ufe0e\\ufe0f",Ipe="\\u200d",Rpe=RegExp("["+Ipe+Epe+kpe+Ope+"]");function Mpe(t){return Rpe.test(t)}var Dz=Mpe;function Dpe(t){return t.split("")}var $pe=Dpe,$z="\\ud800-\\udfff",Lpe="\\u0300-\\u036f",Fpe="\\ufe20-\\ufe2f",Upe="\\u20d0-\\u20ff",Bpe=Lpe+Fpe+Upe,Hpe="\\ufe0e\\ufe0f",zpe="["+$z+"]",sA="["+Bpe+"]",aA="\\ud83c[\\udffb-\\udfff]",Vpe="(?:"+sA+"|"+aA+")",Lz="[^"+$z+"]",Fz="(?:\\ud83c[\\udde6-\\uddff]){2}",Uz="[\\ud800-\\udbff][\\udc00-\\udfff]",Gpe="\\u200d",Bz=Vpe+"?",Hz="["+Hpe+"]?",Kpe="(?:"+Gpe+"(?:"+[Lz,Fz,Uz].join("|")+")"+Hz+Bz+")*",Wpe=Hz+Bz+Kpe,qpe="(?:"+[Lz+sA+"?",sA,Fz,Uz,zpe].join("|")+")",Ype=RegExp(aA+"(?="+aA+")|"+qpe+Wpe,"g");function Qpe(t){return t.match(Ype)||[]}var Xpe=Qpe,Zpe=$pe,Jpe=Dz,eme=Xpe;function tme(t){return Jpe(t)?eme(t):Zpe(t)}var nme=tme,rme=jpe,ime=Dz,ome=nme,sme=Tz;function ame(t){return function(e){e=sme(e);var n=ime(e)?ome(e):void 0,r=n?n[0]:e.charAt(0),i=n?rme(n,1).join(""):e.slice(1);return r[t]()+i}}var lme=ame,cme=lme,ume=cme("toUpperCase"),dme=ume;const q0=en(dme);function bn(t){return function(){return t}}const zz=Math.cos,mx=Math.sin,es=Math.sqrt,gx=Math.PI,Y0=2*gx,lA=Math.PI,cA=2*lA,oc=1e-6,fme=cA-oc;function Vz(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Vz;const n=10**e;return function(r){this._+=r[0];for(let i=1,o=r.length;ioc)if(!(Math.abs(f*c-u*d)>oc)||!o)this._append`L${this._x1=e},${this._y1=n}`;else{let p=r-s,g=i-l,m=c*c+u*u,v=p*p+g*g,b=Math.sqrt(m),x=Math.sqrt(h),w=o*Math.tan((lA-Math.acos((m+h-v)/(2*b*x)))/2),S=w/x,C=w/b;Math.abs(S-1)>oc&&this._append`L${e+S*d},${n+S*f}`,this._append`A${o},${o},0,0,${+(f*p>d*g)},${this._x1=e+C*c},${this._y1=n+C*u}`}}arc(e,n,r,i,o,s){if(e=+e,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(i),c=r*Math.sin(i),u=e+l,d=n+c,f=1^s,h=s?i-o:o-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>oc||Math.abs(this._y1-d)>oc)&&this._append`L${u},${d}`,r&&(h<0&&(h=h%cA+cA),h>fme?this._append`A${r},${r},0,1,${f},${e-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:h>oc&&this._append`A${r},${r},0,${+(h>=lA)},${f},${this._x1=e+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function bT(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new pme(e)}function wT(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Gz(t){this._context=t}Gz.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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Q0(t){return new Gz(t)}function Kz(t){return t[0]}function Wz(t){return t[1]}function qz(t,e){var n=bn(!0),r=null,i=Q0,o=null,s=bT(l);t=typeof t=="function"?t:t===void 0?Kz:bn(t),e=typeof e=="function"?e:e===void 0?Wz:bn(e);function l(c){var u,d=(c=wT(c)).length,f,h=!1,p;for(r==null&&(o=i(p=s())),u=0;u<=d;++u)!(u=p;--g)l.point(w[g],S[g]);l.lineEnd(),l.areaEnd()}b&&(w[h]=+t(v,h,f),S[h]=+e(v,h,f),l.point(r?+r(v,h,f):w[h],n?+n(v,h,f):S[h]))}if(x)return l=null,x+""||null}function d(){return qz().defined(i).curve(s).context(o)}return u.x=function(f){return arguments.length?(t=typeof f=="function"?f:bn(+f),r=null,u):t},u.x0=function(f){return arguments.length?(t=typeof f=="function"?f:bn(+f),u):t},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:bn(+f),u):r},u.y=function(f){return arguments.length?(e=typeof f=="function"?f:bn(+f),n=null,u):e},u.y0=function(f){return arguments.length?(e=typeof f=="function"?f:bn(+f),u):e},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:bn(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(t).y(e)},u.lineY1=function(){return d().x(t).y(n)},u.lineX1=function(){return d().x(r).y(e)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:bn(!!f),u):i},u.curve=function(f){return arguments.length?(s=f,o!=null&&(l=s(o)),u):s},u.context=function(f){return arguments.length?(f==null?o=l=null:l=s(o=f),u):o},u}class Yz{constructor(e,n){this._context=e,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(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function mme(t){return new Yz(t,!0)}function gme(t){return new Yz(t,!1)}const ST={draw(t,e){const n=es(e/gx);t.moveTo(n,0),t.arc(0,0,n,0,Y0)}},vme={draw(t,e){const n=es(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},Qz=es(1/3),yme=Qz*2,xme={draw(t,e){const n=es(e/yme),r=n*Qz;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},bme={draw(t,e){const n=es(e),r=-n/2;t.rect(r,r,n,n)}},wme=.8908130915292852,Xz=mx(gx/10)/mx(7*gx/10),Sme=mx(Y0/10)*Xz,Cme=-zz(Y0/10)*Xz,Ame={draw(t,e){const n=es(e*wme),r=Sme*n,i=Cme*n;t.moveTo(0,-n),t.lineTo(r,i);for(let o=1;o<5;++o){const s=Y0*o/5,l=zz(s),c=mx(s);t.lineTo(c*n,-l*n),t.lineTo(l*r-c*i,c*r+l*i)}t.closePath()}},ES=es(3),_me={draw(t,e){const n=-es(e/(ES*3));t.moveTo(0,n*2),t.lineTo(-ES*n,-n),t.lineTo(ES*n,-n),t.closePath()}},qi=-.5,Yi=es(3)/2,uA=1/es(12),jme=(uA/2+1)*3,Eme={draw(t,e){const n=es(e/jme),r=n/2,i=n*uA,o=r,s=n*uA+n,l=-o,c=s;t.moveTo(r,i),t.lineTo(o,s),t.lineTo(l,c),t.lineTo(qi*r-Yi*i,Yi*r+qi*i),t.lineTo(qi*o-Yi*s,Yi*o+qi*s),t.lineTo(qi*l-Yi*c,Yi*l+qi*c),t.lineTo(qi*r+Yi*i,qi*i-Yi*r),t.lineTo(qi*o+Yi*s,qi*s-Yi*o),t.lineTo(qi*l+Yi*c,qi*c-Yi*l),t.closePath()}};function Nme(t,e){let n=null,r=bT(i);t=typeof t=="function"?t:bn(t||ST),e=typeof e=="function"?e:bn(e===void 0?64:+e);function i(){let o;if(n||(n=o=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),o)return n=null,o+""||null}return i.type=function(o){return arguments.length?(t=typeof o=="function"?o:bn(o),i):t},i.size=function(o){return arguments.length?(e=typeof o=="function"?o:bn(+o),i):e},i.context=function(o){return arguments.length?(n=o??null,i):n},i}function vx(){}function yx(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function Zz(t){this._context=t}Zz.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:yx(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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);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:yx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Tme(t){return new Zz(t)}function Jz(t){this._context=t}Jz.prototype={areaStart:vx,areaEnd:vx,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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:yx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Pme(t){return new Jz(t)}function eV(t){this._context=t}eV.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(t,e){switch(t=+t,e=+e,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+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:yx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function kme(t){return new eV(t)}function tV(t){this._context=t}tV.prototype={areaStart:vx,areaEnd:vx,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function Ome(t){return new tV(t)}function XI(t){return t<0?-1:1}function ZI(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),s=(n-t._y1)/(i||r<0&&-0),l=(o*i+s*r)/(r+i);return(XI(o)+XI(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(l))||0}function JI(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function NS(t,e,n){var r=t._x0,i=t._y0,o=t._x1,s=t._y1,l=(o-r)/3;t._context.bezierCurveTo(r+l,i+l*e,o-l,s-l*n,o,s)}function xx(t){this._context=t}xx.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:NS(this,this._t0,JI(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,NS(this,JI(this,n=ZI(this,t,e)),n);break;default:NS(this,this._t0,n=ZI(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function nV(t){this._context=new rV(t)}(nV.prototype=Object.create(xx.prototype)).point=function(t,e){xx.prototype.point.call(this,e,t)};function rV(t){this._context=t}rV.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,o){this._context.bezierCurveTo(e,t,r,n,o,i)}};function Ime(t){return new xx(t)}function Rme(t){return new nV(t)}function iV(t){this._context=t}iV.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=eR(t),i=eR(e),o=0,s=1;s=0;--e)i[e]=(s[e]-i[e+1])/o[e];for(o[n-1]=(t[n]+i[n-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function Dme(t){return new X0(t,.5)}function $me(t){return new X0(t,0)}function Lme(t){return new X0(t,1)}function Dd(t,e){if((s=t.length)>1)for(var n=1,r,i,o=t[e[0]],s,l=o.length;n=0;)n[e]=e;return n}function Fme(t,e){return t[e]}function Ume(t){const e=[];return e.key=t,e}function Bme(){var t=bn([]),e=dA,n=Dd,r=Fme;function i(o){var s=Array.from(t.apply(this,arguments),Ume),l,c=s.length,u=-1,d;for(const f of o)for(l=0,++u;l0){for(var n,r,i=0,o=t[0].length,s;i0){for(var n=0,r=t[e[0]],i,o=r.length;n0)||!((o=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,o,s;r=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Qme(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var oV={symbolCircle:ST,symbolCross:vme,symbolDiamond:xme,symbolSquare:bme,symbolStar:Ame,symbolTriangle:_me,symbolWye:Eme},Xme=Math.PI/180,Zme=function(e){var n="symbol".concat(q0(e));return oV[n]||ST},Jme=function(e,n,r){if(n==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var i=18*Xme;return 1.25*e*e*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},ege=function(e,n){oV["symbol".concat(q0(e))]=n},CT=function(e){var n=e.type,r=n===void 0?"circle":n,i=e.size,o=i===void 0?64:i,s=e.sizeType,l=s===void 0?"area":s,c=Yme(e,Gme),u=nR(nR({},c),{},{type:r,size:o,sizeType:l}),d=function(){var v=Zme(r),b=Nme().type(v).size(Jme(o,l,r));return b()},f=u.className,h=u.cx,p=u.cy,g=Je(u,!0);return h===+h&&p===+p&&o===+o?T.createElement("path",fA({},g,{className:Nt("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};CT.registerSymbol=ege;function $d(t){"@babel/helpers - typeof";return $d=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$d(t)}function hA(){return hA=Object.assign?Object.assign.bind():function(t){for(var e=1;e0?1:-1},yc=function(e){return sg(e)&&e.indexOf("%")===e.length-1},Ee=function(e){return Xhe(e)&&!If(e)},mr=function(e){return Ee(e)||sg(e)},tpe=0,Rf=function(e){var n=++tpe;return"".concat(e||"").concat(n)},oi=function(e,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(!Ee(e)&&!sg(e))return r;var o;if(yc(e)){var s=e.indexOf("%");o=n*parseFloat(e.slice(0,s))/100}else o=+e;return If(o)&&(o=r),i&&o>n&&(o=n),o},qa=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},npe=function(e){if(!Array.isArray(e))return!1;for(var n=e.length,r={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function lpe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function eA(t){"@babel/helpers - typeof";return eA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},eA(t)}var GI={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"},la=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},KI=null,_S=null,yT=function t(e){if(e===KI&&Array.isArray(_S))return _S;var n=[];return y.Children.forEach(e,function(r){Pt(r)||(Iz.isFragment(r)?n=n.concat(t(r.props.children)):n.push(r))}),_S=n,KI=e,n};function fo(t,e){var n=[],r=[];return Array.isArray(e)?r=e.map(function(i){return la(i)}):r=[la(e)],yT(t).forEach(function(i){var o=zi(i,"type.displayName")||zi(i,"type.name");r.indexOf(o)!==-1&&n.push(i)}),n}function Ri(t,e){var n=fo(t,e);return n&&n[0]}var WI=function(e){if(!e||!e.props)return!1;var n=e.props,r=n.width,i=n.height;return!(!Ee(r)||r<=0||!Ee(i)||i<=0)},cpe=["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"],upe=function(e){return e&&e.type&&sg(e.type)&&cpe.indexOf(e.type)>=0},dpe=function(e){return e&&eA(e)==="object"&&"clipDot"in e},fpe=function(e,n,r,i){var o,s=(o=AS==null?void 0:AS[i])!==null&&o!==void 0?o:[];return!xt(e)&&(i&&s.includes(n)||ipe.includes(n))||r&&vT.includes(n)},Ze=function(e,n,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var i=e;if(y.isValidElement(e)&&(i=e.props),!Tf(i))return null;var o={};return Object.keys(i).forEach(function(s){var l;fpe((l=i)===null||l===void 0?void 0:l[s],s,n,r)&&(o[s]=i[s])}),o},tA=function t(e,n){if(e===n)return!0;var r=y.Children.count(e);if(r!==y.Children.count(n))return!1;if(r===0)return!0;if(r===1)return qI(Array.isArray(e)?e[0]:e,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function vpe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function rA(t){var e=t.children,n=t.width,r=t.height,i=t.viewBox,o=t.className,s=t.style,l=t.title,c=t.desc,u=gpe(t,mpe),d=i||{width:n,height:r,x:0,y:0},f=Et("recharts-surface",o);return T.createElement("svg",nA({},Ze(u,!0,"svg"),{className:f,width:n,height:r,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),T.createElement("title",null,l),T.createElement("desc",null,c),e)}var ype=["children","className"];function iA(){return iA=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function bpe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var Ht=T.forwardRef(function(t,e){var n=t.children,r=t.className,i=xpe(t,ype),o=Et("recharts-layer",r);return T.createElement("g",iA({className:o},Ze(i,!0),{ref:e}),n)}),Uo=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;oi?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r=r?t:Cpe(t,e,n)}var _pe=Ape,jpe="\\ud800-\\udfff",Epe="\\u0300-\\u036f",Npe="\\ufe20-\\ufe2f",Tpe="\\u20d0-\\u20ff",Ppe=Epe+Npe+Tpe,kpe="\\ufe0e\\ufe0f",Ope="\\u200d",Ipe=RegExp("["+Ope+jpe+Ppe+kpe+"]");function Rpe(t){return Ipe.test(t)}var Mz=Rpe;function Mpe(t){return t.split("")}var Dpe=Mpe,Dz="\\ud800-\\udfff",$pe="\\u0300-\\u036f",Lpe="\\ufe20-\\ufe2f",Fpe="\\u20d0-\\u20ff",Upe=$pe+Lpe+Fpe,Bpe="\\ufe0e\\ufe0f",Hpe="["+Dz+"]",oA="["+Upe+"]",sA="\\ud83c[\\udffb-\\udfff]",zpe="(?:"+oA+"|"+sA+")",$z="[^"+Dz+"]",Lz="(?:\\ud83c[\\udde6-\\uddff]){2}",Fz="[\\ud800-\\udbff][\\udc00-\\udfff]",Vpe="\\u200d",Uz=zpe+"?",Bz="["+Bpe+"]?",Gpe="(?:"+Vpe+"(?:"+[$z,Lz,Fz].join("|")+")"+Bz+Uz+")*",Kpe=Bz+Uz+Gpe,Wpe="(?:"+[$z+oA+"?",oA,Lz,Fz,Hpe].join("|")+")",qpe=RegExp(sA+"(?="+sA+")|"+Wpe+Kpe,"g");function Ype(t){return t.match(qpe)||[]}var Qpe=Ype,Xpe=Dpe,Jpe=Mz,Zpe=Qpe;function eme(t){return Jpe(t)?Zpe(t):Xpe(t)}var tme=eme,nme=_pe,rme=Mz,ime=tme,ome=Nz;function sme(t){return function(e){e=ome(e);var n=rme(e)?ime(e):void 0,r=n?n[0]:e.charAt(0),i=n?nme(n,1).join(""):e.slice(1);return r[t]()+i}}var ame=sme,lme=ame,cme=lme("toUpperCase"),ume=cme;const W0=en(ume);function bn(t){return function(){return t}}const Hz=Math.cos,px=Math.sin,es=Math.sqrt,mx=Math.PI,q0=2*mx,aA=Math.PI,lA=2*aA,oc=1e-6,dme=lA-oc;function zz(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return zz;const n=10**e;return function(r){this._+=r[0];for(let i=1,o=r.length;ioc)if(!(Math.abs(f*c-u*d)>oc)||!o)this._append`L${this._x1=e},${this._y1=n}`;else{let p=r-s,g=i-l,m=c*c+u*u,v=p*p+g*g,b=Math.sqrt(m),x=Math.sqrt(h),w=o*Math.tan((aA-Math.acos((m+h-v)/(2*b*x)))/2),S=w/x,C=w/b;Math.abs(S-1)>oc&&this._append`L${e+S*d},${n+S*f}`,this._append`A${o},${o},0,0,${+(f*p>d*g)},${this._x1=e+C*c},${this._y1=n+C*u}`}}arc(e,n,r,i,o,s){if(e=+e,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(i),c=r*Math.sin(i),u=e+l,d=n+c,f=1^s,h=s?i-o:o-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>oc||Math.abs(this._y1-d)>oc)&&this._append`L${u},${d}`,r&&(h<0&&(h=h%lA+lA),h>dme?this._append`A${r},${r},0,1,${f},${e-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:h>oc&&this._append`A${r},${r},0,${+(h>=aA)},${f},${this._x1=e+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function xT(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new hme(e)}function bT(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Vz(t){this._context=t}Vz.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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Y0(t){return new Vz(t)}function Gz(t){return t[0]}function Kz(t){return t[1]}function Wz(t,e){var n=bn(!0),r=null,i=Y0,o=null,s=xT(l);t=typeof t=="function"?t:t===void 0?Gz:bn(t),e=typeof e=="function"?e:e===void 0?Kz:bn(e);function l(c){var u,d=(c=bT(c)).length,f,h=!1,p;for(r==null&&(o=i(p=s())),u=0;u<=d;++u)!(u=p;--g)l.point(w[g],S[g]);l.lineEnd(),l.areaEnd()}b&&(w[h]=+t(v,h,f),S[h]=+e(v,h,f),l.point(r?+r(v,h,f):w[h],n?+n(v,h,f):S[h]))}if(x)return l=null,x+""||null}function d(){return Wz().defined(i).curve(s).context(o)}return u.x=function(f){return arguments.length?(t=typeof f=="function"?f:bn(+f),r=null,u):t},u.x0=function(f){return arguments.length?(t=typeof f=="function"?f:bn(+f),u):t},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:bn(+f),u):r},u.y=function(f){return arguments.length?(e=typeof f=="function"?f:bn(+f),n=null,u):e},u.y0=function(f){return arguments.length?(e=typeof f=="function"?f:bn(+f),u):e},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:bn(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(t).y(e)},u.lineY1=function(){return d().x(t).y(n)},u.lineX1=function(){return d().x(r).y(e)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:bn(!!f),u):i},u.curve=function(f){return arguments.length?(s=f,o!=null&&(l=s(o)),u):s},u.context=function(f){return arguments.length?(f==null?o=l=null:l=s(o=f),u):o},u}class qz{constructor(e,n){this._context=e,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(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function pme(t){return new qz(t,!0)}function mme(t){return new qz(t,!1)}const wT={draw(t,e){const n=es(e/mx);t.moveTo(n,0),t.arc(0,0,n,0,q0)}},gme={draw(t,e){const n=es(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},Yz=es(1/3),vme=Yz*2,yme={draw(t,e){const n=es(e/vme),r=n*Yz;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},xme={draw(t,e){const n=es(e),r=-n/2;t.rect(r,r,n,n)}},bme=.8908130915292852,Qz=px(mx/10)/px(7*mx/10),wme=px(q0/10)*Qz,Sme=-Hz(q0/10)*Qz,Cme={draw(t,e){const n=es(e*bme),r=wme*n,i=Sme*n;t.moveTo(0,-n),t.lineTo(r,i);for(let o=1;o<5;++o){const s=q0*o/5,l=Hz(s),c=px(s);t.lineTo(c*n,-l*n),t.lineTo(l*r-c*i,c*r+l*i)}t.closePath()}},jS=es(3),Ame={draw(t,e){const n=-es(e/(jS*3));t.moveTo(0,n*2),t.lineTo(-jS*n,-n),t.lineTo(jS*n,-n),t.closePath()}},qi=-.5,Yi=es(3)/2,cA=1/es(12),_me=(cA/2+1)*3,jme={draw(t,e){const n=es(e/_me),r=n/2,i=n*cA,o=r,s=n*cA+n,l=-o,c=s;t.moveTo(r,i),t.lineTo(o,s),t.lineTo(l,c),t.lineTo(qi*r-Yi*i,Yi*r+qi*i),t.lineTo(qi*o-Yi*s,Yi*o+qi*s),t.lineTo(qi*l-Yi*c,Yi*l+qi*c),t.lineTo(qi*r+Yi*i,qi*i-Yi*r),t.lineTo(qi*o+Yi*s,qi*s-Yi*o),t.lineTo(qi*l+Yi*c,qi*c-Yi*l),t.closePath()}};function Eme(t,e){let n=null,r=xT(i);t=typeof t=="function"?t:bn(t||wT),e=typeof e=="function"?e:bn(e===void 0?64:+e);function i(){let o;if(n||(n=o=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),o)return n=null,o+""||null}return i.type=function(o){return arguments.length?(t=typeof o=="function"?o:bn(o),i):t},i.size=function(o){return arguments.length?(e=typeof o=="function"?o:bn(+o),i):e},i.context=function(o){return arguments.length?(n=o??null,i):n},i}function gx(){}function vx(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function Xz(t){this._context=t}Xz.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:vx(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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);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:vx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Nme(t){return new Xz(t)}function Jz(t){this._context=t}Jz.prototype={areaStart:gx,areaEnd:gx,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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:vx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Tme(t){return new Jz(t)}function Zz(t){this._context=t}Zz.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(t,e){switch(t=+t,e=+e,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+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:vx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Pme(t){return new Zz(t)}function eV(t){this._context=t}eV.prototype={areaStart:gx,areaEnd:gx,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function kme(t){return new eV(t)}function QI(t){return t<0?-1:1}function XI(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),s=(n-t._y1)/(i||r<0&&-0),l=(o*i+s*r)/(r+i);return(QI(o)+QI(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(l))||0}function JI(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function ES(t,e,n){var r=t._x0,i=t._y0,o=t._x1,s=t._y1,l=(o-r)/3;t._context.bezierCurveTo(r+l,i+l*e,o-l,s-l*n,o,s)}function yx(t){this._context=t}yx.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:ES(this,this._t0,JI(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,ES(this,JI(this,n=XI(this,t,e)),n);break;default:ES(this,this._t0,n=XI(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function tV(t){this._context=new nV(t)}(tV.prototype=Object.create(yx.prototype)).point=function(t,e){yx.prototype.point.call(this,e,t)};function nV(t){this._context=t}nV.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,o){this._context.bezierCurveTo(e,t,r,n,o,i)}};function Ome(t){return new yx(t)}function Ime(t){return new tV(t)}function rV(t){this._context=t}rV.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=ZI(t),i=ZI(e),o=0,s=1;s=0;--e)i[e]=(s[e]-i[e+1])/o[e];for(o[n-1]=(t[n]+i[n-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function Mme(t){return new Q0(t,.5)}function Dme(t){return new Q0(t,0)}function $me(t){return new Q0(t,1)}function Dd(t,e){if((s=t.length)>1)for(var n=1,r,i,o=t[e[0]],s,l=o.length;n=0;)n[e]=e;return n}function Lme(t,e){return t[e]}function Fme(t){const e=[];return e.key=t,e}function Ume(){var t=bn([]),e=uA,n=Dd,r=Lme;function i(o){var s=Array.from(t.apply(this,arguments),Fme),l,c=s.length,u=-1,d;for(const f of o)for(l=0,++u;l0){for(var n,r,i=0,o=t[0].length,s;i0){for(var n=0,r=t[e[0]],i,o=r.length;n0)||!((o=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,o,s;r=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Yme(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var iV={symbolCircle:wT,symbolCross:gme,symbolDiamond:yme,symbolSquare:xme,symbolStar:Cme,symbolTriangle:Ame,symbolWye:jme},Qme=Math.PI/180,Xme=function(e){var n="symbol".concat(W0(e));return iV[n]||wT},Jme=function(e,n,r){if(n==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var i=18*Qme;return 1.25*e*e*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},Zme=function(e,n){iV["symbol".concat(W0(e))]=n},ST=function(e){var n=e.type,r=n===void 0?"circle":n,i=e.size,o=i===void 0?64:i,s=e.sizeType,l=s===void 0?"area":s,c=qme(e,Vme),u=tR(tR({},c),{},{type:r,size:o,sizeType:l}),d=function(){var v=Xme(r),b=Eme().type(v).size(Jme(o,l,r));return b()},f=u.className,h=u.cx,p=u.cy,g=Ze(u,!0);return h===+h&&p===+p&&o===+o?T.createElement("path",dA({},g,{className:Et("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};ST.registerSymbol=Zme;function $d(t){"@babel/helpers - typeof";return $d=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$d(t)}function fA(){return fA=Object.assign?Object.assign.bind():function(t){for(var e=1;e`);var x=p.inactive?u:p.color;return T.createElement("li",hA({className:v,style:f,key:"legend-item-".concat(g)},eu(r.props,p,g)),T.createElement(iA,{width:s,height:s,viewBox:d,style:h},r.renderIcon(p)),T.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},m?m(b,p,g):b))})}},{key:"render",value:function(){var r=this.props,i=r.payload,o=r.layout,s=r.align;if(!i||!i.length)return null;var l={padding:0,margin:0,textAlign:o==="horizontal"?s:"left"};return T.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(y.PureComponent);Jp(AT,"displayName","Legend");Jp(AT,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var uge=M0;function dge(){this.__data__=new uge,this.size=0}var fge=dge;function hge(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var pge=hge;function mge(t){return this.__data__.get(t)}var gge=mge;function vge(t){return this.__data__.has(t)}var yge=vge,xge=M0,bge=dT,wge=fT,Sge=200;function Cge(t,e){var n=this.__data__;if(n instanceof xge){var r=n.__data__;if(!bge||r.lengthl))return!1;var u=o.get(t),d=o.get(e);if(u&&d)return u==e&&d==t;var f=-1,h=!0,p=n&Gge?new Bge:void 0;for(o.set(t,e),o.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=Yve}var NT=Qve,Xve=Ta,Zve=NT,Jve=Pa,eye="[object Arguments]",tye="[object Array]",nye="[object Boolean]",rye="[object Date]",iye="[object Error]",oye="[object Function]",sye="[object Map]",aye="[object Number]",lye="[object Object]",cye="[object RegExp]",uye="[object Set]",dye="[object String]",fye="[object WeakMap]",hye="[object ArrayBuffer]",pye="[object DataView]",mye="[object Float32Array]",gye="[object Float64Array]",vye="[object Int8Array]",yye="[object Int16Array]",xye="[object Int32Array]",bye="[object Uint8Array]",wye="[object Uint8ClampedArray]",Sye="[object Uint16Array]",Cye="[object Uint32Array]",_n={};_n[mye]=_n[gye]=_n[vye]=_n[yye]=_n[xye]=_n[bye]=_n[wye]=_n[Sye]=_n[Cye]=!0;_n[eye]=_n[tye]=_n[hye]=_n[nye]=_n[pye]=_n[rye]=_n[iye]=_n[oye]=_n[sye]=_n[aye]=_n[lye]=_n[cye]=_n[uye]=_n[dye]=_n[fye]=!1;function Aye(t){return Jve(t)&&Zve(t.length)&&!!_n[Xve(t)]}var _ye=Aye;function jye(t){return function(e){return t(e)}}var gV=jye,Cx={exports:{}};Cx.exports;(function(t,e){var n=Cz,r=e&&!e.nodeType&&e,i=r&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===r,s=o&&n.process,l=function(){try{var c=i&&i.require&&i.require("util").types;return c||s&&s.binding&&s.binding("util")}catch{}}();t.exports=l})(Cx,Cx.exports);var Eye=Cx.exports,Nye=_ye,Tye=gV,cR=Eye,uR=cR&&cR.isTypedArray,Pye=uR?Tye(uR):Nye,vV=Pye,kye=Rve,Oye=jT,Iye=Ni,Rye=mV,Mye=ET,Dye=vV,$ye=Object.prototype,Lye=$ye.hasOwnProperty;function Fye(t,e){var n=Iye(t),r=!n&&Oye(t),i=!n&&!r&&Rye(t),o=!n&&!r&&!i&&Dye(t),s=n||r||i||o,l=s?kye(t.length,String):[],c=l.length;for(var u in t)(e||Lye.call(t,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Mye(u,c)))&&l.push(u);return l}var Uye=Fye,Bye=Object.prototype;function Hye(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||Bye;return t===n}var zye=Hye;function Vye(t,e){return function(n){return t(e(n))}}var yV=Vye,Gye=yV,Kye=Gye(Object.keys,Object),Wye=Kye,qye=zye,Yye=Wye,Qye=Object.prototype,Xye=Qye.hasOwnProperty;function Zye(t){if(!qye(t))return Yye(t);var e=[];for(var n in Object(t))Xye.call(t,n)&&n!="constructor"&&e.push(n);return e}var Jye=Zye,exe=cT,txe=NT;function nxe(t){return t!=null&&txe(t.length)&&!exe(t)}var lg=nxe,rxe=Uye,ixe=Jye,oxe=lg;function sxe(t){return oxe(t)?rxe(t):ixe(t)}var Z0=sxe,axe=Sve,lxe=Ove,cxe=Z0;function uxe(t){return axe(t,cxe,lxe)}var dxe=uxe,dR=dxe,fxe=1,hxe=Object.prototype,pxe=hxe.hasOwnProperty;function mxe(t,e,n,r,i,o){var s=n&fxe,l=dR(t),c=l.length,u=dR(e),d=u.length;if(c!=d&&!s)return!1;for(var f=c;f--;){var h=l[f];if(!(s?h in e:pxe.call(e,h)))return!1}var p=o.get(t),g=o.get(e);if(p&&g)return p==e&&g==t;var m=!0;o.set(t,e),o.set(e,t);for(var v=s;++f-1}var h0e=f0e;function p0e(t,e,n){for(var r=-1,i=t==null?0:t.length;++r=T0e){var u=e?null:E0e(t);if(u)return N0e(u);s=!1,i=j0e,c=new C0e}else c=e?[]:l;e:for(;++r=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function G0e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function K0e(t){return t.value}function W0e(t,e){if(T.isValidElement(t))return T.cloneElement(t,e);if(typeof t=="function")return T.createElement(t,e);e.ref;var n=V0e(e,D0e);return T.createElement(AT,n)}var ER=1,ca=function(t){function e(){var n;$0e(this,e);for(var r=arguments.length,i=new Array(r),o=0;oER||Math.abs(i.height-this.lastBoundingBox.height)>ER)&&(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?Hs({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var i=this.props,o=i.layout,s=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(s==="center"&&o==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=s==="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 Hs(Hs({},f),h)}},{key:"render",value:function(){var r=this,i=this.props,o=i.content,s=i.width,l=i.height,c=i.wrapperStyle,u=i.payloadUniqBy,d=i.payload,f=Hs(Hs({position:"absolute",width:s||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return T.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){r.wrapperNode=p}},W0e(o,Hs(Hs({},this.props),{},{payload:_V(d,u,K0e)})))}}],[{key:"getWithHeight",value:function(r,i){var o=Hs(Hs({},this.defaultProps),r.props),s=o.layout;return s==="vertical"&&Ne(r.props.height)?{height:r.props.height}:s==="horizontal"?{width:r.props.width||i}:null}}])}(y.PureComponent);J0(ca,"displayName","Legend");J0(ca,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var NR=sg,q0e=jT,Y0e=Ni,TR=NR?NR.isConcatSpreadable:void 0;function Q0e(t){return Y0e(t)||q0e(t)||!!(TR&&t&&t[TR])}var X0e=Q0e,Z0e=hV,J0e=X0e;function NV(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=J0e),i||(i=[]);++o0&&n(l)?e>1?NV(l,e-1,n,r,i):Z0e(i,l):r||(i[i.length]=l)}return i}var TV=NV;function ewe(t){return function(e,n,r){for(var i=-1,o=Object(e),s=r(e),l=s.length;l--;){var c=s[t?l:++i];if(n(o[c],c,o)===!1)break}return e}}var twe=ewe,nwe=twe,rwe=nwe(),iwe=rwe,owe=iwe,swe=Z0;function awe(t,e){return t&&owe(t,e,swe)}var PV=awe,lwe=lg;function cwe(t,e){return function(n,r){if(n==null)return n;if(!lwe(n))return t(n,r);for(var i=n.length,o=e?i:-1,s=Object(n);(e?o--:++oe||o&&s&&c&&!l&&!u||r&&s&&c||!n&&c||!i)return 1;if(!r&&!o&&!u&&t=l)return c;var u=n[r];return c*(u=="desc"?-1:1)}}return t.index-e.index}var Cwe=Swe,OS=pT,Awe=mT,_we=$s,jwe=kV,Ewe=ywe,Nwe=gV,Twe=Cwe,Pwe=$f,kwe=Ni;function Owe(t,e,n){e.length?e=OS(e,function(o){return kwe(o)?function(s){return Awe(s,o.length===1?o[0]:o)}:o}):e=[Pwe];var r=-1;e=OS(e,Nwe(_we));var i=jwe(t,function(o,s,l){var c=OS(e,function(u){return u(o)});return{criteria:c,index:++r,value:o}});return Ewe(i,function(o,s){return Twe(o,s,n)})}var Iwe=Owe;function Rwe(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var Mwe=Rwe,Dwe=Mwe,kR=Math.max;function $we(t,e,n){return e=kR(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=kR(r.length-e,0),s=Array(o);++i0){if(++e>=Wwe)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Xwe=Qwe,Zwe=Kwe,Jwe=Xwe,eSe=Jwe(Zwe),tSe=eSe,nSe=$f,rSe=Lwe,iSe=tSe;function oSe(t,e){return iSe(rSe(t,e,nSe),t+"")}var sSe=oSe,aSe=uT,lSe=lg,cSe=ET,uSe=Wl;function dSe(t,e,n){if(!uSe(n))return!1;var r=typeof e;return(r=="number"?lSe(n)&&cSe(e,n.length):r=="string"&&e in n)?aSe(n[e],t):!1}var ew=dSe,fSe=TV,hSe=Iwe,pSe=sSe,IR=ew,mSe=pSe(function(t,e){if(t==null)return[];var n=e.length;return n>1&&IR(t,e[0],e[1])?e=[]:n>2&&IR(e[0],e[1],e[2])&&(e=[e[0]]),hSe(t,fSe(e,1),[])}),gSe=mSe;const kT=en(gSe);function em(t){"@babel/helpers - typeof";return em=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},em(t)}function wA(){return wA=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n=e.x),"".concat(lh,"-left"),Ne(n)&&e&&Ne(e.x)&&n=e.y),"".concat(lh,"-top"),Ne(r)&&e&&Ne(e.y)&&rm?Math.max(d,c[r]):Math.max(f,c[r])}function kSe(t){var e=t.translateX,n=t.translateY,r=t.useTranslate3d;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function OSe(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTopLeft,i=t.position,o=t.reverseDirection,s=t.tooltipBox,l=t.useTranslate3d,c=t.viewBox,u,d,f;return s.height>0&&s.width>0&&n?(d=DR({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:s.width,viewBox:c,viewBoxDimension:c.width}),f=DR({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:s.height,viewBox:c,viewBoxDimension:c.height}),u=kSe({translateX:d,translateY:f,useTranslate3d:l})):u=TSe,{cssProperties:u,cssClasses:PSe({translateX:d,translateY:f,coordinate:n})}}function Fd(t){"@babel/helpers - typeof";return Fd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fd(t)}function $R(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function LR(t){for(var e=1;eFR||Math.abs(r.height-this.state.lastBoundingBox.height)>FR)&&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,o=i.active,s=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,v=i.useTranslate3d,b=i.viewBox,x=i.wrapperStyle,w=OSe({allowEscapeViewBox:s,coordinate:d,offsetTopLeft:p,position:g,reverseDirection:m,tooltipBox:this.state.lastBoundingBox,useTranslate3d:v,viewBox:b}),S=w.cssClasses,C=w.cssProperties,A=LR(LR({transition:h&&o?"transform ".concat(l,"ms ").concat(c):void 0},C),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&f?"visible":"hidden",position:"absolute",top:0,left:0},x);return T.createElement("div",{tabIndex:-1,className:S,style:A,ref:function(j){r.wrapperNode=j}},u)}}])}(y.PureComponent),HSe=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Bo={isSsr:HSe(),get:function(e){return Bo[e]},set:function(e,n){if(typeof e=="string")Bo[e]=n;else{var r=Object.keys(e);r&&r.length&&r.forEach(function(i){Bo[i]=e[i]})}}};function Ud(t){"@babel/helpers - typeof";return Ud=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ud(t)}function UR(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function BR(t){for(var e=1;e0;return T.createElement(BSe,{allowEscapeViewBox:s,animationDuration:l,animationEasing:c,isAnimationActive:h,active:o,coordinate:d,hasPayload:A,offset:p,position:v,reverseDirection:b,useTranslate3d:x,viewBox:w,wrapperStyle:S},ZSe(u,BR(BR({},this.props),{},{payload:C})))}}])}(y.PureComponent);OT(zr,"displayName","Tooltip");OT(zr,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Bo.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 JSe=Ds,eCe=function(){return JSe.Date.now()},tCe=eCe,nCe=/\s/;function rCe(t){for(var e=t.length;e--&&nCe.test(t.charAt(e)););return e}var iCe=rCe,oCe=iCe,sCe=/^\s+/;function aCe(t){return t&&t.slice(0,oCe(t)+1).replace(sCe,"")}var lCe=aCe,cCe=lCe,HR=Wl,uCe=Nf,zR=NaN,dCe=/^[-+]0x[0-9a-f]+$/i,fCe=/^0b[01]+$/i,hCe=/^0o[0-7]+$/i,pCe=parseInt;function mCe(t){if(typeof t=="number")return t;if(uCe(t))return zR;if(HR(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=HR(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=cCe(t);var n=fCe.test(t);return n||hCe.test(t)?pCe(t.slice(2),n?2:8):dCe.test(t)?zR:+t}var $V=mCe,gCe=Wl,RS=tCe,VR=$V,vCe="Expected a function",yCe=Math.max,xCe=Math.min;function bCe(t,e,n){var r,i,o,s,l,c,u=0,d=!1,f=!1,h=!0;if(typeof t!="function")throw new TypeError(vCe);e=VR(e)||0,gCe(n)&&(d=!!n.leading,f="maxWait"in n,o=f?yCe(VR(n.maxWait)||0,e):o,h="trailing"in n?!!n.trailing:h);function p(A){var _=r,j=i;return r=i=void 0,u=A,s=t.apply(j,_),s}function g(A){return u=A,l=setTimeout(b,e),d?p(A):s}function m(A){var _=A-c,j=A-u,k=e-_;return f?xCe(k,o-j):k}function v(A){var _=A-c,j=A-u;return c===void 0||_>=e||_<0||f&&j>=o}function b(){var A=RS();if(v(A))return x(A);l=setTimeout(b,m(A))}function x(A){return l=void 0,h&&r?p(A):(r=i=void 0,s)}function w(){l!==void 0&&clearTimeout(l),u=0,r=c=i=l=void 0}function S(){return l===void 0?s:x(RS())}function C(){var A=RS(),_=v(A);if(r=arguments,i=this,c=A,_){if(l===void 0)return g(c);if(f)return clearTimeout(l),l=setTimeout(b,e),p(c)}return l===void 0&&(l=setTimeout(b,e)),s}return C.cancel=w,C.flush=S,C}var wCe=bCe,SCe=wCe,CCe=Wl,ACe="Expected a function";function _Ce(t,e,n){var r=!0,i=!0;if(typeof t!="function")throw new TypeError(ACe);return CCe(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),SCe(t,e,{leading:r,maxWait:e,trailing:i})}var jCe=_Ce;const LV=en(jCe);function nm(t){"@babel/helpers - typeof";return nm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nm(t)}function GR(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ev(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&(I=LV(I,m,{trailing:!0,leading:!1}));var L=new ResizeObserver(I),V=C.current.getBoundingClientRect(),$=V.width,z=V.height;return R($,z),L.observe(C.current),function(){L.disconnect()}},[R,m]);var E=y.useMemo(function(){var I=k.containerWidth,L=k.containerHeight;if(I<0||L<0)return null;Uo(yc(s)||yc(c),`The width(%s) and height(%s) are both fixed numbers, - maybe you don't need to use a ResponsiveContainer.`,s,c),Uo(!n||n>0,"The aspect(%s) must be greater than zero.",n);var V=yc(s)?I:s,$=yc(c)?L:c;n&&n>0&&(V?$=V/n:$&&(V=$*n),h&&$>h&&($=h)),Uo(V>0||$>0,`The width(%s) and height(%s) of chart should be greater than 0, + A`).concat(s,",").concat(s,",0,1,1,").concat(l,",").concat(o),className:"recharts-legend-icon"});if(r.type==="rect")return T.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(Qi/8,"h").concat(Qi,"v").concat(Qi*3/4,"h").concat(-Qi,"z"),className:"recharts-legend-icon"});if(T.isValidElement(r.legendIcon)){var u=ege({},r);return delete u.legendIcon,T.cloneElement(r.legendIcon,u)}return T.createElement(ST,{fill:c,cx:o,cy:o,size:Qi,sizeType:"diameter",type:r.type})}},{key:"renderItems",value:function(){var r=this,i=this.props,o=i.payload,s=i.iconSize,l=i.layout,c=i.formatter,u=i.inactiveColor,d={x:0,y:0,width:Qi,height:Qi},f={display:l==="horizontal"?"inline-block":"block",marginRight:10},h={display:"inline-block",verticalAlign:"middle",marginRight:4};return o.map(function(p,g){var m=p.formatter||c,v=Et(Jp(Jp({"recharts-legend-item":!0},"legend-item-".concat(g),!0),"inactive",p.inactive));if(p.type==="none")return null;var b=xt(p.value)?null:p.value;Uo(!xt(p.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: `);var x=p.inactive?u:p.color;return T.createElement("li",fA({className:v,style:f,key:"legend-item-".concat(g)},eu(r.props,p,g)),T.createElement(rA,{width:s,height:s,viewBox:d,style:h},r.renderIcon(p)),T.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},m?m(b,p,g):b))})}},{key:"render",value:function(){var r=this.props,i=r.payload,o=r.layout,s=r.align;if(!i||!i.length)return null;var l={padding:0,margin:0,textAlign:o==="horizontal"?s:"left"};return T.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(y.PureComponent);Jp(CT,"displayName","Legend");Jp(CT,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var cge=R0;function uge(){this.__data__=new cge,this.size=0}var dge=uge;function fge(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var hge=fge;function pge(t){return this.__data__.get(t)}var mge=pge;function gge(t){return this.__data__.has(t)}var vge=gge,yge=R0,xge=uT,bge=dT,wge=200;function Sge(t,e){var n=this.__data__;if(n instanceof yge){var r=n.__data__;if(!xge||r.lengthl))return!1;var u=o.get(t),d=o.get(e);if(u&&d)return u==e&&d==t;var f=-1,h=!0,p=n&Vge?new Uge:void 0;for(o.set(t,e),o.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=qve}var ET=Yve,Qve=Ta,Xve=ET,Jve=Pa,Zve="[object Arguments]",eye="[object Array]",tye="[object Boolean]",nye="[object Date]",rye="[object Error]",iye="[object Function]",oye="[object Map]",sye="[object Number]",aye="[object Object]",lye="[object RegExp]",cye="[object Set]",uye="[object String]",dye="[object WeakMap]",fye="[object ArrayBuffer]",hye="[object DataView]",pye="[object Float32Array]",mye="[object Float64Array]",gye="[object Int8Array]",vye="[object Int16Array]",yye="[object Int32Array]",xye="[object Uint8Array]",bye="[object Uint8ClampedArray]",wye="[object Uint16Array]",Sye="[object Uint32Array]",_n={};_n[pye]=_n[mye]=_n[gye]=_n[vye]=_n[yye]=_n[xye]=_n[bye]=_n[wye]=_n[Sye]=!0;_n[Zve]=_n[eye]=_n[fye]=_n[tye]=_n[hye]=_n[nye]=_n[rye]=_n[iye]=_n[oye]=_n[sye]=_n[aye]=_n[lye]=_n[cye]=_n[uye]=_n[dye]=!1;function Cye(t){return Jve(t)&&Xve(t.length)&&!!_n[Qve(t)]}var Aye=Cye;function _ye(t){return function(e){return t(e)}}var mV=_ye,Sx={exports:{}};Sx.exports;(function(t,e){var n=Sz,r=e&&!e.nodeType&&e,i=r&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===r,s=o&&n.process,l=function(){try{var c=i&&i.require&&i.require("util").types;return c||s&&s.binding&&s.binding("util")}catch{}}();t.exports=l})(Sx,Sx.exports);var jye=Sx.exports,Eye=Aye,Nye=mV,lR=jye,cR=lR&&lR.isTypedArray,Tye=cR?Nye(cR):Eye,gV=Tye,Pye=Ive,kye=_T,Oye=Ni,Iye=pV,Rye=jT,Mye=gV,Dye=Object.prototype,$ye=Dye.hasOwnProperty;function Lye(t,e){var n=Oye(t),r=!n&&kye(t),i=!n&&!r&&Iye(t),o=!n&&!r&&!i&&Mye(t),s=n||r||i||o,l=s?Pye(t.length,String):[],c=l.length;for(var u in t)(e||$ye.call(t,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Rye(u,c)))&&l.push(u);return l}var Fye=Lye,Uye=Object.prototype;function Bye(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||Uye;return t===n}var Hye=Bye;function zye(t,e){return function(n){return t(e(n))}}var vV=zye,Vye=vV,Gye=Vye(Object.keys,Object),Kye=Gye,Wye=Hye,qye=Kye,Yye=Object.prototype,Qye=Yye.hasOwnProperty;function Xye(t){if(!Wye(t))return qye(t);var e=[];for(var n in Object(t))Qye.call(t,n)&&n!="constructor"&&e.push(n);return e}var Jye=Xye,Zye=lT,exe=ET;function txe(t){return t!=null&&exe(t.length)&&!Zye(t)}var ag=txe,nxe=Fye,rxe=Jye,ixe=ag;function oxe(t){return ixe(t)?nxe(t):rxe(t)}var X0=oxe,sxe=wve,axe=kve,lxe=X0;function cxe(t){return sxe(t,lxe,axe)}var uxe=cxe,uR=uxe,dxe=1,fxe=Object.prototype,hxe=fxe.hasOwnProperty;function pxe(t,e,n,r,i,o){var s=n&dxe,l=uR(t),c=l.length,u=uR(e),d=u.length;if(c!=d&&!s)return!1;for(var f=c;f--;){var h=l[f];if(!(s?h in e:hxe.call(e,h)))return!1}var p=o.get(t),g=o.get(e);if(p&&g)return p==e&&g==t;var m=!0;o.set(t,e),o.set(e,t);for(var v=s;++f-1}var f0e=d0e;function h0e(t,e,n){for(var r=-1,i=t==null?0:t.length;++r=N0e){var u=e?null:j0e(t);if(u)return E0e(u);s=!1,i=_0e,c=new S0e}else c=e?[]:l;e:for(;++r=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function V0e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function G0e(t){return t.value}function K0e(t,e){if(T.isValidElement(t))return T.cloneElement(t,e);if(typeof t=="function")return T.createElement(t,e);e.ref;var n=z0e(e,M0e);return T.createElement(CT,n)}var jR=1,ca=function(t){function e(){var n;D0e(this,e);for(var r=arguments.length,i=new Array(r),o=0;ojR||Math.abs(i.height-this.lastBoundingBox.height)>jR)&&(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?Hs({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var i=this.props,o=i.layout,s=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(s==="center"&&o==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=s==="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 Hs(Hs({},f),h)}},{key:"render",value:function(){var r=this,i=this.props,o=i.content,s=i.width,l=i.height,c=i.wrapperStyle,u=i.payloadUniqBy,d=i.payload,f=Hs(Hs({position:"absolute",width:s||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return T.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){r.wrapperNode=p}},K0e(o,Hs(Hs({},this.props),{},{payload:AV(d,u,G0e)})))}}],[{key:"getWithHeight",value:function(r,i){var o=Hs(Hs({},this.defaultProps),r.props),s=o.layout;return s==="vertical"&&Ee(r.props.height)?{height:r.props.height}:s==="horizontal"?{width:r.props.width||i}:null}}])}(y.PureComponent);J0(ca,"displayName","Legend");J0(ca,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var ER=og,W0e=_T,q0e=Ni,NR=ER?ER.isConcatSpreadable:void 0;function Y0e(t){return q0e(t)||W0e(t)||!!(NR&&t&&t[NR])}var Q0e=Y0e,X0e=fV,J0e=Q0e;function EV(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=J0e),i||(i=[]);++o0&&n(l)?e>1?EV(l,e-1,n,r,i):X0e(i,l):r||(i[i.length]=l)}return i}var NV=EV;function Z0e(t){return function(e,n,r){for(var i=-1,o=Object(e),s=r(e),l=s.length;l--;){var c=s[t?l:++i];if(n(o[c],c,o)===!1)break}return e}}var ewe=Z0e,twe=ewe,nwe=twe(),rwe=nwe,iwe=rwe,owe=X0;function swe(t,e){return t&&iwe(t,e,owe)}var TV=swe,awe=ag;function lwe(t,e){return function(n,r){if(n==null)return n;if(!awe(n))return t(n,r);for(var i=n.length,o=e?i:-1,s=Object(n);(e?o--:++oe||o&&s&&c&&!l&&!u||r&&s&&c||!n&&c||!i)return 1;if(!r&&!o&&!u&&t=l)return c;var u=n[r];return c*(u=="desc"?-1:1)}}return t.index-e.index}var Swe=wwe,kS=hT,Cwe=pT,Awe=$s,_we=PV,jwe=vwe,Ewe=mV,Nwe=Swe,Twe=$f,Pwe=Ni;function kwe(t,e,n){e.length?e=kS(e,function(o){return Pwe(o)?function(s){return Cwe(s,o.length===1?o[0]:o)}:o}):e=[Twe];var r=-1;e=kS(e,Ewe(Awe));var i=_we(t,function(o,s,l){var c=kS(e,function(u){return u(o)});return{criteria:c,index:++r,value:o}});return jwe(i,function(o,s){return Nwe(o,s,n)})}var Owe=kwe;function Iwe(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var Rwe=Iwe,Mwe=Rwe,PR=Math.max;function Dwe(t,e,n){return e=PR(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=PR(r.length-e,0),s=Array(o);++i0){if(++e>=Kwe)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Qwe=Ywe,Xwe=Gwe,Jwe=Qwe,Zwe=Jwe(Xwe),eSe=Zwe,tSe=$f,nSe=$we,rSe=eSe;function iSe(t,e){return rSe(nSe(t,e,tSe),t+"")}var oSe=iSe,sSe=cT,aSe=ag,lSe=jT,cSe=Wl;function uSe(t,e,n){if(!cSe(n))return!1;var r=typeof e;return(r=="number"?aSe(n)&&lSe(e,n.length):r=="string"&&e in n)?sSe(n[e],t):!1}var Z0=uSe,dSe=NV,fSe=Owe,hSe=oSe,OR=Z0,pSe=hSe(function(t,e){if(t==null)return[];var n=e.length;return n>1&&OR(t,e[0],e[1])?e=[]:n>2&&OR(e[0],e[1],e[2])&&(e=[e[0]]),fSe(t,dSe(e,1),[])}),mSe=pSe;const PT=en(mSe);function Zp(t){"@babel/helpers - typeof";return Zp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zp(t)}function bA(){return bA=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n=e.x),"".concat(ah,"-left"),Ee(n)&&e&&Ee(e.x)&&n=e.y),"".concat(ah,"-top"),Ee(r)&&e&&Ee(e.y)&&rm?Math.max(d,c[r]):Math.max(f,c[r])}function PSe(t){var e=t.translateX,n=t.translateY,r=t.useTranslate3d;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function kSe(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTopLeft,i=t.position,o=t.reverseDirection,s=t.tooltipBox,l=t.useTranslate3d,c=t.viewBox,u,d,f;return s.height>0&&s.width>0&&n?(d=MR({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:s.width,viewBox:c,viewBoxDimension:c.width}),f=MR({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:s.height,viewBox:c,viewBoxDimension:c.height}),u=PSe({translateX:d,translateY:f,useTranslate3d:l})):u=NSe,{cssProperties:u,cssClasses:TSe({translateX:d,translateY:f,coordinate:n})}}function Fd(t){"@babel/helpers - typeof";return Fd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fd(t)}function DR(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function $R(t){for(var e=1;eLR||Math.abs(r.height-this.state.lastBoundingBox.height)>LR)&&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,o=i.active,s=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,v=i.useTranslate3d,b=i.viewBox,x=i.wrapperStyle,w=kSe({allowEscapeViewBox:s,coordinate:d,offsetTopLeft:p,position:g,reverseDirection:m,tooltipBox:this.state.lastBoundingBox,useTranslate3d:v,viewBox:b}),S=w.cssClasses,C=w.cssProperties,A=$R($R({transition:h&&o?"transform ".concat(l,"ms ").concat(c):void 0},C),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&f?"visible":"hidden",position:"absolute",top:0,left:0},x);return T.createElement("div",{tabIndex:-1,className:S,style:A,ref:function(j){r.wrapperNode=j}},u)}}])}(y.PureComponent),BSe=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Bo={isSsr:BSe(),get:function(e){return Bo[e]},set:function(e,n){if(typeof e=="string")Bo[e]=n;else{var r=Object.keys(e);r&&r.length&&r.forEach(function(i){Bo[i]=e[i]})}}};function Ud(t){"@babel/helpers - typeof";return Ud=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ud(t)}function FR(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function UR(t){for(var e=1;e0;return T.createElement(USe,{allowEscapeViewBox:s,animationDuration:l,animationEasing:c,isAnimationActive:h,active:o,coordinate:d,hasPayload:A,offset:p,position:v,reverseDirection:b,useTranslate3d:x,viewBox:w,wrapperStyle:S},XSe(u,UR(UR({},this.props),{},{payload:C})))}}])}(y.PureComponent);kT(zr,"displayName","Tooltip");kT(zr,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Bo.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 JSe=Ds,ZSe=function(){return JSe.Date.now()},eCe=ZSe,tCe=/\s/;function nCe(t){for(var e=t.length;e--&&tCe.test(t.charAt(e)););return e}var rCe=nCe,iCe=rCe,oCe=/^\s+/;function sCe(t){return t&&t.slice(0,iCe(t)+1).replace(oCe,"")}var aCe=sCe,lCe=aCe,BR=Wl,cCe=Nf,HR=NaN,uCe=/^[-+]0x[0-9a-f]+$/i,dCe=/^0b[01]+$/i,fCe=/^0o[0-7]+$/i,hCe=parseInt;function pCe(t){if(typeof t=="number")return t;if(cCe(t))return HR;if(BR(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=BR(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=lCe(t);var n=dCe.test(t);return n||fCe.test(t)?hCe(t.slice(2),n?2:8):uCe.test(t)?HR:+t}var DV=pCe,mCe=Wl,IS=eCe,zR=DV,gCe="Expected a function",vCe=Math.max,yCe=Math.min;function xCe(t,e,n){var r,i,o,s,l,c,u=0,d=!1,f=!1,h=!0;if(typeof t!="function")throw new TypeError(gCe);e=zR(e)||0,mCe(n)&&(d=!!n.leading,f="maxWait"in n,o=f?vCe(zR(n.maxWait)||0,e):o,h="trailing"in n?!!n.trailing:h);function p(A){var _=r,j=i;return r=i=void 0,u=A,s=t.apply(j,_),s}function g(A){return u=A,l=setTimeout(b,e),d?p(A):s}function m(A){var _=A-c,j=A-u,k=e-_;return f?yCe(k,o-j):k}function v(A){var _=A-c,j=A-u;return c===void 0||_>=e||_<0||f&&j>=o}function b(){var A=IS();if(v(A))return x(A);l=setTimeout(b,m(A))}function x(A){return l=void 0,h&&r?p(A):(r=i=void 0,s)}function w(){l!==void 0&&clearTimeout(l),u=0,r=c=i=l=void 0}function S(){return l===void 0?s:x(IS())}function C(){var A=IS(),_=v(A);if(r=arguments,i=this,c=A,_){if(l===void 0)return g(c);if(f)return clearTimeout(l),l=setTimeout(b,e),p(c)}return l===void 0&&(l=setTimeout(b,e)),s}return C.cancel=w,C.flush=S,C}var bCe=xCe,wCe=bCe,SCe=Wl,CCe="Expected a function";function ACe(t,e,n){var r=!0,i=!0;if(typeof t!="function")throw new TypeError(CCe);return SCe(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),wCe(t,e,{leading:r,maxWait:e,trailing:i})}var _Ce=ACe;const $V=en(_Ce);function tm(t){"@babel/helpers - typeof";return tm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tm(t)}function VR(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Zg(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&(R=$V(R,m,{trailing:!0,leading:!1}));var L=new ResizeObserver(R),V=C.current.getBoundingClientRect(),$=V.width,z=V.height;return I($,z),L.observe(C.current),function(){L.disconnect()}},[I,m]);var E=y.useMemo(function(){var R=k.containerWidth,L=k.containerHeight;if(R<0||L<0)return null;Uo(yc(s)||yc(c),`The width(%s) and height(%s) are both fixed numbers, + maybe you don't need to use a ResponsiveContainer.`,s,c),Uo(!n||n>0,"The aspect(%s) must be greater than zero.",n);var V=yc(s)?R:s,$=yc(c)?L:c;n&&n>0&&(V?$=V/n:$&&(V=$*n),h&&$>h&&($=h)),Uo(V>0||$>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.`,V,$,s,c,d,f,n);var z=!Array.isArray(p)&&la(p.type).endsWith("Chart");return T.Children.map(p,function(M){return Rz.isElement(M)?y.cloneElement(M,ev({width:V,height:$},z?{style:ev({height:"100%",width:"100%",maxHeight:$,maxWidth:V},M.props.style)}:{})):M})},[n,p,c,h,f,d,k,s]);return T.createElement("div",{id:v?"".concat(v):void 0,className:Nt("recharts-responsive-container",b),style:ev(ev({},S),{},{width:s,height:c,minWidth:d,minHeight:f,maxHeight:h}),ref:C},E)}),cg=function(e){return null};cg.displayName="Cell";function rm(t){"@babel/helpers - typeof";return rm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rm(t)}function WR(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function _A(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Bo.isSsr)return{width:0,height:0};var r=UCe(n),i=JSON.stringify({text:e,copyStyle:r});if(Cu.widthCache[i])return Cu.widthCache[i];try{var o=document.getElementById(qR);o||(o=document.createElement("span"),o.setAttribute("id",qR),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var s=_A(_A({},FCe),r);Object.assign(o.style,s),o.textContent="".concat(e);var l=o.getBoundingClientRect(),c={width:l.width,height:l.height};return Cu.widthCache[i]=c,++Cu.cacheCount>LCe&&(Cu.cacheCount=0,Cu.widthCache={}),c}catch{return{width:0,height:0}}},BCe=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function im(t){"@babel/helpers - typeof";return im=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},im(t)}function Ex(t,e){return GCe(t)||VCe(t,e)||zCe(t,e)||HCe()}function HCe(){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 zCe(t,e){if(t){if(typeof t=="string")return YR(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return YR(t,e)}}function YR(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function o1e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function t2(t,e){return c1e(t)||l1e(t,e)||a1e(t,e)||s1e()}function s1e(){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 a1e(t,e){if(t){if(typeof t=="string")return n2(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return n2(t,e)}}function n2(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[];return V.reduce(function($,z){var M=z.word,U=z.width,K=$[$.length-1];if(K&&(i==null||o||K.width+U+rz.width?$:z})};if(!d)return p;for(var m="…",v=function(V){var $=f.slice(0,V),z=HV({breakAll:u,style:c,children:$+m}).wordsWithComputedWidth,M=h(z),U=M.length>s||g(M).width>Number(i);return[U,M]},b=0,x=f.length-1,w=0,S;b<=x&&w<=f.length-1;){var C=Math.floor((b+x)/2),A=C-1,_=v(A),j=t2(_,2),k=j[0],P=j[1],R=v(C),E=t2(R,1),I=E[0];if(!k&&!I&&(b=C+1),k&&I&&(x=C-1),!k&&I){S=P;break}w++}return S||p},r2=function(e){var n=Pt(e)?[]:e.toString().split(BV);return[{words:n}]},d1e=function(e){var n=e.width,r=e.scaleToFit,i=e.children,o=e.style,s=e.breakAll,l=e.maxLines;if((n||r)&&!Bo.isSsr){var c,u,d=HV({breakAll:s,children:i,style:o});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;c=f,u=h}else return r2(i);return u1e({breakAll:s,children:i,maxLines:l,style:o},c,u,n,r)}return r2(i)},i2="#808080",tu=function(e){var n=e.x,r=n===void 0?0:n,i=e.y,o=i===void 0?0:i,s=e.lineHeight,l=s===void 0?"1em":s,c=e.capHeight,u=c===void 0?"0.71em":c,d=e.scaleToFit,f=d===void 0?!1:d,h=e.textAnchor,p=h===void 0?"start":h,g=e.verticalAnchor,m=g===void 0?"end":g,v=e.fill,b=v===void 0?i2:v,x=e2(e,r1e),w=y.useMemo(function(){return d1e({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:f,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,f,x.style,x.width]),S=x.dx,C=x.dy,A=x.angle,_=x.className,j=x.breakAll,k=e2(x,i1e);if(!mr(r)||!mr(o))return null;var P=r+(Ne(S)?S:0),R=o+(Ne(C)?C:0),E;switch(m){case"start":E=MS("calc(".concat(u,")"));break;case"middle":E=MS("calc(".concat((w.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:E=MS("calc(".concat(w.length-1," * -").concat(l,")"));break}var I=[];if(f){var L=w[0].width,V=x.width;I.push("scale(".concat((Ne(V)?V/L:1)/L,")"))}return A&&I.push("rotate(".concat(A,", ").concat(P,", ").concat(R,")")),I.length&&(k.transform=I.join(" ")),T.createElement("text",jA({},Je(k,!0),{x:P,y:R,className:Nt("recharts-text",_),textAnchor:p,fill:b.includes("url")?i2:b}),w.map(function($,z){var M=$.words.join(j?"":" ");return T.createElement("tspan",{x:P,dy:z===0?E:l,key:"".concat(M,"-").concat(z)},M)}))};function _l(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function f1e(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function IT(t){let e,n,r;t.length!==2?(e=_l,n=(l,c)=>_l(t(l),c),r=(l,c)=>t(l)-c):(e=t===_l||t===f1e?t:h1e,n=t,r=t);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:s,right:o}}function h1e(){return 0}function zV(t){return t===null?NaN:+t}function*p1e(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const m1e=IT(_l),ug=m1e.right;IT(zV).center;class o2 extends Map{constructor(e,n=y1e){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,i]of e)this.set(r,i)}get(e){return super.get(s2(this,e))}has(e){return super.has(s2(this,e))}set(e,n){return super.set(g1e(this,e),n)}delete(e){return super.delete(v1e(this,e))}}function s2({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function g1e({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function v1e({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function y1e(t){return t!==null&&typeof t=="object"?t.valueOf():t}function x1e(t=_l){if(t===_l)return VV;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function VV(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const b1e=Math.sqrt(50),w1e=Math.sqrt(10),S1e=Math.sqrt(2);function Nx(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=b1e?10:o>=w1e?5:o>=S1e?2:1;let l,c,u;return i<0?(u=Math.pow(10,-i)/s,l=Math.round(t*u),c=Math.round(e*u),l/ue&&--c,u=-u):(u=Math.pow(10,i)*s,l=Math.round(t/u),c=Math.round(e/u),l*ue&&--c),c0))return[];if(t===e)return[t];const r=e=i))return[];const l=o-i+1,c=new Array(l);if(r)if(s<0)for(let u=0;u=r)&&(n=r);return n}function l2(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function GV(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=i===void 0?VV:x1e(i);r>n;){if(r-n>600){const c=r-n+1,u=e-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(e-u*f/c+h)),g=Math.min(r,Math.floor(e+(c-u)*f/c+h));GV(t,e,p,g,i)}const o=t[e];let s=n,l=r;for(ch(t,n,e),i(t[r],o)>0&&ch(t,n,r);s0;)--l}i(t[n],o)===0?ch(t,n,l):(++l,ch(t,l,r)),l<=e&&(n=l+1),e<=l&&(r=l-1)}return t}function ch(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function C1e(t,e,n){if(t=Float64Array.from(p1e(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return l2(t);if(e>=1)return a2(t);var r,i=(r-1)*e,o=Math.floor(i),s=a2(GV(t,o).subarray(0,o+1)),l=l2(t.subarray(o+1));return s+(l-s)*(i-o)}}function A1e(t,e,n=zV){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,o=Math.floor(i),s=+n(t[o],o,t),l=+n(t[o+1],o+1,t);return s+(l-s)*(i-o)}}function _1e(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,o=new Array(i);++r>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?nv(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?nv(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=E1e.exec(t))?new yi(e[1],e[2],e[3],1):(e=N1e.exec(t))?new yi(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=T1e.exec(t))?nv(e[1],e[2],e[3],e[4]):(e=P1e.exec(t))?nv(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=k1e.exec(t))?m2(e[1],e[2]/100,e[3]/100,1):(e=O1e.exec(t))?m2(e[1],e[2]/100,e[3]/100,e[4]):c2.hasOwnProperty(t)?f2(c2[t]):t==="transparent"?new yi(NaN,NaN,NaN,0):null}function f2(t){return new yi(t>>16&255,t>>8&255,t&255,1)}function nv(t,e,n,r){return r<=0&&(t=e=n=NaN),new yi(t,e,n,r)}function M1e(t){return t instanceof dg||(t=lm(t)),t?(t=t.rgb(),new yi(t.r,t.g,t.b,t.opacity)):new yi}function kA(t,e,n,r){return arguments.length===1?M1e(t):new yi(t,e,n,r??1)}function yi(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}MT(yi,kA,WV(dg,{brighter(t){return t=t==null?Tx:Math.pow(Tx,t),new yi(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?sm:Math.pow(sm,t),new yi(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new yi(Ic(this.r),Ic(this.g),Ic(this.b),Px(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:h2,formatHex:h2,formatHex8:D1e,formatRgb:p2,toString:p2}));function h2(){return`#${xc(this.r)}${xc(this.g)}${xc(this.b)}`}function D1e(){return`#${xc(this.r)}${xc(this.g)}${xc(this.b)}${xc((isNaN(this.opacity)?1:this.opacity)*255)}`}function p2(){const t=Px(this.opacity);return`${t===1?"rgb(":"rgba("}${Ic(this.r)}, ${Ic(this.g)}, ${Ic(this.b)}${t===1?")":`, ${t})`}`}function Px(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Ic(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function xc(t){return t=Ic(t),(t<16?"0":"")+t.toString(16)}function m2(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ko(t,e,n,r)}function qV(t){if(t instanceof ko)return new ko(t.h,t.s,t.l,t.opacity);if(t instanceof dg||(t=lm(t)),!t)return new ko;if(t instanceof ko)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),s=NaN,l=o-i,c=(o+i)/2;return l?(e===o?s=(n-r)/l+(n0&&c<1?0:s,new ko(s,l,c,t.opacity)}function $1e(t,e,n,r){return arguments.length===1?qV(t):new ko(t,e,n,r??1)}function ko(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}MT(ko,$1e,WV(dg,{brighter(t){return t=t==null?Tx:Math.pow(Tx,t),new ko(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?sm:Math.pow(sm,t),new ko(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new yi(DS(t>=240?t-240:t+120,i,r),DS(t,i,r),DS(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new ko(g2(this.h),rv(this.s),rv(this.l),Px(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 t=Px(this.opacity);return`${t===1?"hsl(":"hsla("}${g2(this.h)}, ${rv(this.s)*100}%, ${rv(this.l)*100}%${t===1?")":`, ${t})`}`}}));function g2(t){return t=(t||0)%360,t<0?t+360:t}function rv(t){return Math.max(0,Math.min(1,t||0))}function DS(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const DT=t=>()=>t;function L1e(t,e){return function(n){return t+n*e}}function F1e(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function U1e(t){return(t=+t)==1?YV:function(e,n){return n-e?F1e(e,n,t):DT(isNaN(e)?n:e)}}function YV(t,e){var n=e-t;return n?L1e(t,n):DT(isNaN(t)?e:t)}const v2=function t(e){var n=U1e(e);function r(i,o){var s=n((i=kA(i)).r,(o=kA(o)).r),l=n(i.g,o.g),c=n(i.b,o.b),u=YV(i.opacity,o.opacity);return function(d){return i.r=s(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return r.gamma=t,r}(1);function B1e(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(o){for(i=0;in&&(o=e.slice(n,o),l[s]?l[s]+=o:l[++s]=o),(r=r[0])===(i=i[0])?l[s]?l[s]+=i:l[++s]=i:(l[++s]=null,c.push({i:s,x:kx(r,i)})),n=$S.lastIndex;return ne&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function Z1e(t,e,n){var r=t[0],i=t[1],o=e[0],s=e[1];return i2?J1e:Z1e,c=u=null,f}function f(h){return h==null||isNaN(h=+h)?o:(c||(c=l(t.map(r),e,n)))(r(s(h)))}return f.invert=function(h){return s(i((u||(u=l(e,t.map(r),kx)))(h)))},f.domain=function(h){return arguments.length?(t=Array.from(h,Ox),d()):t.slice()},f.range=function(h){return arguments.length?(e=Array.from(h),d()):e.slice()},f.rangeRound=function(h){return e=Array.from(h),n=$T,d()},f.clamp=function(h){return arguments.length?(s=h?!0:si,d()):s!==si},f.interpolate=function(h){return arguments.length?(n=h,d()):n},f.unknown=function(h){return arguments.length?(o=h,f):o},function(h,p){return r=h,i=p,d()}}function LT(){return tw()(si,si)}function eAe(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Ix(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Bd(t){return t=Ix(Math.abs(t)),t?t[1]:NaN}function tAe(t,e){return function(n,r){for(var i=n.length,o=[],s=0,l=t[0],c=0;i>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),o.push(n.substring(i-=l,i+l)),!((c+=l+1)>r));)l=t[s=(s+1)%t.length];return o.reverse().join(e)}}function nAe(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var rAe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function cm(t){if(!(e=rAe.exec(t)))throw new Error("invalid format: "+t);var e;return new FT({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}cm.prototype=FT.prototype;function FT(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}FT.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 iAe(t){e:for(var e=t.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var QV;function oAe(t,e){var n=Ix(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(QV=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Ix(t,Math.max(0,e+o-1))[0]}function x2(t,e){var n=Ix(t,e);if(!n)return t+"";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 b2={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:eAe,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>x2(t*100,e),r:x2,s:oAe,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function w2(t){return t}var S2=Array.prototype.map,C2=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function sAe(t){var e=t.grouping===void 0||t.thousands===void 0?w2:tAe(S2.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?w2:nAe(S2.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function u(f){f=cm(f);var h=f.fill,p=f.align,g=f.sign,m=f.symbol,v=f.zero,b=f.width,x=f.comma,w=f.precision,S=f.trim,C=f.type;C==="n"?(x=!0,C="g"):b2[C]||(w===void 0&&(w=12),S=!0,C="g"),(v||h==="0"&&p==="=")&&(v=!0,h="0",p="=");var A=m==="$"?n:m==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():"",_=m==="$"?r:/[%p]/.test(C)?s:"",j=b2[C],k=/[defgprs%]/.test(C);w=w===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function P(R){var E=A,I=_,L,V,$;if(C==="c")I=j(R)+I,R="";else{R=+R;var z=R<0||1/R<0;if(R=isNaN(R)?c:j(Math.abs(R),w),S&&(R=iAe(R)),z&&+R==0&&g!=="+"&&(z=!1),E=(z?g==="("?g:l:g==="-"||g==="("?"":g)+E,I=(C==="s"?C2[8+QV/3]:"")+I+(z&&g==="("?")":""),k){for(L=-1,V=R.length;++L$||$>57){I=($===46?i+R.slice(L+1):R.slice(L))+I,R=R.slice(0,L);break}}}x&&!v&&(R=e(R,1/0));var M=E.length+R.length+I.length,U=M>1)+E+R+I+U.slice(M);break;default:R=U+E+R+I;break}return o(R)}return P.toString=function(){return f+""},P}function d(f,h){var p=u((f=cm(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(Bd(h)/3)))*3,m=Math.pow(10,-g),v=C2[8+g/3];return function(b){return p(m*b)+v}}return{format:u,formatPrefix:d}}var iv,UT,XV;aAe({thousands:",",grouping:[3],currency:["$",""]});function aAe(t){return iv=sAe(t),UT=iv.format,XV=iv.formatPrefix,iv}function lAe(t){return Math.max(0,-Bd(Math.abs(t)))}function cAe(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Bd(e)/3)))*3-Bd(Math.abs(t)))}function uAe(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Bd(e)-Bd(t))+1}function ZV(t,e,n,r){var i=TA(t,e,n),o;switch(r=cm(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(o=cAe(i,s))&&(r.precision=o),XV(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=uAe(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=lAe(i))&&(r.precision=o-(r.type==="%")*2);break}}return UT(r)}function ql(t){var e=t.domain;return t.ticks=function(n){var r=e();return EA(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return ZV(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,o=r.length-1,s=r[i],l=r[o],c,u,d=10;for(l0;){if(u=NA(s,l,n),u===c)return r[i]=s,r[o]=l,e(r);if(u>0)s=Math.floor(s/u)*u,l=Math.ceil(l/u)*u;else if(u<0)s=Math.ceil(s*u)/u,l=Math.floor(l*u)/u;else break;c=u}return t},t}function Rx(){var t=LT();return t.copy=function(){return fg(t,Rx())},yo.apply(t,arguments),ql(t)}function JV(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,Ox),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return JV(t).unknown(e)},t=arguments.length?Array.from(t,Ox):[0,1],ql(n)}function e8(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],o=t[r],s;return oMath.pow(t,e)}function mAe(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function j2(t){return(e,n)=>-t(-e,n)}function BT(t){const e=t(A2,_2),n=e.domain;let r=10,i,o;function s(){return i=mAe(r),o=pAe(r),n()[0]<0?(i=j2(i),o=j2(o),t(dAe,fAe)):t(A2,_2),e}return e.base=function(l){return arguments.length?(r=+l,s()):r},e.domain=function(l){return arguments.length?(n(l),s()):n()},e.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/o(-h):g*o(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=cm(c)).precision==null&&(c.trim=!0),c=UT(c)),l===1/0)return c;const u=Math.max(1,r*l/e.ticks().length);return d=>{let f=d/o(Math.round(i(d)));return f*rn(e8(n(),{floor:l=>o(Math.floor(i(l))),ceil:l=>o(Math.ceil(i(l)))})),e}function t8(){const t=BT(tw()).domain([1,10]);return t.copy=()=>fg(t,t8()).base(t.base()),yo.apply(t,arguments),t}function E2(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function N2(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function HT(t){var e=1,n=t(E2(e),N2(e));return n.constant=function(r){return arguments.length?t(E2(e=+r),N2(e)):e},ql(n)}function n8(){var t=HT(tw());return t.copy=function(){return fg(t,n8()).constant(t.constant())},yo.apply(t,arguments)}function T2(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function gAe(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function vAe(t){return t<0?-t*t:t*t}function zT(t){var e=t(si,si),n=1;function r(){return n===1?t(si,si):n===.5?t(gAe,vAe):t(T2(n),T2(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},ql(e)}function VT(){var t=zT(tw());return t.copy=function(){return fg(t,VT()).exponent(t.exponent())},yo.apply(t,arguments),t}function yAe(){return VT.apply(null,arguments).exponent(.5)}function P2(t){return Math.sign(t)*t*t}function xAe(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function r8(){var t=LT(),e=[0,1],n=!1,r;function i(o){var s=xAe(t(o));return isNaN(s)?r:n?Math.round(s):s}return i.invert=function(o){return t.invert(P2(o))},i.domain=function(o){return arguments.length?(t.domain(o),i):t.domain()},i.range=function(o){return arguments.length?(t.range((e=Array.from(o,Ox)).map(P2)),i):e.slice()},i.rangeRound=function(o){return i.range(o).round(!0)},i.round=function(o){return arguments.length?(n=!!o,i):n},i.clamp=function(o){return arguments.length?(t.clamp(o),i):t.clamp()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return r8(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},yo.apply(i,arguments),ql(i)}function i8(){var t=[],e=[],n=[],r;function i(){var s=0,l=Math.max(1,e.length);for(n=new Array(l-1);++s0?n[l-1]:t[0],l=n?[r[n-1],e]:[r[u-1],r[u]]},s.unknown=function(c){return arguments.length&&(o=c),s},s.thresholds=function(){return r.slice()},s.copy=function(){return o8().domain([t,e]).range(i).unknown(o)},yo.apply(ql(s),arguments)}function s8(){var t=[.5],e=[0,1],n,r=1;function i(o){return o!=null&&o<=o?e[ug(t,o,0,r)]:n}return i.domain=function(o){return arguments.length?(t=Array.from(o),r=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(o){return arguments.length?(e=Array.from(o),r=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(o){var s=e.indexOf(o);return[t[s-1],t[s]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return s8().domain(t).range(e).unknown(n)},yo.apply(i,arguments)}const LS=new Date,FS=new Date;function gr(t,e,n,r){function i(o){return t(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(t(o=new Date(+o)),o),i.ceil=o=>(t(o=new Date(o-1)),e(o,1),t(o),o),i.round=o=>{const s=i(o),l=i.ceil(o);return o-s(e(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,l)=>{const c=[];if(o=i.ceil(o),l=l==null?1:Math.floor(l),!(o0))return c;let u;do c.push(u=new Date(+o)),e(o,l),t(o);while(ugr(s=>{if(s>=s)for(;t(s),!o(s);)s.setTime(s-1)},(s,l)=>{if(s>=s)if(l<0)for(;++l<=0;)for(;e(s,-1),!o(s););else for(;--l>=0;)for(;e(s,1),!o(s););}),n&&(i.count=(o,s)=>(LS.setTime(+o),FS.setTime(+s),t(LS),t(FS),Math.floor(n(LS,FS))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?s=>r(s)%o===0:s=>i.count(0,s)%o===0):i)),i}const Mx=gr(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Mx.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?gr(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Mx);Mx.range;const ra=1e3,lo=ra*60,ia=lo*60,wa=ia*24,GT=wa*7,k2=wa*30,US=wa*365,bc=gr(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*ra)},(t,e)=>(e-t)/ra,t=>t.getUTCSeconds());bc.range;const KT=gr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*ra)},(t,e)=>{t.setTime(+t+e*lo)},(t,e)=>(e-t)/lo,t=>t.getMinutes());KT.range;const WT=gr(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*lo)},(t,e)=>(e-t)/lo,t=>t.getUTCMinutes());WT.range;const qT=gr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*ra-t.getMinutes()*lo)},(t,e)=>{t.setTime(+t+e*ia)},(t,e)=>(e-t)/ia,t=>t.getHours());qT.range;const YT=gr(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*ia)},(t,e)=>(e-t)/ia,t=>t.getUTCHours());YT.range;const hg=gr(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*lo)/wa,t=>t.getDate()-1);hg.range;const nw=gr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/wa,t=>t.getUTCDate()-1);nw.range;const a8=gr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/wa,t=>Math.floor(t/wa));a8.range;function pu(t){return gr(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*lo)/GT)}const rw=pu(0),Dx=pu(1),bAe=pu(2),wAe=pu(3),Hd=pu(4),SAe=pu(5),CAe=pu(6);rw.range;Dx.range;bAe.range;wAe.range;Hd.range;SAe.range;CAe.range;function mu(t){return gr(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/GT)}const iw=mu(0),$x=mu(1),AAe=mu(2),_Ae=mu(3),zd=mu(4),jAe=mu(5),EAe=mu(6);iw.range;$x.range;AAe.range;_Ae.range;zd.range;jAe.range;EAe.range;const QT=gr(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());QT.range;const XT=gr(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());XT.range;const Sa=gr(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Sa.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:gr(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Sa.range;const Ca=gr(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Ca.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:gr(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});Ca.range;function l8(t,e,n,r,i,o){const s=[[bc,1,ra],[bc,5,5*ra],[bc,15,15*ra],[bc,30,30*ra],[o,1,lo],[o,5,5*lo],[o,15,15*lo],[o,30,30*lo],[i,1,ia],[i,3,3*ia],[i,6,6*ia],[i,12,12*ia],[r,1,wa],[r,2,2*wa],[n,1,GT],[e,1,k2],[e,3,3*k2],[t,1,US]];function l(u,d,f){const h=dv).right(s,h);if(p===s.length)return t.every(TA(u/US,d/US,f));if(p===0)return Mx.every(Math.max(TA(u,d,f),1));const[g,m]=s[h/s[p-1][2]53)return null;"w"in ne||(ne.w=1),"Z"in ne?(Fe=HS(uh(ne.y,0,1)),vt=Fe.getUTCDay(),Fe=vt>4||vt===0?$x.ceil(Fe):$x(Fe),Fe=nw.offset(Fe,(ne.V-1)*7),ne.y=Fe.getUTCFullYear(),ne.m=Fe.getUTCMonth(),ne.d=Fe.getUTCDate()+(ne.w+6)%7):(Fe=BS(uh(ne.y,0,1)),vt=Fe.getDay(),Fe=vt>4||vt===0?Dx.ceil(Fe):Dx(Fe),Fe=hg.offset(Fe,(ne.V-1)*7),ne.y=Fe.getFullYear(),ne.m=Fe.getMonth(),ne.d=Fe.getDate()+(ne.w+6)%7)}else("W"in ne||"U"in ne)&&("w"in ne||(ne.w="u"in ne?ne.u%7:"W"in ne?1:0),vt="Z"in ne?HS(uh(ne.y,0,1)).getUTCDay():BS(uh(ne.y,0,1)).getDay(),ne.m=0,ne.d="W"in ne?(ne.w+6)%7+ne.W*7-(vt+5)%7:ne.w+ne.U*7-(vt+6)%7);return"Z"in ne?(ne.H+=ne.Z/100|0,ne.M+=ne.Z%100,HS(ne)):BS(ne)}}function j(pe,Se,Te,ne){for(var rt=0,Fe=Se.length,vt=Te.length,mt,Bt;rt=vt)return-1;if(mt=Se.charCodeAt(rt++),mt===37){if(mt=Se.charAt(rt++),Bt=C[mt in O2?Se.charAt(rt++):mt],!Bt||(ne=Bt(pe,Te,ne))<0)return-1}else if(mt!=Te.charCodeAt(ne++))return-1}return ne}function k(pe,Se,Te){var ne=u.exec(Se.slice(Te));return ne?(pe.p=d.get(ne[0].toLowerCase()),Te+ne[0].length):-1}function P(pe,Se,Te){var ne=p.exec(Se.slice(Te));return ne?(pe.w=g.get(ne[0].toLowerCase()),Te+ne[0].length):-1}function R(pe,Se,Te){var ne=f.exec(Se.slice(Te));return ne?(pe.w=h.get(ne[0].toLowerCase()),Te+ne[0].length):-1}function E(pe,Se,Te){var ne=b.exec(Se.slice(Te));return ne?(pe.m=x.get(ne[0].toLowerCase()),Te+ne[0].length):-1}function I(pe,Se,Te){var ne=m.exec(Se.slice(Te));return ne?(pe.m=v.get(ne[0].toLowerCase()),Te+ne[0].length):-1}function L(pe,Se,Te){return j(pe,e,Se,Te)}function V(pe,Se,Te){return j(pe,n,Se,Te)}function $(pe,Se,Te){return j(pe,r,Se,Te)}function z(pe){return s[pe.getDay()]}function M(pe){return o[pe.getDay()]}function U(pe){return c[pe.getMonth()]}function K(pe){return l[pe.getMonth()]}function X(pe){return i[+(pe.getHours()>=12)]}function re(pe){return 1+~~(pe.getMonth()/3)}function xe(pe){return s[pe.getUTCDay()]}function F(pe){return o[pe.getUTCDay()]}function ue(pe){return c[pe.getUTCMonth()]}function ie(pe){return l[pe.getUTCMonth()]}function ce(pe){return i[+(pe.getUTCHours()>=12)]}function Me(pe){return 1+~~(pe.getUTCMonth()/3)}return{format:function(pe){var Se=A(pe+="",w);return Se.toString=function(){return pe},Se},parse:function(pe){var Se=_(pe+="",!1);return Se.toString=function(){return pe},Se},utcFormat:function(pe){var Se=A(pe+="",S);return Se.toString=function(){return pe},Se},utcParse:function(pe){var Se=_(pe+="",!0);return Se.toString=function(){return pe},Se}}}var O2={"-":"",_:" ",0:"0"},Ar=/^\s*\d+/,IAe=/^%/,RAe=/[\\^$*+?|[\]().{}]/g;function Xt(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o[e.toLowerCase(),n]))}function DAe(t,e,n){var r=Ar.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function $Ae(t,e,n){var r=Ar.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function LAe(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function FAe(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function UAe(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function I2(t,e,n){var r=Ar.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function R2(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function BAe(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function HAe(t,e,n){var r=Ar.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function zAe(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function M2(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function VAe(t,e,n){var r=Ar.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function D2(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function GAe(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function KAe(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function WAe(t,e,n){var r=Ar.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function qAe(t,e,n){var r=Ar.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function YAe(t,e,n){var r=IAe.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function QAe(t,e,n){var r=Ar.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function XAe(t,e,n){var r=Ar.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function $2(t,e){return Xt(t.getDate(),e,2)}function ZAe(t,e){return Xt(t.getHours(),e,2)}function JAe(t,e){return Xt(t.getHours()%12||12,e,2)}function e_e(t,e){return Xt(1+hg.count(Sa(t),t),e,3)}function c8(t,e){return Xt(t.getMilliseconds(),e,3)}function t_e(t,e){return c8(t,e)+"000"}function n_e(t,e){return Xt(t.getMonth()+1,e,2)}function r_e(t,e){return Xt(t.getMinutes(),e,2)}function i_e(t,e){return Xt(t.getSeconds(),e,2)}function o_e(t){var e=t.getDay();return e===0?7:e}function s_e(t,e){return Xt(rw.count(Sa(t)-1,t),e,2)}function u8(t){var e=t.getDay();return e>=4||e===0?Hd(t):Hd.ceil(t)}function a_e(t,e){return t=u8(t),Xt(Hd.count(Sa(t),t)+(Sa(t).getDay()===4),e,2)}function l_e(t){return t.getDay()}function c_e(t,e){return Xt(Dx.count(Sa(t)-1,t),e,2)}function u_e(t,e){return Xt(t.getFullYear()%100,e,2)}function d_e(t,e){return t=u8(t),Xt(t.getFullYear()%100,e,2)}function f_e(t,e){return Xt(t.getFullYear()%1e4,e,4)}function h_e(t,e){var n=t.getDay();return t=n>=4||n===0?Hd(t):Hd.ceil(t),Xt(t.getFullYear()%1e4,e,4)}function p_e(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Xt(e/60|0,"0",2)+Xt(e%60,"0",2)}function L2(t,e){return Xt(t.getUTCDate(),e,2)}function m_e(t,e){return Xt(t.getUTCHours(),e,2)}function g_e(t,e){return Xt(t.getUTCHours()%12||12,e,2)}function v_e(t,e){return Xt(1+nw.count(Ca(t),t),e,3)}function d8(t,e){return Xt(t.getUTCMilliseconds(),e,3)}function y_e(t,e){return d8(t,e)+"000"}function x_e(t,e){return Xt(t.getUTCMonth()+1,e,2)}function b_e(t,e){return Xt(t.getUTCMinutes(),e,2)}function w_e(t,e){return Xt(t.getUTCSeconds(),e,2)}function S_e(t){var e=t.getUTCDay();return e===0?7:e}function C_e(t,e){return Xt(iw.count(Ca(t)-1,t),e,2)}function f8(t){var e=t.getUTCDay();return e>=4||e===0?zd(t):zd.ceil(t)}function A_e(t,e){return t=f8(t),Xt(zd.count(Ca(t),t)+(Ca(t).getUTCDay()===4),e,2)}function __e(t){return t.getUTCDay()}function j_e(t,e){return Xt($x.count(Ca(t)-1,t),e,2)}function E_e(t,e){return Xt(t.getUTCFullYear()%100,e,2)}function N_e(t,e){return t=f8(t),Xt(t.getUTCFullYear()%100,e,2)}function T_e(t,e){return Xt(t.getUTCFullYear()%1e4,e,4)}function P_e(t,e){var n=t.getUTCDay();return t=n>=4||n===0?zd(t):zd.ceil(t),Xt(t.getUTCFullYear()%1e4,e,4)}function k_e(){return"+0000"}function F2(){return"%"}function U2(t){return+t}function B2(t){return Math.floor(+t/1e3)}var Au,h8,p8;O_e({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 O_e(t){return Au=OAe(t),h8=Au.format,Au.parse,p8=Au.utcFormat,Au.utcParse,Au}function I_e(t){return new Date(t)}function R_e(t){return t instanceof Date?+t:+new Date(+t)}function ZT(t,e,n,r,i,o,s,l,c,u){var d=LT(),f=d.invert,h=d.domain,p=u(".%L"),g=u(":%S"),m=u("%I:%M"),v=u("%I %p"),b=u("%a %d"),x=u("%b %d"),w=u("%B"),S=u("%Y");function C(A){return(c(A)e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,o)=>C1e(t,o/r))},n.copy=function(){return y8(e).domain(t)},ka.apply(n,arguments)}function sw(){var t=0,e=.5,n=1,r=1,i,o,s,l,c,u=si,d,f=!1,h;function p(m){return isNaN(m=+m)?h:(m=.5+((m=+d(m))-o)*(r*me}var S8=B_e,H_e=aw,z_e=S8,V_e=$f;function G_e(t){return t&&t.length?H_e(t,V_e,z_e):void 0}var K_e=G_e;const il=en(K_e);function W_e(t,e){return tt.e^o.s<0?1:-1;for(r=o.d.length,i=t.d.length,e=0,n=rt.d[e]^o.s<0?1:-1;return r===i?0:r>i^o.s<0?1:-1};Ke.decimalPlaces=Ke.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*En;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Ke.dividedBy=Ke.div=function(t){return ua(this,new this.constructor(t))};Ke.dividedToIntegerBy=Ke.idiv=function(t){var e=this,n=e.constructor;return gn(ua(e,new n(t),0,1),n.precision)};Ke.equals=Ke.eq=function(t){return!this.cmp(t)};Ke.exponent=function(){return rr(this)};Ke.greaterThan=Ke.gt=function(t){return this.cmp(t)>0};Ke.greaterThanOrEqualTo=Ke.gte=function(t){return this.cmp(t)>=0};Ke.isInteger=Ke.isint=function(){return this.e>this.d.length-2};Ke.isNegative=Ke.isneg=function(){return this.s<0};Ke.isPositive=Ke.ispos=function(){return this.s>0};Ke.isZero=function(){return this.s===0};Ke.lessThan=Ke.lt=function(t){return this.cmp(t)<0};Ke.lessThanOrEqualTo=Ke.lte=function(t){return this.cmp(t)<1};Ke.logarithm=Ke.log=function(t){var e,n=this,r=n.constructor,i=r.precision,o=i+5;if(t===void 0)t=new r(10);else if(t=new r(t),t.s<1||t.eq($i))throw Error(mo+"NaN");if(n.s<1)throw Error(mo+(n.s?"NaN":"-Infinity"));return n.eq($i)?new r(0):(Rn=!1,e=ua(um(n,o),um(t,o),o),Rn=!0,gn(e,i))};Ke.minus=Ke.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?E8(e,t):_8(e,(t.s=-t.s,t))};Ke.modulo=Ke.mod=function(t){var e,n=this,r=n.constructor,i=r.precision;if(t=new r(t),!t.s)throw Error(mo+"NaN");return n.s?(Rn=!1,e=ua(n,t,0,1).times(t),Rn=!0,n.minus(e)):gn(new r(n),i)};Ke.naturalExponential=Ke.exp=function(){return j8(this)};Ke.naturalLogarithm=Ke.ln=function(){return um(this)};Ke.negated=Ke.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Ke.plus=Ke.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?_8(e,t):E8(e,(t.s=-t.s,t))};Ke.precision=Ke.sd=function(t){var e,n,r,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Rc+t);if(e=rr(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 t&&e>n?e:n};Ke.squareRoot=Ke.sqrt=function(){var t,e,n,r,i,o,s,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(mo+"NaN")}for(t=rr(l),Rn=!1,i=Math.sqrt(+l),i==0||i==1/0?(e=vs(l.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=Uf((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new c(e)):r=new c(i.toString()),n=c.precision,i=s=n+3;;)if(o=r,r=o.plus(ua(l,o,s+2)).times(.5),vs(o.d).slice(0,s)===(e=vs(r.d)).slice(0,s)){if(e=e.slice(s-3,s+1),i==s&&e=="4999"){if(gn(o,n+1,0),o.times(o).eq(l)){r=o;break}}else if(e!="9999")break;s+=4}return Rn=!0,gn(r,n)};Ke.times=Ke.mul=function(t){var e,n,r,i,o,s,l,c,u,d=this,f=d.constructor,h=d.d,p=(t=new f(t)).d;if(!d.s||!t.s)return new f(0);for(t.s*=d.s,n=d.e+t.e,c=h.length,u=p.length,c=0;){for(e=0,i=c+r;i>r;)l=o[i]+p[r]*h[i-r-1]+e,o[i--]=l%yr|0,e=l/yr|0;o[i]=(o[i]+e)%yr|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=n,Rn?gn(t,f.precision):t};Ke.toDecimalPlaces=Ke.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(Is(t,0,Ff),e===void 0?e=r.rounding:Is(e,0,8),gn(n,t+rr(n)+1,e))};Ke.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=ru(r,!0):(Is(t,0,Ff),e===void 0?e=i.rounding:Is(e,0,8),r=gn(new i(r),t+1,e),n=ru(r,!0,t+1)),n};Ke.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?ru(i):(Is(t,0,Ff),e===void 0?e=o.rounding:Is(e,0,8),r=gn(new o(i),t+rr(i)+1,e),n=ru(r.abs(),!1,t+rr(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};Ke.toInteger=Ke.toint=function(){var t=this,e=t.constructor;return gn(new e(t),rr(t)+1,e.rounding)};Ke.toNumber=function(){return+this};Ke.toPower=Ke.pow=function(t){var e,n,r,i,o,s,l=this,c=l.constructor,u=12,d=+(t=new c(t));if(!t.s)return new c($i);if(l=new c(l),!l.s){if(t.s<1)throw Error(mo+"Infinity");return l}if(l.eq($i))return l;if(r=c.precision,t.eq($i))return gn(l,r);if(e=t.e,n=t.d.length-1,s=e>=n,o=l.s,s){if((n=d<0?-d:d)<=A8){for(i=new c($i),e=Math.ceil(r/En+4),Rn=!1;n%2&&(i=i.times(l),V2(i.d,e)),n=Uf(n/2),n!==0;)l=l.times(l),V2(l.d,e);return Rn=!0,t.s<0?new c($i).div(i):gn(i,r)}}else if(o<0)throw Error(mo+"NaN");return o=o<0&&t.d[Math.max(e,n)]&1?-1:1,l.s=1,Rn=!1,i=t.times(um(l,r+u)),Rn=!0,i=j8(i),i.s=o,i};Ke.toPrecision=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?(n=rr(i),r=ru(i,n<=o.toExpNeg||n>=o.toExpPos)):(Is(t,1,Ff),e===void 0?e=o.rounding:Is(e,0,8),i=gn(new o(i),t,e),n=rr(i),r=ru(i,t<=n||n<=o.toExpNeg,t)),r};Ke.toSignificantDigits=Ke.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(Is(t,1,Ff),e===void 0?e=r.rounding:Is(e,0,8)),gn(new r(n),t,e)};Ke.toString=Ke.valueOf=Ke.val=Ke.toJSON=Ke[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=rr(t),n=t.constructor;return ru(t,e<=n.toExpNeg||e>=n.toExpPos)};function _8(t,e){var n,r,i,o,s,l,c,u,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),Rn?gn(e,f):e;if(c=t.d,u=e.d,s=t.e,i=e.e,c=c.slice(),o=s-i,o){for(o<0?(r=c,o=-o,l=u.length):(r=u,i=s,l=c.length),s=Math.ceil(f/En),l=s>l?s+1:l+1,o>l&&(o=l,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(l=c.length,o=u.length,l-o<0&&(o=l,r=u,u=c,c=r),n=0;o;)n=(c[--o]=c[o]+u[o]+n)/yr|0,c[o]%=yr;for(n&&(c.unshift(n),++i),l=c.length;c[--l]==0;)c.pop();return e.d=c,e.e=i,Rn?gn(e,f):e}function Is(t,e,n){if(t!==~~t||tn)throw Error(Rc+t)}function vs(t){var e,n,r,i=t.length-1,o="",s=t[0];if(i>0){for(o+=s,e=1;es?1:-1;else for(l=c=0;li[l]?1:-1;break}return c}function n(r,i,o){for(var s=0;o--;)r[o]-=s,s=r[o]1;)r.shift()}return function(r,i,o,s){var l,c,u,d,f,h,p,g,m,v,b,x,w,S,C,A,_,j,k=r.constructor,P=r.s==i.s?1:-1,R=r.d,E=i.d;if(!r.s)return new k(r);if(!i.s)throw Error(mo+"Division by zero");for(c=r.e-i.e,_=E.length,C=R.length,p=new k(P),g=p.d=[],u=0;E[u]==(R[u]||0);)++u;if(E[u]>(R[u]||0)&&--c,o==null?x=o=k.precision:s?x=o+(rr(r)-rr(i))+1:x=o,x<0)return new k(0);if(x=x/En+2|0,u=0,_==1)for(d=0,E=E[0],x++;(u1&&(E=t(E,d),R=t(R,d),_=E.length,C=R.length),S=_,m=R.slice(0,_),v=m.length;v<_;)m[v++]=0;j=E.slice(),j.unshift(0),A=E[0],E[1]>=yr/2&&++A;do d=0,l=e(E,m,_,v),l<0?(b=m[0],_!=v&&(b=b*yr+(m[1]||0)),d=b/A|0,d>1?(d>=yr&&(d=yr-1),f=t(E,d),h=f.length,v=m.length,l=e(f,m,h,v),l==1&&(d--,n(f,_16)throw Error(tP+rr(t));if(!t.s)return new d($i);for(e==null?(Rn=!1,l=f):l=e,s=new d(.03125);t.abs().gte(.1);)t=t.times(s),u+=5;for(r=Math.log(ac(2,u))/Math.LN10*2+5|0,l+=r,n=i=o=new d($i),d.precision=l;;){if(i=gn(i.times(t),l),n=n.times(++c),s=o.plus(ua(i,n,l)),vs(s.d).slice(0,l)===vs(o.d).slice(0,l)){for(;u--;)o=gn(o.times(o),l);return d.precision=f,e==null?(Rn=!0,gn(o,f)):o}o=s}}function rr(t){for(var e=t.e*En,n=t.d[0];n>=10;n/=10)e++;return e}function zS(t,e,n){if(e>t.LN10.sd())throw Rn=!0,n&&(t.precision=n),Error(mo+"LN10 precision limit exceeded");return gn(new t(t.LN10),e)}function Ha(t){for(var e="";t--;)e+="0";return e}function um(t,e){var n,r,i,o,s,l,c,u,d,f=1,h=10,p=t,g=p.d,m=p.constructor,v=m.precision;if(p.s<1)throw Error(mo+(p.s?"NaN":"-Infinity"));if(p.eq($i))return new m(0);if(e==null?(Rn=!1,u=v):u=e,p.eq(10))return e==null&&(Rn=!0),zS(m,u);if(u+=h,m.precision=u,n=vs(g),r=n.charAt(0),o=rr(p),Math.abs(o)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(t),n=vs(p.d),r=n.charAt(0),f++;o=rr(p),r>1?(p=new m("0."+n),o++):p=new m(r+"."+n.slice(1))}else return c=zS(m,u+2,v).times(o+""),p=um(new m(r+"."+n.slice(1)),u-h).plus(c),m.precision=v,e==null?(Rn=!0,gn(p,v)):p;for(l=s=p=ua(p.minus($i),p.plus($i),u),d=gn(p.times(p),u),i=3;;){if(s=gn(s.times(d),u),c=l.plus(ua(s,new m(i),u)),vs(c.d).slice(0,u)===vs(l.d).slice(0,u))return l=l.times(2),o!==0&&(l=l.plus(zS(m,u+2,v).times(o+""))),l=ua(l,new m(f),u),m.precision=v,e==null?(Rn=!0,gn(l,v)):l;l=c,i+=2}}function z2(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(r,i),e){if(i-=r,n=n-r-1,t.e=Uf(n/En),t.d=[],r=(n+1)%En,n<0&&(r+=En),rLx||t.e<-Lx))throw Error(tP+n)}else t.s=0,t.e=0,t.d=[0];return t}function gn(t,e,n){var r,i,o,s,l,c,u,d,f=t.d;for(s=1,o=f[0];o>=10;o/=10)s++;if(r=e-s,r<0)r+=En,i=e,u=f[d=0];else{if(d=Math.ceil((r+1)/En),o=f.length,d>=o)return t;for(u=o=f[d],s=1;o>=10;o/=10)s++;r%=En,i=r-En+s}if(n!==void 0&&(o=ac(10,s-i-1),l=u/o%10|0,c=e<0||f[d+1]!==void 0||u%o,c=n<4?(l||c)&&(n==0||n==(t.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?i>0?u/ac(10,s-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return c?(o=rr(t),f.length=1,e=e-o-1,f[0]=ac(10,(En-e%En)%En),t.e=Uf(-e/En)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(r==0?(f.length=d,o=1,d--):(f.length=d+1,o=ac(10,En-r),f[d]=i>0?(u/ac(10,s-i)%ac(10,i)|0)*o:0),c)for(;;)if(d==0){(f[0]+=o)==yr&&(f[0]=1,++t.e);break}else{if(f[d]+=o,f[d]!=yr)break;f[d--]=0,o=1}for(r=f.length;f[--r]===0;)f.pop();if(Rn&&(t.e>Lx||t.e<-Lx))throw Error(tP+rr(t));return t}function E8(t,e){var n,r,i,o,s,l,c,u,d,f,h=t.constructor,p=h.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new h(t),Rn?gn(e,p):e;if(c=t.d,f=e.d,r=e.e,u=t.e,c=c.slice(),s=u-r,s){for(d=s<0,d?(n=c,s=-s,l=f.length):(n=f,r=u,l=c.length),i=Math.max(Math.ceil(p/En),l)+2,s>i&&(s=i,n.length=1),n.reverse(),i=s;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>s;){if(c[--i]0?o=o.charAt(0)+"."+o.slice(1)+Ha(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i<0?"e":"e+")+i):i<0?(o="0."+Ha(-i-1)+o,n&&(r=n-s)>0&&(o+=Ha(r))):i>=s?(o+=Ha(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+Ha(r))):((r=i+1)0&&(i+1===s&&(o+="."),o+=Ha(r))),t.s<0?"-"+o:o}function V2(t,e){if(t.length>e)return t.length=e,!0}function N8(t){var e,n,r;function i(o){var s=this;if(!(s instanceof i))return new i(o);if(s.constructor=i,o instanceof i){s.s=o.s,s.e=o.e,s.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(Rc+o);if(o>0)s.s=1;else if(o<0)o=-o,s.s=-1;else{s.s=0,s.e=0,s.d=[0];return}if(o===~~o&&o<1e7){s.e=0,s.d=[o];return}return z2(s,o.toString())}else if(typeof o!="string")throw Error(Rc+o);if(o.charCodeAt(0)===45?(o=o.slice(1),s.s=-1):s.s=1,pje.test(o))z2(s,o);else throw Error(Rc+o)}if(i.prototype=Ke,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=N8,i.config=i.set=mje,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=i[e+1]&&r<=i[e+2])this[n]=r;else throw Error(Rc+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Rc+n+": "+r);return this}var nP=N8(hje);$i=new nP(1);const dn=nP;function gje(t){return bje(t)||xje(t)||yje(t)||vje()}function vje(){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 yje(t,e){if(t){if(typeof t=="string")return RA(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return RA(t,e)}}function xje(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function bje(t){if(Array.isArray(t))return RA(t)}function RA(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=e?n.apply(void 0,i):t(e-s,G2(function(){for(var l=arguments.length,c=new Array(l),u=0;ut.length)&&(e=t.length);for(var n=0,r=new Array(e);n"u"||!(Symbol.iterator in Object(t)))){var n=[],r=!0,i=!1,o=void 0;try{for(var s=t[Symbol.iterator](),l;!(r=(l=s.next()).done)&&(n.push(l.value),!(e&&n.length===e));r=!0);}catch(c){i=!0,o=c}finally{try{!r&&s.return!=null&&s.return()}finally{if(i)throw o}}return n}}function Mje(t){if(Array.isArray(t))return t}function I8(t){var e=dm(t,2),n=e[0],r=e[1],i=n,o=r;return n>r&&(i=r,o=n),[i,o]}function R8(t,e,n){if(t.lte(0))return new dn(0);var r=uw.getDigitCount(t.toNumber()),i=new dn(10).pow(r),o=t.div(i),s=r!==1?.05:.1,l=new dn(Math.ceil(o.div(s).toNumber())).add(n).mul(s),c=l.mul(i);return e?c:new dn(Math.ceil(c))}function Dje(t,e,n){var r=1,i=new dn(t);if(!i.isint()&&n){var o=Math.abs(t);o<1?(r=new dn(10).pow(uw.getDigitCount(t)-1),i=new dn(Math.floor(i.div(r).toNumber())).mul(r)):o>1&&(i=new dn(Math.floor(t)))}else t===0?i=new dn(Math.floor((e-1)/2)):n||(i=new dn(Math.floor(t)));var s=Math.floor((e-1)/2),l=Aje(Cje(function(c){return i.add(new dn(c-s).mul(r)).toNumber()}),MA);return l(0,e)}function M8(t,e,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(n-1)))return{step:new dn(0),tickMin:new dn(0),tickMax:new dn(0)};var o=R8(new dn(e).sub(t).div(n-1),r,i),s;t<=0&&e>=0?s=new dn(0):(s=new dn(t).add(e).div(2),s=s.sub(new dn(s).mod(o)));var l=Math.ceil(s.sub(t).div(o).toNumber()),c=Math.ceil(new dn(e).sub(s).div(o).toNumber()),u=l+c+1;return u>n?M8(t,e,n,r,i+1):(u0?c+(n-u):c,l=e>0?l:l+(n-u)),{step:o,tickMin:s.sub(new dn(l).mul(o)),tickMax:s.add(new dn(c).mul(o))})}function $je(t){var e=dm(t,2),n=e[0],r=e[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=Math.max(i,2),l=I8([n,r]),c=dm(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat($A(MA(0,i-1).map(function(){return 1/0}))):[].concat($A(MA(0,i-1).map(function(){return-1/0})),[d]);return n>r?DA(f):f}if(u===d)return Dje(u,i,o);var h=M8(u,d,s,o),p=h.step,g=h.tickMin,m=h.tickMax,v=uw.rangeStep(g,m.add(new dn(.1).mul(p)),p);return n>r?DA(v):v}function Lje(t,e){var n=dm(t,2),r=n[0],i=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=I8([r,i]),l=dm(s,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(e,2),f=R8(new dn(u).sub(c).div(d-1),o,0),h=[].concat($A(uw.rangeStep(new dn(c),new dn(u).sub(new dn(.99).mul(f)),f)),[u]);return r>i?DA(h):h}var Fje=k8($je),Uje=k8(Lje),Bje="Invariant failed";function iu(t,e){throw new Error(Bje)}var Hje=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Vd(t){"@babel/helpers - typeof";return Vd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vd(t)}function Fx(){return Fx=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Yje(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Qje(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Xje(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,s=-1,l=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(l<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var c=o.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(ii(f-d)!==ii(h-f)){var g=[];if(ii(h-f)===ii(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 v=h+c[1]-c[0];g[0]=Math.min(f,(v+f)/2),g[1]=Math.max(f,(v+f)/2)}var b=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(e>b[0]&&e<=b[1]||e>=g[0]&&e<=g[1]){s=i[u].index;break}}else{var x=Math.min(d,h),w=Math.max(d,h);if(e>(x+f)/2&&e<=(w+f)/2){s=i[u].index;break}}}else for(var S=0;S0&&S(r[S].coordinate+r[S-1].coordinate)/2&&e<=(r[S].coordinate+r[S+1].coordinate)/2||S===l-1&&e>(r[S].coordinate+r[S-1].coordinate)/2){s=r[S].index;break}return s},rP=function(e){var n,r=e,i=r.type.displayName,o=(n=e.type)!==null&&n!==void 0&&n.defaultProps?Vn(Vn({},e.type.defaultProps),e.props):e.props,s=o.stroke,l=o.fill,c;switch(i){case"Line":c=s;break;case"Area":case"Radar":c=s&&s!=="none"?s:l;break;default:c=l;break}return c},pEe=function(e){var n=e.barSize,r=e.totalSize,i=e.stackGroups,o=i===void 0?{}:i;if(!o)return{};for(var s={},l=Object.keys(o),c=0,u=l.length;c=0});if(b&&b.length){var x=b[0].type.defaultProps,w=x!==void 0?Vn(Vn({},x),b[0].props):b[0].props,S=w.barSize,C=w[v];s[C]||(s[C]=[]);var A=Pt(S)?n:S;s[C].push({item:b[0],stackList:b.slice(1),barSize:Pt(A)?void 0:oi(A,r,0)})}}return s},mEe=function(e){var n=e.barGap,r=e.barCategoryGap,i=e.bandSize,o=e.sizeList,s=o===void 0?[]:o,l=e.maxBarSize,c=s.length;if(c<1)return null;var u=oi(n,i,0,!0),d,f=[];if(s[0].barSize===+s[0].barSize){var h=!1,p=i/c,g=s.reduce(function(S,C){return S+C.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,v={offset:m-u,size:0};d=s.reduce(function(S,C){var A={item:C.item,position:{offset:v.offset+v.size+u,size:h?p:C.barSize}},_=[].concat(q2(S),[A]);return v=_[_.length-1].position,C.stackList&&C.stackList.length&&C.stackList.forEach(function(j){_.push({item:j,position:v})}),_},f)}else{var b=oi(r,i,0,!0);i-2*b-(c-1)*u<=0&&(u=0);var x=(i-2*b-(c-1)*u)/c;x>1&&(x>>=0);var w=l===+l?Math.min(x,l):x;d=s.reduce(function(S,C,A){var _=[].concat(q2(S),[{item:C.item,position:{offset:b+(x+u)*A+(x-w)/2,size:w}}]);return C.stackList&&C.stackList.length&&C.stackList.forEach(function(j){_.push({item:j,position:_[_.length-1].position})}),_},f)}return d},gEe=function(e,n,r,i){var o=r.children,s=r.width,l=r.margin,c=s-(l.left||0)-(l.right||0),u=F8({children:o,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"&&Ne(e[p]))return Vn(Vn({},e),{},ud({},p,e[p]+(f||0)));if((m==="horizontal"||m==="vertical"&&p==="center")&&g!=="middle"&&Ne(e[g]))return Vn(Vn({},e),{},ud({},g,e[g]+(h||0)))}return e},vEe=function(e,n,r){return Pt(n)?!0:e==="horizontal"?n==="yAxis":e==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},U8=function(e,n,r,i,o){var s=n.props.children,l=fo(s,dw).filter(function(u){return vEe(i,o,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return e.reduce(function(u,d){var f=qn(d,r);if(Pt(f))return u;var h=Array.isArray(f)?[lw(f),il(f)]:[f,f],p=c.reduce(function(g,m){var v=qn(d,m,0),b=h[0]-Math.abs(Array.isArray(v)?v[0]:v),x=h[1]+Math.abs(Array.isArray(v)?v[1]:v);return[Math.min(b,g[0]),Math.max(x,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},yEe=function(e,n,r,i,o){var s=n.map(function(l){return U8(e,l,r,o,i)}).filter(function(l){return!Pt(l)});return s&&s.length?s.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},B8=function(e,n,r,i,o){var s=n.map(function(c){var u=c.props.dataKey;return r==="number"&&u&&U8(e,c,u,i)||Yh(e,u,r,o)});if(r==="number")return s.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return s.reduce(function(c,u){for(var d=0,f=u.length;d=2?ii(l[0]-l[1])*2*u:u,n&&(e.ticks||e.niceTicks)){var d=(e.ticks||e.niceTicks).map(function(f){var h=o?o.indexOf(f):f;return{coordinate:i(h)+u,value:f,offset:u}});return d.filter(function(f){return!If(f.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(f,h){return{coordinate:i(f)+u,value:f,index:h,offset:u}}):i.ticks&&!r?i.ticks(e.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:o?o[f]:f,index:h,offset:u}})},VS=new WeakMap,ov=function(e,n){if(typeof n!="function")return e;VS.has(e)||VS.set(e,new WeakMap);var r=VS.get(e);if(r.has(n))return r.get(n);var i=function(){e.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,i),i},V8=function(e,n,r){var i=e.scale,o=e.type,s=e.layout,l=e.axisType;if(i==="auto")return s==="radial"&&l==="radiusAxis"?{scale:om(),realScaleType:"band"}:s==="radial"&&l==="angleAxis"?{scale:Rx(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:qh(),realScaleType:"point"}:o==="category"?{scale:om(),realScaleType:"band"}:{scale:Rx(),realScaleType:"linear"};if(ag(i)){var c="scale".concat(q0(i));return{scale:(H2[c]||qh)(),realScaleType:H2[c]?c:"point"}}return xt(i)?{scale:i}:{scale:qh(),realScaleType:"point"}},Q2=1e-4,G8=function(e){var n=e.domain();if(!(!n||n.length<=2)){var r=n.length,i=e.range(),o=Math.min(i[0],i[1])-Q2,s=Math.max(i[0],i[1])+Q2,l=e(n[0]),c=e(n[r-1]);(ls||cs)&&e.domain([n[0],n[r-1]])}},xEe=function(e,n){if(!e)return null;for(var r=0,i=e.length;ri)&&(o[1]=i),o[0]>i&&(o[0]=i),o[1]=0?(e[l][r][0]=o,e[l][r][1]=o+c,o=e[l][r][1]):(e[l][r][0]=s,e[l][r][1]=s+c,s=e[l][r][1])}},SEe=function(e){var n=e.length;if(!(n<=0))for(var r=0,i=e[0].length;r=0?(e[s][r][0]=o,e[s][r][1]=o+l,o=e[s][r][1]):(e[s][r][0]=0,e[s][r][1]=0)}},CEe={sign:wEe,expand:Hme,none:Dd,silhouette:zme,wiggle:Vme,positive:SEe},AEe=function(e,n,r){var i=n.map(function(l){return l.props.dataKey}),o=CEe[r],s=Bme().keys(i).value(function(l,c){return+qn(l,c,0)}).order(dA).offset(o);return s(e)},_Ee=function(e,n,r,i,o,s){if(!e)return null;var l=s?n.reverse():n,c={},u=l.reduce(function(f,h){var p,g=(p=h.type)!==null&&p!==void 0&&p.defaultProps?Vn(Vn({},h.type.defaultProps),h.props):h.props,m=g.stackId,v=g.hide;if(v)return f;var b=g[r],x=f[b]||{hasStack:!1,stackGroups:{}};if(mr(m)){var w=x.stackGroups[m]||{numericAxisId:r,cateAxisId:i,items:[]};w.items.push(h),x.hasStack=!0,x.stackGroups[m]=w}else x.stackGroups[Rf("_stackId_")]={numericAxisId:r,cateAxisId:i,items:[h]};return Vn(Vn({},f),{},ud({},b,x))},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,v){var b=p.stackGroups[v];return Vn(Vn({},m),{},ud({},v,{numericAxisId:r,cateAxisId:i,items:b.items,stackedData:AEe(e,b.items,o)}))},g)}return Vn(Vn({},f),{},ud({},h,p))},d)},K8=function(e,n){var r=n.realScaleType,i=n.type,o=n.tickCount,s=n.originalDomain,l=n.allowDecimals,c=r||n.scale;if(c!=="auto"&&c!=="linear")return null;if(o&&i==="number"&&s&&(s[0]==="auto"||s[1]==="auto")){var u=e.domain();if(!u.length)return null;var d=Fje(u,o,l);return e.domain([lw(d),il(d)]),{niceTicks:d}}if(o&&i==="number"){var f=e.domain(),h=Uje(f,o,l);return{niceTicks:h}}return null};function X2(t){var e=t.axis,n=t.ticks,r=t.bandSize,i=t.entry,o=t.index,s=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Pt(i[e.dataKey])){var l=hx(n,"value",i[e.dataKey]);if(l)return l.coordinate+r/2}return n[o]?n[o].coordinate+r/2:null}var c=qn(i,Pt(s)?e.dataKey:s);return Pt(c)?null:e.scale(c)}var Z2=function(e){var n=e.axis,r=e.ticks,i=e.offset,o=e.bandSize,s=e.entry,l=e.index;if(n.type==="category")return r[l]?r[l].coordinate+i:null;var c=qn(s,n.dataKey,n.domain[l]);return Pt(c)?null:n.scale(c)-o/2+i},jEe=function(e){var n=e.numericAxis,r=n.scale.domain();if(n.type==="number"){var i=Math.min(r[0],r[1]),o=Math.max(r[0],r[1]);return i<=0&&o>=0?0:o<0?o:i}return r[0]},EEe=function(e,n){var r,i=(r=e.type)!==null&&r!==void 0&&r.defaultProps?Vn(Vn({},e.type.defaultProps),e.props):e.props,o=i.stackId;if(mr(o)){var s=n[o];if(s){var l=s.items.indexOf(e);return l>=0?s.stackedData[l]:null}}return null},NEe=function(e){return e.reduce(function(n,r){return[lw(r.concat([n[0]]).filter(Ne)),il(r.concat([n[1]]).filter(Ne))]},[1/0,-1/0])},W8=function(e,n,r){return Object.keys(e).reduce(function(i,o){var s=e[o],l=s.stackedData,c=l.reduce(function(u,d){var f=NEe(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})},J2=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,eM=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,BA=function(e,n,r){if(xt(e))return e(n,r);if(!Array.isArray(e))return n;var i=[];if(Ne(e[0]))i[0]=r?e[0]:Math.min(e[0],n[0]);else if(J2.test(e[0])){var o=+J2.exec(e[0])[1];i[0]=n[0]-o}else xt(e[0])?i[0]=e[0](n[0]):i[0]=n[0];if(Ne(e[1]))i[1]=r?e[1]:Math.max(e[1],n[1]);else if(eM.test(e[1])){var s=+eM.exec(e[1])[1];i[1]=n[1]+s}else xt(e[1])?i[1]=e[1](n[1]):i[1]=n[1];return i},Bx=function(e,n,r){if(e&&e.scale&&e.scale.bandwidth){var i=e.scale.bandwidth();if(!r||i>0)return i}if(e&&n&&n.length>=2){for(var o=kT(n,function(f){return f.coordinate}),s=1/0,l=1,c=o.length;lt.length)&&(e=t.length);for(var n=0,r=new Array(e);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},X8=function(e,n,r,i,o){var s=e.width,l=e.height,c=e.startAngle,u=e.endAngle,d=oi(e.cx,s,s/2),f=oi(e.cy,l,l/2),h=Q8(s,l,r),p=oi(e.innerRadius,h,0),g=oi(e.outerRadius,h,h*.8),m=Object.keys(n);return m.reduce(function(v,b){var x=n[b],w=x.domain,S=x.reversed,C;if(Pt(x.range))i==="angleAxis"?C=[c,u]:i==="radiusAxis"&&(C=[p,g]),S&&(C=[C[1],C[0]]);else{C=x.range;var A=C,_=kEe(A,2);c=_[0],u=_[1]}var j=V8(x,o),k=j.realScaleType,P=j.scale;P.domain(w).range(C),G8(P);var R=K8(P,qs(qs({},x),{},{realScaleType:k})),E=qs(qs(qs({},x),R),{},{range:C,radius:g,realScaleType:k,scale:P,cx:d,cy:f,innerRadius:p,outerRadius:g,startAngle:c,endAngle:u});return qs(qs({},v),{},Y8({},b,E))},{})},$Ee=function(e,n){var r=e.x,i=e.y,o=n.x,s=n.y;return Math.sqrt(Math.pow(r-o,2)+Math.pow(i-s,2))},LEe=function(e,n){var r=e.x,i=e.y,o=n.cx,s=n.cy,l=$Ee({x:r,y:i},{x:o,y:s});if(l<=0)return{radius:l};var c=(r-o)/l,u=Math.acos(c);return i>s&&(u=2*Math.PI-u),{radius:l,angle:DEe(u),angleInRadian:u}},FEe=function(e){var n=e.startAngle,r=e.endAngle,i=Math.floor(n/360),o=Math.floor(r/360),s=Math.min(i,o);return{startAngle:n-s*360,endAngle:r-s*360}},UEe=function(e,n){var r=n.startAngle,i=n.endAngle,o=Math.floor(r/360),s=Math.floor(i/360),l=Math.min(o,s);return e+l*360},iM=function(e,n){var r=e.x,i=e.y,o=LEe({x:r,y:i},n),s=o.radius,l=o.angle,c=n.innerRadius,u=n.outerRadius;if(su)return!1;if(s===0)return!0;var d=FEe(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?qs(qs({},n),{},{radius:s,angle:UEe(p,n)}):null},Z8=function(e){return!y.isValidElement(e)&&!xt(e)&&typeof e!="boolean"?e.className:""};function mm(t){"@babel/helpers - typeof";return mm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mm(t)}var BEe=["offset"];function HEe(t){return KEe(t)||GEe(t)||VEe(t)||zEe()}function zEe(){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 VEe(t,e){if(t){if(typeof t=="string")return HA(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return HA(t,e)}}function GEe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function KEe(t){if(Array.isArray(t))return HA(t)}function HA(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function qEe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function oM(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function or(t){for(var e=1;e=0?1:-1,w,S;i==="insideStart"?(w=p+x*s,S=m):i==="insideEnd"?(w=g-x*s,S=!m):i==="end"&&(w=g+x*s,S=m),S=b<=0?S:!S;var C=Jt(u,d,v,w),A=Jt(u,d,v,w+(S?1:-1)*359),_="M".concat(C.x,",").concat(C.y,` + height and width.`,V,$,s,c,d,f,n);var z=!Array.isArray(p)&&la(p.type).endsWith("Chart");return T.Children.map(p,function(M){return Iz.isElement(M)?y.cloneElement(M,Zg({width:V,height:$},z?{style:Zg({height:"100%",width:"100%",maxHeight:$,maxWidth:V},M.props.style)}:{})):M})},[n,p,c,h,f,d,k,s]);return T.createElement("div",{id:v?"".concat(v):void 0,className:Et("recharts-responsive-container",b),style:Zg(Zg({},S),{},{width:s,height:c,minWidth:d,minHeight:f,maxHeight:h}),ref:C},E)}),lg=function(e){return null};lg.displayName="Cell";function nm(t){"@babel/helpers - typeof";return nm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nm(t)}function KR(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function AA(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Bo.isSsr)return{width:0,height:0};var r=FCe(n),i=JSON.stringify({text:e,copyStyle:r});if(Cu.widthCache[i])return Cu.widthCache[i];try{var o=document.getElementById(WR);o||(o=document.createElement("span"),o.setAttribute("id",WR),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var s=AA(AA({},LCe),r);Object.assign(o.style,s),o.textContent="".concat(e);var l=o.getBoundingClientRect(),c={width:l.width,height:l.height};return Cu.widthCache[i]=c,++Cu.cacheCount>$Ce&&(Cu.cacheCount=0,Cu.widthCache={}),c}catch{return{width:0,height:0}}},UCe=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function rm(t){"@babel/helpers - typeof";return rm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rm(t)}function jx(t,e){return VCe(t)||zCe(t,e)||HCe(t,e)||BCe()}function BCe(){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 HCe(t,e){if(t){if(typeof t=="string")return qR(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qR(t,e)}}function qR(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function i1e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function e2(t,e){return l1e(t)||a1e(t,e)||s1e(t,e)||o1e()}function o1e(){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 s1e(t,e){if(t){if(typeof t=="string")return t2(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t2(t,e)}}function t2(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[];return V.reduce(function($,z){var M=z.word,U=z.width,W=$[$.length-1];if(W&&(i==null||o||W.width+U+rz.width?$:z})};if(!d)return p;for(var m="…",v=function(V){var $=f.slice(0,V),z=BV({breakAll:u,style:c,children:$+m}).wordsWithComputedWidth,M=h(z),U=M.length>s||g(M).width>Number(i);return[U,M]},b=0,x=f.length-1,w=0,S;b<=x&&w<=f.length-1;){var C=Math.floor((b+x)/2),A=C-1,_=v(A),j=e2(_,2),k=j[0],P=j[1],I=v(C),E=e2(I,1),R=E[0];if(!k&&!R&&(b=C+1),k&&R&&(x=C-1),!k&&R){S=P;break}w++}return S||p},n2=function(e){var n=Pt(e)?[]:e.toString().split(UV);return[{words:n}]},u1e=function(e){var n=e.width,r=e.scaleToFit,i=e.children,o=e.style,s=e.breakAll,l=e.maxLines;if((n||r)&&!Bo.isSsr){var c,u,d=BV({breakAll:s,children:i,style:o});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;c=f,u=h}else return n2(i);return c1e({breakAll:s,children:i,maxLines:l,style:o},c,u,n,r)}return n2(i)},r2="#808080",tu=function(e){var n=e.x,r=n===void 0?0:n,i=e.y,o=i===void 0?0:i,s=e.lineHeight,l=s===void 0?"1em":s,c=e.capHeight,u=c===void 0?"0.71em":c,d=e.scaleToFit,f=d===void 0?!1:d,h=e.textAnchor,p=h===void 0?"start":h,g=e.verticalAnchor,m=g===void 0?"end":g,v=e.fill,b=v===void 0?r2:v,x=ZR(e,n1e),w=y.useMemo(function(){return u1e({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:f,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,f,x.style,x.width]),S=x.dx,C=x.dy,A=x.angle,_=x.className,j=x.breakAll,k=ZR(x,r1e);if(!mr(r)||!mr(o))return null;var P=r+(Ee(S)?S:0),I=o+(Ee(C)?C:0),E;switch(m){case"start":E=RS("calc(".concat(u,")"));break;case"middle":E=RS("calc(".concat((w.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:E=RS("calc(".concat(w.length-1," * -").concat(l,")"));break}var R=[];if(f){var L=w[0].width,V=x.width;R.push("scale(".concat((Ee(V)?V/L:1)/L,")"))}return A&&R.push("rotate(".concat(A,", ").concat(P,", ").concat(I,")")),R.length&&(k.transform=R.join(" ")),T.createElement("text",_A({},Ze(k,!0),{x:P,y:I,className:Et("recharts-text",_),textAnchor:p,fill:b.includes("url")?r2:b}),w.map(function($,z){var M=$.words.join(j?"":" ");return T.createElement("tspan",{x:P,dy:z===0?E:l,key:"".concat(M,"-").concat(z)},M)}))};function _l(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function d1e(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function OT(t){let e,n,r;t.length!==2?(e=_l,n=(l,c)=>_l(t(l),c),r=(l,c)=>t(l)-c):(e=t===_l||t===d1e?t:f1e,n=t,r=t);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:s,right:o}}function f1e(){return 0}function HV(t){return t===null?NaN:+t}function*h1e(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const p1e=OT(_l),cg=p1e.right;OT(HV).center;class i2 extends Map{constructor(e,n=v1e){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,i]of e)this.set(r,i)}get(e){return super.get(o2(this,e))}has(e){return super.has(o2(this,e))}set(e,n){return super.set(m1e(this,e),n)}delete(e){return super.delete(g1e(this,e))}}function o2({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function m1e({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function g1e({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function v1e(t){return t!==null&&typeof t=="object"?t.valueOf():t}function y1e(t=_l){if(t===_l)return zV;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function zV(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const x1e=Math.sqrt(50),b1e=Math.sqrt(10),w1e=Math.sqrt(2);function Ex(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=x1e?10:o>=b1e?5:o>=w1e?2:1;let l,c,u;return i<0?(u=Math.pow(10,-i)/s,l=Math.round(t*u),c=Math.round(e*u),l/ue&&--c,u=-u):(u=Math.pow(10,i)*s,l=Math.round(t/u),c=Math.round(e/u),l*ue&&--c),c0))return[];if(t===e)return[t];const r=e=i))return[];const l=o-i+1,c=new Array(l);if(r)if(s<0)for(let u=0;u=r)&&(n=r);return n}function a2(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function VV(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=i===void 0?zV:y1e(i);r>n;){if(r-n>600){const c=r-n+1,u=e-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(e-u*f/c+h)),g=Math.min(r,Math.floor(e+(c-u)*f/c+h));VV(t,e,p,g,i)}const o=t[e];let s=n,l=r;for(lh(t,n,e),i(t[r],o)>0&&lh(t,n,r);s0;)--l}i(t[n],o)===0?lh(t,n,l):(++l,lh(t,l,r)),l<=e&&(n=l+1),e<=l&&(r=l-1)}return t}function lh(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function S1e(t,e,n){if(t=Float64Array.from(h1e(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return a2(t);if(e>=1)return s2(t);var r,i=(r-1)*e,o=Math.floor(i),s=s2(VV(t,o).subarray(0,o+1)),l=a2(t.subarray(o+1));return s+(l-s)*(i-o)}}function C1e(t,e,n=HV){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,o=Math.floor(i),s=+n(t[o],o,t),l=+n(t[o+1],o+1,t);return s+(l-s)*(i-o)}}function A1e(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,o=new Array(i);++r>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?tv(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?tv(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=j1e.exec(t))?new yi(e[1],e[2],e[3],1):(e=E1e.exec(t))?new yi(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=N1e.exec(t))?tv(e[1],e[2],e[3],e[4]):(e=T1e.exec(t))?tv(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=P1e.exec(t))?p2(e[1],e[2]/100,e[3]/100,1):(e=k1e.exec(t))?p2(e[1],e[2]/100,e[3]/100,e[4]):l2.hasOwnProperty(t)?d2(l2[t]):t==="transparent"?new yi(NaN,NaN,NaN,0):null}function d2(t){return new yi(t>>16&255,t>>8&255,t&255,1)}function tv(t,e,n,r){return r<=0&&(t=e=n=NaN),new yi(t,e,n,r)}function R1e(t){return t instanceof ug||(t=am(t)),t?(t=t.rgb(),new yi(t.r,t.g,t.b,t.opacity)):new yi}function PA(t,e,n,r){return arguments.length===1?R1e(t):new yi(t,e,n,r??1)}function yi(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}RT(yi,PA,KV(ug,{brighter(t){return t=t==null?Nx:Math.pow(Nx,t),new yi(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?om:Math.pow(om,t),new yi(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new yi(Ic(this.r),Ic(this.g),Ic(this.b),Tx(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:f2,formatHex:f2,formatHex8:M1e,formatRgb:h2,toString:h2}));function f2(){return`#${xc(this.r)}${xc(this.g)}${xc(this.b)}`}function M1e(){return`#${xc(this.r)}${xc(this.g)}${xc(this.b)}${xc((isNaN(this.opacity)?1:this.opacity)*255)}`}function h2(){const t=Tx(this.opacity);return`${t===1?"rgb(":"rgba("}${Ic(this.r)}, ${Ic(this.g)}, ${Ic(this.b)}${t===1?")":`, ${t})`}`}function Tx(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Ic(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function xc(t){return t=Ic(t),(t<16?"0":"")+t.toString(16)}function p2(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ko(t,e,n,r)}function WV(t){if(t instanceof ko)return new ko(t.h,t.s,t.l,t.opacity);if(t instanceof ug||(t=am(t)),!t)return new ko;if(t instanceof ko)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),s=NaN,l=o-i,c=(o+i)/2;return l?(e===o?s=(n-r)/l+(n0&&c<1?0:s,new ko(s,l,c,t.opacity)}function D1e(t,e,n,r){return arguments.length===1?WV(t):new ko(t,e,n,r??1)}function ko(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}RT(ko,D1e,KV(ug,{brighter(t){return t=t==null?Nx:Math.pow(Nx,t),new ko(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?om:Math.pow(om,t),new ko(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new yi(MS(t>=240?t-240:t+120,i,r),MS(t,i,r),MS(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new ko(m2(this.h),nv(this.s),nv(this.l),Tx(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 t=Tx(this.opacity);return`${t===1?"hsl(":"hsla("}${m2(this.h)}, ${nv(this.s)*100}%, ${nv(this.l)*100}%${t===1?")":`, ${t})`}`}}));function m2(t){return t=(t||0)%360,t<0?t+360:t}function nv(t){return Math.max(0,Math.min(1,t||0))}function MS(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const MT=t=>()=>t;function $1e(t,e){return function(n){return t+n*e}}function L1e(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function F1e(t){return(t=+t)==1?qV:function(e,n){return n-e?L1e(e,n,t):MT(isNaN(e)?n:e)}}function qV(t,e){var n=e-t;return n?$1e(t,n):MT(isNaN(t)?e:t)}const g2=function t(e){var n=F1e(e);function r(i,o){var s=n((i=PA(i)).r,(o=PA(o)).r),l=n(i.g,o.g),c=n(i.b,o.b),u=qV(i.opacity,o.opacity);return function(d){return i.r=s(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return r.gamma=t,r}(1);function U1e(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(o){for(i=0;in&&(o=e.slice(n,o),l[s]?l[s]+=o:l[++s]=o),(r=r[0])===(i=i[0])?l[s]?l[s]+=i:l[++s]=i:(l[++s]=null,c.push({i:s,x:Px(r,i)})),n=DS.lastIndex;return ne&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function X1e(t,e,n){var r=t[0],i=t[1],o=e[0],s=e[1];return i2?J1e:X1e,c=u=null,f}function f(h){return h==null||isNaN(h=+h)?o:(c||(c=l(t.map(r),e,n)))(r(s(h)))}return f.invert=function(h){return s(i((u||(u=l(e,t.map(r),Px)))(h)))},f.domain=function(h){return arguments.length?(t=Array.from(h,kx),d()):t.slice()},f.range=function(h){return arguments.length?(e=Array.from(h),d()):e.slice()},f.rangeRound=function(h){return e=Array.from(h),n=DT,d()},f.clamp=function(h){return arguments.length?(s=h?!0:si,d()):s!==si},f.interpolate=function(h){return arguments.length?(n=h,d()):n},f.unknown=function(h){return arguments.length?(o=h,f):o},function(h,p){return r=h,i=p,d()}}function $T(){return ew()(si,si)}function Z1e(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Ox(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Bd(t){return t=Ox(Math.abs(t)),t?t[1]:NaN}function eAe(t,e){return function(n,r){for(var i=n.length,o=[],s=0,l=t[0],c=0;i>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),o.push(n.substring(i-=l,i+l)),!((c+=l+1)>r));)l=t[s=(s+1)%t.length];return o.reverse().join(e)}}function tAe(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var nAe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function lm(t){if(!(e=nAe.exec(t)))throw new Error("invalid format: "+t);var e;return new LT({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}lm.prototype=LT.prototype;function LT(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}LT.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 rAe(t){e:for(var e=t.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var YV;function iAe(t,e){var n=Ox(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(YV=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Ox(t,Math.max(0,e+o-1))[0]}function y2(t,e){var n=Ox(t,e);if(!n)return t+"";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 x2={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Z1e,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>y2(t*100,e),r:y2,s:iAe,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function b2(t){return t}var w2=Array.prototype.map,S2=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function oAe(t){var e=t.grouping===void 0||t.thousands===void 0?b2:eAe(w2.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?b2:tAe(w2.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function u(f){f=lm(f);var h=f.fill,p=f.align,g=f.sign,m=f.symbol,v=f.zero,b=f.width,x=f.comma,w=f.precision,S=f.trim,C=f.type;C==="n"?(x=!0,C="g"):x2[C]||(w===void 0&&(w=12),S=!0,C="g"),(v||h==="0"&&p==="=")&&(v=!0,h="0",p="=");var A=m==="$"?n:m==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():"",_=m==="$"?r:/[%p]/.test(C)?s:"",j=x2[C],k=/[defgprs%]/.test(C);w=w===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function P(I){var E=A,R=_,L,V,$;if(C==="c")R=j(I)+R,I="";else{I=+I;var z=I<0||1/I<0;if(I=isNaN(I)?c:j(Math.abs(I),w),S&&(I=rAe(I)),z&&+I==0&&g!=="+"&&(z=!1),E=(z?g==="("?g:l:g==="-"||g==="("?"":g)+E,R=(C==="s"?S2[8+YV/3]:"")+R+(z&&g==="("?")":""),k){for(L=-1,V=I.length;++L$||$>57){R=($===46?i+I.slice(L+1):I.slice(L))+R,I=I.slice(0,L);break}}}x&&!v&&(I=e(I,1/0));var M=E.length+I.length+R.length,U=M>1)+E+I+R+U.slice(M);break;default:I=U+E+I+R;break}return o(I)}return P.toString=function(){return f+""},P}function d(f,h){var p=u((f=lm(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(Bd(h)/3)))*3,m=Math.pow(10,-g),v=S2[8+g/3];return function(b){return p(m*b)+v}}return{format:u,formatPrefix:d}}var rv,FT,QV;sAe({thousands:",",grouping:[3],currency:["$",""]});function sAe(t){return rv=oAe(t),FT=rv.format,QV=rv.formatPrefix,rv}function aAe(t){return Math.max(0,-Bd(Math.abs(t)))}function lAe(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Bd(e)/3)))*3-Bd(Math.abs(t)))}function cAe(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Bd(e)-Bd(t))+1}function XV(t,e,n,r){var i=NA(t,e,n),o;switch(r=lm(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(o=lAe(i,s))&&(r.precision=o),QV(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=cAe(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=aAe(i))&&(r.precision=o-(r.type==="%")*2);break}}return FT(r)}function ql(t){var e=t.domain;return t.ticks=function(n){var r=e();return jA(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return XV(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,o=r.length-1,s=r[i],l=r[o],c,u,d=10;for(l0;){if(u=EA(s,l,n),u===c)return r[i]=s,r[o]=l,e(r);if(u>0)s=Math.floor(s/u)*u,l=Math.ceil(l/u)*u;else if(u<0)s=Math.ceil(s*u)/u,l=Math.floor(l*u)/u;else break;c=u}return t},t}function Ix(){var t=$T();return t.copy=function(){return dg(t,Ix())},yo.apply(t,arguments),ql(t)}function JV(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,kx),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return JV(t).unknown(e)},t=arguments.length?Array.from(t,kx):[0,1],ql(n)}function ZV(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],o=t[r],s;return oMath.pow(t,e)}function pAe(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function _2(t){return(e,n)=>-t(-e,n)}function UT(t){const e=t(C2,A2),n=e.domain;let r=10,i,o;function s(){return i=pAe(r),o=hAe(r),n()[0]<0?(i=_2(i),o=_2(o),t(uAe,dAe)):t(C2,A2),e}return e.base=function(l){return arguments.length?(r=+l,s()):r},e.domain=function(l){return arguments.length?(n(l),s()):n()},e.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/o(-h):g*o(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=lm(c)).precision==null&&(c.trim=!0),c=FT(c)),l===1/0)return c;const u=Math.max(1,r*l/e.ticks().length);return d=>{let f=d/o(Math.round(i(d)));return f*rn(ZV(n(),{floor:l=>o(Math.floor(i(l))),ceil:l=>o(Math.ceil(i(l)))})),e}function e8(){const t=UT(ew()).domain([1,10]);return t.copy=()=>dg(t,e8()).base(t.base()),yo.apply(t,arguments),t}function j2(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function E2(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function BT(t){var e=1,n=t(j2(e),E2(e));return n.constant=function(r){return arguments.length?t(j2(e=+r),E2(e)):e},ql(n)}function t8(){var t=BT(ew());return t.copy=function(){return dg(t,t8()).constant(t.constant())},yo.apply(t,arguments)}function N2(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function mAe(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function gAe(t){return t<0?-t*t:t*t}function HT(t){var e=t(si,si),n=1;function r(){return n===1?t(si,si):n===.5?t(mAe,gAe):t(N2(n),N2(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},ql(e)}function zT(){var t=HT(ew());return t.copy=function(){return dg(t,zT()).exponent(t.exponent())},yo.apply(t,arguments),t}function vAe(){return zT.apply(null,arguments).exponent(.5)}function T2(t){return Math.sign(t)*t*t}function yAe(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function n8(){var t=$T(),e=[0,1],n=!1,r;function i(o){var s=yAe(t(o));return isNaN(s)?r:n?Math.round(s):s}return i.invert=function(o){return t.invert(T2(o))},i.domain=function(o){return arguments.length?(t.domain(o),i):t.domain()},i.range=function(o){return arguments.length?(t.range((e=Array.from(o,kx)).map(T2)),i):e.slice()},i.rangeRound=function(o){return i.range(o).round(!0)},i.round=function(o){return arguments.length?(n=!!o,i):n},i.clamp=function(o){return arguments.length?(t.clamp(o),i):t.clamp()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return n8(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},yo.apply(i,arguments),ql(i)}function r8(){var t=[],e=[],n=[],r;function i(){var s=0,l=Math.max(1,e.length);for(n=new Array(l-1);++s0?n[l-1]:t[0],l=n?[r[n-1],e]:[r[u-1],r[u]]},s.unknown=function(c){return arguments.length&&(o=c),s},s.thresholds=function(){return r.slice()},s.copy=function(){return i8().domain([t,e]).range(i).unknown(o)},yo.apply(ql(s),arguments)}function o8(){var t=[.5],e=[0,1],n,r=1;function i(o){return o!=null&&o<=o?e[cg(t,o,0,r)]:n}return i.domain=function(o){return arguments.length?(t=Array.from(o),r=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(o){return arguments.length?(e=Array.from(o),r=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(o){var s=e.indexOf(o);return[t[s-1],t[s]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return o8().domain(t).range(e).unknown(n)},yo.apply(i,arguments)}const $S=new Date,LS=new Date;function gr(t,e,n,r){function i(o){return t(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(t(o=new Date(+o)),o),i.ceil=o=>(t(o=new Date(o-1)),e(o,1),t(o),o),i.round=o=>{const s=i(o),l=i.ceil(o);return o-s(e(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,l)=>{const c=[];if(o=i.ceil(o),l=l==null?1:Math.floor(l),!(o0))return c;let u;do c.push(u=new Date(+o)),e(o,l),t(o);while(ugr(s=>{if(s>=s)for(;t(s),!o(s);)s.setTime(s-1)},(s,l)=>{if(s>=s)if(l<0)for(;++l<=0;)for(;e(s,-1),!o(s););else for(;--l>=0;)for(;e(s,1),!o(s););}),n&&(i.count=(o,s)=>($S.setTime(+o),LS.setTime(+s),t($S),t(LS),Math.floor(n($S,LS))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?s=>r(s)%o===0:s=>i.count(0,s)%o===0):i)),i}const Rx=gr(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Rx.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?gr(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Rx);Rx.range;const ra=1e3,lo=ra*60,ia=lo*60,wa=ia*24,VT=wa*7,P2=wa*30,FS=wa*365,bc=gr(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*ra)},(t,e)=>(e-t)/ra,t=>t.getUTCSeconds());bc.range;const GT=gr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*ra)},(t,e)=>{t.setTime(+t+e*lo)},(t,e)=>(e-t)/lo,t=>t.getMinutes());GT.range;const KT=gr(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*lo)},(t,e)=>(e-t)/lo,t=>t.getUTCMinutes());KT.range;const WT=gr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*ra-t.getMinutes()*lo)},(t,e)=>{t.setTime(+t+e*ia)},(t,e)=>(e-t)/ia,t=>t.getHours());WT.range;const qT=gr(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*ia)},(t,e)=>(e-t)/ia,t=>t.getUTCHours());qT.range;const fg=gr(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*lo)/wa,t=>t.getDate()-1);fg.range;const tw=gr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/wa,t=>t.getUTCDate()-1);tw.range;const s8=gr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/wa,t=>Math.floor(t/wa));s8.range;function pu(t){return gr(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*lo)/VT)}const nw=pu(0),Mx=pu(1),xAe=pu(2),bAe=pu(3),Hd=pu(4),wAe=pu(5),SAe=pu(6);nw.range;Mx.range;xAe.range;bAe.range;Hd.range;wAe.range;SAe.range;function mu(t){return gr(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/VT)}const rw=mu(0),Dx=mu(1),CAe=mu(2),AAe=mu(3),zd=mu(4),_Ae=mu(5),jAe=mu(6);rw.range;Dx.range;CAe.range;AAe.range;zd.range;_Ae.range;jAe.range;const YT=gr(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());YT.range;const QT=gr(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());QT.range;const Sa=gr(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Sa.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:gr(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Sa.range;const Ca=gr(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Ca.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:gr(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});Ca.range;function a8(t,e,n,r,i,o){const s=[[bc,1,ra],[bc,5,5*ra],[bc,15,15*ra],[bc,30,30*ra],[o,1,lo],[o,5,5*lo],[o,15,15*lo],[o,30,30*lo],[i,1,ia],[i,3,3*ia],[i,6,6*ia],[i,12,12*ia],[r,1,wa],[r,2,2*wa],[n,1,VT],[e,1,P2],[e,3,3*P2],[t,1,FS]];function l(u,d,f){const h=dv).right(s,h);if(p===s.length)return t.every(NA(u/FS,d/FS,f));if(p===0)return Rx.every(Math.max(NA(u,d,f),1));const[g,m]=s[h/s[p-1][2]53)return null;"w"in ne||(ne.w=1),"Z"in ne?(Fe=BS(ch(ne.y,0,1)),vt=Fe.getUTCDay(),Fe=vt>4||vt===0?Dx.ceil(Fe):Dx(Fe),Fe=tw.offset(Fe,(ne.V-1)*7),ne.y=Fe.getUTCFullYear(),ne.m=Fe.getUTCMonth(),ne.d=Fe.getUTCDate()+(ne.w+6)%7):(Fe=US(ch(ne.y,0,1)),vt=Fe.getDay(),Fe=vt>4||vt===0?Mx.ceil(Fe):Mx(Fe),Fe=fg.offset(Fe,(ne.V-1)*7),ne.y=Fe.getFullYear(),ne.m=Fe.getMonth(),ne.d=Fe.getDate()+(ne.w+6)%7)}else("W"in ne||"U"in ne)&&("w"in ne||(ne.w="u"in ne?ne.u%7:"W"in ne?1:0),vt="Z"in ne?BS(ch(ne.y,0,1)).getUTCDay():US(ch(ne.y,0,1)).getDay(),ne.m=0,ne.d="W"in ne?(ne.w+6)%7+ne.W*7-(vt+5)%7:ne.w+ne.U*7-(vt+6)%7);return"Z"in ne?(ne.H+=ne.Z/100|0,ne.M+=ne.Z%100,BS(ne)):US(ne)}}function j(pe,Se,Ne,ne){for(var nt=0,Fe=Se.length,vt=Ne.length,mt,Bt;nt=vt)return-1;if(mt=Se.charCodeAt(nt++),mt===37){if(mt=Se.charAt(nt++),Bt=C[mt in k2?Se.charAt(nt++):mt],!Bt||(ne=Bt(pe,Ne,ne))<0)return-1}else if(mt!=Ne.charCodeAt(ne++))return-1}return ne}function k(pe,Se,Ne){var ne=u.exec(Se.slice(Ne));return ne?(pe.p=d.get(ne[0].toLowerCase()),Ne+ne[0].length):-1}function P(pe,Se,Ne){var ne=p.exec(Se.slice(Ne));return ne?(pe.w=g.get(ne[0].toLowerCase()),Ne+ne[0].length):-1}function I(pe,Se,Ne){var ne=f.exec(Se.slice(Ne));return ne?(pe.w=h.get(ne[0].toLowerCase()),Ne+ne[0].length):-1}function E(pe,Se,Ne){var ne=b.exec(Se.slice(Ne));return ne?(pe.m=x.get(ne[0].toLowerCase()),Ne+ne[0].length):-1}function R(pe,Se,Ne){var ne=m.exec(Se.slice(Ne));return ne?(pe.m=v.get(ne[0].toLowerCase()),Ne+ne[0].length):-1}function L(pe,Se,Ne){return j(pe,e,Se,Ne)}function V(pe,Se,Ne){return j(pe,n,Se,Ne)}function $(pe,Se,Ne){return j(pe,r,Se,Ne)}function z(pe){return s[pe.getDay()]}function M(pe){return o[pe.getDay()]}function U(pe){return c[pe.getMonth()]}function W(pe){return l[pe.getMonth()]}function X(pe){return i[+(pe.getHours()>=12)]}function re(pe){return 1+~~(pe.getMonth()/3)}function xe(pe){return s[pe.getUTCDay()]}function F(pe){return o[pe.getUTCDay()]}function fe(pe){return c[pe.getUTCMonth()]}function oe(pe){return l[pe.getUTCMonth()]}function de(pe){return i[+(pe.getUTCHours()>=12)]}function Re(pe){return 1+~~(pe.getUTCMonth()/3)}return{format:function(pe){var Se=A(pe+="",w);return Se.toString=function(){return pe},Se},parse:function(pe){var Se=_(pe+="",!1);return Se.toString=function(){return pe},Se},utcFormat:function(pe){var Se=A(pe+="",S);return Se.toString=function(){return pe},Se},utcParse:function(pe){var Se=_(pe+="",!0);return Se.toString=function(){return pe},Se}}}var k2={"-":"",_:" ",0:"0"},Ar=/^\s*\d+/,OAe=/^%/,IAe=/[\\^$*+?|[\]().{}]/g;function Xt(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o[e.toLowerCase(),n]))}function MAe(t,e,n){var r=Ar.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function DAe(t,e,n){var r=Ar.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function $Ae(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function LAe(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function FAe(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function O2(t,e,n){var r=Ar.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function I2(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function UAe(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function BAe(t,e,n){var r=Ar.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function HAe(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function R2(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function zAe(t,e,n){var r=Ar.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function M2(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function VAe(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function GAe(t,e,n){var r=Ar.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function KAe(t,e,n){var r=Ar.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function WAe(t,e,n){var r=Ar.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function qAe(t,e,n){var r=OAe.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function YAe(t,e,n){var r=Ar.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function QAe(t,e,n){var r=Ar.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function D2(t,e){return Xt(t.getDate(),e,2)}function XAe(t,e){return Xt(t.getHours(),e,2)}function JAe(t,e){return Xt(t.getHours()%12||12,e,2)}function ZAe(t,e){return Xt(1+fg.count(Sa(t),t),e,3)}function l8(t,e){return Xt(t.getMilliseconds(),e,3)}function e_e(t,e){return l8(t,e)+"000"}function t_e(t,e){return Xt(t.getMonth()+1,e,2)}function n_e(t,e){return Xt(t.getMinutes(),e,2)}function r_e(t,e){return Xt(t.getSeconds(),e,2)}function i_e(t){var e=t.getDay();return e===0?7:e}function o_e(t,e){return Xt(nw.count(Sa(t)-1,t),e,2)}function c8(t){var e=t.getDay();return e>=4||e===0?Hd(t):Hd.ceil(t)}function s_e(t,e){return t=c8(t),Xt(Hd.count(Sa(t),t)+(Sa(t).getDay()===4),e,2)}function a_e(t){return t.getDay()}function l_e(t,e){return Xt(Mx.count(Sa(t)-1,t),e,2)}function c_e(t,e){return Xt(t.getFullYear()%100,e,2)}function u_e(t,e){return t=c8(t),Xt(t.getFullYear()%100,e,2)}function d_e(t,e){return Xt(t.getFullYear()%1e4,e,4)}function f_e(t,e){var n=t.getDay();return t=n>=4||n===0?Hd(t):Hd.ceil(t),Xt(t.getFullYear()%1e4,e,4)}function h_e(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Xt(e/60|0,"0",2)+Xt(e%60,"0",2)}function $2(t,e){return Xt(t.getUTCDate(),e,2)}function p_e(t,e){return Xt(t.getUTCHours(),e,2)}function m_e(t,e){return Xt(t.getUTCHours()%12||12,e,2)}function g_e(t,e){return Xt(1+tw.count(Ca(t),t),e,3)}function u8(t,e){return Xt(t.getUTCMilliseconds(),e,3)}function v_e(t,e){return u8(t,e)+"000"}function y_e(t,e){return Xt(t.getUTCMonth()+1,e,2)}function x_e(t,e){return Xt(t.getUTCMinutes(),e,2)}function b_e(t,e){return Xt(t.getUTCSeconds(),e,2)}function w_e(t){var e=t.getUTCDay();return e===0?7:e}function S_e(t,e){return Xt(rw.count(Ca(t)-1,t),e,2)}function d8(t){var e=t.getUTCDay();return e>=4||e===0?zd(t):zd.ceil(t)}function C_e(t,e){return t=d8(t),Xt(zd.count(Ca(t),t)+(Ca(t).getUTCDay()===4),e,2)}function A_e(t){return t.getUTCDay()}function __e(t,e){return Xt(Dx.count(Ca(t)-1,t),e,2)}function j_e(t,e){return Xt(t.getUTCFullYear()%100,e,2)}function E_e(t,e){return t=d8(t),Xt(t.getUTCFullYear()%100,e,2)}function N_e(t,e){return Xt(t.getUTCFullYear()%1e4,e,4)}function T_e(t,e){var n=t.getUTCDay();return t=n>=4||n===0?zd(t):zd.ceil(t),Xt(t.getUTCFullYear()%1e4,e,4)}function P_e(){return"+0000"}function L2(){return"%"}function F2(t){return+t}function U2(t){return Math.floor(+t/1e3)}var Au,f8,h8;k_e({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 k_e(t){return Au=kAe(t),f8=Au.format,Au.parse,h8=Au.utcFormat,Au.utcParse,Au}function O_e(t){return new Date(t)}function I_e(t){return t instanceof Date?+t:+new Date(+t)}function XT(t,e,n,r,i,o,s,l,c,u){var d=$T(),f=d.invert,h=d.domain,p=u(".%L"),g=u(":%S"),m=u("%I:%M"),v=u("%I %p"),b=u("%a %d"),x=u("%b %d"),w=u("%B"),S=u("%Y");function C(A){return(c(A)e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,o)=>S1e(t,o/r))},n.copy=function(){return v8(e).domain(t)},ka.apply(n,arguments)}function ow(){var t=0,e=.5,n=1,r=1,i,o,s,l,c,u=si,d,f=!1,h;function p(m){return isNaN(m=+m)?h:(m=.5+((m=+d(m))-o)*(r*me}var w8=U_e,B_e=sw,H_e=w8,z_e=$f;function V_e(t){return t&&t.length?B_e(t,z_e,H_e):void 0}var G_e=V_e;const il=en(G_e);function K_e(t,e){return tt.e^o.s<0?1:-1;for(r=o.d.length,i=t.d.length,e=0,n=rt.d[e]^o.s<0?1:-1;return r===i?0:r>i^o.s<0?1:-1};Ke.decimalPlaces=Ke.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*En;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Ke.dividedBy=Ke.div=function(t){return ua(this,new this.constructor(t))};Ke.dividedToIntegerBy=Ke.idiv=function(t){var e=this,n=e.constructor;return vn(ua(e,new n(t),0,1),n.precision)};Ke.equals=Ke.eq=function(t){return!this.cmp(t)};Ke.exponent=function(){return rr(this)};Ke.greaterThan=Ke.gt=function(t){return this.cmp(t)>0};Ke.greaterThanOrEqualTo=Ke.gte=function(t){return this.cmp(t)>=0};Ke.isInteger=Ke.isint=function(){return this.e>this.d.length-2};Ke.isNegative=Ke.isneg=function(){return this.s<0};Ke.isPositive=Ke.ispos=function(){return this.s>0};Ke.isZero=function(){return this.s===0};Ke.lessThan=Ke.lt=function(t){return this.cmp(t)<0};Ke.lessThanOrEqualTo=Ke.lte=function(t){return this.cmp(t)<1};Ke.logarithm=Ke.log=function(t){var e,n=this,r=n.constructor,i=r.precision,o=i+5;if(t===void 0)t=new r(10);else if(t=new r(t),t.s<1||t.eq($i))throw Error(mo+"NaN");if(n.s<1)throw Error(mo+(n.s?"NaN":"-Infinity"));return n.eq($i)?new r(0):(Rn=!1,e=ua(cm(n,o),cm(t,o),o),Rn=!0,vn(e,i))};Ke.minus=Ke.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?j8(e,t):A8(e,(t.s=-t.s,t))};Ke.modulo=Ke.mod=function(t){var e,n=this,r=n.constructor,i=r.precision;if(t=new r(t),!t.s)throw Error(mo+"NaN");return n.s?(Rn=!1,e=ua(n,t,0,1).times(t),Rn=!0,n.minus(e)):vn(new r(n),i)};Ke.naturalExponential=Ke.exp=function(){return _8(this)};Ke.naturalLogarithm=Ke.ln=function(){return cm(this)};Ke.negated=Ke.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Ke.plus=Ke.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?A8(e,t):j8(e,(t.s=-t.s,t))};Ke.precision=Ke.sd=function(t){var e,n,r,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Rc+t);if(e=rr(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 t&&e>n?e:n};Ke.squareRoot=Ke.sqrt=function(){var t,e,n,r,i,o,s,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(mo+"NaN")}for(t=rr(l),Rn=!1,i=Math.sqrt(+l),i==0||i==1/0?(e=vs(l.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=Uf((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new c(e)):r=new c(i.toString()),n=c.precision,i=s=n+3;;)if(o=r,r=o.plus(ua(l,o,s+2)).times(.5),vs(o.d).slice(0,s)===(e=vs(r.d)).slice(0,s)){if(e=e.slice(s-3,s+1),i==s&&e=="4999"){if(vn(o,n+1,0),o.times(o).eq(l)){r=o;break}}else if(e!="9999")break;s+=4}return Rn=!0,vn(r,n)};Ke.times=Ke.mul=function(t){var e,n,r,i,o,s,l,c,u,d=this,f=d.constructor,h=d.d,p=(t=new f(t)).d;if(!d.s||!t.s)return new f(0);for(t.s*=d.s,n=d.e+t.e,c=h.length,u=p.length,c=0;){for(e=0,i=c+r;i>r;)l=o[i]+p[r]*h[i-r-1]+e,o[i--]=l%yr|0,e=l/yr|0;o[i]=(o[i]+e)%yr|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=n,Rn?vn(t,f.precision):t};Ke.toDecimalPlaces=Ke.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(Is(t,0,Ff),e===void 0?e=r.rounding:Is(e,0,8),vn(n,t+rr(n)+1,e))};Ke.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=ru(r,!0):(Is(t,0,Ff),e===void 0?e=i.rounding:Is(e,0,8),r=vn(new i(r),t+1,e),n=ru(r,!0,t+1)),n};Ke.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?ru(i):(Is(t,0,Ff),e===void 0?e=o.rounding:Is(e,0,8),r=vn(new o(i),t+rr(i)+1,e),n=ru(r.abs(),!1,t+rr(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};Ke.toInteger=Ke.toint=function(){var t=this,e=t.constructor;return vn(new e(t),rr(t)+1,e.rounding)};Ke.toNumber=function(){return+this};Ke.toPower=Ke.pow=function(t){var e,n,r,i,o,s,l=this,c=l.constructor,u=12,d=+(t=new c(t));if(!t.s)return new c($i);if(l=new c(l),!l.s){if(t.s<1)throw Error(mo+"Infinity");return l}if(l.eq($i))return l;if(r=c.precision,t.eq($i))return vn(l,r);if(e=t.e,n=t.d.length-1,s=e>=n,o=l.s,s){if((n=d<0?-d:d)<=C8){for(i=new c($i),e=Math.ceil(r/En+4),Rn=!1;n%2&&(i=i.times(l),z2(i.d,e)),n=Uf(n/2),n!==0;)l=l.times(l),z2(l.d,e);return Rn=!0,t.s<0?new c($i).div(i):vn(i,r)}}else if(o<0)throw Error(mo+"NaN");return o=o<0&&t.d[Math.max(e,n)]&1?-1:1,l.s=1,Rn=!1,i=t.times(cm(l,r+u)),Rn=!0,i=_8(i),i.s=o,i};Ke.toPrecision=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?(n=rr(i),r=ru(i,n<=o.toExpNeg||n>=o.toExpPos)):(Is(t,1,Ff),e===void 0?e=o.rounding:Is(e,0,8),i=vn(new o(i),t,e),n=rr(i),r=ru(i,t<=n||n<=o.toExpNeg,t)),r};Ke.toSignificantDigits=Ke.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(Is(t,1,Ff),e===void 0?e=r.rounding:Is(e,0,8)),vn(new r(n),t,e)};Ke.toString=Ke.valueOf=Ke.val=Ke.toJSON=Ke[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=rr(t),n=t.constructor;return ru(t,e<=n.toExpNeg||e>=n.toExpPos)};function A8(t,e){var n,r,i,o,s,l,c,u,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),Rn?vn(e,f):e;if(c=t.d,u=e.d,s=t.e,i=e.e,c=c.slice(),o=s-i,o){for(o<0?(r=c,o=-o,l=u.length):(r=u,i=s,l=c.length),s=Math.ceil(f/En),l=s>l?s+1:l+1,o>l&&(o=l,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(l=c.length,o=u.length,l-o<0&&(o=l,r=u,u=c,c=r),n=0;o;)n=(c[--o]=c[o]+u[o]+n)/yr|0,c[o]%=yr;for(n&&(c.unshift(n),++i),l=c.length;c[--l]==0;)c.pop();return e.d=c,e.e=i,Rn?vn(e,f):e}function Is(t,e,n){if(t!==~~t||tn)throw Error(Rc+t)}function vs(t){var e,n,r,i=t.length-1,o="",s=t[0];if(i>0){for(o+=s,e=1;es?1:-1;else for(l=c=0;li[l]?1:-1;break}return c}function n(r,i,o){for(var s=0;o--;)r[o]-=s,s=r[o]1;)r.shift()}return function(r,i,o,s){var l,c,u,d,f,h,p,g,m,v,b,x,w,S,C,A,_,j,k=r.constructor,P=r.s==i.s?1:-1,I=r.d,E=i.d;if(!r.s)return new k(r);if(!i.s)throw Error(mo+"Division by zero");for(c=r.e-i.e,_=E.length,C=I.length,p=new k(P),g=p.d=[],u=0;E[u]==(I[u]||0);)++u;if(E[u]>(I[u]||0)&&--c,o==null?x=o=k.precision:s?x=o+(rr(r)-rr(i))+1:x=o,x<0)return new k(0);if(x=x/En+2|0,u=0,_==1)for(d=0,E=E[0],x++;(u1&&(E=t(E,d),I=t(I,d),_=E.length,C=I.length),S=_,m=I.slice(0,_),v=m.length;v<_;)m[v++]=0;j=E.slice(),j.unshift(0),A=E[0],E[1]>=yr/2&&++A;do d=0,l=e(E,m,_,v),l<0?(b=m[0],_!=v&&(b=b*yr+(m[1]||0)),d=b/A|0,d>1?(d>=yr&&(d=yr-1),f=t(E,d),h=f.length,v=m.length,l=e(f,m,h,v),l==1&&(d--,n(f,_16)throw Error(eP+rr(t));if(!t.s)return new d($i);for(e==null?(Rn=!1,l=f):l=e,s=new d(.03125);t.abs().gte(.1);)t=t.times(s),u+=5;for(r=Math.log(ac(2,u))/Math.LN10*2+5|0,l+=r,n=i=o=new d($i),d.precision=l;;){if(i=vn(i.times(t),l),n=n.times(++c),s=o.plus(ua(i,n,l)),vs(s.d).slice(0,l)===vs(o.d).slice(0,l)){for(;u--;)o=vn(o.times(o),l);return d.precision=f,e==null?(Rn=!0,vn(o,f)):o}o=s}}function rr(t){for(var e=t.e*En,n=t.d[0];n>=10;n/=10)e++;return e}function HS(t,e,n){if(e>t.LN10.sd())throw Rn=!0,n&&(t.precision=n),Error(mo+"LN10 precision limit exceeded");return vn(new t(t.LN10),e)}function Ha(t){for(var e="";t--;)e+="0";return e}function cm(t,e){var n,r,i,o,s,l,c,u,d,f=1,h=10,p=t,g=p.d,m=p.constructor,v=m.precision;if(p.s<1)throw Error(mo+(p.s?"NaN":"-Infinity"));if(p.eq($i))return new m(0);if(e==null?(Rn=!1,u=v):u=e,p.eq(10))return e==null&&(Rn=!0),HS(m,u);if(u+=h,m.precision=u,n=vs(g),r=n.charAt(0),o=rr(p),Math.abs(o)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(t),n=vs(p.d),r=n.charAt(0),f++;o=rr(p),r>1?(p=new m("0."+n),o++):p=new m(r+"."+n.slice(1))}else return c=HS(m,u+2,v).times(o+""),p=cm(new m(r+"."+n.slice(1)),u-h).plus(c),m.precision=v,e==null?(Rn=!0,vn(p,v)):p;for(l=s=p=ua(p.minus($i),p.plus($i),u),d=vn(p.times(p),u),i=3;;){if(s=vn(s.times(d),u),c=l.plus(ua(s,new m(i),u)),vs(c.d).slice(0,u)===vs(l.d).slice(0,u))return l=l.times(2),o!==0&&(l=l.plus(HS(m,u+2,v).times(o+""))),l=ua(l,new m(f),u),m.precision=v,e==null?(Rn=!0,vn(l,v)):l;l=c,i+=2}}function H2(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(r,i),e){if(i-=r,n=n-r-1,t.e=Uf(n/En),t.d=[],r=(n+1)%En,n<0&&(r+=En),r$x||t.e<-$x))throw Error(eP+n)}else t.s=0,t.e=0,t.d=[0];return t}function vn(t,e,n){var r,i,o,s,l,c,u,d,f=t.d;for(s=1,o=f[0];o>=10;o/=10)s++;if(r=e-s,r<0)r+=En,i=e,u=f[d=0];else{if(d=Math.ceil((r+1)/En),o=f.length,d>=o)return t;for(u=o=f[d],s=1;o>=10;o/=10)s++;r%=En,i=r-En+s}if(n!==void 0&&(o=ac(10,s-i-1),l=u/o%10|0,c=e<0||f[d+1]!==void 0||u%o,c=n<4?(l||c)&&(n==0||n==(t.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?i>0?u/ac(10,s-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return c?(o=rr(t),f.length=1,e=e-o-1,f[0]=ac(10,(En-e%En)%En),t.e=Uf(-e/En)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(r==0?(f.length=d,o=1,d--):(f.length=d+1,o=ac(10,En-r),f[d]=i>0?(u/ac(10,s-i)%ac(10,i)|0)*o:0),c)for(;;)if(d==0){(f[0]+=o)==yr&&(f[0]=1,++t.e);break}else{if(f[d]+=o,f[d]!=yr)break;f[d--]=0,o=1}for(r=f.length;f[--r]===0;)f.pop();if(Rn&&(t.e>$x||t.e<-$x))throw Error(eP+rr(t));return t}function j8(t,e){var n,r,i,o,s,l,c,u,d,f,h=t.constructor,p=h.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new h(t),Rn?vn(e,p):e;if(c=t.d,f=e.d,r=e.e,u=t.e,c=c.slice(),s=u-r,s){for(d=s<0,d?(n=c,s=-s,l=f.length):(n=f,r=u,l=c.length),i=Math.max(Math.ceil(p/En),l)+2,s>i&&(s=i,n.length=1),n.reverse(),i=s;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>s;){if(c[--i]0?o=o.charAt(0)+"."+o.slice(1)+Ha(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i<0?"e":"e+")+i):i<0?(o="0."+Ha(-i-1)+o,n&&(r=n-s)>0&&(o+=Ha(r))):i>=s?(o+=Ha(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+Ha(r))):((r=i+1)0&&(i+1===s&&(o+="."),o+=Ha(r))),t.s<0?"-"+o:o}function z2(t,e){if(t.length>e)return t.length=e,!0}function E8(t){var e,n,r;function i(o){var s=this;if(!(s instanceof i))return new i(o);if(s.constructor=i,o instanceof i){s.s=o.s,s.e=o.e,s.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(Rc+o);if(o>0)s.s=1;else if(o<0)o=-o,s.s=-1;else{s.s=0,s.e=0,s.d=[0];return}if(o===~~o&&o<1e7){s.e=0,s.d=[o];return}return H2(s,o.toString())}else if(typeof o!="string")throw Error(Rc+o);if(o.charCodeAt(0)===45?(o=o.slice(1),s.s=-1):s.s=1,hje.test(o))H2(s,o);else throw Error(Rc+o)}if(i.prototype=Ke,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=E8,i.config=i.set=pje,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=i[e+1]&&r<=i[e+2])this[n]=r;else throw Error(Rc+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Rc+n+": "+r);return this}var tP=E8(fje);$i=new tP(1);const fn=tP;function mje(t){return xje(t)||yje(t)||vje(t)||gje()}function gje(){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 vje(t,e){if(t){if(typeof t=="string")return IA(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return IA(t,e)}}function yje(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function xje(t){if(Array.isArray(t))return IA(t)}function IA(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=e?n.apply(void 0,i):t(e-s,V2(function(){for(var l=arguments.length,c=new Array(l),u=0;ut.length)&&(e=t.length);for(var n=0,r=new Array(e);n"u"||!(Symbol.iterator in Object(t)))){var n=[],r=!0,i=!1,o=void 0;try{for(var s=t[Symbol.iterator](),l;!(r=(l=s.next()).done)&&(n.push(l.value),!(e&&n.length===e));r=!0);}catch(c){i=!0,o=c}finally{try{!r&&s.return!=null&&s.return()}finally{if(i)throw o}}return n}}function Rje(t){if(Array.isArray(t))return t}function O8(t){var e=um(t,2),n=e[0],r=e[1],i=n,o=r;return n>r&&(i=r,o=n),[i,o]}function I8(t,e,n){if(t.lte(0))return new fn(0);var r=cw.getDigitCount(t.toNumber()),i=new fn(10).pow(r),o=t.div(i),s=r!==1?.05:.1,l=new fn(Math.ceil(o.div(s).toNumber())).add(n).mul(s),c=l.mul(i);return e?c:new fn(Math.ceil(c))}function Mje(t,e,n){var r=1,i=new fn(t);if(!i.isint()&&n){var o=Math.abs(t);o<1?(r=new fn(10).pow(cw.getDigitCount(t)-1),i=new fn(Math.floor(i.div(r).toNumber())).mul(r)):o>1&&(i=new fn(Math.floor(t)))}else t===0?i=new fn(Math.floor((e-1)/2)):n||(i=new fn(Math.floor(t)));var s=Math.floor((e-1)/2),l=Cje(Sje(function(c){return i.add(new fn(c-s).mul(r)).toNumber()}),RA);return l(0,e)}function R8(t,e,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(n-1)))return{step:new fn(0),tickMin:new fn(0),tickMax:new fn(0)};var o=I8(new fn(e).sub(t).div(n-1),r,i),s;t<=0&&e>=0?s=new fn(0):(s=new fn(t).add(e).div(2),s=s.sub(new fn(s).mod(o)));var l=Math.ceil(s.sub(t).div(o).toNumber()),c=Math.ceil(new fn(e).sub(s).div(o).toNumber()),u=l+c+1;return u>n?R8(t,e,n,r,i+1):(u0?c+(n-u):c,l=e>0?l:l+(n-u)),{step:o,tickMin:s.sub(new fn(l).mul(o)),tickMax:s.add(new fn(c).mul(o))})}function Dje(t){var e=um(t,2),n=e[0],r=e[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=Math.max(i,2),l=O8([n,r]),c=um(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(DA(RA(0,i-1).map(function(){return 1/0}))):[].concat(DA(RA(0,i-1).map(function(){return-1/0})),[d]);return n>r?MA(f):f}if(u===d)return Mje(u,i,o);var h=R8(u,d,s,o),p=h.step,g=h.tickMin,m=h.tickMax,v=cw.rangeStep(g,m.add(new fn(.1).mul(p)),p);return n>r?MA(v):v}function $je(t,e){var n=um(t,2),r=n[0],i=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=O8([r,i]),l=um(s,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(e,2),f=I8(new fn(u).sub(c).div(d-1),o,0),h=[].concat(DA(cw.rangeStep(new fn(c),new fn(u).sub(new fn(.99).mul(f)),f)),[u]);return r>i?MA(h):h}var Lje=P8(Dje),Fje=P8($je),Uje="Invariant failed";function iu(t,e){throw new Error(Uje)}var Bje=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Vd(t){"@babel/helpers - typeof";return Vd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vd(t)}function Lx(){return Lx=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function qje(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Yje(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Qje(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,s=-1,l=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(l<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var c=o.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(ii(f-d)!==ii(h-f)){var g=[];if(ii(h-f)===ii(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 v=h+c[1]-c[0];g[0]=Math.min(f,(v+f)/2),g[1]=Math.max(f,(v+f)/2)}var b=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(e>b[0]&&e<=b[1]||e>=g[0]&&e<=g[1]){s=i[u].index;break}}else{var x=Math.min(d,h),w=Math.max(d,h);if(e>(x+f)/2&&e<=(w+f)/2){s=i[u].index;break}}}else for(var S=0;S0&&S(r[S].coordinate+r[S-1].coordinate)/2&&e<=(r[S].coordinate+r[S+1].coordinate)/2||S===l-1&&e>(r[S].coordinate+r[S-1].coordinate)/2){s=r[S].index;break}return s},nP=function(e){var n,r=e,i=r.type.displayName,o=(n=e.type)!==null&&n!==void 0&&n.defaultProps?Vn(Vn({},e.type.defaultProps),e.props):e.props,s=o.stroke,l=o.fill,c;switch(i){case"Line":c=s;break;case"Area":case"Radar":c=s&&s!=="none"?s:l;break;default:c=l;break}return c},hEe=function(e){var n=e.barSize,r=e.totalSize,i=e.stackGroups,o=i===void 0?{}:i;if(!o)return{};for(var s={},l=Object.keys(o),c=0,u=l.length;c=0});if(b&&b.length){var x=b[0].type.defaultProps,w=x!==void 0?Vn(Vn({},x),b[0].props):b[0].props,S=w.barSize,C=w[v];s[C]||(s[C]=[]);var A=Pt(S)?n:S;s[C].push({item:b[0],stackList:b.slice(1),barSize:Pt(A)?void 0:oi(A,r,0)})}}return s},pEe=function(e){var n=e.barGap,r=e.barCategoryGap,i=e.bandSize,o=e.sizeList,s=o===void 0?[]:o,l=e.maxBarSize,c=s.length;if(c<1)return null;var u=oi(n,i,0,!0),d,f=[];if(s[0].barSize===+s[0].barSize){var h=!1,p=i/c,g=s.reduce(function(S,C){return S+C.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,v={offset:m-u,size:0};d=s.reduce(function(S,C){var A={item:C.item,position:{offset:v.offset+v.size+u,size:h?p:C.barSize}},_=[].concat(W2(S),[A]);return v=_[_.length-1].position,C.stackList&&C.stackList.length&&C.stackList.forEach(function(j){_.push({item:j,position:v})}),_},f)}else{var b=oi(r,i,0,!0);i-2*b-(c-1)*u<=0&&(u=0);var x=(i-2*b-(c-1)*u)/c;x>1&&(x>>=0);var w=l===+l?Math.min(x,l):x;d=s.reduce(function(S,C,A){var _=[].concat(W2(S),[{item:C.item,position:{offset:b+(x+u)*A+(x-w)/2,size:w}}]);return C.stackList&&C.stackList.length&&C.stackList.forEach(function(j){_.push({item:j,position:_[_.length-1].position})}),_},f)}return d},mEe=function(e,n,r,i){var o=r.children,s=r.width,l=r.margin,c=s-(l.left||0)-(l.right||0),u=L8({children:o,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"&&Ee(e[p]))return Vn(Vn({},e),{},ud({},p,e[p]+(f||0)));if((m==="horizontal"||m==="vertical"&&p==="center")&&g!=="middle"&&Ee(e[g]))return Vn(Vn({},e),{},ud({},g,e[g]+(h||0)))}return e},gEe=function(e,n,r){return Pt(n)?!0:e==="horizontal"?n==="yAxis":e==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},F8=function(e,n,r,i,o){var s=n.props.children,l=fo(s,uw).filter(function(u){return gEe(i,o,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return e.reduce(function(u,d){var f=qn(d,r);if(Pt(f))return u;var h=Array.isArray(f)?[aw(f),il(f)]:[f,f],p=c.reduce(function(g,m){var v=qn(d,m,0),b=h[0]-Math.abs(Array.isArray(v)?v[0]:v),x=h[1]+Math.abs(Array.isArray(v)?v[1]:v);return[Math.min(b,g[0]),Math.max(x,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},vEe=function(e,n,r,i,o){var s=n.map(function(l){return F8(e,l,r,o,i)}).filter(function(l){return!Pt(l)});return s&&s.length?s.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},U8=function(e,n,r,i,o){var s=n.map(function(c){var u=c.props.dataKey;return r==="number"&&u&&F8(e,c,u,i)||qh(e,u,r,o)});if(r==="number")return s.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return s.reduce(function(c,u){for(var d=0,f=u.length;d=2?ii(l[0]-l[1])*2*u:u,n&&(e.ticks||e.niceTicks)){var d=(e.ticks||e.niceTicks).map(function(f){var h=o?o.indexOf(f):f;return{coordinate:i(h)+u,value:f,offset:u}});return d.filter(function(f){return!If(f.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(f,h){return{coordinate:i(f)+u,value:f,index:h,offset:u}}):i.ticks&&!r?i.ticks(e.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:o?o[f]:f,index:h,offset:u}})},zS=new WeakMap,iv=function(e,n){if(typeof n!="function")return e;zS.has(e)||zS.set(e,new WeakMap);var r=zS.get(e);if(r.has(n))return r.get(n);var i=function(){e.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,i),i},z8=function(e,n,r){var i=e.scale,o=e.type,s=e.layout,l=e.axisType;if(i==="auto")return s==="radial"&&l==="radiusAxis"?{scale:im(),realScaleType:"band"}:s==="radial"&&l==="angleAxis"?{scale:Ix(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:Wh(),realScaleType:"point"}:o==="category"?{scale:im(),realScaleType:"band"}:{scale:Ix(),realScaleType:"linear"};if(sg(i)){var c="scale".concat(W0(i));return{scale:(B2[c]||Wh)(),realScaleType:B2[c]?c:"point"}}return xt(i)?{scale:i}:{scale:Wh(),realScaleType:"point"}},Y2=1e-4,V8=function(e){var n=e.domain();if(!(!n||n.length<=2)){var r=n.length,i=e.range(),o=Math.min(i[0],i[1])-Y2,s=Math.max(i[0],i[1])+Y2,l=e(n[0]),c=e(n[r-1]);(ls||cs)&&e.domain([n[0],n[r-1]])}},yEe=function(e,n){if(!e)return null;for(var r=0,i=e.length;ri)&&(o[1]=i),o[0]>i&&(o[0]=i),o[1]=0?(e[l][r][0]=o,e[l][r][1]=o+c,o=e[l][r][1]):(e[l][r][0]=s,e[l][r][1]=s+c,s=e[l][r][1])}},wEe=function(e){var n=e.length;if(!(n<=0))for(var r=0,i=e[0].length;r=0?(e[s][r][0]=o,e[s][r][1]=o+l,o=e[s][r][1]):(e[s][r][0]=0,e[s][r][1]=0)}},SEe={sign:bEe,expand:Bme,none:Dd,silhouette:Hme,wiggle:zme,positive:wEe},CEe=function(e,n,r){var i=n.map(function(l){return l.props.dataKey}),o=SEe[r],s=Ume().keys(i).value(function(l,c){return+qn(l,c,0)}).order(uA).offset(o);return s(e)},AEe=function(e,n,r,i,o,s){if(!e)return null;var l=s?n.reverse():n,c={},u=l.reduce(function(f,h){var p,g=(p=h.type)!==null&&p!==void 0&&p.defaultProps?Vn(Vn({},h.type.defaultProps),h.props):h.props,m=g.stackId,v=g.hide;if(v)return f;var b=g[r],x=f[b]||{hasStack:!1,stackGroups:{}};if(mr(m)){var w=x.stackGroups[m]||{numericAxisId:r,cateAxisId:i,items:[]};w.items.push(h),x.hasStack=!0,x.stackGroups[m]=w}else x.stackGroups[Rf("_stackId_")]={numericAxisId:r,cateAxisId:i,items:[h]};return Vn(Vn({},f),{},ud({},b,x))},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,v){var b=p.stackGroups[v];return Vn(Vn({},m),{},ud({},v,{numericAxisId:r,cateAxisId:i,items:b.items,stackedData:CEe(e,b.items,o)}))},g)}return Vn(Vn({},f),{},ud({},h,p))},d)},G8=function(e,n){var r=n.realScaleType,i=n.type,o=n.tickCount,s=n.originalDomain,l=n.allowDecimals,c=r||n.scale;if(c!=="auto"&&c!=="linear")return null;if(o&&i==="number"&&s&&(s[0]==="auto"||s[1]==="auto")){var u=e.domain();if(!u.length)return null;var d=Lje(u,o,l);return e.domain([aw(d),il(d)]),{niceTicks:d}}if(o&&i==="number"){var f=e.domain(),h=Fje(f,o,l);return{niceTicks:h}}return null};function Q2(t){var e=t.axis,n=t.ticks,r=t.bandSize,i=t.entry,o=t.index,s=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Pt(i[e.dataKey])){var l=fx(n,"value",i[e.dataKey]);if(l)return l.coordinate+r/2}return n[o]?n[o].coordinate+r/2:null}var c=qn(i,Pt(s)?e.dataKey:s);return Pt(c)?null:e.scale(c)}var X2=function(e){var n=e.axis,r=e.ticks,i=e.offset,o=e.bandSize,s=e.entry,l=e.index;if(n.type==="category")return r[l]?r[l].coordinate+i:null;var c=qn(s,n.dataKey,n.domain[l]);return Pt(c)?null:n.scale(c)-o/2+i},_Ee=function(e){var n=e.numericAxis,r=n.scale.domain();if(n.type==="number"){var i=Math.min(r[0],r[1]),o=Math.max(r[0],r[1]);return i<=0&&o>=0?0:o<0?o:i}return r[0]},jEe=function(e,n){var r,i=(r=e.type)!==null&&r!==void 0&&r.defaultProps?Vn(Vn({},e.type.defaultProps),e.props):e.props,o=i.stackId;if(mr(o)){var s=n[o];if(s){var l=s.items.indexOf(e);return l>=0?s.stackedData[l]:null}}return null},EEe=function(e){return e.reduce(function(n,r){return[aw(r.concat([n[0]]).filter(Ee)),il(r.concat([n[1]]).filter(Ee))]},[1/0,-1/0])},K8=function(e,n,r){return Object.keys(e).reduce(function(i,o){var s=e[o],l=s.stackedData,c=l.reduce(function(u,d){var f=EEe(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})},J2=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Z2=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,UA=function(e,n,r){if(xt(e))return e(n,r);if(!Array.isArray(e))return n;var i=[];if(Ee(e[0]))i[0]=r?e[0]:Math.min(e[0],n[0]);else if(J2.test(e[0])){var o=+J2.exec(e[0])[1];i[0]=n[0]-o}else xt(e[0])?i[0]=e[0](n[0]):i[0]=n[0];if(Ee(e[1]))i[1]=r?e[1]:Math.max(e[1],n[1]);else if(Z2.test(e[1])){var s=+Z2.exec(e[1])[1];i[1]=n[1]+s}else xt(e[1])?i[1]=e[1](n[1]):i[1]=n[1];return i},Ux=function(e,n,r){if(e&&e.scale&&e.scale.bandwidth){var i=e.scale.bandwidth();if(!r||i>0)return i}if(e&&n&&n.length>=2){for(var o=PT(n,function(f){return f.coordinate}),s=1/0,l=1,c=o.length;lt.length)&&(e=t.length);for(var n=0,r=new Array(e);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},Q8=function(e,n,r,i,o){var s=e.width,l=e.height,c=e.startAngle,u=e.endAngle,d=oi(e.cx,s,s/2),f=oi(e.cy,l,l/2),h=Y8(s,l,r),p=oi(e.innerRadius,h,0),g=oi(e.outerRadius,h,h*.8),m=Object.keys(n);return m.reduce(function(v,b){var x=n[b],w=x.domain,S=x.reversed,C;if(Pt(x.range))i==="angleAxis"?C=[c,u]:i==="radiusAxis"&&(C=[p,g]),S&&(C=[C[1],C[0]]);else{C=x.range;var A=C,_=PEe(A,2);c=_[0],u=_[1]}var j=z8(x,o),k=j.realScaleType,P=j.scale;P.domain(w).range(C),V8(P);var I=G8(P,qs(qs({},x),{},{realScaleType:k})),E=qs(qs(qs({},x),I),{},{range:C,radius:g,realScaleType:k,scale:P,cx:d,cy:f,innerRadius:p,outerRadius:g,startAngle:c,endAngle:u});return qs(qs({},v),{},q8({},b,E))},{})},DEe=function(e,n){var r=e.x,i=e.y,o=n.x,s=n.y;return Math.sqrt(Math.pow(r-o,2)+Math.pow(i-s,2))},$Ee=function(e,n){var r=e.x,i=e.y,o=n.cx,s=n.cy,l=DEe({x:r,y:i},{x:o,y:s});if(l<=0)return{radius:l};var c=(r-o)/l,u=Math.acos(c);return i>s&&(u=2*Math.PI-u),{radius:l,angle:MEe(u),angleInRadian:u}},LEe=function(e){var n=e.startAngle,r=e.endAngle,i=Math.floor(n/360),o=Math.floor(r/360),s=Math.min(i,o);return{startAngle:n-s*360,endAngle:r-s*360}},FEe=function(e,n){var r=n.startAngle,i=n.endAngle,o=Math.floor(r/360),s=Math.floor(i/360),l=Math.min(o,s);return e+l*360},rM=function(e,n){var r=e.x,i=e.y,o=$Ee({x:r,y:i},n),s=o.radius,l=o.angle,c=n.innerRadius,u=n.outerRadius;if(su)return!1;if(s===0)return!0;var d=LEe(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?qs(qs({},n),{},{radius:s,angle:FEe(p,n)}):null},X8=function(e){return!y.isValidElement(e)&&!xt(e)&&typeof e!="boolean"?e.className:""};function pm(t){"@babel/helpers - typeof";return pm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pm(t)}var UEe=["offset"];function BEe(t){return GEe(t)||VEe(t)||zEe(t)||HEe()}function HEe(){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 zEe(t,e){if(t){if(typeof t=="string")return BA(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return BA(t,e)}}function VEe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function GEe(t){if(Array.isArray(t))return BA(t)}function BA(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function WEe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function iM(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function or(t){for(var e=1;e=0?1:-1,w,S;i==="insideStart"?(w=p+x*s,S=m):i==="insideEnd"?(w=g-x*s,S=!m):i==="end"&&(w=g+x*s,S=m),S=b<=0?S:!S;var C=Zt(u,d,v,w),A=Zt(u,d,v,w+(S?1:-1)*359),_="M".concat(C.x,",").concat(C.y,` A`).concat(v,",").concat(v,",0,1,").concat(S?0:1,`, - `).concat(A.x,",").concat(A.y),j=Pt(e.id)?Rf("recharts-radial-line-"):e.id;return T.createElement("text",gm({},r,{dominantBaseline:"central",className:Nt("recharts-radial-bar-label",l)}),T.createElement("defs",null,T.createElement("path",{id:j,d:_})),T.createElement("textPath",{xlinkHref:"#".concat(j)},n))},tNe=function(e){var n=e.viewBox,r=e.offset,i=e.position,o=n,s=o.cx,l=o.cy,c=o.innerRadius,u=o.outerRadius,d=o.startAngle,f=o.endAngle,h=(d+f)/2;if(i==="outside"){var p=Jt(s,l,u+r,h),g=p.x,m=p.y;return{x:g,y:m,textAnchor:g>=s?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"end"};var v=(c+u)/2,b=Jt(s,l,v,h),x=b.x,w=b.y;return{x,y:w,textAnchor:"middle",verticalAnchor:"middle"}},nNe=function(e){var n=e.viewBox,r=e.parentViewBox,i=e.offset,o=e.position,s=n,l=s.x,c=s.y,u=s.width,d=s.height,f=d>=0?1:-1,h=f*i,p=f>0?"end":"start",g=f>0?"start":"end",m=u>=0?1:-1,v=m*i,b=m>0?"end":"start",x=m>0?"start":"end";if(o==="top"){var w={x:l+u/2,y:c-f*i,textAnchor:"middle",verticalAnchor:p};return or(or({},w),r?{height:Math.max(c-r.y,0),width:u}:{})}if(o==="bottom"){var S={x:l+u/2,y:c+d+h,textAnchor:"middle",verticalAnchor:g};return or(or({},S),r?{height:Math.max(r.y+r.height-(c+d),0),width:u}:{})}if(o==="left"){var C={x:l-v,y:c+d/2,textAnchor:b,verticalAnchor:"middle"};return or(or({},C),r?{width:Math.max(C.x-r.x,0),height:d}:{})}if(o==="right"){var A={x:l+u+v,y:c+d/2,textAnchor:x,verticalAnchor:"middle"};return or(or({},A),r?{width:Math.max(r.x+r.width-A.x,0),height:d}:{})}var _=r?{width:u,height:d}:{};return o==="insideLeft"?or({x:l+v,y:c+d/2,textAnchor:x,verticalAnchor:"middle"},_):o==="insideRight"?or({x:l+u-v,y:c+d/2,textAnchor:b,verticalAnchor:"middle"},_):o==="insideTop"?or({x:l+u/2,y:c+h,textAnchor:"middle",verticalAnchor:g},_):o==="insideBottom"?or({x:l+u/2,y:c+d-h,textAnchor:"middle",verticalAnchor:p},_):o==="insideTopLeft"?or({x:l+v,y:c+h,textAnchor:x,verticalAnchor:g},_):o==="insideTopRight"?or({x:l+u-v,y:c+h,textAnchor:b,verticalAnchor:g},_):o==="insideBottomLeft"?or({x:l+v,y:c+d-h,textAnchor:x,verticalAnchor:p},_):o==="insideBottomRight"?or({x:l+u-v,y:c+d-h,textAnchor:b,verticalAnchor:p},_):Tf(o)&&(Ne(o.x)||yc(o.x))&&(Ne(o.y)||yc(o.y))?or({x:l+oi(o.x,u),y:c+oi(o.y,d),textAnchor:"end",verticalAnchor:"end"},_):or({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},_)},rNe=function(e){return"cx"in e&&Ne(e.cx)};function wr(t){var e=t.offset,n=e===void 0?5:e,r=WEe(t,BEe),i=or({offset:n},r),o=i.viewBox,s=i.position,l=i.value,c=i.children,u=i.content,d=i.className,f=d===void 0?"":d,h=i.textBreakAll;if(!o||Pt(l)&&Pt(c)&&!y.isValidElement(u)&&!xt(u))return null;if(y.isValidElement(u))return y.cloneElement(u,i);var p;if(xt(u)){if(p=y.createElement(u,i),y.isValidElement(p))return p}else p=ZEe(i);var g=rNe(o),m=Je(i,!0);if(g&&(s==="insideStart"||s==="insideEnd"||s==="end"))return eNe(i,p,m);var v=g?tNe(i):nNe(i);return T.createElement(tu,gm({className:Nt("recharts-label",f)},m,v,{breakAll:h}),p)}wr.displayName="Label";var J8=function(e){var n=e.cx,r=e.cy,i=e.angle,o=e.startAngle,s=e.endAngle,l=e.r,c=e.radius,u=e.innerRadius,d=e.outerRadius,f=e.x,h=e.y,p=e.top,g=e.left,m=e.width,v=e.height,b=e.clockWise,x=e.labelViewBox;if(x)return x;if(Ne(m)&&Ne(v)){if(Ne(f)&&Ne(h))return{x:f,y:h,width:m,height:v};if(Ne(p)&&Ne(g))return{x:p,y:g,width:m,height:v}}return Ne(f)&&Ne(h)?{x:f,y:h,width:0,height:0}:Ne(n)&&Ne(r)?{cx:n,cy:r,startAngle:o||i||0,endAngle:s||i||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:b}:e.viewBox?e.viewBox:{}},iNe=function(e,n){return e?e===!0?T.createElement(wr,{key:"label-implicit",viewBox:n}):mr(e)?T.createElement(wr,{key:"label-implicit",viewBox:n,value:e}):y.isValidElement(e)?e.type===wr?y.cloneElement(e,{key:"label-implicit",viewBox:n}):T.createElement(wr,{key:"label-implicit",content:e,viewBox:n}):xt(e)?T.createElement(wr,{key:"label-implicit",content:e,viewBox:n}):Tf(e)?T.createElement(wr,gm({viewBox:n},e,{key:"label-implicit"})):null:null},oNe=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var i=e.children,o=J8(e),s=fo(i,wr).map(function(c,u){return y.cloneElement(c,{viewBox:n||o,key:"label-".concat(u)})});if(!r)return s;var l=iNe(e.label,n||o);return[l].concat(HEe(s))};wr.parseViewBox=J8;wr.renderCallByParent=oNe;function sNe(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var aNe=sNe;const eG=en(aNe);function vm(t){"@babel/helpers - typeof";return vm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vm(t)}var lNe=["valueAccessor"],cNe=["data","dataKey","clockWise","id","textBreakAll"];function uNe(t){return pNe(t)||hNe(t)||fNe(t)||dNe()}function dNe(){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 fNe(t,e){if(t){if(typeof t=="string")return zA(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zA(t,e)}}function hNe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function pNe(t){if(Array.isArray(t))return zA(t)}function zA(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function yNe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var xNe=function(e){return Array.isArray(e.value)?eG(e.value):e.value};function _s(t){var e=t.valueAccessor,n=e===void 0?xNe:e,r=lM(t,lNe),i=r.data,o=r.dataKey,s=r.clockWise,l=r.id,c=r.textBreakAll,u=lM(r,cNe);return!i||!i.length?null:T.createElement(Ht,{className:"recharts-label-list"},i.map(function(d,f){var h=Pt(o)?n(d,f):qn(d&&d.payload,o),p=Pt(l)?{}:{id:"".concat(l,"-").concat(f)};return T.createElement(wr,zx({},Je(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:c,viewBox:wr.parseViewBox(Pt(s)?d:aM(aM({},d),{},{clockWise:s})),key:"label-".concat(f),index:f}))}))}_s.displayName="LabelList";function bNe(t,e){return t?t===!0?T.createElement(_s,{key:"labelList-implicit",data:e}):T.isValidElement(t)||xt(t)?T.createElement(_s,{key:"labelList-implicit",data:e,content:t}):Tf(t)?T.createElement(_s,zx({data:e},t,{key:"labelList-implicit"})):null:null}function wNe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var r=t.children,i=fo(r,_s).map(function(s,l){return y.cloneElement(s,{data:e,key:"labelList-".concat(l)})});if(!n)return i;var o=bNe(t.label,e);return[o].concat(uNe(i))}_s.renderCallByParent=wNe;function ym(t){"@babel/helpers - typeof";return ym=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ym(t)}function VA(){return VA=Object.assign?Object.assign.bind():function(t){for(var e=1;e=s?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"end"};var v=(c+u)/2,b=Zt(s,l,v,h),x=b.x,w=b.y;return{x,y:w,textAnchor:"middle",verticalAnchor:"middle"}},tNe=function(e){var n=e.viewBox,r=e.parentViewBox,i=e.offset,o=e.position,s=n,l=s.x,c=s.y,u=s.width,d=s.height,f=d>=0?1:-1,h=f*i,p=f>0?"end":"start",g=f>0?"start":"end",m=u>=0?1:-1,v=m*i,b=m>0?"end":"start",x=m>0?"start":"end";if(o==="top"){var w={x:l+u/2,y:c-f*i,textAnchor:"middle",verticalAnchor:p};return or(or({},w),r?{height:Math.max(c-r.y,0),width:u}:{})}if(o==="bottom"){var S={x:l+u/2,y:c+d+h,textAnchor:"middle",verticalAnchor:g};return or(or({},S),r?{height:Math.max(r.y+r.height-(c+d),0),width:u}:{})}if(o==="left"){var C={x:l-v,y:c+d/2,textAnchor:b,verticalAnchor:"middle"};return or(or({},C),r?{width:Math.max(C.x-r.x,0),height:d}:{})}if(o==="right"){var A={x:l+u+v,y:c+d/2,textAnchor:x,verticalAnchor:"middle"};return or(or({},A),r?{width:Math.max(r.x+r.width-A.x,0),height:d}:{})}var _=r?{width:u,height:d}:{};return o==="insideLeft"?or({x:l+v,y:c+d/2,textAnchor:x,verticalAnchor:"middle"},_):o==="insideRight"?or({x:l+u-v,y:c+d/2,textAnchor:b,verticalAnchor:"middle"},_):o==="insideTop"?or({x:l+u/2,y:c+h,textAnchor:"middle",verticalAnchor:g},_):o==="insideBottom"?or({x:l+u/2,y:c+d-h,textAnchor:"middle",verticalAnchor:p},_):o==="insideTopLeft"?or({x:l+v,y:c+h,textAnchor:x,verticalAnchor:g},_):o==="insideTopRight"?or({x:l+u-v,y:c+h,textAnchor:b,verticalAnchor:g},_):o==="insideBottomLeft"?or({x:l+v,y:c+d-h,textAnchor:x,verticalAnchor:p},_):o==="insideBottomRight"?or({x:l+u-v,y:c+d-h,textAnchor:b,verticalAnchor:p},_):Tf(o)&&(Ee(o.x)||yc(o.x))&&(Ee(o.y)||yc(o.y))?or({x:l+oi(o.x,u),y:c+oi(o.y,d),textAnchor:"end",verticalAnchor:"end"},_):or({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},_)},nNe=function(e){return"cx"in e&&Ee(e.cx)};function wr(t){var e=t.offset,n=e===void 0?5:e,r=KEe(t,UEe),i=or({offset:n},r),o=i.viewBox,s=i.position,l=i.value,c=i.children,u=i.content,d=i.className,f=d===void 0?"":d,h=i.textBreakAll;if(!o||Pt(l)&&Pt(c)&&!y.isValidElement(u)&&!xt(u))return null;if(y.isValidElement(u))return y.cloneElement(u,i);var p;if(xt(u)){if(p=y.createElement(u,i),y.isValidElement(p))return p}else p=XEe(i);var g=nNe(o),m=Ze(i,!0);if(g&&(s==="insideStart"||s==="insideEnd"||s==="end"))return ZEe(i,p,m);var v=g?eNe(i):tNe(i);return T.createElement(tu,mm({className:Et("recharts-label",f)},m,v,{breakAll:h}),p)}wr.displayName="Label";var J8=function(e){var n=e.cx,r=e.cy,i=e.angle,o=e.startAngle,s=e.endAngle,l=e.r,c=e.radius,u=e.innerRadius,d=e.outerRadius,f=e.x,h=e.y,p=e.top,g=e.left,m=e.width,v=e.height,b=e.clockWise,x=e.labelViewBox;if(x)return x;if(Ee(m)&&Ee(v)){if(Ee(f)&&Ee(h))return{x:f,y:h,width:m,height:v};if(Ee(p)&&Ee(g))return{x:p,y:g,width:m,height:v}}return Ee(f)&&Ee(h)?{x:f,y:h,width:0,height:0}:Ee(n)&&Ee(r)?{cx:n,cy:r,startAngle:o||i||0,endAngle:s||i||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:b}:e.viewBox?e.viewBox:{}},rNe=function(e,n){return e?e===!0?T.createElement(wr,{key:"label-implicit",viewBox:n}):mr(e)?T.createElement(wr,{key:"label-implicit",viewBox:n,value:e}):y.isValidElement(e)?e.type===wr?y.cloneElement(e,{key:"label-implicit",viewBox:n}):T.createElement(wr,{key:"label-implicit",content:e,viewBox:n}):xt(e)?T.createElement(wr,{key:"label-implicit",content:e,viewBox:n}):Tf(e)?T.createElement(wr,mm({viewBox:n},e,{key:"label-implicit"})):null:null},iNe=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var i=e.children,o=J8(e),s=fo(i,wr).map(function(c,u){return y.cloneElement(c,{viewBox:n||o,key:"label-".concat(u)})});if(!r)return s;var l=rNe(e.label,n||o);return[l].concat(BEe(s))};wr.parseViewBox=J8;wr.renderCallByParent=iNe;function oNe(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var sNe=oNe;const Z8=en(sNe);function gm(t){"@babel/helpers - typeof";return gm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gm(t)}var aNe=["valueAccessor"],lNe=["data","dataKey","clockWise","id","textBreakAll"];function cNe(t){return hNe(t)||fNe(t)||dNe(t)||uNe()}function uNe(){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 dNe(t,e){if(t){if(typeof t=="string")return HA(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return HA(t,e)}}function fNe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function hNe(t){if(Array.isArray(t))return HA(t)}function HA(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function vNe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var yNe=function(e){return Array.isArray(e.value)?Z8(e.value):e.value};function _s(t){var e=t.valueAccessor,n=e===void 0?yNe:e,r=aM(t,aNe),i=r.data,o=r.dataKey,s=r.clockWise,l=r.id,c=r.textBreakAll,u=aM(r,lNe);return!i||!i.length?null:T.createElement(Ht,{className:"recharts-label-list"},i.map(function(d,f){var h=Pt(o)?n(d,f):qn(d&&d.payload,o),p=Pt(l)?{}:{id:"".concat(l,"-").concat(f)};return T.createElement(wr,Hx({},Ze(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:c,viewBox:wr.parseViewBox(Pt(s)?d:sM(sM({},d),{},{clockWise:s})),key:"label-".concat(f),index:f}))}))}_s.displayName="LabelList";function xNe(t,e){return t?t===!0?T.createElement(_s,{key:"labelList-implicit",data:e}):T.isValidElement(t)||xt(t)?T.createElement(_s,{key:"labelList-implicit",data:e,content:t}):Tf(t)?T.createElement(_s,Hx({data:e},t,{key:"labelList-implicit"})):null:null}function bNe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var r=t.children,i=fo(r,_s).map(function(s,l){return y.cloneElement(s,{data:e,key:"labelList-".concat(l)})});if(!n)return i;var o=xNe(t.label,e);return[o].concat(cNe(i))}_s.renderCallByParent=bNe;function vm(t){"@babel/helpers - typeof";return vm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vm(t)}function zA(){return zA=Object.assign?Object.assign.bind():function(t){for(var e=1;e180),",").concat(+(s>u),`, `).concat(f.x,",").concat(f.y,` - `);if(i>0){var p=Jt(n,r,i,s),g=Jt(n,r,i,u);h+="L ".concat(g.x,",").concat(g.y,` + `);if(i>0){var p=Zt(n,r,i,s),g=Zt(n,r,i,u);h+="L ".concat(g.x,",").concat(g.y,` A `).concat(i,",").concat(i,`,0, `).concat(+(Math.abs(c)>180),",").concat(+(s<=u),`, - `).concat(p.x,",").concat(p.y," Z")}else h+="L ".concat(n,",").concat(r," Z");return h},jNe=function(e){var n=e.cx,r=e.cy,i=e.innerRadius,o=e.outerRadius,s=e.cornerRadius,l=e.forceCornerRadius,c=e.cornerIsExternal,u=e.startAngle,d=e.endAngle,f=ii(d-u),h=sv({cx:n,cy:r,radius:o,angle:u,sign:f,cornerRadius:s,cornerIsExternal:c}),p=h.circleTangency,g=h.lineTangency,m=h.theta,v=sv({cx:n,cy:r,radius:o,angle:d,sign:-f,cornerRadius:s,cornerIsExternal:c}),b=v.circleTangency,x=v.lineTangency,w=v.theta,S=c?Math.abs(u-d):Math.abs(u-d)-m-w;if(S<0)return l?"M ".concat(g.x,",").concat(g.y,` + `).concat(p.x,",").concat(p.y," Z")}else h+="L ".concat(n,",").concat(r," Z");return h},_Ne=function(e){var n=e.cx,r=e.cy,i=e.innerRadius,o=e.outerRadius,s=e.cornerRadius,l=e.forceCornerRadius,c=e.cornerIsExternal,u=e.startAngle,d=e.endAngle,f=ii(d-u),h=ov({cx:n,cy:r,radius:o,angle:u,sign:f,cornerRadius:s,cornerIsExternal:c}),p=h.circleTangency,g=h.lineTangency,m=h.theta,v=ov({cx:n,cy:r,radius:o,angle:d,sign:-f,cornerRadius:s,cornerIsExternal:c}),b=v.circleTangency,x=v.lineTangency,w=v.theta,S=c?Math.abs(u-d):Math.abs(u-d)-m-w;if(S<0)return l?"M ".concat(g.x,",").concat(g.y,` a`).concat(s,",").concat(s,",0,0,1,").concat(s*2,`,0 a`).concat(s,",").concat(s,",0,0,1,").concat(-s*2,`,0 - `):tG({cx:n,cy:r,innerRadius:i,outerRadius:o,startAngle:u,endAngle:d});var C="M ".concat(g.x,",").concat(g.y,` + `):eG({cx:n,cy:r,innerRadius:i,outerRadius:o,startAngle:u,endAngle:d});var C="M ".concat(g.x,",").concat(g.y,` A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(p.x,",").concat(p.y,` A`).concat(o,",").concat(o,",0,").concat(+(S>180),",").concat(+(f<0),",").concat(b.x,",").concat(b.y,` A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(x.x,",").concat(x.y,` - `);if(i>0){var A=sv({cx:n,cy:r,radius:i,angle:u,sign:f,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),_=A.circleTangency,j=A.lineTangency,k=A.theta,P=sv({cx:n,cy:r,radius:i,angle:d,sign:-f,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),R=P.circleTangency,E=P.lineTangency,I=P.theta,L=c?Math.abs(u-d):Math.abs(u-d)-k-I;if(L<0&&s===0)return"".concat(C,"L").concat(n,",").concat(r,"Z");C+="L".concat(E.x,",").concat(E.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(R.x,",").concat(R.y,` + `);if(i>0){var A=ov({cx:n,cy:r,radius:i,angle:u,sign:f,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),_=A.circleTangency,j=A.lineTangency,k=A.theta,P=ov({cx:n,cy:r,radius:i,angle:d,sign:-f,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),I=P.circleTangency,E=P.lineTangency,R=P.theta,L=c?Math.abs(u-d):Math.abs(u-d)-k-R;if(L<0&&s===0)return"".concat(C,"L").concat(n,",").concat(r,"Z");C+="L".concat(E.x,",").concat(E.y,` + A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(I.x,",").concat(I.y,` A`).concat(i,",").concat(i,",0,").concat(+(L>180),",").concat(+(f>0),",").concat(_.x,",").concat(_.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(j.x,",").concat(j.y,"Z")}else C+="L".concat(n,",").concat(r,"Z");return C},ENe={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},nG=function(e){var n=uM(uM({},ENe),e),r=n.cx,i=n.cy,o=n.innerRadius,s=n.outerRadius,l=n.cornerRadius,c=n.forceCornerRadius,u=n.cornerIsExternal,d=n.startAngle,f=n.endAngle,h=n.className;if(s0&&Math.abs(d-f)<360?v=jNe({cx:r,cy:i,innerRadius:o,outerRadius:s,cornerRadius:Math.min(m,g/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):v=tG({cx:r,cy:i,innerRadius:o,outerRadius:s,startAngle:d,endAngle:f}),T.createElement("path",VA({},Je(n,!0),{className:p,d:v,role:"img"}))};function xm(t){"@babel/helpers - typeof";return xm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xm(t)}function GA(){return GA=Object.assign?Object.assign.bind():function(t){for(var e=1;e0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function HNe(t,e){return Bf(t.getTime(),e.getTime())}function yM(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.entries(),o=0,s,l;(s=i.next())&&!s.done;){for(var c=e.entries(),u=!1,d=0;(l=c.next())&&!l.done;){var f=s.value,h=f[0],p=f[1],g=l.value,m=g[0],v=g[1];!u&&!r[d]&&(u=n.equals(h,m,o,d,t,e,n)&&n.equals(p,v,h,m,t,e,n))&&(r[d]=!0),d++}if(!u)return!1;o++}return!0}function zNe(t,e,n){var r=vM(t),i=r.length;if(vM(e).length!==i)return!1;for(var o;i-- >0;)if(o=r[i],o===aG&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!sG(e,o)||!n.equals(t[o],e[o],o,o,t,e,n))return!1;return!0}function mh(t,e,n){var r=mM(t),i=r.length;if(mM(e).length!==i)return!1;for(var o,s,l;i-- >0;)if(o=r[i],o===aG&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!sG(e,o)||!n.equals(t[o],e[o],o,o,t,e,n)||(s=gM(t,o),l=gM(e,o),(s||l)&&(!s||!l||s.configurable!==l.configurable||s.enumerable!==l.enumerable||s.writable!==l.writable)))return!1;return!0}function VNe(t,e){return Bf(t.valueOf(),e.valueOf())}function GNe(t,e){return t.source===e.source&&t.flags===e.flags}function xM(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.values(),o,s;(o=i.next())&&!o.done;){for(var l=e.values(),c=!1,u=0;(s=l.next())&&!s.done;)!c&&!r[u]&&(c=n.equals(o.value,s.value,o.value,s.value,t,e,n))&&(r[u]=!0),u++;if(!c)return!1}return!0}function KNe(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}var WNe="[object Arguments]",qNe="[object Boolean]",YNe="[object Date]",QNe="[object Map]",XNe="[object Number]",ZNe="[object Object]",JNe="[object RegExp]",eTe="[object Set]",tTe="[object String]",nTe=Array.isArray,bM=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,wM=Object.assign,rTe=Object.prototype.toString.call.bind(Object.prototype.toString);function iTe(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areMapsEqual,i=t.areObjectsEqual,o=t.arePrimitiveWrappersEqual,s=t.areRegExpsEqual,l=t.areSetsEqual,c=t.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(nTe(d))return e(d,f,h);if(bM!=null&&bM(d))return c(d,f,h);if(p===Date)return n(d,f,h);if(p===RegExp)return s(d,f,h);if(p===Map)return r(d,f,h);if(p===Set)return l(d,f,h);var g=rTe(d);return g===YNe?n(d,f,h):g===JNe?s(d,f,h):g===QNe?r(d,f,h):g===eTe?l(d,f,h):g===ZNe?typeof d.then!="function"&&typeof f.then!="function"&&i(d,f,h):g===WNe?i(d,f,h):g===qNe||g===XNe||g===tTe?o(d,f,h):!1}}function oTe(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?mh:BNe,areDatesEqual:HNe,areMapsEqual:r?pM(yM,mh):yM,areObjectsEqual:r?mh:zNe,arePrimitiveWrappersEqual:VNe,areRegExpsEqual:GNe,areSetsEqual:r?pM(xM,mh):xM,areTypedArraysEqual:r?mh:KNe};if(n&&(i=wM({},i,n(i))),e){var o=lv(i.areArraysEqual),s=lv(i.areMapsEqual),l=lv(i.areObjectsEqual),c=lv(i.areSetsEqual);i=wM({},i,{areArraysEqual:o,areMapsEqual:s,areObjectsEqual:l,areSetsEqual:c})}return i}function sTe(t){return function(e,n,r,i,o,s,l){return t(e,n,l)}}function aTe(t){var e=t.circular,n=t.comparator,r=t.createState,i=t.equals,o=t.strict;if(r)return function(c,u){var d=r(),f=d.cache,h=f===void 0?e?new WeakMap:void 0:f,p=d.meta;return n(c,u,{cache:h,equals:i,meta:p,strict:o})};if(e)return function(c,u){return n(c,u,{cache:new WeakMap,equals:i,meta:void 0,strict:o})};var s={cache:void 0,equals:i,meta:void 0,strict:o};return function(c,u){return n(c,u,s)}}var lTe=Ql();Ql({strict:!0});Ql({circular:!0});Ql({circular:!0,strict:!0});Ql({createInternalComparator:function(){return Bf}});Ql({strict:!0,createInternalComparator:function(){return Bf}});Ql({circular:!0,createInternalComparator:function(){return Bf}});Ql({circular:!0,createInternalComparator:function(){return Bf},strict:!0});function Ql(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,r=t.createInternalComparator,i=t.createState,o=t.strict,s=o===void 0?!1:o,l=oTe(t),c=iTe(l),u=r?r(c):sTe(c);return aTe({circular:n,comparator:c,createState:i,equals:u,strict:s})}function cTe(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function SM(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function i(o){n<0&&(n=o),o-n>e?(t(o),n=-1):cTe(i)};requestAnimationFrame(r)}function KA(t){"@babel/helpers - typeof";return KA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},KA(t)}function uTe(t){return pTe(t)||hTe(t)||fTe(t)||dTe()}function dTe(){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 fTe(t,e){if(t){if(typeof t=="string")return CM(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return CM(t,e)}}function CM(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1?1:b<0?0:b},m=function(b){for(var x=b>1?1:b,w=x,S=0;S<8;++S){var C=f(w)-x,A=p(w);if(Math.abs(C-x)0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,r=n===void 0?100:n,i=e.damping,o=i===void 0?8:i,s=e.dt,l=s===void 0?17:s,c=function(d,f,h){var p=-(d-f)*r,g=h*o,m=h+(p-g)*l/1e3,v=h*l/1e3+d;return Math.abs(v-f)t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function GTe(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o=0)&&(n[i]=t[i]);return n}function GS(t){return YTe(t)||qTe(t)||WTe(t)||KTe()}function KTe(){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 WTe(t,e){if(t){if(typeof t=="string")return XA(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return XA(t,e)}}function qTe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function YTe(t){if(Array.isArray(t))return XA(t)}function XA(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);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 Kx(t){return Kx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Kx(t)}var Xo=function(t){ePe(n,t);var e=tPe(n);function n(r,i){var o;QTe(this,n),o=e.call(this,r,i);var s=o.props,l=s.isActive,c=s.attributeName,u=s.from,d=s.to,f=s.steps,h=s.children,p=s.duration;if(o.handleStyleChange=o.handleStyleChange.bind(e_(o)),o.changeStyle=o.changeStyle.bind(e_(o)),!l||p<=0)return o.state={style:{}},typeof h=="function"&&(o.state={style:d}),JA(o);if(f&&f.length)o.state={style:f[0].style};else if(u){if(typeof h=="function")return o.state={style:u},JA(o);o.state={style:c?Th({},c,u):u}}else o.state={style:{}};return o}return ZTe(n,[{key:"componentDidMount",value:function(){var i=this.props,o=i.isActive,s=i.canBegin;this.mounted=!0,!(!o||!s)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var o=this.props,s=o.isActive,l=o.canBegin,c=o.attributeName,u=o.shouldReAnimate,d=o.to,f=o.from,h=this.state.style;if(l){if(!s){var p={style:c?Th({},c,d):d};this.state&&h&&(c&&h[c]!==d||!c&&h!==d)&&this.setState(p);return}if(!(lTe(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 v={style:c?Th({},c,m):m};(c&&h[c]!==m||!c&&h!==m)&&this.setState(v)}this.runAnimation(bo(bo({},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 o=this,s=i.from,l=i.to,c=i.duration,u=i.easing,d=i.begin,f=i.onAnimationEnd,h=i.onAnimationStart,p=HTe(s,l,kTe(u),c,this.changeStyle),g=function(){o.stopJSAnimation=p()};this.manager.start([h,d,g,c,f])}},{key:"runStepAnimation",value:function(i){var o=this,s=i.steps,l=i.begin,c=i.onAnimationStart,u=s[0],d=u.style,f=u.duration,h=f===void 0?0:f,p=function(m,v,b){if(b===0)return m;var x=v.duration,w=v.easing,S=w===void 0?"ease":w,C=v.style,A=v.properties,_=v.onAnimationEnd,j=b>0?s[b-1]:v,k=A||Object.keys(C);if(typeof S=="function"||S==="spring")return[].concat(GS(m),[o.runJSAnimation.bind(o,{from:j.style,to:C,duration:x,easing:S}),x]);var P=jM(k,x,S),R=bo(bo(bo({},j.style),C),{},{transition:P});return[].concat(GS(m),[R,x,_]).filter(xTe)};return this.manager.start([c].concat(GS(s.reduce(p,[d,Math.max(h,l)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=mTe());var o=i.begin,s=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?Th({},l,c):c,v=jM(Object.keys(m),s,u);g.start([d,o,bo(bo({},m),{},{transition:v}),s,f])}},{key:"render",value:function(){var i=this.props,o=i.children;i.begin;var s=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=VTe(i,zTe),u=y.Children.count(o),d=this.state.style;if(typeof o=="function")return o(d);if(!l||u===0||s<=0)return o;var f=function(p){var g=p.props,m=g.style,v=m===void 0?{}:m,b=g.className,x=y.cloneElement(p,bo(bo({},c),{},{style:bo(bo({},v),d),className:b}));return x};return u===1?f(y.Children.only(o)):T.createElement("div",null,y.Children.map(o,function(h){return f(h)}))}}]),n}(y.PureComponent);Xo.displayName="Animate";Xo.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Xo.propTypes={from:Mt.oneOfType([Mt.object,Mt.string]),to:Mt.oneOfType([Mt.object,Mt.string]),attributeName:Mt.string,duration:Mt.number,begin:Mt.number,easing:Mt.oneOfType([Mt.string,Mt.func]),steps:Mt.arrayOf(Mt.shape({duration:Mt.number.isRequired,style:Mt.object.isRequired,easing:Mt.oneOfType([Mt.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Mt.func]),properties:Mt.arrayOf("string"),onAnimationEnd:Mt.func})),children:Mt.oneOfType([Mt.node,Mt.func]),isActive:Mt.bool,canBegin:Mt.bool,onAnimationEnd:Mt.func,shouldReAnimate:Mt.bool,onAnimationStart:Mt.func,onAnimationReStart:Mt.func};Mt.object,Mt.object,Mt.object,Mt.element;Mt.object,Mt.object,Mt.object,Mt.oneOfType([Mt.array,Mt.element]),Mt.any;function Sm(t){"@babel/helpers - typeof";return Sm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Sm(t)}function Wx(){return Wx=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0?1:-1,c=r>=0?1:-1,u=i>=0&&r>=0||i<0&&r<0?1:0,d;if(s>0&&o instanceof Array){for(var f=[0,0,0,0],h=0,p=4;hs?s:o[h];d="M".concat(e,",").concat(n+l*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(e+c*f[0],",").concat(n)),d+="L ".concat(e+r-c*f[1],",").concat(n),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`, + A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(j.x,",").concat(j.y,"Z")}else C+="L".concat(n,",").concat(r,"Z");return C},jNe={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},tG=function(e){var n=cM(cM({},jNe),e),r=n.cx,i=n.cy,o=n.innerRadius,s=n.outerRadius,l=n.cornerRadius,c=n.forceCornerRadius,u=n.cornerIsExternal,d=n.startAngle,f=n.endAngle,h=n.className;if(s0&&Math.abs(d-f)<360?v=_Ne({cx:r,cy:i,innerRadius:o,outerRadius:s,cornerRadius:Math.min(m,g/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):v=eG({cx:r,cy:i,innerRadius:o,outerRadius:s,startAngle:d,endAngle:f}),T.createElement("path",zA({},Ze(n,!0),{className:p,d:v,role:"img"}))};function ym(t){"@babel/helpers - typeof";return ym=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ym(t)}function VA(){return VA=Object.assign?Object.assign.bind():function(t){for(var e=1;e0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function BNe(t,e){return Bf(t.getTime(),e.getTime())}function vM(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.entries(),o=0,s,l;(s=i.next())&&!s.done;){for(var c=e.entries(),u=!1,d=0;(l=c.next())&&!l.done;){var f=s.value,h=f[0],p=f[1],g=l.value,m=g[0],v=g[1];!u&&!r[d]&&(u=n.equals(h,m,o,d,t,e,n)&&n.equals(p,v,h,m,t,e,n))&&(r[d]=!0),d++}if(!u)return!1;o++}return!0}function HNe(t,e,n){var r=gM(t),i=r.length;if(gM(e).length!==i)return!1;for(var o;i-- >0;)if(o=r[i],o===sG&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!oG(e,o)||!n.equals(t[o],e[o],o,o,t,e,n))return!1;return!0}function ph(t,e,n){var r=pM(t),i=r.length;if(pM(e).length!==i)return!1;for(var o,s,l;i-- >0;)if(o=r[i],o===sG&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!oG(e,o)||!n.equals(t[o],e[o],o,o,t,e,n)||(s=mM(t,o),l=mM(e,o),(s||l)&&(!s||!l||s.configurable!==l.configurable||s.enumerable!==l.enumerable||s.writable!==l.writable)))return!1;return!0}function zNe(t,e){return Bf(t.valueOf(),e.valueOf())}function VNe(t,e){return t.source===e.source&&t.flags===e.flags}function yM(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.values(),o,s;(o=i.next())&&!o.done;){for(var l=e.values(),c=!1,u=0;(s=l.next())&&!s.done;)!c&&!r[u]&&(c=n.equals(o.value,s.value,o.value,s.value,t,e,n))&&(r[u]=!0),u++;if(!c)return!1}return!0}function GNe(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}var KNe="[object Arguments]",WNe="[object Boolean]",qNe="[object Date]",YNe="[object Map]",QNe="[object Number]",XNe="[object Object]",JNe="[object RegExp]",ZNe="[object Set]",eTe="[object String]",tTe=Array.isArray,xM=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,bM=Object.assign,nTe=Object.prototype.toString.call.bind(Object.prototype.toString);function rTe(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areMapsEqual,i=t.areObjectsEqual,o=t.arePrimitiveWrappersEqual,s=t.areRegExpsEqual,l=t.areSetsEqual,c=t.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(tTe(d))return e(d,f,h);if(xM!=null&&xM(d))return c(d,f,h);if(p===Date)return n(d,f,h);if(p===RegExp)return s(d,f,h);if(p===Map)return r(d,f,h);if(p===Set)return l(d,f,h);var g=nTe(d);return g===qNe?n(d,f,h):g===JNe?s(d,f,h):g===YNe?r(d,f,h):g===ZNe?l(d,f,h):g===XNe?typeof d.then!="function"&&typeof f.then!="function"&&i(d,f,h):g===KNe?i(d,f,h):g===WNe||g===QNe||g===eTe?o(d,f,h):!1}}function iTe(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?ph:UNe,areDatesEqual:BNe,areMapsEqual:r?hM(vM,ph):vM,areObjectsEqual:r?ph:HNe,arePrimitiveWrappersEqual:zNe,areRegExpsEqual:VNe,areSetsEqual:r?hM(yM,ph):yM,areTypedArraysEqual:r?ph:GNe};if(n&&(i=bM({},i,n(i))),e){var o=av(i.areArraysEqual),s=av(i.areMapsEqual),l=av(i.areObjectsEqual),c=av(i.areSetsEqual);i=bM({},i,{areArraysEqual:o,areMapsEqual:s,areObjectsEqual:l,areSetsEqual:c})}return i}function oTe(t){return function(e,n,r,i,o,s,l){return t(e,n,l)}}function sTe(t){var e=t.circular,n=t.comparator,r=t.createState,i=t.equals,o=t.strict;if(r)return function(c,u){var d=r(),f=d.cache,h=f===void 0?e?new WeakMap:void 0:f,p=d.meta;return n(c,u,{cache:h,equals:i,meta:p,strict:o})};if(e)return function(c,u){return n(c,u,{cache:new WeakMap,equals:i,meta:void 0,strict:o})};var s={cache:void 0,equals:i,meta:void 0,strict:o};return function(c,u){return n(c,u,s)}}var aTe=Ql();Ql({strict:!0});Ql({circular:!0});Ql({circular:!0,strict:!0});Ql({createInternalComparator:function(){return Bf}});Ql({strict:!0,createInternalComparator:function(){return Bf}});Ql({circular:!0,createInternalComparator:function(){return Bf}});Ql({circular:!0,createInternalComparator:function(){return Bf},strict:!0});function Ql(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,r=t.createInternalComparator,i=t.createState,o=t.strict,s=o===void 0?!1:o,l=iTe(t),c=rTe(l),u=r?r(c):oTe(c);return sTe({circular:n,comparator:c,createState:i,equals:u,strict:s})}function lTe(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function wM(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function i(o){n<0&&(n=o),o-n>e?(t(o),n=-1):lTe(i)};requestAnimationFrame(r)}function GA(t){"@babel/helpers - typeof";return GA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},GA(t)}function cTe(t){return hTe(t)||fTe(t)||dTe(t)||uTe()}function uTe(){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 dTe(t,e){if(t){if(typeof t=="string")return SM(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return SM(t,e)}}function SM(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1?1:b<0?0:b},m=function(b){for(var x=b>1?1:b,w=x,S=0;S<8;++S){var C=f(w)-x,A=p(w);if(Math.abs(C-x)0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,r=n===void 0?100:n,i=e.damping,o=i===void 0?8:i,s=e.dt,l=s===void 0?17:s,c=function(d,f,h){var p=-(d-f)*r,g=h*o,m=h+(p-g)*l/1e3,v=h*l/1e3+d;return Math.abs(v-f)t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function VTe(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o=0)&&(n[i]=t[i]);return n}function VS(t){return qTe(t)||WTe(t)||KTe(t)||GTe()}function GTe(){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 KTe(t,e){if(t){if(typeof t=="string")return QA(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return QA(t,e)}}function WTe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function qTe(t){if(Array.isArray(t))return QA(t)}function QA(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);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 Gx(t){return Gx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Gx(t)}var Xo=function(t){ZTe(n,t);var e=ePe(n);function n(r,i){var o;YTe(this,n),o=e.call(this,r,i);var s=o.props,l=s.isActive,c=s.attributeName,u=s.from,d=s.to,f=s.steps,h=s.children,p=s.duration;if(o.handleStyleChange=o.handleStyleChange.bind(ZA(o)),o.changeStyle=o.changeStyle.bind(ZA(o)),!l||p<=0)return o.state={style:{}},typeof h=="function"&&(o.state={style:d}),JA(o);if(f&&f.length)o.state={style:f[0].style};else if(u){if(typeof h=="function")return o.state={style:u},JA(o);o.state={style:c?Nh({},c,u):u}}else o.state={style:{}};return o}return XTe(n,[{key:"componentDidMount",value:function(){var i=this.props,o=i.isActive,s=i.canBegin;this.mounted=!0,!(!o||!s)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var o=this.props,s=o.isActive,l=o.canBegin,c=o.attributeName,u=o.shouldReAnimate,d=o.to,f=o.from,h=this.state.style;if(l){if(!s){var p={style:c?Nh({},c,d):d};this.state&&h&&(c&&h[c]!==d||!c&&h!==d)&&this.setState(p);return}if(!(aTe(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 v={style:c?Nh({},c,m):m};(c&&h[c]!==m||!c&&h!==m)&&this.setState(v)}this.runAnimation(bo(bo({},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 o=this,s=i.from,l=i.to,c=i.duration,u=i.easing,d=i.begin,f=i.onAnimationEnd,h=i.onAnimationStart,p=BTe(s,l,PTe(u),c,this.changeStyle),g=function(){o.stopJSAnimation=p()};this.manager.start([h,d,g,c,f])}},{key:"runStepAnimation",value:function(i){var o=this,s=i.steps,l=i.begin,c=i.onAnimationStart,u=s[0],d=u.style,f=u.duration,h=f===void 0?0:f,p=function(m,v,b){if(b===0)return m;var x=v.duration,w=v.easing,S=w===void 0?"ease":w,C=v.style,A=v.properties,_=v.onAnimationEnd,j=b>0?s[b-1]:v,k=A||Object.keys(C);if(typeof S=="function"||S==="spring")return[].concat(VS(m),[o.runJSAnimation.bind(o,{from:j.style,to:C,duration:x,easing:S}),x]);var P=_M(k,x,S),I=bo(bo(bo({},j.style),C),{},{transition:P});return[].concat(VS(m),[I,x,_]).filter(yTe)};return this.manager.start([c].concat(VS(s.reduce(p,[d,Math.max(h,l)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=pTe());var o=i.begin,s=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?Nh({},l,c):c,v=_M(Object.keys(m),s,u);g.start([d,o,bo(bo({},m),{},{transition:v}),s,f])}},{key:"render",value:function(){var i=this.props,o=i.children;i.begin;var s=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=zTe(i,HTe),u=y.Children.count(o),d=this.state.style;if(typeof o=="function")return o(d);if(!l||u===0||s<=0)return o;var f=function(p){var g=p.props,m=g.style,v=m===void 0?{}:m,b=g.className,x=y.cloneElement(p,bo(bo({},c),{},{style:bo(bo({},v),d),className:b}));return x};return u===1?f(y.Children.only(o)):T.createElement("div",null,y.Children.map(o,function(h){return f(h)}))}}]),n}(y.PureComponent);Xo.displayName="Animate";Xo.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Xo.propTypes={from:Mt.oneOfType([Mt.object,Mt.string]),to:Mt.oneOfType([Mt.object,Mt.string]),attributeName:Mt.string,duration:Mt.number,begin:Mt.number,easing:Mt.oneOfType([Mt.string,Mt.func]),steps:Mt.arrayOf(Mt.shape({duration:Mt.number.isRequired,style:Mt.object.isRequired,easing:Mt.oneOfType([Mt.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Mt.func]),properties:Mt.arrayOf("string"),onAnimationEnd:Mt.func})),children:Mt.oneOfType([Mt.node,Mt.func]),isActive:Mt.bool,canBegin:Mt.bool,onAnimationEnd:Mt.func,shouldReAnimate:Mt.bool,onAnimationStart:Mt.func,onAnimationReStart:Mt.func};Mt.object,Mt.object,Mt.object,Mt.element;Mt.object,Mt.object,Mt.object,Mt.oneOfType([Mt.array,Mt.element]),Mt.any;function wm(t){"@babel/helpers - typeof";return wm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wm(t)}function Kx(){return Kx=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0?1:-1,c=r>=0?1:-1,u=i>=0&&r>=0||i<0&&r<0?1:0,d;if(s>0&&o instanceof Array){for(var f=[0,0,0,0],h=0,p=4;hs?s:o[h];d="M".concat(e,",").concat(n+l*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(e+c*f[0],",").concat(n)),d+="L ".concat(e+r-c*f[1],",").concat(n),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`, `).concat(e+r,",").concat(n+l*f[1])),d+="L ".concat(e+r,",").concat(n+i-l*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`, `).concat(e+r-c*f[2],",").concat(n+i)),d+="L ".concat(e+c*f[3],",").concat(n+i),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`, `).concat(e,",").concat(n+i-l*f[3])),d+="Z"}else if(s>0&&o===+o&&o>0){var g=Math.min(s,o);d="M ".concat(e,",").concat(n+l*g,` @@ -716,16 +695,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho L `).concat(e+r,",").concat(n+i-l*g,` A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e+r-c*g,",").concat(n+i,` L `).concat(e+c*g,",").concat(n+i,` - A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e,",").concat(n+i-l*g," Z")}else d="M ".concat(e,",").concat(n," h ").concat(r," v ").concat(i," h ").concat(-r," Z");return d},dPe=function(e,n){if(!e||!n)return!1;var r=e.x,i=e.y,o=n.x,s=n.y,l=n.width,c=n.height;if(Math.abs(l)>0&&Math.abs(c)>0){var u=Math.min(o,o+l),d=Math.max(o,o+l),f=Math.min(s,s+c),h=Math.max(s,s+c);return r>=u&&r<=d&&i>=f&&i<=h}return!1},fPe={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},iP=function(e){var n=RM(RM({},fPe),e),r=y.useRef(),i=y.useState(-1),o=rPe(i,2),s=o[0],l=o[1];y.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var S=r.current.getTotalLength();S&&l(S)}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,v=n.animationBegin,b=n.isAnimationActive,x=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var w=Nt("recharts-rectangle",p);return x?T.createElement(Xo,{canBegin:s>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:m,animationEasing:g,isActive:x},function(S){var C=S.width,A=S.height,_=S.x,j=S.y;return T.createElement(Xo,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:m,isActive:b,easing:g},T.createElement("path",Wx({},Je(n,!0),{className:w,d:MM(_,j,C,A,h),ref:r})))}):T.createElement("path",Wx({},Je(n,!0),{className:w,d:MM(c,u,d,f,h)}))},hPe=["points","className","baseLinePoints","connectNulls"];function Vu(){return Vu=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function mPe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function DM(t){return xPe(t)||yPe(t)||vPe(t)||gPe()}function gPe(){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 vPe(t,e){if(t){if(typeof t=="string")return t_(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t_(t,e)}}function yPe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function xPe(t){if(Array.isArray(t))return t_(t)}function t_(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return e.forEach(function(r){$M(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),$M(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},Xh=function(e,n){var r=bPe(e);n&&(r=[r.reduce(function(o,s){return[].concat(DM(o),DM(s))},[])]);var i=r.map(function(o){return o.reduce(function(s,l,c){return"".concat(s).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return r.length===1?"".concat(i,"Z"):i},wPe=function(e,n,r){var i=Xh(e,r);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(Xh(n.reverse(),r).slice(1))},pG=function(e){var n=e.points,r=e.className,i=e.baseLinePoints,o=e.connectNulls,s=pPe(e,hPe);if(!n||!n.length)return null;var l=Nt("recharts-polygon",r);if(i&&i.length){var c=s.stroke&&s.stroke!=="none",u=wPe(n,i,o);return T.createElement("g",{className:l},T.createElement("path",Vu({},Je(s,!0),{fill:u.slice(-1)==="Z"?s.fill:"none",stroke:"none",d:u})),c?T.createElement("path",Vu({},Je(s,!0),{fill:"none",d:Xh(n,o)})):null,c?T.createElement("path",Vu({},Je(s,!0),{fill:"none",d:Xh(i,o)})):null)}var d=Xh(n,o);return T.createElement("path",Vu({},Je(s,!0),{fill:d.slice(-1)==="Z"?s.fill:"none",className:l,d}))};function n_(){return n_=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function NPe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var TPe=function(e,n,r,i,o,s){return"M".concat(e,",").concat(o,"v").concat(i,"M").concat(s,",").concat(n,"h").concat(r)},PPe=function(e){var n=e.x,r=n===void 0?0:n,i=e.y,o=i===void 0?0:i,s=e.top,l=s===void 0?0:s,c=e.left,u=c===void 0?0:c,d=e.width,f=d===void 0?0:d,h=e.height,p=h===void 0?0:h,g=e.className,m=EPe(e,SPe),v=CPe({x:r,y:o,top:l,left:u,width:f,height:p},m);return!Ne(r)||!Ne(o)||!Ne(f)||!Ne(p)||!Ne(l)||!Ne(u)?null:T.createElement("path",r_({},Je(v,!0),{className:Nt("recharts-cross",g),d:TPe(r,o,f,p,l,u)}))},kPe=["cx","cy","innerRadius","outerRadius","gridType","radialLines"];function Am(t){"@babel/helpers - typeof";return Am=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Am(t)}function OPe(t,e){if(t==null)return{};var n=IPe(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function IPe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Aa(){return Aa=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function nke(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function rke(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function HM(t,e){for(var n=0;nGM?s=i==="outer"?"start":"end":o<-GM?s=i==="outer"?"end":"start":s="middle",s}},{key:"renderAxisLine",value:function(){var r=this.props,i=r.cx,o=r.cy,s=r.radius,l=r.axisLine,c=r.axisLineType,u=tc(tc({},Je(this.props,!1)),{},{fill:"none"},Je(l,!1));if(c==="circle")return T.createElement(pg,lc({className:"recharts-polar-angle-axis-line"},u,{cx:i,cy:o,r:s}));var d=this.props.ticks,f=d.map(function(h){return Jt(i,o,s,h.coordinate)});return T.createElement(pG,lc({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var r=this,i=this.props,o=i.ticks,s=i.tick,l=i.tickLine,c=i.tickFormatter,u=i.stroke,d=Je(this.props,!1),f=Je(s,!1),h=tc(tc({},d),{},{fill:"none"},Je(l,!1)),p=o.map(function(g,m){var v=r.getTickLineCoord(g),b=r.getTickTextAnchor(g),x=tc(tc(tc({textAnchor:b},d),{},{stroke:"none",fill:u},f),{},{index:m,payload:g,x:v.x2,y:v.y2});return T.createElement(Ht,lc({className:Nt("recharts-polar-angle-axis-tick",Z8(s)),key:"tick-".concat(g.coordinate)},eu(r.props,g,m)),l&&T.createElement("line",lc({className:"recharts-polar-angle-axis-tick-line"},h,v)),s&&e.renderTickItem(s,x,c?c(g.value,m):g.value))});return T.createElement(Ht,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var r=this.props,i=r.ticks,o=r.radius,s=r.axisLine;return o<=0||!i||!i.length?null:T.createElement(Ht,{className:Nt("recharts-polar-angle-axis",this.props.className)},s&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,i,o){var s;return T.isValidElement(r)?s=T.cloneElement(r,i):xt(r)?s=r(i):s=T.createElement(tu,lc({},i,{className:"recharts-polar-angle-axis-tick-value"}),o),s}}])}(y.PureComponent);hw(zf,"displayName","PolarAngleAxis");hw(zf,"axisType","angleAxis");hw(zf,"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 yke=yV,xke=yke(Object.getPrototypeOf,Object),bke=xke,wke=Ta,Ske=bke,Cke=Pa,Ake="[object Object]",_ke=Function.prototype,jke=Object.prototype,bG=_ke.toString,Eke=jke.hasOwnProperty,Nke=bG.call(Object);function Tke(t){if(!Cke(t)||wke(t)!=Ake)return!1;var e=Ske(t);if(e===null)return!0;var n=Eke.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&bG.call(n)==Nke}var Pke=Tke;const kke=en(Pke);var Oke=Ta,Ike=Pa,Rke="[object Boolean]";function Mke(t){return t===!0||t===!1||Ike(t)&&Oke(t)==Rke}var Dke=Mke;const $ke=en(Dke);function jm(t){"@babel/helpers - typeof";return jm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jm(t)}function Qx(){return Qx=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);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 S=w.upperWidth,C=w.lowerWidth,A=w.height,_=w.x,j=w.y;return T.createElement(Xo,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:m,easing:g},T.createElement("path",Qx({},Je(n,!0),{className:x,d:YM(_,j,S,C,A),ref:r})))}):T.createElement("g",null,T.createElement("path",Qx({},Je(n,!0),{className:x,d:YM(c,u,d,f,h)})))},qke=["option","shapeType","propTransformer","activeClassName","isActive"];function Em(t){"@babel/helpers - typeof";return Em=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Em(t)}function Yke(t,e){if(t==null)return{};var n=Qke(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Qke(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function QM(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Xx(t){for(var e=1;e0?zi(w,"paddingAngle",0):0;if(C){var _=br(C.endAngle-C.startAngle,w.endAngle-w.startAngle),j=yn(yn({},w),{},{startAngle:x+A,endAngle:x+_(m)+A});v.push(j),x=j.endAngle}else{var k=w.endAngle,P=w.startAngle,R=br(0,k-P),E=R(m),I=yn(yn({},w),{},{startAngle:x+A,endAngle:x+E+A});v.push(I),x=I.endAngle}}),T.createElement(Ht,null,r.renderSectorsStatically(v))})}},{key:"attachKeyboardHandlers",value:function(r){var i=this;r.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var s=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[s].focus(),i.setState({sectorToFocus:s});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,o=r.isAnimationActive,s=this.state.prevSectors;return o&&i&&i.length&&(!s||!nu(s,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,o=i.hide,s=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(o||!s||!s.length||!Ne(u)||!Ne(d)||!Ne(f)||!Ne(h))return null;var m=Nt("recharts-pie",l);return T.createElement(Ht,{tabIndex:this.props.rootTabIndex,className:m,ref:function(b){r.pieRef=b}},this.renderSectors(),c&&this.renderLabels(s),wr.renderCallByParent(this.props,null,!1),(!p||g)&&_s.renderCallByParent(this.props,s,!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":r0&&Math.abs(c)>0){var u=Math.min(o,o+l),d=Math.max(o,o+l),f=Math.min(s,s+c),h=Math.max(s,s+c);return r>=u&&r<=d&&i>=f&&i<=h}return!1},dPe={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},rP=function(e){var n=IM(IM({},dPe),e),r=y.useRef(),i=y.useState(-1),o=nPe(i,2),s=o[0],l=o[1];y.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var S=r.current.getTotalLength();S&&l(S)}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,v=n.animationBegin,b=n.isAnimationActive,x=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var w=Et("recharts-rectangle",p);return x?T.createElement(Xo,{canBegin:s>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:m,animationEasing:g,isActive:x},function(S){var C=S.width,A=S.height,_=S.x,j=S.y;return T.createElement(Xo,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:m,isActive:b,easing:g},T.createElement("path",Kx({},Ze(n,!0),{className:w,d:RM(_,j,C,A,h),ref:r})))}):T.createElement("path",Kx({},Ze(n,!0),{className:w,d:RM(c,u,d,f,h)}))},fPe=["points","className","baseLinePoints","connectNulls"];function Vu(){return Vu=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function pPe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function MM(t){return yPe(t)||vPe(t)||gPe(t)||mPe()}function mPe(){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 gPe(t,e){if(t){if(typeof t=="string")return e_(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e_(t,e)}}function vPe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function yPe(t){if(Array.isArray(t))return e_(t)}function e_(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return e.forEach(function(r){DM(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),DM(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},Qh=function(e,n){var r=xPe(e);n&&(r=[r.reduce(function(o,s){return[].concat(MM(o),MM(s))},[])]);var i=r.map(function(o){return o.reduce(function(s,l,c){return"".concat(s).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return r.length===1?"".concat(i,"Z"):i},bPe=function(e,n,r){var i=Qh(e,r);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(Qh(n.reverse(),r).slice(1))},hG=function(e){var n=e.points,r=e.className,i=e.baseLinePoints,o=e.connectNulls,s=hPe(e,fPe);if(!n||!n.length)return null;var l=Et("recharts-polygon",r);if(i&&i.length){var c=s.stroke&&s.stroke!=="none",u=bPe(n,i,o);return T.createElement("g",{className:l},T.createElement("path",Vu({},Ze(s,!0),{fill:u.slice(-1)==="Z"?s.fill:"none",stroke:"none",d:u})),c?T.createElement("path",Vu({},Ze(s,!0),{fill:"none",d:Qh(n,o)})):null,c?T.createElement("path",Vu({},Ze(s,!0),{fill:"none",d:Qh(i,o)})):null)}var d=Qh(n,o);return T.createElement("path",Vu({},Ze(s,!0),{fill:d.slice(-1)==="Z"?s.fill:"none",className:l,d}))};function t_(){return t_=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function EPe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var NPe=function(e,n,r,i,o,s){return"M".concat(e,",").concat(o,"v").concat(i,"M").concat(s,",").concat(n,"h").concat(r)},TPe=function(e){var n=e.x,r=n===void 0?0:n,i=e.y,o=i===void 0?0:i,s=e.top,l=s===void 0?0:s,c=e.left,u=c===void 0?0:c,d=e.width,f=d===void 0?0:d,h=e.height,p=h===void 0?0:h,g=e.className,m=jPe(e,wPe),v=SPe({x:r,y:o,top:l,left:u,width:f,height:p},m);return!Ee(r)||!Ee(o)||!Ee(f)||!Ee(p)||!Ee(l)||!Ee(u)?null:T.createElement("path",n_({},Ze(v,!0),{className:Et("recharts-cross",g),d:NPe(r,o,f,p,l,u)}))},PPe=["cx","cy","innerRadius","outerRadius","gridType","radialLines"];function Cm(t){"@babel/helpers - typeof";return Cm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cm(t)}function kPe(t,e){if(t==null)return{};var n=OPe(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function OPe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Aa(){return Aa=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function tke(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function nke(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function BM(t,e){for(var n=0;nVM?s=i==="outer"?"start":"end":o<-VM?s=i==="outer"?"end":"start":s="middle",s}},{key:"renderAxisLine",value:function(){var r=this.props,i=r.cx,o=r.cy,s=r.radius,l=r.axisLine,c=r.axisLineType,u=tc(tc({},Ze(this.props,!1)),{},{fill:"none"},Ze(l,!1));if(c==="circle")return T.createElement(hg,lc({className:"recharts-polar-angle-axis-line"},u,{cx:i,cy:o,r:s}));var d=this.props.ticks,f=d.map(function(h){return Zt(i,o,s,h.coordinate)});return T.createElement(hG,lc({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var r=this,i=this.props,o=i.ticks,s=i.tick,l=i.tickLine,c=i.tickFormatter,u=i.stroke,d=Ze(this.props,!1),f=Ze(s,!1),h=tc(tc({},d),{},{fill:"none"},Ze(l,!1)),p=o.map(function(g,m){var v=r.getTickLineCoord(g),b=r.getTickTextAnchor(g),x=tc(tc(tc({textAnchor:b},d),{},{stroke:"none",fill:u},f),{},{index:m,payload:g,x:v.x2,y:v.y2});return T.createElement(Ht,lc({className:Et("recharts-polar-angle-axis-tick",X8(s)),key:"tick-".concat(g.coordinate)},eu(r.props,g,m)),l&&T.createElement("line",lc({className:"recharts-polar-angle-axis-tick-line"},h,v)),s&&e.renderTickItem(s,x,c?c(g.value,m):g.value))});return T.createElement(Ht,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var r=this.props,i=r.ticks,o=r.radius,s=r.axisLine;return o<=0||!i||!i.length?null:T.createElement(Ht,{className:Et("recharts-polar-angle-axis",this.props.className)},s&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,i,o){var s;return T.isValidElement(r)?s=T.cloneElement(r,i):xt(r)?s=r(i):s=T.createElement(tu,lc({},i,{className:"recharts-polar-angle-axis-tick-value"}),o),s}}])}(y.PureComponent);fw(zf,"displayName","PolarAngleAxis");fw(zf,"axisType","angleAxis");fw(zf,"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 vke=vV,yke=vke(Object.getPrototypeOf,Object),xke=yke,bke=Ta,wke=xke,Ske=Pa,Cke="[object Object]",Ake=Function.prototype,_ke=Object.prototype,xG=Ake.toString,jke=_ke.hasOwnProperty,Eke=xG.call(Object);function Nke(t){if(!Ske(t)||bke(t)!=Cke)return!1;var e=wke(t);if(e===null)return!0;var n=jke.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&xG.call(n)==Eke}var Tke=Nke;const Pke=en(Tke);var kke=Ta,Oke=Pa,Ike="[object Boolean]";function Rke(t){return t===!0||t===!1||Oke(t)&&kke(t)==Ike}var Mke=Rke;const Dke=en(Mke);function _m(t){"@babel/helpers - typeof";return _m=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_m(t)}function Yx(){return Yx=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);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 S=w.upperWidth,C=w.lowerWidth,A=w.height,_=w.x,j=w.y;return T.createElement(Xo,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:m,easing:g},T.createElement("path",Yx({},Ze(n,!0),{className:x,d:qM(_,j,S,C,A),ref:r})))}):T.createElement("g",null,T.createElement("path",Yx({},Ze(n,!0),{className:x,d:qM(c,u,d,f,h)})))},Wke=["option","shapeType","propTransformer","activeClassName","isActive"];function jm(t){"@babel/helpers - typeof";return jm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jm(t)}function qke(t,e){if(t==null)return{};var n=Yke(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Yke(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function YM(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Qx(t){for(var e=1;e0?zi(w,"paddingAngle",0):0;if(C){var _=br(C.endAngle-C.startAngle,w.endAngle-w.startAngle),j=yn(yn({},w),{},{startAngle:x+A,endAngle:x+_(m)+A});v.push(j),x=j.endAngle}else{var k=w.endAngle,P=w.startAngle,I=br(0,k-P),E=I(m),R=yn(yn({},w),{},{startAngle:x+A,endAngle:x+E+A});v.push(R),x=R.endAngle}}),T.createElement(Ht,null,r.renderSectorsStatically(v))})}},{key:"attachKeyboardHandlers",value:function(r){var i=this;r.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var s=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[s].focus(),i.setState({sectorToFocus:s});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,o=r.isAnimationActive,s=this.state.prevSectors;return o&&i&&i.length&&(!s||!nu(s,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,o=i.hide,s=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(o||!s||!s.length||!Ee(u)||!Ee(d)||!Ee(f)||!Ee(h))return null;var m=Et("recharts-pie",l);return T.createElement(Ht,{tabIndex:this.props.rootTabIndex,className:m,ref:function(b){r.pieRef=b}},this.renderSectors(),c&&this.renderLabels(s),wr.renderCallByParent(this.props,null,!1),(!p||g)&&_s.renderCallByParent(this.props,s,!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?x:x-1)*c,S=v-x*p-w,C=i.reduce(function(j,k){var P=qn(k,b,0);return j+(Ne(P)?P:0)},0),A;if(C>0){var _;A=i.map(function(j,k){var P=qn(j,b,0),R=qn(j,d,k),E=(Ne(P)?P:0)/C,I;k?I=_.endAngle+ii(m)*c*(P!==0?1:0):I=s;var L=I+ii(m)*((P!==0?p:0)+E*S),V=(I+L)/2,$=(g.innerRadius+g.outerRadius)/2,z=[{name:R,value:P,payload:j,dataKey:b,type:h}],M=Jt(g.cx,g.cy,$,V);return _=yn(yn(yn({percent:E,cornerRadius:o,name:R,tooltipPayload:z,midAngle:V,middleRadius:$,tooltipPosition:M},j),g),{},{value:qn(j,b),startAngle:I,endAngle:L,payload:j,paddingAngle:ii(m)*c}),_})}return yn(yn({},g),{},{sectors:A,data:i})});function vOe(t){return t&&t.length?t[0]:void 0}var yOe=vOe,xOe=yOe;const bOe=en(xOe);var wOe=["key"];function Yd(t){"@babel/helpers - typeof";return Yd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Yd(t)}function SOe(t,e){if(t==null)return{};var n=COe(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function COe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Jx(){return Jx=Object.assign?Object.assign.bind():function(t){for(var e=1;e=2&&(c=!0),u.push(Zr(Zr({},Jt(s,l,x,v)),{},{name:g,value:m,cx:s,cy:l,radius:x,angle:v,payload:h}))});var f=[];return c&&u.forEach(function(h){if(Array.isArray(h.value)){var p=bOe(h.value),g=Pt(p)?void 0:e.scale(p);f.push(Zr(Zr({},h),{},{radius:g},Jt(s,l,g,h.angle)))}else f.push(h)}),{points:u,isRange:c,baseLinePoints:f}});var kOe=Math.ceil,OOe=Math.max;function IOe(t,e,n,r){for(var i=-1,o=OOe(kOe((e-t)/(n||1)),0),s=Array(o);o--;)s[r?o:++i]=t,t+=n;return s}var ROe=IOe,MOe=$V,nD=1/0,DOe=17976931348623157e292;function $Oe(t){if(!t)return t===0?t:0;if(t=MOe(t),t===nD||t===-nD){var e=t<0?-1:1;return e*DOe}return t===t?t:0}var jG=$Oe,LOe=ROe,FOe=ew,KS=jG;function UOe(t){return function(e,n,r){return r&&typeof r!="number"&&FOe(e,n,r)&&(n=r=void 0),e=KS(e),n===void 0?(n=e,e=0):n=KS(n),r=r===void 0?e0&&r.handleDrag(i.changedTouches[0])}),Pi(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=r.props,o=i.endIndex,s=i.onDragEnd,l=i.startIndex;s==null||s({endIndex:o,startIndex:l})}),r.detachDragEndListener()}),Pi(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Pi(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Pi(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Pi(r,"handleSlideDragStart",function(i){var o=aD(i)?i.changedTouches[0]:i;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return eIe(e,t),QOe(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var i=r.startX,o=r.endX,s=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,d=u.length-1,f=Math.min(i,o),h=Math.max(i,o),p=e.getIndexInRange(s,f),g=e.getIndexInRange(s,h);return{startIndex:p-p%c,endIndex:g===d?d:g-g%c}}},{key:"getTextOfTick",value:function(r){var i=this.props,o=i.data,s=i.tickFormatter,l=i.dataKey,c=qn(o[r],l,r);return xt(s)?s(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,o=i.slideMoveStartX,s=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-o;m>0?m=Math.min(m,u+d-f-l,u+d-f-s):m<0&&(m=Math.max(m,u-s,u-l));var v=this.getIndex({startX:s+m,endX:l+m});(v.startIndex!==h||v.endIndex!==p)&&g&&g(v),this.setState({startX:s+m,endX:l+m,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,i){var o=aD(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var i=this.state,o=i.brushMoveStartX,s=i.movingTravellerId,l=i.endX,c=i.startX,u=this.state[s],d=this.props,f=d.x,h=d.width,p=d.travellerWidth,g=d.onChange,m=d.gap,v=d.data,b={startX:this.state.startX,endX:this.state.endX},x=r.pageX-o;x>0?x=Math.min(x,f+h-p-u):x<0&&(x=Math.max(x,f-u)),b[s]=u+x;var w=this.getIndex(b),S=w.startIndex,C=w.endIndex,A=function(){var j=v.length-1;return s==="startX"&&(l>c?S%m===0:C%m===0)||lc?C%m===0:S%m===0)||l>c&&C===j};this.setState(Pi(Pi({},s,u+x),"brushMoveStartX",r.pageX),function(){g&&A()&&g(w)})}},{key:"handleTravellerMoveKeyboard",value:function(r,i){var o=this,s=this.state,l=s.scaleValues,c=s.startX,u=s.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(Pi({},i,p),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,i=r.x,o=r.y,s=r.width,l=r.height,c=r.fill,u=r.stroke;return T.createElement("rect",{stroke:u,fill:c,x:i,y:o,width:s,height:l})}},{key:"renderPanorama",value:function(){var r=this.props,i=r.x,o=r.y,s=r.width,l=r.height,c=r.data,u=r.children,d=r.padding,f=y.Children.only(u);return f?T.cloneElement(f,{x:i,y:o,width:s,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(r,i){var o,s,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,v=c.endIndex,b=Math.max(r,this.props.x),x=WS(WS({},Je(this.props,!1)),{},{x:b,y:u,width:d,height:f}),w=p||"Min value: ".concat((o=g[m])===null||o===void 0?void 0:o.name,", Max value: ").concat((s=g[v])===null||s===void 0?void 0:s.name);return T.createElement(Ht,{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(C){["ArrowLeft","ArrowRight"].includes(C.key)&&(C.preventDefault(),C.stopPropagation(),l.handleTravellerMoveKeyboard(C.key==="ArrowRight"?1:-1,i))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(h,x))}},{key:"renderSlide",value:function(r,i){var o=this.props,s=o.y,l=o.height,c=o.stroke,u=o.travellerWidth,d=Math.min(r,i)+u,f=Math.max(Math.abs(i-r)-u,0);return T.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:s,width:f,height:l})}},{key:"renderText",value:function(){var r=this.props,i=r.startIndex,o=r.endIndex,s=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 T.createElement(Ht,{className:"recharts-brush-texts"},T.createElement(tu,nb({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:s+l/2},g),this.getTextOfTick(i)),T.createElement(tu,nb({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+c+p,y:s+l/2},g),this.getTextOfTick(o)))}},{key:"render",value:function(){var r=this.props,i=r.data,o=r.className,s=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,v=h.isSlideMoving,b=h.isTravellerMoving,x=h.isTravellerFocused;if(!i||!i.length||!Ne(l)||!Ne(c)||!Ne(u)||!Ne(d)||u<=0||d<=0)return null;var w=Nt("recharts-brush",o),S=T.Children.count(s)===1,C=qOe("userSelect","none");return T.createElement(Ht,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:C},this.renderBackground(),S&&this.renderPanorama(),this.renderSlide(p,g),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(g,"endX"),(m||v||b||x||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var i=r.x,o=r.y,s=r.width,l=r.height,c=r.stroke,u=Math.floor(o+l/2)-1;return T.createElement(T.Fragment,null,T.createElement("rect",{x:i,y:o,width:s,height:l,fill:c,stroke:"none"}),T.createElement("line",{x1:i+1,y1:u,x2:i+s-1,y2:u,fill:"none",stroke:"#fff"}),T.createElement("line",{x1:i+1,y1:u+2,x2:i+s-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,i){var o;return T.isValidElement(r)?o=T.cloneElement(r,i):xt(r)?o=r(i):o=e.renderDefaultTraveller(i),o}},{key:"getDerivedStateFromProps",value:function(r,i){var o=r.data,s=r.width,l=r.x,c=r.travellerWidth,u=r.updateId,d=r.startIndex,f=r.endIndex;if(o!==i.prevData||u!==i.prevUpdateId)return WS({prevData:o,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:s},o&&o.length?nIe({data:o,width:s,x:l,travellerWidth:c,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(i.scale&&(s!==i.prevWidth||l!==i.prevX||c!==i.prevTravellerWidth)){i.scale.range([l,l+s-c]);var h=i.scale.domain().map(function(p){return i.scale(p)});return{prevData:o,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:s,startX:i.scale(r.startIndex),endX:i.scale(r.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(r,i){for(var o=r.length,s=0,l=o-1;l-s>1;){var c=Math.floor((s+l)/2);r[c]>i?l=c:s=c}return i>=r[l]?l:s}}])}(y.PureComponent);Pi(Xd,"displayName","Brush");Pi(Xd,"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 rIe=PT;function iIe(t,e){var n;return rIe(t,function(r,i,o){return n=e(r,i,o),!n}),!!n}var oIe=iIe,sIe=uV,aIe=$s,lIe=oIe,cIe=Ni,uIe=ew;function dIe(t,e,n){var r=cIe(t)?sIe:lIe;return n&&uIe(t,e,n)&&(e=void 0),r(t,aIe(e))}var fIe=dIe;const hIe=en(fIe);var js=function(e,n){var r=e.alwaysShow,i=e.ifOverflow;return r&&(i="extendDomain"),i===n},lD=OV;function pIe(t,e,n){e=="__proto__"&&lD?lD(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var mIe=pIe,gIe=mIe,vIe=PV,yIe=$s;function xIe(t,e){var n={};return e=yIe(e),vIe(t,function(r,i,o){gIe(n,i,e(r,i,o))}),n}var bIe=xIe;const wIe=en(bIe);function SIe(t,e){for(var n=-1,r=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function FIe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function UIe(t,e){var n=t.x,r=t.y,i=LIe(t,RIe),o="".concat(n),s=parseInt(o,10),l="".concat(r),c=parseInt(l,10),u="".concat(e.height||i.height),d=parseInt(u,10),f="".concat(e.width||i.width),h=parseInt(f,10);return gh(gh(gh(gh(gh({},e),i),s?{x:s}:{}),c?{y:c}:{}),{},{height:d,width:h,name:e.name,radius:e.radius})}function uD(t){return T.createElement(wG,c_({shapeType:"rectangle",propTransformer:UIe,activeClassName:"recharts-active-bar"},t))}var BIe=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,i){if(typeof e=="number")return e;var o=typeof r=="number";return o?e(r,i):(o||iu(),n)}},HIe=["value","background"],kG;function Zd(t){"@babel/helpers - typeof";return Zd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zd(t)}function zIe(t,e){if(t==null)return{};var n=VIe(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function VIe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function ib(){return ib=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&Math.abs(V)0&&Math.abs(L)0&&(I=Math.min((F||0)-(L[ue-1]||0),I))}),Number.isFinite(I)){var V=I/E,$=m.layout==="vertical"?r.height:r.width;if(m.padding==="gap"&&(_=V*$/2),m.padding==="no-gap"){var z=oi(e.barCategoryGap,V*$),M=V*$/2;_=M-z-(M-z)/$*z}}}i==="xAxis"?j=[r.left+(w.left||0)+(_||0),r.left+r.width-(w.right||0)-(_||0)]:i==="yAxis"?j=c==="horizontal"?[r.top+r.height-(w.bottom||0),r.top+(w.top||0)]:[r.top+(w.top||0)+(_||0),r.top+r.height-(w.bottom||0)-(_||0)]:j=m.range,C&&(j=[j[1],j[0]]);var U=V8(m,o,h),K=U.scale,X=U.realScaleType;K.domain(b).range(j),G8(K);var re=K8(K,No(No({},m),{},{realScaleType:X}));i==="xAxis"?(R=v==="top"&&!S||v==="bottom"&&S,k=r.left,P=f[A]-R*m.height):i==="yAxis"&&(R=v==="left"&&!S||v==="right"&&S,k=f[A]-R*m.width,P=r.top);var xe=No(No(No({},m),re),{},{realScaleType:X,x:k,y:P,scale:K,width:i==="xAxis"?r.width:m.width,height:i==="yAxis"?r.height:m.height});return xe.bandSize=Bx(xe,re),!m.hide&&i==="xAxis"?f[A]+=(R?-1:1)*xe.height:m.hide||(f[A]+=(R?-1:1)*xe.width),No(No({},p),{},gw({},g,xe))},{})},DG=function(e,n){var r=e.x,i=e.y,o=n.x,s=n.y;return{x:Math.min(r,o),y:Math.min(i,s),width:Math.abs(o-r),height:Math.abs(s-i)}},tRe=function(e){var n=e.x1,r=e.y1,i=e.x2,o=e.y2;return DG({x:n,y:r},{x:i,y:o})},$G=function(){function t(e){ZIe(this,t),this.scale=e}return JIe(t,[{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,o=r.position;if(n!==void 0){if(o)switch(o){case"start":return this.scale(n);case"middle":{var s=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+s}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],o=r[r.length-1];return i<=o?n>=i&&n<=o:n>=o&&n<=i}}],[{key:"create",value:function(n){return new t(n)}}])}();gw($G,"EPS",1e-4);var oP=function(e){var n=Object.keys(e).reduce(function(r,i){return No(No({},r),{},gw({},i,$G.create(e[i])))},{});return No(No({},n),{},{apply:function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=o.bandAware,l=o.position;return wIe(i,function(c,u){return n[u].apply(c,{bandAware:s,position:l})})},isInRange:function(i){return PG(i,function(o,s){return n[s].isInRange(o)})}})};function nRe(t){return(t%180+180)%180}var rRe=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=nRe(i),s=o*Math.PI/180,l=Math.atan(r/n),c=s>l&&s-1?i[o?e[s]:s]:void 0}}var lRe=aRe,cRe=jG;function uRe(t){var e=cRe(t),n=e%1;return e===e?n?e-n:e:0}var dRe=uRe,fRe=AV,hRe=$s,pRe=dRe,mRe=Math.max;function gRe(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:pRe(n);return i<0&&(i=mRe(r+i,0)),fRe(t,hRe(e),i)}var vRe=gRe,yRe=lRe,xRe=vRe,bRe=yRe(xRe),wRe=bRe;const SRe=en(wRe);var CRe=ahe(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),sP=y.createContext(void 0),aP=y.createContext(void 0),LG=y.createContext(void 0),FG=y.createContext({}),UG=y.createContext(void 0),BG=y.createContext(0),HG=y.createContext(0),mD=function(e){var n=e.state,r=n.xAxisMap,i=n.yAxisMap,o=n.offset,s=e.clipPathId,l=e.children,c=e.width,u=e.height,d=CRe(o);return T.createElement(sP.Provider,{value:r},T.createElement(aP.Provider,{value:i},T.createElement(FG.Provider,{value:o},T.createElement(LG.Provider,{value:d},T.createElement(UG.Provider,{value:s},T.createElement(BG.Provider,{value:u},T.createElement(HG.Provider,{value:c},l)))))))},ARe=function(){return y.useContext(UG)},zG=function(e){var n=y.useContext(sP);n==null&&iu();var r=n[e];return r==null&&iu(),r},_Re=function(){var e=y.useContext(sP);return qa(e)},jRe=function(){var e=y.useContext(aP),n=SRe(e,function(r){return PG(r.domain,Number.isFinite)});return n||qa(e)},VG=function(e){var n=y.useContext(aP);n==null&&iu();var r=n[e];return r==null&&iu(),r},ERe=function(){var e=y.useContext(LG);return e},NRe=function(){return y.useContext(FG)},lP=function(){return y.useContext(HG)},cP=function(){return y.useContext(BG)};function Jd(t){"@babel/helpers - typeof";return Jd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jd(t)}function TRe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function PRe(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);nt*i)return!1;var o=n();return t*(e-t*o/2-r)>=0&&t*(e+t*o/2-i)<=0}function d2e(t,e){return XG(t,e+1)}function f2e(t,e,n,r,i){for(var o=(r||[]).slice(),s=e.start,l=e.end,c=0,u=1,d=s,f=function(){var g=r==null?void 0:r[c];if(g===void 0)return{v:XG(r,u)};var m=c,v,b=function(){return v===void 0&&(v=n(g,m)),v},x=g.coordinate,w=c===0||cb(t,x,b,d,l);w||(c=0,d=s,u+=1),w&&(d=x+t*(b()/2+i),c+=u)},h;u<=o.length;)if(h=f(),h)return h.v;return[]}function Om(t){"@babel/helpers - typeof";return Om=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Om(t)}function CD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Br(t){for(var e=1;e0?p.coordinate-v*t:p.coordinate})}else o[h]=p=Br(Br({},p),{},{tickCoord:p.coordinate});var b=cb(t,p.tickCoord,m,l,c);b&&(c=p.tickCoord-t*(m()/2+i),o[h]=Br(Br({},p),{},{isShow:!0}))},d=s-1;d>=0;d--)u(d);return o}function v2e(t,e,n,r,i,o){var s=(r||[]).slice(),l=s.length,c=e.start,u=e.end;if(o){var d=r[l-1],f=n(d,l-1),h=t*(d.coordinate+t*f/2-u);s[l-1]=d=Br(Br({},d),{},{tickCoord:h>0?d.coordinate-h*t:d.coordinate});var p=cb(t,d.tickCoord,function(){return f},c,u);p&&(u=d.tickCoord-t*(f/2+i),s[l-1]=Br(Br({},d),{},{isShow:!0}))}for(var g=o?l-1:l,m=function(x){var w=s[x],S,C=function(){return S===void 0&&(S=n(w,x)),S};if(x===0){var A=t*(w.coordinate-t*C()/2-c);s[x]=w=Br(Br({},w),{},{tickCoord:A<0?w.coordinate-A*t:w.coordinate})}else s[x]=w=Br(Br({},w),{},{tickCoord:w.coordinate});var _=cb(t,w.tickCoord,C,c,u);_&&(c=w.tickCoord+t*(C()/2+i),s[x]=Br(Br({},w),{},{isShow:!0}))},v=0;v=2?ii(i[1].coordinate-i[0].coordinate):1,b=u2e(o,v,p);return c==="equidistantPreserveStart"?f2e(v,b,m,i,s):(c==="preserveStart"||c==="preserveStartEnd"?h=v2e(v,b,m,i,s,c==="preserveStartEnd"):h=g2e(v,b,m,i,s),h.filter(function(x){return x.isShow}))}var y2e=["viewBox"],x2e=["viewBox"],b2e=["ticks"];function nf(t){"@babel/helpers - typeof";return nf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nf(t)}function Ku(){return Ku=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function w2e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function S2e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _D(t,e){for(var n=0;n0?c(this.props):c(p)),s<=0||l<=0||!g||!g.length?null:T.createElement(Ht,{className:Nt("recharts-cartesian-axis",u),ref:function(v){r.layerReference=v}},o&&this.renderAxisLine(),this.renderTicks(g,this.state.fontSize,this.state.letterSpacing),wr.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,i,o){var s;return T.isValidElement(r)?s=T.cloneElement(r,i):xt(r)?s=r(i):s=T.createElement(tu,Ku({},i,{className:"recharts-cartesian-axis-tick-value"}),o),s}}])}(y.Component);hP(Vf,"displayName","CartesianAxis");hP(Vf,"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 T2e=["x1","y1","x2","y2","key"],P2e=["offset"];function ou(t){"@babel/helpers - typeof";return ou=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ou(t)}function jD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Gr(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function R2e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var M2e=function(e){var n=e.fill;if(!n||n==="none")return null;var r=e.fillOpacity,i=e.x,o=e.y,s=e.width,l=e.height,c=e.ry;return T.createElement("rect",{x:i,y:o,ry:c,width:s,height:l,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function eK(t,e){var n;if(T.isValidElement(t))n=T.cloneElement(t,e);else if(xt(t))n=t(e);else{var r=e.x1,i=e.y1,o=e.x2,s=e.y2,l=e.key,c=ED(e,T2e),u=Je(c,!1);u.offset;var d=ED(u,P2e);n=T.createElement("line",wc({},d,{x1:r,y1:i,x2:o,y2:s,fill:"none",key:l}))}return n}function D2e(t){var e=t.x,n=t.width,r=t.horizontal,i=r===void 0?!0:r,o=t.horizontalPoints;if(!i||!o||!o.length)return null;var s=o.map(function(l,c){var u=Gr(Gr({},t),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(c),index:c});return eK(i,u)});return T.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function $2e(t){var e=t.y,n=t.height,r=t.vertical,i=r===void 0?!0:r,o=t.verticalPoints;if(!i||!o||!o.length)return null;var s=o.map(function(l,c){var u=Gr(Gr({},t),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(c),index:c});return eK(i,u)});return T.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function L2e(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,i=t.y,o=t.width,s=t.height,l=t.horizontalPoints,c=t.horizontal,u=c===void 0?!0:c;if(!u||!e||!e.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+s-h:d[p+1]-h;if(m<=0)return null;var v=p%e.length;return T.createElement("rect",{key:"react-".concat(p),y:h,x:r,height:m,width:o,stroke:"none",fill:e[v],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return T.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function F2e(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,i=t.fillOpacity,o=t.x,s=t.y,l=t.width,c=t.height,u=t.verticalPoints;if(!n||!r||!r.length)return null;var d=u.map(function(h){return Math.round(h+o-o)}).sort(function(h,p){return h-p});o!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],m=g?o+l-h:d[p+1]-h;if(m<=0)return null;var v=p%r.length;return T.createElement("rect",{key:"react-".concat(p),x:h,y:s,width:m,height:c,stroke:"none",fill:r[v],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return T.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var U2e=function(e,n){var r=e.xAxis,i=e.width,o=e.height,s=e.offset;return z8(fP(Gr(Gr(Gr({},Vf.defaultProps),r),{},{ticks:oa(r,!0),viewBox:{x:0,y:0,width:i,height:o}})),s.left,s.left+s.width,n)},B2e=function(e,n){var r=e.yAxis,i=e.width,o=e.height,s=e.offset;return z8(fP(Gr(Gr(Gr({},Vf.defaultProps),r),{},{ticks:oa(r,!0),viewBox:{x:0,y:0,width:i,height:o}})),s.top,s.top+s.height,n)},_u={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Im(t){var e,n,r,i,o,s,l=lP(),c=cP(),u=NRe(),d=Gr(Gr({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:_u.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:_u.fill,horizontal:(r=t.horizontal)!==null&&r!==void 0?r:_u.horizontal,horizontalFill:(i=t.horizontalFill)!==null&&i!==void 0?i:_u.horizontalFill,vertical:(o=t.vertical)!==null&&o!==void 0?o:_u.vertical,verticalFill:(s=t.verticalFill)!==null&&s!==void 0?s:_u.verticalFill,x:Ne(t.x)?t.x:u.left,y:Ne(t.y)?t.y:u.top,width:Ne(t.width)?t.width:u.width,height:Ne(t.height)?t.height:u.height}),f=d.x,h=d.y,p=d.width,g=d.height,m=d.syncWithTicks,v=d.horizontalValues,b=d.verticalValues,x=_Re(),w=jRe();if(!Ne(p)||p<=0||!Ne(g)||g<=0||!Ne(f)||f!==+f||!Ne(h)||h!==+h)return null;var S=d.verticalCoordinatesGenerator||U2e,C=d.horizontalCoordinatesGenerator||B2e,A=d.horizontalPoints,_=d.verticalPoints;if((!A||!A.length)&&xt(C)){var j=v&&v.length,k=C({yAxis:w?Gr(Gr({},w),{},{ticks:j?v:w.ticks}):void 0,width:l,height:c,offset:u},j?!0:m);Uo(Array.isArray(k),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(ou(k),"]")),Array.isArray(k)&&(A=k)}if((!_||!_.length)&&xt(S)){var P=b&&b.length,R=S({xAxis:x?Gr(Gr({},x),{},{ticks:P?b:x.ticks}):void 0,width:l,height:c,offset:u},P?!0:m);Uo(Array.isArray(R),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(ou(R),"]")),Array.isArray(R)&&(_=R)}return T.createElement("g",{className:"recharts-cartesian-grid"},T.createElement(M2e,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),T.createElement(D2e,wc({},d,{offset:u,horizontalPoints:A,xAxis:x,yAxis:w})),T.createElement($2e,wc({},d,{offset:u,verticalPoints:_,xAxis:x,yAxis:w})),T.createElement(L2e,wc({},d,{horizontalPoints:A})),T.createElement(F2e,wc({},d,{verticalPoints:_})))}Im.displayName="CartesianGrid";var H2e=["layout","type","stroke","connectNulls","isRange","ref"],z2e=["key"],tK;function rf(t){"@babel/helpers - typeof";return rf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rf(t)}function nK(t,e){if(t==null)return{};var n=V2e(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function V2e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Sc(){return Sc=Object.assign?Object.assign.bind():function(t){for(var e=1;e0||!nu(d,s)||!nu(f,l))?this.renderAreaWithAnimation(r,i):this.renderAreaStatically(s,l,r,i)}},{key:"render",value:function(){var r,i=this.props,o=i.hide,s=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,v=i.id;if(o||!l||!l.length)return null;var b=this.state.isAnimationFinished,x=l.length===1,w=Nt("recharts-area",c),S=f&&f.allowDataOverflow,C=h&&h.allowDataOverflow,A=S||C,_=Pt(v)?this.id:v,j=(r=Je(s,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},k=j.r,P=k===void 0?3:k,R=j.strokeWidth,E=R===void 0?2:R,I=fpe(s)?s:{},L=I.clipDot,V=L===void 0?!0:L,$=P*2+E;return T.createElement(Ht,{className:w},S||C?T.createElement("defs",null,T.createElement("clipPath",{id:"clipPath-".concat(_)},T.createElement("rect",{x:S?d:d-p/2,y:C?u:u-g/2,width:S?p:p*2,height:C?g:g*2})),!V&&T.createElement("clipPath",{id:"clipPath-dots-".concat(_)},T.createElement("rect",{x:d-$/2,y:u-$/2,width:p+$,height:g+$}))):null,x?null:this.renderArea(A,_),(s||x)&&this.renderDots(A,V,_),(!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}}])}(y.PureComponent);tK=Ho;ys(Ho,"displayName","Area");ys(Ho,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!Bo.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});ys(Ho,"getBaseValue",function(t,e,n,r){var i=t.layout,o=t.baseValue,s=e.props.baseValue,l=s??o;if(Ne(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]});ys(Ho,"getComposedData",function(t){var e=t.props,n=t.item,r=t.xAxis,i=t.yAxis,o=t.xAxisTicks,s=t.yAxisTicks,l=t.bandSize,c=t.dataKey,u=t.stackedData,d=t.dataStartIndex,f=t.displayedData,h=t.offset,p=e.layout,g=u&&u.length,m=tK.getBaseValue(e,n,r,i),v=p==="horizontal",b=!1,x=f.map(function(S,C){var A;g?A=u[d+C]:(A=qn(S,c),Array.isArray(A)?b=!0:A=[m,A]);var _=A[1]==null||g&&qn(S,c)==null;return v?{x:X2({axis:r,ticks:o,bandSize:l,entry:S,index:C}),y:_?null:i.scale(A[1]),value:A,payload:S}:{x:_?null:r.scale(A[1]),y:X2({axis:i,ticks:s,bandSize:l,entry:S,index:C}),value:A,payload:S}}),w;return g||b?w=x.map(function(S){var C=Array.isArray(S.value)?S.value[0]:null;return v?{x:S.x,y:C!=null&&S.y!=null?i.scale(C):null}:{x:C!=null?r.scale(C):null,y:S.y}}):w=v?i.scale(m):r.scale(m),La({points:x,baseLine:w,layout:p,isRange:b},h)});ys(Ho,"renderDotItem",function(t,e){var n;if(T.isValidElement(t))n=T.cloneElement(t,e);else if(xt(t))n=t(e);else{var r=Nt("recharts-area-dot",typeof t!="boolean"?t.className:""),i=e.key,o=nK(e,z2e);n=T.createElement(pg,Sc({},o,{key:i,className:r}))}return n});function of(t){"@babel/helpers - typeof";return of=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},of(t)}function Z2e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function J2e(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function FMe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function UMe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function BMe(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n0?s:e&&e.length&&Ne(i)&&Ne(o)?e.slice(i,o+1):[]};function yK(t){return t==="number"?[0,"auto"]:void 0}var E_=function(e,n,r,i){var o=e.graphicalItems,s=e.tooltipAxis,l=ww(n,e);return r<0||!o||!o.length||r>=l.length?null:o.reduce(function(c,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:n;f&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=r&&(f=f.slice(e.dataStartIndex,e.dataEndIndex+1));var h;if(s.dataKey&&!s.allowDuplicatedCategory){var p=f===void 0?l:f;h=hx(p,s.dataKey,i)}else h=f&&f[r]||l[r];return h?[].concat(lf(c),[q8(u,h)]):c},[])},MD=function(e,n,r,i){var o=i||{x:e.chartX,y:e.chartY},s=JMe(o,r),l=e.orderedTooltipTicks,c=e.tooltipAxis,u=e.tooltipTicks,d=hEe(s,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,h=E_(e,n,d,f),p=eDe(r,l,d,o);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},tDe=function(e,n){var r=n.axes,i=n.graphicalItems,o=n.axisType,s=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=e.layout,f=e.children,h=e.stackOffset,p=H8(d,o);return r.reduce(function(g,m){var v,b=m.type.defaultProps!==void 0?de(de({},m.type.defaultProps),m.props):m.props,x=b.type,w=b.dataKey,S=b.allowDataOverflow,C=b.allowDuplicatedCategory,A=b.scale,_=b.ticks,j=b.includeHidden,k=b[s];if(g[k])return g;var P=ww(e.data,{graphicalItems:i.filter(function(re){var xe,F=s in re.props?re.props[s]:(xe=re.type.defaultProps)===null||xe===void 0?void 0:xe[s];return F===k}),dataStartIndex:c,dataEndIndex:u}),R=P.length,E,I,L;EMe(b.domain,S,x)&&(E=BA(b.domain,null,S),p&&(x==="number"||A!=="auto")&&(L=Yh(P,w,"category")));var V=yK(x);if(!E||E.length===0){var $,z=($=b.domain)!==null&&$!==void 0?$:V;if(w){if(E=Yh(P,w,x),x==="category"&&p){var M=rpe(E);C&&M?(I=E,E=tb(0,R)):C||(E=tM(z,E,m).reduce(function(re,xe){return re.indexOf(xe)>=0?re:[].concat(lf(re),[xe])},[]))}else if(x==="category")C?E=E.filter(function(re){return re!==""&&!Pt(re)}):E=tM(z,E,m).reduce(function(re,xe){return re.indexOf(xe)>=0||xe===""||Pt(xe)?re:[].concat(lf(re),[xe])},[]);else if(x==="number"){var U=yEe(P,i.filter(function(re){var xe,F,ue=s in re.props?re.props[s]:(xe=re.type.defaultProps)===null||xe===void 0?void 0:xe[s],ie="hide"in re.props?re.props.hide:(F=re.type.defaultProps)===null||F===void 0?void 0:F.hide;return ue===k&&(j||!ie)}),w,o,d);U&&(E=U)}p&&(x==="number"||A!=="auto")&&(L=Yh(P,w,"category"))}else p?E=tb(0,R):l&&l[k]&&l[k].hasStack&&x==="number"?E=h==="expand"?[0,1]:W8(l[k].stackGroups,c,u):E=B8(P,i.filter(function(re){var xe=s in re.props?re.props[s]:re.type.defaultProps[s],F="hide"in re.props?re.props.hide:re.type.defaultProps.hide;return xe===k&&(j||!F)}),x,d,!0);if(x==="number")E=A_(f,E,k,o,_),z&&(E=BA(z,E,S));else if(x==="category"&&z){var K=z,X=E.every(function(re){return K.indexOf(re)>=0});X&&(E=K)}}return de(de({},g),{},Ct({},k,de(de({},b),{},{axisType:o,domain:E,categoricalDomain:L,duplicateDomain:I,originalDomain:(v=b.domain)!==null&&v!==void 0?v:V,isCategorical:p,layout:d})))},{})},nDe=function(e,n){var r=n.graphicalItems,i=n.Axis,o=n.axisType,s=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=e.layout,f=e.children,h=ww(e.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:u}),p=h.length,g=H8(d,o),m=-1;return r.reduce(function(v,b){var x=b.type.defaultProps!==void 0?de(de({},b.type.defaultProps),b.props):b.props,w=x[s],S=yK("number");if(!v[w]){m++;var C;return g?C=tb(0,p):l&&l[w]&&l[w].hasStack?(C=W8(l[w].stackGroups,c,u),C=A_(f,C,w,o)):(C=BA(S,B8(h,r.filter(function(A){var _,j,k=s in A.props?A.props[s]:(_=A.type.defaultProps)===null||_===void 0?void 0:_[s],P="hide"in A.props?A.props.hide:(j=A.type.defaultProps)===null||j===void 0?void 0:j.hide;return k===w&&!P}),"number",d),i.defaultProps.allowDataOverflow),C=A_(f,C,w,o)),de(de({},v),{},Ct({},w,de(de({axisType:o},i.defaultProps),{},{hide:!0,orientation:zi(XMe,"".concat(o,".").concat(m%2),null),domain:C,originalDomain:S,isCategorical:g,layout:d})))}return v},{})},rDe=function(e,n){var r=n.axisType,i=r===void 0?"xAxis":r,o=n.AxisComp,s=n.graphicalItems,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=e.children,f="".concat(i,"Id"),h=fo(d,o),p={};return h&&h.length?p=tDe(e,{axes:h,graphicalItems:s,axisType:i,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):s&&s.length&&(p=nDe(e,{Axis:o,graphicalItems:s,axisType:i,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),p},iDe=function(e){var n=qa(e),r=oa(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:kT(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Bx(n,r)}},DD=function(e){var n=e.children,r=e.defaultShowTooltip,i=Ri(n,Xd),o=0,s=0;return e.data&&e.data.length!==0&&(s=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(s=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:s,activeTooltipIndex:-1,isTooltipActive:!!r}},oDe=function(e){return!e||!e.length?!1:e.some(function(n){var r=la(n&&n.type);return r&&r.indexOf("Bar")>=0})},$D=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},sDe=function(e,n){var r=e.props,i=e.graphicalItems,o=e.xAxisMap,s=o===void 0?{}:o,l=e.yAxisMap,c=l===void 0?{}:l,u=r.width,d=r.height,f=r.children,h=r.margin||{},p=Ri(f,Xd),g=Ri(f,ca),m=Object.keys(c).reduce(function(C,A){var _=c[A],j=_.orientation;return!_.mirror&&!_.hide?de(de({},C),{},Ct({},j,C[j]+_.width)):C},{left:h.left||0,right:h.right||0}),v=Object.keys(s).reduce(function(C,A){var _=s[A],j=_.orientation;return!_.mirror&&!_.hide?de(de({},C),{},Ct({},j,zi(C,"".concat(j))+_.height)):C},{top:h.top||0,bottom:h.bottom||0}),b=de(de({},v),m),x=b.bottom;p&&(b.bottom+=p.props.height||Xd.defaultProps.height),g&&n&&(b=gEe(b,i,r,n));var w=u-b.left-b.right,S=d-b.top-b.bottom;return de(de({brushBottom:x},b),{},{width:Math.max(w,0),height:Math.max(S,0)})},aDe=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},Sw=function(e){var n=e.chartName,r=e.GraphicalChild,i=e.defaultTooltipEventType,o=i===void 0?"axis":i,s=e.validateTooltipEventTypes,l=s===void 0?["axis"]:s,c=e.axisComponents,u=e.legendContent,d=e.formatAxisMap,f=e.defaultProps,h=function(v,b){var x=b.graphicalItems,w=b.stackGroups,S=b.offset,C=b.updateId,A=b.dataStartIndex,_=b.dataEndIndex,j=v.barSize,k=v.layout,P=v.barGap,R=v.barCategoryGap,E=v.maxBarSize,I=$D(k),L=I.numericAxisName,V=I.cateAxisName,$=oDe(x),z=[];return x.forEach(function(M,U){var K=ww(v.data,{graphicalItems:[M],dataStartIndex:A,dataEndIndex:_}),X=M.type.defaultProps!==void 0?de(de({},M.type.defaultProps),M.props):M.props,re=X.dataKey,xe=X.maxBarSize,F=X["".concat(L,"Id")],ue=X["".concat(V,"Id")],ie={},ce=c.reduce(function(H,Q){var Z=b["".concat(Q.axisType,"Map")],B=X["".concat(Q.axisType,"Id")];Z&&Z[B]||Q.axisType==="zAxis"||iu();var ee=Z[B];return de(de({},H),{},Ct(Ct({},Q.axisType,ee),"".concat(Q.axisType,"Ticks"),oa(ee)))},ie),Me=ce[V],pe=ce["".concat(V,"Ticks")],Se=w&&w[F]&&w[F].hasStack&&EEe(M,w[F].stackGroups),Te=la(M.type).indexOf("Bar")>=0,ne=Bx(Me,pe),rt=[],Fe=$&&pEe({barSize:j,stackGroups:w,totalSize:aDe(ce,V)});if(Te){var vt,mt,Bt=Pt(xe)?E:xe,N=(vt=(mt=Bx(Me,pe,!0))!==null&&mt!==void 0?mt:Bt)!==null&&vt!==void 0?vt:0;rt=mEe({barGap:P,barCategoryGap:R,bandSize:N!==ne?N:ne,sizeList:Fe[ue],maxBarSize:Bt}),N!==ne&&(rt=rt.map(function(H){return de(de({},H),{},{position:de(de({},H.position),{},{offset:H.position.offset-N/2})})}))}var D=M&&M.type&&M.type.getComposedData;D&&z.push({props:de(de({},D(de(de({},ce),{},{displayedData:K,props:v,dataKey:re,item:M,bandSize:ne,barPosition:rt,offset:S,stackedData:Se,layout:k,dataStartIndex:A,dataEndIndex:_}))),{},Ct(Ct(Ct({key:M.key||"item-".concat(U)},L,ce[L]),V,ce[V]),"animationId",C)),childIndex:mpe(M,v.children),item:M})}),z},p=function(v,b){var x=v.props,w=v.dataStartIndex,S=v.dataEndIndex,C=v.updateId;if(!qI({props:x}))return null;var A=x.children,_=x.layout,j=x.stackOffset,k=x.data,P=x.reverseStackOrder,R=$D(_),E=R.numericAxisName,I=R.cateAxisName,L=fo(A,r),V=_Ee(k,L,"".concat(E,"Id"),"".concat(I,"Id"),j,P),$=c.reduce(function(X,re){var xe="".concat(re.axisType,"Map");return de(de({},X),{},Ct({},xe,rDe(x,de(de({},re),{},{graphicalItems:L,stackGroups:re.axisType===E&&V,dataStartIndex:w,dataEndIndex:S}))))},{}),z=sDe(de(de({},$),{},{props:x,graphicalItems:L}),b==null?void 0:b.legendBBox);Object.keys($).forEach(function(X){$[X]=d(x,$[X],z,X.replace("Map",""),n)});var M=$["".concat(I,"Map")],U=iDe(M),K=h(x,de(de({},$),{},{dataStartIndex:w,dataEndIndex:S,updateId:C,graphicalItems:L,stackGroups:V,offset:z}));return de(de({formattedGraphicalItems:K,graphicalItems:L,offset:z,stackGroups:V},U),$)},g=function(m){function v(b){var x,w,S;return UMe(this,v),S=zMe(this,v,[b]),Ct(S,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Ct(S,"accessibilityManager",new jMe),Ct(S,"handleLegendBBoxUpdate",function(C){if(C){var A=S.state,_=A.dataStartIndex,j=A.dataEndIndex,k=A.updateId;S.setState(de({legendBBox:C},p({props:S.props,dataStartIndex:_,dataEndIndex:j,updateId:k},de(de({},S.state),{},{legendBBox:C}))))}}),Ct(S,"handleReceiveSyncEvent",function(C,A,_){if(S.props.syncId===C){if(_===S.eventEmitterSymbol&&typeof S.props.syncMethod!="function")return;S.applySyncEvent(A)}}),Ct(S,"handleBrushChange",function(C){var A=C.startIndex,_=C.endIndex;if(A!==S.state.dataStartIndex||_!==S.state.dataEndIndex){var j=S.state.updateId;S.setState(function(){return de({dataStartIndex:A,dataEndIndex:_},p({props:S.props,dataStartIndex:A,dataEndIndex:_,updateId:j},S.state))}),S.triggerSyncEvent({dataStartIndex:A,dataEndIndex:_})}}),Ct(S,"handleMouseEnter",function(C){var A=S.getMouseInfo(C);if(A){var _=de(de({},A),{},{isTooltipActive:!0});S.setState(_),S.triggerSyncEvent(_);var j=S.props.onMouseEnter;xt(j)&&j(_,C)}}),Ct(S,"triggeredAfterMouseMove",function(C){var A=S.getMouseInfo(C),_=A?de(de({},A),{},{isTooltipActive:!0}):{isTooltipActive:!1};S.setState(_),S.triggerSyncEvent(_);var j=S.props.onMouseMove;xt(j)&&j(_,C)}),Ct(S,"handleItemMouseEnter",function(C){S.setState(function(){return{isTooltipActive:!0,activeItem:C,activePayload:C.tooltipPayload,activeCoordinate:C.tooltipPosition||{x:C.cx,y:C.cy}}})}),Ct(S,"handleItemMouseLeave",function(){S.setState(function(){return{isTooltipActive:!1}})}),Ct(S,"handleMouseMove",function(C){C.persist(),S.throttleTriggeredAfterMouseMove(C)}),Ct(S,"handleMouseLeave",function(C){S.throttleTriggeredAfterMouseMove.cancel();var A={isTooltipActive:!1};S.setState(A),S.triggerSyncEvent(A);var _=S.props.onMouseLeave;xt(_)&&_(A,C)}),Ct(S,"handleOuterEvent",function(C){var A=ppe(C),_=zi(S.props,"".concat(A));if(A&&xt(_)){var j,k;/.*touch.*/i.test(A)?k=S.getMouseInfo(C.changedTouches[0]):k=S.getMouseInfo(C),_((j=k)!==null&&j!==void 0?j:{},C)}}),Ct(S,"handleClick",function(C){var A=S.getMouseInfo(C);if(A){var _=de(de({},A),{},{isTooltipActive:!0});S.setState(_),S.triggerSyncEvent(_);var j=S.props.onClick;xt(j)&&j(_,C)}}),Ct(S,"handleMouseDown",function(C){var A=S.props.onMouseDown;if(xt(A)){var _=S.getMouseInfo(C);A(_,C)}}),Ct(S,"handleMouseUp",function(C){var A=S.props.onMouseUp;if(xt(A)){var _=S.getMouseInfo(C);A(_,C)}}),Ct(S,"handleTouchMove",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.throttleTriggeredAfterMouseMove(C.changedTouches[0])}),Ct(S,"handleTouchStart",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseDown(C.changedTouches[0])}),Ct(S,"handleTouchEnd",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseUp(C.changedTouches[0])}),Ct(S,"triggerSyncEvent",function(C){S.props.syncId!==void 0&&YS.emit(QS,S.props.syncId,C,S.eventEmitterSymbol)}),Ct(S,"applySyncEvent",function(C){var A=S.props,_=A.layout,j=A.syncMethod,k=S.state.updateId,P=C.dataStartIndex,R=C.dataEndIndex;if(C.dataStartIndex!==void 0||C.dataEndIndex!==void 0)S.setState(de({dataStartIndex:P,dataEndIndex:R},p({props:S.props,dataStartIndex:P,dataEndIndex:R,updateId:k},S.state)));else if(C.activeTooltipIndex!==void 0){var E=C.chartX,I=C.chartY,L=C.activeTooltipIndex,V=S.state,$=V.offset,z=V.tooltipTicks;if(!$)return;if(typeof j=="function")L=j(z,C);else if(j==="value"){L=-1;for(var M=0;M=0){var Se,Te;if(E.dataKey&&!E.allowDuplicatedCategory){var ne=typeof E.dataKey=="function"?pe:"payload.".concat(E.dataKey.toString());Se=hx(M,ne,L),Te=U&&K&&hx(K,ne,L)}else Se=M==null?void 0:M[I],Te=U&&K&&K[I];if(ue||F){var rt=C.props.activeIndex!==void 0?C.props.activeIndex:I;return[y.cloneElement(C,de(de(de({},j.props),ce),{},{activeIndex:rt})),null,null]}if(!Pt(Se))return[Me].concat(lf(S.renderActivePoints({item:j,activePoint:Se,basePoint:Te,childIndex:I,isRange:U})))}else{var Fe,vt=(Fe=S.getItemByXY(S.state.activeCoordinate))!==null&&Fe!==void 0?Fe:{graphicalItem:Me},mt=vt.graphicalItem,Bt=mt.item,N=Bt===void 0?C:Bt,D=mt.childIndex,H=de(de(de({},j.props),ce),{},{activeIndex:D});return[y.cloneElement(N,H),null,null]}return U?[Me,null,null]:[Me,null]}),Ct(S,"renderCustomized",function(C,A,_){return y.cloneElement(C,de(de({key:"recharts-customized-".concat(_)},S.props),S.state))}),Ct(S,"renderMap",{CartesianGrid:{handler:uv,once:!0},ReferenceArea:{handler:S.renderReferenceElement},ReferenceLine:{handler:uv},ReferenceDot:{handler:S.renderReferenceElement},XAxis:{handler:uv},YAxis:{handler:uv},Brush:{handler:S.renderBrush,once:!0},Bar:{handler:S.renderGraphicChild},Line:{handler:S.renderGraphicChild},Area:{handler:S.renderGraphicChild},Radar:{handler:S.renderGraphicChild},RadialBar:{handler:S.renderGraphicChild},Scatter:{handler:S.renderGraphicChild},Pie:{handler:S.renderGraphicChild},Funnel:{handler:S.renderGraphicChild},Tooltip:{handler:S.renderCursor,once:!0},PolarGrid:{handler:S.renderPolarGrid,once:!0},PolarAngleAxis:{handler:S.renderPolarAxis},PolarRadiusAxis:{handler:S.renderPolarAxis},Customized:{handler:S.renderCustomized}}),S.clipPathId="".concat((x=b.id)!==null&&x!==void 0?x:Rf("recharts"),"-clip"),S.throttleTriggeredAfterMouseMove=LV(S.triggeredAfterMouseMove,(w=b.throttleDelay)!==null&&w!==void 0?w:1e3/60),S.state={},S}return KMe(v,m),HMe(v,[{key:"componentDidMount",value:function(){var x,w;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(x=this.props.margin.left)!==null&&x!==void 0?x: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 x=this.props,w=x.children,S=x.data,C=x.height,A=x.layout,_=Ri(w,zr);if(_){var j=_.props.defaultIndex;if(!(typeof j!="number"||j<0||j>this.state.tooltipTicks.length-1)){var k=this.state.tooltipTicks[j]&&this.state.tooltipTicks[j].value,P=E_(this.state,S,j,k),R=this.state.tooltipTicks[j].coordinate,E=(this.state.offset.top+C)/2,I=A==="horizontal",L=I?{x:R,y:E}:{y:R,x:E},V=this.state.formattedGraphicalItems.find(function(z){var M=z.item;return M.type.name==="Scatter"});V&&(L=de(de({},L),V.props.points[j].tooltipPosition),P=V.props.points[j].tooltipPayload);var $={activeTooltipIndex:j,isTooltipActive:!0,activeLabel:k,activePayload:P,activeCoordinate:L};this.setState($),this.renderCursor(_),this.accessibilityManager.setIndex(j)}}}},{key:"getSnapshotBeforeUpdate",value:function(x,w){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==w.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==x.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==x.margin){var S,C;this.accessibilityManager.setDetails({offset:{left:(S=this.props.margin.left)!==null&&S!==void 0?S:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0}})}return null}},{key:"componentDidUpdate",value:function(x){nA([Ri(x.children,zr)],[Ri(this.props.children,zr)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var x=Ri(this.props.children,zr);if(x&&typeof x.props.shared=="boolean"){var w=x.props.shared?"axis":"item";return l.indexOf(w)>=0?w:o}return o}},{key:"getMouseInfo",value:function(x){if(!this.container)return null;var w=this.container,S=w.getBoundingClientRect(),C=BCe(S),A={chartX:Math.round(x.pageX-C.left),chartY:Math.round(x.pageY-C.top)},_=S.width/w.offsetWidth||1,j=this.inRange(A.chartX,A.chartY,_);if(!j)return null;var k=this.state,P=k.xAxisMap,R=k.yAxisMap,E=this.getTooltipEventType();if(E!=="axis"&&P&&R){var I=qa(P).scale,L=qa(R).scale,V=I&&I.invert?I.invert(A.chartX):null,$=L&&L.invert?L.invert(A.chartY):null;return de(de({},A),{},{xValue:V,yValue:$})}var z=MD(this.state,this.props.data,this.props.layout,j);return z?de(de({},A),z):null}},{key:"inRange",value:function(x,w){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,C=this.props.layout,A=x/S,_=w/S;if(C==="horizontal"||C==="vertical"){var j=this.state.offset,k=A>=j.left&&A<=j.left+j.width&&_>=j.top&&_<=j.top+j.height;return k?{x:A,y:_}:null}var P=this.state,R=P.angleAxisMap,E=P.radiusAxisMap;if(R&&E){var I=qa(R);return iM({x:A,y:_},I)}return null}},{key:"parseEventsOfWrapper",value:function(){var x=this.props.children,w=this.getTooltipEventType(),S=Ri(x,zr),C={};S&&w==="axis"&&(S.props.trigger==="click"?C={onClick:this.handleClick}:C={onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd});var A=px(this.props,this.handleOuterEvent);return de(de({},A),C)}},{key:"addListener",value:function(){YS.on(QS,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){YS.removeListener(QS,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(x,w,S){for(var C=this.state.formattedGraphicalItems,A=0,_=C.length;A<_;A++){var j=C[A];if(j.item===x||j.props.key===x.key||w===la(j.item.type)&&S===j.childIndex)return j}return null}},{key:"renderClipPath",value:function(){var x=this.clipPathId,w=this.state.offset,S=w.left,C=w.top,A=w.height,_=w.width;return T.createElement("defs",null,T.createElement("clipPath",{id:x},T.createElement("rect",{x:S,y:C,height:A,width:_})))}},{key:"getXScales",value:function(){var x=this.state.xAxisMap;return x?Object.entries(x).reduce(function(w,S){var C=OD(S,2),A=C[0],_=C[1];return de(de({},w),{},Ct({},A,_.scale))},{}):null}},{key:"getYScales",value:function(){var x=this.state.yAxisMap;return x?Object.entries(x).reduce(function(w,S){var C=OD(S,2),A=C[0],_=C[1];return de(de({},w),{},Ct({},A,_.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(x){var w;return(w=this.state.xAxisMap)===null||w===void 0||(w=w[x])===null||w===void 0?void 0:w.scale}},{key:"getYScaleByAxisId",value:function(x){var w;return(w=this.state.yAxisMap)===null||w===void 0||(w=w[x])===null||w===void 0?void 0:w.scale}},{key:"getItemByXY",value:function(x){var w=this.state,S=w.formattedGraphicalItems,C=w.activeItem;if(S&&S.length)for(var A=0,_=S.length;A<_;A++){var j=S[A],k=j.props,P=j.item,R=P.type.defaultProps!==void 0?de(de({},P.type.defaultProps),P.props):P.props,E=la(P.type);if(E==="Bar"){var I=(k.data||[]).find(function(z){return dPe(x,z)});if(I)return{graphicalItem:j,payload:I}}else if(E==="RadialBar"){var L=(k.data||[]).find(function(z){return iM(x,z)});if(L)return{graphicalItem:j,payload:L}}else if(pw(j,C)||mw(j,C)||Nm(j,C)){var V=cOe({graphicalItem:j,activeTooltipItem:C,itemData:R.data}),$=R.activeIndex===void 0?V:R.activeIndex;return{graphicalItem:de(de({},j),{},{childIndex:$}),payload:Nm(j,C)?R.data[V]:j.props.data[V]}}}return null}},{key:"render",value:function(){var x=this;if(!qI(this))return null;var w=this.props,S=w.children,C=w.className,A=w.width,_=w.height,j=w.style,k=w.compact,P=w.title,R=w.desc,E=ID(w,MMe),I=Je(E,!1);if(k)return T.createElement(mD,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},T.createElement(iA,Jh({},I,{width:A,height:_,title:P,desc:R}),this.renderClipPath(),QI(S,this.renderMap)));if(this.props.accessibilityLayer){var L,V;I.tabIndex=(L=this.props.tabIndex)!==null&&L!==void 0?L:0,I.role=(V=this.props.role)!==null&&V!==void 0?V:"application",I.onKeyDown=function(z){x.accessibilityManager.keyboardEvent(z)},I.onFocus=function(){x.accessibilityManager.focus()}}var $=this.parseEventsOfWrapper();return T.createElement(mD,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},T.createElement("div",Jh({className:Nt("recharts-wrapper",C),style:de({position:"relative",cursor:"default",width:A,height:_},j)},$,{ref:function(M){x.container=M}}),T.createElement(iA,Jh({},I,{width:A,height:_,title:P,desc:R,style:ZMe}),this.renderClipPath(),QI(S,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(y.Component);return Ct(g,"displayName",n),Ct(g,"defaultProps",de({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),Ct(g,"getDerivedStateFromProps",function(m,v){var b=m.dataKey,x=m.data,w=m.children,S=m.width,C=m.height,A=m.layout,_=m.stackOffset,j=m.margin,k=v.dataStartIndex,P=v.dataEndIndex;if(v.updateId===void 0){var R=DD(m);return de(de(de({},R),{},{updateId:0},p(de(de({props:m},R),{},{updateId:0}),v)),{},{prevDataKey:b,prevData:x,prevWidth:S,prevHeight:C,prevLayout:A,prevStackOffset:_,prevMargin:j,prevChildren:w})}if(b!==v.prevDataKey||x!==v.prevData||S!==v.prevWidth||C!==v.prevHeight||A!==v.prevLayout||_!==v.prevStackOffset||!ld(j,v.prevMargin)){var E=DD(m),I={chartX:v.chartX,chartY:v.chartY,isTooltipActive:v.isTooltipActive},L=de(de({},MD(v,x,A)),{},{updateId:v.updateId+1}),V=de(de(de({},E),I),L);return de(de(de({},V),p(de({props:m},V),v)),{},{prevDataKey:b,prevData:x,prevWidth:S,prevHeight:C,prevLayout:A,prevStackOffset:_,prevMargin:j,prevChildren:w})}if(!nA(w,v.prevChildren)){var $,z,M,U,K=Ri(w,Xd),X=K&&($=(z=K.props)===null||z===void 0?void 0:z.startIndex)!==null&&$!==void 0?$:k,re=K&&(M=(U=K.props)===null||U===void 0?void 0:U.endIndex)!==null&&M!==void 0?M:P,xe=X!==k||re!==P,F=!Pt(x),ue=F&&!xe?v.updateId:v.updateId+1;return de(de({updateId:ue},p(de(de({props:m},v),{},{updateId:ue,dataStartIndex:X,dataEndIndex:re}),v)),{},{prevChildren:w,dataStartIndex:X,dataEndIndex:re})}return null}),Ct(g,"renderActiveDot",function(m,v,b){var x;return y.isValidElement(m)?x=y.cloneElement(m,v):xt(m)?x=m(v):x=T.createElement(pg,v),T.createElement(Ht,{className:"recharts-active-dot",key:b},x)}),function(v){return T.createElement(g,v)}},xK=Sw({chartName:"BarChart",GraphicalChild:Xl,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Ll},{axisType:"yAxis",AxisComp:Fl}],formatAxisMap:MG}),pP=Sw({chartName:"PieChart",GraphicalChild:ts,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:zf},{axisType:"radiusAxis",AxisComp:Hf}],formatAxisMap:X8,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),lDe=Sw({chartName:"RadarChart",GraphicalChild:mg,axisComponents:[{axisType:"angleAxis",AxisComp:zf},{axisType:"radiusAxis",AxisComp:Hf}],formatAxisMap:X8,defaultProps:{layout:"centric",startAngle:90,endAngle:-270,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),bK=Sw({chartName:"AreaChart",GraphicalChild:Ho,axisComponents:[{axisType:"xAxis",AxisComp:Ll},{axisType:"yAxis",AxisComp:Fl}],formatAxisMap:MG});const cDe=({messages:t,themes:e,personas:n=[]})=>{var g;const[r,i]=y.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"}]),[o,s]=y.useState([]),[l,c]=y.useState({}),[u,d]=y.useState({isBalanced:!1,score:0,reason:""}),f=m=>{const v=n.find(b=>b.id===m);return v?v.name:`Participant ${m}`};y.useEffect(()=>{if(t.length===0)return;const m={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0},v={},b={};t.forEach(S=>{if(S.senderId!=="moderator"&&S.senderId!=="facilitator"){const C=S.text.toLowerCase();let A="Neutral";C.includes("love")||C.includes("excellent")||C.includes("amazing")?A="Very Positive":C.includes("good")||C.includes("like")||C.includes("great")?A="Positive":C.includes("bad")||C.includes("issue")||C.includes("problem")?A="Negative":(C.includes("terrible")||C.includes("hate")||C.includes("awful"))&&(A="Very Negative"),m[A]++,b[S.senderId]||(b[S.senderId]={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0}),b[S.senderId][A]++,v[S.senderId]=(v[S.senderId]||0)+1}}),i(S=>S.map(C=>({...C,value:m[C.name]||0})));const x=Object.entries(v).map(([S,C])=>({name:f(S),messages:C}));s(x);const w={};Object.entries(b).forEach(([S,C])=>{w[S]={name:f(S),sentiments:C}}),c(w),h(v,b)},[t,n,f]);const h=(m,v)=>{if(Object.keys(m).length===0){d({isBalanced:!1,score:0,reason:"No participant data available"});return}const x=Object.values(m).reduce((z,M)=>z+M,0)/Object.keys(m).length,w=Object.values(m).map(z=>Math.abs(z-x)/x),S=w.reduce((z,M)=>z+M,0)/w.length,C=Object.values(v).map(z=>Object.values(z).filter(M=>M>0).length),A=C.reduce((z,M)=>z+M,0)/C.length,_=["Very Positive","Positive","Neutral","Negative","Very Negative"],j=Object.values(v).map(z=>{const M=Math.max(...Object.values(z));return _.find(U=>z[U]===M)||"Neutral"}),k=new Set(j).size,P=k/_.length,R=Math.max(0,100-S*100),E=A/5*100,I=P*100,L=Math.round(R*.6+E*.2+I*.2);let V="";const $=L>=70;S>.3&&(V+="Participation is uneven among participants. "),A<2&&(V+="Limited range of sentiments expressed. "),k<=1?V+="Participants show similar sentiment patterns, suggesting potential group-think. ":k>=4&&(V+="Wide divergence in participant sentiments, showing healthy diversity of opinions. "),V===""&&(V=$?"Good mix of participation and diverse opinions.":"Multiple factors affecting balance."),d({isBalanced:$,score:L,reason:V})},p=m=>{const v=l[m];if(!v)return"N/A";const b=v.sentiments;let x=0,w="Neutral";return Object.entries(b).forEach(([S,C])=>{C>x&&(x=C,w=S)}),w};return a.jsx("div",{className:"glass-panel rounded-xl p-4",children:a.jsxs(Kl,{defaultValue:"sentiment",children:[a.jsxs(Ea,{className:"grid grid-cols-2 mb-4",children:[a.jsxs(on,{value:"sentiment",className:"flex items-center",children:[a.jsx(NX,{className:"h-4 w-4 mr-2"}),"Sentiment"]}),a.jsxs(on,{value:"participation",className:"flex items-center",children:[a.jsx(o1,{className:"h-4 w-4 mr-2"}),"Participation"]})]}),a.jsx(sn,{value:"sentiment",children:a.jsx(ut,{children:a.jsxs(Et,{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(Al,{width:"100%",height:"100%",children:a.jsxs(pP,{children:[a.jsx(zr,{}),a.jsx(ts,{data:r,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:m,percent:v})=>v>0?`${m} ${(v*100).toFixed(0)}%`:"",children:r.map((m,v)=>a.jsx(cg,{fill:m.color},`cell-${v}`))}),a.jsx(ca,{})]})})}),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,v])=>{var w;const b=p(m),x=((w=r.find(S=>S.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(_p,{className:"h-4 w-4 text-slate-400 mr-2"}),a.jsx("span",{className:"text-sm",children:v.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:`${x}30`,color:x},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(sn,{value:"participation",children:a.jsx(ut,{children:a.jsxs(Et,{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(Al,{width:"100%",height:"100%",children:a.jsxs(xK,{data:o,layout:"vertical",margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(Im,{strokeDasharray:"3 3"}),a.jsx(Ll,{type:"number"}),a.jsx(Fl,{dataKey:"name",type:"category",width:100}),a.jsx(zr,{}),a.jsx(Xl,{dataKey:"messages",fill:"#8884d8",name:"Messages"})]})})}),a.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:o.length>0?`Most active: ${(g=o.sort((m,v)=>v.messages-m.messages)[0])==null?void 0:g.name}`:"No participation data available"})]})})})]})})},uDe=({focusGroupId:t,personas:e,isVisible:n,onToggle:r})=>{const[i,o]=y.useState(null),[s,l]=y.useState(null),[c,u]=y.useState(null),[d,f]=y.useState(null),[h,p]=y.useState(!1),[g,m]=y.useState(null),[v,b]=y.useState(null);y.useEffect(()=>{if(n&&t){x();const _=setInterval(x,3e4);return()=>clearInterval(_)}},[n,t]);const x=async()=>{p(!0),m(null);try{const[_,j,k,P]=await Promise.allSettled([Hn.getConversationAnalytics(t),Hn.getConversationState(t),Hn.getAutonomousConversationStatus(t),Hn.getConversationInsights(t)]);_.status==="fulfilled"&&o(_.value.data.analytics),j.status==="fulfilled"&&l(j.value.data.state),k.status==="fulfilled"&&u(k.value.data.status),P.status==="fulfilled"&&f(P.value.data.insights),b(new Date)}catch(_){console.error("Error fetching dashboard data:",_),m("Failed to load dashboard data")}finally{p(!1)}},w=()=>{x()},S=_=>{switch(_){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"}},C=_=>{switch(_){case"positive":return"text-green-600";case"negative":return"text-red-600";default:return"text-gray-600"}},A=_=>{switch(_){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(ea,{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(te,{variant:"ghost",size:"sm",onClick:w,disabled:h,className:"p-1",children:a.jsx(td,{className:`h-4 w-4 ${h?"animate-spin":""}`})}),a.jsx(te,{variant:"ghost",size:"sm",onClick:r,className:"p-1",children:a.jsx(IX,{className:"h-4 w-4"})})]})]}),v&&a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Last updated: ",v.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(TX,{className:"h-4 w-4 text-red-600"}),a.jsx("span",{className:"text-sm text-red-800",children:g})]})}),c&&a.jsxs(ut,{children:[a.jsx(pi,{className:"pb-3",children:a.jsxs(Mi,{className:"text-sm flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${S(c.conversation_state)}`}),"Autonomous Status"]})}),a.jsx(Et,{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(ur,{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})]})]})})]}),s&&a.jsxs(ut,{children:[a.jsx(pi,{className:"pb-3",children:a.jsxs(Mi,{className:"text-sm flex items-center gap-2",children:[a.jsx(Qs,{className:"h-4 w-4"}),"Conversation Health"]})}),a.jsx(Et,{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(ur,{className:A(s.conversation_health.status),children:s.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:[s.conversation_health.score,"/100"]})]}),a.jsx(mc,{value:s.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:s.conversation_health.indicators.map((_,j)=>a.jsx(ur,{variant:"outline",className:"text-xs",children:_.replace("_"," ")},j))})]})]})})]}),i&&a.jsxs(ut,{children:[a.jsx(pi,{className:"pb-3",children:a.jsxs(Mi,{className:"text-sm flex items-center gap-2",children:[a.jsx(Cr,{className:"h-4 w-4"}),"Participation"]})}),a.jsx(Et,{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(ur,{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(ut,{children:[a.jsx(pi,{className:"pb-3",children:a.jsxs(Mi,{className:"text-sm flex items-center gap-2",children:[a.jsx(XX,{className:"h-4 w-4"}),"Sentiment"]})}),a.jsx(Et,{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(ur,{className:C(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(ut,{children:[a.jsx(pi,{className:"pb-3",children:a.jsxs(Mi,{className:"text-sm flex items-center gap-2",children:[a.jsx(EX,{className:"h-4 w-4"}),"Quality Metrics"]})}),a.jsx(Et,{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(mc,{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(mc,{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(mc,{value:i.quality_metrics.quality_score,className:"h-2"})]})]})})]}),d&&a.jsxs(ut,{children:[a.jsx(pi,{className:"pb-3",children:a.jsxs(Mi,{className:"text-sm flex items-center gap-2",children:[a.jsx(Vc,{className:"h-4 w-4"}),"AI Insights"]})}),a.jsx(Et,{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(ur,{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(ur,{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(ut,{children:[a.jsx(pi,{className:"pb-3",children:a.jsxs(Mi,{className:"text-sm flex items-center gap-2",children:[a.jsx(Kj,{className:"h-4 w-4"}),"Recommendations"]})}),a.jsx(Et,{className:"pt-0",children:a.jsx("div",{className:"space-y-2",children:i.recommendations.map((_,j)=>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:_})},j))})})]})]})]}):null},dDe=({discussionGuide:t,moderatorStatus:e,onSectionSelect:n,onSetPosition:r,onSave:i,focusGroupId:o,isOpen:s,onToggle:l,className:c,onEditingChange:u})=>{const d=y.useRef(!1),f=y.useCallback(v=>{d.current=v,u==null||u(v)},[u]),[h,p]=y.useState(!1),g=async()=>{if(!t){se.error("No discussion guide available",{description:"The discussion guide is not available for download"});return}p(!0);try{await jt.downloadDiscussionGuide(o),se.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(v){console.error("Error downloading discussion guide:",v),se.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{p(!1)}},m=t&&typeof t=="object"&&t.sections;return a.jsx("div",{className:ke("w-full border-b bg-white shadow-sm",c),children:a.jsxs(tg,{open:s,onOpenChange:l,children:[a.jsx(ng,{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(OX,{className:"h-5 w-5 text-slate-600"}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-semibold text-slate-900",children:"Discussion Guide"}),m&&a.jsxs("p",{className:"text-xs text-slate-500",children:[t.title," • ",t.total_duration," minutes"]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{variant:"ghost",size:"sm",onClick:v=>{v.stopPropagation(),g()},disabled:!t||h,className:"h-8",children:h?a.jsx(ws,{className:"h-4 w-4 animate-spin"}):a.jsx(zc,{className:"h-4 w-4"})}),s?a.jsx(Hc,{className:"h-4 w-4 text-slate-500"}):a.jsx(va,{className:"h-4 w-4 text-slate-500"})]})]})}),a.jsx(rg,{children:a.jsx("div",{className:"border-t bg-slate-50",children:a.jsx(ut,{className:"mx-4 mb-4 mt-2",children:a.jsx(Et,{className:"p-4",children:a.jsx("div",{className:"max-h-[70vh] overflow-y-auto",children:a.jsx(rT,{discussionGuide:t,moderatorStatus:e,onSectionSelect:n,onSetPosition:r,onSave:i,showProgress:!0,collapsible:!0,defaultExpanded:!0,focusGroupId:o,onEditingChange:f})})})})})})]})})},fDe=({focusGroupId:t,focusGroupName:e="Focus Group",onNoteClick:n})=>{const[r,i]=y.useState([]),[o,s]=y.useState(!0),[l,c]=y.useState(null);y.useEffect(()=>{u()},[t]);const u=async()=>{try{s(!0);const x=await jt.getNotes(t);if(x.data&&Array.isArray(x.data)){const w=x.data.map(S=>({...S,timestamp:new Date(S.timestamp),createdAt:new Date(S.createdAt)}));i(v(w))}}catch(x){console.error("Error fetching notes:",x),se.error("Failed to load notes",{description:"Please refresh the page to try again."})}finally{s(!1)}},d=async x=>{c(x);try{await jt.deleteNote(t,x),i(r.filter(w=>w.id!==x)),se.success("Note deleted successfully")}catch(w){console.error("Error deleting note:",w),se.error("Failed to delete note",{description:"Please try again."})}finally{c(null)}},f=x=>{x.associatedMessageId&&n?n(x.associatedMessageId):se.info("No associated message",{description:"This note is not linked to a specific discussion point."})},h=()=>{if(r.length===0){se.warning("No notes to export",{description:"Create some notes first before exporting."});return}const x=p(),w=document.createElement("a"),S=new Blob([x],{type:"text/markdown"});w.href=URL.createObjectURL(S),w.download=`${e.replace(/[^a-z0-9]/gi,"_").toLowerCase()}_notes.md`,document.body.appendChild(w),w.click(),document.body.removeChild(w),se.success("Notes exported successfully",{description:`Downloaded ${r.length} notes as Markdown file.`})},p=()=>{const x=[`# Notes: ${e}`,"",`Exported on: ${new Date().toLocaleString()}`,`Total notes: ${r.length}`,"","---",""];return r.forEach((w,S)=>{var C;x.push(`## Note ${S+1}`),x.push(""),x.push(`**Created:** ${w.createdAt.toLocaleString()}`),(C=w.sectionInfo)!=null&&C.sectionTitle&&x.push(`**Section:** ${w.sectionInfo.sectionTitle}`),x.push(`**Elapsed Time:** ${g(w.elapsedTime)}`),x.push(""),x.push("**Content:**"),x.push(w.content),x.push(""),x.push("---"),x.push("")}),x.join(` -`)},g=x=>{const w=Math.floor(x/1e3),S=Math.floor(w/60),C=w%60;return`${S}:${C.toString().padStart(2,"0")}`},m=x=>x.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),v=x=>[...x].sort((w,S)=>S.createdAt.getTime()-w.createdAt.getTime()),b=x=>{i(w=>v([...w,x]))};return y.useEffect(()=>(window.notesPanelAddNote=b,()=>{delete window.notesPanelAddNote}),[]),o?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(gy,{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(te,{variant:"outline",size:"sm",onClick:h,disabled:r.length===0,children:[a.jsx(zc,{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(gy,{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(x=>{var w;return a.jsxs(ut,{className:"hover:shadow-md transition-shadow cursor-pointer group",onClick:()=>f(x),children:[a.jsx(pi,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(Mi,{className:"text-sm font-medium text-slate-600",children:m(x.createdAt)}),((w=x.sectionInfo)==null?void 0:w.sectionTitle)&&a.jsx("div",{className:"text-xs text-slate-500 mt-1",children:a.jsx("span",{children:x.sectionInfo.sectionTitle})})]}),a.jsxs("div",{className:"flex items-center space-x-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[x.associatedMessageId&&a.jsx(te,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:S=>{S.stopPropagation(),f(x)},title:"Go to discussion point",children:a.jsx(VX,{className:"h-3 w-3"})}),a.jsx(te,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-600 hover:text-red-700",onClick:S=>{S.stopPropagation(),d(x.id)},disabled:l===x.id,title:"Delete note",children:a.jsx(Kn,{className:"h-3 w-3"})})]})]})}),a.jsx(Et,{className:"pt-0",children:a.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:x.content})})]},x.id)})})})]})},hDe=({isOpen:t,onClose:e,focusGroupId:n,associatedMessageId:r,sectionInfo:i,messageTimestamp:o,onNoteSaved:s})=>{const[l,c]=y.useState(""),[u,d]=y.useState(!1),f=async()=>{if(!l.trim()){se.error("Note content cannot be empty");return}d(!0);try{const p={content:l.trim(),associatedMessageId:r,sectionInfo:i,elapsedTime:0,timestamp:o.toISOString(),createdAt:new Date().toISOString()},g=await jt.createNote(n,p);if(g.data){const m={...g.data,timestamp:new Date(g.data.timestamp),createdAt:new Date(g.data.createdAt)},v=i!=null&&i.sectionTitle?`'${i.sectionTitle}'`:"current section",b=o.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});se.success("Quick note saved",{description:`Note linked to ${v} at ${b}`}),s&&s(m),c(""),e()}}catch(p){console.error("Error saving note:",p),se.error("Failed to save note",{description:"Please try again or check your connection."})}finally{d(!1)}},h=()=>{c(""),e()};return a.jsx(kc,{open:t,onOpenChange:h,children:a.jsxs(xl,{className:"sm:max-w-md",children:[a.jsx(bl,{children:a.jsx(Sl,{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:"})," ",o.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),a.jsx(ct,{placeholder:"Enter your note here...",value:l,onChange:p=>c(p.target.value),className:"min-h-[100px] resize-none",autoFocus:!0})]}),a.jsxs(wl,{children:[a.jsx(te,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(te,{onClick:f,disabled:u,children:u?"Saving...":"Save Note"})]})]})})},pDe=()=>{const{id:t}=Gj(),e=Xn(),[n,r]=y.useState([]),[i,o]=y.useState([]),[s,l]=y.useState([]),[c,u]=y.useState(null),[d,f]=y.useState([]),[h,p]=y.useState("chat"),[g,m]=y.useState(null),[v,b]=y.useState(!1),[x,w]=y.useState(!1),[S,C]=y.useState(!0),[A,_]=y.useState(!1),[j,k]=y.useState(!1),P=y.useRef(!1),[R,E]=y.useState(!1),I=y.useRef(c);I.current=c;const[L,V]=y.useState([]),[$,z]=y.useState(!1),[M,U]=y.useState(""),[K,X]=y.useState("medium"),[re,xe]=y.useState("medium"),[F,ue]=y.useState(!1),[ie,ce]=y.useState(!1),[Me,pe]=y.useState(null),[Se,Te]=y.useState([]),[ne,rt]=y.useState(!1),[Fe,vt]=y.useState(!1),[mt,Bt]=y.useState(!1),[N,D]=y.useState({isOpen:!1}),H=y.useRef(!1),[Q,Z]=y.useState(""),B=y.useRef(""),ee=y.useRef(!1),me=async()=>{var J;if(t)try{const oe=await Hn.getModeratorStatus(t);if((J=oe==null?void 0:oe.data)!=null&&J.status){const O=oe.data.status;if(g){const q=g.current_section_id!==O.current_section_id||g.current_item_id!==O.current_item_id||g.progress!==O.progress}P.current||m(O)}}catch(oe){console.error("Error fetching moderator status:",oe)}},Ce=async()=>{if(!t)return{aiActive:!1,sessionStatus:""};try{if(typeof(jt==null?void 0:jt.getById)!="function")return console.error("focusGroupsApi.getById is not a function:",typeof(jt==null?void 0:jt.getById)),{aiActive:x,sessionStatus:Q};const J=await jt.getById(t);if(!J||typeof J!="object")return console.error("Invalid response object received:",J),{aiActive:x,sessionStatus:Q};if(!J.data||typeof J.data!="object")return console.warn("Focus group response missing data property:",J),{aiActive:x,sessionStatus:Q};const oe=J.data.status;if(typeof oe>"u")return console.warn("Focus group response missing status field:",J.data),{aiActive:x,sessionStatus:Q};const O=oe==="ai_mode";return oe==="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(oe)||console.warn("Unexpected focus group status value:",oe),{aiActive:O,sessionStatus:oe}}catch(J){console.error("Error checking AI mode status:",J);const oe={focusGroupId:t,currentAiModeStatus:x,errorType:"unknown",timestamp:new Date().toISOString()};return J.response?(oe.errorType="api_error",oe.status=J.response.status,oe.data=J.response.data,console.error("API error response:",J.response.status,J.response.data),J.response.status===404?console.warn("Focus group not found - may have been deleted"):J.response.status===500&&console.error("Server error during status check - backend issue")):J.request?(oe.errorType="network_error",console.error("Network error - no response received, check connectivity")):(oe.errorType="request_setup",oe.message=J.message,console.error("Request setup error:",J.message)),console.debug("Status check error details:",oe),{aiActive:x,sessionStatus:Q,isGenerating:!1}}},De=async(J,oe)=>{if(!t||ee.current)return;const O=["completed","paused"],W=["ai_mode","autonomous_active","active","in-progress"].includes(oe),he=O.includes(J);if(W&&he){ee.current=!0;try{let fe="session_ended";J==="completed"?fe="auto_complete":J==="paused"&&(fe="manual_stop");const Ee=await Hn.endSession(t,fe);Ee!=null&&Ee.data&&(qe.success("Session concluded",{description:"The focus group session has ended with a concluding statement from the moderator."}),setTimeout(()=>{we()},1e3))}catch(fe){console.error("❌ Error ending session with concluding statement:",fe),qe.error("Error ending session",{description:"Failed to add concluding statement, but the session has ended."})}}},we=async()=>{var J;if(t)try{const oe=await jt.getMessages(t);let O=[],q=[];oe&&oe.data&&(Array.isArray(oe.data)?(O=oe.data,q=[]):oe.data.messages||oe.data.mode_events?(O=oe.data.messages||[],q=oe.data.mode_events||[]):(O=Array.isArray(oe.data)?oe.data:[],q=[]));const W=O.map(be=>({id:be._id||be.id||`msg-${Date.now()}`,senderId:be.senderId,text:be.text,timestamp:new Date(be.timestamp||be.created_at||new Date),type:be.type||"response",highlighted:be.highlighted||!1})),he=q.map(be=>({id:be._id||be.id||`event-${Date.now()}`,focus_group_id:be.focus_group_id,event_type:be.event_type,timestamp:new Date(be.timestamp||be.created_at||new Date),user_id:be.user_id,created_at:new Date(be.created_at||new Date)}));o(he),W.length>0?r(be=>{if(be.length===0)return W;{const bt=new Map;be.forEach(Fn=>bt.set(Fn.id,Fn));const tt=W.map(Fn=>{if(bt.has(Fn.id)){const un=bt.get(Fn.id);return{...Fn,highlighted:un.highlighted}}return Fn}),Gt=new Set(tt.map(Fn=>Fn.id)),Zt=be.filter(Fn=>!Gt.has(Fn.id));return[...tt,...Zt].sort((Fn,un)=>Fn.timestamp.getTime()-un.timestamp.getTime())}}):W.length===0&&r(be=>be.length===0?[]:be);const fe=W.filter(be=>be.highlighted),Ee=fe.length>0?fe.map(be=>({id:`theme-${be.id}`,text:be.text.substring(0,40)+(be.text.length>40?"...":""),count:1,messages:[be.id],source:"highlight"})):[];try{const be=await Hn.getKeyThemes(t);if((J=be==null?void 0:be.data)!=null&&J.themes&&Array.isArray(be.data.themes)){const bt=be.data.themes;l([...Ee,...bt])}else l(Ee)}catch(be){console.error("Error fetching AI-generated themes:",be),l(Ee)}}catch(oe){console.error("Error fetching messages:",oe),n.length===0&&qe.error("Failed to fetch messages",{description:"Please try again later or restart the session."})}},We=async()=>{if(!t)return!1;try{const oe=(await kr.getAll()).data||[],O=await jt.getById(t);if(O&&O.data){const q=O.data;console.log("Focus group data from API:",q);const W={id:q._id||q.id,name:q.name,status:q.status||"in-progress",participants:q.participants||[],date:q.date||new Date().toISOString(),duration:q.duration||60,topic:q.topic||"general",discussionGuide:q.discussionGuide||"",llm_model:q.llm_model||"gemini-2.5-pro"};if(u(W),U(W.llm_model||"gemini-2.5-pro"),X(W.reasoning_effort||"medium"),xe(W.verbosity||"medium"),q.participants_data&&Array.isArray(q.participants_data))f(q.participants_data.map(fe=>({...fe,id:fe._id||fe.id})));else if(W.participants&&Array.isArray(W.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:W.participants,allPersonas:oe.map(Ee=>({id:Ee._id||Ee.id,name:Ee.name}))});const fe=oe.filter(Ee=>{const be=Ee._id||Ee.id;return W.participants.includes(be)});console.log("Matched participants:",fe.map(Ee=>Ee.name)),f(fe)}await we(),await me();const he=await Ce();return w(he.aiActive),Z(he.sessionStatus),H.current=he.aiActive,B.current=he.sessionStatus,!0}return!1}catch(J){return console.error("Error fetching focus group:",J),!1}},St=async(J,oe,O)=>{if(console.log("🔧 updateFocusGroupModel called with:",{id:t,focusGroup:!!c,newModel:J,reasoningEffort:oe,verbosity:O}),!t||!c){console.log("❌ updateFocusGroupModel: Missing id or focusGroup",{id:t,focusGroup:!!c});return}ue(!0);try{const q={llm_model:J};J==="gpt-5"&&(q.reasoning_effort=oe||K,q.verbosity=O||re),console.log("🔧 Making API call to update focus group model:",{id:t,updateData:q});const W=await jt.update(t,q);console.log("🔧 API response:",W),W&&W.data?(u(he=>he?{...he,llm_model:J,reasoning_effort:J==="gpt-5"?oe||K:he==null?void 0:he.reasoning_effort,verbosity:J==="gpt-5"?O||re:he==null?void 0:he.verbosity}:null),qe.success("AI Model Updated",{description:`Focus group will now use ${J==="gemini-2.5-pro"?"Gemini 2.5 Pro":J==="gpt-4.1"?"GPT-4.1":J==="gpt-5"?"GPT-5":J} for AI responses`}),z(!1),console.log("✅ Model update successful")):console.log("❌ API response missing data:",W)}catch(q){console.error("❌ Error updating focus group model:",q),qe.error("Failed to update AI model",{description:"There was an error updating the AI model. Please try again."})}finally{ue(!1)}};y.useEffect(()=>{console.log("Looking for focus group with ID:",t);const J=async()=>{try{return(await kr.getAll()).data||[]}catch(W){return console.error("Error fetching personas:",W),[]}},oe=async W=>{try{const he=await jt.getById(t);if(he&&he.data){const fe=he.data;console.log("Focus group data from API:",fe);const Ee={id:fe._id||fe.id,name:fe.name,status:fe.status||"in-progress",participants:fe.participants||[],date:fe.date||new Date().toISOString(),duration:fe.duration||60,topic:fe.topic||"general",discussionGuide:fe.discussionGuide||"",llm_model:fe.llm_model||"gemini-2.5-pro"};if(u(Ee),U(Ee.llm_model||"gemini-2.5-pro"),X(Ee.reasoning_effort||"medium"),xe(Ee.verbosity||"medium"),fe.participants_data&&Array.isArray(fe.participants_data))f(fe.participants_data.map(be=>({...be,id:be._id||be.id})));else if(Ee.participants&&Array.isArray(Ee.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:Ee.participants,allPersonas:W.map(bt=>({id:bt._id||bt.id,name:bt.name}))});const be=W.filter(bt=>{const tt=bt._id||bt.id;return Ee.participants.includes(tt)});console.log("Matched participants:",be.map(bt=>bt.name)),f(be)}return we(),me(),C(!1),!0}return!1}catch(he){return console.error("Error fetching focus group:",he),!1}};let O,q;return J().then(W=>{oe(W).then(he=>{he?((()=>{we(),me(),O&&window.clearInterval(O);const be=x?3e3:1e4;console.log("📡 Setting up message polling:",{aiModeActive:x,pollInterval:be,timestamp:new Date().toISOString()}),O=window.setInterval(()=>{P.current?console.log("📡 Skipping poll - editing discussion guide"):(console.log("📡 Polling for messages...",new Date().toISOString()),we(),me())},be)})(),q=window.setInterval(async()=>{const be=H.current,bt=B.current,tt=await Ce();if(H.current=tt.aiActive,B.current=tt.sessionStatus,w(tt.aiActive),Z(tt.sessionStatus),bt&&bt!==tt.sessionStatus&&await De(tt.sessionStatus,bt),be!==tt.aiActive&&O){window.clearInterval(O);const Gt=tt.aiActive?3e3:1e4;O=window.setInterval(()=>{P.current||(we(),me())},Gt)}},15e3)):(console.error("Focus group not found with ID:",t),C(!1),qe.error("Focus group not found",{description:`Could not find focus group with ID: ${t}`}))})}),()=>{O&&window.clearInterval(O),q&&window.clearInterval(q)}},[t,e]);const Tt=J=>{if(!J||!J.sections||!Array.isArray(J.sections))return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const oe=J.sections[0];if(!oe)return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const O=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 q=O(oe);if(!q&&oe.subsections&&Array.isArray(oe.subsections)){for(const W of oe.subsections)if(q=O(W),q)break}return q?{content:q.content,sectionId:oe.id,itemId:q.itemId}:{content:`Welcome to our focus group session on "${oe.title||"our topic"}". Let's begin our discussion.`,sectionId:oe.id,itemId:"section-intro"}},Ze=async()=>{var J,oe,O,q,W,he;if(t)try{qe.info("Starting focus group session...",{description:"The session is now ready for AI moderation."});try{const fe=await Hn.getModeratorStatus(t),Ee=(oe=(J=fe==null?void 0:fe.data)==null?void 0:J.status)==null?void 0:oe.moderator_position;Ee?console.log("📍 Preserving existing moderator position:",Ee):(await Hn.setModeratorPosition(t,((W=(q=(O=c==null?void 0:c.discussionGuide)==null?void 0:O.sections)==null?void 0:q[0])==null?void 0:W.id)||"welcome"),console.log("🚀 Moderator position initialized to start of discussion guide (first time)"))}catch(fe){console.warn("Failed to check/initialize moderator position:",fe)}await jt.update(t,{status:"active"});try{const fe=Tt(c==null?void 0:c.discussionGuide),Ee={id:`msg-${Date.now()}`,senderId:"moderator",text:fe.content,timestamp:new Date,type:"question"},be=await jt.sendMessage(t,{senderId:"moderator",text:Ee.text,type:"question"});(he=be==null?void 0:be.data)!=null&&he.message_id&&(Ee.id=be.data.message_id),Qe(Ee),console.log("🚀 Initial moderator message created:",{content:fe.content,sectionId:fe.sectionId,itemId:fe.itemId})}catch(fe){console.warn("Failed to create initial moderator message:",fe)}qe.success("Focus group session started",{description:"The discussion has begun. Use the control panel below to moderate."})}catch(fe){console.error("Error starting session:",fe),qe.error("Error starting session",{description:"There was a problem connecting to the server."})}},Qe=J=>{r(oe=>[...oe,J])},$t=async J=>{const oe=[...n],O=oe.findIndex(q=>q.id===J);if(O!==-1){const q=oe[O],W=!q.highlighted;if(oe[O]={...q,highlighted:W},r(oe),t)try{!J.startsWith("local-")&&!J.startsWith("msg-")?await jt.updateMessageHighlight(t,J,W):console.log("Skipping database update for local message:",J)}catch(he){console.error("Error updating message highlight state:",he),qe.error("Failed to save highlight state",{description:"The highlight may not persist if the page is refreshed."})}}},Yt=J=>d.find(oe=>oe.id===J||oe._id===J),_r=()=>{const J=n.map(q=>{var fe;let W;return q.senderId==="moderator"?W="AI Moderator":q.senderId==="facilitator"?W="Human Facilitator":W=((fe=Yt(q.senderId))==null?void 0:fe.name)||"Unknown",`[${q.timestamp.toLocaleTimeString()}] ${W}: ${q.text}`}).join(` + the props "valueKey" will be deprecated in 1.1.0`),b=f);var x=i.filter(function(j){return qn(j,b,0)!==0}).length,w=(v>=360?x:x-1)*c,S=v-x*p-w,C=i.reduce(function(j,k){var P=qn(k,b,0);return j+(Ee(P)?P:0)},0),A;if(C>0){var _;A=i.map(function(j,k){var P=qn(j,b,0),I=qn(j,d,k),E=(Ee(P)?P:0)/C,R;k?R=_.endAngle+ii(m)*c*(P!==0?1:0):R=s;var L=R+ii(m)*((P!==0?p:0)+E*S),V=(R+L)/2,$=(g.innerRadius+g.outerRadius)/2,z=[{name:I,value:P,payload:j,dataKey:b,type:h}],M=Zt(g.cx,g.cy,$,V);return _=yn(yn(yn({percent:E,cornerRadius:o,name:I,tooltipPayload:z,midAngle:V,middleRadius:$,tooltipPosition:M},j),g),{},{value:qn(j,b),startAngle:R,endAngle:L,payload:j,paddingAngle:ii(m)*c}),_})}return yn(yn({},g),{},{sectors:A,data:i})});function gOe(t){return t&&t.length?t[0]:void 0}var vOe=gOe,yOe=vOe;const xOe=en(yOe);var bOe=["key"];function Yd(t){"@babel/helpers - typeof";return Yd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Yd(t)}function wOe(t,e){if(t==null)return{};var n=SOe(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function SOe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Jx(){return Jx=Object.assign?Object.assign.bind():function(t){for(var e=1;e=2&&(c=!0),u.push(Jr(Jr({},Zt(s,l,x,v)),{},{name:g,value:m,cx:s,cy:l,radius:x,angle:v,payload:h}))});var f=[];return c&&u.forEach(function(h){if(Array.isArray(h.value)){var p=xOe(h.value),g=Pt(p)?void 0:e.scale(p);f.push(Jr(Jr({},h),{},{radius:g},Zt(s,l,g,h.angle)))}else f.push(h)}),{points:u,isRange:c,baseLinePoints:f}});var POe=Math.ceil,kOe=Math.max;function OOe(t,e,n,r){for(var i=-1,o=kOe(POe((e-t)/(n||1)),0),s=Array(o);o--;)s[r?o:++i]=t,t+=n;return s}var IOe=OOe,ROe=DV,tD=1/0,MOe=17976931348623157e292;function DOe(t){if(!t)return t===0?t:0;if(t=ROe(t),t===tD||t===-tD){var e=t<0?-1:1;return e*MOe}return t===t?t:0}var _G=DOe,$Oe=IOe,LOe=Z0,GS=_G;function FOe(t){return function(e,n,r){return r&&typeof r!="number"&&LOe(e,n,r)&&(n=r=void 0),e=GS(e),n===void 0?(n=e,e=0):n=GS(n),r=r===void 0?e0&&r.handleDrag(i.changedTouches[0])}),Pi(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=r.props,o=i.endIndex,s=i.onDragEnd,l=i.startIndex;s==null||s({endIndex:o,startIndex:l})}),r.detachDragEndListener()}),Pi(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Pi(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Pi(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Pi(r,"handleSlideDragStart",function(i){var o=sD(i)?i.changedTouches[0]:i;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return ZOe(e,t),YOe(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var i=r.startX,o=r.endX,s=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,d=u.length-1,f=Math.min(i,o),h=Math.max(i,o),p=e.getIndexInRange(s,f),g=e.getIndexInRange(s,h);return{startIndex:p-p%c,endIndex:g===d?d:g-g%c}}},{key:"getTextOfTick",value:function(r){var i=this.props,o=i.data,s=i.tickFormatter,l=i.dataKey,c=qn(o[r],l,r);return xt(s)?s(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,o=i.slideMoveStartX,s=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-o;m>0?m=Math.min(m,u+d-f-l,u+d-f-s):m<0&&(m=Math.max(m,u-s,u-l));var v=this.getIndex({startX:s+m,endX:l+m});(v.startIndex!==h||v.endIndex!==p)&&g&&g(v),this.setState({startX:s+m,endX:l+m,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,i){var o=sD(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var i=this.state,o=i.brushMoveStartX,s=i.movingTravellerId,l=i.endX,c=i.startX,u=this.state[s],d=this.props,f=d.x,h=d.width,p=d.travellerWidth,g=d.onChange,m=d.gap,v=d.data,b={startX:this.state.startX,endX:this.state.endX},x=r.pageX-o;x>0?x=Math.min(x,f+h-p-u):x<0&&(x=Math.max(x,f-u)),b[s]=u+x;var w=this.getIndex(b),S=w.startIndex,C=w.endIndex,A=function(){var j=v.length-1;return s==="startX"&&(l>c?S%m===0:C%m===0)||lc?C%m===0:S%m===0)||l>c&&C===j};this.setState(Pi(Pi({},s,u+x),"brushMoveStartX",r.pageX),function(){g&&A()&&g(w)})}},{key:"handleTravellerMoveKeyboard",value:function(r,i){var o=this,s=this.state,l=s.scaleValues,c=s.startX,u=s.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(Pi({},i,p),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,i=r.x,o=r.y,s=r.width,l=r.height,c=r.fill,u=r.stroke;return T.createElement("rect",{stroke:u,fill:c,x:i,y:o,width:s,height:l})}},{key:"renderPanorama",value:function(){var r=this.props,i=r.x,o=r.y,s=r.width,l=r.height,c=r.data,u=r.children,d=r.padding,f=y.Children.only(u);return f?T.cloneElement(f,{x:i,y:o,width:s,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(r,i){var o,s,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,v=c.endIndex,b=Math.max(r,this.props.x),x=KS(KS({},Ze(this.props,!1)),{},{x:b,y:u,width:d,height:f}),w=p||"Min value: ".concat((o=g[m])===null||o===void 0?void 0:o.name,", Max value: ").concat((s=g[v])===null||s===void 0?void 0:s.name);return T.createElement(Ht,{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(C){["ArrowLeft","ArrowRight"].includes(C.key)&&(C.preventDefault(),C.stopPropagation(),l.handleTravellerMoveKeyboard(C.key==="ArrowRight"?1:-1,i))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(h,x))}},{key:"renderSlide",value:function(r,i){var o=this.props,s=o.y,l=o.height,c=o.stroke,u=o.travellerWidth,d=Math.min(r,i)+u,f=Math.max(Math.abs(i-r)-u,0);return T.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:s,width:f,height:l})}},{key:"renderText",value:function(){var r=this.props,i=r.startIndex,o=r.endIndex,s=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 T.createElement(Ht,{className:"recharts-brush-texts"},T.createElement(tu,tb({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:s+l/2},g),this.getTextOfTick(i)),T.createElement(tu,tb({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+c+p,y:s+l/2},g),this.getTextOfTick(o)))}},{key:"render",value:function(){var r=this.props,i=r.data,o=r.className,s=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,v=h.isSlideMoving,b=h.isTravellerMoving,x=h.isTravellerFocused;if(!i||!i.length||!Ee(l)||!Ee(c)||!Ee(u)||!Ee(d)||u<=0||d<=0)return null;var w=Et("recharts-brush",o),S=T.Children.count(s)===1,C=WOe("userSelect","none");return T.createElement(Ht,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:C},this.renderBackground(),S&&this.renderPanorama(),this.renderSlide(p,g),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(g,"endX"),(m||v||b||x||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var i=r.x,o=r.y,s=r.width,l=r.height,c=r.stroke,u=Math.floor(o+l/2)-1;return T.createElement(T.Fragment,null,T.createElement("rect",{x:i,y:o,width:s,height:l,fill:c,stroke:"none"}),T.createElement("line",{x1:i+1,y1:u,x2:i+s-1,y2:u,fill:"none",stroke:"#fff"}),T.createElement("line",{x1:i+1,y1:u+2,x2:i+s-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,i){var o;return T.isValidElement(r)?o=T.cloneElement(r,i):xt(r)?o=r(i):o=e.renderDefaultTraveller(i),o}},{key:"getDerivedStateFromProps",value:function(r,i){var o=r.data,s=r.width,l=r.x,c=r.travellerWidth,u=r.updateId,d=r.startIndex,f=r.endIndex;if(o!==i.prevData||u!==i.prevUpdateId)return KS({prevData:o,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:s},o&&o.length?tIe({data:o,width:s,x:l,travellerWidth:c,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(i.scale&&(s!==i.prevWidth||l!==i.prevX||c!==i.prevTravellerWidth)){i.scale.range([l,l+s-c]);var h=i.scale.domain().map(function(p){return i.scale(p)});return{prevData:o,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:s,startX:i.scale(r.startIndex),endX:i.scale(r.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(r,i){for(var o=r.length,s=0,l=o-1;l-s>1;){var c=Math.floor((s+l)/2);r[c]>i?l=c:s=c}return i>=r[l]?l:s}}])}(y.PureComponent);Pi(Xd,"displayName","Brush");Pi(Xd,"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 nIe=TT;function rIe(t,e){var n;return nIe(t,function(r,i,o){return n=e(r,i,o),!n}),!!n}var iIe=rIe,oIe=cV,sIe=$s,aIe=iIe,lIe=Ni,cIe=Z0;function uIe(t,e,n){var r=lIe(t)?oIe:aIe;return n&&cIe(t,e,n)&&(e=void 0),r(t,sIe(e))}var dIe=uIe;const fIe=en(dIe);var js=function(e,n){var r=e.alwaysShow,i=e.ifOverflow;return r&&(i="extendDomain"),i===n},aD=kV;function hIe(t,e,n){e=="__proto__"&&aD?aD(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var pIe=hIe,mIe=pIe,gIe=TV,vIe=$s;function yIe(t,e){var n={};return e=vIe(e),gIe(t,function(r,i,o){mIe(n,i,e(r,i,o))}),n}var xIe=yIe;const bIe=en(xIe);function wIe(t,e){for(var n=-1,r=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function LIe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function FIe(t,e){var n=t.x,r=t.y,i=$Ie(t,IIe),o="".concat(n),s=parseInt(o,10),l="".concat(r),c=parseInt(l,10),u="".concat(e.height||i.height),d=parseInt(u,10),f="".concat(e.width||i.width),h=parseInt(f,10);return mh(mh(mh(mh(mh({},e),i),s?{x:s}:{}),c?{y:c}:{}),{},{height:d,width:h,name:e.name,radius:e.radius})}function cD(t){return T.createElement(bG,l_({shapeType:"rectangle",propTransformer:FIe,activeClassName:"recharts-active-bar"},t))}var UIe=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,i){if(typeof e=="number")return e;var o=typeof r=="number";return o?e(r,i):(o||iu(),n)}},BIe=["value","background"],PG;function Jd(t){"@babel/helpers - typeof";return Jd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jd(t)}function HIe(t,e){if(t==null)return{};var n=zIe(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function zIe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function rb(){return rb=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&Math.abs(V)0&&Math.abs(L)0&&(R=Math.min((F||0)-(L[fe-1]||0),R))}),Number.isFinite(R)){var V=R/E,$=m.layout==="vertical"?r.height:r.width;if(m.padding==="gap"&&(_=V*$/2),m.padding==="no-gap"){var z=oi(e.barCategoryGap,V*$),M=V*$/2;_=M-z-(M-z)/$*z}}}i==="xAxis"?j=[r.left+(w.left||0)+(_||0),r.left+r.width-(w.right||0)-(_||0)]:i==="yAxis"?j=c==="horizontal"?[r.top+r.height-(w.bottom||0),r.top+(w.top||0)]:[r.top+(w.top||0)+(_||0),r.top+r.height-(w.bottom||0)-(_||0)]:j=m.range,C&&(j=[j[1],j[0]]);var U=z8(m,o,h),W=U.scale,X=U.realScaleType;W.domain(b).range(j),V8(W);var re=G8(W,No(No({},m),{},{realScaleType:X}));i==="xAxis"?(I=v==="top"&&!S||v==="bottom"&&S,k=r.left,P=f[A]-I*m.height):i==="yAxis"&&(I=v==="left"&&!S||v==="right"&&S,k=f[A]-I*m.width,P=r.top);var xe=No(No(No({},m),re),{},{realScaleType:X,x:k,y:P,scale:W,width:i==="xAxis"?r.width:m.width,height:i==="yAxis"?r.height:m.height});return xe.bandSize=Ux(xe,re),!m.hide&&i==="xAxis"?f[A]+=(I?-1:1)*xe.height:m.hide||(f[A]+=(I?-1:1)*xe.width),No(No({},p),{},mw({},g,xe))},{})},MG=function(e,n){var r=e.x,i=e.y,o=n.x,s=n.y;return{x:Math.min(r,o),y:Math.min(i,s),width:Math.abs(o-r),height:Math.abs(s-i)}},eRe=function(e){var n=e.x1,r=e.y1,i=e.x2,o=e.y2;return MG({x:n,y:r},{x:i,y:o})},DG=function(){function t(e){XIe(this,t),this.scale=e}return JIe(t,[{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,o=r.position;if(n!==void 0){if(o)switch(o){case"start":return this.scale(n);case"middle":{var s=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+s}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],o=r[r.length-1];return i<=o?n>=i&&n<=o:n>=o&&n<=i}}],[{key:"create",value:function(n){return new t(n)}}])}();mw(DG,"EPS",1e-4);var iP=function(e){var n=Object.keys(e).reduce(function(r,i){return No(No({},r),{},mw({},i,DG.create(e[i])))},{});return No(No({},n),{},{apply:function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=o.bandAware,l=o.position;return bIe(i,function(c,u){return n[u].apply(c,{bandAware:s,position:l})})},isInRange:function(i){return TG(i,function(o,s){return n[s].isInRange(o)})}})};function tRe(t){return(t%180+180)%180}var nRe=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=tRe(i),s=o*Math.PI/180,l=Math.atan(r/n),c=s>l&&s-1?i[o?e[s]:s]:void 0}}var aRe=sRe,lRe=_G;function cRe(t){var e=lRe(t),n=e%1;return e===e?n?e-n:e:0}var uRe=cRe,dRe=CV,fRe=$s,hRe=uRe,pRe=Math.max;function mRe(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:hRe(n);return i<0&&(i=pRe(r+i,0)),dRe(t,fRe(e),i)}var gRe=mRe,vRe=aRe,yRe=gRe,xRe=vRe(yRe),bRe=xRe;const wRe=en(bRe);var SRe=she(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),oP=y.createContext(void 0),sP=y.createContext(void 0),$G=y.createContext(void 0),LG=y.createContext({}),FG=y.createContext(void 0),UG=y.createContext(0),BG=y.createContext(0),pD=function(e){var n=e.state,r=n.xAxisMap,i=n.yAxisMap,o=n.offset,s=e.clipPathId,l=e.children,c=e.width,u=e.height,d=SRe(o);return T.createElement(oP.Provider,{value:r},T.createElement(sP.Provider,{value:i},T.createElement(LG.Provider,{value:o},T.createElement($G.Provider,{value:d},T.createElement(FG.Provider,{value:s},T.createElement(UG.Provider,{value:u},T.createElement(BG.Provider,{value:c},l)))))))},CRe=function(){return y.useContext(FG)},HG=function(e){var n=y.useContext(oP);n==null&&iu();var r=n[e];return r==null&&iu(),r},ARe=function(){var e=y.useContext(oP);return qa(e)},_Re=function(){var e=y.useContext(sP),n=wRe(e,function(r){return TG(r.domain,Number.isFinite)});return n||qa(e)},zG=function(e){var n=y.useContext(sP);n==null&&iu();var r=n[e];return r==null&&iu(),r},jRe=function(){var e=y.useContext($G);return e},ERe=function(){return y.useContext(LG)},aP=function(){return y.useContext(BG)},lP=function(){return y.useContext(UG)};function Zd(t){"@babel/helpers - typeof";return Zd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zd(t)}function NRe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function TRe(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);nt*i)return!1;var o=n();return t*(e-t*o/2-r)>=0&&t*(e+t*o/2-i)<=0}function u2e(t,e){return QG(t,e+1)}function d2e(t,e,n,r,i){for(var o=(r||[]).slice(),s=e.start,l=e.end,c=0,u=1,d=s,f=function(){var g=r==null?void 0:r[c];if(g===void 0)return{v:QG(r,u)};var m=c,v,b=function(){return v===void 0&&(v=n(g,m)),v},x=g.coordinate,w=c===0||lb(t,x,b,d,l);w||(c=0,d=s,u+=1),w&&(d=x+t*(b()/2+i),c+=u)},h;u<=o.length;)if(h=f(),h)return h.v;return[]}function km(t){"@babel/helpers - typeof";return km=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},km(t)}function SD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Br(t){for(var e=1;e0?p.coordinate-v*t:p.coordinate})}else o[h]=p=Br(Br({},p),{},{tickCoord:p.coordinate});var b=lb(t,p.tickCoord,m,l,c);b&&(c=p.tickCoord-t*(m()/2+i),o[h]=Br(Br({},p),{},{isShow:!0}))},d=s-1;d>=0;d--)u(d);return o}function g2e(t,e,n,r,i,o){var s=(r||[]).slice(),l=s.length,c=e.start,u=e.end;if(o){var d=r[l-1],f=n(d,l-1),h=t*(d.coordinate+t*f/2-u);s[l-1]=d=Br(Br({},d),{},{tickCoord:h>0?d.coordinate-h*t:d.coordinate});var p=lb(t,d.tickCoord,function(){return f},c,u);p&&(u=d.tickCoord-t*(f/2+i),s[l-1]=Br(Br({},d),{},{isShow:!0}))}for(var g=o?l-1:l,m=function(x){var w=s[x],S,C=function(){return S===void 0&&(S=n(w,x)),S};if(x===0){var A=t*(w.coordinate-t*C()/2-c);s[x]=w=Br(Br({},w),{},{tickCoord:A<0?w.coordinate-A*t:w.coordinate})}else s[x]=w=Br(Br({},w),{},{tickCoord:w.coordinate});var _=lb(t,w.tickCoord,C,c,u);_&&(c=w.tickCoord+t*(C()/2+i),s[x]=Br(Br({},w),{},{isShow:!0}))},v=0;v=2?ii(i[1].coordinate-i[0].coordinate):1,b=c2e(o,v,p);return c==="equidistantPreserveStart"?d2e(v,b,m,i,s):(c==="preserveStart"||c==="preserveStartEnd"?h=g2e(v,b,m,i,s,c==="preserveStartEnd"):h=m2e(v,b,m,i,s),h.filter(function(x){return x.isShow}))}var v2e=["viewBox"],y2e=["viewBox"],x2e=["ticks"];function nf(t){"@babel/helpers - typeof";return nf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nf(t)}function Ku(){return Ku=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function b2e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function w2e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function AD(t,e){for(var n=0;n0?c(this.props):c(p)),s<=0||l<=0||!g||!g.length?null:T.createElement(Ht,{className:Et("recharts-cartesian-axis",u),ref:function(v){r.layerReference=v}},o&&this.renderAxisLine(),this.renderTicks(g,this.state.fontSize,this.state.letterSpacing),wr.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,i,o){var s;return T.isValidElement(r)?s=T.cloneElement(r,i):xt(r)?s=r(i):s=T.createElement(tu,Ku({},i,{className:"recharts-cartesian-axis-tick-value"}),o),s}}])}(y.Component);fP(Vf,"displayName","CartesianAxis");fP(Vf,"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 N2e=["x1","y1","x2","y2","key"],T2e=["offset"];function ou(t){"@babel/helpers - typeof";return ou=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ou(t)}function _D(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Gr(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function I2e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var R2e=function(e){var n=e.fill;if(!n||n==="none")return null;var r=e.fillOpacity,i=e.x,o=e.y,s=e.width,l=e.height,c=e.ry;return T.createElement("rect",{x:i,y:o,ry:c,width:s,height:l,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function ZG(t,e){var n;if(T.isValidElement(t))n=T.cloneElement(t,e);else if(xt(t))n=t(e);else{var r=e.x1,i=e.y1,o=e.x2,s=e.y2,l=e.key,c=jD(e,N2e),u=Ze(c,!1);u.offset;var d=jD(u,T2e);n=T.createElement("line",wc({},d,{x1:r,y1:i,x2:o,y2:s,fill:"none",key:l}))}return n}function M2e(t){var e=t.x,n=t.width,r=t.horizontal,i=r===void 0?!0:r,o=t.horizontalPoints;if(!i||!o||!o.length)return null;var s=o.map(function(l,c){var u=Gr(Gr({},t),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(c),index:c});return ZG(i,u)});return T.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function D2e(t){var e=t.y,n=t.height,r=t.vertical,i=r===void 0?!0:r,o=t.verticalPoints;if(!i||!o||!o.length)return null;var s=o.map(function(l,c){var u=Gr(Gr({},t),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(c),index:c});return ZG(i,u)});return T.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function $2e(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,i=t.y,o=t.width,s=t.height,l=t.horizontalPoints,c=t.horizontal,u=c===void 0?!0:c;if(!u||!e||!e.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+s-h:d[p+1]-h;if(m<=0)return null;var v=p%e.length;return T.createElement("rect",{key:"react-".concat(p),y:h,x:r,height:m,width:o,stroke:"none",fill:e[v],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return T.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function L2e(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,i=t.fillOpacity,o=t.x,s=t.y,l=t.width,c=t.height,u=t.verticalPoints;if(!n||!r||!r.length)return null;var d=u.map(function(h){return Math.round(h+o-o)}).sort(function(h,p){return h-p});o!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],m=g?o+l-h:d[p+1]-h;if(m<=0)return null;var v=p%r.length;return T.createElement("rect",{key:"react-".concat(p),x:h,y:s,width:m,height:c,stroke:"none",fill:r[v],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return T.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var F2e=function(e,n){var r=e.xAxis,i=e.width,o=e.height,s=e.offset;return H8(dP(Gr(Gr(Gr({},Vf.defaultProps),r),{},{ticks:oa(r,!0),viewBox:{x:0,y:0,width:i,height:o}})),s.left,s.left+s.width,n)},U2e=function(e,n){var r=e.yAxis,i=e.width,o=e.height,s=e.offset;return H8(dP(Gr(Gr(Gr({},Vf.defaultProps),r),{},{ticks:oa(r,!0),viewBox:{x:0,y:0,width:i,height:o}})),s.top,s.top+s.height,n)},_u={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Om(t){var e,n,r,i,o,s,l=aP(),c=lP(),u=ERe(),d=Gr(Gr({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:_u.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:_u.fill,horizontal:(r=t.horizontal)!==null&&r!==void 0?r:_u.horizontal,horizontalFill:(i=t.horizontalFill)!==null&&i!==void 0?i:_u.horizontalFill,vertical:(o=t.vertical)!==null&&o!==void 0?o:_u.vertical,verticalFill:(s=t.verticalFill)!==null&&s!==void 0?s:_u.verticalFill,x:Ee(t.x)?t.x:u.left,y:Ee(t.y)?t.y:u.top,width:Ee(t.width)?t.width:u.width,height:Ee(t.height)?t.height:u.height}),f=d.x,h=d.y,p=d.width,g=d.height,m=d.syncWithTicks,v=d.horizontalValues,b=d.verticalValues,x=ARe(),w=_Re();if(!Ee(p)||p<=0||!Ee(g)||g<=0||!Ee(f)||f!==+f||!Ee(h)||h!==+h)return null;var S=d.verticalCoordinatesGenerator||F2e,C=d.horizontalCoordinatesGenerator||U2e,A=d.horizontalPoints,_=d.verticalPoints;if((!A||!A.length)&&xt(C)){var j=v&&v.length,k=C({yAxis:w?Gr(Gr({},w),{},{ticks:j?v:w.ticks}):void 0,width:l,height:c,offset:u},j?!0:m);Uo(Array.isArray(k),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(ou(k),"]")),Array.isArray(k)&&(A=k)}if((!_||!_.length)&&xt(S)){var P=b&&b.length,I=S({xAxis:x?Gr(Gr({},x),{},{ticks:P?b:x.ticks}):void 0,width:l,height:c,offset:u},P?!0:m);Uo(Array.isArray(I),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(ou(I),"]")),Array.isArray(I)&&(_=I)}return T.createElement("g",{className:"recharts-cartesian-grid"},T.createElement(R2e,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),T.createElement(M2e,wc({},d,{offset:u,horizontalPoints:A,xAxis:x,yAxis:w})),T.createElement(D2e,wc({},d,{offset:u,verticalPoints:_,xAxis:x,yAxis:w})),T.createElement($2e,wc({},d,{horizontalPoints:A})),T.createElement(L2e,wc({},d,{verticalPoints:_})))}Om.displayName="CartesianGrid";var B2e=["layout","type","stroke","connectNulls","isRange","ref"],H2e=["key"],eK;function rf(t){"@babel/helpers - typeof";return rf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rf(t)}function tK(t,e){if(t==null)return{};var n=z2e(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function z2e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Sc(){return Sc=Object.assign?Object.assign.bind():function(t){for(var e=1;e0||!nu(d,s)||!nu(f,l))?this.renderAreaWithAnimation(r,i):this.renderAreaStatically(s,l,r,i)}},{key:"render",value:function(){var r,i=this.props,o=i.hide,s=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,v=i.id;if(o||!l||!l.length)return null;var b=this.state.isAnimationFinished,x=l.length===1,w=Et("recharts-area",c),S=f&&f.allowDataOverflow,C=h&&h.allowDataOverflow,A=S||C,_=Pt(v)?this.id:v,j=(r=Ze(s,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},k=j.r,P=k===void 0?3:k,I=j.strokeWidth,E=I===void 0?2:I,R=dpe(s)?s:{},L=R.clipDot,V=L===void 0?!0:L,$=P*2+E;return T.createElement(Ht,{className:w},S||C?T.createElement("defs",null,T.createElement("clipPath",{id:"clipPath-".concat(_)},T.createElement("rect",{x:S?d:d-p/2,y:C?u:u-g/2,width:S?p:p*2,height:C?g:g*2})),!V&&T.createElement("clipPath",{id:"clipPath-dots-".concat(_)},T.createElement("rect",{x:d-$/2,y:u-$/2,width:p+$,height:g+$}))):null,x?null:this.renderArea(A,_),(s||x)&&this.renderDots(A,V,_),(!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}}])}(y.PureComponent);eK=Ho;ys(Ho,"displayName","Area");ys(Ho,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!Bo.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});ys(Ho,"getBaseValue",function(t,e,n,r){var i=t.layout,o=t.baseValue,s=e.props.baseValue,l=s??o;if(Ee(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]});ys(Ho,"getComposedData",function(t){var e=t.props,n=t.item,r=t.xAxis,i=t.yAxis,o=t.xAxisTicks,s=t.yAxisTicks,l=t.bandSize,c=t.dataKey,u=t.stackedData,d=t.dataStartIndex,f=t.displayedData,h=t.offset,p=e.layout,g=u&&u.length,m=eK.getBaseValue(e,n,r,i),v=p==="horizontal",b=!1,x=f.map(function(S,C){var A;g?A=u[d+C]:(A=qn(S,c),Array.isArray(A)?b=!0:A=[m,A]);var _=A[1]==null||g&&qn(S,c)==null;return v?{x:Q2({axis:r,ticks:o,bandSize:l,entry:S,index:C}),y:_?null:i.scale(A[1]),value:A,payload:S}:{x:_?null:r.scale(A[1]),y:Q2({axis:i,ticks:s,bandSize:l,entry:S,index:C}),value:A,payload:S}}),w;return g||b?w=x.map(function(S){var C=Array.isArray(S.value)?S.value[0]:null;return v?{x:S.x,y:C!=null&&S.y!=null?i.scale(C):null}:{x:C!=null?r.scale(C):null,y:S.y}}):w=v?i.scale(m):r.scale(m),La({points:x,baseLine:w,layout:p,isRange:b},h)});ys(Ho,"renderDotItem",function(t,e){var n;if(T.isValidElement(t))n=T.cloneElement(t,e);else if(xt(t))n=t(e);else{var r=Et("recharts-area-dot",typeof t!="boolean"?t.className:""),i=e.key,o=tK(e,H2e);n=T.createElement(hg,Sc({},o,{key:i,className:r}))}return n});function of(t){"@babel/helpers - typeof";return of=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},of(t)}function X2e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function J2e(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function LMe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function FMe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function UMe(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n0?s:e&&e.length&&Ee(i)&&Ee(o)?e.slice(i,o+1):[]};function vK(t){return t==="number"?[0,"auto"]:void 0}var j_=function(e,n,r,i){var o=e.graphicalItems,s=e.tooltipAxis,l=bw(n,e);return r<0||!o||!o.length||r>=l.length?null:o.reduce(function(c,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:n;f&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=r&&(f=f.slice(e.dataStartIndex,e.dataEndIndex+1));var h;if(s.dataKey&&!s.allowDuplicatedCategory){var p=f===void 0?l:f;h=fx(p,s.dataKey,i)}else h=f&&f[r]||l[r];return h?[].concat(lf(c),[W8(u,h)]):c},[])},RD=function(e,n,r,i){var o=i||{x:e.chartX,y:e.chartY},s=JMe(o,r),l=e.orderedTooltipTicks,c=e.tooltipAxis,u=e.tooltipTicks,d=fEe(s,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,h=j_(e,n,d,f),p=ZMe(r,l,d,o);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},eDe=function(e,n){var r=n.axes,i=n.graphicalItems,o=n.axisType,s=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=e.layout,f=e.children,h=e.stackOffset,p=B8(d,o);return r.reduce(function(g,m){var v,b=m.type.defaultProps!==void 0?he(he({},m.type.defaultProps),m.props):m.props,x=b.type,w=b.dataKey,S=b.allowDataOverflow,C=b.allowDuplicatedCategory,A=b.scale,_=b.ticks,j=b.includeHidden,k=b[s];if(g[k])return g;var P=bw(e.data,{graphicalItems:i.filter(function(re){var xe,F=s in re.props?re.props[s]:(xe=re.type.defaultProps)===null||xe===void 0?void 0:xe[s];return F===k}),dataStartIndex:c,dataEndIndex:u}),I=P.length,E,R,L;jMe(b.domain,S,x)&&(E=UA(b.domain,null,S),p&&(x==="number"||A!=="auto")&&(L=qh(P,w,"category")));var V=vK(x);if(!E||E.length===0){var $,z=($=b.domain)!==null&&$!==void 0?$:V;if(w){if(E=qh(P,w,x),x==="category"&&p){var M=npe(E);C&&M?(R=E,E=eb(0,I)):C||(E=eM(z,E,m).reduce(function(re,xe){return re.indexOf(xe)>=0?re:[].concat(lf(re),[xe])},[]))}else if(x==="category")C?E=E.filter(function(re){return re!==""&&!Pt(re)}):E=eM(z,E,m).reduce(function(re,xe){return re.indexOf(xe)>=0||xe===""||Pt(xe)?re:[].concat(lf(re),[xe])},[]);else if(x==="number"){var U=vEe(P,i.filter(function(re){var xe,F,fe=s in re.props?re.props[s]:(xe=re.type.defaultProps)===null||xe===void 0?void 0:xe[s],oe="hide"in re.props?re.props.hide:(F=re.type.defaultProps)===null||F===void 0?void 0:F.hide;return fe===k&&(j||!oe)}),w,o,d);U&&(E=U)}p&&(x==="number"||A!=="auto")&&(L=qh(P,w,"category"))}else p?E=eb(0,I):l&&l[k]&&l[k].hasStack&&x==="number"?E=h==="expand"?[0,1]:K8(l[k].stackGroups,c,u):E=U8(P,i.filter(function(re){var xe=s in re.props?re.props[s]:re.type.defaultProps[s],F="hide"in re.props?re.props.hide:re.type.defaultProps.hide;return xe===k&&(j||!F)}),x,d,!0);if(x==="number")E=C_(f,E,k,o,_),z&&(E=UA(z,E,S));else if(x==="category"&&z){var W=z,X=E.every(function(re){return W.indexOf(re)>=0});X&&(E=W)}}return he(he({},g),{},St({},k,he(he({},b),{},{axisType:o,domain:E,categoricalDomain:L,duplicateDomain:R,originalDomain:(v=b.domain)!==null&&v!==void 0?v:V,isCategorical:p,layout:d})))},{})},tDe=function(e,n){var r=n.graphicalItems,i=n.Axis,o=n.axisType,s=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=e.layout,f=e.children,h=bw(e.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:u}),p=h.length,g=B8(d,o),m=-1;return r.reduce(function(v,b){var x=b.type.defaultProps!==void 0?he(he({},b.type.defaultProps),b.props):b.props,w=x[s],S=vK("number");if(!v[w]){m++;var C;return g?C=eb(0,p):l&&l[w]&&l[w].hasStack?(C=K8(l[w].stackGroups,c,u),C=C_(f,C,w,o)):(C=UA(S,U8(h,r.filter(function(A){var _,j,k=s in A.props?A.props[s]:(_=A.type.defaultProps)===null||_===void 0?void 0:_[s],P="hide"in A.props?A.props.hide:(j=A.type.defaultProps)===null||j===void 0?void 0:j.hide;return k===w&&!P}),"number",d),i.defaultProps.allowDataOverflow),C=C_(f,C,w,o)),he(he({},v),{},St({},w,he(he({axisType:o},i.defaultProps),{},{hide:!0,orientation:zi(QMe,"".concat(o,".").concat(m%2),null),domain:C,originalDomain:S,isCategorical:g,layout:d})))}return v},{})},nDe=function(e,n){var r=n.axisType,i=r===void 0?"xAxis":r,o=n.AxisComp,s=n.graphicalItems,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=e.children,f="".concat(i,"Id"),h=fo(d,o),p={};return h&&h.length?p=eDe(e,{axes:h,graphicalItems:s,axisType:i,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):s&&s.length&&(p=tDe(e,{Axis:o,graphicalItems:s,axisType:i,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),p},rDe=function(e){var n=qa(e),r=oa(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:PT(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Ux(n,r)}},MD=function(e){var n=e.children,r=e.defaultShowTooltip,i=Ri(n,Xd),o=0,s=0;return e.data&&e.data.length!==0&&(s=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(s=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:s,activeTooltipIndex:-1,isTooltipActive:!!r}},iDe=function(e){return!e||!e.length?!1:e.some(function(n){var r=la(n&&n.type);return r&&r.indexOf("Bar")>=0})},DD=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},oDe=function(e,n){var r=e.props,i=e.graphicalItems,o=e.xAxisMap,s=o===void 0?{}:o,l=e.yAxisMap,c=l===void 0?{}:l,u=r.width,d=r.height,f=r.children,h=r.margin||{},p=Ri(f,Xd),g=Ri(f,ca),m=Object.keys(c).reduce(function(C,A){var _=c[A],j=_.orientation;return!_.mirror&&!_.hide?he(he({},C),{},St({},j,C[j]+_.width)):C},{left:h.left||0,right:h.right||0}),v=Object.keys(s).reduce(function(C,A){var _=s[A],j=_.orientation;return!_.mirror&&!_.hide?he(he({},C),{},St({},j,zi(C,"".concat(j))+_.height)):C},{top:h.top||0,bottom:h.bottom||0}),b=he(he({},v),m),x=b.bottom;p&&(b.bottom+=p.props.height||Xd.defaultProps.height),g&&n&&(b=mEe(b,i,r,n));var w=u-b.left-b.right,S=d-b.top-b.bottom;return he(he({brushBottom:x},b),{},{width:Math.max(w,0),height:Math.max(S,0)})},sDe=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},ww=function(e){var n=e.chartName,r=e.GraphicalChild,i=e.defaultTooltipEventType,o=i===void 0?"axis":i,s=e.validateTooltipEventTypes,l=s===void 0?["axis"]:s,c=e.axisComponents,u=e.legendContent,d=e.formatAxisMap,f=e.defaultProps,h=function(v,b){var x=b.graphicalItems,w=b.stackGroups,S=b.offset,C=b.updateId,A=b.dataStartIndex,_=b.dataEndIndex,j=v.barSize,k=v.layout,P=v.barGap,I=v.barCategoryGap,E=v.maxBarSize,R=DD(k),L=R.numericAxisName,V=R.cateAxisName,$=iDe(x),z=[];return x.forEach(function(M,U){var W=bw(v.data,{graphicalItems:[M],dataStartIndex:A,dataEndIndex:_}),X=M.type.defaultProps!==void 0?he(he({},M.type.defaultProps),M.props):M.props,re=X.dataKey,xe=X.maxBarSize,F=X["".concat(L,"Id")],fe=X["".concat(V,"Id")],oe={},de=c.reduce(function(H,Q){var J=b["".concat(Q.axisType,"Map")],B=X["".concat(Q.axisType,"Id")];J&&J[B]||Q.axisType==="zAxis"||iu();var ee=J[B];return he(he({},H),{},St(St({},Q.axisType,ee),"".concat(Q.axisType,"Ticks"),oa(ee)))},oe),Re=de[V],pe=de["".concat(V,"Ticks")],Se=w&&w[F]&&w[F].hasStack&&jEe(M,w[F].stackGroups),Ne=la(M.type).indexOf("Bar")>=0,ne=Ux(Re,pe),nt=[],Fe=$&&hEe({barSize:j,stackGroups:w,totalSize:sDe(de,V)});if(Ne){var vt,mt,Bt=Pt(xe)?E:xe,N=(vt=(mt=Ux(Re,pe,!0))!==null&&mt!==void 0?mt:Bt)!==null&&vt!==void 0?vt:0;nt=pEe({barGap:P,barCategoryGap:I,bandSize:N!==ne?N:ne,sizeList:Fe[fe],maxBarSize:Bt}),N!==ne&&(nt=nt.map(function(H){return he(he({},H),{},{position:he(he({},H.position),{},{offset:H.position.offset-N/2})})}))}var D=M&&M.type&&M.type.getComposedData;D&&z.push({props:he(he({},D(he(he({},de),{},{displayedData:W,props:v,dataKey:re,item:M,bandSize:ne,barPosition:nt,offset:S,stackedData:Se,layout:k,dataStartIndex:A,dataEndIndex:_}))),{},St(St(St({key:M.key||"item-".concat(U)},L,de[L]),V,de[V]),"animationId",C)),childIndex:ppe(M,v.children),item:M})}),z},p=function(v,b){var x=v.props,w=v.dataStartIndex,S=v.dataEndIndex,C=v.updateId;if(!WI({props:x}))return null;var A=x.children,_=x.layout,j=x.stackOffset,k=x.data,P=x.reverseStackOrder,I=DD(_),E=I.numericAxisName,R=I.cateAxisName,L=fo(A,r),V=AEe(k,L,"".concat(E,"Id"),"".concat(R,"Id"),j,P),$=c.reduce(function(X,re){var xe="".concat(re.axisType,"Map");return he(he({},X),{},St({},xe,nDe(x,he(he({},re),{},{graphicalItems:L,stackGroups:re.axisType===E&&V,dataStartIndex:w,dataEndIndex:S}))))},{}),z=oDe(he(he({},$),{},{props:x,graphicalItems:L}),b==null?void 0:b.legendBBox);Object.keys($).forEach(function(X){$[X]=d(x,$[X],z,X.replace("Map",""),n)});var M=$["".concat(R,"Map")],U=rDe(M),W=h(x,he(he({},$),{},{dataStartIndex:w,dataEndIndex:S,updateId:C,graphicalItems:L,stackGroups:V,offset:z}));return he(he({formattedGraphicalItems:W,graphicalItems:L,offset:z,stackGroups:V},U),$)},g=function(m){function v(b){var x,w,S;return FMe(this,v),S=HMe(this,v,[b]),St(S,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),St(S,"accessibilityManager",new _Me),St(S,"handleLegendBBoxUpdate",function(C){if(C){var A=S.state,_=A.dataStartIndex,j=A.dataEndIndex,k=A.updateId;S.setState(he({legendBBox:C},p({props:S.props,dataStartIndex:_,dataEndIndex:j,updateId:k},he(he({},S.state),{},{legendBBox:C}))))}}),St(S,"handleReceiveSyncEvent",function(C,A,_){if(S.props.syncId===C){if(_===S.eventEmitterSymbol&&typeof S.props.syncMethod!="function")return;S.applySyncEvent(A)}}),St(S,"handleBrushChange",function(C){var A=C.startIndex,_=C.endIndex;if(A!==S.state.dataStartIndex||_!==S.state.dataEndIndex){var j=S.state.updateId;S.setState(function(){return he({dataStartIndex:A,dataEndIndex:_},p({props:S.props,dataStartIndex:A,dataEndIndex:_,updateId:j},S.state))}),S.triggerSyncEvent({dataStartIndex:A,dataEndIndex:_})}}),St(S,"handleMouseEnter",function(C){var A=S.getMouseInfo(C);if(A){var _=he(he({},A),{},{isTooltipActive:!0});S.setState(_),S.triggerSyncEvent(_);var j=S.props.onMouseEnter;xt(j)&&j(_,C)}}),St(S,"triggeredAfterMouseMove",function(C){var A=S.getMouseInfo(C),_=A?he(he({},A),{},{isTooltipActive:!0}):{isTooltipActive:!1};S.setState(_),S.triggerSyncEvent(_);var j=S.props.onMouseMove;xt(j)&&j(_,C)}),St(S,"handleItemMouseEnter",function(C){S.setState(function(){return{isTooltipActive:!0,activeItem:C,activePayload:C.tooltipPayload,activeCoordinate:C.tooltipPosition||{x:C.cx,y:C.cy}}})}),St(S,"handleItemMouseLeave",function(){S.setState(function(){return{isTooltipActive:!1}})}),St(S,"handleMouseMove",function(C){C.persist(),S.throttleTriggeredAfterMouseMove(C)}),St(S,"handleMouseLeave",function(C){S.throttleTriggeredAfterMouseMove.cancel();var A={isTooltipActive:!1};S.setState(A),S.triggerSyncEvent(A);var _=S.props.onMouseLeave;xt(_)&&_(A,C)}),St(S,"handleOuterEvent",function(C){var A=hpe(C),_=zi(S.props,"".concat(A));if(A&&xt(_)){var j,k;/.*touch.*/i.test(A)?k=S.getMouseInfo(C.changedTouches[0]):k=S.getMouseInfo(C),_((j=k)!==null&&j!==void 0?j:{},C)}}),St(S,"handleClick",function(C){var A=S.getMouseInfo(C);if(A){var _=he(he({},A),{},{isTooltipActive:!0});S.setState(_),S.triggerSyncEvent(_);var j=S.props.onClick;xt(j)&&j(_,C)}}),St(S,"handleMouseDown",function(C){var A=S.props.onMouseDown;if(xt(A)){var _=S.getMouseInfo(C);A(_,C)}}),St(S,"handleMouseUp",function(C){var A=S.props.onMouseUp;if(xt(A)){var _=S.getMouseInfo(C);A(_,C)}}),St(S,"handleTouchMove",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.throttleTriggeredAfterMouseMove(C.changedTouches[0])}),St(S,"handleTouchStart",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseDown(C.changedTouches[0])}),St(S,"handleTouchEnd",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseUp(C.changedTouches[0])}),St(S,"triggerSyncEvent",function(C){S.props.syncId!==void 0&&qS.emit(YS,S.props.syncId,C,S.eventEmitterSymbol)}),St(S,"applySyncEvent",function(C){var A=S.props,_=A.layout,j=A.syncMethod,k=S.state.updateId,P=C.dataStartIndex,I=C.dataEndIndex;if(C.dataStartIndex!==void 0||C.dataEndIndex!==void 0)S.setState(he({dataStartIndex:P,dataEndIndex:I},p({props:S.props,dataStartIndex:P,dataEndIndex:I,updateId:k},S.state)));else if(C.activeTooltipIndex!==void 0){var E=C.chartX,R=C.chartY,L=C.activeTooltipIndex,V=S.state,$=V.offset,z=V.tooltipTicks;if(!$)return;if(typeof j=="function")L=j(z,C);else if(j==="value"){L=-1;for(var M=0;M=0){var Se,Ne;if(E.dataKey&&!E.allowDuplicatedCategory){var ne=typeof E.dataKey=="function"?pe:"payload.".concat(E.dataKey.toString());Se=fx(M,ne,L),Ne=U&&W&&fx(W,ne,L)}else Se=M==null?void 0:M[R],Ne=U&&W&&W[R];if(fe||F){var nt=C.props.activeIndex!==void 0?C.props.activeIndex:R;return[y.cloneElement(C,he(he(he({},j.props),de),{},{activeIndex:nt})),null,null]}if(!Pt(Se))return[Re].concat(lf(S.renderActivePoints({item:j,activePoint:Se,basePoint:Ne,childIndex:R,isRange:U})))}else{var Fe,vt=(Fe=S.getItemByXY(S.state.activeCoordinate))!==null&&Fe!==void 0?Fe:{graphicalItem:Re},mt=vt.graphicalItem,Bt=mt.item,N=Bt===void 0?C:Bt,D=mt.childIndex,H=he(he(he({},j.props),de),{},{activeIndex:D});return[y.cloneElement(N,H),null,null]}return U?[Re,null,null]:[Re,null]}),St(S,"renderCustomized",function(C,A,_){return y.cloneElement(C,he(he({key:"recharts-customized-".concat(_)},S.props),S.state))}),St(S,"renderMap",{CartesianGrid:{handler:cv,once:!0},ReferenceArea:{handler:S.renderReferenceElement},ReferenceLine:{handler:cv},ReferenceDot:{handler:S.renderReferenceElement},XAxis:{handler:cv},YAxis:{handler:cv},Brush:{handler:S.renderBrush,once:!0},Bar:{handler:S.renderGraphicChild},Line:{handler:S.renderGraphicChild},Area:{handler:S.renderGraphicChild},Radar:{handler:S.renderGraphicChild},RadialBar:{handler:S.renderGraphicChild},Scatter:{handler:S.renderGraphicChild},Pie:{handler:S.renderGraphicChild},Funnel:{handler:S.renderGraphicChild},Tooltip:{handler:S.renderCursor,once:!0},PolarGrid:{handler:S.renderPolarGrid,once:!0},PolarAngleAxis:{handler:S.renderPolarAxis},PolarRadiusAxis:{handler:S.renderPolarAxis},Customized:{handler:S.renderCustomized}}),S.clipPathId="".concat((x=b.id)!==null&&x!==void 0?x:Rf("recharts"),"-clip"),S.throttleTriggeredAfterMouseMove=$V(S.triggeredAfterMouseMove,(w=b.throttleDelay)!==null&&w!==void 0?w:1e3/60),S.state={},S}return GMe(v,m),BMe(v,[{key:"componentDidMount",value:function(){var x,w;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(x=this.props.margin.left)!==null&&x!==void 0?x: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 x=this.props,w=x.children,S=x.data,C=x.height,A=x.layout,_=Ri(w,zr);if(_){var j=_.props.defaultIndex;if(!(typeof j!="number"||j<0||j>this.state.tooltipTicks.length-1)){var k=this.state.tooltipTicks[j]&&this.state.tooltipTicks[j].value,P=j_(this.state,S,j,k),I=this.state.tooltipTicks[j].coordinate,E=(this.state.offset.top+C)/2,R=A==="horizontal",L=R?{x:I,y:E}:{y:I,x:E},V=this.state.formattedGraphicalItems.find(function(z){var M=z.item;return M.type.name==="Scatter"});V&&(L=he(he({},L),V.props.points[j].tooltipPosition),P=V.props.points[j].tooltipPayload);var $={activeTooltipIndex:j,isTooltipActive:!0,activeLabel:k,activePayload:P,activeCoordinate:L};this.setState($),this.renderCursor(_),this.accessibilityManager.setIndex(j)}}}},{key:"getSnapshotBeforeUpdate",value:function(x,w){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==w.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==x.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==x.margin){var S,C;this.accessibilityManager.setDetails({offset:{left:(S=this.props.margin.left)!==null&&S!==void 0?S:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0}})}return null}},{key:"componentDidUpdate",value:function(x){tA([Ri(x.children,zr)],[Ri(this.props.children,zr)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var x=Ri(this.props.children,zr);if(x&&typeof x.props.shared=="boolean"){var w=x.props.shared?"axis":"item";return l.indexOf(w)>=0?w:o}return o}},{key:"getMouseInfo",value:function(x){if(!this.container)return null;var w=this.container,S=w.getBoundingClientRect(),C=UCe(S),A={chartX:Math.round(x.pageX-C.left),chartY:Math.round(x.pageY-C.top)},_=S.width/w.offsetWidth||1,j=this.inRange(A.chartX,A.chartY,_);if(!j)return null;var k=this.state,P=k.xAxisMap,I=k.yAxisMap,E=this.getTooltipEventType();if(E!=="axis"&&P&&I){var R=qa(P).scale,L=qa(I).scale,V=R&&R.invert?R.invert(A.chartX):null,$=L&&L.invert?L.invert(A.chartY):null;return he(he({},A),{},{xValue:V,yValue:$})}var z=RD(this.state,this.props.data,this.props.layout,j);return z?he(he({},A),z):null}},{key:"inRange",value:function(x,w){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,C=this.props.layout,A=x/S,_=w/S;if(C==="horizontal"||C==="vertical"){var j=this.state.offset,k=A>=j.left&&A<=j.left+j.width&&_>=j.top&&_<=j.top+j.height;return k?{x:A,y:_}:null}var P=this.state,I=P.angleAxisMap,E=P.radiusAxisMap;if(I&&E){var R=qa(I);return rM({x:A,y:_},R)}return null}},{key:"parseEventsOfWrapper",value:function(){var x=this.props.children,w=this.getTooltipEventType(),S=Ri(x,zr),C={};S&&w==="axis"&&(S.props.trigger==="click"?C={onClick:this.handleClick}:C={onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd});var A=hx(this.props,this.handleOuterEvent);return he(he({},A),C)}},{key:"addListener",value:function(){qS.on(YS,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){qS.removeListener(YS,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(x,w,S){for(var C=this.state.formattedGraphicalItems,A=0,_=C.length;A<_;A++){var j=C[A];if(j.item===x||j.props.key===x.key||w===la(j.item.type)&&S===j.childIndex)return j}return null}},{key:"renderClipPath",value:function(){var x=this.clipPathId,w=this.state.offset,S=w.left,C=w.top,A=w.height,_=w.width;return T.createElement("defs",null,T.createElement("clipPath",{id:x},T.createElement("rect",{x:S,y:C,height:A,width:_})))}},{key:"getXScales",value:function(){var x=this.state.xAxisMap;return x?Object.entries(x).reduce(function(w,S){var C=kD(S,2),A=C[0],_=C[1];return he(he({},w),{},St({},A,_.scale))},{}):null}},{key:"getYScales",value:function(){var x=this.state.yAxisMap;return x?Object.entries(x).reduce(function(w,S){var C=kD(S,2),A=C[0],_=C[1];return he(he({},w),{},St({},A,_.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(x){var w;return(w=this.state.xAxisMap)===null||w===void 0||(w=w[x])===null||w===void 0?void 0:w.scale}},{key:"getYScaleByAxisId",value:function(x){var w;return(w=this.state.yAxisMap)===null||w===void 0||(w=w[x])===null||w===void 0?void 0:w.scale}},{key:"getItemByXY",value:function(x){var w=this.state,S=w.formattedGraphicalItems,C=w.activeItem;if(S&&S.length)for(var A=0,_=S.length;A<_;A++){var j=S[A],k=j.props,P=j.item,I=P.type.defaultProps!==void 0?he(he({},P.type.defaultProps),P.props):P.props,E=la(P.type);if(E==="Bar"){var R=(k.data||[]).find(function(z){return uPe(x,z)});if(R)return{graphicalItem:j,payload:R}}else if(E==="RadialBar"){var L=(k.data||[]).find(function(z){return rM(x,z)});if(L)return{graphicalItem:j,payload:L}}else if(hw(j,C)||pw(j,C)||Em(j,C)){var V=lOe({graphicalItem:j,activeTooltipItem:C,itemData:I.data}),$=I.activeIndex===void 0?V:I.activeIndex;return{graphicalItem:he(he({},j),{},{childIndex:$}),payload:Em(j,C)?I.data[V]:j.props.data[V]}}}return null}},{key:"render",value:function(){var x=this;if(!WI(this))return null;var w=this.props,S=w.children,C=w.className,A=w.width,_=w.height,j=w.style,k=w.compact,P=w.title,I=w.desc,E=OD(w,RMe),R=Ze(E,!1);if(k)return T.createElement(pD,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},T.createElement(rA,Jh({},R,{width:A,height:_,title:P,desc:I}),this.renderClipPath(),YI(S,this.renderMap)));if(this.props.accessibilityLayer){var L,V;R.tabIndex=(L=this.props.tabIndex)!==null&&L!==void 0?L:0,R.role=(V=this.props.role)!==null&&V!==void 0?V:"application",R.onKeyDown=function(z){x.accessibilityManager.keyboardEvent(z)},R.onFocus=function(){x.accessibilityManager.focus()}}var $=this.parseEventsOfWrapper();return T.createElement(pD,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},T.createElement("div",Jh({className:Et("recharts-wrapper",C),style:he({position:"relative",cursor:"default",width:A,height:_},j)},$,{ref:function(M){x.container=M}}),T.createElement(rA,Jh({},R,{width:A,height:_,title:P,desc:I,style:XMe}),this.renderClipPath(),YI(S,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(y.Component);return St(g,"displayName",n),St(g,"defaultProps",he({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),St(g,"getDerivedStateFromProps",function(m,v){var b=m.dataKey,x=m.data,w=m.children,S=m.width,C=m.height,A=m.layout,_=m.stackOffset,j=m.margin,k=v.dataStartIndex,P=v.dataEndIndex;if(v.updateId===void 0){var I=MD(m);return he(he(he({},I),{},{updateId:0},p(he(he({props:m},I),{},{updateId:0}),v)),{},{prevDataKey:b,prevData:x,prevWidth:S,prevHeight:C,prevLayout:A,prevStackOffset:_,prevMargin:j,prevChildren:w})}if(b!==v.prevDataKey||x!==v.prevData||S!==v.prevWidth||C!==v.prevHeight||A!==v.prevLayout||_!==v.prevStackOffset||!ld(j,v.prevMargin)){var E=MD(m),R={chartX:v.chartX,chartY:v.chartY,isTooltipActive:v.isTooltipActive},L=he(he({},RD(v,x,A)),{},{updateId:v.updateId+1}),V=he(he(he({},E),R),L);return he(he(he({},V),p(he({props:m},V),v)),{},{prevDataKey:b,prevData:x,prevWidth:S,prevHeight:C,prevLayout:A,prevStackOffset:_,prevMargin:j,prevChildren:w})}if(!tA(w,v.prevChildren)){var $,z,M,U,W=Ri(w,Xd),X=W&&($=(z=W.props)===null||z===void 0?void 0:z.startIndex)!==null&&$!==void 0?$:k,re=W&&(M=(U=W.props)===null||U===void 0?void 0:U.endIndex)!==null&&M!==void 0?M:P,xe=X!==k||re!==P,F=!Pt(x),fe=F&&!xe?v.updateId:v.updateId+1;return he(he({updateId:fe},p(he(he({props:m},v),{},{updateId:fe,dataStartIndex:X,dataEndIndex:re}),v)),{},{prevChildren:w,dataStartIndex:X,dataEndIndex:re})}return null}),St(g,"renderActiveDot",function(m,v,b){var x;return y.isValidElement(m)?x=y.cloneElement(m,v):xt(m)?x=m(v):x=T.createElement(hg,v),T.createElement(Ht,{className:"recharts-active-dot",key:b},x)}),function(v){return T.createElement(g,v)}},yK=ww({chartName:"BarChart",GraphicalChild:Xl,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Ll},{axisType:"yAxis",AxisComp:Fl}],formatAxisMap:RG}),hP=ww({chartName:"PieChart",GraphicalChild:ts,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:zf},{axisType:"radiusAxis",AxisComp:Hf}],formatAxisMap:Q8,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),aDe=ww({chartName:"RadarChart",GraphicalChild:pg,axisComponents:[{axisType:"angleAxis",AxisComp:zf},{axisType:"radiusAxis",AxisComp:Hf}],formatAxisMap:Q8,defaultProps:{layout:"centric",startAngle:90,endAngle:-270,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),xK=ww({chartName:"AreaChart",GraphicalChild:Ho,axisComponents:[{axisType:"xAxis",AxisComp:Ll},{axisType:"yAxis",AxisComp:Fl}],formatAxisMap:RG});const lDe=({messages:t,themes:e,personas:n=[]})=>{var g;const[r,i]=y.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"}]),[o,s]=y.useState([]),[l,c]=y.useState({}),[u,d]=y.useState({isBalanced:!1,score:0,reason:""}),f=m=>{const v=n.find(b=>b.id===m);return v?v.name:`Participant ${m}`};y.useEffect(()=>{if(t.length===0)return;const m={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0},v={},b={};t.forEach(S=>{if(S.senderId!=="moderator"&&S.senderId!=="facilitator"){const C=S.text.toLowerCase();let A="Neutral";C.includes("love")||C.includes("excellent")||C.includes("amazing")?A="Very Positive":C.includes("good")||C.includes("like")||C.includes("great")?A="Positive":C.includes("bad")||C.includes("issue")||C.includes("problem")?A="Negative":(C.includes("terrible")||C.includes("hate")||C.includes("awful"))&&(A="Very Negative"),m[A]++,b[S.senderId]||(b[S.senderId]={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0}),b[S.senderId][A]++,v[S.senderId]=(v[S.senderId]||0)+1}}),i(S=>S.map(C=>({...C,value:m[C.name]||0})));const x=Object.entries(v).map(([S,C])=>({name:f(S),messages:C}));s(x);const w={};Object.entries(b).forEach(([S,C])=>{w[S]={name:f(S),sentiments:C}}),c(w),h(v,b)},[t,n,f]);const h=(m,v)=>{if(Object.keys(m).length===0){d({isBalanced:!1,score:0,reason:"No participant data available"});return}const x=Object.values(m).reduce((z,M)=>z+M,0)/Object.keys(m).length,w=Object.values(m).map(z=>Math.abs(z-x)/x),S=w.reduce((z,M)=>z+M,0)/w.length,C=Object.values(v).map(z=>Object.values(z).filter(M=>M>0).length),A=C.reduce((z,M)=>z+M,0)/C.length,_=["Very Positive","Positive","Neutral","Negative","Very Negative"],j=Object.values(v).map(z=>{const M=Math.max(...Object.values(z));return _.find(U=>z[U]===M)||"Neutral"}),k=new Set(j).size,P=k/_.length,I=Math.max(0,100-S*100),E=A/5*100,R=P*100,L=Math.round(I*.6+E*.2+R*.2);let V="";const $=L>=70;S>.3&&(V+="Participation is uneven among participants. "),A<2&&(V+="Limited range of sentiments expressed. "),k<=1?V+="Participants show similar sentiment patterns, suggesting potential group-think. ":k>=4&&(V+="Wide divergence in participant sentiments, showing healthy diversity of opinions. "),V===""&&(V=$?"Good mix of participation and diverse opinions.":"Multiple factors affecting balance."),d({isBalanced:$,score:L,reason:V})},p=m=>{const v=l[m];if(!v)return"N/A";const b=v.sentiments;let x=0,w="Neutral";return Object.entries(b).forEach(([S,C])=>{C>x&&(x=C,w=S)}),w};return a.jsx("div",{className:"glass-panel rounded-xl p-4",children:a.jsxs(Kl,{defaultValue:"sentiment",children:[a.jsxs(Ea,{className:"grid grid-cols-2 mb-4",children:[a.jsxs(on,{value:"sentiment",className:"flex items-center",children:[a.jsx(EX,{className:"h-4 w-4 mr-2"}),"Sentiment"]}),a.jsxs(on,{value:"participation",className:"flex items-center",children:[a.jsx(i1,{className:"h-4 w-4 mr-2"}),"Participation"]})]}),a.jsx(sn,{value:"sentiment",children:a.jsx(ct,{children:a.jsxs(jt,{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(Al,{width:"100%",height:"100%",children:a.jsxs(hP,{children:[a.jsx(zr,{}),a.jsx(ts,{data:r,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:m,percent:v})=>v>0?`${m} ${(v*100).toFixed(0)}%`:"",children:r.map((m,v)=>a.jsx(lg,{fill:m.color},`cell-${v}`))}),a.jsx(ca,{})]})})}),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,v])=>{var w;const b=p(m),x=((w=r.find(S=>S.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(Ap,{className:"h-4 w-4 text-slate-400 mr-2"}),a.jsx("span",{className:"text-sm",children:v.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:`${x}30`,color:x},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(sn,{value:"participation",children:a.jsx(ct,{children:a.jsxs(jt,{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(Al,{width:"100%",height:"100%",children:a.jsxs(yK,{data:o,layout:"vertical",margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(Om,{strokeDasharray:"3 3"}),a.jsx(Ll,{type:"number"}),a.jsx(Fl,{dataKey:"name",type:"category",width:100}),a.jsx(zr,{}),a.jsx(Xl,{dataKey:"messages",fill:"#8884d8",name:"Messages"})]})})}),a.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:o.length>0?`Most active: ${(g=o.sort((m,v)=>v.messages-m.messages)[0])==null?void 0:g.name}`:"No participation data available"})]})})})]})})},cDe=({focusGroupId:t,personas:e,isVisible:n,onToggle:r})=>{const[i,o]=y.useState(null),[s,l]=y.useState(null),[c,u]=y.useState(null),[d,f]=y.useState(null),[h,p]=y.useState(!1),[g,m]=y.useState(null),[v,b]=y.useState(null);y.useEffect(()=>{if(n&&t){x();const _=setInterval(x,3e4);return()=>clearInterval(_)}},[n,t]);const x=async()=>{p(!0),m(null);try{const[_,j,k,P]=await Promise.allSettled([Hn.getConversationAnalytics(t),Hn.getConversationState(t),Hn.getAutonomousConversationStatus(t),Hn.getConversationInsights(t)]);_.status==="fulfilled"&&o(_.value.data.analytics),j.status==="fulfilled"&&l(j.value.data.state),k.status==="fulfilled"&&u(k.value.data.status),P.status==="fulfilled"&&f(P.value.data.insights),b(new Date)}catch(_){console.error("Error fetching dashboard data:",_),m("Failed to load dashboard data")}finally{p(!1)}},w=()=>{x()},S=_=>{switch(_){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"}},C=_=>{switch(_){case"positive":return"text-green-600";case"negative":return"text-red-600";default:return"text-gray-600"}},A=_=>{switch(_){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(ea,{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(te,{variant:"ghost",size:"sm",onClick:w,disabled:h,className:"p-1",children:a.jsx(td,{className:`h-4 w-4 ${h?"animate-spin":""}`})}),a.jsx(te,{variant:"ghost",size:"sm",onClick:r,className:"p-1",children:a.jsx(OX,{className:"h-4 w-4"})})]})]}),v&&a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Last updated: ",v.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(NX,{className:"h-4 w-4 text-red-600"}),a.jsx("span",{className:"text-sm text-red-800",children:g})]})}),c&&a.jsxs(ct,{children:[a.jsx(pi,{className:"pb-3",children:a.jsxs(Mi,{className:"text-sm flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${S(c.conversation_state)}`}),"Autonomous Status"]})}),a.jsx(jt,{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(ur,{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})]})]})})]}),s&&a.jsxs(ct,{children:[a.jsx(pi,{className:"pb-3",children:a.jsxs(Mi,{className:"text-sm flex items-center gap-2",children:[a.jsx(Qs,{className:"h-4 w-4"}),"Conversation Health"]})}),a.jsx(jt,{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(ur,{className:A(s.conversation_health.status),children:s.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:[s.conversation_health.score,"/100"]})]}),a.jsx(mc,{value:s.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:s.conversation_health.indicators.map((_,j)=>a.jsx(ur,{variant:"outline",className:"text-xs",children:_.replace("_"," ")},j))})]})]})})]}),i&&a.jsxs(ct,{children:[a.jsx(pi,{className:"pb-3",children:a.jsxs(Mi,{className:"text-sm flex items-center gap-2",children:[a.jsx(Cr,{className:"h-4 w-4"}),"Participation"]})}),a.jsx(jt,{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(ur,{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(ct,{children:[a.jsx(pi,{className:"pb-3",children:a.jsxs(Mi,{className:"text-sm flex items-center gap-2",children:[a.jsx(QX,{className:"h-4 w-4"}),"Sentiment"]})}),a.jsx(jt,{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(ur,{className:C(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(ct,{children:[a.jsx(pi,{className:"pb-3",children:a.jsxs(Mi,{className:"text-sm flex items-center gap-2",children:[a.jsx(jX,{className:"h-4 w-4"}),"Quality Metrics"]})}),a.jsx(jt,{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(mc,{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(mc,{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(mc,{value:i.quality_metrics.quality_score,className:"h-2"})]})]})})]}),d&&a.jsxs(ct,{children:[a.jsx(pi,{className:"pb-3",children:a.jsxs(Mi,{className:"text-sm flex items-center gap-2",children:[a.jsx(Vc,{className:"h-4 w-4"}),"AI Insights"]})}),a.jsx(jt,{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(ur,{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(ur,{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(ct,{children:[a.jsx(pi,{className:"pb-3",children:a.jsxs(Mi,{className:"text-sm flex items-center gap-2",children:[a.jsx(Gj,{className:"h-4 w-4"}),"Recommendations"]})}),a.jsx(jt,{className:"pt-0",children:a.jsx("div",{className:"space-y-2",children:i.recommendations.map((_,j)=>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:_})},j))})})]})]})]}):null},uDe=({discussionGuide:t,moderatorStatus:e,onSectionSelect:n,onSetPosition:r,onSave:i,focusGroupId:o,isOpen:s,onToggle:l,className:c,onEditingChange:u})=>{const d=y.useRef(!1),f=y.useCallback(v=>{d.current=v,u==null||u(v)},[u]),[h,p]=y.useState(!1),g=async()=>{if(!t){ie.error("No discussion guide available",{description:"The discussion guide is not available for download"});return}p(!0);try{await _t.downloadDiscussionGuide(o),ie.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(v){console.error("Error downloading discussion guide:",v),ie.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{p(!1)}},m=t&&typeof t=="object"&&t.sections;return a.jsx("div",{className:Pe("w-full border-b bg-white shadow-sm",c),children:a.jsxs(eg,{open:s,onOpenChange:l,children:[a.jsx(tg,{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(kX,{className:"h-5 w-5 text-slate-600"}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-semibold text-slate-900",children:"Discussion Guide"}),m&&a.jsxs("p",{className:"text-xs text-slate-500",children:[t.title," • ",t.total_duration," minutes"]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{variant:"ghost",size:"sm",onClick:v=>{v.stopPropagation(),g()},disabled:!t||h,className:"h-8",children:h?a.jsx(ws,{className:"h-4 w-4 animate-spin"}):a.jsx(zc,{className:"h-4 w-4"})}),s?a.jsx(Hc,{className:"h-4 w-4 text-slate-500"}):a.jsx(va,{className:"h-4 w-4 text-slate-500"})]})]})}),a.jsx(ng,{children:a.jsx("div",{className:"border-t bg-slate-50",children:a.jsx(ct,{className:"mx-4 mb-4 mt-2",children:a.jsx(jt,{className:"p-4",children:a.jsx("div",{className:"max-h-[70vh] overflow-y-auto",children:a.jsx(nT,{discussionGuide:t,moderatorStatus:e,onSectionSelect:n,onSetPosition:r,onSave:i,showProgress:!0,collapsible:!0,defaultExpanded:!0,focusGroupId:o,onEditingChange:f})})})})})})]})})},dDe=({focusGroupId:t,focusGroupName:e="Focus Group",onNoteClick:n})=>{const[r,i]=y.useState([]),[o,s]=y.useState(!0),[l,c]=y.useState(null);y.useEffect(()=>{u()},[t]);const u=async()=>{try{s(!0);const x=await _t.getNotes(t);if(x.data&&Array.isArray(x.data)){const w=x.data.map(S=>({...S,timestamp:new Date(S.timestamp),createdAt:new Date(S.createdAt)}));i(v(w))}}catch(x){console.error("Error fetching notes:",x),ie.error("Failed to load notes",{description:"Please refresh the page to try again."})}finally{s(!1)}},d=async x=>{c(x);try{await _t.deleteNote(t,x),i(r.filter(w=>w.id!==x)),ie.success("Note deleted successfully")}catch(w){console.error("Error deleting note:",w),ie.error("Failed to delete note",{description:"Please try again."})}finally{c(null)}},f=x=>{x.associatedMessageId&&n?n(x.associatedMessageId):ie.info("No associated message",{description:"This note is not linked to a specific discussion point."})},h=()=>{if(r.length===0){ie.warning("No notes to export",{description:"Create some notes first before exporting."});return}const x=p(),w=document.createElement("a"),S=new Blob([x],{type:"text/markdown"});w.href=URL.createObjectURL(S),w.download=`${e.replace(/[^a-z0-9]/gi,"_").toLowerCase()}_notes.md`,document.body.appendChild(w),w.click(),document.body.removeChild(w),ie.success("Notes exported successfully",{description:`Downloaded ${r.length} notes as Markdown file.`})},p=()=>{const x=[`# Notes: ${e}`,"",`Exported on: ${new Date().toLocaleString()}`,`Total notes: ${r.length}`,"","---",""];return r.forEach((w,S)=>{var C;x.push(`## Note ${S+1}`),x.push(""),x.push(`**Created:** ${w.createdAt.toLocaleString()}`),(C=w.sectionInfo)!=null&&C.sectionTitle&&x.push(`**Section:** ${w.sectionInfo.sectionTitle}`),x.push(`**Elapsed Time:** ${g(w.elapsedTime)}`),x.push(""),x.push("**Content:**"),x.push(w.content),x.push(""),x.push("---"),x.push("")}),x.join(` +`)},g=x=>{const w=Math.floor(x/1e3),S=Math.floor(w/60),C=w%60;return`${S}:${C.toString().padStart(2,"0")}`},m=x=>x.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),v=x=>[...x].sort((w,S)=>S.createdAt.getTime()-w.createdAt.getTime()),b=x=>{i(w=>v([...w,x]))};return y.useEffect(()=>(window.notesPanelAddNote=b,()=>{delete window.notesPanelAddNote}),[]),o?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(my,{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(te,{variant:"outline",size:"sm",onClick:h,disabled:r.length===0,children:[a.jsx(zc,{className:"mr-2 h-4 w-4"}),"Export Notes"]})]}),a.jsx(k0,{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(my,{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(x=>{var w;return a.jsxs(ct,{className:"hover:shadow-md transition-shadow cursor-pointer group",onClick:()=>f(x),children:[a.jsx(pi,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(Mi,{className:"text-sm font-medium text-slate-600",children:m(x.createdAt)}),((w=x.sectionInfo)==null?void 0:w.sectionTitle)&&a.jsx("div",{className:"text-xs text-slate-500 mt-1",children:a.jsx("span",{children:x.sectionInfo.sectionTitle})})]}),a.jsxs("div",{className:"flex items-center space-x-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[x.associatedMessageId&&a.jsx(te,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:S=>{S.stopPropagation(),f(x)},title:"Go to discussion point",children:a.jsx(zX,{className:"h-3 w-3"})}),a.jsx(te,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-600 hover:text-red-700",onClick:S=>{S.stopPropagation(),d(x.id)},disabled:l===x.id,title:"Delete note",children:a.jsx(Kn,{className:"h-3 w-3"})})]})]})}),a.jsx(jt,{className:"pt-0",children:a.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:x.content})})]},x.id)})})})]})},fDe=({isOpen:t,onClose:e,focusGroupId:n,associatedMessageId:r,sectionInfo:i,messageTimestamp:o,onNoteSaved:s})=>{const[l,c]=y.useState(""),[u,d]=y.useState(!1),f=async()=>{if(!l.trim()){ie.error("Note content cannot be empty");return}d(!0);try{const p={content:l.trim(),associatedMessageId:r,sectionInfo:i,elapsedTime:0,timestamp:o.toISOString(),createdAt:new Date().toISOString()},g=await _t.createNote(n,p);if(g.data){const m={...g.data,timestamp:new Date(g.data.timestamp),createdAt:new Date(g.data.createdAt)},v=i!=null&&i.sectionTitle?`'${i.sectionTitle}'`:"current section",b=o.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});ie.success("Quick note saved",{description:`Note linked to ${v} at ${b}`}),s&&s(m),c(""),e()}}catch(p){console.error("Error saving note:",p),ie.error("Failed to save note",{description:"Please try again or check your connection."})}finally{d(!1)}},h=()=>{c(""),e()};return a.jsx(kc,{open:t,onOpenChange:h,children:a.jsxs(xl,{className:"sm:max-w-md",children:[a.jsx(bl,{children:a.jsx(Sl,{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:"})," ",o.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),a.jsx(lt,{placeholder:"Enter your note here...",value:l,onChange:p=>c(p.target.value),className:"min-h-[100px] resize-none",autoFocus:!0})]}),a.jsxs(wl,{children:[a.jsx(te,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(te,{onClick:f,disabled:u,children:u?"Saving...":"Save Note"})]})]})})},hDe=()=>{const{id:t}=Vj(),e=Xn(),[n,r]=y.useState([]),[i,o]=y.useState([]),[s,l]=y.useState([]),[c,u]=y.useState(null),[d,f]=y.useState([]),[h,p]=y.useState("chat"),[g,m]=y.useState(null),[v,b]=y.useState(!1),[x,w]=y.useState(!1),[S,C]=y.useState(!0),[A,_]=y.useState(!1),[j,k]=y.useState(!1),P=y.useRef(!1),[I,E]=y.useState(!1),R=y.useRef(c);R.current=c;const[L,V]=y.useState([]),[$,z]=y.useState(!1),[M,U]=y.useState(""),[W,X]=y.useState("medium"),[re,xe]=y.useState("medium"),[F,fe]=y.useState(!1),[oe,de]=y.useState(!1),[Re,pe]=y.useState(null),[Se,Ne]=y.useState([]),[ne,nt]=y.useState(!1),[Fe,vt]=y.useState(!1),[mt,Bt]=y.useState(!1),[N,D]=y.useState({isOpen:!1}),H=y.useRef(!1),[Q,J]=y.useState(""),B=y.useRef(""),ee=y.useRef(!1),me=async()=>{var Z;if(t)try{const se=await Hn.getModeratorStatus(t);if((Z=se==null?void 0:se.data)!=null&&Z.status){const O=se.data.status;if(g){const q=g.current_section_id!==O.current_section_id||g.current_item_id!==O.current_item_id||g.progress!==O.progress}P.current||m(O)}}catch(se){console.error("Error fetching moderator status:",se)}},Ce=async()=>{if(!t)return{aiActive:!1,sessionStatus:""};try{if(typeof(_t==null?void 0:_t.getById)!="function")return console.error("focusGroupsApi.getById is not a function:",typeof(_t==null?void 0:_t.getById)),{aiActive:x,sessionStatus:Q};const Z=await _t.getById(t);if(!Z||typeof Z!="object")return console.error("Invalid response object received:",Z),{aiActive:x,sessionStatus:Q};if(!Z.data||typeof Z.data!="object")return console.warn("Focus group response missing data property:",Z),{aiActive:x,sessionStatus:Q};const se=Z.data.status;if(typeof se>"u")return console.warn("Focus group response missing status field:",Z.data),{aiActive:x,sessionStatus:Q};const O=se==="ai_mode";return se==="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(se)||console.warn("Unexpected focus group status value:",se),{aiActive:O,sessionStatus:se}}catch(Z){console.error("Error checking AI mode status:",Z);const se={focusGroupId:t,currentAiModeStatus:x,errorType:"unknown",timestamp:new Date().toISOString()};return Z.response?(se.errorType="api_error",se.status=Z.response.status,se.data=Z.response.data,console.error("API error response:",Z.response.status,Z.response.data),Z.response.status===404?console.warn("Focus group not found - may have been deleted"):Z.response.status===500&&console.error("Server error during status check - backend issue")):Z.request?(se.errorType="network_error",console.error("Network error - no response received, check connectivity")):(se.errorType="request_setup",se.message=Z.message,console.error("Request setup error:",Z.message)),console.debug("Status check error details:",se),{aiActive:x,sessionStatus:Q,isGenerating:!1}}},Me=async(Z,se)=>{if(!t||ee.current)return;const O=["completed","paused"],K=["ai_mode","autonomous_active","active","in-progress"].includes(se),le=O.includes(Z);if(K&&le){ee.current=!0;try{let ue="session_ended";Z==="completed"?ue="auto_complete":Z==="paused"&&(ue="manual_stop");const De=await Hn.endSession(t,ue);De!=null&&De.data&&(Ye.success("Session concluded",{description:"The focus group session has ended with a concluding statement from the moderator."}),setTimeout(()=>{we()},1e3))}catch(ue){console.error("❌ Error ending session with concluding statement:",ue),Ye.error("Error ending session",{description:"Failed to add concluding statement, but the session has ended."})}}},we=async()=>{var Z;if(t)try{const se=await _t.getMessages(t);let O=[],q=[];se&&se.data&&(Array.isArray(se.data)?(O=se.data,q=[]):se.data.messages||se.data.mode_events?(O=se.data.messages||[],q=se.data.mode_events||[]):(O=Array.isArray(se.data)?se.data:[],q=[]));const K=O.map(be=>({id:be._id||be.id||`msg-${Date.now()}`,senderId:be.senderId,text:be.text,timestamp:new Date(be.timestamp||be.created_at||new Date),type:be.type||"response",highlighted:be.highlighted||!1})),le=q.map(be=>({id:be._id||be.id||`event-${Date.now()}`,focus_group_id:be.focus_group_id,event_type:be.event_type,timestamp:new Date(be.timestamp||be.created_at||new Date),user_id:be.user_id,created_at:new Date(be.created_at||new Date)}));o(le),K.length>0?r(be=>{if(be.length===0)return K;{const Tt=new Map;be.forEach(Fn=>Tt.set(Fn.id,Fn));const ut=K.map(Fn=>{if(Tt.has(Fn.id)){const dn=Tt.get(Fn.id);return{...Fn,highlighted:dn.highlighted}}return Fn}),Gt=new Set(ut.map(Fn=>Fn.id)),Jt=be.filter(Fn=>!Gt.has(Fn.id));return[...ut,...Jt].sort((Fn,dn)=>Fn.timestamp.getTime()-dn.timestamp.getTime())}}):K.length===0&&r(be=>be.length===0?[]:be);const ue=K.filter(be=>be.highlighted),De=ue.length>0?ue.map(be=>({id:`theme-${be.id}`,text:be.text.substring(0,40)+(be.text.length>40?"...":""),count:1,messages:[be.id],source:"highlight"})):[];try{const be=await Hn.getKeyThemes(t);if((Z=be==null?void 0:be.data)!=null&&Z.themes&&Array.isArray(be.data.themes)){const Tt=be.data.themes;l([...De,...Tt])}else l(De)}catch(be){console.error("Error fetching AI-generated themes:",be),l(De)}}catch(se){console.error("Error fetching messages:",se),n.length===0&&Ye.error("Failed to fetch messages",{description:"Please try again later or restart the session."})}},We=async()=>{if(!t)return!1;try{const se=(await kr.getAll()).data||[],O=await _t.getById(t);if(O&&O.data){const q=O.data;console.log("Focus group data from API:",q);const K={id:q._id||q.id,name:q.name,status:q.status||"in-progress",participants:q.participants||[],date:q.date||new Date().toISOString(),duration:q.duration||60,topic:q.topic||"general",discussionGuide:q.discussionGuide||"",llm_model:q.llm_model||"gemini-2.5-pro"};if(u(K),U(K.llm_model||"gemini-2.5-pro"),X(K.reasoning_effort||"medium"),xe(K.verbosity||"medium"),q.participants_data&&Array.isArray(q.participants_data))f(q.participants_data.map(ue=>({...ue,id:ue._id||ue.id})));else if(K.participants&&Array.isArray(K.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:K.participants,allPersonas:se.map(De=>({id:De._id||De.id,name:De.name}))});const ue=se.filter(De=>{const be=De._id||De.id;return K.participants.includes(be)});console.log("Matched participants:",ue.map(De=>De.name)),f(ue)}await we(),await me();const le=await Ce();return w(le.aiActive),J(le.sessionStatus),H.current=le.aiActive,B.current=le.sessionStatus,!0}return!1}catch(Z){return console.error("Error fetching focus group:",Z),!1}},wt=async(Z,se,O)=>{if(console.log("🔧 updateFocusGroupModel called with:",{id:t,focusGroup:!!c,newModel:Z,reasoningEffort:se,verbosity:O}),!t||!c){console.log("❌ updateFocusGroupModel: Missing id or focusGroup",{id:t,focusGroup:!!c});return}fe(!0);try{const q={llm_model:Z};Z==="gpt-5"&&(q.reasoning_effort=se||W,q.verbosity=O||re),console.log("🔧 Making API call to update focus group model:",{id:t,updateData:q});const K=await _t.update(t,q);console.log("🔧 API response:",K),K&&K.data?(u(le=>le?{...le,llm_model:Z,reasoning_effort:Z==="gpt-5"?se||W:le==null?void 0:le.reasoning_effort,verbosity:Z==="gpt-5"?O||re:le==null?void 0:le.verbosity}:null),Ye.success("AI Model Updated",{description:`Focus group will now use ${Z==="gemini-2.5-pro"?"Gemini 2.5 Pro":Z==="gpt-4.1"?"GPT-4.1":Z==="gpt-5"?"GPT-5":Z} for AI responses`}),z(!1),console.log("✅ Model update successful")):console.log("❌ API response missing data:",K)}catch(q){console.error("❌ Error updating focus group model:",q),Ye.error("Failed to update AI model",{description:"There was an error updating the AI model. Please try again."})}finally{fe(!1)}};y.useEffect(()=>{console.log("Looking for focus group with ID:",t);const Z=async()=>{try{return(await kr.getAll()).data||[]}catch(K){return console.error("Error fetching personas:",K),[]}},se=async K=>{try{const le=await _t.getById(t);if(le&&le.data){const ue=le.data;console.log("Focus group data from API:",ue);const De={id:ue._id||ue.id,name:ue.name,status:ue.status||"in-progress",participants:ue.participants||[],date:ue.date||new Date().toISOString(),duration:ue.duration||60,topic:ue.topic||"general",discussionGuide:ue.discussionGuide||"",llm_model:ue.llm_model||"gemini-2.5-pro"};if(u(De),U(De.llm_model||"gemini-2.5-pro"),X(De.reasoning_effort||"medium"),xe(De.verbosity||"medium"),ue.participants_data&&Array.isArray(ue.participants_data))f(ue.participants_data.map(be=>({...be,id:be._id||be.id})));else if(De.participants&&Array.isArray(De.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:De.participants,allPersonas:K.map(Tt=>({id:Tt._id||Tt.id,name:Tt.name}))});const be=K.filter(Tt=>{const ut=Tt._id||Tt.id;return De.participants.includes(ut)});console.log("Matched participants:",be.map(Tt=>Tt.name)),f(be)}return we(),me(),C(!1),!0}return!1}catch(le){return console.error("Error fetching focus group:",le),!1}};let O,q;return Z().then(K=>{se(K).then(le=>{le?((()=>{we(),me(),O&&window.clearInterval(O);const be=x?3e3:1e4;console.log("📡 Setting up message polling:",{aiModeActive:x,pollInterval:be,timestamp:new Date().toISOString()}),O=window.setInterval(()=>{P.current?console.log("📡 Skipping poll - editing discussion guide"):(console.log("📡 Polling for messages...",new Date().toISOString()),we(),me())},be)})(),q=window.setInterval(async()=>{const be=H.current,Tt=B.current,ut=await Ce();if(H.current=ut.aiActive,B.current=ut.sessionStatus,w(ut.aiActive),J(ut.sessionStatus),Tt&&Tt!==ut.sessionStatus&&await Me(ut.sessionStatus,Tt),be!==ut.aiActive&&O){window.clearInterval(O);const Gt=ut.aiActive?3e3:1e4;O=window.setInterval(()=>{P.current||(we(),me())},Gt)}},15e3)):(console.error("Focus group not found with ID:",t),C(!1),Ye.error("Focus group not found",{description:`Could not find focus group with ID: ${t}`}))})}),()=>{O&&window.clearInterval(O),q&&window.clearInterval(q)}},[t,e]);const Nt=Z=>{if(!Z||!Z.sections||!Array.isArray(Z.sections))return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const se=Z.sections[0];if(!se)return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const O=K=>K.questions&&Array.isArray(K.questions)&&K.questions.length>0?{content:K.questions[0].content,itemId:K.questions[0].id,type:"question"}:K.activities&&Array.isArray(K.activities)&&K.activities.length>0?{content:K.activities[0].content,itemId:K.activities[0].id,type:"activity"}:null;let q=O(se);if(!q&&se.subsections&&Array.isArray(se.subsections)){for(const K of se.subsections)if(q=O(K),q)break}return q?{content:q.content,sectionId:se.id,itemId:q.itemId}:{content:`Welcome to our focus group session on "${se.title||"our topic"}". Let's begin our discussion.`,sectionId:se.id,itemId:"section-intro"}},Je=async()=>{var Z,se,O,q,K,le;if(t)try{Ye.info("Starting focus group session...",{description:"The session is now ready for AI moderation."});try{const ue=await Hn.getModeratorStatus(t),De=(se=(Z=ue==null?void 0:ue.data)==null?void 0:Z.status)==null?void 0:se.moderator_position;De?console.log("📍 Preserving existing moderator position:",De):(await Hn.setModeratorPosition(t,((K=(q=(O=c==null?void 0:c.discussionGuide)==null?void 0:O.sections)==null?void 0:q[0])==null?void 0:K.id)||"welcome"),console.log("🚀 Moderator position initialized to start of discussion guide (first time)"))}catch(ue){console.warn("Failed to check/initialize moderator position:",ue)}await _t.update(t,{status:"active"});try{const ue=Nt(c==null?void 0:c.discussionGuide),De={id:`msg-${Date.now()}`,senderId:"moderator",text:ue.content,timestamp:new Date,type:"question"},be=await _t.sendMessage(t,{senderId:"moderator",text:De.text,type:"question"});(le=be==null?void 0:be.data)!=null&&le.message_id&&(De.id=be.data.message_id),Xe(De),console.log("🚀 Initial moderator message created:",{content:ue.content,sectionId:ue.sectionId,itemId:ue.itemId})}catch(ue){console.warn("Failed to create initial moderator message:",ue)}Ye.success("Focus group session started",{description:"The discussion has begun. Use the control panel below to moderate."})}catch(ue){console.error("Error starting session:",ue),Ye.error("Error starting session",{description:"There was a problem connecting to the server."})}},Xe=Z=>{r(se=>[...se,Z])},$t=async Z=>{const se=[...n],O=se.findIndex(q=>q.id===Z);if(O!==-1){const q=se[O],K=!q.highlighted;if(se[O]={...q,highlighted:K},r(se),t)try{!Z.startsWith("local-")&&!Z.startsWith("msg-")?await _t.updateMessageHighlight(t,Z,K):console.log("Skipping database update for local message:",Z)}catch(le){console.error("Error updating message highlight state:",le),Ye.error("Failed to save highlight state",{description:"The highlight may not persist if the page is refreshed."})}}},Yt=Z=>d.find(se=>se.id===Z||se._id===Z),_r=()=>{const Z=n.map(q=>{var ue;let K;return q.senderId==="moderator"?K="AI Moderator":q.senderId==="facilitator"?K="Human Facilitator":K=((ue=Yt(q.senderId))==null?void 0:ue.name)||"Unknown",`[${q.timestamp.toLocaleTimeString()}] ${K}: ${q.text}`}).join(` -`),oe=document.createElement("a"),O=new Blob([J],{type:"text/plain"});oe.href=URL.createObjectURL(O),oe.download=`focus-group-${t}-transcript.txt`,document.body.appendChild(oe),oe.click(),document.body.removeChild(oe),qe.success("Transcript downloaded",{description:"The focus group transcript has been saved to your device."})},Sn=(J,oe)=>{const O=tt=>{const Gt=tt.match(/^\[([^\]]+)\]:\s*(.*)$/);return Gt?Gt[2].trim():tt.trim()},q=tt=>tt.toLowerCase().replace(/[^\w\s]/g," ").replace(/\s+/g," ").trim(),W=(tt,Gt)=>{const Zt=q(tt),Dr=q(Gt);if(Zt===Dr)return 1;if(Zt.includes(Dr)||Dr.includes(Zt))return Math.min(Zt.length,Dr.length)/Math.max(Zt.length,Dr.length);const Fn=Zt.split(" "),un=Dr.split(" "),Gf=Fn.filter(mP=>un.includes(mP)&&mP.length>2);return Fn.length===0||un.length===0?0:Gf.length/Math.max(Fn.length,un.length)},he=typeof J=="object"&&J!==null,fe=he?J.text:O(J),Ee=he?J.original:J;let be=null,bt="";if(oe&&(be=n.find(tt=>tt.id===oe),be?bt="direct_message_id_match":console.warn(`Message ID ${oe} not found in current messages array`)),be||(be=n.find(tt=>tt.text.includes(Ee)),be&&(bt="exact_full_match")),be||(be=n.find(tt=>tt.text.includes(fe)),be&&(bt="exact_text_match")),be||(be=n.find(tt=>fe.includes(tt.text.trim())),be&&(bt="reverse_exact_match")),!be){const tt=fe.toLowerCase();be=n.find(Gt=>Gt.text.toLowerCase().includes(tt)||tt.includes(Gt.text.toLowerCase())),be&&(bt="case_insensitive_match")}if(!be){const tt=n.map(Gt=>({message:Gt,similarity:W(fe,Gt.text)})).filter(Gt=>Gt.similarity>.7).sort((Gt,Zt)=>Zt.similarity-Gt.similarity);tt.length>0&&(be=tt[0].message,bt=`fuzzy_match_${Math.round(tt[0].similarity*100)}%`)}if(!be){const Gt=q(fe).split(" ").filter(Zt=>Zt.length>3);Gt.length>0&&(be=n.find(Zt=>{const Dr=q(Zt.text);return Gt.every(Fn=>Dr.includes(Fn))}),be&&(bt="partial_word_match"))}be?(console.log(`Quote match found using strategy: ${bt}`,{quoteType:he?"QuoteData":"string",providedMessageId:oe,extractedText:fe,matchedMessage:be.text.substring(0,100),matchedMessageId:be.id,originalQuote:Ee.substring(0,100)}),p("chat"),setTimeout(()=>{const tt=document.getElementById(`message-${be.id}`);tt&&(j||tt.scrollIntoView({behavior:"smooth",block:"center"}),tt.style.backgroundColor="#fbbf24",tt.style.transition="background-color 0.3s ease",setTimeout(()=>{tt.style.backgroundColor=""},2e3))},100)):(console.warn("Quote match failed",{quoteType:he?"QuoteData":"string",providedMessageId:oe,originalQuote:Ee.substring(0,100),extractedText:fe.substring(0,100),totalMessages:n.length,messageSample:n.slice(0,3).map(tt=>({id:tt.id,text:tt.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."}))},yt=J=>{l(oe=>{const O=new Set(oe.map(W=>W.id)),q=J.filter(W=>!O.has(W.id));return[...oe,...q]})},Xe=async J=>{if(!t)return;const oe=s.find(O=>O.id===J);if(oe)try{"source"in oe&&oe.source==="generated"&&await Hn.deleteKeyTheme(t,J),l(s.filter(O=>O.id!==J))}catch(O){console.error("Error deleting theme:",O),qe.error("Failed to delete theme",{description:"There was an error removing the theme. Please try again."})}},ft=y.useCallback(async(J,oe)=>{if(t)try{await Hn.setModeratorPosition(t,J,oe),await me(),qe.success("Moderator position updated",{description:"The moderator has been moved to the selected section."})}catch(O){console.error("Error setting moderator position:",O),qe.error("Failed to update moderator position",{description:"There was an error updating the moderator position."})}},[t]),Vt=y.useCallback(async J=>{if(console.log("💾 handleDiscussionGuideSave called:",{hasId:!!t,isEditingGuideContent:R,timestamp:new Date().toISOString()}),!!t)try{await jt.update(t,{discussionGuide:J}),R?(I.current&&(I.current={...I.current,discussionGuide:J}),console.log("⚠️ Skipping focus group state update during editing to preserve focus")):(console.log("🔄 Updating focus group state (not editing)"),u(oe=>oe?{...oe,discussionGuide:J}:null))}catch(oe){throw console.error("Error saving discussion guide:",oe),oe}},[t,R]),vn=y.useCallback(J=>{console.log("🔄 handleGuideEditingStateChange called:",{editing:J,timestamp:new Date().toISOString(),currentIsEditingGuideContent:R}),k(J),E(J),!J&&I.current&&(console.log("📝 Updating focus group state after editing ended"),u(I.current))},[R]),Wi=y.useCallback(()=>{_(J=>!J)},[]),Ls=y.useCallback((J,oe,O,q,W,he)=>{D({isOpen:!0,sectionId:J,itemId:oe,content:O,sectionTitle:q,itemTitle:W,itemType:he})},[]),Y=J=>{console.log("🔍 EXTRACT ASSET FILENAME DEBUG - Input content:",J);const oe=[/'([^']*\.[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 O=0;O0){const he=W[0][1];if(console.log(`🔍 Pattern ${O+1} extracted filename:`,he),he&&he.includes("."))return console.log("✅ EXTRACT ASSET FILENAME - Found:",he),he}}return console.warn("❌ EXTRACT ASSET FILENAME - No filename found in content"),null},Oe=()=>{if(g)return{sectionId:g.current_section_id,sectionTitle:g.current_section,itemId:g.current_item_id,itemTitle:g.current_item}},He=()=>{if(n.length!==0)return n[n.length-1].id},ht=()=>{const J=He();if(!J||n.length===0)return new Date;const oe=n.find(O=>O.id===J);return oe?oe.timestamp:new Date},Ye=async()=>{if(t){rt(!0),vt(!1),Bt(!1),qe.info("Analyzing discussion for key themes...",{description:"This may take a moment as we process the entire conversation."});try{const J=await Hn.generateKeyThemes(t);J.data&&J.data.themes?(vt(!0),qe.success(`Generated ${J.data.themes.length} key themes`,{description:"New themes have been added to the analysis."}),l(oe=>[...oe,...J.data.themes])):(vt(!0),qe.warning("No new themes were generated",{description:"Try again when the discussion has more content."}))}catch(J){console.error("Error generating key themes:",J),Bt(!0),qe.error("Failed to generate key themes",{description:"There was an error analyzing the discussion. Please try again."})}}},gt=()=>{rt(!1),vt(!1),Bt(!1)},tn=()=>{Me||pe(new Date),ce(!0)},it=J=>{V(oe=>[...oe,J].sort((O,q)=>q.createdAt.getTime()-O.createdAt.getTime())),window.notesPanelAddNote&&window.notesPanelAddNote(J)},pn=J=>{const oe=n.find(O=>O.id===J);oe?(p("chat"),setTimeout(()=>{const O=document.getElementById(`message-${oe.id}`);O&&(j||O.scrollIntoView({behavior:"smooth",block:"center"}),O.style.backgroundColor="#fbbf24",O.style.transition="background-color 0.3s ease",setTimeout(()=>{O.style.backgroundColor=""},2e3))},100)):qe.info("Message not found",{description:"Could not locate the original message for this note."})};y.useEffect(()=>{n.length>0&&!Me&&pe(new Date)},[n.length,Me]),y.useEffect(()=>{P.current=j,j||me()},[j]);const Qt=J=>{Te(oe=>oe.includes(J)?oe.filter(O=>O!==J):[...oe,J])};return S?a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(aa,{}),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(aa,{}),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(te,{variant:"ghost",onClick:()=>e("/focus-groups"),className:"mr-2",children:a.jsx(Cp,{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(ea,{className:"h-3 w-3 text-slate-500 mr-1"}),a.jsx(ur,{variant:"secondary",className:"text-xs",children:c.llm_model==="gpt-4.1"?"GPT-4.1":c.llm_model==="gpt-5"?"GPT-5":"Gemini 2.5 Pro"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-4 mt-4 sm:mt-0",children:[a.jsxs(te,{variant:"outline",onClick:()=>b(!v),className:v?"bg-blue-50 text-blue-600":"",children:[a.jsx(o1,{className:"mr-2 h-4 w-4"}),"AI Dashboard"]}),a.jsxs(te,{variant:"outline",onClick:()=>z(!0),children:[a.jsx(Xj,{className:"mr-2 h-4 w-4"}),"AI Model"]}),a.jsxs(te,{variant:"outline",onClick:_r,children:[a.jsx(zc,{className:"mr-2 h-4 w-4"}),"Download Transcript"]})]})]}),ne&&a.jsx("div",{className:"mb-6",children:a.jsx(nT,{isActive:ne,isComplete:Fe,hasError:mt,label:"Analyzing discussion for key themes",onComplete:gt,className:"max-w-4xl mx-auto"})}),a.jsx(dDe,{discussionGuide:c.discussionGuide,moderatorStatus:g,onSectionSelect:ft,onSetPosition:Ls,onSave:Vt,focusGroupId:t||"",isOpen:A,onToggle:Wi,onEditingChange:vn}),a.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 h-[calc(100vh-12rem)]",children:[a.jsx(Wce,{participants:d,selectedParticipantIds:Se,onToggleParticipantFilter:Qt}),a.jsx("div",{className:"flex-1 flex flex-col",children:a.jsxs(Kl,{defaultValue:"chat",value:h,onValueChange:p,className:"w-full h-full flex flex-col",children:[a.jsxs(Ea,{className:"grid grid-cols-4 mb-4",children:[a.jsxs(on,{value:"chat",className:"flex items-center",children:[a.jsx(us,{className:"h-4 w-4 mr-2"}),"Discussion"]}),a.jsxs(on,{value:"themes",className:"flex items-center",children:[a.jsx(Vc,{className:"h-4 w-4 mr-2"}),"Key Themes"]}),a.jsxs(on,{value:"notes",className:"flex items-center",children:[a.jsx(gy,{className:"h-4 w-4 mr-2"}),"Notes"]}),a.jsxs(on,{value:"analytics",className:"flex items-center",children:[a.jsx(o1,{className:"h-4 w-4 mr-2"}),"Analytics"]})]}),a.jsx(sn,{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(te,{onClick:Ze,size:"lg",className:"flex items-center gap-2",children:[a.jsx(c4,{className:"h-5 w-5"}),"Start Session"]})]}):a.jsx(Sue,{messages:n,modeEvents:i,personas:d,isSpeaking:!1,focusGroupId:t||"",isAiModeActive:x,selectedParticipantIds:Se,onToggleHighlight:$t,onAdvanceDiscussion:()=>null,onNewMessage:Qe,onStatusChange:We,isEditingDiscussionGuide:j})}),a.jsx(sn,{value:"themes",className:"m-0",children:a.jsx(Aue,{themes:s,messages:n,personas:d,focusGroupId:t||"",onThemesGenerated:yt,onThemeDelete:Xe,onQuoteClick:Sn,onGenerateKeyThemes:Ye})}),a.jsx(sn,{value:"notes",className:"m-0",style:{height:"calc(100% - 3.5rem)"},children:a.jsx("div",{className:"h-full",children:a.jsx(fDe,{focusGroupId:t||"",focusGroupName:c==null?void 0:c.name,onNoteClick:pn})})}),a.jsx(sn,{value:"analytics",className:"m-0",children:a.jsx(cDe,{messages:n,themes:s,personas:d})})]})})]})]}),n.length>0&&a.jsx("div",{className:"fixed bottom-6 right-6 z-40",children:a.jsx(te,{onClick:tn,className:"rounded-full h-12 w-12 p-0 shadow-lg",title:"Take a quick note",children:a.jsx(gy,{className:"h-5 w-5"})})}),a.jsx(hDe,{isOpen:ie,onClose:()=>ce(!1),focusGroupId:t||"",associatedMessageId:He(),sectionInfo:Oe(),messageTimestamp:ht(),onNoteSaved:it}),a.jsx(kc,{open:N.isOpen,onOpenChange:J=>D(oe=>({...oe,isOpen:J})),children:a.jsxs(xl,{children:[a.jsxs(bl,{children:[a.jsx(Sl,{children:"Set Moderator Position"}),a.jsxs(Oc,{children:['Are you sure you want to set the moderator position to "',N.itemTitle,'" in section "',N.sectionTitle,'"? This will make the moderator ask this question in the chat.']})]}),a.jsxs(wl,{children:[a.jsx(te,{variant:"outline",disabled:N.isLoading,onClick:()=>D({isOpen:!1}),children:"Cancel"}),a.jsxs(te,{disabled:N.isLoading,onClick:async()=>{var J,oe,O,q,W,he,fe,Ee,be;if(!(!t||!N.sectionId||!N.itemId||!N.content)){D(bt=>({...bt,isLoading:!0}));try{await Hn.setModeratorPosition(t,N.sectionId,N.itemId);let bt=[],tt=!1,Gt=N.content;const Zt=N.content?Y(N.content):null,Dr=!!Zt;if(console.log("🔍 MANUAL POSITION DEBUG:",{itemType:N.itemType,hasImageAttached:Dr,assetFilename:Zt,content:N.content,sectionTitle:N.sectionTitle,itemTitle:N.itemTitle,contentLength:(J=N.content)==null?void 0:J.length}),Dr&&N.content&&Zt)if(console.log("🔍 ASSET EXTRACTION DEBUG:",{originalContent:N.content,extractedFilename:Zt,contentLength:N.content.length}),Zt){bt=[Zt],tt=!0,console.log("🎨 MANUAL POSITION: Creative review detected, will activate visual context for:",Zt);try{console.log("🎨 MANUAL MODE: Requesting AI description for",Zt);try{console.log("🔍 TESTING: Calling test endpoint first...");const Gf=await Le.post(`/focus-groups/${t}/test-endpoint`,{test:"data"});console.log("✅ TEST: Test endpoint response:",Gf.data)}catch(Gf){console.error("❌ TEST: Test endpoint failed:",Gf)}const un=await jt.describeAsset(t,Zt);un.data.description&&(Gt=N.content.replace(`'${Zt}'`,`'${Zt}' - ${un.data.description}`),console.log("✅ MANUAL MODE: Enhanced question with AI description"),console.log("🔍 Original:",N.content),console.log("🔍 Enhanced:",Gt))}catch(un){console.error("⚠️ MANUAL MODE: Failed to generate AI description:",un),console.error("⚠️ Error response data:",(oe=un.response)==null?void 0:oe.data),console.error("⚠️ Error status:",(O=un.response)==null?void 0:O.status),console.error("⚠️ Error headers:",(q=un.response)==null?void 0:q.headers),console.error("⚠️ Full axios error:",{message:un.message,code:un.code,status:(W=un.response)==null?void 0:W.status,statusText:(he=un.response)==null?void 0:he.statusText,url:(fe=un.config)==null?void 0:fe.url,method:(Ee=un.config)==null?void 0:Ee.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 Fn={id:`msg-${Date.now()}`,senderId:"moderator",text:Gt,timestamp:new Date,type:"question"};try{const un=await jt.sendMessage(t,{senderId:"moderator",text:Gt,type:"question",attached_assets:bt,activates_visual_context:tt});(be=un==null?void 0:un.data)!=null&&be.message_id&&(Fn.id=un.data.message_id)}catch(un){console.warn("Failed to save message to API, showing locally:",un)}Qe(Fn),D({isOpen:!1}),setTimeout(async()=>{await me(),setTimeout(()=>me(),500)},200),qe.success("Moderator position set",{description:`Position set to "${N.itemTitle}" in "${N.sectionTitle}"`})}catch(bt){console.error("Error setting moderator position:",bt),D(tt=>({...tt,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:[N.isLoading&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),N.isLoading?"Generating detailed image description...":"Confirm"]})]})]})}),a.jsx(kc,{open:$,onOpenChange:z,children:a.jsxs(xl,{children:[a.jsxs(bl,{children:[a.jsx(Sl,{children:"AI Model Settings"}),a.jsx(Oc,{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(ea,{className:"h-4 w-4 text-slate-500"}),a.jsx("span",{className:"text-sm font-medium",children:"Current Model:"}),a.jsx(ur,{variant:"secondary",children:(c==null?void 0:c.llm_model)==="gpt-4.1"?"GPT-4.1":(c==null?void 0:c.llm_model)==="gpt-5"?"GPT-5":"Gemini 2.5 Pro"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Select AI Model:"}),a.jsxs(kn,{value:M,onValueChange:J=>{console.log("🔧 Model selection changed:",{from:M,to:J}),U(J)},children:[a.jsx(Nn,{className:"mt-1",children:a.jsx(On,{placeholder:"Select AI model"})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(le,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(le,{value:"gpt-5",children:"GPT-5"})]})]})]}),M==="gpt-5"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Reasoning Effort:"}),a.jsxs(kn,{value:K,onValueChange:X,children:[a.jsx(Nn,{className:"mt-1",children:a.jsx(On,{placeholder:"Select reasoning effort"})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"minimal",children:"Minimal - Fast responses"}),a.jsx(le,{value:"low",children:"Low - Quick thinking"}),a.jsx(le,{value:"medium",children:"Medium - Balanced (default)"}),a.jsx(le,{value:"high",children:"High - Deep reasoning"})]})]}),a.jsx("p",{className:"text-xs text-slate-600 mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx("p",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how thoroughly GPT-5 thinks and how detailed responses are"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Response Verbosity:"}),a.jsxs(kn,{value:re,onValueChange:xe,children:[a.jsx(Nn,{className:"mt-1",children:a.jsx(On,{placeholder:"Select verbosity level"})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"low",children:"Low - Concise responses"}),a.jsx(le,{value:"medium",children:"Medium - Balanced length (default)"}),a.jsx(le,{value:"high",children:"High - Detailed responses"})]})]}),a.jsx("p",{className:"text-xs text-slate-600 mt-1",children:"Controls how detailed and lengthy GPT-5's responses will be"}),a.jsx("p",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how thoroughly GPT-5 thinks and how detailed responses are"})]})]}),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("p",{children:[a.jsx("strong",{children:"GPT-5:"})," OpenAI's newest model with advanced reasoning and customizable response styles."]})]})]}),a.jsxs(wl,{children:[a.jsx(te,{variant:"outline",onClick:()=>z(!1),disabled:F,children:"Cancel"}),a.jsxs(te,{onClick:()=>{console.log("🔧 Update button clicked:",{selectedModel:M,selectedReasoningEffort:K,selectedVerbosity:re,currentModel:c==null?void 0:c.llm_model,isDisabled:F||M===(c==null?void 0:c.llm_model)&&(M!=="gpt-5"||K===(c==null?void 0:c.reasoning_effort)&&re===(c==null?void 0:c.verbosity))}),St(M,K,re)},disabled:F||M===(c==null?void 0:c.llm_model)&&(M!=="gpt-5"||K===((c==null?void 0:c.reasoning_effort)||"medium")&&re===((c==null?void 0:c.verbosity)||"medium")),children:[F&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),F?"Updating...":"Update Model"]})]})]})}),a.jsx(uDe,{focusGroupId:t,personas:d,isVisible:v,onToggle:()=>b(!v)})]}):a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(aa,{}),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(te,{onClick:()=>e("/focus-groups"),className:"mt-4",children:[a.jsx(Cp,{className:"mr-2 h-4 w-4"})," Back to Focus Groups"]})]})]})},mDe=({title:t,description:e})=>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:t}),a.jsx("p",{className:"text-slate-600 mt-1",children:e})]}),a.jsxs("div",{className:"mt-4 sm:mt-0 flex gap-2",children:[a.jsx(te,{variant:"outline",children:"Export Data"}),a.jsx(te,{children:"Generate Report"})]})]}),ZS=({title:t,value:e,changePercentage:n,icon:r})=>a.jsx(ut,{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:t}),a.jsx("h3",{className:"text-2xl font-bold mt-1",children:e}),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"})})]})}),gDe=[{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}],vDe=[{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"}],yDe=()=>a.jsxs("div",{className:"space-y-6",children:[a.jsxs(ut,{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(Al,{width:"100%",height:"100%",children:a.jsxs(bK,{data:gDe,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(Im,{strokeDasharray:"3 3"}),a.jsx(Ll,{dataKey:"name"}),a.jsx(Fl,{}),a.jsx(zr,{}),a.jsx(Ho,{type:"monotone",dataKey:"users",stackId:"1",stroke:"#8884d8",fill:"#8884d8",name:"Synthetic Users"}),a.jsx(Ho,{type:"monotone",dataKey:"groups",stackId:"2",stroke:"#82ca9d",fill:"#82ca9d",name:"Focus Groups"}),a.jsx(Ho,{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(ut,{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:[vDe.slice(0,3).map(t=>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 ${t.sentiment==="positive"?"bg-green-100":t.sentiment==="negative"?"bg-red-100":"bg-slate-100"}`,children:a.jsx(Bc,{className:`h-4 w-4 ${t.sentiment==="positive"?"text-green-600":t.sentiment==="negative"?"text-red-600":"text-slate-600"}`})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:t.title}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t.description}),a.jsxs("div",{className:"flex items-center text-xs text-muted-foreground mt-2",children:[a.jsx("span",{children:t.source}),a.jsx("span",{className:"mx-2",children:"•"}),a.jsx("span",{children:t.date})]})]})]})},t.id)),a.jsx(te,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"View All Insights"})]})]}),a.jsxs(ut,{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(Fg,{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(Fg,{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(Fg,{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(Fg,{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(te,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"Manage Research Calendar"})]})]})]})]}),xDe=[{name:"18-24",value:15},{name:"25-34",value:35},{name:"35-44",value:25},{name:"45-54",value:15},{name:"55+",value:10}],bDe=()=>a.jsxs(ut,{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(te,{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(Al,{width:"100%",height:"100%",children:a.jsxs(pP,{children:[a.jsx(zr,{}),a.jsx(ts,{data:xDe,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(te,{onClick:()=>window.location.href="/synthetic-users",children:"Manage Synthetic Personas"})})]}),wDe=[{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}],LD=[{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"}],SDe=[{name:"Navigation",count:42},{name:"Performance",count:28},{name:"UX Design",count:36},{name:"Features",count:22},{name:"Onboarding",count:18}],CDe=()=>{const t=Xn();return a.jsxs(ut,{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(te,{variant:"outline",size:"sm",onClick:()=>t("/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(Al,{width:"100%",height:"100%",children:a.jsxs(bK,{data:wDe,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(Im,{strokeDasharray:"3 3"}),a.jsx(Ll,{dataKey:"name"}),a.jsx(Fl,{}),a.jsx(zr,{}),a.jsx(Ho,{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(Al,{width:"100%",height:"100%",children:a.jsxs(pP,{children:[a.jsx(zr,{}),a.jsx(ts,{data:LD,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:e,percent:n})=>`${e} ${(n*100).toFixed(0)}%`,children:LD.map((e,n)=>a.jsx(cg,{fill:e.color},`cell-${n}`))}),a.jsx(ca,{})]})})})]})]}),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(Al,{width:"100%",height:"100%",children:a.jsxs(xK,{data:SDe,margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(Im,{strokeDasharray:"3 3"}),a.jsx(Ll,{dataKey:"name"}),a.jsx(Fl,{}),a.jsx(zr,{}),a.jsx(ca,{}),a.jsx(Xl,{dataKey:"count",name:"Mentions",fill:"#8884d8"})]})})})]}),a.jsx("div",{className:"flex justify-center",children:a.jsx(te,{onClick:()=>t("/focus-groups"),children:"Manage Focus Groups"})})]})},ADe=()=>{const[t,e]=y.useState("overview");return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(aa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsx(mDe,{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(ZS,{title:"Total Synthetic Users",value:48,changePercentage:12,icon:Cr}),a.jsx(ZS,{title:"Active Focus Groups",value:7,changePercentage:5,icon:Ps}),a.jsx(ZS,{title:"Research Insights",value:124,changePercentage:18,icon:Vc})]}),a.jsxs(Kl,{value:t,onValueChange:e,className:"glass-panel rounded-xl p-6",children:[a.jsxs(Ea,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(on,{value:"overview",children:"Overview"}),a.jsx(on,{value:"users",children:"Synthetic Users"}),a.jsx(on,{value:"focus-groups",children:"Focus Groups"})]}),a.jsx(sn,{value:"overview",children:a.jsx(yDe,{})}),a.jsx(sn,{value:"users",children:a.jsx(bDe,{})}),a.jsx(sn,{value:"focus-groups",children:a.jsx(CDe,{})})]})]})]})},wK=y.forwardRef(({...t},e)=>a.jsx("nav",{ref:e,"aria-label":"breadcrumb",...t}));wK.displayName="Breadcrumb";const SK=y.forwardRef(({className:t,...e},n)=>a.jsx("ol",{ref:n,className:ke("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",t),...e}));SK.displayName="BreadcrumbList";const $v=y.forwardRef(({className:t,...e},n)=>a.jsx("li",{ref:n,className:ke("inline-flex items-center gap-1.5",t),...e}));$v.displayName="BreadcrumbItem";const N_=y.forwardRef(({asChild:t,className:e,...n},r)=>{const i=t?Es:"a";return a.jsx(i,{ref:r,className:ke("transition-colors hover:text-foreground",e),...n})});N_.displayName="BreadcrumbLink";const CK=y.forwardRef(({className:t,...e},n)=>a.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:ke("font-normal text-foreground",t),...e}));CK.displayName="BreadcrumbPage";const T_=({children:t,className:e,...n})=>a.jsx("li",{role:"presentation","aria-hidden":"true",className:ke("[&>svg]:size-3.5",e),...n,children:t??a.jsx(Zi,{})});T_.displayName="BreadcrumbSeparator";function _De({persona:t}){const e=t.id==="0",n=t.id==="1";return a.jsxs(ut,{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:eg(t),alt:t.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:t.name}),a.jsx("p",{className:"text-muted-foreground",children:t.occupation})]})]}),a.jsxs("div",{className:"mt-6 space-y-4",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Cr,{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:[t.age," ",t.gender?a.jsxs(a.Fragment,{children:["• ",t.gender]}):null,t.ethnicity?a.jsxs(a.Fragment,{children:[" • ",t.ethnicity]}):null]}),t.education&&a.jsx("p",{className:"sidebar-sub-item",children:t.education}),t.socialGrade&&a.jsxs("p",{className:"sidebar-sub-item",children:["Social Grade: ",t.socialGrade]}),t.householdIncome&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household Income: ",t.householdIncome]}),t.householdComposition&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household: ",t.householdComposition]})]})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(FX,{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:t.location}),t.livingSituation&&a.jsx("p",{className:"sidebar-sub-item",children:t.livingSituation})]})]}),t.interests&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(l1,{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:t.interests})]})]}),t.mediaConsumption&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(tS,{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:t.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:[t.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:`${t.techSavviness}%`}})})]}),t.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:[t.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:`${t.brandLoyalty}%`}})})]}),t.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:[t.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:`${t.priceConsciousness}%`}})})]}),t.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:[t.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:`${t.environmentalConcern}%`}})})]}),t.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:t.deviceUsage})]}),t.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:t.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:[t.brandPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(l1,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.brandPreferences})]}),t.communicationPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(_p,{className:"sidebar-icon"}),a.jsxs("span",{className:"text-muted-foreground text-sm",children:["Prefers: ",t.communicationPreferences]})]}),t.deviceUsage&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(BX,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.deviceUsage})]}),t.shoppingHabits&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(GX,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.shoppingHabits})]}),t.additionalInformation&&typeof t.additionalInformation=="string"&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(MX,{className:"sidebar-icon"}),a.jsx("div",{className:"sidebar-sub-item",children:t.additionalInformation.split(` -`).map((r,i)=>a.jsx("div",{className:"mb-1",children:r.trim().startsWith("•")||r.trim().startsWith("-")?r.trim().substring(1).trim():r.trim()},i))})]}),e&&a.jsxs("div",{className:"pt-2 space-y-2",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(rO,{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(my,{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(tS,{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(iO,{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(tS,{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(my,{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(iO,{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(rO,{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(_p,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Seeks autonomy, bespoke service, and acknowledgment for taste"})]})]})]})]})]})]})}function jDe({persona:t}){var e,n,r,i,o,s,l,c,u;return a.jsxs("div",{className:"space-y-6",children:[a.jsx(ut,{children:a.jsxs(Et,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(_v,{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:(e=t.goals)==null?void 0:e.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(ut,{children:a.jsxs(Et,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(h4,{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=t.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(ut,{children:a.jsxs(Et,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(Qs,{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=t.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(ut,{children:a.jsxs(Et,{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(Bc,{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:(o=(i=t.thinkFeelDo)==null?void 0:i.thinks)==null?void 0:o.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(l1,{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=(s=t.thinkFeelDo)==null?void 0:s.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(Qs,{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=t.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 EDe({persona:t}){var n,r,i,o,s;const e=[{trait:"Openness",value:((n=t.oceanTraits)==null?void 0:n.openness)||50},{trait:"Conscientiousness",value:((r=t.oceanTraits)==null?void 0:r.conscientiousness)||50},{trait:"Extraversion",value:((i=t.oceanTraits)==null?void 0:i.extraversion)||50},{trait:"Agreeableness",value:((o=t.oceanTraits)==null?void 0:o.agreeableness)||50},{trait:"Neuroticism",value:((s=t.oceanTraits)==null?void 0:s.neuroticism)||50}];return a.jsx(ut,{children:a.jsxs(Et,{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(Al,{width:"100%",height:"100%",children:a.jsxs(lDe,{outerRadius:90,data:e,children:[a.jsx(mG,{}),a.jsx(zf,{dataKey:"trait"}),a.jsx(Hf,{domain:[0,100]}),a.jsx(mg,{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:[e[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:`${e[0].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[0].value>75?"Highly creative and curious":e[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:[e[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:`${e[1].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[1].value>75?"Highly organized and responsible":e[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:[e[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:`${e[2].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[2].value>75?"Highly sociable and outgoing":e[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:[e[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:`${e[3].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[3].value>75?"Highly cooperative and compassionate":e[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:[e[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:`${e[4].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[4].value>75?"Highly sensitive and prone to stress":e[4].value>50?"Moderately reactive to challenges":"Emotionally stable and resilient"})]})]})]})]})})}function NDe({persona:t}){var r;const e=(i,o)=>{const s=[a.jsx($X,{className:"sidebar-icon"},"grid"),a.jsx(KX,{className:"sidebar-icon"},"smartphone"),a.jsx(DX,{className:"sidebar-icon"},"laptop"),a.jsx(RX,{className:"sidebar-icon"},"grid2x2")];return s[o%s.length]},n=()=>t.scenarioType?t.scenarioType:"Life Scenarios";return a.jsx(ut,{children:a.jsxs(Et,{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=t.scenarios)==null?void 0:r.map((i,o)=>a.jsx("div",{className:"bg-slate-50 p-4 rounded-lg border",children:a.jsxs("div",{className:"sidebar-section",children:[e(i,o),a.jsxs("div",{children:[a.jsxs("h4",{className:"font-medium text-sm mb-2",children:["Scenario ",o+1]}),a.jsx("p",{className:"text-sm",children:i})]})]})},o))})]})})}function TDe(){const t=Xn();return a.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:a.jsxs(ut,{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(te,{onClick:()=>t("/synthetic-users"),children:"Return to Personas"})]})})}function Rt({className:t,...e}){return a.jsx("div",{className:ke("animate-pulse rounded-md bg-muted",t),...e})}function PDe(){return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(aa,{}),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(Rt,{className:"absolute left-0 top-0 h-10 w-20"}),a.jsx(Rt,{className:"h-8 w-48 mx-auto"}),a.jsx(Rt,{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(ut,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx(Rt,{className:"h-16 w-16 rounded-full"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Rt,{className:"h-6 w-32 mb-2"}),a.jsx(Rt,{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(Rt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Rt,{className:"h-4 w-20 mb-2"}),a.jsx(Rt,{className:"h-3 w-40 mb-1"}),a.jsx(Rt,{className:"h-3 w-36"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Rt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Rt,{className:"h-4 w-16 mb-2"}),a.jsx(Rt,{className:"h-3 w-32"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Rt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Rt,{className:"h-4 w-16 mb-2"}),a.jsx(Rt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Rt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Rt,{className:"h-4 w-12 mb-2"}),a.jsx(Rt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(Rt,{className:"h-4 w-32 mb-3"}),a.jsx("div",{className:"space-y-3",children:[...Array(4)].map((t,e)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx(Rt,{className:"h-3 w-24"}),a.jsx(Rt,{className:"h-3 w-8"})]}),a.jsx(Rt,{className:"h-1.5 w-full rounded-full"})]},e))})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(Rt,{className:"h-4 w-36 mb-3"}),a.jsx("div",{className:"space-y-2",children:[...Array(3)].map((t,e)=>a.jsxs("div",{className:"flex items-center",children:[a.jsx(Rt,{className:"h-4 w-4 mr-2"}),a.jsx(Rt,{className:"h-3 w-40"})]},e))})]})]})]})}),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(Rt,{className:"h-10 w-full"}),a.jsx(Rt,{className:"h-10 w-full"}),a.jsx(Rt,{className:"h-10 w-full"})]}),a.jsx(ut,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(Rt,{className:"h-6 w-48"}),a.jsx(Rt,{className:"h-4 w-full"}),a.jsx(Rt,{className:"h-4 w-full"}),a.jsx(Rt,{className:"h-4 w-3/4"}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(Rt,{className:"h-6 w-32"}),a.jsx(Rt,{className:"h-4 w-full"}),a.jsx(Rt,{className:"h-4 w-full"}),a.jsx(Rt,{className:"h-4 w-2/3"})]}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(Rt,{className:"h-6 w-40"}),a.jsx(Rt,{className:"h-4 w-full"}),a.jsx(Rt,{className:"h-4 w-full"}),a.jsx(Rt,{className:"h-4 w-5/6"})]})]})})]})]})]})]})}function kDe({message:t,onLoginSuccess:e,onCancel:n}){const{login:r}=cu(),i=Xn(),[o,s]=y.useState("user"),[l,c]=y.useState("pass"),[u,d]=y.useState(!1),f=async()=>{if(!o||!l){se.error("Please enter username and password");return}d(!0);try{await r(o,l),se.success("Login successful"),e&&e()}catch(p){console.error("Login error:",p),se.error("Login failed",{description:"Please check your credentials and try again"})}finally{d(!1)}},h=()=>{n?n():i("/synthetic-users")};return a.jsxs(ut,{className:"max-w-md mx-auto shadow-lg",children:[a.jsxs(pi,{children:[a.jsx(Mi,{children:"Login Required"}),a.jsx(CN,{children:t||"You need to log in to save personas to the database"})]}),a.jsxs(Et,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(to,{htmlFor:"username",children:"Username"}),a.jsx(Dt,{id:"username",placeholder:"Username",value:o,onChange:p=>s(p.target.value),disabled:u})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(to,{htmlFor:"password",children:"Password"}),a.jsx(Dt,{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(AN,{className:"flex justify-between",children:[a.jsx(te,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(te,{onClick:f,disabled:u,children:u?a.jsxs(a.Fragment,{children:[a.jsx(ws,{className:"h-4 w-4 mr-2 animate-spin"}),"Logging in..."]}):"Login"})]})]})}function ODe({persona:t,onSave:e,onCancel:n}){var j,k,P,R,E,I,L,V,$,z,M,U,K,X,re,xe;const r={...t,education:t.education||"",interests:t.interests||"",brandLoyalty:t.brandLoyalty||0,priceConsciousness:t.priceConsciousness||0,environmentalConcern:t.environmentalConcern||0,hasPurchasingPower:t.hasPurchasingPower||!1,hasChildren:t.hasChildren||!1,goals:t.goals||[],frustrations:t.frustrations||[],motivations:t.motivations||[],scenarios:t.scenarios||[],oceanTraits:t.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:t.thinkFeelDo||{thinks:[],feels:[],does:[]}},[i,o]=y.useState(r),[s,l]=y.useState(!1),[c,u]=y.useState(!1),[d,f]=y.useState(null);y.useState(!1);const{isAuthenticated:h,token:p}=cu();y.useEffect(()=>{(async()=>{c&&h&&p&&(u(!1),d&&await _())})()},[h,p,c]);const g=(F,ue)=>{o(ie=>({...ie,[F]:ue}))},m=(F,ue)=>{o(ie=>({...ie,oceanTraits:{...ie.oceanTraits,[F]:ue}}))},v=F=>{o(ue=>({...ue,[F]:[...ue[F]||[],""]}))},b=(F,ue,ie)=>{o(ce=>{const Me=[...ce[F]||[]];return Me[ue]=ie,{...ce,[F]:Me}})},x=(F,ue)=>{o(ie=>{const ce=[...ie[F]||[]];return ce.splice(ue,1),{...ie,[F]:ce}})},w=(F,ue,ie)=>{o(ce=>{const Me={...ce.thinkFeelDo},pe=[...Me[F]||[]];return pe[ue]=ie,Me[F]=pe,{...ce,thinkFeelDo:Me}})},S=F=>{o(ue=>{var ce;const ie={...ue.thinkFeelDo,[F]:[...((ce=ue.thinkFeelDo)==null?void 0:ce[F])||[],""]};return{...ue,thinkFeelDo:ie}})},C=(F,ue)=>{o(ie=>{const ce={...ie.thinkFeelDo},Me=[...ce[F]||[]];return Me.splice(ue,1),ce[F]=Me,{...ie,thinkFeelDo:ce}})},A=()=>{d&&(se.error("Login canceled - Persona changes not saved"),u(!1),f(null),n())},_=async()=>{if(d){l(!0);try{const F={...d};delete F._id,delete F.isDbPersona;const ue=await kr.create(F),ie={...d,id:ue.data._id||ue.data.id,_id:ue.data._id||ue.data.id,isDbPersona:!0};se.success("Persona saved to database successfully"),u(!1),f(null),e(ie)}catch(F){console.error("Error saving after login:",F),se.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(kDe,{message:"Login is required to save your persona to the database",onLoginSuccess:_,onCancel:A})]}):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(te,{variant:"ghost",onClick:n,className:"mr-2",children:a.jsx(Cp,{className:"h-5 w-5"})}),a.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Edit Persona"})]}),a.jsxs(te,{onClick:async()=>{l(!0);try{const F=i._id||i.id,ue={...i};ue._id&&delete ue._id,delete ue.isDbPersona;let ie;if(F&&typeof F=="string"&&F.startsWith("local-")){console.log("Creating new persona instead of updating local ID"),ie=await kr.create(ue),se.success("Persona saved to database");const ce={...i,id:ie.data._id||ie.data.id,_id:ie.data._id||ie.data.id,isDbPersona:!0};e(ce)}else if(F){ie=await kr.update(F,ue),se.success("Persona updated successfully");const ce={...i,isDbPersona:!0};e(ce)}else{ie=await kr.create(ue);const ce={...i,id:ie.data._id||ie.data.id,_id:ie.data._id||ie.data.id,isDbPersona:!0};se.success("Persona created successfully"),e(ce)}}catch(F){console.error("Error saving persona:",F),F.response&&F.response.status===401?h&&p?(console.log("Auth error despite having token - token likely invalid"),se.error("Authentication error - saving locally instead"),e(i)):(f(i),u(!0)):(se.error("Failed to save persona"),e(i))}finally{l(!1)}},disabled:s,children:[s?a.jsx(ws,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(Yj,{className:"h-4 w-4 mr-2"}),s?"Saving...":"Save Changes"]})]}),a.jsxs(Kl,{defaultValue:"basic",children:[a.jsxs(Ea,{className:"grid w-full grid-cols-6",children:[a.jsx(on,{value:"basic",children:"Basic"}),a.jsx(on,{value:"cooper",children:"Cooper"}),a.jsx(on,{value:"personality",children:"Personality"}),a.jsx(on,{value:"demographics",children:"Demographics"}),a.jsx(on,{value:"lifestyle",children:"Lifestyle"}),a.jsx(on,{value:"extended",children:"Extended"})]}),a.jsx(sn,{value:"basic",className:"mt-6",children:a.jsx(ut,{children:a.jsx(Et,{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(Dt,{value:i.name||"",onChange:F=>g("name",F.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(kn,{value:i.age||"",onValueChange:F=>g("age",F),children:[a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select age range"})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"18-24",children:"18-24"}),a.jsx(le,{value:"25-34",children:"25-34"}),a.jsx(le,{value:"35-44",children:"35-44"}),a.jsx(le,{value:"45-54",children:"45-54"}),a.jsx(le,{value:"55-64",children:"55-64"}),a.jsx(le,{value:"65+",children:"65+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Gender"}),a.jsxs(kn,{value:i.gender||"",onValueChange:F=>g("gender",F),children:[a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select gender"})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"Male",children:"Male"}),a.jsx(le,{value:"Female",children:"Female"}),a.jsx(le,{value:"Non-binary",children:"Non-binary"}),a.jsx(le,{value:"Other",children:"Other"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Occupation"}),a.jsx(Dt,{value:i.occupation||"",onChange:F=>g("occupation",F.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Education"}),a.jsxs(kn,{value:i.education||"",onValueChange:F=>g("education",F),children:[a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select education level"})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"High School",children:"High School"}),a.jsx(le,{value:"Some College",children:"Some College"}),a.jsx(le,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(le,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(le,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(le,{value:"PhD",children:"PhD"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Location"}),a.jsx(Dt,{value:i.location||"",onChange:F=>g("location",F.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Ethnicity (Optional)"}),a.jsxs(kn,{value:i.ethnicity||"",onValueChange:F=>g("ethnicity",F),children:[a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select ethnicity"})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"white",children:"White"}),a.jsx(le,{value:"black",children:"Black"}),a.jsx(le,{value:"asian",children:"Asian"}),a.jsx(le,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(le,{value:"native-american",children:"Native American"}),a.jsx(le,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(le,{value:"mixed",children:"Mixed"}),a.jsx(le,{value:"other",children:"Other"}),a.jsx(le,{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(ct,{value:i.personality||"",onChange:F=>g("personality",F.target.value),rows:3})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Interests"}),a.jsx(ct,{value:i.interests||"",onChange:F=>g("interests",F.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(lr,{value:[i.techSavviness],onValueChange:F=>g("techSavviness",F[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(lr,{value:[i.brandLoyalty||0],onValueChange:F=>g("brandLoyalty",F[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(lr,{value:[i.priceConsciousness||0],onValueChange:F=>g("priceConsciousness",F[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(lr,{value:[i.environmentalConcern||0],onValueChange:F=>g("environmentalConcern",F[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(Yp,{checked:i.hasPurchasingPower||!1,onCheckedChange:F=>g("hasPurchasingPower",F)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-sm font-medium",children:"Has Children"}),a.jsx(Yp,{checked:i.hasChildren||!1,onCheckedChange:F=>g("hasChildren",F)})]})]})]})]})})})}),a.jsxs(sn,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(ut,{children:a.jsxs(Et,{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((F,ue)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:F||"",onChange:ie=>b("goals",ue,ie.target.value)}),a.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x("goals",ue),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},ue)),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>v("goals"),className:"mt-2",children:[a.jsx(Tr,{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((F,ue)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:F||"",onChange:ie=>b("frustrations",ue,ie.target.value)}),a.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x("frustrations",ue),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},ue)),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>v("frustrations"),className:"mt-2",children:[a.jsx(Tr,{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((F,ue)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:F||"",onChange:ie=>b("motivations",ue,ie.target.value)}),a.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x("motivations",ue),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},ue)),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>v("motivations"),className:"mt-2",children:[a.jsx(Tr,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(ut,{children:a.jsxs(Et,{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"}),(((j=i.thinkFeelDo)==null?void 0:j.thinks)||[]).map((F,ue)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:F||"",onChange:ie=>w("thinks",ue,ie.target.value)}),a.jsx(te,{variant:"ghost",size:"icon",onClick:()=>C("thinks",ue),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},ue)),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>S("thinks"),className:"mt-2",children:[a.jsx(Tr,{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"}),(((k=i.thinkFeelDo)==null?void 0:k.feels)||[]).map((F,ue)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:F||"",onChange:ie=>w("feels",ue,ie.target.value)}),a.jsx(te,{variant:"ghost",size:"icon",onClick:()=>C("feels",ue),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},ue)),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>S("feels"),className:"mt-2",children:[a.jsx(Tr,{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=i.thinkFeelDo)==null?void 0:P.does)||[]).map((F,ue)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:F||"",onChange:ie=>w("does",ue,ie.target.value)}),a.jsx(te,{variant:"ghost",size:"icon",onClick:()=>C("does",ue),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},ue)),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>S("does"),className:"mt-2",children:[a.jsx(Tr,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(ut,{children:a.jsxs(Et,{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(Dt,{value:i.scenarioType||"",onChange:F=>g("scenarioType",F.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((F,ue)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(ct,{value:F||"",onChange:ie=>b("scenarios",ue,ie.target.value),rows:2}),a.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x("scenarios",ue),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},ue)),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>v("scenarios"),className:"mt-2",children:[a.jsx(Tr,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})})]}),a.jsx(sn,{value:"personality",className:"mt-6",children:a.jsx(ut,{children:a.jsxs(Et,{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:[((R=i.oceanTraits)==null?void 0:R.openness)||50,"%"]})]}),a.jsx(lr,{value:[((E=i.oceanTraits)==null?void 0:E.openness)||50],onValueChange:F=>m("openness",F[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:[((I=i.oceanTraits)==null?void 0:I.conscientiousness)||50,"%"]})]}),a.jsx(lr,{value:[((L=i.oceanTraits)==null?void 0:L.conscientiousness)||50],onValueChange:F=>m("conscientiousness",F[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:[((V=i.oceanTraits)==null?void 0:V.extraversion)||50,"%"]})]}),a.jsx(lr,{value:[(($=i.oceanTraits)==null?void 0:$.extraversion)||50],onValueChange:F=>m("extraversion",F[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:[((z=i.oceanTraits)==null?void 0:z.agreeableness)||50,"%"]})]}),a.jsx(lr,{value:[((M=i.oceanTraits)==null?void 0:M.agreeableness)||50],onValueChange:F=>m("agreeableness",F[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:[((U=i.oceanTraits)==null?void 0:U.neuroticism)||50,"%"]})]}),a.jsx(lr,{value:[((K=i.oceanTraits)==null?void 0:K.neuroticism)||50],onValueChange:F=>m("neuroticism",F[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(sn,{value:"demographics",className:"mt-6",children:a.jsx(ut,{children:a.jsxs(Et,{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(kn,{value:i.socialGrade||"",onValueChange:F=>g("socialGrade",F),children:[a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select social grade"})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"A",children:"A - Higher managerial"}),a.jsx(le,{value:"B",children:"B - Intermediate managerial"}),a.jsx(le,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(le,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(le,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(le,{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(kn,{value:i.householdIncome||"",onValueChange:F=>g("householdIncome",F),children:[a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select income range"})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"Under $25k",children:"Under $25,000"}),a.jsx(le,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(le,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(le,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(le,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(le,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(le,{value:"Over $250k",children:"Over $250,000"}),a.jsx(le,{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(kn,{value:i.householdComposition||"",onValueChange:F=>g("householdComposition",F),children:[a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select household type"})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"Single person",children:"Single person"}),a.jsx(le,{value:"Couple without children",children:"Couple without children"}),a.jsx(le,{value:"Couple with children",children:"Couple with children"}),a.jsx(le,{value:"Single parent",children:"Single parent"}),a.jsx(le,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(le,{value:"Shared housing",children:"Shared housing"}),a.jsx(le,{value:"Other",children:"Other"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Living Situation"}),a.jsxs(kn,{value:i.livingSituation||"",onValueChange:F=>g("livingSituation",F),children:[a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select living situation"})}),a.jsxs(Tn,{children:[a.jsx(le,{value:"Own home",children:"Own home"}),a.jsx(le,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(le,{value:"Rent house",children:"Rent house"}),a.jsx(le,{value:"Live with family",children:"Live with family"}),a.jsx(le,{value:"Student housing",children:"Student housing"}),a.jsx(le,{value:"Assisted living",children:"Assisted living"}),a.jsx(le,{value:"Other",children:"Other"})]})]})]})]})]})]})})}),a.jsx(sn,{value:"lifestyle",className:"mt-6",children:a.jsx(ut,{children:a.jsxs(Et,{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(ct,{value:i.mediaConsumption||"",onChange:F=>g("mediaConsumption",F.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(ct,{value:i.deviceUsage||"",onChange:F=>g("deviceUsage",F.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(ct,{value:i.shoppingHabits||"",onChange:F=>g("shoppingHabits",F.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(ct,{value:i.brandPreferences||"",onChange:F=>g("brandPreferences",F.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(ct,{value:i.communicationPreferences||"",onChange:F=>g("communicationPreferences",F.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(ct,{value:i.paymentMethods||"",onChange:F=>g("paymentMethods",F.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(ct,{value:i.purchaseBehaviour||"",onChange:F=>g("purchaseBehaviour",F.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(sn,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(ut,{children:a.jsxs(Et,{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(ct,{value:i.coreValues||"",onChange:F=>g("coreValues",F.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(ct,{value:i.lifestyleChoices||"",onChange:F=>g("lifestyleChoices",F.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(ct,{value:i.socialActivities||"",onChange:F=>g("socialActivities",F.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(ct,{value:i.categoryKnowledge||"",onChange:F=>g("categoryKnowledge",F.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(ct,{value:i.decisionInfluences||"",onChange:F=>g("decisionInfluences",F.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(ct,{value:i.painPoints||"",onChange:F=>g("painPoints",F.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(ct,{value:i.journeyContext||"",onChange:F=>g("journeyContext",F.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(ct,{value:i.keyTouchpoints||"",onChange:F=>g("keyTouchpoints",F.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(ct,{value:((X=i.selfDeterminationNeeds)==null?void 0:X.autonomy)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,autonomy:F.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(ct,{value:((re=i.selfDeterminationNeeds)==null?void 0:re.competence)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,competence:F.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(ct,{value:((xe=i.selfDeterminationNeeds)==null?void 0:xe.relatedness)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,relatedness:F.target.value}),rows:2,placeholder:"Need for connection and belonging"})]})]})]})]})]})}),a.jsx(ut,{children:a.jsx(Et,{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((F,ue)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:F,onChange:ie=>b("fears",ue,ie.target.value),placeholder:"Enter a fear or concern"}),a.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x("fears",ue),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},ue)),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>v("fears"),className:"mt-2",children:[a.jsx(Tr,{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(ct,{value:i.narrative||"",onChange:F=>g("narrative",F.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(ct,{value:i.additionalInformation||"",onChange:F=>g("additionalInformation",F.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 IDe(){const{id:t}=Gj(),e=Ei(),n=Xn(),{navigationState:r,clearNavigationState:i}=T0(),[o,s]=y.useState(void 0),[l,c]=y.useState(!1),[u,d]=y.useState(!1),[f,h]=y.useState(!0);return y.useEffect(()=>{if(!t){h(!1);return}let m=!0;const b=new URLSearchParams(e.search).get("fromReview")==="true";return c(b),h(!0),(async()=>{try{const w=t.startsWith("local-")?t.substring(6):t,S=await kr.getById(w);if(S&&S.data){const C=S.data;if(m){console.log("Found persona in database:",C),s({...C,id:C.id||C._id,isDbPersona:!0}),h(!1);return}}console.error("Could not find persona with id:",t),m&&(s(void 0),h(!1),se.error("Persona not found"))}catch(w){console.error("Error fetching persona:",w),m&&(s(void 0),h(!1),se.error("Failed to load persona details"))}})(),()=>{m=!1}},[t,e.search]),{currentPersona:o,isEditing:u,isFromReview:l,isLoading:f,setIsEditing:d,handleGoBack:()=>{r.previousRoute&&r.previousRoute.startsWith("/focus-groups/")&&r.focusGroupId?n(`/focus-groups/${r.focusGroupId}`):r.previousRoute==="/focus-groups"&&r.focusGroupTab?r.isNewFocusGroup?n(`/focus-groups?mode=create&tab=${r.focusGroupTab}`):r.focusGroupId?n(`/focus-groups?mode=edit&id=${r.focusGroupId}&tab=${r.focusGroupTab}`):n("/focus-groups?mode=create&tab=participants"):n(l?"/synthetic-users?mode=create&tab=ai&step=review":"/synthetic-users")},handleSaveEdit:async m=>{try{d(!1);const v=m.isDbPersona||t&&t.length===24&&/^[0-9a-f]{24}$/i.test(t),b={...m};if(b._id&&delete b._id,delete b.isDbPersona,v&&t&&t.length===24&&/^[0-9a-f]{24}$/i.test(t)){const x=await kr.update(t,b);console.log("Updated persona in database:",x);const w={...m,isDbPersona:!0};s(w),se.success("Persona updated in database successfully")}else{const x=await kr.create(b);console.log("Created new persona in database:",x.data);const w={...m,id:x.data._id||x.data.id,_id:x.data._id||x.data.id,isDbPersona:!0};s(w),se.success("Persona saved to database successfully")}}catch(v){return console.error("Error saving persona:",v),v.response&&v.response.status===401?se.error("Authentication error - Please log in to save personas"):v.response&&v.response.status===404?se.error("API endpoint not found - Database service may be unavailable"):se.error("Failed to save persona to database: "+(v.message||"Unknown error")),!1}return!0}}}function FD(){var f;const{currentPersona:t,isEditing:e,isFromReview:n,isLoading:r,setIsEditing:i,handleGoBack:o,handleSaveEdit:s}=IDe(),{navigationState:l}=T0(),[c,u]=y.useState("");y.useEffect(()=>{var h;l.focusGroupId&&((h=l.previousRoute)!=null&&h.startsWith("/focus-groups/"))&&(async()=>{var g;try{const m=await jt.getById(l.focusGroupId);(g=m==null?void 0:m.data)!=null&&g.name&&u(m.data.name)}catch(m){console.error("Error fetching focus group name:",m)}})()},[l.focusGroupId,l.previousRoute]);const d=((f=l.previousRoute)==null?void 0:f.startsWith("/focus-groups/"))&&l.focusGroupId;return r?a.jsx(PDe,{}):t?a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(aa,{}),a.jsx("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:e?a.jsx(ODe,{persona:t,onSave:s,onCancel:()=>i(!1)}):a.jsxs(a.Fragment,{children:[d&&a.jsx("div",{className:"mb-4",children:a.jsx(wK,{children:a.jsxs(SK,{children:[a.jsx($v,{children:a.jsxs(N_,{href:"/focus-groups",className:"flex items-center",children:[a.jsx(my,{className:"h-4 w-4 mr-1"}),"Focus Groups"]})}),a.jsx(T_,{}),a.jsx($v,{children:a.jsxs(N_,{href:`/focus-groups/${l.focusGroupId}`,className:"flex items-center",children:[a.jsx(Cr,{className:"h-4 w-4 mr-1"}),c||"Focus Group Session"]})}),a.jsx(T_,{}),a.jsx($v,{children:a.jsxs(CK,{className:"flex items-center",children:[a.jsx(_p,{className:"h-4 w-4 mr-1"}),(t==null?void 0:t.name)||"Participant"]})})]})})}),a.jsxs("div",{className:"flex items-center mb-6 relative",children:[a.jsx(te,{variant:"ghost",onClick:o,className:"absolute left-0 top-0 flex items-center",children:a.jsx(Cp,{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(te,{onClick:()=>i(!0),className:"absolute right-0 top-0",children:[a.jsx(qX,{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(_De,{persona:t})}),a.jsx("div",{className:"lg:col-span-2",children:a.jsxs(Kl,{defaultValue:"cooper-profile",children:[a.jsxs(Ea,{className:"grid w-full grid-cols-3",children:[a.jsx(on,{value:"cooper-profile",children:"Cooper Profile"}),a.jsx(on,{value:"personality",children:"Personality"}),a.jsx(on,{value:"scenarios",children:"Scenarios"})]}),a.jsx(sn,{value:"cooper-profile",className:"mt-6",children:a.jsx(jDe,{persona:t})}),a.jsx(sn,{value:"personality",className:"mt-6",children:a.jsx(EDe,{persona:t})}),a.jsx(sn,{value:"scenarios",className:"mt-6",children:a.jsx(NDe,{persona:t})})]})})]})]})})]}):a.jsx(TDe,{})}const RDe=Ie.object({username:Ie.string().min(3,"Username must be at least 3 characters"),password:Ie.string().min(4,"Password must be at least 4 characters")});function MDe(){var h;const t=Xn(),e=Ei(),{login:n,loginWithMicrosoft:r,isAuthenticated:i,isMsalLoading:o}=cu(),[s,l]=y.useState(!1),c=((h=e.state)==null?void 0:h.from)||"/";console.log("Login page - destination path:",c),y.useEffect(()=>{i&&(console.log("User already authenticated, redirecting from login page"),t("/",{replace:!0}))},[i,t]);const u=h0({resolver:p0(RDe),defaultValues:{username:"",password:""}});async function d(p){l(!0);try{await n(p.username,p.password)?(console.log("Login successful, received token, navigating to:",c),t(c,{replace:!0})):(console.error("Login succeeded but no token received"),l(!1))}catch(g){console.error("Login error in form handler:",g),l(!1)}}async function f(){try{await r(),console.log("Microsoft login successful, navigating to:",c),t(c,{replace:!0})}catch(p){console.error("Microsoft login error in form handler:",p)}}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(ut,{className:"w-full max-w-md",children:[a.jsxs(pi,{className:"space-y-1",children:[a.jsx(Mi,{className:"text-2xl font-bold text-center",children:"Sign In"}),a.jsx(CN,{className:"text-center",children:"Enter your credentials to access your account"})]}),a.jsxs(Et,{children:[a.jsx("div",{className:"mb-6",children:a.jsx(te,{type:"button",variant:"outline",className:"w-full bg-[#0078d4] hover:bg-[#106ebe] text-white border-[#0078d4] hover:border-[#106ebe]",onClick:f,disabled:s||o,children:o?a.jsxs(a.Fragment,{children:[a.jsx(ws,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing in with Microsoft..."]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{className:"mr-2 h-4 w-4",viewBox:"0 0 21 21",fill:"currentColor",children:[a.jsx("path",{d:"M10 0H0v10h10V0z"}),a.jsx("path",{d:"M21 0H11v10h10V0z"}),a.jsx("path",{d:"M10 11H0v10h10V11z"}),a.jsx("path",{d:"M21 11H11v10h10V11z"})]}),"Sign in with Microsoft"]})})}),a.jsxs("div",{className:"relative mb-6",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("div",{className:"w-full border-t border-gray-200"})}),a.jsx("div",{className:"relative flex justify-center text-sm",children:a.jsx("span",{className:"bg-white px-2 text-gray-500 dark:bg-gray-800 dark:text-gray-400",children:"Or continue with username"})})]}),a.jsx(g0,{...u,children:a.jsxs("form",{onSubmit:u.handleSubmit(d),className:"space-y-4",children:[a.jsx(dt,{control:u.control,name:"username",render:({field:p})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Username"}),a.jsx(at,{children:a.jsx(Dt,{placeholder:"Enter your username",...p,disabled:s,autoComplete:"username"})}),a.jsx(lt,{})]})}),a.jsx(dt,{control:u.control,name:"password",render:({field:p})=>a.jsxs(ot,{children:[a.jsx(st,{children:"Password"}),a.jsx(at,{children:a.jsx(Dt,{placeholder:"Enter your password",type:"password",...p,disabled:s,autoComplete:"current-password"})}),a.jsx(lt,{})]})}),a.jsx(te,{type:"submit",className:"w-full",disabled:s||o,children:s?"Signing in...":"Sign In"})]})})]}),a.jsxs(AN,{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&&!o&&a.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[a.jsx(te,{variant:"outline",onClick:()=>t("/",{replace:!0}),className:"mt-2",children:"Return to Home"}),a.jsx(te,{variant:"link",onClick:()=>{localStorage.setItem("offline_mode","true");const p={username:"guest",email:"guest@example.com",role:"user"};localStorage.setItem("auth_token","offline-mode-token"),localStorage.setItem("user",JSON.stringify(p)),qe.success("Offline mode activated",{description:"Using demo account with limited functionality"}),t("/",{replace:!0})},className:"text-sm text-gray-500",children:"Use offline mode"})]})]})]})})}function ju({children:t}){const{isAuthenticated:e,isLoading:n}=cu(),r=Ei();return console.log("ProtectedRoute check:",{isAuthenticated:e,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"})}):e?(console.log("User is authenticated, showing protected content"),a.jsx(a.Fragment,{children:t})):(console.log("Not authenticated, redirecting to login"),a.jsx(a4,{to:"/login",state:{from:r.pathname},replace:!0}))}const AK=new lN(Ore);AK.initialize().catch(t=>{console.error("MSAL initialization error:",t)});function DDe({children:t}){return a.jsx(Pre,{instance:AK,children:t})}const $De=new bQ,LDe=()=>a.jsx(SQ,{client:$De,children:a.jsx(yX,{basename:"/semblance",children:a.jsx(DDe,{children:a.jsx(Rre,{children:a.jsx(Uce,{children:a.jsxs(XY,{children:[a.jsx(_q,{}),a.jsxs(uX,{children:[a.jsx(wo,{path:"/",element:a.jsx(Dre,{})}),a.jsx(wo,{path:"/login",element:a.jsx(MDe,{})}),a.jsx(wo,{path:"/synthetic-users",element:a.jsx(ju,{children:a.jsx(Fce,{})})}),a.jsx(wo,{path:"/synthetic-users/:id",element:a.jsx(ju,{children:a.jsx(FD,{})})}),a.jsx(wo,{path:"/personas/:id",element:a.jsx(ju,{children:a.jsx(FD,{})})}),a.jsx(wo,{path:"/focus-groups",element:a.jsx(ju,{children:a.jsx(Kce,{})})}),a.jsx(wo,{path:"/focus-groups/:id",element:a.jsx(ju,{children:a.jsx(pDe,{})})}),a.jsx(wo,{path:"/dashboard",element:a.jsx(ju,{children:a.jsx(ADe,{})})}),a.jsx(wo,{path:"/old-path",element:a.jsx(a4,{to:"/",replace:!0})}),a.jsx(wo,{path:"*",element:a.jsx($re,{})})]})]})})})})})});lF(document.getElementById("root")).render(a.jsx(LDe,{})); +`),se=document.createElement("a"),O=new Blob([Z],{type:"text/plain"});se.href=URL.createObjectURL(O),se.download=`focus-group-${t}-transcript.txt`,document.body.appendChild(se),se.click(),document.body.removeChild(se),Ye.success("Transcript downloaded",{description:"The focus group transcript has been saved to your device."})},Sn=(Z,se)=>{const O=ut=>{const Gt=ut.match(/^\[([^\]]+)\]:\s*(.*)$/);return Gt?Gt[2].trim():ut.trim()},q=ut=>ut.toLowerCase().replace(/[^\w\s]/g," ").replace(/\s+/g," ").trim(),K=(ut,Gt)=>{const Jt=q(ut),Dr=q(Gt);if(Jt===Dr)return 1;if(Jt.includes(Dr)||Dr.includes(Jt))return Math.min(Jt.length,Dr.length)/Math.max(Jt.length,Dr.length);const Fn=Jt.split(" "),dn=Dr.split(" "),Gf=Fn.filter(pP=>dn.includes(pP)&&pP.length>2);return Fn.length===0||dn.length===0?0:Gf.length/Math.max(Fn.length,dn.length)},le=typeof Z=="object"&&Z!==null,ue=le?Z.text:O(Z),De=le?Z.original:Z;let be=null,Tt="";if(se&&(be=n.find(ut=>ut.id===se),be?Tt="direct_message_id_match":console.warn(`Message ID ${se} not found in current messages array`)),be||(be=n.find(ut=>ut.text.includes(De)),be&&(Tt="exact_full_match")),be||(be=n.find(ut=>ut.text.includes(ue)),be&&(Tt="exact_text_match")),be||(be=n.find(ut=>ue.includes(ut.text.trim())),be&&(Tt="reverse_exact_match")),!be){const ut=ue.toLowerCase();be=n.find(Gt=>Gt.text.toLowerCase().includes(ut)||ut.includes(Gt.text.toLowerCase())),be&&(Tt="case_insensitive_match")}if(!be){const ut=n.map(Gt=>({message:Gt,similarity:K(ue,Gt.text)})).filter(Gt=>Gt.similarity>.7).sort((Gt,Jt)=>Jt.similarity-Gt.similarity);ut.length>0&&(be=ut[0].message,Tt=`fuzzy_match_${Math.round(ut[0].similarity*100)}%`)}if(!be){const Gt=q(ue).split(" ").filter(Jt=>Jt.length>3);Gt.length>0&&(be=n.find(Jt=>{const Dr=q(Jt.text);return Gt.every(Fn=>Dr.includes(Fn))}),be&&(Tt="partial_word_match"))}be?(console.log(`Quote match found using strategy: ${Tt}`,{quoteType:le?"QuoteData":"string",providedMessageId:se,extractedText:ue,matchedMessage:be.text.substring(0,100),matchedMessageId:be.id,originalQuote:De.substring(0,100)}),p("chat"),setTimeout(()=>{const ut=document.getElementById(`message-${be.id}`);ut&&(j||ut.scrollIntoView({behavior:"smooth",block:"center"}),ut.style.backgroundColor="#fbbf24",ut.style.transition="background-color 0.3s ease",setTimeout(()=>{ut.style.backgroundColor=""},2e3))},100)):(console.warn("Quote match failed",{quoteType:le?"QuoteData":"string",providedMessageId:se,originalQuote:De.substring(0,100),extractedText:ue.substring(0,100),totalMessages:n.length,messageSample:n.slice(0,3).map(ut=>({id:ut.id,text:ut.text.substring(0,50)}))}),Ye.warning("Message not found",{description:"Could not locate the original message for this quote. The quote may have been paraphrased by the AI."}))},yt=Z=>{l(se=>{const O=new Set(se.map(K=>K.id)),q=Z.filter(K=>!O.has(K.id));return[...se,...q]})},qe=async Z=>{if(!t)return;const se=s.find(O=>O.id===Z);if(se)try{"source"in se&&se.source==="generated"&&await Hn.deleteKeyTheme(t,Z),l(s.filter(O=>O.id!==Z))}catch(O){console.error("Error deleting theme:",O),Ye.error("Failed to delete theme",{description:"There was an error removing the theme. Please try again."})}},ft=y.useCallback(async(Z,se)=>{if(t)try{await Hn.setModeratorPosition(t,Z,se),await me(),Ye.success("Moderator position updated",{description:"The moderator has been moved to the selected section."})}catch(O){console.error("Error setting moderator position:",O),Ye.error("Failed to update moderator position",{description:"There was an error updating the moderator position."})}},[t]),Vt=y.useCallback(async Z=>{if(console.log("💾 handleDiscussionGuideSave called:",{hasId:!!t,isEditingGuideContent:I,timestamp:new Date().toISOString()}),!!t)try{await _t.update(t,{discussionGuide:Z}),I?(R.current&&(R.current={...R.current,discussionGuide:Z}),console.log("⚠️ Skipping focus group state update during editing to preserve focus")):(console.log("🔄 Updating focus group state (not editing)"),u(se=>se?{...se,discussionGuide:Z}:null))}catch(se){throw console.error("Error saving discussion guide:",se),se}},[t,I]),un=y.useCallback(Z=>{console.log("🔄 handleGuideEditingStateChange called:",{editing:Z,timestamp:new Date().toISOString(),currentIsEditingGuideContent:I}),k(Z),E(Z),!Z&&R.current&&(console.log("📝 Updating focus group state after editing ended"),u(R.current))},[I]),Wi=y.useCallback(()=>{_(Z=>!Z)},[]),Ls=y.useCallback((Z,se,O,q,K,le)=>{D({isOpen:!0,sectionId:Z,itemId:se,content:O,sectionTitle:q,itemTitle:K,itemType:le})},[]),Y=Z=>{console.log("🔍 EXTRACT ASSET FILENAME DEBUG - Input content:",Z);const se=[/'([^']*\.[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 O=0;O0){const le=K[0][1];if(console.log(`🔍 Pattern ${O+1} extracted filename:`,le),le&&le.includes("."))return console.log("✅ EXTRACT ASSET FILENAME - Found:",le),le}}return console.warn("❌ EXTRACT ASSET FILENAME - No filename found in content"),null},ke=()=>{if(g)return{sectionId:g.current_section_id,sectionTitle:g.current_section,itemId:g.current_item_id,itemTitle:g.current_item}},He=()=>{if(n.length!==0)return n[n.length-1].id},ht=()=>{const Z=He();if(!Z||n.length===0)return new Date;const se=n.find(O=>O.id===Z);return se?se.timestamp:new Date},Qe=async()=>{if(t){nt(!0),vt(!1),Bt(!1),Ye.info("Analyzing discussion for key themes...",{description:"This may take a moment as we process the entire conversation."});try{const Z=await Hn.generateKeyThemes(t);Z.data&&Z.data.themes?(vt(!0),Ye.success(`Generated ${Z.data.themes.length} key themes`,{description:"New themes have been added to the analysis."}),l(se=>[...se,...Z.data.themes])):(vt(!0),Ye.warning("No new themes were generated",{description:"Try again when the discussion has more content."}))}catch(Z){console.error("Error generating key themes:",Z),Bt(!0),Ye.error("Failed to generate key themes",{description:"There was an error analyzing the discussion. Please try again."})}}},gt=()=>{nt(!1),vt(!1),Bt(!1)},tn=()=>{Re||pe(new Date),de(!0)},rt=Z=>{V(se=>[...se,Z].sort((O,q)=>q.createdAt.getTime()-O.createdAt.getTime())),window.notesPanelAddNote&&window.notesPanelAddNote(Z)},mn=Z=>{const se=n.find(O=>O.id===Z);se?(p("chat"),setTimeout(()=>{const O=document.getElementById(`message-${se.id}`);O&&(j||O.scrollIntoView({behavior:"smooth",block:"center"}),O.style.backgroundColor="#fbbf24",O.style.transition="background-color 0.3s ease",setTimeout(()=>{O.style.backgroundColor=""},2e3))},100)):Ye.info("Message not found",{description:"Could not locate the original message for this note."})};y.useEffect(()=>{n.length>0&&!Re&&pe(new Date)},[n.length,Re]),y.useEffect(()=>{P.current=j,j||me()},[j]);const Qt=Z=>{Ne(se=>se.includes(Z)?se.filter(O=>O!==Z):[...se,Z])};return S?a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(aa,{}),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(aa,{}),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(te,{variant:"ghost",onClick:()=>e("/focus-groups"),className:"mr-2",children:a.jsx(Sp,{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(ea,{className:"h-3 w-3 text-slate-500 mr-1"}),a.jsx(ur,{variant:"secondary",className:"text-xs",children:c.llm_model==="gpt-4.1"?"GPT-4.1":c.llm_model==="gpt-5"?"GPT-5":"Gemini 2.5 Pro"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-4 mt-4 sm:mt-0",children:[a.jsxs(te,{variant:"outline",onClick:()=>b(!v),className:v?"bg-blue-50 text-blue-600":"",children:[a.jsx(i1,{className:"mr-2 h-4 w-4"}),"AI Dashboard"]}),a.jsxs(te,{variant:"outline",onClick:()=>z(!0),children:[a.jsx(Qj,{className:"mr-2 h-4 w-4"}),"AI Model"]}),a.jsxs(te,{variant:"outline",onClick:_r,children:[a.jsx(zc,{className:"mr-2 h-4 w-4"}),"Download Transcript"]})]})]}),ne&&a.jsx("div",{className:"mb-6",children:a.jsx(tT,{isActive:ne,isComplete:Fe,hasError:mt,label:"Analyzing discussion for key themes",onComplete:gt,className:"max-w-4xl mx-auto"})}),a.jsx(uDe,{discussionGuide:c.discussionGuide,moderatorStatus:g,onSectionSelect:ft,onSetPosition:Ls,onSave:Vt,focusGroupId:t||"",isOpen:A,onToggle:Wi,onEditingChange:un}),a.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 h-[calc(100vh-12rem)]",children:[a.jsx(Kce,{participants:d,selectedParticipantIds:Se,onToggleParticipantFilter:Qt}),a.jsx("div",{className:"flex-1 flex flex-col",children:a.jsxs(Kl,{defaultValue:"chat",value:h,onValueChange:p,className:"w-full h-full flex flex-col",children:[a.jsxs(Ea,{className:"grid grid-cols-4 mb-4",children:[a.jsxs(on,{value:"chat",className:"flex items-center",children:[a.jsx(us,{className:"h-4 w-4 mr-2"}),"Discussion"]}),a.jsxs(on,{value:"themes",className:"flex items-center",children:[a.jsx(Vc,{className:"h-4 w-4 mr-2"}),"Key Themes"]}),a.jsxs(on,{value:"notes",className:"flex items-center",children:[a.jsx(my,{className:"h-4 w-4 mr-2"}),"Notes"]}),a.jsxs(on,{value:"analytics",className:"flex items-center",children:[a.jsx(i1,{className:"h-4 w-4 mr-2"}),"Analytics"]})]}),a.jsx(sn,{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(te,{onClick:Je,size:"lg",className:"flex items-center gap-2",children:[a.jsx(l4,{className:"h-5 w-5"}),"Start Session"]})]}):a.jsx(wue,{messages:n,modeEvents:i,personas:d,isSpeaking:!1,focusGroupId:t||"",isAiModeActive:x,selectedParticipantIds:Se,onToggleHighlight:$t,onAdvanceDiscussion:()=>null,onNewMessage:Xe,onStatusChange:We,isEditingDiscussionGuide:j})}),a.jsx(sn,{value:"themes",className:"m-0",children:a.jsx(Cue,{themes:s,messages:n,personas:d,focusGroupId:t||"",onThemesGenerated:yt,onThemeDelete:qe,onQuoteClick:Sn,onGenerateKeyThemes:Qe})}),a.jsx(sn,{value:"notes",className:"m-0",style:{height:"calc(100% - 3.5rem)"},children:a.jsx("div",{className:"h-full",children:a.jsx(dDe,{focusGroupId:t||"",focusGroupName:c==null?void 0:c.name,onNoteClick:mn})})}),a.jsx(sn,{value:"analytics",className:"m-0",children:a.jsx(lDe,{messages:n,themes:s,personas:d})})]})})]})]}),n.length>0&&a.jsx("div",{className:"fixed bottom-6 right-6 z-40",children:a.jsx(te,{onClick:tn,className:"rounded-full h-12 w-12 p-0 shadow-lg",title:"Take a quick note",children:a.jsx(my,{className:"h-5 w-5"})})}),a.jsx(fDe,{isOpen:oe,onClose:()=>de(!1),focusGroupId:t||"",associatedMessageId:He(),sectionInfo:ke(),messageTimestamp:ht(),onNoteSaved:rt}),a.jsx(kc,{open:N.isOpen,onOpenChange:Z=>D(se=>({...se,isOpen:Z})),children:a.jsxs(xl,{children:[a.jsxs(bl,{children:[a.jsx(Sl,{children:"Set Moderator Position"}),a.jsxs(Oc,{children:['Are you sure you want to set the moderator position to "',N.itemTitle,'" in section "',N.sectionTitle,'"? This will make the moderator ask this question in the chat.']})]}),a.jsxs(wl,{children:[a.jsx(te,{variant:"outline",disabled:N.isLoading,onClick:()=>D({isOpen:!1}),children:"Cancel"}),a.jsxs(te,{disabled:N.isLoading,onClick:async()=>{var Z,se,O,q,K,le,ue,De,be;if(!(!t||!N.sectionId||!N.itemId||!N.content)){D(Tt=>({...Tt,isLoading:!0}));try{await Hn.setModeratorPosition(t,N.sectionId,N.itemId);let Tt=[],ut=!1,Gt=N.content;const Jt=N.content?Y(N.content):null,Dr=!!Jt;if(console.log("🔍 MANUAL POSITION DEBUG:",{itemType:N.itemType,hasImageAttached:Dr,assetFilename:Jt,content:N.content,sectionTitle:N.sectionTitle,itemTitle:N.itemTitle,contentLength:(Z=N.content)==null?void 0:Z.length}),Dr&&N.content&&Jt)if(console.log("🔍 ASSET EXTRACTION DEBUG:",{originalContent:N.content,extractedFilename:Jt,contentLength:N.content.length}),Jt){Tt=[Jt],ut=!0,console.log("🎨 MANUAL POSITION: Creative review detected, will activate visual context for:",Jt);try{console.log("🎨 MANUAL MODE: Requesting AI description for",Jt);try{console.log("🔍 TESTING: Calling test endpoint first...");const Gf=await Le.post(`/focus-groups/${t}/test-endpoint`,{test:"data"});console.log("✅ TEST: Test endpoint response:",Gf.data)}catch(Gf){console.error("❌ TEST: Test endpoint failed:",Gf)}const dn=await _t.describeAsset(t,Jt);dn.data.description&&(Gt=N.content.replace(`'${Jt}'`,`'${Jt}' - ${dn.data.description}`),console.log("✅ MANUAL MODE: Enhanced question with AI description"),console.log("🔍 Original:",N.content),console.log("🔍 Enhanced:",Gt))}catch(dn){console.error("⚠️ MANUAL MODE: Failed to generate AI description:",dn),console.error("⚠️ Error response data:",(se=dn.response)==null?void 0:se.data),console.error("⚠️ Error status:",(O=dn.response)==null?void 0:O.status),console.error("⚠️ Error headers:",(q=dn.response)==null?void 0:q.headers),console.error("⚠️ Full axios error:",{message:dn.message,code:dn.code,status:(K=dn.response)==null?void 0:K.status,statusText:(le=dn.response)==null?void 0:le.statusText,url:(ue=dn.config)==null?void 0:ue.url,method:(De=dn.config)==null?void 0:De.method}),Ye.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 Fn={id:`msg-${Date.now()}`,senderId:"moderator",text:Gt,timestamp:new Date,type:"question"};try{const dn=await _t.sendMessage(t,{senderId:"moderator",text:Gt,type:"question",attached_assets:Tt,activates_visual_context:ut});(be=dn==null?void 0:dn.data)!=null&&be.message_id&&(Fn.id=dn.data.message_id)}catch(dn){console.warn("Failed to save message to API, showing locally:",dn)}Xe(Fn),D({isOpen:!1}),setTimeout(async()=>{await me(),setTimeout(()=>me(),500)},200),Ye.success("Moderator position set",{description:`Position set to "${N.itemTitle}" in "${N.sectionTitle}"`})}catch(Tt){console.error("Error setting moderator position:",Tt),D(ut=>({...ut,isLoading:!1})),Ye.error("Failed to set moderator position",{description:"There was an error setting the moderator position."})}}},className:"flex items-center gap-2",children:[N.isLoading&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),N.isLoading?"Generating detailed image description...":"Confirm"]})]})]})}),a.jsx(kc,{open:$,onOpenChange:z,children:a.jsxs(xl,{children:[a.jsxs(bl,{children:[a.jsx(Sl,{children:"AI Model Settings"}),a.jsx(Oc,{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(ea,{className:"h-4 w-4 text-slate-500"}),a.jsx("span",{className:"text-sm font-medium",children:"Current Model:"}),a.jsx(ur,{variant:"secondary",children:(c==null?void 0:c.llm_model)==="gpt-4.1"?"GPT-4.1":(c==null?void 0:c.llm_model)==="gpt-5"?"GPT-5":"Gemini 2.5 Pro"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Select AI Model:"}),a.jsxs(kn,{value:M,onValueChange:Z=>{console.log("🔧 Model selection changed:",{from:M,to:Z}),U(Z)},children:[a.jsx(Nn,{className:"mt-1",children:a.jsx(On,{placeholder:"Select AI model"})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(ce,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(ce,{value:"gpt-5",children:"GPT-5"})]})]})]}),M==="gpt-5"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Reasoning Effort:"}),a.jsxs(kn,{value:W,onValueChange:X,children:[a.jsx(Nn,{className:"mt-1",children:a.jsx(On,{placeholder:"Select reasoning effort"})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"minimal",children:"Minimal - Fast responses"}),a.jsx(ce,{value:"low",children:"Low - Quick thinking"}),a.jsx(ce,{value:"medium",children:"Medium - Balanced (default)"}),a.jsx(ce,{value:"high",children:"High - Deep reasoning"})]})]}),a.jsx("p",{className:"text-xs text-slate-600 mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx("p",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how thoroughly GPT-5 thinks and how detailed responses are"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Response Verbosity:"}),a.jsxs(kn,{value:re,onValueChange:xe,children:[a.jsx(Nn,{className:"mt-1",children:a.jsx(On,{placeholder:"Select verbosity level"})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"low",children:"Low - Concise responses"}),a.jsx(ce,{value:"medium",children:"Medium - Balanced length (default)"}),a.jsx(ce,{value:"high",children:"High - Detailed responses"})]})]}),a.jsx("p",{className:"text-xs text-slate-600 mt-1",children:"Controls how detailed and lengthy GPT-5's responses will be"}),a.jsx("p",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how thoroughly GPT-5 thinks and how detailed responses are"})]})]}),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("p",{children:[a.jsx("strong",{children:"GPT-5:"})," OpenAI's newest model with advanced reasoning and customizable response styles."]})]})]}),a.jsxs(wl,{children:[a.jsx(te,{variant:"outline",onClick:()=>z(!1),disabled:F,children:"Cancel"}),a.jsxs(te,{onClick:()=>{console.log("🔧 Update button clicked:",{selectedModel:M,selectedReasoningEffort:W,selectedVerbosity:re,currentModel:c==null?void 0:c.llm_model,isDisabled:F||M===(c==null?void 0:c.llm_model)&&(M!=="gpt-5"||W===(c==null?void 0:c.reasoning_effort)&&re===(c==null?void 0:c.verbosity))}),wt(M,W,re)},disabled:F||M===(c==null?void 0:c.llm_model)&&(M!=="gpt-5"||W===((c==null?void 0:c.reasoning_effort)||"medium")&&re===((c==null?void 0:c.verbosity)||"medium")),children:[F&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),F?"Updating...":"Update Model"]})]})]})}),a.jsx(cDe,{focusGroupId:t,personas:d,isVisible:v,onToggle:()=>b(!v)})]}):a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(aa,{}),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(te,{onClick:()=>e("/focus-groups"),className:"mt-4",children:[a.jsx(Sp,{className:"mr-2 h-4 w-4"})," Back to Focus Groups"]})]})]})},pDe=({title:t,description:e})=>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:t}),a.jsx("p",{className:"text-slate-600 mt-1",children:e})]}),a.jsxs("div",{className:"mt-4 sm:mt-0 flex gap-2",children:[a.jsx(te,{variant:"outline",children:"Export Data"}),a.jsx(te,{children:"Generate Report"})]})]}),XS=({title:t,value:e,changePercentage:n,icon:r})=>a.jsx(ct,{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:t}),a.jsx("h3",{className:"text-2xl font-bold mt-1",children:e}),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"})})]})}),mDe=[{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}],gDe=[{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"}],vDe=()=>a.jsxs("div",{className:"space-y-6",children:[a.jsxs(ct,{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(Al,{width:"100%",height:"100%",children:a.jsxs(xK,{data:mDe,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(Om,{strokeDasharray:"3 3"}),a.jsx(Ll,{dataKey:"name"}),a.jsx(Fl,{}),a.jsx(zr,{}),a.jsx(Ho,{type:"monotone",dataKey:"users",stackId:"1",stroke:"#8884d8",fill:"#8884d8",name:"Synthetic Users"}),a.jsx(Ho,{type:"monotone",dataKey:"groups",stackId:"2",stroke:"#82ca9d",fill:"#82ca9d",name:"Focus Groups"}),a.jsx(Ho,{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(ct,{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:[gDe.slice(0,3).map(t=>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 ${t.sentiment==="positive"?"bg-green-100":t.sentiment==="negative"?"bg-red-100":"bg-slate-100"}`,children:a.jsx(Bc,{className:`h-4 w-4 ${t.sentiment==="positive"?"text-green-600":t.sentiment==="negative"?"text-red-600":"text-slate-600"}`})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:t.title}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t.description}),a.jsxs("div",{className:"flex items-center text-xs text-muted-foreground mt-2",children:[a.jsx("span",{children:t.source}),a.jsx("span",{className:"mx-2",children:"•"}),a.jsx("span",{children:t.date})]})]})]})},t.id)),a.jsx(te,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"View All Insights"})]})]}),a.jsxs(ct,{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(Lg,{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(Lg,{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(Lg,{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(Lg,{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(te,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"Manage Research Calendar"})]})]})]})]}),yDe=[{name:"18-24",value:15},{name:"25-34",value:35},{name:"35-44",value:25},{name:"45-54",value:15},{name:"55+",value:10}],xDe=()=>a.jsxs(ct,{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(te,{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(Al,{width:"100%",height:"100%",children:a.jsxs(hP,{children:[a.jsx(zr,{}),a.jsx(ts,{data:yDe,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(te,{onClick:()=>window.location.href="/synthetic-users",children:"Manage Synthetic Personas"})})]}),bDe=[{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}],$D=[{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"}],wDe=[{name:"Navigation",count:42},{name:"Performance",count:28},{name:"UX Design",count:36},{name:"Features",count:22},{name:"Onboarding",count:18}],SDe=()=>{const t=Xn();return a.jsxs(ct,{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(te,{variant:"outline",size:"sm",onClick:()=>t("/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(Al,{width:"100%",height:"100%",children:a.jsxs(xK,{data:bDe,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(Om,{strokeDasharray:"3 3"}),a.jsx(Ll,{dataKey:"name"}),a.jsx(Fl,{}),a.jsx(zr,{}),a.jsx(Ho,{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(Al,{width:"100%",height:"100%",children:a.jsxs(hP,{children:[a.jsx(zr,{}),a.jsx(ts,{data:$D,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:e,percent:n})=>`${e} ${(n*100).toFixed(0)}%`,children:$D.map((e,n)=>a.jsx(lg,{fill:e.color},`cell-${n}`))}),a.jsx(ca,{})]})})})]})]}),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(Al,{width:"100%",height:"100%",children:a.jsxs(yK,{data:wDe,margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(Om,{strokeDasharray:"3 3"}),a.jsx(Ll,{dataKey:"name"}),a.jsx(Fl,{}),a.jsx(zr,{}),a.jsx(ca,{}),a.jsx(Xl,{dataKey:"count",name:"Mentions",fill:"#8884d8"})]})})})]}),a.jsx("div",{className:"flex justify-center",children:a.jsx(te,{onClick:()=>t("/focus-groups"),children:"Manage Focus Groups"})})]})},CDe=()=>{const[t,e]=y.useState("overview");return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(aa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsx(pDe,{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(XS,{title:"Total Synthetic Users",value:48,changePercentage:12,icon:Cr}),a.jsx(XS,{title:"Active Focus Groups",value:7,changePercentage:5,icon:Ps}),a.jsx(XS,{title:"Research Insights",value:124,changePercentage:18,icon:Vc})]}),a.jsxs(Kl,{value:t,onValueChange:e,className:"glass-panel rounded-xl p-6",children:[a.jsxs(Ea,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(on,{value:"overview",children:"Overview"}),a.jsx(on,{value:"users",children:"Synthetic Users"}),a.jsx(on,{value:"focus-groups",children:"Focus Groups"})]}),a.jsx(sn,{value:"overview",children:a.jsx(vDe,{})}),a.jsx(sn,{value:"users",children:a.jsx(xDe,{})}),a.jsx(sn,{value:"focus-groups",children:a.jsx(SDe,{})})]})]})]})},bK=y.forwardRef(({...t},e)=>a.jsx("nav",{ref:e,"aria-label":"breadcrumb",...t}));bK.displayName="Breadcrumb";const wK=y.forwardRef(({className:t,...e},n)=>a.jsx("ol",{ref:n,className:Pe("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",t),...e}));wK.displayName="BreadcrumbList";const Dv=y.forwardRef(({className:t,...e},n)=>a.jsx("li",{ref:n,className:Pe("inline-flex items-center gap-1.5",t),...e}));Dv.displayName="BreadcrumbItem";const E_=y.forwardRef(({asChild:t,className:e,...n},r)=>{const i=t?Es:"a";return a.jsx(i,{ref:r,className:Pe("transition-colors hover:text-foreground",e),...n})});E_.displayName="BreadcrumbLink";const SK=y.forwardRef(({className:t,...e},n)=>a.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:Pe("font-normal text-foreground",t),...e}));SK.displayName="BreadcrumbPage";const N_=({children:t,className:e,...n})=>a.jsx("li",{role:"presentation","aria-hidden":"true",className:Pe("[&>svg]:size-3.5",e),...n,children:t??a.jsx(Ji,{})});N_.displayName="BreadcrumbSeparator";function ADe({persona:t}){const e=t.id==="0",n=t.id==="1";return a.jsxs(ct,{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:Zm(t),alt:t.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:t.name}),a.jsx("p",{className:"text-muted-foreground",children:t.occupation})]})]}),a.jsxs("div",{className:"mt-6 space-y-4",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Cr,{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:[t.age," ",t.gender?a.jsxs(a.Fragment,{children:["• ",t.gender]}):null,t.ethnicity?a.jsxs(a.Fragment,{children:[" • ",t.ethnicity]}):null]}),t.education&&a.jsx("p",{className:"sidebar-sub-item",children:t.education}),t.socialGrade&&a.jsxs("p",{className:"sidebar-sub-item",children:["Social Grade: ",t.socialGrade]}),t.householdIncome&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household Income: ",t.householdIncome]}),t.householdComposition&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household: ",t.householdComposition]})]})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(LX,{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:t.location}),t.livingSituation&&a.jsx("p",{className:"sidebar-sub-item",children:t.livingSituation})]})]}),t.interests&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(a1,{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:t.interests})]})]}),t.mediaConsumption&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(eS,{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:t.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:[t.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:`${t.techSavviness}%`}})})]}),t.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:[t.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:`${t.brandLoyalty}%`}})})]}),t.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:[t.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:`${t.priceConsciousness}%`}})})]}),t.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:[t.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:`${t.environmentalConcern}%`}})})]}),t.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:t.deviceUsage})]}),t.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:t.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:[t.brandPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(a1,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.brandPreferences})]}),t.communicationPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Ap,{className:"sidebar-icon"}),a.jsxs("span",{className:"text-muted-foreground text-sm",children:["Prefers: ",t.communicationPreferences]})]}),t.deviceUsage&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(UX,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.deviceUsage})]}),t.shoppingHabits&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(VX,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.shoppingHabits})]}),t.additionalInformation&&typeof t.additionalInformation=="string"&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(RX,{className:"sidebar-icon"}),a.jsx("div",{className:"sidebar-sub-item",children:t.additionalInformation.split(` +`).map((r,i)=>a.jsx("div",{className:"mb-1",children:r.trim().startsWith("•")||r.trim().startsWith("-")?r.trim().substring(1).trim():r.trim()},i))})]}),e&&a.jsxs("div",{className:"pt-2 space-y-2",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(nO,{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(py,{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(eS,{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(rO,{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(eS,{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(py,{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(rO,{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(nO,{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(Ap,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Seeks autonomy, bespoke service, and acknowledgment for taste"})]})]})]})]})]})]})}function _De({persona:t}){var e,n,r,i,o,s,l,c,u;return a.jsxs("div",{className:"space-y-6",children:[a.jsx(ct,{children:a.jsxs(jt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(Av,{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:(e=t.goals)==null?void 0:e.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(ct,{children:a.jsxs(jt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(f4,{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=t.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(ct,{children:a.jsxs(jt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(Qs,{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=t.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(ct,{children:a.jsxs(jt,{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(Bc,{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:(o=(i=t.thinkFeelDo)==null?void 0:i.thinks)==null?void 0:o.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(a1,{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=(s=t.thinkFeelDo)==null?void 0:s.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(Qs,{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=t.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 jDe({persona:t}){var n,r,i,o,s;const e=[{trait:"Openness",value:((n=t.oceanTraits)==null?void 0:n.openness)||50},{trait:"Conscientiousness",value:((r=t.oceanTraits)==null?void 0:r.conscientiousness)||50},{trait:"Extraversion",value:((i=t.oceanTraits)==null?void 0:i.extraversion)||50},{trait:"Agreeableness",value:((o=t.oceanTraits)==null?void 0:o.agreeableness)||50},{trait:"Neuroticism",value:((s=t.oceanTraits)==null?void 0:s.neuroticism)||50}];return a.jsx(ct,{children:a.jsxs(jt,{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(Al,{width:"100%",height:"100%",children:a.jsxs(aDe,{outerRadius:90,data:e,children:[a.jsx(pG,{}),a.jsx(zf,{dataKey:"trait"}),a.jsx(Hf,{domain:[0,100]}),a.jsx(pg,{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:[e[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:`${e[0].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[0].value>75?"Highly creative and curious":e[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:[e[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:`${e[1].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[1].value>75?"Highly organized and responsible":e[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:[e[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:`${e[2].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[2].value>75?"Highly sociable and outgoing":e[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:[e[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:`${e[3].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[3].value>75?"Highly cooperative and compassionate":e[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:[e[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:`${e[4].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[4].value>75?"Highly sensitive and prone to stress":e[4].value>50?"Moderately reactive to challenges":"Emotionally stable and resilient"})]})]})]})]})})}function EDe({persona:t}){var r;const e=(i,o)=>{const s=[a.jsx(DX,{className:"sidebar-icon"},"grid"),a.jsx(GX,{className:"sidebar-icon"},"smartphone"),a.jsx(MX,{className:"sidebar-icon"},"laptop"),a.jsx(IX,{className:"sidebar-icon"},"grid2x2")];return s[o%s.length]},n=()=>t.scenarioType?t.scenarioType:"Life Scenarios";return a.jsx(ct,{children:a.jsxs(jt,{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=t.scenarios)==null?void 0:r.map((i,o)=>a.jsx("div",{className:"bg-slate-50 p-4 rounded-lg border",children:a.jsxs("div",{className:"sidebar-section",children:[e(i,o),a.jsxs("div",{children:[a.jsxs("h4",{className:"font-medium text-sm mb-2",children:["Scenario ",o+1]}),a.jsx("p",{className:"text-sm",children:i})]})]})},o))})]})})}function NDe(){const t=Xn();return a.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:a.jsxs(ct,{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(te,{onClick:()=>t("/synthetic-users"),children:"Return to Personas"})]})})}function Rt({className:t,...e}){return a.jsx("div",{className:Pe("animate-pulse rounded-md bg-muted",t),...e})}function TDe(){return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(aa,{}),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(Rt,{className:"absolute left-0 top-0 h-10 w-20"}),a.jsx(Rt,{className:"h-8 w-48 mx-auto"}),a.jsx(Rt,{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(ct,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx(Rt,{className:"h-16 w-16 rounded-full"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Rt,{className:"h-6 w-32 mb-2"}),a.jsx(Rt,{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(Rt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Rt,{className:"h-4 w-20 mb-2"}),a.jsx(Rt,{className:"h-3 w-40 mb-1"}),a.jsx(Rt,{className:"h-3 w-36"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Rt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Rt,{className:"h-4 w-16 mb-2"}),a.jsx(Rt,{className:"h-3 w-32"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Rt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Rt,{className:"h-4 w-16 mb-2"}),a.jsx(Rt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Rt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Rt,{className:"h-4 w-12 mb-2"}),a.jsx(Rt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(Rt,{className:"h-4 w-32 mb-3"}),a.jsx("div",{className:"space-y-3",children:[...Array(4)].map((t,e)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx(Rt,{className:"h-3 w-24"}),a.jsx(Rt,{className:"h-3 w-8"})]}),a.jsx(Rt,{className:"h-1.5 w-full rounded-full"})]},e))})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(Rt,{className:"h-4 w-36 mb-3"}),a.jsx("div",{className:"space-y-2",children:[...Array(3)].map((t,e)=>a.jsxs("div",{className:"flex items-center",children:[a.jsx(Rt,{className:"h-4 w-4 mr-2"}),a.jsx(Rt,{className:"h-3 w-40"})]},e))})]})]})]})}),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(Rt,{className:"h-10 w-full"}),a.jsx(Rt,{className:"h-10 w-full"}),a.jsx(Rt,{className:"h-10 w-full"})]}),a.jsx(ct,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(Rt,{className:"h-6 w-48"}),a.jsx(Rt,{className:"h-4 w-full"}),a.jsx(Rt,{className:"h-4 w-full"}),a.jsx(Rt,{className:"h-4 w-3/4"}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(Rt,{className:"h-6 w-32"}),a.jsx(Rt,{className:"h-4 w-full"}),a.jsx(Rt,{className:"h-4 w-full"}),a.jsx(Rt,{className:"h-4 w-2/3"})]}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(Rt,{className:"h-6 w-40"}),a.jsx(Rt,{className:"h-4 w-full"}),a.jsx(Rt,{className:"h-4 w-full"}),a.jsx(Rt,{className:"h-4 w-5/6"})]})]})})]})]})]})]})}function PDe({message:t,onLoginSuccess:e,onCancel:n}){const{login:r}=cu(),i=Xn(),[o,s]=y.useState("user"),[l,c]=y.useState("pass"),[u,d]=y.useState(!1),f=async()=>{if(!o||!l){ie.error("Please enter username and password");return}d(!0);try{await r(o,l),ie.success("Login successful"),e&&e()}catch(p){console.error("Login error:",p),ie.error("Login failed",{description:"Please check your credentials and try again"})}finally{d(!1)}},h=()=>{n?n():i("/synthetic-users")};return a.jsxs(ct,{className:"max-w-md mx-auto shadow-lg",children:[a.jsxs(pi,{children:[a.jsx(Mi,{children:"Login Required"}),a.jsx(SN,{children:t||"You need to log in to save personas to the database"})]}),a.jsxs(jt,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(to,{htmlFor:"username",children:"Username"}),a.jsx(Dt,{id:"username",placeholder:"Username",value:o,onChange:p=>s(p.target.value),disabled:u})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(to,{htmlFor:"password",children:"Password"}),a.jsx(Dt,{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(CN,{className:"flex justify-between",children:[a.jsx(te,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(te,{onClick:f,disabled:u,children:u?a.jsxs(a.Fragment,{children:[a.jsx(ws,{className:"h-4 w-4 mr-2 animate-spin"}),"Logging in..."]}):"Login"})]})]})}function kDe({persona:t,onSave:e,onCancel:n}){var j,k,P,I,E,R,L,V,$,z,M,U,W,X,re,xe;const r={...t,education:t.education||"",interests:t.interests||"",brandLoyalty:t.brandLoyalty||0,priceConsciousness:t.priceConsciousness||0,environmentalConcern:t.environmentalConcern||0,hasPurchasingPower:t.hasPurchasingPower||!1,hasChildren:t.hasChildren||!1,goals:t.goals||[],frustrations:t.frustrations||[],motivations:t.motivations||[],scenarios:t.scenarios||[],oceanTraits:t.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:t.thinkFeelDo||{thinks:[],feels:[],does:[]}},[i,o]=y.useState(r),[s,l]=y.useState(!1),[c,u]=y.useState(!1),[d,f]=y.useState(null);y.useState(!1);const{isAuthenticated:h,token:p}=cu();y.useEffect(()=>{(async()=>{c&&h&&p&&(u(!1),d&&await _())})()},[h,p,c]);const g=(F,fe)=>{o(oe=>({...oe,[F]:fe}))},m=(F,fe)=>{o(oe=>({...oe,oceanTraits:{...oe.oceanTraits,[F]:fe}}))},v=F=>{o(fe=>({...fe,[F]:[...fe[F]||[],""]}))},b=(F,fe,oe)=>{o(de=>{const Re=[...de[F]||[]];return Re[fe]=oe,{...de,[F]:Re}})},x=(F,fe)=>{o(oe=>{const de=[...oe[F]||[]];return de.splice(fe,1),{...oe,[F]:de}})},w=(F,fe,oe)=>{o(de=>{const Re={...de.thinkFeelDo},pe=[...Re[F]||[]];return pe[fe]=oe,Re[F]=pe,{...de,thinkFeelDo:Re}})},S=F=>{o(fe=>{var de;const oe={...fe.thinkFeelDo,[F]:[...((de=fe.thinkFeelDo)==null?void 0:de[F])||[],""]};return{...fe,thinkFeelDo:oe}})},C=(F,fe)=>{o(oe=>{const de={...oe.thinkFeelDo},Re=[...de[F]||[]];return Re.splice(fe,1),de[F]=Re,{...oe,thinkFeelDo:de}})},A=()=>{d&&(ie.error("Login canceled - Persona changes not saved"),u(!1),f(null),n())},_=async()=>{if(d){l(!0);try{const F={...d};delete F._id,delete F.isDbPersona;const fe=await kr.create(F),oe={...d,id:fe.data._id||fe.data.id,_id:fe.data._id||fe.data.id,isDbPersona:!0};ie.success("Persona saved to database successfully"),u(!1),f(null),e(oe)}catch(F){console.error("Error saving after login:",F),ie.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(PDe,{message:"Login is required to save your persona to the database",onLoginSuccess:_,onCancel:A})]}):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(te,{variant:"ghost",onClick:n,className:"mr-2",children:a.jsx(Sp,{className:"h-5 w-5"})}),a.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Edit Persona"})]}),a.jsxs(te,{onClick:async()=>{l(!0);try{const F=i._id||i.id,fe={...i};fe._id&&delete fe._id,delete fe.isDbPersona;let oe;if(F&&typeof F=="string"&&F.startsWith("local-")){console.log("Creating new persona instead of updating local ID"),oe=await kr.create(fe),ie.success("Persona saved to database");const de={...i,id:oe.data._id||oe.data.id,_id:oe.data._id||oe.data.id,isDbPersona:!0};e(de)}else if(F){oe=await kr.update(F,fe),ie.success("Persona updated successfully");const de={...i,isDbPersona:!0};e(de)}else{oe=await kr.create(fe);const de={...i,id:oe.data._id||oe.data.id,_id:oe.data._id||oe.data.id,isDbPersona:!0};ie.success("Persona created successfully"),e(de)}}catch(F){console.error("Error saving persona:",F),F.response&&F.response.status===401?h&&p?(console.log("Auth error despite having token - token likely invalid"),ie.error("Authentication error - saving locally instead"),e(i)):(f(i),u(!0)):(ie.error("Failed to save persona"),e(i))}finally{l(!1)}},disabled:s,children:[s?a.jsx(ws,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(qj,{className:"h-4 w-4 mr-2"}),s?"Saving...":"Save Changes"]})]}),a.jsxs(Kl,{defaultValue:"basic",children:[a.jsxs(Ea,{className:"grid w-full grid-cols-6",children:[a.jsx(on,{value:"basic",children:"Basic"}),a.jsx(on,{value:"cooper",children:"Cooper"}),a.jsx(on,{value:"personality",children:"Personality"}),a.jsx(on,{value:"demographics",children:"Demographics"}),a.jsx(on,{value:"lifestyle",children:"Lifestyle"}),a.jsx(on,{value:"extended",children:"Extended"})]}),a.jsx(sn,{value:"basic",className:"mt-6",children:a.jsx(ct,{children:a.jsx(jt,{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(Dt,{value:i.name||"",onChange:F=>g("name",F.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(kn,{value:i.age||"",onValueChange:F=>g("age",F),children:[a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select age range"})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"18-24",children:"18-24"}),a.jsx(ce,{value:"25-34",children:"25-34"}),a.jsx(ce,{value:"35-44",children:"35-44"}),a.jsx(ce,{value:"45-54",children:"45-54"}),a.jsx(ce,{value:"55-64",children:"55-64"}),a.jsx(ce,{value:"65+",children:"65+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Gender"}),a.jsxs(kn,{value:i.gender||"",onValueChange:F=>g("gender",F),children:[a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select gender"})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"Male",children:"Male"}),a.jsx(ce,{value:"Female",children:"Female"}),a.jsx(ce,{value:"Non-binary",children:"Non-binary"}),a.jsx(ce,{value:"Other",children:"Other"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Occupation"}),a.jsx(Dt,{value:i.occupation||"",onChange:F=>g("occupation",F.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Education"}),a.jsxs(kn,{value:i.education||"",onValueChange:F=>g("education",F),children:[a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select education level"})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"High School",children:"High School"}),a.jsx(ce,{value:"Some College",children:"Some College"}),a.jsx(ce,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(ce,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(ce,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(ce,{value:"PhD",children:"PhD"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Location"}),a.jsx(Dt,{value:i.location||"",onChange:F=>g("location",F.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Ethnicity (Optional)"}),a.jsxs(kn,{value:i.ethnicity||"",onValueChange:F=>g("ethnicity",F),children:[a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select ethnicity"})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"white",children:"White"}),a.jsx(ce,{value:"black",children:"Black"}),a.jsx(ce,{value:"asian",children:"Asian"}),a.jsx(ce,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(ce,{value:"native-american",children:"Native American"}),a.jsx(ce,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(ce,{value:"mixed",children:"Mixed"}),a.jsx(ce,{value:"other",children:"Other"}),a.jsx(ce,{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(lt,{value:i.personality||"",onChange:F=>g("personality",F.target.value),rows:3})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Interests"}),a.jsx(lt,{value:i.interests||"",onChange:F=>g("interests",F.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(lr,{value:[i.techSavviness],onValueChange:F=>g("techSavviness",F[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(lr,{value:[i.brandLoyalty||0],onValueChange:F=>g("brandLoyalty",F[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(lr,{value:[i.priceConsciousness||0],onValueChange:F=>g("priceConsciousness",F[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(lr,{value:[i.environmentalConcern||0],onValueChange:F=>g("environmentalConcern",F[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(qp,{checked:i.hasPurchasingPower||!1,onCheckedChange:F=>g("hasPurchasingPower",F)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-sm font-medium",children:"Has Children"}),a.jsx(qp,{checked:i.hasChildren||!1,onCheckedChange:F=>g("hasChildren",F)})]})]})]})]})})})}),a.jsxs(sn,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(ct,{children:a.jsxs(jt,{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((F,fe)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:F||"",onChange:oe=>b("goals",fe,oe.target.value)}),a.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x("goals",fe),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},fe)),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>v("goals"),className:"mt-2",children:[a.jsx(Tr,{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((F,fe)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:F||"",onChange:oe=>b("frustrations",fe,oe.target.value)}),a.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x("frustrations",fe),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},fe)),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>v("frustrations"),className:"mt-2",children:[a.jsx(Tr,{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((F,fe)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:F||"",onChange:oe=>b("motivations",fe,oe.target.value)}),a.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x("motivations",fe),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},fe)),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>v("motivations"),className:"mt-2",children:[a.jsx(Tr,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(ct,{children:a.jsxs(jt,{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"}),(((j=i.thinkFeelDo)==null?void 0:j.thinks)||[]).map((F,fe)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:F||"",onChange:oe=>w("thinks",fe,oe.target.value)}),a.jsx(te,{variant:"ghost",size:"icon",onClick:()=>C("thinks",fe),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},fe)),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>S("thinks"),className:"mt-2",children:[a.jsx(Tr,{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"}),(((k=i.thinkFeelDo)==null?void 0:k.feels)||[]).map((F,fe)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:F||"",onChange:oe=>w("feels",fe,oe.target.value)}),a.jsx(te,{variant:"ghost",size:"icon",onClick:()=>C("feels",fe),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},fe)),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>S("feels"),className:"mt-2",children:[a.jsx(Tr,{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=i.thinkFeelDo)==null?void 0:P.does)||[]).map((F,fe)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:F||"",onChange:oe=>w("does",fe,oe.target.value)}),a.jsx(te,{variant:"ghost",size:"icon",onClick:()=>C("does",fe),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},fe)),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>S("does"),className:"mt-2",children:[a.jsx(Tr,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(ct,{children:a.jsxs(jt,{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(Dt,{value:i.scenarioType||"",onChange:F=>g("scenarioType",F.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((F,fe)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(lt,{value:F||"",onChange:oe=>b("scenarios",fe,oe.target.value),rows:2}),a.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x("scenarios",fe),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},fe)),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>v("scenarios"),className:"mt-2",children:[a.jsx(Tr,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})})]}),a.jsx(sn,{value:"personality",className:"mt-6",children:a.jsx(ct,{children:a.jsxs(jt,{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=i.oceanTraits)==null?void 0:I.openness)||50,"%"]})]}),a.jsx(lr,{value:[((E=i.oceanTraits)==null?void 0:E.openness)||50],onValueChange:F=>m("openness",F[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:[((R=i.oceanTraits)==null?void 0:R.conscientiousness)||50,"%"]})]}),a.jsx(lr,{value:[((L=i.oceanTraits)==null?void 0:L.conscientiousness)||50],onValueChange:F=>m("conscientiousness",F[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:[((V=i.oceanTraits)==null?void 0:V.extraversion)||50,"%"]})]}),a.jsx(lr,{value:[(($=i.oceanTraits)==null?void 0:$.extraversion)||50],onValueChange:F=>m("extraversion",F[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:[((z=i.oceanTraits)==null?void 0:z.agreeableness)||50,"%"]})]}),a.jsx(lr,{value:[((M=i.oceanTraits)==null?void 0:M.agreeableness)||50],onValueChange:F=>m("agreeableness",F[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:[((U=i.oceanTraits)==null?void 0:U.neuroticism)||50,"%"]})]}),a.jsx(lr,{value:[((W=i.oceanTraits)==null?void 0:W.neuroticism)||50],onValueChange:F=>m("neuroticism",F[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(sn,{value:"demographics",className:"mt-6",children:a.jsx(ct,{children:a.jsxs(jt,{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(kn,{value:i.socialGrade||"",onValueChange:F=>g("socialGrade",F),children:[a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select social grade"})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"A",children:"A - Higher managerial"}),a.jsx(ce,{value:"B",children:"B - Intermediate managerial"}),a.jsx(ce,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(ce,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(ce,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(ce,{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(kn,{value:i.householdIncome||"",onValueChange:F=>g("householdIncome",F),children:[a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select income range"})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"Under $25k",children:"Under $25,000"}),a.jsx(ce,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(ce,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(ce,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(ce,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(ce,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(ce,{value:"Over $250k",children:"Over $250,000"}),a.jsx(ce,{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(kn,{value:i.householdComposition||"",onValueChange:F=>g("householdComposition",F),children:[a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select household type"})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"Single person",children:"Single person"}),a.jsx(ce,{value:"Couple without children",children:"Couple without children"}),a.jsx(ce,{value:"Couple with children",children:"Couple with children"}),a.jsx(ce,{value:"Single parent",children:"Single parent"}),a.jsx(ce,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(ce,{value:"Shared housing",children:"Shared housing"}),a.jsx(ce,{value:"Other",children:"Other"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Living Situation"}),a.jsxs(kn,{value:i.livingSituation||"",onValueChange:F=>g("livingSituation",F),children:[a.jsx(Nn,{children:a.jsx(On,{placeholder:"Select living situation"})}),a.jsxs(Tn,{children:[a.jsx(ce,{value:"Own home",children:"Own home"}),a.jsx(ce,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(ce,{value:"Rent house",children:"Rent house"}),a.jsx(ce,{value:"Live with family",children:"Live with family"}),a.jsx(ce,{value:"Student housing",children:"Student housing"}),a.jsx(ce,{value:"Assisted living",children:"Assisted living"}),a.jsx(ce,{value:"Other",children:"Other"})]})]})]})]})]})]})})}),a.jsx(sn,{value:"lifestyle",className:"mt-6",children:a.jsx(ct,{children:a.jsxs(jt,{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(lt,{value:i.mediaConsumption||"",onChange:F=>g("mediaConsumption",F.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(lt,{value:i.deviceUsage||"",onChange:F=>g("deviceUsage",F.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(lt,{value:i.shoppingHabits||"",onChange:F=>g("shoppingHabits",F.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(lt,{value:i.brandPreferences||"",onChange:F=>g("brandPreferences",F.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(lt,{value:i.communicationPreferences||"",onChange:F=>g("communicationPreferences",F.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(lt,{value:i.paymentMethods||"",onChange:F=>g("paymentMethods",F.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(lt,{value:i.purchaseBehaviour||"",onChange:F=>g("purchaseBehaviour",F.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(sn,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(ct,{children:a.jsxs(jt,{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(lt,{value:i.coreValues||"",onChange:F=>g("coreValues",F.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(lt,{value:i.lifestyleChoices||"",onChange:F=>g("lifestyleChoices",F.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(lt,{value:i.socialActivities||"",onChange:F=>g("socialActivities",F.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(lt,{value:i.categoryKnowledge||"",onChange:F=>g("categoryKnowledge",F.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(lt,{value:i.decisionInfluences||"",onChange:F=>g("decisionInfluences",F.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(lt,{value:i.painPoints||"",onChange:F=>g("painPoints",F.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(lt,{value:i.journeyContext||"",onChange:F=>g("journeyContext",F.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(lt,{value:i.keyTouchpoints||"",onChange:F=>g("keyTouchpoints",F.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(lt,{value:((X=i.selfDeterminationNeeds)==null?void 0:X.autonomy)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,autonomy:F.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(lt,{value:((re=i.selfDeterminationNeeds)==null?void 0:re.competence)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,competence:F.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(lt,{value:((xe=i.selfDeterminationNeeds)==null?void 0:xe.relatedness)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,relatedness:F.target.value}),rows:2,placeholder:"Need for connection and belonging"})]})]})]})]})]})}),a.jsx(ct,{children:a.jsx(jt,{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((F,fe)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Dt,{value:F,onChange:oe=>b("fears",fe,oe.target.value),placeholder:"Enter a fear or concern"}),a.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x("fears",fe),children:a.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]},fe)),a.jsxs(te,{variant:"outline",size:"sm",onClick:()=>v("fears"),className:"mt-2",children:[a.jsx(Tr,{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(lt,{value:i.narrative||"",onChange:F=>g("narrative",F.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(lt,{value:i.additionalInformation||"",onChange:F=>g("additionalInformation",F.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 ODe(){const{id:t}=Vj(),e=Ei(),n=Xn(),{navigationState:r,clearNavigationState:i}=N0(),[o,s]=y.useState(void 0),[l,c]=y.useState(!1),[u,d]=y.useState(!1),[f,h]=y.useState(!0);return y.useEffect(()=>{if(!t){h(!1);return}let m=!0;const b=new URLSearchParams(e.search).get("fromReview")==="true";return c(b),h(!0),(async()=>{try{const w=t.startsWith("local-")?t.substring(6):t,S=await kr.getById(w);if(S&&S.data){const C=S.data;if(m){console.log("Found persona in database:",C),s({...C,id:C.id||C._id,isDbPersona:!0}),h(!1);return}}console.error("Could not find persona with id:",t),m&&(s(void 0),h(!1),ie.error("Persona not found"))}catch(w){console.error("Error fetching persona:",w),m&&(s(void 0),h(!1),ie.error("Failed to load persona details"))}})(),()=>{m=!1}},[t,e.search]),{currentPersona:o,isEditing:u,isFromReview:l,isLoading:f,setIsEditing:d,handleGoBack:()=>{r.previousRoute&&r.previousRoute.startsWith("/focus-groups/")&&r.focusGroupId?n(`/focus-groups/${r.focusGroupId}`):r.previousRoute==="/focus-groups"&&r.focusGroupTab?r.isNewFocusGroup?n(`/focus-groups?mode=create&tab=${r.focusGroupTab}`):r.focusGroupId?n(`/focus-groups?mode=edit&id=${r.focusGroupId}&tab=${r.focusGroupTab}`):n("/focus-groups?mode=create&tab=participants"):n(l?"/synthetic-users?mode=create&tab=ai&step=review":"/synthetic-users")},handleSaveEdit:async m=>{try{d(!1);const v=m.isDbPersona||t&&t.length===24&&/^[0-9a-f]{24}$/i.test(t),b={...m};if(b._id&&delete b._id,delete b.isDbPersona,v&&t&&t.length===24&&/^[0-9a-f]{24}$/i.test(t)){const x=await kr.update(t,b);console.log("Updated persona in database:",x);const w={...m,isDbPersona:!0};s(w),ie.success("Persona updated in database successfully")}else{const x=await kr.create(b);console.log("Created new persona in database:",x.data);const w={...m,id:x.data._id||x.data.id,_id:x.data._id||x.data.id,isDbPersona:!0};s(w),ie.success("Persona saved to database successfully")}}catch(v){return console.error("Error saving persona:",v),v.response&&v.response.status===401?ie.error("Authentication error - Please log in to save personas"):v.response&&v.response.status===404?ie.error("API endpoint not found - Database service may be unavailable"):ie.error("Failed to save persona to database: "+(v.message||"Unknown error")),!1}return!0}}}function LD(){var f;const{currentPersona:t,isEditing:e,isFromReview:n,isLoading:r,setIsEditing:i,handleGoBack:o,handleSaveEdit:s}=ODe(),{navigationState:l}=N0(),[c,u]=y.useState("");y.useEffect(()=>{var h;l.focusGroupId&&((h=l.previousRoute)!=null&&h.startsWith("/focus-groups/"))&&(async()=>{var g;try{const m=await _t.getById(l.focusGroupId);(g=m==null?void 0:m.data)!=null&&g.name&&u(m.data.name)}catch(m){console.error("Error fetching focus group name:",m)}})()},[l.focusGroupId,l.previousRoute]);const d=((f=l.previousRoute)==null?void 0:f.startsWith("/focus-groups/"))&&l.focusGroupId;return r?a.jsx(TDe,{}):t?a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(aa,{}),a.jsx("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:e?a.jsx(kDe,{persona:t,onSave:s,onCancel:()=>i(!1)}):a.jsxs(a.Fragment,{children:[d&&a.jsx("div",{className:"mb-4",children:a.jsx(bK,{children:a.jsxs(wK,{children:[a.jsx(Dv,{children:a.jsxs(E_,{href:"/focus-groups",className:"flex items-center",children:[a.jsx(py,{className:"h-4 w-4 mr-1"}),"Focus Groups"]})}),a.jsx(N_,{}),a.jsx(Dv,{children:a.jsxs(E_,{href:`/focus-groups/${l.focusGroupId}`,className:"flex items-center",children:[a.jsx(Cr,{className:"h-4 w-4 mr-1"}),c||"Focus Group Session"]})}),a.jsx(N_,{}),a.jsx(Dv,{children:a.jsxs(SK,{className:"flex items-center",children:[a.jsx(Ap,{className:"h-4 w-4 mr-1"}),(t==null?void 0:t.name)||"Participant"]})})]})})}),a.jsxs("div",{className:"flex items-center mb-6 relative",children:[a.jsx(te,{variant:"ghost",onClick:o,className:"absolute left-0 top-0 flex items-center",children:a.jsx(Sp,{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(te,{onClick:()=>i(!0),className:"absolute right-0 top-0",children:[a.jsx(WX,{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(ADe,{persona:t})}),a.jsx("div",{className:"lg:col-span-2",children:a.jsxs(Kl,{defaultValue:"cooper-profile",children:[a.jsxs(Ea,{className:"grid w-full grid-cols-3",children:[a.jsx(on,{value:"cooper-profile",children:"Cooper Profile"}),a.jsx(on,{value:"personality",children:"Personality"}),a.jsx(on,{value:"scenarios",children:"Scenarios"})]}),a.jsx(sn,{value:"cooper-profile",className:"mt-6",children:a.jsx(_De,{persona:t})}),a.jsx(sn,{value:"personality",className:"mt-6",children:a.jsx(jDe,{persona:t})}),a.jsx(sn,{value:"scenarios",className:"mt-6",children:a.jsx(EDe,{persona:t})})]})})]})]})})]}):a.jsx(NDe,{})}const IDe=Oe.object({username:Oe.string().min(3,"Username must be at least 3 characters"),password:Oe.string().min(4,"Password must be at least 4 characters")});function RDe(){var h;const t=Xn(),e=Ei(),{login:n,loginWithMicrosoft:r,isAuthenticated:i,isMsalLoading:o}=cu(),[s,l]=y.useState(!1),c=((h=e.state)==null?void 0:h.from)||"/";console.log("Login page - destination path:",c),y.useEffect(()=>{i&&(console.log("User already authenticated, redirecting from login page"),t("/",{replace:!0}))},[i,t]);const u=f0({resolver:h0(IDe),defaultValues:{username:"",password:""}});async function d(p){l(!0);try{await n(p.username,p.password)?(console.log("Login successful, received token, navigating to:",c),t(c,{replace:!0})):(console.error("Login succeeded but no token received"),l(!1))}catch(g){console.error("Login error in form handler:",g),l(!1)}}async function f(){try{await r(),console.log("Microsoft login successful, navigating to:",c),t(c,{replace:!0})}catch(p){console.error("Microsoft login error in form handler:",p)}}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(ct,{className:"w-full max-w-md",children:[a.jsxs(pi,{className:"space-y-1",children:[a.jsx(Mi,{className:"text-2xl font-bold text-center",children:"Sign In"}),a.jsx(SN,{className:"text-center",children:"Enter your credentials to access your account"})]}),a.jsxs(jt,{children:[a.jsx("div",{className:"mb-6",children:a.jsx(te,{type:"button",variant:"outline",className:"w-full bg-[#0078d4] hover:bg-[#106ebe] text-white border-[#0078d4] hover:border-[#106ebe]",onClick:f,disabled:s||o,children:o?a.jsxs(a.Fragment,{children:[a.jsx(ws,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing in with Microsoft..."]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{className:"mr-2 h-4 w-4",viewBox:"0 0 21 21",fill:"currentColor",children:[a.jsx("path",{d:"M10 0H0v10h10V0z"}),a.jsx("path",{d:"M21 0H11v10h10V0z"}),a.jsx("path",{d:"M10 11H0v10h10V11z"}),a.jsx("path",{d:"M21 11H11v10h10V11z"})]}),"Sign in with Microsoft"]})})}),a.jsxs("div",{className:"relative mb-6",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("div",{className:"w-full border-t border-gray-200"})}),a.jsx("div",{className:"relative flex justify-center text-sm",children:a.jsx("span",{className:"bg-white px-2 text-gray-500 dark:bg-gray-800 dark:text-gray-400",children:"Or continue with username"})})]}),a.jsx(m0,{...u,children:a.jsxs("form",{onSubmit:u.handleSubmit(d),className:"space-y-4",children:[a.jsx(dt,{control:u.control,name:"username",render:({field:p})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Username"}),a.jsx(st,{children:a.jsx(Dt,{placeholder:"Enter your username",...p,disabled:s,autoComplete:"username"})}),a.jsx(at,{})]})}),a.jsx(dt,{control:u.control,name:"password",render:({field:p})=>a.jsxs(it,{children:[a.jsx(ot,{children:"Password"}),a.jsx(st,{children:a.jsx(Dt,{placeholder:"Enter your password",type:"password",...p,disabled:s,autoComplete:"current-password"})}),a.jsx(at,{})]})}),a.jsx(te,{type:"submit",className:"w-full",disabled:s||o,children:s?"Signing in...":"Sign In"})]})})]}),a.jsxs(CN,{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&&!o&&a.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[a.jsx(te,{variant:"outline",onClick:()=>t("/",{replace:!0}),className:"mt-2",children:"Return to Home"}),a.jsx(te,{variant:"link",onClick:()=>{localStorage.setItem("offline_mode","true");const p={username:"guest",email:"guest@example.com",role:"user"};localStorage.setItem("auth_token","offline-mode-token"),localStorage.setItem("user",JSON.stringify(p)),Ye.success("Offline mode activated",{description:"Using demo account with limited functionality"}),t("/",{replace:!0})},className:"text-sm text-gray-500",children:"Use offline mode"})]})]})]})})}function ju({children:t}){const{isAuthenticated:e,isLoading:n}=cu(),r=Ei();return console.log("ProtectedRoute check:",{isAuthenticated:e,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"})}):e?(console.log("User is authenticated, showing protected content"),a.jsx(a.Fragment,{children:t})):(console.log("Not authenticated, redirecting to login"),a.jsx(s4,{to:"/login",state:{from:r.pathname},replace:!0}))}const CK=new aN(kre);CK.initialize().catch(t=>{console.error("MSAL initialization error:",t)});function MDe({children:t}){return a.jsx(Tre,{instance:CK,children:t})}const DDe=new xQ,$De=()=>a.jsx(wQ,{client:DDe,children:a.jsx(vX,{basename:"/semblance",children:a.jsx(MDe,{children:a.jsx(Ire,{children:a.jsx(Fce,{children:a.jsxs(QY,{children:[a.jsx(Aq,{}),a.jsxs(cX,{children:[a.jsx(wo,{path:"/",element:a.jsx(Mre,{})}),a.jsx(wo,{path:"/login",element:a.jsx(RDe,{})}),a.jsx(wo,{path:"/synthetic-users",element:a.jsx(ju,{children:a.jsx(Lce,{})})}),a.jsx(wo,{path:"/synthetic-users/:id",element:a.jsx(ju,{children:a.jsx(LD,{})})}),a.jsx(wo,{path:"/personas/:id",element:a.jsx(ju,{children:a.jsx(LD,{})})}),a.jsx(wo,{path:"/focus-groups",element:a.jsx(ju,{children:a.jsx(Gce,{})})}),a.jsx(wo,{path:"/focus-groups/:id",element:a.jsx(ju,{children:a.jsx(hDe,{})})}),a.jsx(wo,{path:"/dashboard",element:a.jsx(ju,{children:a.jsx(CDe,{})})}),a.jsx(wo,{path:"/old-path",element:a.jsx(s4,{to:"/",replace:!0})}),a.jsx(wo,{path:"*",element:a.jsx(Dre,{})})]})]})})})})})});aF(document.getElementById("root")).render(a.jsx($De,{})); diff --git a/dist/index.html b/dist/index.html index 31e59a1f..7da1404e 100644 --- a/dist/index.html +++ b/dist/index.html @@ -7,7 +7,7 @@ - + diff --git a/src/components/FocusGroupModerator.tsx b/src/components/FocusGroupModerator.tsx index 2c940eb3..5ce792f8 100644 --- a/src/components/FocusGroupModerator.tsx +++ b/src/components/FocusGroupModerator.tsx @@ -737,6 +737,9 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved, preSele // Allow auto-save after loading is complete setTimeout(() => { isLoadingDraftRef.current = false; + // Ensure initial form state is captured after loading + const initialFormState = JSON.stringify(form.getValues()); + prevWatchedFieldsRef.current = initialFormState; }, 1000); // Give it a second to settle } }, [draftToEdit, form]); @@ -768,9 +771,12 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved, preSele if (!draftToEdit) { setTimeout(() => { isLoadingDraftRef.current = false; + // Ensure initial form state is captured for new focus groups + const initialFormState = JSON.stringify(form.getValues()); + prevWatchedFieldsRef.current = initialFormState; }, 500); // Allow initial render to complete } - }, [draftToEdit]); + }, [draftToEdit, form]); // Save Status Indicator Component @@ -854,30 +860,8 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved, preSele }); } - // Fallback to template if API fails - const guide = ` -# Discussion Guide: ${values.focusGroupName} - -## Introduction (5 minutes) -${sampleGuide.introduction} - -## Warm-up Questions (10 minutes) -${sampleGuide.warmup} - -## ${values.discussionTopics.split(',')[0]} Exploration (15 minutes) -${sampleGuide.exploration} - -## Creative Testing (20 minutes) -${sampleGuide.creative} -${values.creativeAssets && values.creativeAssets.length > 0 ? `We'll be reviewing ${values.creativeAssets.length} creative assets.` : ''} - -## Conclusion (10 minutes) -${sampleGuide.conclusion} - -## Research Brief Context -${values.researchBrief} - `; - return guide; + // Don't provide fallback template - throw the error to prevent showing dummy guide + throw error; } // Note: Don't set isGenerating to false here - let the progress bar handle it }; @@ -923,7 +907,7 @@ ${values.researchBrief} formData.append('assets', file); }); - const uploadResponse = await focusGroupsApi.uploadAssets(focusGroupId, formData); + const uploadResponse = await focusGroupsApi.uploadAssets(focusGroupId, formData, true); const uploadResult = uploadResponse.data; console.log("Assets uploaded successfully:", uploadResult); @@ -989,48 +973,61 @@ ${values.researchBrief} } } - // Generate discussion guide based on form input (after database is updated) - const guide = await generateDiscussionGuide(values, focusGroupId); - setDiscussionGuide(guide); - - // Update the focus group with the discussion guide try { - const updateData = { - name: values.focusGroupName, - status: 'draft', - participants: selectedParticipants, - participants_count: selectedParticipants.length, - date: new Date().toISOString(), - 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, - reasoning_effort: values.reasoning_effort, - verbosity: values.verbosity, - discussionGuide: guide - }; + // Generate discussion guide based on form input (after database is updated) + const guide = await generateDiscussionGuide(values, focusGroupId); + setDiscussionGuide(guide); - await focusGroupsApi.update(focusGroupId, updateData); - console.log("Focus group updated with discussion guide"); + // Update the focus group with the discussion guide + try { + const updateData = { + name: values.focusGroupName, + status: 'draft', + participants: selectedParticipants, + participants_count: selectedParticipants.length, + date: new Date().toISOString(), + 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, + reasoning_effort: values.reasoning_effort, + verbosity: values.verbosity, + discussionGuide: guide + }; + + await focusGroupsApi.update(focusGroupId, updateData); + console.log("Focus group updated with discussion guide"); + + toast.success("Progress saved as draft", { + description: "Your focus group setup has been automatically saved", + }); + } catch (error) { + console.error("Failed to update focus group with discussion guide:", error); + toast.error("Failed to save draft", { + description: "Discussion guide generated, but draft save failed", + }); + } - toast.success("Progress saved as draft", { - description: "Your focus group setup has been automatically saved", + // Move to review tab after successful generation + setActiveTab('review'); + + toast.success("Discussion guide generated", { + description: "Review and edit before proceeding", }); - } catch (error) { - console.error("Failed to update focus group with discussion guide:", error); - toast.error("Failed to save draft", { - description: "Discussion guide generated, but draft save failed", + + } catch (guideError) { + console.error("Discussion guide generation failed:", guideError); + // Don't set discussion guide or move to review tab + // Show error message with instruction to go back to setup tab and try again + toast.error("Discussion guide generation failed", { + description: "Please go back to the setup tab and try generating again. Check your inputs and try a different AI model if the issue persists.", + duration: 8000, // Show longer so user can read the instruction }); + // Stay on current tab (setup) so user can try again + return; } - // Move to review tab after successful generation - setActiveTab('review'); - - toast.success("Discussion guide generated", { - description: "Review and edit before proceeding", - }); - } catch (error) { console.error("Error in focus group creation flow:", error); toast.error("Focus group creation failed", { @@ -1644,7 +1641,14 @@ Controls how much time GPT-5 spends thinking before responding /> ) : (
- No discussion guide generated yet. Complete the setup and click "Generate Discussion Guide" to create one. + {guideGenerationError ? ( +
+

Discussion guide generation failed.

+

Go back to the Setup tab and try generating again. Check your inputs and try a different AI model if the issue persists.

+
+ ) : ( +

No discussion guide generated yet. Complete the setup and click "Generate Discussion Guide" to create one.

+ )}
)} diff --git a/src/components/ai-recruiter/AIRecruiterForm.tsx b/src/components/ai-recruiter/AIRecruiterForm.tsx index 64e8033e..1bf7f22e 100644 --- a/src/components/ai-recruiter/AIRecruiterForm.tsx +++ b/src/components/ai-recruiter/AIRecruiterForm.tsx @@ -399,6 +399,7 @@ export default function AIRecruiterForm({ onSubmit, isGenerating }: AIRecruiterF Gemini 2.5 Pro GPT-4.1 + GPT-5 diff --git a/src/components/focus-group-session/DiscussionPanel.tsx b/src/components/focus-group-session/DiscussionPanel.tsx index eda9914b..0d0e69d9 100644 --- a/src/components/focus-group-session/DiscussionPanel.tsx +++ b/src/components/focus-group-session/DiscussionPanel.tsx @@ -1268,8 +1268,8 @@ const DiscussionPanel = ({ className={`hover-transition ${autoScroll ? 'bg-blue-50 text-blue-600 hover:bg-blue-100' : ''}`} title={autoScroll ? 'Disable auto-scroll' : 'Enable auto-scroll'} > - - {autoScroll && 'Auto-scroll'} + + Auto-scroll diff --git a/src/lib/api.ts b/src/lib/api.ts index 36f73d5b..d0bcbbc2 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -459,13 +459,19 @@ export const focusGroupsApi = { api.delete(`/focus-groups/${focusGroupId}/notes/${noteId}`), // Asset management endpoints - uploadAssets: (focusGroupId: string, formData: FormData) => - api.post(`/focus-groups/${focusGroupId}/assets`, formData, { + uploadAssets: (focusGroupId: string, formData: FormData, replace?: boolean) => { + // Add replace flag to form data if specified + if (replace === true) { + formData.append('replace', 'true'); + } + + return api.post(`/focus-groups/${focusGroupId}/assets`, formData, { headers: { 'Content-Type': 'multipart/form-data' }, timeout: 120000 // 2 minutes for file upload - }), + }); + }, getAssets: (focusGroupId: string) => api.get(`/focus-groups/${focusGroupId}/assets`),