@wildo-ai/application-creation-workbench 1.1.12 → 1.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.vite/manifest.json +539 -539
- package/dist/assets/{ChartEmptyState-BC4PowrY.js → ChartEmptyState-bpvSJ-cb.js} +1 -1
- package/dist/assets/ChartLoadingSkeleton-njpdx6Xq.js +1 -0
- package/dist/assets/{ChartView-Dxhrm4ZQ.js → ChartView-Qqvf_azZ.js} +2 -2
- package/dist/assets/ChartWidget-BfFSlmcK.js +5 -0
- package/dist/assets/{abnfDiagram-VCTEODGH-DAniiSne.js → abnfDiagram-VCTEODGH-RkKb7ovy.js} +1 -1
- package/dist/assets/{af-6ARmQGcy.js → af-Bk6Hmdgu.js} +1 -1
- package/dist/assets/{ar-txED5dLR.js → ar-BjZAek7V.js} +1 -1
- package/dist/assets/{architectureDiagram-5GKGNRK7-B3fuQHXi.js → architectureDiagram-5GKGNRK7-Cpy0QsiS.js} +1 -1
- package/dist/assets/badge-tone-C1lf98-p.js +5 -0
- package/dist/assets/{bg-CeKEO9Mk.js → bg-DwzfvwBN.js} +1 -1
- package/dist/assets/{blockDiagram-I7D4REHJ-DNUQ2an8.js → blockDiagram-I7D4REHJ-DPWa_xRc.js} +1 -1
- package/dist/assets/{bn-CX09B8uK.js → bn-Ja9jaMTl.js} +1 -1
- package/dist/assets/{c4Diagram-7LVT6UL2-D1fhMmVz.js → c4Diagram-7LVT6UL2-Bw5u3oez.js} +1 -1
- package/dist/assets/{ca-Bhlp9MKF.js → ca-DcbVfECQ.js} +1 -1
- package/dist/assets/channel-DNblg53t.js +1 -0
- package/dist/assets/{chunk-4HAMMTFA-Bujib7vW.js → chunk-4HAMMTFA-C1vaphAY.js} +1 -1
- package/dist/assets/{chunk-75Z2AOVW-3MyZWqz7.js → chunk-75Z2AOVW-20u1rKqW.js} +1 -1
- package/dist/assets/{chunk-DU6HZSFF-D9yFJR5s.js → chunk-DU6HZSFF-CU7JHG0o.js} +2 -2
- package/dist/assets/{chunk-F27PBJKO-DbSVFcZ1.js → chunk-F27PBJKO-DiphvwD7.js} +1 -1
- package/dist/assets/{chunk-GMAD6QVW-DjHRLroQ.js → chunk-GMAD6QVW-Dq2XOoJg.js} +1 -1
- package/dist/assets/{chunk-GVQU2GXP-CZSwyKRU.js → chunk-GVQU2GXP-CBXRxA1C.js} +1 -1
- package/dist/assets/{chunk-IMKFNOWR-hW5t7Qw5.js → chunk-IMKFNOWR-CfysfMZ8.js} +1 -1
- package/dist/assets/{chunk-L3NEJ4N5-Bv6xmFwR.js → chunk-L3NEJ4N5-ByuBfdXC.js} +1 -1
- package/dist/assets/{chunk-OSK3NFVY-DJUzz194.js → chunk-OSK3NFVY-SIWGDFJo.js} +1 -1
- package/dist/assets/{chunk-P2QGCYS3-7SeAsW9y.js → chunk-P2QGCYS3-DCiOi1YZ.js} +1 -1
- package/dist/assets/{chunk-POPQ4Y6H-CQNafNbB.js → chunk-POPQ4Y6H-BdHV60NS.js} +1 -1
- package/dist/assets/{chunk-PWAF6VOD-jHVX7TMJ.js → chunk-PWAF6VOD-BsKqezYC.js} +1 -1
- package/dist/assets/{chunk-SHT3W25Y-F6dBohnU.js → chunk-SHT3W25Y-NnS-qlZ0.js} +1 -1
- package/dist/assets/{chunk-SVP7TREG-CT22LVkh.js → chunk-SVP7TREG-DHHk5-nb.js} +1 -1
- package/dist/assets/{chunk-TICWLB2K-Dr-TnJTR.js → chunk-TICWLB2K-BsfGmrb3.js} +1 -1
- package/dist/assets/classDiagram-ZZMXUADV-BFJaoqij.js +1 -0
- package/dist/assets/classDiagram-v2-VYDZK3BY-BFJaoqij.js +1 -0
- package/dist/assets/{cm6-editor-zaCDXA9R.js → cm6-editor-2ff9P4C4.js} +3 -3
- package/dist/assets/{code-block-IT6T5CEO-DeiNc4QM.js → code-block-IT6T5CEO-Bephdl7e.js} +1 -1
- package/dist/assets/{context-lL4c0mdb.js → context-T13XYDZY.js} +1 -1
- package/dist/assets/{cs-ZvuhFxc7.js → cs-tnBN9HbI.js} +1 -1
- package/dist/assets/{cy-P-7_oBM6.js → cy-DJqxjV0d.js} +1 -1
- package/dist/assets/{cynefinDiagram-5FMLGOSQ-rrIzisOw.js → cynefinDiagram-5FMLGOSQ-BkjZtE8s.js} +1 -1
- package/dist/assets/{da-Ij9mguPT.js → da-Ca05BK_3.js} +1 -1
- package/dist/assets/{dagre-GXQ25YYZ-BHke2BKR.js → dagre-GXQ25YYZ-DzDsrai8.js} +1 -1
- package/dist/assets/{de-AT-pBRQu7rV.js → de-AT-BX1jIQXB.js} +1 -1
- package/dist/assets/{de-BvpvTOVk.js → de-C9jUnjyM.js} +1 -1
- package/dist/assets/{diagram-S7CK7UJ4-DSVi59-i.js → diagram-S7CK7UJ4-Cwa24pyR.js} +1 -1
- package/dist/assets/{diagram-UQ7AKVKN-Dzm3EQCI.js → diagram-UQ7AKVKN-C0onRf4Z.js} +1 -1
- package/dist/assets/{diagram-VSXAHHWV-C_Cwqxyu.js → diagram-VSXAHHWV-B8xjjT13.js} +1 -1
- package/dist/assets/{diagram-VX7I27RA-j-RbCkFh.js → diagram-VX7I27RA-CHFg3ge_.js} +1 -1
- package/dist/assets/{diagram-Z3DM3KII-eU4ZoMfW.js → diagram-Z3DM3KII-BTt-uk0J.js} +1 -1
- package/dist/assets/{dist-g1q7TkMi.js → dist-26ViD93u.js} +1 -1
- package/dist/assets/{dist-CYCtpul3.js → dist-B4XHlUdM.js} +1 -1
- package/dist/assets/{dist-Cp0QMixe.js → dist-BMz3c4XD.js} +1 -1
- package/dist/assets/{dist-BH50WQuC.js → dist-BSK9ZFAB.js} +1 -1
- package/dist/assets/{dist-DEAzYsYo.js → dist-BrKATYI_.js} +1 -1
- package/dist/assets/{dist-BIoddEoP.js → dist-C-bJB-2H.js} +1 -1
- package/dist/assets/{dist-BCKtn7dL.js → dist-C9IE-VSa.js} +1 -1
- package/dist/assets/{dist-Copqz2Zc.js → dist-CD-6W0UW.js} +1 -1
- package/dist/assets/{dist-BS1Kdsll.js → dist-CIX5O8MF.js} +1 -1
- package/dist/assets/{dist-DdLKhkto.js → dist-CKL3Vsb1.js} +1 -1
- package/dist/assets/{dist-Deso_pi0.js → dist-Cjqmi1vD.js} +1 -1
- package/dist/assets/{dist-BtHXFXvI.js → dist-Cl5h6dau.js} +1 -1
- package/dist/assets/{dist-xdVQ9O1H.js → dist-DBD6m0JS.js} +1 -1
- package/dist/assets/{dist-C4M0SV8x.js → dist-DTDoXkKw.js} +1 -1
- package/dist/assets/{dist-B4qlbkDT.js → dist-DdyVsEPF.js} +1 -1
- package/dist/assets/{dist-CIJHcnby.js → dist-DmRe1vI4.js} +1 -1
- package/dist/assets/{dist-DJw851Uo.js → dist-DxRnokOu.js} +1 -1
- package/dist/assets/{dist-BJAul1MI.js → dist-GFkidrN0.js} +1 -1
- package/dist/assets/{dist-CyL1AF6b.js → dist-QhFPi3vQ.js} +1 -1
- package/dist/assets/{dist-AwELwF0u.js → dist-UoPuPrUB.js} +1 -1
- package/dist/assets/{dist-CMt9H2Ew.js → dist-rySWqc-_.js} +1 -1
- package/dist/assets/{dist-D2x0_5Vw.js → dist-uyPo4CC0.js} +1 -1
- package/dist/assets/{dist-OAEdfO6o.js → dist-y9EDIi1P.js} +1 -1
- package/dist/assets/{ebnfDiagram-PWID7BFC-D6kpCTf2.js → ebnfDiagram-PWID7BFC-D7axqFSr.js} +1 -1
- package/dist/assets/{el-koo0pLJ9.js → el-DiE5RiPH.js} +1 -1
- package/dist/assets/{en-AU-Bfhd2HUx.js → en-AU-BWrv-wCE.js} +1 -1
- package/dist/assets/{en-CA-o4msFHUu.js → en-CA-H-IdnQXN.js} +1 -1
- package/dist/assets/{en-GB-0B3YNqmw.js → en-GB-D84jH8wH.js} +1 -1
- package/dist/assets/{erDiagram-RLTQ6QDP-C4FnvB80.js → erDiagram-RLTQ6QDP-BhfvT_iW.js} +1 -1
- package/dist/assets/{es-D3vTEBnH.js → es-vrQFTnXZ.js} +1 -1
- package/dist/assets/{esm-BI55uNP_.js → esm-CoNe2i-j.js} +1 -1
- package/dist/assets/esm-GhLumFjl.js +46 -0
- package/dist/assets/{et-CuxIGsPb.js → et-Bw_JuPH8.js} +1 -1
- package/dist/assets/{eu-m6DSB3U4.js → eu-C5I3pguf.js} +1 -1
- package/dist/assets/{fa-IR-nYH-4dE0.js → fa-IR-C4oEKL13.js} +1 -1
- package/dist/assets/{fi-BtEUoCwT.js → fi-BcLdAiF0.js} +1 -1
- package/dist/assets/flowDiagram-HODETNUW-392dI3Z6.js +1 -0
- package/dist/assets/{flows-actors-graph-runtime-gROuX0bc.js → flows-actors-graph-runtime-DI3n8jVc.js} +1 -1
- package/dist/assets/{fr-CA-CK6DZ0Y0.js → fr-CA-C3AJ7JuM.js} +1 -1
- package/dist/assets/{fr-C_yCKbUr.js → fr-CGyuQ4Gm.js} +1 -1
- package/dist/assets/{ganttDiagram-EL5Y4UJY-D0jiwOL1.js → ganttDiagram-EL5Y4UJY-DLhOm_Zc.js} +1 -1
- package/dist/assets/{gitGraphDiagram-WWUBYQGX-D8pPMPkg.js → gitGraphDiagram-WWUBYQGX-01OzLEYx.js} +1 -1
- package/dist/assets/{gl-Eza1ndh4.js → gl-ClWJq0NN.js} +1 -1
- package/dist/assets/{graph-runtime-NezJb61g.js → graph-runtime-DFxhReh6.js} +1 -1
- package/dist/assets/{he-DmFVpLKY.js → he-DtPc9727.js} +1 -1
- package/dist/assets/{hi-omEXWkim.js → hi-Cxklbhrz.js} +1 -1
- package/dist/assets/{hr-BYIhr9zQ.js → hr-CJI_0dF1.js} +1 -1
- package/dist/assets/{hu-S-zl8VEE.js → hu-DEsMSN-h.js} +1 -1
- package/dist/assets/{id-BlVfaWlx.js → id-Av8sk-t7.js} +1 -1
- package/dist/assets/{index-EhSlDMAI.css → index-Bcdys-EF.css} +1 -1
- package/dist/assets/index-tbQuFgg9.js +202 -0
- package/dist/assets/{infoDiagram-27XIBGKW-D4Z1xJpi.js → infoDiagram-27XIBGKW-w-KKxZud.js} +1 -1
- package/dist/assets/{is-kinij3xP.js → is-Y2NB-lkJ.js} +1 -1
- package/dist/assets/isSameWeek-DD3c86C9.js +1 -0
- package/dist/assets/{ishikawaDiagram-5VMMS53U-Ciua2PUb.js → ishikawaDiagram-5VMMS53U-bMzgiKpZ.js} +1 -1
- package/dist/assets/{it-DAJ9HpEh.js → it-CQvYk9FM.js} +1 -1
- package/dist/assets/{ja-CVJ6cRU-.js → ja-BUQZbvab.js} +1 -1
- package/dist/assets/{journeyDiagram-3NMN7TZE-D2yd4EpM.js → journeyDiagram-3NMN7TZE-Ds4WwsuL.js} +1 -1
- package/dist/assets/{kanban-definition-UXKFOSKX-D9VhVOLa.js → kanban-definition-UXKFOSKX-BrYusAP6.js} +1 -1
- package/dist/assets/katex-B49ulZim.js +1 -0
- package/dist/assets/{ko-D4zln2fF.js → ko-DFCJZSJ5.js} +1 -1
- package/dist/assets/{line-CF7aeIX6.js → line-CbGUUIqn.js} +1 -1
- package/dist/assets/{linear-DaBItCqY.js → linear-CZlw_kAt.js} +1 -1
- package/dist/assets/{lt-C7az4iaU.js → lt-SSNzpl4l.js} +1 -1
- package/dist/assets/{lv-JpmRbJV_.js → lv-ChFDzo6N.js} +1 -1
- package/dist/assets/{markdown-stream-runtime-B89TcLYb.js → markdown-stream-runtime-B_LlW3_g.js} +4 -4
- package/dist/assets/{match-D4V1W1KE.js → match-BSxRnzW7.js} +1 -1
- package/dist/assets/{match-DCIBCbPQ.js → match-DR_vZ1pS.js} +1 -1
- package/dist/assets/mermaid-VLURNSYL-uoY3A_2r.js +1 -0
- package/dist/assets/{mermaid.core-DD8EuqGp.js → mermaid.core-DfG79j_h.js} +4 -4
- package/dist/assets/{mindmap-definition-YA3MSWOX-DzrVzTT_.js → mindmap-definition-YA3MSWOX-BAoreBgb.js} +1 -1
- package/dist/assets/{ms-vf5qJzAc.js → ms-CudItD7-.js} +1 -1
- package/dist/assets/{mt-9_qeU9SR.js → mt-JcjtZ6VF.js} +1 -1
- package/dist/assets/{nb-7TG2076-.js → nb-C6brsbnR.js} +1 -1
- package/dist/assets/{nl-D75P5GG_.js → nl-B0Pe8Tqa.js} +1 -1
- package/dist/assets/node-Cq1VMMYg.js +2 -0
- package/dist/assets/{pdf-viewer-DPiwTeTb.js → pdf-viewer-CJ-YXdjU.js} +1 -1
- package/dist/assets/{pegDiagram-XKGWAZYB-DMK1vOLC.js → pegDiagram-XKGWAZYB-DoKc8_Wl.js} +1 -1
- package/dist/assets/{pieDiagram-E7YTZNPT-DBKY7gnL.js → pieDiagram-E7YTZNPT-CehZeN4E.js} +1 -1
- package/dist/assets/{pl-BbmlCE_y.js → pl-EL8a3tlp.js} +1 -1
- package/dist/assets/{pt-BR-CAga1VvG.js → pt-BR-Dsdazh3s.js} +1 -1
- package/dist/assets/{pt-Dwabdb55.js → pt-DGtOJAQd.js} +1 -1
- package/dist/assets/{quadrantDiagram-AXDQQJYC-CNthG-7I.js → quadrantDiagram-AXDQQJYC-jliIzJvq.js} +1 -1
- package/dist/assets/{railroadDiagram-O6MQD6OU-_OuV9W5c.js → railroadDiagram-O6MQD6OU-DCWwFine.js} +1 -1
- package/dist/assets/{requirementDiagram-BXWQKSXE-D3w49UW4.js → requirementDiagram-BXWQKSXE-CNJsk6WA.js} +1 -1
- package/dist/assets/{ro-Tme9NXKi.js → ro-BiQPz_H9.js} +1 -1
- package/dist/assets/{ru-cw6HYkru.js → ru-JNyRQsbW.js} +1 -1
- package/dist/assets/{sankeyDiagram-P5KCCOFB-D5uteHCL.js → sankeyDiagram-P5KCCOFB-BzRe86bg.js} +1 -1
- package/dist/assets/{sequenceDiagram-WJ2MYXX4-9CeFVdiB.js → sequenceDiagram-WJ2MYXX4-Vn8b-vQE.js} +1 -1
- package/dist/assets/{sk-8VSY23Ma.js → sk-BcYdCgZc.js} +1 -1
- package/dist/assets/{sl-Dm3eLvz9.js → sl-C9qbM-iW.js} +1 -1
- package/dist/assets/{stateDiagram-D77RDMKH-CZ5Bnsal.js → stateDiagram-D77RDMKH-NvwN6uqL.js} +1 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-CtrY6mXm.js +1 -0
- package/dist/assets/{sv-DpeP710f.js → sv-CKhM__fc.js} +1 -1
- package/dist/assets/{swimlanes-42K2YHIH-DY7jTvPb.js → swimlanes-42K2YHIH-C-3fXu5i.js} +1 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-I2Ys-udk.js +8 -0
- package/dist/assets/{ta-CpEg7vSC.js → ta-BUOrrGS2.js} +1 -1
- package/dist/assets/{th-DN9gntTp.js → th-D9u0kyJy.js} +1 -1
- package/dist/assets/{timeline-definition-24CTP7MA-DwT8DKFM.js → timeline-definition-24CTP7MA-P-CvBruH.js} +1 -1
- package/dist/assets/{tr-DPUIVSGQ.js → tr-YPFOc1ew.js} +1 -1
- package/dist/assets/useI18n-DqSBcroP.js +171 -0
- package/dist/assets/{vennDiagram-4TSXK5OY-BXfI2llp.js → vennDiagram-4TSXK5OY-B3bTjEC-.js} +1 -1
- package/dist/assets/{vi-DT80XNHr.js → vi-ChXhbB_B.js} +1 -1
- package/dist/assets/{wardleyDiagram-VM6X3IG4-Dpki9_Se.js → wardleyDiagram-VM6X3IG4-Dypi6Z9c.js} +1 -1
- package/dist/assets/{xychartDiagram-S5SC5T6Z-Drkgs_g0.js → xychartDiagram-S5SC5T6Z-BTlV8gMe.js} +1 -1
- package/dist/assets/{zh-CN-Dcwslx_d.js → zh-CN-BdicaTVy.js} +1 -1
- package/dist/assets/{zh-HK-BNu9B5SY.js → zh-HK-CJnlVP26.js} +1 -1
- package/dist/assets/{zh-TW-CeOM54jX.js → zh-TW-DxRFH8WI.js} +1 -1
- package/dist/index.html +9 -9
- package/package.json +9 -9
- package/dist/assets/ChartLoadingSkeleton-BUfDWMoH.js +0 -1
- package/dist/assets/ChartWidget-CjyBqut4.js +0 -5
- package/dist/assets/badge-tone-BImBMJx2.js +0 -5
- package/dist/assets/channel-KVQ66UuV.js +0 -1
- package/dist/assets/classDiagram-ZZMXUADV-Cu2_yr-A.js +0 -1
- package/dist/assets/classDiagram-v2-VYDZK3BY-Cu2_yr-A.js +0 -1
- package/dist/assets/esm-DjSVWi2t.js +0 -46
- package/dist/assets/flowDiagram-HODETNUW-bt2zzz0X.js +0 -1
- package/dist/assets/index-B7eQc9Zm.js +0 -202
- package/dist/assets/isSameWeek-BttcEFi5.js +0 -1
- package/dist/assets/katex-Dl5hBKq4.js +0 -1
- package/dist/assets/mermaid-VLURNSYL-KYomrFRA.js +0 -1
- package/dist/assets/node-D1TKeHq4.js +0 -2
- package/dist/assets/stateDiagram-v2-MP3YSRHH-DTPx5dUS.js +0 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-BKfUkABE.js +0 -8
- package/dist/assets/useI18n-pnDuUxWI.js +0 -171
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChartView-Dxhrm4ZQ.js","assets/rolldown-runtime-BWaJ3C7D.js","assets/jsx-runtime-lTuChwRC.js","assets/react-9WV3M1gM.js","assets/useI18n-pnDuUxWI.js","assets/public-runtime-D-EeE8cv.js","assets/bundle-mjs-H9shJLym.js","assets/badge-tone-BImBMJx2.js","assets/ChartEmptyState-BC4PowrY.js","assets/ChartLoadingSkeleton-BUfDWMoH.js","assets/ChartWidget-CjyBqut4.js","assets/react-dom-DQGBdIds.js","assets/preload-helper-7y9sWmk5.js","assets/flows-actors-graph-runtime-gROuX0bc.js","assets/node-D1TKeHq4.js","assets/esm-BI55uNP_.js","assets/index-B7eQc9Zm.js","assets/src-C_gRsKqw.js","assets/index-EhSlDMAI.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e,r as t,t as n}from"./rolldown-runtime-BWaJ3C7D.js";import{t as r}from"./react-9WV3M1gM.js";import{t as i}from"./react-dom-DQGBdIds.js";import{$C as a,$S as o,$T as s,$a as c,$h as l,$i as u,$l as d,$m as f,$n as p,$p as m,$r as h,$t as g,$u as _,$v as v,$w as y,A as b,AC as x,AE as S,AT as C,Aa as w,Ad as T,Af as E,Ag as D,Ah as O,Ai as k,Al as A,An as j,Ao as M,Ap as N,Ar as P,At as F,Au as I,Aw as ee,Ax as L,B as R,BC as te,BE as z,BS as B,BT as ne,Ba as re,Bi as ie,Bn as ae,Br as oe,Bt as se,Bw as ce,Bx as le,By as ue,C as de,CC as fe,CE as pe,CS as me,CT as he,Ca as ge,Cb as _e,Cc as ve,Cg as ye,Ch as be,Ci as xe,Cm as Se,Cn as Ce,Co as we,Cp as Te,Cr as Ee,Ct as De,Cu as Oe,Cv as ke,Cw as Ae,Cx as je,Cy as Me,D as Ne,DC as Pe,DE as Fe,DT as Ie,Da as Le,Df as Re,Dg as ze,Di as Be,Dm as Ve,Dn as He,Do as Ue,Dp as We,Dr as Ge,Dt as Ke,Du as qe,Dw as Je,Dx as Ye,Dy as Xe,E as Ze,EC as Qe,EE as $e,ET as et,Ea as tt,Eb as nt,Ef as rt,Eg as it,Eh as at,Em as ot,En as st,Eo as ct,Er as lt,Et as ut,Eu as dt,Ev as ft,Ew as pt,Ex as mt,F as ht,FC as gt,F_ as _t,Fa as vt,Fg as yt,Fh as bt,Fi as xt,Fm as St,Fn as Ct,Fr as wt,Ft as V,Fw as Tt,Fx as Et,G as Dt,GC as Ot,GE as kt,GS as At,GT as jt,Ga as Mt,Gi as Nt,Gl as Pt,Gn as Ft,Go as It,Gp as Lt,Gr as Rt,Gt as zt,Gw as Bt,H as Vt,HC as Ht,HE as Ut,HS as Wt,HT as Gt,Ha as Kt,Hb as qt,Hi as Jt,Hn as Yt,Hp as Xt,Hr as Zt,Ht as Qt,Hu as $t,Hv as en,Hw as tn,Hx as nn,Hy as rn,I as an,IC as on,IT as sn,Ia as cn,Ib as ln,Ig as un,Ih as dn,Ii as fn,In as pn,Ip as mn,Ir as hn,It as gn,Iw as _n,Ix as vn,Iy as yn,J as bn,JC as xn,JE as Sn,Ja as Cn,Jb as wn,Jf as Tn,Ji as En,Jl as Dn,Jn as On,Jo as kn,Jp as An,Jr as jn,Jt as Mn,Jv as Nn,Jw as Pn,Jy as Fn,K as In,KE as Ln,KS as Rn,KT as zn,Ka as H,Kb as Bn,Kg as Vn,Kh as Hn,Ki as Un,Kl as Wn,Kn as Gn,Ko as Kn,Kr as qn,Kt as Jn,Kw as Yn,Ky as Xn,L as Zn,LC as Qn,LE as $n,LT as er,L_ as tr,La as nr,Lb as rr,Lg as ir,Li as ar,Ln as eee,Lr as or,Lt as sr,Lu as cr,Lw as lr,Lx as ur,M as dr,MC as fr,ME as pr,M_ as mr,Ma as tee,Mb as hr,Md as gr,Mg as nee,Mh as _r,Mi as ree,Mm as vr,Mn as iee,Mp as aee,Mr as yr,Mt as oee,Mv as br,Mw as see,Mx as cee,My as xr,N as lee,NE as Sr,NT as Cr,Na as uee,Nb as dee,Nd as fee,Ng as wr,Ni as Tr,Nn as Er,Nr as pee,Nt as U,Nv as Dr,Nw as Or,Nx as kr,Ny as Ar,O as jr,OE as Mr,OT as Nr,Oa as mee,Od as Pr,Of as Fr,Og as Ir,Oh as hee,Oi as Lr,Om as Rr,On as gee,Oo as _ee,Op as vee,Or as yee,Ot as zr,Ow as bee,Ox as xee,Oy as Br,P as See,PC as Vr,PE as Cee,PT as Hr,P_ as wee,Pa as Tee,Pb as Eee,Pf as Ur,Pg as Wr,Ph as Gr,Pi as Dee,Pn as Kr,Pp as qr,Pr as Jr,Ps as Yr,Pt as Xr,Px as Zr,Q as Oee,QC as kee,QS as Aee,QT as Qr,Qa as $r,Qb as ei,Qf as ti,Qh as ni,Qi as jee,Qn as Mee,Qp as Nee,Qr as Pee,Qt as ri,Qv as Fee,Qw as Iee,Qx as Lee,Qy as ii,R as ai,RC as Ree,RE as oi,RS as si,RT as ci,Ra as zee,Rb as li,Rf as Bee,Rh as ui,Ri as di,Rn as fi,Ro as pi,Rp as mi,Rr as hi,Rt as gi,Ru as _i,Rv as vi,Rw as Vee,Rx as yi,Ry as bi,S as xi,SC as Si,SE as Ci,SS as wi,ST as Hee,S_ as Uee,Sa as Wee,Sd as Gee,Sh as Kee,Si as Ti,Sl as qee,Sm as Ei,Sn as Di,So as Jee,Sr as Yee,St as Xee,Su as Oi,Sv as ki,Sw as Ai,Sx as ji,T as Mi,TC as Ni,TS as Pi,TT as Fi,T_ as Ii,Ta as Li,Tb as Ri,Tf as zi,Th as Bi,Tm as Vi,Tn as Hi,Tp as Ui,Tr as Wi,Tt as Gi,Tu as Ki,Tv as Zee,Tw as Qee,Ty as $ee,U as qi,UE as Ji,UT as ete,U_ as Yi,Ua as tte,Ui as nte,Ul as Xi,Um as rte,Un as ite,Up as ate,Ur as Zi,Ut as ote,Uv as ste,Uw as cte,Ux as lte,Uy as ute,V as dte,VC as Qi,VE as $i,VT as ea,Va as fte,Vb as ta,Vf as na,Vi as pte,Vn as mte,Vo as ra,Vp as ia,Vr as aa,Vt as hte,Vu as oa,Vw as sa,Vx as gte,Vy as _te,W as ca,WC as la,WE as ua,WT as da,Wa as fa,Wf as vte,Wi as pa,Wl as yte,Wn as bte,Wr as xte,Wt as Ste,Ww as Cte,Wy as ma,X as ha,XE as ga,XS as _a,Xa as va,Xb as W,Xc as wte,Xg as Tte,Xi as ya,Xl as Ete,Xn as Dte,Xo as ba,Xr as Ote,Xt as xa,Xv as kte,Xw as Sa,Xy as Ca,Y as wa,YE as Ta,YS as Ea,YT as Da,Ya as Oa,Yg as Ate,Yi as jte,Yl as Mte,Yn as Nte,Yo as ka,Yp as Pte,Yr as Fte,Yt as Aa,Yv as Ite,Yw as Lte,Z as Rte,ZC as zte,ZE as ja,ZS as Ma,ZT as Bte,Za as Vte,Zb as Na,Zf as Pa,Zg as Fa,Zi as Ia,Zl as La,Zn as Ra,Zp as za,Zr as Ba,Zt as Va,Zv as Ha,Zw as Ua,Zy as Wa,_ as Ga,_C as Hte,_D as Ka,_E as qa,_S as Ja,_T as Ute,_a as Wte,_b as Ya,_d as Gte,_g as Xa,_h as Za,_i as Kte,_m as Qa,_n as $a,_o as qte,_p as Jte,_r as Yte,_s as Xte,_t as eo,_v as to,_w as Zte,_y as no,a as Qte,aD as ro,aE as io,aT as $te,aa as ao,ag as ene,ah as tne,ai as oo,al as so,am as co,an as lo,ar as nne,at as rne,au as ine,av as ane,aw as uo,ay as fo,b as one,bC as po,bE as mo,bT as sne,ba as cne,bb as lne,bf as ho,bg as go,bh as une,bi as _o,bm as dne,bn as fne,bp as pne,br as mne,bt as vo,bu as yo,bv as bo,bw as xo,bx as So,by as Co,c as wo,cD as To,cE as Eo,cT as Do,c_ as Oo,ca as ko,cb as Ao,cg as hne,ci as gne,cn as _ne,co as jo,cp as vne,cr as yne,ct as Mo,cw as bne,cx as xne,d as Sne,dD as Cne,dE as No,dT as wne,d_ as Tne,da as Ene,dd as Po,dg as Dne,dh as Fo,di as Io,dm as Lo,dn as One,do as kne,dr as Ane,dt as jne,dw as Ro,dy as zo,eC as Bo,eD as Vo,eE as Ho,eT as Uo,ea as Mne,eb as Wo,eg as Go,ei as Ko,en as qo,eo as Jo,er as Nne,eu as Pne,ev as Yo,ew as Fne,ex as Ine,f as Xo,fD as Zo,fE as Lne,fS as Qo,fT as Rne,f_ as $o,fa as zne,fb as Bne,fd as Vne,fg as Hne,fh as es,fi as ts,fm as ns,fn as rs,fo as is,fr as Une,ft as as,fw as Wne,fy as Gne,g as Kne,gC as qne,gD as os,gE as ss,gT as cs,ga as Jne,gb as ls,gd as us,gg as ds,gh as Yne,gi as Xne,gl as fs,gm as ps,gn as ms,gr as hs,gt as gs,gv as _s,gw as vs,h as ys,hC as bs,hD as xs,hE as Ss,hT as Cs,h_ as ws,ha as Ts,hb as Es,hc as Ds,hd as Os,hf as ks,hg as As,hi as js,hm as Ms,hn as Ns,hr as Ps,ht as Fs,hv as Is,hw as Ls,hy as Rs,i as zs,iD as Bs,iE as Vs,iS as Hs,iT as Us,ia as Ws,ih as Gs,ii as Ks,il as qs,in as Js,ip as Zne,ir as Qne,it as $ne,iu as ere,iv as tre,iw as Ys,iy as nre,j as Xs,jC as Zs,jE as Qs,jT as $s,j_ as ec,ja as rre,jf as ire,jg as tc,jh as nc,ji as rc,jn as ic,jp as are,jr as ac,jt as oc,jv as ore,jw as sc,jx as cc,jy as sre,k as lc,kC as uc,kT as cre,ka as dc,kb as lre,kd as fc,kg as pc,ki as ure,km as dre,ko as fre,kp as mc,kr as hc,kt as gc,kw as _c,kx as vc,ky as pre,l as yc,lD as mre,lE as bc,lT as xc,la as hre,lb as gre,lg as Sc,lh as Cc,li as _re,ln as wc,lo as vre,lp as Tc,lr as yre,lt as bre,lw as Ec,m as Dc,mD as Oc,mT as kc,ma as xre,mb as Ac,md as Sre,mg as Cre,mi as jc,ml as wre,mm as Mc,mn as Nc,mo as Pc,mr as Tre,ms as Fc,mt as Ere,mu as Dre,mv as Ic,mw as Lc,my as Rc,n as G,nD as zc,nT as Bc,na as Ore,ng as Vc,nh as kre,ni as Hc,nl as Are,nm as Uc,nn as Wc,no as Gc,np as Kc,nr as jre,nt as Mre,nu as Nre,nw as qc,nx as Jc,o as Yc,oD as Xc,oE as Pre,oT as Zc,oa as Fre,od as Qc,og as $c,oh as Ire,oi as Lre,om as el,on as Rre,or as zre,ot as tl,ou as Bre,ov as nl,ow as rl,oy as il,p as al,pD as ol,pT as sl,pa as Vre,pb as cl,pi as ll,pm as Hre,pn as ul,pr as Ure,pt as Wre,pw as dl,py as Gre,q as Kre,qE as fl,qS as pl,qa as qre,qb as Jre,qg as ml,qi as hl,ql as Yre,qn as Xre,qo as gl,qr as Zre,qt as _l,qv as vl,qw as yl,qy as Qre,r as bl,rD as xl,rE as Sl,rT as $re,ra as Cl,rg as eie,rh as tie,ri as wl,rl as nie,rm as Tl,rn as El,ro as rie,rp as Dl,rr as Ol,rt as kl,ru as iie,rv as aie,ry as Al,s as oie,sD as jl,sE as Ml,sS as Nl,sT as sie,sa as cie,sb as lie,sg as uie,si as Pl,sm as Fl,sn as Il,so as Ll,sp as Rl,sr as zl,sw as Bl,sx as Vl,sy as Hl,t as K,tD as Ul,tE as Wl,tT as Gl,ta as Kl,tg as ql,ti as Jl,tl as Yl,tm as Xl,tn as Zl,to as die,tr as fie,tt as pie,tu as Ql,tv as $l,tx as mie,u as eu,uD as q,uE as tu,uT as nu,ua as ru,ub as iu,ug as hie,ui as au,um as ou,un as gie,uo as _ie,ur as vie,ut as yie,uu as bie,uw as xie,v as Sie,vC as su,vD as J,vE as cu,vS as lu,vT as Cie,va as wie,vb as uu,vd as du,vf as Tie,vi as fu,vm as pu,vn as mu,vo as Eie,vp as Die,vr as Oie,vv as hu,vw as gu,w as _u,wC as vu,wE as yu,wT as bu,wa as xu,wf as Su,wg as Cu,wh as wu,wi as Tu,wm as Eu,wn as Du,wo as Ou,wp as ku,wr as Au,wt as ju,wu as Mu,wv as Nu,ww as Pu,wx as Fu,x as Iu,xS as Lu,xT as Ru,x_ as zu,xa as Bu,xb as Vu,xf as Hu,xg as Uu,xh as Wu,xi as Gu,xm as kie,xn as Ku,xr as Aie,xt as jie,xu as Mie,xv as qu,xw as Ju,xx as Yu,xy as Xu,y as Nie,yC as Zu,yE as Qu,yS as $u,yT as ed,ya as Pie,yb as td,yd as nd,yf as Fie,yg as rd,yh as Iie,yi as Lie,yn as Rie,yo as id,yp as zie,yr as Bie,yv as ad,yw as od,yx as Vie,yy as sd,z as cd,zC as ld,zE as ud,zS as dd,za as fd,zb as pd,zi as Hie,zl as Uie,zm as Wie,zn as Gie,zp as md,zr as hd,zt as Kie,zu as gd,zv as _d,zw as qie,zx as Jie,zy as vd}from"./useI18n-pnDuUxWI.js";import{B as yd,C as bd,Cr as Yie,Ct as Xie,E as xd,Et as Zie,F as Sd,Hr as Qie,I as Cd,J as $ie,M as wd,N as Td,O as Ed,P as Dd,S as Od,Si as kd,T as eae,Tn as tae,Ts as nae,U as Ad,W as jd,X as Md,Y as rae,Yr as Nd,_ as iae,at as Pd,ci as Fd,ct as Id,dr as Ld,er as Rd,et as aae,g as oae,h as sae,it as zd,j as Bd,li as Vd,m as cae,ot as Hd,p as lae,q as uae,rt as dae,sr as Ud,st as Wd,ta as Gd,tt as Kd,u as fae,v as pae,w as qd,wt as Jd,x as mae,xi as Yd}from"./public-runtime-D-EeE8cv.js";import{$ as hae,B as gae,C as _ae,Ct as Y,Dt as Xd,E as Zd,Et as Qd,F as vae,G as yae,H as bae,I as xae,J as $d,K as ef,M as tf,N as nf,Ot as rf,P as af,Q as of,S as sf,St as cf,T as lf,Tt as uf,U as df,V as ff,W as pf,X as mf,Y as hf,Z as gf,_ as _f,_t as vf,a as yf,at as bf,b as xf,bt as Sf,c as Cf,ct as wf,d as Tf,dt as Ef,et as Df,f as Of,ft as kf,g as Af,gt as jf,h as Mf,ht as Nf,i as Pf,it as Ff,kt as If,l as Lf,lt as Rf,m as zf,mt as Bf,n as Vf,nt as Hf,o as Uf,ot as Wf,p as Gf,pt as Kf,q as qf,r as Jf,rt as Yf,s as Xf,st as Zf,t as Qf,tt as $f,u as ep,ut as tp,v as np,vt as rp,w as ip,wt as ap,x as op,xt as X,y as sp,yt as cp,z as lp}from"./node-D1TKeHq4.js";import{$ as up,$n as dp,A as fp,An as pp,At as mp,B as hp,Bn as gp,Bt as _p,C as vp,Cn as yp,Ct as Sae,D as bp,Dn as xp,Dt as Cae,E as Sp,En as wae,Et as Cp,F as wp,Fn as Tp,Ft as Ep,G as Dp,Gn as Tae,Gt as Op,H as Eae,Hn as kp,Ht as Dae,I as Oae,In as Ap,It as kae,J as jp,Jn as Aae,Jt as jae,K as Mae,Kn as Mp,Kt as Np,L as Nae,Ln as Pp,Lt as Pae,M as Fae,Mn as Fp,Mt as Ip,N as Lp,Nn as Rp,Nt as zp,O as Iae,On as Lae,Ot as Rae,P as Bp,Pn as Vp,Pt as zae,Q as Hp,Qn as Up,Qt as Wp,R as Gp,Rn as Kp,Rt as qp,S as Bae,Sn as Jp,St as Vae,T as Hae,Tn as Uae,Tt as Yp,U as Wae,Un as Gae,Ut as Kae,V as Xp,Vn as Zp,Vt as qae,W as Jae,Wn as Qp,Wt as $p,X as em,Xn as Yae,Xt as tm,Y as nm,Yn as Xae,Yt as rm,Z as im,Zn as Zae,Zt as am,_ as Qae,_n as om,_t as $ae,a as sm,an as eoe,at as cm,b as toe,bn as noe,bt as roe,c as lm,cn as ioe,ct as um,d as aoe,dn as ooe,dt as dm,er as fm,et as soe,f as pm,fn as coe,ft as loe,g as mm,gn as uoe,gt as doe,h as hm,hn as gm,ht as _m,i as foe,in as vm,it as ym,j as bm,jn as poe,jt as moe,k as hoe,kn as goe,kt as xm,l as _oe,ln as voe,lt as Sm,m as yoe,mn as boe,mt as xoe,n as Cm,nn as Soe,nt as wm,o as Tm,on as Em,ot as Coe,p as Dm,pn as woe,pt as Toe,q as Om,qn as Eoe,qt as Doe,r as km,rn as Am,rt as jm,s as Mm,sn as Ooe,st as Nm,t as Pm,tn as Fm,tr as koe,tt as Im,u as Lm,un as Aoe,ut as Rm,v as joe,vn as Moe,vt as Noe,w as Poe,wn as zm,wt as Foe,x as Bm,xn as Ioe,xt as Vm,y as Hm,yn as Loe,yt as Um,z as Roe,zn as zoe,zt as Wm}from"./ChartLoadingSkeleton-BUfDWMoH.js";import{$ as Boe,$t as Gm,A as Voe,At as Km,B as qm,Bt as Jm,C as Ym,Ct as Xm,D as Hoe,Dt as Zm,E as Uoe,Et as Woe,F as Qm,Ft as $m,G as Goe,Gt as Koe,H as eh,Ht as th,I as qoe,It as nh,J as Joe,Jt as rh,K as Yoe,Kt as ih,L as Xoe,Lt as Zoe,M as ah,Mt as oh,N as sh,Nt as ch,O as lh,Ot as uh,P as dh,Pt as fh,Q as ph,Qt as mh,R as hh,Rt as gh,S as _h,St as vh,T as yh,Tt as bh,U as Qoe,Ut as xh,V as Sh,Vt as $oe,W as ese,Wt as Ch,X as wh,Xt as tse,Yt as Th,Z as Eh,Zt as Dh,_ as Oh,_t as nse,a as kh,an as rse,at as ise,b as ase,bt as Ah,c as jh,ct as Mh,d as Nh,dt as Ph,en as Fh,et as Ih,f as Lh,ft as Rh,g as zh,gt as Bh,h as Vh,ht as Hh,i as Uh,in as Wh,it as Gh,j as Kh,jt as qh,k as Jh,kt as Yh,l as Xh,lt as Zh,m as Qh,mt as $h,nn as eg,nt as tg,o as ng,on as rg,ot as ig,p as ag,pt as og,q as sg,qt as cg,r as lg,rn as ug,rt as dg,s as fg,st as pg,t as mg,tn as hg,tt as gg,u as _g,ut as vg,v as yg,vt as bg,w as xg,wt as Sg,x as Cg,xt as wg,y as Tg,yt as Eg,z as Dg,zt as Og}from"./ChartWidget-CjyBqut4.js";import{t as kg}from"./jsx-runtime-lTuChwRC.js";import{A as Ag,B as jg,C as Mg,D as Ng,E as Pg,F as Fg,G as Ig,H as Lg,I as Rg,J as zg,K as Bg,L as Vg,M as Hg,N as Ug,O as Wg,P as Gg,R as Kg,S as qg,T as Jg,U as Yg,V as Xg,W as Zg,Y as Qg,_ as $g,a as e_,b as t_,c as n_,d as r_,f as i_,g as a_,h as o_,i as s_,j as c_,k as l_,l as u_,m as d_,n as f_,o as p_,p as m_,q as h_,r as g_,s as __,t as v_,u as y_,v as b_,w as x_,x as S_,y as C_,z as w_}from"./badge-tone-BImBMJx2.js";import{t as T_}from"./preload-helper-7y9sWmk5.js";import{a as E_,c as D_,d as O_,f as k_,g as A_,h as j_,i as M_,l as N_,m as P_,n as F_,o as I_,p as Z,r as L_,s as R_,t as z_,u as B_}from"./ChartEmptyState-BC4PowrY.js";function V_(e,t){return e!==void 0||t!==void 0}var H_=`frontend_sdk`,U_=function(e){return e.STRING=`string`,e.NUMBER=`number`,e.BOOLEAN=`boolean`,e}({});function W_(e){return{declaredKeys:Object.freeze(Object.keys(e)),requiredKeys:Object.freeze(Object.entries(e).filter(([,e])=>e.required===!0).map(([e])=>e)),"~standard":{version:1,vendor:`wildo`,validate(t){if(typeof t!=`object`||!t||Array.isArray(t))return{issues:[{message:`public configuration must be an object`}]};let n=t,r=[];for(let t of Object.keys(n))t in e||r.push({message:`unknown key`,path:[t]});for(let[t,i]of Object.entries(e)){let e=n[t];e===void 0?i.required===!0&&r.push({message:`required`,path:[t]}):typeof e!==i.kind&&r.push({message:`expected a ${i.kind}, got ${typeof e}`,path:[t]})}return r.length>0?{issues:r}:{value:n}}}}}function G_(e){if(typeof e!=`object`||!e)return;let t=e;if(Array.isArray(t.declaredKeys)&&t.declaredKeys.every(e=>typeof e==`string`))return t.declaredKeys;if(typeof t.shape==`object`&&t.shape!==null)return Object.keys(t.shape)}function K_(e){if(typeof e!=`object`||!e)return[];let t=e;return Array.isArray(t.requiredKeys)&&t.requiredKeys.every(e=>typeof e==`string`)?t.requiredKeys:typeof t.shape==`object`&&t.shape!==null?Object.entries(t.shape).filter(([,e])=>{let t=e?.isOptional;return typeof t==`function`&&!t.call(e)}).map(([e])=>e):[]}function q_(e,t){return(e??[]).filter(e=>{let n=t?.[e];return n==null||typeof n==`string`&&n.trim()===``})}function J_(e){let t=e.missingKeys.map(e=>`"${e}"`).join(`, `),n=e.serviceKey===void 0?``:` on service "${e.serviceKey}"`;return`Frontend provider "${e.providerRef}"${n} is declared but not configured: it requires ${t}, so it will not run. Supply ${e.missingKeys.length>1?`them`:`it`} under providerConfigurations.${e.providerRef}.${H_} in the application's configuration (per environment in its infrastructure configuration), then run \`wildo config sync\`.`}var Y_=class extends Error{facet;conflicts;constructor(e,t){let n=t.map(({ref:e,fragmentIndexes:t})=>` - ref "${e}" declared by fragments [${t.join(`, `)}]`);super(`[compose${e}Providers] conflicting provider refs across fragments:\n${n.join(`
|
|
3
|
-
`)}\nResolution: pick a different ref OR drop the conflicting fragment from the composition call.`),this.name=`ProviderCompositionConflictError`,this.facet=e,this.conflicts=t}};function X_(e,t){let n=new Map;for(let e=0;e<t.length;e+=1)for(let r of t[e].modules.keys()){let t=n.get(r);t?t.push(e):n.set(r,[e])}let r=[];for(let[e,t]of n)t.length>1&&r.push({ref:e,fragmentIndexes:t});if(r.length>0)throw new Y_(e,r);let i=new Map,a=new Map;for(let e of t)for(let[t,n]of e.modules){i.set(t,n);for(let e of n.providerCapabilities){let t=a.get(e);t?t.push(n):a.set(e,[n])}}return Object.freeze({modules:i,getProviderByRef(e){return i.get(e)},getProvidersByProviderCapability(e){return a.get(e)??[]},findProviderByProviderCapability(e){let t=a.get(e);return t&&t.length>0?t[0]:void 0}})}var Z_=[];function Q_(e){let t={...e.callContext};if(!e.row)return t;let n=e.operations.flatMap(e=>(e.initiatorInfos??[]).flatMap(e=>e.parameters??[])),r=new Map;for(let e of n)r.set(e.fieldIdentifier,String(e.resourceType));for(let t of Object.keys(e.callContext))if(!r.has(t)){let n=e.typeOfFieldIdentifier?.(t);n!==void 0&&r.set(t,n)}let i=new Map;for(let t of n){let n=t.fieldIdentifier;if(n===e.ownFieldIdentifier||n in e.callContext||t.scopeViaJunction)continue;let r=e.row[t.relationshipField??t.fieldIdentifier],a=Array.isArray(r)?void 0:e.normalizeId(r);if(a===void 0)continue;let o=i.get(n);i.set(n,o===void 0||o===a?a:null)}for(let[n,a]of i){if(a===null)continue;let o=r.get(n),s=new Set([a]);for(let[t,a]of[...Object.entries(e.callContext),...i])t!==n&&t!==e.ownFieldIdentifier&&a!==null&&r.get(t)===o&&s.add(a);s.size===1&&(t[n]=a)}return t}function $_(e){let{previousRow:t,isStoredRow:n,...r}=e;if(!e.row||!t)return{contextResourceIdentifiers:Q_(r)};let i=n(e.row)?e.row:{...t,...e.row},a=e.operations.flatMap(e=>(e.initiatorInfos??[]).flatMap(e=>e.parameters??[])),o=(t,n)=>{let r=new Set;for(let i of a){if(i.fieldIdentifier!==n||i.scopeViaJunction)continue;let a=t[i.relationshipField??i.fieldIdentifier];r.add(Array.isArray(a)?void 0:e.normalizeId(a))}return r.size===1?[...r][0]:void 0},s=Object.keys(e.callContext).filter(n=>{if(n===e.ownFieldIdentifier||!a.some(e=>e.fieldIdentifier===n&&!e.scopeViaJunction))return!1;let r=o(t,n);return r!==void 0&&r===e.callContext[n]&&o(i,n)!==r}),c=Object.fromEntries(Object.entries(e.callContext).filter(([e])=>!s.includes(e))),l=Q_({...r,row:i,callContext:c}),u=Q_({...r,row:t});return[...new Set([...Object.keys(l),...Object.keys(u)])].some(e=>l[e]!==u[e])?{contextResourceIdentifiers:l,previousContextResourceIdentifiers:u}:{contextResourceIdentifiers:l}}function ev(e,t){if(Object.is(e,t))return!0;if(typeof e==`function`||typeof t==`function`||typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>ev(e,t[n]));let n=e,r=t,i=Object.keys(n).filter(e=>e!==`resolvedSemantics`),a=Object.keys(r).filter(e=>e!==`resolvedSemantics`);return i.length===a.length&&i.every(e=>Object.prototype.hasOwnProperty.call(r,e)&&ev(n[e],r[e]))}function tv(e){let t=new Map;for(let n of e){let e=`${String(n.resourceType1)}→${String(n.resourceType2)}`,r=t.get(e);r?r.push(n):t.set(e,[n])}let n=[];for(let e of t.values()){if(e.length<2)continue;let t=[];for(let n of e){let e=t.find(e=>ev(e.representative,n));e?e.occurrences+=1:t.push({representative:n,occurrences:1})}for(let e of t){if(e.occurrences<2)continue;let{representative:t,occurrences:r}=e;n.push({parentResourceType:t.resourceType1,childResourceType:t.resourceType2,occurrences:r,relationship:t,message:`Relationship '${String(t.resourceType1)}' → '${String(t.resourceType2)}' is registered ${r} times with an identical declaration. The registry buckets relationships by filtering the assembled list, so this edge lands ${r} times in the child's parentRelationships and in the parent's childRelationships — composition seeding would create ${r} child rows per parent create, the onParentDelete cascade would dispatch ${r} times, and every startup guard reports it ${r} times. This is almost always a list COMPOSITION mistake in the application/platform host: the same relationship array reaching the registry through two of its slots (e.g. the shared list folded into the bundle passed as the backend list, while it also still flows through the shared slot). Pass each list through exactly one slot. To declare two genuinely different edges between the same pair, make them differ (distinct foreignKeyField, discriminator/condition, or jointResourceType).`})}}return n}function nv(e){let t=new Map;for(let n of e){if(n.isDisabled)continue;let e=n.resourceType1,r=n.resourceType2,i=t.get(e);i||(i=new Set,t.set(e,i)),i.add(r)}return t}function rv(e,t){let n=new Set,r=[e];for(;r.length>0;){let i=r.pop(),a=t.get(i);if(a)for(let t of a)t!==e&&(n.has(t)||(n.add(t),r.push(t)))}return n}function iv(e){let t=nv(e),n=new Map,r=new Set(t.keys());for(let e of r)n.set(e,rv(e,t));return n}var av=function(e){return e.UTF8=`UTF8`,e.BASE64=`BASE64`,e}({}),ov=function(e){return e.NEXT_ACTIONS=`next_actions`,e.SUMMARY=`summary`,e.FLAT=`flat`,e.DETAILED=`detailed`,e}({}),sv=`summary`;function cv(e,t,n){let r=new Map;for(let e of t)r.set(n(e),e);let i=[],a=new Set;for(let t of e){let e=n(t);a.has(e)||(a.add(e),r.has(e)?i.push(r.get(e)):i.push(t))}for(let e of t){let t=n(e);a.has(t)||(a.add(t),i.push(e))}return i}function lv(e,t){if(!e&&!t)return{};if(!e)return{...t};if(!t)return{...e};let n=e.fields??[],r=t.fields??[];return n.length===0&&r.length===0?{}:{fields:cv(n,r,e=>e.fieldIdentifier)}}function uv(e,t){return!e&&!t?[]:e?t?cv(e,t,e=>e.ref):[...e??[]]:[...t??[]]}function dv(e,t){return!e&&!t?[]:pv(e?t?cv(e,t,e=>e.ref):[...e??[]]:[...t??[]])}function fv(e,t){if(!t?.length)return e;let n=[...e];for(let e of t){let t=n.findIndex(t=>t.ref===e.ref);t===-1?n.push(e):n[t].contentKind===Le.NAVIGATION_LIST&&e.contentKind===Le.NAVIGATION_LIST?n=gv(n,e.ref,e.children):n[t]=e}return pv(n)}function pv(e){let t;try{t=va.isDevelopment()}catch{t=!1}if(!t)return e;let n=new Map,r=(e,t)=>{for(let i of e??[]){let e=hv(i),a=n.get(e)??[];a.push(t),n.set(e,a),r(i.children,t)}};for(let t of e)t.contentKind===Le.NAVIGATION_LIST&&r(t.children,t.ref);for(let[e,t]of n)t.length>1&&console.warn(`[sidebar sections] Launcher target "${e}" appears ${t.length} times in the merged sidebar (sections: ${t.join(`, `)}). Only one occurrence will highlight as active. If this duplication is unintentional, remove the extra item from one of the contributing configs.`);return e}function mv(e,t){let n=new Set,r=[];for(let i of[...e,...t])n.has(i.fieldIdentifier)||(n.add(i.fieldIdentifier),r.push(i));return r}function hv(e){switch(e.kind){case ru.RESOURCE_OPERATION:return`resource_operation:${e.resourceType}:${e.operation}:${e.operationVariant??`default`}`;case ru.VIEW:return`${e.kind}:${e.viewRef}`;case ru.RESOURCE_VIEW:return`${e.kind}:${e.resourceType}:${e.viewRef}`;case ru.ENGINE_PAGE:return`engine_page:${e.pageRef}`;case ru.CUSTOM_COMPONENT:return`custom_component:${e.componentRef}`;case ru.SETTINGS_SECTION:return`settings_section:${e.sectionRef??`default`}`;default:throw Error(`launcherItemRefKey: no key for launcher item kind ${e.kind}`)}}function gv(e,t,n){return e?.length?n.length?e.map(e=>{if(e.ref!==t||e.contentKind!==Le.NAVIGATION_LIST)return e;let r=e,i=new Set(r.children.map(hv)),a=n.filter(e=>!i.has(hv(e)));return a.length===0?e:{...r,children:[...r.children,...a]}}):[...e]:e??[]}function _v(e,t){return e?.length?t?.length?cv(e,t,hv):[...e]:[...t??[]]}function vv(e,t){return e?.length?t?.length?cv(e,t,e=>`${hv(e)}:${e.group??`default`}`):[...e]:[...t??[]]}function yv(e,t){return e?.length?t?.length?cv(e,t,e=>e.ref):[...e]:[...t??[]]}function bv(...e){return{resourceConfigurations:Object.assign({},...e.map(e=>e.resourceConfigurations).filter(Boolean)),resourceFieldIdentifiers:Object.assign({},...e.map(e=>e.resourceFieldIdentifiers).filter(Boolean)),resourceRelationships:e.flatMap(e=>e.resourceRelationships??[])}}function xv(e,t){let n=new Map;for(let r of[...e,...t])n.set(r.fieldIdentifier,r);return Array.from(n.values())}function Sv(e,t,n){let r=new Map;for(let t of e)r.set(n(t),t);for(let e of t)r.set(n(e),e);return Array.from(r.values())}function Cv(e){let t=new Map,n=[];for(let r of e)for(let e of r.componentRegistrations??[]){let i=e.preset??q.DEFAULT,a=`${e.componentRef}\u0000${i}`,o=t.get(a);o&&n.push({componentRef:e.componentRef,preset:i,replacedModuleId:o.moduleId,byModuleId:r.moduleId}),t.set(a,{registration:e,moduleId:r.moduleId})}return{registrations:Array.from(t.values(),e=>e.registration),replaced:n}}function ose(...e){return{moduleIds:e.map(e=>e.moduleId),resourceUIBehavior:Object.assign({},...e.map(e=>e.resourceUIBehavior??{})),sidebarSections:e.reduce((e,t)=>fv(e,t.sidebarSections),[]),quickSwitcherFields:e.reduce((e,t)=>xv(e,t.quickSwitcherFields??[]),[]),compositeViews:e.flatMap(e=>Fp(e.compositeViews))}}function wv(...e){return{...ose(...e),menubarItems:e.flatMap(e=>e.menubarItems??[]),commandMenuItems:e.reduce((e,t)=>_v(e,t.commandMenuItems),[]),sidebarSectionItems:e.flatMap(e=>e.sidebarSectionItems??[]),appScope:e.reduce((e,t)=>({...e,...t.appScope,fields:xv(e.fields??[],t.appScope?.fields??[])}),{}),fullCustomViews:e.reduce((e,t)=>yv(e,t.fullCustomViews),[]),onboardingViews:Sv([],e.flatMap(e=>e.onboardingViews??[]),e=>e.ref),guidanceFlows:Sv([],e.flatMap(e=>e.guidanceFlows??[]),e=>e.ref),flowsActorsViews:Sv([],e.flatMap(e=>e.flowsActorsViews??[]),e=>e.ref),componentRegistrations:sse(e)}}function sse(e){let{registrations:t,replaced:n}=Cv(e);for(let e of n)Jo.getLogger().warn(`[frontend-modules] module '${e.byModuleId}' replaces module '${e.replacedModuleId}''s registration of ${e.componentRef} (${e.preset}); only the later one is registered.`,{...e});return t}function Tv(e){let t=xv(e.appScope.fields??[],e.quickSwitcherFields);return t.length===0?e.appScope:{...e.appScope,fields:t}}function Ev(e,t){let n=dv(e,t.sidebarSections);return t.sidebarSectionItems.reduce((e,t)=>gv(e,t.sectionRef,t.items),n)}function Dv(e,t){let n=e[Fu.MENUBAR],r=e[Fu.SIDEBAR],i=e[Fu.COMMAND_MENU];return{...e,[Fu.MENUBAR]:n&&typeof n==`object`&&!Array.isArray(n)?{...n,items:vv(n.items,t.menubarItems)}:n,[Fu.SIDEBAR]:r&&typeof r==`object`?{...r,contentSections:Ev(r.contentSections,t)}:r,[Fu.COMMAND_MENU]:i&&typeof i==`object`?{...i,commands:_v(i.commands,t.commandMenuItems)}:i}}var Q=e(r(),1),Ov;(function(e){e.ENGINE_PANEL=`engine_panel`,e.RESOURCE_OPERATION=`resource_operation`,e.CUSTOM_COMPONENT=`custom_component`,e.SUB_TABS=`sub_tabs`})(Ov||={});var kv;(function(e){e.SECURITY=`security`,e.APPEARANCE=`appearance`,e.INVITATIONS=`invitations`,e.BILLING=`billing`,e.CONNECTED_ACCOUNTS=`connected-accounts`,e.ORGANIZATION_CONNECTED_ACCOUNTS=`organization-connected-accounts`,e.APPLICATION_CONNECTED_ACCOUNTS=`application-connected-accounts`,e.AGENT_WORK_OVERRIDE_RATE=`agent-work-override-rate`,e.AUTONOMOUS_AGENTS=`autonomous-agents`,e.MODEL_COST_BREAKDOWN=`model-cost-breakdown`,e.REPRESENTING_ORGANIZATION_MODEL_COST_BREAKDOWN=`representing-organization-model-cost-breakdown`,e.REPRESENTATIVE_ACTIVITY=`representative-activity`,e.AGENT_WORK_EVALUATION_EXPORT=`agent-work-evaluation-export`})(kv||={});var Av;(function(e){e.REPRESENTS=`relationshipRepresents`,e.GRANTS=`relationshipGrants`,e.INVITES=`relationshipInvites`,e.LENDS=`relationshipLends`})(Av||={});function jv(e){return e.currentOrganizationId?e.organizations?.find(t=>t._id===e.currentOrganizationId)?.type:void 0}function Mv(e){let t=jv(e),n=nl(e.organizationRelationships,e.organizationTypes,t),r=n.some(e=>e.side===$l.REPRESENTING);return{[Av.REPRESENTS]:r,[Av.GRANTS]:n.some(e=>e.side===$l.GRANTING),[Av.INVITES]:r&&ane(e.organizationRelationships,t??void 0).length>0,[Av.LENDS]:n.some(t=>t.side===$l.GRANTING&&tre(e.organizationRelationships,t.kind))}}var Nv;(function(e){e.ASKS_THE_OPERATOR=`relationshipAsksTheOperator`,e.NAMES_THE_OTHER_ORGANIZATION=`relationshipNamesTheOtherOrganization`})(Nv||={});function Pv(e){let t=nl(e.organizationRelationships,e.organizationTypes,jv(e)),n=hie(e.organizationTypes),r=t=>{let r=e.organizationRelationships?.[t];return r?aie(r,n).standing:void 0};return{[Nv.ASKS_THE_OPERATOR]:t.some(e=>e.side===$l.GRANTING&&r(e.kind)===Yo.OPERATOR_IS_PARTY),[Nv.NAMES_THE_OTHER_ORGANIZATION]:t.some(e=>r(e.kind)===Yo.INDEPENDENT_PARTIES)}}var Fv;(function(e){e.ENABLED=`scimEnabled`,e.ORGANIZATION_TYPE_ADMITS=`scimOrganizationTypeAdmitsDirectory`,e.SETTINGS_REACHABLE=`scimSettingsReachable`})(Fv||={});function Iv(e){return e.organizationTypeKnown&&!(e.featureOffered&&e.organizationTypeDirectoryProvisioned)}function Lv(e){let t=e.featureOffered&&e.organizationTypeDirectoryProvisioned;return{[Fv.ENABLED]:t,[Fv.ORGANIZATION_TYPE_ADMITS]:e.organizationTypeDirectoryProvisioned,[Fv.SETTINGS_REACHABLE]:t||e.holdsUnrevokedToken}}var Rv=[_d.ORG_OWNER,_d.ORG_ADMIN],zv=[vi.APP_ADMIN_SUPER_ADMIN],Bv=`billingEnabled`,Vv=`professionalQualificationsDeclared`,Hv=[{ref:ti.PROFILE,icon:H.PROFILE,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.USER_SELF_PROFILES,operation:W.READ}},{ref:ti.SECURITY,icon:H.LOCK,target:{kind:Ov.ENGINE_PANEL,panelRef:kv.SECURITY}},{ref:ti.APPEARANCE,icon:H.PALETTE,target:{kind:Ov.ENGINE_PANEL,panelRef:kv.APPEARANCE}},{ref:ti.PREFERENCES,icon:H.SLIDERS,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.USER_SELF_PREFERENCES,operation:W.READ}},{ref:ti.MY_INVITATIONS,icon:H.MAIL,target:{kind:Ov.ENGINE_PANEL,panelRef:kv.INVITATIONS}},{ref:ti.DEACTIVATE_ACCOUNT,icon:H.USER_COG,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.USER_SELF,operation:A.DEACTIVATE_ACCOUNT}},{ref:ti.MY_PROVIDER_CREDENTIALS,icon:H.PLUG,target:{kind:Ov.ENGINE_PANEL,panelRef:kv.CONNECTED_ACCOUNTS}},{ref:ti.AUTHORIZED_APPS,icon:H.THIRD_PARTY_APP,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.OAUTH_CONSENT_GRANTS,operation:W.LIST}},{ref:ti.MY_DATA_SUBJECT_REQUESTS,icon:H.SHIELD,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.DATA_SUBJECT_REQUESTS,operation:W.LIST}},{ref:ti.MY_AGENT_PUSH_DELIVERIES,icon:H.NOTIFICATION,requiredEngineCapabilities:[Wd.AI_LLM],target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.USER_A2A_PUSH_DELIVERY_LOG,operation:W.LIST}},{ref:ti.ORGANIZATION_GENERAL,icon:H.ORGANIZATION,requiredRoles:Rv,target:{kind:Ov.SUB_TABS,subTabs:[{ref:`organization-general-record`,label:`Organization`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATIONS,operation:W.READ}},{ref:`organization-general-profile`,label:`Profile`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_PROFILES,operation:W.READ}},{ref:`organization-general-preferences`,label:`Preferences`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_PREFERENCES,operation:W.READ}},{ref:`organization-general-notifications`,label:`Notifications`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_NOTIFICATIONS,operation:W.READ}}]}},{ref:ti.MEMBERS,icon:H.USERS,requiredRoles:Rv,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_MEMBERS,operation:W.LIST}},{ref:ti.ORGANIZATION_UNITS,icon:H.HIERARCHY,requiredRoles:Rv,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_UNITS,operation:W.LIST}},{ref:ti.BILLING,icon:H.CREDIT_CARD,requiredRoles:Rv,runtimeAvailability:{requiredCapabilities:[Bv]},target:{kind:Ov.ENGINE_PANEL,panelRef:kv.BILLING}},{ref:ti.API_KEYS,icon:H.KEY,requiredRoles:Rv,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORG_API_KEYS,operation:W.LIST}},{ref:ti.ORGANIZATION_OAUTH_CLIENTS,icon:H.LINK,requiredRoles:Rv,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.OAUTH_CLIENTS_ORGANIZATION,operation:W.LIST}},{ref:ti.PROVIDER_CREDENTIALS,icon:H.PLUG,requiredRoles:Rv,target:{kind:Ov.ENGINE_PANEL,panelRef:kv.ORGANIZATION_CONNECTED_ACCOUNTS}},{ref:ti.SSO,icon:H.LOGIN,requiredRoles:Rv,runtimeAvailability:{requiredCapabilities:[`ssoEnabled`]},entitlementFeatureId:ou.SINGLE_SIGN_ON,target:{kind:Ov.SUB_TABS,subTabs:[{ref:`sso-configuration`,label:`Configuration`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_SSO_CONFIG,operation:W.READ}},{ref:`sso-connections`,label:`Connections`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_SSO_CONNECTIONS,operation:W.LIST}}]}},{ref:ti.SCIM,icon:H.USER_COG,requiredRoles:Rv,runtimeAvailability:{requiredCapabilities:[Fv.SETTINGS_REACHABLE]},entitlementFeatureId:ou.DIRECTORY_PROVISIONING,target:{kind:Ov.SUB_TABS,subTabs:[{ref:`scim-provisioning`,label:`Provisioning`,runtimeAvailability:{requiredCapabilities:[Fv.ENABLED]},target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_SCIM_PROVISIONING_CONFIG,operation:W.READ}},{ref:`scim-tokens`,label:`Tokens`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_SCIM_TOKENS,operation:W.LIST}}]}},{ref:ti.SIEM,icon:H.ACTIVITY,requiredRoles:Rv,runtimeAvailability:{requiredCapabilities:[`siemEnabled`]},entitlementFeatureId:ou.SECURITY_EVENT_EXPORT,target:{kind:Ov.SUB_TABS,subTabs:[{ref:`siem-export`,label:`Export`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_SIEM_EXPORT_CONFIG,operation:W.READ}},{ref:`siem-failed-deliveries`,label:`Failed deliveries`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_SIEM_DELIVERY_DLQ,operation:W.LIST}}]}},{ref:ti.WEBHOOKS,icon:H.WEBHOOK,requiredRoles:Rv,runtimeAvailability:{requiredCapabilities:[`webhooksEnabled`]},entitlementFeatureId:ou.M2M_WEBHOOK_DELIVERY,target:{kind:Ov.SUB_TABS,subTabs:[{ref:`webhooks-endpoints`,label:`Endpoints`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_WEBHOOK_CONFIG,operation:W.READ}},{ref:`webhooks-delivery-log`,label:`Delivery log`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG,operation:W.LIST}}]}},{ref:ti.INBOUND_DELIVERIES,icon:H.INBOX,requiredRoles:Rv,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_INBOUND_DELIVERIES,operation:W.LIST}},{ref:ti.AGENT_PUSH_DELIVERIES,icon:H.NOTIFICATION,requiredRoles:Rv,requiredEngineCapabilities:[Wd.AI_LLM],target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_A2A_PUSH_DELIVERY_LOG,operation:W.LIST}},{ref:ti.RELATIONSHIPS,icon:H.HANDSHAKE,requiredRoles:Rv,runtimeAvailability:{requiredCapabilities:[Av.GRANTS]},target:{kind:Ov.SUB_TABS,subTabs:[{ref:`relationships-organizations`,label:`Organizations`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_RELATIONSHIPS,operation:W.LIST}},{ref:`relationships-delegated-capabilities`,label:`Delegated capabilities`,runtimeAvailability:{requiredCapabilities:[Av.LENDS]},target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.RELATIONSHIP_CAPABILITY_GRANTS,operation:W.LIST}}]}},{ref:ti.REPRESENTATIONS,icon:H.BRIEFCASE,requiredRoles:Rv,runtimeAvailability:{requiredCapabilities:[Av.REPRESENTS]},target:{kind:Ov.SUB_TABS,subTabs:[{ref:`representations-organizations`,label:`Organizations`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_REPRESENTATIONS,operation:W.LIST}},{ref:`representations-invitations`,label:`Invitations`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.RELATIONSHIP_INVITATIONS,operation:W.LIST}},{ref:`representations-model-cost`,label:`Model cost`,target:{kind:Ov.ENGINE_PANEL,panelRef:kv.REPRESENTING_ORGANIZATION_MODEL_COST_BREAKDOWN}},{ref:`representations-activity`,label:`Activity`,target:{kind:Ov.ENGINE_PANEL,panelRef:kv.REPRESENTATIVE_ACTIVITY}}]}},{ref:ti.AUDIT_LOGS,icon:H.SCROLL,requiredRoles:Rv,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.AUDIT_LOGS,operation:W.LIST}},{ref:ti.OPERATOR_ACCESS,icon:H.SHIELD,requiredRoles:[...Rv,_d.ORG_DELEGATED_APPROVE_ACCESS_GRANTS],target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.PLATFORM_ACCESS_GRANTS,operation:W.LIST}},{ref:ti.ORGANIZATION_ENTITLEMENTS,icon:H.BADGE_CHECK,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_FEATURES,operation:W.READ}},{ref:ti.ORGANIZATION_REFERRALS,icon:H.GIFT,requiredRoles:[_d.ORG_OWNER],runtimeAvailability:{requiredCapabilities:[Bv]},target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.REFERRALS,operation:W.LIST}},{ref:ti.ORGANIZATION_LEGAL_HOLDS,icon:H.SCALE,requiredRoles:[_d.ORG_OWNER],target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.LEGAL_HOLDS,operation:W.LIST}},{ref:ti.ORGANIZATION_PROFESSIONAL_QUALIFICATIONS,icon:H.BADGE_CHECK,requiredRoles:[_d.ORG_ADMIN],runtimeAvailability:{requiredCapabilities:[Vv]},target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.PROFESSIONAL_QUALIFICATIONS,operation:W.LIST}},{ref:ti.EMAIL_DOMAINS,icon:H.GLOBE,requiredRoles:Rv,requiredEngineCapabilities:[Wd.EMAIL_INBOUND],target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_EMAIL_DOMAINS,operation:W.LIST}},{ref:ti.CUSTOM_DOMAINS,icon:H.GLOBE,requiredRoles:Rv,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_CUSTOM_DOMAINS,operation:W.LIST}},{ref:ti.RELATIONSHIP_MAILBOXES,icon:H.MAILBOX,requiredRoles:Rv,requiredEngineCapabilities:[Wd.EMAIL_INBOUND],runtimeAvailability:{requiredCapabilities:[Av.REPRESENTS]},target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.RELATIONSHIP_MAILBOXES,operation:W.LIST}},{ref:ti.CHAT_ACCOUNTS,icon:H.CHAT,requiredRoles:Rv,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.CHAT_IDENTITY_LINKS,operation:W.LIST}},{ref:ti.MY_CHAT_ACCOUNTS,icon:H.CHAT,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.CHAT_IDENTITY_LINKS,operation:W.LIST,operationVariant:`own`}},{ref:ti.AGENT_RUNS,icon:H.BRAIN,requiredRoles:Rv,requiredEngineCapabilities:[Wd.AI_LLM],target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_FLOW_ACTOR_EXECUTIONS,operation:W.LIST}},{ref:ti.AUTONOMOUS_AGENTS,icon:H.CLOCK,requiredRoles:Rv,requiredEngineCapabilities:[Wd.AI_LLM],target:{kind:Ov.ENGINE_PANEL,panelRef:kv.AUTONOMOUS_AGENTS}},{ref:ti.CHAT_AGENTS,icon:H.CHAT,requiredRoles:Rv,requiredEngineCapabilities:[Wd.AI_LLM],target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_CHAT_SETTINGS,operation:W.LIST}},{ref:ti.AGENT_WORK_REVIEW,icon:H.BRAIN,requiredRoles:Rv,requiredEngineCapabilities:[Wd.AI_LLM],target:{kind:Ov.SUB_TABS,subTabs:[{ref:`agent-work-override-rate`,label:`Override rate`,target:{kind:Ov.ENGINE_PANEL,panelRef:kv.AGENT_WORK_OVERRIDE_RATE}},{ref:`agent-work-decisions`,label:`Decisions`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_AGENT_WORK_DECISIONS,operation:W.LIST}},{ref:`agent-behavior-reports`,label:`Reports`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.AGENT_BEHAVIOR_REPORTS,operation:W.LIST}},{ref:`agent-work-content-capture`,label:`Content capture`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.AGENT_WORK_CAPTURE_SETTINGS,operation:W.READ}},{ref:`agent-work-export-authorization`,label:`Export authorisation`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.EVALUATION_EXPORT_AUTHORIZATIONS,operation:W.READ}},{ref:`agent-work-run-export`,label:`Run an export`,target:{kind:Ov.ENGINE_PANEL,panelRef:kv.AGENT_WORK_EVALUATION_EXPORT}},{ref:`agent-work-exports`,label:`Exports`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.EVALUATION_DATASET_EXPORTS,operation:W.LIST}}]}},{ref:ti.AGENT_POLICY,icon:H.BRAIN,requiredRoles:Rv,requiredEngineCapabilities:[Wd.AI_LLM],target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_AGENT_POLICIES,operation:W.READ}},{ref:ti.APPLICATION_GENERAL,icon:H.APP_WINDOW,requiredRoles:zv,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_METADATA,operation:W.READ}},{ref:ti.APPLICATION_VERSIONS,icon:H.HISTORY,requiredRoles:zv,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_VERSIONS,operation:W.LIST}},{ref:ti.APPLICATION_ENTITLEMENTS,icon:H.BADGE_CHECK,requiredRoles:zv,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_FEATURES,operation:W.READ}},{ref:ti.APPLICATION_API_KEYS,icon:H.KEY,requiredRoles:zv,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_API_KEYS,operation:W.LIST}},{ref:ti.APPLICATION_SSO,icon:H.LOGIN,requiredRoles:zv,target:{kind:Ov.SUB_TABS,subTabs:[{ref:`application-sso-configuration`,label:`Configuration`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_SSO_CONFIG,operation:W.READ}},{ref:`application-sso-connections`,label:`Connections`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_SSO_CONNECTIONS,operation:W.LIST}}]}},{ref:ti.APPLICATION_SCIM,icon:H.USER_COG,requiredRoles:zv,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_SCIM_PROVISIONING_CONFIG,operation:W.READ}},{ref:ti.APPLICATION_SIEM,icon:H.ACTIVITY,requiredRoles:zv,target:{kind:Ov.SUB_TABS,subTabs:[{ref:`application-siem-export`,label:`Export`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_SIEM_EXPORT_CONFIG,operation:W.READ}},{ref:`application-siem-failed-deliveries`,label:`Failed deliveries`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_SIEM_DELIVERY_DLQ,operation:W.LIST}}]}},{ref:ti.APPLICATION_WEBHOOKS,icon:H.WEBHOOK,requiredRoles:zv,target:{kind:Ov.SUB_TABS,subTabs:[{ref:`application-webhooks-endpoints`,label:`Endpoints`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_WEBHOOK_CONFIG,operation:W.READ}},{ref:`application-webhooks-delivery-log`,label:`Delivery log`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_M2M_WEBHOOK_DELIVERY_LOG,operation:W.LIST}}]}},{ref:ti.BILLING_CATALOG,icon:H.PACKAGE,requiredRoles:zv,runtimeAvailability:{requiredCapabilities:[Bv]},target:{kind:Ov.SUB_TABS,subTabs:[{ref:`billing-catalog-products`,label:`Products`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.PRODUCTS,operation:W.LIST}},{ref:`billing-catalog-promotions`,label:`Promotions`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.PROMOTIONS,operation:W.LIST}}]}},{ref:ti.APPLICATION_PROVIDER_CONNECTIONS,icon:H.PLUG,requiredRoles:zv,target:{kind:Ov.ENGINE_PANEL,panelRef:kv.APPLICATION_CONNECTED_ACCOUNTS}},{ref:ti.APPLICATION_OAUTH_CLIENTS,icon:H.LINK,requiredRoles:zv,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.OAUTH_CLIENTS_APPLICATION,operation:W.LIST}},{ref:ti.APPLICATION_ACCESS_GRANTS,icon:H.SHIELD,requiredRoles:zv,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_ACCESS_GRANTS,operation:W.LIST}},{ref:ti.APPLICATION_ORGANIZATIONS,icon:H.ORGANIZATION,requiredRoles:zv,target:{kind:Ov.SUB_TABS,subTabs:[{ref:`application-organizations-directory`,label:`All organizations`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.ORGANIZATIONS,operation:W.LIST,operationVariant:rte.DIRECTORY}},{ref:`application-organizations-access-grants`,label:`Access windows`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_ACCESS_GRANTS,operation:W.LIST}}]}},{ref:ti.APPLICATION_DATA_SUBJECT_REQUESTS,icon:H.SHIELD,requiredRoles:[vi.APP_ADMIN_SUPER_ADMIN],target:{kind:Ov.SUB_TABS,subTabs:[{ref:`application-data-subject-requests-queue`,label:`Requests to answer`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.DATA_SUBJECT_REQUESTS,operation:Uie.OPERATOR_QUEUE}},{ref:`application-data-subject-requests-access-grants`,label:`Access windows`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_ACCESS_GRANTS,operation:W.LIST}}]}},{ref:ti.APPLICATION_INBOUND_DELIVERIES,icon:H.INBOX,requiredRoles:[vi.APP_ADMIN_SUPER_ADMIN],target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_INBOUND_DELIVERIES,operation:W.LIST}},{ref:ti.APPLICATION_SMS_NUMBERS,icon:H.SMARTPHONE,requiredRoles:[vi.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[Wd.SMS],target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.SMS_NUMBER_ASSIGNMENTS,operation:W.LIST}},{ref:ti.APPLICATION_AGENT_PUSH_DELIVERIES,icon:H.NOTIFICATION,requiredRoles:[vi.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[Wd.AI_LLM],target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_A2A_PUSH_DELIVERY_LOG,operation:W.LIST}},{ref:ti.APPLICATION_AGENT_RUNS,icon:H.BRAIN,requiredRoles:[vi.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[Wd.AI_LLM],target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_FLOW_ACTOR_EXECUTIONS,operation:W.LIST}},{ref:ti.APPLICATION_AGENT_WORK_REVIEW,icon:H.BRAIN,requiredRoles:[vi.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[Wd.AI_LLM],target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_AGENT_WORK_DECISIONS,operation:W.LIST}},{ref:ti.APPLICATION_AGENT_POLICY,icon:H.BRAIN,requiredRoles:zv,requiredEngineCapabilities:[Wd.AI_LLM],target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_AGENT_POLICIES,operation:W.READ}},{ref:ti.APPLICATION_SYSTEM_OF_RECORD_PARTITIONS,icon:H.ORGANIZATION,requiredRoles:[vi.APP_ADMIN_SUPER_ADMIN],target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.SYSTEM_OF_RECORD_PARTITION_ASSIGNMENTS,operation:W.LIST}},{ref:ti.APPLICATION_MODEL_COSTS,icon:H.RECEIPT,requiredRoles:[vi.APP_ADMIN_SUPER_ADMIN,vi.APP_ADMIN_BILLING_MANAGER],requiredEngineCapabilities:[Wd.AI_LLM],target:{kind:Ov.SUB_TABS,subTabs:[{ref:`model-costs-by-month`,label:`By month`,target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.MODEL_COST_PERIOD_AGGREGATES,operation:W.LIST}},{ref:`model-costs-breakdown`,label:`Breakdown`,target:{kind:Ov.ENGINE_PANEL,panelRef:kv.MODEL_COST_BREAKDOWN}}]}},{ref:ti.APPLICATION_RETENTION_ENFORCEMENT,icon:H.CLOCK,requiredRoles:[vi.APP_ADMIN_SUPER_ADMIN,vi.APP_AUDIT_EVIDENCE_READER],target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.RETENTION_ENFORCEMENT_RECORDS,operation:W.LIST}},{ref:ti.APPLICATION_AUDIT_LOGS,icon:H.SCROLL,requiredRoles:[vi.APP_ADMIN_SUPER_ADMIN,vi.APP_AUDIT_EVIDENCE_READER],target:{kind:Ov.RESOURCE_OPERATION,resourceType:Na.APPLICATION_AUDIT_LOGS,operation:W.LIST}}],Uv=[{ref:`people`,label:`People`,order:0},{ref:`billing`,label:`Billing & entitlements`,order:1},{ref:`security`,label:`Security & access`,order:2},{ref:`integrations`,label:`Integrations`,order:3},{ref:`compliance`,label:`Compliance`,order:4},{ref:`ai`,label:`AI`,order:5}],cse={categories:[{ref:`account`,label:`Account`,scope:td.USER_SELF,order:0},{ref:`organization`,label:`Organization`,scope:td.ORGANIZATIONS,order:1,groups:Uv},{ref:`administration`,label:`Administration`,scope:td.APPLICATION,order:2,groups:Uv}],placements:[{destinationRef:ti.PROFILE,categoryRef:`account`,label:`Profile`,order:0},{destinationRef:ti.SECURITY,categoryRef:`account`,label:`Security`,order:1},{destinationRef:ti.APPEARANCE,categoryRef:`account`,label:`Appearance`,order:2},{destinationRef:ti.PREFERENCES,categoryRef:`account`,label:`Preferences`,order:3},{destinationRef:ti.MY_INVITATIONS,categoryRef:`account`,label:`Invitations`,order:4},{destinationRef:ti.MY_PROVIDER_CREDENTIALS,categoryRef:`account`,label:`Integrations`,order:5},{destinationRef:ti.AUTHORIZED_APPS,categoryRef:`account`,label:`Authorized apps`,order:6},{destinationRef:ti.MY_AGENT_PUSH_DELIVERIES,categoryRef:`account`,label:`Agent push deliveries`,order:7},{destinationRef:ti.MY_DATA_SUBJECT_REQUESTS,categoryRef:`account`,label:`Data requests`,order:8},{destinationRef:ti.DEACTIVATE_ACCOUNT,categoryRef:`account`,label:`Deactivate account`,order:9},{destinationRef:ti.ORGANIZATION_GENERAL,categoryRef:`organization`,label:`General`,order:0},{destinationRef:ti.MEMBERS,categoryRef:`organization`,groupRef:`people`,label:`Members`,order:1},{destinationRef:ti.ORGANIZATION_UNITS,categoryRef:`organization`,groupRef:`people`,label:`Organization units`,order:2},{destinationRef:ti.ORGANIZATION_ENTITLEMENTS,categoryRef:`organization`,groupRef:`billing`,label:`Entitlements`,order:3},{destinationRef:ti.BILLING,categoryRef:`organization`,groupRef:`billing`,label:`Billing`,order:4},{destinationRef:ti.ORGANIZATION_REFERRALS,categoryRef:`organization`,groupRef:`billing`,label:`Referrals`,order:5},{destinationRef:ti.API_KEYS,categoryRef:`organization`,groupRef:`security`,label:`API keys`,order:6},{destinationRef:ti.ORGANIZATION_OAUTH_CLIENTS,categoryRef:`organization`,groupRef:`security`,label:`OAuth clients`,order:7},{destinationRef:ti.PROVIDER_CREDENTIALS,categoryRef:`organization`,groupRef:`integrations`,label:`Integrations`,order:8},{destinationRef:ti.SSO,categoryRef:`organization`,groupRef:`security`,label:`SSO — OIDC / SAML`,order:9},{destinationRef:ti.SCIM,categoryRef:`organization`,groupRef:`security`,label:`SCIM provisioning`,order:10},{destinationRef:ti.SIEM,categoryRef:`organization`,groupRef:`compliance`,label:`SIEM export`,order:11},{destinationRef:ti.WEBHOOKS,categoryRef:`organization`,groupRef:`integrations`,label:`Webhooks`,order:12},{destinationRef:ti.AGENT_PUSH_DELIVERIES,categoryRef:`organization`,groupRef:`integrations`,label:`Agent push deliveries`,order:13},{destinationRef:ti.AUDIT_LOGS,categoryRef:`organization`,groupRef:`compliance`,label:`Audit log`,order:14},{destinationRef:ti.OPERATOR_ACCESS,categoryRef:`organization`,groupRef:`security`,label:`Operator access`,order:15},{destinationRef:ti.INBOUND_DELIVERIES,categoryRef:`organization`,groupRef:`integrations`,label:`Inbound deliveries`,order:16},{destinationRef:ti.RELATIONSHIPS,categoryRef:`organization`,groupRef:`people`,label:`Relationships`,order:17},{destinationRef:ti.REPRESENTATIONS,categoryRef:`organization`,groupRef:`people`,label:`Representations`,order:18},{destinationRef:ti.ORGANIZATION_LEGAL_HOLDS,categoryRef:`organization`,groupRef:`compliance`,label:`Legal holds`,order:19},{destinationRef:ti.EMAIL_DOMAINS,categoryRef:`organization`,groupRef:`integrations`,label:`Email domains`,order:20},{destinationRef:ti.RELATIONSHIP_MAILBOXES,categoryRef:`organization`,groupRef:`integrations`,label:`Relationship mailboxes`,order:21},{destinationRef:ti.MY_CHAT_ACCOUNTS,categoryRef:`organization`,groupRef:`integrations`,label:`My chat accounts`,order:22},{destinationRef:ti.CHAT_ACCOUNTS,categoryRef:`organization`,groupRef:`integrations`,label:`Chat accounts`,order:23},{destinationRef:ti.AGENT_WORK_REVIEW,categoryRef:`organization`,groupRef:`ai`,label:`Agent work review`,order:24},{destinationRef:ti.AGENT_RUNS,categoryRef:`organization`,groupRef:`ai`,label:`Agent runs`,order:25},{destinationRef:ti.AUTONOMOUS_AGENTS,categoryRef:`organization`,groupRef:`ai`,label:`Autonomous agents`,order:26},{destinationRef:ti.CHAT_AGENTS,categoryRef:`organization`,groupRef:`ai`,label:`Chat agents`,order:27},{destinationRef:ti.AGENT_POLICY,categoryRef:`organization`,groupRef:`ai`,label:`Agent policy`,order:28},{destinationRef:ti.ORGANIZATION_PROFESSIONAL_QUALIFICATIONS,categoryRef:`organization`,groupRef:`people`,label:`Professional qualifications`,order:29},{destinationRef:ti.CUSTOM_DOMAINS,categoryRef:`organization`,groupRef:`integrations`,label:`Custom domains`,order:30},{destinationRef:ti.APPLICATION_GENERAL,categoryRef:`administration`,label:`General`,order:0},{destinationRef:ti.APPLICATION_ORGANIZATIONS,categoryRef:`administration`,label:`Organizations`,order:1},{destinationRef:ti.APPLICATION_SYSTEM_OF_RECORD_PARTITIONS,categoryRef:`administration`,label:`System-of-record partitions`,order:2},{destinationRef:ti.APPLICATION_ENTITLEMENTS,categoryRef:`administration`,groupRef:`billing`,label:`Entitlements`,order:3},{destinationRef:ti.BILLING_CATALOG,categoryRef:`administration`,groupRef:`billing`,label:`Plans & pricing`,order:4},{destinationRef:ti.APPLICATION_MODEL_COSTS,categoryRef:`administration`,groupRef:`billing`,label:`Model costs`,order:5},{destinationRef:ti.APPLICATION_API_KEYS,categoryRef:`administration`,groupRef:`security`,label:`API keys`,order:6},{destinationRef:ti.APPLICATION_OAUTH_CLIENTS,categoryRef:`administration`,groupRef:`security`,label:`OAuth clients`,order:7},{destinationRef:ti.APPLICATION_SSO,categoryRef:`administration`,groupRef:`security`,label:`SSO — OIDC / SAML`,order:8},{destinationRef:ti.APPLICATION_SCIM,categoryRef:`administration`,groupRef:`security`,label:`SCIM provisioning`,order:9},{destinationRef:ti.APPLICATION_SIEM,categoryRef:`administration`,groupRef:`compliance`,label:`SIEM export`,order:10},{destinationRef:ti.APPLICATION_PROVIDER_CONNECTIONS,categoryRef:`administration`,groupRef:`integrations`,label:`Integrations`,order:11},{destinationRef:ti.APPLICATION_WEBHOOKS,categoryRef:`administration`,groupRef:`integrations`,label:`Webhooks`,order:12},{destinationRef:ti.APPLICATION_AGENT_PUSH_DELIVERIES,categoryRef:`administration`,groupRef:`integrations`,label:`Agent push deliveries`,order:13},{destinationRef:ti.APPLICATION_AUDIT_LOGS,categoryRef:`administration`,groupRef:`compliance`,label:`Audit log`,order:14},{destinationRef:ti.APPLICATION_ACCESS_GRANTS,categoryRef:`administration`,groupRef:`security`,label:`Access grants`,order:15},{destinationRef:ti.APPLICATION_VERSIONS,categoryRef:`administration`,label:`Versions`,order:16},{destinationRef:ti.APPLICATION_INBOUND_DELIVERIES,categoryRef:`administration`,groupRef:`integrations`,label:`Inbound deliveries`,order:17},{destinationRef:ti.APPLICATION_RETENTION_ENFORCEMENT,categoryRef:`administration`,groupRef:`compliance`,label:`Retention enforcement`,order:18},{destinationRef:ti.APPLICATION_AGENT_WORK_REVIEW,categoryRef:`administration`,groupRef:`ai`,label:`Agent work review`,order:19},{destinationRef:ti.APPLICATION_AGENT_RUNS,categoryRef:`administration`,groupRef:`ai`,label:`Agent runs`,order:20},{destinationRef:ti.APPLICATION_AGENT_POLICY,categoryRef:`administration`,groupRef:`ai`,label:`Agent policy`,order:21},{destinationRef:ti.APPLICATION_DATA_SUBJECT_REQUESTS,categoryRef:`administration`,groupRef:`compliance`,label:`Data subject requests`,order:22},{destinationRef:ti.APPLICATION_SMS_NUMBERS,categoryRef:`administration`,groupRef:`integrations`,label:`SMS numbers`,order:23}],defaultSectionRef:`profile`},Wv=new Map(Hv.map(e=>[e.ref,e]));function Gv(e){let t=new Map(Wv),n=new Set,r=[],i=[];for(let a of e?.destinations??[])Wv.has(a.ref)?r.push(a.ref):n.has(a.ref)?i.push(a.ref):(t.set(a.ref,a),n.add(a.ref));return{byRef:t,applicationDestinationRefs:n,refsShadowingEngineDestinations:r,duplicateApplicationDestinationRefs:i}}function Kv(e){if(e===void 0)return{categories:[],sections:[]};let t=Gv(e),n=[];for(let r of e.placements){let e=t.byRef.get(r.destinationRef);e!==void 0&&n.push({ref:e.ref,categoryRef:r.categoryRef,...r.groupRef===void 0?{}:{groupRef:r.groupRef},label:r.label??e.ref,icon:r.icon??e.icon,order:r.order,target:e.target,runtimeAvailability:e.runtimeAvailability,requiredFeatures:e.requiredFeatures,requiredRoles:e.requiredRoles,entitlementFeatureId:e.entitlementFeatureId,requiredEngineCapabilities:e.requiredEngineCapabilities})}return{categories:e.categories,sections:n,defaultSectionRef:e.defaultSectionRef}}function qv(e){if(e===void 0)return[];let t=Gv(e);return e.placements.map(e=>e.destinationRef).filter(e=>!t.byRef.has(e))}function Jv(){let{settingsHub:e}=e_();return(0,Q.useMemo)(()=>Kv(e),[e])}var Yv;(function(e){e.ERROR=`error`,e.WARNING=`warning`})(Yv||={});var Xv;(function(e){e.RESOURCE_NOT_FOUND=`RESOURCE_NOT_FOUND`,e.OPERATION_NOT_FOUND=`OPERATION_NOT_FOUND`,e.VIEW_NOT_FOUND=`VIEW_NOT_FOUND`,e.VIEW_REF_COLLISION=`VIEW_REF_COLLISION`,e.ENGINE_PAGE_NOT_FOUND=`ENGINE_PAGE_NOT_FOUND`,e.RESOURCE_BROWSER_RESOURCE_NOT_FOUND=`RESOURCE_BROWSER_RESOURCE_NOT_FOUND`,e.RESOURCE_BROWSER_BOUND_OPERATION_NOT_FOUND=`RESOURCE_BROWSER_BOUND_OPERATION_NOT_FOUND`,e.RESOURCE_BROWSER_NAVIGATION_OPERATION_NOT_FOUND=`RESOURCE_BROWSER_NAVIGATION_OPERATION_NOT_FOUND`,e.RESOURCE_BROWSER_MISSING_LABEL_CONFIG=`RESOURCE_BROWSER_MISSING_LABEL_CONFIG`,e.ACTIVITY_BAR_ENABLED_BUT_NO_APP_MODES=`ACTIVITY_BAR_ENABLED_BUT_NO_APP_MODES`,e.HOSTED_COMPONENT_NOT_CONFIGURED=`HOSTED_COMPONENT_NOT_CONFIGURED`,e.VISIBLE_IN_MODES_ORPHAN=`VISIBLE_IN_MODES_ORPHAN`,e.NOTIFICATION_BADGE_REF_NOT_FOUND=`NOTIFICATION_BADGE_REF_NOT_FOUND`,e.APP_SCOPE_DUPLICATE_RESOURCE_TYPE=`APP_SCOPE_DUPLICATE_RESOURCE_TYPE`,e.VIEW_NOT_LAUNCHABLE=`VIEW_NOT_LAUNCHABLE`,e.UNKNOWN_TARGET_KIND=`UNKNOWN_TARGET_KIND`,e.SETTINGS_SECTION_NOT_PLACED=`SETTINGS_SECTION_NOT_PLACED`,e.REQUIRED_ROLES_UNKNOWN_ROLE=`REQUIRED_ROLES_UNKNOWN_ROLE`})(Xv||={});function lse(e){let t=new Map,n=new Set,r=new Map,i=new Map,a=new Map,o=(e,r)=>{e.scope===fm.APPLICATION&&(t.has(e.ref)?n.add(e.ref):t.set(e.ref,{family:r}))};for(let t of e.compositeViews??[])r.set(t.ref,t),o(t,`composite`);for(let t of e.fullCustomViews??[])i.set(t.ref,t),o(t,`fullCustom`);for(let t of e.flowsActorsViews??[])a.set(t.ref,t),o(t,`flowsActors`);return{applicationViewsByRef:t,duplicateApplicationViewRefs:n,compositeViewsByRef:r,fullCustomViewsByRef:i,flowsActorsViewsByRef:a}}function Zv(e,t,n,r,i,a,o){let s=a===`application`?use(e.viewRef,r,t,i,e):dse(e,n,t,i);if(s)switch(s.family){case`fullCustom`:{let n=r.fullCustomViewsByRef.get(e.viewRef);n&&o&&!o(n.componentRef)&&i.push({severity:Yv.ERROR,code:Xv.HOSTED_COMPONENT_NOT_CONFIGURED,context:t,message:`Full custom view "${e.viewRef}" references component "${n.componentRef}" which is not registered in ComponentRegistryService`,item:e});break}}}function use(e,t,n,r,i){return t.duplicateApplicationViewRefs.has(e)?(r.push({severity:Yv.ERROR,code:Xv.VIEW_REF_COLLISION,context:n,message:`Application view ref "${e}" is declared by multiple special-view families in the same launcher scope`,item:i}),null):t.applicationViewsByRef.get(e)||(r.push({severity:Yv.ERROR,code:Xv.VIEW_NOT_FOUND,context:n,message:`Application view "${e}" not found in any compatible special-view definition`,item:i}),null)}function dse(e,t,n,r){if(!t.resourceConfigurations[e.resourceType])return r.push({severity:Yv.ERROR,code:Xv.RESOURCE_NOT_FOUND,context:n,message:`Resource type "${e.resourceType}" not found in registry`,item:e}),null;if(Wh({resourceType:e.resourceType,viewRef:e.viewRef,registry:t}).length>1)return r.push({severity:Yv.ERROR,code:Xv.VIEW_REF_COLLISION,context:n,message:`Resource view ref "${e.viewRef}" is declared multiple times on resource "${e.resourceType}". RESOURCE_VIEW refs must be unique per resource-owned view namespace.`,item:e}),null;let i=rg({resourceType:e.resourceType,viewRef:e.viewRef,registry:t});return i?i.scope===fm.RESOURCE?{family:i.family}:(r.push({severity:Yv.ERROR,code:Xv.VIEW_NOT_LAUNCHABLE,context:n,message:`Resource view "${e.viewRef}" on resource "${e.resourceType}" must be declared with RESOURCE scope to be targeted by RESOURCE_VIEW launchers`,item:e}),null):(r.push({severity:Yv.ERROR,code:Xv.VIEW_NOT_FOUND,context:n,message:`Resource view "${e.viewRef}" is not declared on resource "${e.resourceType}"`,item:e}),null)}function Qv(e,t,n,r,i,a,o){switch(e.kind){case ru.RESOURCE_OPERATION:{let r=n.resourceConfigurations[e.resourceType];if(!r){i.push({severity:Yv.ERROR,code:Xv.RESOURCE_NOT_FOUND,context:t,message:`Resource type "${e.resourceType}" not found in registry`,item:e});return}let a=r.operations.filter(t=>t.operationIdentifier===e.operation);if(!(e.operationVariant?a.some(t=>t.variantKey===e.operationVariant):a.length>0))i.push({severity:Yv.ERROR,code:Xv.OPERATION_NOT_FOUND,context:t,message:`Operation "${e.operation}"${e.operationVariant?` (variant: ${e.operationVariant})`:``} not found on resource "${e.resourceType}"`,item:e});else if(!e.operationVariant){let n=a.filter(e=>e.isOperationDefault===!0);a.length>1&&n.length!==1&&i.push({severity:Yv.ERROR,code:Xv.OPERATION_NOT_FOUND,context:t,message:`Operation "${e.operation}" on resource "${e.resourceType}" is ambiguous without an explicit launcher operationVariant`,item:e})}break}case ru.VIEW:Zv(e,t,n,r,i,`application`,o);break;case ru.RESOURCE_VIEW:Zv(e,t,n,r,i,`resource`,o);break;case ru.ENGINE_PAGE:e.pageRef in Cl||i.push({severity:Yv.ERROR,code:Xv.ENGINE_PAGE_NOT_FOUND,context:t,message:`Engine page ref "${e.pageRef}" has no entry in ENGINE_PAGE_METADATA`,item:e});break;case ru.CUSTOM_COMPONENT:o&&!o(e.componentRef)&&i.push({severity:Yv.ERROR,code:Xv.HOSTED_COMPONENT_NOT_CONFIGURED,context:t,message:`Custom launcher component "${e.componentRef}" is not registered in ComponentRegistryService`,item:e});break;case ru.SETTINGS_SECTION:e.sectionRef!==void 0&&!a.has(e.sectionRef)&&i.push({severity:Yv.ERROR,code:Xv.SETTINGS_SECTION_NOT_PLACED,context:t,message:`Launcher opens Settings Hub section "${e.sectionRef}", which this application does not place in its settings rail (\`settingsHub.placements\`); the hub would silently open its default section instead.`,item:e});break;default:i.push({severity:Yv.ERROR,code:Xv.UNKNOWN_TARGET_KIND,context:t,message:`Unknown LauncherItemTargetKind: "${e.kind}"`,item:e})}}function $v(e,t,n,r){e.notificationBadgeRef&&!n.notificationBadgeDefinitions.some(t=>Os(t)===e.notificationBadgeRef)&&r.push({severity:Yv.ERROR,code:Xv.NOTIFICATION_BADGE_REF_NOT_FOUND,context:t,message:`notificationBadgeRef "${e.notificationBadgeRef}" does not resolve to a registered notification badge definition. A ref is a badge key ("<scope>:<identifier>"); registered keys are: ${n.notificationBadgeDefinitions.map(Os).join(`, `)||`(none)`}`,item:e})}function ey(e,t,n,r,i,a,o){for(let s of e)Qv(s,t,n,r,i,a,o),$v(s,t,n,i),s.children&&ey(s.children,`${t}.children`,n,r,i,a,o)}function fse(e,t,n,r,i,a,o){let s=`sidebar.contentSections[${e.ref}]`;if(e.visibleInModes&&e.visibleInModes.length>0){if(r.size===0)i.push({severity:Yv.WARNING,code:Xv.VISIBLE_IN_MODES_ORPHAN,context:s,message:`Section has visibleInModes but no appModes are declared — section will always be hidden`,item:e});else for(let t of e.visibleInModes)r.has(t)||i.push({severity:Yv.WARNING,code:Xv.VISIBLE_IN_MODES_ORPHAN,context:s,message:`visibleInModes ref "${t}" does not match any declared appMode`,item:e})}switch(e.contentKind){case Le.NAVIGATION_LIST:ey(e.children,s,t,n,i,a,o);break;case Le.RESOURCE_BROWSER:{let n=e,r=t.resourceConfigurations[n.resourceType];if(!r){i.push({severity:Yv.ERROR,code:Xv.RESOURCE_BROWSER_RESOURCE_NOT_FOUND,context:s,message:`RESOURCE_BROWSER resourceType "${n.resourceType}" not found in registry`,item:e});break}n.operation&&(r.operations.some(e=>e.operationIdentifier===n.operation&&(!n.operationVariant||e.variantKey===n.operationVariant))||i.push({severity:Yv.ERROR,code:Xv.RESOURCE_BROWSER_BOUND_OPERATION_NOT_FOUND,context:s,message:`RESOURCE_BROWSER bound operation "${n.operation}"${n.operationVariant?` (variant: ${n.operationVariant})`:``} not found on "${n.resourceType}"`,item:e})),n.navigateOperation&&(r.operations.some(e=>e.operationIdentifier===n.navigateOperation&&(!n.navigateOperationVariant||e.variantKey===n.navigateOperationVariant))||i.push({severity:Yv.ERROR,code:Xv.RESOURCE_BROWSER_NAVIGATION_OPERATION_NOT_FOUND,context:s,message:`RESOURCE_BROWSER navigation operation "${n.navigateOperation}"${n.navigateOperationVariant?` (variant: ${n.navigateOperationVariant})`:``} not found on "${n.resourceType}"`,item:e})),V.frontendResourceLabelDefinitionOf(r)||i.push({severity:Yv.WARNING,code:Xv.RESOURCE_BROWSER_MISSING_LABEL_CONFIG,context:s,message:`RESOURCE_BROWSER for "${n.resourceType}" has no record label configured (recordLabelFields on the resource, or getFrontendResourceLabel in its frontendConfiguration) — instance labels will fall back to the record's summary fields, then its id`,item:e});break}case Le.GUIDANCE_WIDGET:case Le.CUSTOM_COMPONENT:}}function ty(e,t,n,r){let i=[],a=t.appComponentsConfiguration,o=lse(t),s=new Set(Kv(t.settingsHub).sections.map(e=>e.ref)),c=new Set,l=t.appModes??[];for(let e of l)c.add(e.ref);let u=t.appScope?.fields??[],d=zm(u);for(let e of d)i.push({severity:Yv.ERROR,code:Xv.APP_SCOPE_DUPLICATE_RESOURCE_TYPE,context:`appScope.fields`,message:`Duplicate app-scope resourceType "${e.resourceType}" is not allowed in appScope.fields. Conflicting fieldIdentifiers: ${e.fieldIdentifiers.join(`, `)}`,item:e});for(let e of o.duplicateApplicationViewRefs)i.push({severity:Yv.ERROR,code:Xv.VIEW_REF_COLLISION,context:`applicationViews`,message:`Application view ref "${e}" is declared by multiple special-view families. View refs must be unique per launcher scope.`,item:e});let f=a[Fu.SIDEBAR];if(typeof f==`object`&&f&&`contentSections`in f){let t=f.contentSections;if(t)for(let r of t)fse(r,e,o,c,i,s,n)}let p=a[Fu.COMMAND_MENU];if(typeof p==`object`&&p&&`commands`in p){let t=p.commands;if(t)for(let r of t)Qv(r,`command_menu.commands`,e,o,i,s,n)}let m=a[Fu.HOTKEY];if(typeof m==`object`&&m&&`bindings`in m){let t=m.bindings;if(t)for(let r of t)Qv(r,`hotkey.bindings`,e,o,i,s,n)}let h=a[Fu.QUICK_ACTION_BUTTON];if(typeof h==`object`&&h&&`actions`in h){let t=h.actions;if(t)for(let r of t)Qv(r,`quick_action_button.actions`,e,o,i,s,n)}let g=a[Fu.CONTROL_PANEL];if(typeof g==`object`&&g&&`items`in g){let t=g.items;if(t)for(let r of t)Qv(r,`control_panel.items`,e,o,i,s,n)}let _=a[Fu.TOOLBAR];if(typeof _==`object`&&_&&`tools`in _){let t=_.tools;if(t)for(let r of t)Qv(r,`toolbar.tools`,e,o,i,s,n)}let v=a[Fu.MENUBAR];if(typeof v==`object`&&v){if(`hostedComponents`in v){let e=v.hostedComponents;if(e)for(let t of e)t.componentType in a||i.push({severity:Yv.ERROR,code:Xv.HOSTED_COMPONENT_NOT_CONFIGURED,context:`menubar.hostedComponents`,message:`Hosted component "${t.componentType}" is not configured in appComponentsConfiguration`,item:t})}if(`items`in v){let t=v.items;if(t)for(let r of t)Qv(r,`menubar.items`,e,o,i,s,n),$v(r,`menubar.items`,e,i)}}let y=a[Fu.ACTIVITY_BAR];return typeof y==`object`&&y?l.length===0&&i.push({severity:Yv.WARNING,code:Xv.ACTIVITY_BAR_ENABLED_BUT_NO_APP_MODES,context:`activity_bar`,message:`ACTIVITY_BAR is configured but no appModes are declared — the mode selector will have nothing to render`,item:y}):y===!0&&l.length===0&&i.push({severity:Yv.WARNING,code:Xv.ACTIVITY_BAR_ENABLED_BUT_NO_APP_MODES,context:`activity_bar`,message:`ACTIVITY_BAR is enabled but no appModes are declared — the mode selector will have nothing to render`,item:y}),pse(a,r?.organizationRoles,i),{errors:i,isValid:i.length===0}}function pse(e,t,n){if(!t?.length)return;let r=new Set([...Object.values(vi),...Object.values(_d),...t]),i=(e,t)=>{if(typeof e!=`object`||!e)return;let a=e,o=a.runtimeAvailability?.requiredRoles;if(Array.isArray(o))for(let i of o)typeof i==`string`&&!r.has(i)&&n.push({severity:Yv.WARNING,code:Xv.REQUIRED_ROLES_UNKNOWN_ROLE,context:t,message:`requiredRoles names "${i}", which is neither a core role nor one of the application's organization roles: nobody holds it, so the entry is shown to none of the roles meant by it. Check the spelling (a custom application-level role is also reported here).`,item:e});Array.isArray(a.children)&&a.children.forEach((e,n)=>i(e,`${t}.children[${n}]`))},a=(t,n)=>{let r=e[t];if(typeof r!=`object`||!r)return[];let i=r[n];return Array.isArray(i)?i:[]};a(Fu.SIDEBAR,`contentSections`).forEach((e,t)=>i(e,`sidebar.contentSections[${t}]`)),a(Fu.COMMAND_MENU,`commands`).forEach((e,t)=>i(e,`command_menu.commands[${t}]`)),a(Fu.HOTKEY,`bindings`).forEach((e,t)=>i(e,`hotkey.bindings[${t}]`)),a(Fu.QUICK_ACTION_BUTTON,`actions`).forEach((e,t)=>i(e,`quick_action_button.actions[${t}]`)),a(Fu.CONTROL_PANEL,`items`).forEach((e,t)=>i(e,`control_panel.items[${t}]`)),a(Fu.TOOLBAR,`tools`).forEach((e,t)=>i(e,`toolbar.tools[${t}]`)),a(Fu.MENUBAR,`items`).forEach((e,t)=>i(e,`menubar.items[${t}]`))}function ny(e){if(e.isValid){console.log(`[LauncherVerification] ✓ All launcher content declarations are valid`);return}let t=e.errors.filter(e=>e.severity===Yv.ERROR).length,n=e.errors.filter(e=>e.severity===Yv.WARNING).length;console.group(`[LauncherVerification] ${t} error(s), ${n} warning(s)`);for(let t of e.errors){let e=t.severity===Yv.ERROR?`✗ ERROR`:`⚠ WARN`;console.warn(`${e} [${t.code}] ${t.context}: ${t.message}`)}console.groupEnd()}var ry;(function(e){e.ANSWERER=`decisionInboxAnswerer`})(ry||={});function iy(e){let t=e.offer?.answeringRoles??[];if(t.length===0)return!1;let n=e.effectiveRoles,r=n.accessProfile;if(!r)return Jm(t,n);let i=new Set;for(let e of r.roleEntries)if(e.relatedPrimaryScope===td.ORGANIZATIONS&&e.relatedResourceId)for(let t of e.roles)i.add(t);return Jm(t,{...n,organizationRoles:[...i]})}function ay(e){return{[ry.ANSWERER]:iy(e)}}var oy;(function(e){e.ERROR=`error`,e.WARNING=`warning`})(oy||={});var sy;(function(e){e.DUPLICATE_SECTION_REF=`DUPLICATE_SECTION_REF`,e.DUPLICATE_CATEGORY_REF=`DUPLICATE_CATEGORY_REF`,e.SECTION_UNKNOWN_CATEGORY_REF=`SECTION_UNKNOWN_CATEGORY_REF`,e.SECTION_UNKNOWN_GROUP_REF=`SECTION_UNKNOWN_GROUP_REF`,e.DUPLICATE_GROUP_REF=`DUPLICATE_GROUP_REF`,e.DUPLICATE_SUB_TAB_REF=`DUPLICATE_SUB_TAB_REF`,e.DEFAULT_SECTION_REF_UNKNOWN=`DEFAULT_SECTION_REF_UNKNOWN`,e.PLACEMENT_UNKNOWN_DESTINATION_REF=`PLACEMENT_UNKNOWN_DESTINATION_REF`,e.APPLICATION_DESTINATION_SHADOWS_ENGINE=`APPLICATION_DESTINATION_SHADOWS_ENGINE`,e.DUPLICATE_APPLICATION_DESTINATION_REF=`DUPLICATE_APPLICATION_DESTINATION_REF`,e.SETTINGS_HUB_EMPTY=`SETTINGS_HUB_EMPTY`})(sy||={});var mse={refsShadowingEngineDestinations:[],duplicateApplicationDestinationRefs:[]};function cy(e){let t=new Set,n=new Set;for(let r of e)t.has(r)?n.add(r):t.add(r);return[...n]}function ly(e,t=[],n=mse){let r=[];e.sections.length===0&&r.push({severity:oy.ERROR,code:sy.SETTINGS_HUB_EMPTY,context:`settingsHub`,message:"The Settings Hub places no section, so Settings opens as an empty dialog. Pass the application's rail as `settingsHub` in its frontend configuration (`frontendBaseConfig` in `modules-registry.frontend.ts`), with at least one placement."});for(let e of n.refsShadowingEngineDestinations)r.push({severity:oy.ERROR,code:sy.APPLICATION_DESTINATION_SHADOWS_ENGINE,context:`settingsHub.destinations`,message:`Settings Hub destination "${e}" reuses the ref of an engine destination; the engine destination is the one that renders, so this declaration is unused. Give it a ref of its own.`,item:e});for(let e of n.duplicateApplicationDestinationRefs)r.push({severity:oy.ERROR,code:sy.DUPLICATE_APPLICATION_DESTINATION_REF,context:`settingsHub.destinations`,message:`Settings Hub destination "${e}" is declared more than once; only the first declaration renders.`,item:e});for(let e of t)r.push({severity:oy.ERROR,code:sy.PLACEMENT_UNKNOWN_DESTINATION_REF,context:`settingsHub.placements`,message:`Settings Hub placement references destinationRef "${e}", which neither the engine destination catalog nor the application's own destinations declare; the placement is dropped and the section will not render.`,item:e});for(let t of cy(e.categories.map(e=>e.ref)))r.push({severity:oy.ERROR,code:sy.DUPLICATE_CATEGORY_REF,context:`settingsHub.categories`,message:`Settings Hub category ref "${t}" is declared more than once; category refs must be unique (each is a rail group + the join key for its sections).`,item:t});for(let t of cy(e.sections.map(e=>e.ref)))r.push({severity:oy.ERROR,code:sy.DUPLICATE_SECTION_REF,context:`settingsHub.sections`,message:`Settings Hub section ref "${t}" is declared more than once; section refs must be unique across the whole hub (they are the URL segment + Tabs value).`,item:t});let i=new Set(e.categories.map(e=>e.ref));for(let t of e.sections)i.has(t.categoryRef)||r.push({severity:oy.ERROR,code:sy.SECTION_UNKNOWN_CATEGORY_REF,context:`settingsHub.sections[${t.ref}]`,message:`Settings Hub section "${t.ref}" references categoryRef "${t.categoryRef}" which is not declared in categories; the section would render a content panel with no rail entry.`,item:t});for(let t of e.categories)for(let e of cy((t.groups??[]).map(e=>e.ref)))r.push({severity:oy.ERROR,code:sy.DUPLICATE_GROUP_REF,context:`settingsHub.categories[${t.ref}].groups`,message:`Settings Hub group ref "${e}" is declared more than once in category "${t.ref}"; group refs must be unique within their category.`,item:e});let a=new Map(e.categories.map(e=>[e.ref,e]));for(let t of e.sections){if(t.groupRef===void 0)continue;let e=a.get(t.categoryRef);e!==void 0&&((e.groups??[]).some(e=>e.ref===t.groupRef)||r.push({severity:oy.ERROR,code:sy.SECTION_UNKNOWN_GROUP_REF,context:`settingsHub.sections[${t.ref}]`,message:`Settings Hub section "${t.ref}" references groupRef "${t.groupRef}", which category "${t.categoryRef}" does not declare in its groups; the rail draws it above the groups, with no heading.`,item:t}))}for(let t of e.sections)if(t.target.kind===Ov.SUB_TABS)for(let e of cy(t.target.subTabs.map(e=>e.ref)))r.push({severity:oy.ERROR,code:sy.DUPLICATE_SUB_TAB_REF,context:`settingsHub.sections[${t.ref}].subTabs`,message:`Settings Hub sub-tab ref "${e}" is declared more than once within section "${t.ref}"; sub-tab refs must be unique within their section (they are the inner Tabs value).`,item:t});return e.defaultSectionRef&&!e.sections.some(t=>t.ref===e.defaultSectionRef)&&r.push({severity:oy.WARNING,code:sy.DEFAULT_SECTION_REF_UNKNOWN,context:`settingsHub.defaultSectionRef`,message:`Settings Hub defaultSectionRef "${e.defaultSectionRef}" does not match any declared section; the hub will fall back to the first section.`,item:e.defaultSectionRef}),{errors:r,isValid:r.length===0}}function uy(e){if(e.isValid){console.log(`[SettingsHubVerification] ✓ Settings Hub configuration is valid`);return}let t=e.errors.filter(e=>e.severity===oy.ERROR).length,n=e.errors.filter(e=>e.severity===oy.WARNING).length;console.group(`[SettingsHubVerification] ${t} error(s), ${n} warning(s)`);for(let t of e.errors){let e=t.severity===oy.ERROR?`✗ ERROR`:`⚠ WARN`;console.warn(`${e} [${t.code}] ${t.context}: ${t.message}`)}console.groupEnd()}function hse(e){return typeof e==`object`&&!!e&&typeof e.reportCrash==`function`}function gse(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.track==`function`&&typeof t.page==`function`&&typeof t.identify==`function`&&typeof t.reset==`function`}function _se(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.signInSucceeded==`function`&&typeof t.signInFailed==`function`}function dy(e){let t=e.operation.initiatorInfos??[];return t.length===0||t.some(t=>{let n=t.parameters??[];return n.length===0||n.every(t=>{let n=[t.fieldIdentifier,t.relationshipField,t.resourceType].filter(e=>typeof e==`string`&&e.length>0);return n.length!==0&&n.some(t=>{if(gn.getResourceId(e.contextResourceIdentifiers[t]).length>0)return!0;let n=e.contextualParameters[t];return n!==void 0&&String(n).length>0})})})}function fy(e,t,n){let r=ju(t),i=Object.fromEntries(Object.entries(r).flatMap(([e,t])=>{let r=n.fieldIdentifierToResourceType?.[e]??e;return r===e?[[e,t]]:[[e,t],[r,t]]}));return delete i[e],i}function py(e){let t=e.registry.resourceConfigurations[e.resourceType]?.operations??[],n=t=>{let n=V.buildContextualParameters(t,e.registry);return e=>dy({operation:e,contextResourceIdentifiers:t,contextualParameters:n})},r=n(e.scopes.contextResourceIdentifiers),i=e.scopes.previousContextResourceIdentifiers?n(e.scopes.previousContextResourceIdentifiers):void 0;return Aa(t,W.LIST).filter(e=>r(e)||(i?.(e)??!1))}function vse(e){if(typeof e==`string`)return e.length>0?e:void 0;if(typeof e==`object`&&e&&typeof e._id==`string`){let t=e._id;return t.length>0?t:void 0}}function yse(e){let t=e._version;return typeof t==`number`||typeof t==`string`&&/^\d+$/.test(t)}function my(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function hy(e){let{resourceType:t,registry:n}=e,r=ju(e.callContext),i=n.resourceConfigurations[t]?.operations??[],a=new Map;for(let e of i)for(let t of e.initiatorInfos??[])for(let e of t.parameters??[])a.set(e.fieldIdentifier,String(e.resourceType));let o=$_({callContext:Object.fromEntries(Object.entries(r).filter(([e,t])=>![...a].some(([n,i])=>i===e&&n!==e&&r[n]===t))),operations:i,ownFieldIdentifier:n.resourceConfigurations[t]?.resourceFieldIdentifier||n.allResourceFieldIdentifiers?.[t],row:my(e.row)??my(e.previousRow),previousRow:my(e.row)?my(e.previousRow):void 0,normalizeId:vse,isStoredRow:yse,typeOfFieldIdentifier:e=>n.fieldIdentifierToResourceType?.[e]}),s=fy(t,o.contextResourceIdentifiers,n);return o.previousContextResourceIdentifiers?{contextResourceIdentifiers:s,previousContextResourceIdentifiers:fy(t,o.previousContextResourceIdentifiers,n)}:{contextResourceIdentifiers:s}}function bse(e){let{emit:t,resourceConfig:n,registry:r,resourceType:i,operation:a,resourceContext:o,isWebSocketConnected:s,result:c}=e,l=wc(o.additionalContext),u=ri(a),d=ju(o.contextResourceIdentifiers),f=De({contextResourceIdentifiers:o.contextResourceIdentifiers,resourceType:i,result:c,isBulkOperation:a.isBulkOperation===!0});if(!Di(a,s)&&mu(a)){let e=n?.operations?[...n.operations]:[],{[i]:s,...p}=d,m=r?hy({resourceType:i,registry:r,callContext:o.contextResourceIdentifiers,...a.isBulkOperation===!0?{}:{row:c}}).contextResourceIdentifiers:p,h=r?V.buildContextualParameters(m,r):{},g=Aa(e,W.LIST).filter(e=>dy({operation:e,contextResourceIdentifiers:r?m:o.contextResourceIdentifiers,contextualParameters:h})),_=g.length>0?g:[null];for(let e of _){let n=e??{operationIdentifier:W.LIST};t(hc.RESOURCE_REFRESH,{resourceType:i,operationIdentifier:String(n.operationIdentifier??W.LIST),operation:n,variantType:e?.variantType,isOperationDefault:e?.isOperationDefault??!0,isBulkOperation:e?.isBulkOperation??!1,variantKey:e?.variantKey,contextResourceIdentifiers:m,parentResourcesRequirements:o.parentResourcesRequirements,...l?{optionalDiscriminator:l}:{}})}if(u){let a=Aa(e,W.READ,{requireAddressable:!0}).filter(e=>n&&r?ih({resourceConfig:n,operation:e,registry:r,hasResourceId:f[i]!==void 0,contextResourceIdentifiers:f,contextualParameters:r?V.buildContextualParameters(f,r):h}):!0),s=a.length>0?a:[null],c=new Set;for(let e of s){let n=e??{operationIdentifier:W.READ},r=[V.getInstance().getResourceId(f[i]),String(n.operationIdentifier),n.variantType??``,n.variantKey??``,n.isBulkOperation??!1].join(`:`);c.has(r)||(c.add(r),t(hc.RESOURCE_REFRESH,{resourceType:i,operationIdentifier:String(n.operationIdentifier??W.READ),operation:n,variantType:e?.variantType,isOperationDefault:e?.isOperationDefault??!0,isBulkOperation:e?.isBulkOperation??!1,variantKey:e?.variantKey,contextResourceIdentifiers:f,parentResourcesRequirements:o.parentResourcesRequirements,...l?{optionalDiscriminator:l}:{}}))}}}t(hc.RESOURCE_OPERATION_EXECUTED,{resourceType:i,operationIdentifier:String(a.operationIdentifier),operation:a,variantType:a.variantType,isOperationDefault:a.isOperationDefault??!0,isBulkOperation:a.isBulkOperation??!1,variantKey:a.variantKey,contextResourceIdentifiers:f,parentResourcesRequirements:o.parentResourcesRequirements,resultSummary:Ku(c),...l?{optionalDiscriminator:l}:{}})}var $=kg(),gy;(function(e){e.PARENT_RESOURCE_REQUIREMENT=`parent-resource-requirement`,e.ADDITIONAL_RESOURCE_REQUIREMENT=`additional-resource-requirement`})(gy||={});var _y;(function(e){e.INITIAL=`initial`,e.REFRESH=`refresh`})(_y||={});function vy(e){if(!Array.isArray(e.participationRefs)||e.participationRefs.length===0)throw Error(`[ExecutionView] ExecutionPendingPrefetch must carry at least one participation ref. A prefetch with no refs cannot be narrowed to per-ref UX. If the work is not tied to any participation, do not register it as a participation prefetch.`);if(typeof e.resourceType!=`string`||e.resourceType.length===0)throw Error("[ExecutionView] ExecutionPendingPrefetch must carry a non-empty `resourceType` so per-resource UI filtering composes uniformly with the pending-action tier.");if(e.intent!==_y.INITIAL&&e.intent!==_y.REFRESH)throw Error("[ExecutionView] ExecutionPendingPrefetch.intent must be one of `INITIAL` | `REFRESH` so renderers can distinguish full-screen vs background hydration UX without a side-channel flag.")}var yy;(function(e){e.EMBEDDED_CONTENT=`embedded-content`,e.LOCAL_PANE=`local-pane`,e.CUSTOM=`custom`})(yy||={});function by(e){if(e.scope===yy.LOCAL_PANE){let t=e;if(typeof t.paneId!=`string`||t.paneId.length===0)throw Error("[ExecutionView] LOCAL_PANE-scoped dirty marker must carry a non-empty `paneId` so the shell can auto-clear it on pane transitions. Use scope=CUSTOM for markers that should outlive any single pane.")}}function xy(e){if(typeof e==`object`&&e&&e.contentType===hd.RESOURCE_OPERATION)throw Error(`[ExecutionView] localPane payload must not be an ExecutionEmbeddableContent. Resource-operation content belongs in the embedded-content slot. Use openEmbeddedContent() or execution.actions.operation(...).embed() instead.`)}function Sy(e){if(!e||e.contentType!==hd.RESOURCE_OPERATION)throw Error(`[ExecutionView] embeddedContent.content must be a NavigationContent.RESOURCE_OPERATION. Non-resource-operation navigation content must go through delegateToParent() (the app router), not the execution shell's embed slot.`)}var Cy;(function(e){e.EMBEDDED_CONTENT=`embedded-content`,e.LOCAL_PANE=`local-pane`,e.CUSTOM=`custom`,e.PARTICIPATION_PREFETCH=`participation-prefetch`})(Cy||={});function wy(e){if(e.scope===Cy.LOCAL_PANE){let t=e;if(typeof t.paneId!=`string`||t.paneId.length===0)throw Error("[ExecutionView] LOCAL_PANE-scoped failed action must carry a non-empty `paneId` so the shell can auto-clear it on pane transitions. Use scope=CUSTOM for failures that should outlive any single pane.")}if(e.scope===Cy.PARTICIPATION_PREFETCH){let t=e;if(typeof t.prefetchKey!=`string`||t.prefetchKey.length===0)throw Error("[ExecutionView] PARTICIPATION_PREFETCH-scoped failed action must carry a non-empty `prefetchKey` so the shell can auto-clear it on the next successful prefetch settle for the same key. Use scope=CUSTOM for failures that should outlive any single prefetch unit.")}}var Ty=(0,Q.createContext)(void 0);function Ey(e){if(!e)throw Error(`Execution runtime context must be used within an ExecutionRuntimeProvider.`);return e}var Dy=({children:e,viewDefinition:t,contextResourceIdentifiers:n,runtimeInstanceId:r,navigationZone:i,doOperation:a,navigation:o,anchor:s,participations:c,runtimeState:l})=>{let u=(0,Q.useMemo)(()=>({viewDefinition:t,contextResourceIdentifiers:n,runtimeInstanceId:r,navigationZone:i,doOperation:a,navigation:o,anchor:s,participations:c,runtimeState:l}),[t,n,r,i,a,o,s,c,l]);return(0,$.jsx)(Ty.Provider,{value:u,children:e})};function Oy(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===t?n=!0:r[i]=a;return n?r:e}function ky(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===Cy.LOCAL_PANE&&a.paneId!==t?n=!0:r[i]=a;return n?r:e}function Ay(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.wildoError==`object`&&t.wildoError!==null}function jy(e){let t=e.markedByHttpClient??Ay(e.error),n=e.bridgedByExecutionShell??!1,r={failureRuntimeId:e.failureRuntimeId,error:e.error,originatingActionRuntimeId:e.originatingActionRuntimeId,operationPathKey:e.operationPathKey,resourceType:e.resourceType,operationId:e.operationId,capturedAt:e.capturedAt??Date.now(),startedAt:e.startedAt,label:e.label,markedByHttpClient:t,bridgedByExecutionShell:n},i;return i=e.scope===Cy.LOCAL_PANE?{...r,scope:e.scope,paneId:e.paneId}:e.scope===Cy.EMBEDDED_CONTENT?{...r,scope:e.scope}:e.scope===Cy.PARTICIPATION_PREFETCH?{...r,scope:e.scope,prefetchKey:e.prefetchKey}:{...r,scope:Cy.CUSTOM},wy(i),i}function My(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===Cy.PARTICIPATION_PREFETCH&&a.prefetchKey===t?n=!0:r[i]=a;return n?r:e}var Ny;(function(e){e.SINGLE=`single`,e.ARRAY=`array`})(Ny||={});function xse(e){return e.foreignKeyField??e.resourceType}function Py(e){let t=(e.requirements??[]).filter(t=>xse(t)===e.bindingKey);return t.length===1?t[0]:void 0}function Sse(e,t){let n=t.resourceConfigurations[e]?.resourceRelationships;if(!n)return[];let r=(e,t)=>Nn.ensureCompiledRelationship.call(Nn,e,t);return[...n.parentRelationships,...n.childRelationships,...n.selfRelationships].map(e=>r(e,t.allResourceFieldIdentifiers))}function Fy(e){let t=Py({bindingKey:e.bindingKey,requirements:e.requirements});if(t)return{ref:e.ref,source:e.source,requirement:t,contextValue:e.contextResourceIdentifiers?.[e.bindingKey]}}function Cse(e){let t=Ly(e.sourceParticipation);if(t===e.definition.targetResourceType)return;let n=Sse(t,e.registry).filter(n=>{if(n.resourceType1!==e.definition.targetResourceType&&n.resourceType2!==e.definition.targetResourceType||e.definition.foreignKeyField&&Nn.tryResolveRelationshipForeignKeyIdentity(n,e.registry.allResourceFieldIdentifiers)?.fieldIdentifier!==e.definition.foreignKeyField)return!1;let r=n.resourceType1===t?e.sourceResourceData:void 0;return Nn.isRelationshipActiveForParent(n,r,{onMissingParentResource:`exclude`,onConditionError:`exclude`})});if(n.length===1)return{ref:e.ref,source:Um.RELATIONSHIP_PROJECTION,fromParticipationRef:e.definition.fromParticipationRef,relationship:n[0],currentResourceType:t}}function wse(e){let t=e.viewDefinition.participations??{},n=new Map,r=new Set,i=a=>{let o=n.get(a);if(o)return o;let s=t[a];if(!s||r.has(a))return;r.add(a);let c;switch(s.source){case Um.ANCHOR:if(e.anchor){let t=e.explicitContextResourceIdentifiers?.[e.anchor.bindingKey];if(t){let n=e.viewDefinition.anchor?.source===Vm.PARENT_RESOURCE_REQUIREMENT?e.viewDefinition.parentResourcesRequirements:e.viewDefinition.additionalResourceRequirements;c={ref:a,source:Um.ANCHOR,resourceType:e.anchor.mainResourceType,bindingKey:e.anchor.bindingKey,requirement:Py({bindingKey:e.anchor.bindingKey,requirements:n}),contextValue:t}}}break;case Um.PARENT_RESOURCE_REQUIREMENT:c=Fy({ref:a,source:Um.PARENT_RESOURCE_REQUIREMENT,bindingKey:s.bindingKey,requirements:e.viewDefinition.parentResourcesRequirements,contextResourceIdentifiers:e.contextResourceIdentifiers});break;case Um.ADDITIONAL_RESOURCE_REQUIREMENT:c=Fy({ref:a,source:Um.ADDITIONAL_RESOURCE_REQUIREMENT,bindingKey:s.bindingKey,requirements:e.viewDefinition.additionalResourceRequirements,contextResourceIdentifiers:e.contextResourceIdentifiers});break;case Um.RELATIONSHIP_PROJECTION:{let t=i(s.fromParticipationRef);t&&(c=Cse({ref:a,definition:s,sourceParticipation:t,sourceResourceData:e.sourceResourceDataByParticipationRef?.[s.fromParticipationRef],registry:e.registry}));break}}return r.delete(a),c&&n.set(a,c),c};for(let e of Object.keys(t))i(e);return Object.fromEntries(n.entries())}function Iy(e){if(e.source===Um.ANCHOR||e.source===Um.PARENT_RESOURCE_REQUIREMENT||e.source===Um.ADDITIONAL_RESOURCE_REQUIREMENT)return e.contextValue}function Ly(e){if(e.source===Um.ANCHOR)return e.resourceType;if(e.source===Um.PARENT_RESOURCE_REQUIREMENT||e.source===Um.ADDITIONAL_RESOURCE_REQUIREMENT)return e.requirement.resourceType;if(e.source===Um.RELATIONSHIP_PROJECTION){let t=e.relationship;return t.resourceType1===e.currentResourceType?t.resourceType2:t.resourceType1}throw Error(`Unknown execution participation source`)}function Tse(e){let t=Iy(e),n=gn.getResourceId(t);return n.length>0?n:void 0}function Ry(e){if(e.source===Um.PARENT_RESOURCE_REQUIREMENT||e.source===Um.ADDITIONAL_RESOURCE_REQUIREMENT)return e.requirement}function zy(e){return e.source===Um.RELATIONSHIP_PROJECTION?e.relationship:void 0}function Ese(e){let t=zy(e);return t?Nn.getResolvedRelationshipSemantics(t):void 0}function Dse(e,t){let n=zy(e);return n?Nn.tryResolveRelationshipForeignKeyIdentity(n,t):void 0}function Ose(e,t){if(e.source===Um.PARENT_RESOURCE_REQUIREMENT||e.source===Um.ADDITIONAL_RESOURCE_REQUIREMENT)return e.requirement.relationshipEdgeKey;if(e.source!==Um.RELATIONSHIP_PROJECTION)return;let n=Dse(e,t.allResourceFieldIdentifiers);return V.buildRelationshipEdgeKey({parentResourceType:e.relationship.resourceType1,childResourceType:e.relationship.resourceType2,foreignKeyField:n?.fieldIdentifier??e.relationship.foreignKeyField})}function kse(e){if(e.source!==Um.RELATIONSHIP_PROJECTION)return Ny.SINGLE;let t=e.relationship.resourceType1===e.currentResourceType?e.relationship.cardinality2:e.relationship.cardinality1;return nt(t)?Ny.SINGLE:Ny.ARRAY}function By(e){let t=Iy(e.participation);if(!t)return;let n=gn.getResourceId(t);if(!n)return;let r=Ly(e.participation),i=V.getResourceFieldIdentifierForType(r,e.registry),a=gn.getFieldIdentifier(t),o=e.participation.source===Um.ANCHOR?e.participation.requirement?.foreignKeyField:Ry(e.participation)?.foreignKeyField,s=a??o;return s&&s!==i?{fieldIdentifier:s,resourceId:n}:n}function Ase(e){let t={};for(let n of e.participationRefs){let r=e.participations[n];if(!r)throw V.buildConfigurationError(ii.CONFIGURATION,{component:`buildExecutionParticipationContextualParameters`,message:`Unknown execution participation ref "${n}".`,participationRef:n});let i=By({participation:r,registry:e.registry});if(!i)continue;let a=gn.getResourceId(i);if(!a)continue;let o=gn.getFieldIdentifier(i)??V.getResourceFieldIdentifierForType(Ly(r),e.registry),s=t[o];if(s!==void 0&&s!==a)throw V.buildConfigurationError(ii.CONFIGURATION,{component:`buildExecutionParticipationContextualParameters`,message:`Execution participations resolved conflicting contextual values for "${o}".`,fieldIdentifier:o,previousValue:s,nextValue:a,participationRef:n});t[o]=a}return t}function jse(e){return{participation:e.participation,resourceType:Ly(e.participation),resourceId:Tse(e.participation),valueShape:kse(e.participation),contextValue:Iy(e.participation),contextIdentifier:By({participation:e.participation,registry:e.registry}),requirement:Ry(e.participation),relationship:Ese(e.participation),rawRelationship:zy(e.participation),edgeKey:Ose(e.participation,e.registry)}}function Vy(e,t){return V.buildConfigurationError(ii.CONFIGURATION,{message:e,component:`useExecutionResourceOperationContextBuilder`,...t})}function Mse(e){return`operationIdentifier`in e}function Nse(e,t,n){let r=(e.operations??[]).filter(e=>!(String(e.operationIdentifier)!==n.operationIdentifier||n.variantType!==void 0&&e.variantType!==n.variantType||n.variantKey!==void 0&&e.variantKey!==n.variantKey||n.isOperationDefault!==void 0&&e.isOperationDefault!==n.isOperationDefault||n.isBulkOperation!==void 0&&e.isBulkOperation!==n.isBulkOperation));if(r.length===1)return r[0];let i=r.filter(e=>e.isOperationDefault===!0&&e.isBulkOperation!==!0);if(n.variantKey===void 0&&n.variantType===void 0&&n.isOperationDefault===void 0&&n.isBulkOperation===void 0&&i.length===1)return i[0];throw Vy(r.length===0?`Execution resource-operation builder cannot resolve operation "${n.operationIdentifier}" on resource "${t}".`:`Execution resource-operation builder found ambiguous operation "${n.operationIdentifier}" on resource "${t}".`,{resourceType:t,operationIdentifier:n.operationIdentifier,variantType:n.variantType,variantKey:n.variantKey,isOperationDefault:n.isOperationDefault,isBulkOperation:n.isBulkOperation,candidates:r.map(e=>({variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation}))})}function Pse(e,t,n,r,i,a){if(!e)throw Vy(`Execution resource-operation builder cannot resolve resource "${t}" from the registry.`,{resourceType:t});if(Mse(n)){let o=Nse(e,t,n),s=ul(o);if((s===W.READ||s===W.UPDATE||s===W.DELETE)&&o.isBulkOperation!==!0&&!ih({resourceConfig:e,operation:o,registry:r,hasResourceId:gn.getResourceId(i[t])!==``,contextResourceIdentifiers:i,contextualParameters:a}))throw Vy(`Execution resource-operation builder resolved operation "${n.operationIdentifier}" on resource "${t}", but the current context cannot address it.`,{resourceType:t,operationIdentifier:n.operationIdentifier});return o}let o=n.operationLike===W.READ||n.operationLike===W.UPDATE||n.operationLike===W.DELETE,s=n.requireAddressable||o?Th({resourceConfig:e,operations:e.operations??[],coreOperation:n.operationLike,registry:r,hasResourceId:gn.getResourceId(i[t])!==``,allowBulk:n.allowBulk,requireFrontendAddressable:!0,contextResourceIdentifiers:i,contextualParameters:a}):Il(e.operations??[],n.operationLike,{requireAddressable:n.requireAddressable,allowBulk:n.allowBulk});if(!s)throw Vy(`Execution resource-operation builder cannot resolve a preferred ${String(n.operationLike)}-like operation on resource "${t}".`,{resourceType:t,operationLike:n.operationLike,requireAddressable:n.requireAddressable,allowBulk:n.allowBulk});return s}function Fse(e){let t=e.currentValue?gn.getFieldIdentifier(e.currentValue):void 0;return t?{fieldIdentifier:t,resourceId:e.resourceId}:e.resourceId}function Ise(e){let t=e?.currentObject??e?.resource;return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}function Lse(e){let t=Ise(e.additionalContext),n=t?._id??(e.resourceConfig?.resourceFieldIdentifier?t?.[e.resourceConfig.resourceFieldIdentifier]:void 0);return typeof n==`string`&&n.length>0?n:void 0}function Hy(){let{registry:e}=wm(),t=Ey((0,Q.useContext)(Ty));return{buildResourceOperationContext:(0,Q.useCallback)(n=>{let r=n.participationRef?t.participations[n.participationRef]:void 0;if(n.participationRef&&!r)throw Vy(`Execution resource-operation builder cannot resolve participation "${n.participationRef}".`,{participationRef:n.participationRef});let i=n.resourceType??(r?Ly(r):void 0);if(!i)throw Vy("Execution resource-operation builder requires either `resourceType` or `participationRef`.",{target:n});let a={...t.contextResourceIdentifiers??{},...n.contextResourceIdentifiers??{}};if(r){let t=By({participation:r,registry:e});if(!t&&!n.resourceId)throw Vy(`Execution resource-operation builder cannot derive a concrete resource identifier from participation "${n.participationRef}".`,{participationRef:n.participationRef,resourceType:i});t&&(a[i]=t)}let o=e.resourceConfigurations[i],s=Lse({additionalContext:n.additionalContext,resourceConfig:o}),c=n.resourceId??s;if(c&&!r){let r=t.contextResourceIdentifiers??{};a={...Zm({hostIdentifiers:r,hostContextualParameters:{},hostRecord:{resourceType:i,id:gn.getResourceId(r[i])},targetResourceType:i,targetId:c,registry:e}).identifiers,...n.contextResourceIdentifiers??{}}}c&&(a[i]=Fse({currentValue:a[i],resourceId:c}));let l=V.buildContextualParameters(a,e),u=Pse(o,i,n,e,a,l),d=gn.buildParentResourcesRequirements(i,a,e,n.relationshipFieldOverrides);return gn.createFrontendResourceOperationContextFromOperation({resourceType:i,operation:u,contextResourceIdentifiers:a,additionalContext:n.additionalContext,parentResourcesRequirements:d})},[t.contextResourceIdentifiers,t.participations,e])}}function Rse(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-action-${crypto.randomUUID()}`:`execution-action-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Uy(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-failure-${crypto.randomUUID()}`:`execution-failure-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function zse(){let e=Ey((0,Q.useContext)(Ty)),{registry:t}=wm(),{buildResourceOperationContext:n}=Hy(),{emit:r}=vo(),i=(0,Q.useContext)(Sm)?.isConnected??!1,a=(0,Q.useRef)(r),o=(0,Q.useRef)(i);a.current=r,o.current=i;let s=(0,Q.useRef)(e.runtimeState);s.current=e.runtimeState;let c=(0,Q.useMemo)(()=>Object.fromEntries(Object.entries(e.participations).map(([e,n])=>[e,jse({participation:n,registry:t})])),[e.participations,t]),l=(0,Q.useCallback)(e=>c[e],[c]),u=(0,Q.useCallback)(t=>{let n=c[t];if(!n)throw Error(`Execution participation "${t}" is required by view "${e.viewDefinition.ref}" but was not resolved.`);return n},[e.viewDefinition.ref,c]),d=(0,Q.useCallback)(e=>Object.fromEntries(e.map(e=>[e,u(e)])),[u]),f=(0,Q.useCallback)(e=>Array.isArray(e)?d(e):u(e),[u,d]),p=(0,Q.useCallback)(n=>n.length===0?{}:Ase({participationRefs:n,participations:e.participations,registry:t}),[e.participations,t]),m=(0,Q.useCallback)(r=>{let i=(r.contextParticipationRefs??[]).reduce((n,r)=>{let i=e.participations[r];if(!i)throw Error(`Execution action target references unknown context participation "${r}" on view "${e.viewDefinition.ref}".`);let a=By({participation:i,registry:t});if(!a)return n;let o=Ly(i),s=n[o];if(s){let t=gn.getResourceId(s),n=gn.getResourceId(a),i=gn.getFieldIdentifier(s),c=gn.getFieldIdentifier(a);if(t!==n||i!==c)throw V.buildConfigurationError(ii.CONFIGURATION,{component:`useExecution.actions.operation`,message:`Execution action target resolved conflicting context participations for "${o}".`,contextKey:o,existingContextIdentifier:s,nextContextIdentifier:a,participationRef:r,executionViewRef:e.viewDefinition.ref})}return n[o]=a,n},{}),c={...r,contextResourceIdentifiers:{...i,...r.contextResourceIdentifiers??{}}},l=n(c),{resourceType:u,operation:d}=l,f=String(d.operationIdentifier),p=t.resourceConfigurations[u],h=V.buildContextualParameters(l.contextResourceIdentifiers,t),g=Ip({viewDefinition:e.viewDefinition,resourceType:u,operation:d}),_={...Ch.createOperationInitiator(e.navigationZone,d),...r.navigationInitiator??{}},v={contentType:hd.RESOURCE_OPERATION,resourceContext:l},y=()=>(e.navigation.openEmbeddedContent({content:v,navigationInitiator:_}),!0),b=()=>{if(g===_m.EMBED_LOCALLY)return y();let n=p?It.buildOperationFrontendRoutePaths(p,d,t.allResourceFieldIdentifiers):[],i=p&&n.length>0?gn.selectMatchingRoutePath(n,l.contextResourceIdentifiers,u,p.resourceFieldIdentifier,l.parentResourcesRequirements).url:void 0;return e.navigation.delegateToParent({content:v,urlPath:i,relationshipTransition:r.relationshipTransition,initiator:{...r.navigationInitiator,sourceOperation:_.sourceOperation,..._.sourceRelationship?{sourceRelationship:_.sourceRelationship}:{},..._.launcher?{launcher:_.launcher}:{}}}),!0},x=gl.createOperationPathKeyFromOperation(d),S=async n=>{let i=Js({operation:d,requestData:n,additionalContext:l.additionalContext}),s={actionRuntimeId:Rse(),operationPathKey:x,resourceType:u,operationId:f,startedAt:Date.now()};e.navigation.beginPendingAction(s);try{let n=await e.doOperation(x,{contextualParameters:h,parentResourcesRequirements:l.parentResourcesRequirements,...i?{requestData:i}:{}});return bse({emit:a.current,resourceConfig:p,registry:t,resourceType:u,operation:d,resourceContext:l,isWebSocketConnected:o.current,result:n}),n}catch(t){let n=Ay(t),i=!n;i&&st.handleError(t,{source:`promise`,resourceType:u,operationIdentifier:f,additionalContext:{executionRuntimeInstanceId:e.runtimeInstanceId,executionViewRef:e.viewDefinition.ref,operationPathKey:x}});let a={failureRuntimeId:Uy(),originatingActionRuntimeId:s.actionRuntimeId,operationPathKey:x,resourceType:u,operationId:f,startedAt:s.startedAt,error:t,markedByHttpClient:n,bridgedByExecutionShell:i},o;o=r.failureScope?.scope===Cy.LOCAL_PANE?{...a,scope:r.failureScope.scope,paneId:r.failureScope.paneId}:r.failureScope?.scope===Cy.EMBEDDED_CONTENT?{...a,scope:r.failureScope.scope}:{...a,scope:Cy.CUSTOM};let c=jy(o);throw e.navigation.captureFailedAction(c),t}finally{e.navigation.endPendingAction(s.actionRuntimeId)}},C=()=>{try{return m({resourceType:r.resourceType,resourceId:r.resourceId,participationRef:r.participationRef,contextParticipationRefs:r.contextParticipationRefs,contextResourceIdentifiers:r.contextResourceIdentifiers,relationshipFieldOverrides:r.relationshipFieldOverrides,additionalContext:r.additionalContext,navigationInitiator:r.navigationInitiator,relationshipTransition:r.relationshipTransition,operationLike:W.READ,requireAddressable:!0}).navigate()}catch{return!1}},w=null,T=null,E=()=>{let e=s.current;if(w===e&&T!==null)return T;let t=[];for(let n of Object.values(e.pendingActions))n.operationPathKey===x&&t.push(n);let n=[];for(let t of Object.values(e.failedActions))t.operationPathKey===x&&n.push(t);let i=[];if(r.dirtyPredicate)for(let t of Object.values(e.dirtyMarkers))r.dirtyPredicate(t)&&i.push(t);let a;for(let e of n)(!a||e.capturedAt>a.capturedAt)&&(a=e);return T={pendingActions:t,failedActions:n,dirtyMarkers:i,isPending:t.length>0,isErrored:n.length>0,isDirty:i.length>0,latestFailure:a},w=e,T},D=()=>{let t=s.current;for(let n of Object.values(t.failedActions))n.operationPathKey===x&&e.navigation.clearFailedAction(n.failureRuntimeId)};return{target:c,resourceContext:l,resourceType:u,operation:d,operationId:f,operationPathKey:x,contextualParameters:h,navigationHandlingMode:g,get status(){return E()},execute:S,embed:y,navigate:b,navigateToRead:C,retry:async e=>(D(),S(e)),clearMyFailures:D,clearMyDirty:()=>{if(!r.dirtyPredicate)return;let t=s.current;for(let n of Object.values(t.dirtyMarkers))r.dirtyPredicate(n)&&e.navigation.clearDirty(n.markerId)}}},[n,e.doOperation,e.navigation,e.participations,e.viewDefinition,t]),h=(0,Q.useMemo)(()=>({all:c,get:l,require:f}),[l,c,f]),g=(0,Q.useCallback)(e=>Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=e=>{let n={...t,...e,contextResourceIdentifiers:{...t.contextResourceIdentifiers??{},...e?.contextResourceIdentifiers??{}},additionalContext:{...t.additionalContext??{},...e?.additionalContext??{}},navigationInitiator:{...t.navigationInitiator??{},...e?.navigationInitiator??{}}};return m(n)};return[e,{execute:(e,t)=>n(e).execute(t),embed:e=>n(e).embed(),navigate:e=>n(e).navigate(),navigateToRead:e=>n(e).navigateToRead(),bind:e=>n(e)}]})),[m]),_=(0,Q.useMemo)(()=>({operation:m,dictionary:g}),[g,m]),v=(0,Q.useMemo)(()=>({open:e.navigation.openEmbeddedContent,close:e.navigation.closeEmbeddedContent,openResource:e=>m(e).embed()}),[m,e.navigation.closeEmbeddedContent,e.navigation.openEmbeddedContent]),y=(0,Q.useMemo)(()=>{let t=Object.values(e.runtimeState.pendingActions),n=Object.values(e.runtimeState.participationPrefetchActions),r=t.length>0,i=n.length>0;return{pendingActions:t,participationPrefetchActions:n,isBusy:r||i,isAnyPending:r,isPending:e=>e?t.some(e):r,isAnyParticipationPrefetching:i,isParticipationPrefetching:e=>e?n.some(e):i}},[e.runtimeState.pendingActions,e.runtimeState.participationPrefetchActions]),b=(0,Q.useMemo)(()=>{let t=Object.values(e.runtimeState.dirtyMarkers),n=t.length>0;return{markers:t,isAnyDirty:n,isDirty:e=>e?t.some(e):n,mark:e.navigation.markDirty,clear:e.navigation.clearDirty,clearAll:e.navigation.clearAllDirty}},[e.navigation.clearAllDirty,e.navigation.clearDirty,e.navigation.markDirty,e.runtimeState.dirtyMarkers]),x=(0,Q.useRef)(e.navigation.captureFailedAction),S=(0,Q.useRef)(e.runtimeInstanceId),C=(0,Q.useRef)(e.viewDefinition.ref);x.current=e.navigation.captureFailedAction,S.current=e.runtimeInstanceId,C.current=e.viewDefinition.ref;let w=(0,Q.useCallback)(e=>{let t=Ay(e.error),n=(e.bridgeToCanonicalBus??!0)&&!t;n&&st.handleError(e.error,{source:`manual`,resourceType:e.resourceType,operationIdentifier:e.operationId,additionalContext:{executionRuntimeInstanceId:S.current,executionViewRef:C.current,...e.operationPathKey?{operationPathKey:e.operationPathKey}:{}}});let r={failureRuntimeId:Uy(),operationPathKey:e.operationPathKey,resourceType:e.resourceType,operationId:e.operationId,error:e.error,label:e.label,markedByHttpClient:t,bridgedByExecutionShell:n},i;return i=e.scope===Cy.LOCAL_PANE?jy({...r,scope:e.scope,paneId:e.paneId}):e.scope===Cy.EMBEDDED_CONTENT?jy({...r,scope:e.scope}):e.scope===Cy.PARTICIPATION_PREFETCH?jy({...r,scope:e.scope,prefetchKey:e.prefetchKey}):jy({...r,scope:Cy.CUSTOM}),x.current(i),i},[]),T=(0,Q.useMemo)(()=>{let t=Object.values(e.runtimeState.failedActions),n=t.length>0;return{failedActions:t,isAnyErrored:n,isErrored:e=>e?t.some(e):n,capture:w,clear:e.navigation.clearFailedAction,clearAll:e.navigation.clearAllFailedActions}},[w,e.navigation.clearAllFailedActions,e.navigation.clearFailedAction,e.runtimeState.failedActions]);return(0,Q.useMemo)(()=>({view:e.viewDefinition,anchor:e.anchor,state:e.runtimeState,contextResourceIdentifiers:e.contextResourceIdentifiers,runtimeInstanceId:e.runtimeInstanceId,navigationZone:e.navigationZone,doOperation:e.doOperation,delegateToParent:e.navigation.delegateToParent,localPane:{open:e.navigation.openLocalPane,close:e.navigation.closeLocalPane},embeddedContent:v,loading:y,dirty:b,errors:T,participations:c,participation:l,requireParticipation:u,subjects:h,buildContextualParameters:p,buildResourceOperationContext:n,actions:_}),[_,p,n,e.anchor,e.contextResourceIdentifiers,e.doOperation,e.navigation,e.navigationZone,e.runtimeInstanceId,e.runtimeState,e.viewDefinition,v,y,b,T,l,c,u,h])}var Wy=(0,Q.createContext)(null);function Gy({scope:e,children:t}){let n=(0,Q.useMemo)(()=>e.scope===yy.LOCAL_PANE?{scope:yy.LOCAL_PANE,paneId:e.paneId}:e.scope===yy.EMBEDDED_CONTENT?{scope:yy.EMBEDDED_CONTENT}:{scope:yy.CUSTOM},[e.scope,e.paneId]);return(0,$.jsx)(Wy.Provider,{value:n,children:t})}function Bse(){return(0,Q.useContext)(Wy)}function Ky(e){let t=(0,Q.useContext)(Ty),n=(0,Q.useContext)(Wy),{markerId:r,isDirty:i,label:a,scopeOverride:o}=e,s=o??n??null,c=t?.navigation;(0,Q.useEffect)(()=>{if(!c)return;let e=s??{scope:yy.CUSTOM};if(!i){c.clearDirty(r);return}let t;return t=e.scope===yy.LOCAL_PANE?{markerId:r,scope:yy.LOCAL_PANE,paneId:e.paneId,label:a,markedAt:Date.now()}:e.scope===yy.EMBEDDED_CONTENT?{markerId:r,scope:yy.EMBEDDED_CONTENT,label:a,markedAt:Date.now()}:{markerId:r,scope:yy.CUSTOM,label:a,markedAt:Date.now()},c.markDirty(t),()=>{c.clearDirty(r)}},[c,r,i,s?.scope,s?.paneId])}function Vse(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-prefetch-${crypto.randomUUID()}`:`execution-prefetch-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Hse(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-failure-${crypto.randomUUID()}`:`execution-failure-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Use(e){return!e||typeof e!=`object`?!1:e.name===`AbortError`}function qy(e){let t=Ey((0,Q.useContext)(Ty)),n=(0,Q.useRef)(e);n.current=e;let r=(0,Q.useRef)(t.navigation);r.current=t.navigation;let i=(0,Q.useRef)(null),a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(void 0),[u,d]=(0,Q.useState)(!1),f=(0,Q.useCallback)(()=>{let e=i.current,t=a.current;i.current=null,a.current=null,e&&!e.signal.aborted&&e.abort(),t!==null&&r.current.endParticipationPrefetch(t)},[]),p=(0,Q.useCallback)(async()=>{let e=n.current,t=Vse(),o=new AbortController;f(),i.current=o,a.current=t;let c={prefetchRuntimeId:t,participationRefs:e.participationRefs,resourceType:e.resourceType,intent:e.intent,startedAt:Date.now(),...e.label===void 0?{}:{label:e.label}};r.current.beginParticipationPrefetch(c),d(!0);try{let t=await e.run({signal:o.signal});return i.current===o?(s(t),l(void 0),r.current.clearFailedActionsForPrefetchKey(e.prefetchKey),t):void 0}catch(t){if(i.current!==o||Use(t))return;if(l(t),e.bridgeFailuresToShellAggregator===!0){let n=jy({failureRuntimeId:Hse(),error:t,resourceType:e.resourceType,startedAt:c.startedAt,...e.label===void 0?{}:{label:e.label},scope:Cy.PARTICIPATION_PREFETCH,prefetchKey:e.prefetchKey});r.current.captureFailedAction(n)}return}finally{a.current===t&&(a.current=null,i.current=null,r.current.endParticipationPrefetch(t),d(!1))}},[f]),m=(0,Q.useCallback)(()=>{i.current!==null&&(f(),d(!1))},[f]);return(0,Q.useEffect)(()=>()=>{f()},[f]),(0,Q.useMemo)(()=>({data:o,isLoading:u,error:c,prefetchKey:e.prefetchKey,refetch:p,abort:m}),[m,o,c,e.prefetchKey,u,p])}function Wse(e,t){return`participation-prefetch:${e}:${t}`}function Gse(e){let t=Ey((0,Q.useContext)(Ty)),{registry:n}=wm(),{buildResourceOperationContext:r}=Hy(),i=t.participations[e.participationRef];if(!i)throw Error(`useExecutionParticipationDataPrefetch: participation "${e.participationRef}" is not declared on view "${t.viewDefinition.ref}". Add it to the view's \`participations\` map or correct the ref.`);let a=Ly(i),{operationPathKey:o,contextualParameters:s,parentResourcesRequirements:c,label:l}=(0,Q.useMemo)(()=>{let t=r({participationRef:e.participationRef,operationLike:W.READ,requireAddressable:!0}),i=V.buildContextualParameters(t.contextResourceIdentifiers,n);return{operationPathKey:gl.createOperationPathKeyFromOperation(t.operation),contextualParameters:i,parentResourcesRequirements:t.parentResourcesRequirements,label:e.label}},[r,e.label,e.participationRef,n]),u=e.prefetchKey??Wse(a,e.participationRef),d=e.bridgeFailuresToShellAggregator??e.intent===_y.INITIAL,f=t.doOperation,p=(0,Q.useCallback)(async({signal:e})=>f(o,{contextualParameters:s,parentResourcesRequirements:c,dataMode:wn.RAW},{signal:e}),[s,f,o,c]);return qy({prefetchKey:u,participationRefs:[e.participationRef],resourceType:a,intent:e.intent,run:p,...l===void 0?{}:{label:l},bridgeFailuresToShellAggregator:d})}function Jy(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===t?n=!0:r[i]=a;return n?r:e}function Yy(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===yy.LOCAL_PANE&&a.paneId!==t?n=!0:r[i]=a;return n?r:e}function Kse(e){let t={markerId:e.markerId,markedAt:e.markedAt??Date.now(),label:e.label},n;return n=e.scope===yy.LOCAL_PANE?{...t,scope:e.scope,paneId:e.paneId}:{...t,scope:e.scope},by(n),n}function Xy(e){return{navigationLayout:()=>e.navigationLayout,designSystemConfiguration:()=>e.designSystemConfiguration,appComponentsConfiguration:()=>Dv(e.baseAppComponentsConfiguration,e.moduleRegistry),appScope:()=>Tv(e.moduleRegistry),compositeViews:()=>e.moduleRegistry.compositeViews,fullCustomViews:()=>e.moduleRegistry.fullCustomViews,onboardingViews:()=>e.moduleRegistry.onboardingViews,guidanceFlows:()=>e.moduleRegistry.guidanceFlows,flowsActorsViews:()=>e.moduleRegistry.flowsActorsViews,homeDefinition:()=>e.homeDefinition,errorPageConfig:()=>e.errorPageConfig,...e.shellIdentity===void 0?{}:{shellIdentity:()=>e.shellIdentity},...e.publicShellIdentityMode===void 0?{}:{publicShellIdentityMode:()=>e.publicShellIdentityMode}}}function Zy(e,t){let n={...e};for(let r of Object.keys(t)){let i=t[r];n[r]=typeof i==`function`?i():i!==void 0&&typeof i==`object`&&!Array.isArray(i)?{...e[r],...i}:i}return n}var Qy;(function(e){e.DESKTOP=`desktop`,e.MOBILE=`mobile`,e.TABLET=`tablet`,e.API=`api`})(Qy||={});var $y;(function(e){e.STRICT=`strict`,e.LAX=`lax`,e.NONE=`none`})($y||={});var qse=Vd({userAgent:kd().min(1,`User agent is required`),ipAddress:Qie(),deviceType:Rd(Qy).default(Qy.DESKTOP),location:kd().optional(),fingerprint:kd().optional()});function eb(e,t){let n=URL.createObjectURL(e);try{tb(n,t)}finally{URL.revokeObjectURL(n)}}function tb(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,document.body.appendChild(n);try{n.click()}finally{n.remove()}}function nb({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_ERROR_DISPLAY,`ErrorDisplay`)(e);return(0,$.jsx)(n,{...t})}var rb=({error:e,errorInfo:t,resetError:n,navigateHome:r})=>{let i=va.isDevelopment(),{tComponent:a,makeTrComponent:o,isReady:s}=K({component:J.APP_LAYOUTS_ERROR_BOUNDARY}),c=o(J.APP_LAYOUTS_ERROR_BOUNDARY);if(!s)return null;let l=[{label:c(`tryAgain`),onClick:n,variant:`destructive`,iconRef:H.TRY_AGAIN},{label:c(`goHome`),onClick:()=>{n(),r?.()},variant:`secondary`,iconRef:H.HOME}],u=[];return i&&(u.push({label:c(`errorMessageLabel`),content:e.message,variant:`error`}),e.stack&&u.push({label:c(`stackTraceLabel`),content:e.stack,variant:`default`}),t.componentStack&&u.push({label:c(`componentStackLabel`),content:t.componentStack,variant:`info`})),(0,$.jsx)(nb,{variant:`error`,iconRef:H.ERROR_APPLICATION,title:c(`title`),message:c(`message`),actions:l,showDevInfo:i,devInfoTitle:c(`devInfoTitle`),devInfoSubtitle:c(`devInfoSubtitle`),devInfoSections:u})};function ib({preset:e=q.DEFAULT,...t}){let n=G(J.APP_LAYOUTS_ERROR_BOUNDARY,`AppLayout_ErrorBoundary`)(e);return(0,$.jsx)(n,{...t})}var ab=Jo.getLogger();ab.debugByType(`ErrorBoundary`),ab.setDebugTypeLogging(`ErrorBoundary`,!1);function Jse(e){let t=vh(),{emit:n}=vo();return(0,$.jsx)(ib,{...e,navigateHome:()=>Zh({emit:n,routerNavigate:t})})}var ob=class extends Q.Component{constructor(e){super(e),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.setState({error:e,errorInfo:t}),ab.error(`ErrorBoundary caught an error:`,{error:e,errorInfo:t});let n=Du.buildReactError(e,t);try{fi.emit(hc.ERROR_OCCURED,{error:n})}catch(e){ab.warn(`Failed to emit error event:`,{dispatchError:e})}if(this.props.onError)try{this.props.onError(e,t)}catch(e){ab.warn(`Error in custom error handler:`,e)}}resetError=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){if(this.state.hasError&&this.state.error&&this.state.errorInfo){if(this.props.fallback){let e=this.props.fallback;return(0,$.jsx)(e,{error:this.state.error,errorInfo:this.state.errorInfo,resetError:this.resetError})}return(0,$.jsx)(Jse,{error:this.state.error,errorInfo:this.state.errorInfo,resetError:this.resetError})}return this.props.children}};function Yse(e,t){let n=n=>(0,$.jsx)(ob,{...t,children:(0,$.jsx)(e,{...n})});return n.displayName=`withErrorBoundary(${e.displayName||e.name})`,n}function Xse(e){if(typeof e==`string`)return e;try{let t=JSON.stringify(e,null,2);if(t!==void 0)return t}catch{}return String(e)}function Zse(e){switch(e){case 404:return H.ERROR_NOT_FOUND;case 403:return H.ERROR_ACCESS_DENIED;case 500:case 502:case 503:case 504:return H.ERROR_SERVER;default:return H.ERROR}}var sb=({errorType:e,routeError:t,jsError:n,unknownError:r,navigate:i,navigateAction:a,navigateBack:o,navigateHome:s,errorPageConfig:c,userGuidance:l})=>{let u=va.isDevelopment(),{tComponent:d,makeTrComponent:f,isReady:p}=K({component:J.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY}),m=f(J.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY),h=e=>nm({tComponent:d,componentType:J.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY,key:e}),g=s??(()=>i(`/`));return p?e===`route`&&t?ece(t,i,a,o??g,g,m,h,u,c,l):e===`javascript`&&n?tce(n,g,m,u):nce(r,g,m,u):null};function Qse(e,t,n,r,i,a){if(!e)return a;let o=[];if(e.primaryAction){let a=e.primaryAction;o.push({label:i(`errorPage_action_${a.type}`),onClick:()=>{switch(a.type){case`navigate`:if(n){n(a);break}a.target===`/`?r():t(a.target??`/`);break;case`retry`:window.location.reload();break;case`external`:window.open(a.target??`/`,`_blank`,`noopener,noreferrer`);break;case`support`:window.open(a.target??`/`,`_blank`,`noopener,noreferrer`)}},variant:`primary`})}if(e.secondaryActions)for(let a of e.secondaryActions)o.push({label:i(`errorPage_action_${a.type}`),onClick:()=>{switch(a.type){case`navigate`:if(n){n(a);break}a.target===`/`?r():t(a.target??`/`);break;case`retry`:window.location.reload();break;case`external`:window.open(a.target??`/`,`_blank`,`noopener,noreferrer`);break;case`support`:window.open(a.target??`/`,`_blank`,`noopener,noreferrer`)}},variant:`secondary`});return o.length>0?o:a}function $se(e){return{type:Em.NAVIGATE,target:e.target,resourceOperationPath:e.resourceOperationPath,compositeViewReference:e.compositeViewReference}}function ece(e,t,n,r,i,a,o,s,c,l){let{status:u}=e,d,f,p;switch(u){case 404:d=a(`title404`),f=a(`message404`),p=a(`suggestion404`);break;case 403:d=a(`title403`),f=a(`message403`),p=a(`suggestion403`);break;case 500:case 502:case 503:case 504:d=a(`title500`),f=a(`message500`),p=a(`suggestion500`);break;default:d=a(`titleDefault`,{status:u}),f=a(`messageDefault`),p=a(`suggestionDefault`)}let m=Qse(c,t,n,i,a,[{label:a(`goBack`),onClick:r,variant:`primary`,iconRef:H.BACK},{label:a(`goHome`),onClick:i,variant:`secondary`,iconRef:H.HOME}]),h;c?.featureGuide&&c.featureGuide.length>0&&(h=c.featureGuide.map(e=>({label:o(`errorPage_feature_${e.ref}`)??e.ref,onClick:()=>{let r=$se(e);n?n(r):r.target===`/`?i():r.target?t(r.target):i()},iconRef:e.icon})));let g;c?.supportAccess&&(g={label:a(`errorPage_contactSupport`),onClick:()=>{let e=c.supportAccess;e.type===`email`?window.location.href=`mailto:${e.target}`:window.open(e.target,`_blank`,`noopener,noreferrer`)}});let _;return c?.leadMagnet&&(_={label:a(`errorPage_leadMagnet`),onClick:()=>{window.open(c.leadMagnet.target,`_blank`,`noopener,noreferrer`)}}),(0,$.jsx)(nb,{variant:`default`,iconRef:Zse(u),statusCode:u,title:d,message:f,suggestion:p,actions:m,featureGuide:h,supportAccess:g,leadMagnet:_,userGuidance:l})}function tce(e,t,n,r){let i=[{label:n(`reload`),onClick:()=>window.location.reload(),variant:`destructive`,iconRef:H.RELOAD},{label:n(`goHome`),onClick:t,variant:`secondary`,iconRef:H.HOME}],a=[];return r&&(a.push({label:n(`errorMessageLabel`),content:e.message,variant:`error`}),e.stack&&a.push({label:n(`stackTraceLabel`),content:e.stack,variant:`default`})),(0,$.jsx)(nb,{variant:`error`,iconRef:H.ERROR_APPLICATION,title:n(`titleApplication`),message:n(`messageApplication`),actions:i,showDevInfo:r,devInfoTitle:n(`devInfoTitle`),devInfoSubtitle:n(`devInfoSubtitle`),devInfoSections:a})}function nce(e,t,n,r){let i=[{label:n(`reload`),onClick:()=>window.location.reload(),variant:`primary`,iconRef:H.RELOAD},{label:n(`goHome`),onClick:t,variant:`secondary`,iconRef:H.HOME}],a=[];return r&&a.push({label:n(`debugInfoLabel`),content:Xse(e),variant:`default`}),(0,$.jsx)(nb,{variant:`default`,iconRef:H.ERROR_UNKNOWN,title:n(`titleUnknown`),message:n(`messageUnknown`),actions:i,showDevInfo:r,devInfoTitle:n(`devInfoTitle`),devInfoSubtitle:n(`devInfoSubtitle`),devInfoSections:a})}function cb({preset:e=q.DEFAULT,...t}){let n=G(J.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY,`AppLayout_RouterErrorBoundary`)(e);return(0,$.jsx)(n,{...t})}var lb=Jo.getLogger();function rce(e){return e?Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`string`)):{}}var ub=()=>{let e=Sg(),t=vh(),{emit:n}=vo(),r=(0,Q.useContext)(ym),i=lm(),a=(0,Q.useContext)(Eh),o=(0,Q.useContext)(Mi),s=(0,Q.useContext)(yc),c=Ah(e)?e.status:404,l=(0,Q.useMemo)(()=>{if(!o?.frontendConfiguration)return;let e=o.frontendConfiguration;if(e.errorPageConfig)switch(c){case 404:return e.errorPageConfig.notFound;case 401:return e.errorPageConfig.unauthorized;case 403:return e.errorPageConfig.forbidden;case 503:return e.errorPageConfig.maintenance;default:return c>=500?e.errorPageConfig.serverError:void 0}},[o,c]),{wildoError:u,userGuidance:d}=(0,Q.useMemo)(()=>{if(!e)return{wildoError:void 0,userGuidance:void 0};let t=Ah(e)?Du.buildRouterError(e,e.status):Du.buildRouterError(e);return{wildoError:t,userGuidance:t.userGuidance}},[e]);Q.useEffect(()=>{if(u){lb.error(`RouterErrorBoundary caught error:`,{wildoError:u,error:e});try{fi.emit(hc.ERROR_OCCURED,{error:u})}catch(e){lb.warn(`Failed to dispatch error event:`,{dispatchError:e})}}},[u,e]);let f=(0,Q.useMemo)(()=>{let e={...i?.buildContextResourceIdentifiers?.()??{},...rce(u?.context)};return u?.organizationId&&(e.organizationId=u.organizationId),e},[i,u]),p=Q.useCallback(()=>{Zh({emit:n,routerNavigate:t})},[n,t]),m=Q.useCallback(e=>{if(!e.content)p();else if(a)n(hc.NAVIGATION_REQUEST,{content:e.content,initiator:{sourceZone:hn},urlPath:e.urlPath,replaceBrowserHistory:!0});else{if(!e.urlPath){p();return}t(e.urlPath,{replace:!0})}},[n,t,p,a]),h=Q.useCallback(e=>{if(e.type===`navigate`){if(e.resourceOperationPath){if(!r){p();return}let{registry:t}=r,n=e.resourceOperationPath,i=t.resourceConfigurations[n.resourceType];if(!i){p();return}let a=i.operations.find(e=>String(e.operationIdentifier)===String(n.operationIdentifier)&&!!(e.isOperationDefault??!0)===n.isOperationDefault&&!!(e.isBulkOperation??!1)===n.isBulkOperation&&String(e.variantKey??``)===String(n.variantKey??``));if(!a){p();return}let o=Ch.resolveResourceUrl(i,a,f,t.allResourceFieldIdentifiers,n.parentResourcesRequirements)?.resolvedUrl;if(!o){p();return}m({content:{contentType:hd.RESOURCE_OPERATION,resourceContext:gn.createFrontendResourceOperationContextFromOperation({resourceType:n.resourceType,operation:a,contextResourceIdentifiers:f,parentResourcesRequirements:n.parentResourcesRequirements})},urlPath:o})}else if(e.compositeViewReference){let t=Object.keys(f).length>0?f:void 0;m({content:{contentType:hd.COMPOSITE_VIEW,viewRef:e.compositeViewReference,contextResourceIdentifiers:t},urlPath:Vp(e.compositeViewReference,t)})}else!e.target||e.target===`/`?p():a?vg({emit:n,routerNavigate:t,path:e.target}):t(e.target,{replace:!0})}},[n,m,t,p,a,f,r]),g=(0,Q.useMemo)(()=>{if(!d)return;let e=d.guidanceKey??u?.customMessageReference,t=(t,n)=>{if(e&&s){let n=s.tErrorGuidance(e,t,d.params);if(n)return n}return n};return{explanation:t(`explanation`,d.explanation),resolution:t(`resolution`,d.resolution),completedSteps:d.completedSteps,retryAfterSeconds:d.retryAfterSeconds,nextAction:d.nextAction?{label:t(`nextActionLabel`,d.nextAction.label)??d.nextAction.label,onClick:()=>{if(d.nextAction.type===`url`)window.open(d.nextAction.ref,`_blank`,`noopener,noreferrer`);else{let e=d.nextAction.ref;if(!r){lb.warn(`Cannot navigate to operation: resource registry not available`,{ref:e}),p();return}let{registry:t}=r,n=Ch.resolveOperationRef(e,f,t);if(!n||n.contentType!==hd.RESOURCE_OPERATION){p();return}let{resourceContext:i}=n,a=t.resourceConfigurations[i.resourceType];if(!a){p();return}let o=Ch.resolveResourceUrl(a,i.operation,f,t.allResourceFieldIdentifiers,i.parentResourcesRequirements);if(o?.resolvedUrl){m({content:n,urlPath:o.resolvedUrl});return}p()}}}:void 0}},[m,s,p,f,r,d,u]),_=Q.useCallback(()=>{if(a){let e=Ch.resolveGoBackTarget({currentBrowserUrl:Ch.buildBrowserUrl(window.location.pathname,window.location.search),getZoneState:a.getZoneState});if(e?.browserUrl){n(hc.NAVIGATION_POP,{zone:e.zone}),t(e.browserUrl,{replace:!0});return}}window.history.length>1?t(-1):p()},[t,p,a]);return e?Ah(e)?(0,$.jsx)(cb,{errorType:`route`,routeError:{status:e.status,statusText:e.statusText,data:e.data},navigate:t,navigateAction:h,navigateBack:_,navigateHome:p,errorPageConfig:l,userGuidance:g}):e instanceof Error?(0,$.jsx)(cb,{errorType:`javascript`,jsError:e,navigate:t,navigateAction:h,navigateBack:_,navigateHome:p,errorPageConfig:l,userGuidance:g}):(0,$.jsx)(cb,{errorType:`generic`,unknownError:e,navigate:t,navigateAction:h,navigateBack:_,navigateHome:p,errorPageConfig:l,userGuidance:g}):(0,$.jsx)(cb,{errorType:`route`,routeError:{status:404,statusText:`Not Found`,data:{pathname:window.location.pathname}},navigate:t,navigateAction:h,navigateBack:_,navigateHome:p,errorPageConfig:l})},ice=4e3,db=Jo.getLogger(),fb=db.debugByType(`GlobalErrorHandler`);db.setDebugTypeLogging(`GlobalErrorHandler`,!1);function ace(e){switch(e){case vd.CRITICAL:case vd.HIGH:return`error`;case vd.MEDIUM:return`warning`;case vd.LOW:return`info`;default:return`error`}}function pb({onError:e}){let{on:t}=vo(),{handleWildoError:n}=up(),{endSession:r,isAuthenticated:i,getEndedSessionReason:a}=Dm(),{notifyError:o,notifyWarning:s,notifyInfo:c}=qm(),{tErrorMessage:l,tErrorGuidance:u,isKeySettled:d}=K(),f=(0,Q.useRef)({tErrorMessage:l,tErrorGuidance:u});f.current={tErrorMessage:l,tErrorGuidance:u};let p=d(Ji.ERRORS_MESSAGES),m=(0,Q.useRef)(p);m.current=p;let h=(0,Q.useRef)([]),g=(0,Q.useRef)(null),_=(0,Q.useCallback)(e=>{i()?(fb(`triggerLogout requested - logging out via AuthSession`),r(Mre(e))):fb(`triggerLogout requested but not authenticated - skipping logout`)},[r,i]),v=(0,Q.useCallback)(e=>{let t=Gee[e.type],n=e.severity||t?.severity||vd.MEDIUM,r=wp(e,{translators:f.current}),i=ace(n),a={errorType:e.type,severity:n,context:e.context};switch(i){case`error`:o(r,{data:a});break;case`warning`:s(r,{data:a});break;case`info`:c(r,{data:a})}fb(`Error notification displayed via NotificationContext`,{errorType:e.type,severity:n,notificationType:i,message:r})},[o,s,c]),y=(0,Q.useCallback)(()=>{g.current&&=(clearTimeout(g.current),null);let e=h.current;h.current=[];for(let t of e)v(t)},[v]),b=(0,Q.useCallback)(e=>{m.current?v(e):(h.current.push(e),g.current??=setTimeout(y,ice))},[v,y]);(0,Q.useEffect)(()=>{p&&h.current.length>0&&y()},[p,y]),(0,Q.useEffect)(()=>()=>{g.current&&clearTimeout(g.current),g.current=null},[]);let x=(0,Q.useCallback)(t=>{let r=t.error;if(fb(`Received ERROR_OCCURED event`,{errorType:r.type,customMessageReference:r.customMessageReference,triggerLogout:r.triggerLogout}),st.shouldSuppress(r)){fb(`Error suppressed (duplicate)`,{errorType:r.type,customMessageReference:r.customMessageReference});return}let i=r.triggerLogout===!0;if(i){fb(`triggerLogout=true - calling AuthSession logout handler`),_(r);let e=r.frontendActions||[];e.includes(bi.DISCONNECT)&&(r={...r,frontendActions:e.filter(e=>e!==bi.DISCONNECT)})}fb(`Error occurred`,{errorType:r.type,customMessageReference:r.customMessageReference});let o=r.suppressUserDisplay===!0,s=pn(r),c=r.frontendActions||[],l=r;o||i&&a()!==null?l={...r,frontendActions:c.filter(e=>e!==bi.NOTIFY&&e!==bi.SHOW_TOAST&&e!==bi.SHOW_MODAL)}:s&&(b(r),l={...r,frontendActions:c.filter(e=>e!==bi.NOTIFY&&e!==bi.SHOW_TOAST)}),e&&e(r),n(l)},[n,e,_,b,a]);return(0,Q.useEffect)(()=>{fb(`Subscribing to ERROR_OCCURED events`,{eventName:hc.ERROR_OCCURED});let e=t(hc.ERROR_OCCURED,x);return()=>{fb(`Unsubscribing from ERROR_OCCURED events`),e()}},[t,x]),null}var oce=()=>{let e=(0,Q.useContext)(dh);if(!e)throw Error(`useLoading must be used within a LoadingProvider`);return e};function mb(){let e=(0,Q.useContext)(dh);if(!e)throw Error(`useAppLoading must be used within a LoadingProvider`);return{isAppLoading:e.isAppLoading,sources:e.appLoadingSources}}function hb(e,t){let n=(0,Q.useContext)(dh);if(!n)throw Error(`useComponentLoading must be used within a LoadingProvider`);let r=hh(e),i=n.getComponentLoadingState(r)?.isLoading??!1,a=n.hasLoadedOnce(r,t?.refreshThresholdMs),o=n.markRendered,s=(0,Q.useCallback)(()=>{o(r)},[o,r]);return{isInitialLoad:i&&!a,isRefreshing:i&&a,isLoading:i,markRendered:s}}function sce({size:e=24,className:t,...n}){return(0,$.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:t??`inline-flex items-center justify-center text-primary`,...n,children:(0,$.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,style:{animation:`spin 0.9s linear infinite`},children:[(0,$.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeOpacity:`0.25`,strokeWidth:`3`,fill:`none`}),(0,$.jsx)(`path`,{d:`M12 2a10 10 0 0 1 10 10`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,fill:`none`})]})})}function gb({preset:e=q.DEFAULT,...t}){let n=wo.resolve(J.LOW_LEVEL_LOADING_SPINNER,e);return n?(0,$.jsx)(n,{...t}):(0,$.jsx)(sce,{...t})}function _b({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_LOADING_OVERLAY,`LoadingOverlay`)(e);return(0,$.jsx)(n,{...t})}function cce(e){switch(e){case`overlay`:return{initialLoad:wl.OPACITY_OVERLAY,refresh:wl.OPACITY_OVERLAY};case`spinner-only`:return{initialLoad:wl.SPINNER,refresh:wl.SPINNER};case`skeleton-children`:return{initialLoad:wl.SKELETON,refresh:wl.OPACITY_OVERLAY};default:return}}var lce=`contents [:where([class*='space-y-'])>&]:block`,vb=new Set([wl.OPACITY_OVERLAY,wl.HIDDEN,wl.INVISIBLE]);function yb({loadingScopes:e,i18nKeys:t,readiness:n,policy:r,renderLoading:i,renderError:a,timeoutMs:o,children:s}){let c=(0,Q.useContext)(dh);if(!c)throw Error(`LoadingGate must be used within a LoadingProvider`);let l=oc(),u=r??cce(l.interactiveState?.loadingDisplay),d=(0,Q.useMemo)(()=>({keys:t??[]}),[t]),{requestKeys:f,isKeySettled:p,isReady:m}=K(d),h=(0,Q.useMemo)(()=>e?.length?e.map(e=>{let t=hh(e);return{scope:e,key:t,isLoading:c.getComponentLoadingState(t)?.isLoading??!1,hasLoadedOnce:c.hasLoadedOnce(t)}}):[],[e,c]),g=h.length===0||h.every(e=>!e.isLoading);(0,Q.useEffect)(()=>{t?.length&&f(t).catch(()=>void 0)},[t,f]);let _=!t?.length||t.every(e=>p(e)),v=!n?.length||n.every(e=>e.isReady),y=g&&_&&v,b=(0,Q.useMemo)(()=>h.some(e=>e.isLoading&&!e.hasLoadedOnce)?Jl.INITIAL:h.some(e=>e.isLoading&&e.hasLoadedOnce)?Jl.REFRESH:Jl.INITIAL,[h]),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(y){C.current=null,S(!1);return}if(C.current||=Date.now(),!o)return;let e=o-(Date.now()-C.current);if(e<=0){S(!0);return}let t=setTimeout(()=>S(!0),e);return()=>clearTimeout(t)},[y,o]);let w=(0,Q.useRef)(!1);if((0,Q.useEffect)(()=>{if(y&&!w.current&&e?.length){w.current=!0;for(let t of e)c.markRendered(hh(t))}y||(w.current=!1)},[y,e,c]),x&&a){let e=h.filter(e=>e.isLoading).map(e=>e.scope);return(0,$.jsx)($.Fragment,{children:a({failedScopes:e,reason:`timeout`,retry:()=>{S(!1),C.current=Date.now()}})})}let T=u?.refresh??wl.OPACITY_OVERLAY,E=u?.initialLoad??wl.SKELETON,D=vb.has(T)||vb.has(E);if(y)return D?(0,$.jsx)(`div`,{className:lce,"data-loading-gate":`ready`,children:s}):(0,$.jsx)($.Fragment,{children:s});let O=b===Jl.REFRESH?T:E,k={phase:b,scope:h[0]?.scope??{customIdentifier:`loading-gate`}};switch(O){case wl.CUSTOM:return(0,$.jsx)($.Fragment,{children:i?.(k)??s});case wl.SKELETON:return(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:`Loading`}),i?i(k):(0,$.jsx)(Tm,{template:`auto`,density:`auto`,"aria-hidden":`true`})]});case wl.SPINNER:return(0,$.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,$.jsx)(gb,{size:32})});case wl.OPACITY_OVERLAY:return(0,$.jsxs)(`div`,{className:`relative`,"data-loading-gate":`loading`,children:[s,(0,$.jsx)(_b,{})]});case wl.HIDDEN:return(0,$.jsx)(`div`,{style:{display:`none`},"data-loading-gate":`loading`,children:s});case wl.INVISIBLE:return(0,$.jsx)(`div`,{style:{visibility:`hidden`},"data-loading-gate":`loading`,children:s});case wl.FULL_SCREEN:return(0,$.jsx)(`div`,{className:`fixed inset-0 z-(--z-critical) flex items-center justify-center bg-background/80`,children:(0,$.jsx)(gb,{size:48})});default:return(0,$.jsx)($.Fragment,{children:s})}}var bb;(function(e){e.PENDING=`pending`,e.READY=`ready`,e.ERROR=`error`})(bb||={});var xb=(0,Q.createContext)(null);function uce(){let e=(0,Q.useContext)(xb);if(!e)throw Error(`useBarrierParticipant must be used within a LoadingBarrier`);return e}function dce({renderLoading:e,renderError:t,timeoutMs:n,children:r}){let i=(0,Q.useRef)(new Map),[,a]=(0,Q.useState)(0),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(0),u=(0,Q.useRef)(Date.now()),d=(0,Q.useCallback)(e=>(i.current.has(e)||(i.current.set(e,{status:bb.PENDING}),a(e=>e+1)),{markReady:()=>{let t=i.current.get(e);t&&t.status!==bb.READY&&(i.current.set(e,{status:bb.READY}),a(e=>e+1))},markError:t=>{let n=i.current.get(e);n&&n.status!==bb.ERROR&&(i.current.set(e,{status:bb.ERROR,error:t}),a(e=>e+1))},unregister:()=>{i.current.has(e)&&(i.current.delete(e),a(e=>e+1))}}),[]),f=i.current,p=f.size>0&&Array.from(f.values()).every(e=>e.status===bb.READY),m=Array.from(f.values()).some(e=>e.status===bb.ERROR);(0,Q.useEffect)(()=>{if(p||!n)return;let e=n-(Date.now()-u.current);if(e<=0){s(!0);return}let t=setTimeout(()=>s(!0),e);return()=>clearTimeout(t)},[p,n]),(0,Q.useEffect)(()=>{p&&s(!1)},[p]);let h=(0,Q.useMemo)(()=>({register:d,retryCounter:c}),[d,c]);if((o||m)&&t){let e=Array.from(f.entries()).filter(([,e])=>e.status!==bb.READY),n=e.map(([e])=>({customIdentifier:e})),r=e.find(([,e])=>e.error)?.[1]?.error;return(0,$.jsx)(xb.Provider,{value:h,children:t({failedScopes:n,reason:m?`error`:`timeout`,error:r,retry:()=>{s(!1),u.current=Date.now();for(let[e]of f)f.set(e,{status:bb.PENDING});l(e=>e+1),a(e=>e+1)}})})}let g=!p;return(0,$.jsx)(xb.Provider,{value:h,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`div`,{style:{opacity:+!g,pointerEvents:g?`none`:`auto`,transition:`opacity 200ms ease-out`},"aria-hidden":g,children:r}),g&&(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:e?e():(0,$.jsx)(gb,{size:32})})]})})}var Sb={[Ka.RESOURCES_LAYOUTS]:{initialLoad:wl.SKELETON,refresh:wl.OPACITY_OVERLAY},[Ka.RESOURCES_FIELDS]:{initialLoad:wl.SKELETON,refresh:wl.OPACITY_OVERLAY},[Ka.HIGH_LEVEL_VIEWS]:{initialLoad:wl.SKELETON,refresh:wl.OPACITY_OVERLAY},[Ka.APPLICATION_LEVEL_COMPONENTS]:{initialLoad:wl.SKELETON,refresh:wl.HIDDEN},[Ka.PUBLIC_LAYOUTS]:{initialLoad:wl.SPINNER,refresh:wl.SPINNER}};function fce(e,t){let n=Sb[e]??{};return{initialLoad:t?.initialLoad??n.initialLoad??wl.SKELETON,refresh:t?.refresh??n.refresh??wl.OPACITY_OVERLAY,customRenderer:t?.customRenderer??n.customRenderer,disableInteraction:t?.disableInteraction??n.disableInteraction,skeletonSchema:t?.skeletonSchema??n.skeletonSchema}}var Cb=Jo.getLogger(),pce=Cb.debugByType(`AppLoadingGate`);Cb.setDebugTypeLogging(`AppLoadingGate`,!1);function wb({renderLoading:e,children:t}){let{isAppLoading:n,sources:r}=mb(),i=(0,Q.useRef)(!1),[a,o]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{n?i.current=!0:i.current&&o(!0)},[n]),(0,Q.useEffect)(()=>{pce(`Gate render state: ${n?`loading`:`ready`} [${r.map(e=>e.identifier).join(`, `)||`none`}]`)},[n,r]),(0,$.jsxs)($.Fragment,{children:[t,n&&(e?e(r):a?(0,$.jsx)(`div`,{className:`fixed top-4 end-4 z-(--z-critical) pointer-events-none flex items-center justify-center rounded-full bg-background/80 p-2 shadow-md`,role:`status`,"aria-live":`polite`,"data-app-loading-indicator":`non-blocking`,children:(0,$.jsx)(gb,{size:20})}):(0,$.jsx)(`div`,{className:`fixed inset-0 z-(--z-critical) flex items-center justify-center bg-background`,role:`status`,"aria-live":`polite`,children:(0,$.jsx)(gb,{size:48})}))]})}function Tb(e){return Array.from(new Set(e.filter(e=>typeof e==`string`&&e.length>0)))}function Eb(e){let t=e.displayNameLabelKey??Dd(e.providerRef),n=e.translate?.(t);return n&&n!==t?n:e.displayName??e.fallbackLabel??e.providerRef}function Db(...e){let t=X_(`FrontendApp`,e);return sae(`FrontendApp`,t.modules.values()),t}var Ob=`@wildo-ai/external-connectors-public`,mce={metadata:Cd({ref:`dropbox`,packageName:Ob,tier:Bd.MAIN,origin:xd}),providerCapabilities:[Id.FRONTEND_FILE_PICKER],protocols:[ni.FRONTEND_SDK],publicConfig:{},publicConfigSchema:W_({appKey:{kind:U_.STRING,description:`Dropbox app key the Chooser is registered under; public by design.`}}),scripts:[{src:`https://www.dropbox.com/static/api/2/dropins.js`,async:!0,defer:!0}],csp:{scriptOrigins:[`https://www.dropbox.com`],frameOrigins:[`https://www.dropbox.com`],connectOrigins:[`https://dl.dropboxusercontent.com`]},components:{[Id.FRONTEND_FILE_PICKER]:{selectionDelivery:bd.BROWSER_READABLE_URL}},complianceProfile:{deploymentModels:[Ad.VENDOR_HOSTED],processingRegions:[`United States`,`Australia`,`European Union`,`Japan`,`United Kingdom`],processingRegionReach:Object.fromEntries([`United States`,`Australia`,`European Union`,`Japan`,`United Kingdom`].map(e=>[e,{kind:jd.ACCOUNT_RESIDENCY}])),vendorLegalEntityName:`Dropbox, Inc.`,evidence:[{facts:[yd.PROCESSING_REGIONS,yd.PROCESSING_REGION_REACH],source:`https://help.dropbox.com/security/physical-location-data-storage`,verifiedAt:`2026-11-10`}]}},hce={metadata:Cd({ref:`google-drive`,packageName:Ob,tier:Bd.MAIN,origin:xd}),providerCapabilities:[Id.FRONTEND_FILE_PICKER],protocols:[ni.FRONTEND_SDK],publicConfig:{},publicConfigSchema:W_({appId:{kind:U_.STRING,description:`Google Cloud project NUMBER the Drive Picker is registered under.`},developerKey:{kind:U_.STRING,description:`Optional API key for the Picker; public by design.`}}),scripts:[{src:`https://apis.google.com/js/api.js`,async:!0,defer:!0}],csp:{scriptOrigins:[`https://apis.google.com`],frameOrigins:[`https://docs.google.com`],connectOrigins:[`https://content.googleapis.com`]},components:{[Id.FRONTEND_FILE_PICKER]:{selectionDelivery:bd.REMOTE_REFERENCE}},fileStorage:pae.GOOGLE_DRIVE,complianceProfile:{deploymentModels:[Ad.VENDOR_HOSTED],processingRegions:[`United States`,`European Union`,`No preference`,`Servers around the world (personal Google account)`],processingRegionReach:Object.fromEntries([`United States`,`European Union`,`No preference`,`Servers around the world (personal Google account)`].map(e=>[e,{kind:jd.ACCOUNT_RESIDENCY}])),evidence:[{facts:[yd.DEPLOYMENT_MODELS,yd.PROCESSING_REGIONS],source:`https://knowledge.workspace.google.com/admin/compliance/choose-a-geographic-location-for-your-data`,verifiedAt:`2026-11-06`},{facts:[yd.PROCESSING_REGIONS],source:`https://policies.google.com/privacy`,verifiedAt:`2026-11-06`},{facts:[yd.PROCESSING_REGION_REACH],source:`https://knowledge.workspace.google.com/admin/compliance/choose-a-geographic-location-for-your-data`,verifiedAt:`2026-11-10`}]}},gce=`Google Maps`,_ce=[mce,hce,{metadata:Cd({ref:`google-places`,packageName:Ob,tier:Bd.MAIN,origin:xd}),providerCapabilities:[Id.FRONTEND_ADDRESS_LOOKUP],protocols:[],publicConfig:{},publicConfigSchema:W_({}),components:{[Id.FRONTEND_ADDRESS_LOOKUP]:{placeIdRetention:Od.NONE,addressLookup:{suggestOperationId:`address_suggest`,retrieveOperationId:`address_retrieve`,sessionTokenInput:`sessionToken`,attributionMark:gce}}},complianceProfile:{deploymentModels:[Ad.VENDOR_HOSTED],processingRegions:[`Servers around the world`],evidence:[{facts:[yd.DEPLOYMENT_MODELS,yd.PROCESSING_REGIONS],source:`https://policies.google.com/privacy`,verifiedAt:`2026-11-06`}]}},{metadata:Cd({ref:`microsoft-onedrive`,packageName:Ob,tier:Bd.MAIN,origin:xd}),providerCapabilities:[Id.FRONTEND_FILE_PICKER],protocols:[ni.FRONTEND_SDK],publicConfig:{},publicConfigSchema:W_({clientId:{kind:U_.STRING,description:`Azure application (client) id the OneDrive picker is registered under.`},pickerRedirectUri:{kind:U_.STRING,description:`Optional redirect URI for the picker popup.`}}),scripts:[{src:`https://js.live.net/v7.2/OneDrive.js`,async:!0,defer:!0}],csp:{scriptOrigins:[`https://js.live.net`],frameOrigins:[`https://onedrive.live.com`]},components:{[Id.FRONTEND_FILE_PICKER]:{selectionDelivery:bd.BROWSER_READABLE_URL}},complianceProfile:{deploymentModels:[Ad.VENDOR_HOSTED],processingRegions:`European Union.United States.Australia.Austria.Brazil.Canada.Chile.Denmark.France.Germany.India.Indonesia.Israel.Italy.Japan.Malaysia.Mexico.New Zealand.Norway.Poland.Qatar.South Africa.South Korea.Spain.Sweden.Switzerland.Taiwan.United Arab Emirates.United Kingdom.Your region or the United States (personal Microsoft account)`.split(`.`),processingRegionReach:Object.fromEntries(`European Union.United States.Australia.Austria.Brazil.Canada.Chile.Denmark.France.Germany.India.Indonesia.Israel.Italy.Japan.Malaysia.Mexico.New Zealand.Norway.Poland.Qatar.South Africa.South Korea.Spain.Sweden.Switzerland.Taiwan.United Arab Emirates.United Kingdom.Your region or the United States (personal Microsoft account)`.split(`.`).map(e=>[e,{kind:jd.ACCOUNT_RESIDENCY}])),evidence:[{facts:[yd.DEPLOYMENT_MODELS,yd.PROCESSING_REGIONS],source:`https://learn.microsoft.com/en-us/microsoft-365/enterprise/m365-dr-service-spo`,verifiedAt:`2026-11-06`},{facts:[yd.PROCESSING_REGIONS],source:`https://learn.microsoft.com/en-us/microsoft-365/enterprise/o365-data-locations`,verifiedAt:`2026-11-06`},{facts:[yd.PROCESSING_REGIONS],source:`https://www.microsoft.com/en-us/privacy/privacystatement`,verifiedAt:`2026-11-06`},{facts:[yd.PROCESSING_REGION_REACH],source:`https://learn.microsoft.com/en-us/microsoft-365/enterprise/m365-dr-service-spo`,verifiedAt:`2026-11-10`}]}}];Db({modules:new Map(_ce.map(e=>[e.metadata.ref,e]))});var kb=function(e){return e.AT_SURFACE_START=`at_surface_start`,e.ON_DEMAND=`on_demand`,e}({});function Ab(e){return{selectionDelivery:e.selectionDelivery,...e.placeIdRetention===void 0?{}:{placeIdRetention:e.placeIdRetention},...e.addressLookup===void 0?{}:{addressLookup:{suggestOperationId:e.addressLookup.suggestOperationId,retrieveOperationId:e.addressLookup.retrieveOperationId,...e.addressLookup.sessionTokenInput===void 0?{}:{sessionTokenInput:e.addressLookup.sessionTokenInput},...e.addressLookup.attributionMark===void 0?{}:{attributionMark:e.addressLookup.attributionMark}}}}}var jb=Object.freeze({browserHosted:!1}),Mb=Object.freeze({browserHosted:!0,consentPurposes:Object.freeze([])}),Nb=Object.freeze({FRONTEND_PRODUCT_ANALYTICS:Object.freeze({browserHosted:!0,consentPurposes:Object.freeze([Kd.ANALYTICS])}),FRONTEND_ERROR_MONITORING:Mb,FRONTEND_CAPTCHA:Mb,FRONTEND_SEARCH:Mb,FRONTEND_FILE_PICKER:Mb,FRONTEND_ADDRESS_LOOKUP:Mb,FRONTEND_CHAT_SIGN_IN_COMPLETION:Mb,SSO_OAUTH2:Mb,BILLING:jb,EMAIL_TRANSACTIONAL:jb,EMAIL_MARKETING:jb,EMAIL_INBOUND:jb,SMS:jb,ELECTRONIC_SIGNATURE:jb,SSO_SAML:jb,LLM_CHAT:jb,LLM_EMBEDDINGS:jb,DOCUMENT_TEXT_EXTRACTION:jb,PROMPT_INJECTION_SCREENING:jb,OUTPUT_MODERATION:jb,CODING_AGENT:jb,IMAGE_GENERATION:jb,LLM_OBSERVABILITY:jb,OBSERVABILITY_TELEMETRY:jb,COMPLIANCE_AUDIT_TRAIL:jb,KEY_MANAGEMENT:jb});function Pb(e){return Object.prototype.hasOwnProperty.call(Nb,e)?Nb[e]:void 0}function Fb(e){return(e.providerCapabilities??[]).filter(e=>Pb(e)?.browserHosted!==!0)}function Ib(e){let t=new Set(aae);return(e.consentPurposes??[]).filter(e=>!t.has(e))}function Lb(e){let t=[...e.consentPurposes??[]];for(let n of e.providerCapabilities??[]){let e=Pb(n);e?.browserHosted===!0&&t.push(...e.consentPurposes)}return Hd(t)}function Rb(e,t){return Fb(e).length>0||Ib(e).length>0?!1:Pd(t,Lb(e)).length===0}function zb(e,t){return Pd(t,Lb(e))}function Bb(e,t,n){let r=Fb(t);if(r.length>0)return`Provider "${e}" declares ${r.join(`, `)}, which no browser surface may host, so it never starts. Remove the capability from its frontend module.`;let i=Ib(t);return i.length>0?`Provider "${e}" declares consent purposes ${i.join(`, `)}, which are not consent purposes, so it never starts. Declare members of ConsentPurpose.`:`Provider "${e}" rests on consent to ${zb(t,n).join(`, `)}, which has not been granted on this surface.`}function Vb(e,t){let n=Lb(t);if(n.length!==0){if((t.scripts?.length??0)>0)return`Provider "${e}" rests on consent to ${n.join(`, `)} and declares <script> tags, which cannot be stopped when that consent is withdrawn. Load the script from inside its sdk.activate and return a deactivate instead (#1704).`;if(t.sdk!==void 0&&t.sdk.stoppable!==!0)return`Provider "${e}" rests on consent to ${n.join(`, `)} and its SDK does not declare stoppable: true, so a withdrawal could not stop it. Return a deactivate from sdk.activate that fully stops the vendor, and declare stoppable: true (#1704).`}}function Hb(e){let t=e=>typeof e!=`object`||!e||Array.isArray(e)?e:Object.fromEntries(Object.keys(e).sort().map(n=>[n,t(e[n])]));return JSON.stringify(t(e))}function Ub(e,t){if(e.length!==t.length)return!1;let n=[...e].sort(),r=[...t].sort();return n.every((e,t)=>e===r[t])}function vce(e,t){if(e===void 0||t===void 0)return e===t;let n=eae(t);return mae.every(t=>Ub(e[t]??[],n[t]))}function yce(e){return e.issues!==void 0}function bce(e,t,n,r,i){let a=iae({providerCapabilities:r,publicConfig:t});if(a.issues.length>0){i({kind:`PUBLIC_CONFIG_INVALID`,providerRef:e,message:`Provider "${e}" was served a publicConfig its own schema rejects, so none of its code will run. `+a.issues.map(e=>`${e.path.map(String).join(`.`)||`(root)`}: ${e.message}`).join(`; `)});return}let o=n[`~standard`].validate(a.providerConfig);if(o instanceof Promise)i({kind:`PUBLIC_CONFIG_SCHEMA_ASYNC`,providerRef:e,message:`Provider "${e}" declares an asynchronous publicConfigSchema. Frontend provider hydration is synchronous, so the schema cannot be awaited; declare a synchronous validator (a Zod schema is one).`});else if(yce(o))i({kind:`PUBLIC_CONFIG_INVALID`,providerRef:e,message:`Provider "${e}" was served a publicConfig its own schema rejects, so none of its code will run. ${o.issues.map(e=>{let t=(e.path??[]).map(e=>String(typeof e==`object`?e.key:e)).join(`.`);return t.length>0?`${t}: ${e.message}`:e.message}).join(`; `)}`});else return{...a.capabilityConfig,...o.value}}function xce(e){let t=t=>{e.onDiagnostic?.(t)},n=e.modules??{},r=new Map,i=Object.keys(e.entries?.providers??{}),a=Object.keys(n);i.length===0&&a.length>0&&t({kind:`DATA_MISSING_FOR_BUNDLED_PROVIDERS`,providerRef:``,message:`This bundle carries code for ${a.length} provider(s) — ${a.join(`, `)} — and the backend declared none for this service, so every provider-backed surface will render as though none exists. Usually a backend older than this bundle, or a frontend service whose provider scope was never authored; \`wildo config sync\` settles the second.`});for(let[i,a]of Object.entries(e.entries?.providers??{})){let e=Object.prototype.hasOwnProperty.call(n,i)?n[i]:void 0,o=e;if(o!==void 0&&o.metadata.ref!==i&&(t({kind:`GENERATED_MODULE_REF_MISMATCH`,providerRef:i,message:`The generated frontend provider module map lists "${i}" but the module it points at declares ref "${o.metadata.ref}". Its code is ignored rather than bound to another provider's configuration; regenerate with \`wildo config sync\`.`}),o=void 0),o!==void 0&&!vce(a.csp,o.csp)&&t({kind:`GENERATED_ARTIFACT_STALE`,providerRef:i,message:`Provider "${i}" declares a CSP footprint that differs from the one its served entry carries, so the service's Content-Security-Policy was composed from a stale footprint. That surfaces in production only, because CSP is report-only in development. Regenerate with \`wildo config sync\`.`}),o!==void 0&&qd(a.sdk)!==qd(o.sdk?.descriptor)&&t({kind:`GENERATED_ARTIFACT_STALE`,providerRef:i,message:`Provider "${i}" declares ${qd(o.sdk?.descriptor)} but its served entry says ${qd(a.sdk)}. Regenerate with \`wildo config sync\`.`}),o!==void 0){for(let[e,n]of Object.entries(o.components??{})){let r=Hb(Ab(n)),o=a.components?.[e],s=o===void 0?void 0:Hb(Ab(o));s!==r&&t({kind:`GENERATED_ARTIFACT_STALE`,providerRef:i,message:`Provider "${i}" declares its "${e}" component as ${r} but its served entry says ${s??`(none)`}. The framework enforces the CODE side, so the manifest a reviewer reads and the contract actually held would disagree. Regenerate with \`wildo config sync\`.`})}o.fileStorage!==a.fileStorage&&t({kind:`GENERATED_ARTIFACT_STALE`,providerRef:i,message:`Provider "${i}" declares its file picker fronts the "${o.fileStorage??`(none)`}" storage but its served entry says "${a.fileStorage??`(none)`}". Regenerate with \`wildo config sync\`.`})}let s=[...new Set(a.consentPurposes??[])],c=[...new Set(o?.consentPurposes??[])];o!==void 0&&!Ub(s,c)&&t({kind:`GENERATED_ARTIFACT_STALE`,providerRef:i,message:`Provider "${i}" declares consent purposes [${c.join(`, `)}] but its served entry says [${s.join(`, `)}]. It is held to both until the artifact is regenerated with \`wildo config sync\`.`});let l=[...new Set([...s,...c])],u=a.publicConfig??{};o!==void 0&&G_(o.publicConfigSchema)===void 0&&(t({kind:`PUBLIC_CONFIG_SCHEMA_MISSING`,providerRef:i,message:`Provider "${i}" declares no publicConfigSchema whose keys can be read, so nothing holds what it is served to a key list and none of its code will run. Declare one with \`defineFrontendPublicConfigSchema\` (#1705).`}),o=void 0);let d=a.scripts,f=Vb(i,{providerCapabilities:a.providerCapabilities,consentPurposes:l,scripts:a.scripts,sdk:o?.sdk});if(f!==void 0&&(t({kind:`CONSENT_BASED_PROVIDER_NOT_STOPPABLE`,providerRef:i,message:`${f} Its code and scripts are withheld on this surface.`}),o=void 0,d=void 0),o!==void 0||d!==void 0){let e=q_([...new Set([...K_(o?.publicConfigSchema),...a.requiredPublicConfigKeys??[]])],u);e.length>0&&(t({kind:`PUBLIC_CONFIG_NOT_SUPPLIED`,providerRef:i,message:J_({providerRef:i,missingKeys:e})}),o=void 0,d=void 0)}if(o?.publicConfigSchema!==void 0){let e=bce(i,u,o.publicConfigSchema,a.providerCapabilities,t);e===void 0?o=void 0:u=e}o===void 0&&e===void 0&&t({kind:`CODE_MISSING_FOR_DECLARED_PROVIDER`,providerRef:i,message:`Frontend provider "${i}" is declared for this service but the bundle carries no code for it, so its SDK and components are unavailable. Run \`wildo config sync\` to regenerate frontend-providers.generated.ts.`}),r.set(i,{metadata:a.metadata,providerCapabilities:[...a.providerCapabilities],protocols:[...a.protocols],publicConfig:u,csp:a.csp,scripts:d,sdk:o?.sdk,components:o?.components,publicConfigSchema:o?.publicConfigSchema,...l.length>0?{consentPurposes:l}:{}})}return r}function Sce(e){let t=xce(e);return Db({modules:new Map([...t].map(([e,t])=>[e,{...t,providerCapabilities:t.providerCapabilities,protocols:t.protocols,consentPurposes:t.consentPurposes}]))})}var Wb=function(e){return e.SERVES=`serves`,e.DOES_NOT_SERVE=`does_not_serve`,e.NO_PREDICATE=`no_predicate`,e.PREDICATE_FAILED=`predicate_failed`,e}({});function Gb(e,t){let n=e.sdk;if(n?.activation!==kb.ON_DEMAND||!(e.providerCapabilities??[]).includes(t.capability))return{verdict:`does_not_serve`};if(n.servesOnDemandContext===void 0)return{verdict:`no_predicate`};try{return{verdict:n.servesOnDemandContext(t)===!0?`serves`:`does_not_serve`}}catch(e){return{verdict:`predicate_failed`,cause:e}}}function Kb(e){let t=e.trim();return/[.!?]$/.test(t)?t:`${t}.`}function Cce(){return typeof globalThis<`u`&&globalThis.window!==void 0}async function qb(e){let t=t=>{e.onDiagnostic?.(t)},n=new Map,r=e.isBrowser??Cce;for(let i of e.modules){let a=i.sdk;if(a===void 0)continue;let o=i.metadata.ref,s=(a.activation??kb.AT_SURFACE_START)===kb.ON_DEMAND;if(e.onDemand===void 0){if(s)continue}else{let{verdict:n,cause:r}=Gb(i,e.onDemand);if(n===Wb.NO_PREDICATE?t({kind:`ON_DEMAND_WITHOUT_PREDICATE`,providerRef:o,message:`Provider "${o}" declares an on-demand SDK for ${e.onDemand.capability} with no servesOnDemandContext, so it cannot say it serves this call and its SDK was not loaded. Declare the predicate (#2790).`}):n===Wb.PREDICATE_FAILED&&t({kind:`ON_DEMAND_PREDICATE_FAILED`,providerRef:o,message:`Provider "${o}"'s servesOnDemandContext threw: ${Kb(Ca(r))} Its SDK was not loaded.`,cause:r}),n!==Wb.SERVES)continue}if(!Rb(i,e.grantedConsentPurposes??[])){t({kind:`WITHHELD_PENDING_CONSENT`,providerRef:o,message:`${Bb(o,i,e.grantedConsentPurposes??[])} Its SDK was not loaded.`});continue}let c=Vb(o,i);if(c!==void 0)t({kind:`WITHHELD_NOT_STOPPABLE`,providerRef:o,message:`${c} Its SDK was not loaded.`});else if(!r())t({kind:`SKIPPED_OFF_BROWSER`,providerRef:o,message:`Provider "${o}" declares ${qd(a.descriptor)} but activation was requested outside a browser, so nothing was loaded. Activate again on the client.`});else try{let r=await a.activate({providerRef:o,surface:e.surface,publicConfig:i.publicConfig??{}});n.set(o,r),Lb(i).length>0&&r.deactivate===void 0&&t({kind:`STOP_PROMISE_BROKEN`,providerRef:o,message:`Provider "${o}" declares a stoppable SDK but its activation returned no deactivate, so a withdrawal of the consent it rests on will not stop it. Return a deactivate from sdk.activate (#1704).`})}catch(e){t({kind:`ACTIVATION_FAILED`,providerRef:o,message:`Provider "${o}" did not activate (it loads ${qd(a.descriptor)}): ${Kb(Ca(e))} Its capability is unavailable on this surface; every other provider was still activated.`,cause:e})}}return{activations:n,async deactivateAll(){for(let[e,r]of n)if(r.deactivate!==void 0)try{await r.deactivate()}catch(n){t({kind:`DEACTIVATION_FAILED`,providerRef:e,message:`Provider "${e}" failed to deactivate its SDK; it may still be running.`,cause:n})}n.clear()}}}function wce(){let e=Promise.resolve();return{start(t,n){let r=!1,i=e.then(()=>r?void 0:t()).catch(()=>void 0).then(e=>{if(e!==void 0&&!r)try{n?.(e)}catch{}return e});return()=>{r=!0,e=i.then(e=>e?.deactivateAll()).catch(()=>void 0)}}}}var Jb=`data-wildo-provider-script`,Yb=`data-wildo-provider-script-state`;function Tce(e){if(e===void 0)return[];let t=[];for(let n of e)if(!(Lb(n).length>0)&&Rb(n,[]))for(let e of n.scripts??[])t.push({providerRef:n.metadata.ref,declaration:e});return t}function Ece(e,t){return[...e.querySelectorAll(`script[${Jb}]`)].find(e=>e.getAttribute(`src`)===t)}function Dce(e,t){let{providerRef:n,declaration:r}=t,i=e.createElement(`script`);return i.src=r.src,i.setAttribute(Jb,n),i.setAttribute(Yb,`loading`),i.addEventListener(`load`,()=>i.setAttribute(Yb,`loaded`),{once:!0}),i.addEventListener(`error`,()=>i.setAttribute(Yb,`failed`),{once:!0}),r.integrity!==void 0&&(i.integrity=r.integrity),r.crossOrigin!==void 0&&(i.crossOrigin=r.crossOrigin),i.async=r.async??r.defer!==!0,i.defer=r.defer??!1,e.head.appendChild(i),i}function Oce(e){return{providerRef:e.providerRef,src:e.declaration.src,message:`Provider "${e.providerRef}" declares the script "${e.declaration.src}" and it failed to load (network failure, a Content-Security-Policy refusal, or an integrity mismatch). Whatever it installs is not present on this surface.`}}function kce(e){let t=e.getAttribute(Yb);return t===`failed`?Promise.resolve(`failed`):t===`loading`?new Promise(t=>{let n=()=>{e.removeEventListener(`error`,r),t(`loaded`)},r=()=>{e.removeEventListener(`load`,n),t(`failed`)};e.addEventListener(`load`,n,{once:!0}),e.addEventListener(`error`,r,{once:!0})}):Promise.resolve(`loaded`)}async function Xb(e,t){let n=await Promise.all(e.map(async e=>({script:e,state:await kce(Ece(t,e.declaration.src)??Dce(t,e))})));return{loaded:n.filter(e=>e.state===`loaded`).map(e=>e.script),failed:n.filter(e=>e.state===`failed`).map(e=>Oce(e.script))}}function Ace(){return typeof document<`u`}var jce=e=>Xb(e,document);function Mce(e){return typeof e==`object`&&!!e&&e[Symbol.toStringTag]===`Module`}function Nce(e){return typeof e==`function`||typeof e==`object`&&!!e}function Pce(e){let t=t=>{e?.onDiagnostic?.(t)},n=new Map,r=new Map,i=e?.loadScripts??jce,a=e?.hasBrowserDocument??Ace,o=new Map,s=new Map,c=new Map,l=new Map,u=(e,t)=>`${e}:${t}`;for(let i of e?.registrations??[]){let e=u(i.capability,i.providerRef);if(n.has(e)){t({kind:`DUPLICATE_REGISTRATION`,capability:i.capability,providerRef:i.providerRef,message:`Provider "${i.providerRef}" registered a component for "${i.capability}" more than once. The first registration is kept.`});continue}let a=Vb(i.providerRef,{...i.consent,...i.scripts===void 0?{}:{scripts:i.scripts}});if(a!==void 0){t({kind:`CONSENT_BASED_PROVIDER_NOT_STOPPABLE`,capability:i.capability,providerRef:i.providerRef,message:`${a} Its "${i.capability}" component is not offered.`});continue}n.set(e,i.load),i.scripts!==void 0&&i.scripts.length>0&&r.set(e,i.scripts),o.set(e,i.descriptor),s.set(e,i.consent);let l=c.get(i.capability)??[];l.push(i.providerRef),c.set(i.capability,l)}return{listProviders(e){return c.get(e)??[]},has(e,t){return n.has(u(e,t))},providersWithComponents(){return new Set([...c.values()].flat())},describe(e,t){return o.get(u(e,t))},consentRequirement(e,t,n){let r=s.get(u(e,t));if(r===void 0)return;let i=Rb(r,n);return{permitted:i,missingPurposes:i?[]:zb(r,n)}},resolve(e,o,c=[]){let d=u(e,o),f=n.get(d);if(f===void 0)return Promise.resolve(null);if(!a())return t({kind:`NOT_IN_A_BROWSER`,capability:e,providerRef:o,message:`Provider "${o}"'s "${e}" component was requested where there is no browser document (a server render or a build-time prerender). Nothing was loaded; resolve it from an effect.`}),Promise.resolve(null);let p=s.get(d)??{};if(!Rb(p,c))return t({kind:`WITHHELD_PENDING_CONSENT`,capability:e,providerRef:o,message:`${Bb(o,p,c)} Its "${e}" component and scripts were not loaded.`}),Promise.resolve(null);let m=l.get(d);if(m!==void 0)return m;let h=r.get(d)??[],g=(async()=>{let n=h.map(e=>({providerRef:o,declaration:e})),[r,a]=await Promise.all([Promise.resolve().then(f).then(e=>({ok:!0,value:e}),e=>({ok:!1,cause:e})),n.length===0?Promise.resolve(void 0):Promise.resolve().then(()=>i(n)).catch(e=>({loaded:[],failed:n.map(({declaration:t})=>({providerRef:o,src:t.src,message:`The script loader failed before reporting an outcome: ${Wa(e)}`}))}))]);for(let n of a?.failed??[])t({kind:`SCRIPT_LOAD_FAILED`,capability:e,providerRef:o,message:`Provider "${o}" cannot offer its "${e}" component: a script it declares did not load. `+n.message});if(r.ok===!1)return t({kind:`LOAD_FAILED`,capability:e,providerRef:o,message:`Provider "${o}" failed to load its "${e}" component.`,cause:r.cause}),null;if((a?.failed.length??0)>0)return null;let s=r.value;return Mce(s)?(t({kind:`LOADED_VALUE_IS_NOT_A_COMPONENT`,capability:e,providerRef:o,message:`Provider "${o}" returned a MODULE for its "${e}" component instead of the component itself. Return the named export from the loader — \`async () => (await import(…)).Picker\` — rather than the module namespace \`() => import(…)\`.`}),null):Nce(s)?s:(t({kind:`LOADED_VALUE_IS_NOT_A_COMPONENT`,capability:e,providerRef:o,message:`Provider "${o}" returned a ${typeof s} for its "${e}" component. A React component is a function, or an object for memo / forwardRef / lazy.`}),null)})();return l.set(d,g),g}}}function Zb(e,t){return`${e}:${t}`}function Fce(e){let t=new Map;for(let n of e??[])t.set(Zb(n.capability,n.providerRef),n);return t}function Ice(e,t){let n=[],r=t?.contributedLoaders??new Map;for(let i of e)for(let[e,a]of Object.entries(i.components??{})){let o=i.metadata.ref,s=r.get(Zb(e,o));a.load!==void 0&&s!==void 0&&t?.onDiagnostic?.({kind:`LOADER_SUPPLIED_TWICE`,capability:e,providerRef:o,message:`Provider "${o}" carries its own loader for "${e}" AND the facet library contributed one. The module's is used; remove one of the two.`});let c=a.load??s?.load;c===void 0?t?.onDiagnostic?.({kind:`DECLARED_WITHOUT_LOADER`,capability:e,providerRef:o,message:`Provider "${o}" declares a "${e}" component and nothing supplies its loader — neither the module nor the facet library. It is not offered. An engine-shipped component is registered by the surface's facet library (presets-components for the application, the page bridge's \`providerComponentLoaders\` for the website, \`DocsFrontendProviders\`' \`providerComponentLoaders\` for the documentation site); a provider package supplies \`components[capability].load\`.`}):n.push({capability:e,providerRef:o,load:c,descriptor:Ab(a),consent:{providerCapabilities:[...i.providerCapabilities??[]],...i.consentPurposes===void 0?{}:{consentPurposes:[...i.consentPurposes]}},...i.scripts!==void 0&&i.scripts.length>0?{scripts:i.scripts}:{}})}return n}function Lce(e,t){let n=new Set;for(let e of t)n.add(e.providerRef);return Tce([...e].filter(e=>!n.has(e.metadata.ref)))}var Qb=function(e){return e.NONE=`NONE`,e.LOADING=`LOADING`,e.READY=`READY`,e.UNAVAILABLE=`UNAVAILABLE`,e.CONSENT_REQUIRED=`CONSENT_REQUIRED`,e}({}),$b=Object.freeze([]);function ex(){return{status:`NONE`,Component:null,missingConsentPurposes:$b}}function Rce(e){let{registry:t,capability:n,providerRef:r,grantedConsentPurposes:i,onState:a}=e;if(t===void 0||r===void 0||!t.has(n,r))return a(ex()),()=>void 0;let o=t.consentRequirement(n,r,i);if(o!==void 0&&!o.permitted&&o.missingPurposes.length>0)return a({status:`CONSENT_REQUIRED`,Component:null,missingConsentPurposes:o.missingPurposes}),()=>void 0;let s=!0;return a({status:`LOADING`,Component:null,missingConsentPurposes:$b}),t.resolve(n,r,i).then(e=>{s&&a(e===null?{status:`UNAVAILABLE`,Component:null,missingConsentPurposes:$b}:{status:`READY`,Component:e,missingConsentPurposes:$b})}),()=>{s=!1}}var tx=class{registry=Db({modules:new Map});initialize(e){this.registry=Sce({entries:e?.entries,modules:e?.modules,onDiagnostic:e?.onDiagnostic})}getProviderByRef(e){return this.registry.getProviderByRef(e)}listByProviderCapability(e){return this.registry.getProvidersByProviderCapability(e)}findByProviderCapability(e){return this.registry.findProviderByProviderCapability(e)}findByProviderCapabilityAndProtocol(e,t){return this.registry.getProvidersByProviderCapability(e).find(e=>e.protocols.some(e=>e===t))}listAll(){return[...this.registry.modules.values()]}activateOnDemand(e,t){return qb({surface:Jc.SAAS_APP,modules:this.registry.getProvidersByProviderCapability(e.capability),onDemand:e,onDiagnostic:t})}providersServingOnDemand(e){return this.registry.getProvidersByProviderCapability(e.capability).filter(t=>Gb(t,e).verdict===Wb.SERVES).map(e=>e.metadata.ref)}};function nx(e){let t=new tx;return t.initialize(e),t}var rx=Jo.getLogger(),ix;(function(e){e.SUCCEEDED=`succeeded`,e.FAILED=`failed`})(ix||={});function ax(e,t){let n=0;for(let[r,i]of e.activations)if(!_se(i.handle))rx.warn(`A chat sign-in completion provider returned a handle that is not a FrontendChatSignInCompletionSink`,{providerRef:r});else try{t===ix.SUCCEEDED?i.handle.signInSucceeded():i.handle.signInFailed(),n+=1}catch(e){rx.warn(`A chat sign-in completion provider failed to tell its host`,{providerRef:r,error:e})}return n}function ox(e){let t=(0,Q.useContext)(Mi)?.frontendProviderRegistry,n=(0,Q.useMemo)(()=>e===void 0?void 0:{capability:Id.FRONTEND_CHAT_SIGN_IN_COMPLETION,host:e},[e]),r=(0,Q.useMemo)(()=>n!==void 0&&t!==void 0&&t.providersServingOnDemand(n).length>0,[n,t]),i=(0,Q.useRef)(null),a=(0,Q.useRef)(null),o=(0,Q.useCallback)(async(e,o)=>{if(n===void 0||t===void 0||!r||i.current===ix.SUCCEEDED&&e===ix.FAILED||i.current===e&&o?.repeat!==!0)return 0;i.current=e,a.current??=t.activateOnDemand(n,e=>rx.warn(`Chat sign-in completion provider diagnostic`,{kind:e.kind,providerRef:e.providerRef,message:e.message}));try{let t=ax(await a.current,e);return t===0&&(a.current=null),t}catch(e){return rx.warn(`Chat sign-in completion could not be called`,{error:e}),a.current=null,0}},[n,t,r]);return(0,Q.useMemo)(()=>({hostServed:r,tell:o}),[r,o])}var sx=new Map;function cx(e){sx=Fce([...sx.values(),...e])}function lx(){return sx}function zce(){sx=new Map}var ux;(function(e){e.NOT_APPLICABLE=`notApplicable`,e.REQUIRED=`required`,e.PROMPT=`prompt`,e.SATISFIED=`satisfied`})(ux||={});function dx(e){let t=Hd(e.serviceConsentRequirement?.requiredPurposes),n=Hd(e.privacy?.consentedPurposes),r=Pd(n,t),i=dae({requiredPurposes:t,analyticsEnabled:e.analyticsEnabled,analyticsRequiresConsent:e.analyticsRequiresConsent,capabilityDeclaredPurposes:e.capabilityDeclaredConsentPurposes}).filter(e=>!t.includes(e)),a={requiredPurposes:t,missingRequiredPurposes:r,optionalPurposes:i,grantedPurposes:n,gatedProcessing:t.length>0?e.serviceConsentRequirement?.gatedProcessing:void 0};return r.length>0?{...a,status:ux.REQUIRED}:e.privacy===null||e.privacy===void 0||t.length===0&&i.length===0?{...a,status:ux.NOT_APPLICABLE}:i.length>0&&e.privacy?.consentDecidedAt===void 0?{...a,status:ux.PROMPT}:{...a,status:ux.SATISFIED}}function fx(e,t,n){let r=e.filter(e=>!t.includes(e)),i=t.filter(e=>n.includes(e));return Hd([...r,...i])}function px(e,t,n){let r=fx(e.grantedPurposes,t,n);return Pd(r,e.requiredPurposes)}function mx(){let e=(0,Q.useContext)(_h),t=e?.privacy?.consentedPurposes,n=(0,Q.useMemo)(()=>Hd(t),[t]),r=e?.recordConsentDecision,i=e?.user!==null&&e?.user!==void 0&&r!==void 0,a=(0,Q.useCallback)(async e=>{r!==void 0&&await r(fx(n,e,e))},[n,r]);return{granted:n,grant:i?a:void 0}}function hx(e){let{frontendProviderRegistry:t,providerComponentRegistry:n}=_u();return n===void 0?[]:n.listProviders(e).map(e=>{let n=t?.getProviderByRef(e);return{providerRef:e,displayNameLabelKey:n?.metadata.displayNameLabelKey??Dd(e),displayName:n?.metadata.displayName,fileStorage:n?.fileStorage}})}function gx(e,t){let{providerComponentRegistry:n}=_u(),{granted:r}=mx(),i=r.join(`,`),[a,o]=(0,Q.useState)(()=>ex());return(0,Q.useEffect)(()=>Rce({registry:n,capability:e,providerRef:t,grantedConsentPurposes:r,onState:o}),[e,t,n,i]),a}var _x;(function(e){e.PROVIDER_DECLARED_NO_DELIVERY=`PROVIDER_DECLARED_NO_DELIVERY`,e.DELIVERY_CONTRADICTS_DECLARATION=`DELIVERY_CONTRADICTS_DECLARATION`})(_x||={});function vx(e){let t=e.descriptor?.selectionDelivery;if(t===void 0)return{accepted:[],rejections:[{kind:_x.PROVIDER_DECLARED_NO_DELIVERY,providerRef:e.providerRef,message:`Provider "${e.providerRef}" contributes a file picker but declares no \`selectionDelivery\`, so the framework cannot tell whether a selection is a backend reference or bytes the browser already holds — and therefore cannot route it. Declare one on the component: \`components: { FRONTEND_FILE_PICKER: { load, selectionDelivery } }\`.`}]};let n=[];for(let r of e.selections)r.kind!==t&&n.push({kind:_x.DELIVERY_CONTRADICTS_DECLARATION,providerRef:e.providerRef,declared:t,received:r.kind,message:`Provider "${e.providerRef}" declared its file picker delivers "${t}" and returned a "${r.kind}" selection. Which one a provider emits is a declaration, not a runtime choice (issue #383): a surface routes a selection before it mounts the picker, so a picker that contradicts its own declaration is refused rather than guessed at.`});return n.length>0?{accepted:[],rejections:n}:{accepted:e.selections,rejections:[]}}var yx;(function(e){e.PLACE_ID_CONTRADICTS_DECLARATION=`PLACE_ID_CONTRADICTS_DECLARATION`,e.ADDRESS_REFUSED_BY_FIELD=`ADDRESS_REFUSED_BY_FIELD`})(yx||={});function bx(e){let t=e.descriptor?.placeIdRetention??Od.NONE,{address:n,placeId:r}=e.selection;return r!==void 0&&t===Od.NONE?{rejection:{kind:yx.PLACE_ID_CONTRADICTS_DECLARATION,providerRef:e.providerRef,message:`Provider "${e.providerRef}" declared its address lookup returns no place id and returned one. Whether a vendor place id is returned is a declaration (\`placeIdRetention\`), not a runtime choice, so the selection is refused rather than guessed at.`}}:e.addressSchema!==void 0&&!e.addressSchema.safeParse(n).success?{rejection:{kind:yx.ADDRESS_REFUSED_BY_FIELD,providerRef:e.providerRef,message:`Provider "${e.providerRef}" returned an address the field's own schema refuses (a country outside the ones it accepts, or a missing required part). The lookup is a suggestion; the field decides.`}}:{accepted:{address:n,...r===void 0?{}:{placeId:r}}}}var xx=Id.FRONTEND_FILE_PICKER;function Sx(e){let{providerComponentRegistry:t,frontendProviderRegistry:n}=_u(),r=hx(xx),i=e.acceptedStorages,a=(0,Q.useMemo)(()=>r.filter(e=>e.fileStorage===void 0||(i?.includes(e.fileStorage)??!1)),[r,i]),[o,s]=(0,Q.useState)(()=>a.length===1?a[0]?.providerRef:void 0),c=a.length===1?a[0]?.providerRef:void 0;(0,Q.useEffect)(()=>{c!==void 0&&o===void 0&&s(c)},[c,o]);let{status:l,Component:u,missingConsentPurposes:d}=gx(xx,o),{grant:f}=mx(),p=(0,Q.useMemo)(()=>o===void 0?{}:n?.getProviderByRef(o)?.publicConfig??{},[o,n]),m=e.constraints,h=e.multiple,g=(0,Q.useMemo)(()=>oae({base:m,multiple:h,publicConfig:p}),[m,h,p]),{onSelect:_,onCancel:v,onProviderFailure:y}=e,b=(0,Q.useCallback)(e=>{if(o===void 0)return;let n=vx({providerRef:o,descriptor:t?.describe(xx,o),selections:e});n.rejections.length>0?y?.({providerRef:o,rejections:n.rejections}):_(o,n.accepted)},[o,t,_,y]),x=(0,Q.useCallback)(e=>{o!==void 0&&y?.({providerRef:o,error:e})},[o,y]),S=(0,Q.useCallback)(()=>v?.(),[v]),C=(0,Q.useRef)(void 0);(0,Q.useEffect)(()=>{l!==Qb.UNAVAILABLE||o===void 0?C.current=void 0:C.current!==o&&(C.current=o,y?.({providerRef:o,error:Error(`Provider "${o}" cannot open its file picker: its component or a script it declares did not load. The provider component registry logged the cause.`)}))},[l,o,y]);let w=(0,Q.useCallback)(async()=>{if(o!==void 0)return(await lc().getProviderConnectionAccessToken(o))?.accessToken},[o]);if(a.length===0)return null;let T=e.renderChooser?.({choices:a,chosen:o,choose:s})??Bce({choices:a,chosen:o,choose:s}),E=a.find(e=>e.providerRef===o),D=l===Qb.CONSENT_REQUIRED&&E!==void 0?(e.renderConsentRequired??Vce)({choice:E,missingPurposes:d,grant:f===void 0?void 0:()=>f(d)}):null,O=u;return(0,$.jsxs)($.Fragment,{children:[a.length>1?T:null,D,l===Qb.READY&&O!==null&&o!==void 0?(0,$.jsx)(O,{providerRef:o,publicConfig:p,constraints:g,getAccessToken:w,onSelect:b,onCancel:S,onError:x}):null]})}function Bce(e){return(0,$.jsx)(`div`,{role:`group`,children:e.choices.map(t=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":t.providerRef===e.chosen,onClick:()=>e.choose(t.providerRef),children:t.displayName??t.providerRef},t.providerRef))})}function Vce(e){let t=e.missingPurposes.join(`, `);return(0,$.jsxs)(`div`,{role:`status`,"data-provider-consent-required":e.choice.providerRef,children:[(0,$.jsx)(`span`,{children:t}),e.grant===void 0?null:(0,$.jsx)(`button`,{type:`button`,onClick:()=>void e.grant?.(),children:t})]})}var Cx;(function(e){e.VERTICAL=`vertical`,e.HORIZONTAL=`horizontal`,e.RESPONSIVE=`responsive`})(Cx||={});function wx({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_FIELD,`Field`)(e);return(0,$.jsx)(n,{...t})}function Tx({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_FIELD_LABEL,`FieldLabel`)(e);return(0,$.jsx)(n,{...t})}function Ex({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_FIELD_TITLE,`FieldTitle`)(e);return(0,$.jsx)(n,{...t})}function Dx({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_FIELD_CONTENT,`FieldContent`)(e);return(0,$.jsx)(n,{...t})}function Ox({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_FIELD_DESCRIPTION,`FieldDescription`)(e);return(0,$.jsx)(n,{...t})}function kx({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_FIELD_ERROR,`FieldError`)(e);return(0,$.jsx)(n,{...t})}function Hce({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_FIELD_SEPARATOR,`FieldSeparator`)(e);return(0,$.jsx)(n,{...t})}var Ax=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=G(J.LOW_LEVEL_COMBOBOX,`Combobox`)(e);return(0,$.jsx)(r,{...t,ref:n})});Ax.displayName=`Combobox`;var jx=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=G(J.LOW_LEVEL_COMBOBOX_MULTIPLE,`ComboboxMultiple`)(e);return(0,$.jsx)(r,{...t,ref:n})});jx.displayName=`ComboboxMultiple`;var Uce=kd(),Mx=class extends Error{constructor(){super(`The chosen place has no postal address the field can hold.`),this.name=`ProviderAddressLookupPlaceWithoutAddressError`}};function Nx({attribution:e}){return(0,$.jsxs)(`span`,{"data-address-lookup-attribution":``,className:`inline-flex`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:e.accessibleLabel}),(0,$.jsx)(`span`,{"aria-hidden":`true`,translate:`no`,className:`whitespace-nowrap rounded-sm px-1 text-xs font-normal tracking-normal`,style:{color:`#1F1F1F`,backgroundColor:`#FFFFFF`},children:e.mark})]})}function Px(e){return e instanceof Error?e:Error(String(e))}function Fx(e){let{adapter:t,suggest:n,retrieve:r,onSelect:i,onCancel:a,onError:o,countriesAllowed:s,defaultCountry:c,languageCode:l,disabled:u,name:d,attribution:f}=e,{tComponent:p}=K({component:[J.LOW_LEVEL_FORM_FIELD_ADDRESS]}),m=(e,t)=>p(J.LOW_LEVEL_FORM_FIELD_ADDRESS,e,t),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)([]),[y,b]=(0,Q.useState)(!1),x=(0,Q.useRef)(0),S=(0,Q.useRef)(!1),C=h.trim(),w=C.length>=3;(0,Q.useEffect)(()=>{let e=++x.current;if(!w||u){v([]),b(!1);return}b(!0);let r=setTimeout(()=>{let r;try{r=t.buildSuggestInput({query:C,countriesAllowed:s,defaultCountry:c,languageCode:l})}catch(e){b(!1),o(Px(e));return}n(r).then(n=>{e===x.current&&v(t.readSuggestions(n))}).catch(t=>{e===x.current&&(v([]),o(Px(t)))}).finally(()=>{e===x.current&&b(!1)})},300);return()=>clearTimeout(r)},[C,w,u,t,n,o,l,c,(s??[]).join(`,`)]);let T=(0,Q.useMemo)(()=>_.map((e,t)=>({value:`suggestion-${t}`,label:e.primaryText,data:e})),[_]),E=(0,Q.useCallback)(()=>{x.current+=1,g(``),v([]),b(!1)},[]),D=(0,Q.useCallback)(e=>{let n=T.find(t=>t.value===e)?.data;if(n===void 0)return;S.current=!0;let a;try{a=t.buildRetrieveInput({suggestion:n,languageCode:l})}catch(e){S.current=!1,o(Px(e));return}r(a).then(e=>{let n=t.readAddress(e);n===void 0?o(new Mx):i({address:n})}).catch(e=>o(Px(e))).finally(()=>{S.current=!1,E()})},[t,l,o,i,T,E,r]),O=(0,Q.useCallback)(e=>{e||S.current||(E(),a())},[a,E]),k=w?m(Ut.LOOKUP_NO_RESULTS):m(Ut.LOOKUP_TYPE_MORE,{minimum:3});return(0,$.jsx)(Ax,{schema:Uce,name:d,value:``,options:T,onChange:D,onSearchChange:g,onOpenChange:O,shouldFilter:!1,isLoading:y,disabled:u,placeholder:m(Ut.LOOKUP_PLACEHOLDER),searchPlaceholder:m(Ut.LOOKUP_SEARCH_PLACEHOLDER),emptyMessage:k,listFooter:f===void 0?void 0:(0,$.jsx)(Nx,{attribution:f}),renderOption:e=>{let t=e.data;return(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{className:`truncate`,children:t?.primaryText??e.label}),t?.secondaryText?(0,$.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:t.secondaryText}):null]})}})}var Ix=Id.FRONTEND_ADDRESS_LOOKUP,Wce=sa(ec).consentedPurposes,Lx;(function(e){e.UNAVAILABLE=`UNAVAILABLE`,e.ADDRESS_REFUSED=`ADDRESS_REFUSED`})(Lx||={});function Gce(){return globalThis.crypto.randomUUID()}function Rx({host:e,addressSchema:t,fieldName:n}){let{providerComponentRegistry:r,frontendProviderRegistry:i}=_u(),{t:a,tComponent:o,tResourceFieldEnumValue:s,currentLanguage:c}=K({component:[J.LOW_LEVEL_FORM_FIELD_ADDRESS]}),l=(e,t)=>o(J.LOW_LEVEL_FORM_FIELD_ADDRESS,e,t),u=hx(Ix),d=(0,Q.useMemo)(()=>u.filter(e=>r?.describe(Ix,e.providerRef)?.addressLookup!==void 0),[u,r]),[f,p]=(0,Q.useState)(void 0),m=f??(d.length===1?d[0]?.providerRef:void 0),{status:h,Component:g,missingConsentPurposes:_}=gx(Ix,m),{grant:v}=mx(),[y,b]=(0,Q.useState)(void 0),x=m===void 0?void 0:r?.describe(Ix,m),S=x?.addressLookup,C=(0,Q.useRef)(void 0),w=(0,Q.useCallback)(()=>{C.current=void 0},[]),T=(0,Q.useCallback)(async(e,t)=>{if(m===void 0)throw Error(`No address lookup provider is chosen.`);let n=S?.sessionTokenInput,r={...t};return n!==void 0&&(C.current??=Gce(),r={...r,[n]:C.current}),(await lc().executeProviderOperation(m,e,{input:r})).output},[m,S?.sessionTokenInput]),E=(0,Q.useCallback)(e=>S===void 0?Promise.reject(Error(`The address lookup declares no operations.`)):T(S.suggestOperationId,e),[S,T]),D=(0,Q.useCallback)(e=>S===void 0?Promise.reject(Error(`The address lookup declares no operations.`)):T(S.retrieveOperationId,e).finally(w),[S,w,T]),O=(0,Q.useCallback)(n=>{if(m===void 0)return;w();let r=bx({providerRef:m,descriptor:x,selection:n,addressSchema:t});r.accepted===void 0?b(Lx.ADDRESS_REFUSED):(b(void 0),e.applyAddress(r.accepted.address))},[t,m,x,w,e]),k=(0,Q.useCallback)(()=>w(),[w]),A=(0,Q.useCallback)(e=>{w(),b(e instanceof Mx?Lx.ADDRESS_REFUSED:Lx.UNAVAILABLE)},[w]);if(d.length===0)return null;let j=d.find(e=>e.providerRef===m),M=e=>a(e.displayNameLabelKey)??e.displayName??e.providerRef,N=`${n}.lookup`,P=g,F=h===Qb.UNAVAILABLE?Lx.UNAVAILABLE:y;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,"data-address-lookup":m??``,children:[(0,$.jsx)(Tx,{htmlFor:`field-${N}`,className:`text-sm text-muted-foreground`,children:l(Ut.LOOKUP_LABEL)}),d.length>1?(0,$.jsx)(`div`,{role:`group`,className:`flex flex-wrap gap-item-xs`,children:d.map(e=>(0,$.jsx)(X,{type:`button`,size:Xd.SM,variant:e.providerRef===m?Y.DEFAULT:Y.OUTLINE,"aria-pressed":e.providerRef===m,onClick:()=>{b(void 0),w(),p(e.providerRef)},children:M(e)},e.providerRef))}):null,h===Qb.CONSENT_REQUIRED&&j!==void 0?(0,$.jsx)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-item-xs text-sm text-muted-foreground`,children:(()=>{let e=_.map(e=>s(Na.USER_SELF_PREFERENCES,`privacy.consentedPurposes`,e,Wce)).join(`, `);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:l(Ut.LOOKUP_CONSENT_REQUIRED,{provider:M(j),purposes:e})}),v===void 0?null:(0,$.jsx)(X,{type:`button`,size:Xd.SM,variant:Y.OUTLINE,onClick:()=>void v(_),children:l(Ut.LOOKUP_CONSENT_GRANT,{purposes:e})})]})})()}):null,h===Qb.READY&&P!==null&&m!==void 0&&S!==void 0?(0,$.jsx)($.Fragment,{children:(0,$.jsx)(P,{providerRef:m,publicConfig:i?.getProviderByRef(m)?.publicConfig??{},...e.countriesAllowed===void 0?{}:{countriesAllowed:e.countriesAllowed},...e.defaultCountry===void 0?{}:{defaultCountry:e.defaultCountry},languageCode:c,disabled:e.disabled,name:N,...S.attributionMark===void 0?{}:{attribution:{mark:S.attributionMark,accessibleLabel:l(Ut.LOOKUP_ATTRIBUTION,{mark:S.attributionMark})}},suggest:E,retrieve:D,onSelect:O,onCancel:k,onError:A})}):null,F===void 0?null:(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:l(F===Lx.UNAVAILABLE?Ut.LOOKUP_UNAVAILABLE:Ut.LOOKUP_ADDRESS_REFUSED)})]})}function zx(){return(0,Q.useContext)(Bx)}var Bx=(0,Q.createContext)([]),Kce=Jo.getLogger();function qce(e){return[...e].sort().join(`,`)}var Vx=({children:e})=>{let t=(0,Q.useContext)(Mi),n=t?.frontendProviderRegistry,{on:r}=vo(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)([]),c=(0,Q.useRef)(wce());(0,Q.useEffect)(()=>r(hc.USER_PREFERENCES_CHANGED,e=>{if(e.privacy===null){a([]);return}let t=e.privacy?.consentedPurposes;t!==void 0&&a(Hd(t))}),[r]);let l=t?.appConfig?.analytics?.enabled===!0,u=(0,Q.useMemo)(()=>(n?.listAll()??[]).filter(e=>Lb(e).length>0&&(l||!e.providerCapabilities.includes(Id.FRONTEND_PRODUCT_ANALYTICS))),[n,l]),d=(0,Q.useMemo)(()=>{let e=i??[],t=new Set(u.flatMap(e=>Lb(e)));return e.filter(e=>t.has(e))},[u,i]),f=qce(d);return(0,Q.useEffect)(()=>{if(u.length===0||d.length===0){s([]);return}let e=c.current.start(()=>qb({surface:Jc.SAAS_APP,modules:u,grantedConsentPurposes:d,onDiagnostic:e=>{Kce.warn(`Consent-based frontend provider activation diagnostic`,{kind:e.kind,providerRef:e.providerRef,message:e.message})}}),e=>{s(u.flatMap(t=>{let n=e.activations.get(t.metadata.ref);return n===void 0?[]:[{providerRef:t.metadata.ref,providerCapabilities:[...t.providerCapabilities],activation:n}]}))});return()=>{s([]),e()}},[u,f]),(0,$.jsx)(Bx.Provider,{value:o,children:e})},Hx=Jo.getLogger(),Ux=Hx.debugByType(`ResourceReadCache`);Hx.setDebugTypeLogging(`ResourceReadCache`,!1);var Jce=200,Yce=class{applicationId=null;organizationId=null;entries=new Map;authority=null;enabled=!0;setApplicationId(e){this.applicationId=e}getApplicationId(){return this.applicationId}setOrganizationId(e){this.organizationId=e}getOrganizationId(){return this.organizationId}setCoverageAuthority(e){this.authority=e,this.entries.clear(),Ux(`coverage authority changed`,{hasAuthority:e!==null})}setEnabled(e){this.enabled=e,e||this.entries.clear()}get size(){return this.entries.size}read(e){if(!this.enabled)return;let t=this.entries.get(e);if(t){if(!this.authority?.covers(t.resourceType,t.scopes))this.entries.delete(e),Ux(`entry dropped: no live coverage`,{resourceType:t.resourceType});else return t.lastReadAt=Date.now(),t.value}}store(e,t,n,r){if(!this.enabled||!this.authority||r.length===0)return;this.authority.requestCoverage(n,r);let i=Date.now();this.entries.set(e,{value:t,resourceType:n,scopes:r,storedAt:i,lastReadAt:i}),this.evictIfOverCapacity()}invalidateResourceType(e){let t=0;for(let[n,r]of this.entries)r.resourceType===e&&(this.entries.delete(n),t+=1);t>0&&Ux(`invalidated by resource type`,{resourceType:e,dropped:t})}clear(){let e=this.entries.size;this.entries.clear(),e>0&&Ux(`cleared`,{dropped:e})}evictIfOverCapacity(){if(this.entries.size<=Jce)return;let e,t=1/0;for(let[n,r]of this.entries)r.lastReadAt<t&&(t=r.lastReadAt,e=n);e!==void 0&&this.entries.delete(e)}};function Xce(e,t){let n=new WeakSet,r=e=>{if(e===void 0)return`u`;if(e===null)return`n`;if(typeof e==`function`||typeof e==`bigint`)throw Error(`not renderable`);if(typeof e!=`object`)return JSON.stringify(e)??`u`;if(n.has(e))throw Error(`not renderable`);return n.add(e),Array.isArray(e)?`[${e.map(r).join(`,`)}]`:`{${Object.entries(e).filter(([,e])=>e!==void 0).sort(([e],[t])=>e<t?-1:+(e>t)).map(([e,t])=>`${JSON.stringify(e)}:${r(t)}`).join(`,`)}}`};try{return`${e}${r(t)}`}catch{return null}}function Wx(e,t){let n=t?.[Na.USERS];return e?.primaryKeyIdentifiesInitiator===!0&&n!==void 0&&e.resourceFieldIdentifier===n}function Gx(e,t){return e?.timeout===void 0?t.clientRequestTimeoutMs===void 0?{}:{timeout:t.clientRequestTimeoutMs}:{}}function Zce(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`ik-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,12)}-${Math.random().toString(36).slice(2,12)}`}function Kx(e,t){return t.idempotencyKey===void 0||Object.keys(e?.headers??{}).some(e=>e.toLowerCase()===ks.IDEMPOTENCY_KEY)?{}:{headers:{...e?.headers,[ks.IDEMPOTENCY_KEY]:qr(Zce())}}}function Qce(e){return typeof e==`string`||typeof e==`number`}function qx(e){let t=ul(e);return t===W.READ||t===W.LIST||t===W.SEARCH}function $ce(e){return!qx(e)&&ul(e)!==W.COUNT&&e.httpVerb!==Ui.GET}function Jx(e){return qx(e)&&e.hasCustomResponseDto!==!0}var Yx=class e extends ca{resourcesRegistry;errorBuilder;constructor(e,t={}){super(t),this.resourcesRegistry=e,this.errorBuilder=new Ce}buildError(e,t,n){let r=this.errorBuilder.buildWildoError_Frontend(ue.INTERNAL,{customMessageReference:e,operationPathKey:t,context:n}),i=Error(e);return i.wildoError=r,i}readCache=new Yce;getReadCache(){return this.readCache}resolveCacheableRead(e,t,n){let r=t.resourceIdentifier,i=Xce(e,n);if(i===null)return null;let a=t.resourcePrimaryScope;if(!a)return null;let o={};for(let[e,t]of Object.entries(n.contextualParameters??{}))typeof t==`string`?o[e]=t:typeof t==`number`&&(o[e]=String(t));if(a===td.APPLICATION){let e=this.readCache.getApplicationId();e&&(o.applicationId=e)}if(a===td.ORGANIZATIONS&&!o.organizationId){let e=this.readCache.getOrganizationId();e&&(o.organizationId=e)}return{key:i,resourceType:r,scopes:Pte(o,a)}}async doOperation(e,t,n){let r=gl.parseOperationPathKey(e),i=this.findOperation(r);if(!i)throw this.buildError(ii.FRONTEND_RESOURCE_OPERATION_NOT_FOUND,e,{operationPathKey:e});qx(i)||this.readCache.invalidateResourceType(i.resourceIdentifier);let a=Jx(i)?this.resolveCacheableRead(e,i,t):null;if(a){let e=this.readCache.read(a.key);if(e!==void 0)return structuredClone(e)}switch(i.variantType){case Ya.API_CALL:return this.executeApiCallOperation(i,t,n).then(e=>(a&&this.readCache.store(a.key,e,a.resourceType,a.scopes),$ce(i)&&Wx(this.resourcesRegistry.resourceConfigurations[i.resourceIdentifier],this.resourcesRegistry.allResourceFieldIdentifiers)&&this.revalidateSession(),e));default:throw i.variantType,this.buildError(ii.FRONTEND_RESOURCE_UNSUPPORTED_OPERATION_TYPE,e,{operationPathKey:e})}}async executeSearchOperation(e,t,n){let r=gl.parseOperationPathKey(e),i=this.findOperation(r);if(!i)throw this.buildError(ii.FRONTEND_RESOURCE_OPERATION_NOT_FOUND,e,{operationPathKey:e,operationType:`search`});if(ul(i)!==W.SEARCH)throw this.buildError(ii.FRONTEND_RESOURCE_SEARCH_OPERATION_INVALID,e,{operationPathKey:e,actualOperationIdentifier:i.operationIdentifier});let a=Jx(i)?this.resolveCacheableRead(e,i,t):null;if(a){let e=this.readCache.read(a.key);if(e!==void 0)return structuredClone(e)}let o=await this.executeSearchOperationInternal(i,t,n);return a&&this.readCache.store(a.key,o,a.resourceType,a.scopes),o}validateOperationAnswer(e,t,n){if(tne(e,n))return this.validateResponseData(n,Bi,void 0,!1);if(Ve(e,n))return this.validateResponseData(n,ot,void 0,!1);let r=this.selectResponseDto(e,t);return this.validateResponseData(n,r,void 0,lre(e))}selectResponseDto(e,t){let n=Gs.selectResponseDto(e,t);return!n||typeof n!=`object`||typeof n.parse!=`function`?null:n}validateResponseData(t,n,r,i=!1){if(!n)return t;try{let r=i&&Array.isArray(t)?t.map(e=>n.parse(e)):n.parse(t);return e.reattachEngineMetadata(t,r),r}catch(e){throw e instanceof Gd?this.buildError(ii.FRONTEND_RESOURCE_RESPONSE_VALIDATION_FAILED,r,{validationErrors:e.issues,responseData:t}):e}}static reattachEngineMetadata(t,n){if(!t||typeof t!=`object`||!n||typeof n!=`object`)return;if(Array.isArray(t)&&Array.isArray(n)){for(let r=0;r<n.length;r++)e.reattachEngineMetadata(t[r],n[r]);return}let r=t,i=n;if(Array.isArray(r.data)&&Array.isArray(i.data)){let t=r.data,n=i.data;for(let r=0;r<n.length;r++)e.reattachEngineMetadata(t[r],n[r])}for(let e of[`_field_meta`,`_version`])r[e]!==void 0&&i[e]===void 0&&(i[e]=r[e])}findOperation(e){let t=this.resourcesRegistry.resourceConfigurations[e.resourceIdentifier];return t&&t.operations.find(t=>{let n=gl.extractOperationPath(t);if(n.operationIdentifier!==e.operationIdentifier||n.variantType!==e.variantType)return!1;if(e.isOperationDefault){if(!n.isOperationDefault)return!1}else{let t=e.variantKey;if((n.variantKey??void 0)!==(t??void 0))return!1}return n.variantType!==Ya.API_CALL||n.isBulkOperation===!0==(e.isBulkOperation===!0)})||null}async executeApiCallOperation(e,t,n){let r=this.resourcesRegistry.resourceConfigurations[e.resourceIdentifier]?.resourceFieldIdentifier??``,{url:i,missingParameters:a}=this.buildUrlFromInitiatorInfos(e.initiatorInfos||[],t.contextualParameters,e.resourceIdentifier,r,t.parentResourcesRequirements,t.parentChainIsExact);if(a.length>0)throw this.buildError(ii.FRONTEND_RESOURCE_NO_ENDPOINT_AVAILABLE,void 0,{reason:`Missing required URL parameters`,missingParameters:a,availableParameters:Object.keys(t.contextualParameters),url:i});let o={...t.queryParameters};t.dataMode&&(o.dataMode=t.dataMode);let s={...n,...Gx(n,e),...Kx(n,e),params:o,riskLevel:e.riskLevel||ls.MEDIUM,resourceType:e.resourceIdentifier,operationIdentifier:String(e.operationIdentifier),variantKey:e.variantKey,isBulkOperation:e.isBulkOperation,isOperationDefault:e.isOperationDefault,loading:n?.loading??{tier:Hc.COMPONENT,phase:Jl.INITIAL}},c;switch(e.httpVerb){case Ui.GET:c=await this.get(i,s);break;case Ui.POST:c=await this.post(i,t.requestData,s);break;case Ui.PUT:c=await this.put(i,t.requestData,s);break;case Ui.DELETE:c=await this.delete(i,t.requestData===void 0?s:{...s,data:t.requestData});break;case Ui.PATCH:c=await this.patch(i,t.requestData,s);break;default:throw this.buildError(ii.FRONTEND_RESOURCE_UNSUPPORTED_HTTP_METHOD,void 0,{httpMethod:e.httpVerb,url:i})}return this.validateOperationAnswer(e,t.dataMode,c)}async executeSearchOperationInternal(e,t,n){let r=e,i=String(r.resourceIdentifier),a=this.resourcesRegistry.resourceConfigurations[i]?.resourceFieldIdentifier??``,{url:o,missingParameters:s}=this.buildUrlFromInitiatorInfos(r.initiatorInfos||[],t.contextualParameters,i,a,t.parentResourcesRequirements,t.parentChainIsExact);if(s.length>0)throw this.buildError(ii.FRONTEND_RESOURCE_NO_ENDPOINT_AVAILABLE,void 0,{reason:`Missing required URL parameters`,missingParameters:s,availableParameters:Object.keys(t.contextualParameters),url:o});let c={...t.queryParameters};if(t.dataMode&&t.dataMode!==wn.RAW&&(c.dataMode=t.dataMode),t.searchQuery&&(c.q=t.searchQuery),t.filters&&r.filterFields&&Object.entries(t.filters).forEach(([e,t])=>{r.filterFields[e]&&(c[e]=t)}),t.sort&&t.sort.length>0&&(c.sort=t.sort.map(e=>`${e.field}:${e.direction}`).join(`,`)),t.pagination){c.page=t.pagination.page;let e=r.maxPaginatedResultPerPageLimit??50;c.limit=Math.min(t.pagination.limit,e)}let l={...n,...Gx(n,r),params:c,riskLevel:r.riskLevel||ls.MEDIUM,resourceType:r.resourceIdentifier,operationIdentifier:String(r.operationIdentifier),variantKey:e.variantKey,isBulkOperation:e.isBulkOperation,isOperationDefault:e.isOperationDefault,loading:n?.loading??{tier:Hc.COMPONENT,phase:Jl.INITIAL}},u=await this.get(o,l);return this.validateOperationAnswer(e,t.dataMode,u)}selectInitiatorInfo(e,t,n,r,i,a){if(e.length===0)throw this.buildError(ii.FRONTEND_RESOURCE_NO_ENDPOINT_AVAILABLE,void 0,{reason:`No initiator infos available for this operation`});let o=V.selectOperationUrlInitiatorInfo({initiatorInfos:e,contextualParameters:t,targetResourceType:n,targetDefaultFieldIdentifier:r,parentResourcesRequirements:i,parentChainIsExact:a});if(!o){let n=Object.keys(t).join(`, `),r=e.map(e=>e.parameters.map(e=>e.fieldIdentifier).join(`, `)).join(` OR `);throw this.buildError(ii.FRONTEND_RESOURCE_NO_ENDPOINT_AVAILABLE,void 0,{availableParams:n,requiredParams:r})}return o}buildUrlFromInitiatorInfos(e,t,n,r,i,a){let o=this.selectInitiatorInfo(e,t,n,r,i,a);return this.buildUrlFromInitiatorInfo(o,t)}buildUrlFromInitiatorInfo(e,t){let n=e.url,r=[];for(let i of e.parameters){let e=t[i.fieldIdentifier];if(Qce(e)){let t=encodeURIComponent(String(e));n=n.replace(`{${i.fieldIdentifier}}`,t);let r=RegExp(`:${i.fieldIdentifier.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}(?=[/\\?]|$)`,`g`);n=n.replace(r,t)}else r.push(i.fieldIdentifier)}return{url:n,missingParameters:r}}getAvailableOperationPaths(){let e=[];for(let[t,n]of Object.entries(this.resourcesRegistry.resourceConfigurations)){let t=n;for(let n of t.operations){let t=gl.extractOperationPath(n),r=gl.createOperationPathKey(t);e.push(r)}}return e}getOperationDetails(e){let t=gl.parseOperationPathKey(e);return this.findOperation(t)}},Xx=Jo.getLogger();Xx.debugByType(`useNavigationState`),Xx.setDebugTypeLogging(`useNavigationState`,!1);function Zx(){let e=(0,Q.useContext)(Eh);if(!e)throw Error(`useNavigationState must be used within a NavigationProvider`);return e}var Qx;(function(e){e.ELEMENT=`element`,e.CREATE=`create`})(Qx||={});var $x=(0,Q.createContext)({isAvailable:!1,target:null,open:()=>void 0,close:()=>void 0,isElementActive:()=>!1,isCreateActive:!1});function eS({resourceType:e,children:t}){let[n,r]=(0,Q.useState)(null),i=(0,Q.useCallback)(t=>{t.resourceContext.resourceType===e&&r(t)},[e]),a=(0,Q.useCallback)(()=>r(null),[]),o=(0,Q.useCallback)(e=>e?n?.kind===Qx.ELEMENT&&n.elementId===e:!1,[n]),s=(0,Q.useMemo)(()=>({isAvailable:!0,target:n,open:i,close:a,isElementActive:o,isCreateActive:n?.kind===Qx.CREATE}),[n,i,a,o]);return(0,$.jsx)($x.Provider,{value:s,children:t})}function tS(){return(0,Q.useContext)($x)}var nS=Jo.getLogger(),rS=nS.debugByType(`useNavigationController`);nS.setDebugTypeLogging(`useNavigationController`,!1);function iS(e){let t=e?.operationFrontendConfig?.surface;return t!==Es.EMBEDDED&&t!==Es.API_ONLY}function aS(e,t,n=!1){Ch.isInTransaction()||Ch.beginTransaction(`controller_url_update`),e(t,{replace:n})}function oS(e){if(!Ch.isResourceOperationContent(e))return{operation:W.LIST,effectiveOperation:W.LIST,actionPresentationIsAuthored:!1};let t=e.resourceContext.operation;return{operation:t?.operationIdentifier??W.LIST,effectiveOperation:ul(t),resourceType:e.resourceContext.resourceType,operationSurface:t?.operationFrontendConfig?.surface,operationOverrides:t?.operationFrontendConfig?.navigationOverrides,actionPresentationTransition:One(Nc(t)),actionPresentationIsAuthored:t?.operationFrontendConfig?.actionPresentation!==void 0}}var ele={[li.SECONDARY]:li.PRIMARY,[li.COMPANION]:li.SECONDARY};function tle(e){let t=ele[e.paneZone];if(!e.layout||!t)return!1;let n=Ch.isResourceOperationContent(e.content)?nle(e.content.resourceContext,e.registry,e.viewport):void 0,r={[li.PRIMARY]:!0};t===li.SECONDARY&&(r[li.SECONDARY]=!0);let i=Gm.resolve({...oS(e.content),relationshipTransition:n,sourceZone:t,focusedZone:t,viewport:e.viewport,contentAreaWidth:e.contentAreaWidth,zoneOccupancy:r,zoneDepth:{}},e.layout);return i.persistent===!0&&i.targetZone===e.placedZone}function nle(e,t,n){let r=(e.parentResourcesRequirements??[]).filter(e=>!e.isPrimaryScope),i=r[r.length-1];if(!i)return;let a=Ch.findRelationshipBetween(i.resourceType,e.resourceType,t,i.foreignKeyField);return Fh(a?.display?.inParentNavigation?.transition,n??ci.DESKTOP)}function sS(e,t,n,r){let i=t.foreignKeyField,a=r.allResourceFieldIdentifiers?.[t.resourceType]??r.resourceConfigurations?.[t.resourceType]?.resourceFieldIdentifier;!i||i===a?e[t.resourceType]=n:gn.selfReferenceForeignKeysOf(t.resourceType,r).includes(i)?e[i]={fieldIdentifier:i,resourceId:n}:e[t.resourceType]={fieldIdentifier:i,resourceId:n}}function cS(e){let{resourceType:t,contextResourceIdentifiers:n,parentResourcesRequirements:r,registry:i,emit:a,getZoneState:o}=e;if(!e.replaceExisting&&o(li.PRIMARY).stack.length>0)return;let s=i.resourceConfigurations?.[t];if(!s)return;let c={...n};delete c[t];let l=Il(Aa(s.operations??[],W.LIST,{allowBulk:!0}).filter(e=>fn(e.operationFrontendConfig)),W.LIST,{allowBulk:!0});if(!l)return;let u=Ch.resolveResourceUrl(s,l,ju(c),i.allResourceFieldIdentifiers,r)?.resolvedUrl;a(hc.NAVIGATION_REPLACE,{zone:li.PRIMARY,content:{contentType:hd.RESOURCE_OPERATION,resourceContext:gn.createFrontendResourceOperationContextFromOperation({resourceType:t,operation:l,contextResourceIdentifiers:c,parentResourcesRequirements:r})},...u?{urlPath:u}:{},stackEntryId:Ch.generateStackEntryId(),initiator:{sourceZone:li.PRIMARY},navigationSource:e.navigationSource??Zi.URL_SYNC,transition:ln.REPLACE})}function lS(e,t,n){return e?.admitsCrossTenantPlatformAdministration!==!0||n?.({...e,resourceType:t})===!0}function uS(e,t,n,r,i,a,o,s){let c=e.resourceContext.parentResourcesRequirements;if(!c||c.length===0)return;let l=[];if(t===li.SECONDARY?l.push(li.PRIMARY):t===li.COMPANION&&l.push(li.SECONDARY,li.PRIMARY),l.length===0)return;let u=[...c].reverse(),d=e.resourceContext.resourceType;for(let e=0;e<l.length&&e<u.length;e++){let t=l[e],f=u[e];if(f.isPrimaryScope)continue;let p=o(t);if(!s?.overwriteExisting&&p.stack.length>0)continue;let m=f.resourceType,h=n.resourceConfigurations?.[m];if(!h)continue;let g=f.childResourceType??(e===0?d:u[e-1].resourceType),_=Ch.findRelationshipBetween(m,g,n,f.foreignKeyField),v=c.length-1-e,y=v>0?c.slice(0,v):[],b={};for(let e of y){let t=r[e.foreignKeyField??e.resourceType]??r[e.resourceType];t&&sS(b,e,t,n)}let x=(f.foreignKeyField?r[f.foreignKeyField]:void 0)??(m===d?void 0:r[m]),S=x?{...b,[m]:x}:b,C=Ch.resolveAncestorOperationConfig(_,h,{registry:n,contextResourceIdentifiers:S,contextualParameters:V.buildContextualParameters(S,n)}),w=lS(C,m,s?.viewerMayPerform)?C:null;if(t===li.PRIMARY&&(!w||Ch.isCollectionOperationContext({operation:w})&&m!==g)){let e=c.slice(0,v+1),t={};for(let i of e){let e=r[i.foreignKeyField??i.resourceType]??r[i.resourceType];e&&sS(t,i,e,n)}cS({resourceType:g,contextResourceIdentifiers:t,parentResourcesRequirements:e,registry:n,emit:i,getZoneState:o,navigationSource:Zi.CONTROLLER,replaceExisting:!!s?.overwriteExisting});continue}if(!w)continue;let T=ul(w);x&&T===W.READ&&(b[m]=x);let E=gn.createFrontendResourceOperationContextFromOperation({resourceType:m,operation:w,contextResourceIdentifiers:b,parentResourcesRequirements:y}),D={contentType:hd.RESOURCE_OPERATION,resourceContext:E},O;if(iS(w)){let e=Ch.resolveResourceUrl(h,w,ju(b),n.allResourceFieldIdentifiers,y);e?.resolvedUrl&&(O=e.resolvedUrl)}let k=Ch.generateStackEntryId();rS(`cascadeAncestorZones: populating ancestor zone`,{zone:t,ancestorResourceType:m,ancestorOp:T,ancestorUrl:O}),i(hc.NAVIGATION_REPLACE,{zone:t,content:D,urlPath:O,stackEntryId:k,initiator:{sourceZone:t},navigationSource:Zi.CONTROLLER,transition:ln.REPLACE}),t===li.PRIMARY&&O&&a&&aS(a,O,!0)}}function rle(e,t){if(!t)return null;let n=t[e];if(!n?.usersManagement)return null;let r=Object.entries(n.usersManagement),i=r.find(([,e])=>e.isDefault),a=r[0];return(i??a)?.[0]??null}function ile(e,t,n){if(!t?.length||!n)return null;let r=n[e]?.usersManagement;if(!r)return null;for(let e of t)if(r[e])return e;return null}var ale={minLength:15,maxLength:128,requireUppercase:!1,requireLowercase:!1,requireNumbers:!1,requireSpecialChars:!1,expiryDays:0};function dS(){let{auth:e,appConfig:t}=_u(),n=(0,Q.useContext)(_h),r=va.loadEnvironmentConfig().frontendServiceName;return(0,Q.useMemo)(()=>{let i=rle(r,t.frontendServices),a=ile(r,n?.user?.userTypes,t.frontendServices)??i,o=(a?t.userTypes?.[a]:null)?.auth??null,s=o?.passwordPolicy??ale,c=o?.registration,l=hne.safeParse(c),u=!!(a&&t.frontendServices?.[r]?.usersManagement?.[a]?.register===!0),d=l.success?{mode:l.data.mode,allowedMethods:l.data.allowedMethods,frontendServiceAllowsRegistration:u,publicRegistrationAvailable:u&&pi(l.data.mode,uie.PUBLIC_SELF_SERVICE),additionalProfileQuestions:l.data.additionalProfileQuestions??[],profileNamesCollectedAt:As(l.data)}:{mode:Sc.DISABLED,allowedMethods:[],frontendServiceAllowsRegistration:!1,publicRegistrationAvailable:!1,additionalProfileQuestions:[],profileNamesCollectedAt:$c.REGISTRATION};return{resolvedUserType:a,userTypeAuth:o,globalAuth:e,passwordPolicy:s,registrationConfig:d}},[r,t,e,n?.user?.userTypes])}var fS=(0,Q.createContext)(void 0),ole=`wildo:appMode:`;function sle(e,t){return`${ole}${e??`default`}:${t??`anon`}`}function cle(e){try{return localStorage.getItem(e)}catch{return null}}function lle(e,t){try{localStorage.setItem(e,t)}catch{}}function pS(e,t){if(e.length===0)return null;let n=new Set(e.map(e=>e.ref)),r=cle(t);if(r&&n.has(r))return r;let i=e.find(e=>e.isDefault);return i?i.ref:e[0].ref}var mS=({children:e})=>{let{frontendConfiguration:t,appConfig:n}=_u(),{resolvedUserType:r}=dS(),i=(0,Q.useMemo)(()=>t?.appModes??[],[t?.appModes]),a=(0,Q.useMemo)(()=>r?i.filter(e=>!e.visibleToUserTypes||e.visibleToUserTypes.length===0||e.visibleToUserTypes.includes(r)):i,[i,r]),o=(0,Q.useMemo)(()=>sle(n?.appIdentity?.appName,void 0),[n?.appIdentity?.appName]),[s,c]=(0,Q.useState)(()=>pS(a,o));(0,Q.useEffect)(()=>{if(a.length===0){c(null);return}let e=new Set(a.map(e=>e.ref));if(s&&e.has(s))return;let t=pS(a,o);c(t)},[a,o]);let l=(0,Q.useCallback)(e=>{a.some(t=>t.ref===e)&&(c(e),lle(o,e))},[a,o]),u=(0,Q.useMemo)(()=>({allModes:i,availableModes:a,activeMode:s,setActiveMode:l,hasModes:a.length>0}),[i,a,s,l]);return(0,$.jsx)(fS.Provider,{value:u,children:e})};function ule(){let e=(0,Q.useContext)(fS);if(!e)throw Error(`useAppMode must be used within an AppModeProvider`);return e}function hS(){return(0,Q.useContext)(fS)??null}var dle=Jo.getLogger(),fle=100,gS;(function(e){e.PENDING=`pending`,e.HELD=`held`,e.NONE=`none`,e.UNKNOWN=`unknown`,e.STALE=`stale`})(gS||={});function _S(e){return e?e.state===gS.HELD||(e.state===gS.PENDING||e.state===gS.STALE)&&e.previouslyHeld===!0:!1}var vS=new Map,yS=new Set;function ple(e){return yS.add(e),()=>{yS.delete(e)}}function bS(){for(let e of yS)e()}function xS(e){let t=vS.get(e);t&&t.state!==gS.STALE&&(vS.set(e,{state:gS.STALE,previouslyHeld:_S(t)}),bS())}function mle(e,t){return e?.find(e=>e.operationIdentifier===t&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===Ya.API_CALL)}function hle(e){if(Array.isArray(e))return{rows:e,totalPages:1};let t=e;return{rows:Array.isArray(t?.data)?t.data:[],totalPages:typeof t?.pagination?.totalPages==`number`?t.pagination.totalPages:1}}function gle(e){let t=e;return t?.wildoError?.type===ue.NOT_FOUND||t?.wildoError?.context?.httpStatus===404||t?.response?.status===404||t?.status===404}function _le(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e.data;return t&&typeof t==`object`&&!Array.isArray(t)?t:e}function SS(e,t,n){let r=(0,Q.useContext)(ym),i=lm(),a=(0,Q.useContext)(Gi),o=i?.currentUserId??null,s=i?.currentOrganizationId??null,c=r?.registry,l=(0,Q.useMemo)(()=>mle(c?.resourceConfigurations[e.resourceType]?.operations,e.operation),[c,e.resourceType,e.operation]),u=c?.resourceConfigurations[Na.ORGANIZATIONS]?.resourceFieldIdentifier,d=!!l&&th({...l,resourceType:e.resourceType},n),f=t&&d&&o&&s&&u?`${e.key}|${o}|${s}`:null,p=(0,Q.useRef)(r?.doOperation);p.current=r?.doOperation;let m=(0,Q.useRef)(e.matches);m.current=e.matches;let h=(0,Q.useSyncExternalStore)(ple,()=>f?vS.get(f):void 0,()=>void 0);(0,Q.useEffect)(()=>{let t=f?vS.get(f):void 0;if(!f||t&&t.state!==gS.STALE||!l||!u||!s)return;let n=p.current;if(!n)return;let r={state:gS.PENDING,previouslyHeld:_S(t)};vS.set(f,r),bS();let i=e=>{vS.get(f)===r&&(vS.set(f,{state:e}),bS())},a=gl.buildOperationPathKeyFromOperation(l),o={[u]:s};(async()=>{try{if(e.operation===W.READ){let e=_le(await n(a,{contextualParameters:o},{silent:!0}));i(e&&m.current(e)?gS.HELD:gS.NONE);return}for(let e=1;;e+=1){let{rows:t,totalPages:r}=hle(await n(a,{contextualParameters:o,queryParameters:{page:e,limit:fle}},{silent:!0}));if(t.some(e=>m.current(e))){i(gS.HELD);return}if(e>=r||t.length===0){i(gS.NONE);return}}}catch(t){if(e.operation===W.READ&&gle(t)){i(gS.NONE);return}dle.warn(`Could not read whether the organization holds this configuration`,{probe:e.key,organizationId:s,error:t}),i(gS.UNKNOWN)}})()},[f,h,l,u,s,e.key,e.operation]);let g=(0,Q.useRef)(f);return(0,Q.useEffect)(()=>{let e=g.current;g.current=f,e&&e!==f&&xS(e)},[f]),(0,Q.useEffect)(()=>{if(f)return a.on(hc.RESOURCE_OPERATION_EXECUTED,()=>xS(f),t=>t.resourceType===e.resourceType&&!ra(t.operation??{operationIdentifier:t.operationIdentifier}))},[a,f,e.resourceType]),_S(h)}var vle={key:`scim-unrevoked-token`,resourceType:Na.ORGANIZATION_SCIM_TOKENS,operation:W.LIST,matches:e=>e.isActive===!0};function yle(e,t){return SS(vle,e,t)}function CS(){return wS(void 0)}function wS(e){let t=(0,Q.useContext)(_h)?.permissions??null,n=lm()?.currentOrganizationId??null,r=Tg(),i=e??n;return(0,Q.useMemo)(()=>({applicationRoles:t?.appLevel??[],organizationRoles:i&&t?.organizations?.[i]||[],roleTables:r,organizationId:i,accessProfile:t?.accessProfile??null}),[t,i,r])}function TS(){let e=wS(void 0),t=(0,Q.useRef)(e);return t.current=e,(0,Q.useCallback)(e=>th(e,t.current),[])}function ES(){let e=(0,Q.useContext)(Mi)?.appConfig,t=e?.organizationRelationships,n=e?.organizationTypes,r=(0,Q.useContext)(_h)?.organizations,i=lm()?.currentOrganizationId??null;return(0,Q.useMemo)(()=>({organizationRelationships:t,organizationTypes:n,organizations:r,currentOrganizationId:i}),[t,n,r,i])}function DS(){let e=ES();return(0,Q.useMemo)(()=>Mv(e),[e])}function ble(){let e=ES();return(0,Q.useMemo)(()=>Pv(e),[e])}function OS(){let e=(0,Q.useContext)(_h)?.organizations,t=lm()?.currentOrganizationId??null;return(0,Q.useMemo)(()=>{if(!t)return;let n=e?.find(e=>e._id===t)?.type;return typeof n==`string`&&n.length>0?n:void 0},[e,t])}function xle(){let e=(0,Q.useContext)(Mi)?.appConfig?.organizationTypes,t=OS();return(0,Q.useMemo)(()=>Cre(e,t),[e,t])}var Sle={key:`sso-connection`,resourceType:Na.ORGANIZATION_SSO_CONNECTIONS,operation:W.LIST,matches:()=>!0},kS=e=>Array.isArray(e)&&e.length>0,AS=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},Cle={key:`sso-policy`,resourceType:Na.ORGANIZATION_SSO_CONFIG,operation:W.READ,matches:e=>{let t=AS(e.enforcement),n=AS(e.domains),r=AS(e.emergencyAccess),i=AS(e.oauth2ProviderRestrictions);return t.requireSSO===!0||kS(n.verifiedDomains)||kS(n.ssoEnabledDomains)||kS(r.breakGlassAccounts)||kS(i.allowedProviders)||kS(i.blockedProviders)||i.requireEnterpriseSSOOnly===!0||kS(e.socialCredentialOverrides)}},wle={key:`siem-export-enabled`,resourceType:Na.ORGANIZATION_SIEM_EXPORT_CONFIG,operation:W.READ,matches:e=>e.enabled===!0},Tle={key:`webhook-config-configured`,resourceType:Na.ORGANIZATION_WEBHOOK_CONFIG,operation:W.READ,matches:e=>e.enabled===!0||kS(e.endpoints)},Ele=e=>!1;function jS(){let e=hS(),t=lm(),n=CS(),r=(0,Q.useContext)(Oh),i=r?.resolvedFeatures,a=r?.isFeatureOffered??Ele,o=ag(),s=!!r&&r.isLoading!==!0&&(t?.currentOrganizationId??null)===r.resolvedForOrganizationId,c=a(ou.SINGLE_SIGN_ON),l=s&&!c,u=SS(Sle,l,n),d=SS(Cle,l,n),f=c||u||d,p=a(ou.DIRECTORY_PROVISIONING),m=OS(),h=xle(),g=yle(s&&Iv({featureOffered:p,organizationTypeKnown:m!==void 0,organizationTypeDirectoryProvisioned:h}),n),_=(0,Q.useMemo)(()=>Lv({featureOffered:p,organizationTypeDirectoryProvisioned:h,holdsUnrevokedToken:g}),[p,h,g]),v=a(ou.SECURITY_EVENT_EXPORT),y=SS(wle,s&&!v,n),b=v||y,x=a(ou.M2M_WEBHOOK_DELIVERY),S=SS(Tle,s&&!x,n),C=x||S,w=DS(),T=ble(),E=(0,Q.useContext)(Mi)?.appConfig?.decisionInbox,D=Object.keys((0,Q.useContext)(Mi)?.appConfig?.professionalQualificationKinds??{}).length>0,O=(0,Q.useMemo)(()=>ay({offer:E,effectiveRoles:n}),[E,n]);return(0,Q.useMemo)(()=>({activeMode:e?.activeMode??null,availableModes:e?.availableModes??[],allScopeValues:t?.allScopeValues??{},effectiveRoles:n,resolvedFeatures:i?.features??[],runtimeCapabilities:{billingEnabled:!!o?.isEnabled,ssoEnabled:f,..._,siemEnabled:b,webhooksEnabled:C,...w,...T,...O,[Vv]:D}}),[e?.activeMode,e?.availableModes,t?.allScopeValues,n,i?.features,o?.isEnabled,f,_,b,C,w,T,O,D])}function MS(e,t){return(e?.requiredCapabilities??[]).every(e=>!!t.runtimeCapabilities[e])&&Jm(e?.requiredRoles,t.effectiveRoles)}function NS(e,t){return e.flatMap(e=>MS(e.runtimeAvailability,t)?e.children?.length?[{...e,children:NS(e.children,t)}]:[e]:[])}function Dle(e,t){return{...e,children:NS(e.children,t)}}function Ole(e,t){if(!e?.length)return e;let n=[];for(let r of e)MS(r.runtimeAvailability,t)&&(r.contentKind===Le.NAVIGATION_LIST?n.push(Dle(r,t)):n.push(r));return n}function kle(e,t){return PS(e,t)}function PS(e,t){return e?.length?e.filter(e=>MS(e.runtimeAvailability,t)):e}function Ale(e,t){return PS(e,t)}function jle(e,t){return PS(e,t)}function Mle(e,t){return PS(e,t)}function Nle(e,t){return PS(e,t)}function Ple(e,t){return PS(e,t)}var FS=Jo.getLogger(),IS=new Set,LS=(0,Q.createContext)(null);function RS(){let{emit:e}=vo(),{resourceRelationshipDepth:t,getZoneDepth:n,getZoneState:r,contentAreaWidth:i}=Zx(),{navigationLayout:a,currentBreakpoint:o,compositeViews:s,fullCustomViews:c,flowsActorsViews:l}=e_(),{user:u}=Cg(),d=lm(),{registry:f,getOperationContextNeeds:p}=wm(),m=vh(),h=TS(),g=(0,Q.useRef)(0),_=wg(),v=(0,Q.useRef)(Ch.buildBrowserUrl(_.pathname,_.search));v.current=Ch.buildBrowserUrl(_.pathname,_.search);let y=tS(),b=(0,Q.useCallback)((t=li.PRIMARY)=>{if(r(t).stack.length===0)return;if(t===qn.OVERLAY){e(hc.NAVIGATION_POP,{zone:t});return}let n=Ch.resolveGoBackTarget({zone:t,currentBrowserUrl:v.current,getZoneState:r});n&&(e(hc.NAVIGATION_POP,{zone:t}),n.browserUrl&&aS(m,n.browserUrl,!0))},[e,r,m]),x=(0,Q.useCallback)(t=>{let n=++g.current;(async()=>{let{content:_,initiator:x,urlPath:S,contextResourceIdentifiers:C,relationshipTransition:w,relationshipMaxDepth:T,replaceBrowserHistory:E}=t;try{if(rS(`navigate() called`,{contentType:_.contentType,sourceZone:x.sourceZone,urlPath:S}),_.contentType===hd.SETTINGS_HUB){m(S??Cn.settings);return}if(!a){rS(`navigate() aborted: no navigationLayout`);return}let t=pm.extractPrimaryScopeFromContent(_,f,s,c,l),D=pm.buildInitiatorIds({userId:d?.currentUserId,organizationId:d?.currentOrganizationId,applicationId:d?.currentApplicationId,anonymousUserId:d?.currentAnonymousUserId}),O=pm.primaryScopeToContextIdentifiers(D,t),k=d?.buildContextResourceIdentifiers()??{},A=Ch.isResourceOperationContent(_)?_.resourceContext.contextResourceIdentifiers??{}:{},j={...O,...k,...A,...C},M={};for(let[e,t]of Object.entries(j)){let n=gn.getResourceId(t);if(n){M[e]=n;let r=gn.getFieldIdentifier(t);r&&(M[r]=n)}}let N=!1,P=oS(_),F=P.operationSurface,I,ee,L=_;if(Ch.isResourceOperationContent(_)){let e=_.resourceContext.operation;if(F===Es.API_ONLY){FS.error(`[useNavigationController] refused navigation to API_ONLY (headless) operation — it has no rendered interface`,{resourceType:_.resourceContext.resourceType,operationIdentifier:String(e?.operationIdentifier),sourceZone:x.sourceZone});return}let t=_.resourceContext.resourceType,r=f.resourceConfigurations?.[t];if(r){let n=Ih({initiatorInfos:e.initiatorInfos,targetResourceType:t,registry:f,ownIdentifiers:{...A,...C},tenancyIdentifiers:O,parentResourcesRequirements:_.resourceContext.parentResourcesRequirements}),i=Ch.resolveResourceUrl(r,e,M,f.allResourceFieldIdentifiers,n??_.resourceContext.parentResourcesRequirements,n!==void 0);i&&(i.templateUrl,I=i.routePathParameters,ee=i.resolvedUrl)}N=iS(e)&&!!(ee??S);let i=new Set((I??[]).map(e=>e.resourceType));if(`enabledCondition`in e&&e.enabledCondition&&p(e).needsUserContext&&!u){console.warn(`[useNavigationController] Navigation blocked: enabledCondition requires user context but user is missing`,{resourceType:t,operationIdentifier:e.operationIdentifier});return}if(n!==g.current){rS(`navigate() aborted: superseded before state mutation`,{requestId:n,latestRequestId:g.current,sourceZone:x.sourceZone});return}let a={};for(let[e,t]of Object.entries({...O,...k}))(i.size===0||i.has(e))&&(a[e]=t);let o=_.resourceContext.contextResourceIdentifiers?.[t];L={..._,resourceContext:{..._.resourceContext,contextResourceIdentifiers:{...a,...C,...o?{[t]:o}:{},..._.resourceContext.contextResourceIdentifiers}}}}else if(_.contentType===hd.COMPOSITE_VIEW||_.contentType===hd.CHART_VIEW||_.contentType===hd.FULL_CUSTOM_VIEW||_.contentType===hd.EXECUTION_VIEW||_.contentType===hd.FLOWS_ACTORS_VIEW){let e={..._.contextResourceIdentifiers??{},...C};L={..._,contextResourceIdentifiers:Object.keys(e).length>0?e:void 0}}else if(_.contentType===hd.CUSTOM_COMPONENT){let e={...O,...k,..._.contextResourceIdentifiers??{},...C};L={..._,contextResourceIdentifiers:Object.keys(e).length>0?e:void 0}}x.sourceZone===`appLevel`&&(pg(e,`app_level_navigation`),rS(`APP_LEVEL clean break: cleared SECONDARY + COMPANION + OVERLAY`)),Ch.isResourceOperationContent(L)&&Ch.calculateResourceRelationshipDepth(L.resourceContext.parentResourcesRequirements);let R={},te={};for(let e of or){let t=r(e).stack.length;te[e]=t,R[e]=t>0}let z=x.sourceZone,B=P.operation,ne=P.effectiveOperation,re=P.resourceType,ie=z!==`appLevel`&&z!==qn.OVERLAY?z:void 0,ae={sourceZone:z,...P,relationshipTransition:w,relationshipMaxDepth:T,viewport:o,contentAreaWidth:i,zoneOccupancy:R,zoneDepth:te,focusedZone:ie},oe=Gm.resolve(ae,a),se=oe.provenance.adjustments.includes(Zt.PERSISTENT_SPLIT_ESCALATED_NO_COMPANION);if(se||oe.provenance.adjustments.includes(Zt.SPLIT_ESCALATED_NO_ADJACENT_ZONE)){let e=`${re??`view`}:${B}`;IS.has(e)||(IS.add(e),FS.warn(se?"Navigation: a PERSISTENT split was declared for this operation and the layout declares no `companion` zone — a persistent split targets `companion` specifically and does not fall back to `secondary`, so it opened as an overlay.":"Navigation: a SPLIT was declared for this operation and the layout declares no `secondary` or `companion` zone — it opened as an overlay instead of beside its source.",{resourceType:re,operation:B,decidedBy:oe.provenance.transitionSource,remedy:se?"Declare `zones.companion` in the navigation layout, or drop `persistent` so the split may use `secondary`.":"Declare `zones.secondary` in the navigation layout, or change this operation's transition to PUSH, REPLACE or OVERLAY."}))}if(rS(`Policy resolved`,{targetZone:oe.targetZone,transition:oe.transition,decidedBy:oe.provenance.transitionSource,authoredAs:oe.provenance.authoredTransition,adjustments:oe.provenance.adjustments,appearance:oe.appearance,collapsed:oe.collapsed,collapsedFromZone:oe.collapsedFromZone,ephemeral:oe.ephemeral,persistent:oe.persistent}),oe.transition===ln.INPLACE){let e=Ch.isResourceOperationContent(L)?Fle(L,ne):void 0;if(e&&y.isAvailable){rS(`INPLACE resolved to the element-level host`,{kind:e.kind}),y.open(e);return}rS(`INPLACE has no element-level host here — degrading to overlay`,{hasTarget:!!e,hostAvailable:y.isAvailable}),oe=Gm.degradeInPlaceToOverlay(ae,a,oe)}oe.transition===ln.PROMOTE&&(pg(e,`promote_navigation`),rS(`PROMOTE clean break: cleared SECONDARY + COMPANION + OVERLAY`)),x.sourceZone===qn.OVERLAY&&oe.targetZone!==qn.OVERLAY&&oe.transition!==ln.PROMOTE&&(Mh(e,`overlay_breakout_navigation`),rS(`OVERLAY breakout: closed the overlay it was launched from`,{targetZone:oe.targetZone,transition:oe.transition})),(oe.targetZone===li.SECONDARY||oe.targetZone===li.COMPANION)&&Ch.isResourceOperationContent(L)&&uS(L,oe.targetZone,f,M,e,m,r,{viewerMayPerform:h});let ce=Ch.generateStackEntryId(),le=ee??S,ue=oe.targetZone!==qn.OVERLAY,de=L.contentType===hd.EXECUTION_VIEW&&zp({viewRef:L.viewRef,registry:f})?.isAddressable===!0,fe=L.contentType===hd.COMPOSITE_VIEW||L.contentType===hd.CHART_VIEW||L.contentType===hd.FULL_CUSTOM_VIEW||de||L.contentType===hd.FLOWS_ACTORS_VIEW||L.contentType===hd.ENGINE_PAGE,pe=ue&&!!le&&(N||fe),me=pe?L.contentType===hd.COMPOSITE_VIEW?Vp(L.viewRef,L.contextResourceIdentifiers):L.contentType===hd.CHART_VIEW?$p(L.viewRef,L.contextResourceIdentifiers,L.urlParamValues):L.contentType===hd.EXECUTION_VIEW?Yp(L.viewRef,L.contextResourceIdentifiers):le:void 0,he=Ch.getTopEntry(r(li.PRIMARY)),ge=oe.targetZone===li.SECONDARY&&pe&&me!==void 0&&Ch.hostedPaneApplies({paneContent:L,primaryTop:he}),_e={zone:oe.targetZone,content:L,urlPath:me,stackEntryId:ce,initiator:x,navigationSource:Zi.CONTROLLER,transition:oe.transition,appearance:oe.appearance,overlayBehavior:oe.overlayBehavior,ephemeral:oe.ephemeral,persistent:oe.persistent,...ge?{hostedPane:!0}:{},...oe.collapsedFromZone?{collapsedFromZone:oe.collapsedFromZone}:{}},ve=oe.targetZone===qn.OVERLAY&&x.sourceZone===qn.OVERLAY,ye=oe.transition===ln.PUSH||ve,be=ue?r(oe.targetZone):void 0,xe=be&&be.activeTabId===void 0?be.stack[be.stack.length-2]:void 0;if(oe.transition===ln.PUSH&&me!==void 0&&xe?.urlPath&&Ch.urlsAddressSameDestination(xe.urlPath,me)){rS(`PUSH names the entry beneath — going back instead`,{zone:oe.targetZone,finalUrlPath:me}),b(oe.targetZone);return}rS(`Emitting navigation event`,{event:ye?`PUSH`:`REPLACE`,zone:oe.targetZone,finalUrlPath:me,hostedPane:ge,stacksOnOverlay:ve}),ig(()=>{if(e(ye?hc.NAVIGATION_PUSH:hc.NAVIGATION_REPLACE,_e),pe&&me){let e=E===!0||oe.transition===ln.REPLACE||oe.transition===ln.PROMOTE,t=ge||oe.targetZone===li.COMPANION?Ch.resolveBrowserUrlForZoneEntry({zone:oe.targetZone,entryUrlPath:me,paneContent:L,currentBrowserUrl:v.current,getZoneState:r})??me:me;aS(m,t,e)}},{zone:oe.targetZone})}catch(e){FS.error(`useNavigationController navigation failed`,{error:e,requestId:n,sourceZone:x.sourceZone,contentType:_.contentType,urlPath:S,resourceType:Ch.isResourceOperationContent(_)?_.resourceContext.resourceType:void 0,operationIdentifier:Ch.isResourceOperationContent(_)?_.resourceContext.operation?.operationIdentifier:void 0})}})()},[e,a,o,u,d,f,s,c,l,p,m,r,i,y,b]),S=(0,Q.useCallback)((e,t,n,r)=>{let i={contentType:hd.RESOURCE_OPERATION,resourceContext:e};x({content:i,initiator:t,urlPath:n,relationshipTransition:r})},[x]),C=(0,Q.useCallback)(()=>{let t=Ch.getTopEntry(r(qn.OVERLAY));t&&e(hc.NAVIGATION_CLOSE,{zone:qn.OVERLAY,stackEntryId:t.id})},[e,r]),w=(0,Q.useCallback)(t=>{if(t===li.PRIMARY||r(t).stack.length===0)return;let n=Ch.resolveZoneDismissUrl({zone:t,currentBrowserUrl:v.current,getZoneState:r});e(hc.NAVIGATION_CLEAR_ZONE,{zone:t}),n&&aS(m,n,!0)},[e,r,m]),T=(0,Q.useCallback)(e=>n(e)>1,[n]);return(0,Q.useMemo)(()=>({navigate:x,navigateToResource:S,goBack:b,closeOverlay:C,dismissZone:w,canGoBack:T,resourceRelationshipDepth:t}),[x,S,b,C,w,T,t])}function Fle(e,t){let n=e.resourceContext,r=n.operation;if(!r)return;if(t===W.CREATE||t===W.CREATE_MANY)return{kind:Qx.CREATE,operation:r,resourceContext:n};let i=gn.getAddressedRecordId(n);return i?{kind:Qx.ELEMENT,elementId:i,operation:r,resourceContext:n}:void 0}function zS(){let e=(0,Q.useContext)(LS),t=RS();return e??t}function BS(){let{registry:e}=wm(),{navigateToResource:t}=zS(),n=(0,Q.useCallback)(n=>{let{resourceType:r,resourceId:i,contextResourceIdentifiers:a={},sourceZone:o=li.PRIMARY}=n;if(!i)return!1;let s=e.resourceConfigurations[r];if(!s)return!1;let c=gn.buildRecordIdentifiersFromCollection(a,r,i),l=Ile(s,e,c);return l?(t(gn.createFrontendResourceOperationContextFromOperation({resourceType:r,operation:l,contextResourceIdentifiers:c}),{sourceZone:o,sourceOperation:W.READ}),!0):!1},[e,t]);return(0,Q.useMemo)(()=>({navigateToResourceRead:n}),[n])}function Ile(e,t,n){let r=r=>Th({resourceConfig:e,operations:e?.operations??[],coreOperation:W.READ,registry:t,hasResourceId:!0,requireFrontendAddressable:r,contextResourceIdentifiers:n,contextualParameters:V.buildContextualParameters(n,t)}),i=r(!0);if(i)return i;let a=r(!1);return a?.operationFrontendConfig?.surface===Es.EMBEDDED?a:void 0}function VS(e,t){let n=e.filterFields;return n&&Object.keys(n).length>0||ul(e)!==W.LIST?n:t.find(e=>String(e.operationIdentifier)===W.SEARCH&&e.isOperationDefault===!0)?.filterFields}function Lle(e,t){if(typeof t==`string`)return e.some(e=>String(e.operationIdentifier)===t);let[n,r]=t;return e.some(e=>String(e.operationIdentifier)===n&&e.variantKey===r)}function Rle(e){let{collectionDisplayConfig:t,operation:n,resourceOperations:r}=e;if(!t)return;let{displayMode:i,userSwitchableDisplayMode:a,board:o}=t;if(i===au.BOARD&&!o)return`displayMode BOARD requires collectionDisplayConfig.board: { groupByField } naming the enum field its columns come from`;if(!o)return;if(i!==au.BOARD&&a!==!0)return`collectionDisplayConfig.board is read only when displayMode is BOARD or userSwitchableDisplayMode offers it; declare one of them or remove board`;let s=VS(n,r);if(!s||!Object.hasOwn(s,o.groupByField))return`board.groupByField "${o.groupByField}" is not a filter field of this operation; the columns come from that filter field's enum values`;if(o.transitionOperation!==void 0&&!Lle(r,o.transitionOperation))return`board.transitionOperation ${JSON.stringify(o.transitionOperation)} names no operation this resource's frontend registry holds`}var zle=[{mode:au.CALENDAR,configKey:`calendar`,shape:`{ dateField }`,fields:e=>e.calendar?[[`calendar.dateField`,e.calendar.dateField]]:void 0},{mode:au.TIMELINE,configKey:`timeline`,shape:`{ startField, endField }`,fields:e=>e.timeline?[[`timeline.startField`,e.timeline.startField],[`timeline.endField`,e.timeline.endField]]:void 0}];function Ble(e){let{collectionDisplayConfig:t,operation:n,resourceOperations:r}=e;if(!t)return;let{displayMode:i,userSwitchableDisplayMode:a}=t;for(let e of zle){let o=e.fields(t);if(i===e.mode&&!o)return`displayMode ${e.mode.toUpperCase()} requires collectionDisplayConfig.${e.configKey}: ${e.shape}`;if(!o)continue;if(i!==e.mode&&a!==!0)return`collectionDisplayConfig.${e.configKey} is read only when displayMode is ${e.mode.toUpperCase()} or userSwitchableDisplayMode offers it; declare one of them or remove ${e.configKey}`;if(e.mode===au.TIMELINE&&o[0][1]===o[1][1])return`timeline.startField and timeline.endField both name "${o[0][1]}"; a bar runs from one date field to ANOTHER, and one field holds a day, not a span (show it on a calendar)`;let s=VS(n,r);for(let[t,n]of o)if(!s||!Object.hasOwn(s,n))return`${t} "${n}" is not a filter field of this operation; the ${e.configKey} asks for its visible dates as a window on that filter field`}}function HS(e){return e?._zod?.def?.type===`object`}function US(e,t){let n=t[Fe]??{},r=e[Fe]??{};return Object.fromEntries(Object.entries(n).filter(([e,t])=>r[e]!==t))}function WS(e,t){let n=ne(e,[]);return n[Fe]={...n[Fe]??{},...t},n}function GS(e,t,n,r={}){if(n===t)return e;if(!HS(e)||!HS(t)||!HS(n))return n;let i=sa(e),a=sa(t),o=sa(n),s={};for(let[e,t]of Object.entries(o)){let n=a[e],r=i[e];if(n===void 0||r===void 0||t===n||r===t)continue;if(r===n){s[e]=t;continue}let o=US(n,t);Object.keys(o).length>0&&(s[e]=WS(r,o))}let c=Object.keys(s).length===0?e:Gt(e,s);if(r.objectLevel){let r=US(t,n);if(Object.keys(r).length>0){if(c===e)c=WS(e,r);else{let e=c;e[Fe]={...e[Fe]??{},...r}}}}return c}function Vle(e,t){try{let n=sa(e),r=sa(t);return Object.entries(n).some(([e,t])=>{let n=r[e];return n?t===n||Nr(t)===n:!1})}catch{return!1}}function KS(e,t,n){if(!e)return;let r=sr.getObjectLikeFieldShape(e,{commonOnly:!1}),i=sr.getObjectLikeFieldShape(t,{commonOnly:!1});if(r&&i)for(let[e,t]of Object.entries(r)){let r=i[e];if(!r||!t||t===r||n.has(t))continue;let a=xn(r);if(Object.keys(a).length===0)continue;let o=xn(t);Object.keys(a).some(e=>!(e in o)||o[e]!==a[e])&&(t[Fe]={...o,...a})}}var Hle=[Sr.IS_FOREIGN_KEY,Sr.FOREIGN_KEY_UI];function Ule(e,t){if(!e||!t)return e;let n=sr.getObjectLikeFieldShape(e,{commonOnly:!1}),r=sr.getObjectLikeFieldShape(t,{commonOnly:!1});if(!n||!r)return e;let i=new Map;for(let[e,t]of Object.entries(n)){let n=r[e];if(!t||!n||!Uo(n)||Uo(t)||sc(t)===bc.ARRAY!=(sc(n)===bc.ARRAY))continue;let a=xn(n),o={};for(let e of Hle)e in a&&(o[e]=a[e]);let s=ne(t,[]);s[Fe]={...xn(t),...o},i.set(t,s)}return i.size===0?e:Wle(e,i)}function Wle(e,t){let n=new Map,r=new Set,i=e=>{let a=t.get(e);if(a)return a;let o=n.get(e);if(o)return o;if(r.has(e))return e;r.add(e);let s=ea(e,i);return r.delete(e),n.set(e,s),s};return i(e)}function Gle(e){let t=nae.get(e)?.[wu];return typeof t==`string`?t:void 0}function Kle(e,t,n){let r=new Map,i=new Map,a=new Map,o=(e,t)=>{let s=Gle(e)??t,c=(n.get(s)??r).get(e);if(c)return c;let l=i.get(s);l||i.set(s,l=new Map);let u=l.get(e);if(u)return u;let d=a.get(s);if(d||a.set(s,d=new Set),d.has(e))return e;d.add(e);let f=ea(e,e=>o(e,s));return d.delete(e),l.set(e,f),f};return o(e,t)}function qS(e,t,n){if(!e||!t||e===t||typeof e!=`object`||typeof t!=`object`)return;let r=e._zod?.def,i=t._zod?.def;if(!r||!i||r.type!==i.type||n.has(e))return;if(n.set(e,t),r.type===`object`){let e=r.shape,t=i.shape;for(let r of Object.keys(e))qS(e[r],t[r],n);return}for(let e of[`innerType`,`element`,`valueType`,`in`,`out`])qS(r[e],i[e],n);let a=r.options,o=i.options;Array.isArray(a)&&Array.isArray(o)&&a.length===o.length&&a.forEach((e,t)=>qS(e,o[t],n))}function JS(e,t){if(e===void 0)return;let n=!1,r=e.inheritedSchemas.map(e=>{let r=t(e.schema),i=JS(e.inheritenceSchemaDefinition,t);return r===e.schema&&i===e.inheritenceSchemaDefinition?e:(n=!0,{...e,schema:r,...i===void 0?{}:{inheritenceSchemaDefinition:i}})});return n?{...e,inheritedSchemas:r}:e}function YS(e,t,n){for(let t of Object.values(sa(e)??{}))n.add(t);for(let e of t?.inheritedSchemas??[])YS(e.schema,e.inheritenceSchemaDefinition,n)}function XS(e,t,n){if(e===void 0||n===t)return e;let r=e=>e._zod?.def?.type===`object`;return!r(t)||!r(n)?e:JS(e,e=>r(e)?GS(e,t,n):e)}var ZS=class{httpClient;registry=null;isInitialized=!1;declaredFieldInstancesByResource=new Map;presentationSubstitutionsByResource=new Map;resourcesHttpClient=null;constructor(e){this.httpClient=e}buildConfigurationError(e,t){let n=Du.buildWildoError_Frontend(ue.CONFIGURATION,{customMessageReference:e,context:t}),r=Error(e);return r.wildoError=n,r}async initializeResources(e,t,n,r,i,a){if(!this.isInitialized)try{let o={...t,...Ine},s=[...n||[],...kn],c=tv(s);if(c.length>0)throw this.buildConfigurationError(ii.CONFIGURATION,{message:`${c.length} relationship edge(s) registered more than once:\n`+c.map(e=>` • ${e.message}`).join(`
|
|
4
|
-
`),duplicatedEdges:c.map(e=>`${String(e.parentResourceType)} → ${String(e.childResourceType)} (×${e.occurrences})`)});let l=Nn.ensureCompiledRelationships.call(Nn,s,o),u=[...r??[]].filter(e=>ei.has(e));u.length>0&&console.warn(`[ResourcesRepository] Refusing to exclude ${u.join(`, `)}: the engine's own runtime reads these to restore an authenticated session, so honouring the exclusion would make login succeed and then immediately bounce back to the login form. They stay registered.`);let d=u.length>0?new Set([...r??[]].filter(e=>!ei.has(e))):r,f={};e&&Object.keys(e).length>0&&Object.entries(e).forEach(([e,t])=>{t&&typeof t==`function`&&!d?.has(e)&&(f[e]=t(l))});let p={};ka&&Object.keys(ka).length>0&&Object.entries(ka).forEach(([e,t])=>{t&&typeof t==`function`&&!d?.has(e)&&(p[e]=t(l))});let m={...p,...f};if(d&&d.size>0){m=Object.fromEntries(Object.entries(m).filter(([e])=>!d.has(e))),l=l.filter(e=>!d.has(e.resourceType1)&&!d.has(e.resourceType2));for(let e of d)delete o[e]}this.normalizeResourceConfigurationRelationships(m,o);let h=this.buildFrontendResourceConfigurations(m,o,i);Die(h,l,o),Gs.rebuildResourceConfigurationsOperationDtos(h),this.overlayUiBehaviorDtoDecorators(h,i),this.substitutePresentationIntoCustomDtos(h),this.carryReferenceIdentityOntoCustomRequestDtos(h);let g=Nn.buildFieldIdentifierToResourceTypeMap({allResourceFieldIdentifiers:o,allResourceRelationships:l,getMainSchema:e=>h[e]?.mainSchema,fieldIdentifierPriority:mie,onForeignKeyCollision:({foreignKeyField:e,existingType:t,referencedResourceType:n})=>{console.error(`[ResourcesRegistry] FK field "${e}" is reused by different holders referencing "${t}" and "${n}". Keeping "${t}". Use distinct foreignKeyField names to disambiguate.`)}}),_=Nn.buildManyToManyScopeJunctionMap(l,o);this.registry={allResourceFieldIdentifiers:o,fieldIdentifierToResourceType:g,manyToManyScopeJunctions:_,notificationBadgeDefinitions:[...Z_,...a??[]],additionalUserNotificationDefinitions:[],resourceRelationships:l,resourceConfigurations:h,subtreeMap:iv(l)},this.generateUrlsForApiCallOperations(h,o),this.resourcesHttpClient=new Yx(this.registry,{baseURL:this.httpClient.getBaseURL(),timeout:3e4,enableNetworkQueue:!0}),this.validateForeignKeyResolution(h,g),this.validateResourceOwnedViewRefUniqueness(h),this.validateFileDisplayPolicyCoherence(h),this.isInitialized=!0}catch(e){throw e?.wildoError?e:this.buildConfigurationError(ii.CONFIGURATION,{message:`Failed to initialize frontend resources: ${Ca(e)}`})}}normalizeResourceConfigurationRelationships(e,t){for(let n of Object.values(e))n.resourceRelationships={parentRelationships:Nn.ensureCompiledRelationships.call(Nn,n.resourceRelationships.parentRelationships,t),childRelationships:Nn.ensureCompiledRelationships.call(Nn,n.resourceRelationships.childRelationships,t),selfRelationships:Nn.ensureCompiledRelationships.call(Nn,n.resourceRelationships.selfRelationships,t)}}carryReferenceIdentityOntoCustomRequestDtos(e){for(let t of Object.values(e))for(let e of t.operations??[])e.hasCustomRequestDto&&(e.requestDto=Ule(e.requestDto,t.mainSchema))}presentSchemas(e,t,n){let r=t.mainSchema,i=t.inheritenceSchemaDefinition;if(n.mainSchema===r&&n.inheritenceSchemaDefinition===i)return;let a=t;a.mainSchema=n.mainSchema,a.inheritenceSchemaDefinition=n.inheritenceSchemaDefinition;for(let e of t.operations??[])e.mainSchema===r&&(e.mainSchema=n.mainSchema);let o=new Map;qS(r,n.mainSchema,o);let s=(e,t)=>{e?.inheritedSchemas.forEach((e,n)=>{let r=t?.inheritedSchemas[n];qS(e.schema,r?.schema,o),s(e.inheritenceSchemaDefinition,r?.inheritenceSchemaDefinition)})};if(s(i,n.inheritenceSchemaDefinition),o.size===0)return;let c=new Map;for(let[t,n]of this.presentationSubstitutionsByResource.get(e)??[])c.set(t,o.get(n)??n);for(let[e,t]of o)c.has(e)||c.set(e,t);this.presentationSubstitutionsByResource.set(e,c)}substitutePresentationIntoCustomDtos(e){if(this.presentationSubstitutionsByResource.size!==0){for(let[t,n]of Object.entries(e))if(n?.operations)for(let e of n.operations)for(let[n,r]of[[`hasCustomResponseDto`,`responseDto`],[`hasCustomResponseDto`,`contextDto`],[`hasCustomRequestDto`,`requestDto`]]){let i=e[r];e[n]&&i&&(e[r]=Kle(i,t,this.presentationSubstitutionsByResource))}}}overlayUiBehaviorDtoDecorators(e,t){if(t)for(let[n,r]of Object.entries(t)){let t=r[Ti];if(!t)continue;let i=this.declaredFieldInstancesByResource.get(n)??new Set,a=e[n];if(a?.operations)for(let e of a.operations)e.hasCustomResponseDto||(KS(e.responseDto,t,i),KS(e.contextDto,t,i)),e.hasCustomRequestDto||KS(e.requestDto,t,i),KS(e.summaryDto,t,i)}}buildFrontendResourceConfigurations(e,t,n){let r={};for(let[t,n]of Object.entries(e))r[t]={...n,operations:(n.operations??[]).filter(e=>e.variantType===Ya.API_CALL).map(e=>({...e,operationFrontendConfig:void 0})),frontendConfiguration:void 0};if(n)for(let[e,i]of Object.entries(n)){let n=r[e];if(!n){console.warn(`[ResourcesRegistry] Frontend preset references resource "${e}" which has no backend configuration. Skipping.`);continue}let{views:a,relationshipOverrides:o,compositeViews:s,executionViews:c,...l}=i,u=i[Ti],d=new Set;if(YS(n.mainSchema,n.inheritenceSchemaDefinition,d),this.declaredFieldInstancesByResource.set(e,d),u&&u!==n.mainSchema){let t=n.mainSchema,r=GS(t,i[Gu]??t,u,{objectLevel:!0});if(this.presentSchemas(e,n,{mainSchema:r,inheritenceSchemaDefinition:XS(n.inheritenceSchemaDefinition,t,r)}),r!==t)for(let e of n.operations){if(!e.requestDto)continue;let n=e.resourceOperationLike?String(e.resourceOperationLike):String(e.operationIdentifier);(n===W.CREATE||n===W.UPDATE)&&!e.hasCustomRequestDto&&Vle(e.requestDto,t)&&(e.requestDto=Jte(n,r,void 0))}}if((n.recordLabelFields?.length??0)>0&&l.getFrontendResourceLabel!==void 0)throw Error(`[ResourcesRegistry] Resource "${e}" names its records twice: \`recordLabelFields\` (${n.recordLabelFields.join(`, `)}) and its ui-behavior's getFrontendResourceLabel. A record has one name, which a chat shows too: remove getFrontendResourceLabel (the application names it by recordLabelFields), or remove recordLabelFields if the resource has no chat command that names its records.`);let f=this.buildResourceCompositeViewDefinitions(e,n.resourcePrimaryScope??td.ORGANIZATIONS,s),p=this.buildResourceExecutionViewDefinitions(n.resourcePrimaryScope??td.ORGANIZATIONS,c);if(n.frontendConfiguration={...l,...f.length>0&&{compositeViews:f},...p.length>0&&{executionViews:p}},a)for(let[e,t]of a){let r=this.findOperationByPresetKey(n.operations,e);r&&(r.operationFrontendConfig=t)}o&&o.length>0&&this.resolveRelationshipDisplayOverrides(e,n.resourceRelationships,o,t)}for(let[e,t]of Object.entries(r))for(let n of t.operations){if(n.operationFrontendConfig===void 0){n.operationFrontendConfig={surface:n.defaultFrontendPosture??(n.isBulkOperation?Es.EMBEDDED:Es.API_ONLY)};continue}if(n.operationFrontendConfig.surface===Es.API_ONLY){let t=n.operationFrontendConfig;if(t.actionVisibility!==void 0||t.runtimeAvailability!==void 0||t.actionPlacement!==void 0||t.actionPresentation!==void 0||t.actionVariant!==void 0||t.customView!==void 0||t.displayPresetOverride!==void 0||(t.navigationOverrides?.length??0)>0||t.displayPriority!==void 0||t.iconOverride!==void 0||t.collectionDisplayConfig!==void 0||t.hasDescription!==void 0)throw Error(`[ResourcesRegistry] Operation "${String(n.operationIdentifier)}" on resource "${e}" declares surface API_ONLY (headless) but carries view-only frontend config (action/layout/icon/customView). A headless operation has no UI surface — drop the view fields, or change its surface to ADDRESSABLE/EMBEDDED.`)}let r=Rle({collectionDisplayConfig:n.operationFrontendConfig.collectionDisplayConfig,operation:n,resourceOperations:t.operations});if(r)throw Error(`[ResourcesRegistry] Operation "${String(n.operationIdentifier)}" on resource "${e}": ${r}.`);let i=Ble({collectionDisplayConfig:n.operationFrontendConfig.collectionDisplayConfig,operation:n,resourceOperations:t.operations});if(i)throw Error(`[ResourcesRegistry] Operation "${String(n.operationIdentifier)}" on resource "${e}": ${i}.`)}for(let[e,n]of Object.entries(r))this.deriveForeignKeyDisplayFromRelationships(e,n,t);return console.info(`[ResourcesRegistry] Frontend registry built: ${Object.keys(r).length} resource(s) total, ${n?Object.keys(n).length:0} with UI behavior.`),r}buildResourceCompositeViewDefinitions(e,t,n){return n?Object.entries(n).map(([n,r])=>({ref:n,translationRef:Tp(e,n),scope:fm.RESOURCE,isAddressable:!0,operationLike:r.operationLike??W.READ,primaryScope:t,sectionRefs:r.sectionRefs,viewComponent:r.viewComponent,icon:r.icon})):[]}buildResourceExecutionViewDefinitions(e,t){return t?Object.entries(t).map(([t,n])=>({ref:t,scope:fm.RESOURCE,isAddressable:n.isAddressable??!0,primaryScope:n.primaryScope??e,parentResourcesRequirements:n.parentResourcesRequirements,additionalResourceRequirements:n.additionalResourceRequirements,anchor:n.anchor,surfaceInOperations:n.surfaceInOperations,participations:n.participations,viewComponent:n.viewComponent,requiredFeatures:n.requiredFeatures,labels:n.labels,icon:n.icon,launcher:n.launcher,zoneContentMaxWidth:n.zoneContentMaxWidth,zoneContentFillsHeight:n.zoneContentFillsHeight})):[]}resolveRelationshipDisplayOverrides(e,t,n,r){for(let i of n){let n=[];for(let e=0;e<t.childRelationships.length;e++){let r=t.childRelationships[e];r.resourceType2===i.target&&n.push({bucket:t.childRelationships,index:e,rel:r,bucketName:`childRelationships`})}for(let e=0;e<t.parentRelationships.length;e++){let r=t.parentRelationships[e];r.resourceType1===i.target&&n.push({bucket:t.parentRelationships,index:e,rel:r,bucketName:`parentRelationships`})}for(let e=0;e<t.selfRelationships.length;e++){let r=t.selfRelationships[e];r.resourceType1===i.target&&n.push({bucket:t.selfRelationships,index:e,rel:r,bucketName:`selfRelationships`})}if(n.length>1){let e=n.filter(({rel:e})=>e.accessScopeStrategy!==lne.STANDALONE);e.length>0&&(n.length=0,n.push(...e))}if(i.foreignKeyField&&n.length>0){let e=n.filter(({rel:e})=>Nn.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier===i.foreignKeyField);n.length=0,n.push(...e)}if(n.length===0){if(va.isDevelopment()){let n=[...t.childRelationships.map(e=>`${e.resourceType2} (FK: ${Nn.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier??`unresolved`})`),...t.parentRelationships.map(e=>`${e.resourceType1} (FK: ${Nn.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier??`unresolved`})`),...t.selfRelationships.map(e=>`${e.resourceType1} (FK: ${Nn.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier??`unresolved`})`)];console.warn(`[RelationshipDisplay] Resource "${e}" has no relationship with "${i.target}"${i.foreignKeyField?` (FK: ${i.foreignKeyField})`:``}. Available relationships: [${n.join(`, `)}]. Override ignored.`)}continue}if(n.length>1&&!i.foreignKeyField){if(va.isDevelopment()){let t=n.map(({rel:e})=>Nn.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier??`unresolved`);console.warn(`[RelationshipDisplay] Resource "${e}" has ${n.length} relationships with "${i.target}" (FK fields: [${t.join(`, `)}]). Provide foreignKeyField to disambiguate. Override ignored.`)}continue}n.length>1&&i.foreignKeyField&&va.isDevelopment()&&console.warn(`[RelationshipDisplay] Resource "${e}" has ${n.length} relationships with "${i.target}" even after FK field "${i.foreignKeyField}" filtering. Applying to first match.`);let{bucket:a,index:o,rel:s}=n[0],c={...s,display:s.display?{...s.display}:void 0};i.inParentNavigation&&(c.display={...c.display,inParentNavigation:{...c.display?.inParentNavigation,...i.inParentNavigation}}),i.inChildView&&(c.display={...c.display,inChildView:{...c.display?.inChildView,...i.inChildView}}),c.display&&=dee.parse(c.display),a[o]=c}}deriveForeignKeyDisplayFromRelationships(e,t,n){let{parentRelationships:r,selfRelationships:i}=t.resourceRelationships,a=[...r,...i];for(let r of a){if(r.resourceType1===r.resourceType2&&!r.foreignKeyField)continue;let i=Nn.tryResolveRelationshipForeignKeyIdentity(r,n)?.fieldIdentifier;if(!i)continue;let a=r.display?.inChildView?.parentDisplay??hr.CONTEXT,o,s;switch(a){case hr.CONTEXT:o=qa.LABEL,s=!0;break;case hr.BREADCRUMB:o=qa.LABEL,s=!1;break;case hr.BADGE:o=qa.LABEL,s=!1;break;case hr.SUMMARY:o=qa.SUMMARY,s=!0;break;case hr.NONE:o=qa.ID,s=!1;break;default:o=qa.LABEL,s=!0}let c={display:{mode:o,linkable:s}},l=e=>{let t=sa(e)?.[i];if(!t||!Uo(t)||xn(t)[Sr.FOREIGN_KEY_UI]!==void 0)return e;let n=ne(t,[{ref:Sr.FOREIGN_KEY_UI,params:c}]);return Gt(e,{[i]:n})};this.presentSchemas(e,t,{mainSchema:l(t.mainSchema),inheritenceSchemaDefinition:JS(t.inheritenceSchemaDefinition,l)})}}findOperationByPresetKey(e,t){if(Array.isArray(t)){let[n,r]=t;return e.find(e=>e.operationIdentifier===n&&e.variantKey===r)}let n=e.filter(e=>e.operationIdentifier===t),r=n.filter(e=>e.isOperationDefault===!0),i=r.length>0?r:n.filter(e=>!e.variantKey);if(i.length===0)return;if(i.length===1)return i[0];let a=i.filter(e=>e.isBulkOperation!==!0);if(a.length===1)return a[0];throw this.buildConfigurationError(ii.CONFIGURATION,{operationIdentifier:t,candidateVariants:i.map(e=>({variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation})),message:`Frontend preset operation key resolves to multiple URL-bearing variants. Use an explicit [operationIdentifier, variantKey] tuple or make the default operation identity unique.`})}generateUrlsForApiCallOperations(e,t){for(let[n,r]of Object.entries(e))try{It.updateOperationUrls(r,t)}catch(e){console.error(`Failed to generate URLs for resource type ${n}:`,e)}}getResourcesRegistry(){if(!this.isInitialized)throw this.buildConfigurationError(ii.FRONTEND_RESOURCES_NOT_INITIALIZED,{method:`getResourcesRegistry`});return this.registry}getAvailableResourceTypes(){return this.isInitialized?Object.keys(this.registry.resourceConfigurations):[]}getRegistryInfo(){return this.isInitialized?{registeredResourceTypes:Object.keys(this.registry.resourceConfigurations)}:{registeredResourceTypes:[]}}getResourcesHttpClient(){if(!this.isInitialized||!this.resourcesHttpClient)throw this.buildConfigurationError(ii.FRONTEND_RESOURCES_NOT_INITIALIZED,{method:`getResourcesHttpClient`});return this.resourcesHttpClient}getApplicationHttpClient(){return this.httpClient}validateForeignKeyResolution(e,t){let n=Nn.collectUnresolvableForeignKeyFields({mainSchemasByResourceType:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.mainSchema])),variantSchemasByResourceType:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,vl(t.inheritenceSchemaDefinition)])),fieldIdentifierToResourceType:t});if(n.length>0){let e=n.map(({resourceType:e,fieldName:t})=>` - ${e}.${t}`).join(`
|
|
5
|
-
`),t=`[ResourcesRegistry] ${n.length} FK field(s) cannot be resolved to a resource type:\n${e}\nFix: Declare a relationship with the corresponding foreignKeyField.`;if(console.error(t),va.isDevelopment())throw this.buildConfigurationError(ii.FRONTEND_FK_RESOLUTION_FAILED,{unresolvedFKFields:n,message:t})}}validateFileDisplayPolicyCoherence(e){let t=[];for(let[n,r]of Object.entries(e)){let e=[r.mainSchema,...vl(r.inheritenceSchemaDefinition)].flatMap(e=>Object.entries(sa(e)??{})),i=new Set;for(let[r,a]of e){if(i.has(r))continue;let e=a,o=Bl(e);if(!o?.nature)continue;let s=Ys(e);if(!s)continue;let c=s.presentation!==void 0&&s.presentation!==Lne.CARD,l=s.activation?.policy===tu.OVERLAY;(c||l)&&Hte(o.nature)===!1&&(i.add(r),t.push({resourceType:n,fieldName:r,nature:String(o.nature),requested:c?`presentation ${s.presentation}`:`activation overlay`}))}}if(t.length===0)return;let n=t.map(({resourceType:e,fieldName:t,nature:n,requested:r})=>` - ${e}.${t} (nature ${n}) requests ${r}`).join(`
|
|
6
|
-
`),r=`[ResourcesRegistry] ${t.length} file field(s) request a display no displayer can satisfy:\n${n}\nFix: use presentation CARD (with a DOWNLOAD/NEW_TAB activation) for natures that have no viewer, or widen the declared FileNature if the field genuinely holds displayable files.`;if(console.error(r),va.isDevelopment())throw this.buildConfigurationError(ii.FRONTEND_FK_RESOLUTION_FAILED,{offendingFields:t,message:r})}validateResourceOwnedViewRefUniqueness(e){for(let t of Object.keys(e)){let n=new Map;for(let r of rse({resourceType:t,registry:{resourceConfigurations:e}})){let e=n.get(r.viewRef)??[];e.push(r),n.set(r.viewRef,e)}for(let[e,r]of n.entries()){if(r.length<=1)continue;let n=r.map(e=>e.family).join(`, `);throw this.buildConfigurationError(ii.CONFIGURATION,{component:`ResourcesRepositoryFrontendService.validateResourceOwnedViewRefUniqueness`,message:`Resource "${t}" declares resource-owned view ref "${e}" multiple times (${n}). RESOURCE_VIEW refs must be unique per resource-owned view namespace.`})}}}};function QS(e){return gl.createOperationPathKeyFromOperation(e)}function $S(e){let t=e?.requiredFeatures;return t?Array.isArray(t)||!t.appliesWhen:!1}function eC(e){return!!(e.enabledCondition||e.requiredFeatures)}function tC(e,t,n){return(0,Q.useMemo)(()=>{let r={};return e&&(r.userId=e),t&&(r.organizationId=t),n&&(r.applicationId=n),Object.keys(r).length>0?r:void 0},[e,t,n])}function nC(e){let{operation:t,currentObject:n,inputDto:r,objectContext:i,resourceType:a,enabled:o=!0}=e,{getResourcesRegistry:s,doOperation:c}=wm(),{user:l,permissions:u}=Cg(),d=lm(),f=ag(),p=s(),{resolvedFeatures:m,resolvedFeaturesResponse:h,featureDefinitions:g,unavailabilityPolicy:_,isLoading:v}=Nh(),y=(0,Q.useMemo)(()=>um(t),[t]),b=tC(l?._id,d?.primaryScopeValues?.organizationId,d?.primaryScopeValues?.applicationId),x=(0,Q.useMemo)(()=>{if(v)return $S(t)?{isAvailable:!1,behavior:co.DISABLE}:void 0;let e=Xh(u,d?.currentOrganizationId??null);return fg(t,{resolvedFeatures:m,resolvedFeaturesResponse:h,featureDefinitions:g,unavailabilityPolicy:_,userRoles:e,billingEnabled:f?.isEnabled??!1})},[t,v,m,h,g,_,u,d?.currentOrganizationId,f?.isEnabled]),[S,C]=(0,Q.useState)(()=>!eC(t)),[w,T]=(0,Q.useState)(()=>eC(t)),[E,D]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{!o||!t?(C(!0),T(!1)):x&&!x.isAvailable?(C(!1),T(!1)):!(`enabledCondition`in t)||!t.enabledCondition?(C(!0),T(!1)):y.needsUserContext&&!l?(C(!1),T(!1)):(T(!0),D(null),Nm({operation:t,currentObject:n,inputDto:r,userContext:l||void 0,initiatorIds:b,objectContext:i,resourcesRegistry:p,resourceType:a,doOperation:c}).then(e=>{C(e),T(!1)}).catch(e=>{D(e instanceof Error?e:Error(`Unknown error`)),C(!1),T(!1)}))},[o,t,n,r,i,l,b,p,a,y.needsUserContext,c,x]),{isEnabled:S,isLoading:w,error:E,contextNeeds:y,featureAvailability:x}}function qle(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function rC(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(let[n,r]of e){let e=t.get(n);if(!e||r.isEnabled!==e.isEnabled||(r.ineligibleSelectionIndices??[]).join(`,`)!==(e.ineligibleSelectionIndices??[]).join(`,`)||!qle(r.featureAvailability,e.featureAvailability))return!1}return!0}function iC(e,t={}){let{currentObject:n,inputDto:r,objectContext:i,resourceType:a,enabled:o=!0,selectionObjects:s,organizationId:c,subjectDataMode:l}=t,{getResourcesRegistry:u,doOperation:d}=wm(),{user:f,permissions:p}=Cg(),m=lm(),h=ag(),g=u(),{resolvedFeatures:_,resolvedFeaturesResponse:v,featureDefinitions:y,unavailabilityPolicy:b,isLoading:x}=Nh(),S=tC(f?._id,c??m?.primaryScopeValues?.organizationId,m?.primaryScopeValues?.applicationId),[C,w]=(0,Q.useState)(new Map);return(0,Q.useEffect)(()=>{if(!o){let t=new Map;e.forEach(e=>{t.set(QS(e),{isEnabled:!0})}),w(e=>rC(e,t)?e:t);return}if(!e.length||!a){w(e=>e.size===0?e:new Map);return}let t=!1,c=Xh(p,m?.currentOrganizationId??null),u={resolvedFeatures:_,resolvedFeaturesResponse:v,featureDefinitions:y,unavailabilityPolicy:b,userRoles:c,billingEnabled:h?.isEnabled??!1};return(async()=>{let o=new Map;await Promise.all(e.map(async e=>{let t=QS(e),c=x?$S(e)?{isAvailable:!1,behavior:co.DISABLE}:void 0:fg(e,u);if(c&&!c.isAvailable)o.set(t,{isEnabled:!1,featureAvailability:c});else if(!(`enabledCondition`in e)||!e.enabledCondition)o.set(t,{isEnabled:!0,featureAvailability:c});else if(um(e).needsUserContext&&!f)o.set(t,{isEnabled:!1,featureAvailability:c});else try{let u=t=>Nm({operation:e,currentObject:t,inputDto:r,userContext:f||void 0,initiatorIds:S,objectContext:i,resourcesRegistry:g,resourceType:a,doOperation:d,...l?{subjectDataMode:l}:{}});if(e.isBulkOperation===!0&&s&&s.length>0){let n=await Promise.all(s.map(e=>u(e))),r=n.flatMap((e,t)=>e?[]:[t]);o.set(t,{isEnabled:Yne(e)?r.length<n.length:r.length===0,featureAvailability:c,...r.length>0?{ineligibleSelectionIndices:r}:{}})}else o.set(t,{isEnabled:await u(n),featureAvailability:c})}catch{o.set(t,{isEnabled:!1,featureAvailability:c})}})),t||w(e=>rC(e,o)?e:o)})(),()=>{t=!0}},[o,e,n,s,l,r,i,f,S,p,m?.currentOrganizationId,g,a,d,_,v,y,b,x,h?.isEnabled]),C}function aC(e,t,n){let r=e(t,n,`title`);return r&&!r.startsWith(`resources.`)?r:n}function Jle(e){let{registry:t,resourceConfig:n,exportOperation:r,resourceType:i,contextResourceIdentifiers:a,contextualParameters:o,parentResourcesRequirements:s,apiBaseUrl:c,format:l,rowScope:u,listingQuery:d}=e;if(!n?.resourceFieldIdentifier||!r)return null;try{let e=It.buildOperationFrontendRoutePaths(n,r,t.allResourceFieldIdentifiers);if(e.length===0)return null;let i=gn.selectMatchingRoutePath(e,a,n.resourceIdentifier,n.resourceFieldIdentifier,s,t.allResourceFieldIdentifiers),f=Ch.resolveUrlPath(i.url,o);if(Ch.hasUnresolvedPlaceholders(f))return null;let p=new URLSearchParams;p.set(Ue,l),p.set(_ee,u);for(let[e,t]of Object.entries(d??{}))t!==void 0&&t!==``&&e!==`format`&&e!==`rowScope`&&oC(p,e,t);return`${c}${rt}${f}?${p.toString()}`}catch{return null}}function oC(e,t,n){if(n!=null&&n!==``){if(n instanceof Date)e.append(t,n.toISOString());else if(Array.isArray(n))e.append(t,String(n));else if(typeof n==`object`)for(let[r,i]of Object.entries(n))oC(e,`${t}[${r}]`,i);else e.append(t,String(n))}}async function Yle(e){eb(await e.getBlob(e.url),fre(String(e.resourceType),e.format,new Date))}function sC(e,t){if(!e)return[];let n=sr.getObjectLikeFieldShape(e,{commonOnly:!1});if(!n)return[];let r=[];for(let[e,i]of Object.entries(n))Iee(i)&&t[e]&&r.push({fieldName:e,value:t[e],schema:i});return r}var cC;(function(e){e.PANEL=`panel`,e.LIST=`list`})(cC||={});function lC(e){return e.type===`separator`?!1:e.type===`subgroup`?e.disabled===!0:e.disabled===!0||e.unavailability!==void 0}function uC(e,t){let n=new Set(e.slice(0,t)),r=new Set,i=[],a=()=>{let e=i.filter(e=>n.has(e)).length;for(let t of[...i.filter(e=>!lC(e)),...i.filter(lC)].slice(0,e))r.add(t);i=[]};for(let t of e)t.type===`separator`?(a(),n.has(t)&&r.add(t)):i.push(t);a();let o=e=>e.filter((t,n)=>t.type!==`separator`||n>0&&n<e.length-1&&e[n-1].type!==`separator`);return{displayedItems:o(e.filter(e=>r.has(e))),overflowItems:o(e.filter(e=>!r.has(e)))}}function dC({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_ACTION_BAR,`ActionBar`)(e);return(0,$.jsx)(n,{...t})}var fC=(0,Q.createContext)(!1);function pC({children:e}){return(0,$.jsx)(fC.Provider,{value:!0,children:e})}function mC(){return(0,Q.useContext)(fC)}function Xle(e,t,n,r){return V.buildConfigurationError(ii.CONFIGURATION,{component:e,message:`${e}() requires a ${t}-like operation host, but received "${n}" for operation "${r}".`,expectedKind:t,actualKind:n,operationIdentifier:r})}function Zle(e){let t=e?.currentObject??e?.resource;return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}function hC(e,t,n){if(!n)return e;let r=e[t];if(gn.getResourceId(r)===n)return e;let i=r?gn.getFieldIdentifier(r):void 0;return{...e,[t]:i?{fieldIdentifier:i,resourceId:n}:n}}function gC({resourceContext:e,navigationZone:t,navigationInitiator:n,updateLikeMutationFallbackMode:r}){let{registry:i,doOperation:a}=wm(),{navigateToResource:o,goBack:s}=zS(),{handleError:c}=up(),{resourceType:l,operation:u}=e,d=r??hl(u,i.resourceConfigurations[l]?.operations),f=String(u.operationIdentifier),p=(0,Q.useMemo)(()=>i.resourceConfigurations[l],[i,l]),m=(0,Q.useMemo)(()=>ul(u),[u]),h=(0,Q.useMemo)(()=>Zl(u),[u]),g=(0,Q.useMemo)(()=>Ch.createOperationInitiator(t,u),[t,u]),_=(0,Q.useMemo)(()=>Zle(e.additionalContext),[e.additionalContext]),v=(0,Q.useMemo)(()=>{let e=_?._id??(p?.resourceFieldIdentifier?_?.[p.resourceFieldIdentifier]:void 0);return typeof e==`string`&&e.length>0?e:void 0},[_,p?.resourceFieldIdentifier]),y=(0,Q.useMemo)(()=>hC(e.contextResourceIdentifiers,l,v),[v,e.contextResourceIdentifiers,l]),b=(0,Q.useMemo)(()=>({...e,contextResourceIdentifiers:y}),[y,e]),x=(0,Q.useMemo)(()=>V.buildContextualParameters(y,i),[y,i]),S=(0,Q.useCallback)(e=>!!gn.getResourceId(e[l]),[l]),C=(0,Q.useCallback)(()=>{s(t)},[s,t]),w=(0,Q.useCallback)((e,n,r)=>{c(e,n,{resourceType:l,operationId:f,navigationZone:t,component:r})},[c,t,f,l]),T=(0,Q.useCallback)(async e=>{if(Wc(u)&&!Un(d))throw new pa({surfaceName:`useResourceOperationSurface.executeCurrentOperation()`,resourceType:l,operationIdentifier:f});let t=gl.createOperationPathKeyFromOperation(u),n=Js({operation:u,requestData:e,additionalContext:b.additionalContext});return a(t,{contextualParameters:x,parentResourcesRequirements:b.parentResourcesRequirements,...n?{requestData:n}:{}})},[x,a,u,f,b.additionalContext,b.parentResourcesRequirements,l,d]),E=(0,Q.useCallback)((e,t)=>{if(p)return e===W.READ||e===W.UPDATE||e===W.DELETE?Th({resourceConfig:p,operations:p.operations??[],coreOperation:e,registry:i,hasResourceId:S(y),allowBulk:t?.allowBulk,requireFrontendAddressable:!0,contextResourceIdentifiers:y,contextualParameters:x}):Il(p.operations??[],e,t)},[x,S,i,p,y]),D=(0,Q.useCallback)(({operation:e,contextResourceIdentifiers:t=b.contextResourceIdentifiers,parentResourcesRequirements:n=b.parentResourcesRequirements,initiatorOverride:r,transitionOverride:a})=>{if(!p)return!1;let s=hC(t,l,v),c=V.buildContextualParameters(s,i);if(mh({operation:e,resourceType:l,resourceConfig:p})&&e.isBulkOperation!==!0&&!ih({resourceConfig:p,operation:e,registry:i,hasResourceId:S(s),contextResourceIdentifiers:s,contextualParameters:c}))return!1;let u=gn.createFrontendResourceOperationContextFromOperation({resourceType:l,operation:e,contextResourceIdentifiers:s,parentResourcesRequirements:n}),d=It.buildOperationFrontendRoutePaths(p,e,i.allResourceFieldIdentifiers),f=d.length>0?gn.selectMatchingRoutePath(d,u.contextResourceIdentifiers,l,p.resourceFieldIdentifier,n,i.allResourceFieldIdentifiers).url:void 0;return o(u,r??g,f,a),!0},[o,g,i,p,b.contextResourceIdentifiers,b.parentResourcesRequirements,l,S,v]);return{resourceContext:b,navigationZone:t,navigationInitiator:n,resourceType:l,operation:u,operationId:f,resourceConfig:p,effectiveCoreOperation:m,isSemanticCustomOperation:h,operationInitiator:g,contextualParameters:x,goBackWithinZone:C,reportError:w,executeCurrentOperation:T,resolvePreferredOperation:E,navigateToResourceOperation:D,navigateToPreferredRead:(0,Q.useCallback)(e=>{if(!p)return e?.fallbackToGoBack!==!1&&C(),!1;let t=hC(e?.contextResourceIdentifiers??b.contextResourceIdentifiers,l,v),n=e?.parentResourcesRequirements??b.parentResourcesRequirements,r=V.buildContextualParameters(t,i),a=Th({resourceConfig:p,operations:p.operations??[],coreOperation:W.READ,registry:i,hasResourceId:S(t),requireFrontendAddressable:!0,contextResourceIdentifiers:t,contextualParameters:r});return a?D({operation:a,contextResourceIdentifiers:t,parentResourcesRequirements:n,initiatorOverride:e?.initiatorOverride,transitionOverride:e?.transitionOverride}):(e?.fallbackToGoBack!==!1&&C(),!1)},[v,C,S,D,i,p,l,b.contextResourceIdentifiers,b.parentResourcesRequirements])}}function _C(e,t,n){let r=gC(e),i=ms(r.operation);if(i!==t)throw Xle(n,t,i,r.operationId);return r}function Qle(e){return _C(e,`read`,`useReadOperationSurface`)}function $le(e){return _C(e,`list`,`useListOperationSurface`)}function eue(e){return _C(e,`create`,`useCreateOperationSurface`)}function tue(e){return _C(e,`update`,`useUpdateOperationSurface`)}function nue(e){return _C(e,`search`,`useSearchOperationSurface`)}function rue(e){return _C(e,`action`,`useActionOperationSurface`)}var vC=(0,Q.createContext)(null);function yC(){let e=(0,Q.useContext)(vC);if(!e)throw Error(`useResourceOperationViewContext() must be used within a <ResourceOperationViewProvider>. This is provided automatically for routed resource operation layouts.`);return e}function bC(){return(0,Q.useContext)(vC)}function xC({resourceContext:e,navigationZone:t,navigationInitiator:n,inlineParentContext:r,children:i}){let a=gC({resourceContext:e,navigationZone:t,navigationInitiator:n}),o=(0,Q.useMemo)(()=>({...a,inlineParentContext:r}),[r,a]);return(0,$.jsx)(vC.Provider,{value:o,children:i})}var SC=e(jte(),1),CC=e=>e.type===`checkbox`,wC=e=>e instanceof Date,TC=e=>e==null,EC=e=>typeof e==`object`,DC=e=>!TC(e)&&!Array.isArray(e)&&EC(e)&&!wC(e),OC=e=>DC(e)&&e.target?CC(e.target)?e.target.checked:e.target.value:e,kC=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,AC=(e,t)=>e.has(kC(t)),jC=e=>{let t=e.constructor&&e.constructor.prototype;return DC(t)&&t.hasOwnProperty(`isPrototypeOf`)},MC=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function NC(e){if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(MC&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&!(DC(e)&&jC(e)))return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=NC(e[t]));return r}var PC=e=>/^\w*$/.test(e),FC=e=>e===void 0,IC=e=>Array.isArray(e)?e.filter(Boolean):[],LC=e=>IC(e.replace(/["|']|\]/g,``).split(/\.|\[/)),RC=(e,t,n)=>{if(!t||!DC(e))return n;let r=(PC(t)?[t]:LC(t)).reduce((e,t)=>TC(e)?e:e[t],e);return FC(r)||r===e?FC(e[t])?n:e[t]:r},zC=e=>typeof e==`boolean`,BC=e=>typeof e==`function`,VC=(e,t,n)=>{let r=-1,i=PC(t)?[t]:LC(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=DC(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(t===`__proto__`||t===`constructor`||t===`prototype`)return;e[t]=a,e=e[t]}},HC={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`},UC={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},WC={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},GC=Q.createContext(null);GC.displayName=`HookFormControlContext`;var KC=()=>Q.useContext(GC),qC=(e,t,n,r=!0)=>{let i={defaultValues:t._defaultValues};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==UC.all&&(t._proxyFormState[i]=!r||UC.all),n&&(n[i]=!0),e[i]}});return i},JC=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function YC(e){let t=KC(),{control:n=t,disabled:r,name:i,exact:a}=e||{},[o,s]=Q.useState(n._formState),c=Q.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return JC(()=>n._subscribe({name:i,formState:c.current,exact:a,callback:e=>{!r&&s({...n._formState,...e})}}),[i,r,a]),Q.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),Q.useMemo(()=>qC(o,n,c.current,!1),[o,n])}var XC=e=>typeof e==`string`,ZC=(e,t,n,r,i)=>XC(e)?(r&&t.watch.add(e),RC(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),RC(n,e))):(r&&(t.watchAll=!0),n),QC=e=>TC(e)||!EC(e);function $C(e,t,n=new WeakSet){if(QC(e)||QC(t))return Object.is(e,t);if(wC(e)&&wC(t))return Object.is(e.getTime(),t.getTime());let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(let a of r){let r=e[a];if(!i.includes(a))return!1;if(a!==`ref`){let e=t[a];if(wC(r)&&wC(e)||DC(r)&&DC(e)||Array.isArray(r)&&Array.isArray(e)?!$C(r,e,n):!Object.is(r,e))return!1}}return!0}function ew(e){let t=KC(),{control:n=t,name:r,defaultValue:i,disabled:a,exact:o,compute:s}=e||{},c=Q.useRef(i),l=Q.useRef(s),u=Q.useRef(void 0),d=Q.useRef(n),f=Q.useRef(r);l.current=s;let[p,m]=Q.useState(()=>{let e=n._getWatch(r,c.current);return l.current?l.current(e):e}),h=Q.useCallback(e=>{let t=ZC(r,n._names,e||n._formValues,!1,c.current);return l.current?l.current(t):t},[n._formValues,n._names,r]),g=Q.useCallback(e=>{if(!a){let t=ZC(r,n._names,e||n._formValues,!1,c.current);if(l.current){let e=l.current(t);$C(e,u.current)||(m(e),u.current=e)}else m(t)}},[n._formValues,n._names,a,r]);JC(()=>(d.current===n&&$C(f.current,r)||(d.current=n,f.current=r,g()),n._subscribe({name:r,formState:{values:!0},exact:o,callback:e=>{g(e.values)}})),[n,o,r,g]),Q.useEffect(()=>n._removeUnmounted());let _=d.current!==n,v=f.current,y=Q.useMemo(()=>{if(a)return null;let e=!_&&!$C(v,r);return _||e?h():null},[a,_,r,v,h]);return y===null?p:y}function iue(e){let t=KC(),{name:n,disabled:r,control:i=t,shouldUnregister:a,defaultValue:o,exact:s=!0}=e,c=AC(i._names.array,n),l=ew({control:i,name:n,defaultValue:Q.useMemo(()=>RC(i._formValues,n,RC(i._defaultValues,n,o)),[i,n,o]),exact:s}),u=YC({control:i,name:n,exact:s}),d=Q.useRef(e),f=Q.useRef(void 0),p=Q.useRef(i.register(n,{...e.rules,value:l,...zC(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;let m=Q.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!RC(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!RC(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!RC(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!RC(u.validatingFields,n)},error:{enumerable:!0,get:()=>RC(u.errors,n)}}),[u,n]),h=Q.useCallback(e=>p.current.onChange({target:{value:OC(e),name:n},type:HC.CHANGE}),[n]),g=Q.useCallback(()=>p.current.onBlur({target:{value:RC(i._formValues,n),name:n},type:HC.BLUR}),[n,i._formValues]),_=Q.useCallback(e=>{let t=RC(i._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>BC(e.focus)&&e.focus(),select:()=>BC(e.select)&&e.select(),setCustomValidity:t=>BC(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>BC(e.reportValidity)&&e.reportValidity()})},[i._fields,n]),v=Q.useMemo(()=>({name:n,value:l,...zC(r)||u.disabled?{disabled:u.disabled||r}:{},onChange:h,onBlur:g,ref:_}),[n,r,u.disabled,h,g,_,l]);return Q.useEffect(()=>{let e=i._options.shouldUnregister||a,t=f.current;t&&t!==n&&!c&&i.unregister(t),i.register(n,{...d.current.rules,...zC(d.current.disabled)?{disabled:d.current.disabled}:{}});let r=(e,t)=>{let n=RC(i._fields,e);n&&n._f&&(n._f.mount=t)};if(r(n,!0),e){let e=NC(RC(i._options.defaultValues,n,d.current.defaultValue));VC(i._defaultValues,n,e),FC(RC(i._formValues,n))&&VC(i._formValues,n,e)}return!c&&i.register(n),f.current=n,()=>{(c?e&&!i._state.action:e)?i.unregister(n):r(n,!1)}},[n,i,c,a]),Q.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),Q.useMemo(()=>({field:v,formState:u,fieldState:m}),[v,u,m])}var tw=e=>e.render(iue(e)),nw=Q.createContext(null);nw.displayName=`HookFormContext`;var rw=()=>Q.useContext(nw),iw=e=>{let{children:t,watch:n,getValues:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,trigger:c,formState:l,resetField:u,reset:d,handleSubmit:f,unregister:p,control:m,register:h,setFocus:g,subscribe:_}=e;return Q.createElement(nw.Provider,{value:Q.useMemo(()=>({watch:n,getValues:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,trigger:c,formState:l,resetField:u,reset:d,handleSubmit:f,unregister:p,control:m,register:h,setFocus:g,subscribe:_}),[o,m,l,i,r,f,h,d,u,a,g,s,_,c,p,n])},Q.createElement(GC.Provider,{value:m},t))},aue=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},aw=e=>Array.isArray(e)?e:[e],ow=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function sw(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&DC(i)&&a){let e=sw(i,a);DC(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var cw=e=>DC(e)&&!Object.keys(e).length,lw=e=>e.type===`file`,uw=e=>{if(!MC)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},dw=e=>e.type===`select-multiple`,fw=e=>e.type===`radio`,oue=e=>fw(e)||CC(e),pw=e=>uw(e)&&e.isConnected;function sue(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;)e=FC(e)?r++:e[t[r++]];return e}function cue(e){for(let t in e)if(e.hasOwnProperty(t)&&!FC(e[t]))return!1;return!0}function mw(e,t){let n=Array.isArray(t)?t:PC(t)?[t]:LC(t),r=n.length===1?e:sue(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(DC(r)&&cw(r)||Array.isArray(r)&&cue(r))&&mw(e,n.slice(0,-1)),e}var lue=e=>{for(let t in e)if(BC(e[t]))return!0;return!1};function hw(e){return Array.isArray(e)||DC(e)&&!lue(e)}function gw(e,t={}){for(let n in e){let r=e[n];hw(r)?(t[n]=Array.isArray(r)?[]:{},gw(r,t[n])):FC(r)||(t[n]=!0)}return t}function _w(e,t,n){n||=gw(t);for(let r in e){let i=e[r];if(hw(i))FC(t)||QC(n[r])?n[r]=gw(i,Array.isArray(i)?[]:{}):_w(i,TC(t)?{}:t[r],n[r]);else{let e=t[r];n[r]=!$C(i,e)}}return n}var vw={value:!1,isValid:!1},yw={value:!0,isValid:!0},bw=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!FC(e[0].attributes.value)?FC(e[0].value)||e[0].value===``?yw:{value:e[0].value,isValid:!0}:yw:vw}return vw},xw=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>FC(e)?e:t?e===``?NaN:e&&+e:n&&XC(e)?new Date(e):r?r(e):e,Sw={isValid:!1,value:null},Cw=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Sw):Sw;function ww(e){let t=e.ref;return lw(t)?t.files:fw(t)?Cw(e.refs).value:dw(t)?[...t.selectedOptions].map(({value:e})=>e):CC(t)?bw(e.refs).value:xw(FC(t.value)?e.ref.value:t.value,e)}var uue=(e,t,n,r)=>{let i={};for(let n of e){let e=RC(t,n);e&&VC(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},Tw=e=>e instanceof RegExp,Ew=e=>FC(e)?e:Tw(e)?e.source:DC(e)?Tw(e.value)?e.value.source:e.value:e,Dw=e=>({isOnSubmit:!e||e===UC.onSubmit,isOnBlur:e===UC.onBlur,isOnChange:e===UC.onChange,isOnAll:e===UC.all,isOnTouch:e===UC.onTouched}),Ow=`AsyncFunction`,due=e=>!!e&&!!e.validate&&!!(BC(e.validate)&&e.validate.constructor.name===Ow||DC(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===Ow)),fue=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),kw=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),Aw=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=RC(e,i);if(n){let{_f:e,...a}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r||e.ref&&t(e.ref,e.name)&&!r)return!0;if(Aw(a,t))break}else if(DC(a)&&Aw(a,t))break}}};function jw(e,t,n){let r=RC(e,n);if(r||PC(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=RC(t,r),o=RC(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var pue=(e,t,n,r)=>{n(e);let{name:i,...a}=e;return cw(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||UC.all))},mue=(e,t,n)=>!e||!t||e===t||aw(e).some(e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e))),hue=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e,gue=(e,t)=>!IC(RC(e,t)).length&&mw(e,t),Mw=(e,t,n)=>{let r=aw(RC(e,n));return VC(r,`root`,t[n]),VC(e,n,r),e};function Nw(e,t,n=`validate`){if(XC(e)||Array.isArray(e)&&e.every(XC)||zC(e)&&!e)return{type:n,message:XC(e)?e:``,ref:t}}var Pw=e=>DC(e)&&!Tw(e)?e:{value:e,message:``},Fw=async(e,t,n,r,i,a)=>{let{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:_}=e._f,v=RC(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{i&&y.reportValidity&&(y.setCustomValidity(zC(e)?``:e||``),y.reportValidity())},x={},S=fw(o),C=CC(o),w=S||C,T=(g||lw(o))&&FC(o.value)&&FC(v)||uw(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length,E=aue.bind(null,h,r,x),D=(e,t,n,r=WC.maxLength,i=WC.minLength)=>{let a=e?t:n;x[h]={type:e?r:i,message:a,ref:o,...E(e?r:i,a)}};if(a?!Array.isArray(v)||!v.length:c&&(!w&&(T||TC(v))||zC(v)&&!v||C&&!bw(s).isValid||S&&!Cw(s).isValid)){let{value:e,message:t}=XC(c)?{value:!!c,message:c}:Pw(c);if(e&&(x[h]={type:WC.required,message:t,ref:y,...E(WC.required,t)},!r))return b(t),x}if(!T&&(!TC(d)||!TC(f))){let e,t,n=Pw(f),i=Pw(d);if(!TC(v)&&!isNaN(v)){let r=o.valueAsNumber||v&&+v;TC(n.value)||(e=r>n.value),TC(i.value)||(t=r<i.value)}else{let r=o.valueAsDate||new Date(v),a=e=>new Date(new Date().toDateString()+` `+e),s=o.type==`time`,c=o.type==`week`;XC(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),XC(i.value)&&v&&(t=s?a(v)<a(i.value):c?v<i.value:r<new Date(i.value))}if((e||t)&&(D(!!e,n.message,i.message,WC.max,WC.min),!r))return b(x[h].message),x}if((l||u)&&!T&&(XC(v)||a&&Array.isArray(v))){let e=Pw(l),t=Pw(u),n=!TC(e.value)&&v.length>+e.value,i=!TC(t.value)&&v.length<+t.value;if((n||i)&&(D(n,e.message,t.message),!r))return b(x[h].message),x}if(p&&!T&&XC(v)){let{value:e,message:t}=Pw(p);if(Tw(e)&&!v.match(e)&&(x[h]={type:WC.pattern,message:t,ref:o,...E(WC.pattern,t)},!r))return b(t),x}if(m){if(BC(m)){let e=Nw(await m(v,n),y);if(e&&(x[h]={...e,...E(WC.validate,e.message)},!r))return b(e.message),x}else if(DC(m)){let e={};for(let t in m){if(!cw(e)&&!r)break;let i=Nw(await m[t](v,n),y,t);i&&(e={...i,...E(t,i.message)},b(i.message),r&&(x[h]=e))}if(!cw(e)&&(x[h]={ref:y,...e},!r))return x}}return b(!0),x},_ue={mode:UC.onSubmit,reValidateMode:UC.onChange,shouldFocusError:!0};function vue(e={}){let t={..._ue,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:BC(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=(DC(t.defaultValues)||DC(t.values))&&NC(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:NC(i),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,l=0,u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...u},f={...d},p={array:ow(),state:ow()},m=t.criteriaMode===UC.all,h=e=>t=>{clearTimeout(l),l=setTimeout(e,t)},g=async e=>{if(!o.keepIsValid&&!t.disabled&&(d.isValid||f.isValid||e)){let e;t.resolver?(e=cw((await w()).errors),_()):e=await E(r,!0),e!==n.isValid&&p.state.next({isValid:e})}},_=(e,r)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((e||Array.from(s.mount)).forEach(e=>{e&&(r?VC(n.validatingFields,e,r):mw(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!cw(n.validatingFields)}))},v=(e,s=[],c,l,u=!0,m=!0)=>{if(l&&c&&!t.disabled){if(o.action=!0,m&&Array.isArray(RC(r,e))){let t=c(RC(r,e),l.argA,l.argB);u&&VC(r,e,t)}if(m&&Array.isArray(RC(n.errors,e))){let t=c(RC(n.errors,e),l.argA,l.argB);u&&VC(n.errors,e,t),gue(n.errors,e)}if((d.touchedFields||f.touchedFields)&&m&&Array.isArray(RC(n.touchedFields,e))){let t=c(RC(n.touchedFields,e),l.argA,l.argB);u&&VC(n.touchedFields,e,t)}(d.dirtyFields||f.dirtyFields)&&(n.dirtyFields=_w(i,a)),p.state.next({name:e,isDirty:O(e,s),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else VC(a,e,s)},y=(e,t)=>{VC(n.errors,e,t),p.state.next({errors:n.errors})},b=e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},x=(e,t,n,s)=>{let c=RC(r,e);if(c){let r=RC(a,e,FC(n)?RC(i,e):n);FC(r)||s&&s.defaultChecked||t?VC(a,e,t?r:ww(c._f)):j(e,r),o.mount&&!o.action&&g()}},S=(e,r,a,o,s)=>{let c=!1,l=!1,u={name:e};if(!t.disabled){if(!a||o){(d.isDirty||f.isDirty)&&(l=n.isDirty,n.isDirty=u.isDirty=O(),c=l!==u.isDirty);let t=$C(RC(i,e),r);l=!!RC(n.dirtyFields,e),t?mw(n.dirtyFields,e):VC(n.dirtyFields,e,!0),u.dirtyFields=n.dirtyFields,c||=(d.dirtyFields||f.dirtyFields)&&l!==!t}if(a){let t=RC(n.touchedFields,e);t||(VC(n.touchedFields,e,a),u.touchedFields=n.touchedFields,c||=(d.touchedFields||f.touchedFields)&&t!==a)}c&&s&&p.state.next(u)}return c?u:{}},C=(e,r,i,a)=>{let o=RC(n.errors,e),s=(d.isValid||f.isValid)&&zC(r)&&n.isValid!==r;if(t.delayError&&i?(c=h(()=>y(e,i)),c(t.delayError)):(clearTimeout(l),c=null,i?VC(n.errors,e,i):mw(n.errors,e)),(i?!$C(o,i):o)||!cw(a)||s){let t={...a,...s&&zC(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},w=async e=>(_(e,!0),await t.resolver(a,t.context,uue(e||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),T=async e=>{let{errors:t}=await w(e);if(_(e),e)for(let r of e){let e=RC(t,r);e?VC(n.errors,r,e):mw(n.errors,r)}else n.errors=t;return t},E=async(r,i,o={valid:!0})=>{for(let c in r){let l=r[c];if(l){let{_f:r,...c}=l;if(r){let c=s.array.has(r.name),u=l._f&&due(l._f);u&&d.validatingFields&&_([r.name],!0);let f=await Fw(l,s.disabled,a,m,t.shouldUseNativeValidation&&!i,c);if(u&&d.validatingFields&&_([r.name]),f[r.name]&&(o.valid=!1,i||e.shouldUseNativeValidation))break;!i&&(RC(f,r.name)?c?Mw(n.errors,f,r.name):VC(n.errors,r.name,f[r.name]):mw(n.errors,r.name))}!cw(c)&&await E(c,i,o)}}return o.valid},D=()=>{for(let e of s.unMount){let t=RC(r,e);t&&(t._f.refs?t._f.refs.every(e=>!pw(e)):!pw(t._f.ref))&&re(e)}s.unMount=new Set},O=(e,n)=>!t.disabled&&(e&&n&&VC(a,e,n),!$C(ee(),i)),k=(e,t,n)=>ZC(e,s,{...o.mount?a:FC(t)?i:XC(e)?{[e]:t}:t},n,t),A=e=>IC(RC(o.mount?a:i,e,t.shouldUnregister?RC(i,e,[]):[])),j=(e,t,n={})=>{let i=RC(r,e),o=t;if(i){let n=i._f;n&&(!n.disabled&&VC(a,e,xw(t,n)),o=uw(n.ref)&&TC(t)?``:t,dw(n.ref)?[...n.ref.options].forEach(e=>e.selected=o.includes(e.value)):n.refs?CC(n.ref)?n.refs.forEach(e=>{e.defaultChecked&&e.disabled||(e.checked=Array.isArray(o)?!!o.find(t=>t===e.value):o===e.value||!!o)}):n.refs.forEach(e=>e.checked=e.value===o):lw(n.ref)?n.ref.value=``:(n.ref.value=o,n.ref.type||p.state.next({name:e,values:NC(a)})))}(n.shouldDirty||n.shouldTouch)&&S(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&I(e)},M=(e,t,n)=>{for(let i in t){if(!t.hasOwnProperty(i))return;let a=t[i],o=e+`.`+i,c=RC(r,o);(s.array.has(e)||DC(a)||c&&!c._f)&&!wC(a)?M(o,a,n):j(o,a,n)}},N=(e,t,c={})=>{let l=RC(r,e),u=s.array.has(e),m=NC(t);VC(a,e,m),u?(p.array.next({name:e,values:NC(a)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&c.shouldDirty&&p.state.next({name:e,dirtyFields:_w(i,a),isDirty:O(e,m)})):l&&!l._f&&!TC(m)?M(e,m,c):j(e,m,c),kw(e,s)?p.state.next({...n,name:e,values:NC(a)}):p.state.next({name:o.mount?e:void 0,values:NC(a)})},P=async e=>{o.mount=!0;let i=e.target,l=i.name,u=!0,h=RC(r,l),v=e=>{u=Number.isNaN(e)||wC(e)&&isNaN(e.getTime())||$C(e,RC(a,l,e))},y=Dw(t.mode),b=Dw(t.reValidateMode);if(h){let o,x,T=i.type?ww(h._f):OC(e),D=e.type===HC.BLUR||e.type===HC.FOCUS_OUT,O=!fue(h._f)&&!t.resolver&&!RC(n.errors,l)&&!h._f.deps||hue(D,RC(n.touchedFields,l),n.isSubmitted,b,y),k=kw(l,s,D);VC(a,l,T),D?i&&i.readOnly||(h._f.onBlur&&h._f.onBlur(e),c&&c(0)):h._f.onChange&&h._f.onChange(e);let A=S(l,T,D),j=!cw(A)||k;if(!D&&p.state.next({name:l,type:e.type,values:NC(a)}),O)return(d.isValid||f.isValid)&&(t.mode===`onBlur`?D&&g():D||g()),j&&p.state.next({name:l,...k?{}:A});if(!D&&k&&p.state.next({...n}),t.resolver){let{errors:e}=await w([l]);if(_([l]),v(T),u){let t=jw(n.errors,r,l),i=jw(e,r,t.name||l);o=i.error,l=i.name,x=cw(e)}}else _([l],!0),o=(await Fw(h,s.disabled,a,m,t.shouldUseNativeValidation))[l],_([l]),v(T),u&&(o?x=!1:(d.isValid||f.isValid)&&(x=await E(r,!0)));u&&(h._f.deps&&(!Array.isArray(h._f.deps)||h._f.deps.length>0)&&I(h._f.deps),C(l,x,o,A))}},F=(e,t)=>{if(RC(n.errors,t)&&e.focus)return e.focus(),1},I=async(e,i={})=>{let a,o,c=aw(e);if(t.resolver){let t=await T(FC(e)?e:c);a=cw(t),o=e?!c.some(e=>RC(t,e)):a}else e?(o=(await Promise.all(c.map(async e=>{let t=RC(r,e);return await E(t&&t._f?{[e]:t}:t)}))).every(Boolean),(o||n.isValid)&&g()):o=a=await E(r);return p.state.next({...!XC(e)||(d.isValid||f.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&Aw(r,F,e?c:s.mount),o},ee=(e,t)=>{let r={...o.mount?a:i};return t&&(r=sw(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),FC(e)?r:XC(e)?RC(r,e):e.map(e=>RC(r,e))},L=(e,t)=>({invalid:!!RC((t||n).errors,e),isDirty:!!RC((t||n).dirtyFields,e),error:RC((t||n).errors,e),isValidating:!!RC(n.validatingFields,e),isTouched:!!RC((t||n).touchedFields,e)}),R=e=>{let t=e?aw(e):void 0;t?.forEach(e=>mw(n.errors,e)),t?t.forEach(e=>{p.state.next({name:e,errors:n.errors})}):p.state.next({errors:{}})},te=(e,t,i)=>{let a=(RC(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=RC(n.errors,e)||{};VC(n.errors,e,{...l,...t,ref:a}),p.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},z=(e,t)=>BC(e)?p.state.subscribe({next:n=>`values`in n&&e(k(void 0,t),n)}):k(e,t,!0),B=e=>p.state.subscribe({next:t=>{mue(e.name,t.name,e.exact)&&pue(t,e.formState||d,pe,e.reRenderRoot)&&e.callback({values:{...a},...n,...t,defaultValues:i})}}).unsubscribe,ne=e=>(o.mount=!0,f={...f,...e.formState},B({...e,formState:{...u,...e.formState}})),re=(e,o={})=>{for(let c of e?aw(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||(mw(r,c),mw(a,c)),!o.keepError&&mw(n.errors,c),!o.keepDirty&&mw(n.dirtyFields,c),!o.keepTouched&&mw(n.touchedFields,c),!o.keepIsValidating&&mw(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&mw(i,c);p.state.next({values:NC(a)}),p.state.next({...n,...o.keepDirty?{isDirty:O()}:{}}),!o.keepIsValid&&g()},ie=({disabled:e,name:t})=>{if(zC(e)&&o.mount||e||s.disabled.has(t)){let n=s.disabled.has(t)!==!!e;e?s.disabled.add(t):s.disabled.delete(t),n&&o.mount&&!o.action&&g()}},ae=(e,n={})=>{let a=RC(r,e),c=zC(n.disabled)||zC(t.disabled);return VC(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a?ie({disabled:zC(n.disabled)?n.disabled:t.disabled,name:e}):x(e,!0,n.value),{...c?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:Ew(n.min),max:Ew(n.max),minLength:Ew(n.minLength),maxLength:Ew(n.maxLength),pattern:Ew(n.pattern)}:{},name:e,onChange:P,onBlur:P,ref:c=>{if(c){ae(e,n),a=RC(r,e);let t=FC(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=oue(t),s=a._f.refs||[];if(o?s.find(e=>e===t):t===a._f.ref)return;VC(r,e,{_f:{...a._f,...o?{refs:[...s.filter(pw),t,...Array.isArray(RC(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),x(e,!1,void 0,t)}else a=RC(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(AC(s.array,e)&&o.action)&&s.unMount.add(e)}}},oe=()=>t.shouldFocusError&&Aw(r,F,s.mount),se=e=>{zC(e)&&(p.state.next({disabled:e}),Aw(r,(t,n)=>{let i=RC(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},ce=(e,i)=>async o=>{let c;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=NC(a);if(p.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await w();_(),n.errors=e,l=NC(t)}else await E(r);if(s.disabled.size)for(let e of s.disabled)mw(l,e);if(mw(n.errors,`root`),cw(n.errors)){p.state.next({errors:{}});try{await e(l,o)}catch(e){c=e}}else i&&await i({...n.errors},o),oe(),setTimeout(oe);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:cw(n.errors)&&!c,submitCount:n.submitCount+1,errors:n.errors}),c)throw c},le=(e,t={})=>{RC(r,e)&&(FC(t.defaultValue)?N(e,NC(RC(i,e))):(N(e,t.defaultValue),VC(i,e,NC(t.defaultValue))),t.keepTouched||mw(n.touchedFields,e),t.keepDirty||(mw(n.dirtyFields,e),n.isDirty=t.defaultValue?O(e,NC(RC(i,e))):O()),t.keepError||(mw(n.errors,e),d.isValid&&g()),p.state.next({...n}))},ue=(e,c={})=>{let l=e?NC(e):i,u=NC(l),f=cw(e),m=f?i:u;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...Object.keys(_w(i,a))]);for(let t of Array.from(e)){let e=RC(n.dirtyFields,t),r=RC(a,t),i=RC(m,t);e&&!FC(r)?VC(m,t,r):!e&&!FC(i)&&N(t,i)}}else{if(MC&&FC(e))for(let e of s.mount){let t=RC(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(uw(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(c.keepFieldsRef)for(let e of s.mount)N(e,RC(m,e));else r={}}a=t.shouldUnregister?c.keepDefaultValues?NC(i):{}:NC(m),p.array.next({values:{...m}}),p.state.next({values:{...m}})}s={mount:c.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:``},o.mount=!d.isValid||!!c.keepIsValid||!!c.keepDirtyValues||!t.shouldUnregister&&!cw(m),o.watch=!!t.shouldUnregister,o.keepIsValid=!!c.keepIsValid,o.action=!1,c.keepErrors||(n.errors={}),p.state.next({submitCount:c.keepSubmitCount?n.submitCount:0,isDirty:f?!1:c.keepDirty?n.isDirty:!(!c.keepDefaultValues||$C(e,i)),isSubmitted:c.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:f?{}:c.keepDirtyValues?c.keepDefaultValues&&a?_w(i,a):n.dirtyFields:c.keepDefaultValues&&e?_w(i,e):c.keepDirty?n.dirtyFields:{},touchedFields:c.keepTouched?n.touchedFields:{},errors:c.keepErrors?n.errors:{},isSubmitSuccessful:c.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},de=(e,n)=>ue(BC(e)?e(a):e,{...t.resetOptions,...n}),fe=(e,t={})=>{let n=RC(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&BC(e.select)&&e.select()})}},pe=e=>{n={...n,...e}},me={control:{register:ae,unregister:re,getFieldState:L,handleSubmit:ce,setError:te,_subscribe:B,_runSchema:w,_updateIsValidating:_,_focusError:oe,_getWatch:k,_getDirty:O,_setValid:g,_setFieldArray:v,_setDisabledField:ie,_setErrors:b,_getFieldArray:A,_reset:ue,_resetDefaultValues:()=>BC(t.defaultValues)&&t.defaultValues().then(e=>{de(e,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:D,_disableForm:se,_subjects:p,_proxyFormState:d,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return s},set _names(e){s=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e}}},subscribe:ne,trigger:I,register:ae,handleSubmit:ce,watch:z,setValue:N,getValues:ee,reset:de,resetField:le,clearErrors:R,unregister:re,setError:te,setFocus:fe,getFieldState:L};return{...me,formControl:me}}var Iw=()=>{if(typeof crypto<`u`&&crypto.randomUUID)return crypto.randomUUID();let e=typeof performance>`u`?Date.now():performance.now()*1e3;return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let n=(Math.random()*16+e)%16|0;return(t==`x`?n:n&3|8).toString(16)})},Lw=(e,t,n={})=>n.shouldFocus||FC(n.shouldFocus)?n.focusName||`${e}.${FC(n.focusIndex)?t:n.focusIndex}.`:``,Rw=(e,t)=>[...e,...aw(t)],zw=e=>Array.isArray(e)?e.map(()=>void 0):void 0;function Bw(e,t,n){return[...e.slice(0,t),...aw(n),...e.slice(t)]}var Vw=(e,t,n)=>Array.isArray(e)?(FC(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[],Hw=(e,t)=>[...aw(t),...aw(e)];function yue(e,t){let n=0,r=[...e];for(let e of t)r.splice(e-n,1),n++;return IC(r).length?r:[]}var Uw=(e,t)=>FC(t)?[]:yue(e,aw(t).sort((e,t)=>e-t)),Ww=(e,t,n)=>{[e[t],e[n]]=[e[n],e[t]]},Gw=(e,t,n)=>(e[t]=n,e);function Kw(e){let t=KC(),{control:n=t,name:r,keyName:i=`id`,shouldUnregister:a,rules:o}=e,[s,c]=Q.useState(n._getFieldArray(r)),l=Q.useRef(n._getFieldArray(r).map(Iw)),u=Q.useRef(!1);n._names.array.add(r),Q.useMemo(()=>o&&s.length>=0&&n.register(r,o),[n,r,s.length,o]),JC(()=>n._subjects.array.subscribe({next:({values:e,name:t})=>{if(t===r||!t){let t=RC(e,r);Array.isArray(t)&&(c(t),l.current=t.map(Iw))}}}).unsubscribe,[n,r]);let d=Q.useCallback(e=>{u.current=!0,n._setFieldArray(r,e)},[n,r]);return Q.useEffect(()=>{if(n._state.action=!1,kw(r,n._names)&&n._subjects.state.next({...n._formState}),u.current&&(!Dw(n._options.mode).isOnSubmit||n._formState.isSubmitted)&&!Dw(n._options.reValidateMode).isOnSubmit){if(n._options.resolver)n._runSchema([r]).then(e=>{n._updateIsValidating([r]);let t=RC(e.errors,r),i=RC(n._formState.errors,r);(i?!t&&i.type||t&&(i.type!==t.type||i.message!==t.message):t&&t.type)&&(t?VC(n._formState.errors,r,t):mw(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{let e=RC(n._fields,r);e&&e._f&&!(Dw(n._options.reValidateMode).isOnSubmit&&Dw(n._options.mode).isOnSubmit)&&Fw(e,n._names.disabled,n._formValues,n._options.criteriaMode===UC.all,n._options.shouldUseNativeValidation,!0).then(e=>!cw(e)&&n._subjects.state.next({errors:Mw(n._formState.errors,e,r)}))}}n._subjects.state.next({name:r,values:NC(n._formValues)}),n._names.focus&&Aw(n._fields,(e,t)=>{if(n._names.focus&&t.startsWith(n._names.focus)&&e.focus)return e.focus(),1}),n._names.focus=``,n._setValid(),u.current=!1},[s,r,n]),Q.useEffect(()=>(!RC(n._formValues,r)&&n._setFieldArray(r),()=>{n._options.shouldUnregister||a?n.unregister(r):((e,t)=>{let r=RC(n._fields,e);r&&r._f&&(r._f.mount=t)})(r,!1)}),[r,n,i,a]),{swap:Q.useCallback((e,t)=>{let i=n._getFieldArray(r);Ww(i,e,t),Ww(l.current,e,t),d(i),c(i),n._setFieldArray(r,i,Ww,{argA:e,argB:t},!1)},[d,r,n]),move:Q.useCallback((e,t)=>{let i=n._getFieldArray(r);Vw(i,e,t),Vw(l.current,e,t),d(i),c(i),n._setFieldArray(r,i,Vw,{argA:e,argB:t},!1)},[d,r,n]),prepend:Q.useCallback((e,t)=>{let i=aw(NC(e)),a=Hw(n._getFieldArray(r),i);n._names.focus=Lw(r,0,t),l.current=Hw(l.current,i.map(Iw)),d(a),c(a),n._setFieldArray(r,a,Hw,{argA:zw(e)})},[d,r,n]),append:Q.useCallback((e,t)=>{let i=aw(NC(e)),a=Rw(n._getFieldArray(r),i);n._names.focus=Lw(r,a.length-1,t),l.current=Rw(l.current,i.map(Iw)),d(a),c(a),n._setFieldArray(r,a,Rw,{argA:zw(e)})},[d,r,n]),remove:Q.useCallback(e=>{let t=Uw(n._getFieldArray(r),e);l.current=Uw(l.current,e),d(t),c(t),!Array.isArray(RC(n._fields,r))&&VC(n._fields,r,void 0),n._setFieldArray(r,t,Uw,{argA:e})},[d,r,n]),insert:Q.useCallback((e,t,i)=>{let a=aw(NC(t)),o=Bw(n._getFieldArray(r),e,a);n._names.focus=Lw(r,e,i),l.current=Bw(l.current,e,a.map(Iw)),d(o),c(o),n._setFieldArray(r,o,Bw,{argA:e,argB:zw(t)})},[d,r,n]),update:Q.useCallback((e,t)=>{let i=NC(t),a=Gw(n._getFieldArray(r),e,i);l.current=[...a].map((t,n)=>!t||n===e?Iw():l.current[n]),d(a),c([...a]),n._setFieldArray(r,a,Gw,{argA:e,argB:i},!0,!1)},[d,r,n]),replace:Q.useCallback(e=>{let t=aw(NC(e));l.current=t.map(Iw),d([...t]),c([...t]),n._setFieldArray(r,[...t],e=>e,{},!0,!1)},[d,r,n]),fields:Q.useMemo(()=>s.map((e,t)=>({...e,[i]:l.current[t]||Iw()})),[s,i])}}function qw(e={}){let t=Q.useRef(void 0),n=Q.useRef(void 0),[r,i]=Q.useState({isDirty:!1,isValidating:!1,isLoading:BC(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:BC(e.defaultValues)?void 0:e.defaultValues});if(!t.current){if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!BC(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...i}=vue(e);t.current={...i,formState:r}}}let a=t.current.control;return a._options=e,JC(()=>{let e=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState}),reRenderRoot:!0});return i(e=>({...e,isReady:!0})),a._formState.isReady=!0,e},[a]),Q.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),Q.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),Q.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),Q.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),Q.useEffect(()=>{if(a._proxyFormState.isDirty){let e=a._getDirty();e!==r.isDirty&&a._subjects.state.next({isDirty:e})}},[a,r.isDirty]),Q.useEffect(()=>{e.values&&!$C(e.values,n.current)?(a._reset(e.values,{keepFieldsRef:!0,...a._options.resetOptions}),a._options.resetOptions?.keepIsValid||a._setValid(),n.current=e.values,i(e=>({...e}))):a._resetDefaultValues()},[a,e.values]),Q.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=Q.useMemo(()=>qC(r,a),[a,r]),t.current}function Jw({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_OPERATIONS_CONFIRM_CRITICAL,`OperationsConfirmCritical`)(e);return(0,$.jsx)(n,{...t})}function bue(e){let{resourceType:t,resourceConfiguration:n,formFieldShape:r,organizationUnitNarrowing:i}=e;return!r||!Object.prototype.hasOwnProperty.call(r,We)||n?.persistenceAdapter!==Cc.HTTP_API||!i?!1:i[t]?.unitFieldName!==We}function xue(e){let{resourceType:t,resourceConfiguration:n,formFieldShape:r,readThroughCreateOrganizationUnits:i}=e;if(r&&Object.prototype.hasOwnProperty.call(r,We)&&n?.persistenceAdapter===Cc.HTTP_API)return i?.[t]}function Yw(e){if(!e.registry.manyToManyScopeJunctions)return;let t=Nn.findScopeJunctionForTargetInContext(e.registry.manyToManyScopeJunctions,e.resourceType,new Set(Object.keys(e.contextualParameters)));if(!t)return;let n=e.contextualParameters[t.scopeFkField];if(!(typeof n!=`string`&&typeof n!=`number`||String(n).trim()===``))return{[t.scopeFkField]:n}}function Xw(e){return e==null||e===``?[]:Array.isArray(e)?e.filter(e=>typeof e==`string`&&e!==``):[e]}function Sue(e){let t=V.getResourceFieldIdentifierForType(e.resourceType,e.registry);return e.items.flatMap(n=>{let r=V.getResourceObjectId(n,t);return r?[{value:r,label:V.computeFrontendResourceLabel({resourceType:e.resourceType,registry:e.registry,currentObject:n,t:e.t,formatDate:e.formatDate,formatDateTime:e.formatDateTime})??r,data:n}]:[]})}function Zw(e){if(!e.operation)return;let t=V.selectOperationUrlInitiatorInfo({initiatorInfos:e.operation.initiatorInfos??[],contextualParameters:e.contextualParameters,targetResourceType:e.resourceType,targetDefaultFieldIdentifier:e.registry.resourceConfigurations?.[e.resourceType]?.resourceFieldIdentifier??e.registry.allResourceFieldIdentifiers?.[e.resourceType]??``});if(t)return gn.buildParentResourcesRequirementsFromRouteParams(t.parameters,e.resourceType,e.registry)}async function Qw(e){let t=Yw({resourceType:e.resourceType,registry:e.registry,contextualParameters:e.contextualParameters??{}});if(t){let n=Zw({operation:V.pickDefaultOperationFromConfig(e.registry,e.resourceType,W.SEARCH)??V.pickDefaultOperationFromConfig(e.registry,e.resourceType,W.LIST),resourceType:e.resourceType,registry:e.registry,contextualParameters:t}),r=await e.doOperation(V.buildForeignKeySearchOperationPath(e.resourceType,e.registry),{contextualParameters:t,...n?{parentResourcesRequirements:n,parentChainIsExact:!0}:{},queryParameters:{_id:e.id,limit:1},dataMode:V.foreignKeyReferenceDataMode(e.resourceType,e.registry)},{silent:!0,riskLevel:ls.LOW}),i=(Array.isArray(r)?r:r?.data??r?.items??[]).find(t=>t._id===e.id);if(!i)throw Error(`Reference ${e.resourceType}:${e.id} is not reachable within its scope.`);return{record:i,label:V.computeFrontendResourceLabel({resourceType:e.resourceType,registry:e.registry,currentObject:i,t:e.t,formatDate:e.formatDate,formatDateTime:e.formatDateTime})??e.id}}let n=V.buildForeignKeyFetchParams(e.resourceType,e.id,e.registry),r=e.registry.resourceConfigurations[e.resourceType],i={[e.resourceType]:e.id},a={...e.contextualParameters??{},...n.contextualParameters||{}},o=r?e.readOperation&&ih({resourceConfig:r,operation:e.readOperation,registry:e.registry,hasResourceId:gn.getResourceId(i[e.resourceType]).length>0,contextResourceIdentifiers:i,contextualParameters:a})?e.readOperation:Th({resourceConfig:r,operations:r.operations??[],coreOperation:W.READ,registry:e.registry,hasResourceId:!0,contextResourceIdentifiers:i,contextualParameters:a}):e.readOperation,s=V.buildForeignKeyReadOperationPath(e.resourceType,e.registry,o),c=e.parentResourcesRequirements??Zw({operation:V.resolveSingleResourceReadOperation(e.resourceType,e.registry,o),resourceType:e.resourceType,registry:e.registry,contextualParameters:a}),l=await e.doOperation(s,{contextualParameters:a,...c?{parentResourcesRequirements:c,parentChainIsExact:!0}:{}},{silent:!0,riskLevel:ls.LOW});return{record:l,label:V.computeFrontendResourceLabel({resourceType:e.resourceType,registry:e.registry,currentObject:l,t:e.t,formatDate:e.formatDate,formatDateTime:e.formatDateTime})??e.id}}function Cue(e){let{resourceType:t,ids:n,hostContextualParameters:r}=e,{registry:i,doOperation:a}=wm(),{t:o,formatDate:s,formatDateTime:c}=K({}),l=(0,Q.useRef)({registry:i,doOperation:a,t:o,formatDate:s,formatDateTime:c,hostContextualParameters:r});l.current={registry:i,doOperation:a,t:o,formatDate:s,formatDateTime:c,hostContextualParameters:r};let[u,d]=(0,Q.useState)({}),f=(n??[]).join(`|`);return(0,Q.useEffect)(()=>{let e=!1,r=(e,n)=>console.warn(`[useReferenceRecordLabels] The ${t} "${e}" could not be read; the choice shows its id.`,n),i=async e=>{let n=l.current,r=Il(n.registry.resourceConfigurations?.[t]?.operations??[],W.READ)??null,{label:i}=await Qw({resourceType:t,id:e,registry:n.registry,doOperation:n.doOperation,contextualParameters:Zm({hostIdentifiers:{},hostContextualParameters:n.hostContextualParameters,targetResourceType:t,targetId:e,registry:n.registry}).contextualParameters,readOperation:r,t:n.t,formatDate:n.formatDate,formatDateTime:n.formatDateTime});return typeof i==`string`&&i.length>0?i:void 0};for(let t of n??[])u[t]===void 0&&i(t).then(n=>{!e&&n!==void 0&&d(e=>({...e,[t]:n}))}).catch(e=>r(t,e));return()=>{e=!0}},[t,f]),(0,Q.useMemo)(()=>u,[u])}function wue(e){if(!e.roleEntries||e.roleTables.unresolvableRoles!==kne.INERT)return;let{appRolesConfig:t,orgRolesConfig:n}=e.roleTables;return vre({roleEntries:e.roleEntries,organizationId:e.organizationId,resolveHierarchy:(e,r)=>is(e,r===td.APPLICATION?t:n),resolveRolesWithinAuthority:_ie(e.rolesWithinAuthority)})}function Tue(e){let t=sc(e)===bc.ARRAY?te(e):e;return t&&sc(t)===bc.ENUM?qc(t):[]}function $w(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.length>0):typeof e==`string`&&e.length>0?[e]:[]}function Eue(e){let{fieldShape:t,ceiling:n,record:r}=e;if(!t||!n)return;let i={};for(let[e,a]of Object.entries(t)){if(!Zc(a))continue;let t=Tue(a);t.length!==0&&(i[e]={values:jo(n,t,$w(r?.[e]))})}return Object.keys(i).length>0?i:void 0}function Due(e){let{fieldShape:t,ceiling:n,record:r}=e;if(!t||!n||n.kind===Ll.UNBOUNDED)return;let i={};for(let[e,a]of Object.entries(t))Zc(a)&&sc(a)===bc.STRING&&et(a)===Qs.ORGANIZATION_ROLE&&(i[e]=jo(n,[...n.grantableRoles],$w(r?.[e])));return Object.keys(i).length>0?i:void 0}var eT=zs(J.LOW_LEVEL_ALERT_DIALOG,`AlertDialog`,[`Trigger`,`Content`,`Header`,`Footer`,`Title`,`Description`,`Action`,`Cancel`]);function tT({preset:e=q.DEFAULT,...t}){let n=eT(e);return(0,$.jsx)(n,{...t})}var nT=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=eT(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});nT.displayName=`AlertDialogTrigger`;var rT=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=eT(e);return(0,$.jsx)(r.Content,{...t,ref:n})});rT.displayName=`AlertDialogContent`;function iT({preset:e=q.DEFAULT,...t}){let n=eT(e);return(0,$.jsx)(n.Header,{...t})}function aT({preset:e=q.DEFAULT,...t}){let n=eT(e);return(0,$.jsx)(n.Footer,{...t})}var oT=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=eT(e);return(0,$.jsx)(r.Title,{...t,ref:n})});oT.displayName=`AlertDialogTitle`;var sT=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=eT(e);return(0,$.jsx)(r.Description,{...t,ref:n})});sT.displayName=`AlertDialogDescription`;function cT({preset:e=q.DEFAULT,...t}){let n=eT(e);return(0,$.jsx)(n.Action,{...t})}function lT({preset:e=q.DEFAULT,...t}){let n=eT(e);return(0,$.jsx)(n.Cancel,{...t})}var uT=(0,Q.createContext)(void 0);function dT({formChromeMode:e,sectionChromeMode:t,children:n}){let r=(0,Q.useMemo)(()=>({formChromeMode:e,sectionChromeMode:t}),[e,t]);return(0,$.jsx)(uT.Provider,{value:r,children:n})}function fT(){return(0,Q.useContext)(uT)??{}}function pT(e){if(e.path?.length){let t=``;for(let n of e.path){let e=typeof n==`object`?n.key:n;if(typeof e==`string`||typeof e==`number`)t+=t?`.${e}`:e;else return null}return t}return null}var mT;(function(e){e.REQUEST_DTO=`request-dto`,e.MAIN_SCHEMA=`main-schema`})(mT||={});var hT;(function(e){e.IDLE=`idle`,e.SAVING=`saving`,e.SAVED=`saved`,e.ERROR=`error`})(hT||={});var gT=(0,Q.createContext)(null);function _T({schema:e,schemaKind:t=mT.REQUEST_DTO,form:n,resourceType:r,validationMode:i,validateFieldUrl:a,resourceId:o,operationType:s,contextResourceIdentifiers:c,parentResourcesRequirements:l,navigationZone:u,children:d}){let f=c?JSON.stringify(Object.entries(c).sort(([e],[t])=>e.localeCompare(t))):void 0,p=l?JSON.stringify(l):void 0,m=(0,Q.useMemo)(()=>({schema:e,schemaKind:t,form:n,resourceType:r,validationMode:i,validateFieldUrl:a,resourceId:o,operationType:s,contextResourceIdentifiers:c,parentResourcesRequirements:l,navigationZone:u}),[e,t,n,r,i,a,o,s,f,p,u]);return(0,$.jsx)(gT.Provider,{value:m,children:(0,$.jsx)(iw,{...n,children:d})})}var vT=`server`,yT=`server-unique`,bT=`_root`,xT=`record-duplicate-key`,ST=(e,t,n)=>{if(e&&`reportValidity`in e){let r=RC(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},CT=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?ST(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>ST(t,n,e))}},wT=(e,t)=>{t.shouldUseNativeValidation&&CT(e,t);let n={};for(let r in e){let i=RC(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.refs?i.refs[0]:i&&i.ref});if(TT(t.names||Object.keys(e),r)){let e=Object.assign({},RC(n,r));VC(e,`root`,a),VC(n,r,e)}else VC(n,r,a)}return n},TT=(e,t)=>{let n=DT(t);return e.some(e=>ET(e).match(`^${n}\\.\\d+`))};function ET(e){return e.replace(/\[(\d+)]/g,`.$1`).replace(/[[\]]/g,``)}function DT(e){return ET(e).replace(/[.*+?^${}()|\\]/g,`\\$&`)}var OT=new Set([`code`,`message`,`path`,`input`]);function kT(e){let t={};for(let[n,r]of Object.entries(e))OT.has(n)||(t[n]=r);return Object.keys(t).length>0?t:void 0}function AT(e,t){let n={};for(let r of e){let e=pT(r)||`_root`,i=r.code,a=typeof i==`string`?i:``;if(!n[e]){let t=kT(r);n[e]={message:r.message,type:a,...t?{params:t}:{}}}if(t){let t=n[e].types||{};n[e].types={...t,[a||Object.keys(t).length]:r.message}}}return n}function jT(e){return AT(e,!1)}function MT(e,t={}){return async(n,r,i)=>{let a=e[`~standard`].validate(n);if(a instanceof Promise&&(a=await a),a.issues)return{values:{},errors:wT(AT(a.issues,!i.shouldUseNativeValidation&&i.criteriaMode===`all`),i)};let o=a.value;return i.shouldUseNativeValidation&&CT({},i),{values:t.raw?Object.assign({},n):o,errors:{}}}}function NT(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date)}function PT(e){try{return e.safeParse(void 0).success&&!e.safeParse([]).success}catch{return!1}}function FT(e){if(Ju(e)!==null)return!0;let t=Nr(e);return tn(t)===`union`&&(t.options??[]).some(e=>Ju(e)!==null)}function IT(e,t){if(!t||!NT(e)||!FT(t))return e;let n=cs(t),r;for(let i of Object.keys(e)){let a=xo(t,i);if(!a)continue;let o=e[i],s=o;if(Array.isArray(o)){if(o.length===0){if(!n&&PT(a)){r??={...e},delete r[i];continue}}else{let e=te(a);if(e&&FT(e)){let t=o.map(t=>IT(t,e));t.some((e,t)=>e!==o[t])&&(s=t)}}}else NT(o)&&FT(a)&&(s=IT(o,a));s!==o&&(r??={...e},r[i]=s)}return r??e}function LT(e){(0,Q.useEffect)(()=>{let t=e.watch((t,{name:n,type:r})=>{if(r!==`change`&&n===void 0)return;let i=e.getFieldState(bT).error;i&&i.type!==`server`&&i.type!==`server-unique`&&e.trigger(bT)});return()=>t.unsubscribe()},[e])}var RT=Q.createContext(void 0);function zT(e,t){return async(n,r,i)=>{let a=await e(n,r,i),o={};Object.assign(o,a.errors);for(let{name:e,message:n}of t.values())RC(o,e)||VC(o,e,{type:`file-validation`,message:n});return Object.keys(o).length>0?{values:{},errors:o}:a}}function BT({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_CONTENT_SECTION,`ContentSection`)(e);return(0,$.jsx)(n,{...t})}function VT({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_CONTENT_SECTION_GROUP,`ContentSectionGroup`)(e);return(0,$.jsx)(n,{...t})}function HT({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_CONTENT_SECTION_LEGEND,`ContentSectionLegend`)(e);return(0,$.jsx)(n,{...t})}var UT=pr.ON_BLUR,WT;(function(e){e.FORM=`form`,e.DISPLAY=`display`})(WT||={});var GT;(function(e){e.DISPLAY=`display`,e.EDITING=`editing`,e.SAVING=`saving`,e.SAVED=`saved`,e.ERROR=`error`})(GT||={});function KT({schema:e,schemaKind:t,validationSchema:n,defaultValues:r,onSubmit:i,onError:a,validationMode:o,children:s,className:c,disabled:l,id:u,resourceType:d,onFormReady:f,warnOnUnsavedChanges:p=!1,validateFieldUrl:m,resourceId:h,operationType:g,contextResourceIdentifiers:_,parentResourcesRequirements:v,navigationZone:y}){let b=o??UT,x=n??e,S=Q.useRef(new Map).current,C=MT(x),w=qw({resolver:zT(((e,t,n)=>C(IT(e,x),t,n)),S),defaultValues:r,mode:b,disabled:l});LT(w),(0,Q.useEffect)(()=>{if(!p)return;let e=e=>{w.formState.isDirty&&e.preventDefault()};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[p,w.formState.isDirty]),(0,Q.useEffect)(()=>{f&&f({setError:(e,t)=>w.setError(e,t),clearErrors:e=>w.clearErrors(e),watch:w.watch,reset:w.reset,getValues:w.getValues,setValue:w.setValue,trigger:w.trigger,handleSubmit:w.handleSubmit,formState:w.formState,getFieldState:w.getFieldState,resetField:w.resetField})},[f,w]);let T=w.handleSubmit(async e=>{await i(e)},e=>{a?.(e)});return(0,$.jsx)(_T,{schema:e,schemaKind:t,form:w,resourceType:d,validationMode:o,validateFieldUrl:m,resourceId:h,operationType:g,contextResourceIdentifiers:_,parentResourcesRequirements:v,navigationZone:y,children:(0,$.jsx)(RT.Provider,{value:S,children:(0,$.jsx)(`form`,{id:u,onSubmit:T,className:c,noValidate:!0,"data-testid":`form`,children:(0,$.jsx)(BT,{disabled:l,className:`contents`,children:s})})})})}KT.displayName=`Form`;var qT=KT,JT=(0,Q.createContext)(null);function YT({value:e,children:t}){return(0,$.jsx)(JT.Provider,{value:e,children:t})}function XT(){let e=(0,Q.useContext)(JT);if(!e)throw Error(`useFormTemplateContext() must be used within a <FormTemplateProvider>. This is provided automatically by AutomatedForm.`);return e}function ZT(){return(0,Q.useContext)(JT)}function QT(e,t){return e===void 0?t!==`update`:!El(e)}function $T(e){return e.match(/[^.[\]]+/g)??[]}function eE(e,t){if(t.length===0||typeof e!=`object`||!e)return e;let[n,...r]=t;if(Array.isArray(e)){let t=Number(n);if(!Number.isInteger(t)||t<0||t>=e.length)return e;let i=[...e];return r.length===0?(i.splice(t,1),i):(i[t]=eE(i[t],r),i)}let i=e;if(!Object.prototype.hasOwnProperty.call(i,n))return e;let a={...i};return r.length===0?(delete a[n],a):(a[n]=eE(a[n],r),a)}function tE(e,t){if(t.length===0)return e;if(typeof e!=`object`||!e)return;let[n,...r]=t;if(Array.isArray(e)){let t=Number(n);return!Number.isInteger(t)||t<0||t>=e.length?void 0:tE(e[t],r)}let i=e;if(Object.prototype.hasOwnProperty.call(i,n))return tE(i[n],r)}function nE(e,t,n){if(t.length===0)return n;let[r,...i]=t;if(Number.isInteger(Number(r))){let t=Number(r),a=Array.isArray(e)?[...e]:[];return a[t]=nE(a[t],i,n),a}let a=typeof e==`object`&&e&&!Array.isArray(e)?e:{};return{...a,[r]:nE(a[r],i,n)}}function rE(e,t){let n={};for(let r of t){let t=$T(r);if(t.length===0)continue;let i=tE(e,t);i!==void 0&&(n=nE(n,t,i))}return n}function Oue(e,t,n){let r=$T(t);return r.length===0?e:nE(e,r,n)}function kue(e,t,n){if(!n)return e;let r=new Set(t.map($T).filter(e=>e.length===1).map(e=>e[0])),i=new Set,a=e;for(let o of t){let t=$T(o);if(t.length<2)continue;let s=t[0];if(r.has(s))continue;let c=tE(e,t);if(c!==void 0){if(!i.has(s)){i.add(s);let e=n[s];typeof e==`object`&&e&&(a={...a,[s]:e})}a=nE(a,t,c)}}return a}function Aue(e,t){let n={};for(let[r,i]of Object.entries(e))(i!==null||jue(t,r))&&(n[r]=i);return n}function jue(e,t){if(!e)return!1;let n=xo(e,t);return n?n.safeParse(null).success:!1}function iE(e,t){let n=t.omitClearedFields?Aue(e,t.schema):e;for(let e of t.hiddenFieldNames??[]){let t=$T(e);t.length!==0&&(n=eE(n,t))}if(t.contextFieldValues&&Object.keys(t.contextFieldValues).length>0)for(let[e,r]of Object.entries(t.contextFieldValues)){let t=$T(e);t.length!==0&&(n=nE(n,t,r))}return n}function aE(e){return e!==void 0&&Pn(e)}function oE(e,t){let n=Ju(e);return n&&Object.hasOwn(n,t)?n[t]:void 0}function sE(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date)}function cE(e,t){let n=new Set;for(let r of e){let[e,...i]=$T(r);if(e===void 0)continue;let a=e,o=t?xo(t,e):void 0;if(o!==void 0&&!o.safeParse(void 0).success)n.add(a);else{for(let e of i){if(!aE(o))break;a=`${a}.${e}`,o=oE(o,e)}n.add(a)}}let r=[...n];return r.filter(e=>!r.some(t=>t!==e&&e.startsWith(`${t}.`)))}function Mue(e,t){let n=e=>e==null||e===``||e===!1||Array.isArray(e)&&e.length===0;return n(e)?!n(t):!(0,SC.default)(e,t)}function Nue(e){let t=new Set(e.writtenAsHeld??[]),n=new Set(e.variantFields??[]),r={},i=(e,t,n,a)=>{if(aE(n)&&sE(e))for(let[r,o]of Object.entries(e))i(o,sE(t)?t[r]:void 0,oE(n,r),`${a}.${r}`);else Mue(e,t)&&(r[a]=e===void 0||e===``?null:e)};for(let[a,o]of Object.entries(e.values)){let s=e.schema?xo(e.schema,a):void 0,c=s!==void 0&&!n.has(a)&&!s.safeParse(void 0).success;t.has(a)||c?o!==void 0&&(r[a]=o):i(o,e.seed?.[a],s,a)}let a=Object.keys(e.clears??{});for(let t of a)if(!a.some(e=>t.startsWith(`${e}.`))){for(let e of Object.keys(r))(e===t||e.startsWith(`${t}.`))&&delete r[e];r[t]=e.clears[t]}return r}function lE(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>t.some(t=>e===t||e.startsWith(`${t}.`)||t.startsWith(`${e}.`))))}var uE;(function(e){e.CLEAR=`clear`,e.EMPTY=`empty`,e.TURN_OFF=`turn_off`})(uE||={});function Pue(e,t,n,r=[]){if(!t||!n||r.includes(e))return;let i=cE([e],n);if(i.length!==1||i[0]!==e)return;let a;if(e.includes(`.`)){let n=vs(t,e);a=n?Ie(n):void 0}else if(a=xo(t,e),a&&!a.safeParse(void 0).success)return;if(!a)return;let o=a,s=tn(Nr(o)),c=s===`boolean`?{kind:uE.TURN_OFF,value:!1}:s===`array`?{kind:uE.EMPTY,value:[]}:{kind:uE.CLEAR,value:null};return o.safeParse(c.value).success?c:void 0}function Fue(e){return e.writesRecordFields||e.hasCallerSectionHandler}function dE(e){if(!e)return;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`||typeof r==`number`?t[n]=r:r!=null&&typeof r!=`object`&&(t[n]=String(r));return Object.keys(t).length>0?t:void 0}function fE(e,t,n,r){if(e)for(let[i,a]of Object.entries(e)){if(a.title)n[i]=a.title;else if(a.titleKey){let e=t(a.titleKey);e!==a.titleKey&&(n[i]=e)}if(a.description)r[i]=a.description;else if(a.descriptionKey){let e=t(a.descriptionKey);e!==a.descriptionKey&&(r[i]=e)}}}function pE(e,t,n){return e===t?n:n===sr.unresolvedFieldLabel(e)?sr.unresolvedFieldLabel(t):n}function mE(e,t,n,r=`display`,i={}){let{t:a,tResourceFieldDisplay:o,tResourceFieldEdit:s,tResourceFieldEnumValue:c,tResourceSection:l,tResourceWizardStep:u,isReady:d}=K({resource:t?.resourceType}),{layoutRefs:f,overrides:p,fieldPathPrefix:m}=i,h=(0,Q.useCallback)(e=>m?`${m}.${e}`:e,[m]),g=(0,Q.useMemo)(()=>{let i={},a=dE(n),c;try{c=al(e)}catch{return p?.fields??{}}if(c.length===0)return p?.fields??{};for(let{path:e,leaf:n}of c){if(p?.fields?.[e]){i[e]=p.fields[e];continue}let c=h(e);i[e]=t?pE(c,n,(r===`edit`?s:o)(t.resourceType,c,`label`,a)):pE(c,n,o(``,c,`label`,a))}return i},[e,t,n,r,p?.fields,h,o,s]),_=(0,Q.useMemo)(()=>{let i={},a=dE(n),c;try{c=al(e)}catch{return p?.descriptions??{}}for(let{path:e}of c)if(p?.descriptions?.[e])i[e]=p.descriptions[e];else if(t){let n=(r===`edit`?s:o)(t.resourceType,h(e),`description`,a);n&&(i[e]=n)}return i},[e,t,n,r,p?.descriptions,h,o,s]),v=(0,Q.useMemo)(()=>{let n={},i;try{i=sr.getObjectLikeFieldShape(e,{commonOnly:!1})}catch{return{}}if(!i)return{};for(let[e,a]of Object.entries(i))if((r===`display`?Ys(a)?.tooltip===!0:uo(a)?.tooltip===!0)&&t){let i=(r===`edit`?s:o)(t.resourceType,h(e),`tooltip`);i&&(n[e]=i)}return n},[e,t,r,h,o,s]),y=(0,Q.useMemo)(()=>{let n={},r;try{r=al(e)}catch{return p?.enums??{}}for(let{path:e,schema:i}of r){let r=Dc(i);if(r){if(p?.enums?.[e])n[e]=p.enums[e];else if(t){let a=qc(r);if(a.length>0){let r={};for(let n of a)r[n]=c(t.resourceType,h(e),n,i);n[e]=r}}}}return n},[e,t,p?.enums,h,c]),b=(0,Q.useMemo)(()=>{let e={},n={};if(fE(p?.sections,a,e,n),t&&f?.sections){let{resourceType:r}=t;for(let t of f.sections)if(e[t]||(e[t]=l(r,t,`title`)),!n[t]){let e=l(r,t,`description`);e&&(n[t]=e)}}return{labels:e,descriptions:n}},[t,f?.sections,p?.sections,a,l]),x=b.labels,S=b.descriptions,C=(0,Q.useMemo)(()=>{let e={},n={};if(fE(p?.wizardSteps,a,e,n),t&&f?.wizardSteps){let{resourceType:r}=t;for(let t of f.wizardSteps)if(e[t]||(e[t]=u(r,t,`title`)),!n[t]){let e=u(r,t,`description`);e&&(n[t]=e)}}return{labels:e,descriptions:n}},[t,f?.wizardSteps,p?.wizardSteps,a,u]);return{fieldLabels:g,fieldDescriptions:_,fieldTooltips:v,enumLabels:y,sectionLabels:x,sectionDescriptions:S,wizardStepLabels:C.labels,wizardStepDescriptions:C.descriptions,groupLabels:(0,Q.useMemo)(()=>{let e={};if(t&&f?.groups){let{resourceType:n}=t;for(let t of f.groups){let r=`resources.${n}.groups.${t}.title`,i=a(r);i&&i!==r&&(e[t]=i)}}return e},[t,f?.groups,a]),isReady:d}}function hE({schema:e,defaultValues:t,onSubmit:n,onError:r,validationMode:i,className:a,disabled:o,readOnly:s,id:c,warnOnUnsavedChanges:l=!1,labels:u,operationRef:d,operationType:f,operationLike:p,coreOperation:m,layoutRefs:h,fileUploadContext:g,contextFieldValues:_,hiddenFieldNames:v,generatedFieldOverrides:y,allowedValuesByField:b,roleGrantPickerOffersByField:x,requestFieldOffers:S,requestFieldOfferRecord:C,inheritanceConfig:w,chromeMode:T,onSectionSave:E,onFormReady:D,validateFieldUrl:O,resourceType:k,hostResolvesRelationshipRoots:A,resourceId:j,contextResourceIdentifiers:M,parentResourcesRequirements:N,navigationZone:P,layoutTemplate:F}){let{tComponent:I,isReady:ee}=K({component:J.LOW_LEVEL_FORM_MESSAGE}),{fieldLabels:L,fieldDescriptions:R,fieldTooltips:te,enumLabels:z,sectionLabels:B,sectionDescriptions:ne,wizardStepLabels:re,wizardStepDescriptions:ie,groupLabels:ae,isReady:oe}=mE(e,u?.resourceContext,t,`edit`,{layoutRefs:h,overrides:{fields:u?.fields,descriptions:u?.descriptions,enums:u?.enums,sections:u?.sections,wizardSteps:u?.wizardSteps}}),se=(0,Q.useMemo)(()=>!_||Object.keys(_).length===0?t:{...t,..._},[t,_]),ce=QT(m,p||f),le=(0,Q.useContext)(Mi)?.appConfig,ue=(0,Q.useRef)(new Map),de=(0,Q.useCallback)((e,t)=>{ue.current.set(e,t)},[]),fe=(0,Q.useCallback)(e=>{if(!S)return e;let t=Object.fromEntries(Object.entries(S).map(([t,n])=>[t,(n.readsReferences?ue.current.get(t):void 0)??so(n,{appConfig:le,currentObject:C,values:e,references:{}})]));return nie(e,t)},[S,C,le]),pe=(0,Q.useMemo)(()=>t=>n(iE(fe(t),{hiddenFieldNames:v,contextFieldValues:_,omitClearedFields:ce,schema:e})),[n,_,v,ce,fe]),me=(0,Q.useMemo)(()=>{if(E)return(t,n,r)=>{let i=n.length>0?rE(r,n):r;return E(t,n,iE(fe(i),{hiddenFieldNames:v,contextFieldValues:_,omitClearedFields:ce,schema:e}))}},[E,_,v,ce,fe]),he=(0,Q.useMemo)(()=>({schema:e,fieldLabels:L,fieldDescriptions:R,fieldTooltips:te,enumLabels:z,sectionLabels:B,sectionDescriptions:ne,groupLabels:ae,wizardStepLabels:re,wizardStepDescriptions:ie,readOnly:s,disabled:o,fileUploadContext:g,contextFieldValues:_,hiddenFieldNames:v,generatedFieldOverrides:y,allowedValuesByField:b,roleGrantPickerOffersByField:x,requestFieldOffers:S,requestFieldOfferRecord:C,reportRequestFieldOffer:de,onSectionSave:me,operationType:p||f,operationRef:d,isExisting:(p||f)===`update`,inheritanceConfig:w,hostResolvesRelationshipRoots:A}),[e,L,R,te,z,B,ne,ae,re,ie,s,o,g,_,v,y,b,x,S,C,de,w,A,me,p,f,d]);if(!ee||!oe){let e=Math.min(Math.max(Object.keys(L??{}).length,1),8);return(0,$.jsx)(`div`,{className:U(`space-y-section`,a),role:`status`,"aria-busy":`true`,"aria-live":`polite`,children:Array.from({length:e}).map((e,t)=>(0,$.jsxs)(`div`,{className:`space-y-element`,children:[(0,$.jsx)(Tm,{className:`h-4 w-28`}),(0,$.jsx)(Tm,{className:`h-9 w-full`})]},t))})}return(0,$.jsx)(qT,{schema:e,defaultValues:se,onSubmit:pe,onError:r,validationMode:i,className:a,disabled:o,id:c,onFormReady:D,warnOnUnsavedChanges:l,validateFieldUrl:O,resourceType:k,resourceId:j,operationType:p||f,contextResourceIdentifiers:M,parentResourcesRequirements:N,navigationZone:P,children:(0,$.jsx)(YT,{value:he,children:(0,$.jsx)(dT,{formChromeMode:T,children:(0,$.jsx)(F,{})})})})}hE.displayName=`AutomatedForm`;var gE=hE,_E=(0,Q.createContext)(null);function vE({value:e,children:t}){return(0,$.jsx)(_E.Provider,{value:e,children:t})}function yE(){return(0,Q.useContext)(_E)}function bE(){let e=yE();return!e||e.footerClaimed?null:(0,$.jsxs)(`div`,{className:`mt-section flex flex-col gap-element`,children:[e.submissionNotice,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-element`,children:[e.cancelButton,e.draftSaveButton,e.submitButton]})]})}var xE;(function(e){e.IDLE=`IDLE`,e.QUEUED=`QUEUED`,e.SAVING=`SAVING`,e.ERROR=`ERROR`,e.CONFLICT=`CONFLICT`,e.DELETED=`DELETED`})(xE||={});var SE;(function(e){e.MUTATION_RESULT=`mutation_result`,e.REMOTE_UPDATE=`remote_update`,e.CONFLICT_RESET=`conflict_reset`,e.RESOURCE_DELETED=`resource_deleted`})(SE||={});var CE;(function(e){e.AUTOSAVE=`autosave`,e.SUBMIT=`submit`,e.DRAFT=`draft`,e.PUBLISH=`publish`,e.SECTION=`section`,e.INLINE=`inline`,e.CUSTOM=`custom`})(CE||={});var wE;(function(e){e.FORM=`form`,e.DISPLAY=`display`,e.ORCHESTRATOR=`orchestrator`,e.CUSTOM=`custom`})(wE||={});var TE;(function(e){e.VALIDATION=`validation`,e.CONFLICT=`conflict`,e.NOT_FOUND=`not_found`,e.TRANSIENT=`transient`,e.SERVER=`server`,e.ABORT=`abort`,e.REFUSED=`refused`})(TE||={});var EE;(function(e){e.SUCCESS=`success`,e.ERROR=`error`})(EE||={});var DE;(function(e){e.ACCEPT_REMOTE=`accept-remote`,e.LAST_WRITE_WINS=`last-write-wins`})(DE||={});var OE;(function(e){e.VERSION_CONFLICT=`version_conflict`,e.REMOTE_UPDATE=`remote_update`})(OE||={});var kE;(function(e){e.LOCAL=`local`,e.REMOTE=`remote`})(kE||={});var AE;(function(e){e[e.LOW=0]=`LOW`,e[e.NORMAL=1]=`NORMAL`,e[e.HIGH=2]=`HIGH`,e[e.IMMEDIATE=3]=`IMMEDIATE`})(AE||={});var jE=class extends Error{name=`MutationCancelledError`;source;constructor(e){super(`Mutation cancelled`),this.source=e}},ME=class extends Error{name=`ResourceDeletedError`;constructor(){super(`Resource has been deleted`)}},NE=class extends Error{name=`BackpressureRejectedError`;constructor(){super(`Queue at maximum depth — mutation rejected`)}},PE=Jo.getLogger(),Iue=PE.debugByType(`AutosaveContext`);PE.setDebugTypeLogging(`AutosaveContext`,!1);var FE={enabled:!1,defaultTrigger:zn.DEBOUNCE,debounceMs:500,savedStateDurationMs:2e3},IE={state:hT.IDLE},LE=(0,Q.createContext)(null);function RE(){return(0,Q.useContext)(LE)}function zE({children:e,labels:t,validateField:n,onSave:r,rmm:i,config:a,onSaveSuccess:o,onSaveError:s}){let c=(0,Q.useMemo)(()=>({...FE,...a}),[a]),[l,u]=(0,Q.useState)({}),d=(0,Q.useRef)({}),f=(0,Q.useRef)({}),p=(0,Q.useRef)({}),m=(0,Q.useRef)({}),h=(0,Q.useMemo)(()=>Object.values(l).some(e=>e.state===hT.SAVING),[l]),g=rw();(0,Q.useEffect)(()=>()=>{Object.values(d.current).forEach(({timeoutId:e,abortController:t})=>{clearTimeout(e),t.abort()}),Object.values(f.current).forEach(e=>e.abort()),Object.values(m.current).forEach(e=>clearTimeout(e))},[]);let _=(0,Q.useCallback)((e,t)=>{u(n=>({...n,[e]:{...n[e]??IE,...t}}))},[]),v=(0,Q.useCallback)(e=>{m.current[e]&&(clearTimeout(m.current[e]),delete m.current[e])},[]),y=(0,Q.useCallback)(e=>{v(e),_(e,{state:hT.SAVED,lastSavedAt:Date.now()}),m.current[e]=setTimeout(()=>{_(e,{state:hT.IDLE}),delete m.current[e]},c.savedStateDurationMs)},[v,_,c.savedStateDurationMs]),b=(0,Q.useCallback)(e=>{let t=d.current[e];t&&(clearTimeout(t.timeoutId),t.abortController.abort(),delete d.current[e])},[]),x=(0,Q.useCallback)(e=>{let t=t=>t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`);Object.keys(d.current).filter(t).forEach(e=>b(e));for(let[e,n]of Object.entries(f.current))t(e)&&(n.abort(),delete f.current[e],_(e,{state:hT.IDLE}))},[b,_]),S=(0,Q.useCallback)(()=>{Object.keys(d.current).forEach(e=>{b(e)}),Object.values(f.current).forEach(e=>e.abort()),f.current={},i?.cancelPendingMutations()},[b,i]),C=(0,Q.useCallback)(()=>{S(),u({}),Object.values(m.current).forEach(e=>clearTimeout(e)),m.current={},p.current={}},[S]),w=(0,Q.useCallback)(async(e,a,c)=>{f.current[e]=c;try{let l=n?await n(e):!g||await g.trigger(e);if((n||g)&&!l){_(e,{state:hT.IDLE});return}if(c.signal.aborted)return;_(e,{state:hT.SAVING});try{if(r)await r(e,a,c.signal);else if(i){let n=await i.queueMutation({[e]:a},{type:CE.AUTOSAVE,priority:AE.LOW});if(!n.success)throw n.error??Error(t.errorGeneric)}else return;if(c.signal.aborted)return;y(e),o?.(e)}catch(n){if(c.signal.aborted||n instanceof Error&&n.name===`AbortError`)return;let r=n&&typeof n==`object`&&`type`in n?n:null,i;if(r?.type===TE.TRANSIENT)i=t.errorNetwork;else if(r?.type===TE.VALIDATION)i=t.errorValidation;else if(r?.type===TE.CONFLICT)i=t.errorConflict;else if(n instanceof NE){Iue(`executeSave: backpressure rejection — resetting field to idle`,{fieldName:e}),_(e,{state:hT.IDLE});return}else if(n instanceof jE){_(e,{state:hT.IDLE});return}else if(n instanceof ME){_(e,{state:hT.ERROR,lastError:t.errorResourceDeleted});return}else i=t.errorGeneric;_(e,{state:hT.ERROR,lastError:i}),s?.(e,n instanceof Error?n:Error(i))}}finally{f.current[e]===c&&delete f.current[e]}},[g,t,r,s,o,i,y,_,n]),T=(0,Q.useCallback)((e,t,n)=>{if(!c.enabled||n===zn.NONE)return;p.current[e]={value:t,trigger:n},b(e);let r=new AbortController;if(n===zn.BLUR)w(e,t,r);else if(n===zn.DEBOUNCE){let n=c.debounceMs??FE.debounceMs,i=setTimeout(()=>{delete d.current[e],w(e,t,r)},n);d.current[e]={timeoutId:i,abortController:r}}},[c.enabled,c.debounceMs,b,w]),E=(0,Q.useCallback)(e=>{if(!c.enabled)return;let t=p.current[e];if(!t)return;b(e);let n=new AbortController;w(e,t.value,n)},[c.enabled,b,w]),D=(0,Q.useCallback)(e=>l[e]?.state??hT.IDLE,[l]),O=(0,Q.useCallback)(e=>l[e]??IE,[l]),k=(0,Q.useMemo)(()=>({config:c,triggerSave:T,retryFieldSave:E,getFieldState:D,getFieldStateInfo:O,cancelAllPending:S,cancelFieldPending:b,cancelPendingUnder:x,clearAllState:C,isSaving:h}),[c,T,E,D,O,S,b,x,C,h]);return(0,$.jsx)(LE.Provider,{value:k,children:e})}function BE(e,t=zn.DEBOUNCE,n=!1){return e===void 0?t:e===!0?n?zn.DEBOUNCE:zn.BLUR:typeof e==`object`?e.enabled===!1?zn.NONE:e.trigger?e.trigger:n?zn.DEBOUNCE:zn.BLUR:t}var VE=(0,Q.createContext)(null);function Lue(){return(0,Q.useContext)(VE)}var Rue={[uE.CLEAR]:{action:`bulkClearField`,pending:`bulkFieldWillBeCleared`,pendingUncounted:`bulkFieldWillBeClearedOnSelection`},[uE.EMPTY]:{action:`bulkEmptyField`,pending:`bulkFieldWillBeEmptied`,pendingUncounted:`bulkFieldWillBeEmptiedOnSelection`},[uE.TURN_OFF]:{action:`bulkTurnOffField`,pending:`bulkFieldWillBeTurnedOff`,pendingUncounted:`bulkFieldWillBeTurnedOffOnSelection`}};function HE({fieldName:e,label:t,disabled:n,onSaveFieldNow:r,children:i}){let a=Lue(),o=RE(),{tComponent:s}=K({component:J.LOW_LEVEL_FORM_FIELD}),c=a&&e&&!n?a.clearFor(e):void 0,l=c&&e?a?.registerField:void 0;if((0,Q.useEffect)(()=>l&&e?l(e):void 0,[l,e]),!a||!e||!c)return(0,$.jsx)($.Fragment,{children:i});let u=Rue[c.kind],d=a.isCleared(e),f=a.selectionCount,p=t?`bulk-clear-${e}-label`:void 0;return(0,$.jsxs)(`div`,{"data-slot":`bulk-field-clear`,"data-bulk-clear-kind":c.kind,"data-bulk-cleared":d||void 0,className:`flex flex-col gap-1`,children:[p&&(0,$.jsx)(`span`,{id:p,className:`sr-only`,children:t}),!d&&i,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{role:`status`,className:`text-sm text-muted-foreground empty:sr-only`,children:d?f===void 0?s(J.LOW_LEVEL_FORM_FIELD,u.pendingUncounted):s(J.LOW_LEVEL_FORM_FIELD,u.pending,{count:f}):null}),(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.SM,"aria-describedby":p,onClick:()=>{d?a.setCleared(e,!1):(o?.cancelPendingUnder(e),a.setCleared(e,!0),r?.(void 0))},children:s(J.LOW_LEVEL_FORM_FIELD,d?`bulkFieldUndoClear`:u.action)})]})]})}function UE(e){if(!e)return[];try{let t=sr.getObjectLikeFieldShape(e,{commonOnly:!0})??{};return Object.entries(t).filter(([,e])=>Sa(e)).map(([e])=>e)}catch{return[]}}function WE(e,t,n){if(t.length===0||!n)return e;let r=t.filter(t=>!(t in e)&&n[t]!==void 0);if(r.length===0)return e;let i={...e};for(let e of r)i[e]=n[e];return i}function zue(e){let{formFieldShape:t,inheritanceConfig:n,defaultValuesOverride:r}=e,i={};if(t)for(let[e,n]of Object.entries(t)){let t=zte(n);t!==void 0&&(i[e]=t)}let a=n?.discriminatorField;if(a&&i[a]===void 0){let e=n?.withoutInheritanceDiscriminatorFieldValues?.[0];e!==void 0&&(i[a]=e)}let o={...i,...r??{}};return Object.keys(o).length>0?o:void 0}function GE(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function KE(...e){return t=>{let n=!1,r=e.map(e=>{let r=GE(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():GE(e[t],null)}}}}function qE(...e){return Q.useCallback(KE(...e),e)}var Bue=Symbol.for(`react.lazy`),JE=Q.use;function Vue(e){return typeof e==`object`&&!!e&&`then`in e}function YE(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Bue&&`_payload`in e&&Vue(e._payload)}function XE(e){let t=Hue(e),n=Q.forwardRef((e,n)=>{let{children:r,...i}=e;YE(r)&&typeof JE==`function`&&(r=JE(r._payload));let a=Q.Children.toArray(r),o=a.find(Wue);if(o){let e=o.props.children,r=a.map(t=>t===o?Q.Children.count(e)>1?Q.Children.only(null):Q.isValidElement(e)?e.props.children:null:t);return(0,$.jsx)(t,{...i,ref:n,children:Q.isValidElement(e)?Q.cloneElement(e,void 0,r):null})}return(0,$.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var ZE=XE(`Slot`);function Hue(e){let t=Q.forwardRef((e,t)=>{let{children:n,...r}=e;if(YE(n)&&typeof JE==`function`&&(n=JE(n._payload)),Q.isValidElement(n)){let e=Kue(n),i=Gue(r,n.props);return n.type!==Q.Fragment&&(i.ref=t?KE(t,e):e),Q.cloneElement(n,i)}return Q.Children.count(n)>1?Q.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var QE=Symbol(`radix.slottable`);function Uue(e){let t=({children:e})=>(0,$.jsx)($.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=QE,t}function Wue(e){return Q.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===QE}function Gue(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Kue(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var que=Jo.getLogger(),$E=J.APP_LAYOUTS_SURFACE_ERROR_BOUNDARY,eD=class extends Q.Component{state={error:null,errorInfo:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){que.error(`[SurfaceErrorBoundary] Surface child crashed`,{error:e,errorInfo:t}),this.setState({error:e,errorInfo:t})}resetError=()=>{this.setState({error:null,errorInfo:null})};render(){return this.state.error?(0,$.jsx)(Jue,{error:this.state.error,errorInfo:this.state.errorInfo,onRetry:this.resetError,titleAs:this.props.titleAs}):this.props.children}};function Jue(e){return(0,Q.useContext)(yc)?(0,$.jsx)(Yue,{...e}):(0,$.jsx)(tD,{...e,label:e=>`components.${$E}.${e}`})}function Yue(e){let{makeTrComponent:t,isReady:n}=K({component:$E});return n?(0,$.jsx)(tD,{...e,label:t($E)}):e.titleAs?(0,$.jsx)(e.titleAs,{className:`sr-only`}):null}function tD({error:e,errorInfo:t,onRetry:n,titleAs:r,label:i}){let a=va.isDevelopment(),o=[];return a&&(o.push({label:i(`errorMessageLabel`),content:e.message,variant:`error`}),t?.componentStack&&o.push({label:i(`componentStackLabel`),content:t.componentStack,variant:`info`})),(0,$.jsxs)($.Fragment,{children:[r?(0,$.jsx)(r,{className:`sr-only`,children:i(`title`)}):null,(0,$.jsx)(nb,{variant:`error`,title:i(`title`),message:i(`message`),actions:[{label:i(`tryAgain`),onClick:n,variant:`primary`}],showDevInfo:a,devInfoTitle:i(`devInfoTitle`),devInfoSections:o})]})}var nD=`data-surface-scroll-lock-count`,rD,Xue=`a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])`,iD={a11y:{landmarkRole:`none`}};function aD(e){return Array.from(e.querySelectorAll(Xue)).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`)}function oD(){return typeof document>`u`?0:Number(document.body.getAttribute(nD)??0)}function sD(e){typeof document<`u`&&(e<=0?(document.body.removeAttribute(nD),document.body.style.overflow=rD??``,rD=void 0):(oD()===0&&(rD=document.body.style.overflow),document.body.setAttribute(nD,String(e)),document.body.style.overflow=`hidden`))}function cD(e){Q.useEffect(()=>{if(e&&typeof document<`u`)return sD(oD()+1),()=>sD(oD()-1)},[e])}function lD(e,t){Q.useEffect(()=>{if(!t||typeof document>`u`)return;let n=e.current;if(!n)return;let r=document.activeElement instanceof HTMLElement?document.activeElement:null;(aD(n)[0]??n).focus({preventScroll:!0});let i=e=>{if(e.key!==`Tab`)return;let t=aD(n);if(t.length===0){e.preventDefault(),n.focus({preventScroll:!0});return}let r=t[0],i=t[t.length-1],a=document.activeElement;e.shiftKey&&a===r?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())};return n.addEventListener(`keydown`,i),()=>{n.removeEventListener(`keydown`,i),r&&document.body.contains(r)&&r.focus({preventScroll:!0})}},[t,e])}var Zue=Jo.getLogger();function uD(e){switch(e){case`none`:return`0px`;case`field`:return`var(--sp-field)`;case`card-sm`:return`var(--spacing-card-sm)`;case`card`:return`var(--sp-card)`;case`container`:return`var(--sp-container)`;default:return}}function dD(e){switch(e){case`none`:return`0px`;case`item`:return`var(--sp-item)`;case`field`:return`var(--sp-field)`;case`section`:return`var(--sp-section)`;case`lane`:return`var(--sp-region)`;default:return}}function Que(e){switch(e){case`nowrap`:return`nowrap`;case`balance`:return`balance`;case`pretty`:return`pretty`;case`wrap`:return`wrap`;default:return}}function $ue(e){switch(e){case`tabular`:return`tabular-nums`;case`lining`:return`lining-nums`;case`inherit`:return`inherit`;default:return}}function ede(e){switch(e){case`break-word`:return`break-word`;case`break-anywhere`:return`anywhere`;case`overflow`:return`normal`;case`inherit`:return`inherit`;default:return}}function tde(e){switch(e){case`content`:return`var(--z-content)`;case`overlay`:return`var(--z-overlay)`;case`transient`:return`var(--z-transient)`;case`guidance`:return`var(--z-guidance)`;case`critical`:return`var(--z-critical)`;default:return}}function fD(e){switch(e){case`stack`:return`column`;case`row`:case`inherit`:return e;case`column-reverse-on-mobile`:return`row`;default:return}}function pD(e){switch(e){case`column-reverse-on-mobile`:return`column-reverse`;case`stack`:return`column`;case`row`:case`inherit`:return e;default:return}}function mD(e){switch(e){case`full`:return`100%`;case`sm`:return`24rem`;case`md`:return`28rem`;case`lg`:return`32rem`;case`xl`:return`36rem`;case`measure`:return`var(--measure-max-width, 42rem)`;case`centered-readable`:return`72ch`;case`content`:return`var(--content-max-width, 80rem)`;default:return`none`}}function nde(e){switch(e){case`sm`:case`md`:case`lg`:case`xl`:case`measure`:case`centered-readable`:case`content`:return`auto`;default:return`0px`}}function rde(e){switch(e){case`strip`:return`0px`;default:return`var(--surface-policy-padding-inline)`}}function hD(e){switch(e){case`always`:case`when-orphan`:case`never`:return e;default:return}}function gD(e){switch(e){case`inherit`:case`one-tier-tighter`:case`fixed`:return e;default:return}}function _D(e){switch(e){case`collapse`:case`preserve`:return e;default:return}}function vD(e){switch(e){case`border`:case`gap`:case`rule`:case`none`:return e;default:return}}function ide(e,t){if(t)switch(e){case`inherit`:return`inherit`;case`one-tier-tighter`:return`var(--surface-nested-radius-one-tier-tighter, var(--radius-lg, 0.5rem))`;default:return}}function yD(e){switch(e){case`wrap-children`:case`self-selectable`:case`forbidden`:return e;default:return}}function bD(e){switch(e){case`self`:case`children`:case`none`:return e;default:return}}function ade(e){switch(e){case`region`:case`dialog`:case`alertdialog`:case`complementary`:case`navigation`:case`status`:case`main`:return e;default:return}}function xD(e){return!!(e&&e!==`none`)}function SD(e){return e?`flex`:`block`}function CD(e){return e?`column`:`row`}function ode(e){let t=e.containment,n=e.nesting,r=e.content,i=e.interactiveState,a=e.geometry,o=e.stacking,s=e.composition,c=xD(t?.gap);return{"--surface-policy-display":SD(c),"--surface-policy-flex-direction":CD(c),"--surface-policy-padding-block":uD(t?.paddingBlock),"--surface-policy-padding-inline":uD(t?.paddingInline),"--surface-policy-overflow":t?.overflow,"--surface-policy-max-height":t?.maxHeight===`none`?`none`:t?.maxHeight,"--surface-policy-gap":dD(t?.gap),"--surface-policy-header-gap":dD(t?.slotGap?.header??t?.gap),"--surface-policy-body-gap":dD(t?.slotGap?.body??t?.gap),"--surface-policy-footer-gap":dD(t?.slotGap?.footer??t?.gap),"--surface-policy-framing-mode":hD(n?.framingMode),"--surface-policy-nested-radius-strategy":gD(n?.nestedRadiusStrategy),"--surface-policy-first-child-edge-strategy":_D(n?.firstChildEdgeStrategy),"--surface-policy-divider-strategy":vD(n?.dividerStrategy),"--surface-policy-z-tier":tde(o?.stackingTier),"--surface-policy-numeric-align":$ue(r?.numericAlignment),"--surface-policy-text-wrap":Que(r?.wrapStrategy),"--surface-policy-overflow-wrap":ede(r?.overlongTokenStrategy),"--surface-policy-safe-area":a?.safeAreaPadding?`env(safe-area-inset-bottom)`:`0px`,"--surface-policy-action-alignment":fD(a?.actionAlignment),"--surface-policy-action-alignment-mobile":pD(a?.actionAlignment),"--surface-policy-responsive-max-width":mD(a?.responsiveMaxWidth),"--surface-policy-responsive-max-width-margin":nde(a?.responsiveMaxWidth),"--surface-policy-embedded-table-padding-inline":rde(s?.embeddedTablePadding),"--surface-policy-child-adaptive-gap":s?.childAdaptiveDensity?`var(--sp-field)`:void 0,"--surface-policy-selectable-semantics":yD(i?.selectableSemantics),"--surface-policy-gesture-opt-in":bD(i?.gestureOptIn)}}function sde(e,t,n,r){Q.useRef(!1),r&&[e,t].filter(Boolean).join(` `)}function cde(e,t,n,r,i,a){return r?{...ode(e),"--surface-policy-nested-radius":a,borderWidth:i?void 0:`0px`,boxShadow:i?void 0:`none`,borderRadius:a?`var(--surface-policy-nested-radius)`:void 0,...t,...n}:{...t,...n}}var wD=Q.forwardRef(function({variant:e=Ja.BASE,materialRoleOverride:t,policyOverride:n,asChild:r=!1,emitPolicyVars:i=!0,modal:a=!1,a11yManagedByHost:o=!1,errorFallbackTitleAs:s,className:c,style:l,children:u,role:d,"aria-label":f,"aria-labelledby":p,"data-slot":m,"data-surface":h,tabIndex:g,..._},v){let{getComposedClasses:y,getMaterialProfile:b,getRecipe:x,getSurfacePolicy:S}=e_(),C=x?.(wi.SURFACE,e),w=y?.(wi.SURFACE,e),T=b?.(t??C?.material),E=Q.useContext(Ke),D=Q.useMemo(()=>S?S(e,n,E?.policy):gc(Pi[e],void 0,void 0,n,{variant:e,parentPolicy:E?.policy,logger:Zue}),[S,E?.policy,n,e]),[O,k]=Q.useState(),A=Q.useCallback(e=>{k(e)},[]),j=Q.useCallback(e=>{k(t=>t===e?void 0:t)},[]),M=Q.useMemo(()=>({headerId:O,registerHeaderId:A,unregisterHeaderId:j}),[O,A,j]),N=Q.useMemo(()=>zr(e,D,E,M),[M,E,D,e]),P=!!E?.isInFramedAncestor,F=P?E?.nearestFramedAncestorVariant??void 0:void 0,I=ide(D.nesting?.nestedRadiusStrategy,P);sde(c,r&&Q.isValidElement(u)?u.props.className:void 0,n,i);let ee=r?ZE:`div`,L=Q.useRef(null),R=S_(T,L),te=Q.useCallback(e=>{L.current=e,typeof v==`function`?v(e):v&&(v.current=e)},[v]),z=d??ade(D.a11y?.landmarkRole),B=p??(D.a11y?.labelStrategy===`from-header`?O:void 0),ne={...d===void 0?{}:{role:d},...f===void 0?{}:{"aria-label":f},...p===void 0?{}:{"aria-labelledby":p}},re=o?ne:{...z===void 0?{}:{role:z},...f===void 0?{}:{"aria-label":f},...B===void 0?{}:{"aria-labelledby":B}},ie=!o&&(D.a11y?.focusTrap===`on-mount`||a&&D.a11y?.focusTrap===`when-modal`),ae=!o&&a&&D.a11y?.scrollContainment===`lock-body`,oe=ie&&g==null?-1:g,se=oe===void 0?{}:{tabIndex:oe};lD(L,ie),cD(ae),Q.useEffect(()=>{},[o,f,p,O,D.a11y?.labelStrategy,z,e]);let ce=i?{"data-slot":`surface`,"data-surface":``,"data-inline-size-tier":D.geometry?.responsiveMaxWidth}:{},le=D.interactiveState?.errorBoundary===`self`,ue=le?lde(u,r,s):{children:u,boundsContent:!1},de=(0,$.jsx)(ee,{ref:te,..._,...ce,"data-material-kind":R[`data-material-kind`],"data-material-tier":R[`data-material-tier`],"data-material-variant":R[`data-material-variant`],"data-material-depth":R[`data-material-depth`],"data-material-composition":R[`data-material-composition`],"data-material-group":R[`data-material-group`],"data-material-refractive-budget":R[`data-material-refractive-budget`],...se,"data-surface-focus-trap":ie?``:void 0,"data-surface-scroll-containment":ae?``:void 0,"data-surface-framing-mode":i?hD(D.nesting?.framingMode):void 0,"data-surface-frame":i?N.rendersOwnFrame?`rendered`:`suppressed`:void 0,"data-surface-in-framed-ancestor":i&&P?``:void 0,"data-surface-nearest-framed-ancestor":i?F:void 0,"data-surface-nested-radius-strategy":i?gD(D.nesting?.nestedRadiusStrategy):void 0,"data-surface-first-child-edge-strategy":i?_D(D.nesting?.firstChildEdgeStrategy):void 0,"data-surface-divider-strategy":i?vD(D.nesting?.dividerStrategy):void 0,"data-surface-selectable-semantics":i?yD(D.interactiveState?.selectableSemantics):void 0,"data-surface-gesture-opt-in":i?bD(D.interactiveState?.gestureOptIn):void 0,"data-surface-child-adaptive-density":i&&D.composition?.childAdaptiveDensity===!0?``:void 0,"data-surface-selection-column-aware":i&&D.composition?.selectionColumnAware===!0?``:void 0,...re,"data-surface-variant":e,className:U(w,c),style:cde(D,R.style,l,i,N.rendersOwnFrame,I),children:ue.children});return(0,$.jsx)(Ke.Provider,{value:N,children:le&&!ue.boundsContent?(0,$.jsx)(eD,{children:de}):de})});function lde(e,t,n){if(!t)return{children:(0,$.jsx)(eD,{children:e}),boundsContent:!0};if(!Q.isValidElement(e))return{children:e,boundsContent:!1};let r=e.props.children;return r==null||typeof r==`function`?{children:e,boundsContent:!1}:{children:Q.cloneElement(e,void 0,(0,$.jsx)(eD,{titleAs:n,children:r})),boundsContent:!0}}wD.displayName=`Surface`;function TD(e,t,n){let r=t.containment?.slotGap?.[e]??t.containment?.gap,i=xD(r);return{"--surface-policy-slot-display":SD(i),"--surface-policy-slot-flex-direction":CD(i),[`--surface-policy-${e}-gap`]:dD(r),...n}}var ED=Q.forwardRef(function({className:e,id:t,style:n,...r},i){let a=oc(),o=Q.useContext(Ke),s=o?.registerHeaderId,c=o?.unregisterHeaderId,l=Q.useId(),u=t??l;return Q.useEffect(()=>(s?.(u),()=>c?.(u)),[s,u,c]),(0,$.jsx)(`div`,{ref:i,id:u,"data-slot":`surface-header`,className:U(e),style:TD(`header`,a,n),...r})});ED.displayName=`Surface.Header`;var DD=Q.forwardRef(function({className:e,style:t,...n},r){let i=oc();return(0,$.jsx)(`div`,{ref:r,"data-slot":`surface-body`,className:U(e),style:TD(`body`,i,t),...n})});DD.displayName=`Surface.Body`;var OD=Q.forwardRef(function({className:e,style:t,...n},r){let i=oc(),a=i.containment?.slotGap?.footer??i.containment?.gap,o=xD(a),s=!!(i.geometry?.actionAlignment&&i.geometry.actionAlignment!==`inherit`);return(0,$.jsx)(`div`,{ref:r,"data-slot":`surface-footer`,className:U(e),style:{"--surface-policy-slot-display":SD(o||s),"--surface-policy-slot-flex-direction":CD(o),"--surface-policy-footer-gap":dD(a),"--surface-policy-action-alignment":s?fD(i.geometry?.actionAlignment):void 0,"--surface-policy-action-alignment-mobile":s?pD(i.geometry?.actionAlignment):void 0,...t},...n})});OD.displayName=`Surface.Footer`;var kD=Q.forwardRef(function({className:e,...t},n){return(0,$.jsx)(`div`,{ref:n,"data-slot":`surface-action`,className:U(e),...t})});kD.displayName=`Surface.Action`;var AD=Object.assign(wD,{Header:ED,Body:DD,Footer:OD,Action:kD}),jD=Q.createContext(void 0);function ude(e){return e===Lu.EYEBROW?Lu.EYEBROW:Lu.LABEL}function MD(){return Q.useContext(jD)}function ND({voice:e,children:t}){return Q.createElement(jD.Provider,{value:e},t)}function PD({children:e}){let t=MD();return Q.createElement(jD.Provider,{value:ude(t)},e)}var dde=`text-base`;function FD(e){return U(e(wi.TYPOGRAPHY,Lu.HEADING).base,dde)}var ID=(0,Q.createContext)({pathPrefix:``});function LD({pathPrefix:e,children:t}){return(0,$.jsx)(ID.Provider,{value:{pathPrefix:e},children:t})}function RD(){return(0,Q.useContext)(ID)}function zD(e){let{pathPrefix:t}=RD();return t?`${t}.${e}`:e}var BD=(0,Q.createContext)(null);function VD(e){let t=(0,Q.useContext)(BD);(0,Q.useLayoutEffect)(()=>{t?.registerSlot(e)},[e,t])}function fde(){let e=(0,Q.useContext)(BD);(0,Q.useLayoutEffect)(()=>{e?.registerWizardRoot()},[e])}var HD=zs(J.LOW_LEVEL_ALERT,`Alert`,[`Title`,`Description`]);function UD({preset:e=q.DEFAULT,...t}){let n=HD(e);return(0,$.jsx)(n,{...t})}function WD({preset:e=q.DEFAULT,...t}){let n=HD(e);return(0,$.jsx)(n.Title,{...t})}function GD({preset:e=q.DEFAULT,...t}){let n=HD(e);return(0,$.jsx)(n.Description,{...t})}function KD(){let e=(0,Q.useContext)(gT);if(!e)throw Error(`useFormSchemaContext must be used within a FormSchemaProvider`);return e}function qD(){return(0,Q.useContext)(gT)}var pde=Jo.getLogger().debugByType(`FormErrorCategorization`),JD=class e{constructor(){}static ROOT_ERROR_PATHS=new Set([``,`root`,`_`]);static ROOT_ERROR_PREFIX=bT;static isCrossFieldErrorPath(t){return e.isFormLevelErrorPath(t)}static isFormLevelErrorPath(t){return!t||e.ROOT_ERROR_PATHS.has(t)||t.startsWith(e.ROOT_ERROR_PREFIX)}static flattenErrors(t,n=``){let r=[];for(let[i,a]of Object.entries(t)){let t=n?`${n}.${i}`:i;a?.message&&typeof a.message==`string`?r.push({path:t,message:a.message,type:a.type}):typeof a==`object`&&a&&r.push(...e.flattenErrors(a,t))}return r}static categorizeErrors(t){let n=e.flattenErrors(t),r=[],i=[],a=[];for(let t of n)t.type===`server`||t.type===`server-unique`?a.push(t):e.isCrossFieldErrorPath(t.path)?i.push(t):r.push(t);return pde(`categorizeErrors`,{totalErrors:n.length,fieldErrors:r.length,crossFieldErrors:i.length,serverErrors:a.length,serverFields:a.map(e=>e.path),crossFieldPaths:i.map(e=>e.path)}),{fieldErrors:r,crossFieldErrors:i,serverErrors:a}}},YD=`wildo:reveal-field`,XD=`data-reveal-container`,ZD=`data-reveal-panel`;function QD(e){let t={revealed:!1};return e.dispatchEvent(new CustomEvent(YD,{bubbles:!0,detail:t})),t.revealed}function $D(e,t,n=20){let r=typeof requestAnimationFrame==`function`?requestAnimationFrame:e=>setTimeout(e,16),i=0,a=()=>{e.getClientRects().length>0||i>=n?t():(i+=1,r(a))};r(a)}function eO(e){let t=(0,Q.useId)(),n=(0,Q.useRef)(e);return(0,Q.useEffect)(()=>{n.current=e}),(0,Q.useEffect)(()=>{if(typeof document>`u`)return;let e=e=>{let r=e.detail;for(let i=e.target instanceof Element?e.target:null;i;i=i.parentElement){if(i.getAttribute(XD)!==t)continue;let e=i.getAttribute(ZD);e!==null&&n.current(e)&&r&&(r.revealed=!0);return}};return document.addEventListener(YD,e),()=>document.removeEventListener(YD,e)},[t]),t}function tO(e,t){return{[XD]:e,[ZD]:t}}function nO(){return rw()!=null}var rO=`data-form-error-summary`;function iO(e){let t=[],n=(e,r)=>{if(!e||typeof e!=`object`)return;let i=e;if(typeof i.message==`string`||typeof i.type==`string`)r&&t.push(r);else for(let[e,t]of Object.entries(i))e===`root`?n(t,r):n(t,r?`${r}.${e}`:e)};return n(e,``),t}function mde(e){return typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/["\\]/g,`\\$&`)}function aO(e){if(typeof document>`u`||e.length===0)return!1;let t=new Set(e),n=null,r=document.querySelectorAll(`[data-field]`);for(let i of r){let r=i.getAttribute(`data-field`);if(r&&(t.has(r)||e.some(e=>e.startsWith(`${r}.`)))){n=i;break}}if(!n)for(let t of e){let e=document.querySelector(`[name="${mde(t)}"]`);if(e){n=e;break}}if(!n)return e.some(e=>JD.isFormLevelErrorPath(e))?(hde(),!0):!1;let i=n;return QD(i)?$D(i,()=>oO(i)):oO(i),!0}function hde(e=20){let t=typeof requestAnimationFrame==`function`?requestAnimationFrame:e=>setTimeout(e,16),n=0,r=()=>{let i=document.querySelector(`[${rO}]`);i?(i.scrollIntoView({behavior:`smooth`,block:`center`}),i.focus({preventScroll:!0})):n<e&&(n+=1,t(r))};r()}function oO(e){e.scrollIntoView({behavior:`smooth`,block:`center`});let t=e;setTimeout(()=>{if(!document.body.contains(t))return;let e=t.matches(`input, textarea, select, button, [tabindex]:not([tabindex="-1"])`)?t:t.querySelector(`input, textarea, select, button, [tabindex]:not([tabindex="-1"])`);if(e&&document.body.contains(e))try{e.focus({preventScroll:!0})}catch{e.focus()}},100)}var sO=Jo.getLogger(),gde=sO.debugByType(`FormErrorSummary`);sO.setDebugTypeLogging(`FormErrorSummary`,!1);function cO({title:e,className:t,maxErrors:n=10,stepFieldNames:r}){let{formState:i}=rw(),{renderIcon:a}=Rf(),o=oc(),s=qD(),c=s?.resourceType,{tResourceFieldEdit:l,tComponent:u,isReady:d}=K({component:J.LOW_LEVEL_FORM_MESSAGE,...c?{resource:c}:{}}),f=e??u(J.LOW_LEVEL_FORM_MESSAGE,`formErrorsTitle`),{fieldErrors:p,crossFieldErrors:m,serverErrors:h}=JD.categorizeErrors(i.errors),g=o.autoRender?.autoErrorPlacement===`summary-at-surface-top`,_=(0,Q.useMemo)(()=>r?e=>r.some(t=>e===t||e.startsWith(`${t}.`)):()=>!0,[r]),v=(0,Q.useMemo)(()=>h.filter(e=>JD.isFormLevelErrorPath(e.path)||_(e.path)),[h,_]),y=(0,Q.useMemo)(()=>g?p.filter(e=>_(e.path)):[],[p,g,_]),b=[...m,...v,...y],x=ZT()?.fieldLabels,S=(0,Q.useMemo)(()=>sr.createFieldLabelResolver(c,l,s?.schema,x),[c,l,s?.schema,x]);if(b.length===0||!d)return null;gde(`rendering error summary`,{fieldCount:y.length,crossFieldCount:m.length,serverCount:v.length,totalServerErrors:h.length,isWizardFiltered:!!r,errors:b.map(e=>({path:e.path,type:e.type,message:e.message}))});let C=b.slice(0,n),w=b.length>n;return(0,$.jsx)(UD,{variant:`destructive`,className:U(t),role:`alert`,"data-testid":`form-error-summary`,[rO]:``,tabIndex:-1,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-element`,children:[a(H.ERROR,{size:fa.SM,className:`mt-0.5`}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(WD,{className:`mb-element`,children:f}),(0,$.jsxs)(GD,{children:[(0,$.jsx)(`ul`,{className:`list-disc list-inside space-y-item-xs text-sm`,children:C.map(({path:e,message:t},n)=>(0,$.jsxs)(`li`,{children:[JD.isFormLevelErrorPath(e)?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{className:`font-medium`,children:[S(e),`:`]}),` `]}),t]},`${e}-${n}`))}),w&&(0,$.jsx)(`p`,{className:`mt-item text-sm opacity-[var(--opacity-hover)]`,children:u(J.LOW_LEVEL_FORM_MESSAGE,`moreErrors`,{count:b.length-n})})]})]})]})})}cO.displayName=`FormErrorSummary`;var lO=cO,uO=(0,Q.createContext)(null),dO=(0,Q.createContext)(null);function fO(){return(0,Q.useContext)(uO)}function pO({className:e}){VD(`errorSummary`);let t=fO();return(0,$.jsx)(lO,{className:e,stepFieldNames:t?.getCurrentStepFieldNames()})}function mO({loading:e,children:t,width:n=`4em`,className:r}){return e?(0,$.jsx)(Tm,{"aria-hidden":`true`,className:U(`inline-block h-[1em] align-[-0.125em] rounded-sm`,r),style:{width:n}}):t}mO.displayName=`SkeletonText`;function hO({className:e,label:t,submittingLabel:n,fullWidth:r,disabled:i}){VD(`submitButton`);let{formState:a}=rw(),o=ZT(),{tComponent:s,isReady:c}=K({component:J.LOW_LEVEL_FORM_MESSAGE}),l=t===void 0&&!c,u=t??(c?s(J.LOW_LEVEL_FORM_MESSAGE,`submitSave`):void 0),d=a.isSubmitting||!!o?.disabled||l||i===!0,f=a.isSubmitting&&n?n:u;return(0,$.jsx)(`div`,{className:e,children:(0,$.jsx)(X,{type:`submit`,disabled:d,className:r?`w-full`:void 0,children:(0,$.jsx)(mO,{loading:l,width:`5em`,children:f})})})}hO.displayName=`SubmitButton`;var gO;(function(e){e.AUTOMATIC=`automatic`,e.MANUAL=`manual`})(gO||={});var _O;(function(e){e.PRIMARY=`primary`,e.SECONDARY=`secondary`})(_O||={});var vO=Q.createContext(null),yO=zs(J.LOW_LEVEL_TABS,`Tabs`,[`List`,`Trigger`,`Content`]);function bO({preset:e=q.DEFAULT,...t}){let n=yO(e);return(0,$.jsx)(n,{...t})}function xO({preset:e=q.DEFAULT,...t}){let n=yO(e);return(0,$.jsx)(n.List,{...t})}function SO({preset:e=q.DEFAULT,...t}){let n=yO(e);return(0,$.jsx)(n.Trigger,{...t})}function CO({preset:e=q.DEFAULT,...t}){let n=yO(e);return(0,$.jsx)(n.Content,{...t})}var wO=zs(J.LOW_LEVEL_ACCORDION,`Accordion`,[`Item`,`Trigger`,`Content`]);function TO({preset:e=q.DEFAULT,...t}){let n=wO(e);return(0,$.jsx)(n,{...t})}function EO({preset:e=q.DEFAULT,...t}){let n=wO(e);return(0,$.jsx)(n.Item,{...t})}function DO({preset:e=q.DEFAULT,...t}){let n=wO(e);return(0,$.jsx)(n.Trigger,{...t})}function OO({preset:e=q.DEFAULT,...t}){let n=wO(e);return(0,$.jsx)(n.Content,{...t})}var kO;(function(e){e.SINGLE=`single`,e.MULTIPLE=`multiple`})(kO||={});var AO;(function(e){e.SEGMENTED=`segmented`,e.CHIPS=`chips`})(AO||={});var jO=zs(J.LOW_LEVEL_TOGGLE_GROUP,`ToggleGroup`,[`Item`]),MO=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=jO(e);return(0,$.jsx)(r,{...t,ref:n})});MO.displayName=`ToggleGroup`;function NO({preset:e=q.DEFAULT,...t}){let n=jO(e);return(0,$.jsx)(n.Item,{...t})}var PO=zs(J.LOW_LEVEL_COLLAPSIBLE,`Collapsible`,[`Trigger`,`Content`]);function FO({preset:e=q.DEFAULT,...t}){let n=PO(e);return(0,$.jsx)(n,{...t})}function IO({preset:e=q.DEFAULT,...t}){let n=PO(e);return(0,$.jsx)(n.Trigger,{...t})}function LO({preset:e=q.DEFAULT,...t}){let n=PO(e);return(0,$.jsx)(n.Content,{...t})}var RO=zs(J.LOW_LEVEL_STEPPER,`Stepper`,[`Item`,`Indicator`,`Separator`,`Title`,`Description`]);function zO({preset:e=q.DEFAULT,...t}){let n=RO(e);return(0,$.jsx)(n,{...t})}function BO({preset:e=q.DEFAULT,...t}){let n=RO(e);return(0,$.jsx)(n.Item,{...t})}function VO({preset:e=q.DEFAULT,...t}){let n=RO(e);return(0,$.jsx)(n.Indicator,{...t})}function HO({preset:e=q.DEFAULT,...t}){let n=RO(e);return(0,$.jsx)(n.Separator,{...t})}function UO({preset:e=q.DEFAULT,...t}){let n=RO(e);return(0,$.jsx)(n.Title,{...t})}function WO({preset:e=q.DEFAULT,...t}){let n=RO(e);return(0,$.jsx)(n.Description,{...t})}var GO;(function(e){e.REACHED=`reached`,e.CURRENT=`current`,e.NOT_REACHED=`not_reached`})(GO||={});var KO=class extends Error{constructor(e){super(`[Section STAGES] ${e}`),this.name=`SectionStageBindingError`}};function qO(e,t,n){let r=t.join(`, `);if(e===void 0)throw new KO(`the group (${r}) declares no stageBinding. Declare it on the group's first section: which record field holds the stage, and which section each of its values is.`);if(n===void 0||n.length===0)throw new KO(`stageBinding.field "${e.field}" of the group (${r}) is not an enum field of the record. A stage is one value of a closed vocabulary.`);let i=new Set(n),a=new Set(t),o=Object.keys(e.stageOfValue).filter(e=>!i.has(e));if(o.length>0)throw new KO(`stageBinding.stageOfValue maps ${o.map(e=>`"${e}"`).join(`, `)}, which ${o.length===1?`is not a value`:`are not values`} of "${e.field}" (${n.join(`, `)}).`);let s=n.filter(t=>!Object.prototype.hasOwnProperty.call(e.stageOfValue,t));if(s.length>0)throw new KO(`stageBinding.stageOfValue places no stage for ${s.map(e=>`"${e}"`).join(`, `)} of "${e.field}". Every value must name the stage a record holding it is at, or that record would show as having reached nothing.`);let c=[...new Set(Object.values(e.stageOfValue))].filter(e=>!a.has(e));if(c.length>0)throw new KO(`stageBinding.stageOfValue names ${c.map(e=>`"${e}"`).join(`, `)}, which ${c.length===1?`is not a section`:`are not sections`} of the group (${r}).`)}function JO(e,t){return typeof t==`string`&&Object.prototype.hasOwnProperty.call(e.stageOfValue,t)?e.stageOfValue[t]:null}function YO(e,t){let n=t===null?-1:e.indexOf(t);return e.map((e,t)=>n<0||t>n?GO.NOT_REACHED:t===n?GO.CURRENT:GO.REACHED)}var _de=new Set([Mr.DEFAULT,Mr.CARD,Mr.GHOST,Mr.COLLAPSIBLE]);function XO(e){return _de.has(e)}function vde(e,t,n){let r=Q.Children.toArray(e),i=[];for(let e=0;e<r.length;e++){let a=r[e];if(!t(a)){i.push({type:`node`,node:a});continue}let o=a.props.appearance??n??Mr.DEFAULT;if(XO(o)){i.push({type:`node`,node:a});continue}let s=o,c=yde(s,a.props),l=i[i.length-1];if(l?.type===`group`&&l.group.groupingKey===c){l.group.sections.push(a);continue}let u={mode:s,sections:[a],insertionIndex:e,groupingKey:c};i.push({type:`group`,group:u})}return{items:i}}function yde(e,t){switch(e){case Mr.INLINE:return JSON.stringify({mode:e,gap:t.gap});case Mr.GRID:return JSON.stringify({mode:e,columns:t.columns,gap:t.gap,minColumnWidth:t.minColumnWidth});case Mr.COLUMNS:return JSON.stringify({mode:e,columns:t.columns,gap:t.gap});case Mr.VERTICAL_TABS:return JSON.stringify({mode:e,navWidth:t.navWidth});case Mr.ACCORDION:return JSON.stringify({mode:e,allowMultiple:t.allowMultiple});case Mr.EXPANDABLE:return JSON.stringify({mode:e,initialVisibleCount:t.initialVisibleCount});case Mr.STEPPER:return JSON.stringify({mode:e,allowSkip:t.allowSkip,showProgress:t.showProgress,orientation:t.orientation});case Mr.TABS:case Mr.PILLS:case Mr.TIMELINE:case Mr.STAGES:return JSON.stringify({mode:e});default:return JSON.stringify({mode:e})}}function bde(e){let t=e.sections[0].props,n=e.mode,r={mode:n,ariaLabel:void 0,ariaLabelledBy:void 0};switch(n){case Mr.INLINE:return{...r,mode:n,gap:t.gap};case Mr.GRID:return{...r,mode:n,columnCount:t.columns,gap:t.gap,minColumnWidth:t.minColumnWidth};case Mr.COLUMNS:return{...r,mode:n,columnCount:t.columns,gap:t.gap};case Mr.TABS:{let t=e.sections.find(e=>e.props.defaultFocus);return{...r,mode:n,defaultActive:t?.props.name??e.sections[0].props.name}}case Mr.VERTICAL_TABS:{let i=e.sections.find(e=>e.props.defaultFocus);return{...r,mode:n,defaultActive:i?.props.name??e.sections[0].props.name,navWidth:t.navWidth}}case Mr.PILLS:{let t=e.sections.find(e=>e.props.defaultFocus);return{...r,mode:n,defaultActive:t?.props.name??e.sections[0].props.name}}case Mr.ACCORDION:{let i=e.sections.filter(e=>e.props.defaultFocus).map(e=>e.props.name);return{...r,mode:n,allowMultiple:t.allowMultiple,defaultExpanded:i.length>0?i:[e.sections[0].props.name]}}case Mr.EXPANDABLE:return{...r,mode:n,initialVisibleCount:t.initialVisibleCount};case Mr.STEPPER:return{...r,mode:n,allowSkip:t.allowSkip,showProgress:t.showProgress,orientation:t.orientation??Wl.VERTICAL};case Mr.TIMELINE:return{...r,mode:n};case Mr.STAGES:return{...r,mode:n};default:return{mode:Mr.INLINE}}}function xde(e){switch(e){case`grouped`:case`flat`:case`separator-only`:return e;default:return`card-each`}}function ZO(e){switch(e){case`flat`:return{appearance:Mr.DEFAULT};case`separator-only`:return{appearance:Mr.DEFAULT,className:`border-b pb-field last:border-b-0 last:pb-0`};default:return{appearance:Mr.CARD}}}var QO=({sections:e,className:t})=>{let{getRecipe:n}=e_(),r=n(wi.SURFACE,Ja.CARD),i=n(wi.TYPOGRAPHY,Lu.EYEBROW),a=ok();return(0,$.jsx)(AD,{asChild:!0,emitPolicyVars:!1,variant:Ja.CARD,policyOverride:{nesting:{framingMode:`always`}},children:(0,$.jsx)(`div`,{role:`region`,"aria-label":a(`contentSectionsRegion`),className:U(r.base,`divide-y divide-border`,t),children:e.map(e=>(0,$.jsxs)(`section`,{"data-slot":`content-group`,className:`space-y-field p-card`,children:[(e.title!=null||e.icon!=null)&&(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element-xs`,i.base),children:[e.icon!=null&&(0,$.jsx)(`span`,{className:`inline-flex items-center`,children:e.icon}),e.title]}),e.description!=null&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description}),(0,$.jsx)(BT,{appearance:Mr.DEFAULT,disabled:e.disabled,children:e.content})]},e.id))})})};function $O(e,t){let{appearance:n,className:r}=ZO(t?.wrapMode??`card-each`);return(0,$.jsx)(BT,{panel:!0,appearance:n,headingTag:t?.titleTag,legend:e.title,icon:e.icon,description:e.description,disabled:e.disabled,className:r,children:e.content},e.id)}function ek(e,t=e.content,n=`card-each`){let{appearance:r,className:i}=ZO(n);return(0,$.jsx)(BT,{panel:!0,appearance:r,className:i,children:t},e.id)}function tk({section:e}){let{getRecipe:t}=e_();return e.description==null?e.content:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:U(`mb-field`,t(wi.TYPOGRAPHY,Lu.DESCRIPTION).base),children:e.description}),e.content]})}var nk=({sections:e,config:t,className:n,onSectionChange:r})=>{let i=xde(oc().autoRender?.autoSectionWrap);if(e.length===0)return t.emptyStateMessage?(0,$.jsx)(Cm,{title:t.emptyStateMessage,variant:`compact`,className:n}):null;if(e.length===1&&!t.showSingleSectionNav)return i===`grouped`?(0,$.jsx)(QO,{sections:e,className:n}):(0,$.jsx)(`div`,{className:n,children:$O(e[0],{wrapMode:i})});switch(t.mode){case Mr.DEFAULT:case Mr.CARD:case Mr.GHOST:case Mr.INLINE:return(0,$.jsx)(sk,{sections:e,config:t,className:n,sectionWrapMode:i});case Mr.GRID:return(0,$.jsx)(Cde,{sections:e,config:t,className:n,sectionWrapMode:i});case Mr.COLUMNS:return(0,$.jsx)(wde,{sections:e,config:t,className:n,sectionWrapMode:i});case Mr.TABS:return(0,$.jsx)(Tde,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case Mr.VERTICAL_TABS:return(0,$.jsx)(Ode,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case Mr.PILLS:return(0,$.jsx)(kde,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case Mr.ACCORDION:return(0,$.jsx)(Ade,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case Mr.COLLAPSIBLE:return(0,$.jsx)(Mde,{sections:e,config:t,className:n,sectionWrapMode:i});case Mr.EXPANDABLE:return(0,$.jsx)(Pde,{sections:e,config:t,className:n,sectionWrapMode:i});case Mr.STEPPER:return(0,$.jsx)(Fde,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case Mr.TIMELINE:return(0,$.jsx)(Ide,{sections:e,config:t,className:n,sectionWrapMode:i});case Mr.STAGES:return(0,$.jsx)(Lde,{sections:e,config:t,className:n,sectionWrapMode:i});default:return(0,$.jsx)(sk,{sections:e,config:{mode:Mr.INLINE},className:n,sectionWrapMode:i})}},rk={sm:`gap-element`,md:`gap-field`,lg:`gap-section`},Sde={sm:`var(--spacing-element)`,md:`var(--spacing-field)`,lg:`var(--spacing-section)`},ik=`300px`,ak=J.LOW_LEVEL_CONTENT_SECTION_CONTAINER;function ok(){let{tComponent:e}=K({component:ak});return(0,Q.useCallback)((t,n)=>{let r=e(ak,t,n);return r===`${Ji.COMPONENTS}.${ak}.${t}`?``:r},[e])}var sk=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=rk[(`gap`in t?t.gap:void 0)??`md`],a=ok();return r===`grouped`?(0,$.jsx)(QO,{sections:e,className:n}):(0,$.jsx)(`div`,{className:U(`flex flex-col`,i,n),role:`region`,"aria-label":t.ariaLabel??a(`contentSectionsRegion`),children:e.map(e=>$O(e,{wrapMode:r}))})},Cde=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=t.columnCount===`auto`||t.columnCount===void 0?void 0:t.columnCount,a=t.gap??`md`,o=t.minColumnWidth??`300px`,s=rk[a],c=ok(),l=i?`max(${o}, calc((100% - ${i-1} * ${Sde[a]}) / ${i}))`:o,u={gridTemplateColumns:`repeat(${i?`auto-fill`:`auto-fit`}, minmax(min(100%, ${l}), 1fr))`};return(0,$.jsx)(`div`,{className:U(`grid`,s,n),style:u,role:`region`,"aria-label":t.ariaLabel??c(`contentGridRegion`),children:e.map(e=>$O(e,{wrapMode:r}))})},wde=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=rk[t.gap??`md`],a=ok(),o=t.columnCount===`auto`||t.columnCount===void 0?ik:`${t.columnCount} ${ik}`;return(0,$.jsx)(`div`,{className:U(i,n),style:{columns:o},role:`region`,"aria-label":t.ariaLabel??a(`contentColumnsRegion`),children:e.map(e=>(0,$.jsx)(`div`,{className:U(`break-inside-avoid mb-field`,r===`separator-only`&&`border-b pb-field last:border-b-0 last:pb-0`),children:$O(e,{wrapMode:r===`separator-only`?`flat`:r})},e.id))})};function ck(e,t,n){let[r,i]=(0,Q.useState)(e.defaultActive??t[0]?.id),a=e.activeSection??r,o=e=>{i(e),n?.(e)};return{active:a,select:o,revealContainerId:eO(e=>e!==a&&(o(e),!0))}}var Tde=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let a=ok(),o=nO(),{active:s,select:c,revealContainerId:l}=ck(t,e,i);return(0,$.jsxs)(bO,{value:s,className:n,onValueChange:c,children:[(0,$.jsx)(xO,{"aria-label":t.ariaLabel??a(`sectionTabsNav`),children:e.map(e=>(0,$.jsxs)(SO,{value:e.id,disabled:e.disabled,...e.count===void 0?{}:{count:e.count},...e.countTone===void 0?{}:{countTone:e.countTone},children:[e.icon&&(0,$.jsx)(`span`,{className:`me-element`,children:e.icon}),e.title]},e.id))}),e.map(e=>(0,$.jsx)(CO,{value:e.id,...o?{forceMount:!0,hidden:e.id!==s}:{},...tO(l,e.id),className:`animate-in fade-in-0 duration-[var(--motion-duration-fast)]`,children:ek(e,(0,$.jsx)(tk,{section:e}),r)},e.id))]})},Ede=36;function Dde(e){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{if(!t||typeof ResizeObserver>`u`)return;let n=Number.parseFloat(getComputedStyle(document.documentElement).fontSize)||16,r=t=>i(t>0&&t<e*n);r(t.getBoundingClientRect().width);let a=new ResizeObserver(([e])=>{e&&r(e.contentRect.width)});return a.observe(t),()=>a.disconnect()},[t,e]),[n,r]}var Ode=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let a=ok(),o=nO(),{active:s,select:c,revealContainerId:l}=ck(t,e,i),u=t.navWidth??`w-48`,[d,f]=Dde(Ede);return(0,$.jsx)(`div`,{ref:d,className:`min-w-0`,"data-vertical-tabs-stacked":f||void 0,children:(0,$.jsxs)(bO,{value:s,orientation:f?Wl.HORIZONTAL:Wl.VERTICAL,className:U(`mt-field`,n),onValueChange:c,children:[(0,$.jsx)(xO,{className:f?void 0:U(u,`shrink-0 self-start border-e pe-card`),"aria-label":t.ariaLabel??a(`verticalTabsRegion`),children:e.map(e=>(0,$.jsxs)(SO,{value:e.id,disabled:e.disabled,...e.count===void 0?{}:{count:e.count},...e.countTone===void 0?{}:{countTone:e.countTone},children:[e.icon&&(0,$.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:e.icon}),e.title]},e.id))}),e.map(e=>(0,$.jsx)(CO,{value:e.id,...o?{forceMount:!0,hidden:e.id!==s}:{},...tO(l,e.id),className:`min-w-0 flex-1 animate-in fade-in-0 duration-[var(--motion-duration-fast)]`,children:ek(e,(0,$.jsx)(tk,{section:e}),r)},e.id))]})})},kde=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let[a,o]=(0,Q.useState)(t.defaultActive??e[0]?.id),s=t.activeSection??a,c=o,{getRecipe:l}=e_(),u=ok(),d=(0,Q.useId)(),f=(0,Q.useRef)(null),p=l(wi.SELECTABLE,B.FILLED),m=nO(),h=e=>`${d}-tab-${e}`,g=e=>`${d}-panel-${e}`,_=e=>{c(e),i?.(e)},v=eO(e=>e!==s&&(_(e),!0)),y=t=>{if(![`ArrowRight`,`ArrowLeft`,`Home`,`End`].includes(t.key))return;let n=e.filter(e=>!e.disabled).map(e=>e.id);if(n.length===0)return;t.preventDefault();let r=n.indexOf(s),i=r<0?0:r;t.key===`ArrowRight`?i=(r+1)%n.length:t.key===`ArrowLeft`?i=(r-1+n.length)%n.length:t.key===`Home`?i=0:t.key===`End`&&(i=n.length-1);let a=n[i];_(a),f.current?.querySelector(`#${CSS.escape(h(a))}`)?.focus()},b=e.find(e=>e.id===s),x=e=>(0,$.jsx)(`div`,{role:`tabpanel`,id:g(e.id),"aria-labelledby":h(e.id),tabIndex:0,hidden:e.id!==s,...tO(v,e.id),className:U(`animate-in fade-in-0 duration-[var(--motion-duration-fast)]`,Jg(x_.INSET)),children:ek(e,(0,$.jsx)(tk,{section:e}),r)},e.id);return(0,$.jsxs)(`div`,{className:U(`space-y-field`,n),role:`region`,"aria-label":t.ariaLabel??u(`pillNavigationRegion`),children:[(0,$.jsx)(`div`,{ref:f,className:`flex flex-wrap items-center gap-item`,role:`tablist`,"aria-label":t.ariaLabel??u(`sectionTabsNav`),onKeyDown:y,children:e.map(e=>{let t=s===e.id;return(0,$.jsxs)(`button`,{id:h(e.id),type:`button`,role:`tab`,"aria-selected":t,"aria-controls":g(e.id),"data-state":t?`active`:`inactive`,tabIndex:t?0:-1,disabled:e.disabled,className:U(`inline-flex items-center gap-element rounded-md px-card-sm py-item font-medium`,p.base,p.motion?.transition,p.states.focus,!t&&p.states.hover,t&&p.states.selected,e.disabled&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`),onClick:()=>_(e.id),children:[e.icon&&(0,$.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:e.icon}),e.title]},e.id)})}),m?e.map(x):b&&x(b)]})},Ade=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let a=t.defaultExpanded??[e[0]?.id],o=t.allowMultiple??!1,s=nO(),{getRecipe:c}=e_(),l=FD(c),[u,d]=(0,Q.useState)(o?a:a.slice(0,1)),f=e=>{d(e),i?.(o?e:e[0]??``)},p=eO(e=>!u.includes(e)&&(f(o?[...u,e]:[e]),!0)),m=e.map(e=>(0,$.jsxs)(EO,{value:e.id,disabled:e.disabled,children:[(0,$.jsx)(DO,{className:U(e.disabled&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`),children:(0,$.jsxs)(`span`,{className:U(`flex items-center gap-element`,l),children:[e.icon&&(0,$.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:e.icon}),e.title]})}),(0,$.jsx)(OO,{...s?{forceMount:!0,hidden:!u.includes(e.id)}:{},...tO(p,e.id),children:ek(e,(0,$.jsx)(tk,{section:e}),`flat`)})]},e.id));return o?(0,$.jsx)(TO,{type:kO.MULTIPLE,value:u,className:n,onValueChange:e=>f(e),children:m}):(0,$.jsx)(TO,{type:kO.SINGLE,value:u[0]??``,className:n,collapsible:!0,onValueChange:e=>f(e?[e]:[]),children:m})},jde=`all`,Mde=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let[i,a]=(0,Q.useState)(!0),o=ok(),s=t.triggerLabel?.open??o(`accordionCollapseAll`),c=t.triggerLabel?.closed??o(`accordionExpandAll`),l=o(`accordionSectionCount`,{count:e.length}),u=nO(),d=eO(()=>!i&&(a(!0),!0));return(0,$.jsxs)(FO,{open:i,onOpenChange:a,className:n,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:l}),(0,$.jsx)(IO,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.SM,"aria-expanded":i,children:i?s:c})})]}),(0,$.jsx)(LO,{className:`space-y-field mt-field`,...u?{forceMount:!0,hidden:!i}:{},...tO(d,jde),children:e.map(e=>$O(e,{titleTag:`h4`,wrapMode:r}))})]})},Nde=`folded`,Pde=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=t.initialVisibleCount??3,[a,o]=(0,Q.useState)(!1),s=ok(),c=a?e:e.slice(0,i),l=e.length-i,u=t.showMoreLabel??s(`expandableShowMore`,{count:l}),d=t.showLessLabel??s(`expandableShowLess`),f=nO(),{renderIcon:p}=Rf(),m=eO(()=>!a&&(o(!0),!0));return(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-field`,n),children:[f?(0,$.jsxs)($.Fragment,{children:[e.slice(0,i).map(e=>$O(e,{wrapMode:r})),l>0&&(0,$.jsx)(`div`,{className:`flex flex-col gap-field`,hidden:!a,...tO(m,Nde),children:e.slice(i).map(e=>$O(e,{wrapMode:r}))})]}):c.map(e=>$O(e,{wrapMode:r})),l>0&&(0,$.jsxs)(X,{type:`button`,variant:Y.GHOST,size:Xd.SM,className:`self-start`,onClick:()=>o(!a),"aria-expanded":a,children:[a?d:u,p(a?H.CHEVRON_UP:H.CHEVRON_DOWN,{size:fa.SM})]})]})},Fde=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let[a,o]=(0,Q.useState)(0),s=ok(),c=(0,Q.useId)(),l=t.orientation??Wl.HORIZONTAL,u=t.showProgress??!1,d=t.allowSkip??!1,f=t.nextLabel??s(`stepperNext`),p=t.previousLabel??s(`stepperPrevious`),m=e=>d||e<=a+1,h=t=>{t<0||t>=e.length||m(t)&&(o(t),i?.(e[t].id))},g=nO(),_=eO(t=>{let n=e.findIndex(e=>e.id===t);return n<0||n===a?!1:(o(n),i?.(t),!0)}),v=e[a],y=(e,t)=>(0,$.jsx)(`div`,{hidden:t!==a,...tO(_,e.id),className:`animate-in fade-in-0 duration-[var(--motion-duration-fast)]`,children:ek(e,(0,$.jsx)(tk,{section:e}),r)},e.id);return(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-section`,n),children:[(0,$.jsx)(`nav`,{id:c,"aria-label":t.ariaLabel??s(`stepperProgressNav`),children:(0,$.jsx)(zO,{currentStep:a,totalSteps:e.length,orientation:l,onStepSelect:h,isStepSelectable:e=>e!==a&&m(e),...t.completedIcon===void 0?{}:{completedIcon:t.completedIcon},role:`list`,children:e.map((t,n)=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsxs)(BO,{step:n,role:`listitem`,"aria-current":n===a?`step`:void 0,children:[(0,$.jsx)(VO,{step:n,"aria-hidden":`true`}),(0,$.jsx)(UO,{step:n,children:t.title})]}),n<e.length-1&&(0,$.jsx)(HO,{step:n,"aria-hidden":`true`})]},t.id))})}),u&&(0,$.jsx)(`div`,{className:`w-full bg-muted rounded-full h-2`,children:(0,$.jsx)(`div`,{className:`bg-primary h-2 rounded-full transition-[width]`,style:{width:`${(a+1)/e.length*100}%`},role:`progressbar`,"aria-labelledby":c,"aria-valuenow":a+1,"aria-valuemin":1,"aria-valuemax":e.length})}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-field`,children:[g?e.map(y):v&&y(v,a),(0,$.jsxs)(`div`,{className:`flex justify-between`,children:[(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,onClick:()=>h(a-1),disabled:a===0,children:p}),a<e.length-1&&(0,$.jsx)(X,{type:`button`,onClick:()=>h(a+1),children:f})]})]})]})},Ide=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=ok();return(0,$.jsx)(`div`,{className:n,role:`region`,"aria-label":t.ariaLabel??i(`timelineRegion`),children:(0,$.jsx)(Yf,{className:`gap-section`,children:e.map((e,t)=>(0,$.jsx)(Wf,{children:(0,$.jsx)(bf,{children:ek(e,(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element mb-element`,children:[e.icon,(0,$.jsx)(`h3`,{className:`font-semibold`,children:e.title}),(0,$.jsx)(Hf,{variant:`outline`,className:`ms-auto`,children:i(`timelineStep`,{step:t+1})})]}),e.description&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground mb-element`,children:e.description}),e.content]}),r)})},e.id))})})},Lde=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=ok(),a=t.currentStage;if(a===void 0)return e.map(e=>e.id).join(`|`),(0,$.jsx)(sk,{sections:e,config:{mode:Mr.INLINE},className:n,sectionWrapMode:r});let o=YO(e.map(e=>e.id),a),s=o.indexOf(GO.CURRENT);return(0,$.jsx)(`div`,{className:n,role:`region`,"aria-label":t.ariaLabel??i(`stagesRegion`),"data-current-stage":a??void 0,children:(0,$.jsx)(zO,{currentStep:s,totalSteps:e.length,orientation:Wl.VERTICAL,role:`list`,children:e.map((t,n)=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsxs)(BO,{step:n,role:`listitem`,"data-stage":t.id,"data-stage-state":o[n],"aria-current":o[n]===GO.CURRENT?`step`:void 0,children:[(0,$.jsx)(VO,{step:n,"aria-hidden":`true`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(UO,{step:n,children:t.title}),t.description!=null&&(0,$.jsx)(WO,{step:n,children:t.description}),(0,$.jsx)(`div`,{className:`mt-field`,children:t.content})]})]}),n<e.length-1&&(0,$.jsx)(HO,{step:n,"aria-hidden":`true`,className:`ms-[calc(1rem-1px)] my-element`})]},t.id))})})};nk.displayName=`ContentSectionContainer`;function lk(e,t,n){if(!e||typeof e!=`object`)return;let r=e;if(typeof r.type==`string`||typeof r.message==`string`)n.push({path:t,error:r});else for(let[e,i]of Object.entries(r))lk(i,e===`root`?t:`${t}.${e}`,n)}function uk(e,t){let n=[];for(let r of t)lk(e.getFieldState(r).error,r,n);return n}var dk=e=>e.type===`server`||e.type===`server-unique`;async function fk(e,t){if(t.length===0)return!0;let n=uk(e,t).filter(e=>dk(e.error)),r=await e.trigger(t);for(let{path:t,error:r}of n)e.getFieldState(t).error||e.setError(t,{type:r.type,message:r.message});if(r&&n.length===0)return!0;let i=uk(e,t),a=e,o=pk(a);for(let e of i)dk(e.error)||o.has(e.path)||a.setValue(e.path,a.getValues(e.path),{shouldTouch:!0,shouldDirty:!1,shouldValidate:!1});return aO(i.map(e=>e.path)),!1}function pk(e){let t=e.control._names?.array;return t instanceof Set?t:new Set}var mk=(0,Q.createContext)(null);function hk({value:e,children:t}){return(0,$.jsx)(mk.Provider,{value:e,children:t})}function gk(){let e=(0,Q.useContext)(mk);if(!e)throw Error(`useDisplayTemplateContext() must be used within a <DisplayTemplateProvider>. This is provided automatically by AutomaticDisplayer / ResourceAutomaticDisplayer.`);return e}function _k(){return(0,Q.useContext)(mk)}var vk=(0,Q.createContext)(void 0);function yk({displayChromeMode:e,sectionChromeMode:t,children:n}){let r=(0,Q.useMemo)(()=>({displayChromeMode:e,sectionChromeMode:t}),[e,t]);return(0,$.jsx)(vk.Provider,{value:r,children:n})}function bk(){return(0,Q.useContext)(vk)??{}}function xk({children:e}){let{displayChromeMode:t}=bk();return(0,$.jsx)(yk,{displayChromeMode:t,sectionChromeMode:void 0,children:e})}var Sk;(function(e){e.FORM=`form`,e.DISPLAY=`display`,e.COMPOSITE=`composite`})(Sk||={});var Ck=new Set(Object.values(Ho));function wk(e){if(typeof e==`string`)return Ck.has(e)?e:Ho.STACKED;let t={};for(let[n,r]of Object.entries(e))t[n]=r&&Ck.has(r)?r:Ho.STACKED;return t}function Tk(e){return XO(e)}var Ek=(0,Q.createContext)(null);function Dk(){let[e]=(0,Q.useState)(()=>{let e=[],t=new Map,n=!1,r=new Set,i=()=>{for(let e of r)e()},a=()=>{let e=t.size>0&&![...t.values()].some(Boolean);e!==n&&(n=e,i())};return{registerField:t=>{e.includes(t)||(e=[...e,t],i())},unregisterField:t=>{e.includes(t)&&(e=e.filter(e=>e!==t),i())},getRegisteredFields:()=>e,reportSlotPresence:(e,n)=>{t.set(e,n),a()},clearSlotPresence:e=>{t.delete(e)&&a()},showsNoField:()=>n,subscribeToRegisteredFields:e=>(r.add(e),()=>{r.delete(e)})}});return e}function Ok(e){let t=(0,Q.useContext)(Ek);(0,Q.useEffect)(()=>(t?.registerField(e),()=>{t?.unregisterField(e)}),[t,e])}var kk=[],Ak=()=>()=>{};function jk(){let e=(0,Q.useContext)(Ek);return(0,Q.useSyncExternalStore)(e?e.subscribeToRegisteredFields:Ak,e?e.getRegisteredFields:()=>kk)}function Mk(e){let t=(0,Q.useContext)(Ek),[n]=(0,Q.useState)(()=>({}));(0,Q.useLayoutEffect)(()=>()=>{t?.clearSlotPresence(n)},[t,n]),(0,Q.useLayoutEffect)(()=>{t?.reportSlotPresence(n,e)},[t,n,e])}function Nk(e){let[t,n]=(0,Q.useState)(!1);return(0,Q.useLayoutEffect)(()=>{let t=()=>n(e.showsNoField());return t(),e.subscribeToRegisteredFields(t)},[e]),t}var Pk;(function(e){e.FIELD_SLOT=`field_slot`,e.FIELD_SLOT_CONTAINER=`field_slot_container`})(Pk||={});var Fk=Symbol.for(`wildo.sectionContentRole`);function Ik(e){return e!==null&&(typeof e==`function`||typeof e==`object`)?e[Fk]:void 0}function Lk(e,t){Object.defineProperty(e,Fk,{value:t,enumerable:!1})}var Rk;(function(e){e.FIELD_SLOTS=`field_slots`,e.NOTHING=`nothing`,e.CONTENT=`content`})(Rk||={});function zk(e,t,n){let r=!1;for(let i of Q.Children.toArray(e)){if(!(0,Q.isValidElement)(i))return Rk.CONTENT;let e=i.props,a;if(i.type===Q.Fragment)a=zk(e.children,t,n);else if(typeof i.type==`string`)a=!i.type.includes(`-`)&&zk(e.children,t,n)===Rk.FIELD_SLOTS?Rk.FIELD_SLOTS:Rk.CONTENT;else{let r=i.type[Fk],o=typeof e.name==`string`?e.name:void 0,s=o?t?`${t}.${o}`:o:t;r===Pk.FIELD_SLOT?(n.push({path:s,hasOwnSchema:e.schema!==void 0}),a=Rk.FIELD_SLOTS):a=r===Pk.FIELD_SLOT_CONTAINER?zk(e.children,s,n):Rk.CONTENT}if(a===Rk.CONTENT)return Rk.CONTENT;a===Rk.FIELD_SLOTS&&(r=!0)}return r?Rk.FIELD_SLOTS:Rk.NOTHING}function Bk(e){return zk(e,``,[])===Rk.FIELD_SLOTS}function Vk(e,t=``){let n=[];return zk(e,t,n)===Rk.FIELD_SLOTS?n:null}var Hk=(0,Q.createContext)(null);function Uk(){let[e]=(0,Q.useState)(()=>{let e=new Map;return{place:t=>(e.set(t,(e.get(t)??0)+1),()=>{let n=(e.get(t)??1)-1;n>0?e.set(t,n):e.delete(t)}),placedFields:()=>new Set(e.keys())}});return e}function Wk(e){return e.match(/^[^.[\]]+/)?.[0]??e}var Gk=Symbol.for(`wildo.placesNamedField`);function Kk(e){Object.defineProperty(e,Gk,{value:!0,enumerable:!1})}var qk=1e4,Jk=5e4,Yk=200;function Xk(e,t=``){let n=[],r=(e,t)=>typeof e==`string`&&e!==``?t?`${t}.${e}`:e:t,i=new Set,a=0,o=(e,t)=>{try{if((0,Q.isValidElement)(e)){let t=e.type,n=e.props??{};return{element:{type:t,props:n,keys:Object.keys(n)}}}let n=e[Symbol.iterator];if(typeof n==`function`){let t=n.call(e);if(t===e)return null;let r=[],i=t.next();for(;!i.done&&r.length<qk;)r.push(i.value),i=t.next();return i.done||t.return?.(),{entries:r,isCollection:!0}}if(t&&Object.getPrototypeOf(e)===Object.prototype)return{entries:Object.values(e),isCollection:!1}}catch{}return null},s=(e,t,n,r)=>{if(typeof e!=`object`||!e||i.has(e)||r>Yk||++a>Jk)return;let l=o(e,n>0);if(l){if(i.add(e),`element`in l)c(l.element,t,r);else{let e=l.isCollection?n:n-1;for(let n of l.entries)s(n,t,e,r+1)}i.delete(e)}},c=({type:e,props:t,keys:i},a,o)=>{if(e===Q.Fragment){s($k(t,`children`),a,0,o+1);return}let c=Zk(e);if(c===Pk.FIELD_SLOT||Qk(e)){n.push(r($k(t,`name`),a));return}let l=c===Pk.FIELD_SLOT_CONTAINER?r($k(t,`name`),a):a;for(let e of i)s($k(t,e),l,e===`children`?0:1,o+1)};return s(e,t,0,0),n.filter(e=>e!==``)}function Zk(e){try{return Ik(e)}catch{return}}function Qk(e){try{return e!==null&&(typeof e==`function`||typeof e==`object`)&&e[Gk]===!0}catch{return!1}}function $k(e,t){try{return e[t]}catch{return}}function eA(e){let t=(0,Q.useContext)(Hk),n=e.map(Wk).join(`\0`);(0,Q.useLayoutEffect)(()=>{if(!t||n===``)return;let e=n.split(`\0`).map(e=>t.place(e));return()=>e.forEach(e=>e())},[t,n])}function tA(e,t){let n=(0,Q.useContext)(Hk);eA((0,Q.useMemo)(()=>n?Xk(e,t):[],[n,e,t]))}var nA=(0,Q.createContext)(null);function rA({value:e,children:t}){let n=(0,Q.useMemo)(()=>e,[e]);return(0,$.jsx)(nA.Provider,{value:n,children:t})}function iA(){return(0,Q.useContext)(nA)}var aA=(0,Q.createContext)(!1);function oA(){return(0,Q.useContext)(aA)}var sA=Jo.getLogger();function cA(e){let{name:t,className:n,saveable:r,chromeMode:i,children:a,defaultFocus:o=!0,hideTitle:s=!1,hideDescription:c=!1}=e,l=e.appearance??Mr.DEFAULT,u=ZT(),d=_k(),f=iA(),p=f?.sectionEntries?.[t],m=p?.icon?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`me-element inline-flex items-center`,children:p.icon}),p.title??``]}):p?.title,h=u?.sectionLabels?.[t]??d?.sectionLabels?.[t]??m,g=u?.sectionDescriptions?.[t]??d?.sectionDescriptions?.[t]??p?.description,_=s?void 0:h,v=c?void 0:g,y=e.disabled??u?.disabled,b=u?.onSectionSave,x=!!(r&&b),S=u?Sk.FORM:d?Sk.DISPLAY:f?Sk.COMPOSITE:Sk.DISPLAY;if(S===Sk.COMPOSITE&&i)throw V.buildConfigurationError(ii.CONFIGURATION,{component:`Section`,message:`Section chromeMode is only supported inside form/display section hosts. Composite-hosted sections must not declare chromeMode until a dedicated composite chrome contract exists.`,sectionName:t});let C=Dk(),w=Nk(C),{pathPrefix:T}=RD();tA(a,T);let E=w&&Bk(a);if(!Tk(l))return(0,$.jsx)($.Fragment,{children:a});let D=(0,$.jsx)(aA.Provider,{value:!!_,children:(0,$.jsxs)(Ek.Provider,{value:C,children:[(0,$.jsx)(uA,{hostKind:S,chromeMode:i,children:a}),x&&(0,$.jsx)(dA,{sectionName:t,disabled:y})]})});return(0,$.jsx)(BT,{appearance:l,legend:_,description:v,disabled:y,defaultOpen:o,className:n,"data-guidance-section":t,"data-composite-section":S===Sk.COMPOSITE?t:void 0,hidden:E||void 0,children:D})}cA.displayName=`Section`;function lA({hostKind:e,sectionProps:t,providesHeading:n=!1}){let{children:r,chromeMode:i,saveable:a,name:o,className:s,disabled:c}=t,l=Dk(),u=r;return u=e===Sk.FORM?(0,$.jsxs)(Ek.Provider,{value:l,children:[(0,$.jsx)(uA,{hostKind:e,chromeMode:i,children:r}),a&&(0,$.jsx)(dA,{sectionName:o,disabled:c})]}):(0,$.jsx)(uA,{hostKind:e,chromeMode:i,children:r}),(0,$.jsx)(aA.Provider,{value:n,children:(0,$.jsx)(`div`,{className:s?`space-y-field ${s}`:`space-y-field`,"data-guidance-section":o,"data-composite-section":e===Sk.COMPOSITE?o:void 0,children:u})})}function uA({hostKind:e,chromeMode:t,children:n}){let{displayChromeMode:r}=bk(),{formChromeMode:i}=fT();return t?e===Sk.FORM?(0,$.jsx)(dT,{formChromeMode:i,sectionChromeMode:t,children:n}):e===Sk.DISPLAY?(0,$.jsx)(yk,{displayChromeMode:r,sectionChromeMode:wk(t),children:n}):n:n}function dA({sectionName:e,disabled:t}){let n=rw(),r=ZT(),i=jk(),[a,o]=(0,Q.useState)(!1),{tComponent:s,isReady:c}=K({component:J.LOW_LEVEL_FORM_MESSAGE}),l=r?.onSectionSave;if(!l||!c)return null;let u=async()=>{if(i.length!==0&&await fk(n,i)){o(!0);try{let t=n.getValues();await l(e,i,t)}catch(t){sA.error(`[SectionSaveButton] The section save handler threw.`,{sectionName:e,error:t})}finally{o(!1)}}},d=s(J.LOW_LEVEL_FORM_MESSAGE,`sectionSaving`),f=s(J.LOW_LEVEL_FORM_MESSAGE,`sectionSave`);return(0,$.jsx)(`div`,{className:`flex justify-end pt-item`,children:(0,$.jsx)(X,{type:`button`,variant:Y.SECONDARY,size:Xd.SM,onClick:u,disabled:t||a||i.length===0,children:a?d:f})})}function fA(e){return(0,Q.isValidElement)(e)&&e.type===cA}Jo.getLogger();function pA(e,t){return vde(e,fA,t)}function mA(e){return bde(e)}function hA({className:e,children:t,contextFieldValues:n,autoInjectSubmitButton:r=!0,responsiveMaxWidth:i=`measure`}){let a=(0,Q.useRef)(new Set),o=(0,Q.useRef)(!1),[s,c]=(0,Q.useState)({errorSummary:!1,submitButton:!1}),l=yE()!==null,u=(0,Q.useCallback)(e=>{a.current.add(e)},[]),d=(0,Q.useCallback)(()=>{o.current=!0},[]),f=(0,Q.useMemo)(()=>({registerSlot:u,registerWizardRoot:d}),[u,d]);(0,Q.useLayoutEffect)(()=>{let e=requestAnimationFrame(()=>{let e={errorSummary:!a.current.has(`errorSummary`),submitButton:r&&!l&&!o.current&&!a.current.has(`submitButton`)};(e.errorSummary||e.submitButton)&&c(e)});return()=>cancelAnimationFrame(e)},[r,l]);let p=ZT();tA(t,``);let m=(0,Q.useMemo)(()=>_A(t,p),[t,p]);return(0,$.jsx)(BD.Provider,{value:f,children:(0,$.jsx)(ND,{voice:void 0,children:(0,$.jsx)(LD,{pathPrefix:``,children:(0,$.jsx)(`div`,{className:U(`mr-auto w-full`,e),style:{maxInlineSize:mD(i)},"data-inline-size-tier":i,"data-guidance-form":``,"data-slot":`form-layout`,children:(0,$.jsxs)(ob,{children:[s.errorSummary?(0,$.jsx)(pO,{className:`mb-4`}):null,(0,$.jsx)(`div`,{className:`space-y-section [&>[data-chrome-mode^=settings]:has(+[data-chrome-mode^=settings])]:mb-0`,children:m}),s.submitButton?(0,$.jsx)(hO,{className:`mt-6`}):null]})})})})})}function gA(e,t){if(!t)return!1;let n=Vk(e);return n!==null&&n.length>0&&n.every(e=>!e.hasOwnSchema&&sr.resolveFieldSchemaPath(t,e.path)===void 0)}function _A(e,t){let n=pA(e);return(0,$.jsx)($.Fragment,{children:n.items.map((e,n)=>{if(e.type===`node`)return(0,$.jsx)(Q.Fragment,{children:e.node},n);let r=e.group.sections.filter(e=>!gA(e.props.children,t?.schema));if(r.length===0)return null;let i={...e.group,sections:r},a=mA(i),o=t?.sectionLabels??{},s=t?.sectionDescriptions??{},c=i.sections.map(e=>({id:e.props.name,title:o[e.props.name],description:s[e.props.name],content:(0,$.jsx)(vA,{sectionProps:e.props,providesHeading:!!o[e.props.name]})}));return(0,$.jsx)(nk,{sections:c,config:a},`group-${i.mode}-${n}`)})})}function vA({sectionProps:e,providesHeading:t}){return(0,$.jsx)(lA,{hostKind:Sk.FORM,sectionProps:e,providesHeading:t})}function yA(e){let t=e.match(/^(.+)\[(\d+)]$/);return t?{key:t[1],index:parseInt(t[2],10)}:{key:e}}function bA(e,t){return Array.isArray(e)?[...e]:typeof e==`object`&&e?{...e}:t?.index==null?{}:[]}function xA(e,t){if(!e)return;let n=t.split(`.`),r=e;for(let e of n){let{key:t,index:n}=yA(e),i=sr.getObjectLikeFieldShape(r,{commonOnly:!1})??null;if(!i||!(t in i))return;if(r=i[t],n!=null){let e=Nr(r).element;if(!e)return;r=e}}return r}function SA(e,t){if(!e)return;let n=t.split(`.`),r=e;for(let e of n){if(typeof r!=`object`||!r)return;let{key:t,index:n}=yA(e);if(r=r[t],n!=null){if(!Array.isArray(r))return;r=r[n]}}return r}function CA(e,t){if(!t||!e)return e;let n=SA(e,t);if(typeof n==`object`&&n&&!Array.isArray(n))return n}function wA(e,t,n){let r=yA(t.split(`.`)[0]).key,i=TA(e??{},t,n);return{[r]:i[r]}}function TA(e,t,n){let r=t.split(`.`).map(yA),i={...e},a=i;return r.forEach((e,t)=>{let i=t===r.length-1,o=r[t+1];if(e.index!=null){let t=a[e.key],r=Array.isArray(t)?[...t]:[];if(a[e.key]=r,i){r[e.index]=n;return}let s=bA(r[e.index],o);r[e.index]=s,a=s;return}if(i){a[e.key]=n;return}let s=bA(a[e.key],o);a[e.key]=s,a=s}),i}function EA(e,t){if(e==null)return;if(typeof e!=`object`||Array.isArray(e)||!Object.keys(e).some(e=>e===ci.MOBILE||e===ci.VERT_TABLET||e===ci.DESKTOP))return e;let n=e;return n[t]??n[ci.DESKTOP]??n[ci.VERT_TABLET]??n[ci.MOBILE]}var DA=`data-collection-surface`;function OA({className:e,children:t,responsiveMaxWidth:n}){let r=_k(),i=(0,Q.useMemo)(()=>kA(t,r),[t,r]);return(0,$.jsx)(LD,{pathPrefix:``,children:(0,$.jsx)(ND,{voice:Lu.EYEBROW,children:(0,$.jsx)(`div`,{className:U(`mr-auto w-full space-y-section`,`[&>[data-chrome-mode^=settings]:has(+[data-chrome-mode^=settings])]:mb-0`,n===void 0&&`[max-inline-size:var(--measure-max-width,42rem)] has-[[data-collection-surface]]:[max-inline-size:none]`,e),style:n===void 0?void 0:{maxInlineSize:mD(n)},"data-inline-size-tier":n??`derived`,"data-guidance-display":!0,children:i})})})}function kA(e,t){let n=pA(e,t?.defaultSectionAppearance);return(0,$.jsx)($.Fragment,{children:n.items.map((e,n)=>{if(e.type===`node`)return(0,$.jsx)(Q.Fragment,{children:e.node},n);let{group:r}=e,i=AA(mA(r),r,t),a=t?.sectionLabels??{},o=t?.sectionDescriptions??{},s=r.sections.map(e=>({id:e.props.name,title:a[e.props.name],description:o[e.props.name],content:(0,$.jsx)(jA,{sectionProps:e.props,providesHeading:!!a[e.props.name]})}));return(0,$.jsx)(nk,{sections:s,config:i},`group-${r.mode}-${n}`)})})}function AA(e,t,n){if(e.mode!==Mr.STAGES||n===null)return e;let[r,...i]=t.sections,a=t.sections.map(e=>e.props.name),o=e=>`stageBinding`in e?e.stageBinding:void 0,s=i.find(e=>o(e.props)!==void 0);if(s!==void 0)throw new KO(`section "${s.props.name}" declares a stageBinding, but a group's binding is read from its FIRST section ("${r.props.name}"). Declare it there, once.`);let c=o(r.props),l=c?xA(n.schema,c.field):void 0;qO(c,a,l?qc(l):void 0);let u=n.isLoading?null:JO(c,SA(n.data,c.field));return{...e,currentStage:u}}function jA({sectionProps:e,providesHeading:t}){return(0,$.jsx)(lA,{hostKind:Sk.DISPLAY,sectionProps:e,providesHeading:t})}var MA=(0,Q.createContext)(!1);function NA(){return(0,Q.useContext)(MA)}var PA=new Set([bc.ARRAY,bc.SET,bc.TUPLE,bc.RECORD,bc.MAP,bc.OBJECT,bc.VERSIONED_OBJECT,bc.CODE,bc.FILE,bc.ADDRESS]),FA=new Set([S.MULTILINE,S.MARKDOWN,S.UNTRUSTED_HTML]);function IA(e,t,n){return n===qa.SUMMARY?!0:e?PA.has(e)?!0:e===bc.STRING&&!!t&&FA.has(t):!1}function LA({className:e,children:t}){let{displayChromeMode:n}=bk();return(0,$.jsx)(MA.Provider,{value:!0,children:(0,$.jsx)(yk,{displayChromeMode:n,sectionChromeMode:Ho.TILE,children:(0,$.jsx)(`dl`,{"data-slot":`field-tiles`,className:U(`m-0 grid gap-field-sm grid-cols-[repeat(auto-fill,minmax(min(100%,9rem),1fr))] [&>[data-tile-span=full]]:col-span-full empty:hidden`,e),children:t})})})}LA.displayName=`FieldTiles`;function RA({className:e,children:t}){let{displayChromeMode:n}=bk();return(0,$.jsx)(yk,{displayChromeMode:n,sectionChromeMode:Ho.HIDDEN,children:(0,$.jsx)(`div`,{"data-slot":`record-state`,className:U(`flex min-w-0 flex-wrap items-center gap-x-group gap-y-item [&>*]:w-auto empty:hidden`,e),children:t})})}RA.displayName=`RecordState`;function zA({className:e,children:t}){let{displayChromeMode:n}=bk();return(0,$.jsx)(yk,{displayChromeMode:n,sectionChromeMode:Ho.INLINE,children:(0,$.jsx)(`div`,{"data-slot":`record-keeping-facts`,className:U(`flex min-w-0 flex-wrap items-baseline gap-x-group gap-y-item border-t border-border pt-element text-xs text-foreground-subtle [&_*]:text-xs [&_*]:text-foreground-subtle [&>*]:w-auto [&:not(:has(*))]:hidden`,e),children:t})})}zA.displayName=`RecordKeepingFacts`;var BA;(function(e){e.STATE=`state`,e.CONTENT=`content`,e.FACT=`fact`,e.RECORD_KEEPING=`record_keeping`,e.IDENTITY_PLUMBING=`identity_plumbing`})(BA||={});var VA=Pre.BADGE,HA=new Set([Ho.HIDDEN,Ho.COMPACT]);function UA(e){let t=Ys(e)?.chromeMode;return sc(e)!==bc.OBJECT&&typeof t==`string`&&HA.has(t)}var WA=new Set([...lie.filter(e=>!Ao.includes(e)),..._e]);function GA(e,t,n){if(V.isIdentityOnlySummaryField(e,n))return BA.IDENTITY_PLUMBING;let r=sc(t),i=Ys(t);return r===bc.ENUM&&i?.displayMode===VA?BA.STATE:WA.has(e)?BA.RECORD_KEEPING:UA(t)?BA.CONTENT:BA.FACT}function KA(e){if(!e.data||typeof e.data!=`object`)return[];let t=e.registry.resourceConfigurations?.[e.resourceType];if(!V.frontendResourceLabelDefinitionOf(t))return[];let n=V.computeFrontendResourceLabel({resourceType:e.resourceType,registry:e.registry,currentObject:e.data,t:e.t,formatDate:e.formatDate,formatDateTime:e.formatDateTime});if(!n)return[];let r=e.data,i=Object.entries(r).filter(([,e])=>typeof e==`string`&&e===n).map(([e])=>e),a=V.frontendResourceLabelDefinitionOf(t);if(Array.isArray(a))return i.filter(e=>a.includes(e));if(typeof a!=`function`)return[];let o=a,s=t=>{try{return o({currentObject:t,objectContext:{},t:e.t,formatDate:e.formatDate,formatDateTime:e.formatDateTime,resourceType:e.resourceType})}catch{return}},c=s(r);return i.filter(e=>s({...r,[e]:void 0})!==c)}var qA;(function(e){e.DISPLAY=`display`,e.SUMMARY=`summary`})(qA||={});var JA=(0,Q.createContext)(qA.DISPLAY);function YA({kind:e,children:t}){return(0,$.jsx)(JA.Provider,{value:e,children:t})}function XA(){return(0,Q.useContext)(JA)}function ZA(e){return QA(e,(0,Q.useContext)(JA))}function QA(e,t){if(t!==qA.SUMMARY)return e?.display;if(e?.display||e?.summaryOverride)return{...e?.display,...e?.summaryOverride}}function $A(e){if(e==null)return!0;if(typeof e==`string`)return e.trim()===``;if(Array.isArray(e))return e.length===0;if(typeof e==`object`){let t=Object.getPrototypeOf(e);if(t===Object.prototype||t===null)return Object.keys(e).length===0}return!1}function ej({children:e}){let{displayChromeMode:t}=bk();return(0,$.jsx)(MA.Provider,{value:!1,children:(0,$.jsx)(yk,{displayChromeMode:t,sectionChromeMode:void 0,children:e})})}function tj({active:e,name:t,label:n,termAnnounced:r=!1,children:i}){return e?(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`tile`,"data-tile-row":``,"data-tile-span":`full`,"data-field":t,className:`min-w-0`,children:[n&&(0,$.jsx)(`dt`,{className:`sr-only`,"aria-hidden":r?void 0:`true`,children:n}),(0,$.jsx)(`dd`,{className:`m-0 min-w-0`,children:(0,$.jsx)(ej,{children:i})})]}):(0,$.jsx)($.Fragment,{children:i})}function nj(e,t){if(e!=null)return typeof e==`string`?e:e[t]??e[ci.DESKTOP]}var rj=(0,Q.createContext)(!1);function ij(){return(0,Q.useContext)(rj)}var aj=new Set([bc.BOOLEAN,bc.NUMBER,bc.BIGINT,bc.BIGDECIMAL,bc.RANGE_NUMBER,bc.RANGE_BIGDECIMAL]),oj=new Set([bc.DATE,bc.DATETIME,bc.TIME,bc.RANGE_DATE,bc.RANGE_DATETIME,bc.RANGE_TIME]),sj=new Set([Ho.COMPACT,Ho.HIDDEN]);function cj(e){return e!==void 0&&aj.has(e)}function lj(e){return!$A(e)}function uj(e){let t=0;return e.map(({schemaType:e,present:n})=>!n||e===void 0||!oj.has(e)?!1:(t+=1,t>1))}function dj(e){let t=uj(e);return e.map(({schemaType:e,present:n},r)=>n&&(cj(e)||t[r]))}function fj(e,t){let n=dj(t);return t.map(({present:t,declaredChrome:r},i)=>{if(!t)return!1;let a=r??e;return a===void 0?n[i]:!sj.has(a)})}var pj=zs(J.LOW_LEVEL_TOOLTIP,`Tooltip`,[`Trigger`,`Content`,`Provider`]);function mj({preset:e=q.DEFAULT,...t}){let n=pj(e);return(0,$.jsx)(n,{...t})}function hj({preset:e=q.DEFAULT,...t}){let n=pj(e);return(0,$.jsx)(n.Trigger,{...t})}function gj({preset:e=q.DEFAULT,...t}){let n=pj(e);return(0,$.jsx)(n.Content,{...t})}function _j({preset:e=q.DEFAULT,...t}){let n=pj(e);return(0,$.jsx)(n.Provider,{...t})}function vj({provenance:e,className:t}){let n=vne(e.system),r=(0,Q.useMemo)(()=>[n],[n]),{tComponent:i,t:a,formatDateTimeForDisplayMode:o,isReady:c}=K({component:J.LOW_LEVEL_FORM_FIELD,keys:r});if(!c)return null;let l=a(n),u=o(e.currentAsOf,s.AUTO);return(0,$.jsx)(Ox,{className:t,"data-field-provenance":``,children:i(J.LOW_LEVEL_FORM_FIELD,`syncedFromAsOf`,{system:l,asOf:u})})}vj.displayName=`DisplayFieldProvenanceNote`;function yj(e,t){return nj(e,t)??Ho.STACKED}function bj({text:e}){let{renderIcon:t}=Rf(),{tComponent:n,isReady:r}=K({component:J.LOW_LEVEL_FORM_FIELD});return r?(0,$.jsxs)(mj,{children:[(0,$.jsx)(hj,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.ICON_SM,className:`ms-1 rounded-full`,"aria-label":n(J.LOW_LEVEL_FORM_FIELD,`moreInformation`),tabIndex:-1,children:t(H.INFO,{size:fa.XS})})}),(0,$.jsx)(gj,{children:e})]}):null}function xj({mode:e,label:t,labelStyle:n,description:r,tooltip:i,name:a,labelPlacement:o,hideLabel:s,hideDescription:c,provenance:l,wide:u,announceName:d=!1,className:f,children:p}){let{currentBreakpoint:m,isMobile:h,getRecipe:g}=e_(),_=NA(),v=g(wi.TYPOGRAPHY,Lu.DESCRIPTION),y=g(wi.TYPOGRAPHY,Lu.EYEBROW),b=(0,Q.useMemo)(()=>yj(e,m),[e,m]),x=o??(b===Ho.INLINE?`start`:`top`),S=!s&&!!t&&x!==`hidden`&&b!==Ho.COMPACT&&b!==Ho.HIDDEN,C=!c&&!!r&&b!==Ho.COMPACT&&b!==Ho.HIDDEN,w=!!l,T=w?(0,$.jsx)(vj,{provenance:l}):null,E=!S&&!s&&t&&(x===`hidden`||d)?(0,$.jsx)(`span`,{className:`sr-only`,children:d?`${t}: `:t}):null;if(b===Ho.HIDDEN)return(0,$.jsxs)($.Fragment,{children:[E,p]});if(b===Ho.TILE){let e=_?`dt`:`div`,n=_?`dd`:`div`,o=S?t:t?(0,$.jsx)(`span`,{className:`sr-only`,children:t}):null,s=[i,C?r:void 0].filter(e=>!!e).join(` — `)||void 0;return(0,$.jsx)(AD,{asChild:!0,variant:Ja.TILE,children:(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`tile`,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,"data-tile-span":u?`full`:void 0,className:U(`flex min-w-0 flex-col gap-item`,f),children:[o&&(0,$.jsxs)(e,{className:U(`flex min-w-0 items-center`,S&&y.base),children:[o,S&&s&&(0,$.jsx)(bj,{text:s})]}),(0,$.jsxs)(n,{className:`m-0 min-w-0 font-medium [overflow-wrap:anywhere]`,children:[(0,$.jsx)(ej,{children:p}),T]})]})})}if(b===Ho.COMPACT)return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`compact`,"data-label-placement":x,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:f,children:[E,p]});if(b===Ho.INLINE)return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`inline`,"data-label-placement":x,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:U(`flex flex-wrap items-baseline gap-x-1.5 gap-y-element-xs`,f),children:[E,S&&(0,$.jsxs)(`span`,{className:U(`shrink-0`,v.base),children:[t,`:`,i&&(0,$.jsx)(bj,{text:i})]}),(0,$.jsx)(`div`,{className:`min-w-0`,children:p}),C&&(0,$.jsx)(Ox,{className:`w-full`,children:r}),w&&(0,$.jsx)(vj,{provenance:l,className:`w-full`})]});if(b===Ho.SETTINGS_ROW)return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`settings_row`,"data-settings-row-layout":h?`stacked`:void 0,"data-label-placement":x,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:U(`flex min-h-10 px-card py-card-sm border-b border-border last:border-b-0 hover:bg-muted/50 transition-colors`,h?`flex-col gap-element-xs`:U(`flex-row gap-section`,C?`items-start`:`items-center`),f),children:[(0,$.jsxs)(`div`,{className:U(`flex min-w-0 flex-col gap-element-xs`,!h&&`flex-1`),children:[E,S&&(0,$.jsxs)(Tx,{children:[t,i&&(0,$.jsx)(bj,{text:i})]}),C&&(0,$.jsx)(Ox,{children:r})]}),(0,$.jsxs)(`div`,{className:U(`flex min-w-0 flex-col gap-element-xs font-medium`,`[&>[data-list-shape=primitive]]:flex-row [&>[data-list-shape=primitive]]:flex-wrap [&>[data-list-shape=primitive]]:gap-x-element`,h?`w-full items-start text-start`:`w-72 max-w-[55%] shrink items-end text-end [&>[data-list-shape=primitive]]:justify-end`),children:[p,T]})]});if(x===`start`||x===`inline`){let e=x===`inline`;return(0,$.jsxs)(wx,{orientation:Cx.HORIZONTAL,"data-slot":`field-chrome`,"data-chrome-mode":`inline`,"data-label-placement":x,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:U(e&&`flex-row-reverse`,f),children:[E,(0,$.jsxs)(Dx,{children:[S&&(0,$.jsx)(Ex,{children:(0,$.jsxs)(Tx,{className:v.base,children:[t,i&&(0,$.jsx)(bj,{text:i})]})}),C&&(0,$.jsx)(Ox,{children:r}),T]}),p]})}return(0,$.jsxs)(wx,{orientation:Cx.VERTICAL,"data-slot":`field-chrome`,"data-chrome-mode":`stacked`,"data-label-placement":x,"data-field":a,"data-testid":a?`field-${a}`:void 0,"data-guidance-field":a,className:f,children:[E,S&&(n===Sl.TITLE?(0,$.jsxs)(`div`,{className:U(`pt-item-xs`,y.base),children:[t,i&&(0,$.jsx)(bj,{text:i})]}):(0,$.jsxs)(Tx,{className:v.base,children:[t,i&&(0,$.jsx)(bj,{text:i})]})),p,C&&(0,$.jsx)(Ox,{children:r}),T]})}xj.displayName=`DisplayFieldChrome`;function Sj(e){let t=e.parentReferenceConfig,n=[...e.referencedIds];if(!t||t.displayMode!==hr.NONE||!e.referencedResourceType||e.referencedResourceType!==t.parentResourceType)return{hidesWholeReference:!1,visibleIds:n};if(t.parentResourceId===void 0)return{hidesWholeReference:!0,visibleIds:[]};let r=n.filter(e=>String(e)!==t.parentResourceId);return{hidesWholeReference:n.length>0&&r.length===0,visibleIds:r}}var Cj=(0,Q.createContext)({resourceType:void 0,resourceId:void 0,doInlineUpdate:async()=>{},canInlineEdit:!1,fileUploadContext:void 0,contextualParameters:void 0,contextResourceIdentifiers:void 0,navigationZone:void 0,parentReferenceConfig:void 0});function wj(){return(0,Q.useContext)(Cj)}var Tj=class extends Error{name=`InlineEditMutationError`;mutationError;constructor(e,t){super(e),this.mutationError=t}};function Ej(e,t){return e!==cl.REFERENCE&&e!==cl.ASSOCIATION?!1:t??!0}function Dj(e,t){let n=t.resourceConfigurations?.[e];return n?[...n.resourceRelationships.parentRelationships,...n.resourceRelationships.childRelationships,...n.resourceRelationships.selfRelationships]:[]}function Oj(e){let t=e.registry.resourceConfigurations?.[e.relatedResourceType];if(!t)return;let n=(t.operations??[]).filter(e=>!e.isBulkOperation&&(e.operationIdentifier===W.CREATE||e.resourceOperationLike===W.CREATE));return n.find(e=>e.variantKey===`quick-add`)??Il(n,W.CREATE)??n[0]}function kj(e,t){let n=Ej(e.semantics.nature,e.relationship.display?.interaction?.allowQuickCreate);return{sourceKind:`relationshipObject`,relatedResourceType:e.relatedResourceType,relationshipNature:e.semantics.nature,allowQuickCreate:n,relatedCreateOperation:Oj({relatedResourceType:e.relatedResourceType,registry:t})}}function Aj(e){let t=e.fieldName.split(`.`)[0],n=Dj(e.resourceType,e.registry).flatMap(n=>{if(n.resourceType1!==e.resourceType&&n.resourceType2!==e.resourceType)return[];let r=Nn.ensureCompiledRelationship.call(Nn,n,e.registry.allResourceFieldIdentifiers);if(Nn.tryResolveRelationshipForeignKeyIdentity(r,e.registry.allResourceFieldIdentifiers)?.fieldIdentifier!==t)return[];let i=Nn.getResolvedRelationshipSemantics(r),a=r.resourceType1===e.resourceType?r.resourceType2:r.resourceType1;return e.relatedResourceType&&a!==e.relatedResourceType?[]:[{sourceKind:`foreignKey`,relatedResourceType:a,relationshipNature:i.nature,allowQuickCreate:Ej(i.nature,r.display?.interaction?.allowQuickCreate),relatedCreateOperation:Oj({relatedResourceType:a,registry:e.registry})}]});if(n.length<=1)return n[0];if(va.isDevelopment())throw V.buildConfigurationError(ii.CONFIGURATION,{resourceType:e.resourceType,fieldName:e.fieldName,reason:`Ambiguous FK relationship quick-create mapping.`,matchCount:n.length})}function jj(e){let t=V.resolveRelationshipObjectFieldSemantics({resourceType:e.resourceType,fieldName:e.fieldName,operationType:e.operationType,registry:e.registry});if(t)return{...t,sourceKind:`relationshipObject`,quickCreate:kj(t,e.registry)}}function Mj(e){let t=V.resolveRelationshipObjectFieldSemantics({resourceType:e.resourceType,fieldName:e.fieldName,registry:e.registry});if(t)return{...t,sourceKind:`relationshipObject`,objectIdentity:Nn.resolveRelationshipObjectIdentityForResource(t.relationship,e.resourceType,e.registry.allResourceFieldIdentifiers)}}function Nj(e){let t=jj(e);if(t)return e.relatedResourceType&&t.relatedResourceType!==e.relatedResourceType?void 0:{sourceFieldName:e.fieldName,quickCreate:t.quickCreate};let n=Aj({resourceType:e.resourceType,fieldName:e.fieldName,relatedResourceType:e.relatedResourceType,registry:e.registry});if(n)return{sourceFieldName:e.fieldName,quickCreate:n}}function Pj(e){let t=e.resolvedSemantics?.handling?.dtoModelMode;return t?t===Bne.NESTED_RESOURCE:Nn.resolveRelationshipNature(e).nature===cl.COMPOSITION}function Fj(e){if(!Nn.isRelationshipActiveForParent(e.relationship,e.parentData,{onMissingParentResource:`exclude`,onConditionError:`exclude`})||!Pj(e.relationship))return;let t=e.relationship.resourceType1===e.parentResourceType?e.relationship.resourceType2:e.relationship.resourceType1,n=Nn.tryResolveRelationshipForeignKeyIdentity(e.relationship,e.registry.allResourceFieldIdentifiers);if(!n?.fieldIdentifier)return;let r=e.relationship.display?.inParentNavigation,i=nt(e.relationship.cardinality2),a=e.viewport??ci.DESKTOP,o=Ij(i),s=Fh(r?.transition,a),c=e.registry.resourceConfigurations[t]?.resourceRelationships,l=c?[...c.parentRelationships,...c.selfRelationships].find(t=>t.resourceType1===e.parentResourceType&&Nn.tryResolveRelationshipForeignKeyIdentity(t,e.registry.allResourceFieldIdentifiers)?.fieldIdentifier===n.fieldIdentifier):void 0;return{relationship:e.relationship,childResourceType:t,foreignKeyField:n.fieldIdentifier,inChildView:l?.display?.inChildView??e.relationship.display?.inChildView,relationshipEdgeKey:V.buildRelationshipEdgeKey({parentResourceType:e.parentResourceType,childResourceType:t,foreignKeyField:n.fieldIdentifier}),navigationConfig:r,transition:s,contentSectionConfig:o,isOneToOne:i}}function Ij(e){return e?{mode:Mr.INLINE}:{mode:Mr.TABS}}function Lj(e){if(!e.navigationZone||!Ch.shouldShowParentReference(e.inlineParentContext,e.navigationZone,e.navigationInitiator,e.getZoneState))return;let t=e.navigationInitiator?.sourceRelationship;if(!t?.parentResourceType)return;let n=t.inChildView;return{parentReference:{parentResourceType:t.parentResourceType,parentResourceId:t.parentResourceId,parentDisplay:n?.parentDisplay??hr.CONTEXT,showParentLink:n?.showParentLink??!0}}}function Rj(e){let t=e.schema?sa(e.schema):void 0;if(!t)return{hiddenFieldNames:[],inlineEditDisabledFieldNames:[]};let n=new Set,r=new Set;for(let i of Object.keys(t)){let a=Mj({resourceType:e.resourceType,fieldName:i,registry:e.registry});if(!a)continue;if(r.add(a.rootFieldName),Fj({parentResourceType:e.resourceType,relationship:a.relationship,parentData:e.parentData,registry:e.registry})){n.add(a.rootFieldName);continue}if(a.semantics.nature===cl.COMPOSITION)continue;let o=a.foreignKeyIdentity?.fieldIdentifier;o&&o!==a.rootFieldName&&Object.prototype.hasOwnProperty.call(t,o)&&n.add(a.rootFieldName)}return{hiddenFieldNames:[...n],inlineEditDisabledFieldNames:[...r]}}function zj(e){let t={};return e.resourceType&&e.fieldName&&(t.writeSurface=jj({resourceType:e.resourceType,fieldName:e.fieldName,operationType:e.operationType,registry:e.registry}),t.readSurface=Mj({resourceType:e.resourceType,fieldName:e.fieldName,registry:e.registry}),t.inlineEditSurface=Nj({resourceType:e.resourceType,fieldName:e.fieldName,operationType:e.operationType,relatedResourceType:e.relatedResourceType,registry:e.registry})),t.navigationSurface=Lj({inlineParentContext:e.inlineParentContext,navigationZone:e.navigationZone,navigationInitiator:e.navigationInitiator,getZoneState:e.getZoneState}),t}function Bj(e,t){if(!e)return;if(!t)return e;if(!e.startsWith(t.pathPrefix))return;let n=e.slice(t.pathPrefix.length).replace(/^(\[\d+\])*\.?/,``);return n===``?void 0:n}function Vj(e){if(e)return e.includes(`.`)?e.split(`.`).pop():e}function Hj(e){let t=kee(e.schema);if(!t||!e.parentData||!e.currentResourceType||!e.registry)return;let n=Vj(e.fieldName);if(!n)return;let r=Nn.getForeignKeyCandidateReferencedTypes(n,e.currentResourceType,e.registry.resourceRelationships);if(r.length!==0)return Nn.resolveDiscriminatedPolymorphicForeignKeyTarget({record:e.parentData,discriminatorField:t.discriminatorField,variants:t.variants,candidateReferencedTypes:r,getResourcePrimaryScope:t=>e.registry?.resourceConfigurations[t]?.resourcePrimaryScope})}function Uj(e){return e.explicitResourceType||(e.schema?Ec(e.schema)?.referencedResourceType:void 0)||(e.fieldName?e.registry?.fieldIdentifierToResourceType?.[e.fieldName]:void 0)||void 0}function Wj(e,t){if(Array.isArray(e)){let n=e.flatMap(e=>{if(typeof e==`string`&&e!==``)return[e];if(!e||typeof e!=`object`)return[];let n=e[t]??e._id??e.id;return typeof n==`string`&&n!==``?[n]:[]});return n.length>0?n:void 0}if(typeof e==`string`&&e!==``)return e;if(!e||typeof e!=`object`)return;let n=e[t]??e._id??e.id;return typeof n==`string`&&n!==``?n:void 0}function Gj(e){let t=e.resourceLinkTrail?.resourceType??e.currentResourceType,n=Bj(e.fieldName,e.resourceLinkTrail);if(t&&n&&e.registry)return Mj({resourceType:t,fieldName:n,registry:e.registry})}function Kj(e){return Xw(e)}function qj(e){if(e.schema&&y(e.schema))return{referencedResourceType:Uj({explicitResourceType:Hj({schema:e.schema,fieldName:e.fieldName,parentData:e.parentData,currentResourceType:e.currentResourceType,registry:e.registry}),schema:e.schema,fieldName:e.fieldName,registry:e.registry}),referencedIds:Kj(e.value)};let t=Gj(e);if(t&&t.semantics.nature!==cl.COMPOSITION&&t.objectIdentity)return{referencedResourceType:t.relatedResourceType,referencedIds:Kj(Wj(e.value,t.objectIdentity.relationshipIdentifierField))}}function Jj({noValueLabel:e,typography:t,className:n}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{typography:t,className:U(`text-muted-foreground italic`,n),"aria-hidden":`true`,children:`—`}),(0,$.jsx)(`span`,{className:`sr-only`,children:e})]})}var Yj=new Set([bc.NUMBER,bc.BIGDECIMAL,bc.MONEY,bc.DURATION,bc.DATE,bc.TIME,bc.DATETIME,bc.RANGE_NUMBER,bc.RANGE_BIGDECIMAL,bc.RANGE_MONEY,bc.RANGE_DATE,bc.RANGE_TIME,bc.RANGE_DATETIME]);function Xj(e){return e&&Yj.has(e)?Lu.DATA:void 0}function Zj({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_BOOLEAN,`DisplayFieldBoolean`)(e);return(0,$.jsx)(n,{...t})}function Qj({preset:e=q.DEFAULT,...t}){let n=G(J.RESOURCES_FIELDS_RESOURCE_REFERENCE,`ResourceFieldDisplay_ResourceReference`,os.DISPLAY)(e);return(0,$.jsx)(n,{...t})}function $j({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_STRING,`DisplayFieldString`)(e);return(0,$.jsx)(n,{...t})}function eM({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_NUMBER,`DisplayFieldNumber`)(e);return(0,$.jsx)(n,{...t})}function tM({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_ENUM,`DisplayFieldEnum`)(e);return(0,$.jsx)(n,{...t})}function nM({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_MONEY,`DisplayFieldMoney`)(e);return(0,$.jsx)(n,{...t})}function rM({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_DURATION,`DisplayFieldDuration`)(e);return(0,$.jsx)(n,{...t})}function iM({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_PHONE,`DisplayFieldPhone`)(e);return(0,$.jsx)(n,{...t})}function aM({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_ADDRESS,`DisplayFieldAddress`)(e);return(0,$.jsx)(n,{...t})}function oM({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_BIGDECIMAL,`DisplayFieldBigDecimal`)(e);return(0,$.jsx)(n,{...t})}function sM({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_CODE,`DisplayFieldCode`)(e);return(0,$.jsx)(n,{...t})}function cM(e){if(e===void 0)return``;let t=e;if(typeof e==`string`){let n=e.trim();if(n.startsWith(`{`)||n.startsWith(`[`))try{t=JSON.parse(n)}catch{}}try{return JSON.stringify(t,(e,t)=>typeof t==`bigint`?t.toString():t,2)??String(t)}catch{return String(t)}}function lM({value:e,maxHeight:t,...n}){let r=(0,Q.useMemo)(()=>{let t=cM(e);return t?{content:t,language:`json`}:null},[e]);return(0,$.jsx)(sM,{...n,value:r,maxHeight:t,wordWrap:!0})}function uM({preset:e=q.DEFAULT,...t}){let{httpClient:n}=_u(),r=(0,Q.useMemo)(()=>({get:async e=>n.get(e),getBlob:(e,t)=>n.fetchFileBlob(e,t)}),[n]),i=G(J.LOW_LEVEL_DISPLAY_FIELD_FILE,`DisplayFieldFile`)(e);return(0,$.jsx)(i,{...t,httpOperations:r})}function dM({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_RANGE_BIGDECIMAL,`DisplayFieldRangeBigDecimal`)(e);return(0,$.jsx)(n,{...t})}function fM({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_RANGE_MONEY,`DisplayFieldRangeMoney`)(e);return(0,$.jsx)(n,{...t})}function pM({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_DATE,`DisplayFieldDate`)(e);return(0,$.jsx)(n,{...t})}function mM({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_DATETIME,`DisplayFieldDateTime`)(e);return(0,$.jsx)(n,{...t})}function hM({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_TIME,`DisplayFieldTime`)(e);return(0,$.jsx)(n,{...t})}function gM({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_RANGE_NUMBER,`DisplayFieldRangeNumber`)(e);return(0,$.jsx)(n,{...t})}function _M({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_RANGE_DATE,`DisplayFieldRangeDate`)(e);return(0,$.jsx)(n,{...t})}function vM({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_RANGE_DATETIME,`DisplayFieldRangeDateTime`)(e);return(0,$.jsx)(n,{...t})}function yM({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_RANGE_TIME,`DisplayFieldRangeTime`)(e);return(0,$.jsx)(n,{...t})}var bM=Jo.getLogger(),Rde=bM.debugByType(`DisplayValueDispatcher`);bM.setDebugTypeLogging(`DisplayValueDispatcher`,!1);function zde(e){return e?[...e.parentRelationships??[],...e.childRelationships??[],...e.selfRelationships??[]]:[]}function xM(e){if(!e.registry)return typeof e.record._id==`string`?e.record._id:typeof e.record.id==`string`?e.record.id:void 0;let t=e.resourceType?e.registry.resourceConfigurations?.[e.resourceType]?.resourceFieldIdentifier??e.registry.allResourceFieldIdentifiers?.[e.resourceType]:void 0,n=(t?e.record[t]:void 0)??e.record._id??e.record.id;return typeof n==`string`&&n!==``?n:void 0}function SM(e,t,n,r){if(!e||!t||!r)return null;let i=Vj(e);if(!i)return null;if(n){let e=r.resourceConfigurations[n]?.resourceRelationships;for(let a of zde(e))try{let e=Nn.resolveRelationshipObjectIdentityForResource(a,n,r.allResourceFieldIdentifiers);if(e.relationshipIdentifierField!==i)continue;let o=t[e.objectFieldName],s=a.resourceType1===n?a.resourceType2:a.resourceType1;if(o&&typeof o==`object`&&!Array.isArray(o)&&xM({record:o,resourceType:s,registry:r}))return o}catch{}}let a=Ite.extractBaseName(i);if(!a||a===i)return null;let o=t[a];return o&&typeof o==`object`&&!Array.isArray(o)&&xM({record:o,resourceType:r.fieldIdentifierToResourceType?.[i],registry:r})?o:null}function CM(e){let t=e.value,n=t?.fileIds?.length??+!!t?.fileId;return n>0?(0,$.jsx)(Z,{className:e.className,children:e.tComponent(J.LOW_LEVEL_FORM_FIELD,`fileCount`,{count:n})}):(0,$.jsx)(Z,{className:U(`text-muted-foreground italic`,e.className),children:e.tComponent(J.LOW_LEVEL_FORM_FIELD,`noFile`)})}function wM(e){return typeof e?.getMetadata==`string`&&e.getMetadata.trim()!==``}var Bde=5;function TM(e,t,n){switch(e){case`hidden`:return null;case`placeholder`:return(0,$.jsx)(Z,{className:`text-muted-foreground italic`,children:t});case`skeleton`:return(0,$.jsx)(Tm,{className:`h-5 w-full`});default:return(0,$.jsx)(Jj,{noValueLabel:t,typography:Xj(n)})}}function EM({schema:e,schemaType:t,value:n,fieldName:r,label:i,className:a,enumLabels:o,displayComponent:s,parentData:c,resourceLinkTrail:l,renderItem:u,emptyValue:d,fileUploadContext:f,showAllArrayItems:p,onExpandArrayItems:m,showAllObjectFields:h,onExpandObjectFields:g}){let{tComponent:_,t:v,isReady:b}=K({component:[J.LOW_LEVEL_FORM_FIELD,J.LOW_LEVEL_BUTTON]}),x=Q.useContext(ym)?.registry,{resourceType:S}=wj(),{getRecipe:C}=e_(),{renderIcon:w}=Rf(),T=C(wi.INDICATOR,si.ERROR),E=C(wi.TYPOGRAPHY,Lu.LABEL),D=C(wi.TYPOGRAPHY,Lu.BODY),O=C(wi.DIVIDER),k={schema:e,label:i,className:a,forceDisplayLabel:!1,forceDisplayDescription:!1,forceHideLabel:!0,forceHideDescription:!0},A=XA(),j=l?.resourceType,M=l?.pathPrefix,N=Q.useMemo(()=>Gj({fieldName:r,resourceLinkTrail:l,currentResourceType:S,registry:x}),[r,j,M,S,x]),P=N?.objectIdentity,F=Q.useMemo(()=>{if(P)return Wj(n,P.relationshipIdentifierField)},[P,n]);if(!b)return null;if((l?.linkDepth??0)>=Bde)return(0,$.jsx)(Z,{className:`text-muted-foreground italic text-sm`,children:_(J.LOW_LEVEL_FORM_FIELD,`resourceLinkLimitReached`)});let I=t=>_(J.LOW_LEVEL_FORM_FIELD,Qn[Ru(e,t)]),ee=t===bc.UNKNOWN?Bt(n)??bc.UNKNOWN:t;if(n==null||ee===bc.STRING&&n===``)return TM(d,I(!1),ee);if(s){let t={schema:e,className:a};switch(s){case`string`:return(0,$.jsx)($j,{...t,value:n});case`number`:return(0,$.jsx)(eM,{...t,value:n});case`boolean`:return(0,$.jsx)(Zj,{...t,value:n});case`enum`:return(0,$.jsx)(tM,{...t,value:n,labels:o});case`code`:return(0,$.jsx)(sM,{...t,value:n});case`money`:return(0,$.jsx)(nM,{...t,value:n});case`duration`:return(0,$.jsx)(rM,{...t,value:n});case`phone`:return(0,$.jsx)(iM,{...t,value:n});case`address`:return(0,$.jsx)(aM,{...t,value:n});case`bigdecimal`:return(0,$.jsx)(oM,{...t,value:n});case`file`:{let e=r?sr.normalizeSchemaFieldPath(r):void 0,i=e&&f?.[e];return wM(i)?(0,$.jsx)(uM,{...t,fieldName:r,value:n,endpoints:{getMetadata:i.getMetadata,serve:i.serve}}):CM({value:n,className:t.className,tComponent:_})}case`date`:return(0,$.jsx)(pM,{...t,value:n});case`time`:return(0,$.jsx)(hM,{...t,value:n});case`datetime`:return(0,$.jsx)(mM,{...t,value:n});case`range-number`:return(0,$.jsx)(gM,{...t,value:n});case`range-date`:return(0,$.jsx)(_M,{...t,value:n});case`range-time`:return(0,$.jsx)(yM,{...t,value:n});case`range-datetime`:return(0,$.jsx)(vM,{...t,value:n});case`range-bigdecimal`:return(0,$.jsx)(dM,{...t,value:n});case`range-money`:return(0,$.jsx)(fM,{...t,value:n});case`simple-text`:break;default:Rde(`Unrecognized displayComponent — falling back to schema-type dispatch`,{displayComponent:s,fieldName:r})}}if(ee===bc.VERSIONED_FOREIGN_KEY){let t=SM(r,c,S,x);return(0,$.jsx)(Qj,{fieldName:r||``,value:n,data:t??void 0,labelFallback:bu(e,c),displayParams:Ro(e),schema:e,className:a})}if(y(e)){let t=SM(r,c,S,x),i=Hj({schema:e,fieldName:r,parentData:c,currentResourceType:S,registry:x});return(0,$.jsx)(Qj,{fieldName:r||``,value:n,data:t??void 0,labelFallback:bu(e,c),resourceType:i,displayParams:Ro(e),schema:e,className:a})}if(N&&N.semantics.nature!==cl.COMPOSITION&&P)return(0,$.jsx)(Qj,{fieldName:r||``,value:F??null,data:!Array.isArray(n)&&n&&typeof n==`object`?n:void 0,resourceType:N.relatedResourceType,className:a});let L=N&&r?{resourceType:N.relatedResourceType,pathPrefix:r,linkDepth:(l?.linkDepth??0)+1}:l;if(ee===bc.ARRAY&&Array.isArray(n)){if(n.length===0)return TM(d,I(!0));let t=Nr(e).element,s=t?sc(t):bc.UNKNOWN,c=Qi(e),l=QA(c,A),f=l?.displayMode||`vertical`,h=n,g=l?.maxItems||void 0,v=g&&!p?h.slice(0,g):h,y=g?h.length-g:0;if(l?.listStyle===da.CHIPS&&s===bc.STRING&&!u)return(0,$.jsxs)(`div`,{role:`list`,"aria-label":i||r||_(J.LOW_LEVEL_FORM_FIELD,`list`),"data-list-style":`chips`,className:U(`flex flex-row flex-wrap gap-item`,a),children:[v.map((e,t)=>(0,$.jsx)(Hf,{role:`listitem`,variant:`secondary`,children:String(e)},t)),y>0&&!p&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.SM,"aria-label":_(J.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y}),onClick:m,children:_(J.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y})})]});let b=c?.objectItemLayout??jt.CARD,x=s===bc.OBJECT&&t?Ju(t):null,S=b===jt.ROW&&!!x,C=s!==bc.OBJECT&&!u&&f!==`horizontal`&&(l?.listStyle===void 0||l.listStyle===da.PLAIN);return(0,$.jsxs)(`div`,{role:`list`,"aria-label":i||r||_(J.LOW_LEVEL_FORM_FIELD,`list`),"data-list-shape":C?`primitive`:void 0,className:U(S?`flex w-full min-w-0 flex-col gap-element`:f===`horizontal`||l?.listStyle===da.CHIPS?`flex flex-row gap-element flex-wrap`:l?.listStyle===da.SEPARATED?`flex flex-col divide-y divide-border`:s===bc.OBJECT?`flex flex-col gap-field`:`flex flex-col gap-item-xs`,a),children:[u?v.map((n,i)=>{let a=u(r?`${r}[${i}]`:`[${i}]`,t??e);return(0,$.jsx)(`div`,{role:`listitem`,className:U(s===bc.OBJECT&&`py-item-xs`,l?.listStyle===da.SEPARATED&&`py-card-sm first:pt-0 last:pb-0`),children:a??(0,$.jsx)(TR,{schema:t??e,schemaType:s,value:n,enumLabels:o,name:r?`${r}[${i}]`:void 0,resourceLinkTrail:L})},i)}):S&&x?v.map((e,n)=>{let i=e&&typeof e==`object`?e:{},a=od(t),o=sr.getArrayItemPrimaryField(t).name,s=[...a.filter(e=>sc(x[e])===bc.BOOLEAN),...a.filter(e=>sc(x[e])!==bc.BOOLEAN)];return(0,$.jsx)(`div`,{role:`listitem`,className:`flex w-full min-w-0 items-center gap-element`,children:(0,$.jsx)(yk,{displayChromeMode:Ho.COMPACT,sectionChromeMode:void 0,children:s.map(e=>(0,$.jsx)(TR,{schema:x[e],schemaType:sc(x[e]),value:i[e],hideLabel:e===o,labelPlacement:e===o?void 0:`hidden`,name:r?`${r}[${n}].${e}`:void 0,className:U(`w-auto`,e===o?`min-w-0 flex-1 [overflow-wrap:anywhere]`:sc(x[e])===bc.STRING?`min-w-0 [overflow-wrap:anywhere]`:`shrink-0`),resourceLinkTrail:L},e))})},n)}):v.map((n,i)=>(0,$.jsx)(`div`,{role:`listitem`,className:U(l?.listStyle===da.BULLETS&&s!==bc.OBJECT&&f!==`horizontal`&&`ms-4 list-item list-disc marker:text-muted-foreground/60`,s===bc.OBJECT&&!S&&f!==`horizontal`&&`py-item-xs`),children:(0,$.jsx)(TR,{schema:t??e,schemaType:s,value:n,enumLabels:o,name:r?`${r}[${i}]`:void 0,resourceLinkTrail:L})},i)),y>0&&!p&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.SM,className:`self-start`,"aria-label":_(J.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y}),onClick:m,children:_(J.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y})})]})}if((ee===bc.OBJECT||ee===bc.VERSIONED_OBJECT)&&typeof n==`object`){let t=sne(e,n),o=t??e,s=Ju(o),c=od(o),l=(t?Ai(t):void 0)??Ai(e),u=l?.display?.displayMode||`vertical`,f=l?.display?.maxItems||void 0;if(!s||c.length===0)return TM(d,I(!0));let p=l?.display?.primaryField,m=p&&c.includes(p)?[p,...c.filter(e=>e!==p)]:c,v=f&&!h?m.slice(0,f):m,y=f?c.length-f:0,b=p&&c.includes(p)?v.filter(e=>e!==p&&Ys(s[e])?.chromeMode===Ho.COMPACT):[];return(0,$.jsxs)(`div`,{role:`group`,"aria-label":i||r||_(J.LOW_LEVEL_FORM_FIELD,`object`),className:U(`ps-card relative`,u===`horizontal`?`flex flex-row gap-field flex-wrap`:`flex flex-col gap-element`,a),children:[(0,$.jsx)(`div`,{className:U(`absolute start-0 top-0 bottom-0 w-0.5`,O.base),"aria-hidden":`true`}),(0,$.jsx)(xk,{children:v.map(e=>{let t=s[e],i=sc(t),a=n[e],o=r?`${r}.${e}`:e,c=e===p;return b.includes(e)?null:c?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-item-sm gap-y-element-xs`,children:[(0,$.jsx)(`div`,{className:`min-w-0 flex-1 font-medium`,children:(0,$.jsx)(TR,{schema:t,schemaType:i,value:a,name:o,hideLabel:!0,parentData:n,resourceLinkTrail:L})}),b.map(e=>(0,$.jsx)(TR,{schema:s[e],schemaType:sc(s[e]),value:n[e],name:r?`${r}.${e}`:e,parentData:n,resourceLinkTrail:L},e))]},e):(0,$.jsx)(TR,{schema:t,schemaType:i,value:a,name:o,className:u===`horizontal`?`w-auto`:void 0,parentData:n,resourceLinkTrail:L},e)})}),y>0&&!h&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.SM,className:`self-start`,"aria-label":_(J.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y}),onClick:g,children:_(J.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y})})]})}if(ee===bc.BOOLEAN)return(0,$.jsx)(Zj,{...k,value:n});if(ee===bc.ENUM)return(0,$.jsx)(tM,{...k,value:n,labels:o});if(ee===bc.STRING)return(0,$.jsx)($j,{...k,value:n});if(ee===bc.NUMBER||ee===bc.BIGINT)return(0,$.jsx)(eM,{...k,value:n});if(ee===bc.MONEY)return(0,$.jsx)(nM,{...k,value:n});if(ee===bc.DURATION)return(0,$.jsx)(rM,{...k,value:n});if(ee===bc.PHONE)return(0,$.jsx)(iM,{...k,value:n});if(ee===bc.ADDRESS)return(0,$.jsx)(aM,{...k,value:n});if(ee===bc.BIGDECIMAL)return(0,$.jsx)(oM,{...k,value:n});if(ee===bc.CODE)return(0,$.jsx)(sM,{...k,value:n});if(ee===bc.FILE){let e=r?sr.normalizeSchemaFieldPath(r):void 0,t=e&&f?.[e];return wM(t)?(0,$.jsx)(uM,{...k,fieldName:r,value:n,endpoints:{getMetadata:t.getMetadata,serve:t.serve}}):CM({value:n,className:a,tComponent:_})}if(ee===bc.RANGE_BIGDECIMAL)return(0,$.jsx)(dM,{...k,value:n});if(ee===bc.RANGE_MONEY)return(0,$.jsx)(fM,{...k,value:n});if(ee===bc.DATE)return(0,$.jsx)(pM,{...k,value:n});if(ee===bc.DATETIME)return(0,$.jsx)(mM,{...k,value:n});if(ee===bc.TIME)return(0,$.jsx)(hM,{...k,value:n});if(ee===bc.RANGE_NUMBER)return(0,$.jsx)(gM,{...k,value:n});if(ee===bc.RANGE_DATE)return(0,$.jsx)(_M,{...k,value:n});if(ee===bc.RANGE_DATETIME)return(0,$.jsx)(vM,{...k,value:n});if(ee===bc.RANGE_TIME)return(0,$.jsx)(yM,{...k,value:n});if(ee===bc.RECORD&&typeof n==`object`&&n){let t=Object.entries(n);if(t.length===0)return TM(d,I(!0));let i=_c(e),o=bee(e),s=o?lr(o):void 0,c=e=>{if(!s)return e;let t=Bo(s,e),n=v(t);return n===t?e:n};return(0,$.jsxs)(`div`,{className:U(`ps-card relative flex flex-col gap-element`,a),children:[(0,$.jsx)(`div`,{className:U(`absolute start-0 top-0 bottom-0 w-0.5`,O.base),"aria-hidden":`true`}),t.map(([e,t])=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-item-sm gap-y-element-xs`,children:[(0,$.jsx)(Z,{className:U(E.base,`shrink-0`),children:c(e)}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(TR,{schema:i??void 0,schemaType:i?sc(i):void 0,value:t,name:r?`${r}.${e}`:e,hideLabel:!0,parentData:n,resourceLinkTrail:L})})]},e))]})}if(ee===bc.SET&&(n instanceof Set||Array.isArray(n))){let t=Array.from(n);if(t.length===0)return TM(d,I(!0));let i=see(e);return(0,$.jsx)(`div`,{className:U(`flex flex-col gap-element-xs`,a),children:t.map((e,t)=>(0,$.jsx)(TR,{schema:i??void 0,schemaType:i?sc(i):void 0,value:e,name:r?`${r}.${t}`:String(t),hideLabel:!0,resourceLinkTrail:L},`${r??`set`}-${t}`))})}if(ee===bc.TUPLE&&Array.isArray(n)){if(n.length===0)return TM(d,I(!0));let t=Vee(e);return(0,$.jsx)(`div`,{className:U(`flex flex-wrap items-baseline gap-x-item-sm gap-y-element-xs`,a),children:n.map((e,n)=>{let i=t?.[n];return(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(TR,{schema:i??void 0,schemaType:i?sc(i):void 0,value:e,name:r?`${r}.${n}`:String(n),hideLabel:!0,resourceLinkTrail:L})},`${r??`tuple`}-${n}`)})})}if(ee===bc.MAP&&(n instanceof Map||typeof n==`object`&&n)){let t=n instanceof Map?Array.from(n.entries()):Object.entries(n);if(t.length===0)return TM(d,I(!0));let i=dl(e);return(0,$.jsxs)(`div`,{className:U(`ps-card relative flex flex-col gap-element`,a),children:[(0,$.jsx)(`div`,{className:U(`absolute start-0 top-0 bottom-0 w-0.5`,O.base),"aria-hidden":`true`}),t.map(([e,t],n)=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-item-sm gap-y-element-xs`,children:[(0,$.jsx)(`div`,{className:U(E.base,`shrink-0`),children:(0,$.jsx)(TR,{schema:i?.keySchema??void 0,schemaType:i?.keySchema?sc(i.keySchema):void 0,value:e,name:r?`${r}.${n}.key`:`${n}.key`,hideLabel:!0})}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(TR,{schema:i?.valueSchema??void 0,schemaType:i?.valueSchema?sc(i.valueSchema):void 0,value:t,name:r?`${r}.${n}.value`:`${n}.value`,hideLabel:!0,resourceLinkTrail:L})})]},`${r??`map`}-${n}`))]})}return ee===bc.UNKNOWN?(0,$.jsx)(lM,{...k,value:n}):(0,$.jsxs)(`div`,{className:U(D.base,D.sizes?.sm||D.sizes?.md,T.base,`flex items-center gap-element px-card-sm py-item-xs rounded-md`,a),children:[(0,$.jsx)(Z,{className:E.base,children:_(J.LOW_LEVEL_FORM_FIELD,`unsupportedDisplayType`)}),(0,$.jsx)(O_,{className:U(`px-item-xs rounded`,T.states.hover),children:ee})]})}EM.displayName=`DisplayValueDispatcher`;function DM(e){let{schema:t,schemaType:n,value:r,fieldName:i,label:a,description:o,tooltip:s,provenance:c,enumLabels:l,displayComponent:u,parentData:d,resourceLinkTrail:f,renderItem:p,className:m,hideLabel:h,hideDescription:g,resolvedChromeMode:_,resolvedLabelPlacement:v,resolvedLabelStyle:y,resolvedEmptyValue:b,fileUploadContext:x,wideValue:S,announceName:C}=e,[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),O=(0,Q.useRef)(r);return(0,Q.useEffect)(()=>{O.current!==r&&(T(!1),D(!1),O.current=r)},[r]),(0,$.jsx)(xj,{mode:_,label:a,labelStyle:y,description:o,tooltip:s,provenance:c,name:i,labelPlacement:v,hideLabel:h,hideDescription:g,wide:S,announceName:C,className:m,children:(0,$.jsx)(EM,{schema:t,schemaType:n,value:r,fieldName:i,label:a,className:m,enumLabels:l,displayComponent:u,parentData:d,resourceLinkTrail:f,renderItem:p,emptyValue:b,fileUploadContext:x,showAllArrayItems:w,onExpandArrayItems:()=>T(!0),showAllObjectFields:E,onExpandObjectFields:()=>D(!0)})})}DM.displayName=`DisplayFieldReadOnly`;function OM(e){let{schema:t,schemaType:n,value:r,fieldName:i,label:a,description:o,enumLabels:s,displayComponent:c,parentData:l,resourceLinkTrail:u,renderItem:d,className:f,hideLabel:p,hideDescription:m,resolvedLabelPlacement:h,resolvedLabelStyle:g,resolvedEmptyValue:_,fileUploadContext:v,sectionAppearance:y}=e,{getRecipe:b}=e_(),x=b(wi.TYPOGRAPHY,Lu.EYEBROW),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(r);(0,Q.useEffect)(()=>{E.current!==r&&(C(!1),T(!1),E.current=r)},[r]);let D=h===`hidden`;return(0,$.jsxs)(BT,{appearance:y,className:f,"data-field":i,children:[a!=null&&!p&&D&&(0,$.jsx)(HT,{className:`sr-only`,children:a}),a!=null&&!p&&!D&&(g===Sl.TITLE?(0,$.jsx)(`div`,{className:U(`pt-item-xs`,x.base),children:a}):(0,$.jsx)(HT,{children:a})),o!=null&&!m&&(0,$.jsx)(Ox,{children:o}),(0,$.jsx)(EM,{schema:t,schemaType:n,value:r,fieldName:i,label:a,enumLabels:s,displayComponent:c,parentData:l,resourceLinkTrail:u,renderItem:d,emptyValue:_,fileUploadContext:v,showAllArrayItems:S,onExpandArrayItems:()=>C(!0),showAllObjectFields:w,onExpandObjectFields:()=>T(!0)})]})}OM.displayName=`DisplayFieldReadOnlyArraySection`;function kM(e){return e.replace(/\[(\d+)\]/g,`.$1`)}function AM(e,t){let n=kM(e),r=kM(t);return r===n||r.startsWith(n+`.`)}function jM(e,t){return AM(e,t)||AM(t,e)}function MM(e,t){return t?kM(t).split(`.`).filter(Boolean).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e):e}var NM=()=>()=>{},Vde={lastEvent:null},PM=()=>Vde,FM=Jo.getLogger(),IM=FM.debugByType(`FormErrorExtraction`);FM.setDebugTypeLogging(`FormErrorExtraction`,!1);function LM(e){if(!e||typeof e!=`object`)return IM(`extractServerValidationErrors: not an object, skipping`,{errorType:typeof e}),null;let t=e;if(t.customMessageReference===ii.VERSION_CONFLICT)return IM(`extractServerValidationErrors: version conflict, not a validation error`),null;IM(`extractServerValidationErrors: inspecting error shape`,{httpStatus:t.httpStatus,hasValidationErrors:!!t.validationErrors,errorType:t.errorType,hasResponse:!!t.response,message:t.message});let n=t.httpStatus,r=t.validationErrors;if(RM(n)&&Hde(r))return IM(`extractServerValidationErrors: MATCHED via interceptor properties`,{httpStatus:n,fieldCount:Object.keys(r).length,fields:Object.keys(r)}),{httpStatus:n,validationErrors:r};let i=t.response;if(i){let e=i.status,t=i.data;if(RM(e)&&t){let n=ute(t);if(n&&Object.keys(n).length>0)return IM(`extractServerValidationErrors: MATCHED via raw response`,{httpStatus:e,fieldCount:Object.keys(n).length,fields:Object.keys(n)}),{httpStatus:e,validationErrors:n}}}return IM(`extractServerValidationErrors: NO validation errors found`),null}function RM(e){return e===400||e===409||e===422}function Hde(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length>0}var Ude=Object.freeze([]);function Wde(e){let{declaration:t,record:n,appConfig:r,fieldName:i}=e,a=t?.readsFields??Ude,o=ew({name:a}),s=JSON.stringify(o??null),c=(0,Q.useMemo)(()=>{let e=Array.isArray(o)?o:[o];return Object.fromEntries(a.map((t,n)=>[t,e[n]]))},[a,s]),l=Gde(t?.readsReferences);return(0,Q.useMemo)(()=>t?so(t,{appConfig:r,currentObject:n,values:c,references:l},e=>console.warn(`[requestFieldOffers] The offer for "${i}" threw; every value is offered and the operation decides.`,e)):Yl,[t,r,n,c,l,i])}function Gde(e){let t=(0,Q.useMemo)(()=>Object.keys(e??{}),[e]),n=ew({name:t}),r=(0,Q.useMemo)(()=>{let r=Array.isArray(n)?n:[n];return t.map((t,n)=>{let i=r[n];return{field:t,resourceType:e[t],id:typeof i==`string`&&i.length>0?i:void 0}})},[t,e,JSON.stringify(n??null)]),{registry:i,doOperation:a}=wm(),{t:o,formatDate:s,formatDateTime:c}=K({}),l=qD(),u=bC(),d=(0,Q.useMemo)(()=>l?.contextResourceIdentifiers?V.buildContextualParameters(l.contextResourceIdentifiers,i):u?.contextualParameters??{},[l?.contextResourceIdentifiers,u?.contextualParameters,i]),f=l?{resourceType:l.resourceType,id:l.resourceId}:void 0,p=(0,Q.useRef)({registry:i,doOperation:a,t:o,formatDate:s,formatDateTime:c,contextualParameters:d,hostRecord:f});p.current={registry:i,doOperation:a,t:o,formatDate:s,formatDateTime:c,contextualParameters:d,hostRecord:f};let[m,h]=(0,Q.useState)({}),g=r.map(({resourceType:e,id:t})=>`${e}:${t??``}`).join(`|`);return(0,Q.useEffect)(()=>{let e=!1;for(let{resourceType:t,id:n}of r){let r=`${t}:${n}`;if(!n||m[r])continue;let i=p.current,a=Il(i.registry.resourceConfigurations?.[t]?.operations??[],W.READ)??null;Qw({resourceType:t,id:n,registry:i.registry,doOperation:i.doOperation,contextualParameters:Zm({hostIdentifiers:{},hostContextualParameters:i.contextualParameters,hostRecord:i.hostRecord,targetResourceType:t,targetId:n,registry:i.registry}).contextualParameters,readOperation:a,t:i.t,formatDate:i.formatDate,formatDateTime:i.formatDateTime}).then(({record:t})=>{e||h(e=>({...e,[r]:t}))}).catch(e=>{console.warn(`[requestFieldOffers] The ${t} "${n}" a request field references could not be read; its offer narrows nothing by it.`,e)})}return()=>{e=!0}},[g]),(0,Q.useMemo)(()=>Object.fromEntries(r.map(({field:e,resourceType:t,id:n})=>[e,n?m[`${t}:${n}`]:void 0])),[r,m])}var zM=(0,Q.createContext)(null);function BM(e){let t=(0,Q.useContext)(zM);(0,Q.useEffect)(()=>(t?.registerField(e),()=>{t?.unregisterField(e)}),[e,t])}var VM=Jo.getLogger(),HM=VM.debugByType(`FieldUniquenessValidation`);VM.setDebugTypeLogging(`FieldUniquenessValidation`,!1);function Kde({fieldName:e,fieldSchema:t}){let n=qD(),r=rw(),{httpClient:i}=_u(),{tErrorValidation:a}=K(),o=(0,Q.useRef)(null),s=(0,Q.useRef)(!1),c=t?xc(t):!1,l=n?.validateFieldUrl,u=n?.resourceId;return{validateUniqueness:(0,Q.useCallback)(async()=>{if(!c||!l||!i)return;let t=r.getValues(e);if(t==null||t===``){r.getFieldState(e).error?.type===`server-unique`&&r.clearErrors(e);return}HM(`Starting uniqueness check`,{fieldName:e,value:t,validateFieldUrl:l,resourceId:u}),o.current&&o.current.abort();let n=new AbortController;o.current=n,s.current=!0;try{let o=await i.post(l,{fieldName:e,value:t,excludeId:u},{signal:n.signal,silent:!0});return HM(`Uniqueness check response`,{fieldName:e,valid:o.valid,error:o.error}),!o.valid&&o.error?(r.setError(e,{type:yT,message:a(o.error.code,`msg`,o.error.params)}),!1):(r.getFieldState(e).error?.type===`server-unique`&&r.clearErrors(e),!0)}catch(t){if(t?.name===`AbortError`||t?.code===`ERR_CANCELED`){HM(`Uniqueness check aborted (superseded)`,{fieldName:e});return}VM.warn(`Uniqueness pre-validation failed`,{fieldName:e,error:t?.message});return}finally{s.current=!1,o.current===n&&(o.current=null)}},[e,c,l,u,i,r,a]),isChecking:s.current}}function qde(e){return e==null||e===``||Array.isArray(e)&&e.length===0}function UM(e){let t=rw(),n=(0,Q.useRef)(!1);return{handleFieldBlur:(0,Q.useCallback)(r=>{let i=t.getFieldState(e),a=t.getValues(e);return!i.error&&!n.current&&qde(a)?(t.setValue(e,a,{shouldTouch:!0,shouldDirty:!1,shouldValidate:!1}),!0):(r(),!1)},[t,e]),noteInputReceived:(0,Q.useCallback)(()=>{n.current=!0},[])}}var WM=(0,Q.createContext)({});function GM({invalid:e,describedBy:t,children:n}){let r=t.filter(Boolean).join(` `),i=(0,Q.useMemo)(()=>({...e?{"aria-invalid":!0}:{},...r?{"aria-describedby":r}:{}}),[e,r]);return(0,$.jsx)(WM.Provider,{value:i,children:n})}function KM(){return(0,Q.useContext)(WM)}function qM({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AUTOSAVE_INDICATOR,`AutosaveIndicator`)(e);return(0,$.jsx)(n,{...t})}function JM(e,t){let{saveState:n,saveErrorMessage:r,onRetrySave:i,variant:a=`block`}=t;return!n||n===hT.IDLE?e:a===`inline`?(0,$.jsxs)(`div`,{className:`relative inline-flex`,children:[e,(0,$.jsx)(qM,{state:n,errorMessage:r,onRetry:i,position:`inline`,className:`ml-element`})]}):(0,$.jsxs)(`div`,{className:`relative`,children:[e,(0,$.jsx)(qM,{state:n,errorMessage:r,onRetry:i,position:`absolute-right`,className:i?void 0:`pointer-events-none`})]})}function YM(e,t,n){return e==null?io.STACKED:typeof e==`string`?e:e[t]??e[ci.DESKTOP]??io.STACKED}function XM({text:e}){let{renderIcon:t}=Rf(),{tComponent:n,isReady:r}=K({component:J.LOW_LEVEL_FORM_FIELD});return r?(0,$.jsxs)(mj,{children:[(0,$.jsx)(hj,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.ICON_SM,className:`ms-1 rounded-full`,"aria-label":n(J.LOW_LEVEL_FORM_FIELD,`moreInformation`),tabIndex:-1,children:t(H.INFO,{size:fa.XS})})}),(0,$.jsx)(gj,{children:e})]}):null}function ZM({mode:e,label:t,description:n,error:r,required:i,labelPlacement:a,hideLabel:o,hideDescription:s,hideError:c,saveState:l,saveErrorMessage:u,onRetrySave:d,onSaveFieldNow:f,fieldName:p,disabled:m,tooltip:h,wideControl:g,className:_,children:v}){let{currentBreakpoint:y,isMobile:b}=e_(),x=(0,Q.useMemo)(()=>YM(e,y,b),[e,y,b]),S=p?`field-${p}`:void 0,C=p?`field-${p}-description`:void 0,w=p?`field-${p}-error`:void 0,T=p?`field-${p}-label`:void 0,E=a??(x===io.INLINE?`inline`:`top`),D=!o&&!!t&&E!==`hidden`&&x!==io.COMPACT&&x!==io.HIDDEN,O=!s&&!!n&&x!==io.COMPACT&&x!==io.HIDDEN,k=!c&&!!r&&x!==io.HIDDEN,A=!o&&t&&E===`hidden`?(0,$.jsx)(Tx,{id:T,htmlFor:S,className:`sr-only`,children:t}):null,j=E===`start`||E===`inline`?`inline`:`block`,M=JM((0,$.jsx)(GM,{invalid:!!r,describedBy:[O?C:void 0,k?w:void 0],children:(0,$.jsx)(HE,{fieldName:p,label:t,disabled:m,onSaveFieldNow:f,children:v})}),{saveState:l,saveErrorMessage:u,onRetrySave:d,variant:j});if(x===io.HIDDEN)return(0,$.jsxs)($.Fragment,{children:[A,M]});if(x===io.COMPACT)return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`compact`,"data-label-placement":E,"data-field":p,"data-testid":p?`field-${p}`:void 0,"data-guidance-field":p,"data-disabled":m||void 0,className:_,children:[A,M,k&&(0,$.jsx)(kx,{id:w,children:r})]});if(E===`start`||E===`inline`){let e=(0,$.jsxs)(Dx,{children:[D&&(0,$.jsx)(Ex,{children:(0,$.jsxs)(Tx,{id:T,htmlFor:S,children:[t,i&&(0,$.jsx)(`span`,{className:`text-destructive ms-0.5`,"aria-hidden":`true`,children:`*`}),h&&(0,$.jsx)(XM,{text:h})]})}),O&&(0,$.jsx)(Ox,{id:C,children:n}),k&&(0,$.jsx)(kx,{id:w,children:r})]});return(0,$.jsxs)(wx,{orientation:Cx.HORIZONTAL,"data-slot":`field-chrome`,"data-chrome-mode":`inline`,"data-label-placement":E,"data-field":p,"data-testid":p?`field-${p}`:void 0,"data-guidance-field":p,"data-invalid":!!r||void 0,"data-disabled":m||void 0,className:_,children:[E===`start`&&e,M,E===`inline`&&e]})}if(x===io.RELAXED)return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`relaxed`,"data-label-placement":E,"data-field":p,"data-testid":p?`field-${p}`:void 0,"data-guidance-field":p,"data-invalid":!!r||void 0,"data-disabled":m||void 0,className:U(`flex flex-col gap-field`,_),children:[A,D&&(0,$.jsxs)(`label`,{id:T,htmlFor:S,className:U(`text-lg font-semibold leading-snug`,m&&`opacity-[var(--opacity-disabled)]`),children:[t,i&&(0,$.jsx)(`span`,{className:`text-destructive ms-1`,"aria-hidden":`true`,children:`*`}),h&&(0,$.jsx)(XM,{text:h})]}),O&&(0,$.jsx)(`p`,{id:C,className:`text-base text-muted-foreground leading-normal -mt-1`,children:n}),(0,$.jsx)(`div`,{className:`py-1`,children:M}),k&&(0,$.jsx)(`div`,{id:w,role:`alert`,className:`text-base text-destructive font-normal`,children:r})]});if(x===io.SETTINGS_ROW){let e=!!g||b;return(0,$.jsxs)(`div`,{"data-slot":`field-chrome`,"data-chrome-mode":`settings_row`,"data-settings-row-layout":g?`wide`:b?`stacked`:void 0,"data-label-placement":E,"data-field":p,"data-testid":p?`field-${p}`:void 0,"data-guidance-field":p,"data-invalid":!!r||void 0,"data-disabled":m||void 0,className:U(`flex min-h-10 px-card py-card-sm border-b border-border last:border-b-0 hover:bg-muted/50 transition-colors`,e?`flex-col gap-element-xs`:U(`flex-row gap-section`,O?`items-start`:`items-center has-[textarea]:items-start`),_),children:[(0,$.jsxs)(`div`,{className:U(`flex min-w-0 flex-col gap-element-xs`,!e&&`flex-1`),children:[A,D&&(0,$.jsxs)(`label`,{id:T,htmlFor:S,className:U(`text-sm font-medium leading-snug`,m&&`opacity-[var(--opacity-disabled)]`),children:[t,i&&(0,$.jsx)(`span`,{className:`text-destructive ms-0.5`,"aria-hidden":`true`,children:`*`}),h&&(0,$.jsx)(XM,{text:h})]}),O&&(0,$.jsx)(Ox,{id:C,children:n})]}),(0,$.jsxs)(`div`,{className:U(`flex min-w-0 flex-col gap-element-xs`,e?`w-full`:`w-72 max-w-[55%] shrink items-end`),children:[M,k&&(0,$.jsx)(kx,{id:w,children:r})]})]})}return(0,$.jsxs)(wx,{orientation:Cx.VERTICAL,"data-slot":`field-chrome`,"data-chrome-mode":`stacked`,"data-label-placement":E,"data-field":p,"data-testid":p?`field-${p}`:void 0,"data-guidance-field":p,"data-invalid":!!r||void 0,"data-disabled":m||void 0,className:_,children:[A,D&&(0,$.jsxs)(Tx,{id:T,htmlFor:S,children:[t,i&&(0,$.jsx)(`span`,{className:`text-destructive ms-0.5`,"aria-hidden":`true`,children:`*`}),h&&(0,$.jsx)(XM,{text:h})]}),M,O&&(0,$.jsx)(Ox,{id:C,children:n}),k&&(0,$.jsx)(kx,{id:w,children:r})]})}ZM.displayName=`FormFieldChrome`;var QM=zs(J.LOW_LEVEL_SLIDER,`Slider`,[`Root`]),Jde=bl(J.LOW_LEVEL_RANGE_SLIDER,`RangeSlider`),$M=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=QM(e);return(0,$.jsx)(r,{...t,ref:n})});$M.displayName=`Slider`;var eN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=QM(e);return(0,$.jsx)(r.Root,{...t,ref:n})});eN.displayName=`SliderRoot`;var tN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Jde(e);return(0,$.jsx)(r,{...t,ref:n})});tN.displayName=`RangeSlider`;var nN=zs(J.LOW_LEVEL_INPUT,`Input`,[`Root`]),rN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=nN(e);return(0,$.jsx)(r,{...t,ref:n})});rN.displayName=`Input`;var iN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=nN(e);return(0,$.jsx)(r.Root,{...t,ref:n})});iN.displayName=`InputRoot`;var aN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_DATEPICKER,`DatePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});aN.displayName=`DatePicker`;var oN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:J.LOW_LEVEL_FORM_FIELD_DATE}),i=n?.dateFormat;return(0,$.jsx)(aN,{ref:t,...e,dateFormat:i,calendarDate:e.schema?yl(e.schema):!1,timeZone:n?.timezone})}),sN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_DATE,`FormFieldDate`)(e);return(0,$.jsx)(r,{...t,ref:n})});sN.displayName=`FormFieldDate`;var cN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_DATETIME_PICKER,`DateTimePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});cN.displayName=`DateTimePicker`;var lN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:J.LOW_LEVEL_FORM_FIELD_DATETIME});return(0,$.jsx)(cN,{ref:t,...e,dateFormat:n?.dateFormat,timeFormat:n?.timeFormat,timeZone:n?.timezone})}),uN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_DATETIME,`FormFieldDateTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});uN.displayName=`FormFieldDateTime`;var dN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_TIMEPICKER,`TimePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});dN.displayName=`TimePicker`;var fN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:J.LOW_LEVEL_FORM_FIELD_TIME});return(0,$.jsx)(dN,{ref:t,...e,timeFormat:n?.timeFormat})}),pN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_TIME,`FormFieldTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});pN.displayName=`FormFieldTime`;var mN=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,fromPlaceholder:l=`From`,toPlaceholder:u=`To`,fromLabel:d=`From`,toLabel:f=`To`,step:p=1,min:m,max:h,required:g,autoFocus:_,controlSize:v=rf.MD},y)=>{let{tComponent:b,isReady:x}=K({component:J.LOW_LEVEL_FORM_FIELD_RANGE_NUMBER}),S=pt(e),C=m??S?.min,w=h??S?.max,T=S?.fromOptional??!0,E=S?.toOptional??!0,[D,O]=Q.useState(c??{from:void 0,to:void 0}),k=V_(a,o),A=a??D,j=Q.useMemo(()=>A.from==null||A.to==null?!1:A.from>A.to,[A.from,A.to]),M=Q.useCallback(e=>{let t=e.target.value,n=t===``?void 0:Number(t),r={...A,from:n!==void 0&&!isNaN(n)?n:void 0};k?o?.(r):O(r)},[k,o,A]),N=Q.useCallback(e=>{let t=e.target.value,n=t===``?void 0:Number(t),r={...A,to:n!==void 0&&!isNaN(n)?n:void 0};k?o?.(r):O(r)},[k,o,A]),P=Q.useCallback(()=>{s?.()},[s]),F=t??`range-number-field`,I=`${F}-from`,ee=`${F}-to`;return x?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{htmlFor:I,className:`sr-only`,children:d}),(0,$.jsx)(iN,{ref:y,id:I,type:`number`,value:A.from??``,onChange:M,onBlur:P,disabled:n,readOnly:r,placeholder:l,"aria-invalid":j,"aria-required":!T,step:p,min:C,max:w,className:`tabular-nums`,autoFocus:_,controlSize:v})]}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{htmlFor:ee,className:`sr-only`,children:f}),(0,$.jsx)(iN,{id:ee,type:`number`,value:A.to??``,onChange:N,onBlur:P,disabled:n,readOnly:r,placeholder:u,"aria-invalid":j,"aria-required":!E,step:p,min:C,max:w,className:`tabular-nums`,controlSize:v})]})]}),j&&(0,$.jsx)(`p`,{className:`text-destructive text-sm`,role:`alert`,children:b(J.LOW_LEVEL_FORM_MESSAGE,`rangeFromMustBeLessThanTo`)})]}):null}),hN=Q.forwardRef(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_RANGE_NUMBER,`FormFieldRangeNumber`)(e);return(0,$.jsx)(r,{...t,ref:n})});hN.displayName=`FormFieldRangeNumber`;var gN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_DATE_RANGE_PICKER,`DateRangePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});gN.displayName=`DateRangePicker`;var _N=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:J.LOW_LEVEL_FORM_FIELD_RANGE_DATE}),i=e.schema?pt(e.schema):void 0,a=e.minDate??Xr(i?.min),o=e.maxDate??Xr(i?.max),s=i?!i.fromOptional:!1,c=i?!i.toOptional:!1;return(0,$.jsx)(gN,{ref:t,schema:e.schema,name:e.name,...e,dateFormat:n?.dateFormat,timeZone:n?.timezone,minDate:a,maxDate:o,"aria-required":s||c||void 0,"data-from-required":s||void 0,"data-to-required":c||void 0})}),vN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_RANGE_DATE,`FormFieldRangeDate`)(e);return(0,$.jsx)(r,{...t,ref:n})});vN.displayName=`FormFieldRangeDate`;var yN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_DATETIME_RANGE_PICKER,`DateTimeRangePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});yN.displayName=`DateTimeRangePicker`;var bN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:J.LOW_LEVEL_FORM_FIELD_RANGE_DATETIME}),i=e.schema?pt(e.schema):void 0,a=e.minDate??Xr(i?.min),o=e.maxDate??Xr(i?.max),s=i?!i.fromOptional:!1,c=i?!i.toOptional:!1;return(0,$.jsx)(yN,{ref:t,schema:e.schema,name:e.name,...e,dateFormat:n?.dateFormat,timeFormat:n?.timeFormat,timeZone:n?.timezone,minDate:a,maxDate:o,"aria-required":s||c||void 0,"data-from-required":s||void 0,"data-to-required":c||void 0})}),xN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_RANGE_DATETIME,`FormFieldRangeDateTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});xN.displayName=`FormFieldRangeDateTime`;var SN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_TIME_RANGE_PICKER,`TimeRangePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});SN.displayName=`TimeRangePicker`;var CN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=K({component:J.LOW_LEVEL_FORM_FIELD_RANGE_TIME});return(0,$.jsx)(SN,{ref:t,schema:e.schema,name:e.name,...e,timeFormat:n?.timeFormat})}),wN=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_RANGE_TIME,`FormFieldRangeTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});wN.displayName=`FormFieldRangeTime`;function TN({name:e,schema:t,label:n,hideLabel:r,description:i,disabled:a,className:o,renderField:s,fieldLabels:c={},excludedChildKeys:l}){let u=Ju(t),d=od(t),f=ZT();if(!u||d.length===0)return null;let p=l?new Set(l):null,m=p?d.filter(e=>!p.has(e)):d;return m.length===0?null:s?(0,$.jsxs)(BT,{disabled:a,className:o,"data-field":e,children:[!r&&(0,$.jsx)(PD,{children:(0,$.jsx)(HT,{children:n})}),i&&(0,$.jsx)(Ox,{children:i}),(0,$.jsx)(VT,{children:m.map(t=>(0,$.jsx)(Q.Fragment,{children:s(`${e}.${t}`,u[t])},t))})]}):(0,$.jsxs)(BT,{disabled:a,className:o,"data-field":e,children:[!r&&(0,$.jsx)(PD,{children:(0,$.jsx)(HT,{children:n})}),i&&(0,$.jsx)(Ox,{children:i}),(0,$.jsx)(VT,{children:m.map(t=>{let n=u[t],r=`${e}.${t}`,i=c[t]??f?.fieldLabels?.[sr.labelDictionaryPath(r)]??sr.unresolvedFieldLabel(t);return(0,$.jsx)(nR,{name:r,schema:n,label:i,disabled:a},t)})})]})}TN.displayName=`FormFieldComposite`;var EN=TN,Yde=0;function DN(){return`kv-${++Yde}-${Date.now()}`}function Xde(e){return!e||typeof e!=`object`?[]:Object.entries(e).map(([e])=>({id:DN(),key:e,pendingValue:void 0}))}function Zde(e,t,n,r){let i={};for(let a of e){let e=a.key.trim();if(e!==``){if(r?.has(a.id))i[e]=r.get(a.id);else{let r=n(`${t}.${e}`);i[e]=r===void 0?a.pendingValue:r}}}return i}function Qde({entry:e,index:t,valueSchema:n,parentName:r,disabled:i,canRemove:a,keyError:o,onKeyChange:s,onRemove:c,keyLabel:l,valueLabel:u,emptyKeyPlaceholder:d,renderIcon:f}){let{getRecipe:p}=e_(),m=p(wi.TYPOGRAPHY,Lu.DESCRIPTION),{formChromeMode:h,sectionChromeMode:g}=fT(),_=oc(),v=g??h??YL(_.autoRender?.autoFieldChrome),y=XL(_.autoRender?.autoLabelPlacement),b=ZL(_.autoRender?.autoFieldDensity),x=_.autoRender?.autoErrorPlacement===`summary-at-surface-top`,S=(0,Q.useCallback)(t=>{s(e.id,t)},[e.id,s]),C=e.key.trim()!==``;return(0,$.jsxs)(`div`,{className:`relative rounded-lg border border-border p-card`,"data-testid":`record-entry-${t}`,children:[a&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.ICON,onClick:()=>c(e.id),disabled:i,className:`absolute -top-3 end-3 h-6 w-6 bg-background`,"aria-label":`Remove entry ${e.key||t+1}`,children:f(H.CLOSE,{size:fa.SM})}),(0,$.jsxs)(`div`,{className:`pt-item space-y-field`,children:[(0,$.jsx)(ZM,{mode:v,label:l,error:o,labelPlacement:y,hideError:x,fieldName:`${r}.__key_${e.id}`,disabled:i,children:(0,$.jsx)(rN,{schema:kd(),name:`${r}.__key_${e.id}`,value:e.key,onChange:e=>S(String(e)),disabled:i,controlSize:b})}),C?(0,$.jsx)(nR,{name:`${r}.${e.key}`,schema:n,label:u,disabled:i}):(0,$.jsx)(`p`,{className:U(m.base,`py-card-sm px-card-sm rounded-md border border-dashed border-border`),children:d})]})]})}function ON({name:e,schema:t,label:n,description:r,disabled:i,className:a,valueSchema:o,keySchema:s}){let{setValue:c,getValues:l,trigger:u,setError:d,clearErrors:f,getFieldState:p,formState:m}=rw(),{renderIcon:h}=Rf(),g=RE(),_=g!==null&&BE(uo(t)?.autosave,g.config.defaultTrigger,!0)!==zn.NONE?g:null,{tComponent:v,isReady:y,resolvedRegionalPreferences:b}=K({component:J.LOW_LEVEL_FORM_MESSAGE}),x=b?.timezone,{getRecipe:S}=e_(),C=S(wi.TYPOGRAPHY,Lu.DESCRIPTION),w=v(J.LOW_LEVEL_FORM_MESSAGE,`recordAddEntry`),T=v(J.LOW_LEVEL_FORM_MESSAGE,`recordKeyLabel`),E=v(J.LOW_LEVEL_FORM_MESSAGE,`recordValueLabel`),D=v(J.LOW_LEVEL_FORM_MESSAGE,`recordEmptyMessage`),O=v(J.LOW_LEVEL_FORM_MESSAGE,`recordDuplicateKey`),k=v(J.LOW_LEVEL_FORM_MESSAGE,`recordEnterKeyFirst`),A=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>()=>{A.current=!1},[]);let[j,M]=(0,Q.useState)(()=>Xde(l(e))),N=(0,Q.useMemo)(()=>{let e=new Map;for(let t of j){let n=t.key.trim();n!==``&&e.set(n,(e.get(n)||0)+1)}let t=new Set;for(let[n,r]of e)r>1&&t.add(n);return t},[j]);(0,Q.useEffect)(()=>{N.size>0?d(e,{type:xT,message:O}):p(e,m).error?.type===`record-duplicate-key`&&f(e)},[N,e,d,f,p,m,O]);let P=(0,Q.useCallback)((t,n)=>{let r=Zde(t,e,l,n);c(e,r,{shouldDirty:!0,shouldValidate:!0}),_&&_.triggerSave(e,r,zn.DEBOUNCE),setTimeout(()=>{A.current&&u(e)},0)},[e,c,l,u,_]),F=(0,Q.useCallback)((t,n)=>{M(r=>{let i=r.find(e=>e.id===t);if(!i)return r;let a=i.key.trim(),o=a===``?i.pendingValue:l(`${e}.${a}`),s=r.map(e=>e.id===t?{...e,key:n,pendingValue:o}:e);return P(s,new Map([[t,o]])),s})},[e,l,P]),I=(0,Q.useCallback)(()=>{if(i)return;let e={id:DN(),key:``,pendingValue:sr.getDefaultValueForSchema(o,{timeZone:x})};M(t=>[...t,e])},[i,o,x]),ee=(0,Q.useCallback)(e=>{i||M(t=>{let n=t.filter(t=>t.id!==e);return P(n),n})},[i,P]);return y?(0,$.jsxs)(BT,{disabled:i,className:a,"data-field":e,"data-testid":`field-record-${e}`,children:[(0,$.jsx)(PD,{children:(0,$.jsx)(HT,{children:n})}),r&&(0,$.jsx)(Ox,{children:r}),(0,$.jsxs)(VT,{className:`space-y-field`,children:[j.map((t,n)=>{let r=t.key.trim(),a=r!==``&&N.has(r)?O:void 0;return(0,$.jsx)(Qde,{entry:t,index:n,valueSchema:o,parentName:e,disabled:i,canRemove:!i,keyError:a,onKeyChange:F,onRemove:ee,keyLabel:T,valueLabel:E,emptyKeyPlaceholder:k,renderIcon:h},t.id)}),(0,$.jsxs)(X,{type:`button`,variant:Y.OUTLINE,onClick:I,disabled:i,className:`w-full`,children:[h(H.PLUS,{size:fa.SM,className:`me-element`}),w]}),j.length===0&&(0,$.jsx)(`p`,{className:U(C.base,`text-center py-card`),children:D})]})]}):null}ON.displayName=`FormFieldRecord`;var kN=ON,AN=e(i());function $de(){var e=[...arguments];return(0,Q.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var jN=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function MN(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function NN(e){return`nodeType`in e}function PN(e){return e?MN(e)?e:NN(e)?e.ownerDocument?.defaultView??window:window:window}function FN(e){let{Document:t}=PN(e);return e instanceof t}function IN(e){return!MN(e)&&e instanceof PN(e).HTMLElement}function LN(e){return e instanceof PN(e).SVGElement}function RN(e){return e?MN(e)?e.document:NN(e)?FN(e)?e:IN(e)||LN(e)?e.ownerDocument:document:document:document}var zN=jN?Q.useLayoutEffect:Q.useEffect;function BN(e){let t=(0,Q.useRef)(e);return zN(()=>{t.current=e}),(0,Q.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function efe(){let e=(0,Q.useRef)(null);return[(0,Q.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,Q.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function VN(e,t){t===void 0&&(t=[e]);let n=(0,Q.useRef)(e);return zN(()=>{n.current!==e&&(n.current=e)},t),n}function HN(e,t){let n=(0,Q.useRef)();return(0,Q.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function UN(e){let t=BN(e),n=(0,Q.useRef)(null);return[n,(0,Q.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function WN(e){let t=(0,Q.useRef)();return(0,Q.useEffect)(()=>{t.current=e},[e]),t.current}var GN={};function KN(e,t){return(0,Q.useMemo)(()=>{if(t)return t;let n=GN[e]==null?0:GN[e]+1;return GN[e]=n,e+`-`+n},[e,t])}function qN(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var JN=qN(1),YN=qN(-1);function tfe(e){return`clientX`in e&&`clientY`in e}function XN(e){if(!e)return!1;let{KeyboardEvent:t}=PN(e.target);return t&&e instanceof t}function nfe(e){if(!e)return!1;let{TouchEvent:t}=PN(e.target);return t&&e instanceof t}function ZN(e){if(nfe(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return tfe(e)?{x:e.clientX,y:e.clientY}:null}var QN=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[QN.Translate.toString(e),QN.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),$N=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function rfe(e){return e.matches($N)?e:e.querySelector($N)}var ife={display:`none`};function afe(e){let{id:t,value:n}=e;return Q.createElement(`div`,{id:t,style:ife},n)}function ofe(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return Q.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function sfe(){let[e,t]=(0,Q.useState)(``);return{announce:(0,Q.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var eP=(0,Q.createContext)(null);function cfe(e){let t=(0,Q.useContext)(eP);(0,Q.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function lfe(){let[e]=(0,Q.useState)(()=>new Set),t=(0,Q.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,Q.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var ufe={draggable:`
|
|
7
|
-
To pick up a draggable item, press the space bar.
|
|
8
|
-
While dragging, use the arrow keys to move the item.
|
|
9
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
10
|
-
`},dfe={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function ffe(e){let{announcements:t=dfe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=ufe}=e,{announce:a,announcement:o}=sfe(),s=KN(`DndLiveRegion`),[c,l]=(0,Q.useState)(!1);if((0,Q.useEffect)(()=>{l(!0)},[]),cfe((0,Q.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=Q.createElement(Q.Fragment,null,Q.createElement(afe,{id:r,value:i.draggable}),Q.createElement(ofe,{id:s,announcement:o}));return n?(0,AN.createPortal)(u,n):u}var tP;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(tP||={});function nP(){}function rP(e,t){return(0,Q.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function iP(){var e=[...arguments];return(0,Q.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var aP=Object.freeze({x:0,y:0});function oP(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function sP(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function pfe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function cP(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function lP(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function uP(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var dP=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=uP(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=oP(uP(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(sP)},mfe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=cP(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=cP(r),o=i.reduce((e,t,r)=>e+oP(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(sP)};function hfe(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var gfe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=hfe(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(pfe)};function _fe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function fP(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:aP}function vfe(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var yfe=vfe(1);function bfe(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function xfe(e,t,n){let r=bfe(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var Sfe={ignoreTransform:!1};function pP(e,t){t===void 0&&(t=Sfe);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=PN(e).getComputedStyle(e);t&&(n=xfe(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function mP(e){return pP(e,{ignoreTransform:!0})}function Cfe(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function wfe(e,t){return t===void 0&&(t=PN(e).getComputedStyle(e)),t.position===`fixed`}function Tfe(e,t){t===void 0&&(t=PN(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function hP(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(FN(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!IN(i)||LN(i)||n.includes(i))return n;let a=PN(e).getComputedStyle(i);return i!==e&&Tfe(i,a)&&n.push(i),wfe(i,a)?n:r(i.parentNode)}return e?r(e):n}function gP(e){let[t]=hP(e,1);return t??null}function _P(e){return!jN||!e?null:MN(e)?e:NN(e)?FN(e)||e===RN(e).scrollingElement?window:IN(e)?e:null:null}function vP(e){return MN(e)?e.scrollX:e.scrollLeft}function yP(e){return MN(e)?e.scrollY:e.scrollTop}function bP(e){return{x:vP(e),y:yP(e)}}var xP;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(xP||={});function SP(e){return!jN||!e?!1:e===document.scrollingElement}function CP(e){let t={x:0,y:0},n=SP(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Efe={x:.2,y:.2};function Dfe(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Efe);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=CP(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=xP.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=xP.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=xP.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=xP.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Ofe(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function wP(e){return e.reduce((e,t)=>JN(e,bP(t)),aP)}function kfe(e){return e.reduce((e,t)=>e+vP(t),0)}function Afe(e){return e.reduce((e,t)=>e+yP(t),0)}function jfe(e,t){if(t===void 0&&(t=pP),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);gP(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Mfe=[[`x`,[`left`,`right`],kfe],[`y`,[`top`,`bottom`],Afe]],TP=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=hP(t),r=wP(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Mfe)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},EP=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function Nfe(e){let{EventTarget:t}=PN(e);return e instanceof t?e:RN(e)}function DP(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var OP;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(OP||={});function kP(e){e.preventDefault()}function Pfe(e){e.stopPropagation()}var AP;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(AP||={});var jP={start:[AP.Space,AP.Enter],cancel:[AP.Esc],end:[AP.Space,AP.Enter,AP.Tab]},Ffe=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case AP.Right:return{...n,x:n.x+25};case AP.Left:return{...n,x:n.x-25};case AP.Down:return{...n,y:n.y+25};case AP.Up:return{...n,y:n.y-25}}},MP=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new EP(RN(t)),this.windowListeners=new EP(PN(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(OP.Resize,this.handleCancel),this.windowListeners.add(OP.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(OP.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&jfe(n),t(aP)}handleKeyDown(e){if(XN(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=jP,coordinateGetter:a=Ffe,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:aP;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=YN(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=CP(n),p=Ofe(n),m={x:Math.min(i===AP.Right?p.right-p.width/2:p.right,Math.max(i===AP.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===AP.Down?p.bottom-p.height/2:p.bottom,Math.max(i===AP.Down?p.top:p.top+p.height/2,u.y))},h=i===AP.Right&&!s||i===AP.Left&&!c,g=i===AP.Down&&!l||i===AP.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===AP.Right&&e<=d.x||i===AP.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}r.x=a?n.scrollLeft-e:i===AP.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===AP.Down&&e<=d.y||i===AP.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}r.y=a?n.scrollTop-e:i===AP.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,JN(YN(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};MP.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=jP,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function NP(e){return!!(e&&`distance`in e)}function PP(e){return!!(e&&`delay`in e)}var FP=class{constructor(e,t,n){n===void 0&&(n=Nfe(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=RN(i),this.documentListeners=new EP(this.document),this.listeners=new EP(n),this.windowListeners=new EP(PN(i)),this.initialCoordinates=ZN(r)??aP,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(OP.Resize,this.handleCancel),this.windowListeners.add(OP.DragStart,kP),this.windowListeners.add(OP.VisibilityChange,this.handleCancel),this.windowListeners.add(OP.ContextMenu,kP),this.documentListeners.add(OP.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(PP(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(NP(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(OP.Click,Pfe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(OP.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=ZN(e)??aP,s=YN(n,o);if(!t&&a){if(NP(a)){if(a.tolerance!=null&&DP(s,a.tolerance))return this.handleCancel();if(DP(s,a.distance))return this.handleStart()}if(PP(a)&&DP(s,a.tolerance))return this.handleCancel();this.handlePending(a,s)}else e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===AP.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Ife={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},IP=class extends FP{constructor(e){let{event:t}=e,n=RN(t.target);super(e,Ife,n)}};IP.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Lfe={move:{name:`mousemove`},end:{name:`mouseup`}},LP;(function(e){e[e.RightClick=2]=`RightClick`})(LP||={});var Rfe=class extends FP{constructor(e){super(e,Lfe,RN(e.event.target))}};Rfe.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==LP.RightClick&&(r?.({event:n}),!0)}}];var RP={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},zfe=class extends FP{constructor(e){super(e,RP)}static setup(){return window.addEventListener(RP.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(RP.move.name,e)};function e(){}}};zfe.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var zP;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(zP||={});var BP;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(BP||={});function Bfe(e){let{acceleration:t,activator:n=zP.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=BP.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=Hfe({delta:d,disabled:!a}),[m,h]=efe(),g=(0,Q.useRef)({x:0,y:0}),_=(0,Q.useRef)({x:0,y:0}),v=(0,Q.useMemo)(()=>{switch(n){case zP.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case zP.DraggableRect:return i}},[n,i,c]),y=(0,Q.useRef)(null),b=(0,Q.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,Q.useMemo)(()=>s===BP.TreeOrder?[...l].reverse():l,[s,l]);(0,Q.useEffect)(()=>{if(!a||!l.length||!v)h();else{for(let e of x){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=Dfe(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),y.current=e,m(b,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()}},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var Vfe={x:{[xP.Backward]:!1,[xP.Forward]:!1},y:{[xP.Backward]:!1,[xP.Forward]:!1}};function Hfe(e){let{delta:t,disabled:n}=e,r=WN(t);return HN(e=>{if(n||!r||!e)return Vfe;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[xP.Backward]:e.x[xP.Backward]||i.x===-1,[xP.Forward]:e.x[xP.Forward]||i.x===1},y:{[xP.Backward]:e.y[xP.Backward]||i.y===-1,[xP.Forward]:e.y[xP.Forward]||i.y===1}}},[n,t,r])}function Ufe(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return HN(e=>t==null?null:r??e??null,[r,t])}function Wfe(e,t){return(0,Q.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var VP;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(VP||={});var HP;(function(e){e.Optimized=`optimized`})(HP||={});var UP=new Map;function Gfe(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,Q.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,Q.useRef)(e),d=g(),f=VN(d),p=(0,Q.useCallback)(function(e){e===void 0&&(e=[]),f.current||o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,Q.useRef)(null),h=HN(t=>{if(d&&!n)return UP;if(!t||t===UP||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new TP(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,Q.useEffect)(()=>{u.current=e},[e]),(0,Q.useEffect)(()=>{d||p()},[n,d]),(0,Q.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,Q.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case VP.Always:return!1;case VP.BeforeDragging:return n;default:return!n}}}function WP(e,t){return HN(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Kfe(e,t){return WP(e,t)}function qfe(e){let{callback:t,disabled:n}=e,r=BN(t),i=(0,Q.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,Q.useEffect)(()=>()=>i?.disconnect(),[i]),i}function GP(e){let{callback:t,disabled:n}=e,r=BN(t),i=(0,Q.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,Q.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Jfe(e){return new TP(pP(e),e)}function KP(e,t,n){t===void 0&&(t=Jfe);let[r,i]=(0,Q.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=qfe({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=GP({callback:a});return zN(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Yfe(e){return fP(e,WP(e))}var qP=[];function Xfe(e){let t=(0,Q.useRef)(e),n=HN(n=>e?n&&n!==qP&&e&&t.current&&e.parentNode===t.current.parentNode?n:hP(e):qP,[e]);return(0,Q.useEffect)(()=>{t.current=e},[e]),n}function Zfe(e){let[t,n]=(0,Q.useState)(null),r=(0,Q.useRef)(e),i=(0,Q.useCallback)(e=>{let t=_P(e.target);t&&n(e=>e?(e.set(t,bP(t)),new Map(e)):null)},[]);return(0,Q.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=_P(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,bP(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{_P(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,Q.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>JN(e,t),aP):wP(e):aP,[e,t])}function JP(e,t){t===void 0&&(t=[]);let n=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{n.current=null},t),(0,Q.useEffect)(()=>{let t=e!==aP;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?YN(e,n.current):aP}function Qfe(e){(0,Q.useEffect)(()=>{if(!jN)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function $fe(e,t){return(0,Q.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function YP(e){return(0,Q.useMemo)(()=>e?Cfe(e):null,[e])}var XP=[];function epe(e,t){t===void 0&&(t=pP);let[n]=e,r=YP(n?PN(n):null),[i,a]=(0,Q.useState)(XP);function o(){a(()=>e.length?e.map(e=>SP(e)?r:new TP(t(e),e)):XP)}let s=GP({callback:o});return zN(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function tpe(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return IN(t)?t:e}function npe(e){let{measure:t}=e,[n,r]=(0,Q.useState)(null),i=GP({callback:(0,Q.useCallback)(e=>{for(let{target:n}of e)if(IN(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=UN((0,Q.useCallback)(e=>{let n=tpe(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,Q.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var rpe=[{sensor:IP,options:{}},{sensor:MP,options:{}}],ipe={current:{}},ZP={draggable:{measure:mP},droppable:{measure:mP,strategy:VP.WhileDragging,frequency:HP.Optimized},dragOverlay:{measure:pP}},QP=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},ape={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new QP,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:nP},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ZP,measureDroppableContainers:nP,windowRect:null,measuringScheduled:!1},ope={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:nP,draggableNodes:new Map,over:null,measureDroppableContainers:nP},$P=(0,Q.createContext)(ope),eF=(0,Q.createContext)(ape);function spe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new QP}}}function cpe(e,t){switch(t.type){case tP.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case tP.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case tP.DragEnd:case tP.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case tP.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new QP(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case tP.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new QP(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case tP.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new QP(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function lpe(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,Q.useContext)($P),a=WN(r),o=WN(n?.id);return(0,Q.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!XN(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=rfe(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function upe(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function dpe(e){return(0,Q.useMemo)(()=>({draggable:{...ZP.draggable,...e?.draggable},droppable:{...ZP.droppable,...e?.droppable},dragOverlay:{...ZP.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function fpe(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,Q.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;zN(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=fP(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=gP(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var tF=(0,Q.createContext)({...aP,scaleX:1,scaleY:1}),nF;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(nF||={});var rF=(0,Q.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=rpe,collisionDetection:o=gfe,measuring:s,modifiers:c,...l}=e,[u,d]=(0,Q.useReducer)(cpe,void 0,spe),[f,p]=lfe(),[m,h]=(0,Q.useState)(nF.Uninitialized),g=m===nF.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,Q.useRef)({initial:null,translated:null}),C=(0,Q.useMemo)(()=>_==null?null:{id:_,data:x?.data??ipe,rect:S},[_,x]),w=(0,Q.useRef)(null),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),k=VN(l,Object.values(l)),A=KN(`DndDescribedBy`,t),j=(0,Q.useMemo)(()=>b.getEnabled(),[b]),M=dpe(s),{droppableRects:N,measureDroppableContainers:P,measuringScheduled:F}=Gfe(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),I=Ufe(v,_),ee=(0,Q.useMemo)(()=>D?ZN(D):null,[D]),L=Oe(),R=Kfe(I,M.draggable.measure);fpe({activeNode:_==null?null:v.get(_),config:L.layoutShiftCompensation,initialRect:R,measure:M.draggable.measure});let te=KP(I,M.draggable.measure,R),z=KP(I?I.parentElement:null),B=(0,Q.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=b.getNodeFor(B.current.over?.id),re=npe({measure:M.dragOverlay.measure}),ie=re.nodeRef.current??I,ae=g?re.rect??te:null,oe=!!(re.nodeRef.current&&re.rect),se=Yfe(oe?null:te),ce=YP(ie?PN(ie):null),le=Xfe(g?ne??I:null),ue=epe(le),de=upe(c,{transform:{x:y.x-se.x,y:y.y-se.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:te,containerNodeRect:z,draggingNodeRect:ae,over:B.current.over,overlayNodeRect:re.rect,scrollableAncestors:le,scrollableAncestorRects:ue,windowRect:ce}),fe=ee?JN(ee,y):null,pe=Zfe(le),me=JP(pe),he=JP(pe,[te]),ge=JN(de,me),_e=ae?yfe(ae,de):null,ve=C&&_e?o({active:C,collisionRect:_e,droppableRects:N,droppableContainers:j,pointerCoordinates:fe}):null,ye=lP(ve,`id`),[be,xe]=(0,Q.useState)(null),Se=_fe(oe?de:JN(de,he),be?.rect??null,te),Ce=(0,Q.useRef)(null),we=(0,Q.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent,o=new n({active:w.current,activeNode:i,event:a,options:r,context:B,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,AN.unstable_batchedUpdates)(()=>{r?.(i),h(nF.Initializing),d({type:tP.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(Ce.current),O(a)})},onMove(e){d({type:tP.DragMove,coordinates:e})},onEnd:s(tP.DragEnd),onCancel:s(tP.DragCancel)});Ce.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=B.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===tP.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=tP.DragCancel)}w.current=null,(0,AN.unstable_batchedUpdates)(()=>{d({type:e}),h(nF.Uninitialized),xe(null),E(null),O(null),Ce.current=null;let t=e===tP.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Te=Wfe(a,(0,Q.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,we(n,t))},[v,we]));Qfe(a),zN(()=>{te&&m===nF.Initializing&&h(nF.Initialized)},[te,m]),(0,Q.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=B.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:ge.x,y:ge.y},over:i};(0,AN.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[ge.x,ge.y]),(0,Q.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=B.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(ye),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,AN.unstable_batchedUpdates)(()=>{xe(s),a?.(c),f({type:`onDragOver`,event:c})})},[ye]),zN(()=>{B.current={activatorEvent:D,active:C,activeNode:I,collisionRect:_e,collisions:ve,droppableRects:N,draggableNodes:v,draggingNode:ie,draggingNodeRect:ae,droppableContainers:b,over:be,scrollableAncestors:le,scrollAdjustedTranslate:ge},S.current={initial:ae,translated:_e}},[C,I,ve,_e,v,ie,ae,N,b,be,le,ge]),Bfe({...L,delta:y,draggingRect:_e,pointerCoordinates:fe,scrollableAncestors:le,scrollableAncestorRects:ue});let Ee=(0,Q.useMemo)(()=>({active:C,activeNode:I,activeNodeRect:te,activatorEvent:D,collisions:ve,containerNodeRect:z,dragOverlay:re,draggableNodes:v,droppableContainers:b,droppableRects:N,over:be,measureDroppableContainers:P,scrollableAncestors:le,scrollableAncestorRects:ue,measuringConfiguration:M,measuringScheduled:F,windowRect:ce}),[C,I,te,D,ve,z,re,v,b,N,be,P,le,ue,M,F,ce]),De=(0,Q.useMemo)(()=>({activatorEvent:D,activators:Te,active:C,activeNodeRect:te,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:be,measureDroppableContainers:P}),[D,Te,C,te,d,A,v,be,P]);return Q.createElement(eP.Provider,{value:p},Q.createElement($P.Provider,{value:De},Q.createElement(eF.Provider,{value:Ee},Q.createElement(tF.Provider,{value:Se},i)),Q.createElement(lpe,{disabled:n?.restoreFocus===!1})),Q.createElement(ffe,{...n,hiddenTextDescribedById:A}));function Oe(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),ppe=(0,Q.createContext)(null),iF=`button`,mpe=`Draggable`;function hpe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=KN(mpe),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,Q.useContext)($P),{role:p=iF,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,Q.useContext)(g?tF:ppe),[v,y]=UN(),[b,x]=UN(),S=$fe(o,t),C=VN(n);return zN(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,Q.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===iF?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function gpe(){return(0,Q.useContext)(eF)}var _pe=`Droppable`,vpe={timeout:25};function ype(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=KN(_pe),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,Q.useContext)($P),u=(0,Q.useRef)({disabled:n}),d=(0,Q.useRef)(!1),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...vpe,...i},_=VN(h??r),v=GP({callback:(0,Q.useCallback)(()=>{d.current?(p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)):d.current=!0},[g]),disabled:m||!o}),[y,b]=UN((0,Q.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=VN(t);return(0,Q.useEffect)(()=>{v&&y.current&&(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,Q.useEffect)(()=>(s({type:tP.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:tP.UnregisterDroppable,key:a,id:r})),[r]),(0,Q.useEffect)(()=>{n!==u.current.disabled&&(s({type:tP.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function aF(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function bpe(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function oF(e){return e!==null&&e>=0}function xpe(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Spe(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var sF=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=aF(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},cF={scaleX:1,scaleY:1},lF=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...cF}:null}let s=Cpe(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...cF}:r<t&&r>=a?{x:0,y:o.height+s,...cF}:{x:0,y:0,...cF}};function Cpe(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var uF=`Sortable`,dF=Q.createContext({activeIndex:-1,containerId:uF,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:sF,disabled:{draggable:!1,droppable:!1}});function fF(e){let{children:t,id:n,items:r,strategy:i=sF,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=gpe(),d=KN(uF,n),f=s.rect!==null,p=(0,Q.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,Q.useRef)(p),v=!xpe(p,_.current),y=g!==-1&&h===-1||v,b=Spe(a);zN(()=>{v&&m&&u(p)},[v,p,m,u]),(0,Q.useEffect)(()=>{_.current=p},[p]);let x=(0,Q.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:bpe(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return Q.createElement(dF.Provider,{value:x},t)}var wpe=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return aF(n,r,i).indexOf(t)},Tpe=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},Epe={duration:200,easing:`ease`},pF=`transform`,Dpe=QN.Transition.toString({property:pF,duration:0,easing:`linear`}),Ope={roleDescription:`sortable`};function kpe(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,Q.useState)(null),s=(0,Q.useRef)(n);return zN(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=pP(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,Q.useEffect)(()=>{a&&o(null)},[a]),a}function mF(e){let{animateLayoutChanges:t=Tpe,attributes:n,disabled:r,data:i,getNewIndex:a=wpe,id:o,strategy:s,resizeObserverConfig:c,transition:l=Epe}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,Q.useContext)(dF),y=Ape(r,p),b=u.indexOf(o),x=(0,Q.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,Q.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=ype({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:j,listeners:M,isDragging:N,over:P,setActivatorNodeRef:F,transform:I}=hpe({id:o,data:x,attributes:{...Ope,...n},disabled:y.draggable}),ee=$de(E,j),L=!!D,R=L&&!m&&oF(f)&&oF(g),te=!_&&N,z=R?(te&&R?I:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,B=oF(f)&&oF(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ne=D?.id,re=(0,Q.useRef)({activeId:ne,items:u,newIndex:B,containerId:d}),ie=u!==re.current.items,ae=t({active:D,containerId:d,isDragging:N,isSorting:L,id:o,index:b,items:u,newIndex:re.current.newIndex,previousItems:re.current.items,previousContainerId:re.current.containerId,transition:l,wasDragging:re.current.activeId!=null}),oe=kpe({disabled:!ae,index:b,node:w,rect:C});return(0,Q.useEffect)(()=>{L&&re.current.newIndex!==B&&(re.current.newIndex=B),d!==re.current.containerId&&(re.current.containerId=d),u!==re.current.items&&(re.current.items=u)},[L,B,d,u]),(0,Q.useEffect)(()=>{if(ne===re.current.activeId)return;if(ne!=null&&re.current.activeId==null){re.current.activeId=ne;return}let e=setTimeout(()=>{re.current.activeId=ne},50);return()=>clearTimeout(e)},[ne]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:B,items:u,isOver:T,isSorting:L,isDragging:N,listeners:M,node:w,overIndex:g,over:P,setNodeRef:ee,setActivatorNodeRef:F,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:oe??z,transition:se()};function se(){if(oe||ie&&re.current.newIndex===b)return Dpe;if(!(te&&!XN(O)||!l)&&(L||ae))return QN.Transition.toString({...l,property:pF})}}function Ape(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function hF(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var jpe=[AP.Down,AP.Right,AP.Up,AP.Left],gF=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(jpe.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case AP.Down:r.top<a.top&&t.push(n);break;case AP.Up:r.top>a.top&&t.push(n);break;case AP.Left:r.left>a.left&&t.push(n);break;case AP.Right:r.left<a.left&&t.push(n)}});let c=mfe({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=lP(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=hP(c).some((e,t)=>s[t]!==e),i=_F(e,t),a=Mpe(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:YN(u,l)}}}};function _F(e,t){return!hF(e)||!hF(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Mpe(e,t){return!hF(e)||!hF(t)||!_F(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var vF;(function(e){e.POPPER=`popper`,e.ITEM_ALIGNED=`item-aligned`})(vF||={});var yF=zs(J.LOW_LEVEL_SELECT,`Select`,[`Root`,`Trigger`,`Content`,`Value`,`Item`,`Group`,`Label`,`Separator`,`ScrollUpButton`,`ScrollDownButton`]),bF=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=yF(e);return(0,$.jsx)(r,{...t,ref:n})});bF.displayName=`Select`;function xF({preset:e=q.DEFAULT,...t}){let n=yF(e);return(0,$.jsx)(n.Root,{...t})}var SF=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=yF(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});SF.displayName=`SelectTrigger`;var CF=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=yF(e);return(0,$.jsx)(r.Content,{...t,ref:n})});CF.displayName=`SelectContent`;function wF({preset:e=q.DEFAULT,...t}){let n=yF(e);return(0,$.jsx)(n.Value,{...t})}var TF=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=yF(e);return(0,$.jsx)(r.Item,{...t,ref:n})});TF.displayName=`SelectItem`;function Npe({preset:e=q.DEFAULT,...t}){let n=yF(e);return(0,$.jsx)(n.Group,{...t})}function Ppe({preset:e=q.DEFAULT,...t}){let n=yF(e);return(0,$.jsx)(n.Label,{...t})}function Fpe({preset:e=q.DEFAULT,...t}){let n=yF(e);return(0,$.jsx)(n.Separator,{...t})}function Ipe({preset:e=q.DEFAULT,...t}){let n=yF(e);return(0,$.jsx)(n.ScrollUpButton,{...t})}function Lpe({preset:e=q.DEFAULT,...t}){let n=yF(e);return(0,$.jsx)(n.ScrollDownButton,{...t})}var EF=zs(J.LOW_LEVEL_RADIO_GROUP,`RadioGroup`,[`Root`]),DF=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=EF(e);return(0,$.jsx)(r,{...t,ref:n})});DF.displayName=`RadioGroup`;function OF({preset:e=q.DEFAULT,...t}){let n=EF(e);return(0,$.jsx)(n.Root,{...t})}function kF({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_RADIO,`RadioGroupItem`)(e);return(0,$.jsx)(n,{...t})}var AF;(function(e){e.ABSENT=`absent`})(AF||={});var jF=zs(J.LOW_LEVEL_CARD,`Card`,[`Listbox`,`Header`,`Footer`,`Title`,`Action`,`Description`,`Content`]);function MF({preset:e=q.DEFAULT,...t}){let n=jF(e);return(0,$.jsx)(n,{...t})}function NF({preset:e=q.DEFAULT,...t}){let n=jF(e);return(0,$.jsx)(n.Listbox,{...t})}function PF({preset:e=q.DEFAULT,...t}){let n=jF(e);return(0,$.jsx)(n.Header,{...t})}function FF({preset:e=q.DEFAULT,...t}){let n=jF(e);return(0,$.jsx)(n.Footer,{...t})}function IF({preset:e=q.DEFAULT,...t}){let n=jF(e);return(0,$.jsx)(n.Title,{...t})}function LF({preset:e=q.DEFAULT,...t}){let n=jF(e);return(0,$.jsx)(n.Action,{...t})}function RF({preset:e=q.DEFAULT,...t}){let n=jF(e);return(0,$.jsx)(n.Description,{...t})}function zF({preset:e=q.DEFAULT,...t}){let n=jF(e);return(0,$.jsx)(n.Content,{...t})}var Rpe=bl(J.LOW_LEVEL_SELECT_MULTIPLE,`SelectMultiple`),BF=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=Rpe(e);return(0,$.jsx)(r,{...t,ref:n})});BF.displayName=`SelectMultiple`;function zpe(e,t){let n=Q.createContext(t),r=e=>{let{children:t,...r}=e,i=Q.useMemo(()=>r,Object.values(r));return(0,$.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=Q.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function VF(e,t=[]){let n=[];function r(t,r){let i=Q.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=Q.useMemo(()=>o,Object.values(o));return(0,$.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=Q.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>Q.createContext(e));return function(n){let r=n?.[e]||t;return Q.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Bpe(i,...t)]}function Bpe(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return Q.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}typeof window<`u`&&window.document&&window.document.createElement;function HF(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var UF=globalThis?.document?Q.useLayoutEffect:()=>{},Vpe=Q.useInsertionEffect||UF;function WF({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Hpe({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=Q.useRef(e!==void 0);Q.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,Q.useCallback(t=>{if(s){let n=Upe(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Hpe({defaultProp:e,onChange:t}){let[n,r]=Q.useState(e),i=Q.useRef(n),a=Q.useRef(t);return Vpe(()=>{a.current=t},[t]),Q.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Upe(e){return typeof e==`function`}function GF(e){let t=Q.useRef({value:e,previous:e});return Q.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function KF(e){let[t,n]=Q.useState(void 0);return UF(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}function Wpe(e,t){return Q.useReducer((e,n)=>t[e][n]??e,e)}var qF=e=>{let{present:t,children:n}=e,r=Gpe(t),i=typeof n==`function`?n({present:r.isPresent}):Q.Children.only(n),a=qE(r.ref,Kpe(i));return typeof n==`function`||r.isPresent?Q.cloneElement(i,{ref:a}):null};qF.displayName=`Presence`;function Gpe(e){let[t,n]=Q.useState(),r=Q.useRef(null),i=Q.useRef(e),a=Q.useRef(`none`),[o,s]=Wpe(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return Q.useEffect(()=>{let e=JF(r.current);a.current=o===`mounted`?e:`none`},[o]),UF(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=JF(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),UF(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=JF(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=JF(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:Q.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function JF(e){return e?.animationName||`none`}function Kpe(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var YF=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=XE(`Primitive.${t}`),r=Q.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,$.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function qpe(e,t){e&&AN.flushSync(()=>e.dispatchEvent(t))}var XF=`Checkbox`,[Jpe,Ype]=VF(XF),[Xpe,ZF]=Jpe(XF);function Zpe(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=WF({prop:n,defaultProp:i??!1,onChange:c,caller:XF}),[m,h]=Q.useState(null),[g,_]=Q.useState(null),v=Q.useRef(!1),y=!m||!!o||!!m.closest(`form`),b={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,required:l,defaultChecked:!aI(i)&&i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,$.jsx)(Xpe,{scope:t,...b,children:Qpe(d)?d(b):r})}var QF=`CheckboxTrigger`,$F=Q.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=ZF(QF,e),h=qE(i,u),g=Q.useRef(c);return Q.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,$.jsx)(YF.button,{type:`button`,role:`checkbox`,"aria-checked":aI(c)?`mixed`:c,"aria-required":l,"data-state":oI(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:HF(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:HF(n,e=>{d(e=>aI(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});$F.displayName=QF;var eI=Q.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,$.jsx)(Zpe,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)($F,{...d,ref:t,__scopeCheckbox:n}),e&&(0,$.jsx)(iI,{__scopeCheckbox:n})]})})});eI.displayName=XF;var tI=`CheckboxIndicator`,nI=Q.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=ZF(tI,n);return(0,$.jsx)(qF,{present:r||aI(a.checked)||a.checked===!0,children:(0,$.jsx)(YF.span,{"data-state":oI(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});nI.displayName=tI;var rI=`CheckboxBubbleInput`,iI=Q.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=ZF(rI,e),m=qE(n,p),h=GF(a),g=KF(r);Q.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=aI(a),n.call(e,!aI(a)&&a),e.dispatchEvent(t)}},[f,h,a,i]);let _=Q.useRef(!aI(a)&&a);return(0,$.jsx)(YF.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});iI.displayName=rI;function Qpe(e){return typeof e==`function`}function aI(e){return e===`indeterminate`}function oI(e){return aI(e)?`indeterminate`:e?`checked`:`unchecked`}var $pe=Object.freeze([]),sI=Q.forwardRef(({schema:e,name:t,disabled:n,className:r,value:i,onChange:a,onBlur:o,defaultValue:s,validationMode:c,options:l,orientation:u,columns:d,required:f,autoFocus:p},m)=>{let{tErrorValidation:h,tComponent:g,isReady:_}=K({keys:[`errors_validation`],component:[J.LOW_LEVEL_FORM_FIELD,J.LOW_LEVEL_FORM_MESSAGE]}),{renderIcon:v}=Rf(),{getRecipe:y}=e_(),b=y(wi.FORM_CONTROL,Qo.CHECKBOX),x=te(e),S=x?B_(x):void 0,C=u??S?.edit?.editDirection??`vertical`,w=d??S?.edit?.editColumnsCount??1,T=x?qc(x):[],E=l??T.map(e=>({value:e,label:e})),[D,O]=Q.useState(s??[]),k=V_(i,a),A=k?i??$pe:D,j=Q.useCallback((e,t)=>{let n=t?[...A,e]:A.filter(t=>t!==e);k?a?.(n):O(n)},[A,k,a]),M=Q.useRef(null),N=Q.useCallback(e=>{M.current=e,typeof m==`function`?m(e):m&&(m.current=e)},[m]),P=Q.useRef(null),F=Q.useCallback(()=>{P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{M.current&&!M.current.contains(document.activeElement)&&o?.()},0)},[o]);Q.useEffect(()=>()=>{P.current&&clearTimeout(P.current)},[]);let I=t??`checkbox-group-field`;return E.length===0?l===void 0?(0,$.jsx)(`div`,{className:`text-sm text-destructive`,children:`CHECKBOX_GROUP requires an array of enum values. No enum options found.`}):_?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:g(J.LOW_LEVEL_FORM_FIELD,`noResults`)}):null:_?(0,$.jsx)($.Fragment,{children:(0,$.jsx)(`div`,{ref:N,role:`group`,className:U(C===`horizontal`?`flex flex-wrap gap-field`:w>1?`grid gap-group`:`flex flex-col gap-group`,r),style:C===`vertical`&&w>1?{gridTemplateColumns:`repeat(${w}, minmax(0, 1fr))`}:void 0,children:E.map(e=>{let t=A.includes(e.value),r=`${I}-${e.value}`,i=n===!0||e.disabled===!0;return(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(eI,{id:r,checked:t,onCheckedChange:t=>j(e.value,t===!0),onBlur:F,disabled:i,"data-slot":`checkbox`,className:U(`peer size-4 shrink-0 rounded-sm outline-none`,b.base,b.states.focus,b.states.selected,b.states.disabled,b.states.invalid,b.motion.transition),children:(0,$.jsx)(nI,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current transition-none`,children:v(H.CHECK,{size:fa.SM})})}),(0,$.jsx)(`label`,{htmlFor:r,className:U(`text-sm font-normal cursor-pointer select-none`,i&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`),children:e.label})]},e.value)})})}):null});sI.displayName=`FormFieldCheckboxGroup`;var eme={[Ml.SELECT]:!1,[Ml.RADIO]:!1,[Ml.RADIO_ICON_ONLY]:!0,[Ml.TOGGLE]:!1,[Ml.TOGGLE_ICON_ONLY]:!0,[Ml.CARD]:!1,[Ml.CARD_ICON_ONLY]:!0,[Ml.COMBOBOX]:!1},tme={[Ml.SELECT]:mo.VERTICAL,[Ml.RADIO]:mo.VERTICAL,[Ml.RADIO_ICON_ONLY]:mo.HORIZONTAL,[Ml.TOGGLE]:mo.HORIZONTAL,[Ml.TOGGLE_ICON_ONLY]:mo.HORIZONTAL,[Ml.CARD]:mo.VERTICAL,[Ml.CARD_ICON_ONLY]:mo.VERTICAL,[Ml.COMBOBOX]:mo.VERTICAL},nme={[Eo.CHECKBOX]:!1,[Eo.SELECT]:!1,[Eo.TOGGLE]:!1,[Eo.TOGGLE_ICON_ONLY]:!0,[Eo.CARD]:!1,[Eo.CARD_ICON_ONLY]:!0,[Eo.COMBOBOX]:!1},rme={[Eo.CHECKBOX]:mo.VERTICAL,[Eo.SELECT]:mo.VERTICAL,[Eo.TOGGLE]:mo.HORIZONTAL,[Eo.TOGGLE_ICON_ONLY]:mo.HORIZONTAL,[Eo.CARD]:mo.VERTICAL,[Eo.CARD_ICON_ONLY]:mo.VERTICAL,[Eo.COMBOBOX]:mo.VERTICAL},ime=2,ame=4,cI=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,validationMode:l,options:u,placeholder:d,required:f,autoFocus:p,clearable:m,multiple:h,controlSize:g=rf.MD},_)=>{let{renderIcon:v}=Rf(),{tComponent:y,isReady:b}=K({component:J.LOW_LEVEL_FORM_FIELD}),x=a??c,S=h===!0||Array.isArray(x),C=(S?te(e):void 0)??e,w=B_(C),T=Hee(C),E=he(C),D=S?nme[E]??!1:eme[T]??!1,O=S?rme[E]:tme[T],k=w?.edit?.editDirection??O??mo.VERTICAL,A=w?.edit?.editColumnsCount??(D?ame:ime),j=w?.values,M=w?.defaultIcon,N=!!(j&&Object.values(j).some(e=>e.icon))||!!M,P=!!(j&&Object.values(j).some(e=>e.color))||!!w?.defaultColor,F=g===rf.SM?`sm`:`md`,I=g===rf.SM?Xd.SM:Xd.MD,ee=qc(C)??[],L=u??ee.map(e=>({value:e,label:e})),R=Q.useCallback((e,t)=>{if(typeof e==`string`)return v(e,{size:fa.SM,className:t});let n=fd[fa.SM];return Q.createElement(e,{size:n,className:t})},[v]),z=Q.useCallback(e=>{if(!N)return null;let t=j?.[e]?.icon??M;return t?R(t,`shrink-0`):null},[j,M,N,R]),B=Q.useCallback(e=>{let t=z(e.value);if(D&&t!==null)return(0,$.jsxs)(mj,{children:[(0,$.jsx)(hj,{asChild:!0,children:(0,$.jsxs)(`span`,{className:`inline-flex items-center justify-center`,children:[t,(0,$.jsx)(`span`,{className:`sr-only`,children:e.label})]})}),(0,$.jsx)(gj,{children:e.label})]});if(t===null){let t=j?.[e.value]?.color??w?.defaultColor;return!t||D?e.label:(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-element-sm`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:U(of,$f[g_(t)])}),e.label]})}return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-element-sm`,children:[t,e.label]})},[D,z,j,w?.defaultColor]),ne=Q.useMemo(()=>N||D||P?B:void 0,[N,D,P,B]),[re,ie]=Q.useState(c??(S?[]:``)),ae=V_(a,o),oe=a??re,se=Q.useCallback(e=>{r||(ae?o?.(e):ie(e))},[ae,o,r]),ce=Q.useCallback(()=>{s?.()},[s]),le={schema:e,name:t,disabled:n,className:i,validationMode:l,autoFocus:p,controlSize:g},ue=k===mo.HORIZONTAL?Wl.HORIZONTAL:Wl.VERTICAL;if(!b)return null;if(S){let t=Array.isArray(oe)?oe:oe?[oe]:[],a=ld(e),o=a.maxLength!==void 0&&t.length>=a.maxLength,s=a.minLength!==void 0&&t.length<=a.minLength,c=a.minLength===void 0&&a.maxLength===void 0?L:L.map(e=>({...e,disabled:e.disabled===!0||(t.includes(e.value)?s:o)})),l=e=>{a.maxLength!==void 0&&e.length>a.maxLength||a.minLength!==void 0&&e.length<a.minLength&&e.length<t.length||se(e)},u=e=>{l(t.includes(e)?t.filter(t=>t!==e):[...t,e])},m=a.minLength===void 0&&a.maxLength===void 0?null:(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,"data-slot":`enum-multiple-bound`,children:[a.minLength!==void 0&&a.maxLength!==void 0?a.minLength===a.maxLength?y(J.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectExactly`,{count:a.minLength}):y(J.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectRange`,{min:a.minLength,max:a.maxLength}):a.minLength===void 0?y(J.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectUpTo`,{count:a.maxLength}):y(J.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectAtLeast`,{count:a.minLength}),` `,`(`,y(J.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectedCount`,{count:t.length}),`)`]}),h=e=>m===null?e:(0,$.jsxs)(`div`,{className:`flex flex-col items-start gap-item-sm`,children:[e,m]});switch(E){case Eo.CHECKBOX:return h((0,$.jsx)(sI,{ref:_,...le,options:c,value:t,onChange:l,onBlur:ce,controlSize:g}));case Eo.SELECT:return h((0,$.jsx)(BF,{ref:_,...le,options:c,value:t,onChange:l,onBlur:ce,placeholder:d,size:g,renderOptionLabel:ne}));case Eo.TOGGLE:case Eo.TOGGLE_ICON_ONLY:return h((0,$.jsx)(MO,{ref:_,type:kO.MULTIPLE,appearance:AO.CHIPS,value:t,onValueChange:e=>l(Array.isArray(e)?e:e?[e]:[]),disabled:n||r,size:I,orientation:ue,className:i,children:c.map(e=>(0,$.jsx)(NO,{value:e.value,"aria-label":e.label,disabled:e.disabled,children:B(e)},e.value))}));case Eo.CARD:case Eo.CARD_ICON_ONLY:return h((0,$.jsx)(NF,{ref:_,"aria-multiselectable":!0,"aria-disabled":n||r?!0:void 0,"aria-required":f,className:U(`grid gap-element`,i),style:{gridTemplateColumns:`repeat(${A}, minmax(0, 1fr))`},children:c.map(e=>{let i=t.includes(e.value),a=n===!0||r===!0||e.disabled===!0;return(0,$.jsx)(MF,{"data-option":e.value,"aria-disabled":a?!0:void 0,"aria-label":D?e.label:void 0,className:U(`p-card-sm text-sm font-medium`,D&&`flex items-center justify-center`,a&&`cursor-not-allowed opacity-[var(--opacity-disabled)]`),option:{onSelect:()=>{a||u(e.value)}},selected:i,...a?{tabIndex:-1}:{},children:B(e)},e.value)})}));case Eo.COMBOBOX:return h((0,$.jsx)(jx,{ref:_,...le,options:c,value:t,onChange:l,onBlur:ce,placeholder:d,disabled:n||r,autoFocus:p,size:F,showSelectAll:!0,emptyMessage:y(J.LOW_LEVEL_FORM_FIELD,`noResults`),searchPlaceholder:y(J.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`),renderOption:ne?e=>ne(e):void 0}));default:return h((0,$.jsx)(sI,{ref:_,...le,options:c,value:t,onChange:l,onBlur:ce,controlSize:g}))}}switch(T){case Ml.SELECT:return(0,$.jsx)(bF,{ref:_,...le,options:L,value:oe,onChange:se,onBlur:ce,placeholder:d,size:g,renderOptionLabel:ne});case Ml.RADIO:case Ml.RADIO_ICON_ONLY:return(0,$.jsx)(DF,{ref:_,...le,options:L,value:oe,onValueChange:se,onBlur:ce,orientation:ue,renderOptionLabel:B});case Ml.TOGGLE:case Ml.TOGGLE_ICON_ONLY:return(0,$.jsx)(MO,{ref:_,type:kO.SINGLE,value:oe,onValueChange:e=>{(e||m)&&se(e)},disabled:n||r,size:I,orientation:ue,className:i,children:L.map(e=>(0,$.jsx)(NO,{value:e.value,"aria-label":e.label,disabled:e.disabled,children:B(e)},e.value))});case Ml.CARD:case Ml.CARD_ICON_ONLY:return(0,$.jsx)(NF,{ref:_,"aria-disabled":n||r?!0:void 0,"aria-required":f,className:U(`grid gap-element`,i),style:{gridTemplateColumns:`repeat(${A}, minmax(0, 1fr))`},children:L.map(e=>{let t=oe===e.value,i=n===!0||r===!0||e.disabled===!0;return(0,$.jsx)(MF,{"data-option":e.value,"aria-disabled":i?!0:void 0,"aria-label":D?e.label:void 0,className:U(`p-card-sm text-sm font-medium`,D&&`flex items-center justify-center`,i&&`cursor-not-allowed opacity-[var(--opacity-disabled)]`),option:{onSelect:()=>{i||se(e.value)}},selected:t,...i?{tabIndex:-1}:{},children:B(e)},e.value)})});case Ml.COMBOBOX:return(0,$.jsx)(Ax,{ref:_,...le,options:L,value:oe,onChange:se,onBlur:ce,placeholder:d,disabled:n||r,autoFocus:p,size:F,emptyMessage:y(J.LOW_LEVEL_FORM_FIELD,`noResults`),searchPlaceholder:y(J.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`),renderOption:ne?e=>ne(e):void 0,renderSelectedValue:ne});default:return(0,$.jsx)(bF,{ref:_,...le,options:L,value:oe,onChange:se,onBlur:ce,placeholder:d,size:g})}}),lI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_ENUM,`FormFieldEnum`)(e);return(0,$.jsx)(r,{...t,ref:n})});lI.displayName=`FormFieldEnum`;var uI=`file-validation`,ome=/received (undefined|null)\b/i,sme=/expected .+, received (undefined|null)/i;function dI(e){return ome.test(e)||sme.test(e)}function fI(e,t,n,r){if(!(e.error?.type===`server`||e.error?.type===`server-unique`||e.isTouched||t||(n===pr.ON_CHANGE||n===pr.ON_TOUCHED)&&e.isDirty)||!e.error)return;if(dI(e.error.message||``))return r(`required`,`msg`);let i=e.error.type;if(i===`too_small`&&e.error.params?.origin===`string`&&e.error.params?.minimum===1)return r(`required`,`msg`);if(!i||i.trim()===``)return e.error.message?e.error.message:r(`custom`,`msg`);if(i===`file-validation`||i===`server-unique`)return e.error.message||r(`custom`,`msg`);let a=r(i,`msg`,{...e.error.params??{},...e.error.message?{message:e.error.message}:{}});return a===`errors_validation.${i}.msg`||a.includes(`..`)?e.error.message?e.error.message:r(`custom`,`msg`):a}function pI({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_CHIPS_INPUT,`ChipsInput`)(e);return(0,$.jsx)(n,{...t})}pI.displayName=`ChipsInput`;var mI=(0,Q.createContext)(!0);function hI(e){let{setValue:t}=rw(),n=ew({name:e}),r=RE(),i=(0,Q.useContext)(mI)?r:null;return{value:n,setValue:(0,Q.useCallback)(n=>{t(e,n,{shouldDirty:!0,shouldTouch:!0}),i?.triggerSave(e,n,zn.DEBOUNCE)},[t,e,i])}}function gI(e){if(e)return`translate3d(${Math.round(e.x)}px, ${Math.round(e.y)}px, 0)`}var cme={activationConstraint:{distance:8}},lme={coordinateGetter:gF};function _I({listeners:e,attributes:t,disabled:n,ariaLabel:r,renderIcon:i}){return(0,$.jsx)(`button`,{type:`button`,className:U(`shrink-0 cursor-grab touch-none rounded p-0.5 text-muted-foreground/60`,`hover:text-muted-foreground hover:bg-accent/50`,Jg(x_.OFFSET),`active:cursor-grabbing`,n&&`pointer-events-none opacity-0`),"aria-label":r,tabIndex:n?-1:0,...t,...e,children:i(H.GRIP_VERTICAL,{size:fa.SM})})}function ume({id:e,fieldName:t,fieldLabel:n,itemSchema:r,disabled:i,canRemove:a,isValidating:o,reorderable:s,showUpDownIcons:c,isFirst:l,isLast:u,dragHandleAriaLabel:d,moveUpAriaLabel:f,moveDownAriaLabel:p,removeAriaLabel:m,renderField:h,onRemove:g,onMoveUp:_,onMoveDown:v,index:y,renderIcon:b}){let{attributes:x,listeners:S,setNodeRef:C,transform:w,transition:T,isDragging:E}=mF({id:e,disabled:!s||i}),D={transform:gI(w),transition:T,opacity:E?.5:void 0,zIndex:E?10:void 0,position:`relative`};return(0,$.jsxs)(`div`,{ref:C,style:D,className:`flex items-end gap-element`,children:[s&&(0,$.jsx)(_I,{listeners:S,attributes:x,disabled:i,ariaLabel:d,renderIcon:b}),c&&(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-0.5 mb-element`,children:[(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.ICON,onClick:()=>_(y),disabled:i||o||l,className:`h-5 w-5`,"aria-label":f,children:b(H.CHEVRON_UP,{size:fa.XS})}),(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.ICON,onClick:()=>v(y),disabled:i||o||u,className:`h-5 w-5`,"aria-label":p,children:b(H.CHEVRON_DOWN,{size:fa.XS})})]}),(0,$.jsx)(`div`,{className:`flex-1`,children:h?h(t,r):(0,$.jsx)(nR,{name:t,schema:r,label:n,disabled:i})}),a&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.ICON,onClick:()=>g(y),disabled:i||o,className:`shrink-0 mb-element`,"aria-label":m,children:b(H.DELETE,{size:fa.SM})})]})}var vI=`w-12`,yI=`opacity-0 transition-opacity duration-[var(--motion-duration-fast)] group-hover/array-row:opacity-100 group-focus-within/array-row:opacity-100 focus-visible:opacity-100 pointer-coarse:opacity-100`;function bI({fieldName:e,itemSchema:t,primaryFieldName:n,disabled:r,only:i}){let a=ZT(),o=Ju(t),s=od(t);if(!o||s.length===0)return null;if(ee(t))return i===`boolean`?null:(0,$.jsx)(dT,{formChromeMode:io.COMPACT,sectionChromeMode:void 0,children:(0,$.jsx)(nR,{name:e,schema:t,labelPlacement:`hidden`,disabled:r,className:`min-w-0 flex-1`})});let c=s.filter(e=>sc(o[e])===bc.BOOLEAN),l=s.filter(e=>sc(o[e])!==bc.BOOLEAN),u=i===`boolean`?c:i===`body`?l:[...c,...l];return(0,$.jsx)(dT,{formChromeMode:io.COMPACT,sectionChromeMode:void 0,children:u.map(t=>{let i=`${e}.${t}`,s=a?.fieldLabels?.[sr.labelDictionaryPath(i)]??sr.unresolvedFieldLabel(t);return(0,$.jsx)(nR,{name:i,schema:o[t],label:s,labelPlacement:`hidden`,disabled:r,className:U(`w-auto`,t===n?`min-w-0 flex-1`:`shrink-0`)},t)})})}function dme({id:e,fieldName:t,fieldLabel:n,layout:r,primaryFieldName:i,itemSchema:a,disabled:o,canRemove:s,isValidating:c,reorderable:l,showUpDownIcons:u,isFirst:d,isLast:f,dragHandleAriaLabel:p,moveUpAriaLabel:m,moveDownAriaLabel:h,removeAriaLabel:g,renderField:_,onRemove:v,onMoveUp:y,onMoveDown:b,index:x,renderIcon:S}){let{attributes:C,listeners:w,setNodeRef:T,transform:E,transition:D,isDragging:O}=mF({id:e,disabled:!l||o}),k={transform:gI(E),transition:D,opacity:O?.5:void 0,zIndex:O?10:void 0,position:`relative`},A=ew({name:i?`${t}.${i}`:t}),j=typeof A==`string`&&A.trim()!==``?A.trim():typeof A==`number`?String(A):n;return r===jt.ROW?(0,$.jsxs)(`div`,{ref:T,style:k,className:`group/array-row relative flex items-center gap-element`,children:[l&&!u&&(0,$.jsx)(`div`,{className:U(`absolute -left-5 top-1/2 -translate-y-1/2`,yI),children:(0,$.jsx)(_I,{listeners:w,attributes:C,disabled:o,ariaLabel:p,renderIcon:S})}),u&&(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-0.5`,children:[(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.ICON,onClick:()=>y(x),disabled:o||c||d,className:`h-5 w-5`,"aria-label":m,children:S(H.CHEVRON_UP,{size:fa.XS})}),(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.ICON,onClick:()=>b(x),disabled:o||c||f,className:`h-5 w-5`,"aria-label":h,children:S(H.CHEVRON_DOWN,{size:fa.XS})})]}),!_&&(0,$.jsx)(`div`,{className:U(`flex shrink-0 items-center`,vI),children:(0,$.jsx)(bI,{fieldName:t,itemSchema:a,primaryFieldName:i,disabled:o,only:`boolean`})}),(0,$.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-element`,children:_?_(t,a):(0,$.jsx)(bI,{fieldName:t,itemSchema:a,primaryFieldName:i,disabled:o,only:`body`})}),s&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.ICON,onClick:()=>v(x),disabled:o||c,className:U(`shrink-0`,yI),"aria-label":g,children:S(H.DELETE,{size:fa.SM})})]}):(0,$.jsxs)(`div`,{ref:T,style:k,className:`relative mt-3 rounded-lg border border-border p-card`,children:[(0,$.jsxs)(`div`,{className:`absolute -top-3 start-card-sm z-10 flex max-w-[calc(100%-4.5rem)] items-center gap-1 overflow-hidden bg-background px-card-sm text-sm font-medium text-muted-foreground`,children:[l&&(0,$.jsx)(_I,{listeners:w,attributes:C,disabled:o,ariaLabel:p,renderIcon:S}),u&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.ICON,onClick:()=>y(x),disabled:o||c||d,className:`h-5 w-5`,"aria-label":m,children:S(H.CHEVRON_UP,{size:fa.XS})}),(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.ICON,onClick:()=>b(x),disabled:o||c||f,className:`h-5 w-5`,"aria-label":h,children:S(H.CHEVRON_DOWN,{size:fa.XS})})]}),(0,$.jsx)(`span`,{className:`truncate`,children:j})]}),s&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.ICON,onClick:()=>v(x),disabled:o||c,className:`absolute -top-3 end-3 z-10 h-6 w-6 bg-background`,"aria-label":g,children:S(H.CLOSE,{size:fa.SM})}),(0,$.jsx)(`div`,{className:`pt-item`,children:_?_(t,a):(0,$.jsx)(nR,{name:t,schema:a,label:n,hideLabel:!0,disabled:o})})]})}function fme({primaryField:e,itemSchema:t,onAdd:n,disabled:r,addLabel:i,placeholder:a,leadingGutterClassName:o}){let{renderIcon:s}=Rf(),{resolvedRegionalPreferences:c}=K(),l=c?.timezone,u=sc(e.schema)===bc.NUMBER,[d,f]=(0,Q.useState)(``),p=d.trim(),m=u?Number(p):p,h=!r&&p!==``&&e.schema.safeParse(m).success,g=(0,Q.useCallback)(()=>{if(r)return;let i=d.trim();if(i===``)return;let a=u?Number(i):i;e.schema.safeParse(a).success&&(n(e.name===null?a:{...sr.getDefaultValueForSchema(t,{timeZone:l}),[e.name]:a}),f(``))},[r,d,u,e,t,n,l]);return(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,"data-testid":`array-quick-add-row`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),g())},children:[o&&(0,$.jsx)(`span`,{"aria-hidden":`true`,className:U(`shrink-0`,o)}),(0,$.jsx)(iN,{type:u?`number`:`text`,value:d,onChange:e=>f(e.target.value),placeholder:a??i,disabled:r,wrapperClassName:`flex-1`,"aria-label":i}),(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,onClick:g,disabled:!h,"aria-label":i,children:s(H.PLUS,{size:fa.SM})})]})}function pme({name:e,schema:t,label:n,description:r,disabled:i,className:a,renderField:o,addLabel:s,itemLabel:c,reorderable:l=!0,sectionAppearance:u,chromeMode:d,hideLabel:f=!1,objectItemLayout:p,enumLabels:m,allowedValues:h}){let{control:g,getFieldState:_,getValues:v,formState:y,trigger:b}=rw(),x=UM(e),{renderIcon:S}=Rf(),{tComponent:C,tErrorValidation:w,isReady:T,resolvedRegionalPreferences:E}=K({component:J.LOW_LEVEL_FORM_MESSAGE,keys:[`errors_validation`]}),D=E?.timezone,{getRecipe:O}=e_(),k=O(wi.TYPOGRAPHY,Lu.DESCRIPTION),{formChromeMode:A,sectionChromeMode:j}=fT(),M=oc(),N=uo(t),P=N?.chromeMode??d??j??A??YL(M.autoRender?.autoFieldChrome),F=XL(M.autoRender?.autoLabelPlacement),I=ZL(M.autoRender?.autoFieldDensity),ee=M.autoRender?.autoErrorPlacement===`summary-at-surface-top`,L=RE(),R=(0,Q.useContext)(mI)?L:null,z=R?t=>R.triggerSave(e,t,zn.BLUR):void 0,B=s??C(J.LOW_LEVEL_FORM_MESSAGE,`arrayAddItem`),ne=c??C(J.LOW_LEVEL_FORM_MESSAGE,`arrayItemLabel`),re=C(J.LOW_LEVEL_FORM_MESSAGE,`arrayEmptyMessage`),ie=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(ie.current=!0,()=>{ie.current=!1}),[]);let[ae,oe]=(0,Q.useState)(!1),{fields:se,append:ce,remove:le,move:ue}=Kw({control:g,name:e}),de=te(t),fe=ld(t),pe=de?sc(de):`unknown`,me=h!==void 0&&pe===bc.STRING,he=pe===bc.ENUM||me,ge=Qi(t)?.edit,_e=p??Qi(t)?.objectItemLayout??jt.CARD,ve=ge?.isSortable,ye=ve==null||!!ve&&ge?.dnd!==!1,be=ve?ge?.upDownIcons??!1:!1,xe=l&&ye&&!i&&se.length>1,Se=iP(rP(IP,cme),rP(MP,lme)),Ce=(0,Q.useMemo)(()=>se.map(e=>e.id),[se]),we=fe.maxLength===void 0||se.length<fe.maxLength,Te=fe.minLength===void 0||se.length>fe.minLength,Ee=(0,Q.useCallback)(()=>{oe(!0),setTimeout(async()=>{if(ie.current&&(await b(e),ie.current&&(oe(!1),R))){let t=v(e);R.triggerSave(e,t,zn.DEBOUNCE)}},0)},[b,e,R,v]),De=(0,Q.useCallback)(()=>{if(!we||i||ae)return;let e=sr.getDefaultValueForSchema(de,{timeZone:D});ce(e),Ee()},[we,i,ae,de,ce,Ee,D]),Oe=(0,Q.useCallback)(e=>{!we||i||ae||(ce(e),Ee())},[we,i,ae,ce,Ee]),ke=(0,Q.useCallback)(e=>{!Te||i||ae||(le(e),Ee())},[Te,i,ae,le,Ee]),Ae=(0,Q.useCallback)(e=>{e>0&&!i&&!ae&&(ue(e,e-1),Ee())},[ue,i,ae,Ee]),je=(0,Q.useCallback)(e=>{e<se.length-1&&!i&&!ae&&(ue(e,e+1),Ee())},[se.length,ue,i,ae,Ee]),Me=(0,Q.useCallback)(e=>{let{active:t,over:n}=e;if(n&&t.id!==n.id){let e=se.findIndex(e=>e.id===t.id),r=se.findIndex(e=>e.id===n.id);e!==-1&&r!==-1&&(ue(e,r),Ee())}},[se,ue,Ee]);if(!de||!T)return null;if(he){let o=N?.validationMode??pr.ON_BLUR,s=!me&&h!==void 0?qc(de).filter(e=>h.includes(e)):void 0,c=me?h.map(e=>({value:e,label:m?.[e]??e})):s?s.map(e=>({value:e,label:m?.[e]??e})):m?qc(de).map(e=>({value:e,label:m[e]??e})):void 0;return(0,$.jsx)(tw,{name:e,control:g,shouldUnregister:!0,render:({field:s,fieldState:l})=>(0,$.jsx)(ZM,{mode:P,label:n,description:r,error:fI(l,y.isSubmitted,o,w),labelPlacement:F,hideError:ee,saveState:R?.getFieldState(e),saveErrorMessage:R?.getFieldStateInfo(e).lastError,onRetrySave:R?()=>R.retryFieldSave(e):void 0,onSaveFieldNow:z,fieldName:e,disabled:i,className:a,children:(0,$.jsx)(lI,{multiple:!0,schema:t,options:c,name:e,disabled:i,value:Array.isArray(s.value)?s.value:[],onChange:t=>{x.noteInputReceived(),s.onChange(t),R?.triggerSave(e,t,zn.DEBOUNCE)},onBlur:()=>{x.handleFieldBlur(s.onBlur)},controlSize:I})})})}if(pe===bc.STRING&&Qi(t)?.display?.listStyle===da.CHIPS){let t=N?.validationMode??pr.ON_BLUR,o=e=>{let n=de.safeParse(e);if(n.success)return;let r=n.error.issues[0];return fI({isTouched:!0,error:{type:r?.code??`custom`,message:r?.message,params:r?kT(r):void 0}},!0,t,w)};return(0,$.jsx)(tw,{name:e,control:g,shouldUnregister:!0,render:({field:s,fieldState:c})=>(0,$.jsx)(ZM,{mode:P,label:n,description:r,error:fI(c,y.isSubmitted,t,w),labelPlacement:F,hideError:ee,saveState:R?.getFieldState(e),saveErrorMessage:R?.getFieldStateInfo(e).lastError,onRetrySave:R?()=>R.retryFieldSave(e):void 0,onSaveFieldNow:z,fieldName:e,disabled:i,className:a,children:(0,$.jsx)(pI,{id:`field-${e}`,value:Array.isArray(s.value)?s.value.filter(e=>typeof e==`string`):[],onChange:t=>{x.noteInputReceived(),s.onChange(t),R?.triggerSave(e,t,zn.DEBOUNCE)},onBlur:()=>{x.handleFieldBlur(s.onBlur)},validateItem:o,maxItems:fe.maxLength,disabled:i,invalid:!!c.error,controlSize:I})})})}let Ne=R?.getFieldStateInfo(e),Pe=R&&Ne&&Ne.state!==hT.IDLE?(0,$.jsx)(qM,{state:Ne.state,errorMessage:Ne.lastError,onRetry:()=>R.retryFieldSave(e),position:`inline`,size:`sm`,className:`ms-element align-middle`}):null,Fe=_(e,y),Ie=Fe.error?.root?.message||Fe.error?.message,Le=!(!Ie||ee),Re=sr.resolveArrayAddMode(t,de),ze=sr.getArrayItemPrimaryField(de),Be=Re===ete.QUICK_ADD?ze:null,Ve=pe!==`object`&&pe!==`array`,He=(0,$.jsxs)($.Fragment,{children:[Le&&(0,$.jsx)(`p`,{id:`${e}-error`,className:`text-sm text-destructive mt-item-xs`,role:`alert`,children:Ie}),(0,$.jsxs)(VT,{className:U(_e===jt.ROW?void 0:`space-y-field`),style:_e===jt.ROW?{rowGap:`var(--spacing-element)`}:void 0,children:[(0,$.jsx)(rF,{sensors:Se,collisionDetection:dP,onDragEnd:Me,children:(0,$.jsx)(fF,{items:Ce,strategy:lF,children:se.map((t,n)=>{let r=`${e}.${n}`,a=`${ne} ${n+1}`,s=C(J.LOW_LEVEL_FORM_MESSAGE,`arrayDragHandle`,{label:a}),c=C(J.LOW_LEVEL_FORM_MESSAGE,`arrayMoveUp`,{label:a}),l=C(J.LOW_LEVEL_FORM_MESSAGE,`arrayMoveDown`,{label:a}),u=C(J.LOW_LEVEL_FORM_MESSAGE,`arrayRemoveItem`,{label:a});return Ve?(0,$.jsx)(ume,{id:t.id,fieldName:r,fieldLabel:a,itemSchema:de,disabled:i,canRemove:Te,isValidating:ae,reorderable:xe,showUpDownIcons:be,isFirst:n===0,isLast:n===se.length-1,dragHandleAriaLabel:s,moveUpAriaLabel:c,moveDownAriaLabel:l,removeAriaLabel:u,renderField:o,onRemove:ke,onMoveUp:Ae,onMoveDown:je,index:n,renderIcon:S},t.id):(0,$.jsx)(dme,{id:t.id,fieldName:r,fieldLabel:a,layout:_e,primaryFieldName:ze.name,itemSchema:de,disabled:i,canRemove:Te,isValidating:ae,reorderable:xe,showUpDownIcons:be,isFirst:n===0,isLast:n===se.length-1,dragHandleAriaLabel:s,moveUpAriaLabel:c,moveDownAriaLabel:l,removeAriaLabel:u,renderField:o,onRemove:ke,onMoveUp:Ae,onMoveDown:je,index:n,renderIcon:S},t.id)})})}),we&&Be?(0,$.jsx)(fme,{primaryField:Be,itemSchema:de,onAdd:Oe,disabled:i||ae,addLabel:B,leadingGutterClassName:_e===jt.ROW&&!Ve?o?`w-7`:vI:void 0}):we?(0,$.jsxs)(X,{type:`button`,variant:Y.OUTLINE,onClick:De,disabled:i||ae,className:`w-full`,children:[S(H.PLUS,{size:fa.SM,className:`me-element`}),B]}):null,se.length===0&&(i||!we)&&(0,$.jsx)(`p`,{className:U(k.base,`text-center py-card`),children:re})]})]});if(P===io.SETTINGS_ROW&&u===void 0)return(0,$.jsx)(ZM,{mode:io.SETTINGS_ROW,label:n,description:r,labelPlacement:F,onSaveFieldNow:z,fieldName:e,disabled:i,className:a,error:Ie,hideError:!0,hideLabel:f,wideControl:!0,children:(0,$.jsxs)(`div`,{id:`field-${e}`,role:`group`,"aria-labelledby":n&&!f?`field-${e}-label`:void 0,"aria-label":n&&f?n:void 0,className:`flex flex-col`,style:{rowGap:`var(--spacing-element)`},"data-testid":`field-array-${e}`,"aria-describedby":Le?`${e}-error`:void 0,children:[Pe,He]})});let Ue=!f&&(u===Mr.CARD||u===Mr.COLLAPSIBLE),We=u!==Mr.COLLAPSIBLE;return(0,$.jsxs)(BT,{appearance:u??Mr.GHOST,legend:Ue?(0,$.jsxs)($.Fragment,{children:[n,We&&Pe]}):void 0,description:Ue?r:void 0,disabled:i,className:U(a,Ie&&`border-destructive`),"data-field":e,"data-testid":`field-array-${e}`,"aria-invalid":!!Ie,"aria-describedby":Le?`${e}-error`:void 0,children:[Ue?!We&&Pe:f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(PD,{children:(0,$.jsx)(HT,{className:`sr-only`,children:n})}),Pe]}):(0,$.jsx)(PD,{children:(0,$.jsxs)(HT,{children:[n,Pe]})}),!Ue&&r&&!f&&(0,$.jsx)(Ox,{children:r}),(0,$.jsx)(HE,{fieldName:e,label:n,disabled:i,onSaveFieldNow:z,children:He})]})}function xI(e){let t=RE(),n=t!==null&&BE(uo(e.schema)?.autosave,t.config.defaultTrigger,!0)!==zn.NONE;return(0,$.jsx)(mI.Provider,{value:n,children:(0,$.jsx)(pme,{...e})})}xI.displayName=`AutomatedArrayField`;var SI=xI,CI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.RESOURCES_FIELDS_RESOURCE_REFERENCE,`ResourceFieldEdit_ResourceReference`,os.EDIT)(e);return(0,$.jsx)(r,{...t,ref:n})});CI.displayName=`ResourceFieldEdit_ResourceReference`;function mme(e,t){let n=e?.resourceReferenceTargets;if(n)return n[t]??[]}function hme(e,t){if(t)return e?.resourceType===t?e:{resourceType:t}}function gme(e,t){return e?.resourceType?t?{resourceType:e.resourceType,resourceId:t}:{resourceType:e.resourceType}:e}function _me(e,t,n){let r=e.map(e=>({value:e,label:n(e)}));return t&&!e.includes(t)&&r.unshift({value:t,label:n(t)}),r}var vme=[Ji.RESOURCES];function wI(e,t){return Ju(Nr(e))?.[t]??e}var TI=Q.forwardRef(({types:e,value:t,onChange:n,schema:r,name:i,...a},o)=>{let{tComponent:s,tResourceHeader:c}=K({component:J.RESOURCES_FIELDS_RESOURCE_REFERENCE,keys:vme}),l=Q.useMemo(()=>_me(e,t?.resourceType,e=>c(e,`title`)),[e,t?.resourceType,c]);return(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-element`,children:[(0,$.jsx)(bF,{ref:o,...a,schema:wI(r,`resourceType`),name:`${i}.resourceType`,options:l,value:t?.resourceType||void 0,onChange:e=>n?.(hme(t,e)),placeholder:s(J.RESOURCES_FIELDS_RESOURCE_REFERENCE,l.length>0?`selectTypePlaceholder`:`noTypesAvailable`)}),t?.resourceType?(0,$.jsx)(CI,{...a,schema:wI(r,`resourceId`),name:`${i}.resourceId`,targetResourceType:t.resourceType,value:t.resourceId,onChange:e=>n?.(gme(t,Array.isArray(e)?e[0]:e))}):null]})});TI.displayName=`FormFieldResourceReference`;var EI=zs(J.LOW_LEVEL_SWITCH,`Switch`,[`Root`]),DI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=EI(e);return(0,$.jsx)(r,{...t,ref:n})});DI.displayName=`Switch`;var OI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=EI(e);return(0,$.jsx)(r.Root,{...t,ref:n})});OI.displayName=`SwitchRoot`;var kI=zs(J.LOW_LEVEL_CHECKBOX,`Checkbox`,[`Root`]),AI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=kI(e);return(0,$.jsx)(r,{...t,ref:n})});AI.displayName=`Checkbox`;var jI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=kI(e);return(0,$.jsx)(r.Root,{...t,ref:n})});jI.displayName=`CheckboxRoot`;var MI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_TOGGLE_GROUP_BOOLEAN,`ToggleGroupBoolean`)(e);return(0,$.jsx)(r,{...t,ref:n})});MI.displayName=`ToggleGroupBoolean`;var NI=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,checked:a,onCheckedChange:o,onBlur:s,defaultChecked:c,validationMode:l,autoFocus:u,controlSize:d},f)=>{let{tComponent:p,isReady:m}=K({component:J.LOW_LEVEL_FORM_FIELD_BOOLEAN}),h=Ot(e),g=ed(e),_=h?.labellingValue??`yes/no`,[v,y]=Q.useState(c??!1),b=V_(a,o),x=a??v,S=Q.useCallback(e=>{r||(b?o?.(e):y(e))},[b,o,r]),C=Q.useCallback(()=>{s?.()},[s]),w={schema:e,name:t,disabled:n,className:i,validationMode:l,autoFocus:u,controlSize:d},T=typeof _==`object`&&!!_&&_.mode===`custom`,[E,D]=T?[void 0,void 0]:_.split(`/`),O=()=>T?_.trueValue:p(J.LOW_LEVEL_FORM_FIELD_BOOLEAN,E),k=()=>T?_.falseValue:p(J.LOW_LEVEL_FORM_FIELD_BOOLEAN,D);if(!m)return null;switch(g){case Da.TOGGLE:return(0,$.jsx)(MI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C});case Da.SWITCH:return(0,$.jsx)(DI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C});case Da.CHECKBOX:return(0,$.jsx)(AI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C});case Da.RADIO:let e=[{value:`true`,label:O()},{value:`false`,label:k()}];return(0,$.jsx)(DF,{ref:f,...w,options:e,value:x?`true`:`false`,onValueChange:e=>S(e===`true`),onBlur:C});default:return(0,$.jsx)(DI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C})}}),PI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_BOOLEAN,`FormFieldBoolean`)(e);return(0,$.jsx)(r,{...t,ref:n})});PI.displayName=`FormFieldBoolean`;var FI=zs(J.LOW_LEVEL_TEXTAREA,`Textarea`,[`Root`]),II=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=FI(e);return(0,$.jsx)(r,{...t,ref:n})});II.displayName=`Textarea`;var LI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=FI(e);return(0,$.jsx)(r.Root,{...t,ref:n})});LI.displayName=`TextareaRoot`;function RI({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_MARKDOWN_EDITOR,`MarkdownEditor`)(e);return(0,$.jsx)(n,{...t})}RI.displayName=`MarkdownEditor`;var zI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_COLOR_INPUT,`ColorInput`)(e);return(0,$.jsx)(r,{...t,ref:n})});zI.displayName=`ColorInput`;var BI=(0,Q.forwardRef)(({name:e,value:t,onChange:n,onBlur:r,disabled:i,readOnly:a,className:o,autoFocus:s,controlSize:c=rf.MD,clearable:l,labelledBy:u,controlId:d,monthPlaceholder:f},p)=>{let{tComponent:m,resolvedRegionalPreferences:h}=K({component:J.LOW_LEVEL_FORM_FIELD_STRING}),g=on(t),[_,v]=Q.useState(g?.month),[y,b]=Q.useState(String(g?g.year:new Date().getUTCFullYear()));Q.useEffect(()=>{let e=on(t);e?(v(e.month),b(String(e.year))):(t===void 0||t===``)&&(v(void 0),b(String(new Date().getUTCFullYear())))},[t]);let x=Q.useRef(null),S=Q.useCallback(e=>{x.current=e,typeof p==`function`?p(e):p&&(p.current=e)},[p]),C=Q.useMemo(()=>yi.monthNames(h),[h]),w=(e,r)=>{if(e===void 0||!/^\d{4}$/.test(r))return;let i=Vr(Number(r),e);i!==t&&n?.(i)},T=()=>{let e=on(t);e&&!/^\d{4}$/.test(y)&&b(String(e.year)),r?.()},E=i||a,D=l===!0&&on(t)!==void 0;return(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element`,o),role:`group`,"aria-labelledby":u??`field-${e}-label`,children:[(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsxs)(xF,{value:_===void 0?``:String(_),onValueChange:e=>{let t=Number(e);v(t),w(t,y)},onOpenChange:e=>{e||r?.()},disabled:E,name:`${e}.month`,children:[(0,$.jsx)(SF,{ref:S,id:d??`field-${e}`,size:c,className:`w-full`,"aria-label":m(J.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthMonth`),autoFocus:s,children:(0,$.jsx)(wF,{placeholder:f??m(J.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthMonthPlaceholder`)})}),(0,$.jsx)(CF,{children:C.map((e,t)=>(0,$.jsx)(TF,{value:String(t+1),textValue:e,children:e},t+1))})]})}),(0,$.jsx)(`div`,{className:`w-28 shrink-0`,children:(0,$.jsx)(iN,{type:`number`,inputMode:`numeric`,min:1,max:9999,step:1,name:`${e}.year`,controlSize:c,"aria-label":m(J.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthYear`),value:y,disabled:i,readOnly:a,onChange:e=>{let t=e.target.value;b(t),w(_,t)},onBlur:T})}),D&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:c===rf.SM?Xd.SM:Xd.MD,disabled:E,onClick:()=>{n?.(``),x.current?.focus()},children:m(J.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthClear`)})]})});BI.displayName=`YearMonthInput`;var VI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_PASSWORD_INPUT,`PasswordInput`)(e);return(0,$.jsx)(r,{...t,ref:n})});VI.displayName=`PasswordInput`;var HI=zs(J.LOW_LEVEL_INPUT_OTP,`InputOTP`,[`Group`,`Slot`,`Separator`]),UI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=HI(e);return(0,$.jsx)(r,{...t,ref:n})});UI.displayName=`InputOTP`;function WI({preset:e=q.DEFAULT,...t}){let n=HI(e);return(0,$.jsx)(n.Group,{...t})}function GI({preset:e=q.DEFAULT,...t}){let n=HI(e);return(0,$.jsx)(n.Slot,{...t})}function yme({preset:e=q.DEFAULT,...t}){let n=HI(e);return(0,$.jsx)(n.Separator,{...t})}function bme(e,t){let n=e?.organizationRoles;if(!n||n.length===0)return;let r=e?.organizationTypes;return!t||!r?n:n.filter(e=>Hne(r,t,e))}function xme(e,t,n){let r=e.map(e=>({value:e,label:n(e)}));return t&&!e.includes(t)&&r.unshift({value:t,label:n(t)}),r}var Sme=[Ji.ROLES],KI=Q.forwardRef(({roles:e,value:t,onChange:n,clearable:r,...i},a)=>{let{tComponent:o,tRole:s}=K({component:J.LOW_LEVEL_FORM_FIELD_STRING,keys:Sme}),c=Q.useMemo(()=>xme(e,t,e=>s(e,`label`)),[e,t,s]),l=(0,$.jsx)(bF,{ref:a,...i,options:c,value:t||void 0,onChange:e=>n?.(e),placeholder:o(J.LOW_LEVEL_FORM_FIELD_STRING,`organizationRolePlaceholder`)});return!r||!t?l:(0,$.jsxs)(`span`,{className:`flex items-center gap-element`,children:[l,(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,disabled:i.disabled||i.readOnly,onClick:()=>n?.(``),children:o(J.LOW_LEVEL_FORM_FIELD_STRING,`organizationRoleClear`)})]})});KI.displayName=`FormFieldStringOrganizationRole`;function Cme(){let{appConfig:e}=_u(),{organizations:t,currentOrganizationId:n}=Cg(),r=t.find(e=>e._id===n)?.type;return bme(e,r)}function wme(e){if(e.roleTable===pe.ANOTHER_ORGANIZATION)return e.offeredRoles;if(e.table)return e.offeredRoles?e.table.filter(t=>e.offeredRoles.includes(t)):e.table}var qI=Q.forwardRef(({fallback:e,roleTable:t=pe.CURRENT_ORGANIZATION,offeredRoles:n,...r},i)=>{let a=wme({table:Cme(),roleTable:t,offeredRoles:n});return a?(0,$.jsx)(KI,{ref:i,roles:a,...r}):(0,$.jsx)($.Fragment,{children:e})});qI.displayName=`FormFieldStringOrganizationRoleOrFallback`;var JI=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,validationMode:l,placeholder:u,autoComplete:d,autoFocus:f,controlSize:p=rf.MD,type:m,clearable:h,offeredValues:g},_)=>{let v=m??`text`,y=_n(e);Tt(e);let b=et(e),x=y?.edit?.textareaRows??4,[S,C]=Q.useState(c??``),w=V_(a,o),T=a??S,E=Q.useCallback(e=>{w?o?.(e):C(e)},[w,o]),D=Q.useCallback(()=>{s?.()},[s]),O={schema:e,name:t,disabled:n,readOnly:r,className:i,validationMode:l,autoFocus:f,controlSize:p};switch(b){case Qs.INPUT:return(0,$.jsx)(rN,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d,type:v});case Qs.TEXTAREA:return(0,$.jsx)(II,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,rows:x,autoComplete:d});case Qs.MARKDOWN:return(0,$.jsx)(RI,{value:T,onChange:E,onBlur:D,placeholder:u,disabled:n,readOnly:r,autoFocus:f,minRows:x,ariaLabel:t,className:i});case Qs.COLOR:return(0,$.jsx)(zI,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u});case Qs.YEAR_MONTH:return(0,$.jsx)(BI,{ref:_,...O,value:T,onChange:E,onBlur:D,clearable:h});case Qs.PASSWORD:return(0,$.jsx)(VI,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d});case Qs.OTP:{let r=Ae(e)?.maxLength??6;return(0,$.jsx)(UI,{ref:_,name:t,className:i,maxLength:r,value:T,onChange:E,onBlur:D,disabled:n,autoComplete:d,autoFocus:f,controlSize:p,children:(0,$.jsx)(WI,{children:Array.from({length:r},(e,t)=>(0,$.jsx)(GI,{index:t},t))})})}case Qs.ORGANIZATION_ROLE:{let e=(0,$.jsx)(rN,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d,type:v});return(0,$.jsx)(qI,{ref:_,...O,value:T,onChange:E,onBlur:D,clearable:h,fallback:e,roleTable:y?.edit?.organizationRoleTable??pe.CURRENT_ORGANIZATION,...g?{offeredRoles:g}:{}})}default:return(0,$.jsx)(rN,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d,type:v})}}),YI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_STRING,`FormFieldString`)(e);return(0,$.jsx)(r,{...t,ref:n})});YI.displayName=`FormFieldString`;var XI=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,validationMode:l,placeholder:u,step:d,min:f,max:p,autoFocus:m,clearable:h,controlSize:g=rf.MD},_)=>{let{renderIcon:v}=Rf(),y=g===rf.SM?Xd.ICON_SM:Xd.ICON;gu(e);let b=Fi(e),x=Zte(e),S=f??x.min,C=p??x.max,w=d??x.step??1,[T,E]=Q.useState(c??0),D=V_(a,o),O=a??T,k=D&&a==null?``:O,A=Q.useCallback(e=>{D?o?.(e):E(e)},[D,o]),j=Q.useCallback(()=>{s?.()},[s]),M=()=>{let e=O+w;(C===void 0||e<=C)&&A(e)},N=()=>{let e=O-w;(S===void 0||e>=S)&&A(e)},P={schema:e,name:t,disabled:n,readOnly:r,className:i,validationMode:l,autoFocus:m,controlSize:g};switch(b){case Ci.INPUT:return(0,$.jsx)(rN,{ref:_,...P,type:`number`,value:k,onChange:A,onBlur:j,placeholder:u,step:w,min:S,max:C});case Ci.SLIDER:return(0,$.jsx)($M,{ref:_,...P,value:[O],onValueChange:e=>A(e[0]),onBlur:j,min:S??0,max:C??100,step:w,showValue:!0});case Ci.STEPPER:let e=t??`stepper-field`;return(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element`,i),children:[(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,size:y,onClick:N,disabled:n||S!==void 0&&O<=S,children:v(H.MINUS,{size:fa.SM})}),(0,$.jsx)(iN,{ref:_,id:e,type:`number`,value:k,onChange:e=>{let t=e.target.value;if(t===``)A(h?``:S??0);else{let e=parseFloat(t);isNaN(e)||A(e)}},onBlur:j,disabled:n,readOnly:r,min:S,max:C,step:w,className:`w-20 text-center`,autoFocus:m,controlSize:g}),(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,size:y,onClick:M,disabled:n||C!==void 0&&O>=C,children:v(H.PLUS,{size:fa.SM})})]});default:return(0,$.jsx)(rN,{ref:_,...P,type:`number`,value:k,onChange:A,onBlur:j,placeholder:u,step:w,min:S,max:C})}}),ZI=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_NUMBER,`FormFieldNumber`)(e);return(0,$.jsx)(r,{...t,ref:n})});ZI.displayName=`FormFieldNumber`;var QI=Q.forwardRef(({controlSize:e,className:t,wrapperClassName:n,children:r,disabled:i,...a},o)=>{let{getRecipe:s,fieldVariant:c}=e_(),{renderIcon:l}=Rf(),u=s(wi.FORM_CONTROL,Qg(c));return(0,$.jsxs)(`div`,{"data-slot":`native-select`,className:U(`relative flex`,n),children:[(0,$.jsx)(`select`,{ref:o,disabled:i,"data-size":e,className:U(`w-full cursor-pointer rounded-md bg-transparent text-sm disabled:cursor-default`,u.base,u.states.focus,u.states.disabled,e?u.sizes?.[e]:void 0,u.motion.transition,`appearance-none pe-8`,t),...a,children:r}),(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-y-0 end-0 flex items-center pe-3 text-muted-foreground`,children:l(H.CHEVRON_DOWN,{size:fa.SM,className:`opacity-[var(--opacity-muted)]`})})]})});QI.displayName=`ThemedNativeSelect`;function Tme(e,t,n){return se(e,t).map(e=>{let t=le[e],r=n(e);return{value:e,label:`${t.symbol} ${r}`}}).sort((e,t)=>{let n=le[e.value],r=le[t.value];return n.isMajor&&!r.isMajor?-1:!n.isMajor&&r.isMajor?1:e.label.localeCompare(t.label)})}var $I=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,validationMode:l,placeholder:u,required:d,autoFocus:f,clearable:p,controlSize:m=rf.MD},h)=>{let{tSystemEnum:g,tComponent:_,isReady:v}=K({component:J.LOW_LEVEL_FORM_FIELD_MONEY,keys:[`system_enums`]}),{getRecipe:y,fieldVariant:b}=e_(),x=y(wi.FORM_CONTROL,Qg(b)),S=Q.useCallback(e=>g(zc.AVAILABLE_CURRENCY,e),[g]),C=Lc(e),w=C?.currenciesAllowed,T=C?.appEnabledOnly??!0,E=C?.allowCurrencyChange??!0,D=Q.useMemo(()=>Tme(w,T,S),[w,T,S]),O=Q.useCallback(e=>nn(e)?.decimals??2,[]),k=Q.useCallback(()=>Kie(e),[e]),[A,j]=Q.useState(c??k()),M=V_(a,o),N=a??A,P=Q.useMemo(()=>N.amount===0n?``:Cr(N.amount,N.decimals).toFixed(N.decimals),[N.amount,N.decimals]),F=Q.useCallback(e=>{let t=e.target.value;if(!t||t===``){if(M&&p){o?.(void 0);return}let e={...N,amount:0n};M?o?.(e):j(e);return}let n=Hr(t,N.decimals);if(n===null)return;let r={...N,amount:n};M?o?.(r):j(r)},[N,M,o,p]),I=Q.useCallback(e=>{let t=O(e),n={amount:$s(N.amount,N.decimals,t),currency:e,decimals:t};M?o?.(n):j(n)},[N,M,o,O]),ee=Q.useCallback(()=>{s?.()},[s]),L=`field-${t}`,R=nn(N.currency)?.symbol??N.currency;return(0,$.jsxs)(`div`,{className:U(`flex gap-element`,i),children:[(0,$.jsx)(iN,{ref:h,id:L,type:`number`,step:10**-N.decimals,min:C?.minAmount===void 0?void 0:Cr(C.minAmount,N.decimals),max:C?.maxAmount===void 0?void 0:Cr(C.maxAmount,N.decimals),value:P,onChange:F,onBlur:ee,disabled:n,readOnly:r,placeholder:u??`0.00`,prefix:R,wrapperClassName:`flex-1`,className:`tabular-nums`,autoFocus:f,controlSize:m}),E?(0,$.jsx)(QI,{value:N.currency,onChange:e=>I(e.target.value),disabled:n||r,controlSize:m,wrapperClassName:`w-32`,"aria-label":_(J.LOW_LEVEL_FORM_FIELD_MONEY,`currency`),children:D.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))}):(0,$.jsx)(`div`,{"data-size":m,className:U(`flex items-center text-sm text-muted-foreground`,x.sizes?.[m]),children:S(N.currency)})]})}),eL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_MONEY,`FormFieldMoney`)(e);return(0,$.jsx)(r,{...t,ref:n})});eL.displayName=`FormFieldMoney`;var Eme=[Vs.SECONDS,Vs.MINUTES,Vs.HOURS,Vs.DAYS,Vs.WEEKS],tL=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,placeholder:l,required:u,autoFocus:d,clearable:f,controlSize:p=rf.MD},m)=>{let{tSystemEnum:h,tComponent:g,isReady:_}=K({component:J.LOW_LEVEL_FORM_FIELD_DURATION,keys:[`system_enums`]}),v=Fne(e),y=v?.allowedUnits&&v.allowedUnits.length>0?v.allowedUnits:Eme,b=v?.minValue,x=v?.maxValue,S=Q.useCallback(e=>h(zc.DURATION_UNIT,e),[h]),C=Q.useCallback(()=>gi(e),[e]),[w,T]=Q.useState(c??C()),E=V_(a,o),D=a??w,O=D.value===0?``:String(D.value),k=Q.useCallback(e=>{let t=e.target.value;if(t===``||t===void 0){if(E&&f){o?.(void 0);return}let e={...D,value:0};E?o?.(e):T(e);return}let n=parseInt(t,10);if(Number.isNaN(n)||n<0)return;let r={...D,value:n};E?o?.(r):T(r)},[D,E,o,f]),A=Q.useCallback(e=>{let t={...D,unit:e};E?o?.(t):T(t)},[D,E,o]),j=Q.useCallback(()=>{s?.()},[s]),M=`field-${t}`;return(0,$.jsxs)(`div`,{className:U(`flex gap-element`,i),children:[(0,$.jsx)(iN,{ref:m,id:M,type:`number`,step:1,min:b,max:x,value:O,onChange:k,onBlur:j,disabled:n,readOnly:r,placeholder:l??`0`,wrapperClassName:`flex-1`,className:`tabular-nums`,autoFocus:d,controlSize:p}),(0,$.jsx)(QI,{value:D.unit,onChange:e=>A(e.target.value),disabled:n||r,controlSize:p,wrapperClassName:`w-32`,"aria-label":g(J.LOW_LEVEL_FORM_FIELD_DURATION,`unit`),children:y.map(e=>(0,$.jsx)(`option`,{value:e,children:S(e)},e))})]})});tL.displayName=`FormFieldDuration_Preset_Default`;var nL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_DURATION,`FormFieldDuration`)(e);return(0,$.jsx)(r,{...t,ref:n})});nL.displayName=`FormFieldDuration`;var rL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_INPUT_GROUP,`InputGroup`)(e);return(0,$.jsx)(r,{...t,ref:n})});rL.displayName=`InputGroup`;function iL({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_INPUT_GROUP_ADDON,`InputGroupAddon`)(e);return(0,$.jsx)(n,{...t})}function aL({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_INPUT_GROUP_BUTTON,`InputGroupButton`)(e);return(0,$.jsx)(n,{...t})}function Dme({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_INPUT_GROUP_TEXT,`InputGroupText`)(e);return(0,$.jsx)(n,{...t})}function oL({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_INPUT_GROUP_INPUT,`InputGroupInput`)(e);return(0,$.jsx)(n,{...t})}function sL({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_INPUT_GROUP_TEXTAREA,`InputGroupTextarea`)(e);return(0,$.jsx)(n,{...t})}var Ome=`US`;function kme(e){if(!/^[A-Za-z]{2}$/.test(e))return``;let t=e.toUpperCase().split(``).map(e=>127462+(e.charCodeAt(0)-65));return String.fromCodePoint(...t)}function Ame(e){let t;try{t=new Intl.DisplayNames([e],{type:`region`})}catch{t=void 0}let n=new Intl.Collator(e);return uc().map(e=>({code:e,name:t?.of(e)??e,dialCode:Zs(e)})).sort((e,t)=>n.compare(e.name,t.name))}function jme(e,t){let n=0;for(let r=0;r<t&&r<e.length;r++)e[r]>=`0`&&e[r]<=`9`&&n++;return n}function Mme(e,t){if(t<=0)return 0;let n=0;for(let r=0;r<e.length;r++)if(e[r]>=`0`&&e[r]<=`9`&&(n++,n>=t))return r+1;return e.length}var cL=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,placeholder:l,autoFocus:u,autoComplete:d,controlSize:f=rf.MD},p)=>{let{tComponent:m,currentLanguage:h}=K({component:[J.LOW_LEVEL_FORM_FIELD_PHONE]}),g=Pu(e)?.defaultCountry??Ome,_=Q.useMemo(()=>Ame(h),[h]),[v,y]=Q.useState(g),[b,S]=Q.useState(``),C=Q.useRef(null),w=Q.useRef(null),T=Q.useRef(null),E=Q.useRef(``),D=Q.useCallback(e=>{T.current=e,typeof p==`function`?p(e):p&&(p.current=e)},[p]),O=a??c??``;Q.useEffect(()=>{if(O===C.current)return;if(C.current=O,w.current=null,!O.trim()){S(``),E.current=``;return}let e=fr(O,g),t=e?e.formatNational():O;e?.country&&y(e.country),S(t),E.current=t},[O,g]),Q.useLayoutEffect(()=>{let e=w.current;w.current=null;let t=T.current;if(e===null||!t||document.activeElement!==t)return;let n=Mme(t.value,e);t.setSelectionRange(n,n)},[b]);let k=Q.useCallback((e,t)=>{let n=t.replace(/\D/g,``);if(!n)return``;let r=fr(n,e);return r?r.format(`E.164`):`+${Zs(e)}${n}`},[]),A=Q.useCallback((e,t)=>{let n=k(e,t);C.current=n,o?.(n)},[o,k]),j=Q.useCallback(e=>{let t=e.target.value;y(t);let n=E.current.replace(/\D/g,``),r=n?Pe(n,t):``;S(r),E.current=r,n&&A(t,r)},[A]),M=Q.useCallback(e=>{let t=e.target.value,n=e.target.selectionStart??t.length;if(t.trim().startsWith(`+`)){let e=Qe(t);if(e){let n=Zs(e),r=t.replace(/\D/g,``),i=r.startsWith(n)?r.slice(n.length):r,a=k(e,i),s=fr(a),c=s?s.formatNational():Pe(i,e);y(e),S(c),E.current=c,w.current=null,C.current=a,o?.(a);return}S(t),E.current=t;let n=`+${t.replace(/\D/g,``)}`;C.current=n,o?.(n);return}let r=E.current,i=t.length===r.length-1,a=i?t:Pe(t,v);w.current=i?null:jme(t,n),S(a),E.current=a,A(v,a)},[v,A,o,k]),N=Q.useCallback(()=>{s?.()},[s]),P=Q.useMemo(()=>l||x(v)||``,[l,v]),F=Zs(v),I=`field-${t}`,ee=m(J.LOW_LEVEL_FORM_FIELD_PHONE,`country`);return(0,$.jsxs)(rL,{className:U(`w-full`,i),"data-disabled":n||void 0,"data-size":f,children:[(0,$.jsxs)(`div`,{className:`relative flex shrink-0 items-stretch self-stretch border-e border-border`,children:[(0,$.jsxs)(`span`,{"aria-hidden":`true`,className:U(`pointer-events-none flex select-none items-center gap-1.5 ps-3 pe-2 text-sm text-muted-foreground`,n&&`opacity-[var(--opacity-disabled)]`),children:[(0,$.jsx)(`span`,{className:`text-base leading-none`,children:kme(v)}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[`+`,F]}),(0,$.jsx)(`svg`,{viewBox:`0 0 12 12`,className:`size-3 opacity-60`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,$.jsx)(`path`,{d:`M3 4.5 6 7.5 9 4.5`})})]}),(0,$.jsx)(`select`,{value:v,onChange:j,disabled:n||r,"aria-label":ee,"data-slot":`input-group-control`,className:`absolute inset-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-default`,children:_.map(e=>(0,$.jsxs)(`option`,{value:e.code,children:[e.name,` (+`,e.dialCode,`)`]},e.code))})]}),(0,$.jsx)(oL,{ref:D,id:I,name:t,type:`tel`,inputMode:`tel`,value:b,onChange:M,onBlur:N,disabled:n,readOnly:r,placeholder:P,autoFocus:u,autoComplete:d??`tel`,className:`ps-2`})]})});cL.displayName=`FormFieldPhone_Preset_Default`;var lL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_PHONE,`FormFieldPhone`)(e);return(0,$.jsx)(r,{...t,ref:n})});lL.displayName=`FormFieldPhone`;var uL=[{part:vu.LINE1,autoComplete:`address-line1`},{part:vu.LINE2,autoComplete:`address-line2`},{part:vu.CITY,autoComplete:`address-level2`},{part:vu.STATE,autoComplete:`address-level1`},{part:vu.POSTAL_CODE,autoComplete:`postal-code`}];function dL(e,t){return{[vu.LINE1]:e?.line1??``,[vu.LINE2]:e?.line2??``,[vu.CITY]:e?.city??``,[vu.STATE]:e?.state??``,[vu.POSTAL_CODE]:e?.postalCode??``,[vu.COUNTRY]:e?.country??t??``,[fe.LATITUDE]:e?.coordinates?String(e.coordinates.latitude):``,[fe.LONGITUDE]:e?.coordinates?String(e.coordinates.longitude):``}}function fL(e){return e.trim()===``?NaN:Number(e)}function Nme(e){let t=uL.some(({part:t})=>e[t].trim()!==``),n=e.latitude.trim()!==``||e.longitude.trim()!==``;return!t&&!n?null:{line1:e.line1,...e.line2!==``&&{line2:e.line2},city:e.city,...e.state!==``&&{state:e.state},...e.postalCode!==``&&{postalCode:e.postalCode},country:e.country,...n&&{coordinates:{latitude:fL(e.latitude),longitude:fL(e.longitude)}}}}function Pme(e,t){let n;try{n=new Intl.DisplayNames([e],{type:`region`})}catch{n=void 0}let r=new Intl.Collator(e);return(t&&t.length>0?[...t]:uc()).map(e=>({code:e,name:n?.of(e)??e})).sort((e,t)=>r.compare(e.name,t.name))}var pL=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,autoFocus:l,clearable:u,partErrors:d,renderLookup:f,controlSize:p=rf.MD},m)=>{let{tComponent:h,currentLanguage:g}=K({component:[J.LOW_LEVEL_FORM_FIELD_ADDRESS]}),_=Ree(e),v=_?.defaultCountry,y=_?.withCoordinates===!0,b=a??c,[x,S]=Q.useState(()=>dL(b,v)),C=Q.useRef(x),w=Q.useRef(JSON.stringify(b??null)),T=JSON.stringify(b??null);Q.useEffect(()=>{if(T===w.current)return;w.current=T;let e=dL(b,v);C.current=e,S(e)},[T,v]);let E=Q.useMemo(()=>Pme(g,_?.countriesAllowed),[g,_?.countriesAllowed]),D=Q.useCallback(e=>{C.current=e,S(e);let t=Nme(e)??(u?void 0:{line1:``,city:``,country:e.country});w.current=JSON.stringify(t??null),o?.(t)},[u,o]),O=Q.useCallback((e,t)=>D({...C.current,[e]:t}),[D]),k=n===!0||r===!0,A=Q.useCallback(e=>{if(k)return;let{coordinates:t,...n}=e;D(dL(n,v))},[D,v,k]),j=Q.useCallback(e=>{e.currentTarget.contains(e.relatedTarget)||s?.()},[s]),M=`field-${t}`,N=e=>e===vu.LINE1?M:`${M}-${e.replace(`.`,`-`)}`,P=(e,t,n)=>{let r=N(e),i=d?.[e],a=`${r}-error`;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(Tx,{htmlFor:r,className:`text-sm text-muted-foreground`,children:t}),n({id:r,...i&&{"aria-invalid":!0,"aria-describedby":a}}),i&&(0,$.jsx)(kx,{id:a,children:i})]},e)},F=({part:e,autoComplete:i})=>P(e,h(J.LOW_LEVEL_FORM_FIELD_ADDRESS,e),a=>(0,$.jsx)(iN,{...a,ref:e===vu.LINE1?m:void 0,name:`${t}.${e}`,type:`text`,value:x[e],onChange:t=>O(e,t.target.value),disabled:n,readOnly:r,autoComplete:i,autoFocus:e===vu.LINE1?l:void 0,controlSize:p})),I=e=>P(`coordinates.${e}`,h(J.LOW_LEVEL_FORM_FIELD_ADDRESS,e),i=>(0,$.jsx)(iN,{...i,name:`${t}.coordinates.${e}`,type:`number`,step:`any`,inputMode:`decimal`,value:x[e],onChange:t=>O(e,t.target.value),disabled:n,readOnly:r,className:`tabular-nums`,controlSize:p})),[ee,L,R,te,z]=uL,B=E.some(e=>e.code===x.country);return(0,$.jsxs)(`div`,{className:U(`flex w-full flex-col gap-element`,i),role:`group`,"aria-labelledby":`${M}-label`,onBlur:j,children:[f?.({..._?.countriesAllowed&&_.countriesAllowed.length>0&&{countriesAllowed:_.countriesAllowed},...v!==void 0&&{defaultCountry:v},disabled:k,applyAddress:A}),F(ee),F(L),(0,$.jsxs)(`div`,{className:`grid gap-element sm:grid-cols-2`,children:[F(R),F(z)]}),F(te),P(vu.COUNTRY,h(J.LOW_LEVEL_FORM_FIELD_ADDRESS,vu.COUNTRY),e=>(0,$.jsxs)(QI,{...e,name:`${t}.${vu.COUNTRY}`,value:x.country,onChange:e=>O(vu.COUNTRY,e.target.value),disabled:n||r,autoComplete:`country`,controlSize:p,wrapperClassName:`w-full`,children:[x.country===``&&(0,$.jsx)(`option`,{value:``,disabled:!0,children:h(J.LOW_LEVEL_FORM_FIELD_ADDRESS,`countryPlaceholder`)}),x.country!==``&&!B&&(0,$.jsx)(`option`,{value:x.country,children:x.country}),E.map(e=>(0,$.jsx)(`option`,{value:e.code,children:e.name},e.code))]})),y&&(0,$.jsxs)(`div`,{className:`grid gap-element sm:grid-cols-2`,children:[I(fe.LATITUDE),I(fe.LONGITUDE)]})]})});pL.displayName=`FormFieldAddress_Preset_Default`;var mL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_ADDRESS,`FormFieldAddress`)(e);return(0,$.jsx)(r,{...t,ref:n})});mL.displayName=`FormFieldAddress`;var hL;(function(e){e.MAIN_SCHEMA=`main-schema`,e.PATCH_REQUEST_DTO=`patch-request-dto`,e.VALUE_OBJECT=`value-object`})(hL||={});var Fme={[hL.MAIN_SCHEMA]:{isClearable:Rne,normalizeClearedValue:sl},[hL.PATCH_REQUEST_DTO]:{isClearable:Cie,normalizeClearedValue:kc},[hL.VALUE_OBJECT]:{isClearable:cre,normalizeClearedValue:Cs}};function Ime({schemaKind:e,rootSchema:t,fieldName:n}){if(e===mT.MAIN_SCHEMA)return hL.MAIN_SCHEMA;if(!t)return hL.PATCH_REQUEST_DTO;let r=n.replace(/\[(\d+)\]/g,`.$1`).split(`.`).filter(Boolean).slice(0,-1).join(`.`),i=r?sr.resolveFieldSchemaPath(t,r):t;return i?cs(i)?hL.PATCH_REQUEST_DTO:hL.VALUE_OBJECT:hL.PATCH_REQUEST_DTO}var gL=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,validationMode:l,placeholder:u,step:d,min:f,max:p,required:m,autoFocus:h,controlSize:g=rf.MD},_)=>{let{formatNumber:v,isReady:y}=K({component:J.LOW_LEVEL_FORM_FIELD_BIGDECIMAL}),{renderIcon:b}=Rf(),x=g===rf.SM?Xd.ICON_SM:Xd.ICON,S=la(e),C=gu(e),w=S?.edit?.editMode??C?.edit?.editMode??Ci.INPUT,T=Ht(e),E=f??T.min,D=p??T.max,O=T.precision,k=d??(O===void 0?`1`:new er(1).div(new er(10).pow(O)).toString()),A=la(e)?.edit?.defaultValue,[j,M]=Q.useState(c??A??`0`),N=V_(a,o),P=a??j,F=Q.useMemo(()=>{try{return parseFloat(P)}catch{return 0}},[P]),I=Q.useCallback(e=>{N?o?.(e):M(e)},[N,o]),ee=Q.useCallback(()=>{s?.()},[s]),L=Q.useCallback(e=>{let t=e.target.value;if(t===``||t===`-`||t===`.`||t===`-.`)N?o?.(t):M(t);else try{new er(t),I(t)}catch{/^-?\d*\.?\d*$/.test(t)&&(N?o?.(t):M(t))}},[N,o,I]),R=()=>{try{let e=new er(P||`0`),t=new er(k),n=e.plus(t);(D===void 0||n.lte(new er(D)))&&I(n.toString())}catch{I(k)}},te=()=>{try{let e=new er(P||`0`),t=new er(k),n=e.minus(t);(E===void 0||n.gte(new er(E)))&&I(n.toString())}catch{I(new er(k).neg().toString())}},z=Q.useCallback(e=>{let t=e[0];I(O===void 0?t.toString():t.toFixed(O))},[I,O]);switch(w){case Ci.INPUT:return(0,$.jsx)(iN,{ref:_,id:t,type:`text`,inputMode:`decimal`,value:P,onChange:L,onBlur:ee,disabled:n,readOnly:r,placeholder:u,className:U(`tabular-nums`,i),autoFocus:h,controlSize:g});case Ci.SLIDER:let e=E?parseFloat(E):0,a=D?parseFloat(D):100,o=parseFloat(k);return(0,$.jsxs)(`div`,{ref:_,className:U(`flex items-center gap-field`,i),children:[(0,$.jsx)(eN,{value:[F],onValueChange:z,onValueCommit:()=>ee(),min:e,max:a,step:o,disabled:n,className:`flex-1`,controlSize:g}),(0,$.jsx)(`span`,{className:`min-w-[4rem] text-end text-sm tabular-nums`,children:v(F)})]});case Ci.STEPPER:let s=t??`stepper-field`,c=E!==void 0&&(()=>{try{return new er(P||`0`).lte(new er(E))}catch{return!1}})(),l=D!==void 0&&(()=>{try{return new er(P||`0`).gte(new er(D))}catch{return!1}})();return(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element`,i),children:[(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,size:x,onClick:te,disabled:n||r||c,children:b(H.MINUS,{size:fa.SM})}),(0,$.jsx)(iN,{ref:_,id:s,type:`text`,inputMode:`decimal`,value:P,onChange:L,onBlur:ee,disabled:n,readOnly:r,className:`w-24 text-center tabular-nums`,autoFocus:h,controlSize:g}),(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,size:x,onClick:R,disabled:n||r||l,children:b(H.PLUS,{size:fa.SM})})]});default:return(0,$.jsx)(iN,{ref:_,id:t,type:`text`,inputMode:`decimal`,value:P,onChange:L,onBlur:ee,disabled:n,readOnly:r,placeholder:u,className:U(`tabular-nums`,i),autoFocus:h,controlSize:g})}}),_L=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_BIGDECIMAL,`FormFieldBigDecimal`)(e);return(0,$.jsx)(r,{...t,ref:n})});_L.displayName=`FormFieldBigDecimal`;var vL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_CODE,`FormFieldCode`)(e);return(0,$.jsx)(r,{...t,ref:n})});vL.displayName=`FormFieldCode`;var yL=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,validationMode:l,fromPlaceholder:u=`From`,toPlaceholder:d=`To`,fromLabel:f=`From`,toLabel:p=`To`,required:m,autoFocus:h,controlSize:g=rf.MD},_)=>{let{tComponent:v,isReady:y}=K({component:J.LOW_LEVEL_FORM_FIELD_RANGE_BIGDECIMAL}),b=pt(e),x=Ht(e),S=x.min??b?.min,C=x.max??b?.max,w=x.precision,T=b?.fromOptional??!0,E=b?.toOptional??!0,D=w===void 0?`any`:`0.${`0`.repeat(Math.max(0,w-1))}1`,[O,k]=Q.useState(c??{from:void 0,to:void 0}),A=V_(a,o),j=a??O,M=Q.useMemo(()=>{if(j.from==null||j.to==null)return!1;let e=parseFloat(j.from),t=parseFloat(j.to);return isNaN(e)||isNaN(t)?!1:e>t},[j.from,j.to]),N=Q.useCallback(e=>{let t=e.target.value||void 0,n={...j,from:t};A?o?.(n):k(n)},[A,o,j]),P=Q.useCallback(e=>{let t=e.target.value||void 0,n={...j,to:t};A?o?.(n):k(n)},[A,o,j]),F=Q.useCallback(()=>{s?.()},[s]),I=t??`range-bigdecimal-field`,ee=`${I}-from`,L=`${I}-to`;return y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{htmlFor:ee,className:`sr-only`,children:f}),(0,$.jsx)(iN,{ref:_,id:ee,type:`text`,inputMode:`decimal`,value:j.from??``,onChange:N,onBlur:F,disabled:n,readOnly:r,placeholder:u,"aria-invalid":M,"aria-required":!T,min:S,max:C,step:D,className:`tabular-nums`,autoFocus:h,controlSize:g})]}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{htmlFor:L,className:`sr-only`,children:p}),(0,$.jsx)(iN,{id:L,type:`text`,inputMode:`decimal`,value:j.to??``,onChange:P,onBlur:F,disabled:n,readOnly:r,placeholder:d,"aria-invalid":M,"aria-required":!E,min:S,max:C,step:D,className:`tabular-nums`,controlSize:g})]})]}),M&&(0,$.jsx)(`p`,{className:`text-destructive text-sm`,role:`alert`,children:v(J.LOW_LEVEL_FORM_MESSAGE,`rangeFromMustBeLessThanTo`)})]}):null}),bL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_RANGE_BIGDECIMAL,`FormFieldRangeBigDecimal`)(e);return(0,$.jsx)(r,{...t,ref:n})});bL.displayName=`FormFieldRangeBigDecimal`;function Lme(e,t){let n=Object.keys(le);return t&&(n=lte()),n=n.filter(t=>gte(t,e)),n.map(e=>({value:e,label:`${le[e].symbol} ${e}`})).sort((e,t)=>{let n=le[e.value],r=le[t.value];return n.isMajor&&!r.isMajor?-1:!n.isMajor&&r.isMajor?1:e.label.localeCompare(t.label)})}var xL=Q.forwardRef(({schema:e,name:t,disabled:n,readOnly:r,className:i,value:a,onChange:o,onBlur:s,defaultValue:c,validationMode:l,fromPlaceholder:u=`From`,toPlaceholder:d=`To`,required:f,autoFocus:p,controlSize:m=rf.MD},h)=>{let{tComponent:g,isReady:_}=K({component:J.LOW_LEVEL_FORM_FIELD_RANGE_MONEY}),{getRecipe:v,fieldVariant:y}=e_(),b=v(wi.FORM_CONTROL,Qg(y)),x=Lc(e),S=Ls(e),C=pt(e),w=x?.currenciesAllowed,T=x?.appEnabledOnly??!0,E=S?.edit?.defaultCurrency??`USD`,D=x?.allowCurrencyChange??!0,O=x?.minAmount,k=x?.maxAmount,A=C?.fromOptional??!0,j=C?.toOptional??!0,M=Q.useMemo(()=>Lme(w,T),[w,T]),N=Q.useCallback(e=>nn(e)?.decimals??2,[]);Q.useCallback(()=>{let e=N(E);return{amount:0n,currency:E,decimals:e}},[E,N]);let[P,F]=Q.useState(c??{from:void 0,to:void 0}),[I,ee]=Q.useState(c?.from?.currency??c?.to?.currency??E),L=V_(a,o),R=a??P,te=N(I),z=Q.useMemo(()=>!R.from||!R.to||R.from.amount===0n&&R.to.amount===0n?!1:Cr(R.from.amount,R.from.decimals)>Cr(R.to.amount,R.to.decimals),[R.from,R.to]),B=Q.useMemo(()=>!R.from||R.from.amount===0n?``:Cr(R.from.amount,R.from.decimals).toFixed(R.from.decimals),[R.from]),ne=Q.useMemo(()=>!R.to||R.to.amount===0n?``:Cr(R.to.amount,R.to.decimals).toFixed(R.to.decimals),[R.to]),re=Q.useCallback(e=>{let t=e.target.value,n;if(t&&t!==``){let e=Hr(t,te);e!==null&&(n={amount:e,currency:I,decimals:te})}let r={...R,from:n};L?o?.(r):F(r)},[R,I,te,L,o]),ie=Q.useCallback(e=>{let t=e.target.value,n;if(t&&t!==``){let e=Hr(t,te);e!==null&&(n={amount:e,currency:I,decimals:te})}let r={...R,to:n};L?o?.(r):F(r)},[R,I,te,L,o]),ae=Q.useCallback(e=>{let t=N(e);ee(e);let n,r;R.from&&R.from.amount!==0n&&(n={amount:$s(R.from.amount,R.from.decimals,t),currency:e,decimals:t}),R.to&&R.to.amount!==0n&&(r={amount:$s(R.to.amount,R.to.decimals,t),currency:e,decimals:t});let i={from:n,to:r};L?o?.(i):F(i)},[R,N,L,o]),oe=Q.useCallback(()=>{s?.()},[s]),se=t??`range-money-field`,ce=`${se}-from`,le=`${se}-to`,ue=nn(I)?.symbol??I;return _?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(iN,{ref:h,id:ce,type:`number`,step:10**-te,value:B,onChange:re,onBlur:oe,disabled:n,readOnly:r,placeholder:u,prefix:ue,wrapperClassName:`flex-1`,className:U(`tabular-nums`,z&&`border-destructive`),"aria-invalid":z,"aria-required":!A,min:O===void 0?void 0:Cr(O,te),max:k===void 0?void 0:Cr(k,te),autoFocus:p,controlSize:m}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),(0,$.jsx)(iN,{id:le,type:`number`,step:10**-te,value:ne,onChange:ie,onBlur:oe,disabled:n,readOnly:r,placeholder:d,prefix:ue,wrapperClassName:`flex-1`,className:U(`tabular-nums`,z&&`border-destructive`),"aria-invalid":z,"aria-required":!j,min:O===void 0?void 0:Cr(O,te),max:k===void 0?void 0:Cr(k,te),controlSize:m}),D?(0,$.jsx)(QI,{value:I,onChange:e=>ae(e.target.value),disabled:n||r,controlSize:m,wrapperClassName:`w-24`,"aria-label":g(J.LOW_LEVEL_FORM_FIELD_RANGE_MONEY,`currency`),children:M.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.value},e.value))}):(0,$.jsx)(`div`,{"data-size":m,className:U(`flex items-center text-sm text-muted-foreground`,b.sizes?.[m]),children:I})]}),z&&(0,$.jsx)(`p`,{className:`text-destructive text-sm`,role:`alert`,children:g(J.LOW_LEVEL_FORM_MESSAGE,`rangeFromMustBeLessThanTo`)})]}):null}),SL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FORM_FIELD_RANGE_MONEY,`FormFieldRangeMoney`)(e);return(0,$.jsx)(r,{...t,ref:n})});SL.displayName=`FormFieldRangeMoney`;var CL=class extends Error{};function wL(e,t,n,r){return t.throwIfAborted(),new Promise((i,a)=>{let o=()=>{clearTimeout(c),t.removeEventListener(`abort`,s)},s=()=>{o(),a(t.reason)},c=n===void 0?void 0:setTimeout(()=>{o(),a(new CL(r))},Math.max(0,n));t.addEventListener(`abort`,s,{once:!0}),Promise.resolve().then(()=>(t.throwIfAborted(),e())).then(e=>{o(),i(e)},e=>{o(),a(e)})})}async function Rme(e){let t=Date.now()+(e.timeoutMs??12e4),n=e.metadata;for(;;){if(e.signal.throwIfAborted(),n&&n.fileId!==e.fileId||n&&!Object.values(ss).includes(n.readiness))throw new CL(e.unverifiedMessage);if(n?.readiness===ss.READY)return n;if(n&&n.readiness!==ss.PROCESSING)throw new CL(e.unavailableMessage);if(e.onPending(),!e.getMetadata||Date.now()>=t)throw new CL(e.unverifiedMessage);n&&await new Promise((t,n)=>{let r=()=>{clearTimeout(i),n(e.signal.reason)},i=setTimeout(()=>{e.signal.removeEventListener(`abort`,r),t()},e.intervalMs??2e3);e.signal.addEventListener(`abort`,r,{once:!0})}),e.signal.throwIfAborted();try{n=await wL(e.getMetadata,e.signal,t-Date.now(),e.unverifiedMessage)}catch{throw e.signal.throwIfAborted(),new CL(e.unverifiedMessage)}}}function TL(e,t){return t||(!e||typeof e!=`object`?pr.ON_BLUR:Cte(e)?pr.ON_CHANGE:pr.ON_BLUR)}function zme(e){return e.issues[0]?.code??`unknown`}function EL(e){let t={};for(let[n,r]of Object.entries(e))n!==`code`&&n!==`message`&&n!==`path`&&(t[n]=r);return t}function Bme(e){let t=Bl(e.schema);return t?{allowedMimeTypes:t.allowedMimeTypes,maxSize:t.maxSize,maxFiles:t.maxFiles}:{}}var Vme={[Ss.IMAGE]:`accepted_type_image`,[Ss.VIDEO]:`accepted_type_video`,[Ss.AUDIO]:`accepted_type_audio`,[Ss.PDF]:`accepted_type_pdf`,[Ss.OFFICE]:`accepted_type_office`,[Ss.ARCHIVE]:`accepted_type_archive`,[Ss.ALL]:`accepted_types_all`},Hme={[Si.TEXT]:`accepted_type_text`,[Si.MARKDOWN]:`accepted_type_markdown`,[Si.JSON]:`accepted_type_json`,[Si.TYPESCRIPT]:`accepted_type_typescript`,[Si.TYPESCRIPT_JSX]:`accepted_type_typescript_react`,[Si.YAML]:`accepted_type_yaml`};function DL(e,t){let n=e=>t(J.LOW_LEVEL_FORM_FIELD_FILE,e);return e.length===0?n(`accepted_types_all`):e.map(e=>{switch(e.category){case bs.NATURE:return n(Vme[e.nature]);case bs.AGENT_FORMAT:return n(Hme[e.format]);case bs.MIME_SUBTYPE:return e.subtype.toUpperCase()}}).join(`, `)}var OL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_IMAGE_CROP,`ImageCrop`)(e);return(0,$.jsx)(r,{...t,ref:n})});OL.displayName=`ImageCrop`;function kL(e){return!(!e.type.startsWith(`image/`)||e.type===`image/svg+xml`)}async function AL(e){if(typeof createImageBitmap==`function`)try{let t;try{t=await createImageBitmap(e,{imageOrientation:`from-image`})}catch{t=await createImageBitmap(e)}return{source:t,naturalWidth:t.width,naturalHeight:t.height,dispose:()=>t.close()}}catch{}let t=URL.createObjectURL(e);try{let e=await new Promise((e,n)=>{let r=new Image;r.onload=()=>e(r),r.onerror=()=>n(Error(`image_decode_failed`)),r.src=t});return{source:e,naturalWidth:e.naturalWidth,naturalHeight:e.naturalHeight,dispose:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function jL(e,t,n,r){return Math.max(n/e,r/t)}function ML(e,t,n,r){let i=Math.max(0,(t*n-r)/2);return Math.min(i,Math.max(-i,e))}function NL(e){let{naturalWidth:t,naturalHeight:n,viewportWidth:r,viewportHeight:i,transform:a}=e,o=jL(t,n,r,i)*a.zoom,s=r/o,c=i/o,l=t/2-a.offsetX/o,u=n/2-a.offsetY/o;return{x:Math.min(Math.max(0,l-s/2),Math.max(0,t-s)),y:Math.min(Math.max(0,u-c/2),Math.max(0,n-c)),width:Math.min(s,t),height:Math.min(c,n)}}var PL=`image/png`,FL=`image/jpeg`,IL=`image/webp`,LL=[PL,FL,IL],Ume={[PL]:`png`,[FL]:`jpg`,[IL]:`webp`},Wme=[.92,.85,.78,.7,.6,.5];function RL(e){return LL.some(t=>Zu(t,e))}function Gme(e,t,n){return new Promise(r=>e.toBlob(r,t,n))}function zL(e,t){return`${e.replace(/\.[^./\\]+$/,``)}.${t}`}async function BL(e){let{image:t,sourceRect:n,originalFile:r,maxWidth:i,maxHeight:a,maxSizeBytes:o,allowedMimeTypes:s}=e,c=Math.min(1,i?i/n.width:1,a?a/n.height:1),l=Math.max(1,Math.round(n.width*c)),u=Math.max(1,Math.round(n.height*c)),d=document.createElement(`canvas`);d.width=l,d.height=u;let f=d.getContext(`2d`);if(!f)throw Error(`canvas_2d_unavailable`);f.imageSmoothingEnabled=!0,f.imageSmoothingQuality=`high`,f.drawImage(t.source,n.x,n.y,n.width,n.height,0,0,l,u);let p=LL.filter(e=>Zu(e,s)),m=[];p.includes(r.type)&&r.type!==FL&&m.push(r.type);for(let e of[PL,IL,FL])p.includes(e)&&!m.includes(e)&&m.push(e);if(m.length===0)throw Error(`image_export_no_allowed_encoding`);let h=e=>new File([e],zL(r.name,Ume[e.type]??`png`),{type:e.type}),g=null,_=e=>p.includes(e.type)?((!g||e.size<g.size)&&(g=e),!o||e.size<=o?h(e):null):null;for(let e of m){e===FL&&(f.save(),f.globalCompositeOperation=`destination-over`,f.fillStyle=`#ffffff`,f.fillRect(0,0,l,u),f.restore());let t=e===PL?[void 0]:Wme;for(let n of t){let t=await Gme(d,e,n);if(!t)continue;let r=_(t);if(r)return r;if(e===PL)break}}if(!g)throw Error(`image_encode_failed`);return h(g)}function Kme(e){return e!=null&&`fileId`in e}function VL(e){return e!=null&&`fileIds`in e}var qme=0;function HL(){return`upload-${Date.now()}-${++qme}`}function UL(e){return e instanceof Error?e.code===`ERR_CANCELED`||e.name===`AbortError`:!1}function WL(e,t){return t&&e.override?e.override:e.upload}function Jme(e,t){return!!WL(e,t)}function GL(e){return!!e.upload}function Yme(e,t){return e&&e.trim()!==``?e:t}function KL(e,t){return t instanceof CL?t.message:e}var qL=Q.forwardRef(({schema:e,name:t,value:n,onChange:r,onBlur:i,defaultValue:a,disabled:o=!1,readOnly:s,className:c,validationMode:l,endpoints:u,uploadButtonText:d,replaceButtonText:f,onValidationError:p,required:m,httpOperations:h},g)=>{let{t:_,tErrorValidation:v,tComponent:y,tResourceFieldEnumValue:b,isReady:x,formatByteSize:S}=K({component:J.LOW_LEVEL_FORM_FIELD_FILE,keys:[`errors_validation`,`system_enums`]}),{frontendProviderRegistry:C}=_u(),{renderIcon:w}=Rf(),{getRecipe:T}=e_(),E=T(wi.FORM_CONTROL,Qo.DEFAULT),D=d??y(J.LOW_LEVEL_FORM_FIELD_FILE,`choose_file`),O=f??y(J.LOW_LEVEL_FORM_FIELD_FILE,`replace`),k=y(J.LOW_LEVEL_FORM_FIELD_FILE,`drag_and_drop`),A=y(J.LOW_LEVEL_FORM_FIELD_FILE,`remove`),j=y(J.LOW_LEVEL_FORM_FIELD_FILE,`upload_failed`),M=y(J.LOW_LEVEL_FORM_FIELD_FILE,`metadata_load_failed`),N=y(J.LOW_LEVEL_FORM_FIELD_FILE,`uploads_unavailable`),P=y(J.LOW_LEVEL_FORM_FIELD_FILE,`file_attached`),F=Bl(e),I=Bme({schema:e}),ee=I.allowedMimeTypes,L=I.maxSize,R=F?.minSize,te=F?.overridable??!0,z=ee?qne(ee):void 0,B=F?.multiple??!1,ne=I.maxFiles,re=F?.imageConstraints,ie=F?.videoConstraints,ae=F?.audioConstraints,oe=F?.documentConstraints,se=TL(e,l),[ce,le]=Q.useState(a??null),[ue,de]=Q.useState(),fe=Q.useRef(n);Q.useEffect(()=>{fe.current!==void 0&&n==null&&ue&&de(void 0),fe.current=n},[n,ue]);let[pe,me]=Q.useState(new Map),he=Q.useRef(pe);he.current=pe;let[ge,_e]=Q.useState(0),[ve,ye]=Q.useState(new Map),[be,xe]=Q.useState(!1),Se=Q.useRef(new Set),Ce=Q.useRef(0),[we,Te]=Q.useState(new Set),Ee=y(J.LOW_LEVEL_FORM_FIELD_FILE,`file_processing`),De=y(J.LOW_LEVEL_FORM_FIELD_FILE,`file_unavailable`),Oe=y(J.LOW_LEVEL_FORM_FIELD_FILE,`file_readiness_unverified`),ke=Q.useCallback(()=>{Ce.current+=1;for(let e of Se.current)e.abort();for(let e of he.current.values())e.abortController.abort();Se.current.clear()},[]),Ae=Q.useRef(null),je=V_(n,r),Me=n??ce,Ne=Array.from(pe.values()).some(e=>e.status===`uploading`),Pe=Kme(Me)?Me.fileId:null,Fe=VL(Me)?Me.fileIds:[],Ie=B?GL(u):Jme(u,Pe),Le=Q.useRef(Fe);Le.current=Fe;let Re=Q.useMemo(()=>Fe.join(`,`),[Fe]),ze=Q.useRef(ve);ze.current=ve;let Be=Pe?ve.get(Pe)??null:null,Ve=Pe?[Pe]:Fe,He=Ve.some(e=>ve.get(e)?.readiness===ss.UNAVAILABLE)?De:Ve.some(e=>![ss.READY,ss.ATTACHED].includes(ve.get(e)?.readiness))?Ee:void 0,Ue=Array.from(pe.values()).find(e=>e.status===`error`)?.error,We=Ne||we.size>0?Ee:Ue??He;Q.useEffect(()=>{p?.(ue??We)},[ue,We,p]);let Ge=Q.useCallback(async e=>h.get(e),[h]),Ke=Q.useCallback(async e=>h.delete(e),[h]);Q.useEffect(()=>()=>ke(),[u.getMetadata,u.upload,u.override,h,Ge,ke]);let qe=Q.useRef({endpoint:u.getMetadata,get:Ge});Q.useEffect(()=>{let e=Pe?[Pe]:Fe,t=qe.current.endpoint!==u.getMetadata||qe.current.get!==Ge;if(qe.current={endpoint:u.getMetadata,get:Ge},t&&(ze.current=new Map,ye(new Map)),e.length===0){ye(new Map),de(e=>e===M?void 0:e);return}let n=!1,r=new AbortController,i,a=async()=>{let t=!1,o=!1,s=new Map;await Promise.all(e.map(async e=>{let n=ze.current.get(e);if(!(n&&[ss.READY,ss.ATTACHED,ss.UNAVAILABLE].includes(n.readiness))){if(!u.getMetadata)o=!0;else try{let n=await wL(()=>Ge(`${u.getMetadata}/${encodeURIComponent(e)}/metadata`),r.signal,12e4,M);if(n.fileId!==e||!Object.values(ss).includes(n.readiness))throw Error(`Invalid file metadata`);s.set(e,n),n.readiness===ss.PROCESSING&&(t=!0)}catch{o=!0,t=!0,console.warn(`Unable to load file metadata for one or more files.`)}}})),n||(ye(e=>{let t=new Map(e);for(let[e,n]of s)t.set(e,n);return t}),de(e=>o?M:e===M?void 0:e),t&&(i=setTimeout(a,2e3)))};return a(),()=>{n=!0,r.abort(),i&&clearTimeout(i)}},[Pe,Re,u.getMetadata,Ge,M]);let Je=Q.useCallback(async(e,t)=>{let n=new AbortController,r=()=>n.abort();t?.aborted&&n.abort(),t?.addEventListener(`abort`,r,{once:!0}),Se.current.add(n);try{let t=await Rme({...e,signal:n.signal,getMetadata:u.getMetadata?()=>Ge(`${u.getMetadata}/${encodeURIComponent(e.fileId)}/metadata`):void 0,onPending:()=>Te(t=>new Set(t).add(e.fileId)),unavailableMessage:De,unverifiedMessage:Oe});return n.signal.throwIfAborted(),{fileId:e.fileId,metadata:t}}finally{t?.removeEventListener(`abort`,r),Se.current.delete(n),Te(t=>{let n=new Set(t);return n.delete(e.fileId),n})}},[Ge,u.getMetadata,De,Oe]),Ye=Q.useCallback(e=>{if(ee&&ee.length>0&&!Zu(e.type,ee)){let e=DL(su(ee),y);return y(J.LOW_LEVEL_FORM_FIELD_FILE,`file_type_not_allowed`,{accepted:e})}},[ee,y]),Xe=Q.useCallback(e=>{let t=Ye(e);if(t)return t;if(L&&e.size>L){let e=S(L);return y(J.LOW_LEVEL_FORM_FIELD_FILE,`file_too_large`,{max:e})}if(R&&e.size<R){let e=S(R);return y(J.LOW_LEVEL_FORM_FIELD_FILE,`file_too_small`,{min:e})}},[Ye,L,R,y,S]),Ze=Q.useCallback(async(e,t,n,r,i,a)=>{let o=new FormData;o.append(`file`,e),n&&r&&o.append(`fileId`,r);let s=()=>h.upload(t,o,{onProgress:i,signal:a}),c=a?await wL(s,a,void 0,Oe):await s();return a?.throwIfAborted(),Je(c,a)},[h,Je,Oe]),Qe=Q.useCallback(async t=>{ke();let n=Ce.current,i=WL(u,Pe);if(!i){de(N);return}let a=Xe(t);if(a){de(a);return}let o=HL(),s=new AbortController;me(new Map([[o,{tempId:o,fileName:t.name,progress:0,status:`uploading`,abortController:s}]])),_e(0),p?.(Ee),de(void 0);try{let a=await Ze(t,i,!!Pe,Pe,e=>{_e(e),me(t=>{let n=new Map(t),r=n.get(o);return r&&n.set(o,{...r,progress:e}),n})},s.signal);if(n!==Ce.current)return;let c={fileId:a.fileId,updatedAt:new Date};if(je||le(c),r?.(c),a.metadata&&ye(e=>{let t=new Map(e);return t.set(a.fileId,a.metadata),t}),se!==`onSubmit`){let t=e.safeParse(c);if(!t.success){let e=t.error.issues[0];if(e){let t={...EL(e),message:e.message},n=v(e.code,`msg`,t);de(n)}}}}catch(e){if(s.signal.aborted||n!==Ce.current||UL(e))return;de(KL(j,e))}finally{me(e=>{let t=new Map(e);return t.delete(o),t}),_e(0)}},[Pe,u,je,r,N,Xe,se,e,v,Ze,ke,p,Ee,j]),$e=Q.useCallback(async e=>{let t=Ce.current;if(!GL(u)){de(N);return}let n=Le.current.length;if(ne&&n+e.length>ne){de(y(J.LOW_LEVEL_FORM_FIELD_FILE,`too_many_files`,{max:ne}));return}let i=[];for(let t of e){let e=Xe(t);if(e){de(e);return}i.push(t)}p?.(Ee),de(void 0);let a=new Map,o=[];for(let e of i){let t=HL(),n=new AbortController;a.set(t,{tempId:t,fileName:e.name,progress:0,status:`uploading`,abortController:n}),o.push({tempId:t,file:e,abortController:n})}me(e=>{let t=new Map;for(let[n,r]of e)r.status===`uploading`&&t.set(n,r);for(let[e,n]of a)t.set(e,n);return t});let s=await Promise.allSettled(o.map(async({tempId:e,file:n,abortController:r})=>{try{let t=await Ze(n,u.upload,!1,null,t=>{me(n=>{let r=new Map(n),i=r.get(e);return i&&r.set(e,{...i,progress:t}),r})},r.signal);return me(n=>{let r=new Map(n),i=r.get(e);return i&&r.set(e,{...i,status:`done`,fileId:t.fileId,progress:100}),r}),t.metadata&&ye(e=>{let n=new Map(e);return n.set(t.fileId,t.metadata),n}),t.fileId}catch(n){throw r.signal.aborted||t!==Ce.current||UL(n)?(me(t=>{let n=new Map(t);return n.delete(e),n}),n):(me(t=>{let r=new Map(t),i=r.get(e);return i&&r.set(e,{...i,status:`error`,error:KL(j,n)}),r}),n)}})),c=[];for(let e of s)e.status===`fulfilled`&&c.push(e.value);if(c.length>0&&t===Ce.current){let e=[...Le.current,...c];Le.current=e;let t={fileIds:e,updatedAt:new Date};je||le(t),r?.(t)}me(e=>{let t=new Map(e);for(let[e,n]of t)n.status===`done`&&t.delete(e);return t})},[u,je,ne,r,y,Ze,Xe,j,N,p,Ee]),et=re?.aspectRatio,tt=bne(e)?.display?.preview?.shape,[nt,rt]=Q.useState(null),it=Q.useCallback(e=>{rt(null),Qe(e)},[Qe]),at=Q.useCallback(()=>{rt(null)},[]),ot=Q.useCallback(e=>{rt(null),Qe(e)},[Qe]),st=Q.useCallback(e=>{if(e.length!==0){if(B)$e(e);else{let t=e[0];if(et&&kL(t)&&RL(ee)){let e=Ye(t);if(e){de(e);return}de(void 0),rt(t);return}Qe(t)}}},[B,$e,Qe,et,Ye,ee]),ct=Q.useCallback(async(e,t)=>{B||ke();let n=Ce.current,i=B?t:t.slice(0,1),a=B?u.upload:WL(u,Pe);if(!a){de(N);return}p?.(Ee),de(void 0);let o=await Promise.allSettled(i.map(async t=>{let n=HL();Te(e=>new Set(e).add(n));let r=new AbortController;Se.current.add(r);try{let n=await wL(()=>h.linkRemoteReference(a,{remoteReference:{providerRef:e,externalId:t.externalId,...t.displayName===void 0?{}:{displayName:t.displayName},...t.mimeType===void 0?{}:{mimeType:t.mimeType},...t.sizeBytes===void 0?{}:{sizeBytes:t.sizeBytes}}}),r.signal,12e4,Oe);r.signal.throwIfAborted();let i=await Je(n,r.signal);return i.metadata&&ye(e=>{let t=new Map(e);return t.set(i.fileId,i.metadata),t}),i.fileId}finally{Se.current.delete(r),Te(e=>{let t=new Set(e);return t.delete(n),t})}})),s=o.flatMap(e=>e.status===`fulfilled`?[e.value]:[]);if(s.length>0&&n===Ce.current){let e=B?{fileIds:[...Le.current,...s],updatedAt:new Date}:{fileId:s[0],updatedAt:new Date};VL(e)&&(Le.current=e.fileIds),je||le(e),r?.(e)}if(s.length<i.length&&n===Ce.current){let e=o.find(e=>e.status===`rejected`);de(KL(y(J.LOW_LEVEL_FORM_FIELD_FILE,`provider_link_failed`),e?.status===`rejected`?e.reason:void 0))}},[Pe,u,h,je,B,r,N,y,Je,ke,p,Ee,Oe]),lt=Q.useCallback(async(e,t)=>{B||ke();let n=Ce.current,r=new AbortController,i=HL();Se.current.add(r),p?.(Ee),Te(e=>new Set(e).add(i));try{let i=[],a=[],o=!1;for(let e of t)if(e.kind===bd.BROWSER_READABLE_FILE)i.push(e.file);else if(e.kind===bd.BROWSER_READABLE_URL)try{let t=await wL(()=>fetch(e.url,{signal:r.signal}),r.signal,12e4,Oe);if(!t.ok){o=!0;continue}let n=await wL(()=>t.blob(),r.signal,12e4,Oe);i.push(new File([n],e.displayName??`file`,{type:e.mimeType??n.type}))}catch{if(r.signal.aborted||n!==Ce.current)return;o=!0}else a.push(e);if(r.signal.aborted||n!==Ce.current)return;if(a.length>0){await ct(e,a);return}if(o&&i.length===0){de(y(J.LOW_LEVEL_FORM_FIELD_FILE,`provider_fetch_failed`));return}if(i.length===0)return;de(o?y(J.LOW_LEVEL_FORM_FIELD_FILE,`provider_fetch_failed`):void 0),st(i)}finally{Se.current.delete(r),Te(e=>{let t=new Set(e);return t.delete(i),t})}},[st,ct,y,B,ke,p,Ee,Oe]),ut=Q.useCallback(()=>{de(y(J.LOW_LEVEL_FORM_FIELD_FILE,`provider_picker_failed`))},[y]),dt=Q.useCallback(e=>{let t=e.target.files;t&&t.length>0&&st(Array.from(t)),Ae.current&&(Ae.current.value=``)},[st]),ft=o||s,pt=ft||!Ie,mt=Q.useCallback(e=>{e.preventDefault(),e.stopPropagation(),!pt&&!Ne&&xe(!0)},[pt,Ne]),ht=Q.useCallback(e=>{e.preventDefault(),e.stopPropagation(),xe(!1)},[]),gt=Q.useCallback(e=>{if(e.preventDefault(),e.stopPropagation(),xe(!1),pt||Ne)return;let t=e.dataTransfer.files;t&&t.length>0&&st(Array.from(t))},[pt,Ne,st]),_t=Q.useCallback(async()=>{if(ke(),Pe){if(u.delete)try{let e=`${u.delete}/${encodeURIComponent(Pe)}`;await Ke(e)}catch(e){if(UL(e))return;de(KL(j,e));return}de(void 0),je||le(null),r?.(null),ye(e=>{let t=new Map(e);return t.delete(Pe),t})}},[Pe,u,je,r,Ke,j]),vt=Q.useCallback(async e=>{if(ke(),u.delete)try{let t=`${u.delete}/${encodeURIComponent(e)}`;await Ke(t)}catch(e){if(UL(e))return;de(KL(j,e));return}de(void 0);let t=Le.current.filter(t=>t!==e);Le.current=t;let n=t.length>0?{fileIds:t,updatedAt:new Date}:null;je||le(n),r?.(n),ye(t=>{let n=new Map(t);return n.delete(e),n})},[u,je,r,Ke,j]),yt=Q.useCallback(e=>{let t=he.current.get(e);t&&t.abortController.abort(),me(t=>{let n=new Map(t);return n.delete(e),n})},[]),bt=Q.useCallback(()=>{!pt&&!Ne&&Ae.current?.click()},[pt,Ne]),xt=e=>e?e.startsWith(`image/`)?H.FILE_IMAGE:e.startsWith(`video/`)?H.FILE_VIDEO:e.startsWith(`audio/`)?H.FILE_AUDIO:e===`application/pdf`?H.FILE_TEXT:e.includes(`spreadsheet`)||e.includes(`excel`)?H.FILE_SPREADSHEET:e.includes(`presentation`)||e.includes(`powerpoint`)?H.FILE_PRESENTATION:e.includes(`document`)||e.includes(`word`)?H.FILE_TEXT:e.includes(`zip`)||e.includes(`rar`)||e.includes(`7z`)?H.FILE_ARCHIVE:H.FILE:H.FILE,St=(e,t=fa.MD)=>w(xt(e),{size:t}),Ct=DL(su(ee),y),wt=F?.nature,V=(e,t=!1)=>ft?null:(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element`,t?`flex-shrink-0`:``),children:[!t&&te&&Ie&&(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,size:Xd.SM,onClick:bt,disabled:Ne,children:O}),(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.SM,onClick:e,disabled:Ne,className:U(`text-destructive hover:text-destructive`,t&&`h-6 w-6 p-0`),"aria-label":A,title:A,children:w(H.CLOSE,{size:fa.SM})})]}),Tt=(e,t,n=!1)=>(0,$.jsxs)(`div`,{className:U(`min-w-0`,n?``:`flex-1`),children:[(0,$.jsx)(`div`,{className:`flex items-center gap-element`,children:t?.url?(0,$.jsx)(`a`,{href:t.url,target:`_blank`,rel:`noopener noreferrer`,className:U(`font-medium text-primary hover:underline truncate`,n&&`text-sm`),children:t.filename}):(0,$.jsx)(`span`,{className:U(`font-medium truncate`,n&&`text-sm`),children:Yme(t?.filename,P)})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-group text-xs text-muted-foreground mt-0.5`,children:[t?.size!==void 0&&(0,$.jsx)(`span`,{children:S(t.size)}),t?.mimeType&&(0,$.jsx)(`span`,{className:`uppercase`,children:t.extension||t.mimeType.split(`/`).pop()}),t?.width&&t?.height&&(0,$.jsxs)(`span`,{children:[t.width,`×`,t.height]})]})]}),Et=e=>(0,$.jsxs)(`div`,{className:`rounded-md border bg-muted/30 overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`relative`,children:(0,$.jsx)(`img`,{src:e.url||e.thumbnailUrl||``,alt:e.filename,className:`w-full max-h-64 object-contain bg-checkerboard`,loading:`lazy`,onError:e=>{e.target.style.display=`none`}})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:St(e.mimeType,fa.MD)}),Tt(``,e),V(_t)]})]}),Dt=e=>(0,$.jsxs)(`div`,{className:`rounded-md border bg-muted/30 overflow-hidden`,children:[(0,$.jsx)(`video`,{src:e.url,controls:!0,className:`w-full max-h-64 bg-black`,poster:e.thumbnailUrl,preload:`metadata`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:St(e.mimeType,fa.MD)}),Tt(``,e),V(_t)]})]}),Ot=e=>(0,$.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-card-sm space-y-element`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-group`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:St(e.mimeType,fa.MD)}),Tt(``,e),V(_t)]}),(0,$.jsx)(`audio`,{src:e.url,controls:!0,className:`w-full h-8`,preload:`metadata`})]}),kt=(e,t)=>{if(t&&![ss.READY,ss.ATTACHED].includes(t.readiness)&&(t={...t,url:void 0,thumbnailUrl:void 0}),!t)return(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm rounded-md border bg-muted/30`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:St(void 0,fa.LG)}),Tt(e,null),V(_t)]});let n=po(wt,t.mimeType);return n===No.IMAGE&&(t.url||t.thumbnailUrl)?Et(t):n===No.VIDEO&&t.url?Dt(t):n===No.AUDIO&&t.url?Ot(t):(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm rounded-md border bg-muted/30`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:St(t.mimeType,fa.LG)}),Tt(e,t),V(_t)]})},At=(e,t)=>{t&&![ss.READY,ss.ATTACHED].includes(t.readiness)&&(t={...t,url:void 0,thumbnailUrl:void 0});let n=po(wt,t?.mimeType),r=()=>vt(e);return n===No.IMAGE&&t&&(t.url||t.thumbnailUrl)?(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm rounded-md border bg-muted/30`,children:[(0,$.jsx)(`img`,{src:t.thumbnailUrl||t.url||``,alt:t.filename,className:`h-12 w-12 rounded object-cover flex-shrink-0`,loading:`lazy`,onError:e=>{e.target.style.display=`none`}}),(0,$.jsx)(`div`,{className:`flex-1 min-w-0`,children:Tt(e,t,!0)}),V(r,!0)]},e):n===No.AUDIO&&t?.url?(0,$.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-card-sm space-y-item-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-group`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:St(t.mimeType,fa.MD)}),(0,$.jsx)(`div`,{className:`flex-1 min-w-0`,children:Tt(e,t,!0)}),V(r,!0)]}),(0,$.jsx)(`audio`,{src:t.url,controls:!0,className:`w-full h-8`,preload:`metadata`})]},e):(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm rounded-md border bg-muted/30`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:St(t?.mimeType,fa.MD)}),(0,$.jsx)(`div`,{className:`flex-1 min-w-0`,children:Tt(e,t??null,!0)}),V(r,!0)]},e)},jt=()=>(0,$.jsxs)(`div`,{className:`space-y-element`,children:[Fe.map(e=>{let t=ve.get(e);return At(e,t)}),Array.from(pe.values()).map(e=>(0,$.jsxs)(`div`,{className:`flex items-center gap-group p-card-sm rounded-md border border-primary/20 bg-primary/5`,children:[e.status===`uploading`&&(0,$.jsx)(gb,{size:20,className:`text-primary flex-shrink-0`,"aria-hidden":`true`}),e.status===`error`&&(0,$.jsx)(`span`,{className:`text-destructive flex-shrink-0`,"aria-hidden":`true`,children:w(H.WARNING,{size:fa.MD})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsx)(`span`,{className:`font-medium text-sm truncate block`,children:e.fileName}),e.status===`uploading`&&(0,$.jsx)(`div`,{className:`w-full h-1 bg-muted rounded-full mt-1 overflow-hidden`,children:e.progress<0?(0,$.jsx)(`div`,{className:`h-full w-1/3 bg-primary animate-pulse rounded-full`}):(0,$.jsx)(`div`,{className:`h-full bg-primary transition-all duration-[var(--motion-duration-fast)]`,style:{width:`${e.progress}%`}})}),e.status===`error`&&e.error&&(0,$.jsx)(`span`,{className:`text-xs text-destructive`,children:e.error})]}),(e.status===`uploading`||e.status===`error`)&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.SM,onClick:()=>yt(e.tempId),className:`text-muted-foreground hover:text-destructive h-6 w-6 p-0`,"aria-label":y(J.LOW_LEVEL_FORM_FIELD_FILE,`cancel`),title:y(J.LOW_LEVEL_FORM_FIELD_FILE,`cancel`),children:w(H.CLOSE,{size:fa.SM})})]},e.tempId))]}),Mt=e=>{if(e<60)return`${e}s`;if(e<3600)return`${Math.floor(e/60)} min`;let t=Math.floor(e/3600),n=Math.floor(e%3600/60);return n>0?`${t}h ${n}min`:`${t}h`},Nt=Q.useMemo(()=>{let e=[];if(R&&L?e.push(y(J.LOW_LEVEL_FORM_FIELD_FILE,`constraint_size_range`,{min:S(R),max:S(L)})):R&&e.push(y(J.LOW_LEVEL_FORM_FIELD_FILE,`constraint_min_size`,{min:S(R)})),re){let{minWidth:t,maxWidth:n,minHeight:r,maxHeight:i,aspectRatio:a}=re;if(t||r){let n=t??`–`,i=r??`–`;e.push(y(J.LOW_LEVEL_FORM_FIELD_FILE,`constraint_image_dimensions`,{width:String(n),height:String(i)}))}if(n||i){let t=n??`–`,r=i??`–`;e.push(y(J.LOW_LEVEL_FORM_FIELD_FILE,`constraint_image_max_dimensions`,{width:String(t),height:String(r)}))}a&&e.push(y(J.LOW_LEVEL_FORM_FIELD_FILE,`constraint_image_aspect_ratio`,{width:String(a.width),height:String(a.height)}))}return ie&&ie.maxDuration&&e.push(y(J.LOW_LEVEL_FORM_FIELD_FILE,`constraint_video_max_duration`,{duration:Mt(ie.maxDuration)})),ae&&ae.maxDuration&&e.push(y(J.LOW_LEVEL_FORM_FIELD_FILE,`constraint_audio_max_duration`,{duration:Mt(ae.maxDuration)})),oe&&oe.maxPages&&e.push(y(J.LOW_LEVEL_FORM_FIELD_FILE,`constraint_document_max_pages`,{pages:oe.maxPages})),B&&ne&&e.push(y(J.LOW_LEVEL_FORM_FIELD_FILE,`constraint_max_files`,{max:ne})),e},[R,L,re,ie,ae,oe,B,ne,y,S]),Pt=()=>Nt.length===0?null:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-x-group gap-y-item-xs mt-item-xs`,children:Nt.map((e,t)=>(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e},t))}),Ft=(e=!1)=>(0,$.jsx)(`div`,{onClick:bt,onDragOver:mt,onDragLeave:ht,onDrop:gt,className:U(`relative flex flex-col items-center justify-center rounded-md border-2 border-dashed cursor-pointer`,e?`p-card-sm`:`p-container`,be&&`border-primary bg-primary/5`,pt&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`,Ne&&!B&&`pointer-events-none`,ue&&`border-destructive`,!pt&&!Ne&&`hover:border-primary hover:bg-primary/5`,E.motion.transition),children:Ne&&!B?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(gb,{size:32,className:`text-primary mb-element`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:ge<0?y(J.LOW_LEVEL_FORM_FIELD_FILE,`uploading_indeterminate`):y(J.LOW_LEVEL_FORM_FIELD_FILE,`uploading`,{progress:ge})}),(0,$.jsx)(`div`,{className:`w-full max-w-xs h-1 bg-muted rounded-full mt-element overflow-hidden`,children:ge<0?(0,$.jsx)(`div`,{className:`h-full w-1/3 bg-primary animate-pulse rounded-full`}):(0,$.jsx)(`div`,{className:`h-full bg-primary transition-all duration-[var(--motion-duration-fast)]`,style:{width:`${ge}%`}})})]}):(0,$.jsxs)($.Fragment,{children:[!e&&(0,$.jsx)(`span`,{className:`mb-element`,"aria-hidden":`true`,children:w(H.UPLOAD,{size:fa.XL})}),(0,$.jsx)(`span`,{className:U(`font-medium`,e?`text-xs`:`text-sm`),children:e?y(J.LOW_LEVEL_FORM_FIELD_FILE,`add_more`):D}),!e&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground mt-item-xs`,children:k}),(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground mt-element`,children:[Ct,L&&!R&&` • ${y(J.LOW_LEVEL_FORM_FIELD_FILE,`max_size`,{size:S(L)})}`]}),Pt()]})]})}),It=B&&(!ne||Fe.length<ne),Lt=()=>(0,$.jsx)(Sx,{multiple:B,constraints:I,acceptedStorages:F?.storageAccepted,onSelect:lt,onProviderFailure:ut,renderConsentRequired:({choice:e,missingPurposes:t,grant:n})=>{let r=t.map(e=>b(Na.USER_SELF_PREFERENCES,`privacy.consentedPurposes`,e,Xme)).join(`, `),i=_(e.displayNameLabelKey)??e.displayName??e.providerRef;return(0,$.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-item-xs mt-element text-sm text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:y(J.LOW_LEVEL_FORM_FIELD_FILE,`provider_consent_required`,{provider:i,purposes:r})}),n===void 0?null:(0,$.jsx)(X,{type:`button`,size:Xd.SM,variant:Y.OUTLINE,onClick:()=>void n(),children:y(J.LOW_LEVEL_FORM_FIELD_FILE,`provider_consent_grant`,{purposes:r})})]})},renderChooser:({choices:e,chosen:t,choose:n})=>(0,$.jsx)(`div`,{role:`group`,className:`flex flex-wrap gap-item-xs mt-element`,children:e.map(e=>(0,$.jsx)(X,{type:`button`,size:Xd.SM,variant:e.providerRef===t?Y.DEFAULT:Y.OUTLINE,"aria-pressed":e.providerRef===t,onClick:()=>n(e.providerRef),children:_(e.displayNameLabelKey)??e.displayName??e.providerRef},e.providerRef))})});return x?(0,$.jsxs)(`div`,{ref:g,className:c,children:[(ue??We)&&(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:ue??We}),we.size>0&&(0,$.jsx)(X,{type:`button`,onClick:ke,children:y(J.LOW_LEVEL_FORM_FIELD_FILE,`cancel`)}),(0,$.jsx)(`input`,{ref:Ae,type:`file`,accept:z,multiple:B,onChange:dt,className:`hidden`,disabled:pt}),B?(0,$.jsxs)(`div`,{className:`space-y-element`,children:[(Fe.length>0||pe.size>0)&&jt(),!pt&&It&&Ft(Fe.length>0),!pt&&Fe.length===0&&!It&&Ft(!1),!pt&&It&&Lt()]}):Pe?kt(Pe,Be):Ie?(0,$.jsxs)($.Fragment,{children:[Ft(!1),!pt&&Lt()]}):null,nt&&et&&(0,$.jsx)(OL,{file:nt,aspectRatio:et,maskShape:tt,maxOutputWidth:re?.maxWidth,maxOutputHeight:re?.maxHeight,maxOutputSizeBytes:L,allowedMimeTypes:ee,onConfirm:it,onCancel:at,onUncroppable:ot})]}):null}),Xme=sa(ec).consentedPurposes,JL=(0,Q.forwardRef)(({preset:e=q.DEFAULT,httpOperations:t,...n},r)=>{let{httpClient:i}=_u(),a=(0,Q.useMemo)(()=>t||{upload:async(e,t,n)=>{let r=await i.uploadFile(e,t,{onUploadProgress:n?.onProgress,signal:n?.signal});if(r?.file?.fileId)return{fileId:r.file.fileId,metadata:r.file};if(r?.fileId)return{fileId:r.fileId,metadata:r.metadata};throw Error(`upload_failed`)},linkRemoteReference:async(e,t)=>{let n=await i.post(e,t);if(n?.file?.fileId)return{fileId:n.file.fileId,metadata:n.file};throw Error(`link_failed`)},get:async e=>i.get(e),delete:async e=>{await i.delete(e)}},[i,t]),o=bl(J.LOW_LEVEL_FORM_FIELD_FILE,`FormFieldFile`)(e),s={...n,httpOperations:a};return(0,$.jsx)(o,{...s,ref:r})});JL.displayName=`FormFieldFile`;var Zme=[`shipping`,`billing`],Qme=[`home`,`work`,`mobile`,`fax`,`pager`],$me=[`webauthn`];function ehe(e){if(!e)return{leadingModifiers:[],trailingModifiers:[]};let t=Array.isArray(e)?e:[e],n=Array.from(new Set(t)),r=n.find(e=>Zme.includes(e)),i=n.find(e=>Qme.includes(e)),a=n.find(e=>$me.includes(e));return{leadingModifiers:[...r?[r]:[],...i?[i]:[]],trailingModifiers:a?[a]:[]}}function the({identifier:e,modifier:t}){if(!e)return;let{leadingModifiers:n,trailingModifiers:r}=ehe(t);return[...n,e,...r].join(` `)}function YL(e){switch(e){case`stacked`:return io.STACKED;case`inline`:return io.INLINE;case`compact`:return io.COMPACT;default:return}}function XL(e){switch(e){case`top`:case`start`:case`inline`:case`hidden`:return e;default:return}}function ZL(e){switch(e){case`sm`:return rf.SM;case`md`:return rf.MD;default:return}}var QL=300;function nhe(e,t,n=QL){let r=(0,Q.useRef)(null);(0,Q.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let i=(0,Q.useCallback)(()=>{r.current&&=(clearTimeout(r.current),null)},[]);return{debouncedTrigger:(0,Q.useCallback)(()=>{i(),r.current=setTimeout(()=>{e(t)},n)},[e,t,n,i]),cancelDebounce:i}}function rhe(e){return!!(e?.upload||e?.override)}function $L(e){return e??void 0}function ihe(e,t,n=pr.ON_BLUR,r=!1,i,a=kc){let{debouncedTrigger:o,cancelDebounce:s}=nhe(e.trigger,t,QL),c=RE(),l=(i?uo(i):void 0)?.autosave,u=BE(l,c?.config.defaultTrigger,r),d=c?.getFieldStateInfo(t),f=d?.state??hT.IDLE,p=d?.lastError,m=(0,Q.useCallback)(()=>{c?.retryFieldSave?.(t)},[c,t]),{validateUniqueness:h}=Kde({fieldName:t,fieldSchema:i}),{handleFieldBlur:g,noteInputReceived:_}=UM(t);return{createBlurHandler:(0,Q.useCallback)(i=>()=>{let a=g(i);if(s(),a||(n===`onBlur`||n===`onTouched`||n===`onChange`&&r)&&e.trigger(t),c&&u===zn.BLUR){let n=e.getValues(t);c.triggerSave(t,n,zn.BLUR)}h()},[e,t,n,r,s,c,u,h,g]),createChangeHandler:(0,Q.useCallback)(s=>l=>{let d=i?a(i,l):l;s(d),_();let f=e.getFieldState(t);(n===`onChange`||n===`onTouched`&&f.isTouched||n===`onBlur`&&f.error)&&(r?o():e.trigger(t)),c&&u===zn.DEBOUNCE&&c.triggerSave(t,d,zn.DEBOUNCE)},[e,t,n,r,o,c,u,i,a,_]),autosaveFieldState:f,autosaveError:p,handleRetrySave:m,saveFieldNow:(0,Q.useMemo)(()=>c?.config.enabled&&u!==zn.NONE?e=>c.triggerSave(t,e,zn.BLUR):void 0,[c,u,t])}}function ahe(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.fileId==`string`&&t.fileId.trim()!==``||Array.isArray(t.fileIds)&&t.fileIds.some(e=>typeof e==`string`&&e.trim()!==``)}function ohe(e){if(!ahe(e))return 0;let t=e;return Array.isArray(t.fileIds)?Math.max(1,t.fileIds.filter(e=>typeof e==`string`&&e.trim()!==``).length):1}function eR({inputProps:e,value:t,isGeneratedPdfField:n,onBlur:r,inputRef:i}){let{tComponent:a}=K({component:J.LOW_LEVEL_FORM_FIELD_FILE}),o=ohe(t),s=o===0?``:o>1?a(J.LOW_LEVEL_FORM_FIELD_FILE,`files_attached`,{count:o}):a(J.LOW_LEVEL_FORM_FIELD_FILE,`file_attached`),c=a(J.LOW_LEVEL_FORM_FIELD_FILE,n?`generated_pdf_read_only`:`uploads_unavailable_placeholder`);return(0,$.jsx)(rN,{...e,value:s,onChange:()=>void 0,onBlur:r,ref:i,placeholder:c,type:`text`,readOnly:!0,disabled:!0})}function she(e,t,n,r){return uo(e)?.validationMode||t||n||sr.getDefaultValidationMode(r)}function che(e,t){return t.some(t=>e===t||e.startsWith(`${t}.`)||e.startsWith(`${t}[`))}function lhe(e,t){if(!t)return e;let n=Array.isArray(e.conditions)?e.conditions:[e.conditions];return{...e,conditions:n.map(e=>({...e,field:e.field.includes(`.`)||e.field.includes(`[`)?e.field:`${t}.${e.field}`}))}}function uhe(e,t){return sr.resolveFieldSchemaPath(e,t)}function tR({name:e,schema:t,label:n,description:r,tooltip:i,labelPlacement:a,hideLabel:o,hideDescription:s,controlSize:c,respectSurfaceErrorPlacement:l,enumLabels:u,allowedValues:d,as:f,validationMode:p,disabled:m,readOnly:h,className:g,placeholder:_,type:v,renderField:b,sectionAppearance:x,objectItemLayout:S,fileUploadContext:C,autoFocus:w,excludedChildKeys:T,quickCreateSourceFieldName:E}){let D=rw(),O=KD(),k=oc(),{registry:A}=wm(),j=Q.useContext(Mi)?.appConfig,{tErrorValidation:M,t:N,isReady:P}=K({keys:[`errors_validation`]}),F=ZT(),I=zD(e),L=F?.allowedValuesByField?.[I],R=d??L?.values;BM(I),Ok(I),eA([I]);let z=!/\.\d+(\.|$)/.test(I),B=t??uhe(F?.schema,I),ne=(0,Q.useMemo)(()=>B?sre(j,lr(B)):void 0,[B,j]),re=Wde({declaration:F?.requestFieldOffers?.[I],record:F?.requestFieldOfferRecord,appConfig:j,fieldName:I}),ie=(0,Q.useMemo)(()=>{if(!B)return;let e=sc(B),t=e===bc.ARRAY?te(B):void 0,n=ne??(e===bc.ENUM?qc(B):void 0)??(t&&sc(t)===bc.ENUM?qc(t):void 0);return qs(re,n)},[B,ne,re]),ae=!!B&&!R&&sc(B)===bc.STRING&&et(B)===Qs.ORGANIZATION_ROLE,oe=ae?void 0:ie,se=ae?F?.roleGrantPickerOffersByField?.[I]:void 0,ce=(0,Q.useMemo)(()=>se?ie?ie.filter(e=>se.includes(e)):se:ie,[ie,se]),le=oe?R?R.filter(e=>oe.includes(e)):oe:R??ne,ue=F?.reportRequestFieldOffer,de=!!F?.requestFieldOffers?.[I];(0,Q.useEffect)(()=>{de&&ue?.(I,re)},[de,ue,I,re]);let fe=sr.labelDictionaryPath(I),pe=n??F?.fieldLabels?.[fe]??e,me=r??F?.fieldDescriptions?.[fe],he=i??F?.fieldTooltips?.[fe],ge=u??F?.enumLabels?.[fe]??(d?void 0:L?.labels),_e=m??F?.disabled,ve=C??F?.fileUploadContext,ye=F?.generatedFieldOverrides?.[I],be=[...Object.keys(F?.contextFieldValues??{}),...F?.hiddenFieldNames??[],...Object.keys(F?.generatedFieldOverrides??{})],xe=ye==null&&che(I,be),Se=B?Or(B):void 0,Ce=I.includes(`.`)?I.slice(0,I.lastIndexOf(`.`)):``,we=Se?lhe(Se,Ce):void 0,Te=we?sr.getShowWhenWatchFields(we):[],Ee=ew({name:Te.length>0?Te:[]}),De=Array.isArray(Ee)?Ee:Te.length>0?[Ee]:[],Oe=ew({name:F?.inheritanceConfig?.discriminatorField?[F.inheritanceConfig.discriminatorField]:[]}),ke=Array.isArray(Oe)?Oe[0]:Oe,Ae=I.match(/^[^.[\]]+/)?.[0]??I,je=(0,Q.useMemo)(()=>{if(!we)return!0;let e=Object.fromEntries(Te.map((e,t)=>[e,De[t]]));return sr.evaluateShowWhen(we,e)},[we,Te,De]),Me=(0,Q.useMemo)(()=>!F?.inheritanceConfig?.discriminatorField||sr.computeFieldVisibility(F.schema,Ae,{[F.inheritanceConfig.discriminatorField]:ke},F.inheritanceConfig),[ke,F?.inheritanceConfig,F?.schema,Ae]),Ne=B?sc(B):bc.STRING,Pe=B?uo(B):void 0,Fe=F?.hostResolvesRelationshipRoots===!0,Ie=(0,Q.useMemo)(()=>{if(!(Fe||!B||!O.resourceType||Ne!==bc.OBJECT&&Ne!==bc.ARRAY))return jj({resourceType:O.resourceType,fieldName:I,operationType:O.operationType,registry:A})},[Fe,B,O.operationType,O.resourceType,I,A,Ne]),Le=Ne===bc.STRING||Ne===bc.CODE||Ne===bc.NUMBER||Ne===bc.BIGINT||Ne===bc.MONEY||Ne===bc.BIGDECIMAL,Re=B?she(B,p,O.validationMode,Ne):p??O.validationMode??pr.ON_BLUR,ze=h??F?.readOnly??(B?Us(B,O.operationType):!1),Be=Fme[Ime({schemaKind:O?.schemaKind,rootSchema:F?.schema,fieldName:I})],Ve=Be.normalizeClearedValue,He=B?Be.isClearable(B):!1,{createBlurHandler:Ue,createChangeHandler:We,autosaveFieldState:Ge,autosaveError:Ke,handleRetrySave:qe,saveFieldNow:Ye}=ihe(D,I,Re,Le,B,Ve),Xe=w??(F?void 0:Pe?.autoFocus),Ze=Pe,Qe=the({identifier:Ze?.autoComplete,modifier:Ze?.autoCompleteModifier}),tt=(0,Q.useMemo)(()=>B?!$te(B):!1,[B]),nt=Q.useContext(RT),rt=(0,Q.useRef)(Symbol(`file-field-validation`)).current;(0,Q.useEffect)(()=>()=>{nt?.delete(rt)},[nt,rt,I]);let{setError:it,clearErrors:at,getFieldState:ot}=D,st=(0,Q.useCallback)(e=>{let t=e=>{let t=ot(I).error;(t?.type!==`file-validation`||t.message!==e)&&it(I,{type:uI,message:e})};if(e)nt?.set(rt,{name:I,message:e}),t(e);else{nt?.delete(rt);let e=[...nt?.values()??[]].find(e=>e.name===I);if(e){t(e.message);return}ot(I).error?.type===`file-validation`&&at(I)}},[it,at,ot,I,nt,rt]),ct=D.getFieldState(I,D.formState),lt=fI(ct,D.formState.isSubmitted,Re,M),{formChromeMode:ut,sectionChromeMode:dt}=fT(),ft=YL(k.autoRender?.autoFieldChrome),pt=Pe?.chromeMode??dt??ut??ft,mt=a??XL(k.autoRender?.autoLabelPlacement),ht=c??ZL(k.autoRender?.autoFieldDensity),gt=l!==!1&&k.autoRender?.autoErrorPlacement===`summary-at-surface-top`,_t=re.kind===Are.NOT_OFFERED,vt=!!B&&(xe||!je||!Me||_t);if(Mk(!!B&&!vt),(0,Q.useEffect)(()=>{vt&&!z&&I&&D.getValues(I)!==void 0&&D.setValue(I,void 0,{shouldDirty:!1,shouldValidate:!1})},[vt,z,I,D]),(0,Q.useEffect)(()=>{if(!ie||!I)return;let e=D.getValues(I);if(e==null)return;let t=new Set(ie);if(Array.isArray(e)){let n=e.filter(e=>t.has(String(e)));n.length!==e.length&&D.setValue(I,n,{shouldDirty:!0,shouldValidate:!1})}else t.has(String(e))||D.setValue(I,void 0,{shouldDirty:!0,shouldValidate:!1})},[ie,I,D]),!B||vt)return null;if(ye!=null)return(0,$.jsx)($.Fragment,{children:ye});let yt=Pe?.forceHide,bt={mode:pt,label:pe,description:me,tooltip:he,labelPlacement:mt,error:lt,required:tt,hideLabel:o??yt?.label,hideDescription:s??yt?.description,hideError:yt?.error||gt,saveState:Ge,saveErrorMessage:Ke,onRetrySave:qe,onSaveFieldNow:Ye,fieldName:I,disabled:_e,className:g},xt={schema:B,clearable:He,name:I,disabled:_e,readOnly:ze,validationMode:Re,required:tt,autoFocus:Xe||void 0,controlSize:ht},St=!(!Ie||Ie.semantics.nature===cl.COMPOSITION&&Ie.nestedMutationConfig),Ct=Ne===bc.RANGE_NUMBER||Ne===bc.RANGE_DATE||Ne===bc.RANGE_DATETIME||Ne===bc.RANGE_TIME||Ne===bc.RANGE_BIGDECIMAL||Ne===bc.RANGE_MONEY;if(Ct){let e=Je(B),t=f??Pe?.component??Cee(e??$e.NUMBER);return(0,$.jsx)(tw,{name:I,control:D.control,shouldUnregister:z,render:({field:e})=>{let n=Ue(e.onBlur),r=We(e.onChange),i={...xt,value:$L(D.getValues(I)),onBlur:n},a=(()=>{let n=e.ref;switch(t){case cu.RANGE_SLIDER:return(0,$.jsx)(tN,{...i,onValueChange:r,ref:n});case cu.DATE_RANGE:return(0,$.jsx)(vN,{...i,onChange:r,ref:n});case cu.DATETIME_RANGE:return(0,$.jsx)(xN,{...i,onChange:r,ref:n});case cu.TIME_RANGE:return(0,$.jsx)(wN,{...i,onChange:r,ref:n});case cu.BIGDECIMAL_RANGE:return(0,$.jsx)(bL,{...i,onChange:r,ref:n});case cu.MONEY_RANGE:return(0,$.jsx)(SL,{...i,onChange:r,ref:n});default:return{[bc.RANGE_BIGDECIMAL]:(0,$.jsx)(bL,{...i,onChange:r,ref:n}),[bc.RANGE_MONEY]:(0,$.jsx)(SL,{...i,onChange:r,ref:n}),[bc.RANGE_DATE]:(0,$.jsx)(vN,{...i,onChange:r,ref:n}),[bc.RANGE_DATETIME]:(0,$.jsx)(xN,{...i,onChange:r,ref:n}),[bc.RANGE_TIME]:(0,$.jsx)(wN,{...i,onChange:r,ref:n}),[bc.RANGE_NUMBER]:(0,$.jsx)(hN,{...i,onChange:r,ref:n})}[Ne]??(0,$.jsx)(tN,{...i,onValueChange:r,ref:n})}})();return(0,$.jsx)(ZM,{...bt,children:a})}})}let wt=e=>(0,$.jsx)(HE,{fieldName:I,label:pe,disabled:_e,onSaveFieldNow:Ye,children:e});if(Ne===bc.OBJECT){if(St)return null;let e=ee(B),t=e?mme(j,e):void 0;return t?V(e=>(0,$.jsx)(TI,{...xt,types:t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):wt((0,$.jsx)(EN,{name:I,schema:B,label:pe,hideLabel:o,description:me,disabled:_e,className:g,renderField:b,excludedChildKeys:T}))}if(Ne===bc.RECORD){let e=_c(B);return e?wt((0,$.jsx)(kN,{name:I,schema:B,label:pe,description:me,disabled:_e,className:g,valueSchema:e,keySchema:null})):null}if(Ne===bc.MAP){let e=dl(B);return e?wt((0,$.jsx)(kN,{name:I,schema:B,label:pe,description:me,disabled:_e,className:g,valueSchema:e.valueSchema,keySchema:e.keySchema})):null}if(Ne===bc.ARRAY)return St?null:(0,$.jsx)(SI,{name:I,schema:B,label:pe,description:me,disabled:_e,className:g,renderField:b,sectionAppearance:x,objectItemLayout:S,enumLabels:ge,allowedValues:le});function V(e,t){return(0,$.jsx)(tw,{name:I,control:D.control,shouldUnregister:z,render:({field:n})=>(0,$.jsx)(ZM,{...bt,...t,children:e({value:$L(D.getValues(I)),onChange:We(n.onChange),onBlur:Ue(n.onBlur),ref:n.ref})})})}if(le){let e=lr(B),t=t=>{if(!e)return;let n=Bo(e,t),r=N(n);return r===n?void 0:r},n=le.map(e=>({value:e,label:ge?.[e]??t(e)??e}));return V(e=>(0,$.jsx)(lI,{...xt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,options:n}))}let Tt=f;if(Tt&&!Ct)switch(Tt){case cu.INPUT:case cu.TEXTAREA:return V(e=>(0,$.jsx)(YI,{...xt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_,autoComplete:Qe,type:v}));case cu.SLIDER:return V(e=>(0,$.jsx)(ZI,{...xt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));case cu.CHECKBOX:case cu.SWITCH:return V(e=>(0,$.jsx)(PI,{...xt,checked:e.value,onCheckedChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));case cu.SELECT:case cu.RADIO_GROUP:case cu.CHECKBOX_GROUP:{let e=ge?rR(B,ge):void 0;return V(t=>(0,$.jsx)(lI,{...xt,value:t.value,onChange:t.onChange,onBlur:t.onBlur,ref:t.ref,options:e}))}case cu.DATE:return V(e=>(0,$.jsx)(sN,{...xt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));case cu.DATETIME:return V(e=>(0,$.jsx)(uN,{...xt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));case cu.TIME:return V(e=>(0,$.jsx)(pN,{...xt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}))}if(Ne===bc.MONEY)return V(e=>(0,$.jsx)(eL,{...xt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Ne===bc.DURATION)return V(e=>(0,$.jsx)(nL,{...xt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Ne===bc.PHONE)return V(e=>(0,$.jsx)(lL,{...xt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_,autoComplete:Qe}));if(Ne===bc.ADDRESS){let e=Object.fromEntries(Ni().map(e=>[e,fI({...D.getFieldState(`${I}.${e}`,D.formState),isTouched:ct.isTouched,isDirty:ct.isDirty},D.formState.isSubmitted,Re,M)])),t=ct.error;return V(t=>(0,$.jsx)(mL,{...xt,value:t.value,onChange:t.onChange,onBlur:t.onBlur,ref:t.ref,partErrors:e,renderLookup:e=>(0,$.jsx)(Rx,{host:e,addressSchema:B,fieldName:I})}),t!==void 0&&(t.message!==void 0||t.type!==void 0)?void 0:{error:void 0})}if(Ne===bc.BIGDECIMAL)return V(e=>(0,$.jsx)(_L,{...xt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Ne===bc.CODE)return V(e=>(0,$.jsx)(vL,{...xt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));if(Ne===bc.FILE){let e=sr.normalizeSchemaFieldPath(I),t=ve?.[e],n=Do(B);return!n&&rhe(t)?V(e=>(0,$.jsx)(JL,{...xt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,endpoints:t,onValidationError:st}),{wideControl:!0}):n?(0,$.jsx)(ZM,{...bt,children:(0,$.jsx)(eR,{inputProps:xt,value:D.getValues(I),isGeneratedPdfField:!0})}):V(e=>(0,$.jsx)(ZM,{...bt,children:(0,$.jsx)(eR,{inputProps:xt,value:e.value,isGeneratedPdfField:!1,onBlur:e.onBlur,inputRef:e.ref})}))}if(y(B))return V(e=>(0,$.jsx)(CI,{...xt,quickCreateSourceFieldName:E,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));if(Ne===bc.BOOLEAN)return V(e=>(0,$.jsx)(PI,{...xt,checked:e.value,onCheckedChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Ne===bc.STRING)return V(e=>(0,$.jsx)(YI,{...xt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_,autoComplete:Qe,type:v,...ae&&ce?{offeredValues:ce}:{}}));if(Ne===bc.NUMBER||Ne===bc.BIGINT)return V(e=>(0,$.jsx)(ZI,{...xt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));if(Ne===bc.ENUM){let e=ge?rR(B,ge):void 0;return V(t=>(0,$.jsx)(lI,{...xt,value:t.value,onChange:t.onChange,onBlur:t.onBlur,ref:t.ref,options:e}))}return Ne===bc.DATE?V(e=>(0,$.jsx)(sN,{...xt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):Ne===bc.DATETIME?V(e=>(0,$.jsx)(uN,{...xt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):Ne===bc.TIME?V(e=>(0,$.jsx)(pN,{...xt,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):(0,$.jsx)(ZM,{...bt,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-element px-card-sm py-card-sm rounded-md border border-destructive bg-destructive/10 text-destructive text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Unsupported field type:`}),(0,$.jsx)(`code`,{className:`bg-destructive/20 px-item-xs rounded`,children:Ne}),(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e,`)`]})]})})}tR.displayName=`FormField`;var nR=tR;Lk(nR,Pk.FIELD_SLOT);function rR(e,t){return qc(e).map(e=>({value:e,label:t?.[e]??e}))}var iR=Jo.getLogger();function aR(e,t){let n=e instanceof Tj?e.mutationError:void 0,r=n?n.validationErrors?LM({httpStatus:n.status??400,validationErrors:n.validationErrors}):null:LM(e);if(!r)return;let i=Object.keys(r.validationErrors).find(e=>e===t||e.startsWith(`${t}.`));return i===void 0?void 0:r.validationErrors[i]}var oR=iR.debugByType(`DisplayFieldEditable`);iR.setDebugTypeLogging(`DisplayFieldEditable`,!1);function sR(e,t){return t.some(t=>e===t||e.startsWith(t+`[`)||AM(t,e))}function dhe(e){return!!(e?.upload||e?.override)}var fhe={mode:`direct`,saveOn:`blur`,showSaveButton:!1,showCancelButton:!0};function cR(e){let{schema:t,schemaType:n,value:r,fieldName:i,label:a,description:o,tooltip:s,provenance:c,enumLabels:l,displayComponent:u,parentData:d,resourceLinkTrail:f,className:p,hideLabel:m,hideDescription:h,resolvedChromeMode:g,resolvedLabelPlacement:_,resolvedEmptyValue:v,fileUploadContext:y,wideValue:b,announceName:x,doInlineUpdate:S,rmm:C}=e,{tComponent:w,tErrorValidation:T,isReady:E}=K({component:[J.LOW_LEVEL_FORM_FIELD,J.LOW_LEVEL_BUTTON]}),{getRecipe:D}=e_(),{renderIcon:O}=Rf(),k=wj(),{registry:A}=wm(),j=D(wi.INDICATOR,si.SUCCESS),[M,N]=(0,Q.useState)(GT.DISPLAY),[P,F]=(0,Q.useState)(null),I=(0,Q.useRef)(null),ee=(0,Q.useRef)(null),L=(0,Q.useRef)(null),R=(0,Q.useRef)(null),[te,z]=(0,Q.useState)(!1),[B,ne]=(0,Q.useState)(null),[re,ie]=(0,Q.useState)(!1),[ae,oe]=(0,Q.useState)(!1),se=(0,Q.useRef)(r);(0,Q.useEffect)(()=>{se.current!==r&&(ie(!1),oe(!1),ne(null),se.current=r)},[r]);let ce=M!==GT.DISPLAY,le=M===GT.SAVING,ue=C??null,de=(0,Q.useSyncExternalStore)(ue?.subscribe??NM,ue?.getSnapshot??PM),fe=Wne(t)??fhe,pe=(0,Q.useMemo)(()=>{if(i&&k.resourceType)return Nj({resourceType:k.resourceType,fieldName:i,operationType:W.UPDATE,registry:A})},[i,A,k.resourceType]),me=(0,Q.useMemo)(()=>{if(i)return y?.[sr.normalizeSchemaFieldPath(i)]},[i,y]),he=n!==bc.FILE||!Do(t)&&dhe(me),ge=(0,Q.useMemo)(()=>i?.includes(`.`)?i.split(`.`).pop():i??`value`,[i]),_e=(0,Q.useMemo)(()=>Vd({[ge]:t}),[ge,t]),ve=qw({resolver:MT(_e),defaultValues:{[ge]:r},mode:UT});(0,Q.useEffect)(()=>{M===GT.DISPLAY&&(ve.reset({[ge]:r}),F(null))},[r,M,ve,ge,t]),(0,Q.useEffect)(()=>{if(ce&&I.current){let e=setTimeout(()=>{let e=I.current?.querySelector(`input, textarea, select, [tabindex]:not([tabindex="-1"])`);e&&e.focus()},0);return()=>clearTimeout(e)}},[ce]),(0,Q.useEffect)(()=>{M===GT.ERROR&&ee.current?.focus()},[M]),(0,Q.useEffect)(()=>()=>{L.current!=null&&clearTimeout(L.current)},[]);let ye=(0,Q.useCallback)(async()=>{if(i){if(!await ve.trigger(ge))ve.setValue(ge,ve.getValues(ge),{shouldTouch:!0,shouldDirty:!1,shouldValidate:!1}),N(GT.EDITING);else{F(null),N(GT.SAVING);try{let e=ve.getValues(ge);await S(i,e),oR(`inline edit save`,{fieldName:i,value:e}),N(GT.SAVED),L.current=setTimeout(()=>{N(GT.DISPLAY),L.current=null},500)}catch(e){if(e instanceof Tj&&e.mutationError?.type===TE.CONFLICT)return;let t=aR(e,i);if(t!==void 0){let e=ma(t)?T(t.code,`msg`,t.params):t;ve.setError(ge,{type:vT,message:e}),N(GT.EDITING);return}F(w(J.LOW_LEVEL_FORM_FIELD,`save_failed`)),N(GT.ERROR)}}}},[ve,ge,i,S,w,T]);(0,Q.useEffect)(()=>{let e=ve.watch((e,{name:t})=>{t===ge&&ve.getFieldState(ge).error?.type===`server`&&ve.clearErrors(ge)});return()=>e.unsubscribe()},[ve,ge]);let be=(0,Q.useCallback)(()=>{i&&oR(`inline edit cancel`,{fieldName:i}),ve.reset({[ge]:r}),F(null),N(GT.DISPLAY)},[ve,ge,r,i]),xe=(0,Q.useCallback)(async e=>{if(i){ne(e),F(null),z(!0);try{await S(i,e),oR(`inline boolean toggle`,{fieldName:i,value:e})}catch(e){if(ne(null),!(e instanceof Tj&&e.mutationError?.type===TE.CONFLICT)){let t=aR(e,i);F(t===void 0?w(J.LOW_LEVEL_FORM_FIELD,`save_failed`):ma(t)?T(t.code,`msg`,t.params):t)}}finally{z(!1)}}},[i,S,w,T]),Se=(0,Q.useRef)(w);Se.current=w,(0,Q.useEffect)(()=>{if(!ue||!de?.lastEvent||!i)return;let e=de.lastEvent;if(e.id!==R.current)switch(R.current=e.id,e.type){case SE.REMOTE_UPDATE:sR(i,e.changedFields)&&M===GT.EDITING&&(oR(`RMM event cancelling inline edit`,{fieldName:i,eventType:e.type}),be());break;case SE.CONFLICT_RESET:{let t=MM(e.currentData,i);ve.reset({[ge]:t}),M!==GT.DISPLAY&&(oR(`RMM event resetting inline edit after conflict`,{fieldName:i,eventType:e.type}),F(Se.current(J.LOW_LEVEL_FORM_FIELD,`field_reset_after_conflict`)),N(GT.ERROR));break}case SE.MUTATION_RESULT:e.result.success&&e.source.type!==wE.DISPLAY&&e.result.savedFields&&sR(i,e.result.savedFields)&&M===GT.EDITING&&(oR(`RMM event cancelling inline edit`,{fieldName:i,eventType:e.type}),be());break;case SE.RESOURCE_DELETED:M===GT.EDITING&&(oR(`RMM event cancelling inline edit`,{fieldName:i,eventType:e.type}),be())}},[de?.lastEvent?.id,ue,i,M,ge,ve,be]);let Ce=(0,Q.useCallback)(e=>{if(fe.saveOn===`blur`&&I.current){let t=e.relatedTarget;I.current.contains(t)||ye()}},[fe.saveOn,ye]),we=n===bc.CODE||$re(t),Te=(0,Q.useCallback)(e=>{e.key===`Escape`?(e.preventDefault(),be()):e.key===`Enter`&&(we?(e.ctrlKey||e.metaKey)&&(e.preventDefault(),ye()):e.shiftKey||(e.preventDefault(),ye()))},[ye,be,we]);function Ee(){return(0,$.jsx)(EM,{schema:t,schemaType:n,value:r,fieldName:i,label:a,className:p,enumLabels:l,displayComponent:u,parentData:d,resourceLinkTrail:f,emptyValue:v,fileUploadContext:y,showAllArrayItems:re,onExpandArrayItems:()=>ie(!0),showAllObjectFields:ae,onExpandObjectFields:()=>oe(!0)})}function De(){let e=B??!!r;return(0,$.jsxs)(`div`,{className:`inline-flex items-center gap-element`,children:[te&&(0,$.jsx)(`span`,{className:`text-muted-foreground`,"aria-hidden":`true`,children:O(H.LOADER_2,{size:fa.SM,className:`animate-spin motion-reduce:animate-none`})}),P&&!te&&(0,$.jsx)(`span`,{className:`text-destructive text-xs`,role:`alert`,children:P}),(0,$.jsx)(OI,{checked:e,onCheckedChange:xe,disabled:te,"aria-label":a||i||void 0})]})}function Oe(){return(0,$.jsxs)(X,{type:`button`,variant:Y.GHOST,className:U(`group relative inline-flex items-center gap-element h-auto px-card-sm py-item-xs`),onClick:()=>{i&&oR(`inline edit start`,{fieldName:i}),N(GT.EDITING)},"aria-label":w(J.LOW_LEVEL_FORM_FIELD,`editField`,{label:a||i||``}),children:[(0,$.jsx)(`span`,{className:`flex-1`,children:Ee()}),(0,$.jsx)(`span`,{className:`text-muted-foreground opacity-0 group-hover:opacity-100 motion-safe:transition-opacity`,children:O(H.EDIT,{size:fa.SM})})]})}function ke(){let e=i?`inline-edit-error-${i.replace(/\./g,`-`)}`:void 0,n=M===GT.ERROR&&!!P;return(0,$.jsx)(_T,{schema:_e,schemaKind:mT.MAIN_SCHEMA,form:ve,resourceType:k.resourceType,resourceId:k.resourceId,operationType:W.UPDATE,contextResourceIdentifiers:k.contextResourceIdentifiers,navigationZone:k.navigationZone,children:(0,$.jsxs)(`div`,{ref:I,className:`inline-flex flex-col gap-item-xs min-w-[200px]`,onBlur:Ce,onKeyDown:Te,"aria-describedby":n?e:void 0,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-element`,children:[(0,$.jsx)(`div`,{className:`flex-1`,children:(0,$.jsx)(nR,{name:ge,quickCreateSourceFieldName:pe?.sourceFieldName,schema:t,label:``,description:``,disabled:le,placeholder:a,enumLabels:l,respectSurfaceErrorPlacement:!1,fileUploadContext:me?{[ge]:me}:void 0,className:`inline-edit-field`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-item-xs shrink-0 pt-item-xs`,children:[M===GT.SAVED&&(0,$.jsx)(`div`,{className:j.base,"aria-hidden":`true`,children:O(H.CHECK,{size:fa.SM})}),fe.showSaveButton&&M!==GT.SAVED&&(0,$.jsx)(X,{type:`button`,size:Xd.SM,variant:Y.DEFAULT,onClick:ye,disabled:le,"aria-label":w(J.LOW_LEVEL_BUTTON,`save`),children:M===GT.SAVING?O(H.LOADER_2,{size:fa.SM,className:`animate-spin motion-reduce:animate-none`}):O(H.CHECK,{size:fa.SM})}),fe.showCancelButton&&(0,$.jsx)(X,{type:`button`,size:Xd.SM,variant:Y.GHOST,onClick:be,disabled:le,"aria-label":w(J.LOW_LEVEL_BUTTON,`cancel`),children:O(H.CLOSE,{size:fa.SM})})]})]}),n&&(0,$.jsxs)(UD,{id:e,variant:`destructive`,role:`alert`,className:`flex items-center gap-element py-card-sm`,children:[O(H.ERROR,{size:fa.SM,className:`shrink-0`}),(0,$.jsx)(GD,{className:`flex-1 m-0`,children:(0,$.jsx)(Z,{children:P})}),(()=>{let e=w(J.LOW_LEVEL_BUTTON,`retry`);return(0,$.jsx)(X,{ref:ee,type:`button`,size:Xd.SM,variant:Y.GHOST,onClick:ye,disabled:le,"aria-label":e,title:e,children:O(H.TRY_AGAIN,{size:fa.SM})})})()]})]})})}if(!E)return null;let Ae;return Ae=n===bc.BOOLEAN&&i?De():ce&&i&&he?ke():he?Oe():Ee(),(0,$.jsx)(xj,{mode:g,label:a,description:o,tooltip:s,provenance:c,name:i,labelPlacement:_,hideLabel:m,hideDescription:h,wide:b,announceName:x,className:p,children:Ae})}cR.displayName=`DisplayFieldEditable`;function lR({name:e,schema:t,value:n,label:r,description:i,doInlineUpdate:a,renderField:o,sectionAppearance:s,displayChromeMode:c,objectItemLayout:l,enumLabels:u,hideLabel:d}){let f=(0,Q.useMemo)(()=>e.includes(`.`)?e.split(`.`).pop():e,[e]),p=(0,Q.useMemo)(()=>Vd({[f]:t}),[f,t]),m=(0,Q.useMemo)(()=>({[f]:Array.isArray(n)?n:[]}),[f,n]),h=qw({defaultValues:m,mode:`onChange`}),g=(0,Q.useRef)(null),_=(0,Q.useRef)(JSON.stringify(Array.isArray(n)?n:[]));(0,Q.useEffect)(()=>{let e=Array.isArray(n)?n:[],t=JSON.stringify(e);if(t===_.current)return;let r=typeof document<`u`?document.activeElement:null;r&&g.current?.contains(r)||(h.reset({[f]:e}),_.current=t)},[n,h,f]);let v=wj(),y=e.includes(`.`)?e.slice(0,e.lastIndexOf(`.`)):void 0,b=mE(p,{resourceType:v.resourceType,operationId:W.UPDATE},m,`edit`,{fieldPathPrefix:y}),x=(0,Q.useMemo)(()=>({schema:p,fieldLabels:b.fieldLabels,fieldDescriptions:b.fieldDescriptions,fieldTooltips:b.fieldTooltips,enumLabels:b.enumLabels,sectionLabels:b.sectionLabels,sectionDescriptions:b.sectionDescriptions,groupLabels:b.groupLabels,wizardStepLabels:b.wizardStepLabels,wizardStepDescriptions:b.wizardStepDescriptions,operationType:W.UPDATE,isExisting:!0}),[p,b]),S=d===!0||c===Ho.HIDDEN||c===Ho.COMPACT,C=(0,Q.useMemo)(()=>({enabled:!0}),[]),{tComponent:w}=K({component:J.RESOURCES_LAYOUTS_CREATE}),T=(0,Q.useMemo)(()=>({errorNetwork:w(J.RESOURCES_LAYOUTS_CREATE,`autosaveErrorNetwork`),errorValidation:w(J.RESOURCES_LAYOUTS_CREATE,`autosaveErrorValidation`),errorGeneric:w(J.RESOURCES_LAYOUTS_CREATE,`autosaveErrorGeneric`),errorConflict:w(J.RESOURCES_LAYOUTS_CREATE,`autosaveErrorConflict`),errorResourceDeleted:w(J.RESOURCES_LAYOUTS_CREATE,`autosaveErrorResourceDeleted`)}),[w]),E=(0,Q.useCallback)(async()=>{await a(e,h.getValues(f))},[a,e,h,f]);return(0,$.jsx)(iw,{...h,children:(0,$.jsx)(_T,{schema:p,form:h,resourceType:v.resourceType,resourceId:v.resourceId,operationType:W.UPDATE,contextResourceIdentifiers:v.contextResourceIdentifiers,navigationZone:v.navigationZone,children:(0,$.jsx)(YT,{value:x,children:(0,$.jsx)(zE,{onSave:E,labels:T,config:C,children:(0,$.jsx)(`div`,{ref:g,children:(0,$.jsx)(SI,{name:f,schema:t,label:r,description:i,renderField:o,sectionAppearance:s,objectItemLayout:l,enumLabels:u,hideLabel:S,chromeMode:c===Ho.SETTINGS_ROW?io.SETTINGS_ROW:void 0})})})})})})}lR.displayName=`DisplayFieldEditableArray`;var phe=lR,mhe=Yd({slug:kd().regex(Dl,`A slot slug is lowerCamelCase with no separators.`).max(40).refine(e=>e!==Kc,{error:`"${Kc}" is reserved: the environment builder emits ${Zne(`example`)} itself to say an environment has no access to an instance. A slot of that name would make "declared absent" indistinguishable from an address whose value happens to be false.`}),required:Ld(),description:kd().min(1)}),uR=e=>Ud(mhe).superRefine((t,n)=>{let r=new Set;for(let[i,a]of t.entries())r.has(a.slug)&&n.addIssue({code:`custom`,path:[i,`slug`],message:`Duplicate ${e} slot "${a.slug}".`}),r.add(a.slug),i>0&&t[i-1].slug.localeCompare(a.slug)>=0&&n.addIssue({code:`custom`,path:[i,`slug`],message:`${e} slots must be sorted by slug.`})});Yd({addressSlots:uR(`credential address`),secretSlots:uR(`credential secret`)});var hhe={[Tc.ODOO_API_KEY_IN_ARGS]:{addressSlots:[{slug:`login`,required:!0,description:"The Odoo user login the API key belongs to. `common.authenticate` resolves it to the uid every `execute_kw` call then acts as, so it decides what the application can read. JSON-RPC only: a JSON-2 key names its user itself."}],secretSlots:[{slug:`apiKey`,required:!0,description:"Odoo external-API key (Settings → Users → API Keys). It replaces the password in `common.authenticate` and rides as a positional argument of every `execute_kw` call."}]},[Tc.API_KEY_HEADER]:{addressSlots:[],secretSlots:[{slug:`apiKey`,required:!0,description:`The static key this deployment presents. It travels in the header the vendor facet names — the operator never chooses the header, only supplies the key.`}]},[Tc.API_KEY_QUERY]:{addressSlots:[],secretSlots:[{slug:`apiKey`,required:!0,description:`The static key this deployment presents, appended as the query parameter the vendor facet names. Weaker than a header — a URL reaches access logs and proxy logs — so prefer a header kind when the vendor offers one.`}]},[Tc.BASIC]:{addressSlots:[{slug:`username`,required:!0,description:`The user this deployment authenticates as (SAP calls it a communication user). It names an identity rather than proving one, so it is authored in the environment config beside the base URL. It may not contain ":" — RFC 7617 makes the colon the delimiter.`}],secretSlots:[{slug:`password`,required:!0,description:`That user's password. Half of one credential; rotate it with the username only if the vendor requires.`}]},[Tc.OAUTH2_CLIENT_CREDENTIALS_SECRET]:{addressSlots:[{slug:`audience`,required:!1,description:"The `audience` / `resource` parameter, when the vendor requires one to scope the token (Entra names the resource; Salesforce does not)."},{slug:`clientId`,required:!0,description:`The registered application (client) id. Names WHICH client, so it is addressing rather than proof.`},{slug:`scope`,required:!1,description:`Space-delimited scopes to request. Omitted when the vendor derives them from the client registration.`},{slug:`tokenUrl`,required:!0,description:`The token endpoint's absolute URL. Kind-owned: no vendor would declare it if the instance were reached with a static key.`}],secretSlots:[{slug:`clientSecret`,required:!0,description:`The client secret issued with the client id. This is the half that proves the identity, and the only half that is never printed.`}]},[Tc.OAUTH2_CLIENT_CREDENTIALS_CERTIFICATE]:{addressSlots:[{slug:`audience`,required:!1,description:"The `audience` / `resource` parameter when the vendor requires one."},{slug:`certificateKeyId`,required:!1,description:"The key id the vendor assigned to this certificate, placed in the assertion's protected header as `kid` (NetSuite issues one at upload). REQUIRED when the vendor facet declares the key-id header policy; unused otherwise."},{slug:`certificatePem`,required:!1,description:"The PUBLIC certificate in PEM, used to derive the `x5t` thumbprint the assertion header carries. REQUIRED when the vendor facet declares the thumbprint header policy; unused otherwise. Public material, so it is an address slot rather than a secret."},{slug:`clientId`,required:!0,description:"The registered application (client) id — the assertion's `iss` and `sub`."},{slug:`scope`,required:!1,description:`Space-delimited scopes to request.`},{slug:`tokenUrl`,required:!0,description:"The token endpoint's absolute URL, and the assertion's `aud`."}],secretSlots:[{slug:`privateKeyPem`,required:!0,description:`The UNENCRYPTED PKCS#8 private key, in PEM, that signs the client assertion. An encrypted key is refused by name: the secret channel is the protection, and a passphrase stored beside the key it protects protects nothing.`}]},[Tc.OAUTH2_JWT_BEARER]:{addressSlots:[{slug:`audience`,required:!1,description:"The assertion's `aud`, when it differs from the token endpoint (Salesforce wants the login host)."},{slug:`clientId`,required:!0,description:"The connected app's consumer key — the assertion's `iss`."},{slug:`scope`,required:!1,description:`Space-delimited scopes to request.`},{slug:`subject`,required:!1,description:"The user the assertion is made FOR — its `sub`. REQUIRED for this grant and declared optional here only because the facet's offer is what asserts it; a service account's username on the vendor side."},{slug:`tokenUrl`,required:!0,description:`The token endpoint's absolute URL.`}],secretSlots:[{slug:`privateKeyPem`,required:!0,description:`The UNENCRYPTED PKCS#8 private key, in PEM, that signs the assertion. An encrypted key is refused by name.`}]},[Tc.MTLS_CLIENT_CERTIFICATE]:{addressSlots:[{slug:`caBundlePem`,required:!1,description:`The CA certificates, in PEM, that the SERVER's certificate must chain to, when the system of record is served by a private CA. Omitted when its certificate chains to a public CA the platform already trusts. Public material, so an address slot.`},{slug:`certificatePem`,required:!0,description:`The CLIENT certificate, in PEM, that the engine presents in the TLS handshake (SAP calls its holder an X.509 communication user). Public material, so an address slot. Refused at startup outside its validity window.`}],secretSlots:[{slug:`privateKeyPem`,required:!0,description:`The UNENCRYPTED PKCS#8 private key, in PEM, of that client certificate. An encrypted key is refused by name: the secret channel is the protection.`}]}},ghe=function(e){return e.KEY_ID_SUPPLIED=`key-id-supplied`,e.X509_THUMBPRINT_DERIVED=`x509-thumbprint-derived`,e}({}),_he=function(e){return e.REQUEST_BODY=`request-body`,e.BASIC_HEADER=`basic-header`,e}({}),dR=function(e){return e.RS256=`RS256`,e.RS384=`RS384`,e.RS512=`RS512`,e.PS256=`PS256`,e.ES256=`ES256`,e.ES384=`ES384`,e.ES512=`ES512`,e}({}),fR=Fd().int().min(30).max(86400),pR={dialects:Ud(Rd(v)).min(1).optional()},mR=Yie(`kind`,[Yd({kind:Nd(Tc.ODOO_API_KEY_IN_ARGS).systemEnum(`SystemOfRecordCredentialKind`),...pR}),Yd({kind:Nd(Tc.API_KEY_HEADER).systemEnum(`SystemOfRecordCredentialKind`),...pR,headerName:kd().regex(/^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/,`A header name is an RFC 9110 token.`).max(64),valuePrefix:kd().max(32).optional()}),Yd({kind:Nd(Tc.API_KEY_QUERY).systemEnum(`SystemOfRecordCredentialKind`),...pR,parameterName:kd().regex(/^[A-Za-z0-9_.-]+$/,`A query parameter name is alphanumeric with -._`).max(64)}),Yd({kind:Nd(Tc.BASIC).systemEnum(`SystemOfRecordCredentialKind`),...pR}),Yd({kind:Nd(Tc.OAUTH2_CLIENT_CREDENTIALS_SECRET).systemEnum(`SystemOfRecordCredentialKind`),...pR,clientAuthentication:Rd(_he),tokenLifetimeFallbackSeconds:fR}),Yd({kind:Nd(Tc.OAUTH2_CLIENT_CREDENTIALS_CERTIFICATE).systemEnum(`SystemOfRecordCredentialKind`),...pR,assertionHeaderPolicy:Rd(ghe),assertionSigningAlgorithm:Rd(dR),assertionLifetimeSeconds:Fd().int().min(30).max(600),tokenLifetimeFallbackSeconds:fR}),Yd({kind:Nd(Tc.OAUTH2_JWT_BEARER).systemEnum(`SystemOfRecordCredentialKind`),...pR,assertionSigningAlgorithm:Rd(dR),assertionLifetimeSeconds:Fd().int().min(30).max(600),tokenLifetimeFallbackSeconds:fR}),Yd({kind:Nd(Tc.MTLS_CLIENT_CERTIFICATE).systemEnum(`SystemOfRecordCredentialKind`),...pR})]),vhe=function(e){return e.SKIP=`skip`,e.NEXT_LINK_ONLY=`next-link-only`,e}({}),hR=function(e){return e.FIELD=`field`,e.PATH_SEGMENT=`path-segment`,e}({}),yhe=function(e){return e.SCALAR=`scalar`,e.MANY2ONE_PAIR=`many2one-pair`,e}({}),gR=Yd({kind:Rd(hR),remoteField:kd().min(1).max(120),codec:Rd(kte),valueShape:Rd(yhe)}),_R=function(e){return e.CSRF_TOKEN_HANDSHAKE=`csrf-token-handshake`,e}({}),bhe=`@odata.etag`;Yd({vendor:kd().regex(/^[a-z][a-z0-9-]*$/,`A vendor id is lower-kebab-case.`).max(40),dialects:Ud(Rd(v)).min(1),addressSlots:uR(`vendor address`),credentialOffers:Ud(mR).min(1),odataListPaging:Rd(vhe).optional(),partition:gR.optional(),incrementalExtractionModes:Ud(Rd(mc)).optional(),odataExpiredChangePositionErrorCodes:Ud(kd().regex(Vl)).optional(),actionCallShapes:Ud(Rd(Fee)).optional(),rowVersionField:kd().min(1).max(120).optional(),writePrerequisites:Ud(Rd(_R)).optional()}).superRefine((e,t)=>{e.rowVersionField!==void 0&&e.dialects.includes(v.ODATA)&&e.rowVersionField!==`@odata.etag`&&t.addIssue({code:`custom`,path:[`rowVersionField`],message:`An OData vendor's row version is its entity tag, "${bhe}" — got "${e.rowVersionField}".`});for(let[n,r]of(e.actionCallShapes??[]).entries())e.dialects.includes(Ha[r])||t.addIssue({code:`custom`,path:[`actionCallShapes`,n],message:`Action call shape "${r}" is spoken over ${Ha[r]}, which this vendor's dialects do not list.`});e.odataExpiredChangePositionErrorCodes!==void 0&&!(e.incrementalExtractionModes??[]).includes(mc.ODATA_DELTA_LINK)&&t.addIssue({code:`custom`,path:[`odataExpiredChangePositionErrorCodes`],message:`An expired change-position code is read only by the "${mc.ODATA_DELTA_LINK}" mode, which this vendor's incrementalExtractionModes do not list.`});let n=new Set;for(let[r,i]of e.dialects.entries())n.has(i)&&t.addIssue({code:`custom`,path:[`dialects`,r],message:`Duplicate dialects member "${i}".`}),n.add(i);let r=new Set;for(let[n,i]of e.credentialOffers.entries())r.has(i.kind)&&t.addIssue({code:`custom`,path:[`credentialOffers`,n],message:`Duplicate credentialOffers member "${i.kind}".`}),r.add(i.kind);for(let[n,r]of e.credentialOffers.entries())for(let i of r.dialects??[])e.dialects.includes(i)||t.addIssue({code:`custom`,path:[`credentialOffers`,n,`dialects`],message:`Credential offer "${r.kind}" is scoped to ${i}, which this vendor's dialects do not list.`});for(let[n,r]of e.dialects.entries())e.credentialOffers.some(e=>xhe(e,r))||t.addIssue({code:`custom`,path:[`dialects`,n],message:`No credential offer serves dialect "${r}".`});let i=new Set(e.addressSlots.map(e=>e.slug));for(let n of e.credentialOffers)for(let e of hhe[n.kind].addressSlots)i.has(e.slug)&&t.addIssue({code:`custom`,path:[`addressSlots`],message:`Address slot "${e.slug}" is declared by this vendor AND by credential kind "${n.kind}" — one slot has one owner.`})}),Yd({vendor:kd().regex(/^[a-z][a-z0-9-]*$/,`A vendor id is lower-kebab-case.`).max(40),partition:gR.optional(),credentialOffers:Ud(mR).min(1).optional()}).superRefine((e,t)=>{e.partition===void 0&&e.credentialOffers===void 0&&t.addIssue({code:`custom`,path:[],message:`A facet augmentation that adds nothing is refused: declare a partition, credential offers, or both.`});let n=new Set;for(let[r,i]of(e.credentialOffers??[]).entries())n.has(i.kind)&&t.addIssue({code:`custom`,path:[`credentialOffers`,r],message:`Duplicate credentialOffers member "${i.kind}".`}),n.add(i.kind)});function xhe(e,t){return e.dialects===void 0||e.dialects.includes(t)}Object.freeze({[v.ODATA]:{translatesSort:!0,sendsRowWrites:!0},[v.ODATA_V2]:{translatesSort:!0,sendsRowWrites:!1},[v.ODOO_JSONRPC]:{translatesSort:!0,sendsRowWrites:!0},[v.ODOO_JSON2]:{translatesSort:!0,sendsRowWrites:!0},[v.REST_JSON]:{translatesSort:!1,sendsRowWrites:!0}}),Object.freeze({[_R.CSRF_TOKEN_HANDSHAKE]:!1}),Object.freeze({[hR.FIELD]:!0,[hR.PATH_SEGMENT]:!1});function She(e){if(e.direction===N.OUTBOUND)return[];let t=new Set([e.remoteKeyLocalField]);e.partitionKeyLocalField&&t.add(e.partitionKeyLocalField),e.partitionUnitLocalField&&t.add(e.partitionUnitLocalField);for(let n of e.mapping)(e.direction!==N.BIDIRECTIONAL||aee(n)===vee.REMOTE)&&are(n).length>0&&t.add(n.localField);return[...t]}var Che=`external-data-provenance`,whe=Yd({system:Rl,currentAsOf:Zie().nullable()}),The=3e5,vR=new WeakMap;function Ehe(e){let t=vR.get(e);return t||(t=new Set(She(e)),vR.set(e,t)),t}function Dhe(e){let{resourceConfiguration:t,contextualParameters:n}=e,r=(t.operations??[]).filter(e=>pne(e,W.LIST));if(r.length!==1)return;let i=r[0].initiatorInfos??[];if(i.length===0)return;let a=V.selectOperationUrlInitiatorInfo({initiatorInfos:i,contextualParameters:n,targetResourceType:t.resourceIdentifier,targetDefaultFieldIdentifier:t.resourceFieldIdentifier});if(!a)return;let o=Ch.resolveUrlPath(`${rt}${a.url}`,n);if(o&&!Ch.hasUnresolvedPlaceholders(o))return`${o}/${Che}`}var yR=new WeakMap,bR=new Set;function Ohe(e){let t=yR.get(e);return t||(t={cache:new Map,inFlight:new Map},yR.set(e,t)),t}function khe(){for(let e of bR)e()}function Ahe(e){return bR.add(e),()=>{bR.delete(e)}}function jhe(e,t,n=Date.now()){let r=e&&t?yR.get(t)?.cache.get(e):void 0;return r?Math.max(0,r.fetchedAt+The-n):void 0}function Mhe(e,t){if(e&&t)return yR.get(t)?.cache.get(e)?.value}function xR(e,t,n=Date.now()){let{cache:r,inFlight:i}=Ohe(t),a=r.get(e);if(a&&n-a.fetchedAt<3e5||i.has(e))return;let o=(async()=>{let n;try{let r=whe.safeParse(await t.get(e,{silent:!0}));n=r.success?r.data:null}catch{n=null}r.set(e,{value:n,fetchedAt:Date.now()}),i.delete(e),khe()})();i.set(e,o)}function Nhe(e){let{resourceType:t,contextualParameters:n}=wj(),r=jm(),i=(0,Q.useContext)(Mi)?.httpClient,a=t?r?.registry.resourceConfigurations[t]:void 0,o=a?.externalDataPipeline,s=e.enabled&&!!o&&!!e.fieldName&&Ehe(o).has(e.fieldName),c=(0,Q.useMemo)(()=>s&&a?Dhe({resourceConfiguration:a,contextualParameters:n??{}}):void 0,[s,a,n]),l=(0,Q.useSyncExternalStore)(Ahe,()=>Mhe(c,i));return(0,Q.useEffect)(()=>{if(!c||!i)return;xR(c,i);let e=jhe(c,i);if(e===void 0)return;let t=setTimeout(()=>xR(c,i),e+1);return()=>clearTimeout(t)},[c,i,l]),(0,Q.useMemo)(()=>l?.currentAsOf?{system:l.system,currentAsOf:l.currentAsOf}:void 0,[l])}var SR=Jo.getLogger();function Phe(e){switch(e){case`stacked`:return Ho.STACKED;case`inline`:return Ho.INLINE;case`compact`:return Ho.COMPACT;default:return}}function Fhe(e){switch(e){case`em-dash`:case`placeholder`:case`hidden`:case`skeleton`:return e;default:return}}function Ihe(e){switch(e){case`top`:case`start`:case`inline`:case`hidden`:return e;default:return}}function CR(e,t){return!e||!t||t.length===0?!1:t.some(t=>e===t||e.startsWith(`${t}.`)||e.startsWith(`${t}[`))}function wR(e){let t=_k(),{pathPrefix:n}=RD(),r=oc(),i=XA(),a=e.name,o=a?n?`${n}.${a}`:a:void 0,s=e.schema??(o?xA(t?.schema,o):void 0),c=e.schemaType??(s?sc(s):void 0),l=e.value??(o?SA(t?.data,o):void 0),u=o===void 0?void 0:sr.labelDictionaryPath(o),d=o?sr.isArrayItemPath(o):!1,f=d?void 0:u,p=f?sr.unresolvedFieldLabel(f.split(`.`).pop()??f):void 0,m=e.label??(f?t?.fieldLabels?.[f]:void 0)??p,h=s?cte(s):!1,g=e.description??(f&&h?t?.fieldDescriptions?.[f]:void 0),_=e.tooltip??(f?t?.fieldTooltips?.[f]:void 0),v=e.enumLabels??(u?t?.enumLabels?.[u]:void 0),y=s?i===qA.SUMMARY?rl(s):Ys(s):void 0,b=e.displayComponent??y?.component,x=e.parentData??CA(t?.data,n||void 0),S=e.disableInlineEdit??!1,C=e.className,w=CR(o,t?.hiddenFieldNames),T=CR(o,t?.inlineEditDisabledFieldNames),{displayChromeMode:E,sectionChromeMode:D}=bk(),O=NA(),A=ij(),j=Phe(r.autoRender?.autoFieldChrome),M=i===qA.SUMMARY&&A&&y?.chromeMode===void 0&&D===void 0&&cj(c),N=y?.chromeMode??D??(M?Ho.INLINE:void 0)??E??j,P=e.labelPlacement??(y?.chromeMode===void 0?Ihe(r.autoRender?.autoLabelPlacement):void 0),F=e.labelStyle??y?.labelStyle,I=IA(c,y?.displayMode,s?Ro(s)?.mode:void 0),ee=t?.breakpoint,L=ee?EA(y?.forceHide,ee):y?.forceHide,R=L?.label===!0,te=L?.description===!0,z=e.hideLabel===!0||R,B=e.hideDescription===!0||te||M,{canInlineEdit:ne,doInlineUpdate:re,fileUploadContext:ie,rmm:ae,defaultInlineEdit:oe,defaultEmptyValue:se,parentReferenceConfig:ce,resourceType:le}=wj(),ue=jm()?.registry,de=se??Fhe(r.autoRender?.autoEmptyValue),fe=Nhe({fieldName:!n&&!d?o:void 0,enabled:i!==qA.SUMMARY&&!e.resourceLinkTrail}),pe=o&&s&&Bc(s),me=!!o&&!!s&&oe===k.WRITABLE_FIELDS&&Ua(s),he=!S&&!T&&ne&&(!!pe||me);if(w||s&&Gl(s))return(0,$.jsx)($.Fragment,{});let ge=nj(N,ee??ci.DESKTOP),_e=O&&ge!==Ho.TILE,ve=!z&&P!==`hidden`&&ge!==Ho.HIDDEN&&ge!==Ho.COMPACT,ye=!z&&(P===`hidden`||i===qA.SUMMARY),be=!ve&&!ye;if(t?.isLoading??!1)return(0,$.jsx)(tj,{active:_e,name:o,label:m,termAnnounced:be,children:(0,$.jsx)(xj,{mode:N,label:m,labelStyle:F,name:o,labelPlacement:P,hideLabel:z,hideDescription:!0,tooltip:_,wide:I,announceName:i===qA.SUMMARY,children:(0,$.jsx)(Tm,{className:`h-5 w-full`})})});let xe=s?Or(s):void 0,Se=n&&x?x:t?.data;if(xe&&Se&&!sr.evaluateShowWhen(xe,Se))return(0,$.jsx)($.Fragment,{});if(ce?.displayMode===hr.NONE&&o){let t=qj({schema:s,value:l,fieldName:o,parentData:x,resourceLinkTrail:e.resourceLinkTrail,currentResourceType:le,registry:ue});if(t&&Sj({parentReferenceConfig:ce,...t}).hidesWholeReference)return(0,$.jsx)($.Fragment,{})}let Ce=(O||i===qA.SUMMARY)&&!he;if((y?.hideWhenEmpty??Ce)&&$A(l))return(0,$.jsx)($.Fragment,{});if(!s||!c)return SR.error(`[DisplayField] Cannot resolve schema for field`,{name:o}),(0,$.jsx)($.Fragment,{});let we={schema:s,schemaType:c,value:l,fieldName:o,label:m,description:g,tooltip:_,provenance:fe,enumLabels:v,displayComponent:b,parentData:x,resourceLinkTrail:e.resourceLinkTrail,renderItem:e.renderField,className:C,hideLabel:z,hideDescription:B,resolvedChromeMode:N,resolvedLabelPlacement:P,resolvedLabelStyle:F,resolvedEmptyValue:de,fileUploadContext:ie,wideValue:I,announceName:i===qA.SUMMARY};return(0,$.jsx)(ER,{name:o,children:he&&c===bc.ARRAY?(0,$.jsx)(tj,{active:O,name:o,label:m,children:(0,$.jsx)(phe,{name:o,schema:s,value:l,label:m,description:g,doInlineUpdate:re,renderField:e.renderField,sectionAppearance:e.sectionAppearance,objectItemLayout:e.objectItemLayout,enumLabels:v,hideLabel:z,displayChromeMode:ee?EA(N,ee):typeof N==`string`?N:void 0})}):he?(0,$.jsx)(tj,{active:_e,name:o,label:m,termAnnounced:be,children:(0,$.jsx)(cR,{...we,doInlineUpdate:re,rmm:ae})}):c===bc.ARRAY&&e.sectionAppearance?(0,$.jsx)(tj,{active:O,name:o,label:m,children:(0,$.jsx)(OM,{...we,sectionAppearance:e.sectionAppearance})}):(0,$.jsx)(tj,{active:_e,name:o,label:m,termAnnounced:be,children:(0,$.jsx)(DM,{...we})})})}wR.displayName=`DisplayField`;var TR=wR,ER=class extends Q.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){let n=this.props.name;SR.error(`[DisplayField] Error boundary caught error`,{name:n,error:e.message,componentStack:t.componentStack})}render(){let e=this.props.name;return this.state.hasError?(0,$.jsxs)(`div`,{className:`flex items-center gap-element px-card-sm py-item-xs rounded-md bg-destructive/10 border border-destructive/20`,children:[(0,$.jsx)(`span`,{className:`text-destructive text-sm`,children:`Error rendering field`}),e&&(0,$.jsx)(`code`,{className:`text-xs text-destructive/70 px-item-xs rounded bg-destructive/5`,children:e})]}):this.props.children}},DR=(0,Q.createContext)(null);function Lhe({value:e,children:t}){return(0,$.jsx)(DR.Provider,{value:e,children:t})}function OR(){return(0,Q.useContext)(DR)}var kR;(function(e){e.DEFAULT=`default`,e.ENTRY=`entry`,e.SECTION=`section`,e.DOCUMENT=`document`})(kR||={});var Rhe={[kR.DEFAULT]:void 0,[kR.ENTRY]:`h5`,[kR.SECTION]:`h4`,[kR.DOCUMENT]:`h3`};function AR({name:e,scale:t=kR.DEFAULT,className:n}){let r=OR(),{getRecipe:i}=e_(),a=Rhe[t],o=i(wi.TYPOGRAPHY,Lu.HEADING),s=a?U(o.base,o.sizes?.[a]):void 0;if(r?.titleMountTracker&&(r.titleMountTracker.titleMounted=!0),e)return(0,$.jsx)(j_,{className:s,children:(0,$.jsx)(`div`,{"data-summary-title":``,className:U(`min-w-0 flex-1 text-foreground`,s?`leading-tight`:`font-medium leading-tight`,n),children:(0,$.jsx)(TR,{name:e,hideLabel:!0})})});let c=r?.primaryLabel;return c?(0,$.jsx)(Z,{as:`p`,"data-summary-title":``,className:U(`min-w-0 flex-1 font-medium text-foreground`,n),truncate:!0,children:c}):null}var jR;(function(e){e.AUTO=`auto`,e.TEMPLATE_OWNED=`template-owned`})(jR||={});var MR;(function(e){e.STACK=`stack`,e.ROW=`row`})(MR||={});var zhe={[MR.STACK]:`flex flex-col gap-element text-sm`,[MR.ROW]:`flex flex-wrap items-center gap-x-group gap-y-item text-sm`};function NR(e){let t=!1;return Q.Children.forEach(e,e=>{if(t||!(0,Q.isValidElement)(e))return;if(e.type===AR){t=!0;return}let n=e.props?.children;n!==void 0&&NR(n)&&(t=!0)}),t}function PR({flow:e=MR.STACK,className:t,titlePlacement:n=jR.AUTO,children:r}){let i=n===jR.AUTO&&!NR(r);return(0,$.jsx)(LD,{pathPrefix:``,children:(0,$.jsxs)(`div`,{className:U(zhe[e],t),children:[i&&(0,$.jsx)(AR,{}),r]})})}function FR({name:e,className:t,children:n}){let{pathPrefix:r}=RD(),i=r?`${r}.${e}`:e,a=(0,$.jsx)(LD,{pathPrefix:i,children:n});return t?(0,$.jsx)(`div`,{className:t,children:a}):a}Lk(FR,Pk.FIELD_SLOT_CONTAINER);function IR({field:e,variants:t,fallback:n}){let r=ew({name:zD(e)}),i=r==null?void 0:t[String(r)];return(0,$.jsx)($.Fragment,{children:i??n??null})}function LR({field:e,variants:t,fallback:n}){let r=zD(e),i=SA(_k()?.data,r),a=i==null?void 0:t[String(i)];return(0,$.jsx)($.Fragment,{children:a??n??null})}function RR(e,t,n){let r=sc(t),i=Or(t);return{name:e,schema:t,schemaType:r,showWhenParams:i,showWhenWatchFields:i?HR(i):void 0,isDiscriminator:n===e}}function zR(e,t){let n=sr.getObjectLikeFieldShape(e,{commonOnly:!0}),r=n?Object.keys(n):[];if(!n||r.length===0)return[];let i=[];for(let e of r){let r=n[e];nu(r)||Yn(r)||i.push(RR(e,r,t))}return i}function BR(e){return sa(e)}function VR(e){let t=Nr(e);if(!Lte(t))return null;let n=ce(t,`discriminator`),r=qie(t,`options`)??[];if(!n||r.length===0)return null;let i=e=>!!e&&!nu(e)&&!Yn(e),o=r.map(e=>new Set(od(e))),s=[...o[0]??new Set].filter(e=>e!==n&&o.every(t=>t.has(e))),c=Ju(r[0]),l=c?s.filter(e=>i(c[e])).map(e=>RR(e,c[e])):[],u=[];for(let e of r){let t=Ju(e);if(!t)continue;let r=a(t[n])[0];r!=null&&u.push({value:String(r),schema:e,fields:Object.keys(t).filter(e=>e!==n&&!s.includes(e)&&i(t[e])).map(e=>RR(e,t[e]))})}return{discriminator:n,commonFields:l,variants:u}}function Bhe(e){let t=VR(e);if(t)return{discriminatorField:t.discriminator,inheritedSchemas:t.variants.map(e=>({discriminatorFieldValue:e.value,schema:e.schema}))}}function Vhe(e){let t=VR(e.schema);if(!t)return null;let n={};for(let e of t.variants)e.fields.length!==0&&(n[e.value]=(0,$.jsx)($.Fragment,{children:e.fields.map(e=>(0,$.jsx)(nR,{name:e.name},e.name))}));return(0,$.jsxs)(FR,{name:e.name,children:[(0,$.jsx)(nR,{name:t.discriminator}),t.commonFields.map(e=>(0,$.jsx)(nR,{name:e.name},e.name)),Object.keys(n).length>0&&(0,$.jsx)(IR,{field:t.discriminator,variants:n})]},e.name)}function HR(e){let t=Array.isArray(e.conditions)?e.conditions:[e.conditions];return[...new Set(t.map(e=>e.field))]}function UR(e,t){let n=t?.inheritanceConfig??Bhe(e),r=zR(e,n?.discriminatorField);WT.FORM;let i=t?.includeSubmitButton!==!1,a=t?.includeErrorSummary!==!1;if(r.length===0){let e=()=>(0,$.jsx)(hA,{autoInjectSubmitButton:i});return e.displayName=`GeneratedFormTemplate(empty)`,e}let o=Ghe(r),s=o.length>0,c=new Set(r.map(e=>e.name)),l=()=>{let e=Hhe(s,o),t=ZT(),l=new Set(Object.keys(t?.contextFieldValues??{}));for(let e of t?.hiddenFieldNames??[])l.add(e);return(0,$.jsxs)(hA,{autoInjectSubmitButton:i,children:[a&&(0,$.jsx)(pO,{}),r.map(r=>{let i=!!t?.generatedFieldOverrides?.[r.name],a=l.has(r.name)&&!i?null:Uhe(r,n,c,l,t?.generatedFieldOverrides,e,o);return!r.showWhenParams||!e||qR(r.showWhenParams,e,o)?a:null}),i&&(0,$.jsx)(hO,{})]})};return l.displayName=`GeneratedFormTemplate`,l}function Hhe(e,t){let n=ew({name:e?t:[]});return e?Array.isArray(n)?n:[n]:void 0}function Uhe(e,t,n,r,i,a,o){return i?.[e.name]?(0,$.jsx)(nR,{name:e.name},e.name):e.isDiscriminator&&t&&n&&r?Whe(e,t,n,r,i):e.schemaType===bc.OBJECT?WR(e,a,o):(0,$.jsx)(nR,{name:e.name},e.name)}function Whe(e,t,n,r,i){let a={};if(t.inheritedSchemas)for(let e of t.inheritedSchemas){let t=Ju(e.schema),o=od(e.schema);if(t&&o.length>0){let s=o.filter(e=>!nu(t[e])&&!Yn(t[e])&&!n.has(e)&&(!r.has(e)||!!i?.[e]));s.length>0&&(a[e.discriminatorFieldValue]=(0,$.jsx)($.Fragment,{children:s.map(e=>(0,$.jsx)(nR,{name:e},e))}))}}let o=Object.keys(a).length>0;return(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(nR,{name:e.name}),o&&(0,$.jsx)(IR,{field:t.discriminatorField,variants:a})]},e.name)}function WR(e,t,n,r=``){if(e.showWhenParams&&t&&n&&!qR(KR(e.showWhenParams,r),t,n))return null;let i=Vhe(e);if(i)return i;let a=BR(e.schema),o=Object.keys(a).filter(e=>{let t=a[e];return!nu(t)&&!Yn(t)});if(o.length===0)return(0,$.jsx)(nR,{name:e.name},e.name);let s=r?`${r}.${e.name}`:e.name;return(0,$.jsx)(FR,{name:e.name,children:o.map(e=>{let r=a[e];return sc(r)===bc.OBJECT?WR(RR(e,r),t,n,s):(0,$.jsx)(nR,{name:e},e)})},e.name)}function Ghe(e){let t=new Set;for(let n of e)GR(n,t);return[...t]}function GR(e,t,n=``){if(e.showWhenParams){let r=KR(e.showWhenParams,n);for(let e of HR(r))t.add(e)}if(e.schemaType!==bc.OBJECT)return;let r=BR(e.schema),i=n?`${n}.${e.name}`:e.name;for(let[e,n]of Object.entries(r))nu(n)||Yn(n)||GR(RR(e,n),t,i)}function KR(e,t){if(!t)return e;let n=Array.isArray(e.conditions)?e.conditions:[e.conditions];return{...e,conditions:n.map(e=>({...e,field:e.field.includes(`.`)||e.field.includes(`[`)?e.field:`${t}.${e.field}`}))}}function qR(e,t,n){let r={};for(let e=0;e<n.length;e++)r[n[e]]=t[e];return sr.evaluateShowWhen(e,r)}function JR(e,t={}){let n=VR(e);if(n)return()=>(0,$.jsx)(OA,{children:t.factsAsTiles?qhe(n,t.resourceConfig):$R(n,t.resourceConfig)});let r=zR(e);if(WT.DISPLAY,r.length===0)return()=>(0,$.jsx)(OA,{});let i=YR(r,t.resourceConfig);if(t.factsAsTiles)return()=>(0,$.jsxs)(OA,{children:[i.state.length>0&&(0,$.jsx)(RA,{children:i.state.map(XR)}),i.content.map(QR),i.facts.length>0&&(0,$.jsx)(LA,{children:i.facts.map(QR)}),i.recordKeeping.length>0&&(0,$.jsx)(zA,{children:i.recordKeeping.map(QR)})]});let a=[...i.state,...i.content,...i.facts,...i.recordKeeping];return()=>(0,$.jsx)(OA,{children:a.map(QR)})}function YR(e,t){let n={state:[],content:[],facts:[],recordKeeping:[]};for(let r of e)switch(GA(r.name,r.schema,t)){case BA.STATE:(n.state.length===0?n.state:n.facts).push(r);break;case BA.CONTENT:n.content.push(r);break;case BA.FACT:n.facts.push(r);break;case BA.RECORD_KEEPING:n.recordKeeping.push(r);break;case BA.IDENTITY_PLUMBING:}return n}function XR(e){return(0,$.jsx)(TR,{name:e.name,labelPlacement:`hidden`},e.name)}function Khe({children:e}){let{displayChromeMode:t}=bk();return(0,$.jsx)(yk,{displayChromeMode:t,sectionChromeMode:Ho.INLINE,children:e})}function ZR(e){return UA(e.schema)}function qhe(e,t){let n=YR(e.commonFields,t),r={},i={};for(let t of e.variants){let e=t.fields.filter(ZR),n=t.fields.filter(e=>!ZR(e));e.length>0&&(r[t.value]=(0,$.jsx)($.Fragment,{children:e.map(QR)})),n.length>0&&(i[t.value]=(0,$.jsx)($.Fragment,{children:n.map(QR)}))}return(0,$.jsxs)($.Fragment,{children:[n.state.length>0&&(0,$.jsx)(RA,{children:n.state.map(XR)}),n.content.map(QR),Object.keys(r).length>0&&(0,$.jsx)(LR,{field:e.discriminator,variants:r}),(0,$.jsxs)(LA,{children:[(0,$.jsx)(TR,{name:e.discriminator}),n.facts.map(QR),Object.keys(i).length>0&&(0,$.jsx)(LR,{field:e.discriminator,variants:i})]}),n.recordKeeping.length>0&&(0,$.jsx)(zA,{children:n.recordKeeping.map(QR)})]})}function QR(e){return e.schemaType===bc.OBJECT?Jhe(e):(0,$.jsx)(TR,{name:e.name},e.name)}function $R(e,t){let n=YR(e.commonFields,t),r=[...n.state,...n.content,...n.facts,...n.recordKeeping],i={};for(let t of e.variants)t.fields.length!==0&&(i[t.value]=(0,$.jsx)($.Fragment,{children:t.fields.map(QR)}));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(TR,{name:e.discriminator}),r.map(QR),Object.keys(i).length>0&&(0,$.jsx)(LR,{field:e.discriminator,variants:i})]})}function Jhe(e){let t=VR(e.schema);if(t)return(0,$.jsx)(FR,{name:e.name,children:$R(t)},e.name);let n=BR(e.schema),r=Object.keys(n).filter(e=>{let t=n[e];return!nu(t)&&!Yn(t)});return r.length===0?(0,$.jsx)(TR,{name:e.name},e.name):(0,$.jsx)(FR,{name:e.name,children:r.map(e=>QR(RR(e,n[e])))},e.name)}function ez(e,t){let n=sr.getObjectLikeFieldShape(e,{commonOnly:!0}),r=n?Object.keys(n):[];if(!n||r.length===0)return()=>(0,$.jsx)(PR,{titlePlacement:jR.AUTO});let i=e=>!V.isIdentityOnlySummaryField(e,t),a=r.filter(e=>{let t=n[e];return i(e)&&!Yn(t)&&sie(t)}),o=a.length>0?a:r.filter(e=>i(e)&&!Yn(n[e])),s=t?.frontendConfiguration?.layout?.defaultChromeMode?.summary!==void 0,c=o.map(e=>sc(n[e]));return()=>{let e=_k(),t=e?.data,n=t!==void 0&&e?.isLoading!==!0,r=o.map(e=>!n||lj(t?.[e])),i=s?[]:uj(o.map((e,t)=>({schemaType:c[t],present:r[t]})));return(0,$.jsx)(PR,{titlePlacement:jR.AUTO,children:o.map((e,t)=>r[t]?i[t]?(0,$.jsx)(Khe,{children:(0,$.jsx)(TR,{name:e})},e):(0,$.jsx)(TR,{name:e},e):null)})}}function Yhe(e,t){return t!==W.UPDATE||!e?!1:Object.values(e).some(e=>{let t=uo(e)?.autosave;return t===void 0?!1:t===!0||typeof t==`object`&&t.enabled!==!1})}function tz(e,t){return e?.cause instanceof Error?e.cause:Error(e?.message??t)}var nz=(0,Q.createContext)(null);function rz(e){let{tErrorValidation:t,tErrorMessage:n,t:r}=K(),i=(0,Q.useRef)(new Set),a=(0,Q.useRef)(null);(0,Q.useEffect)(()=>()=>{a.current?.unsubscribe()},[]);let o=(0,Q.useCallback)(e=>{a.current?.unsubscribe();let t=e.watch((t,{name:n})=>{n&&i.current.has(n)&&(e.clearErrors(n),i.current.delete(n))});a.current=t},[]),s=(0,Q.useCallback)(()=>{e.current&&i.current.size>0&&(Array.from(i.current).forEach(t=>{e.current.clearErrors(t)}),i.current.clear())},[e]);return{initAutoClearing:o,injectServerErrors:(0,Q.useCallback)(a=>{e.current&&(Object.entries(a).forEach(([a,o])=>{let s=JD.isFormLevelErrorPath(a)?bT:a,c=(ma(o)&&o.code===_te.DECLARED_REFUSAL?Bp({tErrorMessage:n,t:r},o.params?.refusalCode):void 0)??(ma(o)?t(o.code,`msg`,o.params):o);e.current.setError(s,{type:vT,message:c}),i.current.add(s)}),aO(Object.keys(a).map(e=>JD.isFormLevelErrorPath(e)?bT:e)))},[e,t,n,r]),clearServerErrors:s}}function iz(e,t){let{emit:n}=vo(),r=(0,Q.useContext)(Sm),{registry:i}=wm(),a=r?.isConnected??!1,o=(0,Q.useMemo)(()=>{let t=i.resourceConfigurations[e.resourceType],{[e.resourceType]:n,...r}=ju(e.contextResourceIdentifiers),a=V.buildContextualParameters(r,i);return Aa(t?.operations??[],W.LIST).filter(e=>dy({operation:e,contextResourceIdentifiers:r,contextualParameters:a}))},[e.contextResourceIdentifiers,e.resourceType,i]);return(0,Q.useCallback)((r,i)=>{if(Rr(r))return;n(hc.RESOURCE_OPERATION_EXECUTED,{resourceType:e.resourceType,operationIdentifier:String(t.operationIdentifier),operation:t,variantType:t.variantType,isOperationDefault:t.isOperationDefault??!0,isBulkOperation:t.isBulkOperation??!1,variantKey:t.variantKey,contextResourceIdentifiers:De({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:e.resourceType,result:r,isBulkOperation:t.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements,optionalDiscriminator:wc(e.additionalContext),resultSummary:Ku(r),...i?.partialWrite?{isPartialWrite:!0}:{}});let s=t.admitsCrossTenantPlatformAdministration===!0;if(!t.isBulkOperation&&!s||Di(t,a))return;let{[e.resourceType]:c,...l}=ju(e.contextResourceIdentifiers),u=o.length>0?o:[null];for(let t of u)n(hc.RESOURCE_REFRESH,{resourceType:e.resourceType,operationIdentifier:String(t?.operationIdentifier??W.LIST),operation:t??{operationIdentifier:W.LIST},variantType:t?.variantType,isOperationDefault:t?.isOperationDefault??!0,isBulkOperation:t?.isBulkOperation??!1,variantKey:t?.variantKey,contextResourceIdentifiers:l,parentResourcesRequirements:e.parentResourcesRequirements})},[n,a,o,t,e.additionalContext,e.contextResourceIdentifiers,e.parentResourcesRequirements,e.resourceType])}function Xhe(e){let{apiBaseUrl:t,initiatorInfo:n,contextualParameters:r}=e,i=Ch.resolveUrlPath(`${rt}${n.url}`,r);if(i&&!Ch.hasUnresolvedPlaceholders(i))return`${t}${i}/validate-field`}var az=Jo.getLogger(),oz=az.debugByType(`HttpTransportAdapter`);az.setDebugTypeLogging(`HttpTransportAdapter`,!1);function Zhe(e){let t=e?.context;if(!t||typeof t!=`object`)return;let n=t,r=rn.safeParse(n.versionConflict);return r.success?r.data:void 0}function Qhe(e){let t=e.httpStatus;return t!=null&&typeof t==`number`&&!Number.isNaN(t)}function $he(e){return e>=500?TE.SERVER:e>=400&&!ic.has(e)?TE.REFUSED:TE.TRANSIENT}function sz(e,t,n){let r=e?.validationErrors;return typeof r==`object`&&r&&Object.keys(r).length>0?{type:TE.VALIDATION,status:t,validationErrors:r,message:n}:{type:TE.REFUSED,status:t,message:n}}var ege=class{_doOperation;constructor(e){this._doOperation=e}async execute(e){oz(`execute`,{operationPathKey:e.operationPathKey,fields:e.requestData?Object.keys(e.requestData):[],expectedVersion:e.expectedVersion});try{let t={};e.expectedVersion!=null&&(t[ks.IF_MATCH]=String(e.expectedVersion));let n=e.fieldTimestamps?{...e.requestData,_field_timestamps:e.fieldTimestamps}:e.requestData,r=await this._doOperation(e.operationPathKey,{contextualParameters:e.contextualParameters,requestData:n,parentResourcesRequirements:e.parentResourcesRequirements,dataMode:e.dataMode},{signal:e.signal,silent:!0,headers:Object.keys(t).length>0?t:void 0}),i=Rr(r);if(i)return oz(`execute: held for approval`,{decisionRef:i.decisionRef}),{status:EE.SUCCESS,heldForApproval:i};let a=r,o={status:EE.SUCCESS,data:a??void 0,newVersion:a?._version,fieldMeta:a?._field_meta};return oz(`execute: success`,{newVersion:o.newVersion}),o}catch(t){let n=this._mapError(t,e.expectedVersion!=null);return oz(`execute: error`,{errorType:n.error?.type,errorStatus:n.error?.status,errorMessage:n.error?.message}),n}}_mapError(e,t){let n=this._classifyError(e,t);return n.error&&(n.error.cause=e,n.error.type!==TE.SERVER&&n.error.type!==TE.TRANSIENT||ha(e)||tl(e)||(n.error.resendable=Oee(e,Rte.REDISPATCH))),n}_classifyError(e,t){if(eee(e))return{status:EE.ERROR,error:{type:TE.ABORT}};if(ha(e)||tl(e))return{status:EE.ERROR,error:{type:TE.TRANSIENT,message:e.message}};let n=Qhe(e)?e.httpStatus:void 0;if(n!=null)switch(n){case 400:case 422:return{status:EE.ERROR,error:{type:TE.VALIDATION,status:n,validationErrors:e.validationErrors,message:e.message??String(e)}};case 404:case 410:return{status:EE.ERROR,error:{type:TE.NOT_FOUND,status:n}};case 409:if(e?.customMessageReference===ii.VERSION_CONFLICT){let r=Zhe(e);return!r&&!t?{status:EE.ERROR,error:sz(e,n,e?.message??String(e))}:r?{status:EE.ERROR,error:{type:TE.CONFLICT,status:n,conflictDetails:r}}:{status:EE.ERROR,error:{type:TE.SERVER,status:n,message:`Version conflict response missing authoritative conflict details.`}}}return{status:EE.ERROR,error:sz(e,n,e?.message??String(e))};default:return{status:EE.ERROR,error:{type:$he(n),status:n,message:String(e)}}}return{status:EE.ERROR,error:{type:TE.TRANSIENT,message:Ca(e)}}}},tge=15e3,nge=3e4,rge=[1e3,3e3],ige=2e3,age=3e5;function cz(e){let t=e??{},n=t.context??{};return{...typeof t.customMessageReference==`string`?{errorCustomMessageReference:t.customMessageReference}:{},...typeof n.code==`string`&&n.code.length>0?{errorRefusalCode:n.code}:{},...typeof t.httpStatus==`number`?{errorHttpStatus:t.httpStatus}:{},...lz(e)}}function lz(e){let t=fp(e).userGuidance,n=typeof t?.guidanceKey==`string`&&t.guidanceKey.length>0?t.guidanceKey:void 0;return n?{errorGuidanceKey:n,...t?.params?{errorGuidanceParams:t.params}:{}}:{}}var uz=Jo.getLogger(),dz=uz.debugByType(`ResourceMutationManager`);uz.setDebugTypeLogging(`ResourceMutationManager`,!1);var fz=64;function pz(e,t){let n=kM(t).split(`.`).filter(Boolean),r=e;for(let e of n){if(typeof r!=`object`||!r)return;r=Array.isArray(r)?r[Number(e)]:r[e]}return r}function mz(e,t){let n=Object.keys(e).filter(e=>kM(e).includes(`.`));if(n.length===0)return e;if(t===null)throw Error(`Cannot write ${n.join(`, `)} before the record's stored state is known: the stored siblings would be erased.`);let r={};for(let[t,i]of Object.entries(e))n.includes(t)||(r[t]=i);for(let i of n){let n=kM(i).split(`.`)[0];if(n in r)r[n]!==null&&typeof r[n]==`object`&&(r[n]=structuredClone(r[n]));else{let e=t?.[n];r[n]=typeof e==`object`&&e?structuredClone(e):void 0}gz(r,i,e[i])}return r}var hz=new Set([CE.SECTION,CE.AUTOSAVE,CE.INLINE]);function gz(e,t,n){let r=kM(t).split(`.`).filter(Boolean),i=e;for(let e=0;e<r.length-1;e++){let t=r[e],a=r[e+1],o=/^\d+$/.test(a)?[]:{};if(i[t]===void 0||i[t]===null||typeof i[t]!=`object`){if(n===void 0)return;i[t]=o}i=i[t]}let a=r[r.length-1];n===void 0?Array.isArray(i)&&/^\d+$/.test(a)?delete i[Number(a)]:delete i[a]:Array.isArray(i)&&/^\d+$/.test(a)?i[Number(a)]=n:i[a]=n}var _z;(function(e){e.QUEUE_MUTATION=`QUEUE_MUTATION`,e.START_SAVING=`START_SAVING`,e.SAVE_SUCCESS=`SAVE_SUCCESS`,e.SAVE_ERROR=`SAVE_ERROR`,e.RETRY=`RETRY`,e.CONFLICT_DETECTED=`CONFLICT_DETECTED`,e.CONFLICT_ACKNOWLEDGED=`CONFLICT_ACKNOWLEDGED`,e.CANCEL=`CANCEL`,e.DELETE=`DELETE`,e.REMOTE_UPDATE=`REMOTE_UPDATE`})(_z||={});var vz={type:wE.FORM,subscriberId:`autosave`},yz={maxQueueDepth:5,softTimeoutMs:tge,hardTimeoutMs:nge},bz=class{resourceType;_resourceId;_confirmedData=null;_version=null;_pendingFields=new Map;_queue=[];_activeMutation=null;_state=xE.IDLE;_lastError=null;_lastEvent=null;_eventCounter=0;_snapshotVersion=0;_cachedSnapshot=null;_cachedSnapshotVersion=-1;_snapshotListeners=new Set;_optimisticDataVersion=-1;_cachedOptimisticData=null;_config;_mutationIdCounter=0;_retryTimer=null;_retryDelays=[...rge];_serverRetryDelay=ige;_authoritativeRecoveryTimer=null;_backpressure;_softTimer=null;_hardTimer=null;_deferredSelfEvents=[];_allowSettledSelfEventRepair=!1;_producedVersions=new Set;_crdtFieldNames;_discriminatorFieldNames;_fieldMeta=null;_pendingFieldTimestamps=new Map;_lastIssuedLocalTimestamp=0;_clockOffset=0;_onDrainCallbacks=[];constructor(e){this._config=e,this.resourceType=e.resourceType,this._resourceId=e.resourceId;let t=e.backpressure;this._backpressure={maxQueueDepth:t?.maxQueueDepth??yz.maxQueueDepth,softTimeoutMs:t?.softTimeoutMs??yz.softTimeoutMs,hardTimeoutMs:t?.hardTimeoutMs??yz.hardTimeoutMs},this._crdtFieldNames=Mu({mainSchema:e.resourceSchema,inheritenceSchemaDefinition:e.resourceInheritance}),this._discriminatorFieldNames=UE(e.resourceSchema),this.subscribe=this.subscribe.bind(this),this.getSnapshot=this.getSnapshot.bind(this),dz(`constructor`,{resourceType:e.resourceType,resourceId:e.resourceId,conflictStrategy:e.conflictPolicy.strategy,operationPathKey:e.operationPathKey,crdtFieldCount:this._crdtFieldNames.size,crdtFields:Array.from(this._crdtFieldNames)})}_getAdjustedTimestamp(){let e=Date.now()+this._clockOffset;return this._lastIssuedLocalTimestamp=dt(Math.max(1,e),this._lastIssuedLocalTimestamp),this._lastIssuedLocalTimestamp}_isCrdtManagedField(e){return this._crdtFieldNames.has(e)||this._crdtFieldNames.has(e.split(`.`)[0]??e)}set clockOffset(e){this._clockOffset=e}get resourceId(){return this._resourceId}get contextualParameters(){return this._config.contextualParameters}get contextResourceIdentifiers(){return this._config.contextResourceIdentifiers??{}}get parentResourcesRequirements(){return this._config.parentResourcesRequirements}get readOperationPathKey(){return this._config.readOperationPathKey}syncRuntimeRoutingConfig(e){if(this._state===xE.DELETED)return;let t=Object.prototype.hasOwnProperty.call(e,`readOperationPathKey`),n=Object.prototype.hasOwnProperty.call(e,`parentResourcesRequirements`),r=e.operationPathKey!==void 0&&e.operationPathKey!==this._config.operationPathKey,i=t&&e.readOperationPathKey!==this._config.readOperationPathKey,a=e.transportAdapter!==void 0&&e.transportAdapter!==this._config.transportAdapter,o=e.conflictPolicy!==void 0&&e.conflictPolicy.strategy!==this._config.conflictPolicy.strategy,s=e.resourceSchema!==void 0&&e.resourceSchema!==this._config.resourceSchema||e.resourceInheritance!==void 0&&e.resourceInheritance!==this._config.resourceInheritance;this._config={...this._config,...e.transportAdapter===void 0?{}:{transportAdapter:e.transportAdapter},currentUserId:e.currentUserId,...e.contextResourceIdentifiers===void 0?{}:{contextResourceIdentifiers:{...e.contextResourceIdentifiers}},contextualParameters:{...e.contextualParameters},...n?{parentResourcesRequirements:e.parentResourcesRequirements}:{},...e.operationPathKey===void 0?{}:{operationPathKey:e.operationPathKey},...t?{readOperationPathKey:e.readOperationPathKey}:{},...e.conflictPolicy===void 0?{}:{conflictPolicy:e.conflictPolicy},...e.resourceSchema===void 0?{}:{resourceSchema:e.resourceSchema},...e.resourceInheritance===void 0?{}:{resourceInheritance:e.resourceInheritance}},s&&(this._crdtFieldNames=Mu({mainSchema:this._config.resourceSchema,inheritenceSchemaDefinition:this._config.resourceInheritance}),this._discriminatorFieldNames=UE(this._config.resourceSchema)),dz(`syncRuntimeRoutingConfig`,{resourceType:this.resourceType,resourceId:this._resourceId,hasUserId:e.currentUserId.length>0,didUpdateOperationPathKey:r,didUpdateReadOperationPathKey:i,didUpdateTransportAdapter:a,didUpdateConflictPolicy:o,didUpdateResourceSchema:s,crdtFieldCount:this._crdtFieldNames.size}),(r||i)&&this._invalidateSnapshot()}setInitialState(e,t,n){if(this._state===xE.DELETED)return;this._confirmedData={...e},this._version=t,this._clearAuthoritativeRecoveryTimer(),this._allowSettledSelfEventRepair=!1;let r=n??e._field_meta;this._fieldMeta=r==null?null:qe(r),this._invalidateSnapshot(),dz(`setInitialState`,{resourceId:this._resourceId,version:t,fieldCount:Object.keys(e).length,pendingFieldCount:this._pendingFields.size,hasFieldMeta:this._fieldMeta!==null})}queueMutation(e,t){if(this._state===xE.DELETED)return dz(`queueMutation: rejected — resource deleted`,{resourceId:this._resourceId}),Promise.reject(new ME);let n=t?.priority??AE.LOW,r=t?.type??CE.AUTOSAVE,i=t?.source??vz;return this._queue.length>=this._backpressure.maxQueueDepth&&n<=AE.LOW?(dz(`queueMutation: rejected — backpressure`,{queueDepth:this._queue.length,maxDepth:this._backpressure.maxQueueDepth}),Promise.reject(new NE)):(dz(`queueMutation`,{type:r,priority:n,source:i.subscriberId,fields:Object.keys(e),state:this._state,queueDepth:this._queue.length,pendingFieldCount:this._pendingFields.size}),new Promise((a,o)=>{let s={id:`mut_${++this._mutationIdCounter}`,type:r,fields:{...e},priority:n,source:i,resolve:a,reject:o,signal:t?.signal,transportOverride:t?.transportOverride};if(n>=AE.HIGH){for(let[e,t]of this._pendingFields)e in s.fields||(s.fields[e]=t);this._pendingFields.clear();for(let e of Object.keys(s.fields))this._isCrdtManagedField(e)&&!this._pendingFieldTimestamps.has(e)&&this._pendingFieldTimestamps.set(e,this._getAdjustedTimestamp())}else for(let[t,n]of Object.entries(e))this._pendingFields.set(t,n),this._isCrdtManagedField(t)&&this._pendingFieldTimestamps.set(t,this._getAdjustedTimestamp());this._queue.push(s),this._queue.sort((e,t)=>t.priority-e.priority),this._queue.length>1&&this._autoCoalesceQueue(),this._transition({type:_z.QUEUE_MUTATION}),this._processQueue()}))}autosave(e){this.queueMutation(e,{type:CE.AUTOSAVE,priority:AE.LOW,source:vz}).catch(()=>{})}flushPendingFields(e){if(this._pendingFields.size===0)return Promise.resolve(null);let t={};for(let[e,n]of this._pendingFields)t[e]=n;return this.queueMutation(t,{type:CE.AUTOSAVE,priority:e?.priority??AE.NORMAL,source:e?.source??vz,signal:e?.signal})}cancelPendingMutations(e){if(this._state!==xE.DELETED){dz(`cancelPendingMutations`,{source:e?.subscriberId,queueDepth:this._queue.length,hasActiveMutation:this._activeMutation!==null,pendingFieldCount:this._pendingFields.size}),this._retryTimer&&=(clearTimeout(this._retryTimer),null),this._activeMutation&&=(this._activeMutation.abortController.abort(),this._activeMutation.entry.reject(new jE(e)),null);for(let t of this._queue)t.reject(new jE(e));this._queue=[],this._deferredSelfEvents=[],this._pendingFieldTimestamps.clear(),this._transition({type:_z.CANCEL})}}acknowledgeConflict(){this._state===xE.CONFLICT&&(dz(`acknowledgeConflict`,{resourceId:this._resourceId}),this._transition({type:_z.CONFLICT_ACKNOWLEDGED}),this._processQueue())}_isOwnEcho(e){return this._producedVersions.has(e)}_recordProducedVersion(e){if(e!=null&&(this._producedVersions.add(e),this._producedVersions.size>fz)){let e=this._producedVersions.values().next().value;e!==void 0&&this._producedVersions.delete(e)}}applyRemoteUpdate(e,t,n,r){if(this._state!==xE.DELETED){if(this._isOwnEcho(t)){if(this._activeMutation!==null){dz(`applyRemoteUpdate: own-echo deferred (mutation in-flight)`,{version:t,activeMutationId:this._activeMutation.entry.id}),this._deferredSelfEvents.push({changedFields:e,version:t,initiatorUserId:n,fieldMeta:r});return}if(this._allowSettledSelfEventRepair){this._clearAuthoritativeRecoveryTimer(),this._allowSettledSelfEventRepair=!1,dz(`applyRemoteUpdate: accepting settled own-echo after canonical read-back miss`,{version:t}),this._applyRemoteUpdateInternal(e,t,n,r,!0);return}dz(`applyRemoteUpdate: own-echo discarded (no in-flight mutation)`,{version:t})}else this._activeMutation!==null&&n!==void 0&&n===this._config.currentUserId?(dz(`applyRemoteUpdate: same-user echo deferred (mutation in-flight, version not yet known)`,{version:t,activeMutationId:this._activeMutation.entry.id}),this._deferredSelfEvents.push({changedFields:e,version:t,initiatorUserId:n,fieldMeta:r})):this._applyRemoteUpdateInternal(e,t,n,r)}}handleDeletion(e,t){dz(`handleDeletion`,{reason:e,deletedBy:t,resourceId:this._resourceId}),this._transition({type:_z.DELETE,reason:e,deletedBy:t})}subscribe(e){return this._snapshotListeners.add(e),()=>{this._snapshotListeners.delete(e)}}getSnapshot(){if(this._cachedSnapshot&&this._cachedSnapshotVersion===this._snapshotVersion)return this._cachedSnapshot;let e=this._getOptimisticData(),t=Array.from(this._pendingFields.keys()),n={};for(let[e,t]of this._pendingFields)n[e]=t;return this._cachedSnapshot={state:this._state,version:this._version,confirmedData:this._confirmedData,optimisticData:e,pendingFieldNames:t,pendingFieldValues:n,isSaving:this._state===xE.SAVING,isDeleted:this._state===xE.DELETED,hasUnsavedChanges:this._pendingFields.size>0||this._queue.length>0||this._activeMutation!==null,error:this._lastError,queueDepth:this._queue.length,lastEvent:this._lastEvent},this._cachedSnapshotVersion=this._snapshotVersion,this._cachedSnapshot}async destroy(){dz(`destroy: starting`,{resourceId:this._resourceId,pendingFieldCount:this._pendingFields.size,queueDepth:this._queue.length,hasActiveMutation:this._activeMutation!==null});let e=0;for(;this._pendingFields.size>0&&e++<3;)try{await this.flushPendingFields()}catch(t){dz(`destroy: flushPendingFields failed`,{resourceId:this._resourceId,attempt:e,error:Ca(t)});break}this._pendingFields.size>0&&dz(`destroy: completing with pending fields remaining (flush exhausted or failed)`,{resourceId:this._resourceId,pendingFieldCount:this._pendingFields.size}),(this._activeMutation||this._queue.length>0)&&(dz(`destroy: waiting for drain`,{queueDepth:this._queue.length}),await new Promise(e=>{this._onDrainCallbacks.push(e)})),this._clearTimers(),this._clearAuthoritativeRecoveryTimer(),this._snapshotListeners.clear(),dz(`destroy: complete`,{resourceId:this._resourceId})}_transition(e){let t=this._state;switch(e.type){case _z.QUEUE_MUTATION:if(this._state===xE.IDLE)this._state=xE.QUEUED;else if(this._state===xE.ERROR){if(this._retryTimer&&this._activeMutation){this._clearTimers();let e=this._activeMutation;for(let[t,n]of Object.entries(e.savingFields))this._pendingFields.has(t)||this._pendingFields.set(t,n);e.abortController.abort(),this._activeMutation=null,e.entry.reject(new jE(e.entry.source))}this._state=xE.QUEUED}this._invalidateSnapshot();return;case _z.START_SAVING:this._state===xE.QUEUED&&(this._state=xE.SAVING,this._lastError=null,this._startBackpressureTimers());break;case _z.SAVE_SUCCESS:{this._state=this._queue.length>0||this._pendingFields.size>0?xE.QUEUED:xE.IDLE,this._lastError=null,this._clearTimers();let t=e.result.heldForApproval,n=this._confirmedData===null?void 0:{...this._confirmedData};t||(e.result.data&&this._mergeResponseDataIntoConfirmed(e.result.data),this._applyConfirmedClears(e.clearedFields,e.result.data),e.result.newVersion!==void 0&&(this._version=e.result.newVersion)),this._lastEvent={type:SE.MUTATION_RESULT,result:t?{success:!0,savedFields:[],heldForApproval:t}:{success:!0,savedFields:e.savedFields,savedValues:e.savedValues,newVersion:e.result.newVersion,responseData:e.result.data,...n===void 0?{}:{previousConfirmedData:n}},source:e.source,id:++this._eventCounter};break}case _z.SAVE_ERROR:{let t=e.result.error?.type,n=e.result.error?{type:e.result.error.type,status:e.result.error.status,validationErrors:e.result.error.validationErrors,message:e.result.error.message,conflictDetails:e.result.error.conflictDetails,cause:e.result.error.cause,...e.result.error.resendable===void 0?{}:{resendable:e.result.error.resendable}}:{type:TE.SERVER,message:`Unknown error`};if(this._lastError=n,t===TE.CONFLICT){this._clearTimers(),this._state=xE.CONFLICT;let t=[...new Set([...e.savedFields,...this._pendingFields.keys()])];for(let e of this._queue)e.reject(new jE);this._queue=[],this._pendingFields.clear(),this._pendingFieldTimestamps.clear(),this._deferredSelfEvents=[];let r=n.conflictDetails,i=r?.currentValues,a=i&&Object.keys(i).length>0?{...this._confirmedData??{},...i}:this._confirmedData??{},o=r?.currentVersion??this._version??0;this._confirmedData={...a},this._version=o,this._lastEvent={type:SE.CONFLICT_RESET,discardedFields:t,reason:OE.VERSION_CONFLICT,currentData:a,currentVersion:o,conflictDetails:r,id:++this._eventCounter};break}if(t===TE.ABORT){this._clearTimers();let e=this._queue.length>0||this._pendingFields.size>0?xE.QUEUED:xE.IDLE;this._state=e,e===xE.IDLE&&(this._lastError=null);break}if(t===TE.VALIDATION||t===TE.NOT_FOUND||t===TE.REFUSED){if(this._clearTimers(),t===TE.VALIDATION&&this._activeMutation)for(let t of e.savedFields)this._pendingFields.has(t)||this._pendingFields.set(t,this._activeMutation.savingFields[t]);this._lastEvent={type:SE.MUTATION_RESULT,result:{success:!1,savedFields:e.savedFields,error:n,retriesRemaining:0},source:e.source,id:++this._eventCounter},this._state=this._queue.length>0||this._pendingFields.size>0?xE.QUEUED:xE.IDLE;break}let r=this._activeMutation?.retryCount??0,i=n.resendable===!1?0:t===TE.TRANSIENT?this._retryDelays.length:+(t===TE.SERVER);if(r<i){let a=t===TE.TRANSIENT?this._retryDelays[r]:this._serverRetryDelay;this._state=xE.ERROR,this._lastEvent={type:SE.MUTATION_RESULT,result:{success:!1,savedFields:e.savedFields,error:n,retriesRemaining:i-r},source:e.source,id:++this._eventCounter},this._retryTimer=setTimeout(()=>{this._retryTimer=null,this._state===xE.ERROR&&this._activeMutation&&(this._activeMutation.retryCount++,dz(`retry: attempt`,{mutationId:this._activeMutation.entry.id,retryCount:this._activeMutation.retryCount,maxRetries:i,delayMs:a}),this._transition({type:_z.RETRY}),this._executeTransport(this._activeMutation))},a);break}this._clearTimers();let a=[...new Set([...e.savedFields,...this._pendingFields.keys()])];for(let e of this._queue)e.reject(new jE);this._queue=[],this._pendingFields.clear(),this._pendingFieldTimestamps.clear(),this._deferredSelfEvents=[],this._lastEvent={type:SE.MUTATION_RESULT,result:{success:!1,savedFields:e.savedFields,error:n,retriesRemaining:0},source:e.source,id:++this._eventCounter},this._state=xE.IDLE,this._emitTerminalMutationFailureNotification(n,a);break}case _z.RETRY:this._state===xE.ERROR&&(this._state=xE.SAVING);break;case _z.CONFLICT_DETECTED:this._clearTimers(),this._state=xE.CONFLICT,this._activeMutation&&=(this._activeMutation.abortController.abort(),this._activeMutation.entry.reject(new jE),null);for(let e of this._queue)e.reject(new jE);this._queue=[],this._pendingFields.clear(),this._pendingFieldTimestamps.clear(),this._deferredSelfEvents=[],this._confirmedData={...e.currentData},this._version=e.currentVersion,this._lastEvent={type:SE.CONFLICT_RESET,discardedFields:e.discardedFields,reason:e.reason,currentData:e.currentData,currentVersion:e.currentVersion,conflictDetails:e.conflictDetails,id:++this._eventCounter};break;case _z.CONFLICT_ACKNOWLEDGED:this._state===xE.CONFLICT&&(this._state=this._queue.length>0?xE.QUEUED:xE.IDLE,this._lastError=null);break;case _z.CANCEL:this._state=xE.IDLE,this._lastError=null;break;case _z.DELETE:this._clearTimers(),this._activeMutation&&=(this._activeMutation.abortController.abort(),this._activeMutation.entry.reject(new ME),null);for(let e of this._queue)e.reject(new ME);this._queue=[],this._pendingFields.clear(),this._pendingFieldTimestamps.clear(),this._deferredSelfEvents=[],this._state=xE.DELETED,this._lastEvent={type:SE.RESOURCE_DELETED,reason:e.reason,deletedBy:e.deletedBy,id:++this._eventCounter};break;case _z.REMOTE_UPDATE:this._lastEvent={type:SE.REMOTE_UPDATE,changedFields:e.changedFields,mergedFields:e.mergedFields,version:e.version,initiatorUserId:e.initiatorUserId,crdtResolutions:e.crdtResolutions,id:++this._eventCounter}}this._state!==t&&dz(`_transition`,{event:e.type,from:t,to:this._state,queueDepth:this._queue.length,pendingFieldCount:this._pendingFields.size,hasActiveMutation:this._activeMutation!==null,lastEventType:this._lastEvent?.type}),this._invalidateSnapshot()}_emitTerminalMutationFailureNotification(e,t){let n=this._config.operationPathKey??this.resourceType,r={};try{r=gl.parseOperationPathKey(n)}catch{}try{fi.emit(hc.NOTIFY_RESOURCE_ERROR,{resourceType:this.resourceType,parentResourcesRequirements:[],operationIdentifier:String(r.operationIdentifier??W.UPDATE),isOperationDefault:r.isOperationDefault??!0,isBulkOperation:r.isBulkOperation??!1,variantKey:r.variantKey,operation:void 0,contextResourceIdentifiers:this._config.contextResourceIdentifiers??{},additionalContext:{error:e.message??`Saving failed after retries`,errorCustomMessageReference:e.type===TE.TRANSIENT?ii.NETWORK:cz(e.cause).errorCustomMessageReference,errorHttpStatus:e.status,errorRefusalCode:cz(e.cause).errorRefusalCode,...lz(e.cause),mutationErrorType:e.type,discardedFields:t}})}catch(e){dz(`_emitTerminalMutationFailureNotification: emit failed`,{resourceId:this._resourceId,error:Ca(e)})}}_processQueue(){if(this._activeMutation!==null||this._queue.length===0||this._state===xE.CONFLICT||this._state===xE.DELETED||this._state===xE.ERROR)return;let e=this._queue.shift(),t;if(e.type===CE.SUBMIT||e.type===CE.DRAFT||e.type===CE.PUBLISH)t={...e.fields},this._pendingFields.clear();else{t={};for(let n of Object.keys(e.fields))this._pendingFields.has(n)?(t[n]=this._pendingFields.get(n),this._pendingFields.delete(n)):t[n]=e.fields[n]}dz(`_processQueue: dequeued`,{mutationId:e.id,type:e.type,priority:e.priority,savingFields:Object.keys(t),remainingQueue:this._queue.length,remainingPending:this._pendingFields.size});let n=new AbortController;if(e.signal){if(e.signal.aborted){e.reject(new jE(e.source)),this._processQueue();return}e.signal.addEventListener(`abort`,()=>n.abort(),{once:!0})}this._activeMutation={entry:e,savingFields:t,abortController:n,retryCount:0},this._transition({type:_z.START_SAVING}),this._executeTransport(this._activeMutation)}_executeTransport(e){let t=e;dz(`_executeTransport: sending`,{mutationId:e.entry.id,type:e.entry.type,fields:Object.keys(e.savingFields),version:this._version,retryCount:e.retryCount});let n={};for(let t of Object.keys(e.savingFields))if(this._isCrdtManagedField(t)){let e=this._pendingFieldTimestamps.get(t);e!==void 0&&(n[t]=e)}let r=t.entry.transportOverride,i=()=>({operationPathKey:r?.operationPathKey??this._config.operationPathKey??this._config.resourceType,contextualParameters:r?.contextualParameters??this._config.contextualParameters,parentResourcesRequirements:r?.parentResourcesRequirements??this._config.parentResourcesRequirements,requestData:r?.requestData??(hz.has(e.entry.type)?WE(mz(e.savingFields,this._confirmedData),this._discriminatorFieldNames,this._confirmedData):mz(e.savingFields,this._confirmedData)),expectedVersion:this._version,signal:e.abortController.signal,fieldTimestamps:Object.keys(n).length>0?n:void 0}),a;try{a=this._config.transportAdapter.execute(i())}catch(e){a=Promise.reject(e)}a.then(async e=>{if(this._activeMutation!==t){dz(`_executeTransport: stale callback — ignored`,{mutationId:t.entry.id});return}let n=Object.keys(t.savingFields),i=t.entry.source,a=e.status===EE.SUCCESS&&!e.heldForApproval&&r?.readBackOnSuccess?await this._readBackConfirmedState(e):e;if(a.status===EE.SUCCESS){dz(`_executeTransport: success`,{mutationId:t.entry.id,savedFields:n,newVersion:a.newVersion});let e=a.fieldMeta??a.data?._field_meta;e!=null&&(this._fieldMeta=qe(e));for(let e of n)this._pendingFieldTimestamps.delete(e);let r=Object.entries(t.savingFields).filter(([,e])=>e===null).map(([e])=>e),o=hz.has(t.entry.type)?t.savingFields:void 0;this._transition({type:_z.SAVE_SUCCESS,result:a,savedFields:n,savedValues:o,clearedFields:r,source:i}),this._activeMutation=null,this._recordProducedVersion(a.newVersion),this._processDeferredSelfEvents(a.newVersion),this._invalidateSnapshot(),t.entry.resolve(a.heldForApproval?{success:!0,savedFields:[],heldForApproval:a.heldForApproval}:{success:!0,savedFields:n,savedValues:o,newVersion:a.newVersion,responseData:a.data}),this._processQueue(),this._notifyDrained()}else dz(`_executeTransport: error`,{mutationId:t.entry.id,errorType:a.error?.type,errorStatus:a.error?.status,errorMessage:a.error?.message,savedFields:n}),this._transition({type:_z.SAVE_ERROR,result:a,savedFields:n,source:i}),this._state===xE.ERROR||(this._state===xE.CONFLICT?(this._activeMutation=null,this._processDeferredSelfEvents(a.newVersion),this._invalidateSnapshot(),t.entry.resolve({success:!1,savedFields:n,error:{type:TE.CONFLICT,conflictDetails:a.error?.conflictDetails}}),this._notifyDrained()):a.error?.type===TE.ABORT?(this._activeMutation=null,this._processDeferredSelfEvents(a.newVersion),this._invalidateSnapshot(),t.entry.reject(new jE(t.entry.source)),this._processQueue(),this._notifyDrained()):(this._activeMutation=null,this._processDeferredSelfEvents(a.newVersion),this._invalidateSnapshot(),t.entry.resolve({success:!1,savedFields:n,error:a.error?{type:a.error.type,status:a.error.status,validationErrors:a.error.validationErrors,message:a.error.message,cause:a.error.cause}:void 0}),this._processQueue(),this._notifyDrained()))},e=>{if(this._activeMutation!==t){dz(`_executeTransport: stale rejection — ignored`,{mutationId:t.entry.id});return}let n=Object.keys(t.savingFields),r=t.entry.source;dz(`_executeTransport: transport rejected`,{mutationId:t.entry.id,error:Ca(e),savedFields:n}),this._transition({type:_z.SAVE_ERROR,result:{status:EE.ERROR,error:{type:TE.TRANSIENT,message:Ca(e),cause:e}},savedFields:n,source:r}),this._state===xE.ERROR||(this._activeMutation=null,this._processDeferredSelfEvents(void 0),this._invalidateSnapshot(),t.entry.resolve({success:!1,savedFields:n,error:{type:TE.TRANSIENT,message:Ca(e),cause:e}}),this._processQueue(),this._notifyDrained())})}async _readBackConfirmedState(e){let t=this._config.readOperationPathKey;if(!t)return e;let n=await this._config.transportAdapter.execute({operationPathKey:t,contextualParameters:this._config.contextualParameters,parentResourcesRequirements:this._config.parentResourcesRequirements,dataMode:wn.RAW,signal:void 0});return n.status===EE.SUCCESS?(this._clearAuthoritativeRecoveryTimer(),this._allowSettledSelfEventRepair=!1,{...e,data:n.data,newVersion:n.newVersion??e.newVersion,fieldMeta:n.fieldMeta??e.fieldMeta}):(this._allowSettledSelfEventRepair=!0,this._scheduleAuthoritativeRecovery(),dz(`_readBackConfirmedState: falling back to mutation response`,{errorType:n.error?.type,errorStatus:n.error?.status}),{...e,data:void 0,fieldMeta:void 0})}_applyConfirmedClears(e,t){if(!e?.length||!this._confirmedData)return;let n=structuredClone(this._confirmedData);for(let r of e)t&&pz(t,r)!==void 0||gz(n,r,void 0);this._confirmedData=n}_mergeResponseDataIntoConfirmed(e){let t=this._confirmedData===null?{}:structuredClone(this._confirmedData);for(let[n,r]of Object.entries(e))gz(t,n,r);this._confirmedData=t}_getOptimisticData(){if(!this._confirmedData)return null;if(this._pendingFields.size===0&&!this._activeMutation)return this._confirmedData;if(this._optimisticDataVersion===this._snapshotVersion)return this._cachedOptimisticData;let e=structuredClone(this._confirmedData);if(this._activeMutation)for(let[t,n]of Object.entries(this._activeMutation.savingFields))gz(e,t,n);for(let[t,n]of this._pendingFields)gz(e,t,n);return this._cachedOptimisticData=e,this._optimisticDataVersion=this._snapshotVersion,e}_invalidateSnapshot(){this._snapshotVersion++,this._cachedSnapshot=null;for(let e of this._snapshotListeners)e()}_applyRemoteUpdateInternal(e,t,n,r,i=!1){if(this._state===xE.DELETED)return;let a=this._version;this._clearAuthoritativeRecoveryTimer();let o=structuredClone(this._confirmedData??{});if(this._activeMutation)for(let[e,t]of Object.entries(this._activeMutation.savingFields))gz(o,e,t);for(let[e,t]of this._pendingFields)gz(o,e,t);if(this._version!==null&&(i?t<this._version:t<=this._version)){dz(`_applyRemoteUpdateInternal: stale — ignored`,{incomingVersion:t,currentVersion:this._version});return}let s=Object.keys(e),c=[...this._pendingFields.keys()],l=this._activeMutation?Object.keys(this._activeMutation.savingFields):[],u=[...new Set([...l,...c])],d=s.filter(e=>u.some(t=>jM(e,t)));dz(`_applyRemoteUpdateInternal`,{version:t,changedFields:s,overlappingFields:d,initiatorUserId:n,state:this._state});let f=[],p=[];for(let e of d)this._isCrdtManagedField(e)?f.push(e):p.push(e);let m=[],h={},g=structuredClone(this._confirmedData??{});for(let t of s)d.includes(t)||(gz(g,t,e[t]),m.push(t));for(let t of f){let n=u.find(e=>jM(t,e)),i=r?.[t]?.ts??0,a=n?this._pendingFieldTimestamps.get(n)??0:0,o=Ki(i,a);h[t]=o,o===Oe.INCOMING?(n&&(this._pendingFields.delete(n),this._pendingFieldTimestamps.delete(n)),gz(g,t,e[t]),m.push(t),dz(`CRDT LWW: remote wins`,{field:t,remoteTs:i,localTs:a})):dz(`CRDT LWW: local wins (keep pending)`,{field:t,remoteTs:i,localTs:a})}this._confirmedData=g,r!=null&&(this._fieldMeta={...qe(this._fieldMeta),...qe(r)}),this._version=t;let _=Object.keys(h).length>0?h:void 0;if(p.length===0||this._config.conflictPolicy.strategy===DE.LAST_WRITE_WINS){this._transition({type:_z.REMOTE_UPDATE,changedFields:s,mergedFields:m,version:t,initiatorUserId:n,crdtResolutions:_});return}let v=new Map,y=new Map;for(let e of f){let t=u.find(t=>jM(e,t)),n=t?this._pendingFieldTimestamps.get(t)??0:0,i=r?.[e]?.ts??0;if(t&&Ki(i,n)===Oe.EXISTING&&this._pendingFields.has(t)){v.set(t,this._pendingFields.get(t));let e=this._pendingFieldTimestamps.get(t);e!==void 0&&y.set(t,e)}}let b=structuredClone(this._confirmedData??{});for(let[t,n]of Object.entries(e))gz(b,t,n);let x=u.filter(e=>!v.has(e)),S={currentVersion:t,expectedVersion:a??t,conflictingFields:d,currentValues:Object.fromEntries(d.map(e=>[e,MM(b,e)])),submittedValues:Object.fromEntries(d.map(e=>[e,MM(o,e)]))};this._transition({type:_z.CONFLICT_DETECTED,discardedFields:x,reason:OE.REMOTE_UPDATE,currentData:b,currentVersion:t,conflictDetails:S});for(let[e,t]of v)this._pendingFields.set(e,t);for(let[e,t]of y)this._pendingFieldTimestamps.set(e,t)}_processDeferredSelfEvents(e){if(this._deferredSelfEvents.length===0)return;let t=this._deferredSelfEvents;this._deferredSelfEvents=[];for(let n of t)if(e!==void 0&&n.version===e){if(this._allowSettledSelfEventRepair){this._clearAuthoritativeRecoveryTimer(),this._allowSettledSelfEventRepair=!1,dz(`_processDeferredSelfEvents: accepting deferred self-event after canonical read-back miss`,{version:n.version}),this._applyRemoteUpdateInternal(n.changedFields,n.version,n.initiatorUserId,n.fieldMeta,!0);continue}dz(`_processDeferredSelfEvents: discarded (version matches response)`,{version:n.version})}else dz(`_processDeferredSelfEvents: processing as remote change`,{eventVersion:n.version,responseVersion:e}),this._applyRemoteUpdateInternal(n.changedFields,n.version,n.initiatorUserId,n.fieldMeta)}_clearTimers(){this._retryTimer&&=(clearTimeout(this._retryTimer),null),this._softTimer&&=(clearTimeout(this._softTimer),null),this._hardTimer&&=(clearTimeout(this._hardTimer),null)}_scheduleAuthoritativeRecovery(){this._authoritativeRecoveryTimer||this._state===xE.DELETED||(this._authoritativeRecoveryTimer=setTimeout(()=>{this._authoritativeRecoveryTimer=null,this._retryAuthoritativeRecovery()},this._serverRetryDelay))}_clearAuthoritativeRecoveryTimer(){this._authoritativeRecoveryTimer&&=(clearTimeout(this._authoritativeRecoveryTimer),null)}async _retryAuthoritativeRecovery(){if(this._state===xE.DELETED||!this._allowSettledSelfEventRepair)return;let e=this._config.readOperationPathKey;if(!e)return;let t=await this._config.transportAdapter.execute({operationPathKey:e,contextualParameters:this._config.contextualParameters,parentResourcesRequirements:this._config.parentResourcesRequirements,dataMode:wn.RAW,signal:void 0});if(t.status!==EE.SUCCESS||!t.data){dz(`_retryAuthoritativeRecovery: canonical reread still unavailable`,{errorType:t.error?.type,errorStatus:t.error?.status});return}let n=t.newVersion??this._version;n==null?dz(`_retryAuthoritativeRecovery: canonical reread missing version`,{resourceId:this._resourceId}):(dz(`_retryAuthoritativeRecovery: restored canonical confirmed state`,{resourceId:this._resourceId,version:n}),this.setInitialState(t.data,n,t.fieldMeta))}_startBackpressureTimers(){this._softTimer||(this._softTimer=setTimeout(()=>{this._softTimer=null,this._activeMutation&&(dz(`backpressure: soft timeout`,{mutationId:this._activeMutation.entry.id,timeoutMs:this._backpressure.softTimeoutMs}),this._lastEvent={type:SE.MUTATION_RESULT,result:{success:!1,error:{type:TE.TRANSIENT,message:`Operation taking longer than expected`}},source:this._activeMutation.entry.source,id:++this._eventCounter},this._invalidateSnapshot())},this._backpressure.softTimeoutMs),this._hardTimer=setTimeout(()=>{this._hardTimer=null,this._clearTimers(),dz(`backpressure: hard timeout — aborting`,{mutationId:this._activeMutation?.entry.id,timeoutMs:this._backpressure.hardTimeoutMs});let e=this._activeMutation?.entry.source;this._activeMutation&&=(this._activeMutation.abortController.abort(),this._activeMutation.entry.reject(new jE(this._activeMutation.entry.source)),null),this._deferredSelfEvents=[];let t=this._queue.length>0||this._pendingFields.size>0?xE.QUEUED:xE.IDLE;this._state=t,this._lastError=t===xE.IDLE?null:{type:TE.TRANSIENT,message:`Hard timeout exceeded`},this._lastEvent={type:SE.MUTATION_RESULT,result:{success:!1,error:{type:TE.TRANSIENT,message:`Hard timeout exceeded`},retriesRemaining:0},source:e??vz,id:++this._eventCounter},this._invalidateSnapshot(),this._processQueue(),this._notifyDrained()},this._backpressure.hardTimeoutMs))}_autoCoalesceQueue(){if(this._queue.length<=1||this._queue.some(e=>e.transportOverride!==void 0))return;let e=0;for(let t=1;t<this._queue.length;t++)this._queue[t].priority>=this._queue[e].priority&&(e=t);let t=this._queue[e],n=[];for(let r=0;r<this._queue.length;r++){if(r===e)continue;let i=this._queue[r];for(let[e,n]of Object.entries(i.fields))e in t.fields||(t.fields[e]=n);n.push(i)}dz(`_autoCoalesceQueue`,{survivorId:t.id,absorbedCount:n.length,absorbedIds:n.map(e=>e.id),mergedFieldCount:Object.keys(t.fields).length});let r=t.resolve,i=t.reject;t.resolve=e=>{r(e);for(let t of n)t.resolve(e)},t.reject=e=>{i(e);for(let t of n)t.reject(e)},this._queue=[t]}_notifyDrained(){if(!(this._activeMutation!==null||this._queue.length>0)){for(let e of this._onDrainCallbacks)e();this._onDrainCallbacks=[]}}},xz=Jo.getLogger(),Sz=xz.debugByType(`RMMRegistry`);xz.setDebugTypeLogging(`RMMRegistry`,!1);var Cz=class{_instances=new Map;_activeInstanceListeners=new Set;_activeInstancesEmitScheduled=!1;MAX_INSTANCES;_clockOffset=0;constructor(e){this.MAX_INSTANCES=e?.maxInstances??200,Sz(`constructor`,{maxInstances:this.MAX_INSTANCES})}get clockOffset(){return this._clockOffset}setClockOffset(e){this._clockOffset=e;for(let[,t]of this._instances)t.refCount>0&&!t.destroying&&(t.rmm.clockOffset=e)}getOrCreate(e,t,n){let r=this.keyFor(e,t),i=this._instances.get(r);if(i&&!i.destroying){i.destroyTimer&&(clearTimeout(i.destroyTimer),i.destroyTimer=null,Sz(`getOrCreate: cancelled pending destroy`,{key:r}));let e=i.rmm.readOperationPathKey;return n.readOperationPathKey!==void 0&&e!==void 0&&n.readOperationPathKey!==e&&xz.warn(`RMMRegistry updating canonical read path on reused instance`,{key:r,previousReadOperationPathKey:e,nextReadOperationPathKey:n.readOperationPathKey}),i.rmm.syncRuntimeRoutingConfig({transportAdapter:n.transportAdapter,currentUserId:n.currentUserId,contextResourceIdentifiers:n.contextResourceIdentifiers,contextualParameters:n.contextualParameters,parentResourcesRequirements:n.parentResourcesRequirements,operationPathKey:n.operationPathKey,readOperationPathKey:n.readOperationPathKey,conflictPolicy:n.conflictPolicy,resourceSchema:n.resourceSchema,resourceInheritance:n.resourceInheritance}),i.refCount++,i.lastAccessedAt=Date.now(),Sz(`getOrCreate: reused`,{key:r,refCount:i.refCount}),this._emitActiveInstancesChanged(),i.rmm}i?.destroying&&(Sz(`getOrCreate: old instance mid-destroy, replacing`,{key:r}),this._instances.delete(r)),this._evictIfNeeded();let a=new bz(n);return this._clockOffset!==0&&(a.clockOffset=this._clockOffset),this._instances.set(r,{rmm:a,refCount:1,destroyTimer:null,lastAccessedAt:Date.now(),destroying:!1}),Sz(`getOrCreate: created`,{key:r,instanceCount:this._instances.size}),this._instances.size>=this.MAX_INSTANCES*.8&&xz.warn(`RMMRegistry approaching capacity`,{current:this._instances.size,max:this.MAX_INSTANCES}),this._emitActiveInstancesChanged(),a}get(e,t){return this._instances.get(this.keyFor(e,t))?.rmm}getActiveInstances(){let e=[];for(let[t,n]of this._instances)if(n.refCount>0&&!n.destroying){let r=t.indexOf(`:`);if(r<0)continue;let i=t.substring(0,r),a=t.substring(r+1);e.push({key:t,resourceType:i,resourceId:a,rmm:n.rmm})}return e}subscribeActiveInstances(e){return this._activeInstanceListeners.add(e),e(this.getActiveInstances()),()=>{this._activeInstanceListeners.delete(e)}}notifyInstanceRuntimeChanged(){this._emitActiveInstancesChanged()}keyFor(e,t){return`${e}:${t}`}release(e){let t=this._instances.get(e);t&&(t.refCount--,Sz(`release`,{key:e,refCount:t.refCount}),t.refCount<=0&&(t.refCount=0,t.destroyTimer||=setTimeout(()=>{t.destroyTimer=null,t.destroying=!0,Sz(`release: destroy timer fired`,{key:e}),t.rmm.destroy().then(()=>this.remove(e)).catch(()=>{Sz(`release: destroy failed, force-removing`,{key:e}),this.remove(e)})},100)),this._emitActiveInstancesChanged())}remove(e){let t=this._instances.get(e);t&&(t.destroyTimer&&clearTimeout(t.destroyTimer),this._instances.delete(e),Sz(`remove`,{key:e,remainingInstances:this._instances.size}),this._emitActiveInstancesChanged())}destroy(){Sz(`destroy: cleaning up all instances`,{count:this._instances.size});for(let[e,t]of this._instances)t.destroyTimer&&clearTimeout(t.destroyTimer),t.rmm.destroy().catch(()=>{Sz(`destroy: instance cleanup failed`,{key:e})});this._instances.clear(),this._emitActiveInstancesChanged()}_evictIfNeeded(){if(this._instances.size<this.MAX_INSTANCES)return;let e=null,t=1/0;for(let[n,r]of this._instances)r.refCount===0&&r.lastAccessedAt<t&&(e=n,t=r.lastAccessedAt);if(e){let n=this._instances.get(e);n.destroyTimer&&clearTimeout(n.destroyTimer),Sz(`_evictIfNeeded: evicting LRU`,{key:e,lastAccessedAt:t}),n.rmm.destroy().catch(()=>{Sz(`_evictIfNeeded: eviction cleanup failed`,{key:e})}),this._instances.delete(e)}else xz.warn(`RMMRegistry at capacity with no idle instances to evict`,{instanceCount:this._instances.size,maxInstances:this.MAX_INSTANCES})}_emitActiveInstancesChanged(){this._activeInstanceListeners.size!==0&&(this._activeInstancesEmitScheduled||(this._activeInstancesEmitScheduled=!0,queueMicrotask(()=>{if(this._activeInstancesEmitScheduled=!1,this._activeInstanceListeners.size===0)return;let e=this.getActiveInstances();for(let t of this._activeInstanceListeners)t(e)})))}},wz=Jo.getLogger(),Tz=wz.debugByType(`RMMClockSync`);wz.setDebugTypeLogging(`RMMClockSync`,!1);function Ez(e){return e.length===0?0:e.reduce((e,t)=>t.rtt<e.rtt?t:e).offset}async function Dz(e){let t=[];for(let n=0;n<5;n++)try{let n=Date.now(),r=await fetch(`${e}${Su[zi.HEALTH_TIME]}`),i=Date.now(),a=r.headers.get(ks.X_SERVER_TIME);if(a){let e=Number(a),r=i-n,o=e-(i-r/2);t.push({offset:o,rtt:r})}}catch{}return t}async function Oz(e,t){let n=await Dz(e);if(n.length>0){let e=Ez(n),r=n.reduce((e,t)=>Math.min(e,t.rtt),1/0);t.setClockOffset(e),Tz(`calibrated`,{offset:e,sampleCount:n.length,minRtt:r})}return Date.now()}var kz=(0,Q.createContext)(void 0);function Az({children:e,options:t,apiBaseUrl:n}){let r=(0,Q.useMemo)(()=>new Cz(t),[]),i=(0,Q.useRef)(0);return(0,Q.useEffect)(()=>{if(!n)return;Oz(n,r).then(e=>{i.current=e});let e=setInterval(()=>{Oz(n,r).then(e=>{i.current=e})},age);return()=>{clearInterval(e)}},[r,n]),(0,Q.useEffect)(()=>{if(!n)return;function e(){document.visibilityState===`visible`&&Date.now()-i.current>=3e5&&Oz(n,r).then(e=>{i.current=e})}return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[r,n]),(0,Q.useEffect)(()=>()=>r.destroy(),[r]),(0,$.jsx)(kz.Provider,{value:r,children:e})}var jz=wn.RAW;function Mz(e,t,n){let r=t.resourceConfigurations[e],i=r?.operations??[],a=(e,n)=>Th({resourceConfig:r,operations:e,coreOperation:W.READ,registry:t,hasResourceId:n.hasResourceId,contextResourceIdentifiers:n.contextResourceIdentifiers,contextualParameters:n.contextualParameters,preferredVariantKey:n.actingOperation?.variantKey}),o=n?.actingOperation?.admitsCrossTenantPlatformAdministration===!0?a(i.filter(e=>e.admitsCrossTenantPlatformAdministration===!0),n):void 0,s=n?o??a(i,n):Il(i,W.READ);if(s||!n||n.hasResourceId===!0)return s;let c=Aa(i,W.READ).filter(e=>e.isOperationDefault!==!0&&e.isBulkOperation!==!0&&(e.initiatorInfos??[]).some(e=>(e.parameters??[]).some(e=>n.contextResourceIdentifiers?.[String(e.resourceType)]!==void 0||n.contextualParameters?.[e.fieldIdentifier]!==void 0)));return c.length===1?c[0]:void 0}function Nz(e,t,n){let r=t.resourceConfigurations[e]?.operations??[],i=Aa(r,W.READ),a=Mz(e,t,n);if(a)return gl.createOperationPathKeyFromOperation(a);if(i.length===0||n)return;let o=i.filter(e=>e.isOperationDefault===!0&&e.isBulkOperation!==!0);if(o.length===1)return gl.createOperationPathKeyFromOperation(o[0])}function Pz(e){return e.loadedOperationPathKey===e.canonicalReadOperationPathKey&&e.dataMode===jz}async function Fz(e){return e.doOperation(e.readOperationPathKey,{contextualParameters:e.contextualParameters,parentResourcesRequirements:e.parentResourcesRequirements,dataMode:jz})}var Iz=Jo.getLogger(),Lz=Iz.debugByType(`useListInvalidation`);Iz.setDebugTypeLogging(`useListInvalidation`,!1);function Rz(e,t){let n=(0,Q.useSyncExternalStore)(e?.subscribe??NM,e?.getSnapshot??PM),{emit:r}=vo(),i=(0,Q.useContext)(Sm)?.isConnected??!1,a=(0,Q.useRef)(i);a.current=i;let o=(0,Q.useRef)(t);o.current=t,(0,Q.useEffect)(()=>{if(e&&n.lastEvent?.type===SE.MUTATION_RESULT&&n.lastEvent.result.success&&!a.current){let t=n.lastEvent.result,i=hy({resourceType:e.resourceType,registry:o.current.registry,callContext:o.current.contextResourceIdentifiers,previousRow:t.previousConfirmedData,row:t.responseData}),s=py({resourceType:e.resourceType,registry:o.current.registry,scopes:i}),c=s.length>0?s:[null];for(let t of c){let n={resourceType:e.resourceType,operationIdentifier:String(t?.operationIdentifier??W.LIST),variantType:t?.variantType,isOperationDefault:t?.isOperationDefault??!0,isBulkOperation:t?.isBulkOperation??!1,variantKey:t?.variantKey,contextResourceIdentifiers:i.contextResourceIdentifiers,...i.previousContextResourceIdentifiers?{previousContextResourceIdentifiers:i.previousContextResourceIdentifiers}:{},parentResourcesRequirements:o.current.parentResourcesRequirements,operation:t??{operationIdentifier:W.LIST}};r(hc.RESOURCE_REFRESH,n)}Lz(`list invalidation triggered`,{resourceType:e.resourceType,isConnected:a.current})}},[n.lastEvent?.id])}var zz=Jo.getLogger(),Bz=zz.debugByType(`useResourceRMM`);zz.setDebugTypeLogging(`useResourceRMM`,!1);var Vz={strategy:DE.ACCEPT_REMOTE},Hz;(function(e){e.PROVIDER_MISSING=`PROVIDER_MISSING`,e.DISABLED=`DISABLED`,e.MISSING_RESOURCE_ID=`MISSING_RESOURCE_ID`,e.NO_ELIGIBLE_UPDATE_OPERATION=`NO_ELIGIBLE_UPDATE_OPERATION`})(Hz||={});function Uz(e){let{resourceType:t,resourceId:n,doOperationRef:r,contextualParameters:i,parentResourcesRequirements:a,contextResourceIdentifiers:o,resourceSchema:s,resourceInheritance:c,enabled:l=!0,conflictPolicy:u=Vz,directFallbackAccepted:d=!1,actingOperation:f}=e,p=(0,Q.useContext)(kz),{registry:m}=wm(),h=(0,Q.useContext)(_h),g=h?.primaryScopeInitiatorIds?.userId??null,_=(0,Q.useRef)(``);(h?.user?._id||g)&&(_.current=h?.user?._id??g);let v=h?.user?._id??g??_.current,y=m.resourceConfigurations[t],b=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(o),[o]),x=(0,Q.useMemo)(()=>JSON.stringify(a??null),[a]),S=n?String(n):``,C=(0,Q.useMemo)(()=>new ege((...e)=>r.current(...e)),[]),w=wS(Dh(t,S||void 0,o)),T=(0,Q.useMemo)(()=>rh({resourceConfig:y,operations:y?.operations??[],registry:m,hasResourceId:!!S,contextResourceIdentifiers:o,contextualParameters:i,viewer:w}),[b,i,m,y,S,w]),E=(0,Q.useMemo)(()=>T?gl.createOperationPathKeyFromOperation(T):null,[t,T]),D=(0,Q.useMemo)(()=>Nz(t,m,{hasResourceId:!!S,contextResourceIdentifiers:o,contextualParameters:i,actingOperation:f}),[f?.admitsCrossTenantPlatformAdministration,f?.variantKey,b,i,m,y?.operations,S,t]),O=(0,Q.useMemo)(()=>l?S?T?p?null:Hz.PROVIDER_MISSING:Hz.NO_ELIGIBLE_UPDATE_OPERATION:Hz.MISSING_RESOURCE_ID:Hz.DISABLED,[l,S,p,T]),k=(0,Q.useMemo)(()=>O===Hz.DISABLED?(Bz(`RMM unavailable because attachment is disabled for this surface.`,{resourceType:t,resourceId:S}),null):O===Hz.MISSING_RESOURCE_ID?(Bz(`RMM unavailable because no resource id is attached to the current surface.`,{resourceType:t}),null):O===Hz.NO_ELIGIBLE_UPDATE_OPERATION&&d?(Bz(`RMM unavailable because no eligible UPDATE-like operation resolves; the caller runs directly, as the operation declared.`,{resourceType:t,resourceId:S}),null):O===Hz.NO_ELIGIBLE_UPDATE_OPERATION?(zz.warn(`[useResourceRMM] RMM unavailable because no eligible UPDATE-like operation could be resolved for this surface. Default update-like surfaces should fail closed unless they explicitly opt into a weaker direct-operation fallback.`,{resourceType:t,resourceId:S}),null):O===Hz.PROVIDER_MISSING?(zz.warn(`[useResourceRMM] RMM unavailable because RMMRegistryProvider is not mounted. Default update-like surfaces should fail closed unless they explicitly opt into a weaker direct-operation fallback.`,{resourceType:t,resourceId:S}),null):p.getOrCreate(t,S,{resourceType:t,resourceId:S,transportAdapter:C,operationPathKey:E,readOperationPathKey:D,conflictPolicy:u,currentUserId:v,contextResourceIdentifiers:ju(o),contextualParameters:i,parentResourcesRequirements:a,resourceSchema:s,resourceInheritance:c}),[d,E,D,p,t,S,O]);(0,Q.useEffect)(()=>{k&&E&&(k.syncRuntimeRoutingConfig({transportAdapter:C,currentUserId:v,contextResourceIdentifiers:ju(o),contextualParameters:i,parentResourcesRequirements:a,operationPathKey:E,readOperationPathKey:D,conflictPolicy:u,resourceSchema:s,resourceInheritance:c}),p?.notifyInstanceRuntimeChanged())},[k,p,v,u.strategy,b,E,D,x,i,s,c,C]),(0,Q.useEffect)(()=>{if(!k||!p||!S)return;let e=p.keyFor(t,S);return()=>{p.release(e)}},[k,p,t,S]);let A=(0,Q.useSyncExternalStore)(k?.subscribe??NM,k?.getSnapshot??PM);return Rz(k,{contextResourceIdentifiers:ju(o),parentResourcesRequirements:a??[],registry:m}),{rmm:k,rmmSnapshot:A,rmmRegistry:p??null,rmmUnavailableReason:O,canonicalReadOperationPathKey:D}}function Wz(e,t){return e.replace(`{fields}`,t.join(`, `))}function Gz(e,t){return t?typeof e==`object`&&e&&t in e?e[t]:t.replace(/\[(\d+)\]/g,`.$1`).split(`.`).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e):e}function Kz(e,t){if(e==null||e===``)return t;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return String(e);try{let n=JSON.stringify(e);return n?n.length>120?`${n.slice(0,117)}...`:n:t}catch{return String(e)}}var qz=e=>{let{renderIcon:t}=Rf();if(e.type===`conflict`){let n=e.conflictDetails?.conflictingFields?.length?e.conflictDetails.conflictingFields:e.discardedFields;return(0,$.jsxs)(UD,{variant:`warning`,children:[t(H.WARNING,{size:fa.SM}),(0,$.jsxs)(`div`,{className:`flex flex-1 items-center justify-between gap-element`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(WD,{children:e.labels.title}),(0,$.jsx)(GD,{children:Wz(e.labels.message,n)}),e.conflictDetails&&n.length>0&&(0,$.jsx)(`div`,{className:`mt-item-xs space-y-item-xs`,children:n.map(t=>(0,$.jsxs)(`div`,{className:`rounded-md border border-border/60 bg-background/40 px-item-sm py-item-xs`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:t}),(0,$.jsxs)(`div`,{className:`mt-item-xs grid grid-cols-[auto_1fr] items-baseline gap-x-item-sm gap-y-[2px] text-xs`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e.labels.currentValue}),(0,$.jsx)(`code`,{className:`min-w-0 truncate text-muted-foreground`,children:Kz(Gz(e.conflictDetails?.currentValues,t),e.labels.emptyValue)}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e.labels.submittedValue}),(0,$.jsx)(`code`,{className:`min-w-0 truncate font-medium text-foreground`,children:Kz(Gz(e.conflictDetails?.submittedValues,t),e.labels.emptyValue)})]})]},t))})]}),(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.SM,onClick:e.onDismiss,className:`shrink-0`,children:e.labels.acknowledgeButton})]})]})}return(0,$.jsxs)(UD,{variant:`info`,className:`mb-item-xs`,children:[t(H.INFO,{size:fa.SM}),(0,$.jsxs)(`div`,{className:`flex flex-1 items-center justify-between`,children:[(0,$.jsx)(GD,{children:Wz(e.labels.message,e.changedFields)}),(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.SM,onClick:e.onDismiss,"aria-label":e.labels.dismissAriaLabel,className:`shrink-0`,children:t(H.CLOSE,{size:fa.SM})})]})]})},Jz=`relationship.quick_create.completed`;function Yz(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`quick-create-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Xz(e){if(!e.result||typeof e.result!=`object`||Array.isArray(e.result))return;let t=e.result,n=t[e.registry.resourceConfigurations?.[e.resourceType]?.resourceFieldIdentifier??e.registry.allResourceFieldIdentifiers?.[e.resourceType]??`_id`]??t._id;return typeof n==`string`&&n!==``?n:void 0}function Zz(e){let{registry:t}=wm(),{on:n}=vo(),{navigate:r}=zS(),[i,a]=(0,Q.useState)(!1),o=(0,Q.useRef)(null),s=(0,Q.useMemo)(()=>{if(e.sourceResourceType&&e.sourceFieldName)return zj({resourceType:e.sourceResourceType,fieldName:e.sourceFieldName,operationType:e.operationType,relatedResourceType:e.relatedResourceType,registry:t}).inlineEditSurface?.quickCreate},[e.sourceFieldName,e.sourceResourceType,e.operationType,e.relatedResourceType,t]),c=(0,Q.useMemo)(()=>{if(s)return s.relatedCreateOperation},[s]);(0,Q.useEffect)(()=>n(hc.RESOURCE_CUSTOM_EVENT,t=>{let n=t.data;n&&n.requestId===o.current&&(o.current=null,a(!1),e.onCreated?.(n))},e=>e.eventName===Jz&&e.data?.requestId===o.current),[n,e]),(0,Q.useEffect)(()=>n(hc.NAVIGATION_CLOSE,()=>{a(!1)}),[n]);let l=(0,Q.useCallback)(()=>{if(!s||!s.allowQuickCreate||!c||!e.navigationZone||!e.sourceFieldName)return;let n=Yz();o.current=n,a(!0);let i={requestId:n,sourceResourceType:e.sourceResourceType,sourceResourceId:e.sourceResourceId,sourceFieldName:e.sourceFieldName,relatedResourceType:s.relatedResourceType},l=gn.createFrontendResourceOperationContextFromOperation({resourceType:s.relatedResourceType,operation:c,contextResourceIdentifiers:gn.withoutSelfReferencingParents(e.contextResourceIdentifiers??{},s.relatedResourceType,t),additionalContext:{quickCreateRequest:i},isOperationDefault:c.isOperationDefault??!0,isBulkOperation:c.isBulkOperation??!1,variantKey:c.variantKey});r({content:{contentType:hd.RESOURCE_OPERATION,resourceContext:l},initiator:Ch.createOperationInitiator(e.navigationZone,e.sourceOperation),relationshipTransition:e.navigationZone===`overlay`?ln.SPLIT:{transition:ln.OVERLAY,ephemeral:!0}})},[s,r,t,e.contextResourceIdentifiers,e.navigationZone,e.sourceFieldName,e.sourceOperation,e.sourceResourceId,e.sourceResourceType,c]);return{canQuickCreate:!!(s?.allowQuickCreate&&c&&e.navigationZone),isLaunching:i,launchQuickCreate:l,relatedCreateOperation:c,config:s}}function Qz(e){e.emit(hc.RESOURCE_CUSTOM_EVENT,{resourceType:e.resourceType,resourceId:e.resourceId,eventName:Jz,data:{requestId:e.requestId,resourceType:e.resourceType,resourceId:e.resourceId,data:e.data}})}function $z(e){return(0,$.jsx)(ZM,{mode:e.resolvedChromeMode,labelPlacement:e.resolvedLabelPlacement,label:e.fieldLabel,description:e.fieldDescription,hideError:e.hideInlineErrorForPolicy,tooltip:e.fieldTooltip,fieldName:e.fieldName,disabled:e.disabled,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-sm`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-item-sm`,children:[(0,$.jsx)(`div`,{className:`min-w-[16rem] flex-1`,children:e.controls}),e.actions]}),(e.actionError||e.isUnavailable)&&(0,$.jsx)(`span`,{className:e.actionError?`text-xs text-destructive`:`text-xs text-muted-foreground`,children:e.actionError??e.unavailableLabel})]})})}var eB=Jo.getLogger();function tB(e){va.isDevelopment()&&eB.warn(`[${e.componentName}] ${e.message}`,e.context)}function nB(e){let t=e.formSchemaContext.contextResourceIdentifiers??{};return{contextResourceIdentifiers:t,parentResourcesRequirements:e.formSchemaContext.parentResourcesRequirements??(Object.keys(t).length>0?V.getInstance().buildParentResourcesRequirements(e.formSchemaContext.resourceType,t,e.registry):[]),contextualParameters:V.buildContextualParameters(t,e.registry)}}function rB(e,t){if(!e)return;let n=t.split(`.`),r=e;for(let e of n){let t=Ju(Nr(r));if(!t||(r=t[e],!r))return}return r}var iB=Jo.getLogger();function aB(e){let t=rw(),n=KD(),r=ZT(),{registry:i,doOperation:a}=wm();Ok(e.fieldName);let{formChromeMode:o,sectionChromeMode:s}=fT(),c=oc(),{tComponent:l}=K(),u=rB(r?.schema,e.fieldName);return{formContext:t,formSchemaContext:n,templateContext:r,registry:i,doOperation:a,fieldSchema:u,resolvedChromeMode:(u?uo(u):void 0)?.chromeMode??s??o??YL(c.autoRender?.autoFieldChrome),resolvedLabelPlacement:XL(c.autoRender?.autoLabelPlacement),resolvedControlSize:ZL(c.autoRender?.autoFieldDensity),hideInlineErrorForPolicy:c.autoRender?.autoErrorPlacement===`summary-at-surface-top`,fieldLabel:r?.fieldLabels?.[e.fieldName]??sr.formatFieldPathFallback(e.fieldName),fieldDescription:r?.fieldDescriptions?.[e.fieldName],fieldTooltip:r?.fieldTooltips?.[e.fieldName],disabled:r?.disabled,readOnly:r?.readOnly,labels:{saveLabel:l(J.LOW_LEVEL_BUTTON,`save`),savingLabel:l(J.LOW_LEVEL_FORM_FIELD,`saving`),clearLabel:l(J.LOW_LEVEL_FORM_FIELD,`clearSelection`),saveFailedLabel:l(J.LOW_LEVEL_FORM_FIELD,`save_failed`),saveConflictLabel:l(J.LOW_LEVEL_FORM_FIELD,`save_conflict`),saveUnavailableLabel:l(J.LOW_LEVEL_FORM_FIELD,`save_unavailable`)}}}function oB(e){(0,Q.useEffect)(()=>{!e.rmm&&va.isDevelopment()&&(e.allowsDirectOperationFallback?iB.warn(`[${e.componentName}] Resource mutation manager unavailable; relationship writes are using weaker-guarantee direct-operation fallback.`,e.context):iB.warn(`[${e.componentName}] Resource mutation manager unavailable; relationship writes are disabled.`,e.context))},[e.allowsDirectOperationFallback,e.componentName,e.context,e.rmm])}function sB({writeSurface:e,replaceOperation:t,initialRelationshipValue:n,hasHydratedInitialValue:r=!1,rmm:i,allowDirectOperationFallback:a=!1}){let o=e.rootFieldName,s=e.relatedResourceType,{formContext:c,formSchemaContext:l,registry:u,doOperation:d,fieldSchema:f,resolvedChromeMode:p,resolvedLabelPlacement:m,resolvedControlSize:h,hideInlineErrorForPolicy:g,fieldLabel:_,fieldDescription:v,fieldTooltip:y,disabled:b,readOnly:x,labels:{saveLabel:S,savingLabel:C,clearLabel:w,saveFailedLabel:T,saveConflictLabel:E,saveUnavailableLabel:D}}=aB({fieldName:o}),O=u.allResourceFieldIdentifiers?.[s],k=c.watch(o),A=k??n,j=!f||sc(f)===bc.ARRAY,M=r||k!==void 0,N=(0,Q.useMemo)(()=>{let e=new Map;if(!O||!A)return e;let t=Array.isArray(A)?A:[A];for(let n of t){if(!n||typeof n!=`object`||Array.isArray(n))continue;let t=n,r=t[O];typeof r==`string`&&r!==``&&e.set(r,t)}return e},[O,A]),P=(0,Q.useMemo)(()=>[...N.keys()],[N]),[F,I]=(0,Q.useState)(void 0),[ee,L]=(0,Q.useState)(!1),[R,te]=(0,Q.useState)(void 0);(0,Q.useEffect)(()=>{I(void 0),L(!1),te(void 0)},[o,l.resourceId]),(0,Q.useEffect)(()=>{I(void 0),L(!1),te(void 0)},[P.join(`|`)]);let z=F??(j?P:P[0]),B=(0,Q.useMemo)(()=>[...new Set(Xw(z))],[z]),ne=!i&&!a||!M,re=(0,Q.useMemo)(()=>{if(B.length!==P.length)return!0;let e=new Set(P);return B.some(t=>!e.has(t))},[P,B]);oB({rmm:i,allowsDirectOperationFallback:a,componentName:`GeneratedAssociationRelationshipField`,context:(0,Q.useMemo)(()=>({fieldName:o}),[o])});let ie=(0,Q.useCallback)(e=>{M&&(I(e),te(void 0))},[M]),ae=(0,Q.useCallback)(()=>{M&&(I(j?[]:void 0),te(void 0))},[M,j]),oe=(0,Q.useCallback)(async e=>{if(M&&l.resourceId&&l.resourceType&&O&&(e.length!==P.length||e.some(e=>!new Set(P).has(e)))){if(!i&&!a)te(D);else{L(!0),te(void 0);try{let{contextualParameters:n,parentResourcesRequirements:r}=nB({formSchemaContext:l,registry:u}),a=e.map(e=>N.get(e)??{[O]:e}),s=gl.createOperationPathKeyFromOperation(t),f={..._l([l.resourceId]),peerIds:e};if(i){let e=await i.queueMutation({[o]:j?a:a[0]??null},{type:CE.CUSTOM,priority:AE.NORMAL,source:{type:wE.FORM,subscriberId:`generated-association:${o}`},transportOverride:{operationPathKey:s,contextualParameters:n,parentResourcesRequirements:r,requestData:f,readBackOnSuccess:!0}});if(!e.success){te(e.error?.type===TE.CONFLICT?E:T);return}}else await d(s,{contextualParameters:n,parentResourcesRequirements:r,requestData:f});c.setValue(o,j?a:a[0]??null,{shouldDirty:!1,shouldValidate:!1}),I(void 0)}catch(t){tB({componentName:`GeneratedAssociationRelationshipField`,message:`Failed to update association relationship`,context:{fieldName:o,action:`save`,desiredPeerIds:e,error:t}}),te(T)}finally{L(!1)}}}},[a,P,N,d,o,c,l.contextResourceIdentifiers,l.parentResourcesRequirements,l.resourceId,l.resourceType,M,re,j,t,u,O,T,D,i]),se=(0,Q.useCallback)(async()=>{await oe(B)},[B,oe]);return!f||!O?null:(0,$.jsx)($z,{fieldName:o,resolvedChromeMode:p,resolvedLabelPlacement:m,resolvedControlSize:h,hideInlineErrorForPolicy:g,fieldLabel:_,fieldDescription:v,fieldTooltip:y,disabled:b,actionError:R,unavailableLabel:D,isUnavailable:ne,controls:(0,$.jsx)(CI,{schema:j?Ud(kd()).optional():kd().optional(),name:o,quickCreateSourceFieldName:e.quickCreate?o:void 0,value:z,onChange:ie,targetResourceType:s,onQuickCreateCreated:e=>{let t=[...new Set([...B,e])];I(j?t:e),te(void 0),oe(t)},onBlur:()=>{},disabled:b||x||ee||ne,readOnly:x,controlSize:h,required:!1,autoFocus:void 0}),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{type:`button`,size:Xd.SM,className:`shrink-0`,disabled:!re||ee||x||ne,onClick:()=>{se()},children:ee?C:S}),(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,size:Xd.SM,className:`shrink-0`,disabled:B.length===0||ee||x||ne,onClick:ae,children:w})]})})}function cB({writeSurface:e,setOperation:t,clearOperation:n,rmm:r,allowDirectOperationFallback:i=!1}){let a=e.rootFieldName,o=e.foreignKeyIdentity?.fieldIdentifier,s=e.relatedResourceType,{formContext:c,formSchemaContext:l,templateContext:u,registry:d,doOperation:f,fieldSchema:p,resolvedChromeMode:m,resolvedLabelPlacement:h,resolvedControlSize:g,hideInlineErrorForPolicy:_,fieldLabel:v,fieldDescription:y,fieldTooltip:b,disabled:x,readOnly:S,labels:{saveLabel:C,savingLabel:w,clearLabel:T,saveFailedLabel:E,saveConflictLabel:D,saveUnavailableLabel:O}}=aB({fieldName:a});o&&rB(u?.schema,o);let k=d.allResourceFieldIdentifiers?.[s],A=c.watch(o),j=c.watch(a),M=(0,Q.useMemo)(()=>{if(typeof A==`string`&&A!==``)return A;if(!k||!j||typeof j!=`object`||Array.isArray(j))return;let e=j[k];return typeof e==`string`&&e!==``?e:void 0},[A,k,j]),[N,P]=(0,Q.useState)(void 0),[F,I]=(0,Q.useState)(void 0),[ee,L]=(0,Q.useState)(!1),[R,te]=(0,Q.useState)(void 0);(0,Q.useEffect)(()=>{P(void 0),I(void 0),L(!1),te(void 0)},[a,l.resourceId]),(0,Q.useEffect)(()=>{P(void 0),I(void 0),L(!1),te(void 0)},[M]);let z=F===void 0?M:F??void 0,B=N??z;oB({rmm:r,allowsDirectOperationFallback:i,componentName:`GeneratedReferenceRelationshipField`,context:(0,Q.useMemo)(()=>({fieldName:a,foreignKeyFieldName:o}),[a,o])});let ne=(0,Q.useCallback)(e=>{Array.isArray(e)||(P(e),te(void 0))},[]),re=(0,Q.useCallback)(async(e,s)=>{if(!l.resourceId||!l.resourceType)return;let u=e===`set`?t:n;if(!u)return;let p=e===`set`?s??B:void 0;if(e!==`set`||p&&p!==z){if(!r&&!i)te(O);else{L(!0),te(void 0);try{let t=gl.createOperationPathKeyFromOperation(u),{contextualParameters:n,parentResourcesRequirements:i}=nB({formSchemaContext:l,registry:d}),s=e===`set`&&p?(()=>{let e=c.getValues(a);return e&&typeof e==`object`&&!Array.isArray(e)?{...e,[k]:p}:{[k]:p}})():void 0,m={..._l([l.resourceId]),...e===`set`?{targetId:p}:{}};if(r){let c=await r.queueMutation({[a]:e===`set`?s:null,[o]:e===`set`?p:null},{type:CE.CUSTOM,priority:AE.NORMAL,source:{type:wE.FORM,subscriberId:`generated-reference:${a}`},transportOverride:{operationPathKey:t,contextualParameters:n,parentResourcesRequirements:i,requestData:m,readBackOnSuccess:!0}});if(!c.success){te(c.error?.type===TE.CONFLICT?D:E);return}}else await f(t,{contextualParameters:n,parentResourcesRequirements:i,requestData:m});c.setValue(a,e===`set`?s:null,{shouldDirty:!1,shouldValidate:!1}),c.setValue(o,e===`set`?p:null,{shouldDirty:!1,shouldValidate:!1}),I(e===`set`?p??null:null),P(void 0)}catch(t){tB({componentName:`GeneratedReferenceRelationshipField`,message:`Failed to update reference relationship`,context:{fieldName:a,foreignKeyFieldName:o,action:e,error:t}}),te(E)}finally{L(!1)}}}},[n,B,z,a,o,l.contextResourceIdentifiers,l.parentResourcesRequirements,l.resourceId,l.resourceType,c,k,d,i,f,r,E,O,t]);return!p||!k||!o?null:(0,$.jsx)($z,{fieldName:a,resolvedChromeMode:m,resolvedLabelPlacement:h,resolvedControlSize:g,hideInlineErrorForPolicy:_,fieldLabel:v,fieldDescription:y,fieldTooltip:b,disabled:x,actionError:R,unavailableLabel:O,isUnavailable:!r&&!i,controls:(0,$.jsx)(CI,{schema:kd().optional(),name:o,quickCreateSourceFieldName:e.quickCreate?a:void 0,value:B,onChange:ne,onQuickCreateCreated:e=>{P(e),te(void 0),re(`set`,e)},onBlur:()=>{},disabled:x||S||ee||!r&&!i,readOnly:S,controlSize:g,required:!1,autoFocus:void 0}),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{type:`button`,size:Xd.SM,className:`shrink-0`,disabled:!N||N===z||ee||S||!r&&!i,onClick:()=>{re(`set`)},children:ee?w:C}),n&&(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,size:Xd.SM,className:`shrink-0`,disabled:!z||ee||S||!r&&!i,onClick:()=>{re(`clear`)},children:T})]})})}var lB=Jo.getLogger(),uB=lB.debugByType(`ResourceAutomatedForm`);lB.setDebugTypeLogging(`ResourceAutomatedForm`,!1);function dB(e,t){return t.replace(/\[(\d+)\]/g,`.$1`).split(`.`).filter(Boolean).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e)}function fB(e,t){let n=e=>e.replace(/\[(\d+)\]/g,`.$1`),r=t.map(n),i={};for(let a of t){let t=n(a);if(r.some(e=>e!==t&&t.startsWith(`${e}.`)))continue;let o=dB(e,a);o!==void 0&&(i[a]=o)}return i}function pB(e,t){let n=e=>e==null||e===``;return n(e)||n(t)?n(e)&&n(t):(0,SC.default)(e,t)}function mB(e){return e.validationErrors?LM({httpStatus:e.status??400,validationErrors:e.validationErrors})!==null:!1}function hB(e){let t=(e.userNotifications||[]).find(e=>{let t=e.channel,n=e.target;return t===Xn.FRONT_END_SUCCESS&&n===Qre.USER_SELF});return t?{identifier:t.identifier,level:t.level||Fn.SUCCESS}:null}function gB(e){switch(e){case W.CREATE:return`create`;case W.UPDATE:case W.UPDATE_MANY:return`saveChanges`;case W.DELETE:return`delete`;default:return`submit`}}function _B(e){return!e.success&&e.error?.type===TE.CONFLICT}function vB(e){return rs(e.operationIdentifier,e.resourceOperationLike)===W.READ||Wc(e)}function yB(e,t,n,r){if(!e||g(t))return e;let i=n?Object.keys(n):[],a=r?sr.getObjectLikeFieldShape(r):void 0;if(i.length!==0&&a)return i.every(e=>Object.prototype.hasOwnProperty.call(a,e))?e:void 0}function bB({Template:e,requestFieldNames:t}){let n=Uk(),r=ZT(),[i,a]=(0,Q.useState)(null);(0,Q.useLayoutEffect)(()=>{let e=n.placedFields(),i=r?.generatedFieldOverrides??{},o=new Set([...Object.keys(r?.contextFieldValues??{}),...r?.hiddenFieldNames??[]].filter(e=>!i[e]));a(t.filter(t=>!e.has(t)&&!o.has(t)))},[]);let[o,s]=(0,Q.useState)(0),c=(0,Q.useCallback)(()=>(s(e=>e+1),()=>s(e=>e-1)),[]),l=!!i&&i.length>0,u=(0,Q.useMemo)(()=>({content:l?(0,$.jsx)(`div`,{className:`flex flex-col gap-field`,"data-guidance-unplaced-request-fields":``,children:i.map(e=>(0,$.jsx)(nR,{name:e},e))}):null,claim:c}),[c,l,i]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Hk.Provider,{value:n,children:(0,$.jsx)(nz.Provider,{value:u,children:(0,$.jsx)(e,{})})}),l&&o===0&&(0,$.jsx)(`div`,{className:`mr-auto mt-section w-full space-y-field`,style:{maxInlineSize:mD(`measure`)},"data-guidance-unplaced-request-fields":``,children:i.map(e=>(0,$.jsx)(nR,{name:e},e))})]})}function xB({resourceContext:e,onSuccess:t,onError:n,onCancel:r,disabled:i=!1,className:a,labelsOverride:o,showErrorSummary:s=!0,validationMode:c,autosaveConfig:l,draftConfig:u,onSectionSave:d,defaultValuesOverride:f,navigationZone:p,updateLikeMutationFallbackMode:m}){let{doOperation:h,registry:_}=wm(),{emit:v}=vo(),{tComponent:b,tResourceOperation:x,isReady:S}=K({component:J.RESOURCES_LAYOUTS_CREATE,resource:e.resourceType}),w=bp(),T=(0,Q.useRef)(h),E=(0,Q.useRef)(v),D=(0,Q.useRef)(n),O=(0,Q.useRef)(t),k=(0,Q.useRef)(null),A=(0,Q.useRef)(d);T.current=h,E.current=v,D.current=n,O.current=t,A.current=d;let M=(0,Q.useMemo)(()=>new Ce,[]),{resourceType:N,operation:P,contextResourceIdentifiers:F}=e,I=iz(e,P),ee=(0,Q.useContext)(Sh),L=(0,Q.useRef)(ee);L.current=ee;let R=(0,Q.useCallback)(e=>Rr(e)?(L.current?.notifyInfo(b(J.RESOURCES_LAYOUTS_CREATE,`operationSentForApproval`)),!0):!1,[b]),te=m??hl(P,_.resourceConfigurations[N]?.operations),z=String(P.operationIdentifier),B=P.variantKey,ne=P.admitsCrossTenantPlatformAdministration===!0,re=(0,Q.useMemo)(()=>({variantKey:B,admitsCrossTenantPlatformAdministration:ne}),[ne,B]),ie=rs(z,P.resourceOperationLike?String(P.resourceOperationLike):void 0),ae=z,oe=P.resourceOperationLike?String(P.resourceOperationLike):void 0,se=oe??ae,ce=QT(ie,se),[le,de]=(0,Q.useState)(!1),[fe,pe]=(0,Q.useState)(!1),[me,he]=(0,Q.useState)(!1),[ge,_e]=(0,Q.useState)(void 0),[ve,ye]=(0,Q.useState)(`none`),[be,xe]=(0,Q.useState)(null),Se=(0,Q.useRef)(null),{initAutoClearing:we,injectServerErrors:Te,clearServerErrors:Ee}=rz(Se),[Oe,ke]=(0,Q.useState)(null),[Ae,je]=(0,Q.useState)(null),[Me,Ne]=(0,Q.useState)(u?.isDraft??!1),[Pe,Fe]=(0,Q.useState)(null),[Ie,Le]=(0,Q.useState)(null),Re=(0,Q.useRef)(null),ze=(0,Q.useMemo)(()=>{let e=P.requestDto;if(!e)return lB.error(`[ResourceAutomatedForm] No requestDto found for operation ${z} on resource ${N}`),e;if(P.isBulkOperation===!0&&e instanceof tae){let t=Ire.filter(t=>t in e.shape),n=t.length>0?e.omit(Object.fromEntries(t.map(e=>[e,!0]))):e;return El(ie)?C(n):n}return e},[ie,P,z,N]),Be=(0,Q.useMemo)(()=>_.resourceConfigurations[N],[_,N]),Ve=(0,Q.useMemo)(()=>UE(Be?.mainSchema),[Be]),He=(0,Q.useMemo)(()=>ie===W.READ||z===W.UPDATE?new Set:new Set([Be?.mainSchema,...vl(Be?.inheritenceSchemaDefinition)].flatMap(e=>[...wne(e)])),[ie,z,Be]),Ue=(0,Q.useCallback)((e,t=!0)=>{let n=f??{},r=t?{...e,...n}:{...e};for(let e of He)Object.prototype.hasOwnProperty.call(n,e)||delete r[e];return r},[f,He]);(0,Q.useMemo)(()=>P.operationFrontendConfig,[P]);let Ge=Be?.frontendConfiguration?.layout?.refs,Ke=Be?.frontendConfiguration?.layout?.defaultChromeMode?.edit,qe=(0,Q.useMemo)(()=>{let e=Be?.inheritenceSchemaDefinition;if(e)return{discriminatorField:e.discriminatorField,withoutInheritanceDiscriminatorFieldValues:e.withoutInheritanceDiscriminatorFieldValues,inheritedSchemas:e.inheritedSchemas}},[Be]),Je=(0,Q.useMemo)(()=>{if(ze)return sr.getObjectLikeFieldShape(ze)},[ze]),Ye=(0,Q.useMemo)(()=>yB(Be?.frontendConfiguration?.layout?.edit,P.operationIdentifier,Je,Be?.inheritenceSchemaDefinition?Vd(V.resolveFieldShapeOfAnyVariant(Be)??{}):Be?.mainSchema),[Be,P.operationIdentifier,Je]),Xe=Be?.frontendConfiguration?.draftableConfig,Ze=(0,Q.useMemo)(()=>{if(Xe||u)return!Xe&&u?u:Xe&&!u?{enabled:!0,isDraft:!1,discriminator:Xe.discriminator,draftValue:Xe.draftValue,publishedValue:Xe.publishedValue,requireConfirmationToPublish:Xe.requireConfirmationToPublish}:{...Xe,...u,enabled:u?.enabled??!!Xe}},[Xe,u]);(0,Q.useEffect)(()=>{Ze?.isDraft!==void 0&&Ne(Ze.isDraft)},[Ze?.isDraft]);let Qe=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(F),[F]),$e=(0,Q.useMemo)(()=>V.buildContextualParameters(F,_),[Qe,_]),et=(0,Q.useMemo)(()=>{if(!Je)return{};let t=V.resolveSemanticContextFieldValues({resourceType:N,parentResourcesRequirements:e.parentResourcesRequirements,contextResourceIdentifiers:F,contextualParameters:$e,registry:_}),n={};for(let[e,r]of Object.entries(t))Je[e]&&(n[e]=r);return n},[Qe,$e,Je,_,e.parentResourcesRequirements,N]),tt=(0,Q.useMemo)(()=>{if(!Je)return{};let e={};for(let t of Object.keys(Je)){let n=jj({resourceType:N,fieldName:t,operationType:se,registry:_});n&&(e[t]=n)}return e},[se,Je,_,N]),nt=Be?.operations??[],it=(0,Q.useContext)(_h)?.permissions?.accessProfile,at=it?.organizationUnitNarrowing,ot=(0,Q.useMemo)(()=>ie===W.CREATE?xue({resourceType:N,resourceConfiguration:Be,formFieldShape:Je,readThroughCreateOrganizationUnits:it?.readThroughCreateOrganizationUnits}):void 0,[it?.readThroughCreateOrganizationUnits,ie,Je,Be,N]),st=Cue({resourceType:Na.ORGANIZATION_UNITS,ids:ot,hostContextualParameters:$e}),ct=Tg(),lt=lm()?.currentOrganizationId??void 0,ut=Be?.resourcePrimaryScope===td.ORGANIZATIONS&&String($e[iu[td.ORGANIZATIONS]]??lt??``)||void 0,dt=(0,Q.useMemo)(()=>wue({roleEntries:it?.roleEntries,organizationId:ut,roleTables:ct,rolesWithinAuthority:it?.rolesWithinAuthority}),[it?.roleEntries,it?.rolesWithinAuthority,ut,ct]),ft=(0,Q.useMemo)(()=>Eue({fieldShape:Je,ceiling:dt,record:ge}),[Je,dt,ge]),pt=(0,Q.useMemo)(()=>Due({fieldShape:Je,ceiling:dt,record:ge}),[Je,dt,ge]),mt=(0,Q.useMemo)(()=>{let e=ot?{[We]:{values:ot,labels:st}}:void 0;return e||ft?{...ft,...e}:void 0},[ot,st,ft]),ht=(0,Q.useMemo)(()=>{if(!Je)return[];let e=[];for(let t of Object.values(tt)){let n=t.rootFieldName,r=e=>nt.find(t=>t.isBulkOperation===!0&&String(t.operationIdentifier)===Nn.buildRelationshipBulkOperationIdentifier(e,n));(()=>{if(t.semantics.nature===cl.COMPOSITION&&t.nestedMutationConfig)return!0;if(t.semantics.nature===cl.REFERENCE){let e=t.foreignKeyIdentity?.fieldIdentifier,n=e?Je[e]:void 0;return!!(n&&y(n)&&!Object.prototype.hasOwnProperty.call(et,e??``))||!!r(Vu.SET)}return t.semantics.nature===cl.ASSOCIATION&&!!r(Vu.REPLACE)})()?e.push(n):va.isDevelopment()&&lB.warn(`[ResourceAutomatedForm] Keeping relationship root visible because no business-facing editor is available`,{resourceType:N,operationType:se,fieldName:n,relationshipNature:t.semantics.nature,hasNestedMutationConfig:!!t.nestedMutationConfig})}return bue({resourceType:N,resourceConfiguration:Be,formFieldShape:Je,organizationUnitNarrowing:at})&&e.push(We),e},[et,se,Je,at,tt,Be,nt,N]),gt=(0,Q.useMemo)(()=>gl.createOperationPathKeyFromOperation(P),[P]),_t=(0,Q.useMemo)(()=>Wc(P),[P]),vt=(0,Q.useMemo)(()=>{let e=gn.getAddressedRecordId({resourceType:N,operation:P,contextResourceIdentifiers:F});if(e)return e;let t=ge&&typeof ge==`object`?ge._id:void 0;return typeof t==`string`&&t.length>0?t:null},[Qe,ge,N,P]),yt=(0,Q.useMemo)(()=>JSON.stringify(e.parentResourcesRequirements??[]),[e.parentResourcesRequirements]),bt=(0,Q.useMemo)(()=>!vt||F[N]?F:{...F,[N]:vt},[Qe,vt,N]),xt=(0,Q.useMemo)(()=>{let e=Be?.resourceFieldIdentifier;return!vt||!e||String($e[e]??``)===vt?$e:{...$e,[e]:vt}},[$e,Be?.resourceFieldIdentifier,vt]),St=(0,Q.useMemo)(()=>{if(!_t||ie!==W.UPDATE||P.operationIdentifier!==W.UPDATE||!Be)return gt;let e=Th({resourceConfig:Be,operations:nt,coreOperation:W.UPDATE,registry:_,hasResourceId:!!vt,contextResourceIdentifiers:bt,contextualParameters:xt});return e?gl.createOperationPathKeyFromOperation(e):gt},[Qe,bt,xt,ie,_t,P.operationIdentifier,gt,_,Be,vt,nt]),Ct=(0,Q.useMemo)(()=>{let t=_t&&ie===W.UPDATE&&z!==W.UPDATE;return{operationPathKey:St,contextualParameters:xt,parentResourcesRequirements:e.parentResourcesRequirements,...t?{readBackOnSuccess:!0}:{}}},[xt,St,ie,_t,z,e.parentResourcesRequirements]),wt=(0,Q.useCallback)(t=>Js({operation:P,requestData:t,additionalContext:e.additionalContext}),[P,e.additionalContext]),{rmm:Tt,rmmSnapshot:Et,canonicalReadOperationPathKey:Dt}=Uz({resourceType:N,resourceId:vt,doOperationRef:T,contextualParameters:xt,parentResourcesRequirements:e.parentResourcesRequirements,contextResourceIdentifiers:bt,resourceSchema:Be?.mainSchema,resourceInheritance:Be?.inheritenceSchemaDefinition,enabled:_t&&!!vt,conflictPolicy:{strategy:DE.ACCEPT_REMOTE},directFallbackAccepted:Un(te),actingOperation:re});Ky({markerId:`rmm:${N}:${vt??``}`,isDirty:!!Tt&&Et.hasUnsavedChanges});let Ot=(0,Q.useMemo)(()=>Un(te),[te]),kt=_t&&!Ot,At=(0,Q.useCallback)(e=>{if(kt&&!Tt)throw new pa({surfaceName:e,resourceType:N,operationIdentifier:z})},[z,kt,N,Tt]);(0,Q.useEffect)(()=>{kt&&!Tt&&va.isDevelopment()&&lB.warn(`[ResourceAutomatedForm] Default update-like mutation path is mounted without RMM. The surface will fail closed unless it explicitly opts into UpdateLikeMutationFallbackMode.DIRECT_OPERATION_FALLBACK.`,{resourceType:N,operationIdentifier:z,hasResourceId:vt!==null,updateLikeMutationFallbackMode:te})},[z,kt,vt,N,Tt,te]);let jt=(0,Q.useMemo)(()=>{if(!Be||!_t||!vt||!Je)return{};let e={};for(let[t,n]of Object.entries(tt)){let r=n.rootFieldName,i=e=>nt.find(t=>t.isBulkOperation===!0&&String(t.operationIdentifier)===Nn.buildRelationshipBulkOperationIdentifier(e,r));if(n.semantics.nature===cl.REFERENCE){let r=n.foreignKeyIdentity?.fieldIdentifier;if(!r)continue;let a=Je[r];if(a&&y(a)&&!Object.prototype.hasOwnProperty.call(et,r))continue;let o=i(Vu.SET),s=i(Vu.CLEAR);if(!o){va.isDevelopment()&&lB.warn(`[ResourceAutomatedForm] Skipping reference override because generated bulk set operation is unavailable`,{resourceType:N,fieldName:t,foreignKeyFieldName:r});continue}e[t]=(0,$.jsx)(cB,{writeSurface:n,setOperation:o,clearOperation:s,rmm:Tt,allowDirectOperationFallback:Ot})}else if(n.semantics.nature===cl.ASSOCIATION){let r=i(Vu.REPLACE),a=ge?dB(ge,t):void 0,o=!!(ge&&typeof ge==`object`&&Object.prototype.hasOwnProperty.call(ge,t));if(!r){va.isDevelopment()&&lB.warn(`[ResourceAutomatedForm] Skipping association override because generated bulk replace operation is unavailable`,{resourceType:N,fieldName:t});continue}e[t]=(0,$.jsx)(sB,{writeSurface:n,replaceOperation:r,initialRelationshipValue:a,hasHydratedInitialValue:o,rmm:Tt,allowDirectOperationFallback:Ot})}}return e},[et,ge,se,Je,_t,_,Be,vt,nt,N,tt,Tt,Ot]),Mt=(0,Q.useCallback)((e,t,n)=>{let r=Se.current;if(r)for(let i of e){if(n&&Object.prototype.hasOwnProperty.call(n,i)&&!pB(r.getValues(i),n[i]))continue;let e=dB(t,i),a=e===void 0?r.getValues(i):e;r.setValue(i,a,{shouldDirty:!1,shouldValidate:!1}),r.resetField(i,{defaultValue:a,keepTouched:!0})}},[]);(0,Q.useEffect)(()=>{if(!Tt||!Et?.lastEvent)return;let e=Et.lastEvent;switch(e.type){case SE.MUTATION_RESULT:{let{result:t}=e;if(t.success&&t.savedFields&&Mt(t.savedFields,Et.confirmedData,t.savedValues),!t.success&&t.error?.type===TE.VALIDATION&&t.error.validationErrors){let e=LM({httpStatus:t.error.status??400,validationErrors:t.error.validationErrors});e&&Te(e.validationErrors)}break}case SE.REMOTE_UPDATE:if(Se.current)for(let t of e.changedFields)Se.current.getFieldState(t).isDirty||Se.current.setValue(t,dB(Et.confirmedData,t),{shouldDirty:!1,shouldValidate:!1});Le({changedFields:e.changedFields,initiatorUserId:e.initiatorUserId}),Re.current&&clearTimeout(Re.current),Re.current=setTimeout(()=>{Le(null),Re.current=null},3e3);break;case SE.CONFLICT_RESET:Se.current&&Se.current.reset(Ue(e.currentData,!1)),Ee(),Fe({discardedFields:e.discardedFields,conflictingFields:e.conflictDetails?.conflictingFields??e.discardedFields,reason:e.reason,conflictDetails:e.conflictDetails});break;case SE.RESOURCE_DELETED:uB(`RMM resource deleted event`,{reason:e.reason})}},[Et?.lastEvent?.id]),(0,Q.useEffect)(()=>()=>{Re.current&&=(clearTimeout(Re.current),null)},[]);let Nt=(0,Q.useCallback)(()=>{Tt?.acknowledgeConflict(),Fe(null)},[Tt]),Pt=(0,Q.useMemo)(()=>{let e={resourceContext:{resourceType:N,operationId:z}};return{...e,...o,navigation:{...e.navigation,...o?.navigation}}},[N,z,o]),Ft=(0,Q.useMemo)(()=>{let t=ie===W.CREATE,n=Wc(P);if(!t&&!n)return null;try{let t=n?vt:null,r=va.getApiUrl();if(!Be?.resourceFieldIdentifier)throw V.buildConfigurationError(ii.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:e.resourceType,component:`ResourceAutomatedForm`});let i=Be.resourceFieldIdentifier,a={...xt};t&&(a[i]=t);let o=P.variantType===Ya.API_CALL?P:Be&&n?Th({resourceConfig:Be,operations:Be.operations??[],coreOperation:W.UPDATE,registry:_,hasResourceId:!!vt,contextResourceIdentifiers:bt,contextualParameters:xt}):Be?Il(Be.operations??[],W.CREATE):void 0,s;if(o){let t=It.buildOperationFrontendRoutePaths(Be,o,_.allResourceFieldIdentifiers);if(t.length>0){let n=gn.selectMatchingRoutePath(t,bt,Be.resourceIdentifier,i,e.parentResourcesRequirements);s=`${rt}${n.url}`,s=Ch.resolveUrlPath(s,a),s&&Ch.hasUnresolvedPlaceholders(s)&&(lB.warn(`[ResourceAutomatedForm] Unresolved placeholders in routed API basePath; disabling route-derived helpers`,{basePath:s,resourceType:N,operationIdentifier:z}),s=void 0)}}return s?{apiBaseUrl:r,basePath:s,contextualParameters:a,resourceFieldIdentifier:i}:null}catch(e){return lB.error(`[ResourceAutomatedForm] Error computing resource API base:`,e),null}},[bt,xt,ie,P,_,Be,e,vt,N]),Lt=(0,Q.useMemo)(()=>{if(!ze||!Ft||!Be?.resourceFieldIdentifier)return{};let t={},n=Wc(P),{apiBaseUrl:r,contextualParameters:i}=Ft;try{let a=P.variantType===Ya.API_CALL?P:n?Th({resourceConfig:Be,operations:Be.operations??[],coreOperation:W.UPDATE,registry:_,hasResourceId:!!vt,contextResourceIdentifiers:bt,contextualParameters:xt}):Il(Be.operations??[],W.CREATE);if(!a)return t;let o=It.buildOperationFrontendRoutePaths(Be,a,_.allResourceFieldIdentifiers);if(o.length===0)return t;let s=gn.selectMatchingRoutePath(o,bt,Be.resourceIdentifier,Be.resourceFieldIdentifier,e.parentResourcesRequirements),c=`${r}/api/v1/files`,l=sr.collectUploadableFileFieldPaths(ze);for(let e of l){let a=It.buildFileUploadRouteForOperation({operationRouteUrl:s.url,operationParameters:s.parameters,targetResourceType:N,targetResourceFieldIdentifier:Be.resourceFieldIdentifier,fieldName:e,requiresTargetResourceId:n,isFrontend:!0}),o=Ch.resolveUrlPath(a.url,i);if(Ch.hasUnresolvedPlaceholders(o)){lB.warn(`[ResourceAutomatedForm] Unresolved placeholders in file upload path, skipping endpoint`,{fieldName:e,uploadPath:o});continue}let l=`${r}${rt}${o}`;t[e]={upload:l,override:n?l:void 0,getMetadata:c,delete:n?void 0:c}}}catch(e){lB.error(`[ResourceAutomatedForm] Error generating file upload context:`,e)}return t},[bt,ze,P,yt,Ft,Be,N]),Rt=(0,Q.useMemo)(()=>{if(!Ft||!Be)return;let t=V.resolveFieldShapeOfAnyVariant(Be);if(!t||!Object.values(t).some(e=>xc(e)))return;let n=Il(Be.operations??[],W.CREATE),r=n?.initiatorInfos?.length?V.selectOperationUrlInitiatorInfo({initiatorInfos:n.initiatorInfos,contextualParameters:Ft.contextualParameters,targetResourceType:Be.resourceIdentifier,targetDefaultFieldIdentifier:Ft.resourceFieldIdentifier,parentResourcesRequirements:e.parentResourcesRequirements}):void 0;if(!r)return;let i=Xhe({apiBaseUrl:Ft.apiBaseUrl,initiatorInfo:r,contextualParameters:Ft.contextualParameters});return i||lB.warn(`[ResourceAutomatedForm] validate-field URL has unresolved parameters; blur-time validation disabled`,{initiatorUrl:r.url,resourceType:N}),i},[Ft,Be,e.parentResourcesRequirements,N]),zt=(0,Q.useMemo)(()=>vt??void 0,[vt]),Bt=(0,Q.useMemo)(()=>{if(!Tt)return Mz(N,_,{hasResourceId:!!vt,contextResourceIdentifiers:bt,contextualParameters:xt,actingOperation:re})},[Qe,bt,xt,re,_,vt,N,Tt]),Vt=(0,Q.useMemo)(()=>Tt?Dt:Bt?gl.createOperationPathKeyFromOperation(Bt):Nz(N,_,{hasResourceId:!!vt,contextResourceIdentifiers:bt,contextualParameters:xt,actingOperation:re}),[Bt,Qe,bt,xt,re,_,vt,N,Tt,Dt]),Ht=(0,Q.useMemo)(()=>vB(P),[P]),Ut=(0,Q.useRef)(null),Wt=nC({operation:P,currentObject:Ht?ge:void 0,resourceType:N,enabled:Ht&&le&&!be}),Gt=(0,Q.useMemo)(()=>ge&&Ue(ge),[ge,Ue]),Kt=P.isBulkOperation===!0&&El(ie),qt=(0,Q.useMemo)(()=>{if(!Ht)return Kt?f:zue({formFieldShape:Je,inheritanceConfig:qe,defaultValuesOverride:f})},[Ht,Je,qe,f,Kt]),Jt=(0,Q.useCallback)((e,t,n={})=>Nue({values:e,seed:void 0,schema:ze,writtenAsHeld:t,variantFields:Ve,clears:n}),[Ve,ze]),[Yt,Xt]=(0,Q.useState)({}),Zt=(0,Q.useRef)(Yt),Qt=_ne(e.additionalContext),$t=(0,Q.useMemo)(()=>{let e=new Map;return t=>{if(Kt)return e.has(t)||e.set(t,Pue(t,P.requestDto,ze,Ve)),e.get(t)}},[Ve,ze,P.requestDto,Kt]),en=(0,Q.useCallback)((e,t)=>{let n=t?$t(e):void 0;if(t&&!n)return;let r={...Zt.current};if(n?r[e]=n.value:delete r[e],Zt.current=r,Xt(r),!n)return;let i=n.kind===uE.EMPTY?[]:n.kind!==uE.TURN_OFF&&void 0;Se.current?.setValue(e,i,{shouldDirty:!0}),Se.current?.clearErrors(e)},[$t]),tn=(0,Q.useRef)(new Map),nn=(0,Q.useCallback)(e=>{let t=tn.current;return t.set(e,(t.get(e)??0)+1),()=>{let n=(t.get(e)??1)-1;n>0?t.set(e,n):t.delete(e)}},[]),rn=(0,Q.useRef)(St);(0,Q.useEffect)(()=>{rn.current!==St&&(rn.current=St,Object.keys(Zt.current).length!==0&&(Zt.current={},Xt({})))},[St]);let an=(0,Q.useCallback)(()=>Object.fromEntries(Object.entries(Zt.current).filter(([e])=>tn.current.has(e))),[]),on=(0,Q.useCallback)(e=>{let t=Object.keys(e);if(t.length===0)return;let n={...Zt.current};for(let e of t)delete n[e];Zt.current=n,Xt(n)},[]),sn=(0,Q.useMemo)(()=>Kt?{selectionCount:Qt,clearFor:$t,isCleared:e=>Object.hasOwn(Yt,e),setCleared:en,registerField:nn}:null,[$t,Yt,Qt,nn,en,Kt]);(0,Q.useEffect)(()=>{if(!Ht){_e(f??void 0),ye(`create`),de(!0);return}let t=JSON.stringify({canonicalReadOperationPathKey:Vt,contextResourceIdentifiersKey:Qe,parentResourcesRequirementsKey:yt});if(le&&Ut.current===t){if(Tt&&ge&&typeof Tt.getSnapshot==`function`&&Tt.getSnapshot().confirmedData===null&&typeof Tt.setInitialState==`function`){let e=ge;Tt.setInitialState(e,e._version??0,e._field_meta)}return}let n=!1;return(async()=>{xe(null);try{if(!Vt)throw Error(`No addressable canonical READ operation is available for this resource form context.`);let r=await Fz({doOperation:T.current,readOperationPathKey:Vt,contextualParameters:xt,parentResourcesRequirements:e.parentResourcesRequirements});if(n)return;let i=r;Tt&&Tt.setInitialState(i,i._version??0,i._field_meta),_e(f?{...i,...f}:r),Ut.current=t,ye(t),de(!0)}catch(e){if(n)return;let t=e instanceof Error?e:Error(String(e)),r=j(e),i=M.buildWildoError_Frontend(ue.NOT_FOUND,{customMessageReference:ii.FRONTEND_FORM_READ_OPERATION_NOT_AVAILABLE,operationPathKey:Vt,context:{resourceType:N,operationIdentifier:z,originalErrorMessage:t.message,originalErrorStack:t.stack,httpCode:r.code,httpContext:r.context}});xe({wildoError:i,message:w(e)}),D.current?.(t)}})(),()=>{n=!0}},[Ht,Vt,N,Qe,xt,yt,M,z,f,Tt,le,ge]);let cn=(0,Q.useCallback)(async t=>{k.current?.(),pe(!0),Ee(),uB(`handleSubmit: starting`,{operationPathKey:gt,dataKeys:Object.keys(t||{})});try{let n;if(Tt){let e=await Tt.queueMutation(t,{type:CE.SUBMIT,priority:AE.HIGH,source:{type:wE.FORM,subscriberId:`submit`},transportOverride:Ct});if(!e.success){if(_B(e))return;if(e.error?.type===TE.VALIDATION){D.current?.(tz(e.error,`Validation failed`));return}throw tz(e.error,`Submit failed`)}n=e.heldForApproval??e.responseData}else{At(`ResourceAutomatedForm submit`);let e=Object.keys(et),r=Kt?an():{},i=Kt?Jt(t,e,r):t,a=z===W.UPDATE||z===W.UPDATE_MANY;if(Kt&&a&&Object.keys(i).every(t=>e.includes(t))){Te({[bT]:b(J.RESOURCES_LAYOUTS_CREATE,`bulkNothingToChange`)});return}n=await T.current(Ct.operationPathKey,{contextualParameters:Ct.contextualParameters,requestData:wt(i),parentResourcesRequirements:Ct.parentResourcesRequirements},{silent:!0}),on(r)}if(uB(`handleSubmit: success`,{operationPathKey:gt}),R(n)){O.current?.(n);return}let r=hB(P);if(r){let t=r.level===Fn.WARNING?hc.NOTIFY_RESOURCE_WARNING:r.level===Fn.ERROR?hc.NOTIFY_RESOURCE_ERROR:r.level===Fn.INFO?hc.NOTIFY_RESOURCE_INFO:hc.NOTIFY_RESOURCE_SUCCESS;E.current(t,{...e,contextResourceIdentifiers:De({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:N,result:n,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Ku(n),additionalContext:{...e.additionalContext,notificationIdentifier:r.identifier,notificationLevel:r.level,result:n}})}let i=e.additionalContext?.quickCreateRequest;if(i?.requestId&&ie===W.CREATE){let e=Xz({result:n,resourceType:N,registry:_});e&&Qz({emit:E.current,requestId:i.requestId,resourceType:N,resourceId:e,data:typeof n==`object`&&n&&!Array.isArray(n)?n:void 0})}O.current?.(n)}catch(t){if(t instanceof jE)return;let n=t instanceof Error?t:Error(String(t));uB(`handleSubmit: error caught`,{message:n.message,operationPathKey:gt});let r=LM(t);r?(uB(`handleSubmit: server validation errors detected`,{httpStatus:r.httpStatus,fields:Object.keys(r.validationErrors)}),Te(r.validationErrors)):(uB(`handleSubmit: general error (not validation)`,{message:n.message}),E.current(hc.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:ju(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,error:n.message,...cz(t)}})),D.current?.(n)}finally{pe(!1)}},[At,et,Ct,Te,wt,z,gt,$e,P,e,Tt,b,Jt,on,an,Kt]),ln=e=>{uB(`handleError: client-side validation failed`,{errorCount:Object.keys(e).length,fields:Object.keys(e)}),lB.warn(`[ResourceAutomatedForm] Form validation errors`,e),aO(iO(e))};(0,Q.useEffect)(()=>{if(!f||!Se.current)return;let e=ge?Ue(ge):f;Se.current.reset(e)},[f]);let un=(0,Q.useCallback)(e=>{if(Se.current=e,we(e),f){let t=ge?Ue(ge):f;e.reset(t)}},[we,f]),dn=(0,Q.useCallback)(async e=>Se.current?Se.current.trigger(e):(uB(`validateAutosaveField: form methods unavailable, failing closed`,{fieldName:e}),!1),[]),fn=(0,Q.useCallback)(async(e,t,n)=>{At(`ResourceAutomatedForm autosave`);let r=()=>{if(n.aborted)throw new DOMException(`Autosave aborted`,`AbortError`)};r();let i=!Tt&&Kt?lE(an(),cE([e],ze)):{},a=!Tt&&Kt?Jt(rE(Oue(Se.current?.getValues()??{},e,t),cE([e],ze)),[],i):void 0;if(a&&Object.keys(a).length===0)return;let o=Tt?Tt.queueMutation({[e]:t},{type:CE.AUTOSAVE,priority:AE.LOW,transportOverride:Ct}).then(e=>{if(!e.success)throw e.error??Error(`Autosave failed`)}):T.current(Ct.operationPathKey,{contextualParameters:Ct.contextualParameters,requestData:wt(a??WE(wA(Se.current?.getValues()??null,e,t),Ve,ge)),parentResourcesRequirements:Ct.parentResourcesRequirements},{signal:n,silent:!0}),s=new Promise((e,t)=>{if(n.aborted){t(new DOMException(`Autosave aborted`,`AbortError`));return}let r=()=>{t(new DOMException(`Autosave aborted`,`AbortError`))};n.addEventListener(`abort`,r,{once:!0}),o.finally(()=>{n.removeEventListener(`abort`,r)})});await Promise.race([o,s]),r(),on(i)},[At,Ct,ge,Ve,ze,wt,Tt,Jt,on,an,Kt]),pn=(0,Q.useCallback)(async(t,n,r)=>{if(n.length===0){va.isDevelopment()&&lB.warn(`[ResourceAutomatedForm] Skipping section save because no fields were registered for the section.`,{resourceType:N,sectionRef:t});return}let i=iE(rE(r,n),{hiddenFieldNames:ht,contextFieldValues:et,omitClearedFields:ce,schema:ze});try{if(A.current){await A.current(t,n,i);return}let a;if(Tt){let e=await Tt.queueMutation(fB(i,n),{type:CE.SECTION,priority:AE.NORMAL,source:{type:wE.FORM,subscriberId:`section:${t}`},transportOverride:Ct});if(!e.success){if(_B(e)||e.error?.type===TE.VALIDATION&&mB(e.error))return;throw tz(e.error,`Section save failed`)}a=e.heldForApproval??e.responseData}else{At(`ResourceAutomatedForm section save`);let e,t={};if(Kt){let i=Object.keys(et);t=lE(an(),cE(n,ze));let a={...Se.current?.getValues()??r};for(let e of Object.keys(P.requestFieldOffers??{}))e in r?a[e]=r[e]:delete a[e];let o=Jt(iE(rE(a,cE(n,ze)),{hiddenFieldNames:ht,contextFieldValues:et,omitClearedFields:ce,schema:ze}),i,t);if((z===W.UPDATE||z===W.UPDATE_MANY)&&Object.keys(o).every(e=>i.includes(e))){Te({[bT]:b(J.RESOURCES_LAYOUTS_CREATE,`bulkNothingToChange`)});return}e=wt(o)}else{let t=ge;e=wt(WE(kue(i,n,t),Ve,t))}a=await T.current(Ct.operationPathKey,{contextualParameters:Ct.contextualParameters,requestData:e,parentResourcesRequirements:Ct.parentResourcesRequirements},{silent:!0}),Rr(a)||Mt(n,a,Object.fromEntries(n.map(e=>[e,dB(i,e)]))),on(t)}if(R(a))return;I(a,{partialWrite:!0}),E.current(hc.NOTIFY_RESOURCE_SUCCESS,{...e,contextResourceIdentifiers:De({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:N,result:a,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Ku(a),additionalContext:{...e.additionalContext,sectionRef:t,fieldNames:n,notificationIdentifier:`section_saved`,notificationLevel:Fn.SUCCESS}})}catch(n){if(n instanceof jE)return;let r=LM(n);if(r){Te(r.validationErrors);return}let i=n instanceof Error?n:Error(String(n));E.current(hc.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:ju(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,sectionRef:t,error:i.message,...cz(n)}})}},[I,At,Ct,et,ge,Ve,ze,ht,Te,Mt,wt,ce,z,e,N,Tt,b,Jt,on,an,Kt]),mn=(0,Q.useMemo)(()=>l===void 0&&Yhe(Je,se),[l,se,Je]),hn=El(ie)&&P.requiresApproval===void 0,_n=l?.enabled===!0;(0,Q.useEffect)(()=>{_n&&!hn&&va.isDevelopment()&&lB.warn(`[ResourceAutomatedForm] autosaveConfig is ignored: autosave saves fields of records that exist, and this form creates one or runs an action.`,{resourceType:N,operationIdentifier:z})},[hn,_n,z,N]);let vn=(0,Q.useMemo)(()=>({enabled:hn&&(l?.enabled??mn),defaultTrigger:l?.defaultTrigger??(mn?zn.NONE:zn.DEBOUNCE),debounceMs:l?.debounceMs??500,savedStateDurationMs:2e3}),[l,hn,mn]),yn=(0,Q.useMemo)(()=>{if(!ze||!Ze?.enabled)return null;try{let e=ae===W.CREATE?`CREATE`:El(ae)?`UPDATE`:`CREATE`,t=oe===W.CREATE?`CREATE`:oe&&El(oe)?`UPDATE`:oe===W.READ?`READ`:void 0;return Ute(ze,{operationType:e,operationLike:t,isDraftMode:!0})}catch{return null}},[ze,Ze?.enabled,ae,oe]),bn=(0,Q.useCallback)(async t=>{if(Ze?.enabled){k.current?.(),he(!0),Ee();try{let n,r=!0;if(Ze?.onSaveDraft)n=await Ze.onSaveDraft(t),r=n!==void 0;else{let e=Ze?.discriminator||`_isDraft`,r=Ze?.draftValue??!0,i={...t,[e]:r};if(Tt){let e=await Tt.queueMutation(i,{type:CE.DRAFT,priority:AE.HIGH,source:{type:wE.FORM,subscriberId:`draft`},transportOverride:{...Ct,requestData:i}});if(!e.success){if(_B(e))return;throw tz(e.error,`Draft save failed`)}n=e.heldForApproval??e.responseData}else At(`ResourceAutomatedForm draft save`),n=await T.current(Ct.operationPathKey,{contextualParameters:Ct.contextualParameters,requestData:wt(i),parentResourcesRequirements:Ct.parentResourcesRequirements},{silent:!0})}if(R(n)){O.current?.(n);return}Ne(!0),r&&(E.current(hc.NOTIFY_RESOURCE_SUCCESS,{...e,contextResourceIdentifiers:De({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:N,result:n,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Ku(n),additionalContext:{...e.additionalContext,notificationIdentifier:`draftSaved`}}),O.current?.(n))}catch(t){if(t instanceof jE)return;let n=LM(t);n?Te(n.validationErrors):E.current(hc.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:ju(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,notificationIdentifier:`draftSaveFailed`,...cz(t)}}),D.current?.(t)}finally{he(!1)}}},[At,Ct,Ze,wt,e,N,Te,Tt]),xn=(0,Q.useCallback)(async t=>{if(Ze?.enabled){k.current?.(),pe(!0),Ee();try{let n,r=!0;if(Ze?.onPublish)n=await Ze.onPublish(t),r=n!==void 0;else{let e=Ze?.discriminator||`_isDraft`,r=Ze?.publishedValue??!1,i={...t,[e]:r};if(Tt){let e=await Tt.queueMutation(i,{type:CE.PUBLISH,priority:AE.HIGH,source:{type:wE.FORM,subscriberId:`publish`},transportOverride:{...Ct,requestData:i}});if(!e.success){if(_B(e))return;throw tz(e.error,`Publish failed`)}n=e.heldForApproval??e.responseData}else At(`ResourceAutomatedForm publish`),n=await T.current(Ct.operationPathKey,{contextualParameters:Ct.contextualParameters,requestData:wt(i),parentResourcesRequirements:Ct.parentResourcesRequirements},{silent:!0})}if(R(n)){O.current?.(n);return}if(Ne(!1),r){let t=hB(P);t&&E.current(hc.NOTIFY_RESOURCE_SUCCESS,{...e,contextResourceIdentifiers:De({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:N,result:n,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Ku(n),additionalContext:{...e.additionalContext,notificationIdentifier:t.identifier}}),O.current?.(n)}}catch(t){if(t instanceof jE)return;let n=LM(t);n?Te(n.validationErrors):E.current(hc.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:ju(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,notificationIdentifier:`publishFailed`,...cz(t)}}),D.current?.(t)}finally{pe(!1)}}},[At,Ct,Ze,wt,e,N,P,Te,Tt]),Sn=(0,Q.useCallback)(async e=>{Ze?.enabled&&(Ze?.requireConfirmationToPublish?ke(e):await xn(e))},[Ze,xn]),Cn=(0,Q.useCallback)(async()=>{Oe&&(await xn(Oe),ke(null))},[Oe,xn]),wn=(0,Q.useCallback)(()=>{ke(null)},[]),Tn=qo(P.riskLevel),En=P.riskLevel===ls.CRITICAL,Dn=Ri(P)?void 0:null,On=x(N,String(P.operationIdentifier),`description`)||void 0,kn=(0,Q.useMemo)(()=>aC(x,N,String(P.operationIdentifier)),[x,N,P.operationIdentifier]),An=!!(Ze?.enabled&&yn),jn=(0,Q.useCallback)(e=>{An?Sn(e):cn(e)},[An,Sn,cn]),Mn=(0,Q.useCallback)(e=>{Tn?je(e):jn(e)},[Tn,jn]),Pn=(0,Q.useCallback)(()=>{let e=Ae;je(null),e!==null&&jn(e)},[Ae,jn]),In=(0,Q.useCallback)(()=>{je(null)},[]),Ln=(0,Q.useMemo)(()=>{let e=g(z)?b(J.RESOURCES_LAYOUTS_CREATE,gB(ie??z)):kn,t=b(J.RESOURCES_LAYOUTS_CREATE,`submitting`);if(Ze?.enabled&&yn){let e=Ze?.publishLabel?b(J.RESOURCES_LAYOUTS_CREATE,Ze.publishLabel):b(J.RESOURCES_LAYOUTS_CREATE,`publish`),t=b(J.RESOURCES_LAYOUTS_CREATE,`publishing`);return(0,$.jsx)(X,{type:`submit`,disabled:fe||me||i,children:fe?t:e})}return(0,$.jsx)(X,{type:`submit`,disabled:fe||i,children:fe?t:e})},[ie,z,kn,fe,me,i,b,Ze,yn]),Rn=(0,Q.useMemo)(()=>{if(!r)return null;let e=b(J.RESOURCES_LAYOUTS_CREATE,`cancel`);return(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,disabled:fe||me,onClick:r,children:e})},[r,fe,me,b]),H=(0,Q.useMemo)(()=>{if(!Ze?.enabled||!yn)return null;let e=Ze?.saveDraftLabel?b(J.RESOURCES_LAYOUTS_CREATE,Ze.saveDraftLabel):b(J.RESOURCES_LAYOUTS_CREATE,`saveAsDraft`),t=b(J.RESOURCES_LAYOUTS_CREATE,`savingDraft`);return(0,$.jsx)(CB,{draftSchema:yn,omitClearedFields:ce,submissionSchema:ze,onSaveDraft:bn,disabled:me||fe||i,isSavingDraft:me,label:e,savingLabel:t})},[Ze,yn,bn,me,fe,i,b]),Bn=Pe?{title:b(J.RESOURCES_LAYOUTS_CREATE,Pe.reason===OE.VERSION_CONFLICT?`conflictTitleVersion`:`conflictTitleRemote`),message:b(J.RESOURCES_LAYOUTS_CREATE,Pe.reason===OE.VERSION_CONFLICT?`conflictMessageVersion`:`conflictMessageRemote`),acknowledgeButton:b(J.RESOURCES_LAYOUTS_CREATE,`conflictAcknowledge`),currentValue:b(J.RESOURCES_LAYOUTS_CREATE,`conflictCurrentValue`),submittedValue:b(J.RESOURCES_LAYOUTS_CREATE,`conflictSubmittedValue`),emptyValue:b(J.LOW_LEVEL_FORM_FIELD,`noValue`)}:void 0,Vn=(0,Q.useMemo)(()=>!Pe||!Bn?null:(0,$.jsx)(qz,{type:`conflict`,discardedFields:Pe.discardedFields,conflictDetails:Pe.conflictDetails,labels:Bn,onDismiss:Nt}),[Pe,Bn,Nt]),[Hn,Wn]=(0,Q.useState)(0),Gn=(0,Q.useCallback)(()=>(Wn(e=>e+1),()=>Wn(e=>e-1)),[]),Kn=(0,Q.useMemo)(()=>({submitButton:Ln,draftSaveButton:H,cancelButton:Rn,submissionNotice:Vn,claimFooter:Gn,footerClaimed:Hn>0}),[Ln,H,Rn,Vn,Gn,Hn]),qn=(0,Q.useMemo)(()=>{if(Ht)return String(Bt?.operationIdentifier??V.resolveSingleResourceReadOperation(N,_)?.operationIdentifier??W.READ)},[Bt,Ht,N,_]),Jn=(0,Q.useMemo)(()=>!Ht||!qn?[]:[{resourceType:N,operation:qn}],[Ht,N,qn]),Yn=(0,Q.useMemo)(()=>[`components.${J.RESOURCES_LAYOUTS_CREATE}`],[]),Xn=(0,Q.useMemo)(()=>Ht?[{id:`form-data`,isReady:le}]:[],[Ht,le]),Zn=(0,Q.useMemo)(()=>({errorNetwork:b(J.RESOURCES_LAYOUTS_CREATE,`autosaveErrorNetwork`),errorValidation:b(J.RESOURCES_LAYOUTS_CREATE,`autosaveErrorValidation`),errorGeneric:b(J.RESOURCES_LAYOUTS_CREATE,`autosaveErrorGeneric`),errorConflict:b(J.RESOURCES_LAYOUTS_CREATE,`autosaveErrorConflict`),errorResourceDeleted:b(J.RESOURCES_LAYOUTS_CREATE,`autosaveErrorResourceDeleted`)}),[b]),Qn=(0,Q.useMemo)(()=>{if(!ze)return null;if(Ye){let e=Ye,t=g(P.operationIdentifier)?null:zR(ze,qe?.discriminatorField).map(e=>e.name),n=()=>(0,$.jsxs)($.Fragment,{children:[t?(0,$.jsx)(bB,{Template:e,requestFieldNames:t}):(0,$.jsx)(e,{}),(0,$.jsx)(bE,{})]});return n.displayName=`ResourceFormTemplate(explicit)`,n}let e=UR(ze,{inheritanceConfig:qe,includeSubmitButton:!1,includeErrorSummary:s}),t=()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(e,{}),(0,$.jsx)(bE,{})]});return t.displayName=`ResourceFormTemplate`,t},[Ye,ze,qe,s,P.operationIdentifier]);if(!S)return null;if(be){let e=b(J.RESOURCES_LAYOUTS_CREATE,`failedToLoadData`);return(0,$.jsx)(`div`,{className:a,children:(0,$.jsxs)(`div`,{className:`p-card bg-destructive/10 border border-destructive rounded-lg`,role:`alert`,children:[(0,$.jsx)(`p`,{className:`text-destructive font-medium`,children:e}),(0,$.jsx)(`p`,{className:`text-sm text-destructive/80 mt-item-xs`,children:be.message})]})})}if(Ht&&le&&!Wt.isLoading&&!Wt.isEnabled){let e=b(J.RESOURCES_LAYOUTS_CREATE,`operationUnavailableTitle`),t=b(J.RESOURCES_LAYOUTS_CREATE,`operationUnavailableMessage`);return(0,$.jsx)(`div`,{className:a,children:(0,$.jsxs)(`div`,{className:`p-card bg-muted/50 border border-border rounded-lg`,role:`status`,children:[(0,$.jsx)(`p`,{className:`font-medium text-foreground`,children:e}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground mt-item-xs`,children:t})]})})}let $n=Ht?Gt??f:qt??f;if(!ze){let e=b(J.RESOURCES_LAYOUTS_CREATE,`configurationError`),t=b(J.RESOURCES_LAYOUTS_CREATE,`noSchemaFound`,{operation:z,resource:N});return(0,$.jsx)(`div`,{className:a,children:(0,$.jsxs)(`div`,{className:`p-card bg-destructive/10 border border-destructive rounded-lg`,role:`alert`,children:[(0,$.jsx)(`p`,{className:`text-destructive font-medium`,children:e}),(0,$.jsx)(`p`,{className:`text-sm text-destructive/80 mt-item-xs`,children:t})]})})}let er=b(J.RESOURCES_LAYOUTS_CREATE,`confirmPublishTitle`),tr=b(J.RESOURCES_LAYOUTS_CREATE,`confirmPublishMessage`),nr=b(J.RESOURCES_LAYOUTS_CREATE,`cancel`),rr=b(J.RESOURCES_LAYOUTS_CREATE,`publish`),ir=Ie?{message:b(J.RESOURCES_LAYOUTS_CREATE,`remoteUpdateMessage`),dismissAriaLabel:b(J.RESOURCES_LAYOUTS_CREATE,`dismiss`)}:void 0,ar=(0,$.jsx)(yb,{i18nKeys:Yn,loadingScopes:Jn,readiness:Xn,children:(0,$.jsxs)(`div`,{className:a,children:[(0,$.jsx)(tT,{open:!!Oe,onOpenChange:e=>!e&&wn(),children:(0,$.jsxs)(rT,{children:[(0,$.jsxs)(iT,{children:[(0,$.jsx)(oT,{children:er}),(0,$.jsx)(sT,{children:tr})]}),(0,$.jsxs)(aT,{children:[(0,$.jsx)(lT,{onClick:wn,children:nr}),(0,$.jsx)(cT,{onClick:Cn,children:rr})]})]})}),Ae!==null&&(0,$.jsx)(Jw,{open:!0,onOpenChange:e=>{e||In()},cancelCallback:In,validationCallback:Pn,label:kn,confirmLabel:kn,description:Dn,detail:On,requireTypedConfirmation:En,confirmationPhrase:En?kn:``}),Ie&&ir&&(0,$.jsx)(qz,{type:`remote-update`,changedFields:Ie.changedFields,labels:ir,onDismiss:()=>Le(null)}),(0,$.jsx)(VE.Provider,{value:sn,children:(0,$.jsx)(vE,{value:Kn,children:(0,$.jsx)(gE,{schema:ze,defaultValues:$n,onSubmit:Mn,onError:ln,validationMode:c,disabled:i||fe,labels:Pt,layoutRefs:Ge,operationRef:z,operationType:ae,operationLike:oe,coreOperation:ie,fileUploadContext:Lt,contextFieldValues:et,hiddenFieldNames:ht,generatedFieldOverrides:jt,allowedValuesByField:mt,roleGrantPickerOffersByField:pt,requestFieldOffers:P.requestFieldOffers,requestFieldOfferRecord:Ht?ge:void 0,inheritanceConfig:qe,onSectionSave:Fue({writesRecordFields:El(ie),hasCallerSectionHandler:d!==void 0})?pn:void 0,onFormReady:un,warnOnUnsavedChanges:!0,validateFieldUrl:Rt,resourceType:N,hostResolvesRelationshipRoots:!0,resourceId:zt,contextResourceIdentifiers:bt,parentResourcesRequirements:e.parentResourcesRequirements,navigationZone:p,chromeMode:Ke,layoutTemplate:Qn},ve)})})]})});return vn.enabled?(0,$.jsxs)(zE,{labels:Zn,validateField:dn,onSave:fn,rmm:Tt??void 0,config:vn,children:[(0,$.jsx)(SB,{cancelRef:k}),ar]}):ar}function SB({cancelRef:e}){let t=RE();return Q.useEffect(()=>(t&&(e.current=t.cancelAllPending),()=>{e.current=null}),[t,e]),null}function CB({draftSchema:e,onSaveDraft:t,disabled:n,isSavingDraft:r,label:i,savingLabel:a,omitClearedFields:o,submissionSchema:s}){let c=rw(),l=ZT(),u=(0,Q.useCallback)(async()=>{if(!c)return;let n=c.getValues(),r=e.safeParse(IT(n,e));if(r.success){let e=iE(r.data,{hiddenFieldNames:l?.hiddenFieldNames,contextFieldValues:l?.contextFieldValues,omitClearedFields:o,schema:s});c.clearErrors(),await t(e)}else{let e=jT(r.error.issues),t=Object.keys(e);for(let[t,n]of Object.entries(e))c.setError(t,n);aO(t)}},[c,l?.contextFieldValues,l?.hiddenFieldNames,e,t]);return(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,disabled:n,onClick:u,children:r?a:i})}var wB;(function(e){e.SHELL=`shell`,e.SURFACE=`surface`})(wB||={});function TB(e,t,n=!0){return e||(n?t:li.PRIMARY)}function EB({preset:e=q.DEFAULT,host:t=wB.SHELL,...n}){let r=(0,Q.useContext)(__)?.navigationLayout?.backAffordanceOwner;if(!(t===wB.SHELL?Bn(r):Jre(r)))return null;let i=G(J.APPLICATION_LEVEL_NAVIGATION_BACK,`ApplicationLevel_NavigationBack`)(e);return(0,$.jsx)(i,{...n})}var DB=zs(J.LOW_LEVEL_BREADCRUMB,`Breadcrumb`,[`List`,`Item`,`Link`,`Page`,`Separator`,`Ellipsis`]);function OB({preset:e=q.DEFAULT,...t}){let n=DB(e);return(0,$.jsx)(n,{...t})}function kB({preset:e=q.DEFAULT,...t}){let n=DB(e);return(0,$.jsx)(n.List,{...t})}function AB({preset:e=q.DEFAULT,...t}){let n=DB(e);return(0,$.jsx)(n.Item,{...t})}function jB({preset:e=q.DEFAULT,...t}){let n=DB(e);return(0,$.jsx)(n.Link,{...t})}function MB({preset:e=q.DEFAULT,...t}){let n=DB(e);return(0,$.jsx)(n.Page,{...t})}function NB({preset:e=q.DEFAULT,...t}){let n=DB(e);return(0,$.jsx)(n.Separator,{...t})}function PB({preset:e=q.DEFAULT,...t}){let n=DB(e);return(0,$.jsx)(n.Ellipsis,{...t})}function FB(e){let t={};for(let n of e.segment.ancestorRequirements){let r=n.foreignKeyField||n.resourceType,i=e.contextResourceIdentifiers[r]??e.contextResourceIdentifiers[n.resourceType],a=typeof i==`string`?i:i?.resourceId;a&&(n.foreignKeyField?t[r]={fieldIdentifier:n.foreignKeyField,resourceId:a}:t[n.resourceType]=a)}return t[e.segment.resourceType]=e.segment.resourceId,t}function IB(e){let{parentResourcesRequirements:t,contextResourceIdentifiers:n,maxDepth:r=5}=e;if(!t||t.length===0)return[];let i=[],a=new Set,o=[];for(let e of t){let t=e.foreignKeyField||e.resourceType;if(a.has(t))continue;if(a.add(t),i.length>=r)break;let s;if(e.foreignKeyField&&n[e.foreignKeyField]){let t=n[e.foreignKeyField];s=typeof t==`string`?t:t.resourceId}else{let t=n[e.resourceType];if(!t)continue;s=typeof t==`string`?t:t.resourceId}s&&(e.isPrimaryScope||i.push({resourceType:e.resourceType,resourceId:s,ancestorRequirements:[...o]}),o.push(e))}return i}var LB=({resourceContext:e,navigationZone:t,navigationInitiator:n,maxDepth:r=5})=>{let{resourceType:i,contextResourceIdentifiers:a,parentResourcesRequirements:o}=e,{registry:s,doOperation:c}=wm(),l=TS(),{tResourceHeader:u,t:d,formatDate:f,formatDateTime:p,isReady:m}=K({resource:i}),{navigate:h}=zS(),g=(0,Q.useRef)(c);g.current=c;let _=(0,Q.useMemo)(()=>IB({parentResourcesRequirements:o,contextResourceIdentifiers:a,maxDepth:r}),[o,a,r]),[v,y]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{if(_.length===0){y([]);return}y(_.map(e=>({...e,label:null,isLoading:!0})));let e=!1;return(async()=>{let t=await Promise.allSettled(_.map(async e=>{let t=s.resourceConfigurations[e.resourceType],n=V.buildForeignKeyFetchParams(e.resourceType,e.resourceId,s),r=FB({segment:e,contextResourceIdentifiers:a}),i=t?Th({resourceConfig:t,operations:(t.operations??[]).filter(t=>lS(t,e.resourceType,l)),coreOperation:W.READ,registry:s,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:r,contextualParameters:{...V.buildContextualParameters(r,s),...n.contextualParameters??{}}}):void 0,o=V.tryBuildForeignKeyReadOperationPath(e.resourceType,s,i),c=()=>{let t=im({tResourceHeader:u,resourceType:e.resourceType,key:`title`});return{...e,label:`${t} #${e.resourceId.slice(0,8)}`,isLoading:!1}};if(!o)return c();try{let t=await g.current(o,{contextualParameters:{...V.buildContextualParameters(r,s),...n.contextualParameters},parentResourcesRequirements:e.ancestorRequirements,parentChainIsExact:!0});return{...e,label:null,record:t,isLoading:!1}}catch{return c()}}));e||y(t.map((e,t)=>e.status===`fulfilled`?e.value:{..._[t],label:_[t].resourceId.slice(0,8),isLoading:!1}))})(),()=>{e=!0}},[a,_,s,u,l]);let b=(0,Q.useMemo)(()=>v.map(e=>e.record===void 0?e:{...e,label:V.computeFrontendResourceLabel({resourceType:e.resourceType,registry:s,currentObject:e.record,t:d,formatDate:f,formatDateTime:p})||e.resourceId}),[v,s,d,f,p]),x=e=>{let t=s.resourceConfigurations[e.resourceType];if(!t)return;let n=FB({segment:e,contextResourceIdentifiers:a}),r=Th({resourceConfig:t,operations:(t.operations??[]).filter(t=>!ar(t.operationFrontendConfig)&&lS(t,e.resourceType,l)),coreOperation:W.READ,registry:s,hasResourceId:!0,contextResourceIdentifiers:n,contextualParameters:V.buildContextualParameters(n,s)});if(r)return{segmentResourceConfig:t,segmentContextIdentifiers:n,readOp:r}},S=(0,Q.useMemo)(()=>new Map(_.map(e=>[RB(e),x(e)!==void 0])),[_,s,a]),C=(e,n)=>{n.preventDefault();let r=x(e);if(!r)return;let{segmentResourceConfig:i,segmentContextIdentifiers:a,readOp:o}=r,c=gn.createFrontendResourceOperationContextFromOperation({resourceType:e.resourceType,operation:o,contextResourceIdentifiers:a,isOperationDefault:!0,parentResourcesRequirements:e.ancestorRequirements}),l;if(fn(o.operationFrontendConfig)){let t=It.buildOperationFrontendRoutePaths(i,o,s.allResourceFieldIdentifiers);l=gn.selectMatchingRoutePath(t,a,i.resourceIdentifier,i.resourceFieldIdentifier,e.ancestorRequirements)?.url}h({content:{contentType:hd.RESOURCE_OPERATION,resourceContext:c},urlPath:l,initiator:{sourceZone:t}})};return _.length===0||!m?null:(0,$.jsx)(OB,{children:(0,$.jsx)(kB,{children:b.map(e=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(AB,{children:S.get(RB(e))?(0,$.jsx)(jB,{href:`#`,onClick:t=>C(e,t),className:e.isLoading?`animate-pulse motion-reduce:animate-none`:void 0,children:e.isLoading?`...`:e.label}):(0,$.jsx)(`span`,{className:e.isLoading?`animate-pulse motion-reduce:animate-none`:void 0,children:e.isLoading?`...`:e.label})}),(0,$.jsx)(NB,{})]},RB(e)))})})};function RB(e){return`${e.resourceType}-${e.resourceId}`}function zB({preset:e=q.DEFAULT,...t}){let n=G(J.RESOURCES_LAYOUTS_BREADCRUMB,`ResourceLayout_Breadcrumb`)(e);return(0,$.jsx)(n,{...t})}var BB=Jo.getLogger(),VB=BB.debugByType(`AutomaticDisplayer`);BB.setDebugTypeLogging(`AutomaticDisplayer`,!1);function HB({schema:e,data:t,className:n,labels:r,layoutRefs:i,resourceType:a,resourceId:o,contextualParameters:s,contextResourceIdentifiers:c,parentResourcesRequirements:l,navigationZone:u,inlineEditOperation:d,parentReferenceConfig:f,onInlineEdit:p,disableInlineEdit:m=!1,fileUploadContext:h,onInlineEditSuccess:g,rmm:_,updateLikeMutationFallbackMode:v=Nt.RMM_REQUIRED,layoutTemplate:y,isLoading:b=!1,defaultDisplayChromeMode:x,defaultInlineEdit:S,defaultEmptyValue:C,defaultSectionAppearance:w,hiddenFieldNames:T,inlineEditDisabledFieldNames:E,onFileActivationOperation:D}){let{doOperation:O,registry:k}=wm(),A=(0,Q.useContext)(__)?.UIConfig?.currentBreakpoint??ci.DESKTOP,{fieldLabels:j,fieldDescriptions:M,fieldTooltips:N,enumLabels:P,sectionLabels:F,sectionDescriptions:I,groupLabels:ee}=mE(e,r?.resourceContext,t,`display`,{layoutRefs:i,fieldPathPrefix:r?.fieldPathPrefix,overrides:{fields:r?.fields,enums:r?.enums,sections:r?.sections}}),L=wS(Dh(a,o,c)),R=(0,Q.useCallback)(()=>{if(d===null)return null;if(d!==void 0){let e=d.variantType===Ya.API_CALL,t=d.resourceOperationLike??d.operationIdentifier,n=d.operationIdentifier===W.UPDATE;if(!e||!n||d.isBulkOperation===!0||t!==W.UPDATE)throw VB(`Rejected invalid inlineEditOperation`,{operationIdentifier:String(d.operationIdentifier),variantType:d.variantType,variantKey:d.variantKey,isBulkOperation:d.isBulkOperation,effectiveOperation:String(t)}),new Tj(`inlineEditOperation must be the non-bulk URL-bearing literal UPDATE operation, not a custom verb borrowing UPDATE semantics`);return d}if(!a||!o)return null;let e=k.resourceConfigurations[a];if(!e)return null;let t=V.getResourceFieldIdentifierForType(a,k),n=gn.buildRecordIdentifiersFromCollection(c,a,o),r={...s??{},[t]:o};return rh({resourceConfig:e,operations:e.operations??[],registry:k,hasResourceId:gn.getResourceId(n[a]).length>0,requireFrontendAddressable:!0,contextResourceIdentifiers:n,contextualParameters:r,viewer:L})??null},[c,s,d,k,o,a,L]),te=(0,Q.useMemo)(()=>R()!==null,[R]),z=(0,Q.useMemo)(()=>UE(e),[e]),B=(0,Q.useCallback)(async(n,r)=>{let i=e?xo(e,n):void 0,c=i?sl(i,r):r;if(VB(`doInlineUpdate`,{fieldName:n,path:p?`custom`:_?`rmm`:`fallback`}),p)await p(n,c),g?.(n,c);else if(_){let e=d?{operationPathKey:gl.createOperationPathKeyFromOperation(d)}:void 0,t=await _.queueMutation({[n]:c},{type:CE.INLINE,priority:AE.LOW,source:{type:wE.DISPLAY,subscriberId:`display-inline`},transportOverride:e});if(!t.success)throw new Tj(t.error?.message??`Inline edit failed`,t.error);g?.(n,c)}else if(Un(v)&&a&&o){let e=R();if(!e)throw Error(`No UPDATE operation configured for resource "${a}". Inline editing requires an UPDATE.default operation.`);let r=gl.createOperationPathKeyFromOperation(e),i=V.getResourceFieldIdentifierForType(a,k),u={...s,[i]:o};await O(r,{contextualParameters:u,parentResourcesRequirements:l,requestData:WE(wA(t,n,c),z,t)}),g?.(n,c)}else throw new pa({surfaceName:`AutomaticDisplayer inline edit`,resourceType:a??`unknown`,operationIdentifier:d?.operationIdentifier??W.UPDATE})},[p,_,a,o,s,l,O,k,g,R,v,d,z,t,e]),ne=!m&&(!!p||!!_||Un(v)&&!!a&&!!o&&te),re=(0,Q.useMemo)(()=>({resourceType:a,resourceId:o,doInlineUpdate:B,canInlineEdit:ne,defaultInlineEdit:S,defaultEmptyValue:C,fileUploadContext:h,contextualParameters:s,contextResourceIdentifiers:c,navigationZone:u,parentReferenceConfig:f,rmm:_}),[a,o,B,ne,S,C,h,s,c,u,f,_]),ie=(0,Q.useMemo)(()=>({schema:e,data:b?void 0:t,isLoading:b,fieldLabels:j,fieldDescriptions:M,fieldTooltips:N,enumLabels:P,sectionLabels:F,sectionDescriptions:I,groupLabels:ee,defaultSectionAppearance:w,breakpoint:A,hiddenFieldNames:T,inlineEditDisabledFieldNames:E,onFileActivationOperation:D}),[e,t,b,j,M,N,P,F,I,ee,w,A,T,E,D]);return(0,$.jsx)(Cj.Provider,{value:re,children:(0,$.jsx)(MA.Provider,{value:!1,children:(0,$.jsx)(yk,{displayChromeMode:x,children:(0,$.jsx)(hk,{value:ie,children:(0,$.jsx)(`div`,{className:U(`space-y-section`,n),children:y?Q.createElement(y):null})})})})})}HB.displayName=`AutomaticDisplayer`;var UB=HB,WB=(0,Q.createContext)(null);function GB({value:e,children:t}){return(0,$.jsx)(WB.Provider,{value:e,children:t})}function KB(){return(0,Q.useContext)(WB)}function qB({title:e,hostProvidesHeading:t,className:n}){let r=U(`min-w-0 truncate`,YB(),n);return t?(0,$.jsx)(`h2`,{className:r,children:e}):(0,$.jsx)(`h1`,{className:r,children:e})}function JB({className:e}){return(0,$.jsx)(`div`,{className:U(`min-w-0`,YB(),e),"aria-hidden":`true`,"data-resource-header-title-pending":`true`,children:(0,$.jsx)(Tm,{className:`h-[1lh] w-48 max-w-full`})})}function YB(){let e=(0,Q.useContext)(__);return(e?e.getRecipe(wi.TYPOGRAPHY,Lu.RESOURCE_TITLE):qg.typography?.[Lu.RESOURCE_TITLE])?.base}function XB({className:e}){let t=KB();t?.titleMountTracker&&(t.titleMountTracker.titleMounted=!0);let n=t?.title,r=n?(0,$.jsx)(qB,{title:n,hostProvidesHeading:t?.hostProvidesHeading,className:e}):t?.titlePending?(0,$.jsx)(JB,{}):null;return r?t?.titleTarget===void 0?r:t.titleTarget?(0,AN.createPortal)(r,t.titleTarget):null:null}function ZB({children:e}){let t=KB();return t?.leadingTarget===void 0?(0,$.jsx)($.Fragment,{children:e}):t.leadingTarget?(0,AN.createPortal)(e,t.leadingTarget):null}var QB=(0,Q.createContext)(null);function $B({zone:e,controls:t,children:n}){let[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!0),s=(0,Q.useRef)(null),c=(0,Q.useCallback)(e=>{s.current===null&&(s.current=e,i(e))},[]),l=(0,Q.useCallback)(e=>{s.current===e&&(s.current=null,i(null),o(!0))},[]),u=(0,Q.useCallback)((e,t)=>{s.current===e&&o(t)},[]),d=(0,Q.useMemo)(()=>({zone:e,controls:t,claimant:r,claimantOnScreen:a,claim:c,release:l,reportOnScreen:u}),[e,t,r,a,c,l,u]);return(0,$.jsx)(QB.Provider,{value:d,children:n})}function eV(e){let t=(0,Q.useContext)(QB);return!!t&&t.zone===e}var tV;(function(e){e.OWN_ROW=`own_row`,e.IN_HEADER=`in_header`,e.OVERLAY=`overlay`})(tV||={});function nV(){let e=(0,Q.useContext)(QB);return!e||e.claimant==null?tV.OWN_ROW:e.claimantOnScreen?tV.IN_HEADER:tV.OVERLAY}function rV({children:e}){let t=nV();return t===tV.IN_HEADER?null:(0,$.jsx)(`div`,{className:U(`pointer-events-none sticky top-0 z-10 flex justify-end gap-element`,t===tV.OVERLAY&&`-mb-8`),"data-zone-chrome-presence":t,children:e})}function iV(e,t,n=!0){let r=(0,Q.useContext)(QB),i=(0,Q.useRef)({}).current,a=!!r&&t&&e===r.zone,o=r?.claim,s=r?.release,c=r?.reportOnScreen;return(0,Q.useLayoutEffect)(()=>{if(a&&o&&s)return o(i),()=>s(i)},[a,o,s,i]),(0,Q.useLayoutEffect)(()=>{a&&c&&c(i,n)},[a,c,i,n,r?.claimant]),a&&r.claimant===i&&n?r.controls:null}var aV=`@container/resource-header`,oV=new Set([W.READ,W.LIST,W.SEARCH,W.COUNT,W.DELETE,W.DELETE_MANY]);function sV(e,t){if(e.resourceType!==t.resourceType||e.isBulkOperation)return!1;let n=ul(e.operation??{operationIdentifier:e.operationIdentifier});return n!==void 0&&oV.has(n)?!1:lV(e,t)}function cV(e,t){return e.resourceType!==t.resourceType||e.isBulkOperation||e.relaysRowDeletion||ul(e.operation??{operationIdentifier:e.operationIdentifier})!==W.READ?!1:lV(e,t)}function lV(e,t){let n=e.contextResourceIdentifiers?.[t.resourceType];if(n==null)return!1;let r=String(gn.getResourceId(n));return t.shownRowIds.some(e=>e!=null&&e!==``&&e===r)}function uV(e){let{on:t}=vo(),[n,r]=(0,Q.useState)(null),i=(0,Q.useRef)(e.rowIds);i.current=e.rowIds;let{resourceType:a,enabled:o}=e;return(0,Q.useEffect)(()=>{if(!o)return;let e=t(hc.RESOURCE_OPERATION_EXECUTED,()=>r({at:Date.now(),madeElsewhere:!1}),e=>sV(e,{resourceType:a,shownRowIds:i.current})),n=t(hc.RESOURCE_REFRESH,()=>r({at:Date.now(),madeElsewhere:!0}),e=>cV(e,{resourceType:a,shownRowIds:i.current}));return()=>{e(),n()}},[o,t,a]),n}function dV({className:e,actions:t,bar:n}){return(0,$.jsxs)(`div`,{className:U(e||`flex-1`,aV,`flex min-w-0 flex-col`),"data-resource-header-pending":`true`,children:[n,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-field`,children:[(0,$.jsx)(`div`,{className:`min-w-0 flex-1 basis-60`,children:(0,$.jsx)(JB,{})}),t&&(0,$.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center`,children:(0,$.jsx)(pC,{children:t})})]})]})}var fV=({resourceContext:e,navigationZone:t,navigationInitiator:n,title:r,description:i,className:a,actions:o,parentReferenceConfig:s,heldRecord:c})=>{let l=oA(),u=bC(),d=u?.resourceContext?.resourceType===e.resourceType?u:void 0,f=d?.resourceContext??e,{resourceType:p,operation:m,contextResourceIdentifiers:h}=f,{tResourceHeader:g,tResourceOperation:_,t:v,formatDate:y,formatDateTime:b,isReady:x}=K({component:J.RESOURCES_LAYOUTS_HEADER,resource:p}),S=bp(),{registry:C,doOperation:w}=wm(),{renderIcon:T}=Rf();String(m.operationIdentifier);let E=gn.getPrimaryResourceIdentifier(f),D=(0,Q.useMemo)(()=>C.resourceConfigurations[p],[C,p]),O=d?.resourceConfig??D,k=V.frontendResourceLabelDefinitionOf(O),A=ul(m),M=lo(m),N=A===W.READ?O?.frontendConfiguration?.layout?.header:void 0,P=!!k&&!!E&&M,F=(!!k||!!N)&&!!E&&M,I=!!O,[ee,L]=(0,Q.useState)(void 0),[R,te]=(0,Q.useState)(!1),z=c!==void 0,B=c?c.record:ee,ne=c?c.record===void 0&&!c.failed:R,[ie,ae]=(0,Q.useState)(null),oe=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(h),[h]),se=(0,Q.useMemo)(()=>V.buildContextualParameters(h,C),[oe,C]),ce=d?.contextualParameters??se,le=(0,Q.useMemo)(()=>Object.entries(ce).map(([e,t])=>`${e}:${t}`).sort().join(`|`),[ce]),ue=(0,Q.useMemo)(()=>JSON.stringify(f.parentResourcesRequirements??null),[f.parentResourcesRequirements]),de=(0,Q.useMemo)(()=>m.operationIdentifier===W.READ?m:d?.resolvePreferredOperation(W.READ,{requireAddressable:!0})??Mz(p,C,{hasResourceId:!!E,contextResourceIdentifiers:h,contextualParameters:ce}),[m,d,p,C,E,h,ce]),fe=(0,Q.useMemo)(()=>V.tryBuildForeignKeyReadOperationPath(p,C,de),[p,C,de]),pe=hb(Dg({resourceType:p,operation:de?de.operationIdentifier??W.READ:W.READ,discriminator:E??void 0})),me=(0,Q.useRef)(w);(0,Q.useEffect)(()=>{me.current=w},[w]);let he=uV({resourceType:p,rowIds:[E?String(E):null,ee&&(typeof ee._id==`string`||typeof ee._id==`number`)?String(ee._id):null],enabled:!z&&F&&!!E}),ge=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(z||!F||!O||!fe)return;let e=!1,t=`${fe}|${oe}|${le}|${ue}`,n=ge.current===t;return ge.current=t,(async()=>{n||(te(!0),L(void 0)),ae(null);try{let t=await me.current(fe,{contextualParameters:ce,parentResourcesRequirements:f.parentResourcesRequirements});if(e)return;t&&typeof t==`object`&&!Array.isArray(t)&&L(t)}catch(t){if(e)return;let r=j(t);Jo.getLogger().error(`[ResourceLayoutPreset_Header_Default] Error fetching resource label:`,{resourceType:p,operationPathKey:fe,...r,error:t}),ae({...r,message:S(t)}),n||L(void 0)}finally{e||te(!1)}})(),()=>{e=!0}},[z,F,fe,oe,le,ue,I,p,he?.at]);let _e=(0,Q.useMemo)(()=>!B||!P?null:V.computeFrontendResourceLabel({resourceType:p,registry:C,currentObject:B,objectContext:f,initiatorUserContext:void 0,t:v,formatDate:y,formatDateTime:b}),[B,P,p,C,f,v,y,b]),ve=$a(m.operationIdentifier,O?.operations),ye=(0,Q.useMemo)(()=>r||_(p,ve,`title`),[r,_,p,ve]),be=A===W.LIST||A===W.SEARCH,xe=fne(m),Se=!xe&&P?_e:null,Ce=(0,Q.useMemo)(()=>i||Se||(be?em({tResourceHeader:g,resourceType:p})??null:null),[i,Se,be,g,p]),we=(0,Q.useMemo)(()=>P&&xe?ne||pe.isInitialLoad?null:_e||(E?`#${E}`:null):null,[P,xe,ne,pe.isInitialLoad,_e,E]),Te=m.operationFrontendConfig?.headerIconPlacement,Ee=(0,Q.useMemo)(()=>Te===Tu.TEMPLATE_OWNED?null:T({category:re.RESOURCES,resourceType:p},{size:fa.MD}),[T,p,Te]),De=!!we,Oe=l&&!De,ke=P&&xe&&!De&&(ne||pe.isInitialLoad),Ae=(0,Q.useMemo)(()=>V.resolveRowSchema(O,B),[O,B]),je=(0,Q.useMemo)(()=>({resourceContext:{resourceType:p,operationId:W.READ}}),[p]),[Me,Ne]=(0,Q.useState)(null),[Pe,Fe]=(0,Q.useState)(null),[Ie,Le]=(0,Q.useState)(null),[Re,ze]=(0,Q.useState)(!0);(0,Q.useEffect)(()=>{if(!Ie||typeof IntersectionObserver>`u`)return;let e=new IntersectionObserver(e=>{let t=e[e.length-1];t&&ze(t.isIntersecting)});if(typeof e?.observe==`function`)return e.observe(Ie),()=>e.disconnect?.()},[Ie]);let Be=eV(t)&&!l,Ve=iV(t,!l&&(x||ke),Re),He=(0,Q.useMemo)(()=>{if(l||wo.resolve(J.RESOURCES_LAYOUTS_BREADCRUMB,q.DEFAULT)!==LB)return s;let e=IB({parentResourcesRequirements:f.parentResourcesRequirements,contextResourceIdentifiers:f.contextResourceIdentifiers});if(s)return e.some(e=>e.resourceType===s.parentResourceType&&e.resourceId===s.parentResourceId)?{...s,displayMode:hr.NONE}:s;let t=e[e.length-1];return t?{parentResourceType:t.resourceType,parentResourceId:t.resourceId,displayMode:hr.NONE}:void 0},[s,l,f.parentResourcesRequirements,f.contextResourceIdentifiers]),Ue=(0,Q.useRef)({titleMounted:!1}).current,We=(0,Q.useMemo)(()=>({resourceType:p,title:De?we:l&&ke?null:ye,titlePending:ke&&(l||!ye),titleMountTracker:Ue,hostProvidesHeading:l,titleTarget:Me,leadingTarget:Pe}),[p,De,we,ye,Ue,l,ke,Me,Pe]);(0,Q.useEffect)(()=>{});let Ge=(0,$.jsxs)(`div`,{ref:Le,className:U(`flex min-w-0 items-center gap-element pb-item-sm`,Be?`min-h-8`:`empty:hidden`),"data-slot":`resource-header-bar`,children:[(0,$.jsx)(EB,{host:wB.SURFACE,navigationZone:t}),!l&&(0,$.jsx)(zB,{resourceContext:f,navigationZone:t,navigationInitiator:n}),Ve&&(0,$.jsx)(`div`,{className:`ms-auto flex shrink-0 items-center gap-element`,children:Ve})]});if(!x)return ke?(0,$.jsx)(dV,{className:a,actions:o,bar:Ge}):o?(0,$.jsx)(`div`,{className:U(`flex items-center justify-end gap-field`,a),children:(0,$.jsx)(pC,{children:o})}):null;if(Oe)return ke?(0,$.jsx)(dV,{className:a,actions:o}):o?(0,$.jsx)(`div`,{className:U(`flex items-center justify-end gap-field`,a),children:(0,$.jsx)(pC,{children:o})}):null;let Ke=!!N&&!!Ae;return(0,$.jsxs)(`div`,{className:U(a||`flex-1`,aV,`flex min-w-0 flex-col`),"data-slot":`resource-header`,children:[Ge,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-field`,"data-slot":`resource-header-title-line`,children:[Ee&&(0,$.jsx)(`div`,{className:`shrink-0`,children:Ee}),Ke&&(0,$.jsx)(`span`,{ref:Fe,className:`flex shrink-0 items-center gap-field empty:hidden`,"data-slot":`resource-header-leading`}),Ke?(0,$.jsx)(`div`,{ref:Ne,className:`flex min-w-0 flex-1 basis-60 items-center`,"data-slot":`resource-header-title`}):(0,$.jsx)(qB,{title:(De?we:ye)??``,hostProvidesHeading:l,className:`flex-1 basis-60`}),o&&(0,$.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center`,children:(0,$.jsx)(pC,{children:o})})]}),Ke&&(0,$.jsx)(`div`,{className:`min-w-0 [&:has(:is(span,a,img,svg,button,p))]:pt-item-sm`,"data-slot":`resource-header-facts`,children:(0,$.jsx)(GB,{value:We,children:(0,$.jsx)(UB,{schema:Ae,data:B,labels:je,resourceType:p,resourceId:E?String(E):void 0,contextualParameters:ce,contextResourceIdentifiers:h,parentResourcesRequirements:f.parentResourcesRequirements,navigationZone:t,parentReferenceConfig:He,disableInlineEdit:!0,layoutTemplate:N,defaultDisplayChromeMode:Ho.INLINE,isLoading:!B})})}),!De&&Ce&&(0,$.jsx)(`p`,{className:`mt-item-xs text-sm text-muted-foreground`,children:Ce}),ie&&(0,$.jsxs)(`p`,{className:`mt-item-xs text-xs text-destructive/80 inline-flex items-center gap-item-xs`,role:`alert`,"aria-live":`polite`,title:ie.message,children:[T(H.WARNING,{size:fa.XS}),(0,$.jsx)(`span`,{children:ie.message})]})]})};function pV({preset:e=q.DEFAULT,...t}){let n=G(J.RESOURCES_LAYOUTS_HEADER,`ResourceLayout_Header`)(e);return(0,$.jsx)(n,{...t})}function mV({onSuccess:e,errorMessage:t,errorComponent:n}){let{resourceContext:r,resourceType:i,operation:a,reportError:o,goBackWithinZone:s,executeCurrentOperation:c}=yC(),{doOperation:l,registry:u}=wm(),{tComponent:d}=K({component:J.RESOURCES_LAYOUTS_ACTION,resource:i}),f=(0,Q.useRef)(l);f.current=l;let[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),y=(0,Q.useMemo)(()=>Wc(a),[a]),b=y&&Un(hl(a,u.resourceConfigurations[i]?.operations)),x=(0,Q.useMemo)(()=>JSON.stringify({contextResourceIdentifiers:V.buildContextResourceIdentifiersKey(r.contextResourceIdentifiers??{}),parentResourcesRequirements:r.parentResourcesRequirements??[]}),[r.contextResourceIdentifiers,r.parentResourcesRequirements]),S=(0,Q.useMemo)(()=>{let e=r.contextResourceIdentifiers?.[i];return e?gn.getResourceId(e)??null:null},[r.contextResourceIdentifiers,i])??(_?.contextKey===x&&typeof _.row._id==`string`&&_.row._id.length>0?_.row._id:null),C=(0,Q.useMemo)(()=>!S||r.contextResourceIdentifiers?.[i]?r.contextResourceIdentifiers:{...r.contextResourceIdentifiers,[i]:S},[r.contextResourceIdentifiers,S,i]),w=(0,Q.useMemo)(()=>V.buildContextualParameters(C,u),[C,u]),T=a?.variantKey,E=a?.admitsCrossTenantPlatformAdministration===!0,D=(0,Q.useMemo)(()=>({variantKey:T,admitsCrossTenantPlatformAdministration:E}),[E,T]),O=(0,Q.useMemo)(()=>Nz(i,u,{hasResourceId:!!S,contextResourceIdentifiers:C,contextualParameters:w,actingOperation:D}),[C,w,S,D,u,i]),{rmm:k}=Uz({resourceType:i,resourceId:S,doOperationRef:f,contextualParameters:w,parentResourcesRequirements:r.parentResourcesRequirements,contextResourceIdentifiers:C,resourceSchema:u.resourceConfigurations[i]?.mainSchema,resourceInheritance:u.resourceConfigurations[i]?.inheritenceSchemaDefinition,enabled:y&&!!S,conflictPolicy:{strategy:DE.ACCEPT_REMOTE},directFallbackAccepted:b,actingOperation:D}),A=(0,Q.useMemo)(()=>jp({tComponent:d,componentType:J.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),[d]),j=iz((0,Q.useMemo)(()=>C===r.contextResourceIdentifiers?r:{...r,contextResourceIdentifiers:C},[C,r]),a),M=(0,Q.useContext)(Sh),N=(0,Q.useRef)(M);N.current=M;let P=(0,Q.useCallback)(t=>{Rr(t)&&N.current?.notifyInfo(jp({tComponent:d,componentType:J.RESOURCES_LAYOUTS_ACTION,key:`operationSentForApproval`})),j(t),e?e(t):s()},[j,s,e,d]),F=(0,Q.useCallback)(e=>{o(e,t,n)},[n,t,o]);return(0,Q.useEffect)(()=>{if(!y||S||!O)return;let e=!1;return g(!0),Fz({doOperation:f.current,readOperationPathKey:O,contextualParameters:w,parentResourcesRequirements:r.parentResourcesRequirements}).then(t=>{e||v({contextKey:x,row:t})}).catch(t=>{e||F(t instanceof Error?t:Error(String(t)))}).finally(()=>{e||g(!1)}),()=>{e=!0}},[x,O,w,r.parentResourcesRequirements,S,F,y]),(0,Q.useEffect)(()=>{if(k&&_&&_.contextKey===x&&(typeof k.getSnapshot!=`function`||k.getSnapshot().confirmedData===null)&&typeof k.setInitialState==`function`){let e=_.row;k.setInitialState(e,e._version??0,e._field_meta)}},[x,_,k]),{execute:(0,Q.useCallback)(async e=>{m(!0);try{let t;if(y&&(k||!b)){if(!k)throw new pa({surfaceName:`useOperationDirectExecution`,resourceType:i,operationIdentifier:String(a.operationIdentifier)});let n=await k.queueMutation({},{type:CE.CUSTOM,priority:AE.HIGH,source:{type:wE.CUSTOM,subscriberId:`direct-execution:${String(a.operationIdentifier)}`},transportOverride:{operationPathKey:gl.createOperationPathKeyFromOperation(a),contextualParameters:w,parentResourcesRequirements:r.parentResourcesRequirements,requestData:e??{},readBackOnSuccess:!0}});if(!n.success)throw tz(n.error,A);t=n.heldForApproval??n.responseData}else if(y){if(!S)throw Error(`${String(a.operationIdentifier)} on ${i} has no row to act on: no id on the route and none from its canonical READ.`);t=await f.current(gl.createOperationPathKeyFromOperation(a),{contextualParameters:w,parentResourcesRequirements:r.parentResourcesRequirements,requestData:e??{}})}else t=await c(e);P(t)}catch(e){F(e instanceof Error?e:Error(A))}finally{m(!1)}},[w,r.parentResourcesRequirements,c,F,P,b,y,S,a,i,k,A]),isExecuting:p,isBootstrapping:h,completeWithSuccess:P,reportFailure:F}}var hV=Jo.getLogger(),gV;(function(e){e.FULL=`full`,e.COMPACT=`compact`})(gV||={});function _V({...e}){let{errorMessage:t,errorComponent:n,onSuccess:r,onCancel:i,chrome:a,headerActions:o,recordNavigation:s}=e,{resourceContext:c,navigationZone:l,navigationInitiator:u,resourceType:d,operation:f}=yC(),p=e.resourceContext?.operation,m=p?gl.createOperationPathKeyFromOperation(p):void 0,h=f?gl.createOperationPathKeyFromOperation(f):void 0;(0,Q.useEffect)(()=>{m&&h&&m!==h&&hV.error(`[ResourceLayout_SemanticOperationFallback] handed "${m}" but the nearest operation view is "${h}" — this host would render and execute the wrong operation. A host rendered outside its operation's own view must provide one; use ResourceOperationDetachedHost.`)},[m,h]);let{tComponent:g,tResourceOperation:_,isReady:v}=K({component:J.RESOURCES_LAYOUTS_ACTION,resource:d}),y=(0,Q.useMemo)(()=>[`resources.${d}`,`components.${J.RESOURCES_LAYOUTS_ACTION}`],[d]),[b,x]=(0,Q.useState)(!1),{execute:S,isExecuting:C,isBootstrapping:w,completeWithSuccess:T,reportFailure:E}=mV({onSuccess:r,errorMessage:t,errorComponent:n}),D=(0,Q.useMemo)(()=>_(d,String(f.operationIdentifier),`title`),[f.operationIdentifier,d,_]),O=(0,Q.useMemo)(()=>jp({tComponent:g,componentType:J.RESOURCES_LAYOUTS_ACTION,key:`runningAction`,params:{actionLabel:D}}),[D,g]),k=(0,Q.useCallback)(async()=>{await S()},[S]),A=!Rre(f)&&!ri(f),j=f.riskLevel===ls.CRITICAL,M=(0,Q.useMemo)(()=>aC(_,d,String(f.operationIdentifier)),[_,d,f.operationIdentifier]),N=(0,Q.useCallback)(()=>{j?x(!0):k()},[j,k]),P=(0,Q.useCallback)(()=>{x(!1),k()},[k]),F=(0,Q.useCallback)(()=>{x(!1)},[]),I=a===gV.COMPACT;return v===!1?null:(0,$.jsx)(yb,{i18nKeys:y,children:(0,$.jsxs)(`div`,{className:I?`space-y-field`:`space-y-section`,children:[!I&&(0,$.jsx)(pV,{resourceContext:c,navigationZone:l,navigationInitiator:u,actions:o}),!I&&s,A?(0,$.jsx)(xB,{resourceContext:c,navigationZone:l,onSuccess:T,onError:E,onCancel:i,showErrorSummary:!0,className:I?void 0:`max-w-2xl`}):(0,$.jsxs)(`div`,{className:I?`bg-muted rounded-lg p-container`:`bg-muted rounded-lg p-container max-w-2xl`,children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground mb-field`,children:jp({tComponent:g,componentType:J.RESOURCES_LAYOUTS_ACTION,key:`confirmMessage`})}),(0,$.jsx)(X,{type:`button`,variant:Y.DEFAULT,onClick:N,disabled:C||w,children:C||w?O:D})]}),b&&(0,$.jsx)(Jw,{open:!0,onOpenChange:e=>{e||F()},cancelCallback:F,validationCallback:P,requireTypedConfirmation:!0,confirmationPhrase:M})]})})}function vV({resourceContext:e,navigationZone:t,onSuccess:n,onCancel:r,errorMessage:i,errorComponent:a}){let o=bV();return(0,$.jsx)(xC,{resourceContext:e,navigationZone:t,children:(0,$.jsx)(`div`,{ref:o,className:`contents`,"data-slot":`resource-operation-detached-host`,children:(0,$.jsx)(_V,{resourceContext:e,navigationZone:t,chrome:gV.COMPACT,onSuccess:n,onCancel:r,errorMessage:i,errorComponent:a})})})}var yV=`input:not([type="hidden"]):not([disabled]), textarea:not([disabled]), select:not([disabled]), [role="combobox"]:not([aria-disabled="true"])`;function bV(){let e=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{let t=e.current;if(!t||typeof MutationObserver>`u`)return;let n=!1,r=()=>{if(n)return;if(t.contains(document.activeElement)){n=!0;return}let e=t.querySelector(yV);e&&(e.focus(),n=!0)};if(r(),n)return;let i=new MutationObserver(()=>{r(),n&&i.disconnect()});return i.observe(t,{childList:!0,subtree:!0}),()=>i.disconnect()},[]),e}function xV({resourceContext:e,navigationZone:t,onDismiss:n}){let{tComponent:r}=K({component:J.RESOURCES_LAYOUTS_ACTION}),i=(0,Q.useCallback)(()=>{n()},[n]);return(0,$.jsx)(vV,{resourceContext:e,navigationZone:t,onSuccess:i,onCancel:n,errorMessage:jp({tComponent:r,componentType:J.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),errorComponent:`ResourceOperationActionPopoverBody`})}var SV=10,CV=300,wV=2;function TV({schema:e,name:t,value:n,targetResourceType:r}){let{registry:i,doOperation:a}=wm(),{t:o,formatDate:s,formatDateTime:c,tComponent:l,tResourceFieldEdit:u}=K({component:J.RESOURCES_FIELDS_RESOURCE_REFERENCE}),d=bp(),f=qD(),p=bC(),m=(0,Q.useMemo)(()=>f?.contextResourceIdentifiers?V.buildContextualParameters(f.contextResourceIdentifiers,i):p?.contextualParameters??{},[f?.contextResourceIdentifiers,p?.contextualParameters,i]),h=(0,Q.useRef)(null),g=(0,Q.useRef)(a);g.current=a;let _=(0,Q.useRef)(m);_.current=m;let v=f?{resourceType:f.resourceType,id:f.resourceId}:p?.resourceContext?{resourceType:p.resourceContext.resourceType,id:gn.getAddressedRecordId(p.resourceContext)}:void 0,y=(0,Q.useRef)(v);y.current=v;let b=sc(e)===bc.ARRAY,x=b&&te(e)||e,S=(0,Q.useMemo)(()=>Uj({explicitResourceType:r,schema:Ec(e)?e:x,fieldName:t,registry:i}),[x,t,i,e,r]),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)([]),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(``),[P,F]=(0,Q.useState)(new Map),[I,ee]=(0,Q.useState)(null),L=(0,Q.useMemo)(()=>Xw(n),[n]),R=(0,Q.useMemo)(()=>S?Il(i.resourceConfigurations?.[S]?.operations??[],W.READ)??null:null,[i,S]),z=(0,Q.useCallback)(async e=>{if(S){O(!0),ee(null);try{let t=V.buildForeignKeySearchOperationPath(S,i),n=V.buildForeignKeySearchParams(e,SV,{resourceType:S,registry:i}),r=gn.withoutSelfReferencingParents(_.current,S,i),a=Yw({resourceType:S,registry:i,contextualParameters:r})??r,l=await g.current(t,{contextualParameters:a,queryParameters:n.queryParameters,dataMode:n.dataMode}),u=[];if(Array.isArray(l))u=l;else if(l&&typeof l==`object`){let e=l;u=e.data||e.items||[]}E(Sue({items:u,resourceType:S,registry:i,t:o,formatDate:s,formatDateTime:c}))}catch(t){let n=j(t);Jo.getLogger().error(`[useResourceSearch] Failed to fetch options:`,{resourceType:S,query:e,...n,error:t}),ee({...n,message:d(t)}),E([])}finally{O(!1)}}},[S,i,o,s,c]),B=(0,Q.useRef)(P);B.current=P;let ne=(0,Q.useCallback)(async()=>{if(!S||L.length===0)return;let e=L.filter(e=>!B.current.has(e));if(e.length===0)return;A(!0);let t=new Map(B.current);for(let n of e)try{let{label:e}=await Qw({resourceType:S,id:n,registry:i,doOperation:g.current,contextualParameters:Zm({hostIdentifiers:{},hostContextualParameters:_.current,hostRecord:y.current,targetResourceType:S,targetId:n,registry:i}).contextualParameters,readOperation:R,t:o,formatDate:s,formatDateTime:c});t.set(n,e)}catch{t.set(n,n)}F(t),A(!1)},[S,L,i,R,o,s,c]);(0,Q.useEffect)(()=>{ne()},[ne]),(0,Q.useEffect)(()=>{if(C)return h.current&&clearTimeout(h.current),M.length>=wV?h.current=setTimeout(()=>{z(M)},CV):M.length===0&&z(),()=>{h.current&&clearTimeout(h.current)}},[M,C,z]);let re=(0,Q.useCallback)(e=>{N(e)},[]),ie=(0,Q.useCallback)(e=>{w(e),e?ee(null):N(``)},[]),ae=(0,Q.useCallback)(e=>P.get(e)||e,[P]),oe=(0,Q.useMemo)(()=>M.length>0&&M.length<wV?l(J.RESOURCES_FIELDS_RESOURCE_REFERENCE,`minSearchChars`,{count:String(wV)}):l(J.RESOURCES_FIELDS_RESOURCE_REFERENCE,`noResults`),[M,l]),se=f?.resourceType;return{options:T,isLoading:D,isLoadingCurrentValue:k,isOpen:C,setIsOpen:ie,handleSearchChange:re,getDisplayLabel:ae,resourceType:S,isMultiple:b,normalizedValue:L,emptyMessage:oe,defaultPlaceholder:(0,Q.useMemo)(()=>{if(!b&&se){let e=u(se,sr.labelDictionaryPath(t),`label`);if(e)return jp({tComponent:l,componentType:J.RESOURCES_FIELDS_RESOURCE_REFERENCE,key:`selectReferencePlaceholder`,params:{target:e}})}return l(J.RESOURCES_FIELDS_RESOURCE_REFERENCE,`selectPlaceholder`)},[se,b,t,l,u]),fetchError:I}}var EV=zs(J.LOW_LEVEL_COMMAND,`Command`,[`Dialog`,`Input`,`List`,`Empty`,`Group`,`Item`,`Shortcut`,`Separator`]);function DV({preset:e=q.DEFAULT,...t}){let n=EV(e);return(0,$.jsx)(n,{...t})}function OV({preset:e=q.DEFAULT,...t}){let n=EV(e);return(0,$.jsx)(n.Dialog,{...t})}function kV({preset:e=q.DEFAULT,...t}){let n=EV(e);return(0,$.jsx)(n.Input,{...t})}function AV({preset:e=q.DEFAULT,...t}){let n=EV(e);return(0,$.jsx)(n.List,{...t})}function jV({preset:e=q.DEFAULT,...t}){let n=EV(e);return(0,$.jsx)(n.Empty,{...t})}function MV({preset:e=q.DEFAULT,...t}){let n=EV(e);return(0,$.jsx)(n.Group,{...t})}function NV({preset:e=q.DEFAULT,...t}){let n=EV(e);return(0,$.jsx)(n.Item,{...t})}function PV({preset:e=q.DEFAULT,...t}){let n=EV(e);return(0,$.jsx)(n.Shortcut,{...t})}function FV({preset:e=q.DEFAULT,...t}){let n=EV(e);return(0,$.jsx)(n.Separator,{...t})}var IV=7;function LV({resourceContext:e,navigationZone:t,currentValue:n,onDismiss:r}){return(0,$.jsx)(xC,{resourceContext:e,navigationZone:t,children:(0,$.jsx)(RV,{currentValue:n,onDismiss:r})})}function RV({currentValue:e,onDismiss:t}){let{operation:n,resourceType:r}=yC(),{tComponent:i}=K({component:J.RESOURCES_LAYOUTS_ACTION,resource:r}),a=(0,Q.useMemo)(()=>Ns(n),[n]),{execute:o,isExecuting:s,isBootstrapping:c}=mV({onSuccess:t,errorMessage:jp({tComponent:i,componentType:J.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),errorComponent:`ResourceOperationActionDropdownBody`}),l=(0,Q.useCallback)(n=>{a&&(n===e?t():o({[a.fieldName]:n}))},[a,e,o,t]);if(!a)return null;let u=s||c;return a.domain===Ste.REFERENCE?(0,$.jsx)(BV,{choice:a,currentValue:e,busy:u,onPick:l}):(0,$.jsx)(zV,{choice:a,currentValue:e,busy:u,onPick:l})}function zV({choice:e,currentValue:t,busy:n,onPick:r}){let{resourceType:i,operation:a}=yC(),{tComponent:o,isReady:s}=K({component:J.LOW_LEVEL_FORM_FIELD}),{enumLabels:c,isReady:l}=mE(a.requestDto,{resourceType:i,operationId:String(a.operationIdentifier)},void 0,`edit`),u=(0,Q.useMemo)(()=>qc(e.fieldSchema)??[],[e.fieldSchema]),d=c[e.fieldName],f=u.length>IV;return s===!1||l===!1?(0,$.jsx)(VV,{}):(0,$.jsxs)(DV,{shouldFilter:f,children:[f&&(0,$.jsx)(kV,{placeholder:o(J.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`)}),(0,$.jsxs)(AV,{children:[(0,$.jsx)(jV,{children:o(J.LOW_LEVEL_FORM_FIELD,`noResults`)}),(0,$.jsx)(MV,{children:u.map(e=>{let i=d?.[e]??e;return(0,$.jsx)(HV,{value:e,label:i,isCurrent:e===t,disabled:n,onPick:r},e)})})]})]})}function BV({choice:e,currentValue:t,busy:n,onPick:r}){let{tComponent:i,isReady:a}=K({component:J.LOW_LEVEL_FORM_FIELD}),{options:o,isLoading:s,setIsOpen:c,handleSearchChange:l,emptyMessage:u,fetchError:d}=TV({schema:e.fieldSchema,name:e.fieldName,value:t});return(0,Q.useEffect)(()=>(c(!0),()=>c(!1)),[]),a===!1?(0,$.jsx)(VV,{}):(0,$.jsxs)(DV,{shouldFilter:!1,children:[(0,$.jsx)(kV,{placeholder:i(J.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`),onValueChange:l,autoFocus:!0}),(0,$.jsxs)(AV,{children:[(0,$.jsx)(jV,{children:s?(0,$.jsx)(VV,{}):d?.message??u}),(0,$.jsx)(MV,{children:o.map(e=>(0,$.jsx)(HV,{value:e.value,label:e.label,isCurrent:e.value===t,disabled:n||e.disabled===!0,onPick:r},e.value))})]})]})}function VV(){return(0,$.jsx)(`span`,{className:`flex justify-center py-element`,children:(0,$.jsx)(gb,{size:16})})}function HV({value:e,label:t,isCurrent:n,disabled:r,onPick:i}){let{renderIcon:a}=Rf();return(0,$.jsxs)(NV,{value:e,keywords:[t],disabled:r,onSelect:()=>i(e),"aria-current":n?`true`:void 0,"data-choice-value":e,children:[a(H.CHECK,{size:fa.SM,className:U(`me-2 shrink-0`,n?`opacity-100`:`opacity-0`)}),(0,$.jsx)(`span`,{className:`truncate`,children:t})]})}function UV(e){return e}function WV(e,t,n){let r=e.initiatorInfos??[];return r.length===0||r.some(e=>{let r=e.parameters??[];return r.length===0||r.every(e=>[e.fieldIdentifier,e.relationshipField,e.resourceType].filter(e=>typeof e==`string`&&e.length>0).some(e=>{if(gn.getResourceId(t[e]).length>0)return!0;let r=n[e];return r!==void 0&&String(r).length>0}))})}var GV={[W.UPDATE]:10,[W.CREATE]:20,[W.DELETE]:90,[W.DELETE_MANY]:90,[W.UPDATE_MANY]:10},KV=50,qV=0;function JV(e){let t=e.generatedOperation?.export;if(t?.formats?.length&&t.rowScopes?.length)return t}function YV(e){if(!e)return;let{page:t,limit:n,...r}=e;return r}function XV(e){let t=e.rowScope===Fo.FULL_RESULT_SET?`all rows`:`this page`;return`${e.format.toUpperCase()} — ${t}`}function ZV(e){let t=e.generatedOperation?.kind===es.GENERATED_FILE_REGENERATE?e.generatedOperation:void 0,n=typeof t?.fieldName==`string`?t.fieldName:typeof e.operationIdentifier==`string`?Nn.parseGeneratedFileRegenerateOperationIdentifier(e.operationIdentifier)?.fieldName:void 0;return n&&n.length>0?n:void 0}function QV(e){switch(e){case ls.CRITICAL:case ls.HIGH:return Y.DESTRUCTIVE;default:return Y.GHOST}}function $V(e){return e?{unavailability:e}:{}}var eH={[W.READ]:`viewDetails`,[W.UPDATE]:`edit`,[W.DELETE]:`delete`},tH=[];function nH(e,t){let n=e?.[Na.ORGANIZATIONS],r=n?gn.getResourceId(n):``;return r.length>0?r:t??null}function rH(e){let{resourceType:t,displayMode:n,currentObject:r,currentObjectDataMode:i,contextResourceIdentifiers:a,parentResourcesRequirements:o,navigationZone:s,sourceOperation:c,excludeOperations:l,bulkOnly:u=!1,selectionObjects:d,onSelectionNarrow:f,collectionOnly:p=!1,placementFilter:m,selectedItemIds:h,matchAllSelection:g,additionalContext:_,successDiscriminator:v,suppressViewDetails:y=!1,onOperationExecuted:b,collectionExportQuery:x}=e,S=(0,Q.useRef)(r);S.current=r;let{registry:C,doOperation:w}=wm(),{permissions:T}=Cg(),E=lm(),{navigateToResource:D}=zS(),{tComponent:O,tResourceOperation:k,tResourceFieldDisplay:A,isReady:j}=K({component:J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,resource:t}),N=bp(),{renderIcon:P}=Rf(),F=tS(),{emit:I,on:ee}=vo(),L=(0,Q.useContext)(Sm)?.isConnected??!1,R=(0,Q.useContext)(Mi),te=(0,Q.useRef)(R);te.current=R;let z=(0,Q.useRef)(x);z.current=x;let B=(0,Q.useContext)(Sh),ne=(0,Q.useRef)(B);ne.current=B;let ae=(0,Q.useRef)(w),oe=(0,Q.useRef)(I),se=(0,Q.useRef)(L);ae.current=w,oe.current=I,se.current=L;let[ce,le]=(0,Q.useState)({open:!1,label:``,requiresTypedConfirmation:!1,confirmationPhrase:``,description:null,confirmLabel:``,callback:null}),[ue,de]=(0,Q.useState)(!1),fe=(0,Q.useRef)(new Set),[pe,me]=(0,Q.useState)(null),[he,ge]=(0,Q.useState)(()=>new Set),[_e,ve]=(0,Q.useState)(null),[ye,xe]=(0,Q.useState)(null),Se=(0,Q.useRef)(null),Ce=(0,Q.useMemo)(()=>C.resourceConfigurations[t],[C,t]),we=n===Ac.DETAIL&&gie({resourceRelationships:Ce?.resourceRelationships,currentObject:r,contextResourceIdentifiers:a}),Te=(0,Q.useMemo)(()=>ie(n,Ce?.frontendConfiguration?.layout?.actionDisclosure),[n,Ce]),Ee=JSON.stringify(a??{}),Oe=(0,Q.useMemo)(()=>a,[Ee]),ke=JSON.stringify(o??[]),Ae=(0,Q.useMemo)(()=>o??[],[ke]),je=r?._id??(Ce?.resourceFieldIdentifier?r?.[Ce.resourceFieldIdentifier]:void 0),Me=typeof je==`string`&&je.length>0?je:void 0,Ne=(0,Q.useMemo)(()=>{if(!Me)return Oe;let e=Oe[t];if(gn.getResourceId(e)===Me)return Oe;let n=e?gn.getFieldIdentifier(e):void 0;return{...Oe,[t]:n?{fieldIdentifier:n,resourceId:Me}:Me}},[Oe,Me,t]),Pe=JSON.stringify(l??[]),Fe=(0,Q.useMemo)(()=>l??[],[Pe]),Ie=nH(Oe,E?.currentOrganizationId),Le=T?.appLevel??tH,Re=Ie?T?.organizations?.[Ie]??tH:tH,ze=Le.join(`,`),Be=Re.join(`,`),Ve=(0,Q.useMemo)(()=>Le,[ze]),He=Tg(),Ue=(0,Q.useMemo)(()=>Re,[Be]),We=T?.accessProfile??null,Ge=(0,Q.useMemo)(()=>({applicationRoles:[...Ve],organizationRoles:[...Ue],roleTables:He,organizationId:Ie??null,accessProfile:We}),[Ve,Ue,He,Ie,We]),Ke=jS(),qe=(0,Q.useMemo)(()=>(Ce?.operations??[]).filter(e=>!MS(e.operationFrontendConfig?.runtimeAvailability,Ke)).map(e=>gl.createOperationPathKeyFromOperation(e)).sort().join(`
|
|
11
|
-
`),[Ce,Ke]),Je=(0,Q.useMemo)(()=>new Set(qe?qe.split(`
|
|
12
|
-
`):[]),[qe]),Ye=x?.isSearchActive,Xe=x?.listingVariantKeys!==void 0,Ze=x?.listingVariantKeys?.list,Qe=x?.listingVariantKeys?.search,$e=(0,Q.useMemo)(()=>Xe?{list:Ze,search:Qe}:void 0,[Xe,Ze,Qe]),et=(0,Q.useMemo)(()=>{let e=(Ce?.operations??[]).filter(e=>Va(e)),t=e.some(e=>e.generatedOperation?.kind===es.GENERATED_COLLECTION_EXPORT&&e.generatedOperation.sourceCoreOperation===W.SEARCH),n=e.some(e=>e.generatedOperation?.kind===es.GENERATED_COLLECTION_EXPORT&&e.generatedOperation.sourceCoreOperation!==W.SEARCH);return t&&n},[Ce]),tt=(0,Q.useMemo)(()=>{if(!Ce)return[];let e=Ce.operations||[],n=new Set(Fe);return e.filter(e=>{let r=String(e.operationIdentifier),i=e.isBulkOperation??!1;if(n.has(r)||e.operationFrontendConfig?.actionVisibility===oo.HIDDEN||Je.has(gl.createOperationPathKeyFromOperation(e))||ar(e.operationFrontendConfig)&&!Va(e))return!1;let a=xa(e,{addressesTheContextSingletonRecord:we});if(p){if(!a||i)return!1}else if(a)return!1;if(!Mn(e,$e)||Ye!==void 0&&et&&Va(e)&&(e.generatedOperation?.kind===es.GENERATED_COLLECTION_EXPORT&&e.generatedOperation.sourceCoreOperation===W.SEARCH)!==Ye||u&&!i||!u&&(i||Rie(e)))return!1;let o=e.variantType;return!(o&&o!==Ya.API_CALL||!th({...e,resourceType:t,resourcePrimaryScope:Ce?.resourcePrimaryScope},Ge))})},[Ce,t,Fe,Je,u,p,Ge,Ye,$e,et,we]),nt=iC(tt,{currentObject:r,resourceType:t,selectionObjects:d,...i?{subjectDataMode:i}:{},...Ie?{organizationId:Ie}:{}}),rt=(0,Q.useMemo)(()=>V.buildContextualParameters(Ne,C),[Ne,C]),it=(0,Q.useMemo)(()=>!!gn.getResourceId(Ne[t]),[Ne,t]),ot=v??wc(_),st=(0,Q.useCallback)(e=>Ce?e.isBulkOperation===!0?WV(e,Ne,rt):!mh({operation:e,resourceType:t,resourceConfig:Ce})||ih({resourceConfig:Ce,operation:e,registry:C,hasResourceId:it,contextResourceIdentifiers:Ne,contextualParameters:rt}):!0,[Ne,rt,it,C,Ce,t]),ct=(0,Q.useCallback)(e=>{let n=String(e.operationIdentifier);if(Va(e)){let t=JV(e),n=t?M(t):[],r=jp({tComponent:O,componentType:J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`collectionExport`});return n.length===1?`${r} ${n[0].format.toUpperCase()}`:r}if(ri(e)){let n=ZV(e);return jp(n?{tComponent:O,componentType:J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`generatedFileRegenerateNamed`,params:{field:A(t,n,`label`)}}:{tComponent:O,componentType:J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`generatedFileRegenerate`})}let r=eH[n];return r?jp({tComponent:O,componentType:J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:r}):aC(k,t,n)},[O,k,A,t]),lt=(0,Q.useCallback)(e=>P({category:re.OPERATION_RESOURCES,resourceType:t,operationReference:String(e.operationIdentifier)},{size:fa.SM}),[P,t]),ut=(0,Q.useCallback)(e=>{let t=e.operationFrontendConfig;return t?.displayPriority===void 0?GV[ul(e)??String(e.operationIdentifier)]??KV:t.displayPriority},[]),dt=(0,Q.useCallback)(e=>he.has(gl.createOperationPathKeyFromOperation(e)),[he]),ft=(0,Q.useCallback)(()=>g?.matchedCount??d?.length??h?.length??0,[g,h,d]),pt=(0,Q.useRef)(ft);pt.current=ft,(0,Q.useEffect)(()=>{if(ot)return ee(hc.RESOURCE_OPERATION_EXECUTED,e=>{let t=at(e.resultSummary);t&&me({jobId:t.jobId,attemptedCount:pt.current()})},e=>e.resourceType===t&&e.isBulkOperation===!0&&e.optionalDiscriminator===ot)},[ee,t,ot]);let mt=(0,Q.useCallback)(e=>g?Kee(e):be(e),[g]),ht=(0,Q.useCallback)(e=>e.isBulkOperation===!0&&ft()>mt(e),[ft,mt]),gt=(0,Q.useCallback)((e,n)=>{if(ht(e))return{reason:jp({tComponent:O,componentType:J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`bulkSelectionTooLarge`,params:{maxSelection:mt(e),selectedCount:ft()}})};if(n.isEnabled||n.featureAvailability&&!n.featureAvailability.isAvailable)return;let r=String(e.operationIdentifier),i=bm(k,t,r),a=n.ineligibleSelectionIndices;if(e.isBulkOperation===!0&&a&&a.length>0&&d?.length){let e=jp({tComponent:O,componentType:J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`unavailableForSelection`,params:{ineligibleCount:a.length,selectedCount:d.length}}),t=new Set(a),n=d.filter((e,n)=>!t.has(n));return{reason:i?`${e} ${i}`:e,...n.length>0&&f?{resolve:{label:jp({tComponent:O,componentType:J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`keepEligibleOnly`,params:{eligibleCount:n.length}}),onSelect:()=>f(n)}}:{}}}return{reason:i??jp({tComponent:O,componentType:J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`unavailableForItem`})}},[ht,mt,ft,f,t,h,d,O,k]),_t=(0,Q.useCallback)(e=>{let t=QS(e);return nt.has(t)?nt.get(t):e.enabledCondition||e.requiredFeatures?{isEnabled:!1}:{isEnabled:!0}},[nt]),vt=(0,Q.useCallback)(e=>_t(e).isEnabled,[_t]),yt=(0,Q.useCallback)(e=>gn.createFrontendResourceOperationContextFromOperation({resourceType:t,operation:e,contextResourceIdentifiers:Ne,additionalContext:{...e.isBulkOperation===!0&&g?{[hte]:{...g.filters?{filters:g.filters}:{},...g.search?{search:g.search}:{},...g.listing?{listing:g.listing}:{},matchedCount:g.matchedCount}}:e.isBulkOperation===!0&&h?.length?{[Qt]:h}:{},...ot?{[ote]:ot}:{}},parentResourcesRequirements:Ae,isOperationDefault:e.isOperationDefault??!0}),[t,Ne,Ae,h,g,ot]),bt=(0,Q.useCallback)(e=>{if(!Ce)return;let t=yt(e),n=V.flattenContextIdentifiers(Ne),r=Ch.resolveResourceUrl(Ce,e,n,C.allResourceFieldIdentifiers,Ae)?.resolvedUrl;D(t,Ch.createOperationInitiator(s,c),r)},[Ce,yt,Ne,Ae,C,D,s,c]),xt=(0,Q.useCallback)(async(e,n)=>{let r=JV(e),i=te.current?.httpClient;if(!r||!i){ne.current?.notifyError?.(O(J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportUnavailable`));return}let o=z.current,s=e.resourceOperationLike===W.SEARCH;if(o?.isSearchActive&&!s){ne.current?.notifyError?.(O(J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportClearSearch`));return}let{format:c,rowScope:l}=n,u=Jle({registry:C,resourceConfig:Ce,exportOperation:e,resourceType:t,contextResourceIdentifiers:ju(a),contextualParameters:rt,parentResourcesRequirements:Ae,apiBaseUrl:va.getApiUrl(),format:c,rowScope:l,listingQuery:l===Fo.FULL_RESULT_SET?YV(o?.params):o?.params});if(!u)ne.current?.notifyError?.(O(J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportUnaddressable`));else try{await Yle({url:u,resourceType:t,format:c,getBlob:e=>i.fetchFileBlob(e)})}catch(e){ne.current?.notifyError?.(N(e,O(J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportFailed`)))}},[C,Ce,t,a,rt,Ae,O,N]),St=(0,Q.useCallback)(async e=>{if(!Ce)return;let n=gl.createOperationPathKeyFromOperation(e);if(!fe.current.has(n)){fe.current.add(n),ge(new Set(fe.current)),de(!0);try{let n=gl.createOperationPathKeyFromOperation(e),r=e.isBulkOperation??!1,i=e.operationFrontendConfig?.rowTargetRequestField,a=i?gn.getResourceId(Ne[t]):``,o=r&&g?Jn(g):r&&h?.length?_l(h):i&&a?{[i]:a}:void 0;if(i&&!a)throw Error(`Row-targeted operation "${String(e.operationIdentifier)}" could not resolve the target row id from context.`);let s=S.current,c=await ae.current(n,{contextualParameters:rt,parentResourcesRequirements:Ae,...o?{requestData:o}:{}},{silent:!0});if(Rr(c)){ne.current?.notifyInfo(jp({tComponent:O,componentType:J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`operationSentForApproval`}));return}let l=at(c);l&&ne.current?.notifyInfo(jp({tComponent:O,componentType:J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`operationRunningInBackground`}));let u=l?void 0:c&&typeof c==`object`&&!Array.isArray(c)?c.message:void 0;typeof u==`string`&&u.length>0&&ne.current?.notifySuccess(u);let d=()=>{let n=ri(e),r=De({contextResourceIdentifiers:Ne,resourceType:t,result:c,isBulkOperation:e.isBulkOperation===!0}),i=V.buildContextualParameters(r,C),a=Ku(c);if(!Di(e,se.current)&&mu(e)){let a=hy({resourceType:t,registry:C,callContext:Ne,...e.isBulkOperation===!0?{}:{previousRow:s,row:c}}),o=py({resourceType:t,registry:C,scopes:a}),l=o.length>0?o:[null];for(let e of l){let n=e??{operationIdentifier:W.LIST};oe.current(hc.RESOURCE_REFRESH,{resourceType:t,operationIdentifier:String(n.operationIdentifier??W.LIST),operation:n,variantType:e?.variantType,isOperationDefault:e?.isOperationDefault??!0,isBulkOperation:e?.isBulkOperation??!1,variantKey:e?.variantKey,contextResourceIdentifiers:a.contextResourceIdentifiers,...a.previousContextResourceIdentifiers?{previousContextResourceIdentifiers:a.previousContextResourceIdentifiers}:{},parentResourcesRequirements:Ae,...ot?{optionalDiscriminator:ot}:{}})}if(n){let e=Aa(Ce.operations??[],W.READ,{requireAddressable:!0}).filter(e=>ih({resourceConfig:Ce,operation:e,registry:C,hasResourceId:gn.getResourceId(r[t]).length>0,contextResourceIdentifiers:r,contextualParameters:i})),n=e.length>0?e:[null],a=new Set;for(let e of n){let n=e??{operationIdentifier:W.READ},i=[gn.getResourceId(r[t]),String(n.operationIdentifier),n.variantType??``,n.variantKey??``,n.isBulkOperation??!1].join(`:`);a.has(i)||(a.add(i),oe.current(hc.RESOURCE_REFRESH,{resourceType:t,operationIdentifier:String(n.operationIdentifier??W.READ),operation:n,variantType:e?.variantType,isOperationDefault:e?.isOperationDefault??!0,isBulkOperation:e?.isBulkOperation??!1,variantKey:e?.variantKey,contextResourceIdentifiers:r,parentResourcesRequirements:Ae,...ot?{optionalDiscriminator:ot}:{}}))}}}oe.current(hc.RESOURCE_OPERATION_EXECUTED,{resourceType:t,operationIdentifier:String(e.operationIdentifier),operation:e,variantType:e.variantType,isOperationDefault:e.isOperationDefault??!0,isBulkOperation:e.isBulkOperation??!1,variantKey:e.variantKey,contextResourceIdentifiers:r,parentResourcesRequirements:Ae,resultSummary:a,...ot?{optionalDiscriminator:ot}:{}}),b?.(e)};if(c&&typeof c==`object`){let t=sC(e.responseDto,c);if(t.length>0){xe(t),Se.current=d;return}}d()}catch(n){console.error(`[useResourceOperationActions] Operation ${String(e.operationIdentifier)} failed:`,n);let r=n&&typeof n==`object`?n:{};oe.current(hc.NOTIFY_RESOURCE_ERROR,{resourceType:t,operationIdentifier:String(e.operationIdentifier),operation:e,variantType:e.variantType,isOperationDefault:e.isOperationDefault??!0,isBulkOperation:e.isBulkOperation??!1,variantKey:e.variantKey,contextResourceIdentifiers:ju(Ne),parentResourcesRequirements:Ae,additionalContext:{error:r.message??Ca(n),errorCustomMessageReference:r.customMessageReference,errorHttpStatus:r.httpStatus,errorRefusalCode:cz(n).errorRefusalCode,...lz(n)}})}finally{de(!1),fe.current.delete(n),ge(new Set(fe.current))}}},[Ce,t,C,rt,Ne,Ae,h,ot,b]),Ct=(0,Q.useCallback)(e=>{if(Va(e)){let t=JV(e),n=t?M(t):[];n.length>0&&xt(e,n[0]);return}let n=String(e.operationIdentifier),r=e.riskLevel,i=Nc(e);if(i===rc.INLINE&&F.isAvailable){let n=gn.getResourceId(Ne[t]);if(n){F.open({kind:Qx.ELEMENT,elementId:n,operation:e,resourceContext:yt(e)});return}}if(i===rc.POPOVER||i===rc.DROPDOWN)ve(gl.createOperationPathKeyFromOperation(e));else if(zt(i)||i===rc.INLINE)bt(e);else if(qo(r)){let t=n===W.DELETE?jp({tComponent:O,componentType:J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`confirmDelete`}):ct(e),i=r===ls.CRITICAL,a=e.isBulkOperation===!0?ft():0,o=[a>0?jp({tComponent:O,componentType:J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`confirmAppliesToSelection`,params:{count:a}}):void 0,Ri(e)?jp({tComponent:O,componentType:J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`confirmCannotBeUndone`}):void 0].filter(e=>!!e);le({open:!0,label:t,requiresTypedConfirmation:i,confirmationPhrase:i?ct(e):``,description:o.length>0?o.join(` `):null,confirmLabel:ct(e),callback:()=>St(e)})}else St(e)},[bt,St,O,ct,d,h]),wt=(0,Q.useCallback)(e=>{let t=Nc(e);t===rc.POPOVER||t===rc.DROPDOWN?bt(e):Ct(e)},[bt,Ct]),Tt=(0,Q.useCallback)(async()=>{ce.callback&&await ce.callback(),le({open:!1,label:``,requiresTypedConfirmation:!1,confirmationPhrase:``,description:null,confirmLabel:``,callback:null})},[ce.callback]),Et=(0,Q.useCallback)(()=>{le({open:!1,label:``,requiresTypedConfirmation:!1,confirmationPhrase:``,description:null,confirmLabel:``,callback:null})},[]),Dt=(0,Q.useCallback)(()=>{xe(null);let e=Se.current;Se.current=null,e?.()},[]),Ot=(0,Q.useCallback)(e=>{let n=Nc(e);if(!(n===rc.POPOVER||n===rc.DROPDOWN||n===rc.INLINE&&!F.isAvailable)||!Ce)return;let r=gl.createOperationPathKeyFromOperation(e),i=()=>ve(null),a=k(t,$a(e.operationIdentifier,Ce.operations),`title`);if(n===rc.DROPDOWN){let t=Ns(e),n=e.isBulkOperation===!0||!t?void 0:S.current?.[t.rowFieldName];return{open:_e===r,onOpenChange:e=>ve(e?r:null),title:a,chrome:cC.LIST,content:Q.createElement(LV,{resourceContext:yt(e),navigationZone:s,onDismiss:i,...typeof n==`string`?{currentValue:n}:{}})}}return{open:_e===r,onOpenChange:e=>ve(e?r:null),title:a,content:Q.createElement(xV,{resourceContext:yt(e),navigationZone:s,onDismiss:i})}},[Ce,t,k,_e,yt,s,F.isAvailable]);return{items:(0,Q.useMemo)(()=>{if(!Ce)return[];let e=Ce.operations||[],t=new Map;for(let e of tt.filter(st)){let n=String(e.operationIdentifier);t.has(n)||t.set(n,[]),t.get(n).push(e)}let r=[];for(let[e,n]of t){let e=n.filter(e=>_t(e).isEnabled),t=Ge.organizationRoles.length>0?e.filter(e=>e.admitsCrossTenantPlatformAdministration!==!0):[],i=Pc(t.length>0?t:e.length>0?e:n),a=i.find(e=>e.isOperationDefault===!0&&e.isBulkOperation!==!0)||i.find(e=>e.isOperationDefault===!0)||i[0],o=_t(a),s=a.operationFrontendConfig?.actionVisibility,c=!(!o.featureAvailability||o.featureAvailability.isAvailable);if((s??(Te.disabledActionHandling===_o.HIDE&&!c?oo.WHEN_AVAILABLE:oo.ALWAYS))===oo.WHEN_AVAILABLE&&!o.isEnabled||!o.isEnabled&&a.isBulkOperation===!0&&d?.length&&(o.ineligibleSelectionIndices?.length??0)>=d.length)continue;let l=new Map(i.map(e=>[e,_t(e)])),u=a.riskLevel,f=a.operationFrontendConfig?.actionVariant??QV(u),p=lt(a),h=ct(a),g=ut(a),_=a.operationFrontendConfig?.actionPlacement??(qo(u)&&Ri(a)?Ks.DANGER_ZONE:Ks.PRIMARY);if(m&&_!==m)continue;let v=!o.isEnabled||ht(a);if(v&&o.featureAvailability&&!o.featureAvailability.isAvailable){let e=o.featureAvailability;switch(e.behavior){case co.HIDE:continue;case co.DISABLE:break;case co.UPGRADE_PROMPT:case co.ADDON_PROMPT:case co.LIMIT_UPGRADE_PROMPT:case co.CONTACT_ADMIN:case co.CUSTOM:i.length===1?r.push({type:`button`,icon:p,label:h,variant:f,onClick:()=>Ct(a),disabled:!0,featureLocked:!0,featureAvailability:UV(e),_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)}):r.push({type:`subgroup`,icon:p,label:h,variant:f,items:[],disabled:!0,featureLocked:!0,featureAvailability:UV(e),_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)});continue}}let y=Va(a)?JV(a):void 0;if(y){let e=M(y);e.length===1?r.push({type:`button`,icon:p,label:h,variant:f,onClick:()=>{xt(a,e[0])},disabled:v,_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)}):e.length>1&&r.push({type:`subgroup`,icon:p,label:h,variant:f,items:e.map(e=>({type:`button`,icon:p,label:XV(e),variant:f,riskLevel:u,operationIdentifier:String(a.operationIdentifier),onClick:()=>{xt(a,e)},disabled:v})),disabled:v,_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)})}else if(i.length===1){let e=Ot(a);r.push({type:`button`,icon:p,label:h,variant:f,onClick:e?()=>bt(a):()=>Ct(a),...e?{popover:e}:{},disabled:v,...v?$V(gt(a,o)):{},...dt(a)?{busy:!0}:{},_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)})}else{let e=i.filter(e=>e!==a).flatMap(e=>{let t=l.get(e);if(t.featureAvailability&&!t.featureAvailability.isAvailable&&t.featureAvailability.behavior===co.HIDE)return[];let n=e.variantKey,r=n?`${h} (${n})`:h,i=e.riskLevel;return[{type:`button`,icon:lt(e),label:r,variant:QV(i),riskLevel:i,operationIdentifier:String(e.operationIdentifier),onClick:()=>wt(e),disabled:!t.isEnabled||ht(e),...!t.isEnabled||ht(e)?$V(gt(e,t)):{},...t.featureAvailability&&!t.featureAvailability.isAvailable?{featureLocked:!0,featureAvailability:UV(t.featureAvailability)}:{}}]}),t=!o.isEnabled&&e.every(e=>e.disabled===!0);if(e.length===0){let e=Ot(a);r.push({type:`button`,icon:p,label:h,variant:f,onClick:e?()=>bt(a):()=>Ct(a),...e?{popover:e}:{},disabled:v,...v?$V(gt(a,o)):{},...dt(a)?{busy:!0}:{},_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier),...o.featureAvailability&&!o.featureAvailability.isAvailable?{featureLocked:!0,featureAvailability:UV(o.featureAvailability)}:{}});continue}r.push({type:`subgroup`,icon:p,label:h,variant:f,items:e,disabled:t,_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)})}}if(n===Ac.SUMMARY&&m!==Ks.DANGER_ZONE&&!y){let t=Ce?Th({resourceConfig:Ce,operations:e,coreOperation:W.READ,registry:C,hasResourceId:it,requireFrontendAddressable:!0,contextResourceIdentifiers:Ne,contextualParameters:rt}):void 0;if(t){let e=jp({tComponent:O,componentType:J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`viewDetails`});r.push({type:`button`,icon:P(H.EYE,{size:fa.SM}),label:e,variant:Y.GHOST,onClick:()=>bt(t),disabled:!1,_priority:qV,_group:Ks.PRIMARY})}}let i=e=>+(e===Ks.DANGER_ZONE);r.sort((e,t)=>i(e._group)-i(t._group)||e._priority-t._priority);let a=[],o;for(let{_priority:e,_group:t,...n}of r)t===Ks.DANGER_ZONE&&o===Ks.PRIMARY&&a.push({type:`separator`}),a.push(n),o=t;return a},[Ce,Ne,rt,it,Ge,st,C,t,tt,nt,n,Te,y,lt,ct,ut,vt,_t,gt,ht,dt,Ct,wt,bt,Ot,xt,O,P,d]),isConfirmDialogOpen:ce.open,confirmDialogLabel:ce.label,confirmDialogDescription:ce.description,confirmDialogConfirmLabel:ce.confirmLabel,confirmRequiresTypedConfirmation:ce.requiresTypedConfirmation,confirmConfirmationPhrase:ce.confirmationPhrase,onConfirm:Tt,onCancel:Et,isExecuting:ue,acceptedBackgroundRun:pe,ephemeralFields:ye,onEphemeralAcknowledge:Dt}}function iH(e={}){let{idField:t=`id`}=e,[n,r]=(0,Q.useState)(new Map),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),c=(0,Q.useCallback)(e=>String(e[t]??e._id??``),[t]),l=(0,Q.useCallback)(e=>{let t=typeof e==`string`?e:c(e);return n.has(t)},[n,c]),u=(0,Q.useCallback)(e=>{let t=c(e);a(null),s(null),r(n=>{let r=new Map(n);return r.has(t)?r.delete(t):r.set(t,e),r})},[c]),d=(0,Q.useCallback)(e=>{let t=c(e);a(null),s(null),r(n=>{if(n.has(t))return n;let r=new Map(n);return r.set(t,e),r})},[c]),f=(0,Q.useCallback)(e=>{let t=c(e);a(null),s(null),r(e=>{if(!e.has(t))return e;let n=new Map(e);return n.delete(t),n})},[c]),p=(0,Q.useCallback)(e=>{a(null),s(null);let t=new Map;for(let n of e)t.set(c(n),n);r(t)},[c]),m=(0,Q.useCallback)(()=>{r(new Map),a(null),s(null)},[]),h=(0,Q.useCallback)(e=>{r(new Map),s(null),a(e)},[]),g=(0,Q.useCallback)(e=>{r(new Map),a(null),s(e.length>0?[...e]:null)},[]),_=(0,Q.useMemo)(()=>Array.from(n.values()),[n]),v=(0,Q.useMemo)(()=>new Set(n.keys()),[n]),y=i?i.matchedCount:o?.length??n.size;return{selectedItems:_,selectedIds:v,isSelected:l,toggleSelection:u,selectItem:d,deselectItem:f,selectAll:p,clearSelection:m,matchAllSelection:i,selectAllMatching:h,explicitIdSelection:o,selectIds:g,selectionCount:y,hasSelection:y>0}}function aH(e){let{registry:t,resourceConfig:n,operation:r,resourceType:i,fieldName:a,recordId:o,contextResourceIdentifiers:s,contextualParameters:c,parentResourcesRequirements:l,apiBaseUrl:u}=e;if(!n?.resourceFieldIdentifier||!o||!r)return null;try{let e=It.buildOperationFrontendRoutePaths(n,r,t.allResourceFieldIdentifiers);if(e.length===0)return null;let d=gn.selectMatchingRoutePath(e,s,n.resourceIdentifier,n.resourceFieldIdentifier,l,t.allResourceFieldIdentifiers),f={...c,[n.resourceFieldIdentifier]:o},p=It.buildFileUploadRouteForOperation({operationRouteUrl:d.url,operationParameters:d.parameters,targetResourceType:i,targetResourceFieldIdentifier:n.resourceFieldIdentifier,fieldName:a,requiresTargetResourceId:!0,isFrontend:!0}),m=Ch.resolveUrlPath(p.url,f);return Ch.hasUnresolvedPlaceholders(m)?null:`${u}${rt}${m}`}catch{return null}}function oH(e,t){return t===nd.ORIGINAL?e:`${e}${e.includes(`?`)?`&`:`?`}variant=${encodeURIComponent(t)}`}function sH(e){return oH(e,nd.THUMBNAIL)}function cH(e,t){let n=e.VITE_API_BASE_URL;return n?{...e,VITE_API_BASE_URL:ct(n,t)}:e}function lH(e){return Q.createElement(Bh,{flushSync:AN.flushSync,...e})}Eg();var uH=`wildo:reauthentication`,dH=`wildo:reauthentication-callback`,fH;(function(e){e.POPUP_BLOCKED=`popup_blocked`,e.CANCELLED=`cancelled`,e.TIMED_OUT=`timed_out`,e.FAILED=`failed`})(fH||={});var pH=class extends Error{reason;constructor(e){super(`Federated re-authentication did not complete: ${e}`),this.reason=e,this.name=`FederatedReAuthenticationFailure`}},mH=6e5,hH=`wildo-reauthentication`,gH=`popup=yes,width=520,height=680`;function _H(){return window.open(`about:blank`,hH,gH)}function vH(e){let t=new BroadcastChannel(uH);t.postMessage({type:dH,...e}),t.close()}function yH(e,t=mH){return new Promise((n,r)=>{let i=new BroadcastChannel(uH),a=!1,o=t=>{a||(a=!0,i.close(),clearTimeout(l),e?.removeEventListener(`abort`,c),t())},s=()=>o(()=>r(new pH(fH.CANCELLED))),c=()=>s();i.onmessage=e=>{let t=e.data;t&&t.type===`wildo:reauthentication-callback`&&o(()=>typeof t.code==`string`&&t.code?n(t.code):r(new pH(fH.FAILED)))};let l=setTimeout(()=>o(()=>r(new pH(fH.TIMED_OUT))),t);e?.aborted?s():e?.addEventListener(`abort`,c)})}async function bH(e,t,n,r){if(!n)throw new pH(fH.POPUP_BLOCKED);let i=lc();try{let{authorizationUrl:a}=await i.startFederatedReAuthentication(e,t);n.location.href=a;let o=await yH(r);return await i.exchangeFederatedReAuthentication(o)}catch(e){try{n.close()}catch{}throw e instanceof pH?e:new pH(fH.FAILED)}}var xH=[Al.PASSKEY,Al.TOTP,Al.PASSWORD],SH={[fH.POPUP_BLOCKED]:Ul.REAUTH_PROVIDER_POPUP_BLOCKED,[fH.CANCELLED]:Ul.REAUTH_PROVIDER_FAILED,[fH.TIMED_OUT]:Ul.REAUTH_PROVIDER_TIMED_OUT,[fH.FAILED]:Ul.REAUTH_PROVIDER_FAILED},CH={[Al.PASSKEY]:Ul.REAUTH_WITH_PASSKEY,[Al.TOTP]:Ul.REAUTH_WITH_TOTP,[Al.PASSWORD]:Ul.REAUTH_WITH_PASSWORD};async function wH(e){try{let{methods:t,identityLinks:n}=await lc().getReAuthenticationMethods(e),r=new Set(t);return{methods:xH.filter(e=>r.has(e)),identityLinks:n??[]}}catch{return{methods:[...xH],identityLinks:[]}}}function TH(e,t){switch(e){case Al.PASSWORD:return t.password.trim()?{method:e,password:t.password}:null;case Al.TOTP:return/^\d{6,8}$/.test(t.code.trim())?{method:e,code:t.code.trim()}:null;case Al.PASSKEY:return{method:e};default:return null}}function EH(e,t){let n=t.origin===qi.GRANTING_ORGANIZATION,r=t.decisionRequirement?.minimumAssurance;return{methods:e.methods.filter(e=>!n||e!==Al.PASSWORD).filter(e=>{if(r===void 0)return!0;let t=ste(e);return t!==void 0&&en(t,r)}),identityLinks:n||t.decisionRequirement?[]:[...e.identityLinks]}}var DH=({open:e,purpose:t,origin:n=qi.ACCOUNT_OR_OPERATION,decisionRequirement:r,onConfirm:i,onCancel:a,failure:o,isLoading:s})=>{let c=bp(),{tComponent:l,isReady:u}=K({component:J.APP_LAYOUTS_SECURITY_SETTINGS}),d=(0,Q.useCallback)(e=>l(J.APP_LAYOUTS_SECURITY_SETTINGS,e),[l]),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)([]),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),b=(0,Q.useRef)(!1),[x,S]=(0,Q.useState)(``),[C,w]=(0,Q.useState)(``),T=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{if(!e)return;S(``),w(``),T.current=!1,b.current=!1,p(null),h([]),_(null),y(null);let i=!1;return wH(t).then(e=>{if(i)return;let{methods:t,identityLinks:a}=EH(e,{origin:n,...r?{decisionRequirement:r}:{}});p(t),h(a),_(t[0]??null),y(t.length===0?a[0]??null:null)}),()=>{i=!0}},[e,t,n,r]),(0,Q.useEffect)(()=>{s||(T.current=!1,b.current=!1)},[s]);let E=(0,Q.useCallback)(()=>TH(g,{password:x,code:C}),[g,x,C]),D=f?.length===0&&m.length===0,O=(0,Q.useCallback)(()=>{if(D){a();return}if(v){if(T.current)return;T.current=!0,b.current=!0,i({method:v.method,identityLinkId:v.identityLinkId,popup:_H()});return}let e=E();e&&!T.current&&(T.current=!0,i(e))},[D,v,E,a,i]),k=(0,Q.useCallback)(()=>{(!T.current||b.current)&&(S(``),w(``),a())},[a]),A=(0,Q.useCallback)(e=>{!e&&!T.current&&k()},[k]),j=e=>{e.key===`Enter`&&O()};return u?(0,$.jsx)(Jw,{open:e,onOpenChange:A,cancelCallback:k,validationCallback:O,label:d(Ul.REAUTH_TITLE),children:(0,$.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,$.jsx)(Z,{className:`text-sm`,children:d(n===qi.GRANTING_ORGANIZATION?Ul.REAUTH_GRANTING_ORGANIZATION_DESCRIPTION:Ul.REAUTH_DESCRIPTION)}),o!==null&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:o instanceof pH?d(SH[o.reason]):c(o,d(Ul.ERROR))})}),D&&(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:d(Ul.REAUTH_NO_ACCEPTED_METHOD)})}),f&&f.length+m.length>1&&(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":d(Ul.REAUTH_TITLE),children:[f.map(e=>(0,$.jsx)(X,{type:`button`,size:Xd.SM,variant:e===g?Y.DEFAULT:Y.OUTLINE,"aria-pressed":e===g,disabled:s,onClick:()=>{_(e),y(null)},children:d(CH[e])},e)),m.map(e=>(0,$.jsx)(X,{type:`button`,size:Xd.SM,variant:e.identityLinkId===v?.identityLinkId?Y.DEFAULT:Y.OUTLINE,"aria-pressed":e.identityLinkId===v?.identityLinkId,disabled:s,onClick:()=>{y(e),_(null)},children:l(J.APP_LAYOUTS_SECURITY_SETTINGS,Ul.REAUTH_WITH_PROVIDER,{provider:e.displayName})},e.identityLinkId))]}),v&&(0,$.jsx)(Z,{className:`text-sm`,children:l(J.APP_LAYOUTS_SECURITY_SETTINGS,Ul.REAUTH_PROVIDER_PROMPT,{provider:v.displayName})}),g===Al.PASSWORD&&(0,$.jsxs)(wx,{children:[(0,$.jsx)(Tx,{children:d(Ul.REAUTH_PASSWORD)}),(0,$.jsx)(iN,{type:`password`,autoComplete:`current-password`,value:x,onChange:e=>S(e.target.value),placeholder:d(Ul.REAUTH_PASSWORD_PLACEHOLDER),disabled:s,onKeyDown:j})]}),g===Al.TOTP&&(0,$.jsxs)(wx,{children:[(0,$.jsx)(Tx,{children:d(Ul.REAUTH_TOTP_CODE)}),(0,$.jsx)(iN,{inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:8,value:C,onChange:e=>w(e.target.value.replace(/\D/g,``)),placeholder:d(Ul.REAUTH_TOTP_CODE_PLACEHOLDER),disabled:s,onKeyDown:j})]}),g===Al.PASSKEY&&(0,$.jsx)(Z,{className:`text-sm`,children:d(Ul.REAUTH_PASSKEY_PROMPT)})]})}):null},OH=(0,Q.createContext)(void 0),kH=({children:e})=>{let{setStepUpAuthHandler:t}=wm(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(zo.STEP_UP),[u,d]=(0,Q.useState)(qi.ACCOUNT_OR_OPERATION),[f,p]=(0,Q.useState)(void 0),m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(null),_=(0,Q.useRef)(null),v=(0,Q.useCallback)(async(e,t=qi.ACCOUNT_OR_OPERATION,n)=>n?(g.current&&await g.current.catch(()=>void 0),l(zo.STEP_UP),d(t),p(n),y()):g.current?(e===zo.STEP_UP&&l(zo.STEP_UP),t===qi.GRANTING_ORGANIZATION&&d(qi.GRANTING_ORGANIZATION),g.current):(l(e),d(t),p(void 0),y()),[]);function y(){let e=new Promise((e,t)=>{m.current=e,h.current=t,a(null),s(!1),r(!0)});return g.current=e,e.finally(()=>{g.current=null}).catch(()=>void 0),e}let b=(0,Q.useRef)(t);(0,Q.useEffect)(()=>{b.current=t},[t]),(0,Q.useEffect)(()=>(lc().setStepUpAuthHandler(v),b.current(v),()=>{lc().setStepUpAuthHandler(null),b.current(null),h.current?.(Error(`StepUpAuthProvider unmounted`)),m.current=null,h.current=null}),[v]);let x=(0,Q.useCallback)(async e=>{s(!0),a(null);let t=new AbortController;_.current=t;try{let{reAuthToken:n}=await AH(e,c,t.signal,f?.binding);r(!1),m.current?.(n),m.current=null,h.current=null}catch(e){t.signal.aborted||a(e)}finally{_.current===t&&(_.current=null),s(!1)}},[c,f]),S=(0,Q.useCallback)(()=>{_.current?.abort(),r(!1),h.current?.(Error(`Step-up authentication cancelled`)),m.current=null,h.current=null},[]),C=(0,Q.useMemo)(()=>({isStepUpPending:n}),[n]);return(0,$.jsxs)(OH.Provider,{value:C,children:[e,(0,$.jsx)(DH,{open:n,purpose:c,origin:u,...f?{decisionRequirement:f.requirement}:{},onConfirm:x,onCancel:S,failure:i,isLoading:o})]})};async function AH(e,t=zo.STEP_UP,n,r){let i=lc(),a=r?{decisionBinding:r}:{};switch(e.method){case Al.PASSWORD:return i.reAuthenticate(Al.PASSWORD,{password:e.password,...a},t);case Al.TOTP:return i.reAuthenticate(Al.TOTP,{code:e.code,...a},t);case Al.PASSKEY:{let e=await i.reAuthPasskeyOptions(void 0,r),n=await Wae({optionsJSON:e});return i.reAuthenticate(Al.PASSKEY,{passkeyResponse:n,...a},t)}case Al.EXTERNAL_OAUTH2:case Al.ORG_OPENID_CONNECT:case Al.ORG_SAML:return bH(e.identityLinkId,t,e.popup,n)}}var jH=Jo.getLogger();function MH(){let e=Xm(),{registry:t}=wm(),n=t.resourceConfigurations[Na.ORGANIZATIONS]?.resourceFieldIdentifier;return n?e[n]:void 0}function NH(){let e=MH(),{registry:t,doOperation:n}=wm(),{auth:r,user:i}=Cg(),a=lm(),o=(0,Q.useRef)(n);o.current=n;let s=t.resourceConfigurations[Na.ORGANIZATIONS],c=s?.resourceFieldIdentifier,l=a?.currentUserId??null,u=!!i&&(!l||i._id===l),d=!!r.accessToken&&r.sessionType!==Wo.ONE_OFF&&!r.isRestoringSession&&r.sessionRestored&&u,f=!!r.accessToken&&r.sessionType!==Wo.ONE_OFF&&u,p=!!e&&f&&Jh(i?.organizationMembers,e),m=e&&d&&!p?`${i?._id}:${e}`:null,[h,g]=(0,Q.useState)({}),_=m?h[m]:void 0;return(0,Q.useEffect)(()=>{if(!m||_||!e||!c)return;let t=e=>{g(t=>({...t,[m]:e}))},n=lh(s);if(!n){t(xg.INCONCLUSIVE);return}let r=!1;return o.current(gl.buildOperationPathKeyFromOperation(n),{contextualParameters:{[c]:e}},{silent:!0}).then(()=>{r||t(xg.ADMITTED)}).catch(n=>{if(r)return;let i=st.isAuthorizationError(n)||st.isNotFoundError(n);i||jH.warn(`Could not verify access to the organization addressed by the route`,{organizationId:e,error:n}),t(i?xg.REFUSED:xg.INCONCLUSIVE)}),()=>{r=!0}},[m,_,e,c,s]),e?p?xg.ACTIVE_MEMBERSHIP:d?_??xg.VERIFYING:xg.UNDECIDABLE:xg.NOT_ADDRESSED}var PH=(0,Q.createContext)(null);function FH(e){let t=MH(),n=lm(),{user:r,organizations:i,permissions:a,followRouteOrganization:o}=Cg(),{emit:s}=vo(),c=n?.currentOrganizationId,l=t&&r?._id?`${r._id}:${t}`:null,[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(null),m=l!==null&&f===l;u!==l&&(d(l),p(null),m=!1),l&&!m&&c===t&&(p(l),m=!0);let h=Uoe({routeOrganizationId:t,access:e,routeOrganizationLoaded:!!t&&i.some(e=>e._id===t),routeOrganizationConferred:Voe(a?.accessProfile,t),currentOrganizationId:c,arrivalSettled:m});return(0,Q.useEffect)(()=>{h===yh.FOLLOWING&&t&&l&&(p(l),o(t)&&s(hc.NAVIGATION_ORGANIZATION_FOLLOWED,{organizationId:t}))},[h,t,l,o,s]),h}function IH(){let e=(0,Q.useContext)(__),t=e&&!e.shellIdentity?e.organizationProductName:void 0;(0,Q.useEffect)(()=>{if(!t)return;let e=document.title;return document.title=t,()=>{document.title=e}},[t])}function LH({preset:e=q.DEFAULT,...t}){IH();let n=G(J.APP_LAYOUTS_MAIN_CONTAINER,`AppLayout_MainContainer`)(e);return(0,$.jsx)(n,{...t})}var RH=Jo.getLogger();function zH(){let{appConfig:e}=_u(),{privacy:t,recordConsentDecision:n,logout:r}=Cg(),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)([]),u=(0,Q.useMemo)(()=>dx({serviceConsentRequirement:e.compliance?.serviceConsentRequirement,analyticsEnabled:e.analytics?.enabled===!0,analyticsRequiresConsent:e.analytics?.requiresConsent!==!1,capabilityDeclaredConsentPurposes:e.compliance?.capabilityDeclaredConsentPurposes,privacy:t}),[e.analytics?.enabled,e.analytics?.requiresConsent,e.compliance?.serviceConsentRequirement,e.compliance?.capabilityDeclaredConsentPurposes,t]),d=(0,Q.useCallback)(async(e,t,r=!1)=>{s(!1);let i=px(u,e,t);if(i.length>0&&!r)l(i);else{l([]),a(!0);try{await n(fx(u.grantedPurposes,e,t))}catch(e){RH.error(`Consent decision could not be recorded`,{error:e}),s(!0)}finally{a(!1)}}},[n,u]);return{...u,isSaving:i,saveFailed:o,pendingWithdrawalCost:c,decide:d,signOut:r}}function BH({preset:e=q.DEFAULT,children:t}){let n=zH();if(n.status===ux.NOT_APPLICABLE||n.status===ux.SATISFIED)return(0,$.jsx)($.Fragment,{children:t});let r=G(J.APP_LAYOUTS_CONSENT_GATE,`AppLayout_ConsentGate`)(e);return n.status===ux.REQUIRED?(0,$.jsx)(r,{gate:n}):(0,$.jsxs)($.Fragment,{children:[t,(0,$.jsx)(r,{gate:n})]})}var VH;(function(e){e.NOT_APPLICABLE=`NOT_APPLICABLE`,e.CHECKING=`CHECKING`,e.SATISFIED=`SATISFIED`,e.REQUIRED=`REQUIRED`,e.UNAVAILABLE=`UNAVAILABLE`})(VH||={});function HH(){let{appConfig:e}=_u(),{logout:t}=Cg(),{resolvedUserType:n}=dS(),r=e.compliance?.governedDocumentAcceptanceMode??Fa.EXPLICIT_CHECKBOX,i=Vn(e.compliance),a=n!==null&&(e.compliance?.governedDocumentReleases??[]).some(e=>e.allowedInteractionKinds.includes(Oo.CONTRACT_ACCEPTED)&&(!i||e.approvalState===ws.APPROVED)),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)([]),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{if(!a)return;let e=!1;return lc().getOwedGovernedDocumentAcceptances().then(t=>{e||s(t.owed)}).catch(()=>{e||l(!0)}),()=>{e=!0}},[a]);let b=(0,Q.useMemo)(()=>(o??[]).flatMap(e=>e.releases),[o]),x=(0,Q.useMemo)(()=>b.map(t=>({release:t,document:ml(e.compliance?.publicDocuments??[],t,{requireApproved:i})})),[b,e.compliance?.publicDocuments,i]),S=(0,Q.useMemo)(()=>e.compliance?.publicDocuments??[],[e.compliance?.publicDocuments]),C=(0,Q.useCallback)(e=>{p(t=>t.includes(e)?t:[...t,e])},[]),w=a?c?VH.UNAVAILABLE:o===void 0?VH.CHECKING:o.length===0?VH.SATISFIED:VH.REQUIRED:VH.NOT_APPLICABLE,T=r===Fa.IMPLIED_BY_REGISTERING||u,E=(0,Q.useCallback)(async()=>{if(T&&b.length!==0){h(!0),_(!1),y(!1);try{let e=await lc().acceptGovernedDocuments(b.map(e=>({releaseId:e.identity.releaseId,releaseVersion:e.identity.releaseVersion})));s(e.owed),d(!1),p([]),e.owed.length>0&&_(!0)}catch(e){if(Er(e)&&e.customMessageReference===ii.GOVERNED_DOCUMENT_RELEASE_SUPERSEDED)try{let e=await lc().getOwedGovernedDocumentAcceptances();s(e.owed),d(!1),p([]),y(!0)}catch{_(!0)}else _(!0)}finally{h(!1)}}},[T,b]),D=(0,Q.useMemo)(()=>({requiredReleases:b,acceptanceMode:r,requiredDocuments:x,servedDocuments:S,accepted:u,setAccepted:d,documentsRead:f,markDocumentRead:C}),[b,r,x,S,u,f,C]);return{status:w,reason:w===VH.REQUIRED?o?.[0]?.reason:void 0,acceptance:D,canAccept:T,isSaving:m,saveFailed:g,releaseSuperseded:v,accept:E,signOut:t}}function UH({preset:e=q.DEFAULT,children:t}){let n=HH();if(n.status!==VH.REQUIRED)return(0,$.jsx)($.Fragment,{children:t});let r=G(J.APP_LAYOUTS_DOCUMENT_ACCEPTANCE_GATE,`AppLayout_DocumentAcceptanceGate`)(e);return(0,$.jsx)(r,{gate:n})}var WH=()=>(0,$.jsx)(`div`,{className:`flex items-center justify-center w-full min-h-[200px]`,children:(0,$.jsx)(gb,{})}),GH=()=>{let e=vh(),{notifyWarning:t}=qm(),{tErrorMessage:n,tErrorGuidance:r}=K(),i=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{i.current||(i.current=!0,t(wp({type:ue.AUTHORIZATION,customMessageReference:ii.AUTHORIZATION_ORGANIZATION_NOT_ACCESSIBLE},{translators:{tErrorMessage:n,tErrorGuidance:r}})),e(Cn.home,{replace:!0}))},[e,t,n,r]),(0,$.jsx)(WH,{})},KH=({redirectTo:e=Cn.login})=>{let{auth:t}=Cg(),n=(0,Q.useContext)(Mi)?.shellCompanions??[],r=lm(),i=wg(),a=NH(),o=FH(a),s=MH()??null,c=a===xg.VERIFYING||a===xg.REFUSED||o===yh.FOLLOWING,l=(0,Q.useMemo)(()=>({routeOrganizationId:s,routeContentHeld:c}),[s,c]),u=r?.currentOrganizationId,d=!!t.accessToken,f=cd(i),p=ai(e,f);if(!d)return(0,$.jsx)(og,{to:p,replace:!0});if(t.isRestoringSession||!t.sessionRestored&&!u)return(0,$.jsx)(LH,{children:(0,$.jsx)(WH,{})});let m=(0,$.jsx)($h,{});return a===xg.REFUSED?m=(0,$.jsx)(GH,{}):c&&(m=(0,$.jsx)(WH,{})),(0,$.jsx)(PH.Provider,{value:l,children:(0,$.jsx)(UH,{children:(0,$.jsxs)(BH,{children:[n.map((e,t)=>(0,$.jsx)(e,{},t)),(0,$.jsx)(LH,{children:m})]})})})},qH=new Set;function JH(e){let{resourceType:t,guidanceFlows:n,urlPatterns:r}=e;return n.map(e=>{let n=`${t}.${e.ref}`,i=YH(e,t,r),a=e.elements.map((e,t)=>XH(e,t)),o=a.filter(e=>e.type===rd.CHECKLIST_ITEM).map(e=>e.ref),s=0;for(let e of a)e.type===rd.CHECKLIST&&(s++,e.items=s===1?o:[]);return s>1&&o.length>0&&!qH.has(n)&&(qH.add(n),Jo.getLogger().warn(`compileResourceGuidance: flow "${n}" declares ${s} checklists and ${o.length} checklist item(s). The resource-level authoring surface cannot express which items belong to which checklist, so the first checklist owns them all and the others render empty. Declare one checklist per flow.`)),{ref:n,scope:e.scope??Xl.USER,renderMode:e.renderMode,trigger:i,audience:e.audience,priority:e.priority??100,elements:a}})}function YH(e,t,n){let r=e.trigger;switch(r.type){case`FIRST_VISIT`:{let r=n?.[e.bindToOperation];return{type:ye.ROUTE_MATCH,routePattern:r??`/${t.toLowerCase()}`}}case`MANUAL`:return{type:ye.MANUAL};case`DELAYED`:return{type:ye.DELAYED,delayMs:r.delayMs??1e3};case`EVENT`:{let n=r.eventName??`${t}:${e.bindToOperation}`;return{type:ye.EVENT,eventName:n}}default:return{type:ye.MANUAL}}}function XH(e,t){let n=e.targetSelector??(e.targetField?`[data-guidance-field="${e.targetField}"]`:void 0),r={ref:e.ref,type:e.type,order:t,...e.targetField?{targetField:e.targetField}:{}};switch(e.type){case rd.TOOLTIP:return{...r,type:rd.TOOLTIP,targetSelector:n??``,placement:ZH(e.placement)};case rd.TOUR:return{...r,type:rd.TOUR,steps:(e.steps??[]).map((e,t)=>({ref:e.ref,order:t,placement:ZH(e.placement)??it.BOTTOM,targetSelector:e.targetSelector??(e.targetField?`[data-guidance-field="${e.targetField}"]`:void 0),...e.targetField?{targetField:e.targetField}:{}}))};case rd.MODAL:return{...r,type:rd.MODAL,dismissible:!0,...e.actionRef?{ctaAction:e.actionRef}:{}};case rd.BANNER:return{...r,type:rd.BANNER,...e.actionRef?{actionRef:e.actionRef}:{}};case rd.ANNOUNCEMENT:return{...r,type:rd.ANNOUNCEMENT,...e.actionRef?{actionRef:e.actionRef}:{}};case rd.BADGE:return{...r,type:rd.BADGE,...n?{targetSelector:n}:{}};case rd.CARD:return{...r,type:rd.CARD,...e.actionRef?{actionRef:e.actionRef}:{}};case rd.SURVEY:return{...r,type:rd.SURVEY,questions:(e.questions??[]).map(e=>({id:e.id,type:e.type,required:e.required??!1,options:e.options?.map(e=>({ref:e.ref}))}))};case rd.CHECKLIST:return{...r,type:rd.CHECKLIST,items:[]};case rd.CHECKLIST_ITEM:return{...r,type:rd.CHECKLIST_ITEM,...e.actionRef?{actionRef:e.actionRef}:{}};default:return{...r,type:e.type}}}function ZH(e){if(!e)return;let t=e.toUpperCase();if(t in it)return it[t]}var QH={achievedMilestoneRefs:new Set,stagesReached:new Set};function $H(e,t,n){if(!e)return!0;let r=t.scopedState[n]??QH;if(e.roles&&e.roles.length>0&&!e.roles.some(e=>t.userRoles.includes(e)))return!1;if(e.requiredFeatures){let n=e.requiredFeatures,r=Array.isArray(n)?n:n.features??[],i=Array.isArray(n)?`OR`:n.mode??`OR`;if(r.length>0&&!(i===`OR`?r.some(e=>t.userFeatures.includes(e)):r.every(e=>t.userFeatures.includes(e)))||!Array.isArray(n)&&n.limitChecks?.length&&n.limitChecks.some(e=>{let n=t.featureLimits[e.featureId];return n===void 0||n===-1?!1:(t.currentUsage[e.featureId]??0)+(e.increment??1)>n}))return!1}if(e.excludeIfCompleted&&e.excludeIfCompleted.length>0&&e.excludeIfCompleted.some(e=>t.completedFlowRefs.has(e))||e.requireIfCompleted&&e.requireIfCompleted.length>0&&!e.requireIfCompleted.every(e=>t.completedFlowRefs.has(e))||e.requiredMilestones&&e.requiredMilestones.length>0&&!e.requiredMilestones.every(e=>r.achievedMilestoneRefs.has(e)))return!1;if(e.currentLifecycleStages&&e.currentLifecycleStages.length>0){let t=r.currentLifecycleStage;if(t===void 0||!e.currentLifecycleStages.includes(t))return!1}return!(e.lifecycleStagesReached&&e.lifecycleStagesReached.length>0&&!e.lifecycleStagesReached.some(e=>r.stagesReached.has(e))||e.requiredSurveyAnswers&&e.requiredSurveyAnswers.length>0&&!e.requiredSurveyAnswers.every(e=>{let n=t.recordedSurveyAnswer(e.flowRef,e.elementRef,e.questionId);return Array.isArray(n)?n.includes(String(e.equals)):n===e.equals})||e.createdAfter&&t.userCreatedAt&&t.userCreatedAt<e.createdAfter)}var eU=(0,Q.createContext)(null),tU=[],nU={},rU=[],iU={[Mc.USER]:null,[Mc.ORGANIZATION]:null},aU={scopedStates:iU,isMilestoneAchieved:()=>!1,getMilestoneAchievement:()=>void 0,getCategoryProgress:()=>void 0,totalPoints:0,milestoneDefinitions:rU,isLoading:!1},oU={currentStage:null,stageEnteredAt:null,isEnabled:!1,isLoading:!1,hasReachedStage:()=>!1,activationProgress:{criteriaMet:{},criteria:[],totalCriteria:0,metCriteria:0,isFullyActivated:!1}},sU={activeFlows:tU,flowStates:nU,activateFlow:()=>{},recordFlowPresented:()=>{},reportFlowNotPresentable:()=>{},completeElement:async()=>{},completeFlow:()=>{},dismissFlow:()=>{},skipFlow:()=>{},isFlowActive:()=>!1,isFlowCompleted:()=>!1,isFlowPersistable:()=>!1,isLoading:!1,progression:aU,lifecycle:oU};function cU(e,t,n){let r=e.resourceConfigurations[t];return r?r.operations.find(e=>e.operationIdentifier===n&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===Ya.API_CALL)??null:null}var lU;(function(e){e.LOADED=`loaded`,e.ABSENT=`absent`,e.UNAVAILABLE=`unavailable`})(lU||={});var uU=new Set;function dU(e,t){let n=`${e}:${t}`;uU.has(n)||(uU.add(n),Jo.getLogger().warn(`GuidanceContext: no default non-bulk API_CALL ${t} operation is registered for "${e}". Guidance for this scope cannot be persisted and every change will be local to the session. Register the operation, or stop declaring persistable flows for it.`))}function fU(e,t){return t?{...e,flows:{...e.flows,...t.flows}}:e}async function pU(e,t,n){let r=m[e],i=cU(n,r,W.READ);if(!i)return dU(r,W.READ),{outcome:lU.UNAVAILABLE};let a=gl.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{}},{silent:!0});return{outcome:lU.LOADED,state:e??{flows:{}}}}catch(e){return st.isNotFoundError(e)?{outcome:lU.ABSENT}:{outcome:lU.UNAVAILABLE}}}async function mU(e,t,n){let r=m[e],i=cU(n,r,W.CREATE);if(!i)return dU(r,W.CREATE),{outcome:lU.UNAVAILABLE};let a=gl.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{},requestData:{flows:{}}},{silent:!0});return{outcome:lU.LOADED,state:e??{flows:{}}}}catch{return pU(e,t,n)}}async function hU(e,t,n,r){let i=m[e],a=cU(r,i,W.UPDATE);if(!a){dU(i,W.UPDATE);return}let o=gl.buildOperationPathKeyFromOperation(a);try{await n(o,{contextualParameters:{},requestData:t})}catch{}}var gU;(function(e){e.WRITTEN=`written`,e.NOT_BOUND=`not_bound`,e.NO_OPERATION=`no_operation`,e.REFUSED=`refused`})(gU||={});async function _U(e,t,n,r){if(e.type!==rd.SURVEY)return gU.NOT_BOUND;let i=e,a=i.bindTo?.resourceType;if(!a)return gU.NOT_BOUND;let o={};for(let e of i.questions??[]){if(!e.bindToField)continue;let n=t?.[e.id];n!==void 0&&(o[e.bindToField]=n)}if(Object.keys(o).length===0)return gU.NOT_BOUND;let s=cU(r,a,W.UPDATE);if(!s)return Jo.getLogger().warn(`GuidanceContext: survey "${e.ref}" binds to "${a}", which registers no default non-bulk API_CALL UPDATE operation. Its answers cannot be written, so the survey will not complete. Register the operation, or remove the binding.`,{elementRef:e.ref,resourceType:a}),gU.NO_OPERATION;let c=gl.buildOperationPathKeyFromOperation(s);try{return await n(c,{contextualParameters:{},requestData:o}),gU.WRITTEN}catch(t){return Jo.getLogger().warn(`GuidanceContext: writing survey "${e.ref}" answers to "${a}" was refused. The survey has not been completed, so the person can retry.`,{elementRef:e.ref,resourceType:a,fields:Object.keys(o),error:String(t)}),gU.REFUSED}}async function vU(e,t,n){let r=Hre[e],i=cU(n,r,W.READ);if(!i)return{outcome:lU.UNAVAILABLE};let a=gl.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{}},{silent:!0});return{outcome:lU.LOADED,state:e??{milestonesAchieved:{},operationCounts:{},totalPoints:0,valueMomentsAchieved:{},categoriesProgress:{}}}}catch(e){return st.isNotFoundError(e)?{outcome:lU.ABSENT}:{outcome:lU.UNAVAILABLE}}}async function yU(e){if(!e)return[];try{return(await lc().getMilestoneDefinitions({silent:!0}))?.definitions??[]}catch{return[]}}var bU={[Qa.USER]:null,[Qa.ORGANIZATION]:null};async function xU(e,t,n){let r=ps[e],i=cU(n,r,W.READ);if(!i)return{outcome:lU.UNAVAILABLE};let a=gl.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{}},{silent:!0});return e?{outcome:lU.LOADED,state:e}:{outcome:lU.ABSENT}}catch(e){return st.isNotFoundError(e)?{outcome:lU.ABSENT}:{outcome:lU.UNAVAILABLE}}}function SU(e,t=new Set){let n=[...e].sort((e,n)=>{let r=+!!t.has(e.ref),i=+!!t.has(n.ref);return r===i?(e.priority??100)-(n.priority??100):r-i}),r=[],i=!1,a=!1;for(let e of n)switch(e.renderMode){case Uc.OVERLAY:i||=(r.push(e),!0);break;case Uc.CHECKLIST:a||=(r.push(e),!0);break;case Uc.INLINE:r.push(e)}return r}var CU=({children:e})=>{let t=(0,Q.useContext)(Mi),{on:n,emit:r}=vo(),i=Cg(),a=lm(),o=wm(),s=(0,Q.useContext)(Oh),c=(0,Q.useRef)(o);c.current=o;let l=(0,Q.useMemo)(()=>Jo.getLogger(),[]),u=(0,Q.useMemo)(()=>{let e=l.debugByType(`GuidanceContext`);return l.setDebugTypeLogging(`GuidanceContext`,!1),e},[l]),d=(0,Q.useMemo)(()=>{let e=[],n=t?.frontendConfiguration;n?.guidanceFlows&&e.push(...n.guidanceFlows);let r=[];if(o?.registry)for(let e of o.getAvailableResourceTypes()){let t=o.getResourceConfiguration(e)?.frontendConfiguration?.guidance;if(t&&Array.isArray(t)&&t.length>0){let n=JH({resourceType:e,guidanceFlows:t});r.push(...n)}}return[...e,...r]},[t?.frontendConfiguration,o]),f=(0,Q.useMemo)(()=>{let e=new Map;for(let t of d)e.set(t.ref,t);return e},[d]),p=(0,Q.useMemo)(()=>t?.frontendConfiguration?.onboardingViews??[],[t?.frontendConfiguration]),m=(0,Q.useMemo)(()=>{let e=new Map;for(let t of d)e.set(t.ref,{ref:t.ref,scope:t.scope??Xl.USER,elements:t.elements,renderMode:t.renderMode});for(let t of p)e.has(t.ref)||e.set(t.ref,{ref:t.ref,scope:Xl.USER,elements:t.elements,renderMode:void 0});return e},[d,p]),h=m.size>0,g=(0,Q.useMemo)(()=>{let e={};for(let t of m.values())e[t.ref]=t.scope;return e},[m]),[_,v]=(0,Q.useState)({}),y=(0,Q.useRef)({}),b=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(b.current=!0,()=>{b.current=!1}),[]);let x=(0,Q.useRef)(new Set),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(null),w=(0,Q.useRef)(0),[T,E]=(0,Q.useState)(new Set),[D,O]=(0,Q.useState)(!0),k=(0,Q.useRef)(!1),A=(0,Q.useRef)(new Map),j=(0,Q.useRef)(new Set),M=(0,Q.useCallback)(e=>(y.current=e,v(e),e),[]),N=(0,Q.useCallback)(e=>{let t=e(y.current);return M(t)},[M]),[P,F]=(0,Q.useState)({...iU}),[I,ee]=(0,Q.useState)(!0),L=(0,Q.useRef)(!1),[R,te]=(0,Q.useState)(rU),z=t?.appConfig?.lifecycle,B=!!z?.enabled,[ne,re]=(0,Q.useState)({...bU}),[ie,ae]=(0,Q.useState)(B),oe=(0,Q.useRef)(!1),se=(0,Q.useMemo)(()=>z?.activationCriteria,[z?.activationCriteria]),ce=i.user?._id??null,le=!!i.auth.accessToken,ue=!!t?.appConfig?.analytics?.enabled,de=s?.isLoading??!1,fe=le&&h&&!k.current,pe=le&&h?D||fe:!1;sh({identifier:Ko.PROGRESSION,isLoading:I}),sh({identifier:Ko.LIFECYCLE,isLoading:ie});let me=(0,Q.useMemo)(()=>{let e=[Xl.USER];return a?.currentOrganizationId&&e.push(Xl.ORGANIZATION),e},[a?.currentOrganizationId]);(0,Q.useEffect)(()=>{y.current=_},[_]);let he=(0,Q.useRef)(me);(0,Q.useEffect)(()=>{he.current!==me&&(k.current=!1,L.current=!1,oe.current=!1,j.current.clear(),x.current.clear(),S.current=!1,Ce.current.clear(),we.current.clear(),w.current+=1,he.current=me,le&&h&&O(!0),le&&ee(!0),le&&B&&ae(!0),N(e=>{if(!(Xl.ORGANIZATION in e))return e;let t={...e};return delete t[Xl.ORGANIZATION],t}),F(e=>({...e,[Mc.ORGANIZATION]:null})),re(e=>({...e,[Qa.ORGANIZATION]:null})),E(e=>{let t=new Set(e);for(let e of d)(e.scope??Xl.USER)===Xl.ORGANIZATION&&t.delete(e.ref);return t}))},[me,d,h,le,B,N]);let ge=(0,Q.useRef)({isAuthenticated:le,userId:ce});(0,Q.useEffect)(()=>{let e=ge.current,t=e.isAuthenticated&&!le,n=e.userId!==null&&ce!==null&&e.userId!==ce;if(ge.current={isAuthenticated:le,userId:ce},t||n){for(let e of A.current.values())clearTimeout(e);A.current.clear(),k.current=!1,L.current=!1,oe.current=!1,j.current.clear(),x.current.clear(),S.current=!1,Ce.current.clear(),we.current.clear(),w.current+=1,M({}),E(new Set),F({...iU}),te(rU),re({...bU}),O(le&&h),ee(le),ae(le&&B)}},[M,ce,h,le,B]);let _e=(0,Q.useMemo)(()=>{let e={};for(let t of me){let n=_[t];n?.flows&&Object.assign(e,n.flows)}return e},[_,me]),ve=(0,Q.useMemo)(()=>{let e=new Set;for(let[t,n]of Object.entries(_e))n.status===go.COMPLETED&&e.add(t);let t=Xh(i.permissions,a?.currentOrganizationId).filter(Boolean),n=s?.resolvedFeatures?.features??[],r=s?.resolvedFeatures?.limits??{},o=s?.resolvedFeatures?.currentUsage??{},c={};for(let e of[Xl.USER,Xl.ORGANIZATION]){let t=P[Nee[e]],n=ne[za[e]];(t||n)&&(c[e]={achievedMilestoneRefs:new Set(Object.keys(t?.milestonesAchieved??{})),currentLifecycleStage:n?.currentStage,stagesReached:new Set(n?.stagesVisited??[])})}return{userRoles:t,userFeatures:n,featureLimits:r,currentUsage:o,completedFlowRefs:e,userCreatedAt:i.user?.createdAt?new Date(i.user.createdAt):void 0,scopedState:c,recordedSurveyAnswer:(e,t,n)=>_e[e]?.elements?.[t]?.surveyAnswers?.[n]}},[_e,P,ne,i.permissions,a?.currentOrganizationId,i.user?.createdAt,s?.resolvedFeatures?.features,s?.resolvedFeatures?.limits,s?.resolvedFeatures?.currentUsage]);(0,Q.useEffect)(()=>{if(k.current||!h||!le)return;k.current=!0;let e=Symbol(`guidance-init`);C.current=e,S.current=!0;let t=!1,n=!1;return(async()=>{let e=c.current;u(`Initializing guidance state`,{scopes:me,flowCount:m.size});let r=await Promise.allSettled(me.map(async t=>{let n=await pU(t,e.doOperation,e.registry);return n.outcome===lU.ABSENT&&(u(`Auto-creating guidance state for scope ${t}`),n=await mU(t,e.doOperation,e.registry)),{scope:t,read:n}}));if(t)return;let i={};for(let e of r){if(e.status!==`fulfilled`)continue;let{scope:t,read:n}=e.value;n.outcome===lU.LOADED?(x.current.add(t),i[t]=n.state):u(`Guidance state unavailable for scope ${t} — writes suppressed for this scope`)}N(e=>{let t={...e};for(let[n,r]of Object.entries(i))t[n]=fU(r,e[n]);return t}),n=!0,O(!1),u(`Guidance state loaded`,{scopeCount:Object.keys(i).length})})().catch(e=>{Jo.getLogger().warn(`GuidanceContext: guidance initialization failed`,{error:e}),k.current=!1,O(!1)}).finally(()=>{C.current===e&&(S.current=!1)}),()=>{t=!0,n||(k.current=!1),C.current===e&&(S.current=!1)}},[h,me,le,u,N]);let be=(0,Q.useMemo)(()=>{let e=[Mc.USER];return a?.currentOrganizationId&&e.push(Mc.ORGANIZATION),e},[a?.currentOrganizationId]);(0,Q.useEffect)(()=>{if(L.current||!le)return;L.current=!0;let e=!1,t=!1;return(async()=>{let n=c.current;u(`Initializing progression state`,{scopes:be});let[r,i]=await Promise.all([Promise.allSettled(be.map(async e=>({scope:e,read:await vU(e,n.doOperation,n.registry)}))),yU(ue&&n.hasResource(Na.USER_PROGRESSION_STATE))]);if(e)return;let a={...iU};for(let e of r){if(e.status!==`fulfilled`)continue;let{scope:t,read:n}=e.value;n.outcome===lU.LOADED?a[t]=n.state:u(`Progression state unavailable for scope ${t} — showing nothing rather than zeroes`)}F(e=>({...e,...a})),i.length>0&&te(i),t=!0,ee(!1),u(`Progression state loaded`,{scopeCount:Object.values(a).filter(Boolean).length,milestoneDefinitionCount:i.length})})().catch(e=>{Jo.getLogger().warn(`GuidanceContext: progression initialization failed`,{error:e}),L.current=!1,ee(!1)}),()=>{e=!0,t||(L.current=!1)}},[ue,be,le,u]);let xe=(0,Q.useMemo)(()=>{if(!B)return[];let e=[Qa.USER];return a?.currentOrganizationId&&e.push(Qa.ORGANIZATION),e},[B,a?.currentOrganizationId]);(0,Q.useEffect)(()=>{if(oe.current||!le||!B)return;oe.current=!0;let e=!1,t=!1;return(async()=>{let n=c.current;ae(!0),u(`Initializing lifecycle state`,{scopes:xe});let r=await Promise.allSettled(xe.map(async e=>({scope:e,read:await xU(e,n.doOperation,n.registry)})));if(e)return;let i={...bU};for(let e of r){if(e.status!==`fulfilled`)continue;let{scope:t,read:n}=e.value;n.outcome===lU.LOADED?i[t]=n.state:n.outcome===lU.ABSENT&&(i[t]=ba.createInitialLifecycleState())}re(e=>({...e,...i})),t=!0,ae(!1),u(`Lifecycle state loaded`,{scopeCount:Object.values(i).filter(Boolean).length})})().catch(e=>{Jo.getLogger().warn(`GuidanceContext: lifecycle initialization failed`,{error:e}),oe.current=!1,ae(!1)}),()=>{e=!0,t||(oe.current=!1)}},[xe,le,B,u]);let Se=(0,Q.useCallback)((e,t=y.current)=>{let n=[Xl.USER,Xl.ORGANIZATION].filter(n=>t[n]?.flows?.[e]!==void 0);return n.find(n=>t[n]?.flows?.[e]?.status===go.IN_PROGRESS)??n[0]??g[e]??Xl.USER},[g]),Ce=(0,Q.useRef)(new Set),we=(0,Q.useRef)(new Set),Te=(0,Q.useRef)(new Set),Ee=(0,Q.useCallback)(async e=>{if(Te.current.has(e))return;Te.current.add(e);let t=w.current;try{let n=c.current,r=await vU(e,n.doOperation,n.registry);if(r.outcome!==lU.LOADED||!b.current||w.current!==t)return;F(t=>({...t,[e]:r.state})),u(`Progression state for scope ${e} recovered after a failed read`)}finally{Te.current.delete(e)}},[u]),De=(0,Q.useCallback)(async e=>{if(x.current.has(e)||S.current||we.current.has(e))return;we.current.add(e);let t=w.current;try{let n=c.current,r=await pU(e,n.doOperation,n.registry);if(r.outcome===lU.ABSENT&&(r=await mU(e,n.doOperation,n.registry)),r.outcome!==lU.LOADED||!b.current||w.current!==t)return;x.current.add(e),Jo.getLogger().info(`GuidanceContext: guidance state for scope "${e}" recovered — persistence resumes for this scope.`),Ce.current.delete(e),N(t=>({...t,[e]:fU(r.state,t[e])}))}finally{we.current.delete(e)}},[N]),Oe=(0,Q.useCallback)((e,t,n)=>{let r=y.current,i=n?.scopeOverride??Se(e,r),a=x.current.has(i),s=r[i]??{flows:{}},c=t(s.flows[e]??{status:go.NOT_STARTED,elements:{},triggerCount:0}),l={...s,flows:{...s.flows,[e]:c}};M({...r,[i]:l}),a?hU(i,l,o.doOperation,o.registry):(Ce.current.has(i)||(Ce.current.add(i),Jo.getLogger().warn(`GuidanceContext: guidance persistence is SUPPRESSED for scope "${i}" — its stored document was never read this session, so writing would replace the server's history with this session's single entry. Changes apply locally and are retried on the next interaction.`)),De(i))},[M,Se,o,De]),ke=(0,Q.useCallback)(e=>{let t=f.get(e);if(!t)return;let n=g[e]??Xl.USER;if(!me.includes(n))return;if(de&&t.audience?.requiredFeatures){j.current.add(e);return}let r=_e[e];ze(r?.status)||r?.status===go.IN_PROGRESS&&T.has(e)||$H(t.audience,ve,t.scope??Xl.USER)&&(u(`Activating flow: ${e}`),E(t=>{let n=new Set(t);return n.add(e),n}))},[f,_e,T,ve,g,me,u,de]),Ae=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{for(let e of Ae.current)T.has(e)||Ae.current.delete(e);let e=!1;for(let t of je.current)T.has(t)||(je.current.delete(t),e=!0);e&&Ne(new Set(je.current))},[T]);let je=(0,Q.useRef)(new Set),[Me,Ne]=(0,Q.useState)(new Set),Pe=(0,Q.useCallback)((e,t)=>{je.current.has(e)!==t&&(t?je.current.add(e):je.current.delete(e),Ne(new Set(je.current)))},[]),Fe=(0,Q.useCallback)(e=>{if(!T.has(e)||Ae.current.has(e))return;let t=f.get(e);t&&(Ae.current.add(e),Oe(e,e=>({...e,status:go.IN_PROGRESS,startedAt:e.startedAt??new Date,triggerCount:(e.triggerCount??0)+1})),r(hc.GUIDANCE_FLOW_ACTIVATED,{flowRef:e,renderMode:t.renderMode,triggerSource:`frontend`,scope:g[e]??Xl.USER}))},[T,f,g,Oe,r]);(0,Q.useEffect)(()=>{if(!(pe||de||d.length===0))for(let e of d){if(e.trigger.type!==ye.FIRST_VISIT)continue;let t=_e[e.ref];t&&t.triggerCount!==0||ke(e.ref)}},[pe,de,me]),(0,Q.useEffect)(()=>{if(de||j.current.size===0)return;let e=Array.from(j.current);j.current.clear();for(let t of e)ke(t)},[de,ke]);let Ie=(0,Q.useMemo)(()=>d.filter(e=>e.trigger.type===ye.ROUTE_MATCH&&e.trigger.routePattern).map(e=>{try{return{...e,_compiledPattern:new RegExp(e.trigger.routePattern)}}catch{return null}}).filter(e=>e!==null),[d]);(0,Q.useEffect)(()=>{if(!(pe||Ie.length===0))return n(hc.NAVIGATION_ZONE_CHANGED,e=>{let t=e.currentContent?.urlPath;if(t)for(let e of Ie)e._compiledPattern.test(t)&&ke(e.ref)})},[pe,Ie,n,ke]);let Le=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{if(pe||d.length===0)return;let e=d.filter(e=>e.trigger.type===ye.EVENT&&e.trigger.eventName);if(e.length!==0){for(let t of e){let e=t.trigger.eventName;e.includes(`:`)||Le.current.has(t.ref)||(Le.current.add(t.ref),Jo.getLogger().warn(`GuidanceContext: guidance flow "${t.ref}" declares an EVENT trigger with the unqualified eventName "${e}". Event names are matched as "<resourceType>:<operationIdentifier>", so this flow can never fire. Qualify it with the resource it belongs to.`))}return n(hc.NOTIFY_RESOURCE_SUCCESS,t=>{let n=`${t.resourceType}:${t.operationIdentifier}`;for(let t of e)t.trigger.eventName===n&&ke(t.ref)})}},[pe,d,n,ke]);let Re=(0,Q.useRef)(ke);(0,Q.useEffect)(()=>{Re.current=ke},[ke]),(0,Q.useEffect)(()=>{if(pe||d.length===0)return;let e=d.filter(e=>e.trigger.type===ye.DELAYED&&e.trigger.delayMs);if(e.length!==0){for(let t of e){if(A.current.has(t.ref))continue;let e=setTimeout(()=>{Re.current(t.ref),A.current.delete(t.ref)},t.trigger.delayMs);A.current.set(t.ref,e)}return()=>{for(let e of A.current.values())clearTimeout(e);A.current.clear()}}},[pe,d]);let Be=(0,Q.useMemo)(()=>SU(d.filter(e=>T.has(e.ref)),Me),[d,T]),Ve=(0,Q.useCallback)(e=>{pe||ke(e)},[ke,pe]),He=(0,Q.useCallback)(e=>{E(t=>{let n=new Set(t);return n.delete(e),n});let t=m.get(e),n=Se(e);t?.renderMode&&r(hc.GUIDANCE_FLOW_COMPLETED,{flowRef:e,renderMode:t.renderMode,triggerSource:`frontend`,scope:n}),u(`Flow completed: ${e}`)},[m,Se,r,u]),Ue=(0,Q.useCallback)(e=>{if(!m.has(e))return;let t=_e[e];ze(t?.status)||(Oe(e,e=>({...e,status:go.COMPLETED,completedAt:new Date})),He(e))},[Oe,m,_e,He]),We=(0,Q.useCallback)(async(e,t,n)=>{if(!m.has(e))return;let i;if(n?.surveyAnswers){let e={};for(let[t,r]of Object.entries(n.surveyAnswers))(typeof r==`string`||typeof r==`number`||typeof r==`boolean`||Array.isArray(r)&&r.every(e=>typeof e==`string`))&&(e[t]=r);i=e}let a=m.get(e)?.elements.find(e=>e.ref===t);if(a&&!n?.declineResourceBinding){let e=c.current,t=await _U(a,i,e.doOperation,e.registry);if(t===gU.REFUSED||t===gU.NO_OPERATION)throw Error(`guidance_survey_binding_write_failed:${t}`)}let o=m.get(e),s=o!==void 0&&o.elements.every(n=>n.ref===t||_e[e]?.elements?.[n.ref]?.status===go.COMPLETED);if(Oe(e,e=>({...e,status:s?go.COMPLETED:e.status===go.NOT_STARTED?go.IN_PROGRESS:e.status,...s?{completedAt:new Date}:{},elements:{...e.elements,[t]:{status:go.COMPLETED,completedAt:new Date,surveyAnswers:i,lastStepIndex:n?.lastStepIndex}}})),o?.renderMode){let n=o.elements.find(e=>e.ref===t);n&&r(hc.GUIDANCE_ELEMENT_COMPLETED,{flowRef:e,elementRef:t,elementType:n.type})}u(`Element completed: ${e}/${t}`),s&&He(e)},[Oe,m,r,u,He,_e]),Ge=(0,Q.useCallback)(e=>{if(!m.has(e))return;let t=_e[e];if(ze(t?.status))return;Oe(e,e=>({...e,status:go.DISMISSED,dismissedAt:new Date})),E(t=>{let n=new Set(t);return n.delete(e),n});let n=m.get(e),i=Se(e);n?.renderMode&&r(hc.GUIDANCE_FLOW_DISMISSED,{flowRef:e,renderMode:n.renderMode,triggerSource:`frontend`,scope:i}),u(`Flow dismissed: ${e}`)},[Oe,m,_e,Se,r,u]),Ke=(0,Q.useCallback)(e=>{if(!m.has(e))return;let t=_e[e];ze(t?.status)||(Oe(e,e=>({...e,status:go.SKIPPED})),E(t=>{let n=new Set(t);return n.delete(e),n}),u(`Flow skipped: ${e}`))},[Oe,m,_e,u]),qe=(0,Q.useCallback)(e=>T.has(e),[T]),Je=(0,Q.useCallback)(e=>_e[e]?.status===go.COMPLETED,[_e]),Ye=(0,Q.useCallback)(e=>m.has(e),[m]);(0,Q.useEffect)(()=>{let e=n(hc.GUIDANCE_FLOW_ACTIVATED,e=>{e.triggerSource===`backend`&&(u(`Backend activated flow: ${e.flowRef}`),E(t=>{let n=new Set(t);return n.add(e.flowRef),n}))}),t=n(hc.GUIDANCE_FLOW_COMPLETED,e=>{e.triggerSource===`backend`&&(u(`Backend completed flow: ${e.flowRef}`),E(t=>{let n=new Set(t);return n.delete(e.flowRef),n}),Oe(e.flowRef,e=>({...e,status:go.COMPLETED,completedAt:new Date}),{scopeOverride:e.scope}))}),r=n(hc.GUIDANCE_FLOW_DISMISSED,e=>{e.triggerSource===`backend`&&(u(`Backend dismissed flow: ${e.flowRef}`),E(t=>{let n=new Set(t);return n.delete(e.flowRef),n}),Oe(e.flowRef,e=>({...e,status:go.DISMISSED,dismissedAt:new Date}),{scopeOverride:e.scope}))});return()=>{e(),t(),r()}},[n,u,Oe]),(0,Q.useEffect)(()=>{let e=n(hc.MILESTONE_ACHIEVED,e=>{u(`Milestone achieved: ${e.milestoneRef} (scope: ${e.scope})`);let t=e.scope;if(F(n=>{let r=n[t];return r?{...n,[t]:{...r,milestonesAchieved:{...r.milestonesAchieved,[e.milestoneRef]:{achievedAt:new Date,count:1}},totalPoints:e.totalPoints,categoriesProgress:{...r.categoriesProgress,[e.category]:{completedCount:(r.categoriesProgress[e.category]?.completedCount??0)+1,totalPoints:(r.categoriesProgress[e.category]?.totalPoints??0)+(e.points??0)}}}}:(u(`Milestone event for unread progression scope ${t} — dropped rather than seeded`),Ee(t),n)}),e.reward?.type===Lo.FEATURE_UNLOCK&&(s?.refetch(),r(hc.NOTIFY_CUSTOM_SUCCESS,{identifier:`milestone.feature_unlock.${e.milestoneRef}`,data:{milestoneRef:e.milestoneRef,featureRef:e.reward.featureRef}})),e.reward?.type===Lo.CELEBRATION&&e.reward?.celebrationLevel){let t=Ms(e.reward);r(hc.NOTIFY_CUSTOM_SUCCESS,{identifier:`milestone.${e.milestoneRef}`,data:{frontendDisplayHints:{celebration:{mode:t}},milestoneRef:e.milestoneRef,category:e.category,points:e.points}})}}),t=n(hc.PROGRESSION_UPDATED,e=>{let t=e.scope;F(n=>{let r=n[t];return r?{...n,[t]:{...r,operationCounts:e.operationCounts,totalPoints:e.totalPoints}}:(u(`Progression update for unread progression scope ${t} — dropped rather than seeded`),Ee(t),n)})});return()=>{e(),t()}},[n,u,r,s,Ee]),(0,Q.useEffect)(()=>{if(!B)return;let e=n(hc.LIFECYCLE_STAGE_CHANGED,e=>{u(`Lifecycle stage changed: ${e.previousStage} → ${e.newStage} (scope: ${e.scope})`);let t=e.scope;re(n=>{let r=n[t]??ba.createInitialLifecycleState(new Date(e.changedAt)),i=new Date(e.changedAt),a=[...r.stageHistory];return a.length>0&&!a[0].exitedAt&&(a[0]={...a[0],exitedAt:i}),a.unshift({stage:e.newStage,enteredAt:i,trigger:e.trigger}),{...n,[t]:{...r,currentStage:e.newStage,stageEnteredAt:i,stageHistory:a,...e.activationCriteriaMet?{activationCriteriaMet:e.activationCriteriaMet}:{}}}})});return()=>{e()}},[n,u,B]);let Xe=(0,Q.useMemo)(()=>{let e=e=>{for(let t of Object.values(Mc))if(P[t]?.milestonesAchieved[e])return!0;return!1},t=e=>{for(let t of Object.values(Mc)){let n=P[t]?.milestonesAchieved[e];if(n)return n}},n=e=>{let t;for(let n of Object.values(Mc)){let r=P[n]?.categoriesProgress[e];r&&(t||={completedCount:0,totalPoints:0},t.completedCount+=r.completedCount,t.totalPoints+=r.totalPoints)}return t},r=0;for(let e of Object.values(Mc)){let t=P[e];t&&(r+=t.totalPoints)}return{scopedStates:P,isMilestoneAchieved:e,getMilestoneAchievement:t,getCategoryProgress:n,totalPoints:r,milestoneDefinitions:R,isLoading:I}},[P,I,R]),Ze=(0,Q.useMemo)(()=>{if(!B)return oU;let e=ne[Qa.USER],t=e?.currentStage??null,n=e?.stageEnteredAt?new Date(e.stageEnteredAt):null,r=t=>e?dne(e,t):!1,i=e?.activationCriteriaMet??{},a=se?.criteria??[],o=a.length,s=Object.values(i).filter(Boolean).length;return{currentStage:t,stageEnteredAt:n,isEnabled:!0,isLoading:ie,hasReachedStage:r,activationProgress:{criteriaMet:i,criteria:a,totalCriteria:o,metCriteria:s,isFullyActivated:o>0?s>=o:t!==pu.SIGNED_UP}}},[B,ne,ie,se]),Qe=(0,Q.useMemo)(()=>({activeFlows:Be,flowStates:_e,activateFlow:Ve,recordFlowPresented:Fe,reportFlowNotPresentable:Pe,completeElement:We,completeFlow:Ue,dismissFlow:Ge,skipFlow:Ke,isFlowActive:qe,isFlowCompleted:Je,isFlowPersistable:Ye,isLoading:pe,progression:Xe,lifecycle:Ze}),[Be,_e,Ve,Fe,We,Ue,Ge,Ke,qe,Je,Ye,pe,Xe,Ze]);return(0,$.jsx)(eU.Provider,{value:Qe,children:e})};function wU(){return(0,Q.useContext)(eU)??sU}function TU(){let e=(0,Q.useContext)(eU);return(0,Q.useMemo)(()=>e?.lifecycle??oU,[e?.lifecycle])}function EU(){let e=(0,Q.useContext)(eU);return(0,Q.useMemo)(()=>e?.progression??aU,[e?.progression])}var DU=new Set,OU;(function(e){e.ACHIEVED=`achieved`,e.IN_PROGRESS=`in-progress`,e.LOCKED=`locked`})(OU||={});function kU(e,t){return e.scopedStates[t]!=null}function AU(e,t){return e.filter(e=>kU(t,e.scope??Mc.USER)).map(e=>{let n=t.getMilestoneAchievement(e.identifier);if(n)return{definition:e,status:OU.ACHIEVED,achievement:n};if(e.dependencies?.length&&!e.dependencies.every(e=>t.isMilestoneAchieved(e)))return{definition:e,status:OU.LOCKED};let r=`${e.trigger.resourceType}:${e.trigger.operation}`,i=e.scope??Mc.USER,a=t.scopedStates[i]?.operationCounts?.[r]??0;return{definition:e,status:OU.IN_PROGRESS,currentCount:a}})}function jU(e){let t=new Map;for(let n of e){let e=n.definition.category;t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({category:e,milestones:t,completedCount:t.filter(e=>e.status===OU.ACHIEVED).length,totalCount:t.length,totalPoints:t.reduce((e,t)=>t.status===OU.ACHIEVED?e+(t.definition.points??0):e,0)}))}function MU(e,t){return t(e,`title`)}function NU(e,t){return t(e)}function PU(e,t){return e.filter(e=>e.status===OU.IN_PROGRESS).sort((e,t)=>FU(t)-FU(e)).slice(0,t)}function FU(e){let t=e.definition.threshold;return!t||e.definition.type!==ns.COUNT_THRESHOLD?0:Math.min(1,(e.currentCount??0)/t)}function IU(e){return e.status===OU.IN_PROGRESS&&e.definition.type===ns.COUNT_THRESHOLD&&e.definition.threshold!=null&&e.definition.threshold>0}function LU({item:e,name:t,tTracker:n,showPoints:r,showStatusIcon:i}){let{renderIcon:a}=Rf(),o=e.status===OU.ACHIEVED?a(H.CHECK,{size:fa.SM,className:`text-success`}):e.status===OU.LOCKED?a(H.LOCK,{size:fa.SM,className:`text-muted-foreground`}):a(H.CLOCK,{size:fa.SM,className:`text-primary`}),s=n(e.status===OU.ACHIEVED?`achieved`:e.status===OU.LOCKED?`locked`:`inProgress`),c=IU(e),l=c&&e.definition.threshold?Math.min(100,Math.round((e.currentCount??0)/e.definition.threshold*100)):0;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 py-2.5`,role:`listitem`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i&&(0,$.jsx)(`span`,{className:`shrink-0`,role:`img`,"aria-label":s,children:o}),(0,$.jsx)(`span`,{className:`text-sm flex-1 text-foreground`,children:t}),r&&(e.definition.points??0)>0&&(0,$.jsx)(Hf,{variant:`outline`,className:`text-xs shrink-0`,children:n(`milestonePoints`,{points:e.definition.points??0})})]}),c&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 ps-6`,children:[(0,$.jsx)(I_,{value:l,className:`flex-1 h-1`,"aria-label":t,"aria-valuenow":Math.min(e.currentCount??0,e.definition.threshold),"aria-valuemin":0,"aria-valuemax":e.definition.threshold}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:n(`countProgress`,{current:e.currentCount??0,total:e.definition.threshold??0})})]})]})}function RU({completed:e,total:t,tTracker:n}){return(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(I_,{value:t>0?e/t*100:0,className:`flex-1 h-2`,"aria-label":n(`title`),"aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":t}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:n(`progressDisplay`,{completed:e,total:t})})]})}function zU({variant:e=sv,actionableLimit:t=3,className:n}={}){let r=EU(),{tComponent:i,tMilestone:a,tMilestoneCategory:o,isReady:s}=K({component:J.PROGRESSION_MILESTONE_TRACKER,keys:[Ji.MILESTONES]}),c=(0,Q.useMemo)(()=>(e,t)=>i(J.PROGRESSION_MILESTONE_TRACKER,e,t),[i]),l=(0,Q.useMemo)(()=>AU(r.milestoneDefinitions,r),[r]),u=(0,Q.useMemo)(()=>jU(l),[l]);if(!s||r.isLoading||r.milestoneDefinitions.length===0||!Object.values(r.scopedStates).some(e=>e!=null))return null;let d=l.filter(e=>e.status===OU.ACHIEVED).length,f=l.length,p=c(`title`),m=c(`description`),h=e=>MU(e.definition.identifier,a),g=Object.values(ov).includes(e)?e:sv;g!==e&&!DU.has(e)&&(DU.add(e),Jo.getLogger().warn(`ProgressionMilestoneTracker: unknown variant "${e}" — falling back to "${sv}". Valid values: ${Object.values(ov).join(`, `)}.`));let _=(()=>{switch(g){case ov.NEXT_ACTIONS:{let e=PU(l,t);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(RU,{completed:d,total:f,tTracker:c}),e.length>0&&(0,$.jsx)(`div`,{role:`list`,className:`divide-y divide-border`,children:e.map(e=>(0,$.jsx)(LU,{item:e,name:h(e),tTracker:c,showPoints:!1,showStatusIcon:!1},e.definition.identifier))})]})}case ov.SUMMARY:{let[e]=PU(l,1);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(RU,{completed:d,total:f,tTracker:c}),e&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:c(`nextUp`)}),(0,$.jsx)(`div`,{role:`list`,children:(0,$.jsx)(LU,{item:e,name:h(e),tTracker:c,showPoints:!1,showStatusIcon:!1})})]})]})}case ov.FLAT:return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsx)(RU,{completed:d,total:f,tTracker:c}),u.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:NU(e.category,o)}),(0,$.jsx)(`div`,{role:`list`,className:`divide-y divide-border`,children:e.milestones.map(e=>(0,$.jsx)(LU,{item:e,name:h(e),tTracker:c,showPoints:!1,showStatusIcon:!0},e.definition.identifier))})]},e.category))]});case ov.DETAILED:return(0,$.jsx)(`div`,{className:`flex flex-col gap-5`,children:u.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-foreground`,children:NU(e.category,o)}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:c(`progressDisplay`,{completed:e.completedCount,total:e.totalCount})})]}),(0,$.jsx)(I_,{value:e.totalCount>0?e.completedCount/e.totalCount*100:0,className:`h-2`,"aria-label":NU(e.category,o),"aria-valuenow":e.completedCount,"aria-valuemin":0,"aria-valuemax":e.totalCount}),(0,$.jsx)(`div`,{role:`list`,className:`divide-y divide-border`,children:e.milestones.map(e=>(0,$.jsx)(LU,{item:e,name:h(e),tTracker:c,showPoints:!0,showStatusIcon:!0},e.definition.identifier))})]},e.category))})}})(),v=g===ov.SUMMARY||g===ov.DETAILED;return(0,$.jsxs)(MF,{role:`region`,"aria-label":p,className:n,"data-progression-variant":g,children:[(0,$.jsxs)(PF,{className:`pb-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`min-w-0 text-base font-semibold`,children:p}),v&&(0,$.jsx)(Hf,{variant:`secondary`,className:`text-sm shrink-0`,children:c(`totalPoints`,{points:r.totalPoints})})]}),m&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:m})]}),(0,$.jsx)(zF,{className:`pt-0`,children:_})]})}var BU=(0,Q.createContext)(null);function VU({hostResourceType:e,contextResourceIdentifiers:t,navigationZone:n,navigationInitiator:r,children:i}){let a=(0,Q.useMemo)(()=>({hostResourceType:e,contextResourceIdentifiers:t,navigationZone:n,navigationInitiator:r}),[e,t,n,r]);return(0,$.jsx)(BU.Provider,{value:a,children:i})}function HU(){let e=(0,Q.useContext)(BU);if(!e)throw Error(`useEmbeddedResourceHostContext must be used inside a host that provides an embedded-resource context — a composite view (CompositeViewProvider) or a resource layout surface (EmbeddedResourceHostProvider).`);return e}function UU(){return(0,Q.useContext)(BU)}var WU=(0,Q.createContext)(null);function GU({viewDefinition:e,breakpoint:t,navigationZone:n,navigationInitiator:r,hostResourceType:i,contextResourceIdentifiers:a,children:o}){let s=(0,Q.useMemo)(()=>({viewDefinition:e,breakpoint:t,navigationZone:n,navigationInitiator:r,hostResourceType:i,contextResourceIdentifiers:a}),[e,t,n,r,i,a]);return(0,$.jsx)(VU,{hostResourceType:i,contextResourceIdentifiers:a,navigationZone:n,navigationInitiator:r,children:(0,$.jsx)(WU.Provider,{value:s,children:o})})}function KU(){let e=(0,Q.useContext)(WU);if(!e)throw Error(`useCompositeViewContext must be used within a CompositeViewProvider`);return e}function qU(){return(0,Q.useContext)(WU)}var JU=({viewRef:e,document:t,hostResourceType:n,contextResourceIdentifiers:r,navigationZone:i,navigationInitiator:a})=>{let o=qU(),{registry:s}=wm(),c=lm(),{UIConfig:l,compositeViews:u}=e_(),d=l?.currentBreakpoint,f=Q.useMemo(()=>Up(e),[e]),p=n??(f?.hostKind===Qp.RESOURCE&&f.viewKind===Mp.COMPOSITE_VIEW?f.hostRef:void 0)??o?.hostResourceType,m=r??o?.contextResourceIdentifiers,h=(0,Q.useMemo)(()=>t??kp({viewRef:e,compositeViews:u,registry:s}),[t,e,u,s]);(0,Q.useEffect)(()=>{},[h,m,e]);let g=(0,Q.useMemo)(()=>{let e=pm.buildInitiatorIds({userId:c?.currentUserId,organizationId:c?.currentOrganizationId,applicationId:c?.currentApplicationId,anonymousUserId:c?.currentAnonymousUserId}),t=h?.primaryScope?pm.primaryScopeToContextIdentifiers(e,h.primaryScope):{},n=c?.buildContextResourceIdentifiers()??{},r=pm.filterCustomScopeContextResourceIdentifiers(n);if(!h)return pm.mergeContextResourceIdentifiers(t,r,m);let i=h.scope===fm.RESOURCE&&p?[{resourceType:p,requirement:uu.OPTIONAL,isPrimaryScope:!1}]:[],a=[...h.additionalResourceRequirements??[],...i],o=pm.getAllowedViewBindingKeys({primaryScope:h.primaryScope,parentResourcesRequirements:h.parentResourcesRequirements,additionalResourceRequirements:a});return pm.resolveViewContextResourceIdentifiers({surfaceName:`CompositeView`,surfaceRef:h.ref,primaryScope:h.primaryScope,parentResourcesRequirements:h.parentResourcesRequirements,additionalResourceRequirements:a,primaryScopeContext:t,customScopeContext:r,explicitContextResourceIdentifiers:pm.scopeContextToBindingContract(m,o)})},[c,c?.currentAnonymousUserId,c?.currentApplicationId,c?.currentOrganizationId,c?.currentUserId,h,p,m]),_=V.buildContextResourceIdentifiersKey(g),v=(0,Q.useMemo)(()=>g,[_]),y=i??o?.navigationZone??qn.PRIMARY,b=a??o?.navigationInitiator;if(!h)return(0,$.jsx)(E_,{viewKind:`composite`,viewRef:e});let x=h.viewComponent;return(0,$.jsx)(GU,{viewDefinition:h,breakpoint:d,navigationZone:y,navigationInitiator:b,hostResourceType:p,contextResourceIdentifiers:v,children:(0,$.jsx)(x,{viewRef:h.ref,viewDefinition:h})})};function YU({activationProgress:e}){let{tLifecycle:t,tActivationCriterion:n,isReady:r}=K({keys:[`lifecycle`]}),{criteriaMet:i,criteria:a,totalCriteria:o,metCriteria:s,isFullyActivated:c}=e;return(0,$.jsxs)(`div`,{style:{padding:`2rem`,maxWidth:600,margin:`0 auto`},children:[(0,$.jsx)(`h2`,{children:t(`home_activation_progress.title`)}),(0,$.jsx)(`p`,{children:t(`home_activation_progress.description`)}),o>0&&(0,$.jsxs)(`div`,{style:{marginTop:`1rem`},children:[(0,$.jsxs)(`div`,{style:{marginBottom:`0.5rem`},children:[s,` / `,o]}),(0,$.jsx)(`div`,{className:`w-full h-2 bg-muted rounded overflow-hidden`,children:(0,$.jsx)(`div`,{className:`h-full rounded transition-all duration-[var(--motion-duration-normal)] ease-in-out ${c?`bg-success`:`bg-primary`}`,style:{width:`${o>0?s/o*100:0}%`}})}),(0,$.jsx)(`ul`,{style:{listStyle:`none`,padding:0,marginTop:`1rem`},children:a.map((e,t)=>{let r=e.criterionType===Ii.MILESTONE?e.milestoneRef:e.guidanceFlowRef,a=i[r]??!1;return(0,$.jsxs)(`li`,{style:{padding:`0.25rem 0`,display:`flex`,alignItems:`center`,gap:`0.5rem`},children:[(0,$.jsx)(`span`,{children:a?`✓`:`○`}),(0,$.jsx)(`span`,{style:{opacity:a?.6:1},children:n(e)})]},r??t)})})]})]})}function XU({stage:e}){let{tLifecycle:t,tLifecycleStage:n}=K({keys:[`lifecycle`]});return(0,$.jsxs)(`div`,{className:`px-8 py-4 bg-success/5 rounded-lg mb-4`,children:[(0,$.jsx)(`strong`,{children:t(`home_welcome_back.title`)}),(0,$.jsx)(`p`,{style:{margin:`0.25rem 0 0`},children:t(`home_welcome_back.message`,{stage:n(e)})})]})}function ZU(){let{tLifecycle:e,isReady:t}=K({keys:[`lifecycle`]}),{milestoneDefinitions:n,isLoading:r}=EU(),i=!r&&n.length>0;return(0,$.jsxs)(`div`,{style:{padding:`2rem`,maxWidth:800,margin:`0 auto`},children:[(0,$.jsx)(`h2`,{children:e(`home_dashboard.title`)}),(0,$.jsx)(`p`,{children:e(`home_dashboard.description`)}),i&&(0,$.jsx)(`div`,{className:`mt-6`,children:(0,$.jsx)(zU,{})})]})}function QU(){let{tComponent:e}=K({component:J.APP_LAYOUTS_HOME});return(0,$.jsx)(`div`,{style:{padding:`2rem`,maxWidth:600,margin:`0 auto`,textAlign:`center`},children:(0,$.jsx)(`h2`,{children:e(J.APP_LAYOUTS_HOME,`welcomeTitle`)})})}var $U=({})=>{let{currentStage:e,isEnabled:t,isLoading:n,activationProgress:r}=TU(),{homeDefinition:i}=e_(),{registry:a}=wm(),o=wg(),{navigate:s}=zS(),c=lm(),{tComponent:l,isReady:u}=K({component:J.APP_LAYOUTS_HOME}),d=i?.compositeViewReference,f=(0,Q.useMemo)(()=>{if(!i||i.compositeViewReference)return null;let e=i.resourceOperationPath;if(!e)return null;let t=a.resourceConfigurations[e.resourceType];if(!t)return null;let n=t.operations.find(t=>String(t.operationIdentifier)===String(e.operationIdentifier)&&!!(t.isOperationDefault??!0)===e.isOperationDefault&&!!(t.isBulkOperation??!1)===e.isBulkOperation&&String(t.variantKey??``)===String(e.variantKey??``));if(!n)return null;let r=Ch.resolveResourceUrl(t,n,c?.buildContextResourceIdentifiers?.()??{},a.allResourceFieldIdentifiers,e.parentResourcesRequirements);return r?.resolvedUrl?{content:{contentType:hd.RESOURCE_OPERATION,resourceContext:gn.createFrontendResourceOperationContextFromOperation({resourceType:e.resourceType,operation:n,contextResourceIdentifiers:c?.buildContextResourceIdentifiers?.()??{},parentResourcesRequirements:e.parentResourcesRequirements})},urlPath:r.resolvedUrl}:null},[c,i,a]);if((0,Q.useEffect)(()=>{f&&f.urlPath!==o.pathname&&s({content:f.content,urlPath:f.urlPath,initiator:{sourceZone:hn},replaceBrowserHistory:!0})},[f,o.pathname,s]),d)return(0,$.jsx)(JU,{viewRef:d,navigationZone:qn.PRIMARY});if(!u)return null;if(n)return(0,$.jsx)(`div`,{style:{padding:`2rem`,textAlign:`center`},children:l(J.APP_LAYOUTS_HOME,`loading`)});if(!t||!e)return(0,$.jsx)(QU,{});switch(e){case pu.SIGNED_UP:return(0,$.jsx)(YU,{activationProgress:r});case pu.REACTIVATED:return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(XU,{stage:e}),(0,$.jsx)(ZU,{})]});case pu.DORMANT:case pu.ACTIVATED:case pu.ENGAGED:default:return(0,$.jsx)(ZU,{})}};function eW({preset:e=q.DEFAULT,...t}){let n=G(J.APP_LAYOUTS_HOME,`AppLayout_Home`)(e);return(0,$.jsx)(n,{...t})}function tW({className:e,children:t,containerConfig:n,sectionMetadata:r,onSectionChange:i}){let a=qU(),o=a?.viewDefinition.translationRef,s=(0,Q.useMemo)(()=>o?[`${Ji.COMPOSITE_VIEWS}.${o}`]:[],[o]),{tCompositeViewSection:c}=K({keys:s}),l=(0,Q.useMemo)(()=>{let e=new Set([...Object.keys(r??{}),...a?.viewDefinition.sectionRefs??[]]);if(e.size===0)return;let t=new Set(a?.viewDefinition.sectionRefs??[]);return Object.fromEntries(Array.from(e).map(e=>[e,{title:o&&t.has(e)?c(o,e,`title`):void 0,description:o&&t.has(e)?c(o,e,`description`):void 0,icon:r?.[e]?.icon,count:r?.[e]?.count,countTone:r?.[e]?.countTone}]))},[o,a?.viewDefinition.sectionRefs,r,c]),u=(0,Q.useMemo)(()=>nW(t,n,l,r,i),[t,n,l,r,i]);return(0,$.jsx)(rA,{value:{sectionEntries:l},children:(0,$.jsx)(`div`,{className:U(`flex flex-col gap-section`,e),"data-composite-layout":!0,children:u})})}function nW(e,t,n,r,i){let a=pA(e);return(0,$.jsx)($.Fragment,{children:a.items.map((e,a)=>{if(e.type===`node`)return(0,$.jsx)(Q.Fragment,{children:e.node},a);let{group:o}=e;return oW(o.sections,r).map((e,s)=>{let c=aW(mA({...o,sections:e}),iW(e,t,r)),l=e.map(e=>rW(e,n));return(0,$.jsx)(nk,{sections:l,config:c,onSectionChange:i},`composite-group-${o.mode}-${a}-${s}`)})})})}function rW(e,t){let n=t?.[e.props.name];return{id:e.props.name,title:n?.title,description:n?.description,icon:n?.icon,count:n?.count,countTone:n?.countTone,disabled:e.props.disabled,content:(0,$.jsx)(lA,{hostKind:Sk.COMPOSITE,sectionProps:e.props,providesHeading:!!n?.title})}}function iW(e,t,n){let r=e.map(e=>n?.[e.props.name]?.containerConfig).find(e=>e!==void 0);if(t||r)return{...t,...r}}function aW(e,t){return t?{...e,...t}:e}function oW(e,t){let n=[];for(let r of e){let e=JSON.stringify(t?.[r.props.name]?.containerConfig??null),i=n[n.length-1];if(!i){n.push([r]);continue}let a=i[i.length-1];JSON.stringify(t?.[a.props.name]?.containerConfig??null)===e?i.push(r):n.push([r])}return n}function sW({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_APPROVAL_REQUEST,`AI_ApprovalRequest`)(e);return(0,$.jsx)(n,{...t})}function cW({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_APPROVAL_QUEUE,`AI_ApprovalQueue`)(e);return(0,$.jsx)(n,{...t})}function lW({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_DECISION_REQUEST,`AI_DecisionRequest`)(e);return(0,$.jsx)(n,{...t})}function uW({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_HUMAN_INPUT_REQUEST,`AI_HumanInputRequest`)(e);return(0,$.jsx)(n,{...t})}var dW=Jo.getLogger(),fW=new Set(Object.values(Rs));function pW(e,t){let n=e=>e.decisionRef===t.decisionRef&&(t.routeVersion===void 0||e.routeVersion<t.routeVersion);return e.some(n)?e.filter(e=>!n(e)):e}function mW(e){let t=e?.response?.data;return t&&typeof t.kind==`string`&&fW.has(t.kind)?t:void 0}var hW;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(hW||={});function gW(){let{httpClient:e}=_u(),{on:t}=Sp(),[n,r]=(0,Q.useState)([]),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(hW.LOADING),c=(0,Q.useRef)(!0),l=(0,Q.useRef)(new Set),u=(0,Q.useRef)(n),d=(0,Q.useRef)(0),f=(0,Q.useRef)(0),p=(0,Q.useCallback)(e=>{u.current=e,r(e)},[]),m=(0,Q.useCallback)(async()=>{if(!e)return;let t=++d.current;f.current+=1,a(!0);try{let n=`${rt}${Xi(Re.FLOWS_ACTORS_DECISIONS)}`,r=await e.get(n,{silent:!0});c.current&&t===d.current&&(p(r?.decisions??[]),s(hW.READY))}catch(e){dW.warn(`Pending decisions could not be read`,{error:e instanceof Error?e.message:`unknown`}),c.current&&t===d.current&&s(hW.FAILED)}finally{--f.current,c.current&&t===d.current&&a(!1)}},[e,p]),h=(0,Q.useCallback)(async(t,n,r)=>{if(!e)return{kind:Rs.NOT_ACTIONABLE};let i=`${rt}${Xi(Re.FLOWS_ACTORS_DECISION_ACT,{decisionRef:t,act:n})}`,a=async t=>{try{return await e.post(i,r,{silent:!0,...t?{headers:{[ks.REAUTH_TOKEN]:t}}:{}})}catch(e){let t=mW(e);if(!t)throw e;return t}},o=i=>n===Rc.ANSWER&&r.presentationId!==void 0?e.stepUpForDecision({binding:{decisionRef:t,presentationId:r.presentationId},requirement:i}):Promise.resolve(void 0),s={kind:Rs.NOT_ACTIONABLE,reason:Co.DECISION_STEP_UP_REQUIRED},c;l.current.add(t);try{let e=n===Rc.ANSWER?u.current.find(e=>e.decisionRef===t)?.stepUp:void 0;if(e){let t=await o(e);c=t?await a(t):s}else if(c=await a(),c.kind===Rs.NOT_ACTIONABLE&&c.reason===Co.DECISION_STEP_UP_REQUIRED){let e=await o({});e&&(c=await a(e))}await m()}finally{l.current.delete(t)}return c},[e,m]),g=(0,Q.useCallback)(async t=>{if(!e)return[];let n=`${rt}${Xi(Re.FLOWS_ACTORS_DECISION_CANDIDATES,{decisionRef:t})}`;try{return(await e.get(n,{silent:!0}))?.candidates??[]}catch(e){if(mW(e))return[];throw e}},[e]);return(0,Q.useEffect)(()=>{c.current=!0,m();let e=t(mi.FLOWS_ACTORS_DECISION_ROUTED,()=>{m()}),n=t(mi.FLOWS_ACTORS_DECISION_WITHDRAWN,e=>{if(!e?.decisionRef||l.current.has(e.decisionRef))return;let t=pW(u.current,e);t===u.current?f.current>0&&m():(p(t),m())});return()=>{c.current=!1,e?.(),n?.()}},[t,m,p]),{decisions:n,isLoading:i,readState:o,refresh:m,act:h,candidates:g}}var _W=Jo.getLogger(),vW=_W.debugByType(`FlowsActorsContext`);_W.setDebugTypeLogging(`FlowsActorsContext`,!1);var yW=500;function bW(e,...t){let n=[...e,...t];return n.length>yW?n.slice(n.length-yW):n}function xW(e,t,n){if(t.messageId){let r=e.findIndex(e=>e.messageId===t.messageId);if(r>=0){let i=[...e],a=i[r];return i[r]={...a,type:t.type,content:n?t.content:a.content+t.content,data:t.data??a.data,timestamp:t.timestamp},i}}return bW(e,t)}var SW;(function(e){e.IDLE=`idle`,e.STARTING=`starting`,e.RUNNING=`running`,e.AWAITING_APPROVAL=`awaiting_approval`,e.COMPLETED=`completed`,e.CANCELLED=`cancelled`,e.ERROR=`error`})(SW||={});var CW={[yn.COMPLETED]:SW.COMPLETED,[yn.CANCELLED]:SW.CANCELLED,[yn.AWAITING_APPROVAL]:SW.AWAITING_APPROVAL,[yn.PROCESSING]:SW.RUNNING,[yn.PENDING]:SW.STARTING,[yn.READY]:SW.STARTING,[yn.FAILED]:SW.ERROR,[yn.ABORTED]:SW.ERROR};function wW(e){return CW[e]??SW.ERROR}function TW(e){let{approvalId:t,decisionRef:n,routeKind:r,toolName:i,toolArgs:a,toolInputSchema:o,requestedAt:s,expiresAt:c,reasonCodes:l,riskLevel:u,question:d,presentation:f,presentationId:p}=e;return{approvalId:t,...u?{riskLevel:u}:{},toolName:i,toolArgs:a,toolInputSchema:o,requestedAt:new Date(s),expiresAt:c?new Date(c):void 0,decisionRef:n,routeKind:r,...l&&l.length>0?{reasonCodes:l}:{},...d?{question:d}:{},...f?{presentation:f}:{},...p?{presentationId:p}:{}}}var EW=(0,Q.createContext)(void 0),DW=({children:e})=>{let{appConfig:t,frontendConfiguration:n,httpClient:r}=_u(),i=Cg(),a=lm(),{on:o,emit:s,isConnected:c}=Sp(),l=(0,Q.useRef)(!1),u=(n?.flowsActorsViews?.length??0)>0,[d,f]=(0,Q.useState)([]),[p,m]=(0,Q.useState)([]),[h,g]=(0,Q.useState)([]),[_,v]=(0,Q.useState)([]),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(new Map),[T,E]=(0,Q.useState)(!1);sh({identifier:Ko.FLOWS_ACTORS,isLoading:y,hasLoadedOnce:T});let D=(0,Q.useRef)(C);D.current=C;let O=(0,Q.useCallback)((e,t)=>{w(n=>{let r=n.get(e);if(!r)return n;let i=new Map(n);return i.set(e,t(r)),i})},[]),k=(0,Q.useCallback)(async()=>{if(!t?.runtime?.endPoints?.main_backend_api)vW(`Cannot refresh systems - API endpoint not configured`);else if(!r)vW(`Cannot refresh systems - httpClient not available`);else{b(!0),S(null);try{let e=await r.get(`${rt}${Xi(Re.FLOWS_ACTORS_FRONTEND_INFO)}`);f(e.systems),m(e.autonomousAgents),g(e.chatAgents),v(e.chatConnectionRefs),E(!0),vW(`Systems refreshed`,{count:e.systems.length})}catch(e){if(st.isNotFoundError(e)){vW(`FlowsActors backend support not available - skipping systems bootstrap`),f([]),m([]),g([]),v([]),S(null),E(!0);return}let t=e instanceof Error?e:Error(`Unknown error`);S(t),vW(`Failed to refresh systems`,{error:t.message})}finally{b(!1)}}},[t?.runtime?.endPoints?.main_backend_api,r]),A=(0,Q.useCallback)(async(e,t,n)=>{if(!r)vW(`Cannot fetch conversation history - httpClient not available`);else try{let i=`${rt}${Xi(Re.FLOWS_ACTORS_HISTORY)}`,o=t===void 0?void 0:ke({...a?.currentOrganizationId?{organizationId:a.currentOrganizationId}:{},...t}),s=`?systemRef=${encodeURIComponent(e)}${o===void 0?``:`&contextRef=${encodeURIComponent(o)}`}`+(n?.before?`&before=${encodeURIComponent(n.before)}`:``),c=zh(mn,await r.get(`${i}${s}`));vW(`Conversation history fetched`,{systemRef:e,count:c.executions.length});let l=c.executions.filter(e=>e.pendingApproval!==void 0);return l.length>0&&w(e=>{let t;for(let n of l){let r=e.get(n.executionId),i=r?.status===SW.ERROR&&(r.errorCode===Ar.DECISION_PENDING||r.errorCode===Ar.DECISION_PRESENTATION_STALE||r.errorCode===Ar.DECISION_STEP_UP_REQUIRED);r&&!i||n.pendingApproval===void 0||(t??=new Map(e),t.set(n.executionId,{executionId:n.executionId,systemRef:n.systemRef,status:SW.AWAITING_APPROVAL,messages:[],pendingApproval:TW(n.pendingApproval)}))}return t??e}),{executions:c.executions,hasOlder:c.hasOlder===!0}}catch(t){if(st.isNotFoundError(t))return vW(`FlowsActors history surface not available - returning empty history`,{systemRef:e}),{executions:[],hasOlder:!1};_W.warn(`Failed to fetch conversation history`,{systemRef:e,error:t instanceof Error?t.message:`unknown`});return}},[r,a?.currentOrganizationId]),j=(0,Q.useCallback)(async e=>{if(!r){vW(`Cannot delete conversation - httpClient not available`);return}let t=`${rt}${Xi(Re.FLOWS_ACTORS_HISTORY)}`;await r.delete(`${t}?executionId=${encodeURIComponent(e)}`),vW(`Conversation deleted`,{executionId:e})},[r]),M=(0,Q.useCallback)((e,t,n,r,i)=>{if(!c)return vW(`Cannot start execution — WebSocket not connected`,{systemRef:e}),null;let o=n??crypto.randomUUID();vW(`Starting execution`,{systemRef:e,executionId:o,hasInput:!!t,isContinuation:!!n});let l={};return a?.currentOrganizationId&&(l.organizationId=a.currentOrganizationId),Object.assign(l,r??{}),w(t=>{let n=new Map(t);return n.set(o,{executionId:o,systemRef:e,status:SW.STARTING,messages:[]}),n}),s(mi.FLOWS_ACTORS_START,{systemRef:e,executionId:o,contextResourceIdentifiers:l,initialInput:t,...i?.caseRef?{caseRef:i.caseRef}:{},...i?.messageId?{messageId:i.messageId}:{}}),o},[c,s,a?.currentOrganizationId]),N=(0,Q.useCallback)((e,t,n,r,i,a)=>{let o=D.current.get(e);o?c?(vW(`Responding to approval`,{executionId:e,approvalId:t,approved:n,modified:i!==void 0}),s(mi.FLOWS_ACTORS_APPROVAL_RESPONSE,{systemRef:o.systemRef,executionId:e,approvalId:t,approved:n,comment:r,...o.pendingApproval?.decisionRef?{decisionRef:o.pendingApproval.decisionRef}:{},...o.pendingApproval?.presentationId?{presentationId:o.pendingApproval.presentationId}:{},...i?{modifiedToolArgs:i}:{},...a?{reasonCode:a}:{}}),O(e,e=>({...e,status:n?SW.RUNNING:e.status,errorCode:void 0,recoverable:void 0,pendingApproval:void 0,answeredApproval:e.pendingApproval?{approval:e.pendingApproval,...i?{submittedToolArgs:i}:{}}:void 0}))):vW(`Cannot respond to approval — WebSocket not connected`,{executionId:e,approvalId:t}):vW(`Cannot respond to approval — execution not found`,{executionId:e,approvalId:t})},[c,s,O]),P=(0,Q.useCallback)((e,t,n,r)=>{let i=D.current.get(e),a=i?.pendingApproval;if(!i||!a?.question||!a.decisionRef||!c){vW(`Cannot answer a question — no paused question, or the WebSocket is not connected`,{executionId:e});return}let o=t===Hn.ANSWER;s(mi.FLOWS_ACTORS_APPROVAL_RESPONSE,{systemRef:i.systemRef,executionId:e,approvalId:a.approvalId,decisionRef:a.decisionRef,...a.presentationId?{presentationId:a.presentationId}:{},approved:o,answer:{decisionId:a.decisionRef,optionRef:t,values:[...n]},...r?{comment:r}:{}}),O(e,e=>({...e,status:SW.RUNNING,errorCode:void 0,recoverable:void 0,pendingApproval:void 0,answeredApproval:e.pendingApproval?{approval:e.pendingApproval}:void 0}))},[c,s,O]),F=(0,Q.useCallback)(e=>D.current.get(e),[]),I=(0,Q.useCallback)(e=>d.find(t=>t.ref===e),[d]),ee=(0,Q.useCallback)(e=>{let t=D.current.get(e);t&&c&&s(mi.FLOWS_ACTORS_CANCEL,{systemRef:t.systemRef,executionId:e})},[c,s]),L=(0,Q.useCallback)(e=>{w(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]);(0,Q.useEffect)(()=>{i.isAuthenticated()||(l.current=!1,f([]),m([]),g([]),v([]),S(null),w(new Map))},[i]);let R=(0,Q.useCallback)(()=>{!l.current&&t?.runtime?.endPoints?.main_backend_api&&r&&i.isAuthenticated()&&(l.current=!0,k())},[t?.runtime?.endPoints?.main_backend_api,r,i,k]);(0,Q.useEffect)(()=>{!l.current&&u&&t?.runtime?.endPoints?.main_backend_api&&r&&i.isAuthenticated()&&(l.current=!0,k())},[t?.runtime?.endPoints?.main_backend_api,u,r,i,k]);let te=(0,Q.useRef)(c);(0,Q.useEffect)(()=>{let e=te.current&&!c;te.current=c,e&&w(e=>{let t=null;for(let[n,r]of e)(r.status===SW.STARTING||r.status===SW.RUNNING)&&(t??=new Map(e),t.set(n,{...r,status:SW.ERROR,recoverable:!0,errorCode:Ar.CONNECTION_LOST}));return t??e})},[c]),(0,Q.useEffect)(()=>{if(!c)return;let e=o(mi.FLOWS_ACTORS_STARTED,e=>{vW(`Execution started`,{executionId:e.executionId}),O(e.executionId,e=>({...e,status:SW.RUNNING}))}),t=o(mi.FLOWS_ACTORS_MESSAGE,e=>{vW(`Execution message`,{executionId:e.executionId,type:e.messageType,messageId:e.messageId,isFinal:e.isFinal});let t=ate.safeParse(e.data);if(t.success){let{approvalId:n,toolName:r}=t.data;vW(`Approval requested`,{executionId:e.executionId,approvalId:n,toolName:r}),O(e.executionId,e=>({...e,status:SW.AWAITING_APPROVAL,answeredApproval:void 0,pendingApproval:TW(t.data)}))}O(e.executionId,t=>({...t,messages:xW(t.messages,{type:e.messageType,content:e.content,data:e.data,timestamp:e.timestamp instanceof Date?e.timestamp:new Date(e.timestamp),messageId:e.messageId},e.isFinal===!0)}))}),n=o(mi.FLOWS_ACTORS_COMPLETED,e=>{vW(`Execution completed`,{executionId:e.executionId,status:e.status,duration:e.duration}),O(e.executionId,t=>({...t,status:wW(e.status),pendingApproval:void 0,duration:e.duration,...e.usage?{usage:e.usage}:{}}))}),r=o(mi.FLOWS_ACTORS_ERROR,e=>{vW(`Execution error`,{executionId:e.executionId,errorCode:e.errorCode,recoverable:e.recoverable}),O(e.executionId,t=>{if(e.recoverable&&e.errorCode===Ar.APPROVAL_MODIFICATION_REJECTED&&t.answeredApproval)return{...t,status:SW.AWAITING_APPROVAL,recoverable:e.recoverable,errorCode:e.errorCode,pendingApproval:{...t.answeredApproval.approval,modificationRefusal:e.approvalModificationRefusal??{reason:``},rejectedToolArgs:t.answeredApproval.submittedToolArgs,reasonCodeRefused:void 0},answeredApproval:void 0};if(e.recoverable&&e.errorCode===Ar.APPROVAL_REASON_CODE_REJECTED&&t.answeredApproval)return{...t,status:SW.AWAITING_APPROVAL,recoverable:e.recoverable,errorCode:e.errorCode,pendingApproval:{...t.answeredApproval.approval,modificationRefusal:void 0,rejectedToolArgs:void 0,reasonCodeRefused:!0},answeredApproval:void 0};if(e.recoverable&&e.errorCode===Ar.SERVICE_CONSENT_REQUIRED&&t.answeredApproval)return{...t,status:SW.AWAITING_APPROVAL,recoverable:e.recoverable,errorCode:e.errorCode,pendingApproval:{...t.answeredApproval.approval,modificationRefusal:void 0,rejectedToolArgs:t.answeredApproval.submittedToolArgs,reasonCodeRefused:void 0},answeredApproval:void 0};let n=t.pendingApproval?.decisionRef??t.answeredApproval?.approval.decisionRef;return e.errorCode===Ar.DECISION_PENDING&&n!==void 0&&n===e.waitingDecisionRef?t:{...t,status:SW.ERROR,recoverable:e.recoverable,errorCode:e.errorCode,pendingApproval:void 0,answeredApproval:void 0}})});return()=>{e(),t(),n(),r()}},[c,o,O]);let z=(0,Q.useMemo)(()=>({systems:d,autonomousAgents:p,chatAgents:h,chatConnectionRefs:_,requestAgentDeclarations:R,isLoading:y,error:x,executions:C,startExecution:M,respondToApproval:N,answerQuestion:P,cancelExecution:ee,clearExecution:L,getExecution:F,getSystem:I,refreshSystems:k,fetchConversationHistory:A,deleteConversation:j}),[d,p,h,_,R,y,x,C,M,N,P,ee,L,F,I,k,A,j]);return(0,$.jsx)(EW.Provider,{value:z,children:e})};function OW(){let e=(0,Q.useContext)(EW);if(!e)throw Error(`useFlowsActors must be used within a FlowsActorsProvider`);return e}function kW(){return(0,Q.useContext)(EW)}var AW={[md.AGENT_NOT_REGISTERED]:`refusalAgentNotRegistered`,[md.TOOL_NOT_DECLARED]:`refusalToolNotDeclared`,[md.TOOL_NO_LONGER_GATED]:`refusalToolNoLongerGated`,[md.APPROVAL_ROUTE_CHANGED]:`refusalApprovalRouteChanged`,[md.AGENT_NOT_ACTIVE]:`refusalAgentNotActive`,[md.AGENT_SUSPENDED]:`refusalAgentSuspended`,[md.CONTENT_POLICY_TIGHTENED]:`refusalContentPolicyTightened`,[md.AGENT_STANDING_UNREADABLE]:`refusalAgentStandingUnreadable`,[md.ARGUMENTS_INVALID]:`refusalArgumentsInvalid`,[md.ARGUMENTS_NOT_RUN_AS_WRITTEN]:`refusalArgumentsNotRunAsWritten`,[md.ARGUMENTS_CANNOT_BE_CORRECTED]:`refusalArgumentsCannotBeCorrected`,[md.CREDENTIAL_NOT_ACCEPTED]:`refusalCredentialNotAccepted`,[md.SIGNING_KEY_NOT_CONFIGURED]:`refusalSigningKeyNotConfigured`,[md.CALL_NOT_REWRITABLE]:`refusalCallNotRewritable`,[md.RECORD_NOT_REACHABLE]:`refusalRecordNotReachable`,[md.DELIVERABLE_FILE_NOT_EDITABLE]:`refusalDeliverableFileNotEditable`},jW=`refusalReasonUnstated`,MW=new Set(Object.values(md));function NW(e,t){return t(MW.has(e.reason)?AW[e.reason]:jW,{toolName:e.toolName??``,arguments:(e.argumentPaths??[]).join(`, `)})}function PW(e,t){let n={arguments:(e.argumentNames??[]).join(`, `)||t(`noticeTheseArguments`)};return{[Rs.APPLIED]:void 0,[Rs.NOT_ACTIONABLE]:e.reason===Co.PRESENTATION_STALE?t(`noticePresentationStale`):e.reason===Co.CLOCK_ALREADY_PAUSED?t(`noticeClockAlreadyPaused`):e.reason===Co.CLOCK_NOT_PAUSED?t(`noticeClockNotPaused`):e.reason===Co.PAUSE_STATE_NOT_DECLARED?t(`noticePauseStateNotDeclared`):t(`noticeNotActionable`),[Rs.LAPSED]:t(`noticeLapsed`),[Rs.REQUESTER_AUTHORITY_LAPSED]:t(`noticeRequesterAuthorityLapsed`),[Rs.MODIFICATION_REJECTED]:e.reason===Co.EDITED_CALL_NOT_REACHABLE?t(`noticeEditedCallNotReachable`,n):e.reason===Co.CALL_NOT_RUN_AS_READ?t(`noticeCallNotRunAsRead`,n):e.reason===Co.CREDENTIAL_NOT_ACCEPTED?t(`noticeCredentialNotAccepted`,n):e.reason===Co.CALL_CANNOT_RUN?t(`noticeCallCannotRun`):e.reason===Co.ARGUMENTS_CANNOT_BE_CORRECTED?t(`noticeArgumentsCannotBeCorrected`,n):t(`noticeModificationRejected`),[Rs.REASON_CODE_REJECTED]:t(`noticeReasonCodeRejected`),[Rs.CONSENT_REQUIRED]:t(`noticeConsentRequired`),[Rs.TARGET_REFUSED]:e.reason===Co.NO_TARGET?t(`noticeNoEscalationTarget`):t(`noticeTargetRefused`),[Rs.SUPERSEDED]:t(`noticeSuperseded`)}[e.kind]}function FW(e,t){let n=e.find(e=>e.decisionRef===t)?.presentationId;return n?{presentationId:n}:{}}function IW(e,t){if(e&&e.length!==0)return e.map(e=>({value:e,label:t(Gne,e)}))}function LW(e,t){return t(pre.HUMAN_DECISION_PAUSE_STATE,e)}var RW=[Ji.SYSTEM_ENUMS,Ji.ROLES],zW=[];function BW({executionId:e,...t}){let{executions:n,respondToApproval:r,answerQuestion:i}=OW(),[a,o]=Q.useState(null),s=n.get(e),c=s?.pendingApproval,l=c?.toolName,{t:u,roleLabel:d,toolLabel:f,operationLabel:p,tComponent:m,tSystemEnum:h}=JW(Q.useMemo(()=>l?[l]:[],[l]),zW),g=Q.useCallback((t,n,i,a)=>{o(t),r(e,t,!0,n,i,...a?[a]:[])},[e,r]),_=Q.useCallback((t,n,i)=>{o(t),i?r(e,t,!1,n,void 0,i):r(e,t,!1,n)},[e,r]),v=Q.useCallback((t,n,r,a)=>{o(t),i(e,n,r,a)},[e,i]),y=Q.useCallback(e=>m(J.LOW_LEVEL_AI_APPROVAL,e),[m]);if(Q.useEffect(()=>{o(null)},[c]),!s||!c)return null;let{approvalId:b,riskLevel:x,expiresAt:S,toolName:C,toolArgs:w,toolInputSchema:T,modificationRefusal:E,rejectedToolArgs:D,routeKind:O,reasonCodes:k,reasonCodeRefused:A,question:j,presentation:M}=c,N=WW(M?.title??Se({plane:sd.CONVERSATIONAL,toolName:C??``}).title,u,d,f,p),P=O===void 0||O===Me.OWNER;return j?(0,$.jsx)(sW,{approvalId:b,actionDescription:j.title,executionId:e,systemRef:s.systemRef,expiresAt:S,answerable:P,question:KW(j,y),onAnswer:v,isProcessing:a===b,...t}):(0,$.jsx)(sW,{approvalId:b,actionDescription:N,riskLevel:x,executionId:e,systemRef:s.systemRef,expiresAt:S,answerable:P,actionNotice:P?A?m(J.LOW_LEVEL_AI_APPROVAL,`noticeReasonCodeRejected`):void 0:m(J.LOW_LEVEL_AI_APPROVAL,`awaitingReview`),reasonCodeOptions:P?IW(k,h):void 0,allowArgumentModification:P,toolName:C,toolLabel:C?f(C):void 0,executionContext:w,presentedArguments:c.presentation?.fields,argumentsSchema:T,argumentModificationError:E?NW(E,(e,t)=>m(J.LOW_LEVEL_AI_APPROVAL,e,t)):void 0,rejectedArguments:D,onApprove:g,onDeny:_,isProcessing:a===b,...t})}function VW(e,t,n,r){return{[Me.OWNER]:()=>t(`holderOwner`),[Me.ASSIGNEE]:()=>e.claimedAt?t(`holderClaimedByYou`,{when:r(e.claimedAt)}):t(`holderAssignedToYou`),[Me.ROLE]:()=>e.eligibleRole?t(`holderRole`,{role:n(e.eligibleRole)}):void 0}[e.kind]()}var HW={[Xu.USER]:void 0,[Xu.MACHINE]:`requesterAutonomousAgent`,[Xu.DELEGATED_CLIENT]:`requesterConnectedApplication`};function UW(e,t){let n=HW[e];return n?t(n):void 0}function WW(e,t,n,r,i=(e,t)=>`${Ji.RESOURCES}.${e}.operations.${t}.${Vo.TITLE}`){switch(e.kind){case Ei.LABEL:return e.params?t(e.labelRef,Object.fromEntries(Object.entries(e.params).map(([e,a])=>[e,typeof a==`object`?WW(a,t,n,r,i):String(a)]))):t(e.labelRef);case Ei.ROLE:return n(e.roleKey);case Ei.TOOL:return r(e.toolName);case Ei.RESOURCE_OPERATION:return i(e.resourceType,e.operationIdentifier);case Ei.TEXT:return e.text;default:return e}}function GW(e,t,n=e=>e,r=e=>e,i){let a=e.presentation?{presentedArguments:e.presentation.fields}:{},o=WW(e.presentation?.title??Se(e).title,t,n,r,i);return e.plane===sd.OPERATION_APPROVAL&&e.operationApproval?{actionDescription:o,executionContext:e.operationApproval.requestedValues,...a}:e.plane===sd.REPRESENTATIVE_ADMISSION&&e.representativeAdmission||Eu(e)?{actionDescription:o}:{actionDescription:o,toolName:e.toolName,toolLabel:r(e.toolName),executionContext:e.toolArgs,...a}}function KW(e,t){return{description:e.description,options:e.options.map(e=>({ref:e.ref,label:WW(Vi(e),t,e=>e,e=>e),intent:e.intent,...e.description?{description:e.description}:{}})),fields:e.fields,...e.form?{form:e.form}:{}}}function qW(e,t){if(e.request&&Eu(e))return KW(e.request,t)}function JW(e,t){let n=Q.useMemo(()=>[...RW,...e.map(ft),...t.map(e=>`${Ji.RESOURCES}.${e}`)],[e,t]),{t:r,tComponent:i,tRole:a,tSystemEnum:o,tResourceOperation:s,formatDateTime:c}=K({component:J.LOW_LEVEL_AI_APPROVAL,keys:n});return{t:Q.useCallback((e,t)=>i(J.LOW_LEVEL_AI_APPROVAL,e,t),[i]),roleLabel:Q.useCallback(e=>a?a(e,`label`):e,[a]),toolLabel:Q.useCallback(e=>{let t=Zee(e,_s.TITLE),n=r(t);return n===t||n.length===0?e:n},[r]),operationLabel:Q.useCallback((e,t)=>s(e,t,Vo.TITLE),[s]),tComponent:i,tSystemEnum:o,formatDateTime:c}}function YW(e,t){let n=new URLSearchParams(t).get(Gre);if(!n)return e;let r=e.filter(e=>e.decisionRef===n);return r.length===0?e:[...r,...e.filter(e=>e.decisionRef!==n)]}function XW(e){let{decisions:t,readState:n,refresh:r,act:i,candidates:a}=gW(),o=Q.useMemo(()=>YW(t,window.location.search),[t]),{t:s,roleLabel:c,toolLabel:l,operationLabel:u,tSystemEnum:d,formatDateTime:f}=JW(Q.useMemo(()=>[...new Set(o.map(e=>e.toolName).filter(e=>!!e))].sort(),[o]),Q.useMemo(()=>[...new Set(o.map(e=>e.operationApproval?.resourceType).filter(e=>!!e))].sort(),[o])),[p,m]=Q.useState(()=>new Set),[h,g]=Q.useState(()=>new Map),[_,v]=Q.useState(()=>new Map),y=Q.useCallback(async(e,t,n)=>{m(t=>new Set(t).add(e));try{let r=PW(await i(e,t,n),s);g(t=>{let n=new Map(t);return r===void 0?n.delete(e):n.set(e,r),n})}catch{g(t=>new Map(t).set(e,s(`noticeNotActionable`)))}finally{m(t=>{let n=new Set(t);return n.delete(e),n})}},[i,s]),b=Q.useMemo(()=>o.map(e=>({approvalId:e.decisionRef,executionId:e.executionId,systemRef:e.systemRef,systemName:e.systemDisplayName,riskLevel:e.riskLevel,question:qW(e,s),holderNotice:VW(e.route,s,c,f),requesterNotice:UW(e.requesterKind,s),...GW(e,s,c,l,u),expiresAt:e.expiresAt?new Date(e.expiresAt):void 0,createdAt:new Date(e.requestedAt),canEscalate:e.permittedActs.includes(Rc.ESCALATE)&&e.declaresEscalationTarget,canClaim:e.permittedActs.includes(Rc.CLAIM),canUnclaim:e.permittedActs.includes(Rc.UNCLAIM),canReassign:e.permittedActs.includes(Rc.REASSIGN),reassignCandidates:_.get(e.decisionRef),actionNotice:h.get(e.decisionRef),canPauseClock:e.permittedActs.includes(Rc.PAUSE_CLOCK)&&!e.clockPause&&e.pauseStates.length>0,canResumeClock:e.permittedActs.includes(Rc.RESUME_CLOCK)&&!!e.clockPause,pauseStateOptions:e.pauseStates.map(e=>({value:e,label:LW(e,d)})),deadlineNotice:e.nextDeadline?s(e.nextDeadline.kind===$ee.CLAIM?`deadlineClaimBy`:`deadlineDecisionBy`,{when:f(e.nextDeadline.dueAt)}):void 0,clockPausedNotice:e.clockPause?s(`clockPausedIn`,{pauseState:LW(e.clockPause.pauseStateRef,d)}):void 0,reasonCodeOptions:IW(e.reasonCodes,d),allowArgumentModification:e.plane===sd.CONVERSATIONAL,argumentsSchema:e.toolInputSchema})),[o,_,h,s,c,l,u,d,f]),x=Q.useCallback((e,t,n,r,i)=>{let a=o.find(t=>t.decisionRef===e)?.plane,c=a?kie[a]:void 0;if(!c){g(t=>new Map(t).set(e,s(`noticeNotActionable`)));return}let l=t?c.approve:c.deny;y(e,Rc.ANSWER,{answer:{decisionId:e,optionRef:l,values:[]},...FW(o,e),...n?{reason:n}:{},...r?{modifiedToolArgs:r}:{},...i?{reasonCode:i}:{}})},[y,o,s]),S=Q.useCallback(e=>{v(t=>{let n=new Map(t);return n.delete(e),n}),a(e).then(t=>v(n=>new Map(n).set(e,t.map(e=>({value:e.userId,label:e.email??e.userId}))))).catch(()=>v(t=>new Map(t).set(e,[])))},[a]);return(0,$.jsx)(cW,{items:b,onApprove:(e,t,n,r)=>x(e,!0,t,n,r),onDeny:(e,t,n)=>x(e,!1,t,void 0,n),onEscalate:(e,t)=>void y(e,Rc.ESCALATE,t?{reason:t}:{}),onAnswer:(e,t,n,r,i)=>void y(e,Rc.ANSWER,{answer:{decisionId:e,optionRef:t,values:[...n]},...FW(o,e),...r?{reason:r}:{},...i?{reasonCode:i}:{}}),onClaim:e=>void y(e,Rc.CLAIM,{}),onUnclaim:e=>void y(e,Rc.UNCLAIM,{}),onReassignOpen:S,onReassign:(e,t,n)=>void y(e,Rc.REASSIGN,{targetUserId:t,...n?{reason:n}:{}}),onPauseClock:(e,t)=>void y(e,Rc.PAUSE_CLOCK,{pauseStateRef:t}),onResumeClock:e=>void y(e,Rc.RESUME_CLOCK,{}),processingIds:p,isLoading:n===hW.LOADING,loadFailed:n===hW.FAILED,onRetry:()=>{r()},...e})}function ZW(){return(0,$.jsx)(tW,{children:(0,$.jsx)(cA,{name:`decisions`,appearance:Mr.CARD,children:(0,$.jsx)(XW,{})})})}function QW(e){return e.operationFrontendConfig?.customView}function $W(e){return e.operationFrontendConfig?.displayPresetOverride?.resourceLayoutPresetKey}var eG=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>{let{tComponent:r,isReady:i}=K({component:J.RESOURCES_LAYOUTS_ACTION});return i?(0,$.jsx)(_V,{resourceContext:e,navigationZone:t,navigationInitiator:n,errorMessage:jp({tComponent:r,componentType:J.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),errorComponent:`ResourceLayoutPreset_Action_Default`}):null};function tG({preset:e,...t}){let n=QW(t.resourceContext.operation);if(n)return(0,$.jsx)(n,{...t});let r=$W(t.resourceContext.operation),i=e??r??q.DEFAULT,a=G(J.RESOURCES_LAYOUTS_ACTION,`ResourceLayout_Action`)(i);return(0,$.jsx)(a,{...t})}var nG=zs(J.LOW_LEVEL_DIALOG,`Dialog`,[`Trigger`,`Content`,`Close`,`Header`,`Footer`,`Title`,`Description`]);function rG({preset:e=q.DEFAULT,...t}){let n=nG(e);return(0,$.jsx)(n,{...t})}var iG=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=nG(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});iG.displayName=`DialogTrigger`;var aG=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=nG(e);return(0,$.jsx)(r.Content,{...t,ref:n})});aG.displayName=`DialogContent`;function oG({preset:e=q.DEFAULT,...t}){let n=nG(e);return(0,$.jsx)(n.Close,{...t})}function sG({preset:e=q.DEFAULT,...t}){let n=nG(e);return(0,$.jsx)(n.Header,{...t})}function cG({preset:e=q.DEFAULT,...t}){let n=nG(e);return(0,$.jsx)(n.Footer,{...t})}var lG=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=nG(e);return(0,$.jsx)(r.Title,{...t,ref:n})});lG.displayName=`DialogTitle`;var uG=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=nG(e);return(0,$.jsx)(r.Description,{...t,ref:n})});uG.displayName=`DialogDescription`;function dG({open:e,onAcknowledge:t,fields:n,resourceType:r}){let{tComponent:i,tResourceFieldDisplay:a,isReady:o}=K({component:J.RESOURCES_LAYOUTS_CREATE,resource:r}),s=Q.useRef(n);if(s.current=n,(0,Q.useEffect)(()=>()=>{s.current=[]},[]),!o)return null;let c=jp({tComponent:i,componentType:J.RESOURCES_LAYOUTS_CREATE,key:`ephemeral.title`}),l=jp({tComponent:i,componentType:J.RESOURCES_LAYOUTS_CREATE,key:`ephemeral.warning`}),u=jp({tComponent:i,componentType:J.RESOURCES_LAYOUTS_CREATE,key:`ephemeral.acknowledge`});return(0,$.jsx)(rG,{open:e,onOpenChange:()=>{},children:(0,$.jsxs)(aG,{className:`sm:max-w-lg`,onPointerDownOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),showCloseButton:!1,children:[(0,$.jsxs)(sG,{children:[(0,$.jsx)(lG,{className:`text-warning-foreground`,children:c}),(0,$.jsx)(uG,{className:`text-sm text-muted-foreground`,children:l})]}),(0,$.jsx)(`div`,{className:`space-y-field py-field`,children:n.map(e=>{let t=a(r,e.fieldName,`description`);return(0,$.jsxs)(`div`,{className:`space-y-item-xs`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium text-foreground`,children:a(r,e.fieldName,`label`)}),(0,$.jsx)(`div`,{className:`flex items-center rounded-md border border-border bg-muted/40 px-element py-item`,children:(0,$.jsx)($j,{schema:e.schema,value:String(e.value),className:`w-full overflow-x-auto`})}),t?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}):null]},e.fieldName)})}),(0,$.jsx)(cG,{children:(0,$.jsx)(X,{onClick:t,children:u})})]})})}var fG=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>{let{tComponent:r,isReady:i}=K({component:J.RESOURCES_LAYOUTS_CREATE}),{resourceType:a,operation:o,resourceConfig:s,isSemanticCustomOperation:c,navigateToPreferredRead:l,reportError:u,goBackWithinZone:d}=gC({resourceContext:e,navigationZone:t,navigationInitiator:n}),f=jp({tComponent:r,componentType:J.RESOURCES_LAYOUTS_CREATE,key:`formSubmissionFailed`}),p=jp({tComponent:r,componentType:J.RESOURCES_LAYOUTS_CREATE,key:`semanticOperationFailed`}),{closeOverlay:m}=zS(),h=e.additionalContext?.defaultValuesOverride,g=!!e.additionalContext?.quickCreateRequest,[_,v]=(0,Q.useState)(null),y=(0,Q.useCallback)(n=>{if(g)t===qn.OVERLAY?m():d();else if(s){if(n){let r=n._id||n[s.resourceFieldIdentifier];if(r){l({contextResourceIdentifiers:gn.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,a,String(r)),fallbackToGoBack:!1,transitionOverride:t===qn.OVERLAY?ln.PROMOTE:void 0})||d();return}}d()}},[m,d,g,l,t,s,e.contextResourceIdentifiers,a]),b=(0,Q.useCallback)(e=>{if(!s)return;let t=sC(o.responseDto,e);t.length>0?v({fields:t,result:e}):y(e)},[s,o.responseDto,y]),x=(0,Q.useCallback)(()=>{if(_){let{result:e}=_;v(null),y(e)}},[_,y]),S=(0,Q.useCallback)(e=>{u(e,f,`ResourceLayoutPreset_Create_Default`)},[f,u]),C=(0,Q.useMemo)(()=>t===qn.OVERLAY?()=>m():void 0,[t,m]);return i?c?(0,$.jsx)(_V,{resourceContext:e,navigationZone:t,navigationInitiator:n,errorMessage:p,errorComponent:`ResourceLayoutPreset_Create_Default`,onSuccess:b,onCancel:C}):(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(pV,{resourceContext:e,navigationZone:t,navigationInitiator:n}),(0,$.jsx)(xB,{resourceContext:e,defaultValuesOverride:h,navigationZone:t,onSuccess:b,onError:S,onCancel:C,showErrorSummary:!0}),_&&(0,$.jsx)(dG,{open:!0,onAcknowledge:x,fields:_.fields,resourceType:a})]}):null};function pG({preset:e,...t}){let n=QW(t.resourceContext.operation);if(n)return(0,$.jsx)(n,{...t});let r=$W(t.resourceContext.operation),i=e??r??q.DEFAULT,a=G(J.RESOURCES_LAYOUTS_CREATE,`ResourceLayout_Create`)(i);return(0,$.jsx)(a,{...t})}var mG=700;function hG(e,{enabled:t=!0,delayMs:n=450,moveTolerancePx:r=10}={}){let i=(0,Q.useRef)(null),a=(0,Q.useRef)(null),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(null),c=(0,Q.useRef)(e);c.current=e;let l=(0,Q.useCallback)(()=>{i.current&&=(clearTimeout(i.current),null)},[]),u=(0,Q.useCallback)(e=>{if(!t)return;if(e.touches.length>1){l();return}o.current=!1;let r=e.touches[0];s.current=r?{x:r.clientX,y:r.clientY}:null,l(),i.current=setTimeout(()=>{o.current=!0,c.current()},n)},[t,n,l]),d=(0,Q.useCallback)(e=>{let t=s.current,n=e.touches[0];t&&n&&(Math.abs(n.clientX-t.x)>r||Math.abs(n.clientY-t.y)>r)&&l()},[r,l]),f=(0,Q.useCallback)(()=>{l(),o.current&&(a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{o.current=!1},mG))},[l]),p=(0,Q.useCallback)(e=>{o.current&&e.preventDefault()},[]),m=(0,Q.useCallback)(()=>o.current?(o.current=!1,!0):!1,[]);return(0,Q.useEffect)(()=>()=>{i.current&&clearTimeout(i.current),a.current&&clearTimeout(a.current)},[]),{handlers:{onTouchStart:u,onTouchEnd:f,onTouchMove:d,onContextMenu:p},consumeLongPress:m}}var gG=Ho.HIDDEN;function _G(e){let{resourceType:t,resourceConfig:n,data:r,hostIdentifiers:i}=e,a={...i??{}},o=n?.resourcePrimaryScope;if(o){let e=r[iu[o]];typeof e==`string`&&e.length>0&&(a[gre[o]]=e)}let s=n?.resourceFieldIdentifier,c=s?V.getResourceObjectId(r,s):void 0;return c&&(a[t]=c),a}function vG({resourceType:e,schema:t,data:n,className:r,primaryLabel:i=null,contextResourceIdentifiers:a}){let{registry:o}=wm(),s=(0,Q.useMemo)(()=>o.resourceConfigurations[e],[o,e]),c=(0,Q.useMemo)(()=>_G({resourceType:e,resourceConfig:s,data:n,hostIdentifiers:a}),[e,s,n,a]),l=(0,Q.useMemo)(()=>V.buildContextualParameters(c,o),[c,o]),u=V.getInstance().getResourceId(c[e])||void 0,d=s?.frontendConfiguration?.layout?.summary,f=s?.frontendConfiguration?.layout?.defaultChromeMode?.summary,p=(0,Q.useMemo)(()=>d??ez(t,s),[d,t,s]),m=(0,Q.useRef)({titleMounted:!1}).current,h=(0,Q.useMemo)(()=>({resourceType:e,primaryLabel:i,titleMountTracker:m}),[e,i,m]);(0,Q.useEffect)(()=>{});let g=(0,Q.useMemo)(()=>({resourceContext:{resourceType:e,operationId:W.READ}}),[e]);return(0,$.jsx)(YA,{kind:qA.SUMMARY,children:(0,$.jsx)(Lhe,{value:h,children:(0,$.jsx)(rj.Provider,{value:f===void 0,children:(0,$.jsx)(UB,{schema:t,data:n,resourceType:e,resourceId:u,contextResourceIdentifiers:c,contextualParameters:l,className:r,labels:g,disableInlineEdit:!0,layoutTemplate:p,defaultDisplayChromeMode:f??gG,isLoading:!1})})})})}vG.displayName=`ResourceSummaryDisplayer`;var yG=vG;function bG({className:e,children:t}){return(0,$.jsx)(`div`,{className:U(`flex min-w-0 flex-wrap items-center gap-x-group gap-y-item`,`[&>*]:w-auto`,e),children:t})}var xG=`15rem`,SG=`border border-border rounded-lg divide-y divide-border list-none m-0 p-0`,CG=`px-card py-card-sm`,wG=`ps-card`,TG=`flex items-start gap-element-sm`,EG=`border-s border-transparent ${wG}`,DG=`grid gap-element list-none m-0 p-0`;function OG(e){return e===void 0?SG:U(DG)}function kG(e){if(e===void 0)return;let t=Math.min(Math.max(Math.trunc(e),1),6);return{gridTemplateColumns:`repeat(auto-fill, minmax(max(${xG}, ${`calc((100% - ${t-1} * var(--spacing-element)) / ${t})`}), 1fr))`}}var AG={vertical:Ma.MIDDLE,horizontal:pl.END,orientation:Wl.HORIZONTAL},jG={[Ma.TOP]:`items-start`,[Ma.MIDDLE]:`items-center`,[Ma.BOTTOM]:`items-end`};function MG(e=AG){let{vertical:t,horizontal:n,orientation:r=Wl.HORIZONTAL}=e,i=r===Wl.VERTICAL?`flex flex-col gap-element-sm`:`flex gap-element-sm`;return n===pl.MIDDLE?{containerClass:`flex ${t===Ma.TOP?`flex-col-reverse`:`flex-col`} gap-element-sm`,contentClass:`min-w-0`,actionsClass:`${i} self-center`}:{containerClass:`flex ${n===pl.START?`flex-row-reverse`:``} ${jG[t]} gap-element-sm`.replace(/\s+/g,` `).trim(),contentClass:`min-w-0 flex-1`,actionsClass:`${i} shrink-0`}}var NG=async()=>{throw Error(`A collection cell does not edit in place.`)};function PG(e){let t=wj(),n=jm()?.registry,{resourceType:r,record:i,collectionContextResourceIdentifiers:a}=e;return(0,Q.useMemo)(()=>{if(!n||!i)return t;let e=_G({resourceType:r,resourceConfig:n.resourceConfigurations[r],data:i,hostIdentifiers:a??t.contextResourceIdentifiers});return{...t,resourceType:r,resourceId:gn.getResourceId(e[r])||void 0,contextResourceIdentifiers:e,contextualParameters:V.buildContextualParameters(e,n),canInlineEdit:!1,doInlineUpdate:NG,defaultInlineEdit:void 0,fileUploadContext:void 0,rmm:null}},[t,n,i,r,a])}function FG({fieldName:e,value:t,fieldSchema:n,fieldLabel:r,resourceType:i,record:a,collectionContextResourceIdentifiers:o,tResourceFieldEnumValue:s,fieldLabelVisible:c=!1}){let l=PG({resourceType:i,record:a,collectionContextResourceIdentifiers:o}),u=(0,Q.useMemo)(()=>{let t=n?Dc(n):void 0;if(!t)return;let r=qc(t);if(r.length!==0)return Object.fromEntries(r.map(t=>[t,s(i,e,t,n)]))},[n,i,e,s]);return t==null?null:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-element-sm`,children:[r&&(c?(0,$.jsxs)(Z,{as:`span`,variant:$u.MUTED,size:lu.XS,children:[r,`:`]}):(0,$.jsxs)(`span`,{className:`sr-only`,children:[r,`: `]})),n?(0,$.jsx)(Cj.Provider,{value:l,children:(0,$.jsx)(yk,{displayChromeMode:Ho.COMPACT,children:(0,$.jsx)(TR,{name:e,schema:n,value:t,enumLabels:u,parentData:a,disableInlineEdit:!0,className:`min-w-0 truncate text-sm text-muted-foreground`})})}):(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm text-muted-foreground`,children:String(t)})]})}function IG({item:e,resourceType:t,resourceConfig:n,registry:r,collectionContextResourceIdentifiers:i,summaryFields:a,fieldLabelsMap:o,tResourceFieldEnumValue:s,onItemClick:c,operationsSlot:l,cardActionPlacement:u,selectable:d=!1,isSelected:f=!1,onToggleSelect:p,selectionActive:m=!1,selectAriaLabel:h,className:g,interactiveClasses:_}){if(!n?.resourceFieldIdentifier)throw V.buildConfigurationError(ii.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:t,component:`ResourceListItemRenderer`});let v=n.resourceFieldIdentifier,y=V.getResourceObjectId(e,v),{t:b,formatDate:x,formatDateTime:S}=K({resource:t}),C=(0,Q.useMemo)(()=>{let n=V.computeFrontendResourceLabel({resourceType:t,registry:r,currentObject:e,t:b,formatDate:x,formatDateTime:S});return String(n||e[a[0]]||`${t} #${y}`)},[e,t,r,a,y,b,x,S]),w=(0,Q.useMemo)(()=>a.filter(t=>{let n=e[t];return lj(n)?String(n)!==C:!1}),[a,e,C]),T=(0,Q.useMemo)(()=>V.resolveRowSchema(n,e),[n,e]),E=(0,Q.useMemo)(()=>T?sr.getObjectLikeFieldShape(T,{commonOnly:!1})??null:null,[T]),D=Q.useContext(__),O=D?.UIConfig?.currentBreakpoint??ci.DESKTOP,k=nj(n?.frontendConfiguration?.layout?.defaultChromeMode?.summary,O),A=(0,Q.useMemo)(()=>fj(k,w.map(e=>{let t=E?.[e];return{schemaType:t?sc(t):void 0,present:!0,declaredChrome:t?nj(rl(t)?.chromeMode,O):void 0}})),[k,w,E,O]),j=n?.frontendConfiguration?.layout?.summary,M=_?.hover??``,N=_?.transition??``,P=MG(u),F=D?.UIConfig?.currentBreakpoint===ci.MOBILE,I=d&&m&&F,ee=hG(()=>p?.(e),{enabled:d&&!!p&&F}),L=!!c||I,R=()=>{ee.consumeLongPress()||(I?p?.(e):c?.(e))};return(0,$.jsxs)(`div`,{"data-slot":`resource-list-item`,className:U(`group/list-item`,CG,N,L&&`relative`,L&&M,L&&`cursor-pointer`,f&&`bg-primary/5`,d&&`select-none`,g),onClick:L?R:void 0,...ee.handlers,children:[L&&(0,$.jsx)(`button`,{type:`button`,"aria-label":String(C),className:U(`absolute inset-0 rounded-[inherit] outline-none`,Jg(x_.INSET)),onClick:e=>{e.stopPropagation(),R()}}),(0,$.jsxs)(`div`,{className:U(TG,L&&`relative`),children:[d&&(0,$.jsx)(`div`,{className:U(`shrink-0`,`pt-0.5`,!f&&!m&&`opacity-0 group-hover/list-item:opacity-100 group-focus-within/list-item:opacity-100 any-pointer-coarse:opacity-100 motion-safe:transition-opacity`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,$.jsx)(jI,{checked:f,onCheckedChange:()=>p?.(e),"aria-label":h??String(C)})}),(0,$.jsxs)(`div`,{className:U(P.containerClass,`min-w-0 flex-1`),children:[(0,$.jsx)(`div`,{className:U(`space-y-item-xs`,P.contentClass),children:j&&T?(0,$.jsx)(yG,{resourceType:t,schema:T,data:e,primaryLabel:C,contextResourceIdentifiers:i}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{as:`p`,className:`font-medium text-foreground`,truncate:!0,children:C}),w.length>0&&(0,$.jsx)(bG,{children:w.map((n,r)=>{let a=e[n];return(0,$.jsx)(FG,{fieldLabelVisible:A[r],fieldName:n,value:a,fieldSchema:E?.[n],fieldLabel:o[n],resourceType:t,record:e,collectionContextResourceIdentifiers:i,tResourceFieldEnumValue:s},n)})})]})}),l&&(0,$.jsx)(`div`,{className:P.actionsClass,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:l})]})]})]})}function LG({navigationZone:e,className:t}){let n=tS(),{tComponent:r}=K({component:J.RESOURCES_LAYOUTS_ACTION}),i=(0,Q.useCallback)(()=>{n.close()},[n]),a=n.target;return a?(0,$.jsx)(`div`,{"data-slot":`resource-in-place-operation`,className:U(`p-container`,t),children:(0,$.jsx)(vV,{resourceContext:a.resourceContext,navigationZone:e,onSuccess:i,onCancel:i,errorMessage:jp({tComponent:r,componentType:J.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),errorComponent:`ResourceInPlaceOperationRow`})}):null}var RG;(function(e){e.STRING=`string`,e.NUMBER=`number`,e.BOOLEAN=`boolean`,e.ENUM=`enum`,e.DATE=`date`,e.YEAR_MONTH=`yearMonth`,e.REFERENCE=`reference`,e.NUMBER_RANGE=`numberRange`,e.YEAR_MONTH_RANGE=`yearMonthRange`,e.UNKNOWN=`unknown`})(RG||={});var zG=new Set;function BG(e,t){return VG(e,t,yl)}function VG(e,t,n){if(!e)return zG;let r=new Set;for(let i of[e,...vl(t)]){let e=sr.getObjectLikeFieldShape(i,{commonOnly:!1});for(let[t,i]of Object.entries(e??{}))n(i)&&r.add(t)}return r.size>0?r:zG}var HG=class e{constructor(){}static detectSummaryFields(e){return V.detectSummaryFields(e)}static withoutPinnedFilterFields(e,t){return t?e.filter(e=>!Object.prototype.hasOwnProperty.call(t,e.fieldName)):[...e]}static withoutPresetsAssigningPinnedFields(e,t){return!e||!t?e?[...e]:void 0:e.filter(e=>!Object.keys(e.filters).some(e=>Object.prototype.hasOwnProperty.call(t,e)))}static withPinnedFilters(e,t){return{...e,...t??{}}}static variantKeyOf(e){let t=e?.variantKey;return typeof t==`string`&&t.length>0?t:null}static searchOperationAcceptsATerm(e){return!!e&&e.isSearchable!==!1}static listingOperationShown(e){return e.inlineSearchTerm&&e.searchOperation?e.searchOperation:e.listOperation}static matchListingOf(t){if(!Wu(t))return;let n=String(t.operationIdentifier),r=e.variantKeyOf(t);return{operation:n,...r?{variantKey:r}:{}}}static computeTransportPinnedFieldNames(e){let t=new Set,n=e.resourceConfig.resourcePrimaryScope,r=n?iu[n]:void 0;r&&t.add(r);let i=(`initiatorInfos`in e.operation?e.operation.initiatorInfos:void 0)??[];if(i.length>0){let n=V.selectOperationUrlInitiatorInfo({initiatorInfos:i,contextualParameters:e.contextualParameters,targetResourceType:e.resourceConfig.resourceIdentifier,targetDefaultFieldIdentifier:String(e.resourceConfig.resourceFieldIdentifier??``),parentResourcesRequirements:e.parentResourcesRequirements});for(let e of n?.parameters??[])t.add(e.fieldIdentifier)}return t}static parseFilterFieldDefinitions(t,n,r){if(!t||typeof t!=`object`)return[];let i=n?e.computeTransportPinnedFieldNames(n):void 0,a=n?.resourceConfig??r,o=VG(a?.mainSchema,a?.inheritenceSchemaDefinition,gt),s=[];for(let[e,r]of Object.entries(t)){if(typeof r==`function`||!r||typeof r!=`object`||i?.has(e)||e===`_id`)continue;let t=r,a=sc(t),c=RG.UNKNOWN;if(Iie(t)){s.push({fieldName:e,schema:t,fieldType:RG.NUMBER_RANGE,enumValues:void 0,referenceTargetResourceType:void 0});continue}if(une(t)){s.push({fieldName:e,schema:t,fieldType:RG.YEAR_MONTH_RANGE,enumValues:void 0,referenceTargetResourceType:void 0});continue}let l,u;switch(a){case bc.STRING:c=RG.STRING;break;case bc.NUMBER:case bc.BIGDECIMAL:c=RG.NUMBER;break;case bc.BOOLEAN:c=RG.BOOLEAN;break;case bc.ENUM:c=RG.ENUM;try{l=qc(Nr(t))}catch{l=[]}break;case bc.DATE:case bc.DATETIME:c=RG.DATE;break;default:c=RG.STRING}if(c===RG.STRING&&n){let t=n.registry.fieldIdentifierToResourceType?.[e];t&&(c=RG.REFERENCE,u=t)}c===RG.STRING&&(gt(t)||o.has(e))&&(c=RG.YEAR_MONTH),s.push({fieldName:e,schema:t,fieldType:c,enumValues:l,referenceTargetResourceType:u})}return s}},UG=new Set([W.LIST,W.SEARCH,W.COUNT]);function WG(e){let{parentRelationships:t,childRelationships:n,selfRelationships:r}=e.hostRelationships;return[...t,...n,...r].filter(t=>t.isDisabled!==!0&&(t.resourceType1===e.hostResourceType?t.resourceType2:t.resourceType1)===e.targetResourceType&&Nn.resolveForeignKeyHolderResourceType(t)===e.targetResourceType).map(t=>({relationship:t,foreignKeyField:Nn.tryResolveRelationshipForeignKeyIdentity(t,e.registry.allResourceFieldIdentifiers)?.fieldIdentifier})).filter(t=>e.selectedForeignKey===void 0||t.foreignKeyField===e.selectedForeignKey)}var GG;(function(e){e.NAMES_HOST=`names_host`,e.OTHER=`other`,e.NO_ROUTE=`no_route`})(GG||={});function KG(e){return qG(e)===GG.NAMES_HOST}function qG(e){let{childContext:t,hostResourceType:n,hostResourceId:r,registry:i,edgeForeignKeyFields:a}=e,o=t.operation.initiatorInfos??[],s=V.buildContextualParameters(t.contextResourceIdentifiers,i),c=V.selectOperationUrlInitiatorInfo({initiatorInfos:o,contextualParameters:s,targetResourceType:t.resourceType,targetDefaultFieldIdentifier:String(i.allResourceFieldIdentifiers[t.resourceType]??``),parentResourcesRequirements:t.parentResourcesRequirements});return c?c.parameters.some(e=>(e.resourceType===n||a.includes(e.fieldIdentifier))&&String(s[e.fieldIdentifier]??``)===r)?GG.NAMES_HOST:GG.OTHER:GG.NO_ROUTE}function JG(e,t){return V.buildConfigurationError(ii.CONFIGURATION,{message:e,component:`confineRelatedCollectionToHost`,...t})}function YG(e,t,n){let r=n.resourceConfigurations[t]?.operations??[];return new Set(Object.keys(VS(e,r)??{}))}function XG(e){let{childContext:t,hostResourceType:n,hostResourceId:r,edgeForeignKeyFields:i,registry:a}=e,o=t.resourceType,s=String(a.allResourceFieldIdentifiers[o]??``),c=[...t.operation.initiatorInfos??[]].sort((e,t)=>t.parameters.length-e.parameters.length||String(e.url??``).localeCompare(String(t.url??``))),l=V.buildContextualParameters(t.contextResourceIdentifiers,a),u=e=>(t.parentResourcesRequirements??[]).find(t=>t.resourceType===e);for(let e of c){let c=e.parameters.filter(e=>e.resourceType!==o||e.fieldIdentifier!==s),d=e=>i.length>0?i.includes(e.fieldIdentifier)||e.relationshipField!==void 0&&i.includes(e.relationshipField):e.resourceType===n;if(!c.some(d))continue;let f={...t.contextResourceIdentifiers},p=!0;for(let e of c){let t=l[e.fieldIdentifier],n=(typeof t==`string`||typeof t==`number`)&&String(t).length>0;if(d(e)){if(n&&String(t)!==r){p=!1;break}n||(f[e.fieldIdentifier]={fieldIdentifier:e.fieldIdentifier,resourceId:r})}else if(!n){p=!1;break}}if(!p)continue;let m=c.map((e,t)=>{let n=c[t+1]?.resourceType??o,r=u(e.resourceType);return{resourceType:e.resourceType,foreignKeyField:e.relationshipField,childResourceType:n,relationshipEdgeKey:V.buildRelationshipEdgeKey({parentResourceType:e.resourceType,childResourceType:n,foreignKeyField:e.relationshipField}),requirement:r?.requirement??uu.MANDATORY,isPrimaryScope:r?.isPrimaryScope??!1,...r?.primaryScope?{primaryScope:r.primaryScope}:{}}}),h={...t,contextResourceIdentifiers:f,parentResourcesRequirements:m};if(KG({childContext:h,hostResourceType:n,hostResourceId:r,registry:a,edgeForeignKeyFields:i}))return h}}function ZG(e){let{childContext:t,hostResourceId:n,callerPinnedFilters:r,registry:i}=e,{operation:a}=t,o=a.isBulkOperation===!0?void 0:ul(a);if(!o||!UG.has(o))return t;if(r&&Object.keys(r).length>0){let a=eK(t,r,i,$G.CALLER);if(!n)return a;try{return QG({...e,childContext:a,hostResourceId:n})}catch(e){if(e.wildoError?.context?.conflictingKey!==void 0)throw e;return a}}return n?QG({...e,hostResourceId:n}):t}function QG(e){let{childContext:t,hostResourceType:n,hostResourceId:r,hostRelationships:i,selectedForeignKey:a,registry:o}=e,{operation:s,resourceType:c}=t,l=i?WG({hostResourceType:n,hostRelationships:i,targetResourceType:c,selectedForeignKey:a,registry:o}):[];if(a!==void 0&&l.length===0)throw JG(`"${c}" is placed on a "${n}" record through \`viaForeignKey: { ${n}: '${a}' }\`, but no live relationship from "${n}" to "${c}" has that foreign key (a typo, a renamed or a disabled relationship), so nothing says which rows are this record's.`,{hostResourceType:n,targetResourceType:c,selectedForeignKey:a});if(l.some(e=>e.relationship.isPrimaryScope===!0))return t;let u=l.map(e=>e.foreignKeyField).filter(e=>!!e),d=qG({childContext:t,hostResourceType:n,hostResourceId:r,registry:o,edgeForeignKeyFields:u});if(d===GG.NAMES_HOST)return t;let f=l.length<=1?XG({childContext:t,hostResourceType:n,hostResourceId:r,edgeForeignKeyFields:u,registry:o}):void 0;if(f)return f;if(d===GG.NO_ROUTE)return t;if(l.length===0)throw JG(`"${c}" is embedded on a "${n}" record, but no relationship links the two and no route of its ${String(s.operationIdentifier)} names the record, so nothing says which rows are this record's. Relate the two resources, or pin the collection to the record on a filter its operation declares.`,{hostResourceType:n,targetResourceType:c,operationIdentifier:s.operationIdentifier});if(l.length>1)throw JG(`"${c}" is placed on a "${n}" record through ${l.length} relationships, and its ${String(s.operationIdentifier)} route names none of them, so the embed cannot tell which of the record's rows to list. Name the relationship with \`viaForeignKey: { ${n}: '<foreign key>' }\`.`,{hostResourceType:n,targetResourceType:c,foreignKeyFields:l.map(e=>e.foreignKeyField)});let p=l[0].foreignKeyField;if(!p)throw JG(`"${c}" is placed on a "${n}" record through a relationship whose foreign key cannot be resolved, and no route names the record, so nothing can confine it to this record's rows.`,{hostResourceType:n,targetResourceType:c});return eK(t,{[p]:r},o,$G.RELATIONSHIP,n)}var $G;(function(e){e.CALLER=`caller`,e.RELATIONSHIP=`relationship`})($G||={});function eK(e,t,n,r,i){let a=r===$G.CALLER?`the embed's own filter`:`the relationship's foreign key`,{operation:o,resourceType:s}=e;if(ul(o)===W.COUNT)throw JG(`"${s}"'s ${String(o.operationIdentifier)} can only be confined by a pinned filter (${a}), and a count is rendered without the pinned filters, so it would count every row the reader may read. Embed its LIST, or route the relationship under the record.`,{hostResourceType:i,targetResourceType:s,pins:Object.keys(t)});let c=YG(o,s,n),l=Object.keys(t).find(e=>!c.has(e));if(l!==void 0&&r===$G.CALLER)throw JG(`"${s}" is embedded with its own filter "${l}", which its ${String(o.operationIdentifier)} does not admit (it is not in the operation's filterFields), so the backend would drop it and list every row the reader may read. Declare "${l}" in the operation's filterFields, or confine the embed by a filter it declares.`,{targetResourceType:s,refusedKey:l,operationIdentifier:o.operationIdentifier});if(l!==void 0)throw JG(`"${s}"${i?` is placed on a "${i}" record, but the`:`'s`} ${String(o.operationIdentifier)} route its request would take does not name the record (the relationship is standalone, or its context policy is disabled, and no route under the record can be selected) and the operation does not admit "${l}" as a filter (${a}), so nothing can confine it to this record's rows: embedding it would list every row the reader may read. Declare "${l}" in the operation's filterFields (the embed then pins it to the record), or route the relationship under the record.`,{hostResourceType:i,targetResourceType:s,refusedKey:l,operationIdentifier:o.operationIdentifier});let u=Object.keys(t).find(n=>e.pinnedFilters?.[n]!==void 0&&e.pinnedFilters[n]!==t[n]);if(u!==void 0)throw JG(`"${s}" is pinned on "${u}" twice, to "${e.pinnedFilters?.[u]}" and to "${t[u]}", so the embed cannot tell which rows it lists.`,{hostResourceType:i,targetResourceType:s,conflictingKey:u});return{...e,pinnedFilters:{...e.pinnedFilters??{},...t}}}function tK(e){let{searchOperation:t}=e;if(!t)return!1;let n=Object.keys(e.pinnedFilters??{});if(n.length>0){let r=YG(t,e.resourceType,e.registry);if(!n.every(e=>r.has(e)))return!1}let r=t=>V.selectOperationUrlInitiatorInfo({initiatorInfos:t.initiatorInfos??[],contextualParameters:e.contextualParameters,targetResourceType:e.resourceType,targetDefaultFieldIdentifier:e.resourceFieldIdentifier,parentResourcesRequirements:e.parentResourcesRequirements}),i=r(e.listOperation);if(!i)return!0;let a=r(t);if(!a)return!1;let o=new Set(a.parameters.map(e=>e.fieldIdentifier));return i.parameters.every(e=>o.has(e.fieldIdentifier))}function nK(e){let t=e?.wildoError?.context?.message;return typeof t==`string`&&t.length>0?t:e instanceof Error?e.message:void 0}var rK=({pagination:e,onPaginationChange:t,className:n})=>{let{tComponent:r,isReady:i}=K({component:J.RESOURCES_LAYOUTS_PAGINATION}),a=(e.page-1)*e.limit+1,o=Math.min(e.page*e.limit,e.total),s=(0,Q.useCallback)(()=>{t(e=>({...e,page:e.page-1}))},[t]),c=(0,Q.useCallback)(()=>{t(e=>({...e,page:e.page+1}))},[t]);return e.total<=e.limit||!i?null:(0,$.jsxs)(`nav`,{"aria-label":r(J.RESOURCES_LAYOUTS_PAGINATION,`paginationLabel`),className:U(`flex items-center justify-between`,n),children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"aria-live":`polite`,children:r(J.RESOURCES_LAYOUTS_PAGINATION,`showing`,{from:a,to:o,total:e.total})}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.SM,disabled:e.page<=1,"aria-label":r(J.RESOURCES_LAYOUTS_PAGINATION,`previousPage`),onClick:s,children:r(J.RESOURCES_LAYOUTS_PAGINATION,`previous`)}),(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.SM,disabled:e.page>=e.totalPages,"aria-label":r(J.RESOURCES_LAYOUTS_PAGINATION,`nextPage`),onClick:c,children:r(J.RESOURCES_LAYOUTS_PAGINATION,`next`)})]})]})};function iK({preset:e=q.DEFAULT,...t}){let n=G(J.RESOURCES_LAYOUTS_PAGINATION,`ResourceLayout_Pagination`)(e);return(0,$.jsx)(n,{...t})}function aK(e,t){let n=oc();return km(n.interactiveState?.emptyDisplay)===`placeholder`&&oK(e,t)}function oK(e,t){return e?.primaryAction!==!1&&t}var sK=G(J.RESOURCES_LAYOUTS_EMPTY_STATE,`ResourceEmptyState`);function cK({resourceType:e,config:t,hasCreateOperation:n=!1,onCreateAction:r,variant:i=`default`,title:a,description:o,preset:s=q.DEFAULT}){let{tResourceEmptyState:c,tResourceOperation:l,tComponent:u,isReady:d}=K({component:[J.RESOURCES_LAYOUTS_EMPTY_STATE,J.RESOURCES_LAYOUTS_LIST],resource:e}),{activateFlow:f}=wU(),p=oc(),m=km(p.interactiveState?.emptyDisplay),h=(0,Q.useMemo)(()=>a||c(e,`title`)||jp({tComponent:u,componentType:J.RESOURCES_LAYOUTS_LIST,key:`noItems`}),[a,e,c,u]),g=(0,Q.useMemo)(()=>a?o:c(e,`description`),[a,o,e,c]),_=oK(t,n),v=(0,Q.useMemo)(()=>{if(_)return l(e,W.CREATE,`title`)},[_,e,l]),y=(0,Q.useMemo)(()=>{if(t?.icon)return t.icon},[t?.icon]),b=(0,Q.useMemo)(()=>{if(!t?.secondaryAction)return;let{type:n,target:r}=t.secondaryAction,i=c(e,`secondaryActionLabel`);if(n===Lr.LINK)return{label:i,onClick:()=>{window.open(r,`_blank`,`noopener,noreferrer`)}};if(n===Lr.GUIDANCE)return{label:i,onClick:()=>f(r)}},[t?.secondaryAction,e,c,f]),x=sK(s);return!d||m===`render-children`||foe(m)?null:(0,$.jsx)(x,{title:h,description:g,iconRef:y,primaryActionLabel:v,onPrimaryAction:_?r:void 0,showPrimaryAction:_,secondaryAction:b,variant:i,hidden:sm(m),style:sm(m)?{display:`none`}:void 0})}function lK(e){return e==null||e===``?!1:Array.isArray(e)?e.length>0:typeof e!=`object`||Object.keys(e).length>0}function uK(e){return e.isSearchActive||Object.values(e.filterValues).some(lK)}function dK(e){return!(e.hasLoadedOnce&&e.itemCount===0&&!e.isNarrowed&&e.emptyStateOffersCreate)}var fK=300;function pK({enabled:e,debounceMs:t=fK,onDebouncedChange:n}){let[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{let e=setTimeout(()=>{o(e=>(e!==r&&n?.(),r))},t);return()=>clearTimeout(e)},[r,t]);let s=(0,Q.useCallback)(e=>{i(e.target.value)},[]),c=(0,Q.useCallback)(()=>{i(``)},[]);return{query:r,debouncedQuery:a,isVisible:e,isActive:a.length>0,handleChange:s,handleClear:c}}var mK=({query:e,onChange:t,onClear:n,resourceType:r,autoFocus:i,onFocus:a,onBlur:o,onKeyDown:s})=>{let{tComponent:c,isReady:l}=K({component:J.RESOURCES_LAYOUTS_LIST}),{renderIcon:u}=Rf(),d=u(H.SEARCH,{size:fa.SM}),f=u(H.X_MARK,{size:fa.SM});if(!l)return null;let p=c(J.RESOURCES_LAYOUTS_LIST,`searchPlaceholder`);return(0,$.jsx)(iN,{type:`text`,value:e,onChange:t,placeholder:p,"aria-label":p,"data-slot":`collection-toolbar-search-input`,autoFocus:i,onFocus:a,onBlur:o,onKeyDown:s,prefix:d,suffix:e?(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.ICON_SM,onClick:n,"aria-label":c(J.RESOURCES_LAYOUTS_LIST,`clearSearch`),className:`me-1`,children:f}):void 0})};function hK(e){let{resolvedRegionalPreferences:t}=K(),{registry:n}=wm(),r=n.resourceConfigurations[e],i=r?.mainSchema,a=r?.inheritenceSchemaDefinition,o=(0,Q.useMemo)(()=>BG(i,a),[i,a]),s=t?.timezone,c=(0,Q.useContext)(_h)?.user?._id,l=(0,Q.useMemo)(()=>c?{userId:String(c)}:{},[c]);return(0,Q.useMemo)(()=>({timeZone:s,calendarDateFields:o,viewer:l}),[s,o,l])}var gK=864e5;function _K(e,t){return new Date(e.getTime()+t*gK)}function vK(e,t,n,r){let i=e=>n?e:yi.startOfZonedDay(e,r),a={};return e!==void 0&&(a.startDate=i(e)),t!==void 0&&(a.endDate=new Date(i(_K(t,1)).getTime()-1)),a}function yK(e){let t=e instanceof Date?e:typeof e==`string`&&e!==``?new Date(e):void 0;return t&&!Number.isNaN(t.getTime())?t:void 0}function bK(e,t,n){if(typeof e!=`object`||!e||e instanceof Date||Array.isArray(e))return;let r=e,i=yK(r.startDate),a=yK(r.endDate);if(!i&&!a)return;let o=e=>yi.calendarDateToday({timezone:t?`UTC`:n},e);return{firstDay:i?o(i):void 0,lastDay:a?o(a):void 0}}function xK(e){return typeof e==`string`&&on(e)!==void 0?e:void 0}function SK(e){let t=xK(e);if(t!==void 0)return{startMonth:t,endMonth:t};if(typeof e!=`object`||!e||Array.isArray(e))return{};let{startMonth:n,endMonth:r}=e,i=xK(n),a=xK(r);return{...i===void 0?{}:{startMonth:i},...a===void 0?{}:{endMonth:a}}}function CK(e,t,n){let r={...SK(e)},i=xK(n);return i===void 0?delete r[t]:r[t]=i,r.startMonth===void 0&&r.endMonth===void 0?void 0:r}var wK={[jc.TODAY]:e=>({firstDay:e,lastDay:e}),[jc.YESTERDAY]:e=>({firstDay:_K(e,-1),lastDay:_K(e,-1)}),[jc.LAST_7_DAYS]:e=>({firstDay:_K(e,-6),lastDay:e}),[jc.LAST_30_DAYS]:e=>({firstDay:_K(e,-29),lastDay:e}),[jc.THIS_MONTH]:e=>({firstDay:new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1)),lastDay:e}),[jc.THIS_YEAR]:e=>({firstDay:new Date(Date.UTC(e.getUTCFullYear(),0,1)),lastDay:e}),[jc.BEFORE_TODAY]:e=>({lastDay:_K(e,-1)}),[jc.BEFORE_NOW]:e=>({lastDay:_K(e,-1)}),[jc.NEXT_7_DAYS]:e=>({firstDay:e,lastDay:_K(e,6)}),[jc.NEXT_30_DAYS]:e=>({firstDay:e,lastDay:_K(e,29)})},TK=new Set([jc.BEFORE_NOW]),EK;(function(e){e.EXACT_BOUNDS=`exact_bounds`,e.ENDS_EARLIER_TODAY=`ends_earlier_today`})(EK||={});function DK(e,t,n,r){let i=r.calendarDateFields.has(t);return TK.has(e)&&!i?{window:{endDate:new Date(r.now.getTime())},readBack:EK.ENDS_EARLIER_TODAY}:{window:kK(wK[e](n),i,r.timeZone),readBack:EK.EXACT_BOUNDS}}function OK(e,t,n){if(!VK(e)||e.startDate!==void 0||e.endDate===void 0)return!1;let r=vK(t,void 0,!1,n.timeZone).startDate,i=e.endDate.getTime();return r!==void 0&&i>=r.getTime()&&i<=n.now.getTime()}function kK(e,t,n){return vK(e.firstDay,e.lastDay,t,n)}var AK={[ll.THIS_MONTH]:e=>({first:e,last:e}),[ll.LAST_MONTH]:e=>({first:e-1,last:e-1}),[ll.NEXT_MONTH]:e=>({first:e+1,last:e+1}),[ll.THIS_QUARTER]:e=>({first:e-e%3,last:e-e%3+2}),[ll.LAST_QUARTER]:e=>({first:e-e%3-3,last:e-e%3-1}),[ll.LAST_3_MONTHS]:e=>({first:e-2,last:e}),[ll.LAST_12_MONTHS]:e=>({first:e-11,last:e}),[ll.YEAR_TO_DATE]:e=>({first:e-e%12,last:e}),[ll.THIS_YEAR]:e=>({first:e-e%12,last:e-e%12+11})};function jK(e){return Vr(Math.floor(e/12),e%12+1)}function MK(e,t){let n=AK[e](t.getUTCFullYear()*12+t.getUTCMonth());return{startMonth:jK(n.first),endMonth:jK(n.last)}}var NK={[ts.CURRENT_USER]:e=>e.userId!==void 0&&e.userId.length>0?e.userId:void 0};function PK(e){return typeof e==`object`&&!!e&&`contextValue`in e}function FK(e){return typeof e==`object`&&!!e&&`relativeMonthRange`in e}function IK(e){return typeof e==`object`&&!!e&&`relativeRange`in e}function LK(e,t){let n=yi.calendarDateToday({timezone:t.timeZone},t.now),r={};for(let[i,a]of Object.entries(e.filters))if(IK(a))r[i]=DK(a.relativeRange,i,n,t).window;else if(FK(a))r[i]=MK(a.relativeMonthRange,n);else if(PK(a)){let e=NK[a.contextValue](t.viewer);if(e===void 0)return null;r[i]=e}else r[i]=a;return r}function RK(e,t){return Object.values(e.filters).every(e=>!PK(e)||NK[e.contextValue](t)!==void 0)}function zK(e,t){if(VK(t)){if(!VK(e))return!1;let n=(e,t)=>e===void 0?t===void 0:t!==void 0&&e.getTime()===t.getTime();return n(e.startDate,t.startDate)&&n(e.endDate,t.endDate)}if(HK(t))return HK(e)&&e.min===t.min&&e.max===t.max;if(BK(t)||BK(e)){let n=SK(e),r=SK(t);return(n.startMonth!==void 0||n.endMonth!==void 0)&&n.startMonth===r.startMonth&&n.endMonth===r.endMonth}return e===t}function BK(e){if(!e||typeof e!=`object`||Array.isArray(e)||e instanceof Date)return!1;let t=Object.entries(e).filter(([,e])=>e!==void 0);return t.length>0&&t.every(([e,t])=>(e===`startMonth`||e===`endMonth`)&&typeof t==`string`&&on(t)!==void 0)}function VK(e){if(!e||typeof e!=`object`||Array.isArray(e)||e instanceof Date)return!1;let t=Object.entries(e).filter(([,e])=>e!==void 0);return t.length>0&&t.every(([e,t])=>(e===`startDate`||e===`endDate`)&&t instanceof Date)}function HK(e){if(!e||typeof e!=`object`||Array.isArray(e)||e instanceof Date)return!1;let t=Object.keys(e);return t.length>0&&t.every(e=>e===`min`||e===`max`)}function UK(e,t,n){let r=LK(e,n);if(r===null)return!1;let i=Object.entries(r),a=yi.calendarDateToday({timezone:n.timeZone},n.now);return i.length>0&&i.every(([r,i])=>{let o=e.filters[r];return o!==void 0&&IK(o)&&DK(o.relativeRange,r,a,n).readBack===EK.ENDS_EARLIER_TODAY?OK(t[r],a,n):zK(t[r],i)})}function WK(e,t,n){let r=LK(e,n);if(r===null)return t;let i={...t};if(UK(e,t,n)){for(let e of Object.keys(r))delete i[e];return i}return{...i,...r}}function GK(e,t,n){let r=new Set;for(let i of e)if(UK(i,t,n))for(let e of Object.keys(i.filters))r.add(e);return r}var KK=/^(\d{4})-(\d{2})-(\d{2})$/;function qK(e,t){if(e instanceof Date)return Number.isNaN(e.getTime())?null:{date:e,calendarDate:t};if(typeof e!=`string`||e===``)return null;let n=KK.exec(e),r=n?new Date(Date.UTC(Number(n[1]),Number(n[2])-1,Number(n[3]))):new Date(e);return Number.isNaN(r.getTime())?null:{date:r,calendarDate:n!==null}}function JK(e,t,n=!1){let r=e=>t(e.date,{calendarDate:e.calendarDate});if(typeof e==`object`&&e&&!(e instanceof Date)){let t=e,i=qK(t.startDate,n),a=qK(t.endDate,n);if(!i&&!a)return null;if(i&&a){let e=r(i),t=r(a);return e===t?e:`${e} – ${t}`}return i?`≥ ${r(i)}`:`≤ ${r(a)}`}let i=qK(e,n);return i?r(i):null}var YK=({resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r,presetFilters:i,className:a})=>{let{tResourceFieldDisplay:o,tResourceFieldEnumValue:s,tComponent:c,formatDate:l,isReady:u}=K({component:J.RESOURCES_LAYOUTS_FILTERS,resource:e}),{renderIcon:d}=Rf(),f=e=>c(J.RESOURCES_LAYOUTS_FILTERS,e),p=hK(e),m=p.calendarDateFields,h=(0,Q.useMemo)(()=>{if(!i||i.length===0)return t;let e=GK(i,n,{now:new Date,...p});return t.filter(t=>!e.has(t.fieldName))},[t,i,n,p]),g=(0,Q.useMemo)(()=>h.filter(e=>{let t=n[e.fieldName];return t!=null&&t!==``}),[h,n]),_=(0,Q.useMemo)(()=>{let n={};for(let r of t){let t=o(e,r.fieldName,`label`);n[r.fieldName]=typeof t==`string`?t:r.fieldName}return n},[t,e,o]),v=(0,Q.useCallback)(()=>{let e={...n};for(let t of h)delete e[t.fieldName];r(e)},[n,h,r]),y=(0,Q.useCallback)(e=>{let t={...n};delete t[e],r(t)},[n,r]);if(!u||g.length===0)return null;let b=d(H.X_MARK,{size:fa.XS});return(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element-sm flex-wrap`,a),children:[g.map(t=>{let r=t.fieldName,i=n[r],a=_[r]||r,o=String(i);if(t.fieldType===RG.REFERENCE)o=(0,$.jsx)(XK,{field:t,value:String(i)});else if(t.fieldType===RG.ENUM){let n=s(e,r,String(i),t.schema);typeof n==`string`&&(o=n)}else if(t.fieldType===RG.BOOLEAN)o=f(i?`booleanYes`:`booleanNo`);else if(t.fieldType===RG.YEAR_MONTH){let e=l(String(i),{yearMonth:!0});e!==``&&(o=e)}else if(t.fieldType===RG.YEAR_MONTH_RANGE){let{startMonth:e,endMonth:t}=SK(i),n=e===void 0?``:l(e,{yearMonth:!0}),r=t===void 0?``:l(t,{yearMonth:!0});n!==``&&r!==``?o=e===t?n:`${n} – ${r}`:n===``?r!==``&&(o=`≤ ${r}`):o=`≥ ${n}`}else if(t.fieldType===RG.DATE){let e=JK(i,l,m.has(t.fieldName));e!==null&&(o=e)}else if(t.fieldType===RG.NUMBER_RANGE){let e=i??{};o=e.min!==void 0&&e.max!==void 0?`${e.min} – ${e.max}`:e.min===void 0?`≤ ${e.max}`:`≥ ${e.min}`}return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-element-xs ps-element-sm pe-element-xs py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[a,`:`]}),o,(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.ICON_SM,onClick:()=>y(r),className:`ms-0.5 h-4 w-4 p-0`,"aria-label":f(`removeFilter`),children:b})]},r)}),(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.SM,onClick:v,className:`text-xs text-muted-foreground`,children:f(`clearAll`)})]})},XK=({field:e,value:t})=>{let{getDisplayLabel:n,isLoadingCurrentValue:r}=TV({schema:e.schema,name:e.fieldName,value:t,targetResourceType:e.referenceTargetResourceType});return r?(0,$.jsx)($.Fragment,{children:`…`}):(0,$.jsx)($.Fragment,{children:n(t)})};function ZK(e,t){return(t?t.map(t=>e[t]):Object.values(e)).filter(e=>e!=null&&e!==``).length}var QK=`filters-panel`,$K=({activeCount:e,isExpanded:t,onToggle:n,className:r})=>{let{tComponent:i,isReady:a}=K({component:J.RESOURCES_LAYOUTS_FILTERS}),{renderIcon:o}=Rf();if(!a)return null;let s=(e=>i(J.RESOURCES_LAYOUTS_FILTERS,e))(`filters`);return(0,$.jsxs)(X,{variant:Y.GHOST,size:Xd.SM,onClick:n,"aria-expanded":t,"aria-controls":QK,"aria-label":s,title:s,"data-slot":`collection-toolbar-filters-trigger`,className:U(`gap-element-sm`,r),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:o(H.FILTER,{size:fa.SM})}),e>0&&(0,$.jsx)(`span`,{className:`inline-flex items-center justify-center min-w-5 h-5 px-element-xs text-xs font-semibold rounded-full bg-primary text-primary-foreground`,children:e})]})},eq=({resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r,className:i})=>{let{tResourceFieldDisplay:a,tResourceFieldEnumValue:o,tComponent:s,resolvedRegionalPreferences:c,isReady:l}=K({component:J.RESOURCES_LAYOUTS_FILTERS,resource:e}),{timeZone:u,calendarDateFields:d}=hK(e),f=e=>s(J.RESOURCES_LAYOUTS_FILTERS,e),p=(0,Q.useMemo)(()=>{let n={};for(let r of t){let t=a(e,r.fieldName,`label`);n[r.fieldName]=typeof t==`string`?t:r.fieldName}return n},[t,e,a]),m=(0,Q.useCallback)((e,t)=>{let i={...n};t===``||t==null?delete i[e]:i[e]=t,r(i)},[n,r]);return!l||t.length===0?null:(0,$.jsx)(`div`,{id:QK,className:U(`flex items-start gap-field flex-wrap p-card bg-muted/50 rounded-lg border border-border`,i),children:t.map(t=>(0,$.jsx)(`div`,{"data-filter-field":t.fieldName,className:`contents`,children:(0,$.jsx)(aq,{field:t,value:n[t.fieldName],label:p[t.fieldName],resourceType:e,onChange:e=>m(t.fieldName,e),tResourceFieldEnumValue:o,tc:f,calendarDateField:d.has(t.fieldName),timeZone:u,dateFormat:c?.dateFormat},t.fieldName)},t.fieldName))})},tq=({resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r,className:i})=>{let[a,o]=(0,Q.useState)(!1),s=ZK(n,t.map(e=>e.fieldName));return t.length===0?null:(0,$.jsxs)(`div`,{className:U(`space-y-element-sm`,i),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element-sm flex-wrap`,children:[(0,$.jsx)($K,{activeCount:s,isExpanded:a,onToggle:()=>o(e=>!e)}),(0,$.jsx)(YK,{resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r})]}),a&&(0,$.jsx)(eq,{resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r})]})},nq={[Da.TOGGLE]:Ml.TOGGLE,[Da.RADIO]:Ml.RADIO,[Da.SWITCH]:Ml.SELECT,[Da.CHECKBOX]:Ml.SELECT},rq;(function(e){e.ANY=``,e.YES=`true`,e.NO=`false`})(rq||={});function iq(e){return Rd(rq).enumUI({edit:{editMode:nq[ed(e)]}})}var aq=({field:e,value:t,label:n,resourceType:r,onChange:i,tResourceFieldEnumValue:a,tc:o,calendarDateField:s,timeZone:c,dateFormat:l})=>{let[u,d]=(0,Q.useState)(t??``),f=(0,Q.useRef)(void 0),p=(0,Q.useId)();(0,Q.useEffect)(()=>{d(t??``)},[t]);let m=(0,Q.useCallback)(e=>{let t=e.target.value;d(t),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{i(t||void 0)},400)},[i]),h=(0,Q.useCallback)(e=>{let t=e.target.value;d(t),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{i(t?Number(t):void 0)},400)},[i]);(0,Q.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]);let g=(0,Q.useMemo)(()=>iq(e.schema),[e.schema]);switch(e.fieldType){case RG.REFERENCE:return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[200px]`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(CI,{name:e.fieldName,schema:e.schema,value:typeof t==`string`&&t!==``?t:void 0,onChange:e=>i(typeof e==`string`&&e!==``?e:void 0),targetResourceType:e.referenceTargetResourceType,placeholder:o(`anyValue`),controlSize:rf.SM})]});case RG.STRING:return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[160px]`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(iN,{type:`text`,value:u,onChange:m})]});case RG.NUMBER:return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[120px]`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(iN,{type:`number`,value:u,onChange:h})]});case RG.BOOLEAN:{let r=[{value:rq.ANY,label:o(`booleanAny`)},{value:rq.YES,label:o(`booleanYes`)},{value:rq.NO,label:o(`booleanNo`)}];return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[100px]`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(lI,{name:e.fieldName,schema:g,options:r,value:t===void 0?rq.ANY:String(t),onChange:e=>i(e===rq.ANY?void 0:e===rq.YES),controlSize:rf.SM})]})}case RG.ENUM:{let s=[{value:``,label:o(`enumAll`)},...(e.enumValues??[]).map(t=>{let n=a(r,e.fieldName,t,e.schema);return{value:t,label:typeof n==`string`?n:t}})];return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[140px]`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(lI,{name:e.fieldName,schema:e.schema,options:s,value:t??``,onChange:e=>i(e||void 0),controlSize:rf.SM})]})}case RG.DATE:{let r=bK(t,s,c),a=r?{from:r.firstDay,to:r.lastDay}:void 0;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[200px]`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(gN,{name:e.fieldName,schema:e.schema,value:a,onChange:e=>{let t=e?.from??e?.to;i(t?vK(t,e?.to??t,s,c):void 0)},placeholder:o(`anyValue`),dateFormat:l,timeZone:c,controlSize:rf.SM})]})}case RG.YEAR_MONTH:return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[240px]`,children:[(0,$.jsx)(`label`,{id:p,className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(BI,{name:e.fieldName,schema:e.schema,value:typeof t==`string`?t:void 0,onChange:i,clearable:!0,labelledBy:p,controlId:`${p}-month`,monthPlaceholder:o(`anyValue`),controlSize:rf.SM})]});case RG.YEAR_MONTH_RANGE:{let r=SK(t),a=`${p}-start`,s=`${p}-end`;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[240px]`,children:[(0,$.jsx)(`label`,{id:p,className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(`span`,{id:a,className:`text-xs text-muted-foreground`,children:o(`monthRangeStart`)}),(0,$.jsx)(BI,{name:`${e.fieldName}.startMonth`,schema:e.schema,value:r.startMonth,onChange:e=>i(CK(t,`startMonth`,e)),clearable:!0,labelledBy:`${p} ${a}`,controlId:`${p}-start-month`,monthPlaceholder:o(`anyValue`),controlSize:rf.SM}),(0,$.jsx)(`span`,{id:s,className:`text-xs text-muted-foreground`,children:o(`monthRangeEnd`)}),(0,$.jsx)(BI,{name:`${e.fieldName}.endMonth`,schema:e.schema,value:r.endMonth,onChange:e=>i(CK(t,`endMonth`,e)),clearable:!0,labelledBy:`${p} ${s}`,controlId:`${p}-end-month`,monthPlaceholder:o(`anyValue`),controlSize:rf.SM})]})}case RG.NUMBER_RANGE:{let e=t??{},r=(t,n)=>{let r={...e,[t]:n===``?void 0:Number(n)};i(r.min!==void 0||r.max!==void 0?{...r.min===void 0?{}:{min:r.min},...r.max===void 0?{}:{max:r.max}}:void 0)};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[180px]`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsxs)(`div`,{className:`flex items-center gap-element-sm`,children:[(0,$.jsx)(iN,{type:`number`,"aria-label":o(`rangeMinimum`),placeholder:o(`rangeMinimum`),value:e.min??``,onChange:e=>r(`min`,e.target.value)}),(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:`–`}),(0,$.jsx)(iN,{type:`number`,"aria-label":o(`rangeMaximum`),placeholder:o(`rangeMaximum`),value:e.max??``,onChange:e=>r(`max`,e.target.value)})]})]})}default:return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs min-w-[160px]`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:n}),(0,$.jsx)(iN,{type:`text`,value:u,onChange:m})]})}},oq=`__wildo-quick-filter-all__`,sq=kd(),cq=`@max-[32rem]/collection-toolbar:hidden`,lq=`hidden @max-[32rem]/collection-toolbar:block`,uq=({resourceType:e,field:t,value:n,onChange:r,className:i})=>{let{tComponent:a,tResourceFieldDisplay:o,tResourceFieldEnumValue:s,isReady:c}=K({component:J.RESOURCES_LAYOUTS_FILTERS}),l=(0,Q.useCallback)(e=>{typeof e==`string`&&e!==``&&r(e===oq?void 0:e)},[r]);if(!c)return null;let u=t.enumValues??[];if(u.length===0)return null;let d=o(e,t.fieldName,`label`),f=a(J.RESOURCES_LAYOUTS_FILTERS,`enumAll`),p=a(J.RESOURCES_LAYOUTS_FILTERS,`quickFilterLabel`,{field:d}),m=[{value:oq,label:f},...u.map(n=>({value:n,label:s(e,t.fieldName,n,t.schema)}))],h=n??oq;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(MO,{type:kO.SINGLE,value:h,onValueChange:l,size:Xd.SM,rovingFocus:!0,loop:!0,className:U(`justify-start`,cq,i),"data-slot":`collection-quick-filter`,"aria-label":p,children:m.map(e=>(0,$.jsx)(NO,{value:e.value,size:Xd.SM,children:e.label},e.value))}),(0,$.jsx)(`div`,{className:U(lq,i),"data-slot":`collection-quick-filter-select`,children:(0,$.jsx)(bF,{name:`quick-filter-${t.fieldName}`,schema:sq,options:m,value:h,onChange:e=>l(e),"aria-label":p,size:rf.SM})})]})},dq=({resourceType:e,presets:t,currentFilters:n,onFiltersChange:r,className:i})=>{let{tResourceFilterPreset:a}=K({component:J.RESOURCES_LAYOUTS_FILTERS}),o=new Date,s=hK(e),c=(0,Q.useMemo)(()=>t.filter(e=>UK(e,n,{now:o,...s})).map(e=>e.ref),[t,n,s]),l=(0,Q.useCallback)(e=>{let i=Array.isArray(e)?e:[e],a=i.find(e=>!c.includes(e))??c.find(e=>!i.includes(e));if(!a)return;let o=t.find(e=>e.ref===a);o&&r(WK(o,n,{now:new Date,...s}))},[c,t,n,r,s]);return t.length===0?null:(0,$.jsx)(MO,{type:kO.MULTIPLE,appearance:AO.CHIPS,value:c,onValueChange:l,size:Xd.SM,orientation:Wl.HORIZONTAL,className:i,"data-slot":`collection-filter-presets`,children:t.map(t=>{let n=a(e,t.ref,`label`);return(0,$.jsx)(NO,{value:t.ref,size:Xd.SM,"data-preset":t.ref,disabled:!RK(t,s.viewer),children:n},t.ref)})})},fq=zs(J.LOW_LEVEL_POPOVER,`Popover`,[`Trigger`,`Content`,`Anchor`]);function pq({preset:e=q.DEFAULT,...t}){let n=fq(e);return(0,$.jsx)(n,{...t})}var mq=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=fq(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});mq.displayName=`PopoverTrigger`;var hq=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=fq(e);return(0,$.jsx)(r.Content,{...t,ref:n})});hq.displayName=`PopoverContent`;function gq({preset:e=q.DEFAULT,...t}){let n=fq(e);return(0,$.jsx)(n.Anchor,{...t})}function _q(e){if(e)return`translate3d(${Math.round(e.x)}px, ${Math.round(e.y)}px, 0)`}var vq={activationConstraint:{distance:8}},yq={coordinateGetter:gF};function bq({rule:e,index:t,reorderable:n,label:r,reorderLabel:i,ascLabel:a,descLabel:o,removeLabel:s,onToggleDirection:c,onRemove:l,renderIcon:u}){let{attributes:d,listeners:f,setNodeRef:p,transform:m,transition:h,isDragging:g}=mF({id:e.field,disabled:!n}),_=e.direction===`asc`,v={transform:_q(m),transition:h,opacity:g?.5:void 0,zIndex:g?10:void 0,position:`relative`};return(0,$.jsxs)(`div`,{ref:p,style:v,className:`flex items-center gap-element-sm rounded-md bg-muted/40 px-element-sm py-1`,children:[n&&(0,$.jsx)(`button`,{type:`button`,className:U(`shrink-0 cursor-grab touch-none rounded p-0.5 text-muted-foreground/60`,`hover:bg-accent/50 hover:text-muted-foreground`,Jg(x_.OFFSET),`active:cursor-grabbing`),"aria-label":i,...d,...f,children:u(H.GRIP_VERTICAL,{size:fa.SM})}),(0,$.jsx)(`span`,{className:`flex-1 truncate text-sm`,children:r}),(0,$.jsxs)(X,{type:`button`,variant:Y.OUTLINE,size:Xd.SM,onClick:()=>c(t),className:`h-6 gap-1 px-2 text-xs`,children:[u(_?H.CHEVRON_UP:H.CHEVRON_DOWN,{size:fa.XS}),_?a:o]}),(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.ICON_SM,className:`h-5 w-5 p-0 text-muted-foreground`,onClick:()=>l(t),"aria-label":s,children:u(H.X_MARK,{size:fa.XS})})]})}var xq=({resourceType:e,sortFields:t,currentSorts:n,onSortChange:r,className:i})=>{let{tResourceFieldDisplay:a,tComponent:o,isReady:s}=K({component:J.RESOURCES_LAYOUTS_LIST,resource:e}),{renderIcon:c}=Rf(),[l,u]=(0,Q.useState)(!1),d=iP(rP(IP,vq),rP(MP,yq)),f=(0,Q.useCallback)(t=>a(e,t,`label`),[a,e]),p=(0,Q.useMemo)(()=>t.filter(e=>!n.some(t=>t.field===e)),[t,n]),m=(0,Q.useMemo)(()=>n.map(e=>e.field),[n]),h=(0,Q.useCallback)(e=>{r(n.map((t,n)=>n===e?{...t,direction:t.direction===`asc`?`desc`:`asc`}:t))},[n,r]),g=(0,Q.useCallback)(e=>{r(n.filter((t,n)=>n!==e))},[n,r]),_=(0,Q.useCallback)(e=>{let{active:t,over:i}=e;if(i&&t.id!==i.id){let e=n.findIndex(e=>e.field===t.id),a=n.findIndex(e=>e.field===i.id);e!==-1&&a!==-1&&r(aF([...n],e,a))}},[n,r]),v=(0,Q.useCallback)(e=>{r([...n,{field:e,direction:`asc`}])},[n,r]),y=(0,Q.useCallback)(()=>r([]),[r]);if(t.length===0||!s)return null;let b=e=>o(J.RESOURCES_LAYOUTS_LIST,e),x=n.length,S=x>1,C=c(H.ARROWS_UP_DOWN,{size:fa.SM}),w=b(`sortAsc`),T=b(`sortDesc`),E=b(`removeSort`),D=b(`reorderSort`);return(0,$.jsxs)(pq,{open:l,onOpenChange:u,children:[(0,$.jsx)(mq,{asChild:!0,children:(0,$.jsxs)(X,{type:`button`,variant:Y.GHOST,size:Xd.SM,"aria-label":b(`sortLabel`),"data-slot":`collection-toolbar-sort-trigger`,className:U(`gap-1.5`,i),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:C}),(0,$.jsx)(`span`,{children:b(`sortLabel`)}),x>0&&(0,$.jsx)(`span`,{className:`inline-flex items-center justify-center min-w-5 h-5 px-1 text-xs font-semibold rounded-full bg-primary text-primary-foreground`,children:x})]})}),(0,$.jsxs)(hq,{align:Qu.START,className:`w-72 p-element-sm space-y-element-sm`,onInteractOutside:e=>{let t=e.detail.originalEvent?.type;t!==`pointerdown`&&t!==`mousedown`&&t!==`touchstart`&&t!==`click`&&e.preventDefault()},children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-element-sm`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:b(`sortLabel`)}),x>0&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.SM,onClick:y,className:`h-auto py-0.5 text-xs text-muted-foreground`,children:b(`clearSort`)})]}),(0,$.jsx)(rF,{sensors:d,collisionDetection:dP,onDragEnd:_,children:(0,$.jsx)(fF,{items:m,strategy:lF,children:(0,$.jsx)(`div`,{className:`space-y-element-sm`,children:n.map((e,t)=>(0,$.jsx)(bq,{rule:e,index:t,reorderable:S,label:f(e.field),reorderLabel:D,ascLabel:w,descLabel:T,removeLabel:E,onToggleDirection:h,onRemove:g,renderIcon:c},e.field))})})}),p.length>0&&(0,$.jsxs)(`div`,{className:`space-y-1 border-t border-border/50 pt-element-sm`,children:[(0,$.jsx)(`span`,{className:`px-element-sm text-xs text-muted-foreground`,children:b(`addSort`)}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1 px-element-sm`,children:p.map(e=>(0,$.jsxs)(X,{type:`button`,variant:Y.GHOST,size:Xd.SM,onClick:()=>v(e),className:`h-6 gap-1 px-2 text-xs`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:c(H.PLUS,{size:fa.XS})}),f(e)]},e))})]})]})]})},Sq=[{mode:au.CARDS,icon:H.VIEW_LIST,labelKey:`viewCards`},{mode:au.TABLE,icon:H.VIEW_TABLE,labelKey:`viewTable`},{mode:au.BOARD,icon:H.VIEW_BOARD,labelKey:`viewBoard`},{mode:au.CALENDAR,icon:H.VIEW_CALENDAR,labelKey:`viewCalendar`},{mode:au.TIMELINE,icon:H.VIEW_TIMELINE,labelKey:`viewTimeline`}],Cq=[au.CARDS,au.TABLE],wq=e=>Sq.some(t=>t.mode===e),Tq=({viewMode:e,onViewModeChange:t,availableModes:n=Cq,className:r})=>{let{tComponent:i,isReady:a}=K({component:J.RESOURCES_LAYOUTS_LIST}),{renderIcon:o}=Rf();if(!a)return null;let s=e=>i(J.RESOURCES_LAYOUTS_LIST,e);return(0,$.jsx)(MO,{type:kO.SINGLE,value:e,onValueChange:r=>{typeof r==`string`&&wq(r)&&n.includes(r)&&r!==e&&t(r)},size:Xd.SM,"aria-label":s(`viewModeLabel`),className:U(`shrink-0`,r),"data-slot":`collection-view-mode`,children:Sq.filter(({mode:e})=>n.includes(e)).map(({mode:e,icon:t,labelKey:n})=>{let r=s(n);return(0,$.jsx)(NO,{value:e,size:Xd.SM,"aria-label":r,title:r,children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:o(t,{size:fa.SM})})},e)})})};function Eq({count:e,onClear:t,matchAllOffer:n,isMatchAllSelected:r,className:i}){let{tComponent:a}=K({component:J.RESOURCES_LAYOUTS_LIST}),{renderIcon:o}=Rf();return(0,$.jsxs)(`div`,{className:U(`flex items-center gap-element-sm`,i),"data-slot":`collection-selection`,children:[(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:U(`text-sm font-medium text-muted-foreground whitespace-nowrap`,e===0&&`sr-only`),children:e>0?a(J.RESOURCES_LAYOUTS_LIST,r?`allMatchingSelected`:`selectedCount`,{count:e}):``}),n&&!r&&(0,$.jsx)(X,{type:`button`,variant:Y.LINK,size:Xd.SM,onClick:n.onSelectAllMatching,children:a(J.RESOURCES_LAYOUTS_LIST,`selectAllMatching`,{count:n.matchedCount})}),e>0&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.ICON_SM,onClick:t,"aria-label":a(J.RESOURCES_LAYOUTS_LIST,`clearSelection`),children:o(H.X_MARK,{size:fa.XS})})]})}function Dq(e,t){return e===0||t===0?!1:t>=e||`indeterminate`}function Oq({state:e,onToggle:t,className:n}){let{tComponent:r}=K({component:J.RESOURCES_LAYOUTS_LIST}),i=r(J.RESOURCES_LAYOUTS_LIST,`selectAll`);return(0,$.jsx)(`span`,{className:U(`inline-flex shrink-0 items-center`,EG,n),"data-slot":`collection-select-all`,title:i,children:(0,$.jsx)(jI,{checked:e,onCheckedChange:()=>t(),"aria-label":i})})}var kq;(function(e){e.LABELLED=`labelled`,e.ICONS=`icons`,e.CAPPED=`capped`})(kq||={});var Aq={[kq.LABELLED]:kq.ICONS,[kq.ICONS]:kq.CAPPED,[kq.CAPPED]:kq.CAPPED},jq=(0,Q.createContext)(null);function Mq({density:e,onActionSetChange:t,onBackgroundRunChange:n,children:r}){let i=(0,Q.useMemo)(()=>({density:e,reportActionSet:t,reportBackgroundRun:n}),[e,t,n]);return(0,$.jsx)(jq.Provider,{value:i,children:r})}function Nq(){return(0,Q.useContext)(jq)?.density??null}function Pq(e){let t=(0,Q.useContext)(jq)?.reportActionSet;(0,Q.useLayoutEffect)(()=>{t?.(e)},[t,e])}var Fq;(function(e){e.NONE=`none`,e.WORKING=`working`,e.FINISHED=`finished`})(Fq||={});function Iq(e){let t=(0,Q.useContext)(jq)?.reportBackgroundRun;(0,Q.useLayoutEffect)(()=>{t?.(e)},[t,e]),(0,Q.useLayoutEffect)(()=>()=>t?.(Fq.NONE),[t])}function Lq(e){let[t,n]=(0,Q.useState)(e);e&&!t&&n(!0);let[r,i]=(0,Q.useState)(Fq.NONE);return{isBulkBarMounted:e||t,backgroundRunState:r,onBackgroundRunChange:i}}function Rq(e,t){let[n,r]=(0,Q.useState)(kq.LABELLED),[i,a]=(0,Q.useState)(0),o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(null);return(0,Q.useLayoutEffect)(()=>{if(s===l.current)return;let e=l.current!==null;l.current=s,e&&r(kq.LABELLED)},[s]),(0,Q.useLayoutEffect)(()=>{if(!t){r(kq.LABELLED);return}let n=e.current;n&&n.scrollWidth>n.clientWidth+1&&r(e=>Aq[e])},[t,n,i,e]),(0,Q.useEffect)(()=>{let n=e.current;if(!t||!n||typeof ResizeObserver>`u`)return;let i=new ResizeObserver(()=>{let e=n.clientWidth;o.current!==null&&Math.abs(e-o.current)>1&&r(kq.LABELLED),o.current=e,a(e=>e+1)});if(typeof i?.observe==`function`){i.observe(n);for(let e of Array.from(n.children))i.observe(e);return()=>i.disconnect?.()}},[t,e]),(0,Q.useMemo)(()=>({density:n,reportActionSet:c}),[n])}var zq=`motion-safe:transition-[width] motion-safe:duration-[var(--motion-duration-normal)] motion-safe:ease-[var(--motion-easing-default)] motion-reduce:transition-none`,Bq=`@container/collection-toolbar`,Vq=`@max-[32rem]/collection-toolbar:order-last @max-[32rem]/collection-toolbar:basis-full`,Hq=`@max-[32rem]/collection-toolbar:hidden`,Uq;(function(e){e.REFINE=`refine`,e.SELECTION=`selection`})(Uq||={});var Wq=({resourceType:e,quickFilter:t,presetFilters:n,search:r,filterFields:i,filterPanel:a=Io.OFFERED,filterValues:o,onFiltersChange:s,sort:c,viewMode:l,primaryAction:u,selection:d,selectAll:f,bulkActions:p,collectionActions:m,className:h})=>{let[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),{tComponent:b}=K({component:J.RESOURCES_LAYOUTS_LIST}),{renderIcon:x}=Rf(),S=b(J.RESOURCES_LAYOUTS_LIST,`searchPlaceholder`),C=(0,Q.useCallback)(e=>{e.currentTarget.value||_(!1)},[]),w=(0,Q.useCallback)(e=>{e.key===`Escape`&&(r?.onClear(),_(!1),e.currentTarget.blur())},[r]),T=i.length>0,E=T&&a!==Io.HIDDEN,D=!!c&&c.sortFields.length>0,O=ZK(o,i.map(e=>e.fieldName)),k=!!r&&(g||!!r.query),A=!!d&&d.count>0,j=!!n&&n.length>0,M=(0,Q.useRef)(null),N=Rq(M,A),P=Lq(A);return(0,$.jsxs)(`div`,{className:U(Bq,`flex flex-col gap-element-sm`,h),"data-slot":`collection-toolbar`,children:[t&&(0,$.jsx)(uq,{resourceType:e,field:t.field,value:t.value,onChange:t.onChange}),(0,$.jsxs)(`div`,{ref:M,className:U(`flex items-center gap-element`,A?`flex-nowrap`:`flex-wrap`),"data-slot":`collection-toolbar-row`,"data-mode":A?Uq.SELECTION:Uq.REFINE,children:[f&&(0,$.jsx)(Oq,{state:f.state,onToggle:f.onToggle}),!A&&(0,$.jsxs)($.Fragment,{children:[r&&!k&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.ICON_SM,onClick:()=>_(!0),"aria-label":S,title:S,"data-slot":`collection-toolbar-search-trigger`,children:x(H.SEARCH,{size:fa.SM})}),r&&k&&(0,$.jsx)(`div`,{className:U(`overflow-hidden shrink-0 w-64 max-w-full`,zq),"data-state":`open`,children:(0,$.jsx)(mK,{query:r.query,onChange:r.onChange,onClear:r.onClear,resourceType:e,autoFocus:!0,onFocus:()=>_(!0),onBlur:C,onKeyDown:w})}),E&&(0,$.jsx)($K,{activeCount:O,isExpanded:v,onToggle:()=>y(e=>!e)}),D&&(0,$.jsx)(xq,{resourceType:e,sortFields:c.sortFields,currentSorts:c.sortStates,onSortChange:c.onSortChange}),j&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:U(`h-5 w-px bg-border`,Hq),"aria-hidden":`true`}),(0,$.jsx)(dq,{resourceType:e,presets:n,currentFilters:o,onFiltersChange:s,className:Vq})]})]}),d&&(0,$.jsx)(Eq,{className:`shrink-0`,count:d.count,onClear:d.onClear,...d.matchAllOffer?{matchAllOffer:d.matchAllOffer}:{},...d.isMatchAllSelected?{isMatchAllSelected:!0}:{}}),(l||u||p||m)&&(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-element ms-auto`,children:[l&&!A&&(0,$.jsx)(Tq,{viewMode:l.viewMode,onViewModeChange:l.onViewModeChange,availableModes:l.availableModes}),!A&&m,p&&P.isBulkBarMounted&&(0,$.jsx)(Mq,{density:N.density,onActionSetChange:N.reportActionSet,onBackgroundRunChange:P.onBackgroundRunChange,children:p}),!A&&P.backgroundRunState!==Fq.WORKING&&u]})]}),E&&v&&!A&&(0,$.jsx)(eq,{resourceType:e,filterFields:i,currentFilters:o,onFiltersChange:s}),T&&(0,$.jsx)(YK,{resourceType:e,filterFields:i,currentFilters:o,onFiltersChange:s,...n?{presetFilters:n}:{}})]})};function Gq(e,t){return typeof e==`function`?e(t):e}function Kq(e,t){return n=>{t.setState(t=>({...t,[e]:Gq(n,t[e])}))}}function qq(e){return e instanceof Function}function Jq(e){return Array.isArray(e)&&e.every(e=>typeof e==`number`)}function oge(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i!=null&&i.length&&r(i)})};return r(e),n}function Yq(e,t,n){let r=[],i;return a=>{let o;n.key&&n.debug&&(o=Date.now());let s=e(a);if(!(s.length!==r.length||s.some((e,t)=>r[t]!==e)))return i;r=s;let c;if(n.key&&n.debug&&(c=Date.now()),i=t(...s),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
|
|
13
|
-
font-size: .6rem;
|
|
14
|
-
font-weight: bold;
|
|
15
|
-
color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return i}}function Xq(e,t,n,r){return{debug:()=>e?.debugAll??e[t],key:!1,onChange:r}}function sge(e,t,n,r){let i={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:()=>i.getValue()??e.options.renderFallbackValue,getContext:Yq(()=>[e,n,t,i],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),Xq(e.options,`debugCells`,`cell.getContext`))};return e._features.forEach(r=>{r.createCell==null||r.createCell(i,n,t,e)},{}),i}function cge(e,t,n,r){let i={...e._getDefaultColumnDef(),...t},a=i.accessorKey,o=i.id??(a?typeof String.prototype.replaceAll==`function`?a.replaceAll(`.`,`_`):a.replace(/\./g,`_`):void 0)??(typeof i.header==`string`?i.header:void 0),s;if(i.accessorFn?s=i.accessorFn:a&&(s=a.includes(`.`)?e=>{let t=e;for(let e of a.split(`.`))t=t?.[e];return t}:e=>e[i.accessorKey]),!o)throw Error();let c={id:`${String(o)}`,accessorFn:s,parent:r,depth:n,columnDef:i,columns:[],getFlatColumns:Yq(()=>[!0],()=>[c,...c.columns?.flatMap(e=>e.getFlatColumns())],Xq(e.options,`debugColumns`,`column.getFlatColumns`)),getLeafColumns:Yq(()=>[e._getOrderColumnsFn()],e=>{var t;return(t=c.columns)!=null&&t.length?e(c.columns.flatMap(e=>e.getLeafColumns())):[c]},Xq(e.options,`debugColumns`,`column.getLeafColumns`))};for(let t of e._features)t.createColumn==null||t.createColumn(c,e);return c}var Zq=`debugHeaders`;function Qq(e,t,n){let r={id:n.id??t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(r),e},getContext:()=>({table:e,header:r,column:t})};return e._features.forEach(t=>{t.createHeader==null||t.createHeader(r,e)}),r}var lge={createTable:e=>{e.getHeaderGroups=Yq(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{let a=r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],o=i?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],s=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id)));return $q(t,[...a,...s,...o],e)},Xq(e.options,Zq,`getHeaderGroups`)),e.getCenterHeaderGroups=Yq(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id))),$q(t,n,e,`center`)),Xq(e.options,Zq,`getCenterHeaderGroups`)),e.getLeftHeaderGroups=Yq(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>$q(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`left`),Xq(e.options,Zq,`getLeftHeaderGroups`)),e.getRightHeaderGroups=Yq(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>$q(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`right`),Xq(e.options,Zq,`getRightHeaderGroups`)),e.getFooterGroups=Yq(()=>[e.getHeaderGroups()],e=>[...e].reverse(),Xq(e.options,Zq,`getFooterGroups`)),e.getLeftFooterGroups=Yq(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),Xq(e.options,Zq,`getLeftFooterGroups`)),e.getCenterFooterGroups=Yq(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),Xq(e.options,Zq,`getCenterFooterGroups`)),e.getRightFooterGroups=Yq(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),Xq(e.options,Zq,`getRightFooterGroups`)),e.getFlatHeaders=Yq(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),Xq(e.options,Zq,`getFlatHeaders`)),e.getLeftFlatHeaders=Yq(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),Xq(e.options,Zq,`getLeftFlatHeaders`)),e.getCenterFlatHeaders=Yq(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),Xq(e.options,Zq,`getCenterFlatHeaders`)),e.getRightFlatHeaders=Yq(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),Xq(e.options,Zq,`getRightFlatHeaders`)),e.getCenterLeafHeaders=Yq(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),Xq(e.options,Zq,`getCenterLeafHeaders`)),e.getLeftLeafHeaders=Yq(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),Xq(e.options,Zq,`getLeftLeafHeaders`)),e.getRightLeafHeaders=Yq(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),Xq(e.options,Zq,`getRightLeafHeaders`)),e.getLeafHeaders=Yq(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>[...e[0]?.headers??[],...t[0]?.headers??[],...n[0]?.headers??[]].map(e=>e.getLeafHeaders()).flat(),Xq(e.options,Zq,`getLeafHeaders`))}};function $q(e,t,n,r){let i=0,a=function(e,t){t===void 0&&(t=1),i=Math.max(i,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;(n=e.columns)!=null&&n.length&&a(e.columns,t+1)},0)};a(e);let o=[],s=(e,t)=>{let i={depth:t,id:[r,`${t}`].filter(Boolean).join(`_`),headers:[]},a=[];e.forEach(e=>{let o=[...a].reverse()[0],s=e.column.depth===i.depth,c,l=!1;if(s&&e.column.parent?c=e.column.parent:(c=e.column,l=!0),o&&o?.column===c)o.subHeaders.push(e);else{let i=Qq(n,c,{id:[r,t,c.id,e?.id].filter(Boolean).join(`_`),isPlaceholder:l,placeholderId:l?`${a.filter(e=>e.column===c).length}`:void 0,depth:t,index:a.length});i.subHeaders.push(e),a.push(i)}i.headers.push(e),e.headerGroup=i}),o.push(i),t>0&&s(a,t-1)};s(t.map((e,t)=>Qq(n,e,{depth:i,index:t})),i-1),o.reverse();let c=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,r=[0];e.subHeaders&&e.subHeaders.length?(r=[],c(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:i}=e;t+=n,r.push(i)})):t=1;let i=Math.min(...r);return n+=i,e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return c(o[0]?.headers??[]),o}var uge=(e,t,n,r,i,a,o)=>{let s={id:t,index:r,original:n,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(s._valuesCache.hasOwnProperty(t))return s._valuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return s._valuesCache[t]=n.accessorFn(s.original,r),s._valuesCache[t]},getUniqueValues:t=>{if(s._uniqueValuesCache.hasOwnProperty(t))return s._uniqueValuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return n.columnDef.getUniqueValues?(s._uniqueValuesCache[t]=n.columnDef.getUniqueValues(s.original,r),s._uniqueValuesCache[t]):(s._uniqueValuesCache[t]=[s.getValue(t)],s._uniqueValuesCache[t])},renderValue:t=>s.getValue(t)??e.options.renderFallbackValue,subRows:a??[],getLeafRows:()=>oge(s.subRows,e=>e.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let e=[],t=s;for(;;){let n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:Yq(()=>[e.getAllLeafColumns()],t=>t.map(t=>sge(e,s,t,t.id)),Xq(e.options,`debugRows`,`getAllCells`)),_getAllCellsByColumnId:Yq(()=>[s.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),Xq(e.options,`debugRows`,`getAllCellsByColumnId`))};for(let t=0;t<e._features.length;t++){let n=e._features[t];n==null||n.createRow==null||n.createRow(s,e)}return s},dge={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},eJ=(e,t,n)=>{var r,i;let a=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!((i=e.getValue(t))!=null&&(i=i.toString())!=null&&(i=i.toLowerCase())!=null&&i.includes(a))};eJ.autoRemove=e=>uJ(e);var tJ=(e,t,n)=>{var r;return!!((r=e.getValue(t))!=null&&(r=r.toString())!=null&&r.includes(n))};tJ.autoRemove=e=>uJ(e);var nJ=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};nJ.autoRemove=e=>uJ(e);var rJ=(e,t,n)=>e.getValue(t)?.includes(n);rJ.autoRemove=e=>uJ(e);var iJ=(e,t,n)=>!n.some(n=>{var r;return!((r=e.getValue(t))!=null&&r.includes(n))});iJ.autoRemove=e=>uJ(e)||!(e!=null&&e.length);var aJ=(e,t,n)=>n.some(n=>e.getValue(t)?.includes(n));aJ.autoRemove=e=>uJ(e)||!(e!=null&&e.length);var oJ=(e,t,n)=>e.getValue(t)===n;oJ.autoRemove=e=>uJ(e);var sJ=(e,t,n)=>e.getValue(t)==n;sJ.autoRemove=e=>uJ(e);var cJ=(e,t,n)=>{let[r,i]=n,a=e.getValue(t);return a>=r&&a<=i};cJ.resolveFilterValue=e=>{let[t,n]=e,r=typeof t==`number`?t:parseFloat(t),i=typeof n==`number`?n:parseFloat(n),a=t===null||Number.isNaN(r)?-1/0:r,o=n===null||Number.isNaN(i)?1/0:i;if(a>o){let e=a;a=o,o=e}return[a,o]},cJ.autoRemove=e=>uJ(e)||uJ(e[0])&&uJ(e[1]);var lJ={includesString:eJ,includesStringSensitive:tJ,equalsString:nJ,arrIncludes:rJ,arrIncludesAll:iJ,arrIncludesSome:aJ,equals:oJ,weakEquals:sJ,inNumberRange:cJ};function uJ(e){return e==null||e===``}var fge={getDefaultColumnDef:()=>({filterFn:`auto`}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Kq(`columnFilters`,e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);return typeof n==`string`?lJ.includesString:typeof n==`number`?lJ.inNumberRange:typeof n==`boolean`||typeof n==`object`&&n?lJ.equals:Array.isArray(n)?lJ.arrIncludes:lJ.weakEquals},e.getFilterFn=()=>qq(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn===`auto`?e.getAutoFilterFn():t.options.filterFns?.[e.columnDef.filterFn]??lJ[e.columnDef.filterFn],e.getCanFilter=()=>(e.columnDef.enableColumnFilter??!0)&&(t.options.enableColumnFilters??!0)&&(t.options.enableFilters??!0)&&!!e.accessorFn,e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(t=>t.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>t.getState().columnFilters?.findIndex(t=>t.id===e.id)??-1,e.setFilterValue=n=>{t.setColumnFilters(t=>{let r=e.getFilterFn(),i=t?.find(t=>t.id===e.id),a=Gq(n,i?i.value:void 0);if(dJ(r,a,e))return t?.filter(t=>t.id!==e.id)??[];let o={id:e.id,value:a};return i?t?.map(t=>t.id===e.id?o:t)??[]:t!=null&&t.length?[...t,o]:[o]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let n=e.getAllLeafColumns();e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(e=>Gq(t,e)?.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&dJ(t.getFilterFn(),e.value,t))}))},e.resetColumnFilters=t=>{e.setColumnFilters(t?[]:e.initialState?.columnFilters??[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function dJ(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||t===void 0||typeof t==`string`&&!t}var fJ={sum:(e,t,n)=>n.reduce((t,n)=>{let r=n.getValue(e);return t+(typeof r==`number`?r:0)},0),min:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r>n||r===void 0&&n>=n)&&(r=n)}),r},max:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r<n||r===void 0&&n>=n)&&(r=n)}),r},extent:(e,t,n)=>{let r,i;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r===void 0?n>=n&&(r=i=n):(r>n&&(r=n),i<n&&(i=n)))}),[r,i]},mean:(e,t)=>{let n=0,r=0;if(t.forEach(t=>{let i=t.getValue(e);i!=null&&(i=+i)>=i&&(++n,r+=i)}),n)return r/n},median:(e,t)=>{if(!t.length)return;let n=t.map(t=>t.getValue(e));if(!Jq(n))return;if(n.length===1)return n[0];let r=Math.floor(n.length/2),i=n.sort((e,t)=>e-t);return n.length%2==0?(i[r-1]+i[r])/2:i[r]},unique:(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount:(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count:(e,t)=>t.length},pge={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t;return((t=e.getValue())==null||t.toString==null?void 0:t.toString())??null},aggregationFn:`auto`}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Kq(`grouping`,e),groupedColumnMode:`reorder`}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(t=>t!==e.id):[...t??[],e.id])},e.getCanGroup=()=>(e.columnDef.enableGrouping??!0)&&(t.options.enableGrouping??!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue),e.getIsGrouped=()=>t.getState().grouping?.includes(e.id),e.getGroupedIndex=()=>t.getState().grouping?.indexOf(e.id),e.getToggleGroupingHandler=()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);if(typeof n==`number`)return fJ.sum;if(Object.prototype.toString.call(n)===`[object Date]`)return fJ.extent},e.getAggregationFn=()=>{if(!e)throw Error();return qq(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn===`auto`?e.getAutoAggregationFn():t.options.aggregationFns?.[e.columnDef.aggregationFn]??fJ[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{e.setGrouping(t?[]:e.initialState?.grouping??[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];let r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((t=n.subRows)!=null&&t.length)}}};function mge(e,t,n){if(!(t!=null&&t.length)||!n)return e;let r=e.filter(e=>!t.includes(e.id));return n===`remove`?r:[...t.map(t=>e.find(e=>e.id===t)).filter(Boolean),...r]}var hge={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Kq(`columnOrder`,e)}),createColumn:(e,t)=>{e.getIndex=Yq(e=>[vJ(t,e)],t=>t.findIndex(t=>t.id===e.id),Xq(t.options,`debugColumns`,`getIndex`)),e.getIsFirstColumn=n=>vJ(t,n)[0]?.id===e.id,e.getIsLastColumn=n=>{let r=vJ(t,n);return r[r.length-1]?.id===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{e.setColumnOrder(t?[]:e.initialState.columnOrder??[])},e._getOrderColumnsFn=Yq(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>r=>{let i=[];if(!(e!=null&&e.length))i=r;else{let t=[...e],n=[...r];for(;n.length&&t.length;){let e=t.shift(),r=n.findIndex(t=>t.id===e);r>-1&&i.push(n.splice(r,1)[0])}i=[...i,...n]}return mge(i,t,n)},Xq(e.options,`debugTable`,`_getOrderColumnsFn`))}},pJ=()=>({left:[],right:[]}),gge={getInitialState:e=>({columnPinning:pJ(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Kq(`columnPinning`,e)}),createColumn:(e,t)=>{e.pin=n=>{let r=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>n===`right`?{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:[...(e?.right??[]).filter(e=>!(r!=null&&r.includes(e))),...r]}:n===`left`?{left:[...(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),...r],right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))}:{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))})},e.getCanPin=()=>e.getLeafColumns().some(e=>(e.columnDef.enablePinning??!0)&&(t.options.enableColumnPinning??t.options.enablePinning??!0)),e.getIsPinned=()=>{let n=e.getLeafColumns().map(e=>e.id),{left:r,right:i}=t.getState().columnPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`left`:o?`right`:!1},e.getPinnedIndex=()=>{var n;let r=e.getIsPinned();return r?((n=t.getState().columnPinning)==null||(n=n[r])==null?void 0:n.indexOf(e.id))??-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=Yq(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.column.id))},Xq(t.options,`debugRows`,`getCenterVisibleCells`)),e.getLeftVisibleCells=Yq(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`left`})),Xq(t.options,`debugRows`,`getLeftVisibleCells`)),e.getRightVisibleCells=Yq(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`right`})),Xq(t.options,`debugRows`,`getRightVisibleCells`))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>e.setColumnPinning(t?pJ():e.initialState?.columnPinning??pJ()),e.getIsSomeColumnsPinned=t=>{let n=e.getState().columnPinning;return t?!!n[t]?.length:!!(n.left?.length||n.right?.length)},e.getLeftLeafColumns=Yq(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),Xq(e.options,`debugColumns`,`getLeftLeafColumns`)),e.getRightLeafColumns=Yq(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),Xq(e.options,`debugColumns`,`getRightLeafColumns`)),e.getCenterLeafColumns=Yq(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.id))},Xq(e.options,`debugColumns`,`getCenterLeafColumns`))}};function _ge(e){return e||(typeof document<`u`?document:null)}var mJ={size:150,minSize:20,maxSize:2**53-1},hJ=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),vge={getDefaultColumnDef:()=>mJ,getInitialState:e=>({columnSizing:{},columnSizingInfo:hJ(),...e}),getDefaultOptions:e=>({columnResizeMode:`onEnd`,columnResizeDirection:`ltr`,onColumnSizingChange:Kq(`columnSizing`,e),onColumnSizingInfoChange:Kq(`columnSizingInfo`,e)}),createColumn:(e,t)=>{e.getSize=()=>{let n=t.getState().columnSizing[e.id];return Math.min(Math.max(e.columnDef.minSize??mJ.minSize,n??e.columnDef.size??mJ.size),e.columnDef.maxSize??mJ.maxSize)},e.getStart=Yq(e=>[e,vJ(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),Xq(t.options,`debugColumns`,`getStart`)),e.getAfter=Yq(e=>[e,vJ(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),Xq(t.options,`debugColumns`,`getAfter`)),e.resetSize=()=>{t.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>(e.columnDef.enableResizing??!0)&&(t.options.enableColumnResizing??!0),e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0,n=e=>{e.subHeaders.length?e.subHeaders.forEach(n):t+=e.column.getSize()??0};return n(e),t},e.getStart=()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{let r=t.getColumn(e.column.id),i=r?.getCanResize();return a=>{if(!r||!i||(a.persist==null||a.persist(),_J(a)&&a.touches&&a.touches.length>1))return;let o=e.getSize(),s=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[r.id,r.getSize()]],c=_J(a)?Math.round(a.touches[0].clientX):a.clientX,l={},u=(e,n)=>{typeof n==`number`&&(t.setColumnSizingInfo(e=>{let r=t.options.columnResizeDirection===`rtl`?-1:1,i=(n-(e?.startOffset??0))*r,a=Math.max(i/(e?.startSize??0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;l[t]=Math.round(Math.max(n+n*a,0)*100)/100}),{...e,deltaOffset:i,deltaPercentage:a}}),(t.options.columnResizeMode===`onChange`||e===`end`)&&t.setColumnSizing(e=>({...e,...l})))},d=e=>u(`move`,e),f=e=>{u(`end`,e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=_ge(n),m={moveHandler:e=>d(e.clientX),upHandler:e=>{p?.removeEventListener(`mousemove`,m.moveHandler),p?.removeEventListener(`mouseup`,m.upHandler),f(e.clientX)}},h={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),d(e.touches[0].clientX),!1),upHandler:e=>{p?.removeEventListener(`touchmove`,h.moveHandler),p?.removeEventListener(`touchend`,h.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),f(e.touches[0]?.clientX)}},g=yge()?{passive:!1}:!1;_J(a)?(p?.addEventListener(`touchmove`,h.moveHandler,g),p?.addEventListener(`touchend`,h.upHandler,g)):(p?.addEventListener(`mousemove`,m.moveHandler,g),p?.addEventListener(`mouseup`,m.upHandler,g)),t.setColumnSizingInfo(e=>({...e,startOffset:c,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{e.setColumnSizing(t?{}:e.initialState.columnSizing??{})},e.resetHeaderSizeInfo=t=>{e.setColumnSizingInfo(t?hJ():e.initialState.columnSizingInfo??hJ())},e.getTotalSize=()=>e.getHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getLeftTotalSize=()=>e.getLeftHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getCenterTotalSize=()=>e.getCenterHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getRightTotalSize=()=>e.getRightHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0}},gJ=null;function yge(){if(typeof gJ==`boolean`)return gJ;let e=!1;try{let t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener(`test`,n,t),window.removeEventListener(`test`,n)}catch{e=!1}return gJ=e,gJ}function _J(e){return e.type===`touchstart`}var bge={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Kq(`columnVisibility`,e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{let n=e.columns;return(n.length?n.some(e=>e.getIsVisible()):t.getState().columnVisibility?.[e.id])??!0},e.getCanHide=()=>(e.columnDef.enableHiding??!0)&&(t.options.enableHiding??!0),e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Yq(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),Xq(t.options,`debugRows`,`_getAllVisibleCells`)),e.getVisibleCells=Yq(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],Xq(t.options,`debugRows`,`getVisibleCells`))},createTable:e=>{let t=(t,n)=>Yq(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join(`_`)],e=>e.filter(e=>e.getIsVisible==null?void 0:e.getIsVisible()),Xq(e.options,`debugColumns`,t));e.getVisibleFlatColumns=t(`getVisibleFlatColumns`,()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t(`getVisibleLeafColumns`,()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t(`getLeftVisibleLeafColumns`,()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t(`getRightVisibleLeafColumns`,()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t(`getCenterVisibleLeafColumns`,()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{e.setColumnVisibility(t?{}:e.initialState.columnVisibility??{})},e.toggleAllColumnsVisible=t=>{t??=!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(n.getCanHide!=null&&n.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(e=>!(e.getIsVisible!=null&&e.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(e=>e.getIsVisible==null?void 0:e.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{e.toggleAllColumnsVisible(t.target?.checked)}}};function vJ(e,t){return t?t===`center`?e.getCenterVisibleLeafColumns():t===`left`?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var xge={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,`__global__`),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,`__global__`),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,`__global__`),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},Sge={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Kq(`globalFilter`,e),globalFilterFn:`auto`,getColumnCanGlobalFilter:t=>{var n;let r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r==`string`||typeof r==`number`}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>(e.columnDef.enableGlobalFilter??!0)&&(t.options.enableGlobalFilter??!0)&&(t.options.enableFilters??!0)&&((t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))??!0)&&!!e.accessorFn},createTable:e=>{e.getGlobalAutoFilterFn=()=>lJ.includesString,e.getGlobalFilterFn=()=>{let{globalFilterFn:t}=e.options;return qq(t)?t:t===`auto`?e.getGlobalAutoFilterFn():e.options.filterFns?.[t]??lJ[t]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},Cge={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Kq(`expanded`,e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{if(!t)e._queue(()=>{t=!0});else if(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=t=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{t??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{e.setExpanded(t?{}:e.initialState?.expanded??{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(e=>e.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>t=>{t.persist==null||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let t=e.getState().expanded;return t===!0||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{let t=e.getState().expanded;return typeof t==`boolean`?t===!0:!(!Object.keys(t).length||e.getRowModel().flatRows.some(e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{let n=e.split(`.`);t=Math.max(t,n.length)}),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{let i=r===!0||!!(r!=null&&r[e.id]),a={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(e=>{a[e]=!0}):a=r,n??=!i,!i&&n)return{...a,[e.id]:!0};if(i&&!n){let{[e.id]:t,...n}=a;return n}return r})},e.getIsExpanded=()=>{let n=t.getState().expanded;return!!((t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))??(n===!0||n?.[e.id]))},e.getCanExpand=()=>{var n;return(t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))??((t.options.enableExpanding??!0)&&!!((n=e.subRows)!=null&&n.length))},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},yJ=0,bJ=10,xJ=()=>({pageIndex:yJ,pageSize:bJ}),wge={getInitialState:e=>({...e,pagination:{...xJ(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:Kq(`pagination`,e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{if(!t)e._queue(()=>{t=!0});else if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=t=>e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(e=>Gq(t,e)),e.resetPagination=t=>{e.setPagination(t?xJ():e.initialState.pagination??xJ())},e.setPageIndex=t=>{e.setPagination(n=>{let r=Gq(t,n.pageIndex),i=e.options.pageCount===void 0||e.options.pageCount===-1?2**53-1:e.options.pageCount-1;return r=Math.max(0,Math.min(r,i)),{...n,pageIndex:r}})},e.resetPageIndex=t=>{var n;e.setPageIndex(t?yJ:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageIndex)??yJ)},e.resetPageSize=t=>{var n;e.setPageSize(t?bJ:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageSize)??bJ)},e.setPageSize=t=>{e.setPagination(e=>{let n=Math.max(1,Gq(t,e.pageSize)),r=e.pageSize*e.pageIndex,i=Math.floor(r/n);return{...e,pageIndex:i,pageSize:n}})},e.setPageCount=t=>e.setPagination(n=>{let r=Gq(t,e.options.pageCount??-1);return typeof r==`number`&&(r=Math.max(-1,r)),{...n,pageCount:r}}),e.getPageOptions=Yq(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},Xq(e.options,`debugTable`,`getPageOptions`)),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return n===-1||n!==0&&t<n-1},e.previousPage=()=>e.setPageIndex(e=>e-1),e.nextPage=()=>e.setPageIndex(e=>e+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>e.options.pageCount??Math.ceil(e.getRowCount()/e.getState().pagination.pageSize),e.getRowCount=()=>e.options.rowCount??e.getPrePaginationRowModel().rows.length}},SJ=()=>({top:[],bottom:[]}),Tge={getInitialState:e=>({rowPinning:SJ(),...e}),getDefaultOptions:e=>({onRowPinningChange:Kq(`rowPinning`,e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{let a=r?e.getLeafRows().map(e=>{let{id:t}=e;return t}):[],o=i?e.getParentRows().map(e=>{let{id:t}=e;return t}):[],s=new Set([...o,e.id,...a]);t.setRowPinning(e=>n===`bottom`?{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:[...(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)]}:n===`top`?{top:[...(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)],bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))}:{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))})},e.getCanPin=()=>{let{enableRowPinning:n,enablePinning:r}=t.options;return typeof n==`function`?n(e):n??r??!0},e.getIsPinned=()=>{let n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`top`:o?`bottom`:!1},e.getPinnedIndex=()=>{let n=e.getIsPinned();return n?((n===`top`?t.getTopRows():t.getBottomRows())?.map(e=>{let{id:t}=e;return t}))?.indexOf(e.id)??-1:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>e.setRowPinning(t?SJ():e.initialState?.rowPinning??SJ()),e.getIsSomeRowsPinned=t=>{let n=e.getState().rowPinning;return t?!!n[t]?.length:!!(n.top?.length||n.bottom?.length)},e._getPinnedRows=(t,n,r)=>(e.options.keepPinnedRows??!0?(n??[]).map(t=>{let n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null}):(n??[]).map(e=>t.find(t=>t.id===e))).filter(Boolean).map(e=>({...e,position:r})),e.getTopRows=Yq(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,`top`),Xq(e.options,`debugRows`,`getTopRows`)),e.getBottomRows=Yq(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,`bottom`),Xq(e.options,`debugRows`,`getBottomRows`)),e.getCenterRows=Yq(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(e,t,n)=>{let r=new Set([...t??[],...n??[]]);return e.filter(e=>!r.has(e.id))},Xq(e.options,`debugRows`,`getCenterRows`))}},Ege={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Kq(`rowSelection`,e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>e.setRowSelection(t?{}:e.initialState.rowSelection??{}),e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=t===void 0?!e.getIsAllRowsSelected():t;let r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(e=>{e.getCanSelect()&&(r[e.id]=!0)}):i.forEach(e=>{delete r[e.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{let r=t===void 0?!e.getIsAllPageRowsSelected():t,i={...n};return e.getRowModel().rows.forEach(t=>{CJ(i,t.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Yq(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?wJ(e,n):{rows:[],flatRows:[],rowsById:{}},Xq(e.options,`debugTable`,`getSelectedRowModel`)),e.getFilteredSelectedRowModel=Yq(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?wJ(e,n):{rows:[],flatRows:[],rowsById:{}},Xq(e.options,`debugTable`,`getFilteredSelectedRowModel`)),e.getGroupedSelectedRowModel=Yq(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?wJ(e,n):{rows:[],flatRows:[],rowsById:{}},Xq(e.options,`debugTable`,`getGroupedSelectedRowModel`)),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState(),r=!!(t.length&&Object.keys(n).length);return r&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter(e=>e.getCanSelect()),{rowSelection:n}=e.getState(),r=!!t.length;return r&&t.some(e=>!n[e.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{let t=Object.keys(e.getState().rowSelection??{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.filter(e=>e.getCanSelect()).some(e=>e.getIsSelected()||e.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{let i=e.getIsSelected();t.setRowSelection(a=>{if(n=n===void 0?!i:n,e.getCanSelect()&&i===n)return a;let o={...a};return CJ(o,e.id,n,r?.selectChildren??!0,t),o})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return TJ(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return EJ(e,n)===`some`},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return EJ(e,n)===`all`},e.getCanSelect=()=>typeof t.options.enableRowSelection==`function`?t.options.enableRowSelection(e):t.options.enableRowSelection??!0,e.getCanSelectSubRows=()=>typeof t.options.enableSubRowSelection==`function`?t.options.enableSubRowSelection(e):t.options.enableSubRowSelection??!0,e.getCanMultiSelect=()=>typeof t.options.enableMultiRowSelection==`function`?t.options.enableMultiRowSelection(e):t.options.enableMultiRowSelection??!0,e.getToggleSelectedHandler=()=>{let t=e.getCanSelect();return n=>{t&&e.toggleSelected(n.target?.checked)}}}},CJ=(e,t,n,r,i)=>{var a;let o=i.getRow(t,!0);n?(o.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),o.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(a=o.subRows)!=null&&a.length&&o.getCanSelectSubRows()&&o.subRows.forEach(t=>CJ(e,t.id,n,r,i))};function wJ(e,t){let n=e.getState().rowSelection,r=[],i={},a=function(e,t){return e.map(e=>{var t;let o=TJ(e,n);if(o&&(r.push(e),i[e.id]=e),(t=e.subRows)!=null&&t.length&&(e={...e,subRows:a(e.subRows)}),o)return e}).filter(Boolean)};return{rows:a(t.rows),flatRows:r,rowsById:i}}function TJ(e,t){return t[e.id]??!1}function EJ(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let i=!0,a=!1;return e.subRows.forEach(e=>{if((!a||i)&&(e.getCanSelect()&&(TJ(e,t)?a=!0:i=!1),e.subRows&&e.subRows.length)){let n=EJ(e,t);n===`all`?a=!0:(n===`some`&&(a=!0),i=!1)}}),i?`all`:a?`some`:!1}var DJ=/([0-9]+)/gm,Dge=(e,t,n)=>AJ(kJ(e.getValue(n)).toLowerCase(),kJ(t.getValue(n)).toLowerCase()),Oge=(e,t,n)=>AJ(kJ(e.getValue(n)),kJ(t.getValue(n))),kge=(e,t,n)=>OJ(kJ(e.getValue(n)).toLowerCase(),kJ(t.getValue(n)).toLowerCase()),Age=(e,t,n)=>OJ(kJ(e.getValue(n)),kJ(t.getValue(n))),jge=(e,t,n)=>{let r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},Mge=(e,t,n)=>OJ(e.getValue(n),t.getValue(n));function OJ(e,t){return e===t?0:e>t?1:-1}function kJ(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function AJ(e,t){let n=e.split(DJ).filter(Boolean),r=t.split(DJ).filter(Boolean);for(;n.length&&r.length;){let e=n.shift(),t=r.shift(),i=parseInt(e,10),a=parseInt(t,10),o=[i,a].sort();if(isNaN(o[0])){if(e>t)return 1;if(t>e)return-1}else{if(isNaN(o[1]))return isNaN(i)?-1:1;if(i>a)return 1;if(a>i)return-1}}return n.length-r.length}var jJ={alphanumeric:Dge,alphanumericCaseSensitive:Oge,text:kge,textCaseSensitive:Age,datetime:jge,basic:Mge},Nge=[lge,bge,hge,gge,dge,fge,xge,Sge,{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:`auto`,sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Kq(`sorting`,e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let n=t.getFilteredRowModel().flatRows.slice(10),r=!1;for(let t of n){let n=t?.getValue(e.id);if(Object.prototype.toString.call(n)===`[object Date]`)return jJ.datetime;if(typeof n==`string`&&(r=!0,n.split(DJ).length>1))return jJ.alphanumeric}return r?jJ.text:jJ.basic},e.getAutoSortDir=()=>typeof t.getFilteredRowModel().flatRows[0]?.getValue(e.id)==`string`?`asc`:`desc`,e.getSortingFn=()=>{if(!e)throw Error();return qq(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn===`auto`?e.getAutoSortingFn():t.options.sortingFns?.[e.columnDef.sortingFn]??jJ[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{let i=e.getNextSortingOrder(),a=n!=null;t.setSorting(o=>{let s=o?.find(t=>t.id===e.id),c=o?.findIndex(t=>t.id===e.id),l=[],u,d=a?n:i===`desc`;return u=o!=null&&o.length&&e.getCanMultiSort()&&r?s?`toggle`:`add`:o!=null&&o.length&&c!==o.length-1?`replace`:s?`toggle`:`replace`,u===`toggle`&&(a||i||(u=`remove`)),u===`add`?(l=[...o,{id:e.id,desc:d}],l.splice(0,l.length-(t.options.maxMultiSortColCount??2**53-1))):l=u===`toggle`?o.map(t=>t.id===e.id?{...t,desc:d}:t):u===`remove`?o.filter(t=>t.id!==e.id):[{id:e.id,desc:d}],l})},e.getFirstSortDir=()=>e.columnDef.sortDescFirst??t.options.sortDescFirst??e.getAutoSortDir()===`desc`?`desc`:`asc`,e.getNextSortingOrder=n=>{let r=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==r&&(t.options.enableSortingRemoval??!0)&&(!n||(t.options.enableMultiRemove??!0))?!1:i===`desc`?`asc`:`desc`:r},e.getCanSort=()=>(e.columnDef.enableSorting??!0)&&(t.options.enableSorting??!0)&&!!e.accessorFn,e.getCanMultiSort=()=>e.columnDef.enableMultiSort??t.options.enableMultiSort??!!e.accessorFn,e.getIsSorted=()=>{let n=t.getState().sorting?.find(t=>t.id===e.id);return n?n.desc?`desc`:`asc`:!1},e.getSortIndex=()=>t.getState().sorting?.findIndex(t=>t.id===e.id)??-1,e.clearSorting=()=>{t.setSorting(t=>t!=null&&t.length?t.filter(t=>t.id!==e.id):[])},e.getToggleSortingHandler=()=>{let n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{e.setSorting(t?[]:e.initialState?.sorting??[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},pge,Cge,wge,Tge,Ege,vge];function Pge(e){let t=[...Nge,...e._features??[]],n={_features:t},r=n._features.reduce((e,t)=>Object.assign(e,t.getDefaultOptions==null?void 0:t.getDefaultOptions(n)),{}),i=e=>n.options.mergeOptions?n.options.mergeOptions(r,e):{...r,...e},a={...e.initialState??{}};n._features.forEach(e=>{a=(e.getInitialState==null?void 0:e.getInitialState(a))??a});let o=[],s=!1,c={_features:t,options:{...r,...e},initialState:a,_queue:e=>{o.push(e),s||(s=!0,Promise.resolve().then(()=>{for(;o.length;)o.shift()();s=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{n.setState(n.initialState)},setOptions:e=>{let t=Gq(e,n.options);n.options=i(t)},getState:()=>n.options.state,setState:e=>{n.options.onStateChange==null||n.options.onStateChange(e)},_getRowId:(e,t,r)=>(n.options.getRowId==null?void 0:n.options.getRowId(e,t,r))??`${r?[r.id,t].join(`.`):t}`,getCoreRowModel:()=>(n._getCoreRowModel||=n.options.getCoreRowModel(n),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:(e,t)=>{let r=(t?n.getPrePaginationRowModel():n.getRowModel()).rowsById[e];if(!r&&(r=n.getCoreRowModel().rowsById[e],!r))throw Error();return r},_getDefaultColumnDef:Yq(()=>[n.options.defaultColumn],e=>(e??={},{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t;return((t=e.renderValue())==null||t.toString==null?void 0:t.toString())??null},...n._features.reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef==null?void 0:t.getDefaultColumnDef()),{}),...e}),Xq(e,`debugColumns`,`_getDefaultColumnDef`)),_getColumnDefs:()=>n.options.columns,getAllColumns:Yq(()=>[n._getColumnDefs()],e=>{let t=function(e,r,i){return i===void 0&&(i=0),e.map(e=>{let a=cge(n,e,i,r),o=e;return a.columns=o.columns?t(o.columns,a,i+1):[],a})};return t(e)},Xq(e,`debugColumns`,`getAllColumns`)),getAllFlatColumns:Yq(()=>[n.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),Xq(e,`debugColumns`,`getAllFlatColumns`)),_getAllFlatColumnsById:Yq(()=>[n.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),Xq(e,`debugColumns`,`getAllFlatColumnsById`)),getAllLeafColumns:Yq(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),Xq(e,`debugColumns`,`getAllLeafColumns`)),getColumn:e=>n._getAllFlatColumnsById()[e]};Object.assign(n,c);for(let e=0;e<n._features.length;e++){let t=n._features[e];t==null||t.createTable==null||t.createTable(n)}return n}function Fge(){return e=>Yq(()=>[e.options.data],t=>{let n={rows:[],flatRows:[],rowsById:{}},r=function(t,i,a){i===void 0&&(i=0);let o=[];for(let c=0;c<t.length;c++){let l=uge(e,e._getRowId(t[c],c,a),t[c],c,i,void 0,a?.id);if(n.flatRows.push(l),n.rowsById[l.id]=l,o.push(l),e.options.getSubRows){var s;l.originalSubRows=e.options.getSubRows(t[c],c),(s=l.originalSubRows)!=null&&s.length&&(l.subRows=r(l.originalSubRows,i+1,l))}}return o};return n.rows=r(t),n},Xq(e.options,`debugTable`,`getRowModel`,()=>e._autoResetPageIndex()))}function Ige(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=Q.useState(()=>({current:Pge(t)})),[r,i]=Q.useState(()=>n.current.initialState);return n.current.setOptions(t=>({...t,...e,state:{...r,...e.state},onStateChange:t=>{i(t),e.onStateChange==null||e.onStateChange(t)}})),n.current}var MJ=zs(J.LOW_LEVEL_TABLE,`Table`,[`Header`,`Body`,`Footer`,`Row`,`Head`,`Cell`,`Caption`]);function NJ({preset:e=q.DEFAULT,...t}){let n=MJ(e);return(0,$.jsx)(n,{...t})}function PJ({preset:e=q.DEFAULT,...t}){let n=MJ(e);return(0,$.jsx)(n.Header,{...t})}function FJ({preset:e=q.DEFAULT,...t}){let n=MJ(e);return(0,$.jsx)(n.Body,{...t})}function Lge({preset:e=q.DEFAULT,...t}){let n=MJ(e);return(0,$.jsx)(n.Footer,{...t})}function IJ({preset:e=q.DEFAULT,...t}){let n=MJ(e);return(0,$.jsx)(n.Row,{...t})}function LJ({preset:e=q.DEFAULT,...t}){let n=MJ(e);return(0,$.jsx)(n.Head,{...t})}function RJ({preset:e=q.DEFAULT,...t}){let n=MJ(e);return(0,$.jsx)(n.Cell,{...t})}function Rge({preset:e=q.DEFAULT,...t}){let n=MJ(e);return(0,$.jsx)(n.Caption,{...t})}function zJ(e,t){return e===void 0?null:typeof e==`function`?e(t):e}var zge=({items:e,resourceType:t,resourceConfig:n,navigationZone:r,summaryFields:i,contextResourceIdentifiers:a,fieldLabelsMap:o,sortFields:s,sortStates:c,onSortChange:l,selectable:u=!1,isRowSelected:d,onToggleRow:f,allSelected:p=!1,onToggleAll:m,renderRowActions:h,onRowClick:g,canOpenRow:_})=>{let{tComponent:v,tResourceFieldEnumValue:y}=K({component:J.RESOURCES_LAYOUTS_LIST,resource:t}),{renderIcon:b}=Rf(),x=tS(),{getRecipe:S}=e_(),C=S(wi.INTERACTIVE,dd.GHOST),w=S(wi.TYPOGRAPHY,Lu.EYEBROW),T=(0,Q.useMemo)(()=>V.resolveFieldShapeOfAnyVariant(n)??null,[n]),E=(0,Q.useMemo)(()=>new Set(s),[s]),D=Ige({data:e,columns:(0,Q.useMemo)(()=>{let e=[];u&&e.push({id:`__select`,header:()=>(0,$.jsx)(jI,{checked:p,onCheckedChange:()=>m?.(),"aria-label":v(J.RESOURCES_LAYOUTS_LIST,`selectAll`)}),cell:({row:e})=>(0,$.jsx)(jI,{checked:d?.(e.original)??!1,onCheckedChange:()=>f?.(e.original),"aria-label":v(J.RESOURCES_LAYOUTS_LIST,`selectRow`,{row:e.index+1})}),size:40,enableSorting:!1});for(let n of i){let r=T?.[n],i=E.has(n),s=o[n]||n;e.push({id:n,accessorFn:e=>e[n],header:()=>{if(!i)return(0,$.jsx)(`span`,{children:s});let e=c.findIndex(e=>e.field===n),t=e>=0,r=t?c[e].direction:null;return(0,$.jsxs)(X,{type:`button`,variant:Y.GHOST,size:Xd.SM,className:`inline-flex items-center gap-1 text-start -ms-2 h-auto py-0.5 px-2 font-medium`,onClick:()=>{e<0?l([...c,{field:n,direction:`asc`}]):c[e].direction===`asc`?l(c.map((t,n)=>n===e?{...t,direction:`desc`}:t)):l(c.filter((t,n)=>n!==e))},children:[s,t&&(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-muted-foreground`,"aria-hidden":`true`,children:[b(r===`asc`?H.CHEVRON_UP:H.CHEVRON_DOWN,{size:fa.XS}),c.length>1&&(0,$.jsx)(`span`,{className:`text-[10px] font-semibold tabular-nums`,children:e+1})]})]})},cell:({row:e})=>(0,$.jsx)(FG,{value:e.original[n],fieldSchema:r,fieldLabel:void 0,resourceType:t,record:e.original,collectionContextResourceIdentifiers:a,fieldName:n,tResourceFieldEnumValue:y})})}return h&&e.push({id:`__actions`,header:()=>(0,$.jsx)(`span`,{className:`sr-only`,children:v(J.RESOURCES_LAYOUTS_LIST,`actionsColumn`)}),cell:({row:e})=>(0,$.jsx)(`div`,{className:`flex justify-end`,children:h(e.original)}),enableSorting:!1}),e},[u,p,m,d,f,h,i,a,T,E,o,c,l,t,y,v,b]),getCoreRowModel:Fge(),getRowId:(e,t)=>String(e.id??e._id??t),manualSorting:!0});return(0,$.jsx)($.Fragment,{children:(0,$.jsx)(`div`,{className:`rounded-lg border border-border overflow-hidden`,children:(0,$.jsx)(`div`,{className:`overflow-x-auto`,children:(0,$.jsxs)(`table`,{"data-slot":`table`,className:`w-full text-sm tabular-nums`,"aria-label":v(J.RESOURCES_LAYOUTS_LIST,`listLabel`),children:[(0,$.jsx)(`thead`,{className:`bg-muted/50 border-b border-border`,children:D.getHeaderGroups().map(e=>(0,$.jsx)(`tr`,{children:e.headers.map(e=>(0,$.jsx)(`th`,{className:U(`px-card-sm py-element-sm text-start`,w.base),style:{width:e.getSize()===150?void 0:e.getSize()},children:e.isPlaceholder?null:zJ(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,$.jsx)(`tbody`,{className:`divide-y divide-border`,children:D.getRowModel().rows.map(e=>{let t=V.getResourceObjectId(e.original,n.resourceFieldIdentifier);if(x.isElementActive(t))return(0,$.jsx)(`tr`,{role:`row`,children:(0,$.jsx)(`td`,{colSpan:e.getVisibleCells().length,className:`p-0`,children:(0,$.jsx)(LG,{navigationZone:r})})},e.id);let i=!_||_(e.original);return(0,$.jsx)(`tr`,{"data-slot":`resource-list-item`,className:U(i&&(C.states.hover||`hover:bg-muted/30`),`transition-colors motion-reduce:transition-none`,i&&`cursor-pointer`,i&&Jg(x_.INSET),d?.(e.original)&&`bg-primary/5`),onClick:i?()=>g(e.original):void 0,role:`row`,"aria-selected":u?d?.(e.original)??!1:void 0,tabIndex:i?0:void 0,onKeyDown:i?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),g(e.original))}:void 0,children:e.getVisibleCells().map(e=>{let t=e.column.id===`__select`||e.column.id===`__actions`;return(0,$.jsx)(RJ,{className:`px-card-sm py-element-sm text-foreground`,truncate:!t,onClick:t?e=>e.stopPropagation():void 0,onKeyDown:t?e=>e.stopPropagation():void 0,children:zJ(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)})})]})})})})},Bge=`__wildo-board-ungrouped__`;function Vge(e){let{vocabulary:t,labelOf:n,pages:r,collectionTotal:i}=e;if(t.length===0)return null;let a=t.map(e=>{let t=r.get(e);return{key:e,value:e,label:n(e),items:t?.items??[],total:t?.total??0,loading:!t||t.loading,failed:t?.failed??!1}}),o=a.every(e=>!e.loading&&!e.failed)&&i!==void 0?i-a.reduce((e,t)=>e+t.total,0):0;return o>0&&a.push({key:Bge,value:null,label:null,items:[],total:o,loading:!1,failed:!1}),a}function Hge(e,t){if(t===void 0)return[];let n=e.filter(e=>e.isBulkOperation!==!0);if(typeof t==`string`)return n.filter(e=>String(e.operationIdentifier)===t);let[r,i]=t;return n.filter(e=>String(e.operationIdentifier)===r&&e.variantKey===i)}function Uge(e,t){if(e.length===0)return;let n=t(e);return n.find(e=>e.isOperationDefault===!0)??n[0]}function Wge(e,t){return{[e]:t}}async function Gge(e){let t=Wge(e.groupByField,e.targetValue);try{await e.call(t)}catch(t){return e.reportRefusal(t),!1}return e.applyMove(t),!0}function Kge(e,t,n){let r=e.filter(e=>e.value!==null),i=r.findIndex(e=>e.value===t);if(i!==-1)return r[i+n]?.value??void 0}var BJ=`application/x-wildo-board-card`,qge=[];function Jge(e,t){let n=e?.operations??qge,r=iC(n,{currentObject:t,resourceType:e?.resourceType,subjectDataMode:e?.subjectDataMode,organizationId:e?.organizationId});return Uge(n.filter(e=>r.get(QS(e))?.isEnabled===!0),e=>Pc(e))}function Yge({item:e,index:t,itemId:n,columnValue:r,transition:i,isMoving:a,hintId:o,renderCard:s,onDragStart:c,onDragEnd:l,onKeyboardMove:u}){let d=Jge(i,e),f=d!==void 0&&!a;return(0,$.jsx)(`li`,{className:U(`list-none rounded-md border bg-background`,f&&`cursor-grab`,a&&`opacity-60`),"data-board-card":n,"data-board-card-movable":f?`true`:void 0,draggable:f,tabIndex:f?0:void 0,"aria-describedby":f?o:void 0,"aria-busy":a?!0:void 0,onDragStart:e=>{!f||!d?e.preventDefault():(e.dataTransfer.setData(BJ,n),e.dataTransfer.effectAllowed=`move`,c(n,r,d))},onDragEnd:l,onKeyDown:t=>{if(!f||!d||t.target!==t.currentTarget)return;let n=t.key===`ArrowRight`?1:t.key===`ArrowLeft`?-1:0;n!==0&&(t.preventDefault(),u(e,r,n,d))},children:s(e,t)})}function Xge({columns:e,onLoadMore:t,loadMoreLabel:n,columnLoadFailedLabel:r,ungroupedNote:i,renderCard:a,getItemId:o,transition:s,onMoveItem:c,boardLabel:l,ungroupedLabel:u,columnCountLabel:d,moveHint:f}){let p=(0,Q.useId)(),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),b=(0,Q.useCallback)(t=>{for(let n of e){let e=n.items.find(e=>o(e)===t);if(e)return e}},[e,o]),x=(0,Q.useCallback)(async(e,t,n)=>{y(o(e));try{await c(e,t,n)}finally{y(null)}},[o,c]),S=(0,Q.useCallback)(()=>{h(null),_(null)},[]),C=(0,Q.useCallback)((t,n,r,i)=>{let a=Kge(e,n,r);a!==void 0&&x(t,a,i)},[e,x]),w=0;return(0,$.jsxs)(`div`,{role:`group`,"aria-label":l,className:`flex gap-group overflow-x-auto pb-item-sm`,"data-slot":`collection-board`,children:[(0,$.jsx)(`span`,{id:p,className:`sr-only`,children:f}),e.map(e=>{let c=e.value!==null&&m!==null&&m.fromValue!==e.value,l=c&&g===e.value,f=e.label??u;return(0,$.jsxs)(`section`,{"aria-label":f,"data-board-column":e.key,"data-drop-target":l?`true`:void 0,className:U(`flex w-72 shrink-0 flex-col gap-item-sm rounded-lg border bg-muted/20 p-item-sm`,l&&`border-primary bg-muted/40`),onDragOver:t=>{c&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,g!==e.value&&_(e.value))},onDragLeave:t=>{t.currentTarget.contains(t.relatedTarget)||g===e.value&&_(null)},onDrop:t=>{if(!c||e.value===null)return;t.preventDefault();let n=t.dataTransfer.getData(BJ)||m?.itemId,r=m?.itemId===n?m?.operation:void 0;S();let i=n?b(n):void 0;i&&r&&x(i,e.value,r)},children:[(0,$.jsxs)(`header`,{className:`flex items-baseline justify-between gap-item-sm px-item-xs`,children:[(0,$.jsx)(`h3`,{className:`truncate text-xs font-medium text-muted-foreground`,children:f}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.failed?null:d(e.total)})]}),e.value===null&&(0,$.jsx)(`p`,{className:`px-item-xs text-xs text-muted-foreground`,children:i(e.total)}),e.failed&&(0,$.jsx)(`p`,{role:`alert`,className:`px-item-xs text-xs text-destructive`,children:r}),(0,$.jsx)(`ul`,{role:`list`,"aria-label":f,"aria-busy":e.loading?!0:void 0,className:`flex min-h-16 flex-col gap-item-sm`,children:e.items.map(t=>{let n=w++,r=o(t);return(0,$.jsx)(Yge,{item:t,index:n,itemId:r,columnValue:e.value,transition:s,isMoving:v===r,hintId:p,renderCard:a,onDragStart:(e,t,n)=>h({itemId:e,fromValue:t,operation:n}),onDragEnd:S,onKeyboardMove:C},r||n)})}),e.value!==null&&!e.failed&&e.items.length<e.total&&(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.SM,disabled:e.loading,"data-board-load-more":e.key,onClick:()=>t(e.value),children:n(e.total-e.items.length)})]},e.key)})]})}function VJ(e){return e.toISOString().slice(0,10)}function HJ(e){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1))}function UJ(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+t,1))}function WJ(e){return VJ(e).slice(0,7)}function Zge(e){try{let t=new Intl.Locale(e||`en`),n=t.getWeekInfo?.().firstDay??t.weekInfo?.firstDay;if(typeof n==`number`&&n>=1&&n<=7)return n%7}catch{}return 1}function Qge(e,t){let n=HJ(e),r=(n.getUTCDay()-t+7)%7,i=_K(UJ(n,1),-1),a=[],o=_K(n,-r);for(;o.getTime()<=i.getTime();){let e=[];for(let t=0;t<7;t++)e.push({day:o,key:VJ(o),inMonth:o.getUTCMonth()===n.getUTCMonth()}),o=_K(o,1);a.push(e)}return a}function $ge(e){let t=e[0],n=e[e.length-1];return{firstDay:t[0].day,lastDay:n[n.length-1].day}}function GJ(e,t,n){let r=e instanceof Date?e:typeof e==`string`||typeof e==`number`?new Date(e):void 0;if(r&&!Number.isNaN(r.getTime()))return yi.calendarDateToday({timezone:t?`UTC`:n},r)}function e_e(e){let t=new Map;for(let n of e.items){let r=GJ(n[e.dateField],e.calendarField,e.timeZone);if(!r)continue;let i=VJ(r),a=t.get(i);a?a.push(n):t.set(i,[n])}return t}function t_e(e,t,n){return vK(e.firstDay,e.lastDay,t,n)}function KJ(e){let t=e instanceof Date?e:typeof e==`string`&&e!==``?new Date(e):void 0;return t&&!Number.isNaN(t.getTime())?t:void 0}function n_e(e,t){if(typeof e!=`object`||!e||e instanceof Date||Array.isArray(e))return{...t};let n=e,r=[KJ(n.startDate),t.startDate].filter(e=>e!==void 0),i=[KJ(n.endDate),t.endDate].filter(e=>e!==void 0),a={};return r.length>0&&(a.startDate=new Date(Math.max(...r.map(e=>e.getTime())))),i.length>0&&(a.endDate=new Date(Math.min(...i.map(e=>e.getTime())))),a}function r_e(e,t){if(!t||Object.keys(t).length===0)return e;let n={...e};for(let[r,i]of Object.entries(t))n[r]=n_e(e[r],i);return n}function i_e(e){switch(e){case`ArrowLeft`:return{days:-1};case`ArrowRight`:return{days:1};case`ArrowUp`:return{days:-7};case`ArrowDown`:return{days:7};case`PageUp`:return{months:-1};case`PageDown`:return{months:1};case`Home`:return{weekEdge:`start`};case`End`:return{weekEdge:`end`};default:return}}function a_e(e,t,n){if(`days`in t)return _K(e,t.days);if(`months`in t){let n=UJ(HJ(e),t.months),r=_K(UJ(n,1),-1).getUTCDate();return new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),Math.min(e.getUTCDate(),r)))}let r=(e.getUTCDay()-n+7)%7;return t.weekEdge===`start`?_K(e,-r):_K(e,6-r)}var o_e=[];function s_e({weeks:e,itemsByDay:t,month:n,today:r,firstDayOfWeek:i,onMonthChange:a,monthHeading:o,weekdayLabels:s,dayNumberLabel:c,dayLabel:l,getItemId:u,getItemLabel:d,canOpenItem:f,onOpenItem:p,calendarLabel:m,previousMonthLabel:h,nextMonthLabel:g,todayLabel:_,keyboardHint:v}){let y=(0,Q.useId)(),b=(0,Q.useId)(),{renderIcon:x}=Rf(),S=(0,Q.useRef)(null),[C,w]=(0,Q.useState)(()=>HJ(r).getTime()===HJ(n).getTime()?r:HJ(n)),T=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{w(e=>HJ(e).getTime()===HJ(n).getTime()?e:HJ(n))},[n]);let E=VJ(C);(0,Q.useEffect)(()=>{T.current&&(T.current=!1,S.current?.querySelector(`[data-calendar-day="${E}"]`)?.focus())},[E,e]);let D=(0,Q.useCallback)(e=>{T.current=!0,w(e);let t=HJ(e);t.getTime()!==HJ(n).getTime()&&a(t)},[n,a]),O=(e,t)=>{if(e.target!==e.currentTarget)return;let n=i_e(e.key);n&&(e.preventDefault(),D(a_e(t,n,i)))},k=VJ(r);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-sm`,"data-slot":`collection-calendar`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-item-sm`,children:[(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.ICON_SM,"aria-label":h,title:h,onClick:()=>a(UJ(n,-1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:x(H.CHEVRON_LEFT,{size:fa.SM})})}),(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.ICON_SM,"aria-label":g,title:g,onClick:()=>a(UJ(n,1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:x(H.CHEVRON_RIGHT,{size:fa.SM})})}),(0,$.jsx)(`h3`,{id:b,className:`text-sm font-medium`,"aria-live":`polite`,children:o}),(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.SM,className:`ms-auto`,onClick:()=>D(r),children:_})]}),(0,$.jsx)(`span`,{id:y,className:`sr-only`,children:v}),(0,$.jsxs)(`table`,{ref:S,role:`grid`,"aria-label":m,"aria-describedby":y,className:`w-full table-fixed border-collapse`,children:[(0,$.jsx)(`caption`,{className:`sr-only`,children:o}),(0,$.jsx)(`thead`,{children:(0,$.jsx)(`tr`,{children:s.map((e,t)=>(0,$.jsx)(`th`,{scope:`col`,className:`pb-item-xs text-xs font-medium text-muted-foreground`,children:e},t))})}),(0,$.jsx)(`tbody`,{children:e.map(e=>(0,$.jsx)(`tr`,{children:e.map(({day:e,key:n,inMonth:r})=>{let i=t.get(n)??o_e,a=n===E;return(0,$.jsxs)(`td`,{role:`gridcell`,"data-calendar-day":n,"data-in-month":r?`true`:void 0,"data-today":n===k?`true`:void 0,"aria-label":l(e,i.length),"aria-current":n===k?`date`:void 0,tabIndex:a?0:-1,onKeyDown:t=>O(t,e),onFocus:t=>{t.target===t.currentTarget&&!a&&w(e)},className:U(`h-24 border align-top p-item-xs outline-none focus-visible:ring-2 focus-visible:ring-ring`,!r&&`bg-muted/30 text-muted-foreground`),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:U(`mb-item-xs inline-flex size-6 items-center justify-center rounded-full text-xs`,n===k&&`bg-primary text-primary-foreground`),children:c(e)}),i.length>0&&(0,$.jsx)(`ul`,{role:`list`,className:`flex max-h-28 flex-col gap-px overflow-y-auto`,children:i.map(e=>{let t=u(e),n=d(e);return(0,$.jsx)(`li`,{className:`list-none`,"data-calendar-item":t,children:f(e)?(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.XS,tabIndex:a?0:-1,className:`h-auto w-full justify-start truncate px-item-xs py-px text-start text-xs font-normal`,title:n,onClick:()=>p(e),children:n}):(0,$.jsx)(`span`,{className:`block truncate px-item-xs text-xs`,title:n,children:n})},t)})})]},n)})},e[0].key))})]})]})}function c_e(e){let t=HJ(e),n=UJ(t,1),r=[];for(let e=t;e.getTime()<n.getTime();e=_K(e,1))r.push(e);return r}var qJ=864e5;function l_e(e){let{items:t,startField:n,endField:r,startIsCalendarDate:i,endIsCalendarDate:a,timeZone:o,days:s}=e;if(s.length===0)return[];let c=s[0].getTime(),l=s[s.length-1].getTime(),u=[];for(let e of t){let t=GJ(e[n],i,o),s=GJ(e[r],a,o);if(!t||!s)continue;let d=s.getTime()<t.getTime()?t:s;if(t.getTime()>l||d.getTime()<c)continue;let f=Math.round((Math.max(t.getTime(),c)-c)/qJ)+1,p=Math.round((Math.min(d.getTime(),l)-c)/qJ)+1;u.push({item:e,startDay:t,endDay:d,startColumn:f,endColumn:p,continuesBefore:t.getTime()<c,continuesAfter:d.getTime()>l})}return u}function u_e(e){let{startField:t,endField:n,startIsCalendarDate:r,endIsCalendarDate:i,timeZone:a,firstDay:o,lastDay:s}=e;return{[t]:vK(void 0,s,r,a),[n]:vK(o,void 0,i,a)}}var JJ=VJ;function d_e(e){return{gridTemplateColumns:`minmax(8rem, 12rem) repeat(${e}, minmax(1.5rem, 1fr))`}}function f_e({days:e,placements:t,month:n,today:r,onMonthChange:i,monthHeading:a,dayNumberLabel:o,getItemId:s,getItemLabel:c,barLabel:l,canOpenItem:u,onOpenItem:d,timelineLabel:f,previousMonthLabel:p,nextMonthLabel:m,todayLabel:h,emptyMonthLabel:g}){let{renderIcon:_}=Rf(),v=(0,Q.useRef)(null),y=JJ(r),b=d_e(e.length),x=e=>{let t=e.key===`ArrowDown`?1:e.key===`ArrowUp`?-1:0;if(t===0)return;let n=Array.from(v.current?.querySelectorAll(`[data-timeline-bar]`)??[]),r=n[n.indexOf(e.currentTarget)+t];r&&(e.preventDefault(),r.focus())};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-sm`,"data-slot":`collection-timeline`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-item-sm`,children:[(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.ICON_SM,"aria-label":p,title:p,onClick:()=>i(UJ(n,-1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:_(H.CHEVRON_LEFT,{size:fa.SM})})}),(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.ICON_SM,"aria-label":m,title:m,onClick:()=>i(UJ(n,1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:_(H.CHEVRON_RIGHT,{size:fa.SM})})}),(0,$.jsx)(`h3`,{className:`text-sm font-medium`,"aria-live":`polite`,children:a}),(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.SM,className:`ms-auto`,onClick:()=>i(r),children:h})]}),(0,$.jsx)(`div`,{className:`overflow-x-auto`,children:(0,$.jsxs)(`div`,{className:`min-w-max`,children:[(0,$.jsxs)(`div`,{className:`grid border-b pb-item-xs`,style:b,"aria-hidden":`true`,children:[(0,$.jsx)(`span`,{}),e.map(e=>{let t=JJ(e);return(0,$.jsx)(`span`,{"data-timeline-day":t,"data-today":t===y?`true`:void 0,className:U(`text-center text-xs text-muted-foreground`,t===y&&`font-semibold text-foreground`),children:o(e)},t)})]}),t.length===0?(0,$.jsx)(`p`,{role:`status`,className:`py-section text-center text-sm text-muted-foreground`,children:g}):(0,$.jsx)(`ul`,{ref:v,role:`list`,"aria-label":f,className:`flex flex-col`,children:t.map(e=>{let{item:t,startDay:n,endDay:r,startColumn:i,endColumn:a,continuesBefore:o,continuesAfter:f}=e,p=s(t),m=c(t),h=l(t,n,r),g=U(`h-6 min-w-0 truncate rounded-md bg-primary/15 px-item-xs text-start text-xs text-foreground`,o&&`rounded-s-none`,f&&`rounded-e-none`),_={gridColumn:`${i+1} / ${a+2}`,gridRow:1};return(0,$.jsxs)(`li`,{className:`grid list-none items-center border-b py-px`,style:b,"data-timeline-item":p,"data-continues-before":o?`true`:void 0,"data-continues-after":f?`true`:void 0,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`truncate pe-item-sm text-sm`,style:{gridColumn:1,gridRow:1},title:m,children:m}),u(t)?(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.XS,"data-timeline-bar":p,"aria-label":h,title:h,className:U(g,`justify-start font-normal hover:bg-primary/25`),style:_,onClick:()=>d(t),onKeyDown:x,children:m}):(0,$.jsx)(`span`,{role:`img`,"data-timeline-bar":p,tabIndex:0,"aria-label":h,title:h,className:U(g,`flex items-center`),style:_,onKeyDown:x,children:m})]},p)})})]})})]})}function YJ(e){if(Array.isArray(e))return{items:e,total:e.length,totalPages:1};if(e&&typeof e==`object`&&`data`in e&&`pagination`in e){let{data:t,pagination:n}=e;return Array.isArray(t)?{items:t,total:typeof n?.total==`number`?n.total:t.length,totalPages:typeof n?.totalPages==`number`?n.totalPages:1}:void 0}}async function p_e(e){let{requestPage:t,pageLimit:n,maxPages:r=5}=e,i=async e=>{let r=YJ(await t(e,n));if(!r)throw Error(`The collection answered a display window with a response that holds no rows.`);return r},a=await i(1),o=Math.min(a.totalPages,r),s=[a,...o>1?await Promise.all(Array.from({length:o-1},(e,t)=>i(t+2))):[]].flatMap(e=>e.items);return{items:s,total:a.total,notShown:Math.max(0,a.total-s.length)}}function XJ(e,t,n){let r=e[t];return r!=null&&r!==``&&!(Array.isArray(r)?r.includes(n):r===n)?null:{...e,[t]:n}}function m_e(e,t){let{itemId:n,fromValue:r,toValue:i,movedFields:a,getItemId:o}=t,s=e.get(r),c=e.get(i),l=s?.items.find(e=>o(e)===n);if(!s||!c||!l)return new Map(e);let u=new Map(e);return u.set(r,{...s,items:s.items.filter(e=>o(e)!==n),total:Math.max(0,s.total-1)}),u.set(i,{...c,items:[{...l,...a},...c.items],total:c.total+1}),u}function h_e(e,t,n,r){let i=new Set(e.items.map(r));return{items:[...e.items,...t.items.filter(e=>!i.has(r(e)))],total:t.total,page:n,loading:!1,failed:!1}}var ZJ={items:[],total:0,page:0,loading:!1,failed:!1};function g_e(e){let{enabled:t,vocabulary:n,groupByField:r,readerFilters:i,reloadKey:a,pageSize:o,requestPage:s,getItemId:c}=e,[l,u]=(0,Q.useState)(()=>new Map),d=(0,Q.useRef)({readerFilters:i,requestPage:s,getItemId:c,pageSize:o,groupByField:r});d.current={readerFilters:i,requestPage:s,getItemId:c,pageSize:o,groupByField:r};let f=n.join(`\0`);return(0,Q.useEffect)(()=>{if(!t)return;let e=!1,{readerFilters:r,requestPage:i,pageSize:a,groupByField:o}=d.current;u(new Map(n.map(e=>[e,{...ZJ,items:[],loading:__e(r,o,e)}])));for(let t of n){let n=XJ(r,o,t);n&&i(n,1,a).then(n=>{if(e)return;let r=YJ(n);u(e=>new Map(e).set(t,r?{items:r.items,total:r.total,page:1,loading:!1,failed:!1}:{...ZJ,items:[],failed:!0}))},()=>{e||u(e=>new Map(e).set(t,{...ZJ,items:[],failed:!0}))})}return()=>{e=!0}},[t,f,a]),{pages:l,loadMore:(0,Q.useCallback)(async e=>{let{readerFilters:t,requestPage:n,pageSize:r,groupByField:i,getItemId:a}=d.current,o=XJ(t,i,e),s=l.get(e);if(!o||!s||s.loading)return;let c=s.page+1;u(t=>new Map(t).set(e,{...s,loading:!0}));try{let t=YJ(await n(o,c,r));u(n=>{let r=n.get(e)??s;return new Map(n).set(e,t?h_e(r,t,c,a):{...r,loading:!1,failed:!0})})}catch{u(t=>new Map(t).set(e,{...t.get(e)??s,loading:!1,failed:!0}))}},[l]),applyMove:(0,Q.useCallback)((e,t,n,r)=>{u(i=>m_e(i,{itemId:e,fromValue:t,toValue:n,movedFields:r,getItemId:d.current.getItemId}))},[])}}function __e(e,t,n){return XJ(e,t,n)!==null}function v_e(e){let{on:t}=vo(),[n,r]=(0,Q.useState)(null),i=e?.jobId??null,a=e?.attemptedCount??0;return(0,Q.useEffect)(()=>{if(!i)r(null);else return r({jobId:i,attemptedCount:a,processedCount:0,failedCount:0,finished:!1,failures:[]}),t(hc.BULK_JOB_PROGRESS,e=>{e.jobId===i&&r({jobId:e.jobId,operationIdentifier:e.operationIdentifier,attemptedCount:e.attemptedCount,processedCount:e.processedCount,failedCount:e.failedCount,finished:e.finished,failures:e.failures??[]})})},[t,i,a]),n}function y_e(e,t){let n=new Map;for(let r of e){let e=r.customMessageReference??`unnamedRefusal`,i=n.get(e);i?i.resourceIds.push(r.resourceId):n.set(e,{key:e,reason:(r.customMessageReference?t(r.customMessageReference):void 0)??e,resourceIds:[r.resourceId]})}return[...n.values()].sort((e,t)=>t.resourceIds.length-e.resourceIds.length)}var QJ=({resourceContext:e,navigationZone:t,navigationInitiator:n,selectedItems:r,selectedItemsDataMode:i,matchAllSelection:a,explicitIdSelection:o,onSelectIds:s,idField:c=`_id`,onSelectionClear:l,onSelectionReplace:u,size:d=Xd.ICON_SM,labelDisplayMode:f=Wt.INLINE,className:p})=>{let m=Nq(),{resourceType:h,operation:g}=e,{on:_}=vo(),v=(0,Q.useId)(),{isReady:y,tComponent:b,tErrorMessage:x,tResourceOperation:S}=K({component:J.RESOURCES_LAYOUTS_OPERATIONS_BULK,resource:h}),C=(0,Q.useMemo)(()=>ju(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]),w=(0,Q.useMemo)(()=>[`resources.${h}`,`components.${J.RESOURCES_LAYOUTS_OPERATIONS_BULK}`],[h]),T=(0,Q.useMemo)(()=>o&&o.length>0?[...o]:r.map(e=>String(e[c]??e._id??``)),[o,r,c]),E=(0,Q.useMemo)(()=>u?e=>u([...e]):void 0,[u]),{items:D,isConfirmDialogOpen:O,confirmDialogLabel:k,confirmDialogDescription:A,confirmDialogConfirmLabel:j,confirmRequiresTypedConfirmation:M,confirmConfirmationPhrase:N,onConfirm:P,onCancel:F,isExecuting:I,acceptedBackgroundRun:ee}=rH({resourceType:h,displayMode:Ac.DETAIL,contextResourceIdentifiers:e.contextResourceIdentifiers,parentResourcesRequirements:e.parentResourcesRequirements,navigationZone:t,sourceOperation:g,bulkOnly:!0,selectedItemIds:T,successDiscriminator:v,selectionObjects:r,...i?{currentObjectDataMode:i}:{},...a?{matchAllSelection:a}:{},onSelectionNarrow:E}),L=v_e(ee),R=r.length>0||!!a||!!o?.length,te=a?`match:${JSON.stringify(a)}`:R?`ids:${T.join(`,`)}`:``,[z,B]=(0,Q.useState)(null),[ne,re]=(0,Q.useState)(null);L?.finished&&z?.jobId!==L.jobId&&B({jobId:L.jobId,selectionKey:te});let ie=!!L?.finished&&z?.jobId===L.jobId&&te!==``&&te!==z.selectionKey;ie&&ne!==L.jobId&&re(L.jobId);let ae=L&&!ie&&L.jobId!==ne?L:null;return Iq(ae?ae.finished?Fq.FINISHED:Fq.WORKING:Fq.NONE),Pq((0,Q.useMemo)(()=>D.map(e=>e.type===`separator`?`|`:e.operationIdentifier??e.label).join(`,`),[D])),(0,Q.useEffect)(()=>{if(l)return _(hc.RESOURCE_OPERATION_EXECUTED,()=>l(),e=>{let t=e;return t.resourceType===h&&t.isBulkOperation===!0&&t.isPartialWrite!==!0&&t.optionalDiscriminator===v&&(0,SC.default)(ju(t.contextResourceIdentifiers),C)})},[_,l,C,h,v]),y?ae?(0,$.jsx)(yb,{i18nKeys:w,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-element-sm`,"data-slot":`bulk-background-run`,children:[!ae.finished&&(0,$.jsx)(I_,{value:ae.processedCount,max:Math.max(ae.attemptedCount,1),className:`w-40`,getValueLabel:(e,t)=>`${e}/${t}`}),(0,$.jsx)(`span`,{className:`text-sm text-muted-foreground whitespace-nowrap`,role:`status`,"aria-live":`polite`,children:ae.finished?b(J.RESOURCES_LAYOUTS_OPERATIONS_BULK,`backgroundRunFinished`,{succeededCount:ae.processedCount-ae.failedCount,failedCount:ae.failedCount}):b(J.RESOURCES_LAYOUTS_OPERATIONS_BULK,`backgroundRunProgress`,{processedCount:ae.processedCount,attemptedCount:ae.attemptedCount})}),ae.finished&&ae.failures.length>0&&(0,$.jsxs)(pq,{children:[(0,$.jsx)(mq,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:Y.LINK,size:Xd.SM,children:b(J.RESOURCES_LAYOUTS_OPERATIONS_BULK,`viewFailures`)})}),(0,$.jsxs)(hq,{className:`w-96 max-h-80 overflow-auto`,children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-element-sm`,children:y_e(ae.failures,e=>Lp({tErrorMessage:x,tResourceOperation:S,resourceType:h,operationIdentifier:ae.operationIdentifier,customMessageReference:e})).map(e=>(0,$.jsxs)(`li`,{className:`flex flex-col gap-element-xs`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium`,children:e.reason}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:b(J.RESOURCES_LAYOUTS_OPERATIONS_BULK,`failureReasonRowCount`,{count:e.resourceIds.length})}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground break-all`,children:e.resourceIds.join(`, `)})]},e.key))}),s&&(0,$.jsx)(X,{type:`button`,variant:Y.LINK,size:Xd.SM,onClick:()=>s(ae.failures.map(e=>e.resourceId)),children:b(J.RESOURCES_LAYOUTS_OPERATIONS_BULK,`selectRefusedRows`,{count:ae.failures.length})}),ae.failures.length<ae.failedCount&&(0,$.jsx)(`p`,{className:`mt-element-sm text-xs text-muted-foreground`,children:b(J.RESOURCES_LAYOUTS_OPERATIONS_BULK,`failuresPartialList`,{shownCount:ae.failures.length,failedCount:ae.failedCount})})]})]})]})}):!R||D.length===0?null:(0,$.jsx)(yb,{i18nKeys:w,children:(0,$.jsxs)(`div`,{"data-slot":`operations-bulk`,className:U(`flex items-center`,p),children:[(0,$.jsx)(dC,{items:D,size:d,labelDisplayMode:m===null||m===kq.LABELLED?f:Wt.TOOLTIP,...m===kq.CAPPED?{maxDisplayed:2}:{}}),O&&(0,$.jsx)(Jw,{open:O,onOpenChange:e=>{e||F()},cancelCallback:F,validationCallback:P,label:k,description:A,confirmLabel:j,requireTypedConfirmation:M,confirmationPhrase:N})]})}):null};function $J({preset:e=q.DEFAULT,...t}){let n=G(J.RESOURCES_LAYOUTS_OPERATIONS_BULK,`ResourceLayout_OperationBulk`)(e);return(0,$.jsx)(n,{...t})}var b_e=({resourceContext:e,navigationZone:t,size:n=Xd.ICON_SM,className:r,collectionExportQuery:i})=>{let{resourceType:a,operation:o}=e,{items:s,isConfirmDialogOpen:c,confirmDialogLabel:l,confirmDialogDescription:u,confirmDialogConfirmLabel:d,confirmRequiresTypedConfirmation:f,confirmConfirmationPhrase:p,onConfirm:m,onCancel:h,ephemeralFields:g,onEphemeralAcknowledge:_}=rH({resourceType:a,displayMode:Ac.DETAIL,contextResourceIdentifiers:e.contextResourceIdentifiers,parentResourcesRequirements:e.parentResourcesRequirements,additionalContext:e.additionalContext,navigationZone:t,sourceOperation:o,collectionOnly:!0,collectionExportQuery:i});return s.length===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dC,{items:s,size:n,labelDisplayMode:Wt.INLINE,className:r}),c&&(0,$.jsx)(Jw,{open:c,onOpenChange:e=>{e||h()},cancelCallback:h,validationCallback:m,label:l,description:u,confirmLabel:d,requireTypedConfirmation:f,confirmationPhrase:p}),g&&(0,$.jsx)(dG,{open:!0,onAcknowledge:_,fields:g,resourceType:a})]})},x_e=`__wildo-ungrouped__`;function S_e(e,t,n,r,i){let a=BG(n,i).has(t),o=[];for(let n of e){let e=n[t],i=e instanceof Date?e:typeof e==`string`||typeof e==`number`?new Date(e):null,s=i&&!Number.isNaN(i.getTime())?r(i,{calendarDate:a}):null,c=s??x_e,l=o[o.length-1];l&&l.key===c?l.items.push(n):o.push({key:c,label:s,items:[n]})}return o}var C_e=`wildo-collection-view-mode:`;function eY(e){return`${C_e}${e}`}function w_e(e){let t=Fs(eY(e));return t!==null&&Object.values(au).includes(t)?t:null}function T_e(e,t){eo(eY(e),t)}function E_e(e,t){let[n,r]=(0,Q.useState)(()=>w_e(e)??t);return{viewMode:n,setViewMode:(0,Q.useCallback)(t=>{r(t),T_e(e,t)},[e])}}function D_e(e){return e instanceof Error?e:Error(String(e))}var tY=class extends Q.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){let n=D_e(e);Jo.getLogger().warn(`[${this.props.doorName}] lazy door failed to render its module`,{error:n.message,componentStack:t.componentStack}),this.props.onError?.(n)}render(){return this.state.failed?this.props.fallback:this.props.children}};function nY({className:e,style:t}){return(0,$.jsx)(`div`,{"aria-hidden":`true`,"data-lazy-door":`unavailable`,className:U(`rounded-md border border-dashed border-muted-foreground/40 bg-muted/30`,e),style:t})}var O_e=Q.lazy(()=>T_(()=>import(`./ChartView-Dxhrm4ZQ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));function k_e({height:e}){let{tComponent:t,isReady:n}=K({component:J.HIGH_LEVEL_VIEWS_CHART_WIDGET});return n?(0,$.jsx)(`div`,{style:{minHeight:e},"data-lazy-door":`unavailable`,children:(0,$.jsx)(Cm,{variant:`compact`,iconRef:H.ERROR_APPLICATION,title:t(J.HIGH_LEVEL_VIEWS_CHART_WIDGET,`chartFailed`),respectSurfaceEmptyDisplay:!1,className:`h-full min-h-[120px] border-0`})}):null}var rY=e=>(0,$.jsx)(tY,{doorName:`ChartView`,fallback:(0,$.jsx)(k_e,{height:e.height??400}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Pm,{height:e.height??400}),children:(0,$.jsx)(O_e,{...e})})});function A_e(e){return typeof e.resourceType==`string`&&e.resourceType.length>0}function j_e(e){return e.foreignKeyField??e.resourceType}function M_e(e,t){if(!e.anchor||!t)return null;let{bindingKey:n,source:r}=e.anchor,i=t[n];if(!i)return null;let a=((r===Vm.PARENT_RESOURCE_REQUIREMENT?e.parentResourcesRequirements:e.additionalResourceRequirements)??[]).filter(e=>A_e(e)?j_e(e)===n:!1);return a.length===1?{mainResourceType:a[0].resourceType,mainResourceId:i,bindingKey:n,source:r===Vm.PARENT_RESOURCE_REQUIREMENT?gy.PARENT_RESOURCE_REQUIREMENT:gy.ADDITIONAL_RESOURCE_REQUIREMENT}:null}function N_e(e){return e.explicitTemplate?e.explicitTemplate:e.displaySchema?JR(e.displaySchema,{factsAsTiles:e.defaultDisplayChromeMode===void 0,...e.resourceConfig?{resourceConfig:e.resourceConfig}:{}}):null}function iY(e){return e??void 0}var aY=class{resourcesRegistry;errorBuilder;constructor(e){this.resourcesRegistry=e,this.errorBuilder=new Ce}buildError(e,t,n){let r=this.errorBuilder.buildWildoError_Frontend(ue.INTERNAL,{customMessageReference:e,operationPathKey:t?.operationPathKey,context:{...n,resourceType:t?.resourceType,operationIdentifier:t?.operationIdentifier}}),i=Error(e);return i.wildoError=r,i}findOperation(e){let t=this.resourcesRegistry.resourceConfigurations[e.resourceType];if(!t||!e.operationIdentifier)return null;let n=t.operations.filter(t=>String(t.operationIdentifier)===e.operationIdentifier&&(iY(e.variantType)===void 0||t.variantType===e.variantType)&&(iY(e.variantKey)===void 0||t.variantKey===e.variantKey)&&(iY(e.isOperationDefault)===void 0||!!t.isOperationDefault===e.isOperationDefault)&&(iY(e.isBulkOperation)===void 0||t.isBulkOperation===!0===e.isBulkOperation));if(n.length===1)return n[0];let r=n.filter(e=>e.isOperationDefault===!0&&e.isBulkOperation!==!0);return r.length===1?r[0]:null}findOperationByPathKey(e,t){if(!t)return null;let n=this.resourcesRegistry.resourceConfigurations[e];if(!n)return null;try{return n.operations.find(e=>gl.createOperationPathKeyFromOperation(e)===t)??null}catch{return null}}resolveOperation(e){if(!this.resourcesRegistry.resourceConfigurations[e.resourceType])return null;let t=this.findOperationByPathKey(e.resourceType,e.operationPathKey);return t?e.validationTarget===`canonical-read`&&Kn.getCoreResourceOperationFromOperation(t)!==W.READ?null:t:e.validationTarget===`canonical-read`?null:this.findOperation(e)}selectResponseDto(e,t){return Gs.selectResponseDto(e,t)}validateResourceData(e,t,n){if(!t)return e;try{return t.parse(e)}catch(t){throw t instanceof Gd?this.buildError(ii.FRONTEND_RESOURCE_RESPONSE_VALIDATION_FAILED,n,{validationErrors:t.issues,resourceData:e}):t}}validateWebSocketResourceData(e,t){let n=this.resolveOperation(t),r=t.validationTarget!=null;if(!n){if(r)throw this.buildError(ii.FRONTEND_RESOURCE_RESPONSE_VALIDATION_FAILED,t,{message:`Unable to resolve websocket validation operation`,resourceData:e});return e}let i=this.selectResponseDto(n,t.dataMode);if(!i&&r)throw this.buildError(ii.FRONTEND_RESOURCE_RESPONSE_VALIDATION_FAILED,t,{message:`Unable to resolve websocket validation DTO`,resourceData:e,operationIdentifier:n.operationIdentifier});return this.validateResourceData(e,i,t)}validateWebSocketResourceDataArray(e,t){return e.map((e,n)=>{try{return this.validateWebSocketResourceData(e,t)}catch(e){if(e instanceof Error&&e.wildoError){let r={...t,operationPathKey:t.operationPathKey?`${t.operationPathKey}[${n}]`:`[${n}]`};throw this.buildError(ii.FRONTEND_RESOURCE_RESPONSE_VALIDATION_FAILED,r,{arrayIndex:n,originalError:e})}throw e}})}},oY=Jo.getLogger(),sY=oY.debugByType(`RMMWebSocketBridge`);oY.setDebugTypeLogging(`RMMWebSocketBridge`,!1);function cY(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function lY(e,t){return e===t?!0:e==null||t==null?e===t:Array.isArray(e)||Array.isArray(t)?!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>lY(e,t[n])):cY(e)||cY(t)?!cY(e)||!cY(t)?!1:[...new Set([...Object.keys(e),...Object.keys(t)])].every(n=>lY(e[n],t[n])):!1}function uY(e,t,n=``,r={}){if(lY(e,t))return r;if(Array.isArray(e)||Array.isArray(t))return n&&(r[n]=e),r;if(cY(e)&&cY(t)){let i=[...new Set([...Object.keys(e),...Object.keys(t)])];for(let a of i){let i=n?`${n}.${a}`:a;uY(e[a],t[a],i,r)}return r}if(cY(e)){for(let[t,i]of Object.entries(e))uY(i,void 0,n?`${n}.${t}`:t,r);return r}return n&&(r[n]=e),r}function P_e(e,t){return uY(e,t)}async function dY(e){let{resourceType:t,resourceId:n,rmm:r,doOperation:i}=e;if(r.getSnapshot().isDeleted)return;let a=r.readOperationPathKey;if(!a){sY(`authoritative refetch skipped: missing canonical read operation`,{resourceType:t,resourceId:n});return}let o=await Fz({doOperation:i,readOperationPathKey:a,contextualParameters:r.contextualParameters,parentResourcesRequirements:r.parentResourcesRequirements});if(!o||typeof o!=`object`)return;let s=o,c=s._version,l=r.getSnapshot();l.isDeleted||c!=null&&(l.version==null||c>l.version)&&(sY(`authoritative refetch: applying newer state`,{resourceType:t,resourceId:n,localVersion:l.version,serverVersion:c}),r.setInitialState(s,c,s._field_meta))}var F_e=()=>{let{on:e,isConnected:t,connectionCount:n,claimResourceRoom:r,releaseResourceRoom:i}=Sp(),a=(0,Q.useContext)(kz),{doOperation:o,getResourcesRegistry:s}=wm(),c=(0,Q.useMemo)(()=>s(),[s]),l=(0,Q.useMemo)(()=>new aY(c),[c]),u=(0,Q.useRef)(o);u.current=o;let d=(0,Q.useRef)(new Set),f=(0,Q.useRef)(new Set),p=(0,Q.useRef)(new Map),m=(0,Q.useCallback)((e,t,n)=>{let r=`${e}:${t}`;d.current.has(r)||(d.current.add(r),dY({resourceType:e,resourceId:t,rmm:n,doOperation:u.current}).catch(n=>{sY(`authoritative refetch failed`,{resourceType:e,resourceId:t,error:Ca(n)})}).finally(()=>{d.current.delete(r)}))},[]),h=(0,Q.useCallback)(async e=>{let t=new Set(e.map(({key:e})=>`rmm:${e}`));for(let e of f.current){if(t.has(e))continue;let n=p.current.get(e);n&&(await i({ownerKey:e,resourceType:n.resourceType,resourceId:n.resourceId,contextResourceIdentifiers:n.contextResourceIdentifiers}),p.current.delete(e))}for(let{key:t,resourceType:n,resourceId:i,rmm:a}of e){let e=`rmm:${t}`;p.current.set(e,{resourceType:n,resourceId:i,contextResourceIdentifiers:a.contextResourceIdentifiers}),await r({ownerKey:e,resourceType:n,resourceId:i,contextResourceIdentifiers:a.contextResourceIdentifiers})}f.current=t},[r,i]);(0,Q.useEffect)(()=>{if(!a)return;let e=a.subscribeActiveInstances(e=>{h(e)});return()=>{e();let t=Array.from(f.current);f.current.clear();for(let e of t){let t=p.current.get(e);t&&(i({ownerKey:e,resourceType:t.resourceType,resourceId:t.resourceId,contextResourceIdentifiers:t.contextResourceIdentifiers}),p.current.delete(e))}}},[a,i,h]),(0,Q.useEffect)(()=>{if(!t||!a)return;let n=e(mi.RESOURCE_UPDATED,e=>{if(e.deliveryTarget===Lt.SCOPE_ROOM_NOTIFICATION){let t=new Set([e.resourceId,...e.affectedIds??[]].filter(e=>!!e));for(let n of t){let t=a.get(e.resourceType,n);t&&m(e.resourceType,n,t)}return}let t=a.get(e.resourceType,e.resourceId);if(!t)return;if(e.deliveryTarget!==Lt.RESOURCE_ROOM_SYNC){sY(`RESOURCE_UPDATED: notification-grade resource room update, scheduling authoritative refetch`,{resourceType:e.resourceType,resourceId:e.resourceId,deliveryTarget:e.deliveryTarget}),m(e.resourceType,e.resourceId,t);return}let n=e.resourceData,r=e.version;if(!cY(n)||r==null){sY(`RESOURCE_UPDATED: sync payload missing replayable object data, scheduling authoritative refetch`,{resourceType:e.resourceType,resourceId:e.resourceId}),m(e.resourceType,e.resourceId,t);return}let i;try{i=l.validateWebSocketResourceData(n,{resourceType:e.resourceType,operationPathKey:t.readOperationPathKey,operationIdentifier:e.operationIdentifier,variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation,dataMode:jz,validationTarget:`canonical-read`})}catch(n){sY(`RESOURCE_UPDATED: sync payload failed canonical-read validation, scheduling authoritative refetch`,{resourceType:e.resourceType,resourceId:e.resourceId,error:Ca(n)}),m(e.resourceType,e.resourceId,t);return}let o=t.getSnapshot(),s=o.confirmedData??{},c=P_e(i,s);Object.keys(c).length===0&&r===o.version?sY(`RESOURCE_UPDATED: no changes detected, skipping`,{resourceType:e.resourceType,resourceId:e.resourceId,version:r}):(sY(`RESOURCE_UPDATED → applyRemoteUpdate`,{resourceType:e.resourceType,resourceId:e.resourceId,version:r,changedFieldCount:Object.keys(c).length,initiatorUserId:e.initiatorUserId}),t.applyRemoteUpdate(c,r,e.initiatorUserId,e.fieldMeta))}),r=e(mi.RESOURCE_DELETED,e=>{let t=a.get(e.resourceType,e.resourceId);t&&(sY(`RESOURCE_DELETED → handleDeletion`,{resourceType:e.resourceType,resourceId:e.resourceId,initiatorUserId:e.initiatorUserId}),t.handleDeletion(kE.REMOTE,e.initiatorUserId))});return()=>{n(),r()}},[t,e,a,m,l]);let g=(0,Q.useRef)(n);return(0,Q.useEffect)(()=>{if(!a)return;if(g.current===0){g.current=n;return}if(n<=g.current)return;g.current=n;let e=a.getActiveInstances();if(e.length!==0){sY(`reconnection detected — syncing versions`,{connectionCount:n,activeRMMCount:e.length}),h(e);for(let{resourceType:t,resourceId:n,rmm:r}of e)m(t,n,r)}},[n,a,m,h]),null},fY=Jo.getLogger(),pY=fY.debugByType(`ResourceAutomaticDisplayer`),mY=2e3,hY=3e4;fY.setDebugTypeLogging(`ResourceAutomaticDisplayer`,!1);function gY({resourceContext:e,onError:t,className:n,labelsOverride:r,dataMode:i,onDataLoaded:a,parentReferenceConfig:o,navigationZone:s,updateLikeMutationFallbackMode:c=Nt.RMM_REQUIRED,recordNameShownAbove:l=!1}){let{doOperation:u,registry:d}=wm(),{emit:f,resourceRefreshEvent:p}=vo(),{lastRefreshAt:m}=p({ctx:e}),{tComponent:h,isReady:g,t:_,formatDate:v,formatDateTime:y}=K({component:J.RESOURCES_LAYOUTS_READ,resource:e.resourceType}),[b]=bh(),x=(0,Q.useMemo)(()=>[`resources.${e.resourceType}`,`components.${J.RESOURCES_LAYOUTS_READ}`],[e.resourceType]),S=(0,Q.useRef)(u),C=(0,Q.useRef)(f),w=(0,Q.useRef)(t),T=(0,Q.useRef)(a),E=(0,Q.useRef)(e);S.current=u,C.current=f,w.current=t,T.current=a,E.current=e;let D=(0,Q.useMemo)(()=>new Ce,[]),{resourceType:O,operation:A,contextResourceIdentifiers:j}=e,M=String(A.operationIdentifier),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(null),[ee,L]=(0,Q.useState)(null),[R,te]=(0,Q.useState)(!1),z=(0,Q.useMemo)(()=>[{resourceType:O,operation:M}],[O,M]),B=(0,Q.useMemo)(()=>gn.extractDataMode(b,i),[b,i]),ne=(0,Q.useMemo)(()=>B??wn.RAW,[B]),re=(0,Q.useMemo)(()=>{let e;switch(ne){case wn.SUMMARY:e=A.summaryDto||A.responseDto;break;case wn.CONTEXT:e=A.contextDto||A.responseDto;break;case wn.RAW:default:e=A.responseDto}return e||fY.error(`[ResourceAutomaticDisplayer] No DTO found`,{operationIdentifier:M,resourceType:O,dataMode:ne}),e},[ne,A,M,O]),ie=(0,Q.useMemo)(()=>d.resourceConfigurations[O],[d,O]),ae=ie?.frontendConfiguration?.layout?.refs,oe=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(j),[j]),se=(0,Q.useMemo)(()=>V.buildContextualParameters(j,d),[oe,d]),ce=(0,Q.useMemo)(()=>gl.createOperationPathKeyFromOperation(A),[A]),le=(0,Q.useMemo)(()=>({resourceContext:{resourceType:O,operationId:M},...r}),[O,M,r]),de=(0,Q.useMemo)(()=>{if(re)try{let e=sr.collectFileFieldPaths(re);if(e.length===0)return;let t=va.getApiUrl(),n=`${t}/api/v1/files`,r={},i=N?String(N._id??N[ie?.resourceFieldIdentifier??`_id`]??``):``;if(ie&&i)for(let n of e){let e=aH({registry:d,resourceConfig:ie,operation:A,resourceType:O,fieldName:n,recordId:i,contextResourceIdentifiers:j,contextualParameters:se,parentResourcesRequirements:E.current.parentResourcesRequirements,apiBaseUrl:t});e&&(r[n]=e)}let a={};for(let t of e)a[t]={getMetadata:n,serve:r[t],upload:``,override:void 0,delete:``};return a}catch{return}},[re,ie,A,d,j,se,O,N]);(0,Q.useEffect)(()=>{let e=!1,t,n=mY,r=async(i=!1)=>{i||L(null);try{let t=await S.current(ce,{contextualParameters:se,parentResourcesRequirements:E.current.parentResourcesRequirements,dataMode:ne},{silent:!0});if(e)return;L(null),P(t)}catch(a){if(e)return;let o=a instanceof Error?a:Error(String(a)),s=a&&typeof a==`object`?a:{},c=D.buildWildoError_Frontend(ue.NOT_FOUND,{customMessageReference:ii.FRONTEND_FORM_READ_OPERATION_NOT_AVAILABLE,operationPathKey:ce,context:{resourceType:O,operationIdentifier:M,originalErrorMessage:o.message,originalErrorStack:o.stack,httpCode:s.code,httpContext:s.context}});if(L(c),(pie(a)||tl(a))&&(t!==void 0&&clearTimeout(t),t=setTimeout(()=>{t=void 0,r(!0)},n),n=Math.min(n*2,hY)),i)return;let l=E.current,{errorRefusalCode:u}=cz(a);C.current(hc.NOTIFY_RESOURCE_ERROR,{...l,contextResourceIdentifiers:ju(l.contextResourceIdentifiers),parentResourcesRequirements:l.parentResourcesRequirements||[],additionalContext:{...l.additionalContext,error:o.message,errorCustomMessageReference:ii.FRONTEND_FORM_READ_OPERATION_NOT_AVAILABLE,...u?{errorRefusalCode:u}:{},...lz(a)}}),w.current?.(o),pY(`fetch error`,{resourceType:O,error:o.message})}};return r(),()=>{e=!0,t!==void 0&&clearTimeout(t)}},[O,ce,oe,D,M,ne,m,F]);let fe=(0,Q.useMemo)(()=>{let e=j?.[O];if(e)return gn.getResourceId(e);if(N){let e=V.getResourceFieldIdentifierForType(O,d),t=N[e];if(t!=null)return t;let n=ie?.mainSchema?Qee(ie.mainSchema):void 0;if(n)return N[n]}},[j,O,N,d,ie?.mainSchema]),pe=(0,Q.useMemo)(()=>!fe||j?.[O]?j:{...j,[O]:String(fe)},[j,fe,O]),me=(0,Q.useMemo)(()=>{let e=ie?.resourceFieldIdentifier;if(!fe||!e)return se;let t=String(fe);return String(se[e]??``)===t?se:{...se,[e]:t}},[se,fe,ie?.resourceFieldIdentifier]),he=wS(Dh(ie?.resourceIdentifier,fe==null?void 0:String(fe),pe)),ge=(0,Q.useMemo)(()=>{if(ie)return rh({resourceConfig:ie,operations:ie.operations??[],registry:d,hasResourceId:fe!=null,contextResourceIdentifiers:pe,contextualParameters:me,viewer:he})},[pe,me,fe,A,d,ie,he]),_e=(0,Q.useMemo)(()=>ge!==void 0,[ge]),{rmm:ve,rmmSnapshot:ye}=Uz({resourceType:O,resourceId:fe==null?null:String(fe),doOperationRef:S,contextualParameters:me,parentResourcesRequirements:e.parentResourcesRequirements,contextResourceIdentifiers:pe,resourceSchema:ie?.mainSchema,resourceInheritance:ie?.inheritenceSchemaDefinition,enabled:_e&&fe!=null,conflictPolicy:{strategy:DE.ACCEPT_REMOTE}}),be=(0,Q.useRef)(null);be.current=typeof N?._id==`string`||typeof N?._id==`number`?String(N._id):null;let xe=ve!==null&&!R,Se=(0,Q.useRef)(!1),we=uV({resourceType:O,rowIds:[fe==null?null:String(fe),be.current],enabled:fe!=null});(0,Q.useEffect)(()=>{if(we!=null&&fe!=null){if(xe&&ve!==null&&!we.madeElsewhere){let e=String(fe);dY({resourceType:O,resourceId:e,rmm:ve,doOperation:S.current}).catch(t=>{fY.warn(`[ResourceAutomaticDisplayer] Re-reading the row after it changed failed`,{resourceType:O,resourceId:e,error:Ca(t)})})}xe&&Se.current||I(we.at)}},[we]);let Te=(0,Q.useMemo)(()=>ve?ve.readOperationPathKey:Nz(O,d,{hasResourceId:fe!=null,contextResourceIdentifiers:pe,contextualParameters:me}),[d,O,ve,fe,pe,me]),Ee=R?null:ve;(0,Q.useEffect)(()=>{pY(`RMM obtained`,{resourceType:O,resourceId:fe==null?void 0:String(fe),rmmExists:!!ve})},[ve,O,fe]),(0,Q.useEffect)(()=>{te(!1)},[Te,fe,ce,O]),(0,Q.useEffect)(()=>{if(!ve||!N)return;let e=ve.getSnapshot();if(e.confirmedData!==null&&m==null)return;if(!Te){te(!0),fY.warn(`[ResourceAutomaticDisplayer] Cannot seed RMM without an addressable canonical READ`,{resourceType:O,resourceId:fe==null?void 0:String(fe)});return}let t=!1;return(async()=>{let n=Pz({loadedOperationPathKey:ce,canonicalReadOperationPathKey:Te,dataMode:ne}),r=n?N:await Fz({doOperation:S.current,readOperationPathKey:Te,contextualParameters:me,parentResourcesRequirements:E.current.parentResourcesRequirements});if(t)return;if(typeof r!=`object`||!r){te(!0);return}let i=r,a=i._version??0;ve.setInitialState(i,a,i._field_meta),te(!1),pY(`setInitialState`,{resourceType:O,resourceId:fe==null?void 0:String(fe),version:a,fieldCount:Object.keys(i).length,refreshDriven:e.confirmedData!==null,seededFromCanonicalRead:!n})})().catch(e=>{te(!0),fY.warn(`[ResourceAutomaticDisplayer] Failed to seed RMM from canonical read`,{resourceType:O,resourceId:fe==null?void 0:String(fe),error:Ca(e)})}),()=>{t=!0}},[ve,N,ne,ce,Te,me,O,fe,m]),(0,Q.useEffect)(()=>{if(!ve||!ye?.lastEvent)return;let e=ye.lastEvent;pY(`RMM event`,{type:e.type,resourceType:O,resourceId:fe==null?void 0:String(fe)});let t=Te?!Pz({loadedOperationPathKey:ce,canonicalReadOperationPathKey:Te,dataMode:ne}):!1,n=()=>{t&&S.current(ce,{contextualParameters:me,parentResourcesRequirements:E.current.parentResourcesRequirements,dataMode:ne}).then(e=>{P(e)}).catch(e=>{fY.warn(`[ResourceAutomaticDisplayer] Summary/context refetch failed (RMM handler)`,{resourceType:O,error:Ca(e)})})};switch(e.type){case SE.MUTATION_RESULT:e.result.success&&(e.source.type===wE.DISPLAY&&C.current(hc.NOTIFY_RESOURCE_SUCCESS,{...E.current,contextResourceIdentifiers:De({contextResourceIdentifiers:E.current.contextResourceIdentifiers,resourceType:O,result:e.result.responseData}),parentResourcesRequirements:E.current.parentResourcesRequirements||[],additionalContext:{...E.current.additionalContext,inlineEdit:!0,fieldName:e.result.savedFields?.[0]},resultSummary:e.result.responseData}),n());break;case SE.REMOTE_UPDATE:case SE.CONFLICT_RESET:n();break;case SE.RESOURCE_DELETED:}},[ye?.lastEvent?.id]);let Oe=(0,Q.useMemo)(()=>Pz({loadedOperationPathKey:ce,canonicalReadOperationPathKey:Te,dataMode:ne}),[Te,ne,ce]),ke=ne===wn.SUMMARY||ne===wn.CONTEXT,Ae=!ke&&Oe&&ve&&ye.optimisticData?ye.optimisticData:N;Se.current=!ke&&Oe&&xe;let je=xe?ye.optimisticData:null;(0,Q.useEffect)(()=>{if(Ae==null)return;let e=Oe?Ae:je??void 0;T.current?.(Ae,{holdsCanonicalRecord:Oe||xe,canonicalRecord:e})},[Ae,Oe,xe,je]),(0,Q.useEffect)(()=>{pY(`effectiveData source`,{dataMode:ne,usingRmmData:Oe&&!!ye?.optimisticData})},[Oe,ne,ye?.optimisticData]);let Me=(0,Q.useCallback)((e,t)=>{P(n=>n&&TA(n,e,t)),C.current(hc.NOTIFY_RESOURCE_SUCCESS,{...E.current,contextResourceIdentifiers:De({contextResourceIdentifiers:E.current.contextResourceIdentifiers,resourceType:O,result:t}),parentResourcesRequirements:E.current.parentResourcesRequirements||[],additionalContext:{...E.current.additionalContext,inlineEdit:!0,fieldName:e},resultSummary:typeof t==`object`&&t?t:TA({},e,t)})},[O]),Ne=ie?.frontendConfiguration?.layout?.display,Pe=ie?.frontendConfiguration?.layout?.defaultChromeMode?.display,Fe=ie?.frontendConfiguration?.layout?.defaultInlineEdit,Ie=ie?.frontendConfiguration?.layout?.defaultEmptyValue,Le=ie?.frontendConfiguration?.layout?.defaultDisplaySectionAppearance,Re=(0,Q.useMemo)(()=>N_e({explicitTemplate:Ne,displaySchema:re,defaultDisplayChromeMode:Pe,resourceConfig:ie}),[Ne,re,Pe,ie]),ze=rH({resourceType:e.resourceType,displayMode:Ac.DETAIL,currentObject:Ae,currentObjectDataMode:ne,contextResourceIdentifiers:e.contextResourceIdentifiers??{},parentResourcesRequirements:e.parentResourcesRequirements,navigationZone:s??li.PRIMARY,sourceOperation:e.operation}),Be=(0,Q.useCallback)(t=>{let n=ze.items.find(e=>e.type!==`separator`&&e.type!==`subgroup`&&e.operationIdentifier===t.operationIdentifier);n?.onClick?n.onClick():va.isDevelopment()&&Jo.getLogger().warn(`[ResourceAutomaticDisplayer] File "${t.fieldName}" requests operation "${t.operationIdentifier}", which is not available on ${e.resourceType} for the current user/row (unauthorized, condition-disabled, or unknown). The activation is inert.`)},[ze.items,e.resourceType]),Ve=(0,Q.useMemo)(()=>{if(Ne)return{hiddenFieldNames:[],inlineEditDisabledFieldNames:[]};let e=Rj({resourceType:O,schema:re,parentData:Ae,registry:d}),t=ie?.frontendConfiguration?.layout?.defaultInlineEdit===k.WRITABLE_FIELDS,n=re?sr.getObjectLikeFieldShape(re,{commonOnly:!1}):void 0,r=l&&!t?KA({resourceType:O,registry:d,data:Ae,t:_,formatDate:v,formatDateTime:y}).filter(e=>{let t=n?.[e];return!t||!Bc(t)}):[];return r.length===0?e:{...e,hiddenFieldNames:[...e.hiddenFieldNames,...r]}},[re,Ae,Ne,d,O,ie,l,_,v,y]),He=!Ae,Ue=(0,Q.useCallback)(async e=>{let t=ie?.operations?.find(t=>String(t.operationIdentifier)===e&&t.isOperationDefault===!0);if(!t)throw Error(`${O} declares no operation ${e}`);return S.current(gl.createOperationPathKeyFromOperation(t),{contextualParameters:se,parentResourcesRequirements:E.current.parentResourcesRequirements},{silent:!0})},[ie,O,se]);if(g===!1)return null;if(ee){let t=ie?.frontendConfiguration?.layout?.readFailure;if(t)return(0,$.jsx)(`div`,{className:n,children:(0,$.jsx)(t,{error:ee,resourceContext:e,askOperation:Ue})});let r=h(J.RESOURCES_LAYOUTS_READ,`failedToLoadData`),i=r;return(0,$.jsx)(`div`,{className:n,children:(0,$.jsxs)(`div`,{role:`alert`,className:`p-card bg-destructive/10 border border-destructive rounded-lg`,children:[(0,$.jsx)(`p`,{className:`text-destructive font-medium`,children:r}),(0,$.jsx)(`p`,{className:`text-sm text-destructive/80 mt-item-xs`,children:i})]})})}if(!re){let e=h(J.RESOURCES_LAYOUTS_READ,`configurationError`),t=h(J.RESOURCES_LAYOUTS_READ,`noSchemaFound`,{operation:M,resource:O});return(0,$.jsx)(`div`,{className:n,children:(0,$.jsxs)(`div`,{role:`alert`,className:`p-card bg-destructive/10 border border-destructive rounded-lg`,children:[(0,$.jsx)(`p`,{className:`text-destructive font-medium`,children:e}),(0,$.jsx)(`p`,{className:`text-sm text-destructive/80 mt-item-xs`,children:t})]})})}return(0,$.jsx)(yb,{i18nKeys:x,loadingScopes:z,children:(0,$.jsx)(UB,{schema:re,data:Ae,className:n,labels:le,layoutRefs:ae,resourceType:O,resourceId:fe?String(fe):void 0,contextualParameters:me,contextResourceIdentifiers:pe,parentResourcesRequirements:e.parentResourcesRequirements,navigationZone:s,inlineEditOperation:ge??null,parentReferenceConfig:o,fileUploadContext:de,rmm:Ee,onInlineEditSuccess:!Ee&&Un(c)?Me:void 0,updateLikeMutationFallbackMode:c,layoutTemplate:Re,isLoading:He,defaultDisplayChromeMode:Pe,defaultInlineEdit:Fe,defaultEmptyValue:Ie,defaultSectionAppearance:Le,hiddenFieldNames:Ve.hiddenFieldNames,inlineEditDisabledFieldNames:Ve.inlineEditDisabledFieldNames,onFileActivationOperation:Be})})}gY.displayName=`ResourceAutomaticDisplayer`;var _Y=gY,I_e=Object.freeze(new Set),L_e=Object.freeze({depth:0,visited:I_e}),vY=(0,Q.createContext)(L_e);function yY(){return(0,Q.useContext)(vY)}var bY=new Set;function R_e(e,t,n,r){bY.has(`${e}:${t}`)||(bY.add(`${e}:${t}`),Jo.getLogger().warn(t===`cycle`?`[embedded-resource-descent] CYCLE refused at "${e}": this record was already reached on this path, so rendering it again would not terminate. Nothing is rendered here.`:`[embedded-resource-descent] DEPTH LIMIT refused at "${e}": embedded nesting reached ${n} of a maximum ${r}. Nothing is rendered here. Raise the per-edge limit only if this hierarchy genuinely belongs on one page — otherwise link to the child instead of embedding it.`))}function xY({descentKey:e,maxDepth:t=3,children:n}){let r=yY(),i=r.visited.has(e),a=r.depth+1,o=a>t,s=(0,Q.useMemo)(()=>{let t=new Set(r.visited);return t.add(e),{depth:a,visited:t}},[r.visited,e,a]);return i||o?(R_e(e,i?`cycle`:`depth`,a,t),null):(0,$.jsx)(vY.Provider,{value:s,children:n})}var SY=(0,Q.createContext)(null);function CY({children:e}){let t=(0,Q.useRef)({placed:new Set,owned:{current:!1},composedAutomatically:{current:!1}});t.current.placed.clear(),t.current.owned.current=!1,t.current.composedAutomatically.current=!1;let n=(0,Q.useMemo)(()=>t.current,[]);return(0,Q.useEffect)(()=>{let e=t.current;e.composedAutomatically.current&&(e.owned.current||e.placed.size>0)&&z_e([...e.placed])}),(0,$.jsx)(SY.Provider,{value:n,children:e})}var wY=new Set;function z_e(e){let t=e.slice().sort().join(`,`);wY.has(t)||(wY.add(t),Jo.getLogger().warn(`[composed-children] A template claimed the child region AND the automatic container composed children in the same pass, so children render TWICE${e.length>0?` (placed: ${e.join(`, `)})`:``}. The handshake is render-phase, so the template must render BEFORE the container — check that the surface still renders its display template above <ResourceLayout_ContainerNested>.`))}function TY(e){let t=(0,Q.useContext)(SY);t&&e&&t.placed.add(e)}function EY(){let e=(0,Q.useContext)(SY);return e?e.owned.current||e.placed.size>0:!1}function DY(){let e=(0,Q.useContext)(SY);e&&(e.owned.current=!0)}var B_e=Object.freeze(new Set);function OY(e){let t=(0,Q.useContext)(SY);t&&e&&(t.composedAutomatically.current=!0)}function V_e(){return(0,Q.useContext)(SY)?.placed??B_e}function H_e(e,t){if(!t)return;let n=gn.getResourceId(e[t]);return typeof n==`string`&&n.length>0?n:void 0}function kY(e,t,n){let r=e.initiatorInfos??[];return r.length!==0&&r.some(e=>(e.parameters??[]).every(e=>[e.fieldIdentifier,e.relationshipField,e.resourceType].filter(e=>typeof e==`string`&&e.length>0).some(e=>H_e(t.contextResourceIdentifiers,e)!==void 0||n[e]!==void 0&&String(n[e]).length>0)))}function AY(e){let t=e.operations.filter(t=>kY(t,e.childContext,e.contextualParameters));return Il(t,W.LIST)}function U_e(e){return e.isOneToOne}function W_e(e){return e===Mr.COLLAPSIBLE}function G_e(e){let t=[];for(let n of e){let e=n.contentSectionConfig.mode;if(W_e(e)){t.push({type:`single`,config:n});continue}let r=JSON.stringify(n.contentSectionConfig),i=t[t.length-1];i?.type===`group`&&i.groupingKey===r?i.configs.push(n):t.push({type:`group`,mode:e,configs:[n],groupingKey:r})}return{items:t}}var jY=new Set;function MY(e,t,n){let r=`${e}->${t}`;jY.has(r)||(jY.add(r),Jo.getLogger().warn(`[nested-container] "${r}" is not displayable and was SKIPPED: no unambiguous LIST/READ operation could be resolved for the child. The parent surface still renders. Cause: ${Ca(n)}`))}var NY=new Set;function K_e(e,t){let n=`${e}->${t.childResourceType}`;NY.has(n)||(NY.add(n),Jo.getLogger().warn(`[nested-container] owned child "${n}" composes NOTHING: no addressable ${t.isOneToOne?`READ`:`LIST`} operation resolves for the child in this parent context. Common cause: the child operation is contextPolicy-disabled (e.g. operationOverrides.LIST.enabled=false) or not addressable here. Surface the child explicitly (a composite view / EmbedRelatedResourceOperation) or enable the operation.`))}var PY=({resourceContext:e,navigationZone:t,navigationInitiator:n,parentData:r})=>{let{resourceType:i}=e,{registry:a}=wm(),{tResourceHeader:o,isReady:s}=K({component:J.RESOURCES_LAYOUTS_CONTAINER_NESTED,resource:i}),{navigate:c}=zS(),{currentBreakpoint:l}=e_(),u=EY(),d=(0,Q.useMemo)(()=>[`resources.${i}`,`components.${J.RESOURCES_LAYOUTS_CONTAINER_NESTED}`],[i]),f=(0,Q.useMemo)(()=>a.resourceConfigurations[i],[a,i]),p=(0,Q.useMemo)(()=>f?.resourceRelationships?Za(f.resourceRelationships):[],[f]),m=(0,Q.useMemo)(()=>{if(p.length===0)return[];let t=[];for(let n of p){let s=Fj({parentResourceType:i,relationship:n,parentData:r,registry:a,viewport:l});if(!s)continue;let c=s.childResourceType,u=a.resourceConfigurations[c];if(!u)continue;let d=s.isOneToOne,p;try{p=gn.deriveChildResourceContext(e,{resourceType:c,operationIdentifier:d?W.READ:W.LIST,relationshipFieldOverrides:{[i]:s.foreignKeyField}},a)}catch(e){MY(i,c,e);continue}let m=V.buildContextualParameters(p.contextResourceIdentifiers,a),h=d?Th({resourceConfig:u,operations:u.operations??[],coreOperation:W.READ,registry:a,hasResourceId:!!gn.getResourceId(p.contextResourceIdentifiers?.[c]),contextResourceIdentifiers:p.contextResourceIdentifiers,contextualParameters:m}):p&&m?AY({operations:u.operations??[],childContext:p,contextualParameters:m}):void 0;if(!d&&h){let t;try{t=gn.deriveChildResourceContext(e,{resourceType:c,operationIdentifier:String(h.operationIdentifier),operation:h,relationshipFieldOverrides:{[i]:s.foreignKeyField}},a)}catch(e){MY(i,c,e);continue}let n=gn.getResourceId(e.contextResourceIdentifiers?.[i])||void 0,r=s.relationship.isPrimaryScope===!0;if(n!==void 0)try{r=ZG({childContext:t,hostResourceType:i,hostResourceId:n,hostRelationships:f?.resourceRelationships,selectedForeignKey:s.foreignKeyField,registry:a})===t}catch{r=!1}if(!r)continue}if(!h){K_e(i,s);continue}let g=im({tResourceHeader:o,resourceType:c,key:`title`});t.push({...s,label:g})}return t},[p,f,a,e,i,o,r,l]),h=(0,Q.useMemo)(()=>G_e(m),[m]),g=(0,Q.useMemo)(()=>{let t=e.contextResourceIdentifiers?.[i];if(t)return typeof t==`string`?t:t.resourceId},[e.contextResourceIdentifiers,i]),_=(0,Q.useCallback)((t,n)=>gn.deriveChildResourceContext(e,{resourceType:t.childResourceType,operationIdentifier:String(n.operationIdentifier),operation:n,relationshipFieldOverrides:{[i]:t.foreignKeyField}},a),[a,e,i]),v=(0,Q.useCallback)(t=>{let n=a.resourceConfigurations[t.childResourceType];if(!n)return;let r=gn.deriveChildResourceContext(e,{resourceType:t.childResourceType,operationIdentifier:W.READ,relationshipFieldOverrides:{[i]:t.foreignKeyField}},a),o=V.buildContextualParameters(r.contextResourceIdentifiers,a);return Th({resourceConfig:n,operations:n.operations??[],coreOperation:W.READ,registry:a,hasResourceId:!!gn.getResourceId(r.contextResourceIdentifiers?.[t.childResourceType]),contextResourceIdentifiers:r.contextResourceIdentifiers,contextualParameters:o})},[a,e,i]),y=(0,Q.useCallback)(t=>{let n=a.resourceConfigurations[t.childResourceType];if(!n)return;let r=gn.deriveChildResourceContext(e,{resourceType:t.childResourceType,operationIdentifier:W.LIST,relationshipFieldOverrides:{[i]:t.foreignKeyField}},a),o=V.buildContextualParameters(r.contextResourceIdentifiers,a);return AY({operations:n.operations??[],childContext:r,contextualParameters:o})},[a,e,i]),b=(0,Q.useCallback)(e=>{let n=a.resourceConfigurations[e.childResourceType]?e.isOneToOne?v(e):y(e):void 0;if(!n)return;let r=_(e,n);c({content:{contentType:hd.RESOURCE_OPERATION,resourceContext:r},initiator:{sourceZone:t,sourceOperation:ul(n),sourceRelationship:{parentResourceType:i,parentResourceId:g,childResourceType:e.childResourceType,foreignKeyField:e.foreignKeyField,relationshipEdgeKey:e.relationshipEdgeKey,inChildView:e.inChildView}},relationshipTransition:e.transition,relationshipMaxDepth:e.navigationConfig?.maxDepth})},[_,a,c,t,i,g,v,y]),x=e=>{if(e.transition)return(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:()=>b(e),children:e.label},e.relationshipEdgeKey);let r=a.resourceConfigurations[e.childResourceType];if(U_e(e)){let t=r?v(e):void 0;if(t){let n=_(e,t);return(0,$.jsx)(_Y,{resourceContext:n},e.relationshipEdgeKey)}return null}let o=r?y(e):void 0;if(!o)return null;let s=_(e,o),c={parentResourceType:i,parentResourceId:g,transition:typeof e.transition==`string`?e.transition:e.transition?.transition};return(0,$.jsx)(OX,{resourceContext:s,navigationZone:t,navigationInitiator:n,inlineParentContext:c,sourceRelationship:{parentResourceType:i,parentResourceId:g,childResourceType:e.childResourceType,foreignKeyField:e.foreignKeyField,relationshipEdgeKey:e.relationshipEdgeKey,inChildView:e.inChildView}},e.relationshipEdgeKey)},S=(0,Q.useCallback)(e=>({id:e.relationshipEdgeKey,title:e.label,content:(0,$.jsx)(xY,{descentKey:`nested:${e.relationshipEdgeKey}::${g||`no-row`}`,children:(0,$.jsx)(aA.Provider,{value:!0,children:x(e)})})}),[x,g]);return OY(m.length>0&&s&&!u),m.length===0||!s||u?null:(0,$.jsx)(yb,{i18nKeys:d,children:(0,$.jsx)(`div`,{className:`space-y-section`,children:h.items.map((e,t)=>e.type===`single`?(0,$.jsx)(nk,{config:{...e.config.contentSectionConfig,...e.config.contentSectionConfig.mode===Mr.COLLAPSIBLE?{showSingleSectionNav:!0}:{}},sections:[S(e.config)]},e.config.relationshipEdgeKey):(0,$.jsx)(nk,{config:e.configs[0].contentSectionConfig,sections:e.configs.map(S)},`relationship-group-${e.mode}-${t}`))})})};function FY({preset:e=q.DEFAULT,...t}){let n=G(J.RESOURCES_LAYOUTS_CONTAINER_NESTED,`ResourceLayout_ContainerNested`)(e);return(0,$.jsx)(n,{...t})}var IY=(0,Q.memo)(({resourceContext:e,navigationZone:t,navigationInitiator:n,currentObject:r,currentObjectDataMode:i,displayMode:a=Ac.DETAIL,onOperationExecuted:o,size:s=Xd.ICON_SM,maxDisplayed:c,excludeOperations:l,placementFilter:u,hostRowOpensRead:d=!1,orientation:f,className:p})=>{let{resourceType:m,operation:h}=e,g=jm()?.getResourceConfiguration(m)?.frontendConfiguration?.layout,_=g?.actionLabelDisplayMode?.[a],v=Q.useContext(__)?.UIConfig?.currentBreakpoint===ci.MOBILE,y=g?.actionDisclosure?.[a]?.maxPrimaryActions??c??(v?a===Ac.SUMMARY?0:1:void 0)??ie(a,g?.actionDisclosure).maxPrimaryActions,{items:b,isConfirmDialogOpen:x,confirmDialogLabel:S,confirmDialogDescription:C,confirmDialogConfirmLabel:w,confirmRequiresTypedConfirmation:T,confirmConfirmationPhrase:E,onConfirm:D,onCancel:O,ephemeralFields:k,onEphemeralAcknowledge:A}=rH({resourceType:m,displayMode:a,currentObject:r,...i?{currentObjectDataMode:i}:{},contextResourceIdentifiers:e.contextResourceIdentifiers,parentResourcesRequirements:e.parentResourcesRequirements,additionalContext:e.additionalContext,navigationZone:t,sourceOperation:h,excludeOperations:l,placementFilter:u,suppressViewDetails:d,onOperationExecuted:o});return b.length===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dC,{items:b,maxDisplayed:y,labelDisplayMode:_,orientation:f,size:s,className:p}),x&&(0,$.jsx)(Jw,{open:x,onOpenChange:e=>{e||O()},cancelCallback:O,validationCallback:D,label:S,description:C,confirmLabel:w,requireTypedConfirmation:T,confirmationPhrase:E}),k&&(0,$.jsx)(dG,{open:!0,onAcknowledge:A,fields:k,resourceType:m})]})});function LY({preset:e=q.DEFAULT,...t}){let n=G(J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`ResourceLayout_OperationsItems`)(e);return(0,$.jsx)(n,{...t})}function RY({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DANGER_ZONE,`DangerZone`)(e);return(0,$.jsx)(n,{...t})}function zY({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_HEADING,`Heading`)(e);return(0,$.jsx)(n,{...t})}function BY({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_SUBHEADING,`Subheading`)(e);return(0,$.jsx)(n,{...t})}var VY=({resourceContext:e,navigationZone:t,currentObject:n,onOperationExecuted:r,className:i,responsiveMaxWidth:a})=>{let{resourceType:o,operation:s}=e,{tComponent:c,tResourceOperation:l}=K({component:J.RESOURCES_LAYOUTS_DANGER_ZONE,resource:o}),{items:u,isConfirmDialogOpen:d,confirmDialogLabel:f,confirmDialogDescription:p,confirmDialogConfirmLabel:m,confirmRequiresTypedConfirmation:h,confirmConfirmationPhrase:g,onConfirm:_,onCancel:v}=rH({resourceType:o,displayMode:Ac.DETAIL,currentObject:n,contextResourceIdentifiers:e.contextResourceIdentifiers,parentResourcesRequirements:e.parentResourcesRequirements,additionalContext:e.additionalContext,navigationZone:t,sourceOperation:s,placementFilter:Ks.DANGER_ZONE,onOperationExecuted:r}),y=(0,Q.useMemo)(()=>u.flatMap(e=>e.type===`subgroup`?e.items.filter(e=>e.type!==`separator`&&e.type!==`subgroup`):e.type===`separator`?[]:[e]),[u]);if(y.length===0)return null;let b=e=>c(J.RESOURCES_LAYOUTS_DANGER_ZONE,e),x=b(`title`),S=e=>{switch(e){case ls.CRITICAL:return b(`descriptionCritical`);case ls.HIGH:return b(`descriptionHigh`);default:return b(`descriptionDefault`)}},C=e=>(e.operationIdentifier?l(o,e.operationIdentifier,`description`):``)||S(e.riskLevel);return(0,$.jsxs)(`section`,{"data-slot":`danger-zone-section`,"data-inline-size-tier":a,className:U(`mr-auto w-full flex flex-col gap-field-sm`,i),style:{maxInlineSize:mD(a)},children:[(0,$.jsx)(zY,{level:3,children:x}),(0,$.jsx)(RY,{className:`rounded-xl p-0 overflow-hidden divide-y divide-destructive/20`,children:y.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-field px-card py-card sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs`,children:[(0,$.jsx)(k_,{children:e.label}),(0,$.jsx)(Z,{variant:$u.MUTED,size:lu.SM,children:C(e)})]}),(0,$.jsx)(X,{variant:Qd(e.variant,lC(e)),disabled:e.disabled,onClick:e.onClick,className:`shrink-0 self-start sm:self-auto`,children:e.label})]},t))}),d&&(0,$.jsx)(Jw,{open:d,onOpenChange:e=>{e||v()},cancelCallback:v,validationCallback:_,label:f,description:p,confirmLabel:m,requireTypedConfirmation:h,confirmationPhrase:g})]})};function HY({preset:e=q.DEFAULT,...t}){let n=G(J.RESOURCES_LAYOUTS_DANGER_ZONE,`ResourceLayout_DangerZone`)(e);return(0,$.jsx)(n,{...t})}var q_e=Jo.getLogger(),UY;(function(e){e.IDLE=`idle`,e.LOADING=`loading`,e.READY=`ready`,e.NOT_SHAREABLE=`not_shareable`,e.FAILED=`failed`})(UY||={});function WY(e,t){return(e?.resourceConfigurations[Na.ORGANIZATION_RELATIONSHIPS]?.operations)?.find(e=>String(e.operationIdentifier)===t&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===Ya.API_CALL)}function GY(e,t,n,r){let i=Na.ORGANIZATION_RELATIONSHIPS,a={...pm.buildResourceOperationContextIdentifiers({currentOrganizationId:n,primaryScope:e.resourceConfigurations[i]?.resourcePrimaryScope,explicitContextResourceIdentifiers:{}}),...r?{[i]:r}:{}};return{operationPathKey:gl.buildOperationPathKeyFromOperation(t),contextualParameters:V.buildContextualParameters(a,e),parentResourcesRequirements:gn.buildParentResourcesRequirements(i,a,e)}}function J_e(e){let t=e;return(t?.response?.data?.error?.details?.code??t?.context?.code)===dre.RELATIONSHIP_RECORD_NOT_SHAREABLE}var KY={relationships:[],viaRelationshipId:null,sharedWithRelationshipIds:[],commonToEveryRelationship:!1};function Y_e(e){let t=(0,Q.useContext)(ym),n=t?.registry,r=(0,Q.useRef)(t?.doOperation);r.current=t?.doOperation;let[i,a]=(0,Q.useState)(0),[o,s]=(0,Q.useState)(UY.IDLE),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(KY),{enabled:f,organizationId:p,resourceType:m,recordId:h}=e,[g,_]=(0,Q.useState)(void 0),v=f&&p&&h?`${p}|${m}|${h}`:void 0,y=(0,Q.useRef)(void 0);(0,Q.useEffect)(()=>{let e=r.current,t=WY(n,vr.READ_RECORD_SHARING);if(!f||!n||!e||!p||!h||!t){y.current=void 0,_(void 0),s(UY.IDLE),l(!1),d(KY);return}let i=!1,a=`${p}|${m}|${h}`;return y.current===a?l(!0):(y.current=void 0,l(!1),d(KY),s(UY.LOADING)),(async()=>{try{let r=GY(n,t,p),o=St.parse(await e(r.operationPathKey,{contextualParameters:r.contextualParameters,parentResourcesRequirements:r.parentResourcesRequirements,requestData:{resourceType:m,recordId:h}},{silent:!0}));if(i)return;d({relationships:o.relationships.map(({representingOrganizationName:e,...t})=>({...t,...e?{name:e}:{}})),viaRelationshipId:o.viaRelationshipId,sharedWithRelationshipIds:o.sharedWithRelationshipIds,commonToEveryRelationship:o.commonToEveryRelationship}),y.current=a,_(a),s(UY.READY),l(!1)}catch(e){if(i)return;if(y.current=void 0,_(a),l(!1),d(KY),J_e(e)){s(UY.NOT_SHAREABLE);return}q_e.warn(`[RecordSharing] The record's sharing could not be read`,{resourceType:m,backendRefusal:Er(e)}),s(UY.FAILED)}})(),()=>{i=!0}},[f,n,p,m,h,i]);let b=(0,Q.useCallback)(async(e,t)=>{let i=r.current,o=WY(n,e);if(!n||!i||!o||!p||!h)throw Error(`The ${e} operation of organization relationships is not available in this frontend.`);let s=GY(n,o,p,t);l(!0);try{await i(s.operationPathKey,{contextualParameters:s.contextualParameters,parentResourcesRequirements:s.parentResourcesRequirements,requestData:{resourceType:m,recordId:h}})}finally{a(e=>e+1)}},[n,p,m,h]),x=(0,Q.useCallback)(e=>b(vr.SHARE_RECORD,e),[b]),S=(0,Q.useCallback)(e=>b(vr.UNSHARE_RECORD,e),[b]);return o!==UY.IDLE&&o!==UY.LOADING&&g!==v?{readState:UY.LOADING,refreshing:!1,relationships:KY.relationships,viaRelationshipId:KY.viaRelationshipId,sharedWithRelationshipIds:KY.sharedWithRelationshipIds,commonToEveryRelationship:KY.commonToEveryRelationship,share:x,unshare:S}:{readState:o,refreshing:c,relationships:u.relationships,viaRelationshipId:u.viaRelationshipId,sharedWithRelationshipIds:u.sharedWithRelationshipIds,commonToEveryRelationship:u.commonToEveryRelationship,share:x,unshare:S}}function X_e(e,t){let n=e?._id??(t?e?.[t]:void 0);return(typeof n==`string`||typeof n==`number`)&&String(n).length>0?String(n):void 0}function qY(e){let t=e.registry?.resourceConfigurations[e.resourceType];if(!t||!ku(e.resourceType,t.resourcePrimaryScope)||Te.includes(e.resourceType)||!e.recordId||!e.currentOrganizationId||e.recordOrganizationId!==e.currentOrganizationId||!e.grants)return!1;let n=e.registry?.resourceConfigurations[Na.ORGANIZATION_RELATIONSHIPS]?.resourcePrimaryScope,r=t=>!!t&&th({...t,resourceType:Na.ORGANIZATION_RELATIONSHIPS,resourcePrimaryScope:n},e.viewer);return r(WY(e.registry,vr.READ_RECORD_SHARING))&&r(WY(e.registry,vr.SHARE_RECORD))&&!!WY(e.registry,vr.UNSHARE_RECORD)}var JY=({resourceContext:e,currentObject:t,className:n,responsiveMaxWidth:r})=>{let{resourceType:i}=e,{tComponent:a,formatList:o}=K({component:J.RESOURCES_LAYOUTS_RECORD_SHARING,resource:i}),s=(e,t)=>a(J.RESOURCES_LAYOUTS_RECORD_SHARING,e,t),c=(0,Q.useContext)(ym)?.registry,l=lm()?.currentOrganizationId??void 0,u=X_e(t,c?.resourceConfigurations[i]?.resourceFieldIdentifier),d=(typeof t?.organizationId==`string`&&t.organizationId.length>0?t.organizationId:void 0)??Dh(i,u,e.contextResourceIdentifiers),f=wS(d),p=DS()[Av.GRANTS],m=qY({registry:c,resourceType:i,recordId:u,recordOrganizationId:d,currentOrganizationId:l,grants:p,viewer:f}),h=Y_e({enabled:m,organizationId:d,resourceType:i,recordId:u}),[g,_]=(0,Q.useState)(void 0),[v,y]=(0,Q.useState)(void 0),[b,x]=(0,Q.useState)(!1),S=`${i}|${u??``}`,[C,w]=(0,Q.useState)(S);C!==S&&(w(S),_(void 0),y(void 0));let T=(0,Q.useMemo)(()=>new Map(h.relationships.map(e=>[e.relationshipId,e])),[h.relationships]),E=e=>T.get(e)?.name??s(`unnamedRelationship`),D=h.relationships.filter(e=>e.wouldReadIfShared&&!h.sharedWithRelationshipIds.includes(e.relationshipId)),O=e=>e!==void 0&&D.some(t=>t.relationshipId===e),k=h.readState!==UY.LOADING&&!h.refreshing;k&&g!==void 0&&!O(g)&&_(void 0),k&&v!==void 0&&!O(v)&&y(void 0);let A=g,j=v,M=h.relationships.filter(e=>e.readsWithoutShare&&e.relationshipId!==h.viaRelationshipId),N=h.relationships.filter(e=>e.confersNow),P=!h.commonToEveryRelationship&&N.length>0&&N.every(e=>!e.rolesReachRecord),F=h.viaRelationshipId===null?void 0:T.get(h.viaRelationshipId),I=e=>{let t=T.get(e);if(!t?.confersNow)return s(`relationshipInactive`);if(t.readsWithoutShare)return s(`readsWithoutShare`);if(!t.rolesReachRecord)return s(`shareHasNoEffect`)};if(!m||h.readState!==UY.READY&&h.readState!==UY.FAILED||h.readState===UY.READY&&h.viaRelationshipId===null&&h.sharedWithRelationshipIds.length===0&&D.length===0&&M.length===0)return null;let ee=b||h.refreshing,L=e=>{x(!0),e().then(()=>_(void 0)).catch(()=>void 0).finally(()=>x(!1))},R=WY(c,vr.SHARE_RECORD),te=e=>{qo(R?.riskLevel)?y(e):L(()=>h.share(e))};return(0,$.jsxs)(`section`,{"data-slot":`record-sharing-section`,"data-inline-size-tier":r,className:U(`mr-auto w-full flex flex-col gap-field-sm`,n),style:{maxInlineSize:mD(r)},children:[(0,$.jsx)(zY,{level:3,children:s(`title`)}),(0,$.jsx)(MF,{className:`rounded-xl p-0 overflow-hidden divide-y divide-border`,children:h.readState===UY.FAILED?(0,$.jsx)(`div`,{className:`px-card py-card`,children:(0,$.jsx)(Z,{variant:$u.MUTED,size:lu.SM,children:s(`readFailed`)})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs px-card py-card`,children:[(0,$.jsx)(Z,{size:lu.SM,children:h.viaRelationshipId===null?s(`ownRecord`):s(`createdThrough`,{relationship:E(h.viaRelationshipId)})}),h.viaRelationshipId!==null&&!F?.confersNow&&(0,$.jsx)(Z,{variant:$u.MUTED,size:lu.SM,children:s(`relationshipInactive`)}),h.viaRelationshipId!==null&&F?.confersNow&&!F.rolesReachRecord&&(0,$.jsx)(Z,{variant:$u.MUTED,size:lu.SM,children:s(`creatorCannotRead`)}),(0,$.jsx)(Z,{variant:$u.MUTED,size:lu.SM,children:h.commonToEveryRelationship?s(`commonToEveryRelationship`):s(P?`notReadableByRelationships`:`description`)}),M.length>0&&!h.commonToEveryRelationship&&(0,$.jsx)(Z,{variant:$u.MUTED,size:lu.SM,children:s(`alreadyReadBy`,{relationships:o(M.map(e=>E(e.relationshipId)))})})]}),h.sharedWithRelationshipIds.length===0?(0,$.jsx)(`div`,{className:`px-card py-card`,children:(0,$.jsx)(Z,{variant:$u.MUTED,size:lu.SM,children:s(`notShared`)})}):h.sharedWithRelationshipIds.map(e=>{let t=I(e);return(0,$.jsxs)(`div`,{"data-slot":`record-sharing-share`,className:`flex flex-col gap-field px-card py-card sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-xs`,children:[(0,$.jsx)(k_,{children:E(e)}),t!==void 0&&(0,$.jsx)(Z,{variant:$u.MUTED,size:lu.SM,children:t})]}),(0,$.jsx)(X,{variant:Y.OUTLINE,disabled:ee,onClick:()=>L(()=>h.unshare(e)),className:`shrink-0 self-start sm:self-auto`,children:s(`withdraw`)})]},e)}),D.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-field px-card py-card sm:flex-row sm:items-center`,children:[(0,$.jsx)(bF,{name:`recordSharingRelationship`,schema:kd(),options:D.map(e=>({value:e.relationshipId,label:E(e.relationshipId)})),value:A,onChange:_,placeholder:s(`chooseRelationship`),size:rf.SM,disabled:ee}),(0,$.jsx)(X,{variant:Y.SECONDARY,disabled:ee||!A,onClick:()=>{A&&te(A)},className:`shrink-0 self-start sm:self-auto`,children:s(`share`)})]})]})}),j!==void 0&&(0,$.jsx)(Jw,{open:!0,onOpenChange:e=>{e||y(void 0)},cancelCallback:()=>y(void 0),validationCallback:()=>{let e=j;y(void 0),L(()=>h.share(e))},label:s(`confirmShareTitle`,{relationship:E(j)}),description:s(`confirmShareDescription`),confirmLabel:s(`share`)})]})};function YY({preset:e=q.DEFAULT,...t}){let n=G(J.RESOURCES_LAYOUTS_RECORD_SHARING,`ResourceLayout_RecordSharing`)(e);return(0,$.jsx)(n,{...t})}var XY=(0,Q.createContext)(void 0);function ZY(){return(0,Q.useContext)(XY)}function Z_e(e){let{registry:t,doOperation:n}=wm(),[r,i]=(0,Q.useState)(void 0),a=(0,Q.useMemo)(()=>{if(!e.enabled)return!1;let n=t.resourceConfigurations[e.resourceContext.resourceType];return(n?.resourceRelationships?Za(n.resourceRelationships):[]).some(e=>e.discriminator!=null||e.condition!=null)},[e.enabled,e.resourceContext.resourceType,t]),o=uV({resourceType:e.resourceContext.resourceType,rowIds:[gn.getResourceId(e.resourceContext.contextResourceIdentifiers?.[e.resourceContext.resourceType]),typeof r?._id==`string`?r._id:null],enabled:a}),s=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{if(!a){i(void 0);return}let r=t.resourceConfigurations[e.resourceContext.resourceType];if(!r){i(void 0);return}let o=V.buildContextualParameters(e.resourceContext.contextResourceIdentifiers,t),c=gn.getResourceId(e.resourceContext.contextResourceIdentifiers?.[e.resourceContext.resourceType]),l=Th({resourceConfig:r,operations:r.operations??[],coreOperation:W.READ,registry:t,hasResourceId:!!c,contextResourceIdentifiers:e.resourceContext.contextResourceIdentifiers,contextualParameters:o});if(!l){i(void 0);return}let u=gl.createOperationPathKeyFromOperation(l),d=`${u}|${JSON.stringify(o)}`,f=s.current===d;s.current=d;let p=!1;return n(u,{contextualParameters:o,parentResourcesRequirements:e.resourceContext.parentResourcesRequirements}).then(e=>{p||(e&&typeof e==`object`&&!Array.isArray(e)&&!(`data`in e)?i(e):i(void 0))}).catch(()=>{!p&&!f&&i(void 0)}),()=>{p=!0}},[n,e.resourceContext.contextResourceIdentifiers,e.resourceContext.parentResourcesRequirements,e.resourceContext.resourceType,t,a,o?.at]),r}var QY=({resourceContext:e,navigationZone:t,navigationInitiator:n,inlineParentContext:r,children:i,showCharts:a=!0})=>{let{goBack:o,canGoBack:s,navigate:c}=zS(),{getZoneState:l}=Zx(),{registry:u}=wm(),{tComponent:d,isReady:f}=K({component:J.RESOURCES_LAYOUTS_READ}),{resourceContext:p,resourceType:m,operation:h,isSemanticCustomOperation:g,reportError:_,resolvePreferredOperation:v,navigateToResourceOperation:y}=gC({resourceContext:e,navigationZone:t,navigationInitiator:n}),[b,x]=(0,Q.useState)(void 0),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(void 0),[E,D]=(0,Q.useState)(void 0),O=(0,Q.useCallback)((e,t)=>{x(e),C(!1),T(t.canonicalRecord),D(t.holdsCanonicalRecord)},[]),k=E??String(p.operation.operationIdentifier)===W.READ,A=(0,Q.useMemo)(()=>k?{record:w,failed:S}:void 0,[k,w,S]),j=jp({tComponent:d,componentType:J.RESOURCES_LAYOUTS_READ,key:`displayFailed`}),M=jp({tComponent:d,componentType:J.RESOURCES_LAYOUTS_READ,key:`semanticOperationFailed`}),N=Z_e({resourceContext:p,enabled:g}),P=(0,Q.useMemo)(()=>Lj({inlineParentContext:r,navigationZone:t,navigationInitiator:n,getZoneState:l}),[r,t,n,l]),F=(0,Q.useCallback)(e=>{let n=P?.parentReference,r=n?.parentResourceType,i=t?l(t):void 0,a=i&&i.activeTabId===void 0?i.stack[i.stack.length-2]:void 0;if(a?.content.contentType===hd.RESOURCE_OPERATION&&a.content.resourceContext.resourceType===r&&gn.getAddressedRecordId(a.content.resourceContext)===e&&s(t))return o(t),!0;if(!n||!r)return!1;let d=u.resourceConfigurations[r];if(!d)return!1;let f=p.contextResourceIdentifiers??{},m=p.parentResourcesRequirements??[],h=m[m.length-1]?.resourceType===r?m.slice(0,-1):gn.buildParentResourcesRequirements(r,f,u),g={};for(let e of h){let t=e.foreignKeyField??e.resourceType,n=f[t]??f[e.resourceType],r=gn.getResourceId(n);r&&(e.foreignKeyField?g[t]={fieldIdentifier:e.foreignKeyField,resourceId:r}:g[e.resourceType]=r)}g[r]=e;let _=V.buildContextualParameters(g,u),v=Th({resourceConfig:d,operations:d.operations??[],coreOperation:W.READ,registry:u,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:g,contextualParameters:_});if(!v)return!1;let y=gn.createFrontendResourceOperationContextFromOperation({resourceType:r,operation:v,contextResourceIdentifiers:g,parentResourcesRequirements:h}),b=Ch.resolveResourceUrl(d,v,ju(g),u.allResourceFieldIdentifiers,h);return c({content:{contentType:hd.RESOURCE_OPERATION,resourceContext:y},initiator:{sourceZone:t},urlPath:b?.resolvedUrl}),!0},[s,p.contextResourceIdentifiers,p.parentResourcesRequirements,l,o,c,P,t,u]),I=(0,Q.useMemo)(()=>{let e=P?.parentReference;if(e)return{parentResourceType:e.parentResourceType,parentResourceId:e.parentResourceId,displayMode:e.parentDisplay??hr.CONTEXT,showParentLink:e.showParentLink,onNavigateToParent:F}},[P,F]),ee=(0,Q.useCallback)(e=>{C(!0),_(e,j,`ResourceLayoutPreset_Read_Default`)},[j,_]),L=(0,Q.useCallback)(e=>{let n=ul(e);if(n!==W.DELETE&&n!==W.DELETE_MANY)return;if(s(t)||t!==li.PRIMARY){o(t);return}let r=v(W.LIST);if(!r)return;let{[m]:i,...a}=p.contextResourceIdentifiers??{};y({operation:r,contextResourceIdentifiers:a,parentResourcesRequirements:p.parentResourcesRequirements})},[o,s,t,v,y,m,p.contextResourceIdentifiers,p.parentResourcesRequirements]),R=(0,Q.useMemo)(()=>V.flattenContextIdentifiers(p.contextResourceIdentifiers),[p.contextResourceIdentifiers]);return f===!1?null:g?(0,$.jsx)(VU,{hostResourceType:p.resourceType,contextResourceIdentifiers:R,navigationZone:t,navigationInitiator:n,children:(0,$.jsxs)(CY,{children:[(0,$.jsx)(_V,{resourceContext:p,navigationZone:t,navigationInitiator:n,errorMessage:M,errorComponent:`ResourceLayoutPreset_Read_Default`,headerActions:(0,$.jsx)(SX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:bX.ACTION_BAR}),recordNavigation:(0,$.jsx)(SX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:bX.RECORD_NAVIGATION})}),(0,$.jsxs)(ND,{voice:Lu.EYEBROW,children:[(0,$.jsx)(SX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:bX.CONTENT}),(0,$.jsx)(FY,{resourceContext:p,navigationZone:t,navigationInitiator:n,parentData:N})]})]})}):(0,$.jsx)(VU,{hostResourceType:p.resourceType,contextResourceIdentifiers:R,navigationZone:t,navigationInitiator:n,children:(0,$.jsx)(CY,{children:(0,$.jsxs)(`div`,{className:`space-y-section [--record-body-max-inline-size:var(--measure-max-width,42rem)] has-[[data-record-body]_[data-guidance-display][data-inline-size-tier=derived]_[data-collection-surface]]:[--record-body-max-inline-size:none] has-[[data-record-body]_[data-guidance-display][data-inline-size-tier=none]]:[--record-body-max-inline-size:none]`,children:[(0,$.jsx)(pV,{resourceContext:p,navigationZone:t,navigationInitiator:n,parentReferenceConfig:I,heldRecord:A,actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(SX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:bX.ACTION_BAR}),(0,$.jsx)(LY,{resourceContext:p,currentObject:b,navigationZone:t,navigationInitiator:n,displayMode:Ac.DETAIL,placementFilter:Ks.PRIMARY,size:Xd.ICON_SM,onOperationExecuted:L})]})}),(0,$.jsx)(SX,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:bX.RECORD_NAVIGATION}),(0,$.jsx)(`div`,{"data-record-body":!0,children:(0,$.jsx)(_Y,{resourceContext:p,navigationZone:t,onError:ee,onDataLoaded:O,parentReferenceConfig:I,recordNameShownAbove:!0})}),(0,$.jsx)(SX,{resourceContext:p,navigationZone:t,showCharts:a,renderSlot:bX.CONTENT}),(0,$.jsxs)(ND,{voice:Lu.EYEBROW,children:[(0,$.jsx)(XY.Provider,{value:b,children:i}),(0,$.jsx)(FY,{resourceContext:p,navigationZone:t,navigationInitiator:n,parentData:b})]}),(0,$.jsx)(YY,{resourceContext:p,navigationZone:t,navigationInitiator:n,currentObject:b,className:`[max-inline-size:var(--record-body-max-inline-size)]`}),(0,$.jsx)(HY,{resourceContext:p,navigationZone:t,navigationInitiator:n,currentObject:b,onOperationExecuted:L,className:`[max-inline-size:var(--record-body-max-inline-size)]`})]})})})},$Y=(0,Q.createContext)(new Set);function eX({preset:e,...t}){let n=QW(t.resourceContext.operation),r=$W(t.resourceContext.operation),i=e??r??ol.DEFAULT,a=(0,Q.useContext)($Y),o=(0,Q.useMemo)(()=>gl.createOperationPathKeyFromOperation(t.resourceContext.operation),[t.resourceContext.operation]),s=!!n&&a.has(o),c=(0,Q.useMemo)(()=>n&&!s?new Set([...a,o]):a,[n,s,a,o]);if(n&&!s)return(0,$.jsx)($Y.Provider,{value:c,children:(0,$.jsx)(n,{...t})});let l=G(J.RESOURCES_LAYOUTS_READ,`ResourceLayout_Read`)(i);return(0,$.jsx)($.Fragment,{children:(0,$.jsx)(l,{...t})})}var tX=Jo.getLogger(),nX=({resourceContext:e,navigationZone:t,navigationInitiator:n,dataMode:r})=>{let{resourceType:i,operation:a,resourceConfig:o,operationInitiator:s,contextualParameters:c,navigateToResourceOperation:l}=gC({resourceContext:e,navigationZone:t,navigationInitiator:n}),{tComponent:u,tResourceFieldDisplay:d,tResourceFieldEnumValue:f}=K({component:[J.RESOURCES_LAYOUTS_SEARCH,J.RESOURCES_LAYOUTS_LIST],resource:i}),p=bp(),m=e=>u(J.RESOURCES_LAYOUTS_SEARCH,e),{renderIcon:h}=Rf(),{getRecipe:g}=e_(),_=g(wi.INTERACTIVE,dd.GHOST),{registry:v,doOperation:y}=wm(),[b]=bh(),x=a.operationFrontendConfig?.collectionDisplayConfig,S=x?.cardLayout,C=x?.cardActionPlacement,w=x?.selectable??!1,T=S?.style===Pl.GRID,E=S?.style===Pl.GRID?S.columns:void 0,D=o?.resourceFieldIdentifier,O=iH({idField:D}),k=tS(),[A,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)([]),ee=(0,Q.useRef)(null),L=Rq(ee,O.selectionCount>0),R=Lq(O.selectionCount>0),te=F.length>0&&F.every(e=>O.isSelected(e)),z=(0,Q.useCallback)(()=>{F.length>0&&F.every(e=>O.isSelected(e))?F.forEach(e=>O.deselectItem(e)):F.forEach(e=>O.selectItem(e))},[F,O]),[B,ne]=(0,Q.useState)(null),[re,ie]=(0,Q.useState)(!1),[ae,oe]=(0,Q.useState)(()=>{let e=a,t=e?.pageSize??20,n=e?.maxPaginatedResultPerPageLimit;return{page:1,limit:n?Math.min(t,n):t,total:0,totalPages:0}}),[se,ce]=(0,Q.useState)(!1),[le,ue]=(0,Q.useState)([]),[de,fe]=(0,Q.useState)({});(0,Q.useEffect)(()=>{O.clearSelection()},[N,de]);let pe=(0,Q.useMemo)(()=>[`resources.${i}`,`components.${J.RESOURCES_LAYOUTS_SEARCH}`],[i]),me=a?.operationIdentifier??W.SEARCH,{isInitialLoad:he,isRefreshing:ge}=hb(Dg({resourceType:i,operation:me})),_e=(0,Q.useRef)(y),ve=(0,Q.useRef)(e),ye=(0,Q.useRef)(le),be=(0,Q.useRef)(de);_e.current=y,ve.current=e,ye.current=le,be.current=de;let xe=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]),Se=(0,Q.useMemo)(()=>HG.searchOperationAcceptsATerm(a),[a]),Ce=(0,Q.useMemo)(()=>HG.detectSummaryFields(o),[o]),we=(0,Q.useMemo)(()=>jp({tComponent:u,componentType:J.RESOURCES_LAYOUTS_SEARCH,key:`resultsLabel`}),[u]),Te=(0,Q.useMemo)(()=>{let e={};for(let t of Ce)e[t]=d(i,t,`label`);return e},[Ce,i,d]),Ee=(0,Q.useCallback)(e=>o?Th({resourceConfig:o,operations:o.operations??[],coreOperation:W.READ,registry:v,hasResourceId:gn.getResourceId(e[i]).length>0,requireFrontendAddressable:!0,contextResourceIdentifiers:e,contextualParameters:V.buildContextualParameters(e,v)})??null:null,[v,o,i]),{sortFields:De,filterFields:Oe,filtersEnabled:ke}=(0,Q.useMemo)(()=>{let t=a,n=t?.sortFields??[],r=HG.parseFilterFieldDefinitions(t?.filterFields,o?{registry:v,resourceConfig:o,operation:a,contextualParameters:c,parentResourcesRequirements:e.parentResourcesRequirements}:void 0),i=HG.withoutPinnedFilterFields(r,e.pinnedFilters);return{sortFields:n,filterFields:i,filtersEnabled:i.length>0}},[a,v,o,c,e.parentResourcesRequirements,e.pinnedFilters]),Ae=(0,Q.useMemo)(()=>gn.extractDataMode(b,r),[b,r]),je=(0,Q.useMemo)(()=>gl.createOperationPathKeyFromOperation(a),[a]),Me=HG.matchListingOf(a);(0,Q.useEffect)(()=>{let e=setTimeout(()=>{P(A)},300);return()=>clearTimeout(e)},[A]);let Ne=le.map(e=>`${e.field}:${e.direction}`).join(`,`),Pe=(0,Q.useMemo)(()=>JSON.stringify(de),[de]),Fe=(0,Q.useMemo)(()=>JSON.stringify(e.pinnedFilters??{}),[e.pinnedFilters]),{emit:Ie}=vo();(0,Q.useEffect)(()=>{Ie(hc.RESOURCE_COLLECTION_FILTERS_CHANGED,{resourceType:i,filterValues:be.current})},[Pe,i,Ie]);let Le=`${i}|${je}|${xe}|${N}|${ae.page}|${ae.limit}|${Ne}|${Pe}|${Fe}|${Se}`;(0,Q.useEffect)(()=>{if(!N&&!re&&Se)return;let e=!1,t=!1,n=()=>{t||(t=!0,ce(!1))};return(async()=>{ce(!0),ne(null),ie(!0);try{let t=HG.withPinnedFilters(be.current,ve.current.pinnedFilters),n=Object.keys(t).length>0?t:void 0,r={contextualParameters:c,searchQuery:N||void 0,filters:n,pagination:{page:ae.page,limit:ae.limit},sort:ye.current.length?[...ye.current]:void 0,parentResourcesRequirements:ve.current.parentResourcesRequirements,dataMode:Ae},i=await _e.current(je,r);if(e)return;if(i&&typeof i==`object`&&`data`in i&&`pagination`in i){let e=i;I(e.data),oe(e.pagination)}else Array.isArray(i)&&(I(i),oe(e=>({...e,total:i.length,totalPages:1})))}catch(t){if(e)return;let n=j(t);ne({message:p(t)}),tX.error(`[ResourceLayoutPreset_Search_Default] Search error:`,{...n,error:t})}finally{e||n()}})(),()=>{e=!0,n()}},[Le]);let Re=(0,Q.useCallback)(e=>{if(!o)return;let t=V.getResourceObjectId(e,o.resourceFieldIdentifier);if(!t){tX.error(`[ResourceLayoutPreset_Search] Result click ignored: could not resolve resource id from search result.`,{resourceType:i,fieldIdentifier:o.resourceFieldIdentifier,itemKeys:Object.keys(e??{})});return}let n=gn.buildRecordIdentifiersFromCollection(ve.current.contextResourceIdentifiers,i,t),r=Ee(n);r&&l({operation:r,contextResourceIdentifiers:n,parentResourcesRequirements:ve.current.parentResourcesRequirements,initiatorOverride:s})},[o,o?.resourceFieldIdentifier,i,l,s,Ee]),ze=(0,Q.useCallback)(e=>{ue(e),oe(e=>({...e,page:1}))},[]),Be=(0,Q.useCallback)(e=>{fe(e),oe(e=>({...e,page:1}))},[]),Ve=(0,Q.useCallback)(e=>{e.preventDefault(),P(A)},[A]),He=h(H.SEARCH,{size:fa.SM});return(0,$.jsx)(yb,{i18nKeys:pe,readiness:[{id:`search-initial-load`,isReady:!he}],renderLoading:()=>(0,$.jsx)(Tm,{template:`list`,density:`auto`,role:`status`,"aria-live":`polite`,"aria-busy":`true`,"aria-label":`Loading`}),children:(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(pV,{resourceContext:e,navigationZone:t,navigationInitiator:n}),Se&&(0,$.jsxs)(`form`,{onSubmit:Ve,role:`search`,className:`flex gap-element`,children:[(0,$.jsx)(`div`,{className:`flex-1`,children:(0,$.jsx)(iN,{type:`text`,value:A,onChange:e=>M(e.target.value),placeholder:m(`placeholder`),"aria-label":m(`placeholder`),prefix:He})}),(0,$.jsx)(X,{type:`submit`,disabled:se,children:m(`search`)})]}),(ke||De.length>0&&re)&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-sm`,children:[ke&&Oe.length>0&&(0,$.jsx)(tq,{resourceType:i,filterFields:Oe,currentFilters:de,onFiltersChange:Be}),De.length>0&&re&&(0,$.jsx)(xq,{resourceType:i,sortFields:De,currentSorts:le,onSortChange:ze})]}),w&&re&&(F.length>0||O.selectionCount>0||R.backgroundRunState!==Fq.NONE)&&(0,$.jsxs)(`div`,{ref:ee,className:`flex flex-nowrap items-center gap-element`,"data-slot":`collection-selection-row`,children:[F.length>0&&(0,$.jsx)(Oq,{state:Dq(F.length,F.filter(e=>O.isSelected(e)).length),onToggle:z}),(0,$.jsx)(Eq,{count:O.selectionCount,onClear:O.clearSelection,...te&&!O.matchAllSelection&&ae.total>F.length&&Me?{matchAllOffer:{matchedCount:ae.total,onSelectAllMatching:()=>O.selectAllMatching({filters:HG.withPinnedFilters(de,e.pinnedFilters),...N?{search:N}:{},listing:Me,matchedCount:ae.total})}}:{},...O.matchAllSelection?{isMatchAllSelected:!0}:{}}),R.isBulkBarMounted&&(0,$.jsx)(`div`,{className:`ms-auto min-w-0`,children:(0,$.jsx)(Mq,{density:L.density,onActionSetChange:L.reportActionSet,onBackgroundRunChange:R.onBackgroundRunChange,children:(0,$.jsx)($J,{resourceContext:e,navigationZone:t,navigationInitiator:n,selectedItems:O.selectedItems,selectedItemsDataMode:Ae,matchAllSelection:O.matchAllSelection,explicitIdSelection:O.explicitIdSelection,onSelectIds:O.selectIds,idField:D,onSelectionClear:O.clearSelection,onSelectionReplace:O.selectAll})})})]}),B&&(0,$.jsx)(nb,{variant:`error`,iconRef:H.ERROR_APPLICATION,title:jp({tComponent:u,componentType:J.RESOURCES_LAYOUTS_SEARCH,key:`errorLoading`}),message:B.message}),k.isCreateActive&&(0,$.jsx)(LG,{navigationZone:t,className:`border border-border rounded-lg`}),re&&!B&&(0,$.jsxs)($.Fragment,{children:[F.length===0?(0,$.jsx)(`div`,{className:`text-center py-section text-muted-foreground text-sm`,role:`status`,children:jp({tComponent:u,componentType:J.RESOURCES_LAYOUTS_LIST,key:`noSearchResults`})}):(0,$.jsx)(`div`,{className:`space-y-item-sm`,children:(0,$.jsx)(`ul`,{role:`list`,"aria-label":we,style:kG(E),className:U(OG(E),ge&&`opacity-70 transition-opacity duration-150 motion-reduce:transition-none`),"aria-busy":he||ge||void 0,children:F.map((n,r)=>{let a=o?.resourceFieldIdentifier;if(!a)throw V.buildConfigurationError(ii.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:i,component:`ResourceLayoutPreset_Search`});let s=V.getResourceObjectId(n,a);return k.isElementActive(s)?(0,$.jsx)(`li`,{className:U(`list-none`,T&&`border border-border rounded-lg overflow-hidden`),children:(0,$.jsx)(LG,{navigationZone:t})},s||r):(0,$.jsx)(`li`,{className:U(`list-none`,T&&`border border-border rounded-lg overflow-hidden`),children:(0,$.jsx)(IG,{item:n,resourceType:i,resourceConfig:o,registry:v,collectionContextResourceIdentifiers:e.contextResourceIdentifiers,summaryFields:Ce,fieldLabelsMap:Te,tResourceFieldEnumValue:f,onItemClick:Re,cardActionPlacement:C,selectable:w,isSelected:O.isSelected(n),selectionActive:O.selectionCount>0,onToggleSelect:O.toggleSelection,selectAriaLabel:u(J.RESOURCES_LAYOUTS_LIST,`selectRow`,{row:r+1}),interactiveClasses:{hover:_.states.hover,transition:_.motion.transition}})},s||r)})})}),(0,$.jsx)(iK,{pagination:ae,onPaginationChange:oe})]})]})})};function rX({preset:e,...t}){let n=QW(t.resourceContext.operation),r=$W(t.resourceContext.operation),i=e??r??xs.DEFAULT,a=n?(0,$.jsx)(n,{...t}):Q.createElement(G(J.RESOURCES_LAYOUTS_SEARCH,`ResourceLayout_Search`)(i),t);return(0,$.jsx)(eS,{resourceType:t.resourceContext.resourceType,children:(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,[DA]:!0,children:a})})}var iX=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>{let{tComponent:r,isReady:i}=K({component:J.RESOURCES_LAYOUTS_UPDATE}),{resourceContext:a,operation:o,isSemanticCustomOperation:s,navigateToPreferredRead:c,goBackWithinZone:l,reportError:u}=gC({resourceContext:e,navigationZone:t,navigationInitiator:n}),d=jp({tComponent:r,componentType:J.RESOURCES_LAYOUTS_UPDATE,key:`formUpdateFailed`}),f=jp({tComponent:r,componentType:J.RESOURCES_LAYOUTS_UPDATE,key:`semanticOperationFailed`}),{closeOverlay:p}=zS(),m=(0,Q.useCallback)(()=>{o.isBulkOperation?l():c({transitionOverride:t===qn.OVERLAY?ln.PROMOTE:void 0})},[l,c,t,o.isBulkOperation]),h=iz(a,o),g=(0,Q.useCallback)(e=>{h(e),m()},[h,m]),_=(0,Q.useCallback)(e=>{u(e,d,`ResourceLayoutPreset_Update_Default`)},[d,u]),v=(0,Q.useMemo)(()=>t===qn.OVERLAY?()=>p():void 0,[t,p]);return i?s?(0,$.jsx)(_V,{resourceContext:a,navigationZone:t,navigationInitiator:n,errorMessage:f,errorComponent:`ResourceLayoutPreset_Update_Default`,onSuccess:m,onCancel:v}):(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(pV,{resourceContext:a,navigationZone:t,navigationInitiator:n}),(0,$.jsx)(xB,{resourceContext:a,navigationZone:t,onSuccess:g,onError:_,onCancel:v,showErrorSummary:!0})]}):null};function aX({preset:e,...t}){let n=QW(t.resourceContext.operation);if(n)return(0,$.jsx)(n,{...t});let r=$W(t.resourceContext.operation),i=e??r??q.DEFAULT,a=G(J.RESOURCES_LAYOUTS_UPDATE,`ResourceLayout_Update`)(i);return(0,$.jsx)(a,{...t})}function oX({resourceContext:e,navigationZone:t,navigationInitiator:n}){let r={resourceContext:e,navigationZone:t,navigationInitiator:n},i=ms(e.operation),a;switch(i){case`create`:a=(0,$.jsx)(pG,{...r});break;case`list`:a=(0,$.jsx)(OX,{...r});break;case`read`:a=(0,$.jsx)(eX,{...r});break;case`update`:a=(0,$.jsx)(aX,{...r});break;case`search`:a=(0,$.jsx)(rX,{...r});break;default:a=(0,$.jsx)(tG,{...r})}return(0,$.jsx)(xC,{...r,children:a})}function sX(e){return`${Ji.COMPOSITE_VIEWS}.${e}`}function cX(e){return`${Ji.VIEWS}.${e.family}.${e.translationRef}`}function lX(e){return`app.${e}`}function uX(e,t){return`resources.${e}.${t}`}function dX(e){let t=Up(e);if(!t)return Rp(e);if(t.viewKind===Mp.COMPOSITE_VIEW)return t.hostKind===Qp.RESOURCE?Tp(t.hostRef,t.localRef):Rp(t.localRef)}function fX(e){let t=Up(e.viewRef);if(e.contentType===hd.CHART_VIEW)return t?.viewKind===Mp.CHART_VIEW?{family:Ln.CHART,translationRef:uX(t.hostRef,t.localRef)}:{family:Ln.CHART,translationRef:lX(e.viewRef)};if(e.contentType===hd.EXECUTION_VIEW)return t?.viewKind===Mp.EXECUTION_VIEW?{family:Ln.EXECUTION,translationRef:uX(t.hostRef,t.localRef)}:{family:Ln.EXECUTION,translationRef:lX(e.viewRef)};if(e.contentType===hd.FULL_CUSTOM_VIEW)return{family:Ln.FULL_CUSTOM,translationRef:lX(e.viewRef)};if(e.contentType===hd.FLOWS_ACTORS_VIEW)return{family:Ln.FLOWS_ACTORS,translationRef:lX(e.viewRef)}}function pX(e){if(e.contentType===hd.COMPOSITE_VIEW){let t=dX(e.viewRef);return t?e.tCompositeView(t,`title`):e.viewRef}let t=fX({viewRef:e.viewRef,contentType:e.contentType});return t?e.tView(t.family,t.translationRef,`title`):e.viewRef}var Q_e={[hd.FULL_CUSTOM_VIEW]:`view-custom-`,[hd.EXECUTION_VIEW]:`view-execution-`,[hd.FLOWS_ACTORS_VIEW]:`view-flows-`,[hd.CHART_VIEW]:`view-chart-`},mX=({viewRef:e,contentType:t,hasAuthoredIcon:n=!1,iconViewRef:r,navigationZone:i=qn.PRIMARY,className:a})=>{let o=oA(),s=(0,Q.useMemo)(()=>{if(t===hd.COMPOSITE_VIEW){let t=dX(e);return t?[sX(t)]:[]}let n=fX({viewRef:e,contentType:t});return n?[cX(n)]:[]},[e,t]),{tCompositeView:c,tView:l,isReady:u}=K({keys:s}),{renderIcon:d}=Rf(),{title:f,description:p}=(0,Q.useMemo)(()=>{if(t===hd.COMPOSITE_VIEW){let t=dX(e);return t?{title:c(t,`title`),description:c(t,`description`)}:{title:``,description:``}}let n=fX({viewRef:e,contentType:t});return n?{title:l(n.family,n.translationRef,`title`),description:l(n.family,n.translationRef,`description`)}:{title:``,description:``}},[t,e,c,l]),m=(0,Q.useMemo)(()=>{if(!n)return null;let i=Q_e[t];return i?d({category:re.CUSTOM,customReference:`${i}${r??e}`},{size:fa.LG}):null},[n,t,e,r,d]);return!u||o||!f?null:(0,$.jsxs)(`div`,{className:U(a),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-field`,children:[(0,$.jsx)(EB,{host:wB.SURFACE,navigationZone:i}),m&&(0,$.jsx)(`div`,{className:`shrink-0`,children:m}),(0,$.jsx)(`h1`,{className:`min-w-0 flex-1 text-xl font-semibold text-foreground`,children:f})]}),p&&(0,$.jsx)(`p`,{className:`mt-item-xs text-sm text-muted-foreground`,children:p})]})};function $_e(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-${crypto.randomUUID()}`:`execution-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}var hX=({viewRef:e,viewDefinition:t,contextResourceIdentifiers:n,navigationZone:r=qn.PRIMARY})=>{let i=lm(),{doOperation:a,registry:o}=wm(),{navigate:s}=zS(),{tComponent:c,isReady:l}=K({component:J.HIGH_LEVEL_VIEWS_EXECUTION}),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)({}),[g,_]=(0,Q.useState)({}),[v,y]=(0,Q.useState)({}),[b,x]=(0,Q.useState)({}),S=t??zp({viewRef:e,registry:o}),C=(0,Q.useMemo)(()=>$_e(),[S?.ref]);(0,Q.useEffect)(()=>{},[n,S,e]);let w=(0,Q.useMemo)(()=>{let e=pm.buildInitiatorIds({userId:i?.currentUserId,organizationId:i?.currentOrganizationId,applicationId:i?.currentApplicationId,anonymousUserId:i?.currentAnonymousUserId}),t=S?.primaryScope?pm.primaryScopeToContextIdentifiers(e,S.primaryScope):{},r=i?.buildContextResourceIdentifiers()??{},a=pm.filterCustomScopeContextResourceIdentifiers(r);if(!S)return pm.mergeContextResourceIdentifiers(t,a,n);let o=pm.getAllowedViewBindingKeys({primaryScope:S.primaryScope,parentResourcesRequirements:S.parentResourcesRequirements,additionalResourceRequirements:S.additionalResourceRequirements});return pm.resolveViewContextResourceIdentifiers({surfaceName:`ExecutionView`,surfaceRef:S.ref,primaryScope:S.primaryScope,parentResourcesRequirements:S.parentResourcesRequirements,additionalResourceRequirements:S.additionalResourceRequirements,primaryScopeContext:t,customScopeContext:a,explicitContextResourceIdentifiers:pm.scopeContextToBindingContract(n,o)})},[n,S?.primaryScope,S?.ref,S?.parentResourcesRequirements,S?.additionalResourceRequirements,i?.currentUserId,i?.currentOrganizationId,i?.currentApplicationId,i?.currentAnonymousUserId,i]),T=(0,Q.useMemo)(()=>S?M_e(S,n):null,[S,n]),E=(0,Q.useMemo)(()=>({embeddedContent:u,localPane:f,pendingActions:m,participationPrefetchActions:g,dirtyMarkers:v,failedActions:b}),[u,f,m,g,v,b]),D=(0,Q.useMemo)(()=>S?wse({viewDefinition:S,registry:o,anchor:T,contextResourceIdentifiers:w,explicitContextResourceIdentifiers:n}):{},[T,w,n,o,S]),O=(0,Q.useMemo)(()=>({delegateToParent:e=>{s({content:e.content,urlPath:e.urlPath,contextResourceIdentifiers:e.contextResourceIdentifiers,relationshipTransition:e.relationshipTransition,initiator:{sourceZone:r,...e.initiator??{}}})},openEmbeddedContent:e=>{Sy(e.content),d(e),y(e=>Jy(e,yy.EMBEDDED_CONTENT)),x(e=>Oy(e,Cy.EMBEDDED_CONTENT))},closeEmbeddedContent:()=>{d(null),y(e=>Jy(e,yy.EMBEDDED_CONTENT)),x(e=>Oy(e,Cy.EMBEDDED_CONTENT))},openLocalPane:(e,t)=>{xy(t),p({paneId:e,payload:t}),y(t=>Yy(t,e)),x(t=>ky(t,e))},closeLocalPane:()=>{p(null),y(e=>Yy(e,null)),x(e=>ky(e,null))},beginPendingAction:e=>{h(t=>({...t,[e.actionRuntimeId]:e}))},endPendingAction:e=>{h(t=>{if(!(e in t))return t;let{[e]:n,...r}=t;return r})},beginParticipationPrefetch:e=>{vy(e),_(t=>({...t,[e.prefetchRuntimeId]:e}))},endParticipationPrefetch:e=>{_(t=>{if(!(e in t))return t;let{[e]:n,...r}=t;return r})},markDirty:e=>{by(e),y(t=>({...t,[e.markerId]:e}))},clearDirty:e=>{y(t=>{if(!(e in t))return t;let{[e]:n,...r}=t;return r})},clearAllDirty:()=>{y(e=>Object.keys(e).length===0?e:{})},captureFailedAction:e=>{wy(e),x(t=>({...t,[e.failureRuntimeId]:e}))},clearFailedAction:e=>{x(t=>{if(!(e in t))return t;let{[e]:n,...r}=t;return r})},clearAllFailedActions:()=>{x(e=>Object.keys(e).length===0?e:{})},clearFailedActionsForPrefetchKey:e=>{x(t=>My(t,e))}}),[s,r]);if(!S)return(0,$.jsx)(E_,{viewKind:`execution`,viewRef:e});if(!l)return null;let k=e=>jp({tComponent:c,componentType:J.HIGH_LEVEL_VIEWS_EXECUTION,key:e}),A=S.viewComponent,j=E.embeddedContent,M=j?.content??null,N=(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{className:`h-8 animate-pulse motion-reduce:animate-none bg-muted rounded`,"aria-hidden":`true`}),children:(0,$.jsx)(A,{viewRef:S.ref,viewDefinition:S,contextResourceIdentifiers:w})});return(0,$.jsxs)(Dy,{viewDefinition:S,contextResourceIdentifiers:w,runtimeInstanceId:C,navigationZone:r,doOperation:a,navigation:O,anchor:T,participations:D,runtimeState:E,children:[(0,$.jsx)(mX,{viewRef:e??S.ref,iconViewRef:S.ref,contentType:hd.EXECUTION_VIEW,hasAuthoredIcon:!!S.icon,navigationZone:r,className:`mb-group`}),(0,$.jsx)(ob,{children:M?(0,$.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-group xl:grid-cols-[minmax(0,1fr)_minmax(360px,480px)]`,children:[(0,$.jsx)(`div`,{className:`flex min-w-0 min-h-0 flex-col`,children:N}),(0,$.jsxs)(`aside`,{className:`flex min-w-0 min-h-0 flex-col overflow-hidden rounded-lg border bg-background`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b px-card py-item-sm`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:k(`embeddedTitle`)}),(0,$.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:k(`embeddedDescription`)})]}),(0,$.jsx)(X,{type:`button`,variant:Y.LINK,size:Xd.SM,onClick:()=>{O.closeEmbeddedContent()},children:k(`embeddedClose`)})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,$.jsx)(Gy,{scope:{scope:yy.EMBEDDED_CONTENT},children:(0,$.jsx)(oX,{resourceContext:M.resourceContext,navigationZone:r,navigationInitiator:j?.navigationInitiator})})})]})]}):N})]})};function gX(e){let t={};for(let[n,r]of Object.entries(e.contextResourceIdentifiers)){let e=gn.getResourceId(r);if(e&&(t[n]=e,typeof r==`object`&&r&&`fieldIdentifier`in r)){let n=r.fieldIdentifier;typeof n==`string`&&n.length>0&&(t[n]=e)}}return t}function _X(e,t){return!e||e.length===0||e.every(e=>{if(e.requirement!==uu.MANDATORY||e.isPrimaryScope)return!0;let n=e.foreignKeyField?t[e.foreignKeyField]:void 0,r=t[e.resourceType];return!!(n??r)})}function vX({resourceContext:e,viewRef:t,navigationZone:n,navigationInitiator:r}){let i=(0,Q.useMemo)(()=>Ap(e.resourceType,{ref:t}),[e.resourceType,t]),a=(0,Q.useMemo)(()=>gX(e),[e]);return(0,$.jsx)(JU,{viewRef:i.insertedViewRef,contextResourceIdentifiers:a,navigationZone:n,navigationInitiator:r})}function eve({resourceContext:e,viewRef:t,inputs:n,urlParamValues:r,className:i}){let{registry:a}=wm(),o=(0,Q.useMemo)(()=>Np(e.resourceType,{ref:t}),[e.resourceType,t]),s=(0,Q.useMemo)(()=>gX(e),[e]),c=a.resourceConfigurations[e.resourceType]?.frontendConfiguration?.chartViews?.find(e=>e.ref===t);if(!c)throw yX(`Cannot resolve resource-owned chart view "${t}" on resource "${e.resourceType}".`,{resourceType:e.resourceType,viewRef:t});return(0,$.jsx)(`div`,{className:i,children:(0,$.jsx)(lg,{requiredFeatures:c.chartDefinition.requiredFeatures,children:(0,$.jsx)(rY,{viewRef:o.insertedViewRef,viewDefinition:c,runtimeDescriptor:Op({identity:o,chartView:c,contextResourceIdentifiers:s}),contextResourceIdentifiers:s,inputs:n,urlParamValues:r,localErrorOnly:!0})})})}function tve({resourceContext:e,viewRef:t,navigationZone:n,className:r}){let i=(0,Q.useMemo)(()=>Cp(e.resourceType,{ref:t}),[e.resourceType,t]),a=(0,Q.useMemo)(()=>gX(e),[e]);return(0,$.jsx)(`div`,{className:r,children:(0,$.jsx)(hX,{viewRef:i.insertedViewRef,navigationZone:n,contextResourceIdentifiers:a})})}function yX(e,t){return V.buildConfigurationError(ii.CONFIGURATION,{component:`ResourceOwnedViewEmbeds`,message:e,...t})}var bX;(function(e){e.ACTION_BAR=`action_bar`,e.RECORD_NAVIGATION=`record_navigation`,e.CONTENT=`content`,e.ALL=`all`})(bX||={});var xX=(0,Q.createContext)(new Set);function SX({resourceContext:e,navigationZone:t,navigationInitiator:n,className:r=``,chartHeight:i=320,showCharts:a=!0,renderSlot:o=bX.ALL}){let{registry:s}=wm(),c=(0,Q.useContext)(xX),{navigate:l}=zS(),{renderIcon:u}=Rf(),d=s.resourceConfigurations[e.resourceType]?.frontendConfiguration,f=(0,Q.useMemo)(()=>(d?.compositeViews??[]).map(e=>sX(e.translationRef)),[d?.compositeViews]),p=(0,Q.useMemo)(()=>[...(d?.chartViews??[]).map(t=>cX({family:Ln.CHART,translationRef:uX(e.resourceType,t.ref)})),...(d?.executionViews??[]).map(t=>cX({family:Ln.EXECUTION,translationRef:uX(e.resourceType,t.ref)}))],[d?.chartViews,d?.executionViews,e.resourceType]),{tCompositeView:m,tResourceHeader:h,tResourceOperation:g,tView:_}=K({keys:[...f,...p]}),v=(0,Q.useMemo)(()=>gX(e),[e]),y=e.operation,b=y.isOperationDefault===!0||!y.variantKey,x=String(y.operationIdentifier),S=MD(),C=x===W.READ?Lu.EYEBROW:S,{getRecipe:w}=e_(),T=(0,Q.useMemo)(()=>b?x:Ep([x,String(y.variantKey)]),[x,b,y.variantKey]),E=(0,Q.useMemo)(()=>b?(d?.compositeViews??[]).filter(e=>String(e.operationLike)===x&&_X(e.parentResourcesRequirements,v)):[],[v,x,d?.compositeViews,b]),D=(0,Q.useMemo)(()=>b?(d?.chartViews??[]).filter(e=>String(e.operationLike)===x&&_X(e.parentResourcesRequirements,v)):[],[v,x,d?.chartViews,b]),O=(0,Q.useMemo)(()=>(d?.executionViews??[]).filter(e=>(e.surfaceInOperations??[]).some(e=>Ep(e)===T)&&_X(e.parentResourcesRequirements,v)),[v,T,d?.executionViews]),k=(0,Q.useMemo)(()=>{if(E.length===0&&D.length===0&&O.length===0)return[];let t={registry:s,contextResourceIdentifiers:v,views:{},tResourceHeader:h,tResourceOperation:g,tViewTitle:(e,t)=>pX({viewRef:e,contentType:t,tCompositeView:m,tView:_}),t:e=>e,settingsSectionIcon:()=>void 0,settingsSectionLabel:()=>void 0,settingsSectionVisible:null,viewerRoles:null},n=[];for(let r of E)r.isAddressable?CX({resolvedSegments:n,resolutionContext:t,resourceType:e.resourceType,viewRef:r.ref,operationIdentifier:y.operationIdentifier,familyLabel:`composite`,launcher:r.launcher}):c.has(r.ref)||n.push({type:`embedded-composite`,ref:r.ref});if(a)for(let t of D)n.push({type:`chart`,ref:t.ref,chartView:t,title:_(Ln.CHART,uX(e.resourceType,t.ref),`title`)});for(let r of O)CX({resolvedSegments:n,resolutionContext:t,resourceType:e.resourceType,viewRef:r.ref,operationIdentifier:y.operationIdentifier,familyLabel:`execution`,launcher:r.launcher});return n},[c,E,D,O,v,y.operationIdentifier,s,e.resourceType,a,m,_,h,g]),A=(0,Q.useCallback)(e=>{l({content:{contentType:e.kind,viewRef:e.ref,contextResourceIdentifiers:e.contextResourceIdentifiers},initiator:{sourceZone:t},urlPath:e.urlPath})},[l,t]),j=(0,Q.useMemo)(()=>{if(o===bX.ALL)return k;let e={[qp.ACTION_BAR]:bX.ACTION_BAR,[qp.RECORD_NAVIGATION]:bX.RECORD_NAVIGATION,[qp.CONTENT_CARD]:bX.CONTENT};return k.flatMap(t=>{if(t.type!==`launcher-group`)return o===bX.CONTENT?[t]:[];let n=t.views.filter(t=>e[t.presentation.placement]===o);return n.length>0?[{...t,views:n}]:[]})},[k,o]);return j.length===0?null:(0,$.jsx)(ND,{voice:C,children:(0,$.jsx)(`div`,{className:U(`space-y-section`,r),"data-testid":`resource-layout-inserted-views`,children:j.map((r,a)=>r.type===`embedded-composite`?(0,$.jsx)(xX.Provider,{value:new Set([...c,r.ref]),children:(0,$.jsx)(vX,{resourceContext:e,viewRef:r.ref,navigationZone:t,navigationInitiator:n})},`embedded-composite:${r.ref}:${a}`):r.type===`chart`?(0,$.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-field shadow-sm`,children:[r.title&&(0,$.jsx)(`h3`,{className:U(`mb-element-sm`,C?w(wi.TYPOGRAPHY,C).base:`text-sm font-medium text-foreground`),children:r.title}),(0,$.jsx)(lg,{requiredFeatures:r.chartView.chartDefinition.requiredFeatures,children:(0,$.jsx)(rY,{viewDefinition:r.chartView,runtimeDescriptor:Op({identity:Np(e.resourceType,r.chartView),chartView:r.chartView,contextResourceIdentifiers:v}),height:i,localErrorOnly:!0})})]},`chart:${r.ref}:${a}`):(0,$.jsx)(nve,{renderSlot:o,children:r.views.map(e=>(0,$.jsx)(lg,{requiredFeatures:e.requiredFeatures,children:(0,$.jsxs)(X,{"data-testid":`inserted-view-launcher-${e.ref}`,type:`button`,variant:e.presentation.emphasized?Y.DEFAULT:o===bX.RECORD_NAVIGATION?Y.GHOST:Y.OUTLINE,size:Xd.SM,onClick:()=>A(e),"aria-label":e.presentation.showLabel?void 0:e.label,title:e.presentation.showLabel&&o!==bX.ACTION_BAR?void 0:e.label,children:[e.iconReference?u(e.iconReference,{size:fa.SM}):e.kind===hd.COMPOSITE_VIEW?u({category:re.COMPOSITE_VIEW,viewReference:e.ref},{size:fa.SM}):u({category:re.CUSTOM,customReference:`view-execution-${e.ref}`},{size:fa.SM}),e.presentation.showLabel&&(0,$.jsx)(`span`,{className:o===bX.ACTION_BAR?`@max-[48rem]/resource-header:sr-only`:void 0,children:e.label})]})},`${e.kind}:${e.ref}`))},`launcher-group:${a}`))})})}function nve({renderSlot:e,children:t}){return e===bX.ACTION_BAR?(0,$.jsx)($.Fragment,{children:t}):e===bX.RECORD_NAVIGATION?(0,$.jsx)(`nav`,{className:`-mt-element flex flex-wrap items-center gap-item-xs border-b border-border pb-element-sm`,children:t}):(0,$.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-field shadow-sm`,children:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-item-sm`,children:t})})}function rve(e){return e?.contentType===hd.COMPOSITE_VIEW||e?.contentType===hd.EXECUTION_VIEW}function CX(e){let{resolvedSegments:t,resolutionContext:n,resourceType:r,viewRef:i,operationIdentifier:a,familyLabel:o,launcher:s}=e,c=oh({kind:ru.RESOURCE_VIEW,resourceType:r,viewRef:i},n);if(!c)throw wX(`Operation "${String(a)}" on resource "${r}" could not resolve resource-owned ${o} view "${i}".`);if(!rve(c))throw wX(`Operation "${String(a)}" on resource "${r}" resolved ${o} view "${i}" into unsupported content type "${c.contentType}".`);let l={kind:c.contentType,ref:c.viewRef,label:c.label,iconReference:c.iconReference,urlPath:c.urlPath,contextResourceIdentifiers:c.contextResourceIdentifiers,requiredFeatures:c.requiredFeatures,presentation:Wm(s)},u=t[t.length-1];u?.type===`launcher-group`?u.views.push(l):t.push({type:`launcher-group`,views:[l]})}function wX(e){return V.buildConfigurationError(ii.CONFIGURATION,{component:`ResourceLayout_InsertedViews`,message:e})}var TX=Jo.getLogger(),EX=TX.debugByType(`ResourceLayoutPreset_List_Default`);TX.setDebugTypeLogging(`ResourceLayoutPreset_List_Default`,!1);var DX=({resourceContext:e,navigationZone:t,navigationInitiator:n,dataMode:r,sourceRelationship:i,showCharts:a=!0,defaultViewMode:o=au.CARDS})=>{let{resourceType:s,operation:c,operationId:l,resourceConfig:u,operationInitiator:d,contextualParameters:f,resolvePreferredOperation:p,navigateToResourceOperation:m}=gC({resourceContext:e,navigationZone:t,navigationInitiator:n}),{tResourceHeader:h,tResourceFieldDisplay:g,tResourceFieldEnumValue:_,tResourceOperation:v,tComponent:y,formatDate:b,formatDateTime:x,isReady:S,resolvedRegionalPreferences:C}=K({component:J.RESOURCES_LAYOUTS_LIST,resource:s}),{t:w}=K({resource:s}),T=bp(),{renderIcon:E}=Rf(),{registry:D,doOperation:O}=wm(),[k]=bh(),{getRecipe:A}=e_(),M=A(wi.INTERACTIVE,dd.GHOST),N=(0,Q.useMemo)(()=>({...d,sourceRelationship:i??n?.sourceRelationship}),[d,i,n?.sourceRelationship]),P=c.operationFrontendConfig?.collectionDisplayConfig,F=P?.displayMode??o??au.CARDS,I=P?.userSwitchableDisplayMode??!1,ee=P?.quickFilterField,L=HG.withoutPresetsAssigningPinnedFields(P?.presetFilters,e.pinnedFilters),R=e.collectionToolbar!==fu.HIDDEN,te=P?.filterPanel,z=P?.temporalGroupField,B=P?.enumGroupField,ne=P?.board,re=P?.calendar,ie=P?.timeline,ae=P?.cardLayout,oe=P?.cardActionPlacement,se=P?.selectable??!1,ce=ae?.style===Pl.GRID,le=ae?.style===Pl.GRID?ae.columns:void 0,{viewMode:ue,setViewMode:de}=E_e(s,F),fe=I?ue:F,pe=(0,Q.useMemo)(()=>[au.CARDS,au.TABLE,...ne?[au.BOARD]:[],...re?[au.CALENDAR]:[],...ie?[au.TIMELINE]:[]],[ne,re,ie]),me=pe.includes(fe)?fe:au.CARDS,he=u?.resourceFieldIdentifier,ge=tS(),_e=iH({idField:he}),[ve,ye]=(0,Q.useState)([]),be=ve.length>0&&ve.every(e=>_e.isSelected(e)),xe=Dq(ve.length,ve.filter(e=>_e.isSelected(e)).length),{isSelected:Se,selectItem:Ce,deselectItem:we,toggleSelection:Te}=_e,Ee=(0,Q.useCallback)(()=>{ve.length>0&&ve.every(e=>Se(e))?ve.forEach(e=>we(e)):ve.forEach(e=>Ce(e))},[ve,Se,Ce,we]),[De,Oe]=(0,Q.useState)(null),[ke,Ae]=(0,Q.useState)(()=>{let e=c,t=e?.pageSize??20,n=e?.maxPaginatedResultPerPageLimit;return{page:1,limit:n?Math.min(t,n):t,total:0,totalPages:0}}),[je,Me]=(0,Q.useState)(!1),[Ne,Pe]=(0,Q.useState)([]),[Fe,Ie]=(0,Q.useState)({}),Le=(0,Q.useMemo)(()=>[`resources.${s}`,`components.${J.RESOURCES_LAYOUTS_LIST}`],[s]),Re=(0,Q.useMemo)(()=>[{id:`initial-data`,isReady:je}],[je]),ze=(0,Q.useCallback)(()=>{Ae(e=>({...e,page:1}))},[]),Be=(0,Q.useRef)(O),Ve=(0,Q.useRef)(Ne),He=(0,Q.useRef)(Fe);Be.current=O,Ve.current=Ne,He.current=Fe,(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]);let Ue=(0,Q.useMemo)(()=>Object.entries(f).map(([e,t])=>`${e}:${t}`).sort().join(`|`),[f]),We=wS(nH(e.contextResourceIdentifiers,void 0)??void 0),Ge=(0,Q.useMemo)(()=>{if(!u)return{create:null,read:null,search:null};let t=p(W.CREATE,{requireLiteralIdentifier:!0}),n=t?.operationFrontendConfig;return{create:t&&n&&!ar(n)&&n.actionVisibility!==oo.HIDDEN&&th({...t,resourceType:e.resourceType,resourcePrimaryScope:u.resourcePrimaryScope},We)?t:null,read:p(W.READ,{requireAddressable:!0})||null,search:p(W.SEARCH)||null}},[u,p,We,e.resourceType]),Ke=(0,Q.useCallback)(e=>{if(!u)return null;let t=t=>Th({resourceConfig:u,operations:u.operations??[],coreOperation:W.READ,registry:D,hasResourceId:gn.getResourceId(e[s]).length>0,requireFrontendAddressable:t,preferredVariantKey:c?.variantKey,contextResourceIdentifiers:e,contextualParameters:V.buildContextualParameters(e,D)})??null,n=t(!0);if(n)return n;let r=t(!1);return r&&r.operationFrontendConfig&&!ar(r.operationFrontendConfig)?r:null},[c,D,u,s]),qe=(0,Q.useMemo)(()=>{let e=[{resourceType:s,operation:l}];return Ge.search&&e.push({resourceType:s,operation:String(Ge.search.operationIdentifier)}),e},[s,l,Ge.search]),Je=(0,Q.useMemo)(()=>u?.frontendConfiguration?.emptyState,[u]),{sortFields:Ye,filterFields:Xe,searchEnabled:Ze,filtersEnabled:Qe}=(0,Q.useMemo)(()=>{let t=c,n=Ge.search,r=(t?.sortFields?.length?t.sortFields:n?.sortFields)??[],i=t?.filterFields&&Object.keys(t.filterFields).length>0?t.filterFields:n?.filterFields,a=HG.parseFilterFieldDefinitions(i,u?{registry:D,resourceConfig:u,operation:c,contextualParameters:f,parentResourcesRequirements:e.parentResourcesRequirements}:void 0),o=t?.searchEnabled??!0,s=t?.filtersEnabled??!0;return{sortFields:r,filterFields:HG.withoutPinnedFilterFields(a,e.pinnedFilters),searchEnabled:o,filtersEnabled:s}},[Ge.search,c,D,u,f,e.parentResourcesRequirements,e.pinnedFilters]),$e=C?.timezone,et=(0,Q.useMemo)(()=>Zge(C?.locale),[C?.locale]),tt=yi.calendarDateToday({timezone:$e}),[nt,rt]=(0,Q.useState)(()=>HJ(tt)),it=(0,Q.useCallback)(e=>rt(HJ(e)),[]),at=re&&me===au.CALENDAR?Xe.find(e=>e.fieldName===re.dateField&&e.fieldType===RG.DATE):void 0,ot=(0,Q.useMemo)(()=>re?BG(u?.mainSchema,u?.inheritenceSchemaDefinition).has(re.dateField):!1,[re,u]),st=(0,Q.useMemo)(()=>Qge(nt,et),[nt,et]),ct=!!ie&&me===au.TIMELINE&&[ie.startField,ie.endField].every(e=>Xe.some(t=>t.fieldName===e&&t.fieldType===RG.DATE)),lt=(0,Q.useMemo)(()=>BG(u?.mainSchema,u?.inheritenceSchemaDefinition),[u]),ut=(0,Q.useMemo)(()=>c_e(nt),[nt]),dt=(0,Q.useMemo)(()=>{if(re&&at)return{[re.dateField]:t_e($ge(st),ot,$e)};if(ie&&ct)return u_e({startField:ie.startField,endField:ie.endField,startIsCalendarDate:lt.has(ie.startField),endIsCalendarDate:lt.has(ie.endField),timeZone:$e,firstDay:ut[0],lastDay:ut[ut.length-1]})},[re,at,st,ot,$e,ie,ct,lt,ut]),ft=(0,Q.useRef)(dt);ft.current=dt;let pt=(0,Q.useMemo)(()=>JSON.stringify(dt??{}),[dt]);(0,Q.useEffect)(()=>{Ae(e=>e.page===1?e:{...e,page:1})},[pt]);let{quickFilterDef:mt,panelFilterFields:ht}=(0,Q.useMemo)(()=>{if(!ee)return{quickFilterDef:void 0,panelFilterFields:Xe};let e=Xe.find(e=>e.fieldName===ee&&e.fieldType===RG.ENUM&&(e.enumValues?.length??0)>0);return e?{quickFilterDef:e,panelFilterFields:Xe.filter(t=>t!==e)}:{quickFilterDef:void 0,panelFilterFields:Xe}},[Xe,ee]),gt=(0,Q.useMemo)(()=>HG.detectSummaryFields(u),[u]),_t=(0,Q.useMemo)(()=>jp({tComponent:y,componentType:J.RESOURCES_LAYOUTS_LIST,key:`errorLoading`}),[y]),vt=(0,Q.useMemo)(()=>v(s,W.CREATE,`title`),[v,s]),yt=(0,Q.useMemo)(()=>jp({tComponent:y,componentType:J.RESOURCES_LAYOUTS_LIST,key:`noSearchResults`}),[y]),bt=(0,Q.useMemo)(()=>jp({tComponent:y,componentType:J.RESOURCES_LAYOUTS_LIST,key:`listLabel`}),[y]),xt=(0,Q.useMemo)(()=>{let e={};for(let t of gt)e[t]=g(s,t,`label`);return e},[gt,s,g]),St=(0,Q.useMemo)(()=>gn.extractDataMode(k,r,wn.SUMMARY),[k,r]),Ct=(0,Q.useMemo)(()=>gl.createOperationPathKeyFromOperation(c),[c]),wt=(0,Q.useMemo)(()=>HG.searchOperationAcceptsATerm(Ge.search)&&tK({listOperation:c,searchOperation:Ge.search??void 0,contextualParameters:f,parentResourcesRequirements:e.parentResourcesRequirements,pinnedFilters:e.pinnedFilters,resourceType:s,resourceFieldIdentifier:String(u?.resourceFieldIdentifier??``),registry:D}),[Ge.search,f,c,D,u,e.parentResourcesRequirements,e.pinnedFilters,s]),Tt=(0,Q.useMemo)(()=>!Ge.search||!wt?null:gl.createOperationPathKeyFromOperation(Ge.search),[Ge.search,wt]),Et=pK({enabled:Ze&&!!Ge.search&&wt,onDebouncedChange:ze}),Dt=Et.debouncedQuery;(0,Q.useEffect)(()=>{_e.clearSelection()},[Fe,Dt]);let Ot=(0,Q.useRef)(e);Ot.current=e;let kt=Ne.map(e=>`${e.field}:${e.direction}`).join(`,`),At=(0,Q.useMemo)(()=>JSON.stringify(Fe),[Fe]),jt=e.pinnedFilters,Mt=(0,Q.useMemo)(()=>JSON.stringify(jt??{}),[jt]),{emit:Nt,resourceCollectionRefreshEvent:Pt}=vo(),{lastRefreshAt:Ft}=Pt({ctx:(0,Q.useMemo)(()=>({...e,contextResourceIdentifiers:V.resolveCollectionRefreshScope({operation:c,contextResourceIdentifiers:e.contextResourceIdentifiers,contextualParameters:f,targetResourceType:s,targetDefaultFieldIdentifier:String(u?.resourceFieldIdentifier??``),parentResourcesRequirements:e.parentResourcesRequirements})}),[f,c,u?.resourceFieldIdentifier,e,s])});(0,Q.useEffect)(()=>{Nt(hc.RESOURCE_COLLECTION_FILTERS_CHANGED,{resourceType:s,filterValues:He.current})},[At,s,Nt]);let It=Dt.length>0&&!!Tt,Lt=`${s}|${It?Tt:Ct}|${Ue}|${ke.limit}|${kt}|${At}|${Mt}|${pt}|${Dt}|${Ft??0}`,Rt=`${Lt}|page:${ke.page}`,zt=(0,Q.useCallback)(async(e,t,n)=>{let r=HG.withPinnedFilters(e,Ot.current.pinnedFilters);if(It&&Tt){EX(`Calling doOperation (SEARCH via inline search)`,{searchOperationPathKey:Tt,query:Dt});let e={contextualParameters:f,searchQuery:Dt,filters:Object.keys(r).length>0?r:void 0,pagination:{page:t,limit:n},sort:Ve.current.length?[...Ve.current]:void 0,parentResourcesRequirements:Ot.current.parentResourcesRequirements,dataMode:St};return Be.current(Tt,e)}EX(`Calling doOperation (LIST)`,{operationPathKey:Ct});let i={page:t,limit:n};return Ve.current.length&&(i.sort=Ve.current.map(e=>`${e.field}:${e.direction}`).join(`,`)),Object.entries(r).forEach(([e,t])=>{t!=null&&t!==``&&(i[e]=t)}),Be.current(Ct,{contextualParameters:f,queryParameters:i,parentResourcesRequirements:Ot.current.parentResourcesRequirements,dataMode:St})},[It,Tt,Dt,f,St,Ct]),Bt=(0,Q.useRef)(zt);Bt.current=zt;let Vt=It?Ge.search?.maxPaginatedResultPerPageLimit??50:c?.maxPaginatedResultPerPageLimit??100,[Ht,Ut]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{EX(`useEffect triggered`,{fetchKey:Rt,resourceType:s});let e=!1;return(async()=>{EX(`fetchData started`,{fetchKey:Rt,operationPathKey:Ct,contextualParameters:f}),Oe(null);try{let t=r_e(He.current,ft.current);if(ft.current){let n=await p_e({requestPage:(e,n)=>Bt.current(t,e,n),pageLimit:Vt});if(e)return;ye(n.items),Ut(n.notShown),Me(!0);return}let n=await Bt.current(t,ke.page,ke.limit);if(EX(`doOperation completed`,{resultType:Array.isArray(n)?`array`:typeof n,resultLength:Array.isArray(n)?n.length:void 0}),e)return;if(Ut(0),n&&typeof n==`object`&&`data`in n&&`pagination`in n){let e=n;ye(e.data),Ae(t=>{let n=e.pagination;return t.page===n.page&&t.limit===n.limit&&t.total===n.total&&t.totalPages===n.totalPages?t:n})}else Array.isArray(n)&&(ye(n),Ae(e=>e.total===n.length&&e.totalPages===1?e:{...e,total:n.length,totalPages:1}));Me(!0)}catch(t){if(e){EX(`Fetch cancelled after error`,{fetchKey:Rt});return}let n=j(t);Oe({message:T(t)}),TX.error(`Fetch error`,{...n,error:t,fetchKey:Rt})}finally{EX(`fetchData finally block`,{cancelled:e,fetchKey:Rt})}})(),()=>{EX(`useEffect cleanup`,{cancelled:e,fetchKey:Rt}),e=!0}},[Rt]);let Wt=(0,Q.useCallback)(e=>{Pe(e),Ae(e=>({...e,page:1}))},[]),Gt=(0,Q.useCallback)(e=>{Ie(e),Ae(e=>({...e,page:1}))},[]),Kt=(0,Q.useCallback)(e=>{ee&&(Ie(t=>{let n={...t};return e===void 0?delete n[ee]:n[ee]=e,n}),Ae(e=>({...e,page:1})))},[ee]),qt=(0,Q.useMemo)(()=>{if(!B||me!==au.CARDS)return null;let e=Xe.find(e=>e.fieldName===B),t=e?.enumValues??[];if(t.length===0)return null;let n=new Map(t.map(e=>[e,[]])),r=[];for(let e of ve){let t=e[B],i=typeof t==`string`?n.get(t):void 0;i?i.push(e):r.push(e)}let i=[];for(let r of t){let t=n.get(r)??[];t.length!==0&&i.push({key:r,label:_(s,B,r,e?.schema),items:t})}return r.length>0&&i.push({key:`__wildo-ungrouped__`,label:null,items:r}),i},[ve,B,me,Xe,_,s]),Jt=(0,Q.useMemo)(()=>qt||!z||me!==au.CARDS?null:S_e(ve,z,u?.mainSchema,b,u?.inheritenceSchemaDefinition),[ve,z,me,b,qt,u]),Yt=qt??Jt,Xt=ne&&me===au.BOARD?Xe.find(e=>e.fieldName===ne.groupByField):void 0,Zt=(0,Q.useMemo)(()=>Xt?.fieldType===RG.ENUM?Xt.enumValues??[]:[],[Xt]),Qt=(0,Q.useCallback)(e=>V.getResourceObjectId(e,String(u?.resourceFieldIdentifier??``))??``,[u?.resourceFieldIdentifier]),$t=g_e({enabled:Zt.length>0,vocabulary:Zt,groupByField:ne?.groupByField??``,readerFilters:Fe,reloadKey:Lt,pageSize:ke.limit,requestPage:zt,getItemId:Qt}),en=(0,Q.useMemo)(()=>!ne||!Xt?null:Vge({vocabulary:Zt,labelOf:e=>_(s,ne.groupByField,e,Xt.schema),pages:$t.pages,collectionTotal:je?ke.total:void 0}),[ne,Xt,Zt,$t.pages,je,ke.total,_,s]),tn=(0,Q.useMemo)(()=>{if(!ne||!u)return;let t=Hge(u.operations??[],ne.transitionOperation).filter(e=>th({...e,resourceType:s,resourcePrimaryScope:u.resourcePrimaryScope},We));if(t.length!==0)return{operations:t,resourceType:s,subjectDataMode:St,organizationId:nH(e.contextResourceIdentifiers,void 0)??void 0}},[ne,u,s,We,St,e.contextResourceIdentifiers]),nn=(0,Q.useCallback)(async(t,n,r)=>{if(!ne)return;let i=Qt(t);if(!i)return;let a=gn.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,i);await Gge({groupByField:ne.groupByField,targetValue:n,call:t=>O(gl.createOperationPathKeyFromOperation(r),{contextualParameters:V.buildContextualParameters(a,D),requestData:t,parentResourcesRequirements:e.parentResourcesRequirements}),applyMove:e=>{let r=t[ne.groupByField];typeof r==`string`&&$t.applyMove(i,r,n,e)},reportRefusal:e=>wh.error(T(e))})},[ne,$t.applyMove,Qt,e.contextResourceIdentifiers,e.parentResourcesRequirements,s,O,D,T]),rn=(0,Q.useMemo)(()=>!re||!at?new Map:e_e({items:ve,dateField:re.dateField,calendarField:ot,timeZone:$e}),[re,at,ve,ot,$e]),an=(0,Q.useMemo)(()=>!ie||!ct?[]:l_e({items:ve,startField:ie.startField,endField:ie.endField,startIsCalendarDate:lt.has(ie.startField),endIsCalendarDate:lt.has(ie.endField),timeZone:$e,days:ut}),[ie,ct,ve,lt,$e,ut]),on=C?.locale,sn=(0,Q.useMemo)(()=>{let e=new Intl.DateTimeFormat(on||void 0,{weekday:`short`,timeZone:`UTC`});return(st[0]??[]).map(({day:t})=>e.format(t))},[on,st]),cn=(0,Q.useMemo)(()=>new Intl.DateTimeFormat(on||void 0,{day:`numeric`,timeZone:`UTC`}),[on]),ln=(0,Q.useCallback)(e=>{let t=V.computeFrontendResourceLabel({resourceType:s,registry:D,currentObject:e,t:w,formatDate:b,formatDateTime:x});return String(t||Qt(e))},[s,D,w,b,x,Qt]),un=(0,Q.useCallback)(()=>{u?Ge.create?m({operation:Ge.create,contextResourceIdentifiers:e.contextResourceIdentifiers,parentResourcesRequirements:e.parentResourcesRequirements,initiatorOverride:N}):console.warn(`[ResourceLayoutPreset_List_Default] Cannot create - CREATE operation not available for resource:`,s):console.warn(`[ResourceLayoutPreset_List_Default] Cannot create - missing resourceConfig`)},[u,Ge.create,m,e.contextResourceIdentifiers,e.parentResourcesRequirements,N]),dn=(0,Q.useCallback)(t=>{if(!u)return!1;let n=V.getResourceObjectId(t,u.resourceFieldIdentifier);return n?Ke(gn.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,n))!==null:!1},[u,e.contextResourceIdentifiers,s,Ke]),fn=(0,Q.useCallback)(t=>{if(!u)return;let n=V.getResourceObjectId(t,u.resourceFieldIdentifier);if(!n){TX.error(`[ResourceLayoutPreset_List] Item click ignored: could not resolve resource id from list item.`,{resourceType:s,fieldIdentifier:u.resourceFieldIdentifier,itemKeys:Object.keys(t??{})});return}let r=gn.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,n),i=Ke(r);i&&m({operation:i,contextResourceIdentifiers:r,parentResourcesRequirements:e.parentResourcesRequirements,initiatorOverride:N})},[u,m,u?.resourceFieldIdentifier,e.contextResourceIdentifiers,e.parentResourcesRequirements,s,N,Ke]),pn=(0,Q.useCallback)((n,r)=>{let i=u?.resourceFieldIdentifier;if(!i)return null;let a=V.getResourceObjectId(n,i),o=a?gn.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,a):e.contextResourceIdentifiers,c=Ke(o),l=gn.createFrontendResourceOperationContextFromOperation({resourceType:s,operation:c??e.operation,contextResourceIdentifiers:o});return(0,$.jsx)(LY,{resourceContext:l,navigationZone:t,navigationInitiator:N,currentObject:n,currentObjectDataMode:St,displayMode:Ac.SUMMARY,size:Xd.ICON_SM,orientation:r,hostRowOpensRead:!0})},[u,s,e.contextResourceIdentifiers,e.operation,Ke,t,N,St]),mn=(e,n)=>{let r=u?.resourceFieldIdentifier;if(!r)throw V.buildConfigurationError(ii.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:s,component:`ResourceLayoutPreset_List`});let i=V.getResourceObjectId(e,r);return ge.isElementActive(i)?(0,$.jsx)(`li`,{className:U(`list-none`,ce&&`border border-border rounded-lg overflow-hidden`),children:(0,$.jsx)(LG,{navigationZone:t})},i||n):(0,$.jsx)(`li`,{className:U(`list-none`,ce&&`border border-border rounded-lg overflow-hidden`),children:hn(e,n)},i||n)},hn=(t,n)=>(0,$.jsx)(IG,{item:t,resourceType:s,resourceConfig:u,registry:D,collectionContextResourceIdentifiers:e.contextResourceIdentifiers,summaryFields:gt,fieldLabelsMap:xt,tResourceFieldEnumValue:_,onItemClick:dn(t)?fn:void 0,cardActionPlacement:oe,selectable:se,isSelected:_e.isSelected(t),selectionActive:_e.selectionCount>0,onToggleSelect:_e.toggleSelection,selectAriaLabel:y(J.RESOURCES_LAYOUTS_LIST,`selectRow`,{row:n+1}),operationsSlot:pn(t,oe?.orientation),interactiveClasses:{hover:`hover:bg-muted/50`,transition:M.motion.transition}}),_n=E(H.PLUS,{size:fa.SM}),vn=Ge.create?(0,$.jsxs)(X,{onClick:un,size:Xd.SM,"data-slot":`collection-create`,className:`inline-flex items-center gap-element`,children:[_n,(0,$.jsx)(`span`,{children:vt})]}):void 0,yn=uK({isSearchActive:It,filterValues:Fe}),bn=R&&!!Ge.create,xn=aK(Je,bn),Sn=dK({hasLoadedOnce:je,itemCount:ve.length,isNarrowed:yn,emptyStateOffersCreate:xn})?vn:void 0,Cn=(0,Q.useMemo)(()=>(u?.operations??[]).some(e=>xa(e)),[u]),Tn=(0,Q.useMemo)(()=>{let e={page:ke.page,limit:ke.limit};Ne.length&&(e.sort=Ne.map(e=>`${e.field}:${e.direction}`).join(`,`));for(let[t,n]of Object.entries(HG.withPinnedFilters(Fe,jt)))n!=null&&n!==``&&(e[t]=n);It&&(e.q=Dt);let t={list:HG.variantKeyOf(c),...Ge.search?{search:HG.variantKeyOf(Ge.search)}:{}};return{params:e,isSearchActive:!!Dt,listingVariantKeys:t}},[ke.page,ke.limit,Ne,Fe,jt,Dt,It,c,Ge.search]),En=HG.matchListingOf(HG.listingOperationShown({inlineSearchTerm:Dt,listOperation:c,searchOperation:Ge.search})),Dn=Cn?(0,$.jsx)(b_e,{resourceContext:e,navigationZone:t,navigationInitiator:N,collectionExportQuery:Tn}):void 0;return S?De?(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(pV,{resourceContext:e,navigationZone:t,navigationInitiator:N}),(0,$.jsxs)(`div`,{className:`p-card bg-destructive/10 border border-destructive rounded-lg`,role:`alert`,children:[(0,$.jsx)(`p`,{className:`text-destructive font-medium`,children:_t}),(0,$.jsx)(`p`,{className:`text-sm text-destructive/80 mt-item-xs`,children:De.message})]})]}):(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(pV,{resourceContext:e,navigationZone:t,navigationInitiator:N}),R&&(0,$.jsx)(Wq,{resourceType:s,quickFilter:mt?{field:mt,value:Fe[mt.fieldName],onChange:Kt}:void 0,presetFilters:L,search:Et.isVisible?{query:Et.query,onChange:Et.handleChange,onClear:Et.handleClear}:void 0,filterFields:Qe?ht:[],filterPanel:te,filterValues:Fe,onFiltersChange:Gt,sort:me===au.CARDS&&Ye.length>0?{sortFields:Ye,sortStates:Ne,onSortChange:Wt}:void 0,viewMode:I?{viewMode:me,onViewModeChange:de,availableModes:pe}:void 0,primaryAction:Sn,collectionActions:Dn,...se&&me!==au.TABLE&&ve.length>0?{selectAll:{state:xe,onToggle:Ee}}:{},selection:se?{count:_e.selectionCount,onClear:_e.clearSelection,...be&&!_e.matchAllSelection&&ke.total>ve.length&&En?{matchAllOffer:{matchedCount:ke.total,onSelectAllMatching:()=>_e.selectAllMatching({filters:HG.withPinnedFilters(Fe,jt),...Dt?{search:Dt}:{},listing:En,matchedCount:ke.total})}}:{},..._e.matchAllSelection?{isMatchAllSelected:!0}:{}}:void 0,bulkActions:se?(0,$.jsx)($J,{resourceContext:e,navigationZone:t,navigationInitiator:N,selectedItems:_e.selectedItems,selectedItemsDataMode:St,matchAllSelection:_e.matchAllSelection,explicitIdSelection:_e.explicitIdSelection,onSelectIds:_e.selectIds,idField:he,onSelectionClear:_e.clearSelection,onSelectionReplace:_e.selectAll}):void 0}),(0,$.jsx)(yb,{i18nKeys:Le,loadingScopes:qe,readiness:Re,renderLoading:()=>(0,$.jsx)(Tm,{template:me===au.TABLE?`table`:ce?`card`:`list`,density:`auto`,count:ke.limit,"aria-hidden":`true`}),children:(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(SX,{resourceContext:e,navigationZone:t,showCharts:a}),ge.isCreateActive&&(0,$.jsx)(LG,{navigationZone:t,className:`border border-border rounded-lg`}),dt&&Ht>0&&(0,$.jsx)(UD,{variant:`warning`,"data-slot":`collection-window-not-shown`,children:(0,$.jsx)(GD,{children:y(J.RESOURCES_LAYOUTS_LIST,`displayWindowRowsNotShown`,{count:Ht})})}),re&&at?(0,$.jsx)(s_e,{weeks:st,itemsByDay:rn,month:nt,today:tt,firstDayOfWeek:et,onMonthChange:it,monthHeading:b(WJ(nt),{yearMonth:!0}),weekdayLabels:sn,dayNumberLabel:e=>cn.format(e),dayLabel:(e,t)=>y(J.RESOURCES_LAYOUTS_LIST,`calendarDayItemCount`,{date:b(e,{calendarDate:!0}),count:t}),getItemId:Qt,getItemLabel:ln,canOpenItem:dn,onOpenItem:fn,calendarLabel:bt,previousMonthLabel:y(J.RESOURCES_LAYOUTS_LIST,`displayPreviousMonth`),nextMonthLabel:y(J.RESOURCES_LAYOUTS_LIST,`displayNextMonth`),todayLabel:y(J.RESOURCES_LAYOUTS_LIST,`displayToday`),keyboardHint:y(J.RESOURCES_LAYOUTS_LIST,`calendarKeyboardHint`)}):ie&&ct?(0,$.jsx)(f_e,{days:ut,placements:an,month:nt,today:tt,onMonthChange:it,monthHeading:b(WJ(nt),{yearMonth:!0}),dayNumberLabel:e=>cn.format(e),getItemId:Qt,getItemLabel:ln,barLabel:(e,t,n)=>y(J.RESOURCES_LAYOUTS_LIST,`timelineItemSpan`,{label:ln(e),from:b(t,{calendarDate:!0}),to:b(n,{calendarDate:!0})}),canOpenItem:dn,onOpenItem:fn,timelineLabel:bt,previousMonthLabel:y(J.RESOURCES_LAYOUTS_LIST,`displayPreviousMonth`),nextMonthLabel:y(J.RESOURCES_LAYOUTS_LIST,`displayNextMonth`),todayLabel:y(J.RESOURCES_LAYOUTS_LIST,`displayToday`),emptyMonthLabel:y(J.RESOURCES_LAYOUTS_LIST,`timelineEmptyMonth`)}):ve.length===0?yn?(0,$.jsx)(`div`,{className:`text-center py-section text-muted-foreground text-sm`,role:`status`,children:yt}):(0,$.jsx)(cK,{resourceType:s,config:Je,hasCreateOperation:bn,onCreateAction:un,variant:R?`default`:`compact`,title:e.emptyStateWords?.title,description:e.emptyStateWords?.description}):me===au.TABLE?(0,$.jsx)(zge,{items:ve,resourceType:s,resourceConfig:u,navigationZone:t,summaryFields:gt,contextResourceIdentifiers:e.contextResourceIdentifiers,fieldLabelsMap:xt,sortFields:Ye,sortStates:Ne,onSortChange:Wt,selectable:se,isRowSelected:Se,onToggleRow:Te,allSelected:be,onToggleAll:Ee,renderRowActions:pn,onRowClick:fn,canOpenRow:dn}):en?(0,$.jsx)(Xge,{columns:en,onLoadMore:e=>{$t.loadMore(e)},loadMoreLabel:e=>y(J.RESOURCES_LAYOUTS_LIST,`boardLoadMore`,{count:e}),columnLoadFailedLabel:y(J.RESOURCES_LAYOUTS_LIST,`boardColumnLoadFailed`),ungroupedNote:e=>y(J.RESOURCES_LAYOUTS_LIST,`boardUngroupedNote`,{count:e}),renderCard:hn,getItemId:Qt,transition:tn,onMoveItem:nn,boardLabel:bt,ungroupedLabel:y(J.RESOURCES_LAYOUTS_LIST,`boardUngrouped`),columnCountLabel:e=>y(J.RESOURCES_LAYOUTS_LIST,`boardColumnCount`,{count:e}),moveHint:y(J.RESOURCES_LAYOUTS_LIST,`boardMoveHint`)}):Yt?(0,$.jsx)(`div`,{className:`space-y-card`,"data-slot":`collection-groups`,children:Yt.map((e,t)=>{let n=Yt.slice(0,t).reduce((e,t)=>e+t.items.length,0);return(0,$.jsxs)(`section`,{className:`space-y-item-xs`,children:[e.label&&(0,$.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:e.label}),(0,$.jsx)(`ul`,{role:`list`,"aria-label":e.label??bt,className:OG(le),style:kG(le),children:e.items.map((e,t)=>mn(e,n+t))})]},`${e.key}:${t}`)})}):(0,$.jsx)(`ul`,{role:`list`,"aria-label":bt,className:OG(le),style:kG(le),children:ve.map(mn)}),!en&&!dt&&(0,$.jsx)(iK,{pagination:ke,onPaginationChange:Ae})]})})]}):null};function OX({preset:e,...t}){let n=QW(t.resourceContext.operation),r=e??$W(t.resourceContext.operation)??Zo.DEFAULT,i=n?(0,$.jsx)(n,{...t}):Q.createElement(G(J.RESOURCES_LAYOUTS_LIST,`ResourceLayout_List`)(r),t);return(0,$.jsx)(eS,{resourceType:t.resourceContext.resourceType,children:(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,[DA]:!0,children:i})})}var kX=Jo.getLogger(),ive=kX.debugByType(`PublicLayout_MainContainer`);kX.setDebugTypeLogging(`PublicLayout_MainContainer`,!1);function AX({preset:e=q.DEFAULT,...t}){let n=G(J.PUBLIC_LAYOUTS_MAIN_CONTAINER,`PublicLayout_MainContainer`)(e);return ive(`Render preset=${e} card=${t.useCardLayout?`yes`:`no`} component=${n.displayName??n.name??`anonymous`}`),(0,$.jsx)(n,{...t})}var jX;(function(e){e.DEFAULT=`default`,e.MUTED=`muted`,e.CONTRAST=`contrast`,e.DESTRUCTIVE=`destructive`,e.SUCCESS=`success`,e.INHERIT=`inherit`})(jX||={});var MX;(function(e){e.HOVER=`hover`,e.ALWAYS=`always`,e.NONE=`none`})(MX||={});var NX;(function(e){e.NORMAL=`normal`,e.MEDIUM=`medium`,e.SEMIBOLD=`semibold`})(NX||={});function PX({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_LINK,`Link`)(e);return(0,$.jsx)(n,{...t})}var FX=({href:e,onClick:t,children:n})=>(0,$.jsx)(Z,{children:(0,$.jsx)(PX,{href:e,onClick:t,children:n})}),IX=({code:e,errorParam:t,errorDescription:n})=>{let{handleAuthCodeExchange:r,auth:i}=Dm(),{tComponent:a,isReady:o}=K({component:J.PUBLIC_LAYOUTS_AUTH_CALLBACK}),s=bp(),c=wg(),l=e=>a(J.PUBLIC_LAYOUTS_AUTH_CALLBACK,e),u=(0,Q.useMemo)(()=>R(c.search),[c.search]),d=(0,Q.useMemo)(()=>ai(Cn.login,u),[u]),f=(0,Q.useMemo)(()=>Vt(c.search),[c.search]),[p,m]=(0,Q.useState)(null),h=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{h.current||(t?(h.current=!0,m(l($n.ERROR_GENERIC))):e?i.accessToken||i.onboardingSessionId?h.current=!0:(h.current=!0,r(e).catch(e=>{m(s(e,l($n.ERROR_EXCHANGE_FAILED)))})):(h.current=!0,m(l($n.ERROR_NO_CODE))))},[e,t,n,i.accessToken,i.onboardingSessionId,r]);let g=Xp(i,u);return g?(0,$.jsx)(og,{to:g,replace:!0}):i.accessToken&&!i.isLoading?(0,$.jsx)(og,{to:f,replace:!0}):o?p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-destructive`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 18L18 6M6 6l12 12`})})}),(0,$.jsx)(zY,{children:l($n.ERROR_TITLE)})]}),(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:p})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(FX,{href:d,children:l($n.LOGIN_LINK)})})]}):(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`text-center space-y-item-xs`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,"aria-hidden":`true`,children:(0,$.jsx)(gb,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:l($n.VERIFYING)})]}):null};function LX({preset:e=q.DEFAULT,...t}){let n=G(J.PUBLIC_LAYOUTS_AUTH_CALLBACK,`Auth_AuthCallback`)(e);return(0,$.jsx)(n,{...t})}var ave=()=>{let[e]=bh(),t=e.get(`code`),n=e.get(`error`),r=e.get(`error_description`);return(0,$.jsx)(AX,{useCardLayout:!0,children:(0,$.jsx)(LX,{code:t,errorParam:n,errorDescription:r})})},RX;(function(e){e.REPORTED=`reported`,e.NOTHING_TO_REPORT=`nothing_to_report`})(RX||={});var ove=()=>{let[e]=bh(),{tComponent:t,isReady:n}=K({component:J.PUBLIC_LAYOUTS_AUTH_CALLBACK}),[r,i]=(0,Q.useState)(null),a=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{if(a.current)return;a.current=!0;let t=e.get(`code`),n=e.get(`error`);!t&&!n?i(RX.NOTHING_TO_REPORT):(vH(t?{code:t}:{error:n??void 0}),i(RX.REPORTED),window.close())},[e]),!n||r===null?null:(0,$.jsx)(AX,{useCardLayout:!0,children:(0,$.jsx)(Z,{className:`text-sm`,children:t(J.PUBLIC_LAYOUTS_AUTH_CALLBACK,r===RX.REPORTED?$n.REAUTH_RETURNING:$n.REAUTH_NO_RESULT)})})};function zX({mfaRequired:e,mfaSessionId:t,usableSecondFactorMethods:n,email:r,authRedirectTarget:i}){let a=vh();(0,Q.useEffect)(()=>{e&&t&&(n.length===0?a(ai(Cn.enrollmentRequired,i),{replace:!0}):a(ai(`${Cn.mfaChallenge}?sessionId=${t}&email=${encodeURIComponent(r||``)}`,i),{replace:!0}))},[e,t,n,a,r,i])}var BX=({token:e,email:t,redirect:n})=>{let r=dte(n)?n:void 0,{handleMagicLinkVerify:i,auth:a}=Dm(),{tComponent:o,isReady:s}=K({component:J.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY}),c=bp(),l=e=>o(J.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY,e),u=Cn.login,[d,f]=(0,Q.useState)(null),p=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{p.current||(!e||!t?(p.current=!0,f(l(ua.ERROR_INVALID_LINK))):a.accessToken?p.current=!0:(p.current=!0,i(e,t).then(e=>{!e.success&&!e.requiresMFA&&f(c(null,l(ua.ERROR_VERIFICATION_FAILED)))}).catch(e=>{f(c(e,l(ua.ERROR_EXPIRED)))})))},[e,t,a.accessToken,i]),zX({mfaRequired:a.mfaRequired,mfaSessionId:a.mfaSessionId,usableSecondFactorMethods:a.usableSecondFactorMethods,email:t??void 0,authRedirectTarget:r});let m=Xp(a,r);return m?(0,$.jsx)(og,{to:m,replace:!0}):a.accessToken&&!a.isLoading?(0,$.jsx)(og,{to:r??Cn.home,replace:!0}):s?d?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-destructive`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 18L18 6M6 6l12 12`})})}),(0,$.jsx)(zY,{children:l(ua.ERROR_TITLE)})]}),(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:d})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(FX,{href:u,children:l(ua.LOGIN_LINK)})})]}):(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`text-center space-y-item-xs`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,"aria-hidden":`true`,children:(0,$.jsx)(gb,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:l(ua.VERIFYING)})]}):null};function VX({preset:e=q.DEFAULT,...t}){let n=G(J.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY,`Auth_MagicLinkVerify`)(e);return(0,$.jsx)(n,{...t})}var sve=()=>{let[e]=bh(),t=e.get(`token`),n=e.get(`email`),r=e.get(`redirect`);return Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(AX,{useCardLayout:!0,children:(0,$.jsx)(VX,{token:t,email:n,redirect:r})})},cve=()=>{let{auth:e}=Cg(),{tComponent:t,isReady:n}=K({component:J.PUBLIC_LAYOUTS_USER_AUTH});return n?(0,$.jsxs)(hA,{children:[(0,$.jsx)(nR,{name:`email`}),(0,$.jsx)(nR,{name:`password`}),e.error&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:e.error})}),(0,$.jsx)(hO,{label:(e=>t(J.PUBLIC_LAYOUTS_USER_AUTH,e))(xl.SUBMIT),submittingLabel:`…`,fullWidth:!0})]}):null},lve=({email:e,onSuccess:t,onError:n,isLoading:r,t:i})=>{let{authenticateWithPassword:a}=Cg(),o=bp(),s=(0,Q.useCallback)(async e=>{try{t(await a(e.email,e.password))}catch(e){n(o(e))}},[a,t,n,o]),c=(0,Q.useMemo)(()=>({email:e,password:``}),[e]);return(0,$.jsx)(gE,{schema:La,defaultValues:c,onSubmit:s,validationMode:pr.ON_BLUR,disabled:r,labels:{fields:{email:i(xl.EMAIL_ADDRESS),password:i(xl.PASSWORD)}},layoutTemplate:cve},`password-auth`)},HX={[Al.PASSWORD]:H.KEY,[Al.PASSKEY]:H.FINGERPRINT,[Al.MAGIC_LINK]:H.MAIL,[Al.EMAIL_OTP]:H.MAIL,[Al.SMS_OTP]:H.MESSAGE_CIRCLE,[Al.TOTP]:H.SMARTPHONE,[Al.ORG_SAML]:H.ORGANIZATION,[Al.ORG_OPENID_CONNECT]:H.ORGANIZATION,[Al.EXTERNAL_OAUTH2]:H.LINK},uve={[Al.PASSWORD]:xl.METHOD_PASSWORD,[Al.MAGIC_LINK]:xl.METHOD_MAGIC_LINK,[Al.PASSKEY]:xl.METHOD_PASSKEY,[Al.SMS_OTP]:xl.METHOD_SMS_OTP,[Al.ORG_SAML]:xl.METHOD_ORG_SSO,[Al.ORG_OPENID_CONNECT]:xl.METHOD_ORG_SSO,[Al.EXTERNAL_OAUTH2]:xl.METHOD_EXTERNAL_OAUTH2};function dve(e,t,n){if(e===Al.ORG_SAML||e===Al.ORG_OPENID_CONNECT)return t.offeredMethod?.config?.displayName?.trim()||void 0;if(e!==Al.EXTERNAL_OAUTH2)return;let r=t.offeredMethod?.oauth2ProviderRefs,i=t.socialProviders??[],a=r&&r.length>0?i.filter(e=>r.includes(e.providerRef)):i;return a.length===1&&n(a[0]).trim()||void 0}function UX(e,t){let n=dve(e,t,t.resolveSocialProviderLabel);if(n&&t.continueWithTemplate.includes(`{provider}`))return t.continueWithTemplate.replace(`{provider}`,n);let r=uve[e];return r?t.translateLabel(r):e}var WX=({method:e})=>{let{renderIcon:t}=Rf();return t(HX[e],{size:fa.SM})},fve=({email:e,isLoading:t,t:n,authRedirectTarget:r})=>{let[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(!1),c=(0,Q.useCallback)(async()=>{if(e){s(!0);try{await lc().magicLinkSend(e,r),a(!0)}catch{}finally{s(!1)}}},[e,r]);return i?(0,$.jsxs)(`div`,{className:`space-y-item text-center`,children:[(0,$.jsx)(zY,{children:n(xl.MAGIC_LINK_SENT_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:n(xl.MAGIC_LINK_SENT_DESCRIPTION)}),(0,$.jsx)(Z,{children:(0,$.jsx)(PX,{href:`#`,onClick:e=>{e.preventDefault(),a(!1)},children:n(xl.MAGIC_LINK_TRY_ANOTHER_METHOD)})})]}):(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsxs)(X,{variant:Y.OUTLINE,className:`w-full`,labelOverflow:cf.WRAP,onClick:c,disabled:o||t,children:[(0,$.jsx)(WX,{method:Al.MAGIC_LINK}),o?`…`:n(xl.MAGIC_LINK_SEND)]})})};function GX({fieldName:e,submitLabel:t,submittingLabel:n,fieldProps:r}){let{formState:i}=rw();return(0,$.jsxs)(hA,{children:[(0,$.jsx)(nR,{name:e,...r}),i.errors.root&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:i.errors.root.message})}),(0,$.jsx)(hO,{label:t,submittingLabel:n,fullWidth:!0})]})}var KX=5e3,pve=({sessionId:e,onSuccess:t,isLoading:n,t:r})=>{let{handleMfaVerify:i}=Dm(),a=bp(),o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(0),[h,g]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{if(p===0)return;let t=!1,n=Date.now(),r,i=async()=>{if(!t){try{let{codeUndelivered:n}=await lc().smsOTPDelivery(e);if(t)return;if(n){g(!0);return}}catch{}!t&&Date.now()-n<12e4&&(r=setTimeout(()=>{i()},KX))}};return r=setTimeout(()=>{i()},KX),()=>{t=!0,r!==void 0&&clearTimeout(r)}},[p,e]);let _=(0,Q.useMemo)(()=>()=>(0,$.jsx)(GX,{fieldName:`code`,submitLabel:r(kt.VERIFY_BUTTON),submittingLabel:r(kt.VERIFYING),fieldProps:{autoFocus:!0}}),[r]),v=(0,Q.useCallback)(e=>{o.current=e},[]),y=(0,Q.useCallback)(()=>{o.current?.clearErrors(`root`)},[]),b=(0,Q.useCallback)(e=>{o.current?.setError(`root`,{type:`server`,message:e})},[]),x=(0,Q.useCallback)(async()=>{u(!0),f(null),y();try{await lc().smsOTPSend(e),g(!1),c(!0),m(e=>e+1)}catch(e){let t=a(e,r(kt.ERROR_GENERIC));s?b(t):f(t)}finally{u(!1)}},[e,s,y,b,r,a]),S=(0,Q.useCallback)(async n=>{y();try{let o=await i(e,Al.SMS_OTP,n.code.trim());o.success?t(o):b(a(null,r(kt.ERROR_INVALID_CODE)))}catch(e){b(a(e,r(kt.ERROR_INVALID_CODE)))}},[e,i,t,r,y,b,a]);return s?(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:r(kt.SMS_OTP_SENT)}),h&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:r(kt.SMS_OTP_UNDELIVERED)})}),(0,$.jsx)(gE,{schema:ere,defaultValues:{code:``},onSubmit:S,validationMode:pr.ON_BLUR,disabled:n||l,onFormReady:v,labels:{fields:{code:r(kt.SMS_OTP_CODE_LABEL)}},layoutTemplate:_},`sms-otp-challenge`),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.SM,onClick:x,disabled:l,children:r(kt.RESEND_CODE)})})]}):(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:r(kt.SMS_OTP_DESCRIPTION)}),(0,$.jsxs)(X,{className:`w-full`,labelOverflow:cf.WRAP,onClick:x,disabled:l||n,children:[(0,$.jsx)(WX,{method:Al.SMS_OTP}),r(l?kt.SMS_OTP_SENDING:kt.SMS_OTP_SEND)]}),d&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:d})})]})},mve=({sessionId:e,onSuccess:t,isLoading:n,t:r})=>{let{handleMfaVerify:i}=Dm(),a=bp(),o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(null),m=(0,Q.useMemo)(()=>()=>(0,$.jsx)(GX,{fieldName:`code`,submitLabel:r(kt.VERIFY_BUTTON),submittingLabel:r(kt.VERIFYING),fieldProps:{autoFocus:!0}}),[r]),h=(0,Q.useCallback)(e=>{o.current=e},[]),g=(0,Q.useCallback)(()=>{o.current?.clearErrors(`root`)},[]),_=(0,Q.useCallback)(e=>{o.current?.setError(`root`,{type:`server`,message:e})},[]),v=(0,Q.useCallback)(async()=>{u(!0),p(null),g();try{await lc().mfaEmailOTPSend(e),c(!0)}catch(e){let t=a(e,r(kt.ERROR_GENERIC));s?_(t):p(t)}finally{u(!1)}},[e,s,g,_,r,a]),y=(0,Q.useCallback)(async n=>{g();try{let o=await i(e,Al.EMAIL_OTP,n.code.trim());o.success?t(o):_(a(null,r(kt.ERROR_INVALID_CODE)))}catch(e){_(a(e,r(kt.ERROR_INVALID_CODE)))}},[e,i,t,r,g,_,a]);return s?(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:r(kt.EMAIL_OTP_SENT)}),(0,$.jsx)(gE,{schema:d,defaultValues:{code:``},onSubmit:y,validationMode:pr.ON_BLUR,disabled:n||l,onFormReady:h,labels:{fields:{code:r(kt.EMAIL_OTP_CODE_LABEL)}},layoutTemplate:m},`email-otp-challenge`),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.SM,onClick:v,disabled:l,children:r(kt.RESEND_CODE)})})]}):(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:r(kt.EMAIL_OTP_DESCRIPTION)}),(0,$.jsxs)(X,{className:`w-full`,labelOverflow:cf.WRAP,onClick:v,disabled:l||n,children:[(0,$.jsx)(WX,{method:Al.EMAIL_OTP}),r(l?kt.EMAIL_OTP_SENDING:kt.EMAIL_OTP_SEND)]}),f&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:f})})]})},hve=({sessionId:e,onSuccess:t,isLoading:n,t:r})=>{let{handleMfaVerify:i}=Dm(),a=bp(),o=(0,Q.useRef)(null),s=(0,Q.useMemo)(()=>()=>(0,$.jsx)(GX,{fieldName:`code`,submitLabel:r(kt.VERIFY_BUTTON),submittingLabel:r(kt.VERIFYING),fieldProps:{autoFocus:!0}}),[r]),c=(0,Q.useCallback)(e=>{o.current=e},[]),l=(0,Q.useCallback)(()=>{o.current?.clearErrors(`root`)},[]),u=(0,Q.useCallback)(e=>{o.current?.setError(`root`,{type:`server`,message:e})},[]),d=(0,Q.useCallback)(async n=>{l();try{let o=await i(e,Al.TOTP,n.code.trim());o.success?t(o):u(a(null,r(kt.ERROR_INVALID_CODE)))}catch(e){u(a(e,r(kt.ERROR_INVALID_CODE)))}},[e,i,t,r,l,u,a]);return(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:r(kt.TOTP_DESCRIPTION)}),(0,$.jsx)(gE,{schema:ine,defaultValues:{code:``},onSubmit:d,validationMode:pr.ON_BLUR,disabled:n,onFormReady:c,labels:{fields:{code:r(kt.TOTP_CODE_LABEL)}},layoutTemplate:s},`totp-challenge`)]})},gve=({sessionId:e,onSuccess:t,onError:n,isLoading:r,t:i,factorLevel:a})=>{let{handlePasskeyAuth:o}=Dm(),s=bp(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useMemo)(()=>a===`first`?xl:kt,[a]),p=typeof window<`u`&&!!window.PublicKeyCredential,m=(0,Q.useCallback)(async()=>{l(!0),d(null);try{let r=await o(e,a);if(r.success)t(r);else{let e=s(null,i(f.PASSKEY_ERROR));d(e),n(e)}}catch(e){let t=e?.name===`NotAllowedError`?i(f.PASSKEY_CANCELLED):s(e,i(f.PASSKEY_ERROR));d(t),n(t)}finally{l(!1)}},[e,a,o,t,n,i,f,s]);return p?(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:i(f.PASSKEY_DESCRIPTION)}),u&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:u})}),(0,$.jsxs)(X,{className:`w-full`,labelOverflow:cf.WRAP,onClick:m,disabled:c||r,children:[(0,$.jsx)(WX,{method:Al.PASSKEY}),i(c?f.PASSKEY_AUTHENTICATING:f.PASSKEY_BUTTON)]})]}):(0,$.jsx)(`div`,{className:`space-y-item`,children:(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:i(f.PASSKEY_UNSUPPORTED)})})})},_ve=rt,vve=({methodConfig:e,isLoading:t,t:n,factorLevel:r})=>{let[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c=wg(),l=e.config?.displayName||`SSO`,u=e.config?.connectionId,d=cd(c),f=(0,Q.useCallback)(()=>{if(!u){s(n(xl.SSO_CONFIGURATION_ERROR));return}a(!0);let e=Xi(Re.AUTH_SAML_LOGIN,{connectionId:u}),t=lc().getBaseURL(),r=t===window.location.origin?window.location.origin:``;window.location.href=`${t}${_ve}${e}?returnUrl=${encodeURIComponent(`${r}${d}`)}`},[u,d,n]),p=r===`first`?n(xl.CONTINUE_WITH).replace(`{provider}`,l):l;return(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsxs)(X,{variant:Y.OUTLINE,className:`w-full`,labelOverflow:cf.WRAP,onClick:f,disabled:t||i,children:[(0,$.jsx)(WX,{method:Al.ORG_SAML}),i?`…`:p]}),o&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:o})})]})},yve=({methodConfig:e,isLoading:t,t:n,factorLevel:r})=>{let[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c=wg(),l=bp(),u=e.config?.displayName||`SSO`,d=e.config?.connectionId,f=e.config?.scopeType,p=e.config?.scopeId,m=f===il.ORGANIZATION?p:void 0,h=cd(c),g=f===il.APPLICATION?p:void 0,_=(0,Q.useCallback)(async()=>{if(!d)s(n(xl.SSO_CONFIGURATION_ERROR));else{a(!0),s(null);try{let e=lc();if(!m&&!g){s(n(xl.SSO_CONFIGURATION_ERROR)),a(!1);return}let t=m?await e.getEnterpriseSSOAuthorizationUrl(m,d,h):await e.getAppEnterpriseSSOAuthorizationUrl(d,h,{headers:{[ks.APPLICATION_ID]:g}});window.location.href=t.authorizationUrl}catch(e){a(!1),s(l(e))}}},[g,d,m,h,n,l]),v=r===`first`?n(xl.CONTINUE_WITH).replace(`{provider}`,u):u;return(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsxs)(X,{variant:Y.OUTLINE,className:`w-full`,labelOverflow:cf.WRAP,onClick:_,disabled:t||i,children:[(0,$.jsx)(WX,{method:Al.ORG_OPENID_CONNECT}),i?`…`:v]}),o&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:o})})]})},qX=({label:e,className:t})=>(0,$.jsxs)(`div`,{className:`my-group flex items-center gap-element text-xs uppercase text-muted-foreground${t?` ${t}`:``}`,children:[(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:e}),(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":`true`})]});function JX(e){return Eb({providerRef:e.providerRef,displayName:e.displayName,displayNameLabelKey:e.displayNameLabelKey,fallbackLabel:e.brandLabel,translate:e.translate})}function YX(e){let t=e.publicProviders;return t?Object.entries(t).map(([e,t])=>({key:e,providerRef:e,displayName:t.displayName,displayNameLabelKey:Dd(e)})):[]}var XX={google:{label:`Google`,brandClass:``,icon:(0,$.jsxs)(`svg`,{className:`size-5`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,$.jsx)(`path`,{d:`M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z`,fill:`#4285F4`}),(0,$.jsx)(`path`,{d:`M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z`,fill:`#34A853`}),(0,$.jsx)(`path`,{d:`M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z`,fill:`#FBBC05`}),(0,$.jsx)(`path`,{d:`M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z`,fill:`#EA4335`})]})},microsoft:{label:`Microsoft`,brandClass:`bg-[#2F2F2F] hover:bg-[#404040] text-white`,icon:(0,$.jsxs)(`svg`,{className:`size-5`,viewBox:`0 0 21 21`,"aria-hidden":`true`,children:[(0,$.jsx)(`rect`,{x:`1`,y:`1`,width:`9`,height:`9`,fill:`#F25022`}),(0,$.jsx)(`rect`,{x:`11`,y:`1`,width:`9`,height:`9`,fill:`#7FBA00`}),(0,$.jsx)(`rect`,{x:`1`,y:`11`,width:`9`,height:`9`,fill:`#00A4EF`}),(0,$.jsx)(`rect`,{x:`11`,y:`11`,width:`9`,height:`9`,fill:`#FFB900`})]})},github:{label:`GitHub`,brandClass:`bg-[#24292e] hover:bg-[#2f363d] text-white`,icon:(0,$.jsx)(`svg`,{className:`size-5`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,$.jsx)(`path`,{d:`M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844a9.59 9.59 0 0 1 2.504.337c1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z`})})},apple:{label:`Apple`,brandClass:`bg-black hover:bg-gray-900 text-white`,icon:(0,$.jsx)(`svg`,{className:`size-5`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,$.jsx)(`path`,{d:`M17.05 20.28c-.98.95-2.05.88-3.08.4-1.09-.5-2.08-.48-3.24 0-1.44.62-2.2.44-3.06-.4C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z`})})}},ZX={brandClass:`bg-muted hover:bg-muted/80 border border-border text-foreground`,icon:(0,$.jsxs)(`svg`,{className:`size-5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,$.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,$.jsx)(`path`,{d:`M2 12h20`}),(0,$.jsx)(`path`,{d:`M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z`})]})},QX=({providers:e,onProviderClick:t,isLoading:n,disabled:r=!1,continueWithLabel:i,translate:a,dividerLabel:o,showDivider:s})=>e.length===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`space-y-item`,children:e.map(({key:e,providerRef:o,displayName:s,displayNameLabelKey:c})=>{let l=XX[o]??null,u=JX({providerRef:o,displayName:s,displayNameLabelKey:c,brandLabel:l?.label,translate:a}),d=l?.brandClass??ZX.brandClass,f=l?.icon??ZX.icon;return(0,$.jsxs)(X,{type:`button`,variant:Y.OUTLINE,disabled:n||r,onClick:()=>t(o),className:`w-full ${d}`,children:[f,(0,$.jsx)(`span`,{children:i.replace(`{provider}`,u)})]},e)})}),s&&o&&(0,$.jsx)(qX,{label:o})]}),bve=({methodConfig:e,isLoading:t,t:n})=>{let{initiateOAuth2Login:r}=Cg(),{appConfig:i}=_u(),a=wg(),[o,s]=(0,Q.useState)(null),c=bp(),l=e.oauth2ProviderRefs||[],u=(0,Q.useMemo)(()=>YX({publicProviders:Object.fromEntries(l.map(e=>[e,i.auth?.socialOAuth2Providers?.[e]??{}]))}),[i.auth?.socialOAuth2Providers,l]),d=(0,Q.useMemo)(()=>Tb(u.map(e=>e.displayNameLabelKey)),[u]),{t:f}=K({keys:d}),p=(0,Q.useMemo)(()=>cd(a),[a]),m=(0,Q.useCallback)(async e=>{s(null);try{await r(e,p)}catch(e){s(c(e))}},[r,p,c]);return l.length===0?null:(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(QX,{providers:u,onProviderClick:m,isLoading:t,continueWithLabel:n(xl.CONTINUE_WITH),translate:f}),o&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:o})})]})},$X={};$X[Al.PASSWORD]=lve,$X[Al.MAGIC_LINK]=fve,$X[Al.SMS_OTP]=pve,$X[Al.EMAIL_OTP]=mve,$X[Al.TOTP]=hve,$X[Al.PASSKEY]=gve,$X[Al.ORG_SAML]=vve,$X[Al.ORG_OPENID_CONNECT]=yve,$X[Al.EXTERNAL_OAUTH2]=bve;var eZ={};function tZ(e,t){eZ[e]=t}var nZ;(function(e){e.REFLOW=`reflow`,e.LIST=`list`})(nZ||={});var rZ=({methods:e,labelFor:t,onSelect:n,disabled:r,layout:i=nZ.REFLOW,className:a})=>{if(e.length===0)return null;let o=i===nZ.REFLOW;return(0,$.jsx)(`div`,{className:U(o?`flex flex-wrap gap-element`:`flex flex-col gap-item`,a),children:e.map(e=>(0,$.jsxs)(X,{type:`button`,variant:Y.OUTLINE,labelOverflow:cf.WRAP,className:o?`grow basis-[10rem] max-w-full text-center`:`w-full justify-start text-start`,onClick:()=>n(e),disabled:r,"data-auth-method":e,children:[(0,$.jsx)(WX,{method:e}),(0,$.jsx)(`span`,{children:t(e)})]},e))})};function iZ({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_LABEL,`Label`)(e);return(0,$.jsx)(n,{...t})}var xve=n(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),aZ=n((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),oZ=n((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),Sve=n(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Cve=n(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),wve=n((e=>{var t=aZ().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Tve=n((e=>{var t=aZ().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Eve=n((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),sZ=n((e=>{var t=oZ(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Dve=n((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Ove=n((e=>{var t=Dve();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),kve=n(((e,t)=>{var n=Ove();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),cZ=n((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),lZ=n((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
16
|
-
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),uZ=n((e=>{var t=cZ(),n=lZ();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),Ave=n((e=>{var t=aZ(),n=sZ(),r=oZ(),i=uZ(),a=cZ(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),jve=n((e=>{var t=aZ(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),Mve=n(((e,t)=>{var n=uZ();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),Nve=n(((e,t)=>{var n=uZ(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),Pve=n(((e,t)=>{var n=uZ();function r(e){this.mode=n.BYTE,this.data=typeof e==`string`?new TextEncoder().encode(e):new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),Fve=n(((e,t)=>{var n=uZ(),r=aZ();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
|
|
17
|
-
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),Ive=n(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),Lve=n((e=>{var t=uZ(),n=Mve(),r=Nve(),i=Pve(),a=Fve(),o=lZ(),s=aZ(),c=Ive();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
|
|
18
|
-
Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),Rve=n((e=>{var t=aZ(),n=oZ(),r=Sve(),i=Cve(),a=wve(),o=Tve(),s=Eve(),c=sZ(),l=kve(),u=Ave(),d=jve(),f=uZ(),p=Lve();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
|
|
19
|
-
The chosen QR Code version cannot contain this amount of data.
|
|
20
|
-
Minimum version required to store current data is: `+c+`.
|
|
21
|
-
`);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),dZ=n((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||(e.color={});let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),zve=n((e=>{var t=dZ();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o!==void 0||i&&i.getContext||(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i!==void 0||n&&n.getContext||(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),Bve=n((e=>{var t=dZ();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
|
|
22
|
-
`;return typeof a==`function`&&a(null,p),p}})),Vve=e(n((e=>{var t=xve(),n=Rve(),r=zve(),i=Bve();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),1);function fZ(e){return e?{[ks.AUTH_SESSION_ID]:e}:void 0}var pZ=({sessionId:e,onComplete:t,onError:n,isLoading:r,t:i})=>{let a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(`loading`),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)([]),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),v=(0,Q.useRef)(n);v.current=n;let y=(0,Q.useRef)(i);y.current=i;let b=bp(),x=(0,Q.useRef)(null),S=(0,Q.useMemo)(()=>()=>(0,$.jsx)(GX,{fieldName:`code`,submitLabel:i(z.TOTP_VERIFY_BUTTON),submittingLabel:i(z.TOTP_VERIFYING),fieldProps:{autoFocus:!0}}),[i]),C=(0,Q.useCallback)(e=>{a.current=e},[]),w=(0,Q.useCallback)(()=>{a.current?.clearErrors(`root`)},[]),T=(0,Q.useCallback)(e=>{a.current?.setError(`root`,{type:`server`,message:e})},[]);(0,Q.useEffect)(()=>{let t=!1;if(!x.current||x.current.sessionId!==e){let t=fZ(e);x.current={sessionId:e,promise:lc().mfaTOTPSetup(t?{headers:t}:void 0)}}let n=x.current.promise;return(async()=>{try{let e=await n;if(t)return;let r=await Vve.toDataURL(e.qrCodeUri,{width:256,margin:2});if(t)return;d(e.secret),l(r),p(e.backupCodes||[]),s(`ready`)}catch(e){if(t)return;let n=b(e,y.current(z.ENROLL_ERROR));_(n),v.current(n)}})(),()=>{t=!0}},[e]);let E=(0,Q.useCallback)(async r=>{w();try{let n=fZ(e),a=await lc().mfaTOTPVerifySetup(r.code.trim(),n?{headers:n}:void 0);a.verified?t(a.enrollmentSession):T(i(z.ENROLL_ERROR))}catch(e){let t=b(e,i(z.ENROLL_ERROR));T(t),n(t)}},[e,t,n,i,w,T,b]);if(o===`loading`)return(0,$.jsx)(`div`,{className:`space-y-item text-center`,children:(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(z.LOADING)})});let D=f.length>0&&!m;return(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:i(z.TOTP_QR_INSTRUCTION)}),c&&(0,$.jsx)(`div`,{className:`flex justify-center py-2`,children:(0,$.jsx)(`img`,{src:c,alt:`TOTP QR Code`,className:`rounded-md`})}),(0,$.jsxs)(`div`,{className:`text-center`,children:[(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:i(z.TOTP_MANUAL_SECRET)}),(0,$.jsx)(`code`,{className:`block mt-1 text-sm font-mono bg-muted px-3 py-2 rounded-md select-all break-all`,children:u})]}),f.length>0&&(0,$.jsx)(MF,{children:(0,$.jsxs)(zF,{className:`space-y-2 pt-4`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:i(z.TOTP_BACKUP_CODES)}),(0,$.jsx)(`div`,{className:`grid grid-cols-2 gap-1`,children:f.map((e,t)=>(0,$.jsx)(`code`,{className:`text-xs font-mono bg-muted px-2 py-1 rounded text-center`,children:e},t))}),(0,$.jsxs)(iZ,{className:`flex items-center gap-2 cursor-pointer mt-2`,children:[(0,$.jsx)(jI,{checked:m,onCheckedChange:e=>h(e===!0)}),(0,$.jsx)(Z,{className:`text-xs`,children:i(z.TOTP_BACKUP_SAVED)})]})]})}),(0,$.jsxs)(`div`,{className:`space-y-item-xs pt-2`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium text-center`,children:i(z.TOTP_VERIFY_LABEL)}),(0,$.jsx)(gE,{schema:Bre,defaultValues:{code:``},onSubmit:E,validationMode:pr.ON_BLUR,disabled:r||D,onFormReady:C,labels:{fields:{code:i(z.TOTP_VERIFY_LABEL)}},layoutTemplate:S},`totp-enrollment-verify`)]}),g&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:g})})]})};tZ(Al.TOTP,pZ);function Hve(e){return e?{[ks.AUTH_SESSION_ID]:e}:void 0}tZ(Al.PASSKEY,({sessionId:e,onComplete:t,onError:n,isLoading:r,t:i})=>{let[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l=bp(),u=typeof window<`u`&&!!window.PublicKeyCredential,d=(0,Q.useCallback)(async()=>{o(!0),c(null);try{let n=Hve(e),r=await lc().passkeyRegisterOptions(n?{headers:n}:void 0),i=await Dp({optionsJSON:r});t((await lc().passkeyRegisterVerify({response:i},n?{headers:n}:void 0)).enrollmentSession)}catch(e){let t=e?.name===`NotAllowedError`?i(z.PASSKEY_CANCELLED):l(e,i(z.ENROLL_ERROR));c(t),n(t)}finally{o(!1)}},[e,t,n,i,l]);return u?(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:i(z.PASSKEY_DESCRIPTION)}),s&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:s})}),(0,$.jsx)(X,{className:`w-full`,onClick:d,disabled:a||r,children:i(a?z.PASSKEY_REGISTERING:z.PASSKEY_REGISTER_BUTTON)})]}):(0,$.jsx)(`div`,{className:`space-y-item`,children:(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:i(z.PASSKEY_UNSUPPORTED)})})})});function mZ(e){return e?{[ks.AUTH_SESSION_ID]:e}:void 0}var hZ=({sessionId:e,onComplete:t,onError:n,isLoading:r,t:i})=>{let a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),s=bp(),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),m=(0,Q.useMemo)(()=>()=>(0,$.jsx)(GX,{fieldName:`phoneNumber`,submitLabel:i(z.PHONE_SEND_CODE),submittingLabel:i(z.PHONE_SENDING),fieldProps:{type:`tel`,placeholder:`+1 555 123 4567`,autoFocus:!0}}),[i]),h=(0,Q.useMemo)(()=>()=>(0,$.jsx)(GX,{fieldName:`code`,submitLabel:i(z.PHONE_VERIFY_BUTTON),submittingLabel:i(z.PHONE_VERIFYING),fieldProps:{autoFocus:!0}}),[i]),g=(0,Q.useCallback)(e=>{a.current=e},[]),_=(0,Q.useCallback)(e=>{o.current=e},[]),v=(0,Q.useCallback)(()=>{a.current?.clearErrors(`root`)},[]),y=(0,Q.useCallback)(()=>{o.current?.clearErrors(`root`)},[]),b=(0,Q.useCallback)(e=>{a.current?.setError(`root`,{type:`server`,message:e})},[]),x=(0,Q.useCallback)(e=>{o.current?.setError(`root`,{type:`server`,message:e})},[]),S=(0,Q.useCallback)(async(t,r)=>{let a=t.trim();if(a){p(!0),r===`phone`?v():y();try{let t=mZ(e);await lc().phoneVerifySend(a,t?{headers:t}:void 0),l(a),d(!0)}catch(e){let t=s(e,i(z.ENROLL_ERROR));r===`phone`?b(t):x(t),n(t)}finally{p(!1)}}},[e,n,i,s,v,y,b,x]),C=(0,Q.useCallback)(async e=>{await S(e.phoneNumber,`phone`)},[S]),w=(0,Q.useCallback)(async()=>{await S(c,`code`)},[c,S]),T=(0,Q.useCallback)(async r=>{y();try{let n=mZ(e),a=await lc().phoneVerifyConfirm(c.trim(),r.code.trim(),n?{headers:n}:void 0);a.verified?t(a.enrollmentSession):x(i(z.ENROLL_ERROR))}catch(e){let t=s(e,i(z.ENROLL_ERROR));x(t),n(t)}},[c,e,t,n,i,y,x,s]);return u?(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:i(z.PHONE_CODE_SENT)}),(0,$.jsx)(gE,{schema:iie,defaultValues:{code:``},onSubmit:T,validationMode:pr.ON_BLUR,disabled:f||r,onFormReady:_,labels:{fields:{code:i(z.PHONE_CODE_LABEL)}},layoutTemplate:h},`phone-enrollment-verify`),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.SM,onClick:w,disabled:f,children:i(z.PHONE_RESEND)})})]}):(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:i(z.PHONE_DESCRIPTION)}),(0,$.jsx)(gE,{schema:Nre,defaultValues:{phoneNumber:c},onSubmit:C,validationMode:pr.ON_BLUR,disabled:f||r,onFormReady:g,labels:{fields:{phoneNumber:i(z.PHONE_NUMBER_LABEL)}},layoutTemplate:m},`phone-enrollment-start`)]})};tZ(Al.SMS_OTP,hZ);var Uve={[Al.SMS_OTP]:kt.SMS_OTP_TITLE,[Al.EMAIL_OTP]:kt.EMAIL_OTP_TITLE,[Al.TOTP]:kt.TOTP_TITLE,[Al.PASSKEY]:kt.PASSKEY_TITLE},gZ=({sessionId:e,sessionEmail:t=``})=>{let{getSessionState:n,auth:r}=Dm(),i=(0,Q.useMemo)(()=>[J.PUBLIC_LAYOUTS_MFA_CHALLENGE,J.PUBLIC_LAYOUTS_USER_AUTH],[]),{tComponent:a,isReady:o}=K({component:i}),s=wg(),c=e=>a(J.PUBLIC_LAYOUTS_MFA_CHALLENGE,e),l=(0,Q.useMemo)(()=>Om(a,J.PUBLIC_LAYOUTS_USER_AUTH),[a]),u=(0,Q.useMemo)(()=>R(s.search),[s.search]),d=(0,Q.useMemo)(()=>ai(Cn.login,u),[u]),f=(0,Q.useMemo)(()=>Vt(s.search),[s.search]),[p,m]=(0,Q.useState)([]),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{!C.current&&e&&(C.current=!0,n(e).then(e=>{let t=new Set(e.usableSecondFactorMethods||[]),n=(e.availableSecondFactorMethods||[]).filter(e=>t.has(e.method)).filter(e=>$X[e.method]);n.length===0?(e.availableEnrollmentMethods||[]).filter(e=>eZ[e]).length>0?S(!0):b(`no_methods`):(m(n),n.length===1&&g(n[0].method))}).catch(e=>{let t=e?.response?.status;b(t===404||t===410?`expired`:`generic`)}))},[e,n]);let w=(0,Q.useCallback)(e=>{},[]),T=(0,Q.useCallback)(e=>{v(e)},[]),E=(0,Q.useCallback)(()=>{g(null),v(null)},[]),D=Xp(r,u);if(D)return(0,$.jsx)(og,{to:D,replace:!0});if(r.accessToken&&!r.isLoading)return(0,$.jsx)(og,{to:f,replace:!0});if(x&&e)return(0,$.jsx)(og,{to:ai(`${Cn.enrollmentRequired}?sessionId=${encodeURIComponent(e)}&email=${encodeURIComponent(t)}`,u),replace:!0});if(!o)return null;if(!e||y){let e={expired:kt.ERROR_EXPIRED,no_methods:kt.ERROR_NO_METHODS,generic:kt.ERROR_GENERIC},t=y?e[y]:kt.ERROR_GENERIC;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`text-center space-y-item-xs mb-group`,children:(0,$.jsx)(zY,{children:c(kt.TITLE)})}),(0,$.jsx)(UD,{variant:y===`no_methods`?`default`:`destructive`,children:(0,$.jsx)(GD,{children:c(t)})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(FX,{href:d,children:c(kt.BACK_TO_LOGIN)})})]})}return p.length===0?(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`text-center space-y-item-xs py-section`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,"aria-hidden":`true`,children:(0,$.jsx)(gb,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`text-muted-foreground`,children:c(kt.VERIFYING)})]}):(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(zY,{children:c(kt.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto text-muted-foreground`,children:c(kt.SUB_TITLE)})]}),!h&&p.length>1&&(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:c(kt.SELECT_METHOD)}),(0,$.jsx)(rZ,{layout:nZ.LIST,methods:p.map(e=>e.method),labelFor:e=>{let t=Uve[e];return t?c(t):e},onSelect:g})]}),h&&(()=>{let n=$X[h];if(!n)return null;let i=p.find(e=>e.method===h);if(!i)return null;let a={sessionId:e,email:t,methodConfig:i,onSuccess:w,onError:T,factorLevel:`second`,isLoading:r.isLoading,t:l,authRedirectTarget:u};return(0,$.jsx)(n,{...a})})(),_&&!h&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:_})}),h&&p.length>1&&(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.SM,onClick:E,children:c(kt.CHANGE_METHOD)})}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(FX,{href:d,children:c(kt.BACK_TO_LOGIN)})})]})};function _Z({preset:e=q.DEFAULT,...t}){let n=G(J.PUBLIC_LAYOUTS_MFA_CHALLENGE,`Auth_MfaChallenge`)(e);return(0,$.jsx)(n,{...t})}var Wve=()=>{let[e]=bh(),t=e.get(`sessionId`),n=e.get(`email`)||``;return(0,$.jsx)(AX,{useCardLayout:!0,children:(0,$.jsx)(_Z,{sessionId:t,sessionEmail:n})})},vZ={[Al.TOTP]:z.TOTP_TITLE,[Al.PASSKEY]:z.PASSKEY_TITLE,[Al.SMS_OTP]:z.PHONE_TITLE},yZ=e=>{let{auth:t,completeEnrollmentSession:n,getSessionState:r,adoptPendingMfaSession:i}=Dm(),{logout:a}=Cg(),{tComponent:o,isReady:s}=K({component:J.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED}),c=vh(),l=wg(),u=e=>o(J.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,e),d=(0,Q.useMemo)(()=>R(l.search),[l.search]),{urlSessionId:f,urlEmail:p}=(0,Q.useMemo)(()=>{let e=new URLSearchParams(l.search);return{urlSessionId:e.get(`sessionId`),urlEmail:e.get(`email`)||``}},[l.search]),[m]=(0,Q.useState)(()=>Nae()),h=f??m?.sessionId??null,g=p||m?.email||``,_=!t.accessToken&&!t.mfaRequired&&!!h,[v,y]=(0,Q.useState)(!1),b=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{if(!_||!h||b.current)return;b.current=!0;let e=()=>{m?.sessionId===h&&Oae()};r(h).then(t=>{i(h,t)||e()}).catch(t=>{let n=t?.response?.status;(n===404||n===410)&&e()}).finally(()=>y(!0))},[_,h,m,r,i]);let x=(0,Q.useMemo)(()=>ai(Cn.login,d),[d]),S=(0,Q.useMemo)(()=>Vt(l.search),[l.search]),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(null),k=(0,Q.useMemo)(()=>t.availableEnrollmentMethods.filter(e=>eZ[e]),[t.availableEnrollmentMethods]),A=(0,Q.useMemo)(()=>{let e=t.mfaSessionId;if(!e)return ai(Cn.mfaChallenge,d);let n=t.identification?.email||g;return ai(`${Cn.mfaChallenge}?sessionId=${e}&email=${encodeURIComponent(n)}`,d)},[t.mfaSessionId,t.identification?.email,g,d]),j=(0,Q.useCallback)(e=>{O(null),n(e)||(E(!0),setTimeout(()=>{c(A,{replace:!0})},1200))},[c,A,n]),M=(0,Q.useCallback)(e=>{O(e)},[]),N=Xp(t,d);if(N)return(0,$.jsx)(og,{to:N,replace:!0});if(t.accessToken&&!t.isLoading)return(0,$.jsx)(og,{to:S,replace:!0});if(!t.mfaRequired)return _&&!v?(0,$.jsx)($.Fragment,{}):(0,$.jsx)(og,{to:x,replace:!0});let P=t.usableSecondFactorMethods.length>0;if(t.mfaSessionId&&k.length===0&&P)return(0,$.jsx)(og,{to:A,replace:!0});if(!s)return null;if(k.length===0)return(0,$.jsxs)(`div`,{className:`space-y-group py-section`,children:[(0,$.jsx)(`div`,{className:`text-center space-y-item-xs`,children:(0,$.jsx)(zY,{children:u(z.TITLE)})}),(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:u(z.NO_METHODS_AVAILABLE)})}),(0,$.jsx)(X,{variant:Y.OUTLINE,className:`w-full`,onClick:()=>a(),children:u(z.LOGOUT_BUTTON)})]});if(T)return(0,$.jsxs)(`div`,{className:`text-center space-y-group py-section`,children:[(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:u(z.ENROLL_SUCCESS)})}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:u(z.LOADING)})]});let F=C?eZ[C]:null;return(0,$.jsxs)(`div`,{className:`space-y-group py-section`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(zY,{children:u(z.TITLE)}),(0,$.jsx)(Z,{className:`text-muted-foreground max-w-sm mx-auto`,children:u(z.DESCRIPTION)})]}),D&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:D})}),!C&&(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium text-center`,children:u(z.SELECT_METHOD)}),(0,$.jsx)(rZ,{layout:nZ.LIST,methods:k,labelFor:e=>u(vZ[e]||e),onSelect:e=>{w(e),O(null)}})]}),C&&F&&(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.SM,onClick:()=>{w(null),O(null)},children:`←`}),(0,$.jsx)(Z,{className:`text-sm font-medium`,children:u(vZ[C]||C)})]}),(0,$.jsx)(F,{sessionId:t.mfaSessionId||void 0,onComplete:j,onError:M,isLoading:!1,t:u})]}),(0,$.jsx)(`div`,{className:`pt-2`,children:(0,$.jsx)(X,{variant:Y.OUTLINE,className:`w-full`,onClick:()=>a(),children:u(z.LOGOUT_BUTTON)})})]})};function bZ({preset:e=q.DEFAULT,...t}){let n=G(J.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,`Auth_EnrollmentRequired`)(e);return(0,$.jsx)(n,{...t})}var Gve=()=>(0,$.jsx)(AX,{useCardLayout:!0,children:(0,$.jsx)(bZ,{})}),xZ=J.PUBLIC_LAYOUTS_ORGANIZATION_ONBOARDING,SZ=Q.createContext(null),Kve=()=>{let{tComponent:e,isReady:t}=K({component:xZ}),n=Q.useContext(SZ);return t?(0,$.jsxs)(hA,{children:[(0,$.jsx)(nR,{name:`organizationName`}),n&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:n})}),(0,$.jsx)(hO,{label:e(xZ,ga.SUBMIT_BUTTON),submittingLabel:`…`,fullWidth:!0})]}):null},qve=()=>{let{tComponent:e,isReady:t}=K({component:xZ}),n=Q.useContext(SZ);return t?(0,$.jsxs)(hA,{children:[(0,$.jsx)(nR,{name:`firstName`}),(0,$.jsx)(nR,{name:`lastName`}),n&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:n})}),(0,$.jsx)(hO,{label:e(xZ,ga.PROFILE_SUBMIT_BUTTON),submittingLabel:`…`,fullWidth:!0})]}):null};function CZ(e){let t=e?.pendingObligations;if(!Array.isArray(t))return[Ql.ORGANIZATION];let n=new Set(Object.values(Ql));return t.filter(e=>typeof e==`string`&&n.has(e))}var wZ=e=>{let{auth:t,completeOrganizationOnboarding:n,completeProfileOnboarding:r,abandonOrganizationOnboarding:i,getSessionState:a}=Dm(),{tComponent:o,isReady:s}=K({component:xZ}),c=e=>o(xZ,e),l=bp(),u=wg(),d=vh(),f=(0,Q.useMemo)(()=>R(u.search),[u.search]),p=(0,Q.useMemo)(()=>Vt(u.search),[u.search]),m=(0,Q.useMemo)(()=>ai(Cn.login,f),[f]),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e=t.onboardingSessionId;if(!e){v(null);return}let n=!1;return a(e).then(e=>{n||v(CZ(e))}).catch(()=>{n||v([Ql.ORGANIZATION])}),()=>{n=!0}},[t.onboardingSessionId]);let y=_?.[0],b=(0,Q.useCallback)(async e=>{g(null);try{let t=await r(e.firstName.trim(),e.lastName.trim());t.signedIn||v(t.pendingObligations)}catch(e){g(l(e,c(ga.COMPLETION_ERROR)))}},[r,c]),x=(0,Q.useCallback)(async e=>{g(null);try{let t=await n(e.organizationName.trim());t.signedIn||v(t.pendingObligations)}catch(e){g(l(e,c(ga.COMPLETION_ERROR)))}},[n,c]),S=(0,Q.useCallback)(()=>{i(),d(m,{replace:!0})},[i,d,m]);if(t.accessToken&&!t.isLoading)return(0,$.jsx)(og,{to:p,replace:!0});if(!s)return null;if(!t.onboardingSessionId)return(0,$.jsxs)(`div`,{className:`space-y-group py-section text-center`,children:[(0,$.jsxs)(`div`,{className:`space-y-item-xs`,children:[(0,$.jsx)(zY,{children:c(ga.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:c(ga.SESSION_EXPIRED)})]}),(0,$.jsx)(Z,{className:`text-sm`,children:(0,$.jsx)(PX,{href:m,children:c(ga.SIGN_IN_AGAIN_LINK)})})]});if(_===null)return null;let C=(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(X,{variant:Y.GHOST,onClick:S,children:c(ga.USE_DIFFERENT_ACCOUNT)})});return y===Ql.PROFILE_NAMES?(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(zY,{children:c(ga.PROFILE_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:c(ga.PROFILE_DESCRIPTION)})]}),(0,$.jsx)(SZ.Provider,{value:h,children:(0,$.jsx)(gE,{schema:Pt,defaultValues:{firstName:``,lastName:``},onSubmit:b,validationMode:pr.ON_BLUR,disabled:t.isLoading,layoutTemplate:qve,labels:{fields:{firstName:c(ga.FIRST_NAME),lastName:c(ga.LAST_NAME)}}},Ql.PROFILE_NAMES)}),C]}):(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(zY,{children:c(ga.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:c(ga.DESCRIPTION)})]}),(0,$.jsx)(SZ.Provider,{value:h,children:(0,$.jsx)(gE,{schema:yte,defaultValues:{organizationName:``},onSubmit:x,validationMode:pr.ON_BLUR,disabled:t.isLoading,layoutTemplate:Kve,labels:{fields:{organizationName:c(ga.ORGANIZATION_NAME)}}},Ql.ORGANIZATION)}),C]})};function TZ({preset:e=q.DEFAULT,...t}){let n=G(xZ,`Auth_OrganizationOnboarding`)(e);return(0,$.jsx)(n,{...t})}var Jve=()=>(0,$.jsx)(AX,{useCardLayout:!0,children:(0,$.jsx)(TZ,{})}),EZ=({label:e})=>{let{appConfig:t}=_u(),n=Ate(t.compliance,$ie.PRIVACY_NOTICE,new Date().toISOString());return n===void 0?null:(0,$.jsx)(Z,{children:(0,$.jsx)(PX,{href:n,external:!0,"data-privacy-notice-link":``,children:e})})},DZ=Jo.getLogger(),OZ=DZ.debugByType(`Auth_Main`);DZ.setDebugTypeLogging(`Auth_Main`,!1);var Yve=()=>{let{auth:e}=Cg(),{tComponent:t,isReady:n}=K({component:J.PUBLIC_LAYOUTS_USER_AUTH});return n?(0,$.jsxs)(hA,{children:[(0,$.jsx)(nR,{name:`email`}),e.error&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:e.error})}),(0,$.jsx)(hO,{label:(e=>t(J.PUBLIC_LAYOUTS_USER_AUTH,e))(xl.CONTINUE),submittingLabel:`…`,fullWidth:!0})]}):null};function Xve(e){return new Promise(t=>{let n=Date.now()+e,r=()=>{let e=document.querySelector(`input[autocomplete~="webauthn"]`);e||Date.now()>=n?t(e):requestAnimationFrame(r)};r()})}var Zve=3e3,Qve={[fo.SAML_LOGIN_FAILED]:{label:xl.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[fo.SAML_AUTH_FAILED]:{label:xl.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[fo.MISSING_PARAMS]:{label:xl.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[fo.OAUTH_FAILED]:{label:xl.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[fo.SAML_SLO_FAILED]:{label:xl.PROVIDER_SIGN_OUT_FAILED,variant:`warning`}},kZ=({})=>{let{auth:e,identifyByEmail:t,initiateOAuth2Login:n}=Cg(),{signInWithPasskey:r,endedSessionReason:i}=Dm(),a=dS(),o=wg(),s=(0,Q.useMemo)(()=>YX({publicProviders:a.globalAuth?.socialOAuth2Providers}),[a.globalAuth?.socialOAuth2Providers]),c=(0,Q.useMemo)(()=>Tb(s.map(e=>e.displayNameLabelKey)),[s]),{t:l,tComponent:u,isReady:d}=K({component:J.PUBLIC_LAYOUTS_USER_AUTH,keys:c}),f=e=>u(J.PUBLIC_LAYOUTS_USER_AUTH,e),p=Cn,m=(0,Q.useMemo)(()=>Vt(o.search),[o.search]),h=(0,Q.useMemo)(()=>R(o.search),[o.search]),g=(0,Q.useMemo)(()=>{let e=new URLSearchParams(o.search).get(`error`);if(!e)return null;let{label:t,variant:n}=Qve[e]??{label:xl.PROVIDER_SIGN_IN_FAILED,variant:`destructive`};return{text:u(J.PUBLIC_LAYOUTS_USER_AUTH,t),variant:n}},[o.search,u]),_=i===P.ACCOUNT_NOT_ACTIVE?{text:f(xl.ACCOUNT_NOT_ACTIVE_NOTICE),variant:`destructive`}:i===P.SESSION_ENDED?{text:f(xl.SESSION_ENDED_NOTICE),variant:`info`}:null,v=(0,Q.useMemo)(()=>ai(p.passwordLost,h),[h,p.passwordLost]),y=(0,Q.useMemo)(()=>ai(p.register,h),[h,p.register]),[b,x]=(0,Q.useState)(null);zX({mfaRequired:e.mfaRequired,mfaSessionId:e.mfaSessionId,usableSecondFactorMethods:e.usableSecondFactorMethods,email:e.identification?.email,authRedirectTarget:h});let S=!!e.identification,C=e.identification?.sessionId||``,w=e.identification?.email||``,T=(0,Q.useMemo)(()=>!S||!e.identification?.userExists?[]:(e.identification?.firstFactorMethods||[]).filter(e=>$X[e.method]),[S,e.identification]),E=(0,Q.useMemo)(()=>{if(T.length===0)return null;let t=e.identification?.defaultFirstFactorMethod;return t&&$X[t]?t:T[0].method},[T,e.identification?.defaultFirstFactorMethod]),D=b||E,O=T.filter(e=>e.method!==D),k=T.some(e=>e.method===D&&e.enforcedFirstFactor),A=async e=>{try{await n(e,h)}catch{}},j=async e=>{await t(e.email)},M=(0,Q.useCallback)(e=>{},[]),N=(0,Q.useCallback)(e=>{},[]),F=s.length>0,I=!S||!e.identification?.userExists,ee=F&&I,L=(0,Q.useMemo)(()=>{let e=Tie(a.userTypeAuth?.authMethodsEnabled);return F||e.delete(Al.EXTERNAL_OAUTH2),e},[F,a.userTypeAuth?.authMethodsEnabled]),te=!a.userTypeAuth?.authMethodsEnabled||L.size>0,z=ee&&te,B=Fie(a.userTypeAuth?.authMethodsEnabled).has(Al.PASSKEY)&&e.purpose!==Hl.REAUTH&&typeof window<`u`&&!!window.PublicKeyCredential,ne=I&&!te&&!B&&!ee,re=!I&&T.length===0,ie=(0,Q.useRef)(!1),[ae,oe]=(0,Q.useState)(0),se=(0,Q.useCallback)(async()=>{ie.current=!0;try{await r(Bm.MODAL)}catch{}finally{ie.current=!1,oe(e=>e+1)}},[r]),ce=(0,Q.useRef)(r);ce.current=r,(0,Q.useEffect)(()=>{if(!d||!I||!B)return;let e=!1;return(async()=>{if(await Jae())for(await Xve(Zve);!e;)try{await ce.current(Bm.CONDITIONAL);return}catch(e){if(!(e instanceof Hm)||ie.current)return}})(),()=>{e=!0,Mae.cancelCeremony()}},[d,I,B,ae]),(0,Q.useEffect)(()=>{OZ(`Render isReady=${d} accessToken=${e.accessToken?`yes`:`no`} authLoading=${e.isLoading?`yes`:`no`} identification=${S?`yes`:`no`} showIdentify=${I?`yes`:`no`} activeMethod=${D??`none`}`)},[d,e.accessToken,e.isLoading,S,I,D]);let le=Xp(e,h);return le?(0,$.jsx)(og,{to:le,replace:!0}):e.accessToken?(0,$.jsx)(og,{to:m,replace:!0}):d?(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(zY,{children:e.purpose===Hl.REAUTH?f(xl.REAUTH_TITLE):f(xl.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:e.purpose===Hl.REAUTH?f(xl.REAUTH_SUB_TITLE):f(xl.SUB_TITLE)})]}),ee&&(0,$.jsx)(QX,{providers:s,onProviderClick:A,isLoading:e.isLoading,continueWithLabel:f(xl.CONTINUE_WITH),translate:l,dividerLabel:f(xl.DIVIDER_OR),showDivider:z}),!e.error&&_&&(0,$.jsx)(UD,{variant:_.variant,"data-session-ended-notice":i??void 0,children:(0,$.jsx)(GD,{children:_.text})}),!e.error&&g&&(0,$.jsx)(UD,{variant:g.variant,children:(0,$.jsx)(GD,{children:g.text})}),I&&te&&(0,$.jsx)(gE,{schema:Ete,defaultValues:{email:``},onSubmit:j,validationMode:pr.ON_BLUR,disabled:e.isLoading,labels:{fields:{email:f(xl.EMAIL_ADDRESS)}},layoutTemplate:Yve},`identify`),I&&B&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(qX,{label:f(xl.DIVIDER_OR)}),(0,$.jsxs)(X,{variant:Y.OUTLINE,className:`w-full`,labelOverflow:cf.WRAP,onClick:se,disabled:e.isLoading,"data-passkey-sign-in":``,children:[(0,$.jsx)(WX,{method:Al.PASSKEY}),f(xl.PASSKEY_SIGN_IN)]})]}),D&&!I&&(()=>{let t=$X[D];if(!t)return null;let n=T.find(e=>e.method===D);if(!n)return null;let r={sessionId:C,email:w,methodConfig:n,onSuccess:M,onError:N,factorLevel:`first`,isLoading:e.isLoading,t:f,authRedirectTarget:h};return(0,$.jsx)(t,{...r})})(),k&&O.length>0&&!I&&(0,$.jsx)(Z,{children:f(xl.ORGANIZATION_ENFORCED_METHOD)}),O.length>0&&!I&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(qX,{label:f(xl.OTHER_METHODS_DIVIDER)}),(0,$.jsx)(rZ,{methods:O.map(e=>e.method),labelFor:e=>UX(e,{offeredMethod:O.find(t=>t.method===e),socialProviders:s,continueWithTemplate:f(xl.CONTINUE_WITH),translateLabel:e=>f(e),resolveSocialProviderLabel:e=>JX({providerRef:e.providerRef,displayName:e.displayName,displayNameLabelKey:e.displayNameLabelKey,brandLabel:XX[e.providerRef]?.label,translate:l})}),onSelect:x,disabled:e.isLoading})]}),ne&&(0,$.jsx)(UD,{"data-auth-no-entry-point":``,children:(0,$.jsx)(GD,{children:f(xl.NO_SIGN_IN_METHOD_AVAILABLE)})}),re&&(0,$.jsx)(UD,{"data-auth-no-method-for-address":``,children:(0,$.jsx)(GD,{children:f(xl.NO_SIGN_IN_METHOD_FOR_ADDRESS)})}),!te&&!S&&e.error&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:e.error})}),(0,$.jsxs)(`div`,{className:`text-center space-y-item pt-group`,children:[D===Al.PASSWORD&&!I&&(0,$.jsx)(Z,{children:(0,$.jsx)(PX,{href:v,children:f(xl.FORGOT_PASSWORD)})}),e.purpose!==Hl.REAUTH&&a.registrationConfig.publicRegistrationAvailable&&(0,$.jsxs)(Z,{children:[f(xl.NO_ACCOUNT),` `,(0,$.jsx)(PX,{href:y,children:f(xl.SIGNUP_LINK)})]}),(0,$.jsx)(EZ,{label:f(xl.PRIVACY_NOTICE_LINK)})]})]}):null};function AZ({preset:e=q.DEFAULT,...t}){let n=G(J.PUBLIC_LAYOUTS_USER_AUTH,`Auth_Main`)(e);return OZ(`Resolve wrapper preset=${e} component=${n.displayName??n.name??`anonymous`}`),(0,$.jsx)(n,{...t})}var jZ=Jo.getLogger(),$ve=jZ.debugByType(`AuthPage_Main`);jZ.setDebugTypeLogging(`AuthPage_Main`,!1);var eye=()=>{let{auth:e}=Dm(),{isReady:t}=K({component:[J.PUBLIC_LAYOUTS_USER_AUTH,J.LOW_LEVEL_FORM_MESSAGE],keys:[`errors_validation`]});return $ve(`Render ready=${t}`),t?(0,$.jsx)(AX,{useCardLayout:!0,organizationBranding:e.identification?.organizationBranding,children:(0,$.jsx)(AZ,{})}):(0,$.jsx)(`div`,{className:`flex min-h-screen w-screen items-center justify-center bg-background`,children:(0,$.jsx)(gb,{size:48})})},tye=60,MZ=({token:e,email:t})=>{let{auth:n,handleEmailVerification:r}=Dm(),{tComponent:i,isReady:a}=K({component:J.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL}),o=bp(),s=e=>i(J.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL,e),c=Cn.login,[l,u]=(0,Q.useState)(null),d=(0,Q.useRef)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(t||``),[g,_]=(0,Q.useState)(`idle`),[v,y]=(0,Q.useState)(0),[b,x]=(0,Q.useState)(null),S=(0,Q.useCallback)(()=>{e&&t&&r(e,t).catch(e=>{u(o(e,s(Bs.ERROR_MESSAGE)))})},[e,t]);(0,Q.useEffect)(()=>{e&&t&&!d.current&&(d.current=!0,n.accessToken&&!n.isLoading?p(!0):S())},[e,t]),(0,Q.useEffect)(()=>{if(v<=0)return;let e=setInterval(()=>{y(t=>t<=1?(clearInterval(e),0):t-1)},1e3);return()=>clearInterval(e)},[v]),zX({mfaRequired:n.mfaRequired,mfaSessionId:n.mfaSessionId,usableSecondFactorMethods:n.usableSecondFactorMethods,email:t,authRedirectTarget:void 0});let C=(0,Q.useCallback)(async()=>{if(!(!m||v>0)){_(`sending`),x(null);try{await lc().resendVerificationEmail(m),_(`sent`),y(tye)}catch(e){_(`error`),x(o(e,s(Bs.ERROR_MESSAGE)))}}},[m,v]),w=Xp(n,void 0);return w?(0,$.jsx)(og,{to:w,replace:!0}):a?!e||!t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-destructive`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 18L18 6M6 6l12 12`})})}),(0,$.jsx)(zY,{children:s(Bs.ERROR_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(Bs.INVALID_LINK)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(FX,{href:c,children:s(Bs.LOGIN_LINK)})})]}):f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-warning/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-warning-foreground`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4.5c-.77-.833-2.694-.833-3.464 0L3.34 16.5c-.77.833.192 2.5 1.732 2.5z`})})}),(0,$.jsx)(zY,{children:s(Bs.SESSION_CONFLICT_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(Bs.SESSION_CONFLICT_DESCRIPTION).replace(`{email}`,t)})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-sm`,children:[(0,$.jsx)(X,{type:`button`,onClick:()=>{p(!1),S()},children:s(Bs.SESSION_CONFLICT_VERIFY_BUTTON).replace(`{email}`,t)}),(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,onClick:()=>{window.location.href=Cn.home},children:s(Bs.SESSION_CONFLICT_CANCEL_BUTTON)})]})]}):n.accessToken&&!n.isLoading?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-success/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-success`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 13l4 4L19 7`})})}),(0,$.jsx)(zY,{children:s(Bs.SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(Bs.SUCCESS_MESSAGE)})]}),(0,$.jsx)(og,{to:Cn.home,replace:!0})]}):l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-destructive`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 18L18 6M6 6l12 12`})})}),(0,$.jsx)(zY,{children:s(Bs.ERROR_TITLE)})]}),(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:l})}),(0,$.jsxs)(`div`,{className:`mt-group space-y-item-sm`,children:[(0,$.jsx)(Z,{className:`text-sm text-center`,children:s(Bs.RESEND_DESCRIPTION)}),(0,$.jsxs)(`div`,{className:`flex gap-item-xs`,children:[(0,$.jsx)(rN,{name:`__display`,schema:kd(),type:`email`,placeholder:s(Bs.RESEND_EMAIL_PLACEHOLDER),value:m,onChange:e=>h(String(e)),disabled:g===`sending`||v>0}),(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,onClick:C,disabled:!m||g===`sending`||v>0,children:g===`sending`?s(Bs.RESEND_SENDING):v>0?`${s(Bs.RESEND_COOLDOWN)} (${v}s)`:s(Bs.RESEND_BUTTON)})]}),g===`sent`&&(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:s(Bs.RESEND_SUCCESS)})}),g===`error`&&b&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:b})})]}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(FX,{href:c,children:s(Bs.LOGIN_LINK)})})]}):(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`text-center space-y-item-xs`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,"aria-hidden":`true`,children:(0,$.jsx)(gb,{size:24,className:`text-primary`})}),(0,$.jsx)(zY,{children:s(Bs.TITLE)}),(0,$.jsxs)(Z,{className:`max-w-sm mx-auto`,children:[s(Bs.VERIFYING),` `,t]})]})}):null};function NZ({preset:e=q.DEFAULT,...t}){let n=G(J.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL,`Auth_ConfirmEmail`)(e);return(0,$.jsx)(n,{...t})}var nye=()=>{let[e]=bh(),t=e.get(`token`)||void 0,n=e.get(`email`)||void 0;return Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(AX,{useCardLayout:!0,children:(0,$.jsx)(NZ,{token:t,email:n})})},PZ={minLength:15,maxLength:128,requireUppercase:!1,requireLowercase:!1,requireNumbers:!1,requireSpecialChars:!1,expiryDays:0},FZ=({fieldName:e,policy:t,t:n,blocklistContext:r})=>{let{watch:i}=rw(),a=i(e)||``,o=(0,Q.useMemo)(()=>{if(!a)return[];let e=[];return e.push({label:n(ja.MIN_LENGTH).replace(`{minLength}`,String(t.minLength)),passed:a.length>=t.minLength}),e.push({label:n(ja.MAX_LENGTH).replace(`{maxLength}`,String(t.maxLength)),passed:a.length<=t.maxLength}),t.requireUppercase&&e.push({label:n(ja.UPPERCASE),passed:/[A-Z]/.test(a)}),t.requireLowercase&&e.push({label:n(ja.LOWERCASE),passed:/[a-z]/.test(a)}),t.requireNumbers&&e.push({label:n(ja.NUMBER),passed:/\d/.test(a)}),t.requireSpecialChars&&e.push({label:n(ja.SPECIAL_CHAR),passed:/[^A-Za-z0-9]/.test(a)}),e.push({label:n(ja.BLOCKLISTED),passed:!Hu(a,r)}),e},[a,t,n,r]);return!a||o.length===0?null:(0,$.jsx)(`ul`,{className:`space-y-1 text-xs mt-item-xs`,children:o.map((e,t)=>(0,$.jsxs)(`li`,{className:`flex items-center gap-1.5 ${e.passed?`text-success-subtle-foreground`:`text-muted-foreground`}`,children:[e.passed?(0,$.jsx)(`svg`,{className:`w-3.5 h-3.5 shrink-0`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":`true`,children:(0,$.jsx)(`path`,{fillRule:`evenodd`,d:`M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z`,clipRule:`evenodd`})}):(0,$.jsx)(`svg`,{className:`w-3.5 h-3.5 shrink-0`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":`true`,children:(0,$.jsx)(`circle`,{cx:`10`,cy:`10`,r:`3`})}),(0,$.jsx)(`span`,{children:e.label})]},t))})};function IZ({email:e}){return e?(0,$.jsx)(`input`,{"data-testid":`credential-username-autofill`,type:`email`,name:`email`,autoComplete:`username`,value:e,readOnly:!0,tabIndex:-1,className:`sr-only`}):null}function LZ(e,t,n){return e.map(e=>{let r=t(e);return e===Vc.MIN_LENGTH?r.replace(`{minLength}`,String(n.minLength??8)):e===Vc.MAX_LENGTH?r.replace(`{maxLength}`,String(n.maxLength??128)):r})}function RZ(e,t,n){if(!e||typeof e!=`object`)return null;let r=e;if(r.message!==ii.VALIDATION_PASSWORD_POLICY_VIOLATION)return null;let i=r.context,a=i?.violations;return!Array.isArray(a)||a.length===0?null:LZ(a,t,{minLength:i.minLength??n.minLength??8,maxLength:i.maxLength??n.maxLength??128}).join(`. `)}var rye=new Set([Al.PASSWORD,Al.ORG_SAML,Al.ORG_OPENID_CONNECT,Al.EXTERNAL_OAUTH2,Al.MAGIC_LINK,Al.PASSKEY]),iye=({invitationEmail:e,passwordPolicy:t})=>{let{formState:n}=rw(),{tComponent:r,isReady:i}=K({component:J.PUBLIC_LAYOUTS_USER_INVITATION}),a=e=>r(J.PUBLIC_LAYOUTS_USER_INVITATION,e);return i?(0,$.jsxs)(hA,{children:[(0,$.jsx)(IZ,{email:e}),(0,$.jsx)(nR,{name:`firstName`}),(0,$.jsx)(nR,{name:`lastName`}),(0,$.jsx)(nR,{name:`password`}),(0,$.jsx)(nR,{name:`confirmPassword`}),(0,$.jsx)(FZ,{fieldName:`password`,policy:t,t:a}),n.errors.root&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:n.errors.root.message})}),(0,$.jsx)(hO,{label:a(ro.ACCEPT_INVITATION),submittingLabel:a(ro.ACCEPTING_INVITATION),fullWidth:!0})]}):null},aye=({invitationEmail:e,t,tAuth:n})=>{let{formState:r}=rw();return(0,$.jsxs)(hA,{children:[e&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:e}),(0,$.jsx)(nR,{name:`firstName`}),(0,$.jsx)(nR,{name:`lastName`}),r.errors.root&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:r.errors.root.message})}),(0,$.jsx)(hO,{label:n(xl.MAGIC_LINK_SEND),submittingLabel:n(xl.MAGIC_LINK_SEND),fullWidth:!0})]})},oye=({invitationEmail:e,disabled:t,onSubmit:n,t:r,tAuth:i})=>{let a=(0,Q.useRef)(null),o=bp(),s=(0,Q.useMemo)(()=>Wn.pick({firstName:!0,lastName:!0}),[]),c=(0,Q.useCallback)(async e=>{a.current?.clearErrors(`root`);try{await n(e.firstName?.trim()||void 0,e.lastName?.trim()||void 0)}catch(e){a.current?.setError(`root`,{type:`server`,message:o(e,r(ro.UNEXPECTED_ERROR))})}},[n,r,o]);return(0,$.jsx)(gE,{schema:s,defaultValues:{firstName:``,lastName:``},onSubmit:c,validationMode:pr.ON_BLUR,disabled:t,onFormReady:e=>{a.current=e},labels:{fields:{firstName:r(ro.FIRST_NAME),lastName:r(ro.LAST_NAME)}},layoutTemplate:()=>(0,$.jsx)(aye,{invitationEmail:e,t:r,tAuth:i})})},sye=({invitationEmail:e,error:t,t:n})=>(0,$.jsxs)(hA,{children:[e&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:e}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:n(ro.PASSKEY_DESCRIPTION)}),(0,$.jsx)(nR,{name:`firstName`}),(0,$.jsx)(nR,{name:`lastName`}),t&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:t})}),(0,$.jsx)(hO,{label:n(ro.PASSKEY_CREATE),submittingLabel:n(ro.PASSKEY_CREATING),fullWidth:!0})]}),cye=({invitationEmail:e,disabled:t,error:n,onSubmit:r,t:i})=>{let a=typeof window<`u`&&!!window.PublicKeyCredential,o=(0,Q.useMemo)(()=>Wn.pick({firstName:!0,lastName:!0}),[]);return a?(0,$.jsx)(gE,{schema:o,defaultValues:{firstName:``,lastName:``},onSubmit:e=>r(e.firstName?.trim()||void 0,e.lastName?.trim()||void 0),validationMode:pr.ON_BLUR,disabled:t,labels:{fields:{firstName:i(ro.FIRST_NAME),lastName:i(ro.LAST_NAME)}},layoutTemplate:()=>(0,$.jsx)(sye,{invitationEmail:e,error:n,t:i})}):(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:i(ro.PASSKEY_UNAVAILABLE_HINT)})})},zZ=({token:e,email:t})=>{let{auth:n,acceptInvitation:r}=Dm(),{handleError:i}=up(),a=bp(),o=dS(),s=(0,Q.useMemo)(()=>[J.PUBLIC_LAYOUTS_USER_INVITATION,J.PUBLIC_LAYOUTS_USER_AUTH],[]),{tComponent:c,isReady:l}=K({component:s}),u=wg(),d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!0),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(null),I=(0,Q.useCallback)(e=>c(J.PUBLIC_LAYOUTS_USER_INVITATION,e),[c]),ee=(0,Q.useCallback)(e=>c(J.PUBLIC_LAYOUTS_USER_AUTH,e),[c]),L=(0,Q.useMemo)(()=>Om(c,J.PUBLIC_LAYOUTS_USER_AUTH),[c]),te=Cn.login,z=(0,Q.useMemo)(()=>Vt(u.search),[u.search]),B=(0,Q.useMemo)(()=>R(u.search),[u.search]),ne=O?.inviteeEmail??t,re=(0,Q.useMemo)(()=>O?.passwordPolicy??o.passwordPolicy??PZ,[O?.passwordPolicy,o.passwordPolicy]),ie=(0,Q.useMemo)(()=>Wn.refine(e=>!e.password||e.password===e.confirmPassword,{message:I(ro.PASSWORD_MISMATCH),path:[`confirmPassword`]}),[I]),ae=(0,Q.useCallback)(e=>{d.current=e},[]);(0,Q.useEffect)(()=>{if(!e||n.accessToken){j(!1);return}let t=!1;return j(!0),N(null),lc().getInvitationInfo(e).then(e=>{t||k(e)}).catch(e=>{t||N(a(e,I(ro.UNEXPECTED_ERROR)))}).finally(()=>{t||j(!1)}),()=>{t=!0}},[e,n.accessToken]);let oe=(0,Q.useMemo)(()=>(O?.availableFirstFactorMethods??[]).filter(e=>rye.has(e.method)),[O]),se=oe.length>0,ce=n.isLoading||E||v,le=(0,Q.useMemo)(()=>oe[0]?.method??null,[oe]),ue=P??le,de=oe.filter(e=>e.method!==ue);zX({mfaRequired:n.mfaRequired,mfaSessionId:n.mfaSessionId,usableSecondFactorMethods:n.usableSecondFactorMethods,email:ne||void 0,authRedirectTarget:B});let fe=(0,Q.useCallback)(async t=>{if(d.current?.clearErrors(`root`),t.password){let e=ho.validatePasswordAgainstPolicy(t.password,re);if(!e.valid){d.current?.setError(`root`,{type:`policy`,message:LZ(e.violations,I,re).join(`. `)});return}}let n=e=>e?.trim()||void 0;try{(await r({invitationToken:e,firstName:n(t.firstName),lastName:n(t.lastName),password:t.password||void 0}))?.signInRequired&&T(!0)}catch(e){d.current?.setError(`root`,{type:`server`,message:a(e,I(ro.UNEXPECTED_ERROR))})}},[r,re,I,e,a]),pe=(0,Q.useCallback)(async(t,n)=>{x(null),y(!0);try{let i=await r({invitationToken:e,firstName:t,lastName:n,credentialMethod:Al.PASSKEY});if(i?.signInRequired){T(!0);return}let a=i?.passkeyRegistrationOptions;if(a)try{let e=await Dp({optionsJSON:a});await lc().passkeyRegisterVerify({response:e})}catch{}}catch(e){x(a(e,I(ro.UNEXPECTED_ERROR)))}finally{y(!1)}},[r,e,I,a]),me=(0,Q.useCallback)(async(t,n)=>{D(!0);try{(await lc().acceptInvitation({invitationToken:e,firstName:t,lastName:n,credentialMethod:Al.MAGIC_LINK,redirect:B})).nextStep===nre.SIGN_IN_REQUIRED?T(!0):C(!0)}catch(e){throw i(e,`Invitation acceptance failed (magic link)`,{credentialMethod:Al.MAGIC_LINK}),e}finally{D(!1)}},[e,i,B]),he=(0,Q.useCallback)(async()=>{if(_(null),!e)_(I(ro.INVALID_LINK));else{p(!0);try{await lc().rejectInvitation({invitationToken:e}),h(!0)}catch(e){_(a(e,I(ro.UNEXPECTED_ERROR)))}finally{p(!1)}}},[I,e,a]),ge=(0,Q.useCallback)(e=>{},[]),_e=(0,Q.useCallback)(e=>{},[]);return n.accessToken&&!v?(0,$.jsx)(og,{to:z,replace:!0}):l?e?m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(zY,{children:I(ro.DECLINE_SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:I(ro.DECLINE_SUCCESS_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(FX,{href:te,children:I(ro.CONTINUE_LINK)})})]}):w?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(zY,{children:I(ro.SIGN_IN_REQUIRED_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:I(ro.SIGN_IN_REQUIRED_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(FX,{href:te,children:I(ro.LOGIN_LINK)})})]}):S?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(zY,{children:ee(xl.MAGIC_LINK_SENT_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:ee(xl.MAGIC_LINK_SENT_DESCRIPTION)}),ne&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:ne})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(FX,{href:te,children:I(ro.LOGIN_LINK)})})]}):A?(0,$.jsx)(`div`,{className:`flex items-center justify-center py-group`,children:(0,$.jsx)(gb,{size:40})}):M||!O?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(zY,{children:I(ro.ERROR_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:M||I(ro.INVALID_LINK)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(FX,{href:te,children:I(ro.LOGIN_LINK)})})]}):O.managementMode===Pne.SCIM?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(zY,{children:I(ro.SCIM_MANAGED_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:I(ro.SCIM_MANAGED_MESSAGE)}),ne&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:ne})]}),g&&(0,$.jsx)(UD,{variant:`destructive`,className:`mb-group`,children:(0,$.jsx)(GD,{children:g})}),(0,$.jsxs)(`div`,{className:`text-center mt-group space-y-item-sm`,children:[(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:he,disabled:f,className:`w-full`,children:I(f?ro.DECLINING_INVITATION:ro.DECLINE_INVITATION)}),(0,$.jsx)(FX,{href:te,children:I(ro.LOGIN_LINK)}),(0,$.jsx)(EZ,{label:ee(xl.PRIVACY_NOTICE_LINK)})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(zY,{children:I(ro.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:I(ro.SUB_TITLE)}),O.organizationName&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:O.organizationName}),ne&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:ne})]}),se?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center mb-element`,children:I(ro.METHOD_CHOICE_HINT)}),(()=>{if(!ue)return null;let e=oe.find(e=>e.method===ue);if(!e)return null;if(ue===Al.PASSWORD)return(0,$.jsx)(gE,{schema:ie,defaultValues:{firstName:``,lastName:``,password:``,confirmPassword:``},onSubmit:fe,validationMode:pr.ON_BLUR,disabled:n.isLoading||f,onFormReady:ae,labels:{fields:{firstName:I(ro.FIRST_NAME),lastName:I(ro.LAST_NAME),password:I(ro.PASSWORD),confirmPassword:I(ro.CONFIRM_PASSWORD)}},layoutTemplate:()=>(0,$.jsx)(iye,{invitationEmail:ne,passwordPolicy:re})});if(ue===Al.MAGIC_LINK)return(0,$.jsx)(oye,{invitationEmail:ne,disabled:n.isLoading||f,onSubmit:me,t:I,tAuth:ee});if(ue===Al.PASSKEY)return(0,$.jsx)(cye,{invitationEmail:ne,disabled:n.isLoading||f,error:b,onSubmit:pe,t:I});let t=$X[ue];if(!t)return null;let r={sessionId:``,email:ne??``,methodConfig:e,onSuccess:ge,onError:_e,factorLevel:`first`,isLoading:n.isLoading||f,t:L};return(0,$.jsx)(t,{...r})})(),de.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(qX,{label:ee(xl.OTHER_METHODS_DIVIDER)}),(0,$.jsx)(rZ,{methods:de.map(e=>e.method),labelFor:e=>UX(e,{offeredMethod:de.find(t=>t.method===e),continueWithTemplate:ee(xl.CONTINUE_WITH),translateLabel:e=>ee(e),resolveSocialProviderLabel:e=>e.displayName??e.providerRef}),onSelect:e=>{F(e),x(null)},disabled:ce||f})]})]}):(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:I(ro.NO_METHOD_AVAILABLE_HINT)})}),g&&(0,$.jsx)(UD,{variant:`destructive`,className:`mt-group`,children:(0,$.jsx)(GD,{children:g})}),(0,$.jsxs)(`div`,{className:`text-center mt-group space-y-item-sm`,children:[(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:he,disabled:ce||f,className:`w-full`,children:I(f?ro.DECLINING_INVITATION:ro.DECLINE_INVITATION)}),(0,$.jsx)(FX,{href:te,children:I(ro.LOGIN_LINK)}),(0,$.jsx)(EZ,{label:ee(xl.PRIVACY_NOTICE_LINK)})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(zY,{children:I(ro.ERROR_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:I(ro.INVALID_LINK)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(FX,{href:te,children:I(ro.LOGIN_LINK)})})]}):null};function BZ({preset:e=q.DEFAULT,...t}){let n=G(J.PUBLIC_LAYOUTS_USER_INVITATION,`Auth_Invitation`)(e);return(0,$.jsx)(n,{...t})}var lye=()=>{let[e]=bh(),t=e.get(`token`)||void 0,n=e.get(`email`)||void 0;return Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(AX,{useCardLayout:!0,children:(0,$.jsx)(BZ,{token:t,email:n})})};function uye(e,t,n){if(!t||Object.keys(t).length===0)return;let r,i;for(let t of Object.values(n.resourceConfigurations)){let n=Array.isArray(t.operations)?t.operations:[];for(let a of n)if(a.tokenAuthentication?.types?.includes(e)&&fn(a.operationFrontendConfig)){r=t,i=a;break}if(i)break}if(!r||!i)return;let a={};for(let[e,r]of Object.entries(t)){let t=n.fieldIdentifierToResourceType[e];t&&(a[t]=r)}return Ch.resolveResourceUrl(r,i,a,n.allResourceFieldIdentifiers)?.resolvedUrl??void 0}function dye(e){return!e||!lae(e)||e.includes(`..`)||e.includes(`\\`)||e.includes(`://`)||/[<>"]/.test(e)||e.length>256?Cn.home:e}var VZ=({token:e,mode:t=`one-off-session`,returnPathFromUrl:n})=>{let{handleOneOffTokenExchange:r,handleAuthCodeExchange:i,clearCrossFrontendHandoffContext:a,auth:o,tokenStorage:s}=Dm(),{registry:c}=wm(),{tComponent:l,isReady:u}=K({component:J.PUBLIC_LAYOUTS_ONE_OFF_SESSION}),d=bp(),f=e=>l(J.PUBLIC_LAYOUTS_ONE_OFF_SESSION,e),p=Cn.login,[m,h]=(0,Q.useState)(null),g=(0,Q.useRef)(!1),[_,v]=(0,Q.useState)(t===`one-off-session`&&!!o.accessToken),y=(0,Q.useMemo)(()=>o.accessToken?t===`cross-frontend-handoff`?dye(o.crossFrontendHandoffContext?.returnPath??n):o.oneOffContext?uye(o.oneOffContext.tokenType,o.oneOffContext.scopedInitiatorIds,c)??Cn.home:Cn.home:Cn.home,[t,o.oneOffContext,o.accessToken,o.crossFrontendHandoffContext,n,c]);return(0,Q.useEffect)(()=>{g.current||(t===`one-off-session`&&!(s instanceof mm)?(g.current=!0,h(f(Ta.ERROR_WRONG_TAB)),v(!0)):e?o.accessToken&&t===`one-off-session`?(g.current=!0,v(!0)):(g.current=!0,(t===`cross-frontend-handoff`?i(e):r(e)).catch(e=>{h(d(e,f(Ta.ERROR_GENERIC)))}).finally(()=>{v(!0)})):(g.current=!0,h(f(Ta.ERROR_NO_TOKEN)),v(!0)))},[e,t,o.accessToken,r,i,s]),(0,Q.useEffect)(()=>()=>{t===`cross-frontend-handoff`&&a()},[t,a]),o.accessToken&&!o.isLoading&&_&&!m?(0,$.jsx)(og,{to:y,replace:!0}):u?m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-destructive`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 18L18 6M6 6l12 12`})})}),(0,$.jsx)(zY,{children:f(Ta.ERROR_TITLE)})]}),(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:m})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(FX,{href:p,children:f(Ta.LOGIN_LINK)})})]}):(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`text-center space-y-item-xs`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,"aria-hidden":`true`,children:(0,$.jsx)(gb,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:f(Ta.VERIFYING)})]}):null};function HZ({preset:e=q.DEFAULT,...t}){let n=G(J.PUBLIC_LAYOUTS_ONE_OFF_SESSION,`Auth_OneOffSession`)(e);return(0,$.jsx)(n,{...t})}var UZ=()=>{let{token:e}=Xm();return(0,$.jsx)(AX,{useCardLayout:!0,children:(0,$.jsx)(HZ,{token:e})})},WZ;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.UPLOADING=`uploading`,e.DONE=`done`,e.FAILED=`failed`})(WZ||={});function GZ(e,t){if(e.length===0||t===``)return!0;let n=t.split(`/`)[0];return e.some(e=>e===t||e===`${n}/*`)}function fye(e){let t=e,n=t?.status??t?.statusCode??t?.response?.status;return typeof n==`number`?n:void 0}var KZ=({token:e})=>{let{tComponent:t,isReady:n,formatDateTime:r,formatByteSize:i}=K({component:J.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT}),a=bp(),o=(0,Q.useCallback)((e,n)=>t(J.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT,e,n),[t]),[s,c]=(0,Q.useState)(WZ.LOADING),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(0),_=(0,Q.useRef)(null),v=(0,Q.useCallback)(async()=>{if(!e)return f({kind:$i.ERROR_NOT_FOUND,cause:void 0}),c(WZ.FAILED),null;try{let t=await lc().readFileUploadGrantStatus(e);return u(t),t}catch(e){let t=fye(e)===404?$i.ERROR_NOT_FOUND:$i.ERROR_GENERIC;return f({kind:t,cause:t===$i.ERROR_GENERIC?e:void 0}),c(WZ.FAILED),null}},[e]);(0,Q.useEffect)(()=>{let e=!1;return v().then(t=>{!e&&t&&c(WZ.READY)}),()=>{e=!0}},[v]);let y=(0,Q.useMemo)(()=>l?i(l.constraints.maxBytes):``,[l,i]),b=(0,Q.useCallback)(e=>{e&&l&&(e.size>l.constraints.maxBytes?(m(null),f({kind:$i.ERROR_TOO_LARGE,cause:void 0}),c(WZ.FAILED)):GZ(l.constraints.allowedMimeTypes,e.type)?(f(null),m(e),c(WZ.READY)):(m(null),f({kind:$i.ERROR_TYPE_NOT_ACCEPTED,cause:void 0}),c(WZ.FAILED)))},[l]),x=(0,Q.useCallback)(async()=>{if(e&&l&&p){c(WZ.UPLOADING),g(0);try{await lc().uploadWithFileUploadGrant(l,e,p,{onUploadProgress:e=>g(e<0?0:e)}),await v()&&c(WZ.DONE)}catch(e){f({kind:$i.ERROR_GENERIC,cause:e}),c(WZ.FAILED)}}},[e,l,p,v]),S=(0,Q.useCallback)(()=>{f(null),m(null),g(0),l?c(WZ.READY):(c(WZ.LOADING),v().then(e=>{e&&c(WZ.READY)}))},[l,v]);if(!n)return null;if(s===WZ.LOADING)return(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`text-center space-y-item-xs`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,"aria-hidden":`true`,children:(0,$.jsx)(gb,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:o($i.LOADING)})]});if(s===WZ.FAILED&&d){let e=o($i.ERROR_GENERIC),t=d.cause===void 0?null:a(d.cause,e);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`text-center space-y-item-xs mb-group`,children:(0,$.jsx)(zY,{children:o($i.ERROR_TITLE)})}),(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsxs)(GD,{children:[o(d.kind,d.kind===$i.ERROR_TOO_LARGE?{maxSize:y}:void 0),t&&t!==e?(0,$.jsx)(`span`,{className:`block mt-element text-xs opacity-80`,children:t}):null]})}),d.kind===$i.ERROR_NOT_FOUND?null:(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,onClick:S,children:o($i.RETRY)})})]})}if(!l)return null;if(l.state!==du.PENDING){let e=s===WZ.DONE,t=e?$i.SUCCESS_TITLE:l.state===du.REDEEMED?$i.STATE_REDEEMED_TITLE:l.state===du.EXPIRED?$i.STATE_EXPIRED_TITLE:$i.STATE_REVOKED_TITLE,n=e?$i.SUCCESS_MESSAGE:l.state===du.REDEEMED?$i.STATE_REDEEMED:l.state===du.EXPIRED?$i.STATE_EXPIRED:$i.STATE_REVOKED;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`text-center space-y-item-xs mb-group`,children:(0,$.jsx)(zY,{children:o(t)})}),(0,$.jsx)(UD,{variant:e?`success`:`info`,children:(0,$.jsx)(GD,{children:o(n)})}),l.file?(0,$.jsxs)(`dl`,{className:`mt-group text-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:o($i.FILE_ID)}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`code`,{"data-testid":`upload-grant-file-id`,children:l.file.fileId})})]}):null]})}let C=s===WZ.UPLOADING,w=l.constraints.allowedMimeTypes;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(zY,{children:o($i.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:o($i.INTRO,{fieldName:l.target.fieldName})})]}),(0,$.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-element gap-y-item-xs text-sm mb-group`,children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:o($i.MAX_SIZE)}),(0,$.jsx)(`dd`,{"data-testid":`upload-grant-max-size`,children:y}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:o($i.ACCEPTED_TYPES)}),(0,$.jsx)(`dd`,{"data-testid":`upload-grant-accepted-types`,children:w.length>0?w.join(`, `):o($i.ANY_TYPE)}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:o($i.EXPIRES_AT)}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`time`,{dateTime:l.expiresAt,children:r(l.expiresAt)})})]}),(0,$.jsxs)(`div`,{role:`group`,"aria-label":o($i.DROPZONE_ARIA),className:`rounded-md border border-dashed border-input p-group text-center`,onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),C||b(e.dataTransfer.files?.[0]??null)},children:[(0,$.jsx)(`input`,{ref:_,type:`file`,"data-testid":`upload-grant-file-input`,className:`sr-only`,accept:w.length>0?w.join(`,`):void 0,disabled:C,onChange:e=>b(e.target.files?.[0]??null)}),(0,$.jsx)(Z,{className:`mb-element`,children:o($i.DROPZONE_PROMPT)}),(0,$.jsx)(X,{type:`button`,"data-testid":`upload-grant-choose`,variant:Y.OUTLINE,disabled:C,onClick:()=>_.current?.click(),children:o($i.CHOOSE_FILE)}),(0,$.jsx)(Z,{className:`mt-element text-sm`,"data-testid":`upload-grant-selected-file`,children:p?`${p.name} · ${i(p.size)}`:o($i.NO_FILE_SELECTED)})]}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(X,{type:`button`,"data-testid":`upload-grant-submit`,disabled:!p||C,onClick:()=>void x(),children:C?o($i.UPLOADING,{percent:h}):o($i.UPLOAD)})})]})};function qZ({preset:e=q.DEFAULT,...t}){let n=G(J.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT,`Files_UploadGrantDrop`)(e);return(0,$.jsx)(n,{...t})}var JZ=()=>{let{token:e}=Xm();return(0,$.jsx)(AX,{useCardLayout:!0,children:(0,$.jsx)(qZ,{token:e})})},pye=()=>{let[e]=bh(),t=e.get(`code`)??void 0,n=e.get(`return`)??void 0;return(0,$.jsx)(AX,{useCardLayout:!0,children:(0,$.jsx)(HZ,{token:t,mode:`cross-frontend-handoff`,returnPathFromUrl:n})})},mye=()=>{let{formState:e}=rw(),{tComponent:t,isReady:n}=K({component:J.PUBLIC_LAYOUTS_USER_PASSWORD_LOST}),r=e=>t(J.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,e);return n?(0,$.jsxs)(hA,{children:[(0,$.jsx)(nR,{name:`email`}),e.errors.root&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:e.errors.root.message})}),(0,$.jsx)(hO,{label:r(jl.SEND_RESET_PASSWORD_LINK),submittingLabel:r(jl.SENDING),fullWidth:!0})]}):null},hye=({resetEmail:e})=>{let t=dS(),{formState:n}=rw(),{tComponent:r,isReady:i}=K({component:J.PUBLIC_LAYOUTS_USER_PASSWORD_LOST}),a=e=>r(J.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,e),o=t.passwordPolicy??PZ;return i?(0,$.jsxs)(hA,{children:[(0,$.jsx)(IZ,{email:e}),(0,$.jsx)(nR,{name:`newPassword`}),(0,$.jsx)(nR,{name:`confirmPassword`}),(0,$.jsx)(FZ,{fieldName:`newPassword`,policy:o,t:a}),n.errors.root&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:n.errors.root.message})}),(0,$.jsx)(hO,{label:a(jl.RESET_BUTTON),submittingLabel:a(jl.RESETTING),fullWidth:!0})]}):null},YZ=({resetToken:e,email:t})=>{let{auth:n}=Cg(),r=dS(),i=bp(),{tComponent:a,isReady:o}=K({component:J.PUBLIC_LAYOUTS_USER_PASSWORD_LOST}),s=e=>a(J.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,e),c=Cn.login,l=(0,Q.useRef)(null),{initAutoClearing:u,injectServerErrors:d,clearServerErrors:f}=rz(l),p=(0,Q.useCallback)(e=>{l.current=e,u(e)},[u]),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),b=(0,Q.useMemo)(()=>r.passwordPolicy??PZ,[r.passwordPolicy]),x=(0,Q.useMemo)(()=>Dn.refine(e=>e.newPassword===e.confirmPassword,{message:s(jl.PASSWORD_MISMATCH),path:[`confirmPassword`]}),[s]);return n.accessToken?(0,$.jsx)(og,{to:Cn.home,replace:!0}):o?v?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-success/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-success`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 13l4 4L19 7`})})}),(0,$.jsx)(zY,{children:s(jl.RESET_SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(jl.RESET_SUCCESS_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(FX,{href:c,children:s(jl.LOGIN_LINK)})})]}):e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(zY,{children:s(jl.RESET_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(jl.RESET_SUB_TITLE)})]}),(0,$.jsx)(gE,{schema:x,defaultValues:{newPassword:``,confirmPassword:``},onSubmit:async t=>{h(!0),l.current?.clearErrors(`root`),f();let n=ho.validatePasswordAgainstPolicy(t.newPassword,b);if(!n.valid)l.current?.setError(`root`,{type:`policy`,message:LZ(n.violations,s,b).join(`. `)}),h(!1);else try{await lc().completePasswordReset(e,t.newPassword),y(!0)}catch(e){let t=LM(e);if(t)d(t.validationErrors);else{let t=RZ(e,s,b);l.current?.setError(`root`,{type:`server`,message:t??i(e,s(jl.INVALID_TOKEN))})}}finally{h(!1)}},onFormReady:p,validationMode:pr.ON_BLUR,disabled:m,labels:{fields:{newPassword:s(jl.NEW_PASSWORD),confirmPassword:s(jl.CONFIRM_PASSWORD)}},layoutTemplate:()=>(0,$.jsx)(hye,{resetEmail:t})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(FX,{href:c,children:s(jl.BACK_TO_LOGIN)})})]}):g?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-primary`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z`})})}),(0,$.jsx)(zY,{children:s(jl.SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(jl.SUCCESS_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(FX,{href:c,children:s(jl.BACK_TO_LOGIN)})})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(zY,{children:s(jl.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(jl.SUB_TITLE)})]}),(0,$.jsx)(gE,{schema:Mte,defaultValues:{email:``},onSubmit:async e=>{h(!0),l.current?.clearErrors(`root`),f();try{await lc().requestPasswordReset(e.email),_(!0)}catch(e){let t=LM(e);t?d(t.validationErrors):l.current?.setError(`root`,{type:`server`,message:i(e,s(jl.UNEXPECTED_ERROR))})}finally{h(!1)}},onFormReady:p,validationMode:pr.ON_BLUR,disabled:m,labels:{fields:{email:s(jl.EMAIL_ADDRESS)}},layoutTemplate:mye}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(FX,{href:c,children:s(jl.BACK_TO_LOGIN)})})]}):null};function XZ({preset:e=q.DEFAULT,...t}){let n=G(J.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,`Auth_PasswordLost`)(e);return(0,$.jsx)(n,{...t})}var gye=()=>{let[e]=bh(),t=e.get(`token`)||void 0,n=e.get(`email`)||void 0;return Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(AX,{useCardLayout:!0,children:(0,$.jsx)(XZ,{resetToken:t,email:n})})},_ye=[`response_type`,`client_id`,`redirect_uri`,`code_challenge`,`code_challenge_method`,`scope`,`resource`,`state`,`nonce`],ZZ=e=>{let{auth:t}=Cg(),{tComponent:n,isReady:r}=K({component:J.PUBLIC_LAYOUTS_OAUTH_CONSENT}),[i]=bh(),[a,o]=(0,Q.useState)(`loading`),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),p=t?.accessToken,m=(e,t)=>n(J.PUBLIC_LAYOUTS_OAUTH_CONSENT,e,t),h=(0,Q.useRef)(!1),g=(0,Q.useMemo)(()=>{let e=new URLSearchParams;for(let t of _ye){let n=i.get(t);n&&e.set(t,n)}return e},[i]);(0,Q.useEffect)(()=>{if(!p)return;let e=!1;return o(`loading`),u(null),lc().oauthAuthorizeConsent(g).then(t=>{e||(t&&`consent_required`in t&&t.consent_required&&t.consent_token?(c(t),o(`ready`)):t&&`redirect_to`in t&&t.redirect_to?window.location.assign(t.redirect_to):(o(`error`),u(Xc.ERROR_INVALID)))}).catch(()=>{e||(o(`error`),u(Xc.ERROR_LOAD))}),()=>{e=!0}},[p,g]);let _=(0,Q.useCallback)(async e=>{if(s&&!h.current){h.current=!0,o(`submitting`),u(null);try{let{redirect_to:t}=await lc().oauthConsentDecision(s.consent_token,e,e===Oi.APPROVE&&d);window.location.assign(t)}catch{h.current=!1,o(`error`),u(Xc.ERROR_DECISION)}}},[s,d]);if(!p){let e=cd({pathname:Cn.oauthConsent,search:`?${i.toString()}`});return(0,$.jsx)(og,{to:ai(Cn.login,e),replace:!0})}return a===`loading`||a===`submitting`||!r?(0,$.jsx)(`div`,{className:`py-region flex justify-center`,children:(0,$.jsx)(gb,{})}):a===`error`||!s?(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:m(l??Xc.ERROR_GENERIC)})}):(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(zY,{children:m(Xc.TITLE,{clientName:s.client.name})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:m(Xc.SUB_TITLE)})]}),s.scopes.length>0&&(0,$.jsxs)(`div`,{className:`space-y-element`,children:[(0,$.jsx)(Z,{className:`font-medium`,children:m(Xc.SCOPES_INTRO)}),(0,$.jsx)(`ul`,{className:`space-y-item-xs`,children:s.scopes.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(Z,{children:e})},e))})]}),s.resource&&(0,$.jsx)(Z,{className:`text-sm break-all`,children:m(Xc.AGENT_ENDPOINT,{resource:s.resource})}),(0,$.jsxs)(`label`,{className:`flex items-center gap-item-xs cursor-pointer`,children:[(0,$.jsx)(jI,{checked:d,onCheckedChange:e=>f(e===!0)}),(0,$.jsx)(Z,{children:m(Xc.REMEMBER)})]}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[(0,$.jsx)(X,{variant:Y.OUTLINE,className:`flex-1`,onClick:()=>_(Oi.DENY),children:m(Xc.DENY)}),(0,$.jsx)(X,{variant:Y.DEFAULT,className:`flex-1`,onClick:()=>_(Oi.APPROVE),children:m(Xc.APPROVE)})]})]})};function QZ({preset:e=q.DEFAULT,...t}){let n=G(J.PUBLIC_LAYOUTS_OAUTH_CONSENT,`Auth_OAuthConsent`)(e);return(0,$.jsx)(n,{...t})}var vye=()=>(Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(AX,{useCardLayout:!0,children:(0,$.jsx)(QZ,{})})),$Z;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.LINKING=`linking`,e.LINKED=`linked`,e.ERROR=`error`})($Z||={});var eQ=J.PUBLIC_LAYOUTS_CHAT_IDENTITY_LINK;function tQ(e){return gl.createOperationPathKey({resourceIdentifier:Na.CHAT_IDENTITY_LINKS,operationIdentifier:e,variantType:Ya.API_CALL,isOperationDefault:!0,isBulkOperation:!1})}var nQ=e=>{let{auth:t}=Cg(),n=t?.accessToken,{tComponent:r,isReady:i,formatDateTime:a}=K({component:eQ}),o=(e,t)=>r(eQ,e,t),{doOperation:s}=wm(),c=bp(),l=vh(),[u,d]=bh(),[f]=(0,Q.useState)(()=>({organizationId:u.get(_i.ORGANIZATION_ID),token:u.get(_i.TOKEN),host:cae(u.get(_i.HOST))})),p=ox(f.host),[m,h]=(0,Q.useState)($Z.LOADING),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),b=(0,Q.useRef)(!1),x=(0,Q.useRef)(s);x.current=s;let S=(0,Q.useRef)(c);S.current=c;let C=(0,Q.useCallback)(()=>({contextualParameters:{organizationId:f.organizationId??``},requestData:{token:f.token??``}}),[f]),w=!!n;(0,Q.useEffect)(()=>{if(!w||b.current)return;if(u.has(_i.TOKEN)&&d({},{replace:!0}),!f.organizationId||!f.token){h($Z.ERROR),y(null);return}let e=!1;return h($Z.LOADING),x.current(tQ(oa.PREVIEW_LINK),C()).then(t=>{e||(_(t),h($Z.READY))}).catch(t=>{e||(y(S.current(t)),h($Z.ERROR))}),()=>{e=!0}},[w,f,C]);let T=(0,Q.useCallback)(async()=>{if(!b.current){b.current=!0,h($Z.LINKING);try{await x.current(tQ(oa.COMPLETE_LINK),C()),h($Z.LINKED)}catch(e){b.current=!1,y(S.current(e)),h($Z.ERROR)}}},[C]),E=m===$Z.LINKED||m===$Z.READY&&g?.standing===gd.LINKED_TO_YOU,D=p.tell;(0,Q.useEffect)(()=>{E&&D(ix.SUCCEEDED)},[E,D]);let O=(e,t)=>p.hostServed?(0,$.jsx)(X,{variant:Y.OUTLINE,className:t,onClick:()=>{D(E?ix.SUCCEEDED:ix.FAILED,{repeat:!0}).then(e=>{e===0&&l(Cn.home)})},children:o(oi.CLOSE_HOST_WINDOW)}):(0,$.jsx)(X,{variant:Y.OUTLINE,className:t,onClick:()=>l(Cn.home),children:o(e)}),k=O(oi.BACK_TO_APP);if(!n){let e=cd({pathname:cr,search:`?${u.toString()}`});return(0,$.jsx)(og,{to:ai(Cn.login,e),replace:!0})}if(!i||m===$Z.LOADING||m===$Z.LINKING)return(0,$.jsxs)(`div`,{className:`py-region flex flex-col items-center gap-element`,children:[(0,$.jsx)(gb,{}),i&&(0,$.jsx)(Z,{children:o(m===$Z.LINKING?oi.LINKING:oi.LOADING)})]});if(m===$Z.ERROR||!g)return(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsx)(zY,{children:o(oi.ERROR_TITLE)}),(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:v??o(oi.ERROR_INCOMPLETE_LINK)})}),k]});if(m===$Z.LINKED)return(0,$.jsxs)(`div`,{className:`space-y-group text-center`,children:[(0,$.jsx)(zY,{children:o(oi.SUCCESS_TITLE)}),(0,$.jsx)(Z,{children:o(oi.SUCCESS_MESSAGE)}),k]});if(g.standing===gd.LINKED_TO_YOU)return(0,$.jsxs)(`div`,{className:`space-y-group text-center`,children:[(0,$.jsx)(zY,{children:o(oi.ALREADY_LINKED_TITLE)}),(0,$.jsx)(Z,{children:o(oi.ALREADY_LINKED)}),k]});if(g.standing===gd.LINKED_TO_ANOTHER_MEMBER)return(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsx)(zY,{children:o(oi.LINKED_TO_ANOTHER_TITLE)}),(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:o(oi.LINKED_TO_ANOTHER)})}),k]});let A=g.chatUserDisplayName&&g.workspaceDisplayName?o(oi.ACCOUNT_NAMED,{chatUser:g.chatUserDisplayName,workspace:g.workspaceDisplayName}):void 0,j=o(oi.ACCOUNT_IDS,{chatUserId:g.chatUserId,workspaceId:g.workspaceRef});return(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(zY,{children:o(oi.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:o(oi.INTRO)})]}),(0,$.jsxs)(`dl`,{className:`space-y-item-xs`,children:[(0,$.jsx)(`dt`,{children:(0,$.jsx)(Z,{className:`font-medium`,children:o(oi.ACCOUNT_LABEL)})}),(0,$.jsxs)(`dd`,{className:`space-y-item-xs`,children:[A!==void 0&&(0,$.jsx)(Z,{children:A}),(0,$.jsx)(Z,{className:`font-mono text-sm`,children:j})]})]}),(0,$.jsx)(UD,{variant:`warning`,children:(0,$.jsx)(GD,{children:o(oi.WARNING_NOT_YOURS)})}),(0,$.jsx)(Z,{className:`text-sm`,children:o(oi.EXPIRES_AT,{expiresAt:a(g.expiresAt)})}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[O(oi.CANCEL,`flex-1`),(0,$.jsx)(X,{variant:Y.DEFAULT,className:`flex-1`,onClick:T,children:o(oi.CONFIRM)})]})]})};function rQ({preset:e=q.DEFAULT,...t}){let n=G(eQ,`Auth_ChatIdentityLink`)(e);return(0,$.jsx)(n,{...t})}var yye=()=>(Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(AX,{useCardLayout:!0,children:(0,$.jsx)(rQ,{})})),iQ=e=>{let{tComponent:t,isReady:n}=K({component:J.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT}),r=vh(),i=e=>t(J.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT,e);return n?(0,$.jsxs)(`div`,{className:`text-center space-y-group py-section`,children:[(0,$.jsxs)(`div`,{className:`space-y-item-xs`,children:[(0,$.jsx)(zY,{children:i(fl.TITLE)}),(0,$.jsx)(Z,{className:`text-muted-foreground max-w-sm mx-auto`,children:i(fl.SUB_TITLE)})]}),(0,$.jsx)(X,{variant:Y.DEFAULT,className:`w-full`,onClick:()=>r(Cn.login),children:i(fl.RETURN_TO_SIGN_IN)})]}):(0,$.jsx)(`div`,{className:`flex justify-center py-section`,children:(0,$.jsx)(gb,{})})};function aQ({preset:e=q.DEFAULT,...t}){let n=G(J.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT,`Auth_OAuthLoggedOut`)(e);return(0,$.jsx)(n,{...t})}var bye=()=>(0,$.jsx)(AX,{useCardLayout:!0,children:(0,$.jsx)(aQ,{})}),oQ;(function(e){e.READY=`ready`,e.SUBMITTING=`submitting`,e.ERROR=`error`})(oQ||={});var sQ=e=>{let{tComponent:t,isReady:n}=K({component:J.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM}),[r]=bh(),[i,a]=(0,Q.useState)(oQ.READY),o=e=>t(J.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM,e),s=(0,Q.useMemo)(()=>r.get(`token`)??``,[r]),c=(0,Q.useRef)(!1),l=(0,Q.useCallback)(async()=>{if(s&&!c.current){c.current=!0,a(oQ.SUBMITTING);try{let{redirect_to:e}=await lc().oauthEndSessionConfirm(s);window.location.assign(e)}catch{c.current=!1,a(oQ.ERROR)}}},[s]),u=(0,Q.useCallback)(()=>{window.location.assign(Cn.home)},[]);return n?s?(0,$.jsxs)(`div`,{className:`text-center space-y-group py-section`,children:[(0,$.jsxs)(`div`,{className:`space-y-item-xs`,children:[(0,$.jsx)(zY,{children:o(Sn.TITLE)}),(0,$.jsx)(Z,{className:`text-muted-foreground max-w-sm mx-auto`,children:o(Sn.SUB_TITLE)})]}),i===oQ.ERROR&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:o(Sn.ERROR)})}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[(0,$.jsx)(X,{variant:Y.OUTLINE,className:`flex-1`,disabled:i===oQ.SUBMITTING,onClick:u,children:o(Sn.CANCEL)}),(0,$.jsx)(X,{variant:Y.DEFAULT,className:`flex-1`,disabled:i===oQ.SUBMITTING,onClick:l,children:o(Sn.CONFIRM)})]})]}):(0,$.jsx)(og,{to:Cn.oauthLoggedOut,replace:!0}):(0,$.jsx)(`div`,{className:`flex justify-center py-section`,children:(0,$.jsx)(gb,{})})};function cQ({preset:e=q.DEFAULT,...t}){let n=G(J.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM,`Auth_OAuthLogoutConfirm`)(e);return(0,$.jsx)(n,{...t})}var xye=()=>(Q.useEffect(()=>{let e=document.createElement(`meta`);return e.name=`referrer`,e.content=`no-referrer`,document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),(0,$.jsx)(AX,{useCardLayout:!0,children:(0,$.jsx)(cQ,{})})),lQ=(e,t)=>e.kind===$o.RELEASED?`${String(t)}:${e.release.identity.releaseId}@${String(e.release.identity.releaseVersion)}:${e.content.title}`:`${String(t)}:${e.content.title}`,Sye=({document:e,t,paneKey:n,onReachedEnd:r})=>{let i=(0,Q.useRef)(null),a=(0,Q.useCallback)(()=>{let e=i.current;e&&e.scrollTop+e.clientHeight>=e.scrollHeight-2&&r(n)},[r,n]);return(0,Q.useEffect)(a,[a,e]),(0,$.jsxs)(`div`,{ref:i,onScroll:a,tabIndex:0,lang:e.content.locale,role:`region`,"aria-label":e.content.title,className:U(`max-h-64 overflow-y-auto rounded-md border border-border bg-muted/30 p-element text-sm`,Jg(x_.FIELD)),children:[(0,$.jsx)(`h2`,{className:`font-medium`,children:e.content.title}),e.kind===$o.UNRELEASED_DRAFT&&(0,$.jsx)(Z,{role:`note`,className:`mt-element-sm text-xs font-medium`,children:t(To.TERMS_DRAFT_NOTICE)}),e.content.sections.map(e=>(0,$.jsxs)(`div`,{className:`mt-element flex flex-col gap-element-sm`,children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:e.title}),e.clauses.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-sm`,children:[(0,$.jsx)(Z,{className:`whitespace-pre-line text-muted-foreground`,children:e.bodyMarkdown}),e.standing===Tne.NOT_YET_ESTABLISHED&&(0,$.jsx)(Z,{role:`note`,className:`text-xs`,children:`${t(To.TERMS_CLAUSE_NOT_ESTABLISHED)} ${e.missingInformation??``}`.trim()})]},e.clauseRef))]},e.sectionRef))]})},uQ=({state:e,t,tComponent:n})=>{let{requiredReleases:r,acceptanceMode:i,requiredDocuments:a,servedDocuments:o,accepted:s,setAccepted:c,documentsRead:l,markDocumentRead:u}=e,d=a.map(e=>e.document).filter(e=>e!==void 0),f=a.map(e=>({release:e.release,routePath:Md(e.release.identity.document.documentRef),path:Mie(e.release),title:e.document?.content.title??Md(e.release.identity.document.documentRef)??``,locale:e.document?.content.locale??e.release.locale})).filter(e=>e.path!==void 0&&e.routePath!==void 0),p=new Set(f.map(e=>e.routePath)),m=o.map(e=>({document:e,path:Md(e.kind===$o.RELEASED?e.release.identity.document.documentRef:e.documentRef)})).filter(e=>e.path!==void 0&&!p.has(e.path)),h=d.length>0&&d.every((e,t)=>l.includes(lQ(e,t)));if(r.length===0)return null;let g=f.length>0&&(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-element-sm`,children:[m.map(({document:e,path:t})=>(0,$.jsx)(PX,{href:t,external:!0,target:`_blank`,rel:`noreferrer`,className:`text-sm`,lang:e.content.locale,children:n(J.PUBLIC_LAYOUTS_USER_REGISTER,To.TERMS_OPEN_DOCUMENT,{documentTitle:e.content.title})},t)),f.map(({release:e,path:t,title:r,locale:i})=>(0,$.jsx)(PX,{href:t,external:!0,target:`_blank`,rel:`noreferrer`,className:`text-sm`,lang:i,children:n(J.PUBLIC_LAYOUTS_USER_REGISTER,To.TERMS_OPEN_DOCUMENT,{documentTitle:r})},e.identity.releaseId))]});if(!zu(i))return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-sm`,children:[(0,$.jsx)(Z,{role:`note`,className:`text-sm text-muted-foreground`,children:t(To.TERMS_ACCEPTANCE_IMPLIED)}),g]});let _=a.every(e=>e.document!==void 0)&&a.length>0,v=Uee(i)&&_,y=v&&!h,b=(0,Q.useId)();return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element`,children:[v&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{id:b,className:`text-sm text-muted-foreground`,children:t(To.TERMS_READ_PROMPT)}),d.map((e,n)=>(0,$.jsx)(Sye,{document:e,t,paneKey:lQ(e,n),onReachedEnd:u},lQ(e,n)))]}),(0,$.jsxs)(`label`,{className:U(`flex items-start gap-element`,y?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(jI,{checked:s,"aria-disabled":y||void 0,"aria-describedby":v?b:void 0,onCheckedChange:e=>{y||c(e===!0)}}),(0,$.jsx)(Z,{className:`text-sm`,children:t(To.TERMS_ACCEPTANCE)})]}),(0,$.jsx)(Z,{"aria-live":`polite`,className:`sr-only`,children:v&&h?t(To.TERMS_READ_COMPLETE):``}),g]})},Cye=60,wye=[Al.PASSWORD,Al.MAGIC_LINK,Al.PASSKEY],dQ=Q.createContext({requiredReleases:[],acceptanceMode:Fa.EXPLICIT_CHECKBOX,requiredDocuments:[],servedDocuments:[],accepted:!1,setAccepted:()=>{},documentsRead:[],markDocumentRead:()=>{},method:Al.PASSWORD}),fQ=({t:e,tComponent:t})=>{let{method:n,...r}=Q.useContext(dQ);return(0,$.jsx)(uQ,{state:r,t:e,tComponent:t})},Tye=()=>{let e=dS(),{formState:t}=rw(),{tComponent:n,isReady:r}=K({component:J.PUBLIC_LAYOUTS_USER_REGISTER}),i=e=>n(J.PUBLIC_LAYOUTS_USER_REGISTER,e),a=e.passwordPolicy??PZ,{requiredReleases:o,acceptanceMode:s,accepted:c,method:l}=Q.useContext(dQ),u=l===Al.PASSWORD;if(!r)return null;let d=u?To.REGISTER_BUTTON:l===Al.PASSKEY?To.PASSKEY_SIGNUP_BUTTON:To.MAGIC_LINK_SIGNUP_BUTTON,f=u?To.REGISTERING:To.MAGIC_LINK_SIGNUP_SENDING;return(0,$.jsxs)(hA,{children:[(0,$.jsx)(nR,{name:`email`}),(0,$.jsx)(nR,{name:`firstName`}),(0,$.jsx)(nR,{name:`lastName`}),(0,$.jsx)(nR,{name:`organizationName`}),(e.registrationConfig.additionalProfileQuestions??[]).map(e=>(0,$.jsx)(nR,{name:e.id},e.id)),(0,$.jsx)(nR,{name:`password`}),(0,$.jsx)(nR,{name:`confirmPassword`}),u&&(0,$.jsx)(FZ,{fieldName:`password`,policy:a,t:i}),t.errors.root&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:t.errors.root.message})}),(0,$.jsx)(fQ,{t:i,tComponent:n}),(0,$.jsx)(hO,{label:i(d),submittingLabel:i(f),fullWidth:!0,disabled:o.length>0&&zu(s)&&!c})]})},pQ=({})=>{let{auth:e,initiateOAuth2Login:t}=Cg(),{registerAccount:n}=Dm(),r=bp(),{appConfig:i}=_u(),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)([]),l=(0,Q.useCallback)(e=>{c(t=>t.includes(e)?t:[...t,e])},[]),[u,d]=(0,Q.useState)(null),f=i.compliance?.governedDocumentAcceptanceMode??Fa.EXPLICIT_CHECKBOX,p=Vn(i.compliance),m=(0,Q.useMemo)(()=>(u===null?Tte(i.compliance?.governedDocumentReleases??[],new Date().toISOString(),{requireApproved:p}):(i.compliance?.governedDocumentReleases??[]).filter(e=>u.some(t=>t.releaseId===e.identity.releaseId&&t.releaseVersion===e.identity.releaseVersion))).filter(e=>e.allowedInteractionKinds.includes(Oo.CONTRACT_ACCEPTED)),[i.compliance?.governedDocumentReleases,p,u]),h=(0,Q.useMemo)(()=>m.map(e=>({release:e,document:ml(i.compliance?.publicDocuments??[],e,{requireApproved:p})})),[m,i.compliance?.publicDocuments,p]),g=(0,Q.useMemo)(()=>i.compliance?.publicDocuments??[],[i.compliance?.publicDocuments]),_=(0,Q.useMemo)(()=>({requiredReleases:m,acceptanceMode:f,requiredDocuments:h,servedDocuments:g,accepted:a,setAccepted:o,documentsRead:s,markDocumentRead:l,method:Al.EXTERNAL_OAUTH2}),[m,f,h,g,a,s,l]),v=m.length>0&&zu(f)&&!a,y=(0,Q.useMemo)(()=>m.length===0||zu(f)&&!a?[]:m.map(e=>({releaseId:e.identity.releaseId,releaseVersion:e.identity.releaseVersion})),[m,f,a]),b=(0,Q.useCallback)(e=>{if(!Er(e)||e.customMessageReference!==ii.GOVERNED_DOCUMENT_RELEASE_SUPERSEDED)return!1;let t=e.context?.inForceReleases,n=Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&typeof e.releaseId==`string`&&typeof e.releaseVersion==`number`):[],r=i.compliance?.governedDocumentReleases??[];return n.every(e=>r.some(t=>t.identity.releaseId===e.releaseId&&t.identity.releaseVersion===e.releaseVersion))?(d(n),o(!1),c([]),!0):(window.location.reload(),!0)},[i.compliance?.governedDocumentReleases]),x=dS(),S=wg(),C=(0,Q.useMemo)(()=>x.registrationConfig.allowedMethods.includes(Al.EXTERNAL_OAUTH2)?YX({publicProviders:x.globalAuth?.socialOAuth2Providers}):[],[x.globalAuth?.socialOAuth2Providers,x.registrationConfig.allowedMethods]),w=(0,Q.useMemo)(()=>Tb(C.map(e=>e.displayNameLabelKey)),[C]),T=(0,Q.useMemo)(()=>[J.PUBLIC_LAYOUTS_USER_REGISTER,J.PUBLIC_LAYOUTS_USER_AUTH],[]),{t:E,tComponent:D,isReady:O}=K({component:T,keys:w}),k=e=>D(J.PUBLIC_LAYOUTS_USER_REGISTER,e),A=e=>D(J.PUBLIC_LAYOUTS_USER_AUTH,e),j=(0,Q.useMemo)(()=>R(S.search),[S.search]),M=(0,Q.useMemo)(()=>new URLSearchParams(S.search).get(`email`)?.trim()??``,[S.search]),N=(0,Q.useMemo)(()=>ai(Cn.login,j),[j]),P=(0,Q.useMemo)(()=>Vt(S.search),[S.search]),F=C.length>0,I=(0,Q.useCallback)(async e=>{try{await t(e,j,y)}catch(e){b(e)}},[y,j,t,b]),ee=(0,Q.useRef)(null),{initAutoClearing:L,injectServerErrors:te,clearServerErrors:z}=rz(ee),B=(0,Q.useCallback)(e=>{ee.current=e,L(e)},[L]),[ne,re]=(0,Q.useState)(!1),[ie,ae]=(0,Q.useState)(null),[oe,se]=(0,Q.useState)(``);zX({mfaRequired:ie===Gp.MFA_ENROLLMENT_REQUIRED&&e.mfaRequired,mfaSessionId:e.mfaSessionId,usableSecondFactorMethods:e.usableSecondFactorMethods,email:oe,authRedirectTarget:j});let[ce,le]=(0,Q.useState)(`idle`),[ue,de]=(0,Q.useState)(0),[fe,pe]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(ue<=0)return;let e=setInterval(()=>{de(t=>t<=1?(clearInterval(e),0):t-1)},1e3);return()=>clearInterval(e)},[ue]);let me=(0,Q.useCallback)(async()=>{if(!(!oe||ue>0)){le(`sending`),pe(null);try{await lc().resendVerificationEmail(oe),le(`sent`),de(Cye)}catch(e){le(`error`),pe(r(e,k(To.UNEXPECTED_ERROR)))}}},[oe,ue]),he=(0,Q.useMemo)(()=>x.passwordPolicy??PZ,[x.passwordPolicy]),ge=(0,Q.useMemo)(()=>{if(!x.resolvedUserType)return!1;let e=Dne(i.organizationTypes,x.resolvedUserType);return e.length===1&&e[0]?.definition.creationPolicy?.orgNameSource===ene.ASK},[i.organizationTypes,x.resolvedUserType]),_e=(0,Q.useMemo)(()=>x.registrationConfig,[x.registrationConfig]).allowedMethods,ve=(0,Q.useMemo)(()=>wye.filter(e=>_e.includes(e)),[_e]),[ye,be]=(0,Q.useState)(null),xe=ye!==null&&ve.includes(ye)?ye:ve[0]??null,Se=ve.filter(e=>e!==xe),Ce=xe!==null,we=Ce&&xe!==null,Te=xe===Al.PASSWORD,Ee=F&&Ce,De=x.registrationConfig.additionalProfileQuestions??[],Oe=x.registrationConfig.profileNamesCollectedAt!==$c.ONBOARDING,ke=(0,Q.useMemo)(()=>{let e={};for(let t of De){let n=t.type===Uu.RATING?Fd():kd().min(1);e[t.id]=t.required?n:n.optional()}let t=Yre.extend(e),n=Oe?t:t.omit({firstName:!0,lastName:!0}),r=ge?n:n.omit({organizationName:!0});return Te?r.refine(e=>!e.password||e.password===e.confirmPassword,{message:k(To.PASSWORD_MISMATCH),path:[`confirmPassword`]}):r.omit({password:!0,confirmPassword:!0})},[k,ge,Te,De,Oe]),Ae=Xp(e,j);if(Ae)return(0,$.jsx)(og,{to:Ae,replace:!0});if(!O)return null;if(ie===Gp.SIGNED_IN)return e.accessToken?(0,$.jsx)(og,{to:P,replace:!0}):null;if(ie===Gp.MFA_ENROLLMENT_REQUIRED)return null;if(ie!==null){let e=ie===Gp.SSO_REDIRECT_REQUIRED,t=e?To.SSO_REGISTRATION_TITLE:To.SUCCESS_TITLE,n=e?To.SSO_REGISTRATION_MESSAGE:ie===Gp.UNFINISHED?To.REGISTRATION_UNFINISHED:ie===Gp.MAGIC_LINK_SENT?To.MAGIC_LINK_SENT_MESSAGE:ie===Gp.PASSKEY_ENROLLMENT_PENDING?To.PASSKEY_ENROLLMENT_PENDING_MESSAGE:To.SUCCESS_MESSAGE,r=ie===Gp.EMAIL_VERIFICATION_PENDING;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mb-element`,children:(0,$.jsx)(`svg`,{className:`h-6 w-6 text-primary`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:`2`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z`})})}),(0,$.jsx)(zY,{children:k(t)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:k(n)})]}),r&&(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsxs)(Z,{className:`text-sm text-muted-foreground`,children:[k(To.RESEND_PROMPT),` `,(0,$.jsx)(X,{variant:Y.LINK,className:`p-0 h-auto text-sm`,onClick:me,disabled:ce===`sending`||ue>0,children:ce===`sending`?k(To.RESEND_SENDING):ue>0?`${k(To.RESEND_COOLDOWN)} (${ue}s)`:k(To.RESEND_LINK)})]}),ce===`sent`&&(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:k(To.RESEND_SUCCESS)})}),ce===`error`&&fe&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:fe})})]}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(FX,{href:N,children:k(To.SIGNIN_LINK)})})]})}let je=async e=>{re(!0),ee.current?.clearErrors(`root`),z();let t=xe??Al.PASSWORD;if(t===Al.PASSWORD&&e.password){let t=ho.validatePasswordAgainstPolicy(e.password,he);if(!t.valid){ee.current?.setError(`root`,{type:`policy`,message:LZ(t.violations,k,he).join(`. `)}),re(!1);return}}try{let r=await n({email:e.email,...Oe?{firstName:e.firstName,lastName:e.lastName}:{},password:t===Al.PASSWORD&&e.password?.trim()||void 0,organizationName:e.organizationName?.trim()||void 0,profileAnswers:De.length>0?Object.fromEntries(De.map(t=>[t.id,e[t.id]]).filter(([,e])=>e!==void 0&&e!==``)):void 0,method:t,...j?{redirect:j}:{},...y.length>0?{acceptedGovernedDocumentReleases:y}:{}});se(e.email),ae(r)}catch(e){b(e);let t=LM(e);if(t)te(t.validationErrors);else{let t=RZ(e,k,he);ee.current?.setError(`root`,{type:`server`,message:t??r(e,k(To.UNEXPECTED_ERROR))})}}finally{re(!1)}};return!F&&!Ce?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(zY,{children:k(To.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:k(To.REGISTRATION_DISABLED)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(FX,{href:N,children:k(To.SIGNIN_LINK)})})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(zY,{children:k(To.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:k(To.SUB_TITLE)})]}),C.length>0&&m.length>0&&!we&&(0,$.jsx)(dQ.Provider,{value:_,children:(0,$.jsx)(fQ,{t:k,tComponent:D})}),(0,$.jsx)(QX,{providers:C,onProviderClick:I,isLoading:ne||e.isLoading,disabled:v,continueWithLabel:k(To.CONTINUE_WITH),translate:E,dividerLabel:k(To.DIVIDER_OR),showDivider:Ee}),Ce&&xe!==null&&(0,$.jsx)(dQ.Provider,{value:{requiredReleases:m,acceptanceMode:f,requiredDocuments:h,servedDocuments:g,accepted:a,setAccepted:o,documentsRead:s,markDocumentRead:l,method:xe},children:(0,$.jsx)(gE,{schema:ke,defaultValues:{email:M,...Oe&&{firstName:``,lastName:``},...ge&&{organizationName:``},...Te&&{password:``,confirmPassword:``}},onSubmit:je,onFormReady:B,validationMode:pr.ON_BLUR,disabled:ne,layoutTemplate:Tye,labels:{fields:{email:k(To.EMAIL_ADDRESS),...Oe&&{firstName:k(To.FIRST_NAME),lastName:k(To.LAST_NAME)},...ge&&{organizationName:k(To.ORGANIZATION_NAME)},...Te&&{password:k(To.PASSWORD),confirmPassword:k(To.CONFIRM_PASSWORD)}}}},xe)}),Se.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(qX,{label:A(xl.OTHER_METHODS_DIVIDER)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center mb-element`,children:k(To.METHOD_CHOICE_HINT)}),(0,$.jsx)(rZ,{methods:Se,labelFor:e=>UX(e,{socialProviders:C,continueWithTemplate:A(xl.CONTINUE_WITH),translateLabel:e=>A(e),resolveSocialProviderLabel:e=>JX({providerRef:e.providerRef,displayName:e.displayName,displayNameLabelKey:e.displayNameLabelKey,brandLabel:XX[e.providerRef]?.label,translate:E})}),onSelect:be,disabled:ne})]}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsxs)(Z,{className:`text-sm`,children:[k(To.ALREADY_HAVE_ACCOUNT),` `,(0,$.jsx)(PX,{href:N,children:k(To.SIGNIN_LINK)})]})})]})};function Eye({mode:e}){let t=wg(),{tComponent:n,isReady:r}=K({component:J.PUBLIC_LAYOUTS_USER_REGISTER}),i=(0,Q.useMemo)(()=>R(t.search),[t.search]),a=(0,Q.useMemo)(()=>ai(Cn.login,i),[i]);if(!r)return null;let o=e===Sc.INVITATION_ONLY?To.INVITATION_ONLY:e===Sc.ADMIN_ONLY?To.ADMIN_ONLY:To.REGISTRATION_DISABLED,s=e=>n(J.PUBLIC_LAYOUTS_USER_REGISTER,e);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(zY,{children:s(To.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(o)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(FX,{href:a,children:s(To.SIGNIN_LINK)})})]})}function mQ({preset:e=q.DEFAULT,...t}){let{auth:n}=Cg(),r=dS(),i=wg(),a=(0,Q.useMemo)(()=>Vt(i.search),[i.search]);if(n.accessToken)return(0,$.jsx)(og,{to:a,replace:!0});if(!r.registrationConfig.publicRegistrationAvailable)return(0,$.jsx)(Eye,{mode:r.registrationConfig.mode});let o=G(J.PUBLIC_LAYOUTS_USER_REGISTER,`Auth_Register`)(e);return(0,$.jsx)(o,{...t})}var Dye=()=>(0,$.jsx)(AX,{useCardLayout:!0,children:(0,$.jsx)(mQ,{})});function hQ({preset:e=q.DEFAULT,...t}){let n=G(J.PUBLIC_LAYOUTS_TERMS,`PublicLayout_Terms`)(e);return(0,$.jsx)(n,{...t})}function gQ({preset:e=q.DEFAULT,...t}){let n=G(J.PUBLIC_LAYOUTS_LEGAL_NOTICE,`PublicLayout_LegalNotice`)(e);return(0,$.jsx)(n,{...t})}function Oye(){let{on:e}=vo(),{navigate:t}=zS(),{registry:n}=wm(),r=vh();return(0,Q.useEffect)(()=>e(hc.NAVIGATION_REQUEST,e=>{let i;e.operationRef?i=Ch.resolveOperationRef(e.operationRef,e.operationRefContextIdentifiers,n):e.content&&(i=e.content),i?t({content:i,initiator:e.initiator,urlPath:e.urlPath,replaceBrowserHistory:e.replaceBrowserHistory}):!e.operationRef&&e.urlPath&&r(e.urlPath,e.replaceBrowserHistory?{replace:!0}:void 0)}),[t,e,n,r]),null}function _Q(e){let t=(0,Q.useSyncExternalStore)(Ch.subscribeToTransactionState,Ch.getTransactionEpoch,Ch.getTransactionEpoch),n=(0,Q.useCallback)(()=>void 0,[]);return{retryTick:t,scheduleRetry:n,clearRetry:n}}function vQ(){let e=wg(),t=(0,Q.useContext)(Ph)?.router,n=(0,Q.useCallback)(e=>t?t.subscribe(()=>e()):()=>void 0,[t]),r=(0,Q.useCallback)(()=>t?.state.location??e,[t,e]);return(0,Q.useSyncExternalStore)(n,r,r)}function yQ(e){let t=vQ();return t.pathname!==e.pathname||t.search!==e.search}function kye(e,t,n){let r=wg(),i=yQ(r),a=Xm(),{registry:o}=wm(),{emit:s}=vo(),{getZoneState:c,contentAreaWidth:l}=Zx(),u=lm(),d=TS(),{navigationLayout:f,currentBreakpoint:p}=e_(),m=(0,Q.useMemo)(()=>Ch.buildBrowserUrl(r.pathname,r.search),[r.pathname,r.search]),h=(0,Q.useMemo)(()=>u?.buildContextResourceIdentifiers?.()??{},[u]),g=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(h),[h]),_=(0,Q.useRef)(null),{retryTick:v,scheduleRetry:y,clearRetry:b}=_Q(m),x=(0,Q.useMemo)(()=>{if(!e||!t)return[];let n=o.resourceConfigurations?.[e];return n?It.buildOperationFrontendRoutePaths(n,t,o.allResourceFieldIdentifiers).map(e=>e.url):[]},[e,t,o]);(0,Q.useEffect)(()=>{if(!e||!t)return;if(rS(`useRouterSync: effect fired`,{resourceType:e,operationId:t.operationIdentifier,locationPathname:r.pathname,lastSyncedPath:_.current,routePatternsCount:x.length}),Ch.isInTransaction()){rS(`useRouterSync: SKIP — navigation transaction active`,{source:Ch.getTransactionSource()}),y();return}if(b(),i){rS(`useRouterSync: SKIP — the router is ahead of the committed location`,{committedUrl:m});return}if(_.current===m){rS(`useRouterSync: SKIP — already synced this path`,{currentBrowserUrl:m});return}if(x.length>0&&!x.some(e=>Ch.matchUrlPattern(e,r.pathname))){rS(`useRouterSync: SKIP — URL does not match any resource route pattern`,{pathname:r.pathname,patterns:x}),_.current=m;return}let g=o.resourceConfigurations?.[e]?.resourcePrimaryScope,v=n?gn.buildParentResourcesRequirementsFromRouteParams(n,e,o):[],S=f?.zones,C=!!S?.secondary,w=!!S?.companion,T=Ch.calculateResourceRelationshipDepth(v),E=T===0&&C&&t!==void 0&&Ch.layoutSplitsOperationFromPrimary(f,t,p),D=Ch.resolveResourceTargetZone(T,{hasSecondary:C,hasCompanion:w,prefersAdjacentZoneForDetail:E}),O=eg({zone:D,layout:f,viewport:p,contentAreaWidth:l})?D:li.PRIMARY;O!==D&&rS(`useRouterSync: adjacent zone is collapsed at this viewport — restoring into PRIMARY`,{preferredZone:D,viewport:p,contentAreaWidth:l});let k=Ch.zoneOwnsBrowserUrl(O,m,c);if(rS(`useRouterSync: checking guards`,{currentBrowserUrl:m,targetZone:O,targetZoneOwnsUrl:k,targetZoneTopUrlPath:Ch.getTopEntry(c(O))?.urlPath}),k){rS(`useRouterSync: SKIP — target zone already owns current URL`,{targetZone:O}),_.current=m;return}let A=Ch.findStructuralRouteOwner(m,c);if(A&&A.zone!==O){rS(`useRouterSync: SKIP — another structural zone already shows this destination`,{owningZone:A.zone,targetZone:O,currentBrowserUrl:m}),_.current=m;return}let j=gn.extractResourceIdentifiersFromUrlParams(a,o,n),M=pm.buildResourceOperationContextIdentifiers({currentUserId:u?.currentUserId,currentOrganizationId:u?.currentOrganizationId,currentApplicationId:u?.currentApplicationId,currentAnonymousUserId:u?.currentAnonymousUserId,primaryScope:g,liveAppScopeContextResourceIdentifiers:h,explicitContextResourceIdentifiers:j}),N=gn.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:t,contextResourceIdentifiers:M,parentResourcesRequirements:v}),P={contentType:hd.RESOURCE_OPERATION,resourceContext:N},F=Ch.generateStackEntryId();rS(`useRouterSync: EMITTING NAVIGATION_REPLACE (URL_SYNC)`,{resourceType:e,operationId:t.operationIdentifier,currentBrowserUrl:m,mergedContextIdentifiers:M,depth:T,targetZone:O}),T>=1&&Ch.beginTransaction(`url_reverse_cascade`);let I=O!==D,ee=tle({content:P,paneZone:D,placedZone:O,layout:f,registry:o,viewport:p,contentAreaWidth:l});if(I&&E&&D===li.SECONDARY&&cS({resourceType:e,contextResourceIdentifiers:M,parentResourcesRequirements:v,registry:o,emit:s,getZoneState:c}),s(I?hc.NAVIGATION_PUSH:hc.NAVIGATION_REPLACE,{zone:O,content:P,urlPath:m,stackEntryId:F,initiator:{sourceZone:O},navigationSource:Zi.URL_SYNC,transition:ln.REPLACE,...I?{collapsedFromZone:D}:{},...ee?{persistent:!0}:{}}),E&&O===li.SECONDARY&&cS({resourceType:e,contextResourceIdentifiers:M,parentResourcesRequirements:v,registry:o,emit:s,getZoneState:c}),T>=1){let e=ju(M);uS(P,O,o,e,s,null,c,{overwriteExisting:!0,viewerMayPerform:d})}_.current=m},[r.pathname,r.search,i,a,e,t,o,s,c,u?.currentUserId,u?.currentOrganizationId,u?.currentApplicationId,u?.currentAnonymousUserId,g,n,x,f,p,m,v,y,b])}function bQ(e,t){let n=wg(),r=yQ(n),{emit:i}=vo(),{getZoneState:a}=Zx(),{registry:o}=wm(),{fullCustomViews:s,flowsActorsViews:c}=e_(),l=(0,Q.useRef)(null),u=Ch.buildBrowserUrl(n.pathname,n.search),{retryTick:d,scheduleRetry:f,clearRetry:p}=_Q(u);(0,Q.useEffect)(()=>{if(!e)return;if(Ch.isInTransaction()){f();return}if(p(),r||l.current===u)return;if(Ch.zoneOwnsBrowserUrl(li.PRIMARY,u,a)){l.current=u;return}let d,m=t===hd.COMPOSITE_VIEW?Kp(new URLSearchParams(n.search)):void 0,h=t===hd.CHART_VIEW?rm(new URLSearchParams(n.search)):void 0,g=t===hd.CHART_VIEW?tm(new URLSearchParams(n.search)):void 0,_=t===hd.EXECUTION_VIEW?xm(new URLSearchParams(n.search)):void 0,v=t===hd.FULL_CUSTOM_VIEW?s?.find(t=>t.ref===e):void 0,y=t===hd.FLOWS_ACTORS_VIEW?c?.find(t=>t.ref===e):void 0,b=t===hd.EXECUTION_VIEW?zp({viewRef:e,registry:o}):void 0;switch(t){case hd.COMPOSITE_VIEW:d={contentType:hd.COMPOSITE_VIEW,viewRef:e,contextResourceIdentifiers:m};break;case hd.CHART_VIEW:d={contentType:hd.CHART_VIEW,viewRef:e,contextResourceIdentifiers:h,urlParamValues:g};break;case hd.FULL_CUSTOM_VIEW:if(!v)return;d={contentType:hd.FULL_CUSTOM_VIEW,viewRef:e,fullCustomComponentRef:v.componentRef};break;case hd.FLOWS_ACTORS_VIEW:if(!y)return;d={contentType:hd.FLOWS_ACTORS_VIEW,viewRef:e,flowsActorsSystemRef:y.systemRef};break;case hd.EXECUTION_VIEW:if(!b||b.isAddressable!==!0)return;d={contentType:hd.EXECUTION_VIEW,viewRef:e,contextResourceIdentifiers:_};break;default:return}let x=Ch.generateStackEntryId();rS(`useViewRouterSync: EMITTING NAVIGATION_REPLACE (URL_SYNC)`,{viewRef:e,contentType:t,locationPathname:n.pathname,locationSearch:n.search}),i(hc.NAVIGATION_REPLACE,{zone:li.PRIMARY,content:d,urlPath:Ch.decomposeHostedPaneBrowserUrl(u).hostUrl,stackEntryId:x,initiator:{sourceZone:li.PRIMARY},navigationSource:Zi.URL_SYNC,transition:ln.REPLACE}),l.current=u},[e,t,i,a,s,c,o,u,r,d,f,p])}function Aye(e){let t=wg(),n=yQ(t),{emit:r}=vo(),{getZoneState:i}=Zx(),a=(0,Q.useRef)(null),o=Ch.buildBrowserUrl(t.pathname,t.search),{retryTick:s,scheduleRetry:c,clearRetry:l}=_Q(o);(0,Q.useEffect)(()=>{if(!e)return;if(Ch.isInTransaction()){c();return}if(l(),n||a.current===o)return;if(Ch.zoneOwnsBrowserUrl(li.PRIMARY,o,i)){a.current=o;return}let t=Ch.generateStackEntryId();r(hc.NAVIGATION_REPLACE,{zone:li.PRIMARY,content:{contentType:hd.ENGINE_PAGE,pageRef:e},urlPath:Ch.decomposeHostedPaneBrowserUrl(o).hostUrl,stackEntryId:t,initiator:{sourceZone:li.PRIMARY},navigationSource:Zi.URL_SYNC,transition:ln.REPLACE}),a.current=o},[e,r,i,o,n,s,c,l])}function jye(){let e=vQ(),{emit:t}=vo(),{getZoneState:n}=Zx(),r=(0,Q.useRef)(null),i=Ch.buildBrowserUrl(e.pathname,e.search),{retryTick:a,scheduleRetry:o,clearRetry:s}=_Q(i);(0,Q.useEffect)(()=>{if(Ch.isInTransaction()){o();return}if(s(),r.current===i)return;if(xQ(e.pathname).isSettings){r.current=i;return}let a=Ch.findStructuralStackEntryOwningUrl(i,n);if(a?.isTop){if(a.searchDiffers){let{hostUrl:e,paneUrl:r}=Ch.decomposeHostedPaneBrowserUrl(i),o=r===void 0?[{zone:a.zone,entry:a.entry,urlPath:i}]:[{zone:li.PRIMARY,entry:Ch.getTopEntry(n(li.PRIMARY)),urlPath:e},{zone:li.SECONDARY,entry:a.entry,urlPath:r}];for(let e of o)e.entry&&e.entry.urlPath!==e.urlPath&&(rS(`useStructuralZoneBackForwardSync: refreshing entry urlPath for a view-state change`,{zone:e.zone,stackEntryId:e.entry.id,from:e.entry.urlPath,to:e.urlPath}),t(hc.NAVIGATION_URL_PATH_UPDATED,{zone:e.zone,stackEntryId:e.entry.id,urlPath:e.urlPath}))}r.current=i}else if(a)rS(`useStructuralZoneBackForwardSync: POP to backstack entry`,{zone:a.zone,toStackEntryId:a.entry.id,currentUrl:i}),t(hc.NAVIGATION_POP,{zone:a.zone,toStackEntryId:a.entry.id}),r.current=i;else{if(or.some(e=>n(e).stack.length>0)){rS(`useStructuralZoneBackForwardSync: clearing structural zones for URL rebuild`,{currentUrl:i}),Ch.beginTransaction(`backforward_url_rebuild`);for(let e of or)t(hc.NAVIGATION_CLEAR_ZONE,{zone:e})}r.current=i}},[i,e.pathname,t,n,a,o,s])}function Mye(){let e=vQ(),{emit:t}=vo(),{getZoneState:n}=Zx(),{registry:r}=wm(),i=lm(),a=(0,Q.useRef)(null),o=Ch.buildBrowserUrl(e.pathname,e.search),{retryTick:s,scheduleRetry:c,clearRetry:l}=_Q(o),u=(0,Q.useMemo)(()=>i?.buildContextResourceIdentifiers?.()??{},[i]);(0,Q.useEffect)(()=>{if(Ch.isInTransaction()){c();return}if(l(),a.current===o)return;if(xQ(e.pathname).isSettings){a.current=o;return}let{paneUrl:s}=Ch.decomposeHostedPaneBrowserUrl(o),d=n(li.SECONDARY),f=Ch.getTopEntry(d);if(s===void 0){f?.hostedPane&&(rS(`useHostedPaneRouteSync: pane left the URL — clearing SECONDARY`,{currentUrl:o}),t(hc.NAVIGATION_CLEAR_ZONE,{zone:li.SECONDARY})),a.current=o;return}if(f?.hostedPane&&Ch.urlsAddressSameDestination(f.urlPath,s)){a.current=o;return}let p=Ch.getTopEntry(n(li.PRIMARY));if(Ch.isHeldHostedPane(p)&&Ch.urlsAddressSameDestination(p?.urlPath,s)){a.current=o;return}let m=[...d.stack].reverse().find(e=>e.hostedPane&&Ch.urlsAddressSameDestination(e.urlPath,s));if(m){rS(`useHostedPaneRouteSync: POP to a buried pane`,{toStackEntryId:m.id,paneUrl:s}),t(hc.NAVIGATION_POP,{zone:li.SECONDARY,toStackEntryId:m.id}),a.current=o;return}let h=Ch.resolveResourceRouteForUrl(s,r);if(!h){rS(`useHostedPaneRouteSync: pane URL matches no addressable resource route — ignored`,{paneUrl:s}),a.current=o;return}let g=gn.buildParentResourcesRequirementsFromRouteParams(h.routePathParameters,h.resourceType,r),_=gn.extractResourceIdentifiersFromUrlParams(h.urlParameters,r,h.routePathParameters),v=r.resourceConfigurations?.[h.resourceType]?.resourcePrimaryScope,y=pm.buildResourceOperationContextIdentifiers({currentUserId:i?.currentUserId,currentOrganizationId:i?.currentOrganizationId,currentApplicationId:i?.currentApplicationId,currentAnonymousUserId:i?.currentAnonymousUserId,primaryScope:v,liveAppScopeContextResourceIdentifiers:u,explicitContextResourceIdentifiers:_}),b=gn.createFrontendResourceOperationContextFromOperation({resourceType:h.resourceType,operation:h.operation,contextResourceIdentifiers:y,parentResourcesRequirements:g});rS(`useHostedPaneRouteSync: EMITTING NAVIGATION_REPLACE (URL_SYNC) for the hosted pane`,{paneUrl:s,resourceType:h.resourceType,operationId:h.operation.operationIdentifier}),t(hc.NAVIGATION_REPLACE,{zone:li.SECONDARY,content:{contentType:hd.RESOURCE_OPERATION,resourceContext:b},urlPath:s,stackEntryId:Ch.generateStackEntryId(),initiator:{sourceZone:li.PRIMARY},navigationSource:Zi.URL_SYNC,transition:ln.SPLIT,hostedPane:!0}),a.current=o},[o,e.pathname,t,n,r,i?.currentUserId,i?.currentOrganizationId,i?.currentApplicationId,i?.currentAnonymousUserId,u,s,c,l])}function xQ(e){if(e===Cn.settings)return{isSettings:!0};let t=`${Cn.settings}/`;if(e.startsWith(t)){let[n,r]=e.slice(t.length).split(`/`);return{isSettings:!0,sectionRef:n&&n.length>0?n:void 0,subTabRef:r&&r.length>0?r:void 0}}return{isSettings:!1}}function Nye(){let e=vQ(),{emit:t}=vo(),{state:n}=Zx(),{retryTick:r,scheduleRetry:i,clearRetry:a}=_Q(e.pathname),o=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(Ch.isInTransaction()){i();return}a();let{isSettings:r,sectionRef:s,subTabRef:c}=xQ(e.pathname),l=n.overlay,u=l.length>0?l[l.length-1]:void 0,d=!1,f,p;if(u&&u.content.contentType===hd.SETTINGS_HUB&&(d=!0,f=u.content.sectionRef,p=u.content.subTabRef),r){if(d&&f===s&&p===c){o.current=null;return}let n=d?hc.NAVIGATION_REPLACE:hc.NAVIGATION_PUSH,r=`${n}|${e.pathname}|${s??``}|${c??``}|${l.length}`;if(o.current===r)return;o.current=r,t(n,{zone:qn.OVERLAY,content:{contentType:hd.SETTINGS_HUB,sectionRef:s,subTabRef:c},urlPath:Ch.buildBrowserUrl(e.pathname,e.search),stackEntryId:Ch.generateStackEntryId(),initiator:{sourceZone:qn.OVERLAY},navigationSource:Zi.URL_SYNC,transition:ln.OVERLAY,appearance:pd.DIALOG,ephemeral:!1})}else if(d){let e=`${hc.NAVIGATION_CLOSE}|${l.length}`;if(o.current===e)return;o.current=e,t(hc.NAVIGATION_CLOSE,{zone:qn.OVERLAY})}else o.current=null},[e.pathname,e.search,t,n.overlay,r,i,a])}var SQ=({viewRef:e,viewDefinition:t,contextResourceIdentifiers:n,navigationZone:r=qn.PRIMARY})=>{let{fullCustomViews:i}=e_(),a=lm(),o=t??(e?i?.find(t=>t.ref===e):void 0);(0,Q.useEffect)(()=>{},[n,o,e]);let s=(0,Q.useMemo)(()=>{let e=pm.buildInitiatorIds({userId:a?.currentUserId,organizationId:a?.currentOrganizationId,applicationId:a?.currentApplicationId,anonymousUserId:a?.currentAnonymousUserId}),t=o?.primaryScope?pm.primaryScopeToContextIdentifiers(e,o.primaryScope):{},r=a?.buildContextResourceIdentifiers()??{},i=pm.filterCustomScopeContextResourceIdentifiers(r);return o?pm.resolveViewContextResourceIdentifiers({surfaceName:`FullCustomView`,surfaceRef:o.ref,primaryScope:o.primaryScope,parentResourcesRequirements:o.parentResourcesRequirements,additionalResourceRequirements:o.additionalResourceRequirements,primaryScopeContext:t,customScopeContext:i,explicitContextResourceIdentifiers:n}):pm.mergeContextResourceIdentifiers(t,i,n)},[n,o?.primaryScope,o?.ref,o?.parentResourcesRequirements,o?.additionalResourceRequirements,a?.currentUserId,a?.currentOrganizationId,a?.currentApplicationId,a?.currentAnonymousUserId,a]);if(!o)return(0,$.jsx)(E_,{viewKind:`full-custom`,viewRef:e});let c=wo.resolve(o.componentRef,q.DEFAULT);return c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(mX,{viewRef:o.ref,contentType:hd.FULL_CUSTOM_VIEW,hasAuthoredIcon:!!o.icon,navigationZone:r,className:`mb-group`}),(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{className:`h-8 animate-pulse motion-reduce:animate-none bg-muted rounded`,"aria-hidden":`true`}),children:(0,$.jsx)(c,{viewRef:o.ref,viewDefinition:o,contextResourceIdentifiers:s})})]}):(0,$.jsx)(Yc,{componentType:o.componentRef,componentName:o.componentRef})},CQ;(function(e){e.TURN=`turn`,e.TOOL=`tool`,e.REASONING=`reasoning`,e.HOST=`host`})(CQ||={});var wQ;(function(e){e.IDLE=`idle`,e.WORKING=`working`,e.ANSWERING=`answering`,e.AWAITING_DECISION=`awaiting_decision`,e.STOPPED=`stopped`,e.FAILED=`failed`,e.INTERRUPTED=`interrupted`})(wQ||={});function TQ(e,t){return[...e??[],t]}function Pye(e,t){if(!e||e.length===0)return[];let n=-1;return e.forEach((e,r)=>{t.has(e.id)&&(n=r)}),e.slice(n+1)}var EQ=new Set([hu.TEXT,hu.MARKDOWN]);function DQ(e){if(e==null)return 1/0;let t=new Date(e).getTime();return Number.isNaN(t)?1/0:t}function Fye(e){if(e.role===to.TOOL){let t=qu.safeParse(e.data);return t.success?{kind:CQ.TOOL,key:`tool:${t.data.toolCallId}`,trace:t.data,fromRecordOnly:!0}:null}if(e.role!==to.USER&&e.role!==to.ASSISTANT)return null;if(e.contentType===hu.REASONING)return{kind:CQ.REASONING,key:`reasoning:${e.id}`,content:e.content};if(e.contentType!==void 0&&!EQ.has(e.contentType))return null;let t=ad.safeParse(e.data).data?.sources;return{kind:CQ.TURN,key:`message:${e.id}`,storedMessageId:e.id,role:e.role,content:e.content,markdown:e.role===to.ASSISTANT||e.contentType===hu.MARKDOWN,...t&&t.length>0?{sources:t}:{}}}var OQ;(function(e){e.NONE=`none`,e.REASONING=`reasoning`,e.TOOL=`tool`,e.REPLY=`reply`})(OQ||={});function Iye(e,t){let n=new Set(t.map(e=>e.id)),r=new Set(t.flatMap(e=>{let t=e.role===to.TOOL?qu.safeParse(e.data):null;return t?.success?[t.data.toolCallId]:[]})),i=e.status===SW.RUNNING||e.status===SW.STARTING,a=new Map,o=new Map,s=new Map,c=OQ.NONE;e.messages.forEach((t,r)=>{let i=t.messageId??`${e.executionId}:${r}`;if(t.type===hu.REASONING){let e=a.get(i)??{id:i,content:``,sources:[]};e.content+=t.content,a.set(i,e),n.has(i)||(c=OQ.REASONING)}else if(t.type===hu.PROGRESS){let e=qu.safeParse(t.data);if(!e.success)return;s.set(e.data.toolCallId,{...s.get(e.data.toolCallId),...e.data}),c=OQ.TOOL}else if(EQ.has(t.type)){let e=o.get(i)??{id:i,content:``,sources:[]};e.content+=t.content,e.sources.push(...ad.safeParse(t.data).data?.sources??[]),o.set(i,e),n.has(i)||(c=OQ.REPLY)}});let l=e=>[...e.values()].filter(e=>e.content.length>0&&!n.has(e.id)),u=l(a),d=l(o),f=[];u.forEach((e,t)=>f.push({kind:CQ.REASONING,key:`live-reasoning:${e.id}`,content:e.content,streaming:i&&t===u.length-1&&c===OQ.REASONING}));let p=new Map;for(let e of s.values())r.has(e.toolCallId)?p.set(e.toolCallId,e):f.push({kind:CQ.TOOL,key:`tool:${e.toolCallId}`,trace:e});return d.forEach((e,t)=>f.push({kind:CQ.TURN,key:`live-reply:${e.id}`,role:to.ASSISTANT,content:e.content,markdown:!0,...i&&t===d.length-1&&c===OQ.REPLY?{streaming:!0}:{},...e.sources.length>0?{sources:e.sources}:{}})),{entries:f,calls:[...s.values()],recordedCallUpdates:p,activity:c}}function Lye(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if((n.role===to.USER||n.role===to.ASSISTANT)&&(n.contentType===void 0||EQ.has(n.contentType)))return n.role}}function kQ(e){let t=e.thread?.messages??[],n=[],r=new Map;for(let e of t){let t=Fye(e);if(t){if(t.kind===CQ.TOOL){let e=r.get(t.trace.toolCallId);if(e!==void 0){let r=n[e].entry;n[e].entry={...r,trace:{...r.trace,...t.trace}};continue}r.set(t.trace.toolCallId,n.length)}n.push({at:DQ(e.createdAt),entry:t})}}let i=e.live,a=i?Iye(i,t):void 0;for(let[e,t]of a?.recordedCallUpdates??[]){let i=r.get(e);if(i===void 0)continue;let{fromRecordOnly:a,...o}=n[i].entry;n[i].entry={...o,trace:{...o.trace,...t}}}for(let r of Pye(e.sent,new Set(t.map(e=>e.id))))n.push({at:r.sentAt.getTime(),entry:{kind:CQ.TURN,key:`sent-pending:${r.id}`,role:to.USER,content:r.text,markdown:!1,pending:!0}});let o=(e.hostEntries??[]).map((e,t)=>({at:DQ(e.at),index:t,entry:{kind:CQ.HOST,key:`host:${e.key}`,node:e.node}})).sort((e,t)=>e.at-t.at||e.index-t.index),s=[],c=0;for(let e of n){for(;c<o.length&&o[c].at<e.at;)s.push(o[c++].entry);s.push(e.entry)}for(;c<o.length;)s.push(o[c++].entry);if(!i||!a){let n=e.thread?.status,r=e.thread?.executionId;if(n===yn.AWAITING_APPROVAL&&r&&e.thread?.pendingApproval!==void 0)return{entries:s,turnState:wQ.AWAITING_DECISION,activeExecutionId:r,stoppable:!1};let i=e.thread?.failureCode;return n===yn.FAILED&&i!==void 0?{entries:s,turnState:wQ.FAILED,stoppable:!1,recoverable:!1,errorCode:i}:n===yn.FAILED&&Lye(t)===to.USER?{entries:s,turnState:wQ.INTERRUPTED,stoppable:!1}:n===yn.CANCELLED?{entries:s,turnState:wQ.STOPPED,stoppable:!1}:{entries:s,turnState:wQ.IDLE,stoppable:!1}}switch(s.push(...a.entries),i.status){case SW.STARTING:case SW.RUNNING:{if(a.activity===OQ.REPLY)return{entries:s,turnState:wQ.ANSWERING,activeExecutionId:i.executionId,stoppable:!0};let e=a.activity===OQ.TOOL?a.calls.at(-1):void 0;return{entries:s,turnState:wQ.WORKING,activeExecutionId:i.executionId,stoppable:!0,...e?.phase===bo.CALL?{currentCall:e}:{}}}case SW.AWAITING_APPROVAL:return{entries:s,turnState:wQ.AWAITING_DECISION,activeExecutionId:i.executionId,stoppable:!1,...i.errorCode?{errorCode:i.errorCode}:{}};case SW.CANCELLED:return{entries:s,turnState:wQ.STOPPED,stoppable:!1};case SW.ERROR:return{entries:s,turnState:wQ.FAILED,stoppable:!1,recoverable:i.recoverable===!0,...i.errorCode?{errorCode:i.errorCode}:{}};case SW.IDLE:case SW.COMPLETED:return{entries:s,turnState:wQ.IDLE,stoppable:!1}}}function AQ(e){return new Date(e.createdAt).getTime()}function jQ(e){return[...e].sort((e,t)=>AQ(t)-AQ(e))}function MQ(e,t){if(!t.hasOlder)return{threads:jQ(t.executions),hasOlder:!1};let n=Math.min(...t.executions.map(AQ)),r=new Set(t.executions.map(e=>e.executionId)),i=e.threads.filter(e=>AQ(e)<n&&!r.has(e.executionId));return{threads:jQ([...t.executions,...i]),hasOlder:i.length>0?e.hasOlder:!0}}function NQ(e,t){let n=new Map(e.threads.map(e=>[e.executionId,e]));for(let e of t.executions)n.set(e.executionId,e);return{threads:jQ(n.values()),hasOlder:t.hasOlder}}function PQ(e){let t=e.threads.at(-1);return t?new Date(t.createdAt).toISOString():void 0}async function FQ(e){let t=await e();if(!t)return;let n=MQ({threads:[],hasOlder:!1},t);for(;n.hasOlder;){let t=PQ(n),r=await e(t?{before:t}:void 0);if(!r)return;let i=NQ(n,r);if(i.threads.length===n.threads.length)break;n=i}return n.threads}var IQ=zs(J.LOW_LEVEL_AI_CONVERSATION_THREAD,`AI_ConversationThread`,[`Composer`,`Discussions`]);function LQ({preset:e=q.DEFAULT,...t}){let n=IQ(e);return(0,$.jsx)(n,{...t})}function RQ({preset:e=q.DEFAULT,...t}){let n=IQ(e);return(0,$.jsx)(n.Composer,{...t})}function zQ({preset:e=q.DEFAULT,...t}){let n=IQ(e);return(0,$.jsx)(n.Discussions,{...t})}var BQ=new Map;function VQ(e,t,n,r){return`${e??``}\u0000${t}\u0000${n}\u0000${r}`}function Rye(e){return BQ.get(e)??null}function zye(e,t){t?BQ.set(e,t):BQ.delete(e)}var HQ=zs(J.LOW_LEVEL_AI_MESSAGE,`AI_Message`,[`Content`,`Response`,`Actions`,`Action`,`Branch`,`BranchContent`,`BranchSelector`,`BranchPrevious`,`BranchNext`,`BranchPage`,`Attachment`,`Attachments`,`Toolbar`]);function UQ({preset:e=q.DEFAULT,...t}){let n=HQ(e);return(0,$.jsx)(n,{...t})}function WQ({preset:e=q.DEFAULT,...t}){let n=HQ(e);return(0,$.jsx)(n.Content,{...t})}function GQ({preset:e=q.DEFAULT,...t}){let n=HQ(e);return(0,$.jsx)(n.Response,{...t})}function KQ({preset:e=q.DEFAULT,...t}){let n=HQ(e);return(0,$.jsx)(n.Actions,{...t})}function qQ({preset:e=q.DEFAULT,...t}){let n=HQ(e);return(0,$.jsx)(n.Action,{...t})}function Bye({preset:e=q.DEFAULT,...t}){let n=HQ(e);return(0,$.jsx)(n.Branch,{...t})}function Vye({preset:e=q.DEFAULT,...t}){let n=HQ(e);return(0,$.jsx)(n.BranchContent,{...t})}function Hye({preset:e=q.DEFAULT,...t}){let n=HQ(e);return(0,$.jsx)(n.BranchSelector,{...t})}function Uye({preset:e=q.DEFAULT,...t}){let n=HQ(e);return(0,$.jsx)(n.BranchPrevious,{...t})}function Wye({preset:e=q.DEFAULT,...t}){let n=HQ(e);return(0,$.jsx)(n.BranchNext,{...t})}function Gye({preset:e=q.DEFAULT,...t}){let n=HQ(e);return(0,$.jsx)(n.BranchPage,{...t})}function Kye({preset:e=q.DEFAULT,...t}){let n=HQ(e);return(0,$.jsx)(n.Attachment,{...t})}function qye({preset:e=q.DEFAULT,...t}){let n=HQ(e);return(0,$.jsx)(n.Attachments,{...t})}function Jye({preset:e=q.DEFAULT,...t}){let n=HQ(e);return(0,$.jsx)(n.Toolbar,{...t})}var Yye=gl.createOperationPathKey({resourceIdentifier:Na.AGENT_BEHAVIOR_REPORTS,operationIdentifier:W.CREATE,variantType:Ya.API_CALL,isOperationDefault:!0,isBulkOperation:!1}),JQ;(function(e){e.IDLE=`idle`,e.SENDING=`sending`,e.SENT=`sent`})(JQ||={});function Xye({executionId:e,messageId:t,organizationId:n}){let{tComponent:r,tResourceFieldEnumValue:i}=K({component:J.HIGH_LEVEL_VIEWS_FLOWS_ACTORS,resource:Na.AGENT_BEHAVIOR_REPORTS}),a=(0,Q.useMemo)(()=>Om(r,J.HIGH_LEVEL_VIEWS_FLOWS_ACTORS),[r]),{doOperation:o}=wm(),s=bp(),{renderIcon:c}=Rf(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(void 0),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(JQ.IDLE),[_,v]=(0,Q.useState)(null),y=(0,Q.useRef)(!1),b=(0,Q.useMemo)(()=>Object.values(ire).map(e=>({value:e,label:i(Na.AGENT_BEHAVIOR_REPORTS,`category`,e,Ur.shape.category)})),[i]),x=(0,Q.useCallback)(async()=>{if(d&&!y.current){y.current=!0,g(JQ.SENDING),v(null);try{let r=p.trim();await o(Yye,{contextualParameters:{organizationId:n},requestData:{executionRef:{kind:br.CONVERSATIONAL_EXECUTION,id:e},turnMessageId:t,category:d,...r?{comment:r}:{}}},{silent:!0}),g(JQ.SENT),u(!1)}catch(e){v(s(e)),g(JQ.IDLE)}finally{y.current=!1}}},[d,p,o,e,t,n,s]),S=`agent-reply-report-category-label-${t}`,C=`agent-reply-report-comment-${t}`,w=h===JQ.SENT,T=a(w?`replyReported`:`reportReply`);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(qQ,{tooltip:T,label:T,disabled:w,onClick:()=>{v(null),u(!0)},"data-agent-reply-report":h,children:c(H.WARNING,{size:fa.SM})}),(0,$.jsx)(rG,{open:l,onOpenChange:e=>{h!==JQ.SENDING&&u(e)},children:(0,$.jsxs)(aG,{className:`sm:max-w-lg`,children:[(0,$.jsxs)(sG,{children:[(0,$.jsx)(lG,{children:a(`reportDialogTitle`)}),(0,$.jsx)(uG,{children:a(`reportDialogDescription`)})]}),(0,$.jsxs)(Dx,{className:`gap-field py-field`,children:[(0,$.jsxs)(wx,{children:[(0,$.jsx)(Ex,{id:S,children:a(`reportCategoryLabel`)}),(0,$.jsx)(DF,{"aria-labelledby":S,name:`agent-reply-report-category-${t}`,schema:Ur.shape.category,options:b,value:d,onValueChange:e=>f(e),orientation:Wl.VERTICAL,disabled:h===JQ.SENDING,required:!0})]}),(0,$.jsxs)(wx,{children:[(0,$.jsx)(Tx,{htmlFor:`field-${C}`,children:a(`reportCommentLabel`)}),(0,$.jsx)(II,{name:C,schema:Ur.shape.comment,value:p,onChange:e=>m((e??``).slice(0,E)),placeholder:a(`reportCommentPlaceholder`),rows:3,disabled:h===JQ.SENDING})]}),_?(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:_})}):null]}),(0,$.jsxs)(cG,{children:[(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:()=>u(!1),disabled:h===JQ.SENDING,children:a(`reportCancel`)}),(0,$.jsx)(X,{onClick:()=>{x()},disabled:!d||h===JQ.SENDING,children:a(`reportSend`)})]})]})})]})}function YQ(e,t=40){let n=e.trim().replace(/\s+/g,` `);return n.length>t?`${n.slice(0,t)}…`:n}function Zye(e){return YQ(e.messages.find(e=>e.role===to.USER)?.content??``)}function XQ(){let{tComponent:e}=K({component:J.HIGH_LEVEL_VIEWS_FLOWS_ACTORS});return(0,Q.useMemo)(()=>Om(e,J.HIGH_LEVEL_VIEWS_FLOWS_ACTORS),[e])}var Qye=new Set([SW.COMPLETED,SW.CANCELLED,SW.ERROR,SW.AWAITING_APPROVAL]),ZQ={threads:[],hasOlder:!1},$ye=({system:e,contextResourceIdentifiers:t,preset:n,caseRef:r})=>{let i=XQ(),{startExecution:a,cancelExecution:o,executions:s,fetchConversationHistory:c,deleteConversation:l}=OW(),u=lm(),d=u?.currentUserId??null,f=ke(t),p=(0,Q.useRef)(t);p.current=t;let[m,h]=(0,Q.useState)(ZQ),g=m.threads,[_,v]=(0,Q.useState)(!1),y=r?`${r.resourceType}:${r.resourceId}`:``,b=VQ(d,e.ref,f,y),[x,S]=(0,Q.useState)(null),C=(0,Q.useRef)(b);C.current=b;let w=(0,Q.useCallback)(e=>{S(t=>{let n=typeof e==`function`?e(t):e;return zye(C.current,n),n})},[]),T=(0,Q.useRef)(null),[E,D]=(0,Q.useState)({}),O=(0,Q.useRef)(0),k=(0,Q.useCallback)(async()=>{let t=++O.current,n=await c(e.ref,p.current);t===O.current&&n!==void 0&&h(e=>MQ(e,n))},[e.ref,c]),A=(0,Q.useRef)(0),j=(0,Q.useCallback)(async()=>{let t=PQ(m);if(!t||_)return;let n=A.current;v(!0);try{let r=await c(e.ref,p.current,{before:t});if(n!==A.current||r===void 0)return;h(e=>NQ(e,r))}finally{n===A.current&&v(!1)}},[m,_,e.ref,c]);(0,Q.useEffect)(()=>{let e=T.current;e&&m!==ZQ&&(T.current=null,!m.threads.some(t=>t.executionId===e)&&!s.has(e)&&w(t=>t===e?null:t))},[m,s,w]),(0,Q.useEffect)(()=>{A.current+=1,h(ZQ),v(!1);let t=Rye(VQ(d,e.ref,f,y));T.current=t,S(t),D({}),k()},[k,d,f,e.ref,y]);let M=x?s.get(x):void 0;(0,Q.useEffect)(()=>{M&&Qye.has(M.status)&&k()},[M?.status,k]);let N=x?g.find(e=>e.executionId===x):void 0,P=x?E[x]:void 0,F=(0,Q.useMemo)(()=>kQ({...N?{thread:N}:{},...M?{live:M}:{},...P?{sent:P}:{}}),[N,M,P]),I=(0,Q.useMemo)(()=>{let e=g.map(e=>({id:e.executionId,title:Zye(e)}));return[...Object.entries(E).filter(([e,t])=>t.length>0&&!g.some(t=>t.executionId===e)).sort(([,e],[,t])=>t[0].sentAt.getTime()-e[0].sentAt.getTime()).map(([e,t])=>({id:e,title:YQ(t[0].text)})),...e]},[g,E]),ee=(0,Q.useCallback)(()=>w(null),[w]),L=(0,Q.useCallback)(e=>{w(e),k()},[k,w]),R=(0,Q.useCallback)(e=>{h(t=>({...t,threads:t.threads.filter(t=>t.executionId!==e)})),D(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n}),w(t=>t===e?null:t),l(e).catch(()=>{k()})},[l,k,w]),te=(0,Q.useCallback)(t=>{let n=crypto.randomUUID(),i=a(e.ref,{message:t},x??void 0,p.current,{messageId:n,...r?{caseRef:r}:{}});i&&(D(e=>({...e,[i]:TQ(e[i],{id:n,text:t,sentAt:new Date})})),w(i))},[a,e.ref,x,r,w]),z=F.turnState===wQ.WORKING||F.turnState===wQ.ANSWERING||F.turnState===wQ.AWAITING_DECISION,B=F.stoppable?F.activeExecutionId:void 0,ne=Bee(t,u?.currentOrganizationId??void 0),re=N?x:null,ie=(0,Q.useMemo)(()=>re&&ne?({messageId:e})=>(0,$.jsx)(Xye,{executionId:re,messageId:e,organizationId:ne},e):void 0,[re,ne]);return(0,$.jsx)(`div`,{className:`@container flex min-h-0 flex-1 flex-col`,children:(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-card @2xl:flex-row`,children:[(0,$.jsx)(zQ,{preset:n,discussions:I,currentId:x,onNew:ee,onSelect:L,onDelete:R,...m.hasOlder?{onLoadOlder:()=>{j()},loadingOlder:_}:{}}),(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-card-sm`,children:[(0,$.jsx)(LQ,{preset:n,model:F,...ie?{renderReplyActions:ie}:{},emptyState:{title:e.displayName,description:e.description||i(`emptyStateDescription`)}}),(0,$.jsx)(RQ,{preset:n,placeholder:i(`promptPlaceholder`,{assistant:e.displayName}),onSubmit:te,sendDisabled:z,...B?{onStop:()=>o(B)}:{}})]})]})})},ebe=({system:e})=>{let t=XQ(),{executions:n}=OW(),r=(0,Q.useMemo)(()=>Array.from(n.values()).some(t=>t.systemRef===e.ref&&(t.status===SW.RUNNING||t.status===SW.STARTING)),[n,e.ref]);return(0,$.jsxs)(`div`,{className:`flex items-center gap-element border-b border-border pb-card-sm`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:U(`size-2 shrink-0 rounded-full`,r?`bg-warning`:`bg-success`)}),(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.displayName}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(r?`statusWorking`:`statusReady`)})]})},QQ=({viewRef:e,viewDefinition:t,contextResourceIdentifiers:n,caseRef:r})=>{let{flowsActorsViews:i}=e_(),a=lm(),{systems:o,isLoading:s}=OW(),{isReady:c}=K({component:J.HIGH_LEVEL_VIEWS_FLOWS_ACTORS}),l=XQ(),u=t??(e?i?.find(t=>t.ref===e):void 0);(0,Q.useEffect)(()=>{},[n,u,e]);let d=(0,Q.useMemo)(()=>{let e=pm.buildInitiatorIds({userId:a?.currentUserId,organizationId:a?.currentOrganizationId,applicationId:a?.currentApplicationId,anonymousUserId:a?.currentAnonymousUserId}),t=u?.primaryScope?pm.primaryScopeToContextIdentifiers(e,u.primaryScope):{},r=a?.buildContextResourceIdentifiers()??{},i=pm.filterCustomScopeContextResourceIdentifiers(r);return u?pm.resolveViewContextResourceIdentifiers({surfaceName:`FlowsActorsView`,surfaceRef:u.ref,primaryScope:u.primaryScope,parentResourcesRequirements:u.parentResourcesRequirements,additionalResourceRequirements:u.additionalResourceRequirements,primaryScopeContext:t,customScopeContext:i,explicitContextResourceIdentifiers:n})??{}:pm.mergeContextResourceIdentifiers(t,i,n)??{}},[n,u,a]),f=(0,Q.useMemo)(()=>{if(u)return o.find(e=>e.ref===u.systemRef)},[u,o]);return u?c?(0,$.jsx)(`div`,{className:`flex h-full min-h-0 flex-col`,children:f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ebe,{system:f}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col pt-card-sm`,children:(0,$.jsx)($ye,{system:f,contextResourceIdentifiers:d,preset:u.layoutPreset,caseRef:r})})]}):(0,$.jsx)(`div`,{role:`status`,className:`p-section text-sm text-muted-foreground`,children:l(s?`loading`:`unavailable`)})}):null:(0,$.jsx)(E_,{viewKind:`flows-actors`})},tbe=Q.lazy(()=>T_(()=>import(`./ChartView-Dxhrm4ZQ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));function nbe(e){let{insertedIdentity:t,contextResourceIdentifiers:n,urlParamValues:r,registry:i}=e;if(t.hostKind!==Qp.RESOURCE||t.viewKind!==Mp.CHART_VIEW)return;let a=Wp({viewRef:t.insertedViewRef,registry:i})?.chartView;if(!a||!am(a))return;let o=n??{};return{routeViewRef:t.insertedViewRef,viewDefinition:a,contextResourceIdentifiers:o,urlParamValues:r,runtimeDescriptor:Op({identity:t,chartView:a,contextResourceIdentifiers:o}),requiredFeatures:a.chartDefinition.requiredFeatures}}function rbe(e){let{viewRef:t,registry:n,contextResourceIdentifiers:r,urlParamValues:i}=e;if(!t)return;let a=Up(t);if(a)return nbe({insertedIdentity:a,contextResourceIdentifiers:r,urlParamValues:i,registry:n})}function ibe(e){let t=wg(),n=yQ(t),{emit:r}=vo(),{getZoneState:i}=Zx(),a=Q.useRef(null),o=`${t.pathname}${t.search}`,{retryTick:s,scheduleRetry:c,clearRetry:l}=_Q(o);Q.useEffect(()=>{e&&(Ch.isInTransaction()?c():(l(),n||a.current!==o&&(Ch.zoneOwnsBrowserUrl(li.PRIMARY,o,i)||r(hc.NAVIGATION_REPLACE,{zone:li.PRIMARY,content:{contentType:hd.CHART_VIEW,viewRef:e.routeViewRef,viewDefinition:e.viewDefinition,contextResourceIdentifiers:e.contextResourceIdentifiers,urlParamValues:e.urlParamValues,runtimeDescriptor:e.runtimeDescriptor,requiredFeatures:e.requiredFeatures},urlPath:Ch.decomposeHostedPaneBrowserUrl(o).hostUrl,stackEntryId:Ch.generateStackEntryId(),initiator:{sourceZone:li.PRIMARY},navigationSource:Zi.URL_SYNC,transition:ln.REPLACE}),a.current=o)))},[r,i,e,o,n,s,c,l])}var abe=new Set(Object.values(W).map(e=>String(e).toLowerCase()));function obe(e,t){let n=[],r=[],i=[];for(let[t,a]of Object.entries(e))a&&a.startsWith(`:`)?n.push(`${t}=${a}`):!a||a.trim()===``?r.push(t):a===`undefined`||a===`null`||a===`[object Object]`?n.push(`${t}=${a}`):abe.has(a.toLowerCase())&&i.push(`${t}=${a}`);return n.length>0?{isValid:!1,errorType:`unresolved`,invalidParams:n,message:`Unresolved route parameters for ${t}: ${n.join(`, `)}. The URL contains placeholder values instead of actual IDs.`}:i.length>0?{isValid:!1,errorType:`invalid`,invalidParams:i,message:`Route parameter for ${t} is an operation keyword, not a resource id: ${i.join(`, `)}. This URL does not address a resource.`}:r.length>0?{isValid:!1,errorType:`missing`,invalidParams:r,message:`Missing required parameters for ${t}: ${r.join(`, `)}`}:{isValid:!0}}var sbe=Jo.getLogger(),cbe=({resourceType:e,operation:t,PageComponent:n,routePathParameters:r})=>{let{registry:i}=wm(),a=lm(),{navigationLayout:o,currentBreakpoint:s}=e_(),{contentAreaWidth:c}=Zx(),l=Xm(),u=Q.useMemo(()=>obe(l,e),[l,e]);kye(u.isValid?e:void 0,u.isValid?t:void 0,r),Q.useEffect(()=>{!u.isValid&&u.message&&sbe.warn(`[AppRouter] ${u.message}`,{resourceType:e,operation:String(t.operationIdentifier),invalidParams:u.invalidParams,errorType:u.errorType,url:window.location.href})},[u.isValid,u.message,u.errorType,u.invalidParams,e,t.operationIdentifier]);let d=Q.useMemo(()=>gn.buildParentResourcesRequirementsFromRouteParams(r,e,i),[r,e,i]);if(!u.isValid)return(0,$.jsx)(ub,{});let f=gn.extractResourceIdentifiersFromUrlParams(l,i,r),p=i.resourceConfigurations?.[e]?.resourcePrimaryScope,m=pm.buildResourceOperationContextIdentifiers({currentUserId:a?.currentUserId,currentOrganizationId:a?.currentOrganizationId,currentApplicationId:a?.currentApplicationId,currentAnonymousUserId:a?.currentAnonymousUserId,primaryScope:p,liveAppScopeContextResourceIdentifiers:a?.buildContextResourceIdentifiers?.(),explicitContextResourceIdentifiers:f}),h=gn.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:t,contextResourceIdentifiers:m,parentResourcesRequirements:d}),g=Ch.calculateResourceRelationshipDepth(d),_=g===0&&!!o?.zones?.secondary&&Ch.layoutSplitsOperationFromPrimary(o,t,s),v=Ch.resolveResourceTargetZone(g,{hasSecondary:!!o?.zones?.secondary,hasCompanion:!!o?.zones?.companion,prefersAdjacentZoneForDetail:_}),y=eg({zone:v,layout:o,viewport:s,contentAreaWidth:c})?v:li.PRIMARY;return(0,$.jsx)(n,{resourceContext:h,navigationZone:y,navigationInitiator:{sourceZone:y}})};function $Q(e,t){let{compositeViews:n,fullCustomViews:r,flowsActorsViews:i}=e_(),{registry:a}=wm();return Q.useMemo(()=>{if(e)switch(t){case hd.COMPOSITE_VIEW:return kp({viewRef:e,compositeViews:n,registry:a})?.requiredFeatures;case hd.CHART_VIEW:return Wp({viewRef:e,registry:a})?.chartView.chartDefinition.requiredFeatures;case hd.FULL_CUSTOM_VIEW:return r?.find(t=>t.ref===e)?.requiredFeatures;case hd.FLOWS_ACTORS_VIEW:return i?.find(t=>t.ref===e)?.requiredFeatures;case hd.EXECUTION_VIEW:return zp({viewRef:e,registry:a})?.requiredFeatures;default:return}},[e,t,n,r,i,a])}var e$=({ViewComponent:e,contentType:t,viewProps:n})=>{let{viewRef:r}=Xm();bQ(r,t);let i=$Q(r,t);return(0,$.jsx)(lg,{requiredFeatures:i,children:(0,$.jsx)(e,{viewRef:r,...n})})},lbe=({viewProps:e})=>{let{viewRef:t}=Xm(),n=wg(),{compositeViews:r}=e_(),{registry:i}=wm(),a=Q.useMemo(()=>Kp(new URLSearchParams(n.search)),[n.search]),o=Q.useMemo(()=>kp({viewRef:t,compositeViews:r,registry:i}),[t,r,i]),s=!!t&&Zp(o);bQ(s?t:void 0,hd.COMPOSITE_VIEW);let c=$Q(s?t:void 0,hd.COMPOSITE_VIEW);return s?(0,$.jsx)(lg,{requiredFeatures:c,children:(0,$.jsx)(JU,{viewRef:t,contextResourceIdentifiers:a,...e})}):(0,$.jsx)(E_,{viewKind:`composite`,viewRef:t})},ube=({viewProps:e})=>{let{viewRef:t}=Xm(),n=wg(),{registry:r}=wm(),i=Q.useMemo(()=>zp({viewRef:t,registry:r}),[t,r]),a=Q.useMemo(()=>xm(new URLSearchParams(n.search)),[n.search]),o=!!t&&!!i&&mp(i);bQ(o?t:void 0,hd.EXECUTION_VIEW);let s=$Q(o?t:void 0,hd.EXECUTION_VIEW);return o?(0,$.jsx)(lg,{requiredFeatures:s,children:(0,$.jsx)(hX,{viewRef:t,contextResourceIdentifiers:a,...e})}):(0,$.jsx)(E_,{viewKind:`execution`,viewRef:t})},dbe=({viewProps:e})=>{let{viewRef:t}=Xm(),n=wg(),{registry:r}=wm(),i=Q.useMemo(()=>rm(new URLSearchParams(n.search)),[n.search]),a=Q.useMemo(()=>tm(new URLSearchParams(n.search)),[n.search]),o=Q.useMemo(()=>rbe({viewRef:t,registry:r,contextResourceIdentifiers:i,urlParamValues:a}),[t,r,i,a]);return ibe(o),o?(0,$.jsx)(lg,{requiredFeatures:o.requiredFeatures,children:(0,$.jsx)(tbe,{viewRef:o.routeViewRef,viewDefinition:o.viewDefinition,contextResourceIdentifiers:o.contextResourceIdentifiers,urlParamValues:o.urlParamValues,runtimeDescriptor:o.runtimeDescriptor,...e})}):(0,$.jsx)(E_,{viewKind:`chart`,viewRef:t})},t$=({pageRef:e,PageComponent:t})=>(Aye(e),(0,$.jsx)(t,{})),n$=()=>(0,$.jsx)(eW,{});function fbe({documentRef:e}){let[t]=bh(),n=yo(t);return(0,$.jsx)(hQ,{documentRef:e,...n?{namedRelease:n}:{}})}var pbe=()=>{let{registry:e}=wm();va.isDevelopment();let t=[];return Object.values(e.resourceConfigurations).forEach(n=>{(Array.isArray(n.operations)?n.operations:[]).forEach(r=>{if(!fn(r.operationFrontendConfig))return;let i=It.buildOperationFrontendRoutePaths(n,r,e.allResourceFieldIdentifiers),a=ms(r),o;switch(a){case`create`:o=pG;break;case`list`:o=OX;break;case`read`:o=eX;break;case`update`:o=aX;break;case`search`:o=rX;break;default:o=tG}i.forEach((e,i)=>{let a=(0,$.jsx)(lg,{operation:r,children:(0,$.jsx)(cbe,{resourceType:n.resourceIdentifier,operation:r,PageComponent:o,routePathParameters:e.parameters})}),s=`${n.resourceIdentifier}-${String(r.operationIdentifier)}-${i}`;t.push((0,$.jsx)(Hh,{path:e.url,element:a,errorElement:(0,$.jsx)(ub,{})},s))})})}),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Oye,{}),(0,$.jsxs)(nse,{children:[(0,$.jsx)(Hh,{path:Cn.authCallback,element:(0,$.jsx)(ave,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.reAuthenticationCallback,element:(0,$.jsx)(ove,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.magicLinkVerify,element:(0,$.jsx)(sve,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.mfaChallenge,element:(0,$.jsx)(Wve,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.enrollmentRequired,element:(0,$.jsx)(Gve,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.organizationOnboarding,element:(0,$.jsx)(Jve,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.oneOffSession,element:(0,$.jsx)(UZ,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.fileUploadGrant,element:(0,$.jsx)(JZ,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.authExchange,element:(0,$.jsx)(pye,{}),errorElement:(0,$.jsx)(ub,{})}),Object.entries(rae).map(([e,t])=>(0,$.jsx)(Hh,{path:t,element:(0,$.jsx)(fbe,{documentRef:e}),errorElement:(0,$.jsx)(ub,{})},e)),(0,$.jsx)(Hh,{path:uae,element:(0,$.jsx)(gQ,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.login,element:(0,$.jsx)(eye,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.register,element:(0,$.jsx)(Dye,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.passwordLost,element:(0,$.jsx)(gye,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.oauthConsent,element:(0,$.jsx)(vye,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.chatIdentityLink,element:(0,$.jsx)(yye,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.oauthLoggedOut,element:(0,$.jsx)(bye,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.oauthLogoutConfirm,element:(0,$.jsx)(xye,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.invitation,element:(0,$.jsx)(lye,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.confirmEmail,element:(0,$.jsx)(nye,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsxs)(Hh,{element:(0,$.jsx)(KH,{}),errorElement:(0,$.jsx)(ub,{}),children:[(0,$.jsx)(Hh,{path:Cn.home,element:(0,$.jsx)(t$,{pageRef:ao.HOME,PageComponent:eW}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.decisions,element:(0,$.jsx)(t$,{pageRef:ao.DECISIONS,PageComponent:ZW}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.settings,element:(0,$.jsx)(n$,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.settingsSection,element:(0,$.jsx)(n$,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:Cn.settingsSectionSubTab,element:(0,$.jsx)(n$,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:`/composite/:viewRef`,element:(0,$.jsx)(lbe,{}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:`/custom/:viewRef`,element:(0,$.jsx)(e$,{ViewComponent:SQ,contentType:hd.FULL_CUSTOM_VIEW}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:`/flows-actors/:viewRef`,element:(0,$.jsx)(e$,{ViewComponent:QQ,contentType:hd.FLOWS_ACTORS_VIEW}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:`/execution/:viewRef`,element:(0,$.jsx)(ube,{viewProps:{navigationZone:qn.PRIMARY}}),errorElement:(0,$.jsx)(ub,{})}),(0,$.jsx)(Hh,{path:`/chart/:viewRef`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{style:{padding:`2rem`,textAlign:`center`,color:`var(--muted-foreground, #737373)`},children:`Loading chart...`}),children:(0,$.jsx)(dbe,{})}),errorElement:(0,$.jsx)(ub,{})}),t]}),(0,$.jsx)(Hh,{path:`*`,element:(0,$.jsx)(ub,{})})]})]})},r$=Xie.EN,i$={en:{title:`Something went wrong`,message:`The application could not start. Please try again.`,retry:`Try again`},es:{title:`Algo salió mal`,message:`La aplicación no pudo iniciarse. Vuelve a intentarlo.`,retry:`Reintentar`},fr:{title:`Une erreur est survenue`,message:`L'application n'a pas pu démarrer. Veuillez réessayer.`,retry:`Réessayer`},de:{title:`Etwas ist schiefgelaufen`,message:`Die Anwendung konnte nicht gestartet werden. Bitte versuchen Sie es erneut.`,retry:`Erneut versuchen`},pt:{title:`Algo correu mal`,message:`A aplicação não conseguiu iniciar. Tente novamente.`,retry:`Tentar novamente`},it:{title:`Qualcosa è andato storto`,message:`L'applicazione non è riuscita ad avviarsi. Riprova.`,retry:`Riprova`},nl:{title:`Er is iets misgegaan`,message:`De applicatie kon niet starten. Probeer het opnieuw.`,retry:`Opnieuw proberen`},ru:{title:`Что-то пошло не так`,message:`Не удалось запустить приложение. Попробуйте ещё раз.`,retry:`Повторить`},zh:{title:`出了点问题`,message:`应用无法启动,请重试。`,retry:`重试`},"zh-TW":{title:`發生錯誤`,message:`應用程式無法啟動,請重試。`,retry:`重試`},"zh-HK":{title:`發生錯誤`,message:`應用程式無法啟動,請重試。`,retry:`重試`},ja:{title:`問題が発生しました`,message:`アプリケーションを起動できませんでした。もう一度お試しください。`,retry:`再試行`},ko:{title:`문제가 발생했습니다`,message:`애플리케이션을 시작할 수 없습니다. 다시 시도해 주세요.`,retry:`다시 시도`},ar:{title:`حدث خطأ ما`,message:`تعذّر بدء تشغيل التطبيق. يرجى المحاولة مرة أخرى.`,retry:`إعادة المحاولة`},hi:{title:`कुछ गलत हो गया`,message:`एप्लिकेशन शुरू नहीं हो सका। कृपया पुनः प्रयास करें।`,retry:`पुनः प्रयास करें`},sv:{title:`Något gick fel`,message:`Appen kunde inte starta. Försök igen.`,retry:`Försök igen`},no:{title:`Noe gikk galt`,message:`Appen kunne ikke starte. Prøv igjen.`,retry:`Prøv igjen`},da:{title:`Noget gik galt`,message:`Appen kunne ikke starte. Prøv igen.`,retry:`Prøv igen`},fi:{title:`Jokin meni pieleen`,message:`Sovellusta ei voitu käynnistää. Yritä uudelleen.`,retry:`Yritä uudelleen`},pl:{title:`Coś poszło nie tak`,message:`Nie udało się uruchomić aplikacji. Spróbuj ponownie.`,retry:`Spróbuj ponownie`},cs:{title:`Něco se pokazilo`,message:`Aplikaci se nepodařilo spustit. Zkuste to znovu.`,retry:`Zkusit znovu`},hu:{title:`Valami hiba történt`,message:`Az alkalmazást nem sikerült elindítani. Próbálja újra.`,retry:`Újrapróbálkozás`},ro:{title:`Ceva nu a funcționat`,message:`Aplicația nu a putut porni. Încercați din nou.`,retry:`Încercați din nou`},bg:{title:`Нещо се обърка`,message:`Приложението не можа да стартира. Опитайте отново.`,retry:`Опитайте отново`},hr:{title:`Nešto je pošlo po zlu`,message:`Aplikacija se nije mogla pokrenuti. Pokušajte ponovno.`,retry:`Pokušaj ponovno`},sk:{title:`Niečo sa pokazilo`,message:`Aplikáciu sa nepodarilo spustiť. Skúste to znova.`,retry:`Skúsiť znova`},sl:{title:`Nekaj je šlo narobe`,message:`Aplikacije ni bilo mogoče zagnati. Poskusite znova.`,retry:`Poskusi znova`},lt:{title:`Kažkas nepavyko`,message:`Nepavyko paleisti programos. Bandykite dar kartą.`,retry:`Bandyti dar kartą`},lv:{title:`Kaut kas nogāja greizi`,message:`Neizdevās palaist lietotni. Mēģiniet vēlreiz.`,retry:`Mēģināt vēlreiz`},et:{title:`Midagi läks valesti`,message:`Rakendust ei õnnestunud käivitada. Proovige uuesti.`,retry:`Proovi uuesti`},el:{title:`Κάτι πήγε στραβά`,message:`Η εφαρμογή δεν μπόρεσε να ξεκινήσει. Δοκιμάστε ξανά.`,retry:`Δοκιμάστε ξανά`},tr:{title:`Bir şeyler ters gitti`,message:`Uygulama başlatılamadı. Lütfen tekrar deneyin.`,retry:`Tekrar dene`},th:{title:`เกิดข้อผิดพลาด`,message:`ไม่สามารถเริ่มแอปพลิเคชันได้ โปรดลองอีกครั้ง`,retry:`ลองอีกครั้ง`},vi:{title:`Đã xảy ra lỗi`,message:`Không thể khởi động ứng dụng. Vui lòng thử lại.`,retry:`Thử lại`},id:{title:`Terjadi kesalahan`,message:`Aplikasi tidak dapat dimulai. Silakan coba lagi.`,retry:`Coba lagi`},ms:{title:`Sesuatu tidak kena`,message:`Aplikasi tidak dapat dimulakan. Sila cuba lagi.`,retry:`Cuba lagi`},ta:{title:`ஏதோ தவறு நடந்தது`,message:`செயலியைத் தொடங்க முடியவில்லை. மீண்டும் முயற்சிக்கவும்.`,retry:`மீண்டும் முயற்சி`},bn:{title:`কিছু ভুল হয়েছে`,message:`অ্যাপ্লিকেশনটি চালু করা যায়নি। আবার চেষ্টা করুন।`,retry:`আবার চেষ্টা করুন`},ur:{title:`کچھ غلط ہو گیا`,message:`ایپلیکیشن شروع نہیں ہو سکی۔ دوبارہ کوشش کریں۔`,retry:`دوبارہ کوشش کریں`},fa:{title:`مشکلی پیش آمد`,message:`برنامه راهاندازی نشد. لطفاً دوباره تلاش کنید.`,retry:`تلاش دوباره`},he:{title:`משהו השתבש`,message:`לא ניתן היה להפעיל את היישום. נסה שוב.`,retry:`נסה שוב`},sw:{title:`Hitilafu imetokea`,message:`Programu haikuweza kuanza. Tafadhali jaribu tena.`,retry:`Jaribu tena`},af:{title:`Iets het verkeerd geloop`,message:`Die toepassing kon nie begin nie. Probeer weer.`,retry:`Probeer weer`},am:{title:`የሆነ ችግር ተፈጥሯል`,message:`መተግበሪያውን መጀመር አልተቻለም። እባክዎ እንደገና ይሞክሩ።`,retry:`እንደገና ይሞክሩ`},is:{title:`Eitthvað fór úrskeiðis`,message:`Ekki tókst að ræsa forritið. Reyndu aftur.`,retry:`Reyna aftur`},mt:{title:`Xi ħaġa marret ħażin`,message:`L-applikazzjoni ma setgħetx tibda. Erġa' pprova.`,retry:`Erġa' pprova`},ga:{title:`Chuaigh rud éigin mícheart`,message:`Níorbh fhéidir an feidhmchlár a thosú. Bain triail eile as.`,retry:`Bain triail eile as`},cy:{title:`Aeth rhywbeth o'i le`,message:`Nid oedd modd cychwyn y rhaglen. Rhowch gynnig arall arni.`,retry:`Rhoi cynnig arall`},eu:{title:`Zerbait gaizki joan da`,message:`Aplikazioa ezin izan da abiarazi. Saiatu berriro.`,retry:`Saiatu berriro`},ca:{title:`Alguna cosa ha anat malament`,message:`L'aplicació no s'ha pogut iniciar. Torna-ho a provar.`,retry:`Torna-ho a provar`},gl:{title:`Algo foi mal`,message:`A aplicación non puido iniciarse. Téntao de novo.`,retry:`Tentar de novo`}};function mbe(e){return e.trim().split(`-`)[0]?.toLowerCase()??``}function a$(e){let t=e.trim().toLowerCase();if(t)return Object.keys(i$).find(e=>e.toLowerCase()===t)}function o$(e){let t=i$[e]??i$[r$],n=Jie[e]?.direction??Jd.LTR;return{...t,languageTag:e,direction:n}}function hbe(e){for(let t of e){if(typeof t!=`string`)continue;let e=a$(t);if(e)return o$(e);let n=a$(mbe(t));if(n)return o$(n)}return o$(r$)}function gbe({onRetry:e}){let t=(0,Q.useMemo)(()=>hbe(navigator.languages??[navigator.language]),[]);return(0,$.jsx)(`div`,{className:`min-h-screen w-screen bg-background px-6 py-10 md:px-10`,lang:t.languageTag,dir:t.direction,children:(0,$.jsx)(`div`,{className:`mx-auto flex min-h-[calc(100vh-5rem)] max-w-xl items-center justify-center`,children:(0,$.jsxs)(`div`,{role:`alert`,className:`w-full rounded-2xl border border-border bg-card px-6 py-8 text-center shadow-sm md:px-8`,children:[(0,$.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/12 text-xl text-destructive`,children:`!`}),(0,$.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-foreground`,children:t.title}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-muted-foreground`,children:t.message}),(0,$.jsx)(`button`,{type:`button`,onClick:e,className:`mt-6 inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90`,children:t.retry})]})})})}function _be(e){let t=[...ybe(e.appConfig),...xbe(e.resourcesRegistry)],n=die({definitions:e.featureConfiguration.definitions,usages:t}),r=[...vbe(e.featureConfiguration,e.isComponentRegistered),...n.unknownIssues.map(e=>`${e.surface}: unknown feature reference(s): ${Cbe(e.references)}`),...n.incompatibleIssues.map(e=>`${e.surface}: incompatible feature reference(s): ${e.references.map(e=>`'${e.featureId}' via ${e.slotLabel} expects ${e.expectedValueType} but registry defines ${e.actualValueType}`).join(`, `)}`)];return{...n,warnings:r,isValid:r.length===0}}function vbe(e,t){let n=[];for(let r of e.definitions??[]){let e=r.unavailability;if(!e||!(e.behavior===co.CUSTOM||Object.values(e.byRole??{}).includes(co.CUSTOM)))continue;let i=e.customComponentRef;i?t&&!t(i)&&n.push(`feature '${r.identifier}': customComponentRef '${i}' is not registered in ComponentRegistryService`):n.push(`feature '${r.identifier}': unavailability behavior CUSTOM declares no customComponentRef, so it renders the generic prompt and behaves identically to DISABLE`)}return n}function ybe(e){return[...s$(e.compositeViews,e=>`frontend composite view '${e.ref}'`),...s$(e.fullCustomViews,e=>`frontend full custom view '${e.ref}'`),...s$(e.flowsActorsViews,e=>`frontend flows/actors view '${e.ref}'`),...s$(e.onboardingViews,e=>`frontend onboarding view '${e.ref}'`),...bbe(e)]}function bbe(e){return(e.guidanceFlows??[]).flatMap(e=>{let t=Gc(e.audience?.requiredFeatures);return t.length===0?[]:[{surface:`frontend guidance flow '${e.ref}' audience`,references:t}]})}function s$(e,t){return e?e.flatMap((e,n)=>{let r=Gc(e.requiredFeatures);return r.length===0?[]:[{surface:t(e,n),references:r}]}):[]}function xbe(e){return Object.entries(e.resourceConfigurations).flatMap(([e,t])=>Sbe(e,t))}function Sbe(e,t){let n=t.frontendConfiguration;return[...(n?.compositeViews??[]).flatMap(t=>{let n=Gc(t.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' composite view '${t.ref}'`,references:n}]}),...(n?.chartViews??[]).flatMap(t=>{let n=Gc(t.chartDefinition.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' chart '${t.ref}'`,references:n}]}),...(n?.executionViews??[]).flatMap(t=>{let n=Gc(t.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' execution view '${t.ref}'`,references:n}]}),...(n?.guidance??[]).flatMap(t=>{let n=Gc(t.audience?.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' guidance flow '${t.ref}' audience`,references:n}]})]}function Cbe(e){return e.map(e=>`'${e.featureId}' via ${e.slotLabel}`).join(`, `)}var c$;(function(e){e.HANDLE_IS_NOT_A_SINK=`HANDLE_IS_NOT_A_SINK`,e.NO_ACTIVATED_SDK=`NO_ACTIVATED_SDK`,e.REPORT_FAILED=`REPORT_FAILED`})(c$||={});function wbe(e){let t=e.context??{},n=e=>{let n=t[e];return typeof n==`string`&&n.length>0?n:void 0};return{name:n(`errorName`)??`Error`,message:n(`errorMessage`)??n(`message`)??e.type,stack:n(`errorStack`),componentStack:n(`componentStack`),tags:{errorType:e.type,errorSeverity:e.severity,...e.operationPathKey===void 0?{}:{operationPathKey:e.operationPathKey}}}}function Tbe(e){let t=t=>{e.onDiagnostic?.(t)},n=[];for(let r of e.modules){if(!r.providerCapabilities.includes(Id.FRONTEND_ERROR_MONITORING))continue;let i=r.metadata.ref,a=e.activations.get(i);a===void 0?t({kind:c$.NO_ACTIVATED_SDK,providerRef:i,message:`Provider "${i}" declares FRONTEND_ERROR_MONITORING but has no activated SDK, so crashes are not being reported anywhere. Its activation diagnostic says why.`}):hse(a.handle)?n.push({providerRef:i,sink:a.handle}):t({kind:c$.HANDLE_IS_NOT_A_SINK,providerRef:i,message:`Provider "${i}" declares FRONTEND_ERROR_MONITORING but its activated handle has no reportCrash(report). Return a FrontendErrorMonitoringSink from activate() rather than the vendor namespace; crashes are not being reported until it does.`})}return(e.subscribe??fi.on.bind(fi))(hc.ERROR_OCCURED,e=>{if(n.length===0)return;let r=wbe(e.error);for(let{providerRef:e,sink:i}of n)try{i.reportCrash(r)}catch(n){t({kind:c$.REPORT_FAILED,providerRef:e,message:`Provider "${e}" threw while reporting a crash; the crash itself is unaffected.`,cause:n})}})}function l$(e){return typeof e==`object`&&!!e}function Ebe(e){if(!l$(e)||!(`cause`in e))return;let t=e.cause;if(t instanceof Error)return t.message;if(typeof t==`string`)return t}function Dbe(e,t){let n=e instanceof Error?e:Error(String(e)),r=l$(n)&&l$(n.wildoError)?n.wildoError:void 0;return n.initializationDiagnostics={...t,errorName:n.name,errorMessage:n.message,stack:n.stack,causeMessage:Ebe(n),wildoError:r?{type:r.type,customMessageReference:r.customMessageReference,context:l$(r.context)?r.context:void 0}:void 0},n}var u$=class{services=null;isInitialized=!1;initializationPromise=null;logger=null;logDebug=null;reportNavigationLayoutDiagnostics(e){if(!e)return;let t;try{t=qt(e)}catch(e){this.logger.warn(`Navigation layout diagnostics could not run`,{error:Ca(e)});return}if(t.length!==0)for(let e of t){let t={path:e.path,code:e.code,remedy:e.remedy};e.severity===Eee.ERROR?this.logger.error(`Navigation layout: ${e.message}`,t):this.logger.warn(`Navigation layout: ${e.message}`,t)}}async initializeApplication(e){if(this.isInitialized&&this.services)return this.services;if(this.initializationPromise)return this.initializationPromise;let t={...e};this.initializationPromise=this.performInitialization(t);try{this.services=await this.initializationPromise,this.isInitialized=!0;try{e.onInitialized&&e.onInitialized()}catch(e){this.logger.error(`Failed to fire onInitialized callback`,{error:Ca(e)})}return this.services}catch(e){throw this.initializationPromise=null,e}}async performInitialization(e){let{config:t,autoAuth:n=!0,preloadResources:r=[],onError:i,customShared_ResourcesConfigurationsFactoryMap:a,customShared_ResourceFieldIdentifier:o,customShared_ResourcesRelationships:s,componentLoader:c}=e,u=`startup preparation`,d;this.logger||(this.logger=Jo.getLogger(),this.logDebug=this.logger.debugByType(`StartApplicationFrontendService`),this.logger.setDebugTypeLogging(`StartApplicationFrontendService`,!1)),this.logger.info(`Starting application initialization...`,{autoAuth:n}),this.logDebug(`Frontend initialization started with config`,{apiBaseUrl:t.apiBaseUrl,autoAuth:n});try{u=`http client initialization`,this.logDebug(`Initializing HTTP client...`);let n=new ca({baseURL:t.apiBaseUrl});u=`manual backend client setup`,this.logDebug(`Fetching application configuration from backend...`);let i=new jr({baseURL:t.apiBaseUrl});try{u=`environment configuration loading`,d=va.loadEnvironmentConfig(),this.logDebug(`Environment configuration loaded`,{frontendServiceName:d.frontendServiceName,apiBaseUrl:d.apiBaseUrl,appName:d.appName})}catch(e){throw this.logger.error(`Failed to load environment configuration`,{error:e.message}),Error(`Environment configuration failed: ${e.message}`)}let f,p;try{u=`backend application configuration fetch`;let t=null;for(let n=1;n<=2;n++)try{let t=l.parse(await i.getApplicationConfig(d.frontendServiceName));p=nx({entries:t.frontendProviders,modules:e.frontendProviderModules,onDiagnostic:e=>{this.logger?.warn(`Frontend provider hydration diagnostic`,{kind:e.kind,providerRef:e.providerRef,message:e.message})}}),f=ql.parse(t);break}catch(e){if(t=e instanceof Error?e:Error(String(e)),n<2){let e=Math.min(2e3*2**(n-1),5e3);this.logDebug(`Config fetch attempt ${n}/2 failed, retrying after ${e}ms`,{error:t.message,attempt:n,totalAttempts:2}),await new Promise(t=>setTimeout(t,e))}else throw this.logger.error(`All 2 config fetch attempts failed`,{error:t.message,totalAttempts:2}),t}Mo(f.compliance.clientInstanceIdScope),this.logDebug(`Application configuration fetched successfully`,{hasAppIdentity:!!f.appIdentity,hasAppPreferences:!!f.appPreferences,hasRuntime:!!f.runtime,endpointsCount:Object.keys(f.runtime?.endPoints||{}).length}),this.logDebug(`Application configuration loaded from backend`,{appName:f.appIdentity?.appName,version:f.appIdentity?.version,hasAuth:!!f.auth,hasSocialOAuth2Providers:!!f.auth?.socialOAuth2Providers&&Object.keys(f.auth.socialOAuth2Providers).length>0,defaultLanguage:f.appPreferences?.languages?.defaultLanguage,enabledLanguages:f.appPreferences?.languages?.enabledLanguages,endpointsList:Object.keys(f.runtime?.endPoints||{}),frontendProvidersCount:p?.listAll().length??0})}catch(e){throw this.logger.error(`Failed to fetch application configuration from backend`,{error:e.message,frontendServiceName:d?.frontendServiceName,apiBaseUrl:t.apiBaseUrl}),Error(`Application configuration fetch failed: ${e.message}`)}u=`frontend configuration validation`;let m={...e.baseFrontendConfig};this.logDebug(`Using app-provided base frontend configuration`),e.frontendConfigOverrides&&(m=Zy(m,e.frontendConfigOverrides),this.logDebug(`Applied frontend config overrides`,{sections:Object.keys(e.frontendConfigOverrides)})),m=Fm.parse(m),this.reportNavigationLayoutDiagnostics(m.navigationLayout),this.logDebug(`Frontend configuration resolved`,{frontendServiceName:d.frontendServiceName,finalConfig:{hasNavigationLayout:!!m.navigationLayout,hasAppComponentsConfiguration:!!m.appComponentsConfiguration,hasDesignSystem:!!m.designSystemConfiguration,hasTypography:!!m.designSystemConfiguration?.typography}}),u=`frontend resource registry initialization`,this.logDebug(`Initializing resources repository...`);let h=new ZS(n);await h.initializeResources(a,o,s,e.excludedResourceTypes,e.resourceUIBehavior,e.notificationBadgeDefinitions);let g=h.getResourcesRegistry();if(u=`component preset registration`,await c(),va.isDevelopment()&&(u=`development launcher verification`,ny(ty(g,m,e=>wo.hasComponentType(e),{organizationRoles:f.organizationRoles})),uy(ly(Kv(m?.settingsHub),qv(m?.settingsHub),Gv(m?.settingsHub))),e.featureConfiguration)){let t=_be({resourcesRegistry:g,appConfig:m,featureConfiguration:e.featureConfiguration,isComponentRegistered:e=>wo.hasComponentType(e)});t.isValid||this.logger.warn(`Invalid frontend feature references detected:\n${t.warnings.map(e=>` ⚠ ${e}`).join(`
|
|
23
|
-
`)}`)}r.length>0&&(u=`resource preload`,await this.preloadResources(r)),u=`frontend provider SDK activation`;let _=p??nx(),v=await qb({surface:Jc.SAAS_APP,modules:_.listAll().filter(e=>Lb(e).length===0),onDiagnostic:e=>{this.logger?.warn(`Frontend provider SDK activation diagnostic`,{kind:e.kind,providerRef:e.providerRef,message:e.message})}});u=`frontend error-monitoring bridge`,Tbe({modules:_.listAll(),activations:v.activations,onDiagnostic:e=>{this.logger?.warn(`Frontend error-monitoring bridge diagnostic`,{kind:e.kind,providerRef:e.providerRef,message:e.message})}});let y=e=>{this.logger?.warn(`Provider component diagnostic`,{kind:e.kind,capability:e.capability,providerRef:e.providerRef,message:e.message})},b=Ice(_.listAll(),{contributedLoaders:lx(),onDiagnostic:y}),x=Pce({registrations:b,onDiagnostic:y});u=`frontend provider script loading`;let S=Lce(_.listAll(),b);S.length>0&&Xb(S,document).then(e=>{for(let t of e.failed)this.logger?.warn(`Frontend provider script diagnostic`,{providerRef:t.providerRef,src:t.src,message:t.message})});let C={logger:this.logger,httpClient:n,resourceRepository:h,resourcesRegistry:g,appConfigFromBackend:f,frontendProviderRegistry:_,frontendProviderSdks:v,providerComponentRegistry:x,frontendConfiguration:m};return this.logger.info(`Application initialization completed successfully`),C}catch(e){let n=Dbe(e,{phase:u,apiBaseUrl:t.apiBaseUrl,frontendServiceName:d?.frontendServiceName});throw this.logger?this.logger.error(`Application initialization failed`,{error:n.message,stack:n.stack,phase:u,apiBaseUrl:t.apiBaseUrl,frontendServiceName:d?.frontendServiceName,initializationDiagnostics:n.initializationDiagnostics}):console.error(`Application initialization failed:`,n),i&&i(n),n}}getServices(){return this.services}isApplicationInitialized(){return this.isInitialized}reset(){this.services=null,this.isInitialized=!1,this.initializationPromise=null}async preloadResources(e){if(this.logger){this.logger.info(`Preloading resources...`,{resourceCount:e.length});try{await Promise.all(e.map(async e=>{this.logger.debug(`Preloading resource: ${e}`)})),this.logger.info(`Resource preloading completed successfully`)}catch(e){this.logger.warn(`Resource preloading failed`,{error:e.message})}}}},d$=typeof globalThis<`u`?globalThis:window;d$.__START_APPLICATION_FRONTEND_SERVICE__||=new u$;var f$=d$.__START_APPLICATION_FRONTEND_SERVICE__,Obe=G(J.LOW_LEVEL_CELEBRATION_OVERLAY,`CelebrationOverlay`),p$=({preset:e=q.DEFAULT})=>{let{celebration:t,dismissCelebration:n}=qm(),{tComponent:r,isReady:i}=K({component:J.LOW_LEVEL_CELEBRATION_OVERLAY}),a=r(J.LOW_LEVEL_CELEBRATION_OVERLAY,`dismiss`),o=r(J.LOW_LEVEL_CELEBRATION_OVERLAY,`ariaLabel`),s=Obe(e);return!i&&!t.isActive?null:(0,$.jsx)(s,{isActive:t.isActive,mode:t.mode?.mode,message:t.message,heading:t.heading,notificationIdentifier:t.notificationIdentifier,nextStep:t.nextStep,onDismiss:n,dismissLabel:a,ariaLabel:o})};p$.displayName=`AppCelebrationOverlay`;function m$({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_TOAST,`Toaster`)(e);return(0,$.jsx)(n,{...t})}var h$=({children:e})=>{let{registry:t}=wm(),{compositeViews:n,fullCustomViews:r,flowsActorsViews:i}=e_(),a=(0,Q.useMemo)(()=>g$({registry:t,compositeViews:n,fullCustomViews:r,flowsActorsViews:i}),[t,n,r,i]);return(0,$.jsx)(Ef,{customRegistry:a,children:e})};function g$(e){let{registry:t,compositeViews:n,fullCustomViews:r,flowsActorsViews:i}=e,a=new Map,o=new Map,s=new Map,c=new Map;if(t?.resourceConfigurations)for(let[e,n]of Object.entries(t.resourceConfigurations)){let t=n.frontendConfiguration?.icon,r=_$(t);r&&a.set(e,r);let i=n.frontendConfiguration?.compositeViews??[];for(let e of i){let t=_$(e.icon);t&&s.set(e.ref,t)}let l=n.frontendConfiguration?.executionViews??[];for(let e of l){let t=_$(e.icon);t&&c.set(`view-execution-${e.ref}`,t)}let u=n.frontendConfiguration?.chartViews??[];for(let e of u){let t=_$(e.icon);t&&c.set(`view-chart-${e.ref}`,t)}let d=Array.isArray(n.operations)?n.operations:[];for(let t of d){let n=t.operationFrontendConfig?.iconOverride,r=_$(n);if(!r)continue;let i=`${e}:${String(t.operationIdentifier)}`;o.set(i,r)}}for(let e of n??[]){let t=_$(e.icon);t&&s.set(e.ref,t)}for(let e of r??[]){let t=_$(e.icon);t&&c.set(`view-custom-${e.ref}`,t)}for(let e of i??[]){let t=_$(e.icon);t&&c.set(`view-flows-${e.ref}`,t)}return{resources:a,operationResources:o,compositeView:s,custom:c}}function _$(e){if(e)return typeof e==`string`?kf.standard.get(e):{icon:e}}var kbe=2e3,v$=new Map;function y$(e,t){let n=us(t.badgeReference);n&&v$.set(n,t.badgeCount),e(hc.BADGE_COUNT_CHANGED,t)}function b$(){v$.clear()}function x$(){let e=lm(),t=e?.currentUserId??null,n=e?.currentOrganizationId??null,r=(0,Q.useRef)({userId:t,organizationId:n});return(0,Q.useEffect)(()=>{let e=r.current;r.current={userId:t,organizationId:n};let i=e.userId!==null&&e.userId!==t,a=e.organizationId!==null&&e.organizationId!==n;(i||a)&&b$()},[t,n]),null}var S$=()=>{let{on:e}=vo(),[t,n]=(0,Q.useState)(()=>Object.fromEntries(v$)),[r,i]=(0,Q.useState)({}),a=(0,Q.useRef)(Object.fromEntries(v$));return(0,Q.useEffect)(()=>e(hc.BADGE_COUNT_CHANGED,e=>{let t=us(e.badgeReference);if(!t)return;let r=a.current[t]??0;a.current[t]=e.badgeCount,n(n=>({...n,[t]:e.badgeCount})),e.badgeCount>r&&(i(e=>({...e,[t]:!0})),setTimeout(()=>{i(e=>({...e,[t]:!1}))},kbe))}),[e]),{getBadgeState:(0,Q.useCallback)(e=>{let n=Os(e),i=t[n]??0,a=!1;switch(e.display.pulse){case Po.WHILE_ACTIVE:a=i>0;break;case Po.ON_INCREASE:a=!!r[n];break;case Po.NONE:default:a=!1}return{count:i,pulse:a}},[t,r])}},C$=()=>{let{on:e,isConnected:t}=Sp(),n=vo(),{getResourcesRegistry:r}=wm(),i=(0,Q.useMemo)(()=>r(),[r]),a=(0,Q.useMemo)(()=>new aY(i),[i]);return(0,Q.useEffect)(()=>{if(!t)return;let r=e=>{switch(e){case Xt.CREATED:return ia.SUCCESS;case Xt.UPDATED:return ia.INFO;case Xt.DELETED:return ia.WARNING;default:return ia.INFO}},o=e=>{let t=i.resourceConfigurations[e.resourceType]?.operations??[];if(e.operationPathKey){let n=t.find(t=>{try{return gl.createOperationPathKeyFromOperation(t)===e.operationPathKey}catch{return!1}});if(n)return n}let n=t.filter(t=>String(t.operationIdentifier)===e.operationIdentifier&&(e.variantType==null||t.variantType===e.variantType)&&(e.variantKey==null||t.variantKey===e.variantKey)&&(e.isBulkOperation==null||t.isBulkOperation===!0===e.isBulkOperation)&&(e.isOperationDefault==null||!!t.isOperationDefault===e.isOperationDefault));return n.length===1?n[0]:(n.length>1&&console.warn(`[WebSocketEventBridge] Ambiguous operation identity in notification payload; emitting minimal operation context.`,{resourceType:e.resourceType,operationIdentifier:e.operationIdentifier,variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation,candidateVariants:n.map(e=>({variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation}))}),{operationIdentifier:e.operationIdentifier,variantType:e.variantType,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation,variantKey:e.variantKey})},s=(e,t)=>fy(e,t,i),c=({resourceType:e,resourceIds:t,contextResourceIdentifiers:r,previousContextResourceIdentifiers:a,shouldEmitReadRefresh:o,relaysRowDeletion:c=!1})=>{let l=i.resourceConfigurations[e],u=s(e,r),d=a?s(e,a):void 0,f=py({resourceType:e,registry:i,scopes:d?{contextResourceIdentifiers:u,previousContextResourceIdentifiers:d}:{contextResourceIdentifiers:u}}),p=f.length>0?f:[null],m=gn.buildParentResourcesRequirements(e,u,i);for(let t of p)n.emit(hc.RESOURCE_REFRESH,{resourceType:e,operationIdentifier:String(t?.operationIdentifier??W.LIST),variantType:t?.variantType,isOperationDefault:t?.isOperationDefault??!0,isBulkOperation:t?.isBulkOperation??!1,variantKey:t?.variantKey,contextResourceIdentifiers:u,parentResourcesRequirements:m,operation:t??{operationIdentifier:W.LIST},...d?{previousContextResourceIdentifiers:d}:{},...c?{relaysRowDeletion:!0}:{}});let h=Array.from(new Set((t??[]).filter(e=>typeof e==`string`&&e.length>0)));if(!o||h.length===0)return;let g=Aa(l?.operations??[],W.READ,{requireAddressable:!0}),_=new Set;for(let t of h){let r={...u,[e]:t},a=V.buildContextualParameters(r,i),o=gn.buildParentResourcesRequirements(e,r,i),s=g.filter(e=>!l||ih({resourceConfig:l,operation:e,registry:i,hasResourceId:!0,contextResourceIdentifiers:r,contextualParameters:a})),d=s.length>0?s:[null];for(let i of d){let a=i??{operationIdentifier:W.READ},s=[t,String(a.operationIdentifier),a.variantType??``,a.variantKey??``,a.isBulkOperation??!1].join(`:`);_.has(s)||(_.add(s),n.emit(hc.RESOURCE_REFRESH,{resourceType:e,operationIdentifier:String(a.operationIdentifier??W.READ),variantType:i?.variantType,isOperationDefault:i?.isOperationDefault??!0,isBulkOperation:i?.isBulkOperation??!1,variantKey:i?.variantKey,contextResourceIdentifiers:r,parentResourcesRequirements:o,operation:a,...c?{relaysRowDeletion:!0}:{}}))}}},l=e(mi.RESOURCE_NOTIFICATION,e=>{let t=o({resourceType:e.resourceType,operationIdentifier:e.operationIdentifier,operationPathKey:e.operationPathKey,variantType:e.variantType,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation,variantKey:e.variantKey}),i={serverNotification:e.deliveryPolicy,resourceType:e.resourceType,operationIdentifier:e.operationIdentifier,variantType:t.variantType??e.variantType,isOperationDefault:t.isOperationDefault??e.isOperationDefault,isBulkOperation:t.isBulkOperation??e.isBulkOperation,variantKey:typeof t.variantKey==`string`?t.variantKey:e.variantKey,contextResourceIdentifiers:e.contextResourceIdentifiers??{},parentResourcesRequirements:[],operation:t,additionalContext:{notificationIdentifier:e.notificationIdentifier,action:e.action,frontendDisplayHints:e.frontendDisplayHints,...e.isBulkOperation?{affectedCount:e.affectedIds.length}:{}},resultSummary:e.contextResourceIdentifiers?{...e.contextResourceIdentifiers}:void 0},a=e.notificationLevel??r(e.action);switch(a!==ia.ERROR&&c({resourceType:e.resourceType,resourceIds:e.affectedIds,contextResourceIdentifiers:e.contextResourceIdentifiers??{},previousContextResourceIdentifiers:e.previousContextResourceIdentifiers,shouldEmitReadRefresh:e.affectedIds.length>0&&!(e.isBulkOperation??!1)}),a){case ia.SUCCESS:n.emit(hc.NOTIFY_RESOURCE_SUCCESS,i);break;case ia.WARNING:n.emit(hc.NOTIFY_RESOURCE_WARNING,i);break;case ia.ERROR:n.emit(hc.NOTIFY_RESOURCE_ERROR,i);break;case ia.INFO:default:n.emit(hc.NOTIFY_RESOURCE_INFO,i)}}),u=e(mi.RESOURCE_UPDATED,e=>{c({resourceType:e.resourceType,resourceIds:e.deliveryTarget===Lt.SCOPE_ROOM_NOTIFICATION?e.affectedIds??[]:[e.resourceId],contextResourceIdentifiers:e.contextResourceIdentifiers??{},previousContextResourceIdentifiers:e.previousContextResourceIdentifiers,shouldEmitReadRefresh:e.deliveryTarget===Lt.SCOPE_ROOM_NOTIFICATION?(e.affectedIds?.length??0)>0:!!e.resourceId})}),d=e(mi.RESOURCE_DELETED,e=>{c({resourceType:e.resourceType,resourceIds:[e.resourceId],contextResourceIdentifiers:e.contextResourceIdentifiers??{},previousContextResourceIdentifiers:e.previousContextResourceIdentifiers,shouldEmitReadRefresh:!!e.resourceId,relaysRowDeletion:!0})}),f=e(mi.BADGE_UPDATE,e=>{let t={badgeReference:e.badgeReference,badgeCount:e.badgeCount};y$(n.emit,t)}),p=e(mi.BULK_JOB_PROGRESS,e=>{n.emit(hc.BULK_JOB_PROGRESS,{jobId:e.jobId,resourceType:e.resourceType,operationIdentifier:e.operationIdentifier,attemptedCount:e.attemptedCount,processedCount:e.processedCount,failedCount:e.failedCount,finished:e.finished,...e.failures?{failures:e.failures}:{}})}),m=e(mi.RESOURCE_EDITING_START,e=>{if(e.initiatorUserId){let t={resourceType:e.resourceType,resourceId:e.resourceId,userId:e.initiatorUserId,timestamp:e.timestamp};n.emit(hc.RESOURCE_EDITING_START,t)}}),h=e(mi.RESOURCE_EDITING_END,e=>{if(e.initiatorUserId){let t={resourceType:e.resourceType,resourceId:e.resourceId,userId:e.initiatorUserId,timestamp:e.timestamp};n.emit(hc.RESOURCE_EDITING_END,t)}}),g=e(mi.RESOURCE_CUSTOM,e=>{let t=e.resourceData;if(e.resourceData&&typeof e.resourceData==`object`&&!Array.isArray(e.resourceData))try{t=a.validateWebSocketResourceData(e.resourceData,{resourceType:e.resourceType,operationIdentifier:void 0,dataMode:e.dataMode})}catch(n){console.warn(`[WebSocketEventBridge] Resource data validation failed:`,n),t=e.resourceData}let r={resourceType:e.resourceType,resourceId:e.resourceId,eventName:e.eventName,data:e.data,resourceData:t,dataMode:e.dataMode,userId:e.initiatorUserId,timestamp:e.timestamp};n.emit(hc.RESOURCE_CUSTOM_EVENT,r)}),_=e(mi.USER_NOTIFICATION,e=>{let t={identifier:e.identifier??``,data:{...e.data,_backendNotification:!0,displayTarget:e.displayTarget,message:e.message,title:e.title,organizationId:e.organizationId,destination:e.destination}};switch(e.notificationLevel){case ia.INFO:n.emit(hc.NOTIFY_CUSTOM_INFO,t);break;case ia.SUCCESS:n.emit(hc.NOTIFY_CUSTOM_SUCCESS,t);break;case ia.WARNING:n.emit(hc.NOTIFY_CUSTOM_WARNING,t);break;case ia.ERROR:n.emit(hc.NOTIFY_CUSTOM_ERROR,t);break;default:n.emit(hc.NOTIFY_CUSTOM_INFO,t)}}),v=e(mi.ANALYTICS_MOMENT_ACHIEVED,e=>{let t={momentIdentifier:e.momentIdentifier,role:e.role,scope:e.scope,triggerSource:tc.BACKEND};n.emit(hc.ANALYTICS_MOMENT_ACHIEVED,t)}),y=e(mi.GUIDANCE_STATE_CHANGED,e=>{let t={flowRef:e.flowRef,triggerSource:e.triggerSource,scope:e.scope,renderMode:e.renderMode};switch(e.status){case go.IN_PROGRESS:n.emit(hc.GUIDANCE_FLOW_ACTIVATED,t);break;case go.COMPLETED:n.emit(hc.GUIDANCE_FLOW_COMPLETED,t);break;case go.DISMISSED:n.emit(hc.GUIDANCE_FLOW_DISMISSED,t)}}),b=e(mi.MILESTONE_ACHIEVED,e=>{let t={milestoneRef:e.milestoneRef,category:e.category,points:e.points,achievedAt:e.achievedAt,scope:e.scope,reward:e.reward,lifecycleTransition:e.lifecycleTransition,totalPoints:e.totalPoints};n.emit(hc.MILESTONE_ACHIEVED,t)}),x=e(mi.PROGRESSION_UPDATED,e=>{let t={scope:e.scope,operationCounts:e.operationCounts,totalPoints:e.totalPoints,updatedAt:e.updatedAt};n.emit(hc.PROGRESSION_UPDATED,t)}),S=e(mi.LIFECYCLE_STAGE_CHANGED,e=>{let t={previousStage:e.previousStage,newStage:e.newStage,scope:e.scope,trigger:e.trigger,changedAt:e.changedAt,activationCriteriaMet:e.activationCriteriaMet};n.emit(hc.LIFECYCLE_STAGE_CHANGED,t)});return()=>{l(),u(),d(),f(),p(),m(),h(),g(),_(),v(),y(),b(),x(),S()}},[t,e,n,i,a]),null},w$=`wildo:connectivity-status`,Abe=3e3,jbe={connectionReconnectingNotice:`Connection lost — reconnecting…`,connectionLostNotice:`Connection lost. Please check your network and reload the page.`},T$=e=>e===dm.RECONNECTING||e===dm.ERROR,E$=()=>{let{status:e}=Sp(),{showPersistentToast:t,dismissPersistentToast:n}=qm(),{tComponent:r,isReady:i}=K({component:J.APPLICATION_LEVEL_STATUS_BAR}),a=(0,Q.useRef)(r);a.current=r;let o=(0,Q.useRef)(t);o.current=t;let s=(0,Q.useRef)(n);s.current=n;let c=(0,Q.useRef)(e);c.current=e;let l=(0,Q.useRef)(null),u=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{T$(c.current)||s.current(w$)},[]),(0,Q.useEffect)(()=>{let t=()=>{l.current&&=(clearTimeout(l.current),null)},n=()=>{let e=c.current===dm.ERROR,t=e?`connectionLostNotice`:`connectionReconnectingNotice`,n=a.current(J.APPLICATION_LEVEL_STATUS_BAR,t),r=n.startsWith(`components.`)?jbe[t]:n;o.current(w$,e?`error`:`loading`,r),u.current=!0};T$(e)?i&&(u.current?n():l.current||=setTimeout(()=>{l.current=null,n()},Abe)):(t(),u.current&&=(s.current(w$),!1))},[e,i]),(0,Q.useEffect)(()=>()=>{l.current&&=(clearTimeout(l.current),null),u.current&&=(s.current(w$),!1)},[]),null},D$=class{name=Go.CONSOLE;async initialize(){console.log(`[Analytics:Console] Initialized`)}identify(e){console.log(`[Analytics:Console] Identify:`,e)}track(e){console.log(`[Analytics:Console] Track: ${e.name}`,e.properties)}page(e,t){console.log(`[Analytics:Console] Page: ${e}`,t)}reset(){console.log(`[Analytics:Console] Reset`)}discard(){}async shutdown(){console.log(`[Analytics:Console] Shutdown`)}},Mbe=50,Nbe=1e4,Pbe=20,O$=class{name=Go.BACKEND_PROXY;buffer=[];flushInterval=null;httpClient;identity=null;generation=0;constructor(e){this.httpClient=e}async initialize(e){let t=e?.flushIntervalMs??Nbe;this.flushInterval=setInterval(()=>this.flush(),t)}identify(e){this.identity!==null&&this.identity.userId!==e.userId&&(this.buffer=[],this.generation+=1),this.identity=e}track(e){this.buffer.push({...e,timestamp:e.timestamp??Date.now()}),this.buffer.length>=Pbe&&this.flush()}page(e,t){this.track({name:pc.PAGE_VIEW,properties:{path:e,...t}})}reset(){let e=this.buffer,t=this.identity,n=this.credentialOf(t);this.generation+=1,this.buffer=[],this.identity=null,e.length!==0&&n!==null&&this.httpClient.postAnalyticsEvents({events:e},{sessionBoundCredential:n,silent:!0}).catch(()=>{})}credentialOf(e){let t=this.httpClient.getAuthToken();if(!t||!e)return null;try{return loe(t).userId===e.userId?t:null}catch{return null}}discard(){this.buffer=[],this.generation+=1}async shutdown(){this.flushInterval&&=(clearInterval(this.flushInterval),null),await this.flush()}async flush(){if(this.buffer.length===0)return;let e=this.credentialOf(this.identity);if(this.identity!==null&&e===null){this.buffer=this.buffer.slice(-50);return}let t=[...this.buffer],n=this.generation;this.buffer=[];try{await this.httpClient.postAnalyticsEvents({events:t},e===null?{silent:!0}:{sessionBoundCredential:e,silent:!0})}catch{if(n!==this.generation)return;this.buffer=[...t.slice(-50),...this.buffer].slice(0,Mbe)}}},Fbe={[Go.CONSOLE]:()=>new D$,[Go.BACKEND_PROXY]:e=>new O$(e)},k$=class{resolveFromConfig(e,t){return e.map(e=>Fbe[e.providerType](t,e.config))}},Ibe={current:null};function A$(){return(0,Q.useContext)(j$)||{track:()=>{},page:()=>{},isActive:!1,sessionStartTimestamp:Date.now(),achievedMoments:new Set,markMomentAchieved:()=>!1,_onTrackRef:Ibe}}var Lbe=({config:e,valueMoments:t,identity:n,progress:r})=>{let{track:i,page:a,isActive:o,sessionStartTimestamp:s,achievedMoments:c,markMomentAchieved:l,_onTrackRef:u}=A$(),{on:d,emit:f}=vo(),p=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]);let m=(0,Q.useRef)(r.signals),h=(0,Q.useRef)(r.completed),g=(0,Q.useRef)(r.counts),_=(0,Q.useRef)(r.lastFired),v=(0,Q.useRef)(new Map),y=(0,Q.useRef)(i);(0,Q.useEffect)(()=>{y.current=i},[i]);let b=(0,Q.useRef)(l);(0,Q.useEffect)(()=>{b.current=l},[l]);let x=(0,Q.useMemo)(()=>t??[],[t]),S=(0,Q.useCallback)(e=>JSON.stringify([n.applicationId,e.scope,e.scope===un.ORGANIZATION?n.organizationId:n.userId,e]),[n.applicationId,n.userId,n.organizationId]),C=(0,Q.useCallback)(e=>{if((e.scope===un.ORGANIZATION?!n.organizationId:!n.userId)||e.role!==yt.ANTI_PATTERN&&(c.has(e.identifier)||h.current.has(S(e)))||e.requires?.length&&!e.requires.every(e=>c.has(e))||e.beforeStage?.length&&e.beforeStage.some(e=>c.has(e)))return!1;if(e.role===yt.ANTI_PATTERN){let t=e.cooldownMs??3e5,n=_.current.get(S(e));if(n&&Date.now()-n<t)return!1}return!0},[c,n,S]),w=(0,Q.useCallback)((e,t)=>{if(!p.current||!C(e))return;let n=e.identifier,r=S(e);m.current.has(r)||m.current.set(r,new Set);let i=m.current.get(r);if(i.add(t),e.mode!==Wr.ANY&&i.size!==e.signals.length)return;e.role!==yt.ANTI_PATTERN&&h.current.add(r);let a=()=>{if(!p.current)return;let r=e.role===yt.ANTI_PATTERN?yt.ANTI_PATTERN:nee;y.current(`${r}.${n}`,{signalIndex:e.mode===Wr.ANY?t:void 0,signalType:e.mode===Wr.ANY?e.signals[t].signalType:wr,elapsedMs:Date.now()-s,role:e.role,scope:e.scope}),e.onAchieved?.frontendEvent&&f(hc.ANALYTICS_MOMENT_ACHIEVED,{momentIdentifier:n,role:e.role,scope:e.scope??un.USER,triggerSource:tc.FRONTEND})};e.role===yt.ANTI_PATTERN?(_.current.set(r,Date.now()),a()):Promise.resolve(b.current(n)).then(e=>{e?a():h.current.delete(r)})},[C,s,f,S]),T=(0,Q.useCallback)((e,t)=>t?e?Object.entries(t).every(([t,n])=>e[t]===n):!1:!0,[]);return(0,Q.useEffect)(()=>{if(!o)return;let e=lc();for(let t of x)C(t)&&t.signals.forEach((n,r)=>{if(n.signalType!==ir.RESOURCE_STATE)return;let i=JSON.stringify(n.filter||{}),a=`${n.resourceType}:${i}`;e.get(`${rt}/resources/${n.resourceType}`,{params:{limit:1,filter:n.filter}}).then(e=>{if(!p.current)return;let i=e.totalCount??0;v.current.set(a,i),i>=n.threshold&&w(t,r)}).catch(()=>{})})},[o,x]),(0,Q.useEffect)(()=>{if(!o)return;let e=lc(),t=()=>{if(document.visibilityState===`visible`)for(let t of x)C(t)&&t.signals.forEach((n,r)=>{if(n.signalType!==ir.RESOURCE_STATE)return;let i=JSON.stringify(n.filter||{}),a=`${n.resourceType}:${i}`;e.get(`${rt}/resources/${n.resourceType}`,{params:{limit:1,filter:n.filter}}).then(e=>{if(!p.current)return;let i=e.totalCount??0;v.current.set(a,i),i>=n.threshold&&w(t,r)}).catch(()=>{})})};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[o,x]),(0,Q.useEffect)(()=>{if(o)return d(hc.NAVIGATION_ZONE_CHANGED,t=>{if(e?.pageViews&&a(window.location.pathname,{contentType:t.currentContent?.contentType,zone:t.zone,stackDepth:t.stackDepth}),t.currentContent){let e=t.currentContent;for(let t of x)t.signals.forEach((n,r)=>{n.signalType===ir.VIEW_VISIT&&e.contentType===n.contentType&&(!n.viewRef||`viewRef`in e&&e.viewRef===n.viewRef)&&w(t,r)})}})},[o,e?.pageViews,x,d,a,w]),(0,Q.useEffect)(()=>{if(o)return d(hc.NOTIFY_RESOURCE_SUCCESS,t=>{e?.resourceOperations&&i(pc.RESOURCE_OPERATION,{resourceType:t.resourceType,operation:t.operationIdentifier});let n=t.resultSummary;for(let e of x)e.signals.forEach((r,i)=>{if(r.signalType===ir.RESOURCE_OPERATION&&t.resourceType===r.resourceType&&t.operationIdentifier===r.operation&&T(n,r.filter)&&p.current&&C(e)){if(r.threshold&&r.threshold>1){let t=JSON.stringify([S(e),i]),n=(g.current.get(t)??0)+1;if(g.current.set(t,n),n<r.threshold)return}w(e,i)}});let r=lc();for(let e of x)for(let n of e.signals){if(n.signalType!==ir.RESOURCE_STATE||t.resourceType!==n.resourceType)continue;let i=JSON.stringify(n.filter||{}),a=`${n.resourceType}:${i}`;r.get(`${rt}/resources/${n.resourceType}`,{params:{limit:1,filter:n.filter}}).then(t=>{if(!p.current)return;let r=t.totalCount??0;v.current.set(a,r),r>=n.threshold&&w(e,e.signals.indexOf(n))}).catch(()=>{})}})},[o,e?.resourceOperations,x,d,i,w,T,C,S]),(0,Q.useEffect)(()=>{if(o&&e?.trackErrors)return d(hc.ERROR_OCCURED,e=>{i(pc.ERROR,{errorType:e.error?.type,errorSeverity:e.error?.severity})})},[o,e?.trackErrors,d,i]),(0,Q.useEffect)(()=>{if(!o||!e?.userLifecycle)return;let t=[d(hc.USER_STATUS_CHANGED,e=>i(pc.USER_STATUS_CHANGED,{newStatus:e.newStatus,oldStatus:e.oldStatus}))];return()=>t.forEach(e=>e())},[o,e?.userLifecycle,d,i]),(0,Q.useEffect)(()=>{if(!o||!e?.notifications)return;let t=[d(hc.NOTIFY_CUSTOM_INFO,e=>i(pc.NOTIFICATION,{level:Fn.INFO,identifier:e.identifier})),d(hc.NOTIFY_CUSTOM_SUCCESS,e=>i(pc.NOTIFICATION,{level:Fn.SUCCESS,identifier:e.identifier})),d(hc.NOTIFY_CUSTOM_WARNING,e=>i(pc.NOTIFICATION,{level:Fn.WARNING,identifier:e.identifier})),d(hc.NOTIFY_CUSTOM_ERROR,e=>i(pc.NOTIFICATION,{level:Fn.ERROR,identifier:e.identifier}))];return()=>t.forEach(e=>e())},[o,e?.notifications,d,i]),(0,Q.useEffect)(()=>{if(!o||!e?.hotkeys)return;let t=[d(hc.HOTKEY_COMMAND_MENU_OPEN,()=>i(pc.HOTKEY_USED,{key:D.COMMAND_MENU})),d(hc.HOTKEY_SIDEBAR_TOGGLE,()=>i(pc.HOTKEY_USED,{key:D.SIDEBAR_TOGGLE})),d(hc.HOTKEY_NOTIFICATIONS_OPEN,()=>i(pc.HOTKEY_USED,{key:D.NOTIFICATIONS})),d(hc.HOTKEY_QUICK_SWITCHER_OPEN,()=>i(pc.HOTKEY_USED,{key:D.QUICK_SWITCHER})),d(hc.HOTKEY_SHORTCUTS_HELP,()=>i(pc.HOTKEY_USED,{key:D.SHORTCUTS_HELP}))];return()=>t.forEach(e=>e())},[o,e?.hotkeys,d,i]),(0,Q.useEffect)(()=>{if(!o)return;let e=[d(hc.MILESTONE_ACHIEVED,e=>{i(`milestone_achieved`,{milestoneRef:e.milestoneRef,category:e.category,points:e.points,scope:e.scope})}),d(hc.LIFECYCLE_STAGE_CHANGED,e=>{i(`lifecycle_stage_changed`,{previousStage:e.previousStage,newStage:e.newStage,scope:e.scope,trigger:e.trigger})})];return()=>e.forEach(e=>e())},[o,d,i]),(0,Q.useEffect)(()=>{if(o)return u.current=(e,t)=>{for(let n of x)n.signals.forEach((r,i)=>{if(r.signalType===ir.CUSTOM_EVENT&&r.eventName===e){if(!p.current||!C(n))return;if(r.threshold&&r.threshold>1){let e=JSON.stringify([S(n),i]),t=(g.current.get(e)??0)+1;if(g.current.set(e,t),t<r.threshold)return}w(n,i)}r.signalType===ir.FEATURE_ACCESS&&e===pc.FEATURE_ACCESSED&&r.featureId===t?.featureId&&w(n,i)})},()=>{u.current=null}},[o,x,w,C,S,u]),null},j$=(0,Q.createContext)(null),M$=(0,Q.createContext)(null),Rbe=new k$,zbe=`signed_in_at`,N$=({children:e})=>{let t=(0,Q.useContext)(Mi),{on:n}=vo(),r=Im(Na.USER_PROGRESSION_STATE),i=(0,Q.useRef)([]),[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(Date.now()).current,c=(0,Q.useMemo)(()=>t?.appConfig?.analytics,[t?.appConfig?.analytics]),[l,u]=(0,Q.useState)(null),d=(0,Q.useMemo)(()=>l??[],[l]);(0,Q.useEffect)(()=>n(hc.USER_PREFERENCES_CHANGED,e=>{let t=()=>{S.current&&i.current.forEach(e=>e.discard())};if(e.privacy===null){t(),u([]);return}let n=e.privacy?.consentedPurposes;if(n!==void 0){let e=Hd(n);zd(e,[Kd.ANALYTICS])||t(),u(e)}}),[n]);let f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(0),h=(0,Q.useRef)(()=>{});(0,Q.useEffect)(()=>{if(!c?.enabled){o(!1);return}if(!(c.requiresConsent===!1||zd(d,[Kd.ANALYTICS]))){i.current.forEach(e=>e.reset()),o(!1);return}let e=!1,t=lc(),n=[...Rbe.resolveFromConfig(c.providers??[],t)];return Promise.all(n.map(e=>e.initialize(c.providers?.find(t=>t.providerType===e.name)?.config).catch(t=>{console.warn(`[Analytics] Failed to initialize provider "${e.name}":`,t)}))).then(()=>{if(e)return;i.current=n;let t=f.current;t!==null&&n.forEach(e=>e.identify({userId:t})),o(!0),m(e=>e+1)}),()=>{e=!0,n.forEach(e=>e.shutdown().catch(()=>{})),i.current=[]}},[c,d]);let g=zx(),_=(0,Q.useMemo)(()=>c?.enabled?g.filter(e=>e.providerCapabilities.includes(Id.FRONTEND_PRODUCT_ANALYTICS)).map(e=>e.activation.handle).filter(gse):[],[c?.enabled,g]),v=a||_.length>0,y=c?.autoInstrumentation?.userLifecycle===!0,b=(0,Q.useRef)(y);b.current=y;let x=c?.requiresConsent!==!1,S=(0,Q.useRef)(x);S.current=x;let C=(0,Q.useRef)(null),[w,T]=(0,Q.useState)(0),E=(0,Q.useCallback)(e=>{C.current=e,T(e=>e+1)},[]);(0,Q.useEffect)(()=>n(hc.USER_LOGIN,e=>{f.current=e.userId,i.current.forEach(t=>t.identify({userId:e.userId})),e.establishment===ac.SIGNED_IN&&E({occurredAt:Date.now(),decided:!S.current,owedToBuiltIns:!0,owedToVendorSinks:!0})}),[n,E]),(0,Q.useEffect)(()=>n(hc.USER_PREFERENCES_CHANGED,e=>{let t=C.current;if(t===null||!S.current||!e.privacy)return;let n=e.privacy.consentedPurposes;n!==void 0&&E(zd(Hd(n),[Kd.ANALYTICS])?{...t,decided:!0}:null)}),[n,E]),(0,Q.useEffect)(()=>n(hc.USER_LOGOUT,e=>{e.reason===P.SIGNED_OUT&&b.current&&h.current(pc.USER_LOGOUT),E(null),f.current=null,i.current.forEach(e=>e.reset())}),[n,E]);let[D,O]=(0,Q.useState)(null),k=(0,Q.useRef)(null),A=(0,Q.useCallback)(e=>{let t=Symbol();return k.current=t,O(e),()=>{k.current===t&&(k.current=null,O(null))}},[]),j=JSON.stringify(D),M=D?.userId??null;(0,Q.useEffect)(()=>{_.length!==0&&(M===null?_.forEach(e=>e.reset()):_.forEach(e=>e.identify({userId:M})))},[_,M]);let N=(0,Q.useRef)(j);N.current=j;let F=(0,Q.useRef)({signals:new Map,counts:new Map,lastFired:new Map,completed:new Set}),I=D?.userId?`${Ir}${JSON.stringify([D.applicationId,un.USER,D.userId])}`:null,ee=D?.organizationId?`${Ir}${JSON.stringify([D.applicationId,un.ORGANIZATION,D.organizationId])}`:null,L=JSON.stringify([I,ee]),R=(0,Q.useCallback)(e=>c?.valueMoments?.find(t=>t.identifier===e)?.scope===un.ORGANIZATION,[c?.valueMoments]),te=(0,Q.useCallback)(e=>c?.valueMoments?.find(t=>t.identifier===e)?.role!==yt.ANTI_PATTERN,[c?.valueMoments]),[z,B]=(0,Q.useState)({key:j,moments:new Set}),ne=(0,Q.useMemo)(()=>z.key===j?z.moments:new Set,[z,j]),re=(0,Q.useCallback)(e=>{B(t=>({key:j,moments:typeof e==`function`?e(t.key===j?t.moments:new Set):e}))},[j]),ie=(0,Q.useCallback)(e=>{try{I&&localStorage.setItem(I,JSON.stringify([...e].filter(e=>!R(e)))),ee&&localStorage.setItem(ee,JSON.stringify([...e].filter(R)))}catch{}},[I,ee,R]);(0,Q.useEffect)(()=>{if(re(new Set),c?.enabled&&D&&(D.userId||D.organizationId)){try{let e=new Set;for(let[t,n]of[[I,!1],[ee,!0]]){if(!t)continue;let r=localStorage.getItem(t);if(r)for(let t of JSON.parse(r))te(t)&&R(t)===n&&e.add(t)}re(e)}catch{}if(c?.persistence?.backendSync&&r){let e=!1;return lc().getAnalyticsMomentsAchieved().then(t=>{if(e||N.current!==j)return;let n=t;n.moments&&re(e=>{let t=new Set([...e,...n.moments].filter(te));return ie(t),t})}).catch(()=>{}),()=>{e=!0}}}},[c?.enabled,c?.persistence?.backendSync,r,L,j,ie,te,R]),(0,Q.useEffect)(()=>n(hc.ANALYTICS_MOMENT_ACHIEVED,e=>{D&&e.triggerSource!==tc.FRONTEND&&e.role!==yt.ANTI_PATTERN&&te(e.momentIdentifier)&&re(t=>{let n=new Set(t);return n.add(e.momentIdentifier),ie(n),n})}),[n,ie,j,te]);let ae=(0,Q.useCallback)(e=>{if(!D||!te(e))return!1;let t=c?.valueMoments?.find(t=>t.identifier===e);if(t?.requires?.some(e=>!ne.has(e))||t?.beforeStage?.some(e=>ne.has(e)))return!1;let n=()=>N.current===j&&(re(t=>{let n=new Set(t);return n.add(e),ie(n),n}),!0);return c?.persistence?.backendSync?lc().postAnalyticsMomentsAchieved({momentIdentifier:e,scope:t?.scope}).then(e=>e.success!==!1&&n()).catch(e=>{let t=e,r=t?.httpStatus??t?.response?.status;return r&&r>=400&&r<500?!1:n()}):n()},[c,ie,j,te,ne]),oe=(0,Q.useRef)(null),se=(0,Q.useCallback)((e,t)=>{if(!v)return;let n={name:e,properties:t,timestamp:Date.now()};a&&i.current.forEach(e=>e.track(n)),_.forEach(n=>n.track({name:e,properties:t})),oe.current?.(e,t)},[a,v,_]);h.current=se,(0,Q.useEffect)(()=>{let e=C.current;if(e===null||!e.decided||!y)return;let t={name:pc.USER_LOGIN,timestamp:e.occurredAt},n=e.owedToBuiltIns,r=e.owedToVendorSinks;n&&a&&i.current.length>0&&(i.current.forEach(e=>e.track(t)),n=!1),r&&_.length>0&&(_.forEach(n=>n.track({name:t.name,properties:{[zbe]:new Date(e.occurredAt).toISOString()}})),r=!1),(n!==e.owedToBuiltIns||r!==e.owedToVendorSinks)&&(C.current=n||r?{...e,owedToBuiltIns:n,owedToVendorSinks:r}:null)},[w,p,a,_,y]);let ce=(0,Q.useCallback)((e,t)=>{v&&(a&&i.current.forEach(n=>n.page(e,t)),_.forEach(n=>n.page(e,t)))},[a,v,_]),le=(0,Q.useMemo)(()=>({track:se,page:ce,isActive:v,sessionStartTimestamp:s,achievedMoments:ne,markMomentAchieved:ae,_onTrackRef:oe}),[se,ce,v,s,ne,ae]);return(0,$.jsx)(M$.Provider,{value:A,children:(0,$.jsxs)(j$.Provider,{value:le,children:[v&&D&&c&&(0,$.jsx)(Lbe,{identity:D,progress:F.current,config:c.autoInstrumentation,valueMoments:c.valueMoments},`${j}:${JSON.stringify(c.valueMoments)}`),e]})})};function Bbe(){let e=Mm(),t=(0,Q.useContext)(M$);return(0,Q.useLayoutEffect)(()=>t?.({userId:e.currentUserId,organizationId:e.currentOrganizationId,applicationId:e.currentApplicationId,anonymousUserId:e.currentAnonymousUserId}),[t,e.currentUserId,e.currentOrganizationId,e.currentApplicationId,e.currentAnonymousUserId]),null}var P$=Jo.getLogger(),F$=P$.debugByType(`ResourceReadCacheBridge`);P$.setDebugTypeLogging(`ResourceReadCacheBridge`,!1);var I$=`read-cache`,L$=`VITE_RESOURCE_READ_CACHE`,Vbe=`off`,Hbe=()=>{let{on:e,isConnected:t,connectionCount:n,claimResourceRoom:r,releaseResourceRoom:i}=Sp(),{getReadCache:a}=wm(),o=a();(0,Q.useEffect)(()=>{let e=va.readOptionalEnvironmentValue(L$)?.toLowerCase()===Vbe;o.setEnabled(!e),e&&P$.info(`Resource read cache disabled by environment`,{flag:L$})},[o]);let s=lm(),c=s?.currentOrganizationId??null,l=(0,Q.useContext)(Mi)?.appIdentity?.applicationId??s?.currentApplicationId??null,u=(0,Q.useRef)(new Set),d=(0,Q.useRef)(new Map),f=(0,Q.useRef)(new Map),p=(0,Q.useRef)(t);p.current=t;let m=(0,Q.useCallback)((e,t)=>{d.current.has(e)||(d.current.set(e,t),r({ownerKey:`${I$}:${e}`,resourceType:t.resourceType,scopeKey:t.scopeKey,scopeId:t.scopeId,contextResourceIdentifiers:{[`${t.scopeKey}Id`]:t.scopeId}}).then(n=>{d.current.get(e)===t&&(n?.success?(u.current.add(e),F$(`scope room confirmed`,{roomName:e})):(d.current.delete(e),F$(`scope room not confirmed; entries under it stay unservable`,{roomName:e})))}).catch(()=>{d.current.get(e)===t&&d.current.delete(e)}))},[r]),h=(0,Q.useRef)(m);h.current=m;let g=(0,Q.useCallback)(()=>{for(let[e,t]of d.current)i({ownerKey:`${I$}:${e}`,resourceType:t.resourceType,scopeKey:t.scopeKey,scopeId:t.scopeId,contextResourceIdentifiers:{[`${t.scopeKey}Id`]:t.scopeId}});d.current.clear(),u.current.clear(),f.current.clear()},[i]),_=(0,Q.useRef)(g);_.current=g,(0,Q.useEffect)(()=>{let e=o;return e.setCoverageAuthority({covers:(e,t)=>!p.current||t.length===0?!1:t.every(t=>u.current.has(An(e,t.scopeKey,t.scopeId))),requestCoverage:(e,t)=>{for(let n of t){let t=An(e,n.scopeKey,n.scopeId);d.current.has(t)||(p.current?h.current(t,{...n,resourceType:e}):(f.current.set(t,{...n,resourceType:e}),F$(`coverage deferred until the socket is up`,{roomName:t})))}}}),()=>{e.setCoverageAuthority(null),_.current()}},[o]),(0,Q.useEffect)(()=>{if(!t||f.current.size===0)return;let e=[...f.current.entries()];f.current.clear(),F$(`claiming coverage deferred during the connect window`,{rooms:e.length});for(let[t,n]of e)m(t,n)},[t,m]),(0,Q.useEffect)(()=>{o.setApplicationId(l)},[l,o]),(0,Q.useEffect)(()=>{o.setOrganizationId(c)},[c,o]);let v=(0,Q.useRef)(n);return(0,Q.useEffect)(()=>{let e=v.current;v.current=n,n<=1||n!==e&&(u.current.clear(),d.current.clear(),f.current.clear(),o.clear(),F$(`reconnected; coverage and cache reset`,{connectionCount:n}))},[n,o]),(0,Q.useEffect)(()=>{o.clear(),g(),F$(`organization scope changed; cache cleared`,{currentOrganizationId:c})},[c,o,g]),(0,Q.useEffect)(()=>{if(!t)return;let n=e(mi.RESOURCE_UPDATED,e=>{o.invalidateResourceType(e.resourceType),F$(`invalidated by resource update`,{resourceType:e.resourceType,deliveryTarget:e.deliveryTarget,isScopeRoom:e.deliveryTarget===Lt.SCOPE_ROOM_NOTIFICATION})}),r=e(mi.RESOURCE_DELETED,e=>{o.invalidateResourceType(e.resourceType)});return()=>{n(),r()}},[e,t,o]),null},R$;(function(e){e.CTRL=`ctrl`,e.ALT=`alt`,e.SHIFT=`shift`,e.META=`meta`,e.MOD=`mod`})(R$||={});function z$(){return typeof navigator<`u`&&navigator.platform.toLowerCase().includes(`mac`)}var B$=-100,V$={[L.COMPONENT]:2,[L.PAGE]:1,[L.GLOBAL]:0};function H$(e){return e.length===1&&!/[a-z0-9]/i.test(e)}function U$(e){let t=e.split(`+`).map(e=>e.trim().toLowerCase()),n=[],r=``;for(let e of t)switch(e){case`ctrl`:case`control`:n.push(R$.CTRL);break;case`alt`:case`option`:n.push(R$.ALT);break;case`shift`:n.push(R$.SHIFT);break;case`meta`:case`cmd`:case`command`:case`win`:case`windows`:n.push(R$.META);break;case`mod`:n.push(R$.MOD);break;default:r=e}H$(r)&&(n=n.filter(e=>e!==R$.SHIFT));let i=z$(),a=[];return n.includes(R$.MOD)&&a.push(i?`⌘`:`Ctrl`),n.includes(R$.CTRL)&&a.push(i?`⌃`:`Ctrl`),n.includes(R$.ALT)&&a.push(i?`⌥`:`Alt`),n.includes(R$.SHIFT)&&a.push(i?`⇧`:`Shift`),n.includes(R$.META)&&a.push(i?`⌘`:`Win`),a.push(r.toUpperCase()),{modifiers:n,key:r,chord:[...[...n].sort(),r].join(`+`),display:a.join(i?``:`+`)}}function W$(e,t){let n=e.ctrlKey,r=e.altKey,i=e.shiftKey,a=e.metaKey,o=t.modifiers.includes(R$.MOD),s=z$(),c=t.modifiers.includes(R$.CTRL)||o&&!s,l=t.modifiers.includes(R$.ALT),u=t.modifiers.includes(R$.SHIFT),d=t.modifiers.includes(R$.META)||o&&s;return n!==c||r!==l||!H$(t.key)&&i!==u||a!==d?!1:e.key.toLowerCase()===t.key}var G$=(0,Q.createContext)(null);function K$(e,t){return e===t||e===L.GLOBAL||t===L.GLOBAL}var q$=({children:e,initialScope:t=L.GLOBAL})=>{let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(!1),o=(0,Q.useRef)(new Map),[s,c]=(0,Q.useState)(0),l=(0,Q.useCallback)(e=>{let t=U$(e.shortcut),n=Array.from(o.current.values()).filter(n=>n.id!==e.id&&n.parsed.chord===t.chord&&K$(n.scope,e.scope));n.length>0&&console.warn(`[HotkeyRegistry] Duplicate shortcut "${e.shortcut}" detected. Precedence: priority, then scope specificity (component > page > global), then registration order. Declare \`priority\` on the one that should win, or give one of them a different chord.`,{incomingId:e.id,incomingPriority:e.priority??0,existing:n.map(e=>({id:e.id,priority:e.priority??0}))});let r={...e,enabled:e.enabled!==!1,preventDefault:e.preventDefault??!0,stopPropagation:e.stopPropagation??!1,parsed:t};return o.current.set(e.id,r),c(e=>e+1),()=>{o.current.delete(e.id),c(e=>e+1)}},[]),u=(0,Q.useCallback)(e=>{o.current.delete(e),c(e=>e+1)},[]),d=(0,Q.useCallback)((e,t)=>{let n=o.current.get(e);n&&(n.enabled=t,c(e=>e+1))},[]),f=(0,Q.useCallback)(()=>a(!0),[]),p=(0,Q.useCallback)(()=>a(!1),[]),m=(0,Q.useCallback)(()=>Array.from(o.current.values()),[]),h=(0,Q.useCallback)(e=>Array.from(o.current.values()).filter(t=>t.group===e),[]),g=(0,Q.useCallback)(()=>{let e=new Map;for(let t of o.current.values()){let n=t.parsed.chord,r=e.get(n)??[];r.push(t),e.set(n,r)}let t=[];for(let[n,r]of e.entries()){let e=r.filter(e=>r.some(t=>t.id!==e.id&&K$(t.scope,e.scope))).map(e=>e.id);e.length>1&&t.push({shortcut:n,hotkeyIds:e})}return t},[]);(0,Q.useEffect)(()=>{let e=e=>{if(i)return;let t=e.target,r=t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable;r&&t.closest(`[data-hotkey-passthrough]`)&&(r=!1);let a,s;for(let t of o.current.values()){if(!t.enabled||t.scope===L.PAGE&&n!==L.PAGE||t.scope===L.COMPONENT&&n!==L.COMPONENT||r&&t.scope!==L.GLOBAL||!W$(e,t.parsed))continue;let i=[t.priority??0,V$[t.scope]];(s===void 0||i[0]>s[0]||i[0]===s[0]&&i[1]>s[1])&&(a=t,s=i)}{let t=a;if(t){try{t.handler()}catch(e){console.error(`Hotkey handler error for ${t.id}:`,e)}t.preventDefault&&e.preventDefault(),t.stopPropagation&&e.stopPropagation()}}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[n,i]);let _=(0,Q.useMemo)(()=>({register:l,unregister:u,setEnabled:d,setActiveScope:r,pause:f,resume:p,getHotkeys:m,getHotkeysByGroup:h,getConflicts:g,activeScope:n,isPaused:i}),[l,u,d,f,p,m,h,g,n,i]);return(0,$.jsx)(G$.Provider,{value:_,children:e})};function J$(){let e=(0,Q.useContext)(G$);if(!e)throw Error(`useHotkeyRegistry must be used within a HotkeyRegistryProvider`);return e}var Y$=0;function Ube(e,t,n={}){let{register:r}=J$(),i=(0,Q.useMemo)(()=>n.id??`hotkey-${++Y$}`,[n.id]);return(0,Q.useEffect)(()=>{let a={id:i,shortcut:e,handler:t,description:n.description??e,scope:n.scope??L.GLOBAL,enabled:n.enabled!==!1,group:n.group,preventDefault:n.preventDefault};return r(a)},[i,e,t,n.description,n.scope,n.enabled,n.group,n.preventDefault,r]),(0,Q.useMemo)(()=>U$(e),[e])}function Wbe(e){let{register:t}=J$();(0,Q.useEffect)(()=>{let n=[];for(let r of e){let e={id:r.id??`hotkey-batch-${++Y$}`,shortcut:r.shortcut,handler:r.handler,description:r.description??r.shortcut,scope:r.scope??L.GLOBAL,enabled:r.enabled!==!1,group:r.group};n.push(t(e))}return()=>{for(let e of n)e()}},[e,t])}function Gbe(){let{pause:e,resume:t,isPaused:n}=J$();return{pause:e,resume:t,isPaused:n}}function Kbe(){let{activeScope:e,setActiveScope:t}=J$();return{activeScope:e,setActiveScope:t}}function X$(e,t){let n=new Map;for(let t of e)n.set(t.event,t);if(t)for(let e of t)n.set(e.event,e);let r=e.map(e=>n.get(e.event));for(let i of t??[])e.some(e=>e.event===i.event)||r.push(n.get(i.event));return r}function qbe(e,t){switch(e){case void 0:return!0;case td.USER_SELF:return!!t.currentUserId;case td.ORGANIZATIONS:return!!t.currentOrganizationId;case td.APPLICATION:return!!t.currentApplicationId;case td.ANONYMOUS:return!!t.currentAnonymousUserId}}function Jbe(e,t){return Jm(e,t)}function Ybe(e,t){if(!e)return!0;let n=Array.isArray(e)?e:e.features??[];return n.length===0?!0:(Array.isArray(e)?`OR`:e.mode??`OR`)===`OR`?n.some(e=>t.includes(e)):n.every(e=>t.includes(e))}function Xbe(e,t){return(e??[]).every(e=>t.includes(e))}function Zbe(e,t){return Xbe(e.requiredEngineCapabilities,t.enabledEngineCapabilities)&&MS(e.runtimeAvailability,t.runtimeContext)&&Jbe(e.requiredRoles,t.runtimeContext.effectiveRoles)&&Ybe(e.requiredFeatures,t.enabledFeatures)}function Qbe(e,t){if(e.target.kind!==Ov.SUB_TABS)return e;let n=e.target.subTabs.filter(e=>MS(e.runtimeAvailability,t.runtimeContext));return n.length===0?null:n.length===e.target.subTabs.length?e:{...e,target:{...e.target,subTabs:n}}}function $be(e,t){let n=e.categories.filter(e=>qbe(e.scope,t.scopeIds)),r=new Set(n.map(e=>e.ref)),i=e.sections.flatMap(e=>{if(!r.has(e.categoryRef)||!Zbe(e,t))return[];let n=Qbe(e,t);return n?[n]:[]}),a=new Set(i.map(e=>e.categoryRef));return{categories:n.filter(e=>a.has(e.ref)),sections:i,defaultSectionRef:e.defaultSectionRef&&i.some(t=>t.ref===e.defaultSectionRef)?e.defaultSectionRef:i[0]?.ref}}var exe=[];function Z$(){let e=Jv(),t=lm(),n=(0,Q.useContext)(Oh)?.resolvedFeatures,r=jS(),i=(0,Q.useContext)(Mi),a=i?.appIdentity?.applicationId??t?.currentApplicationId??null,o=i?.appConfig?.enabledEngineCapabilities??exe;return(0,Q.useMemo)(()=>$be(e,{scopeIds:{currentUserId:t?.currentUserId,currentOrganizationId:t?.currentOrganizationId,currentApplicationId:a,currentAnonymousUserId:t?.currentAnonymousUserId},enabledFeatures:n?.features??[],runtimeContext:r,enabledEngineCapabilities:o}),[e,t?.currentUserId,t?.currentOrganizationId,a,t?.currentAnonymousUserId,n?.features,r,o])}var txe=Object.values(Cl).map(e=>`${e.i18nKey}.title`);function Q$(){let{registry:e}=wm(),{compositeViews:t,fullCustomViews:n,flowsActorsViews:r}=e_(),i=lm(),a=(0,Q.useMemo)(()=>e?.resourceConfigurations?Object.keys(e.resourceConfigurations).filter(t=>e.resourceConfigurations[t]?.frontendConfiguration):[],[e]),o=(0,Q.useMemo)(()=>{let n=(t??[]).map(e=>sX(e.translationRef)),r=e?.resourceConfigurations?Object.values(e.resourceConfigurations).flatMap(e=>e.frontendConfiguration?.compositeViews?.map(e=>sX(e.translationRef))??[]):[];return Array.from(new Set([...n,...r]))},[t,e]),s=(0,Q.useMemo)(()=>{let t=[...(n??[]).map(e=>cX({family:Ln.FULL_CUSTOM,translationRef:lX(e.ref)})),...(r??[]).map(e=>cX({family:Ln.FLOWS_ACTORS,translationRef:lX(e.ref)}))],i=e?.resourceConfigurations?Object.entries(e.resourceConfigurations).flatMap(([e,t])=>[...t.frontendConfiguration?.chartViews?.map(t=>cX({family:Ln.CHART,translationRef:uX(e,t.ref)}))??[],...t.frontendConfiguration?.executionViews?.map(t=>cX({family:Ln.EXECUTION,translationRef:uX(e,t.ref)}))??[]]):[];return Array.from(new Set([...t,...i]))},[r,n,e]),{t:c,tResourceHeader:l,tResourceOperation:u,tCompositeView:d,tView:f,translations:p,isReady:m}=K({resource:a,keys:[...o,...s,...txe,uh]}),h=CS(),{sections:g}=Jv(),_=(0,Q.useMemo)(()=>{let e=new Map(g.map(e=>[e.ref,e.icon]));return t=>e.get(t)},[g]),v=(0,Q.useMemo)(()=>{let e=new Map(g.map(e=>[e.ref,e.label]));return t=>e.get(t)},[g]),{sections:y}=Z$(),b=(0,Q.useMemo)(()=>gh(g.map(e=>e.ref),y.map(e=>e.ref)),[g,y]),x=(0,Q.useMemo)(()=>(e,t)=>pX({viewRef:e,contentType:t,tCompositeView:d,tView:f}),[d,f]);return(0,Q.useMemo)(()=>!e||!m?null:{registry:e,contextResourceIdentifiers:i?.buildContextResourceIdentifiers()??{},views:{compositeViews:t,fullCustomViews:n,flowsActorsViews:r},tResourceHeader:l,tResourceOperation:u,tViewTitle:x,t:c,settingsSectionIcon:_,settingsSectionLabel:v,settingsSectionVisible:b,viewerRoles:h},[e,m,i,t,n,r,l,u,x,c,_,v,b,h,p])}var nxe={[Ye.HOTKEY_SIDEBAR_TOGGLE]:`engine.hotkeys.sidebarToggle`,[Ye.HOTKEY_NOTIFICATIONS_OPEN]:`engine.hotkeys.notificationsOpen`,[Ye.HOTKEY_QUICK_SWITCHER_OPEN]:`engine.hotkeys.quickSwitcherOpen`,[Ye.HOTKEY_SHORTCUTS_HELP]:`engine.hotkeys.shortcutsHelp`},$$=[{event:Ye.HOTKEY_SIDEBAR_TOGGLE,shortcut:`Mod+B`,scope:L.GLOBAL,group:vc.NAVIGATION},{event:Ye.HOTKEY_QUICK_SWITCHER_OPEN,shortcut:`Mod+P`,scope:L.GLOBAL,group:vc.NAVIGATION},{event:Ye.HOTKEY_NOTIFICATIONS_OPEN,shortcut:`Mod+I`,scope:L.GLOBAL,group:vc.NAVIGATION}];function rxe(e){return $$.includes(e)}function ixe(e){switch(e){case Ye.HOTKEY_QUICK_SWITCHER_OPEN:return Fu.QUICK_SWITCHER;case Ye.HOTKEY_NOTIFICATIONS_OPEN:return Fu.NOTIFICATION_CENTER;default:return}}function e1(){let{register:e}=J$(),{emit:t}=vo(),n=Q$(),{navigate:r}=zS(),{appComponentsConfiguration:i}=e_(),a=jS(),o=i?.[Fu.HOTKEY],s=typeof o==`object`&&o?o.bindings:void 0,c=(0,Q.useMemo)(()=>Nle(s,a),[s,a]),l=typeof o==`object`&&o?o.emitShortcuts:void 0,u=(0,Q.useMemo)(()=>X$($$,l),[l]),d=(0,Q.useMemo)(()=>!c||!n?[]:qh(c,n),[c,n]);return(0,Q.useEffect)(()=>{let i=[],a=e=>{let t=e.descriptionLabellingRef??nxe[e.event];return n?n.t(t):t};for(let n of u)n.enabled!==!1&&i.push(e({id:`app-emit-${n.event}`,shortcut:n.shortcut,description:a(n),scope:n.scope??L.GLOBAL,group:n.group,handler:()=>{switch(n.event){case Ye.HOTKEY_SIDEBAR_TOGGLE:t(hc.HOTKEY_SIDEBAR_TOGGLE,{});break;case Ye.HOTKEY_NOTIFICATIONS_OPEN:t(hc.HOTKEY_NOTIFICATIONS_OPEN,{});break;case Ye.HOTKEY_QUICK_SWITCHER_OPEN:t(hc.HOTKEY_QUICK_SWITCHER_OPEN,{});break;case Ye.HOTKEY_SHORTCUTS_HELP:t(hc.HOTKEY_SHORTCUTS_HELP,{})}},launcher:ixe(n.event),preventDefault:n.preventDefault!==!1,priority:rxe(n)?B$:void 0}));for(let t of d)i.push(e({id:`app-hotkey-${t.id}`,shortcut:t.shortcut,description:t.description??t.label,scope:t.scope??L.GLOBAL,group:vc.ACTIONS,handler:()=>{Ch.dispatchNavigationForResolvedTarget(r,t,Fu.HOTKEY)},launcher:Fu.HOTKEY,preventDefault:!0}));return()=>{for(let e of i)e()}},[e,t,d,r,u,n]),null}function t1({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_KBD,`Kbd`)(e);return(0,$.jsx)(n,{...t})}t1.displayName=`Kbd`;var n1=[vc.NAVIGATION,vc.ACTIONS,vc.HELP,`other`];function axe(e,t){switch(e){case vc.NAVIGATION:return t(`navigation`);case vc.ACTIONS:return t(`actions`);case vc.HELP:return t(`help`);default:return t(`other`)}}function r1(e,t){switch(e){case L.GLOBAL:return t(`shortcutsHelpScopeGlobal`);case L.PAGE:return t(`shortcutsHelpScopePage`);case L.COMPONENT:return t(`shortcutsHelpScopeComponent`);default:return t(`shortcutsHelpScopeUnknown`)}}function i1(){let[e,t]=(0,Q.useState)(!1),{on:n}=vo(),{getHotkeys:r,getConflicts:i,activeScope:a,isPaused:o}=J$(),{t:s,tComponent:c,isReady:l}=K({component:J.APPLICATION_LEVEL_COMMAND_MENU});(0,Q.useEffect)(()=>n(hc.HOTKEY_SHORTCUTS_HELP,()=>{t(e=>!e)}),[n]);let u=(e,t)=>jp({tComponent:c,componentType:J.APPLICATION_LEVEL_COMMAND_MENU,key:e,params:t}),d=(0,Q.useMemo)(()=>e?r().slice().sort((e,t)=>{let n=n1.indexOf(e.group??`other`),r=n1.indexOf(t.group??`other`);return n===r?e.description.localeCompare(t.description):n-r}):[],[r,e]),f=(0,Q.useMemo)(()=>{let e=new Map;for(let t of d){let n=t.group??`other`,r=e.get(n)??[];r.push(t),e.set(n,r)}return n1.map(t=>({group:t,label:axe(t,u),hotkeys:e.get(t)??[]})).filter(e=>e.hotkeys.length>0)},[d,u]),p=(0,Q.useMemo)(()=>e?i():[],[i,e]);if(!l)return null;let m=Hp({t:s,key:`engine.hotkeys.shortcutsHelp`});return(0,$.jsx)(rG,{open:e,onOpenChange:t,children:(0,$.jsxs)(aG,{className:`max-w-3xl pt-10`,children:[(0,$.jsx)(sG,{children:(0,$.jsx)(lG,{children:m})}),(0,$.jsxs)(`div`,{className:`space-y-card-sm`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-item-sm text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[u(`shortcutsHelpActiveScope`),`: `,r1(a,u)]}),(0,$.jsxs)(`span`,{children:[u(`shortcutsHelpRegistry`),`: `,u(o?`shortcutsHelpRegistryPaused`:`shortcutsHelpRegistryListening`)]}),(0,$.jsx)(`span`,{children:u(`shortcutsHelpCount`,{count:d.length})})]}),p.length>0&&(0,$.jsxs)(`div`,{className:`rounded-md border border-warning/40 bg-warning/10 p-card-sm text-sm text-warning-foreground`,children:[(0,$.jsx)(`div`,{className:`font-medium`,children:u(`shortcutsHelpConflictsDetected`)}),(0,$.jsx)(`ul`,{className:`mt-item-xs space-y-item-xs`,children:p.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`code`,{children:e.shortcut}),` `,u(`shortcutsHelpConflictUsedBy`),` `,e.hotkeyIds.join(`, `)]},e.shortcut))})]}),(0,$.jsx)(hf,{className:`max-h-[60vh] pe-item-sm`,children:(0,$.jsx)(`div`,{className:`space-y-card`,children:f.map(({group:e,label:t,hotkeys:n})=>(0,$.jsxs)(`section`,{className:`space-y-item-sm`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:t}),(0,$.jsx)(`div`,{className:`space-y-item-xs`,children:n.map(e=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-field rounded-md border border-border/70 px-card-sm py-item-sm`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 space-y-[2px]`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e.description}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-item-sm text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:r1(e.scope,u)}),e.launcher&&(0,$.jsx)(`span`,{children:e.launcher}),(0,$.jsx)(`span`,{children:e.id})]})]}),(0,$.jsx)(t1,{children:e.parsed.display})]},e.id))})]},e))})})]})]})})}function oxe(e){return typeof e==`string`?e:gl.createOperationPathKey(e)}function sxe(e,t){let n=e.resourceConfigurations[t.resourceIdentifier];return n&&n.operations.find(e=>{let n=gl.extractOperationPath(e);if(n.operationIdentifier!==t.operationIdentifier||n.variantType!==t.variantType)return!1;if(t.isOperationDefault){if(!n.isOperationDefault)return!1}else{let e=t.variantKey;if((n.variantKey??void 0)!==(e??void 0))return!1}return n.variantType!==Ya.API_CALL||n.isBulkOperation===!0==(t.isBulkOperation===!0)})||null}function cxe({children:e}){let t=wm(),n=lm(),r=(0,Q.useCallback)(async(e,r,i)=>{if(!n)return t.doOperation(e,r,i);let a=oxe(e),o=null;try{o=gl.parseOperationPathKey(a)}catch{o=null}let s=o?sxe(t.registry,o):null;if(!s)return t.doOperation(e,r,i);let c=n.buildContextualParameters(),l=r?.contextualParameters,u={...c,...l||{}},d=r,f=d?.parentChainIsExact===!0?void 0:Boe({initiatorInfos:s.initiatorInfos,targetResourceType:s.resourceIdentifier,registry:t.registry,ownContextualParameters:{...Object.fromEntries(Object.entries(c).filter(([e])=>Woe.has(e))),...l||{}},parentResourcesRequirements:d?.parentResourcesRequirements}),p={...r,contextualParameters:u,...f?{parentResourcesRequirements:f,parentChainIsExact:!0}:{}};return t.doOperation(e,p,i)},[n,t]),i=(0,Q.useCallback)(async e=>Coe.evaluateEnabledCondition({...e,resourcesRegistry:t.registry,doOperation:r}),[t.registry,r]),a=(0,Q.useMemo)(()=>({...t,doOperation:r,evaluateOperationEnabled:i}),[t,r,i]);return(0,$.jsx)(ym.Provider,{value:a,children:e})}function lxe(){let e=ag(),{notifyError:t}=qm(),n=bp(),r=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{if(e?.error){let i=e.error.message;r.current!==i&&(r.current=i,t(n(e.error)))}else r.current=null},[e?.error,t,n]),null}function uxe(){let{currentOrganizationId:e}=Cg(),{isLoading:t,isFeatureEnabled:n,resolvedForOrganizationId:r}=Nh(),{doOperation:i,registry:a}=wm(),{emit:o,on:s}=vo(),{httpClient:c}=_u(),[l,u]=(0,Q.useState)(0),d=e??null,f=d!==null&&!t&&r===d&&n(ou.CUSTOM_BRANDING);return(0,Q.useEffect)(()=>s(hc.RESOURCE_OPERATION_EXECUTED,()=>u(e=>e+1),e=>e.resourceType===Na.ORGANIZATION_PROFILES&&!ra(e.operation??{operationIdentifier:e.operationIdentifier})),[s]),(0,Q.useEffect)(()=>{let e=!1,t=t=>{if(e)return;let n=d===null?void 0:fs(t?.logo),r=n&&d!==null?`${c.getBaseURL().replace(/\/+$/,``)}${rt}${Fr(d,wre.LOGO,n.updatedAt)}`:null;o(hc.ORGANIZATION_BRANDING_CHANGED,{organizationId:d,primaryColor:t?.primaryColor??null,secondaryColor:t?.secondaryColor??null,logoUrl:r,productName:t?.productName??null})},n=lh(a.resourceConfigurations[Na.ORGANIZATION_PROFILES]);return!f||d===null||!n?(t(null),()=>{e=!0}):(i(gl.buildOperationPathKeyFromOperation(n),{contextualParameters:{organizationId:d}}).then(e=>t(e?.branding)).catch(()=>t(null)),()=>{e=!0})},[d,f,i,a,o,l,c]),(0,Q.useEffect)(()=>()=>o(hc.ORGANIZATION_BRANDING_CHANGED,{organizationId:null,primaryColor:null,secondaryColor:null,logoUrl:null,productName:null}),[o]),null}var a1=[{componentType:J.APP_LAYOUTS_MAIN_CONTAINER,preset:q.DEFAULT},{componentType:J.PUBLIC_LAYOUTS_MAIN_CONTAINER,preset:q.DEFAULT}];function dxe({children:e}){let{frontendConfiguration:t,markComponentInitialized:n}=_u(),{on:r}=vo(),i=(0,Q.useCallback)(e=>r(hc.USER_PREFERENCES_CHANGED,t=>{Object.prototype.hasOwnProperty.call(t,`uiPreferences`)&&e(t.uiPreferences??null)}),[r]),a=(0,Q.useCallback)(e=>r(hc.ORGANIZATION_BRANDING_CHANGED,t=>{e({primaryColor:t.primaryColor??null,secondaryColor:t.secondaryColor??null,logoUrl:t.logoUrl??null,productName:t.productName??null})}),[r]),o=(0,Q.useCallback)(()=>n(Ne.UI),[n]);return(0,$.jsx)(n_,{frontendConfiguration:t,subscribeToUserPreferences:i,subscribeToOrganizationBranding:a,markInitialized:o,children:e})}function o1(e){return typeof e==`object`&&!!e}function s1(e){if(typeof e==`string`)return e;if(e instanceof Error)return e.message;if(e===void 0)return`undefined`;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function fxe(e){return e.split(/[\s_-]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function c1(e){if(typeof e==`string`&&e.trim().length!==0)return fxe(e.trim())}function pxe(e){if(o1(e)&&o1(e.initializationDiagnostics))return e.initializationDiagnostics}function mxe(e,t){if(t&&o1(t.wildoError))return t.wildoError;if(o1(e)&&o1(e.wildoError))return e.wildoError}function hxe(e){if(typeof e!=`string`)return null;try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=t.filter(e=>typeof e==`object`&&!!e);return n.length>0?n:null}catch{return null}}function gxe(e,t,n){return t&&typeof t.errorMessage==`string`&&t.errorMessage.trim().length>0?t.errorMessage:n&&o1(n.context)&&typeof n.context.message==`string`?n.context.message:e instanceof Error?e.message:typeof e==`string`?e:s1(e)}function _xe(e){if(!e)return[];let t=[];if(Array.isArray(e.unresolvedFKFields))for(let n of e.unresolvedFKFields){let e=typeof n?.resourceType==`string`?n.resourceType:`unknown-resource`,r=typeof n?.fieldName==`string`?n.fieldName:`unknown-field`;t.push(`${e}.${r}: foreign key cannot be resolved to a resource type`)}if(typeof e.message==`string`){let n=e.message.split(`
|
|
24
|
-
`).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`[ResourcesRegistry]`)&&!e.startsWith(`Fix:`));for(let e of n)e.startsWith(`- `)?t.push(e.slice(2)):t.includes(e)||t.push(e)}let n=[[`Resource type`,e.resourceType],[`Foreign key field`,e.foreignKeyField],[`Method`,e.method],[`Existing type`,e.existingType],[`New type`,e.newType]];for(let[e,r]of n)typeof r==`string`&&r.trim().length>0&&t.push(`${e}: ${r}`);return Array.from(new Set(t)).slice(0,6)}function l1(e){let t=[{label:`Application`,value:e.startupAppName}],n=c1(e.diagnostics?.phase);return n&&t.push({label:`Failed step`,value:n}),typeof e.diagnostics?.frontendServiceName==`string`&&e.diagnostics.frontendServiceName.trim().length>0&&t.push({label:`Frontend service`,value:e.diagnostics.frontendServiceName}),typeof e.diagnostics?.apiBaseUrl==`string`&&e.diagnostics.apiBaseUrl.trim().length>0&&t.push({label:`API base URL`,value:e.diagnostics.apiBaseUrl}),typeof e.wildoError?.customMessageReference==`string`&&e.wildoError.customMessageReference.trim().length>0&&t.push({label:`Error reference`,value:e.wildoError.customMessageReference}),typeof e.wildoError?.type==`string`&&e.wildoError.type.trim().length>0&&t.push({label:`Error type`,value:e.wildoError.type}),t}function vxe(e){return!e||e.length===0?`root`:e.map(e=>typeof e==`string`?e:String(e)).join(` > `)}function yxe(e,t){let n=pxe(e),r=mxe(e,n),i=gxe(e,n,r),a=hxe(i),o=s1(n?{...n,rawError:e instanceof Error?{name:e.name,message:e.message,stack:e.stack}:e}:e);if(a){let e=a.slice(0,6).map(e=>`${vxe(e.path)}: ${e.message??`Invalid configuration value`}`);return{title:`Application configuration is invalid`,description:`Startup stopped because the frontend configuration failed validation in ${a.length} place${a.length===1?``:`s`}.`,highlights:e,technicalDetails:JSON.stringify(a,null,2),remainingIssueCount:Math.max(a.length-e.length,0),contextRows:l1({diagnostics:n,wildoError:r,startupAppName:t})}}let s=_xe(r&&o1(r.context)?r.context:void 0),c=c1(n?.phase),l=i===`configuration`||typeof r?.customMessageReference==`string`&&r.customMessageReference===`configuration`,u=[c?`Startup stopped during ${c}.`:void 0,i&&i!==`configuration`?i:void 0,!i||i===`configuration`?`Open the technical details to inspect the full startup diagnostics.`:void 0].filter(e=>!!e);return{title:l?`Application configuration is invalid`:`Application initialization failed`,description:u.join(` `),highlights:s,technicalDetails:o,remainingIssueCount:0,contextRows:l1({diagnostics:n,wildoError:r,startupAppName:t})}}function u1({options:e}){let t=(0,Q.useMemo)(()=>rie(e.featureConfiguration),[e.featureConfiguration]),n=(0,Q.useMemo)(()=>Jo.getLogger(),[]),r=(0,Q.useMemo)(()=>{let e=n.debugByType(`ApplicationMainContext`);return n.setDebugTypeLogging(`ApplicationMainContext`,!1),e},[n]),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)({[Ne.MAIN_CONTEXT]:!1,[Ne.UI]:!1,[Ne.LOADER]:!1,[Ne.ERRORS]:!1,[Ne.ROUTER]:!1,[Ne.I18N]:!1,[Ne.APP_MAIN_CONTAINER]:!1,[Ne.PUBLIC_APP_CONTAINER]:!1}),m=(0,Q.useCallback)(e=>e[Ne.MAIN_CONTEXT]&&e[Ne.UI]&&e[Ne.APP_MAIN_CONTAINER]&&e[Ne.PUBLIC_APP_CONTAINER],[]),h=(0,Q.useCallback)(e=>{p(t=>{let n={...t,[e]:!0},i=Object.entries(n).filter(([e,t])=>!t).map(([e])=>e);return r(`Component initialized: ${e}`,{newStatus:n,allComponentsReady:m(n),missingComponents:i}),m(n)&&(r(`All components initialized, setting isInitialized=true`),a(!0)),n})},[m,r]),g=(0,Q.useRef)(!1),_=(0,Q.useRef)(!1),v=(0,Q.useRef)(null),y=(0,Q.useMemo)(()=>{let t=e.env.VITE_APP_NAME?.trim();return t&&t.length>0?t:`Application`},[e.env]),b=(0,Q.useMemo)(()=>o?yxe(o,y):null,[o,y]);(0,Q.useEffect)(()=>{r(`useEffect triggered`,{initializationStartedRef:g.current,initializationFailedRef:_.current,hasApplicationServices:!!c,isInitialized:i,currentInitializationStatus:f}),c&&!i?(r(`Services exist but not initialized, restoring core components`),h(Ne.MAIN_CONTEXT),h(Ne.LOADER),h(Ne.ERRORS),h(Ne.ROUTER),h(Ne.APP_MAIN_CONTAINER),h(Ne.PUBLIC_APP_CONTAINER),r(`Marked container components for hot reload (they will re-mark themselves when rendered)`)):g.current||_.current?(r(`Skipping initialization (already started/failed)`),_.current&&!o&&s(`Initialization previously failed. Click Retry to try again.`)):(async()=>{g.current=!0;try{Hi.initializeGlobalErrorHandlers(),va.injectEnvironmentVariables(cH(e.env,window.location));let i=va.loadEnvironmentConfig(),a={apiBaseUrl:e.apiBaseUrl??i.apiBaseUrl};d(a);let o=await f$.initializeApplication({config:a,autoAuth:!1,frontendProviderModules:e.frontendProviderModules,customShared_ResourcesConfigurationsFactoryMap:e.customShared_ResourcesConfigurationsFactoryMap,customShared_ResourceFieldIdentifier:e.customShared_ResourceFieldIdentifier,customShared_ResourcesRelationships:e.customShared_ResourcesRelationships,excludedResourceTypes:e.excludedResourceTypes,resourceUIBehavior:e.resourceUIBehavior,notificationBadgeDefinitions:e.notificationBadgeDefinitions,baseFrontendConfig:e.baseFrontendConfig,frontendConfigOverrides:e.frontendConfigOverrides,featureConfiguration:t,componentLoader:async()=>{await e.componentLoader(),wo.assertRequiredRegistrations(`SaaS application`,a1)},onInitialized:()=>{r(`Application initialized successfully`)},onError:e=>{n.error(`Application initialization failed`,{error:e.message,details:e}),s(e)}});wo.assertRequiredRegistrations(`SaaS application`,a1),l(o),h(Ne.MAIN_CONTEXT),h(Ne.LOADER),h(Ne.ERRORS),h(Ne.ROUTER)}catch(e){_.current=!0;let t=e instanceof Error?e.message:`Unknown initialization error`;s(e),n.error(`Application initialization failed`,{error:t,details:e})}})()},[e,c,i]);let x=(0,Q.useCallback)(()=>{_.current=!1,g.current=!1,window.location.reload()},[]),S=(0,Q.useRef)(window.location.pathname.startsWith(`/one-off-session/`)),C=(0,Q.useMemo)(()=>S.current?new mm:void 0,[]);if(o&&b)return va.readEnvironmentMode()===`development`?(0,$.jsx)(`div`,{className:`min-h-screen w-screen bg-background px-6 py-10 md:px-10`,children:(0,$.jsx)(`div`,{className:`mx-auto flex min-h-[calc(100vh-5rem)] max-w-5xl items-center justify-center`,children:(0,$.jsxs)(`div`,{role:`alert`,className:`w-full overflow-hidden rounded-2xl border border-border bg-card shadow-sm`,children:[(0,$.jsx)(`div`,{className:`border-b border-border bg-muted/40 px-6 py-5 md:px-8`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,$.jsx)(`div`,{className:`flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-destructive/12 text-xl text-destructive`,children:`!`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium uppercase tracking-wide text-destructive`,children:`Initialization failed`}),(0,$.jsx)(`h1`,{className:`mt-1 text-2xl font-semibold text-foreground`,children:b.title}),(0,$.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-muted-foreground`,children:b.description})]})]})}),(0,$.jsxs)(`div`,{className:`space-y-6 px-6 py-6 md:px-8`,children:[b.contextRows.length>0?(0,$.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:b.contextRows.map(e=>(0,$.jsxs)(`div`,{className:`rounded-xl border border-border bg-muted/20 px-4 py-3`,children:[(0,$.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:e.label}),(0,$.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs leading-5 text-foreground`,children:e.value})]},`${e.label}:${e.value}`))}):null,b.highlights.length>0?(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`What needs attention`}),(0,$.jsx)(`div`,{className:`grid gap-2`,children:b.highlights.map(e=>(0,$.jsx)(`div`,{className:`rounded-lg border border-border bg-muted/30 px-3 py-2 font-mono text-xs leading-5 text-foreground`,children:e},e))}),b.remainingIssueCount>0?(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`And `,b.remainingIssueCount,` more issue`,b.remainingIssueCount===1?``:`s`,` in the technical details below.`]}):null]}):null,(0,$.jsxs)(`div`,{className:`rounded-xl border border-border bg-muted/20 p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The application will not automatically retry. Fix the underlying issue, then reload the app to start a fresh initialization attempt.`}),(0,$.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-3`,children:(0,$.jsx)(`button`,{onClick:x,className:`inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90`,children:`Retry initialization`})})]}),(0,$.jsxs)(`details`,{className:`group rounded-xl border border-border bg-background`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer list-none px-4 py-3 text-sm font-medium text-foreground`,children:[(0,$.jsx)(`span`,{className:`group-open:hidden`,children:`Show technical details`}),(0,$.jsx)(`span`,{className:`hidden group-open:inline`,children:`Hide technical details`})]}),(0,$.jsx)(`div`,{className:`border-t border-border px-4 py-4`,children:(0,$.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-muted/30 p-4 font-mono text-xs leading-5 text-foreground`,children:b.technicalDetails})})]})]})]})})}):(0,$.jsx)(gbe,{onRetry:x});if(!c||!u){let e=Object.entries(f).filter(([e,t])=>!t).map(([e])=>e);return r(`Still loading`,{isInitialized:i,hasApplicationServices:!!c,hasConfig:!!u,initializationStatus:f,missingComponents:e}),(0,$.jsx)(`div`,{className:`flex min-h-screen w-screen items-center justify-center bg-background`,children:(0,$.jsx)(gb,{size:48})})}let w=(0,$.jsx)(ob,{children:(0,$.jsx)(Qm,{children:(0,$.jsx)(wb,{children:(0,$.jsx)(vp,{children:(0,$.jsxs)(hm,{tokenStorage:C,children:[(0,$.jsx)(pb,{}),(0,$.jsx)(kH,{children:(0,$.jsxs)(Lm,{children:[(0,$.jsx)(Hbe,{}),(0,$.jsx)(x$,{}),(0,$.jsx)(Bbe,{}),(0,$.jsx)(ase,{customRoles:e.customRoles,children:(0,$.jsx)(Ym,{children:(0,$.jsx)(mS,{children:(0,$.jsxs)(Vh,{productDefinitions:e.productDefinitions,children:[(0,$.jsx)(lxe,{}),(0,$.jsxs)(yg,{featureConfiguration:t,children:[(0,$.jsx)(uxe,{}),(0,$.jsx)(cxe,{children:(0,$.jsx)(CU,{children:(0,$.jsx)(DW,{children:(0,$.jsxs)(ph,{children:[(0,$.jsx)(e1,{}),(0,$.jsx)(i1,{}),(0,$.jsx)(pbe,{})]})})})})]})]})})})})]})})]})})})})});v.current===null&&(v.current=bg([{path:`/*`,element:w,errorElement:(0,$.jsx)(ub,{})}]));let T=v.current;return(0,$.jsx)(ut,{children:(0,$.jsx)(Rm,{children:(0,$.jsx)(Mi.Provider,{value:{appConfig:c.appConfigFromBackend,appIdentity:c.appConfigFromBackend.appIdentity,appPreferences:c.appConfigFromBackend.appPreferences,runtime:c.appConfigFromBackend.runtime,auth:c.appConfigFromBackend.auth,compliance:c.appConfigFromBackend.compliance,frontendConfiguration:c.frontendConfiguration,logger:c.logger,httpClient:c.httpClient,frontendProviderRegistry:c.frontendProviderRegistry,providerComponentRegistry:c.providerComponentRegistry,...e.shellCompanions?{shellCompanions:e.shellCompanions}:{},isInitialized:i,version:c.appConfigFromBackend.appIdentity?.version??`1.0.0`,initializationStatus:f,markComponentInitialized:h},children:(0,$.jsx)(dxe,{children:(0,$.jsx)(xi,{children:(0,$.jsx)(eu,{children:(0,$.jsx)(eh,{children:(0,$.jsx)(q$,{children:(0,$.jsx)(cm,{resourcesRepository:c.resourceRepository,children:(0,$.jsx)(Vx,{children:(0,$.jsx)(N$,{children:(0,$.jsx)(h$,{children:(0,$.jsxs)(Az,{apiBaseUrl:u.apiBaseUrl,children:[(0,$.jsx)(C$,{}),(0,$.jsx)(F_e,{}),(0,$.jsx)(E$,{}),(0,$.jsx)(p$,{}),(0,$.jsx)(m$,{}),(0,$.jsx)(lH,{router:T})]})})})})})})})})})})})})})}function bxe(e){let t=jm()?.registry,n=CS(),{resourceType:r,operationIdentifier:i,variantKey:a}=e;return(0,Q.useMemo)(()=>{let e=t?.resourceConfigurations?.[r]?.operations;return e?e.filter(e=>String(e.operationIdentifier)===String(i)).filter(e=>a===void 0||e.variantKey===a).filter(e=>e.variantType===void 0||zie.includes(e.variantType)).some(e=>th({...e,resourceType:r},n)):!1},[t,r,i,a,n])}var xxe=[li.SECONDARY,li.COMPANION];function Sxe(e){let{zones:t,viewport:n,contentAreaWidth:r,reconcileCollapsedZones:i,navigationState:a}=e;(0,Q.useEffect)(()=>{i(xxe.map(e=>({zone:e,mode:hg({zoneConfig:t?.[e],viewport:n,contentAreaWidth:r}),contentModel:t?.[e]?.contentModel})))},[t,n,r,i,a])}function d1(e){return e.contentType===hd.COMPOSITE_VIEW||e.contentType===hd.CHART_VIEW||e.contentType===hd.FULL_CUSTOM_VIEW||e.contentType===hd.FLOWS_ACTORS_VIEW||e.contentType===hd.EXECUTION_VIEW}function f1(e,t={}){let{keepOperationTitle:n=!1}=t,r=e?.content?.contentType===hd.RESOURCE_OPERATION?e.content.resourceContext.resourceType:void 0,i=(0,Q.useMemo)(()=>{if(e?.content.contentType!==hd.COMPOSITE_VIEW)return[];let t=dX(e.content.viewRef);return t?[sX(t)]:[]},[e]),a=(0,Q.useMemo)(()=>{let t=e?.content;if(!t||!d1(t)||t.contentType===hd.COMPOSITE_VIEW)return[];let n=fX({viewRef:t.viewRef,contentType:t.contentType});return n?[cX(n)]:[]},[e]),o=jm()?.registry.resourceConfigurations[r??``]?.operations,{tResourceOperation:s,tCompositeView:c,tView:l}=K({resource:r,keys:[...i,...a]});return(0,Q.useMemo)(()=>{if(!e)return{title:``};let{content:t}=e;if(t.contentType===hd.RESOURCE_OPERATION){let{resourceType:e,operationIdentifier:r}=t.resourceContext,i=n?String(r):$a(r,o);return{title:s(e,i,`title`)}}return d1(t)?{title:pX({viewRef:t.viewRef,contentType:t.contentType,tCompositeView:c,tView:l})}:t.contentType===hd.SETTINGS_HUB?{title:`Settings`}:{title:``}},[e,o,n,c,s,l])}function Cxe(){let e=(0,Q.useContext)(PH),t=lm()?.currentOrganizationId,{getZoneState:n}=Zx();return(0,Q.useCallback)(r=>Hoe({entryOrganizationId:gg(r.content),entryOwnsBrowserUrl:tg(r,n),currentOrganizationId:t,routeDecision:e}),[e,t,n])}var wxe=({wildoError:e})=>{let t=bp();return(0,$.jsx)(`div`,{className:`space-y-element`,children:(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground whitespace-pre-wrap`,children:t(e)})})},p1=zs(J.LOW_LEVEL_RESIZABLE_PANEL_GROUP,`ResizablePanelGroup`,[`Panel`,`Handle`]);function m1({preset:e=q.DEFAULT,...t}){let n=p1(e);return(0,$.jsx)(n,{...t})}function h1({preset:e=q.DEFAULT,...t}){let n=p1(e);return(0,$.jsx)(n.Panel,{...t})}function g1({preset:e=q.DEFAULT,...t}){let n=p1(e);return(0,$.jsx)(n.Handle,{...t})}var _1=zs(J.LOW_LEVEL_SHEET,`Sheet`,[`Trigger`,`Content`,`Close`,`Header`,`Footer`,`Title`,`Description`]);function v1({preset:e=q.DEFAULT,...t}){let n=_1(e);return(0,$.jsx)(n,{...t})}var y1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=_1(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});y1.displayName=`SheetTrigger`;var b1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=_1(e);return(0,$.jsx)(r.Content,{...t,ref:n})});b1.displayName=`SheetContent`;function Txe({preset:e=q.DEFAULT,...t}){let n=_1(e);return(0,$.jsx)(n.Close,{...t})}function x1({preset:e=q.DEFAULT,...t}){let n=_1(e);return(0,$.jsx)(n.Header,{...t})}function S1({preset:e=q.DEFAULT,...t}){let n=_1(e);return(0,$.jsx)(n.Footer,{...t})}var C1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=_1(e);return(0,$.jsx)(r.Title,{...t,ref:n})});C1.displayName=`SheetTitle`;var w1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=_1(e);return(0,$.jsx)(r.Description,{...t,ref:n})});w1.displayName=`SheetDescription`;var T1=zs(J.LOW_LEVEL_DRAWER,`Drawer`,[`Trigger`,`Content`,`Close`,`Header`,`Footer`,`Title`,`Description`]);function E1({preset:e=q.DEFAULT,...t}){let n=T1(e);return(0,$.jsx)(n,{...t})}var D1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=T1(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});D1.displayName=`DrawerTrigger`;var O1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=T1(e);return(0,$.jsx)(r.Content,{...t,ref:n})});O1.displayName=`DrawerContent`;function k1({preset:e=q.DEFAULT,...t}){let n=T1(e);return(0,$.jsx)(n.Close,{...t})}function A1({preset:e=q.DEFAULT,...t}){let n=T1(e);return(0,$.jsx)(n.Header,{...t})}function j1({preset:e=q.DEFAULT,...t}){let n=T1(e);return(0,$.jsx)(n.Footer,{...t})}var M1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=T1(e);return(0,$.jsx)(r.Title,{...t,ref:n})});M1.displayName=`DrawerTitle`;var N1=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=T1(e);return(0,$.jsx)(r.Description,{...t,ref:n})});N1.displayName=`DrawerDescription`;function P1({requestedMode:e,isMobileViewport:t,mobileShape:n}){if(e===yu.DIALOG&&t){if(n===`drawer`)return yu.DRAWER;if(n===`sheet`)return yu.SHEET}return e}function F1(){let e=null;return{resolve(t){let n=P1(t);return t.open===!0?(e??=n,e):(e=null,n)},reset(){e=null}}}var I1=({open:e,onOpenChange:t,trigger:n,anchor:r,title:i,titleVisuallyHidden:a,description:o,children:s,footer:c,config:l,surfacePolicyOverride:u,className:d,cancelText:f,confirmText:p,onConfirm:m,onCancel:h,commandPlaceholder:g,commandItems:_=[]})=>{let{mode:v,...y}=l,[b,x]=(0,Q.useState)(!1),S=e??b,C=(0,Q.useCallback)(n=>{e===void 0&&x(n),t?.(n)},[t,e]),{isMobile:w,getSurfacePolicy:T}=e_(),E=(0,Q.useRef)(null);E.current===null&&(E.current=F1());let D=T?.(Ja.OVERLAY,u),O=E.current.resolve({open:S,requestedMode:v,isMobileViewport:w,mobileShape:D?.geometry?.mobileShape}),{tComponent:k,isReady:A}=K({component:[J.LOW_LEVEL_OVERLAY_CONTAINER,J.LOW_LEVEL_DIALOG,J.LOW_LEVEL_SHEET,J.LOW_LEVEL_DRAWER]}),j=(e,t)=>jp({tComponent:k,componentType:J.LOW_LEVEL_OVERLAY_CONTAINER,key:e,params:t}),M=f??j(`cancel`),N=p??j(`confirm`),P=g??j(`commandPlaceholder`),F=j(`commandEmpty`),I=j(`commandGroup`),ee=j(`close`),L=Pxe(O,k),R=i||L,te=a||!i,z=(0,Q.useMemo)(()=>l.closeOnEscape===!1?e=>e.preventDefault():void 0,[l.closeOnEscape]);if(!A)return null;switch(O){case yu.DIALOG:return(0,$.jsx)(R1,{open:e,onOpenChange:C,trigger:n,title:R,titleVisuallyHidden:te,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:z,children:s});case yu.ALERT:return(0,$.jsx)(Exe,{open:e,onOpenChange:C,trigger:n,title:R,titleVisuallyHidden:te,description:o,cancelText:M,confirmText:N,onConfirm:m,onCancel:h,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:z,children:s});case yu.SHEET:return(0,$.jsx)(Dxe,{open:e,onOpenChange:C,trigger:n,title:R,titleVisuallyHidden:te,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:z,children:s});case yu.DRAWER:return(0,$.jsx)(Oxe,{open:e,onOpenChange:C,trigger:n,title:R,titleVisuallyHidden:te,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,children:s});case yu.COMMAND:return(0,$.jsx)(kxe,{open:e,onOpenChange:C,placeholder:P,emptyLabel:F,groupLabel:I,items:_,config:y,surfacePolicyOverride:u,className:d,children:s});case yu.POPOVER:return(0,$.jsx)(Axe,{open:e,onOpenChange:C,trigger:n,anchor:r,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:z,children:s});case yu.LIGHTBOX:return(0,$.jsx)(jxe,{open:e,onOpenChange:C,trigger:n,title:R,titleVisuallyHidden:te,closeLabel:ee,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:z,children:s});case yu.ACTION_SHEET:return(0,$.jsx)(Mxe,{open:e,onOpenChange:C,trigger:n,title:R,cancelText:M,config:y,surfacePolicyOverride:u,className:d,children:s});case yu.TOAST:return null;default:return(0,$.jsx)(R1,{open:e,onOpenChange:C,trigger:n,title:R,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:z,children:s})}};function L1(e){return e?{}:{"aria-describedby":void 0}}var R1=({open:e,onOpenChange:t,trigger:n,title:r,titleVisuallyHidden:i,description:a,footer:o,config:s,surfacePolicyOverride:c,className:l,children:u,onEscapeKeyDown:d})=>{let f=Nxe(s.size);return(0,$.jsxs)(rG,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(iG,{asChild:!0,children:n}),(0,$.jsxs)(aG,{surfacePolicyOverride:c,className:U(f,l),...L1(a),onEscapeKeyDown:d,children:[i&&!a?r&&(0,$.jsx)(lG,{className:`sr-only`,children:r}):(r||a)&&(0,$.jsxs)(sG,{children:[r&&(0,$.jsx)(lG,{className:i?`sr-only`:void 0,children:r}),a&&(0,$.jsx)(uG,{children:a})]}),u,o&&(0,$.jsx)(cG,{children:o})]})]})},Exe=({open:e,onOpenChange:t,trigger:n,title:r,description:i,cancelText:a,confirmText:o,onConfirm:s,onCancel:c,config:l,surfacePolicyOverride:u,className:d,children:f,onEscapeKeyDown:p})=>(0,$.jsxs)(tT,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(nT,{asChild:!0,children:n}),(0,$.jsxs)(rT,{surfacePolicyOverride:u,className:d,onEscapeKeyDown:p,children:[(0,$.jsxs)(iT,{children:[r&&(0,$.jsx)(oT,{children:r}),i&&(0,$.jsx)(sT,{children:i})]}),f,(0,$.jsxs)(aT,{children:[(0,$.jsx)(lT,{onClick:c,children:a}),(0,$.jsx)(cT,{onClick:s,children:o})]})]})]}),Dxe=({open:e,onOpenChange:t,trigger:n,title:r,titleVisuallyHidden:i,description:a,footer:o,config:s,surfacePolicyOverride:c,className:l,children:u,onEscapeKeyDown:d})=>{let f=s.side??Ea.END,p=typeof f==`string`&&!Object.values(Ea).includes(f)?f:Aee(f,document.documentElement.dir===`rtl`?`rtl`:`ltr`);return(0,$.jsxs)(v1,{open:e,onOpenChange:t,modal:s.modal??!0,children:[n&&(0,$.jsx)(y1,{asChild:!0,children:n}),(0,$.jsxs)(b1,{surfacePolicyOverride:c,side:p,className:l,...L1(a),onEscapeKeyDown:d,showBackdrop:s.showBackdrop??!0,onPointerDownOutside:s.closeOnOutsideClick===!1?e=>e.preventDefault():void 0,onInteractOutside:s.closeOnOutsideClick===!1?e=>e.preventDefault():void 0,children:[(r||a)&&(0,$.jsxs)(x1,{children:[r&&(0,$.jsx)(C1,{className:i?`sr-only`:void 0,children:r}),a&&(0,$.jsx)(w1,{children:a})]}),u,o&&(0,$.jsx)(S1,{children:o})]})]})},Oxe=({open:e,onOpenChange:t,trigger:n,title:r,titleVisuallyHidden:i,description:a,footer:o,config:s,surfacePolicyOverride:c,className:l,children:u})=>(0,$.jsxs)(E1,{open:e,onOpenChange:t,direction:`bottom`,snapPoints:s.snapPoints,dismissible:s.closeOnEscape!==!1&&s.dismissible,children:[n&&(0,$.jsx)(D1,{asChild:!0,children:n}),(0,$.jsxs)(O1,{surfacePolicyOverride:c,className:l,...L1(a),children:[(r||a)&&(0,$.jsxs)(A1,{children:[r&&(0,$.jsx)(M1,{className:i?`sr-only`:void 0,children:r}),a&&(0,$.jsx)(N1,{children:a})]}),(0,$.jsx)(`div`,{className:`px-container pb-card`,children:u}),o&&(0,$.jsx)(j1,{children:o})]})]}),kxe=({open:e,onOpenChange:t,placeholder:n,emptyLabel:r,groupLabel:i,items:a,surfacePolicyOverride:o,className:s,children:c})=>(0,$.jsxs)(OV,{open:e,onOpenChange:t,surfacePolicyOverride:o,children:[(0,$.jsx)(kV,{placeholder:n}),(0,$.jsxs)(AV,{className:s,children:[(0,$.jsx)(jV,{children:r}),a.length>0&&(0,$.jsx)(MV,{heading:i,children:a.map(e=>(0,$.jsxs)(NV,{onSelect:e.onSelect,children:[(0,$.jsx)(`span`,{children:e.label}),e.shortcut&&(0,$.jsx)(t1,{className:`ms-auto`,children:e.shortcut})]},e.id))}),c]})]}),Axe=({open:e,onOpenChange:t,trigger:n,anchor:r,surfacePolicyOverride:i,className:a,children:o,onEscapeKeyDown:s})=>(0,$.jsxs)(pq,{open:e,onOpenChange:t,children:[r&&(0,$.jsx)(gq,{asChild:!0,children:(0,$.jsx)(`span`,{ref:r})}),n&&(0,$.jsx)(mq,{asChild:!0,children:n}),(0,$.jsx)(hq,{surfacePolicyOverride:i,className:a,onEscapeKeyDown:s,children:o})]}),jxe=({open:e,onOpenChange:t,trigger:n,title:r,titleVisuallyHidden:i,closeLabel:a,surfacePolicyOverride:o,className:s,children:c,onEscapeKeyDown:l})=>{let{getRecipe:u}=e_(),d=u(wi.OVERLAY_BACKDROP);return(0,$.jsxs)(rG,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(iG,{asChild:!0,children:n}),(0,$.jsxs)(aG,{surfacePolicyOverride:o,showCloseButton:!1,onEscapeKeyDown:l,...L1(void 0),className:U(`max-w-[90vw] max-h-[90vh] p-0 overflow-hidden`,d.base,s),children:[(0,$.jsxs)(oG,{className:`absolute top-4 end-4 z-(--z-transient) text-white hover:text-white/80`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:a}),(0,$.jsx)(`svg`,{className:`w-6 h-6`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,$.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M6 18L18 6M6 6l12 12`})})]}),(0,$.jsx)(`div`,{className:`flex items-center justify-center min-h-[50vh]`,children:c}),i?(0,$.jsx)(lG,{className:`sr-only`,children:r}):(0,$.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 p-card bg-gradient-to-t from-black/80 to-transparent`,children:(0,$.jsx)(lG,{className:`text-white text-center text-base font-normal tracking-normal leading-normal`,children:r})})]})]})},Mxe=({open:e,onOpenChange:t,trigger:n,title:r,cancelText:i,surfacePolicyOverride:a,className:o,children:s})=>(0,$.jsxs)(E1,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(D1,{asChild:!0,children:n}),(0,$.jsxs)(O1,{surfacePolicyOverride:a,className:o,children:[r&&(0,$.jsx)(A1,{className:`text-center`,children:(0,$.jsx)(M1,{className:`text-sm font-normal text-muted-foreground`,children:r})}),(0,$.jsx)(`div`,{className:`px-card-sm pb-card`,children:s}),(0,$.jsx)(j1,{className:`pt-element border-t`,children:(0,$.jsx)(k1,{asChild:!0,children:(0,$.jsx)(X,{variant:Y.OUTLINE,className:`w-full`,children:i})})})]})]});function Nxe(e){switch(e){case`sm`:return`max-w-sm`;case`md`:return`max-w-md`;case`lg`:return`max-w-lg`;case`xl`:return`max-w-xl`;case`full`:return`max-w-[95vw] max-h-[95vh]`;default:return`max-w-lg`}}function Pxe(e,t){switch(e){case yu.DIALOG:return jp({tComponent:t,componentType:J.LOW_LEVEL_DIALOG,key:`defaultTitle`});case yu.SHEET:return jp({tComponent:t,componentType:J.LOW_LEVEL_SHEET,key:`defaultTitle`});case yu.DRAWER:return jp({tComponent:t,componentType:J.LOW_LEVEL_DRAWER,key:`defaultTitle`});default:return``}}I1.displayName=`OverlayContainer`;var Fxe=`w-full max-w-md overflow-y-auto`,Ixe=`max-w-2xl max-h-[90vh] overflow-y-auto pt-10 data-[vaul-drawer-direction=bottom]:max-w-none data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:pt-0`,z1=`w-full h-[min(92vh,56rem)] p-0 gap-0 overflow-hidden`,Lxe=`${z1} max-w-6xl`,Rxe=`${z1} max-w-[min(94vw,88rem)]`;function zxe(e){return e?Rxe:Lxe}function B1(e){switch(e){case pd.SHEET:return yu.SHEET;case pd.DRAWER:return yu.DRAWER;case pd.DIALOG:default:return yu.DIALOG}}function Bxe(e){return e===yu.SHEET?Fxe:Ixe}var Vxe=[W.LIST,W.SEARCH];function V1(e){return e.kind===Ov.SUB_TABS?e.subTabs.map(e=>e.target):[e]}function Hxe(e){return e===Mr.VERTICAL_TABS}var Uxe={[kv.SECURITY]:!1,[kv.APPEARANCE]:!1,[kv.INVITATIONS]:!1,[kv.BILLING]:!0,[kv.CONNECTED_ACCOUNTS]:!1,[kv.ORGANIZATION_CONNECTED_ACCOUNTS]:!1,[kv.APPLICATION_CONNECTED_ACCOUNTS]:!1,[kv.AGENT_WORK_OVERRIDE_RATE]:!1,[kv.AUTONOMOUS_AGENTS]:!1,[kv.MODEL_COST_BREAKDOWN]:!1,[kv.REPRESENTING_ORGANIZATION_MODEL_COST_BREAKDOWN]:!1,[kv.REPRESENTATIVE_ACTIVITY]:!1,[kv.AGENT_WORK_EVALUATION_EXPORT]:!1};function Wxe(e){return e.kind===Ov.ENGINE_PANEL?Uxe[e.panelRef]:e.kind===Ov.RESOURCE_OPERATION&&Vxe.includes(String(e.operation))}function Gxe(e){return V1(e).some(Wxe)}function Kxe(e,t,n){if(!t)return!1;let r=e.find(e=>e.ref===t);return r?Gxe(r.target)?!0:V1(r.target).some(e=>e.kind===Ov.RESOURCE_OPERATION&&Hxe(n(e.resourceType))):!1}function H1({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_SEPARATOR,`Separator`)(e);return(0,$.jsx)(n,{...t})}var U1;(function(e){e.ACTIVE=`active`,e.INACTIVE=`inactive`,e.UNAVAILABLE=`unavailable`})(U1||={});var qxe={[U1.ACTIVE]:`success`,[U1.INACTIVE]:`outline`,[U1.UNAVAILABLE]:`secondary`},W1=({icon:e,title:t,description:n,state:r,statusLabel:i,meta:a,action:o,children:s})=>{let{renderIcon:c}=Rf(),l=r===U1.ACTIVE;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item py-group first:pt-0 last:pb-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-row items-start gap-item`,children:[(0,$.jsx)(`div`,{"aria-hidden":`true`,className:U(`flex size-9 shrink-0 items-center justify-center rounded-md`,l?`bg-success/10 text-success`:`bg-muted text-muted-foreground`),children:c(e,{size:fa.SM})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-element-xs`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element-xs`,children:[(0,$.jsx)(Z,{className:`font-medium leading-snug`,children:t}),(0,$.jsx)(Hf,{variant:qxe[r],children:i})]}),!l&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:n}),a]}),o&&(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-element-xs`,children:o})]}),s&&(0,$.jsx)(`div`,{className:`flex flex-col gap-item ps-[calc(var(--spacing)*9+var(--sp-item))]`,children:s})]})},Jxe=()=>{let{auth:e}=_u(),{auth:t,signOutEverywhere:n}=Dm(),{user:r}=Cg(),i=dS(),a=bp(),[o,s]=(0,Q.useState)([]),[c,l]=(0,Q.useState)([]),[u,d]=(0,Q.useState)([]),[f,p]=(0,Q.useState)(!0),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),w=(0,Q.useMemo)(()=>Tb(u.map(e=>Dd(e.providerRef))),[u]),{tComponent:T,t:E,isReady:D,formatDate:O}=K({component:[J.APP_LAYOUTS_SECURITY_SETTINGS,J.PUBLIC_LAYOUTS_USER_REGISTER,J.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED],keys:w}),k=(0,Q.useCallback)((e,t)=>T(J.APP_LAYOUTS_SECURITY_SETTINGS,e,t),[T]),A=(0,Q.useCallback)(e=>T(J.PUBLIC_LAYOUTS_USER_REGISTER,e),[T]),j=e?.passkeyConfig,M=i.userTypeAuth?.methodManagement,N=i.passwordPolicy,P=j?.maxPasskeysPerUser??10,F=M?.allowUserMethodRemoval??!0,I=(0,Q.useCallback)(async()=>{p(!0),h(null);try{let e=lc(),[t,n,r]=await Promise.all([e.getMyMethods(),e.passkeyList().catch(()=>({credentials:[]})),e.getIdentityLinks().catch(()=>({links:[]}))]);s(t.methods??[]),l(n.credentials??[]),d(r.links??[])}catch(e){h(a(e,k(Ul.ERROR)))}finally{p(!1)}},[k,a]);(0,Q.useEffect)(()=>{I()},[I]),(0,Q.useEffect)(()=>{if(!g)return;let e=setTimeout(()=>_(null),5e3);return()=>clearTimeout(e)},[g]);let ee=ho.getEnrollableSecondFactorMethods(),L=o.filter(e=>e.enrolled&&ee.includes(e.method)).map(e=>e.method),R=ah.evaluateAccountCompleteness(t.identification?.requiresMFA??!1,t.identification?.secondFactorMethods?.map(e=>e.method)??[],L.length>0?L:t.enrolledSecondFactorMethods,i.userTypeAuth?.mfaPolicy?.acceptableMFAMethods??[]),te=o.some(e=>e.method===Al.PASSWORD&&e.enrolled),z=o.some(e=>e.method===Al.TOTP&&e.enrolled),B=o.find(e=>e.method===Al.SMS_OTP),ne=B?.enrolled??!1,re=B?.details?.phoneNumber,ie=(0,Q.useMemo)(()=>u.map(t=>({...t,providerLabel:Eb({providerRef:t.providerRef,displayName:e?.socialOAuth2Providers?.[t.providerRef]?.displayName,translate:E})})),[e?.socialOAuth2Providers,u,E]),ae=(0,Q.useCallback)(async()=>{if(!(c.length>=P)&&typeof window<`u`&&window.PublicKeyCredential){C(!0),h(null);try{let e=lc(),t=await e.passkeyRegisterOptions(),n=await Dp({optionsJSON:t});await e.passkeyRegisterVerify({response:n}),_(k(Ul.SUCCESS)),I()}catch(e){if(Kr(e))return;let t=e?.name===`NotAllowedError`?k(Ul.PASSKEY_CANCELLED):a(e,k(Ul.ERROR));h(t)}finally{C(!1)}}},[P,c.length,I,k,a]),oe=(0,Q.useCallback)(async e=>{if(F)try{await lc().passkeyRemove(e),_(k(Ul.SUCCESS)),I()}catch(e){Kr(e)||h(a(e,k(Ul.ERROR)))}},[F,I,k,a]),se=(0,Q.useCallback)(async()=>{try{await lc().mfaTOTPDisable(),_(k(Ul.SUCCESS)),y(!1),I()}catch(e){Kr(e)||h(a(e,k(Ul.ERROR)))}},[I,k,a]),ce=(0,Q.useCallback)(async e=>{if(F)try{await lc().unlinkIdentityLink(e),_(k(Ul.SUCCESS)),I()}catch(e){Kr(e)||h(a(e,k(Ul.ERROR)))}},[F,I,k,a]);if(!D)return null;let le=typeof window<`u`&&!!window.PublicKeyCredential,ue=le?c.length>0?U1.ACTIVE:U1.INACTIVE:U1.UNAVAILABLE,de=e=>{switch(e){case U1.ACTIVE:return k(Ul.STATUS_ACTIVE);case U1.UNAVAILABLE:return k(Ul.STATUS_UNAVAILABLE);case U1.INACTIVE:return k(Ul.STATUS_NOT_CONFIGURED)}},fe=(0,$.jsxs)(W1,{icon:HX[Al.PASSKEY],title:k(Ul.SECTION_PASSKEYS),description:k(Ul.PASSKEYS_DESCRIPTION),state:ue,statusLabel:de(ue),action:le&&c.length<P?(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:ae,disabled:S,children:k(S?Ul.PASSKEY_ADDING:Ul.PASSKEY_ADD)}):void 0,children:[!le&&(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:k(Ul.PASSKEY_UNSUPPORTED)})}),le&&c.length>0&&(0,$.jsx)(`ul`,{className:`flex flex-col gap-element`,children:c.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-item rounded-md border p-card-sm`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(Z,{className:`truncate font-medium`,children:e.name}),e.createdAt&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:k(Ul.PASSKEY_ADDED,{date:O(e.createdAt)})})]}),F&&(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.SM,onClick:()=>oe(e.credentialId),children:k(Ul.PASSKEY_REMOVE)})]},e.credentialId))})]}),pe=z?U1.ACTIVE:U1.INACTIVE,me=(0,$.jsx)(W1,{icon:HX[Al.TOTP],title:k(Ul.SECTION_TOTP),description:k(Ul.TOTP_DESCRIPTION),state:pe,statusLabel:de(pe),action:z?F?(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:se,children:k(Ul.TOTP_DISABLE)}):void 0:v?void 0:(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:()=>y(!0),children:k(Ul.TOTP_SETUP)}),children:z?(0,$.jsx)($.Fragment,{children:R.enrolledMethods.length===1&&R.enrolledMethods.includes(Al.TOTP)&&(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:k(Ul.TOTP_ONLY_MFA_WARNING)})})}):v?(0,$.jsx)(pZ,{onComplete:()=>{y(!1),I()},onError:e=>h(e),isLoading:!1,t:e=>T(J.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,e)}):null}),he=ne?U1.ACTIVE:U1.INACTIVE,ge=(0,$.jsx)(W1,{icon:HX[Al.SMS_OTP],title:k(Ul.SECTION_PHONE),description:k(Ul.PHONE_DESCRIPTION),state:he,statusLabel:de(he),meta:ne&&re?(0,$.jsx)(Z,{className:`text-sm`,children:re}):void 0,action:ne?(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:()=>x(!0),children:k(Ul.PHONE_CHANGE)}):b?void 0:(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:()=>x(!0),children:k(Ul.PHONE_VERIFY)}),children:ne&&!b?null:b?(0,$.jsx)(hZ,{onComplete:()=>{x(!1),I()},onError:e=>h(e),isLoading:!1,t:e=>T(J.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,e)}):null});return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:k(Ul.PAGE_TITLE)}),m&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:m})}),g&&(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:g})}),f?(0,$.jsx)(Z,{className:`text-muted-foreground`,children:k(Ul.LOADING)}):(0,$.jsx)(MF,{children:(0,$.jsxs)(zF,{className:`flex flex-col divide-y divide-border p-card`,children:[fe,me,ge,(0,$.jsx)(Yxe,{hasPassword:te,passwordPolicy:N,userEmail:r?.email,t:k,tPolicy:A,onSuccess:()=>{_(k(Ul.SUCCESS)),I()},onError:e=>h(e)}),(0,$.jsx)(Zxe,{links:ie,allowRemoval:F,t:k,onUnlink:ce})]})}),!f&&(0,$.jsx)(MF,{children:(0,$.jsx)(zF,{className:`flex flex-col divide-y divide-border p-card`,children:(0,$.jsx)(Xxe,{t:k,formatDate:O,onSignOutEverywhere:n,onError:e=>h(a(e))})})})]})},Yxe=({hasPassword:e,passwordPolicy:t,userEmail:n,t:r,tPolicy:i,onSuccess:a,onError:o})=>{let s=bp(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),f=qw({defaultValues:{currentPassword:``,newPassword:``,confirmPassword:``}}),p=qw({defaultValues:{newPassword:``,confirmPassword:``}}),m=(0,Q.useCallback)(async e=>{if(e.newPassword!==e.confirmPassword)o(r(Ul.PASSWORD_MISMATCH));else{l(!0);try{await lc().passwordChange(e.currentPassword,e.newPassword),a(),f.reset(),d(!1)}catch(e){Kr(e)||o(s(e,r(Ul.ERROR)))}finally{l(!1)}}},[f,o,a,r,s]),h=(0,Q.useCallback)(async e=>{if(e.newPassword!==e.confirmPassword)o(r(Ul.PASSWORD_MISMATCH));else{l(!0);try{await lc().passwordSet(e.newPassword),a(),p.reset(),d(!1)}catch(e){Kr(e)||o(s(e,r(Ul.ERROR)))}finally{l(!1)}}},[o,a,p,r,s]),g=e?U1.ACTIVE:U1.INACTIVE;return(0,$.jsx)(W1,{icon:HX[Al.PASSWORD],title:r(Ul.SECTION_PASSWORD),description:r(Ul.PASSWORD_DESCRIPTION),state:g,statusLabel:r(e?Ul.STATUS_ACTIVE:Ul.STATUS_NOT_CONFIGURED),action:u?(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:()=>{d(!1),f.reset(),p.reset()},children:r(Ul.CANCEL)}):(0,$.jsx)(X,{variant:Y.OUTLINE,onClick:()=>d(!0),children:r(e?Ul.PASSWORD_CHANGE:Ul.PASSWORD_SET)}),children:u?e?(0,$.jsx)(iw,{...f,children:(0,$.jsxs)(`form`,{onSubmit:f.handleSubmit(m),className:`space-y-4`,children:[(0,$.jsx)(IZ,{email:n}),(0,$.jsxs)(wx,{children:[(0,$.jsx)(Tx,{children:r(Ul.PASSWORD_CURRENT)}),(0,$.jsx)(iN,{type:`password`,autoComplete:`current-password`,...f.register(`currentPassword`,{required:!0})})]}),(0,$.jsxs)(wx,{children:[(0,$.jsx)(Tx,{children:r(Ul.PASSWORD_NEW)}),(0,$.jsx)(iN,{type:`password`,autoComplete:`new-password`,...f.register(`newPassword`,{required:!0})}),(0,$.jsx)(FZ,{fieldName:`newPassword`,policy:t,t:i})]}),(0,$.jsxs)(wx,{children:[(0,$.jsx)(Tx,{children:r(Ul.PASSWORD_CONFIRM)}),(0,$.jsx)(iN,{type:`password`,autoComplete:`new-password`,...f.register(`confirmPassword`,{required:!0})})]}),(0,$.jsx)(X,{type:`submit`,disabled:c,children:r(Ul.PASSWORD_CHANGE)})]})}):(0,$.jsx)(iw,{...p,children:(0,$.jsxs)(`form`,{onSubmit:p.handleSubmit(h),className:`space-y-4`,children:[(0,$.jsx)(IZ,{email:n}),(0,$.jsxs)(wx,{children:[(0,$.jsx)(Tx,{children:r(Ul.PASSWORD_NEW)}),(0,$.jsx)(iN,{type:`password`,autoComplete:`new-password`,...p.register(`newPassword`,{required:!0})}),(0,$.jsx)(FZ,{fieldName:`newPassword`,policy:t,t:i})]}),(0,$.jsxs)(wx,{children:[(0,$.jsx)(Tx,{children:r(Ul.PASSWORD_CONFIRM)}),(0,$.jsx)(iN,{type:`password`,autoComplete:`new-password`,...p.register(`confirmPassword`,{required:!0})})]}),(0,$.jsx)(X,{type:`submit`,disabled:c,children:r(Ul.PASSWORD_SET)})]})}):null})},Xxe=({t:e,formatDate:t,onSignOutEverywhere:n,onError:r})=>{let{renderIcon:i}=Rf(),{t:a}=K(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),m=(0,Q.useRef)(r);m.current=r,(0,Q.useEffect)(()=>{let e=!1;return lc().listMySessions().then(t=>{e||d(t.sessions)}).catch(t=>{e||(d([]),m.current(t))}),()=>{e=!0}},[]);let h=(0,Q.useCallback)(async e=>{p(e);let t=()=>d(t=>t?.filter(t=>t.sessionId!==e)??null);try{await lc().revokeMySession(e),t()}catch(e){e?.httpStatus===404?t():m.current(e)}finally{p(null)}},[]),g=(e,t)=>{let n=Bo(e,t),r=a(n);return r===n?Xo(t):r},_=t=>e(Ul.SESSION_DEVICE,{browser:g(id.BROWSER,t.browser??qte.OTHER),operatingSystem:g(id.OPERATING_SYSTEM,t.operatingSystem??Eie.OTHER)}),v=n=>n.ipAddress?e(Ul.SESSION_DETAILS,{address:n.ipAddress,lastActive:t(n.lastActiveAt)}):e(Ul.SESSION_LAST_ACTIVE,{lastActive:t(n.lastActiveAt)}),y=(0,Q.useCallback)(async()=>{l(!0);try{await n()}catch(e){l(!1),s(!1),r(e)}},[n,r]);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item`,children:[(0,$.jsxs)(`div`,{className:`flex flex-row items-start gap-item`,children:[(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-9 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:i(H.LOGOUT,{size:fa.SM})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-element-xs`,children:[(0,$.jsx)(Z,{className:`font-medium leading-snug`,children:e(Ul.SECTION_SESSIONS)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:e(Ul.SIGN_OUT_EVERYWHERE_DESCRIPTION)})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-element-xs`,children:(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.SM,onClick:()=>s(!0),disabled:c,children:e(Ul.SIGN_OUT_EVERYWHERE)})}),(0,$.jsx)(tT,{open:o,onOpenChange:e=>{!e&&!c&&s(!1)},children:(0,$.jsxs)(rT,{children:[(0,$.jsxs)(iT,{children:[(0,$.jsx)(oT,{children:e(Ul.SIGN_OUT_EVERYWHERE_CONFIRM_TITLE)}),(0,$.jsx)(sT,{children:e(Ul.SIGN_OUT_EVERYWHERE_CONFIRM_DESCRIPTION)})]}),(0,$.jsxs)(aT,{children:[(0,$.jsx)(lT,{disabled:c,children:e(Ul.CANCEL)}),(0,$.jsx)(cT,{disabled:c,onClick:e=>{e.preventDefault(),y()},children:e(Ul.SIGN_OUT_EVERYWHERE)})]})]})})]}),u&&u.length>0&&(0,$.jsx)(`ul`,{className:`flex flex-col gap-element ps-[calc(var(--spacing)*9+var(--sp-item))]`,"aria-label":e(Ul.SECTION_SESSIONS),children:u.map(t=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-item rounded-md border p-card-sm`,"data-session-id":t.sessionId,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element-xs`,children:[(0,$.jsx)(Z,{className:`truncate font-medium`,children:_(t)}),t.isCurrent&&(0,$.jsx)(Hf,{variant:`secondary`,children:e(Ul.SESSION_THIS_DEVICE)})]}),(0,$.jsx)(Z,{className:`truncate text-xs text-muted-foreground`,children:v(t)})]}),!t.isCurrent&&(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.SM,disabled:f===t.sessionId,onClick:()=>{h(t.sessionId)},children:e(Ul.SESSION_SIGN_OUT)})]},t.sessionId))})]})},Zxe=({links:e,allowRemoval:t,t:n,onUnlink:r})=>(0,$.jsx)(W1,{icon:HX[Al.EXTERNAL_OAUTH2],title:n(Ul.SECTION_IDENTITY_LINKS),description:n(Ul.IDENTITY_LINKS_DESCRIPTION),state:e.length>0?U1.ACTIVE:U1.INACTIVE,statusLabel:n(e.length>0?Ul.STATUS_ACTIVE:Ul.STATUS_NOT_CONFIGURED),children:e.length>0&&(0,$.jsx)(`ul`,{className:`flex flex-col gap-element`,children:e.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-item rounded-md border p-card-sm`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(Z,{className:`truncate font-medium`,children:e.providerLabel}),(0,$.jsx)(Z,{className:`truncate text-xs text-muted-foreground`,children:e.providerEmail})]}),t&&(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.SM,onClick:()=>r(e._id),children:n(Ul.IDENTITY_LINKS_UNLINK)})]},e._id))})});function Qxe(e,t,n){let r=e.resourceConfigurations[t];return r?r.operations.find(e=>e.operationIdentifier===n&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===Ya.API_CALL)??null:null}function G1(){let{themePreference:e,setTheme:t}=e_(),{doOperation:n,registry:r}=wm();return{themePreference:e,selectTheme:(0,Q.useCallback)(e=>{t(e);let i=Qxe(r,Na.USER_SELF_PREFERENCES,W.UPDATE);if(!i)return;let a=gl.buildOperationPathKeyFromOperation(i);n(a,{contextualParameters:{},requestData:{ui:{theme:e}}}).catch(()=>{})},[n,r,t])}}var $xe=[Qc.LIGHT,Qc.DARK,Qc.AUTO],eSe={[Qc.LIGHT]:`themeLight`,[Qc.DARK]:`themeDark`,[Qc.AUTO]:`themeSystem`},tSe=[Hs.BACKGROUND,Hs.FOREGROUND,Hs.MUTED,Hs.MUTED_FOREGROUND,Hs.PRIMARY,Hs.BORDER];function K1(e,t,n){let r=r=>{let i=e?.[r]??t?.[r];return i?me(i,n):`var(--${r})`};return tSe.reduce((e,t)=>({...e,[t]:r(t)}),{})}var q1=({palette:e,className:t})=>(0,$.jsxs)(`div`,{className:U(`flex h-full w-full gap-[3px] p-[5px]`,t),style:{backgroundColor:e[Hs.BACKGROUND]},children:[(0,$.jsxs)(`div`,{className:`flex w-1/4 shrink-0 flex-col gap-[3px] rounded-[3px] p-[3px]`,style:{backgroundColor:e[Hs.MUTED]},children:[(0,$.jsx)(`div`,{className:`h-[3px] w-full rounded-full`,style:{backgroundColor:e[Hs.PRIMARY]}}),(0,$.jsx)(`div`,{className:`h-[3px] w-3/4 rounded-full`,style:{backgroundColor:e[Hs.MUTED_FOREGROUND],opacity:.5}}),(0,$.jsx)(`div`,{className:`h-[3px] w-2/3 rounded-full`,style:{backgroundColor:e[Hs.MUTED_FOREGROUND],opacity:.5}})]}),(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col gap-[4px] rounded-[3px] border p-[4px]`,style:{backgroundColor:e[Hs.MUTED],borderColor:e[Hs.BORDER]},children:[(0,$.jsx)(`div`,{className:`h-[4px] w-2/3 rounded-full`,style:{backgroundColor:e[Hs.FOREGROUND]}}),(0,$.jsx)(`div`,{className:`h-[3px] w-full rounded-full`,style:{backgroundColor:e[Hs.MUTED_FOREGROUND],opacity:.55}}),(0,$.jsx)(`div`,{className:`h-[3px] w-4/5 rounded-full`,style:{backgroundColor:e[Hs.MUTED_FOREGROUND],opacity:.55}}),(0,$.jsx)(`div`,{className:`mt-auto h-[6px] w-2/5 rounded-[2px]`,style:{backgroundColor:e[Hs.PRIMARY]}})]})]}),nSe=({option:e,light:t,dark:n})=>e===Qc.AUTO?(0,$.jsxs)(`div`,{"aria-hidden":`true`,className:`flex h-16 w-full overflow-hidden rounded-md border`,children:[(0,$.jsx)(`div`,{className:`w-1/2 overflow-hidden`,children:(0,$.jsx)(`div`,{className:`h-full w-[200%]`,children:(0,$.jsx)(q1,{palette:t})})}),(0,$.jsx)(`div`,{className:`w-1/2 overflow-hidden`,children:(0,$.jsx)(`div`,{className:`ms-[-100%] h-full w-[200%]`,children:(0,$.jsx)(q1,{palette:n})})})]}):(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`h-16 w-full overflow-hidden rounded-md border`,children:(0,$.jsx)(q1,{palette:e===Qc.DARK?n:t})}),rSe=()=>{let{tComponent:e,isReady:t}=K({component:J.APP_LAYOUTS_APPEARANCE_SETTINGS}),{designSystemConfiguration:n}=e_(),{themePreference:r,selectTheme:i}=G1(),a=(0,Q.useCallback)(t=>e(J.APP_LAYOUTS_APPEARANCE_SETTINGS,t),[e]),o=(0,Q.useMemo)(()=>K1(n?.tokens,n?.customTokens,Nl.LIGHT),[n]),s=(0,Q.useMemo)(()=>K1(n?.tokens,n?.customTokens,Nl.DARK),[n]);return t?(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:a(`pageTitle`)}),(0,$.jsx)(OF,{value:r,onValueChange:e=>i(e),"aria-label":a(`themeHeading`),className:`grid-cols-1 gap-item sm:grid-cols-3`,children:$xe.map(e=>{let t=`appearance-theme-${e}`;return(0,$.jsxs)(iZ,{htmlFor:t,className:U(`flex cursor-pointer flex-col gap-element rounded-lg border p-card-sm font-normal transition-colors`,r===e?`border-primary ring-1 ring-primary`:`hover:border-primary/40`),children:[(0,$.jsx)(nSe,{option:e,light:o,dark:s}),(0,$.jsxs)(`div`,{className:`flex items-center gap-element-xs`,children:[(0,$.jsx)(kF,{id:t,value:e}),(0,$.jsx)(`span`,{className:`text-sm font-medium`,children:a(eSe[e])})]})]},e)})})]}):null},iSe=[Ji.ROLES],aSe=kd().min(1),oSe=()=>{let{tComponent:e,tRole:t,isReady:n,formatDateTime:r}=K({component:J.APP_LAYOUTS_INVITATIONS_SETTINGS,keys:iSe}),{refreshOrganizations:i}=Cg(),a=(0,Q.useCallback)((t,n)=>e(J.APP_LAYOUTS_INVITATIONS_SETTINGS,t,n),[e]),[o,s]=(0,Q.useState)([]),[c,l]=(0,Q.useState)([]),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(!0),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),b=(0,Q.useRef)(a);b.current=a;let x=(0,Q.useCallback)(async()=>{p(!0),_(null);try{let e=lc(),[t,n]=await Promise.allSettled([e.listMyPendingInvitations(),e.listMyRelationshipInvitations()]);s(t.status===`fulfilled`?t.value.invitations??[]:[]),l(n.status===`fulfilled`?n.value.invitations??[]:[]),[t,n].find(e=>e.status===`rejected`)?.status===`rejected`&&_(b.current(`errorGeneric`))}catch{_(b.current(`errorGeneric`))}finally{p(!1)}},[]);(0,Q.useEffect)(()=>{x()},[x]),(0,Q.useEffect)(()=>{if(!v)return;let e=setTimeout(()=>y(null),5e3);return()=>clearTimeout(e)},[v]);let S=(0,Q.useCallback)(async e=>{h(e),_(null);try{await lc().acceptMyInvitation(e),await i(),y(a(`acceptSuccess`)),await x()}catch(e){Kr(e)||_(a(`errorGeneric`))}finally{h(null)}},[x,i,a]),C=(0,Q.useCallback)(async e=>{h(e),_(null);try{await lc().rejectMyInvitation(e),y(a(`rejectSuccess`)),await x()}catch(e){Kr(e)||_(a(`errorGeneric`))}finally{h(null)}},[x,a]),w=(0,Q.useCallback)(async(e,t)=>{h(e),_(null);try{y(await t()),await x()}catch(e){Er(e)&&await x(),Kr(e)||_(a(`errorGeneric`))}finally{h(null)}},[x,a]),T=(0,Q.useCallback)(e=>{let t=u[e.invitationId]??e.receivingOrganizations[0]?.organizationId,n=e.receivingOrganizations.find(e=>e.organizationId===t);if(n)return w(e.invitationId,async()=>(await lc().receiveMyRelationshipInvitation(e.invitationId,n.organizationId),a(`relationshipReceiveSuccess`,{representingOrganization:e.representingOrganizationName??a(`unknownRepresentingOrganization`),organization:n.organizationName??a(`unknownOrganization`)})))},[u,w,a]),E=(0,Q.useCallback)(e=>w(e.invitationId,async()=>(await lc().declineMyRelationshipInvitation(e.invitationId),a(`relationshipDeclineSuccess`))),[w,a]);if(!n)return null;let D=o.length===0&&c.length===0;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:a(`pageTitle`)}),g&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:g})}),v&&(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:v})}),(f||D)&&(0,$.jsx)(MF,{children:(0,$.jsx)(zF,{className:`p-card`,children:(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(f?`loading`:`empty`)})})}),!f&&o.length>0&&(0,$.jsx)(MF,{children:(0,$.jsx)(zF,{className:`p-card`,children:(0,$.jsx)(`ul`,{className:`divide-y divide-border`,children:o.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-section py-group`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`font-medium`,children:e.organizationName??a(`unknownOrganization`)}),e.roles.length>0&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[a(`rolesPrefix`),` `,e.roles.map(e=>t(e,`label`)).join(`, `)]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-element`,children:[(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.SM,disabled:m===e.membershipId,onClick:()=>C(e.membershipId),children:a(`rejectButton`)}),(0,$.jsx)(X,{size:Xd.SM,disabled:m===e.membershipId,onClick:()=>S(e.membershipId),children:a(`acceptButton`)})]})]},e.membershipId))})})}),!f&&c.length>0&&(0,$.jsxs)(`section`,{"aria-labelledby":`invitations-settings-relationships`,className:`flex flex-col gap-group`,children:[(0,$.jsx)(`h4`,{id:`invitations-settings-relationships`,className:`text-sm font-semibold`,children:a(`relationshipInvitationsHeading`)}),(0,$.jsx)(MF,{children:(0,$.jsx)(zF,{className:`p-card`,children:(0,$.jsx)(`ul`,{className:`divide-y divide-border`,children:c.map(e=>{let n=e.receivingOrganizations,i=u[e.invitationId]??n[0]?.organizationId,o=m===e.invitationId;return(0,$.jsxs)(`li`,{className:`flex flex-col gap-group py-group`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`font-medium`,children:e.representingOrganizationName??a(`unknownRepresentingOrganization`)}),e.purpose&&(0,$.jsx)(Z,{className:`text-sm`,children:e.purpose}),e.role&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[a(`relationshipRolePrefix`),` `,t(e.role,`label`)]}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:a(`relationshipExpires`,{date:r(e.expiresAt)})})]}),n.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`relationshipNoReceivingOrganization`)}):n.length===1?(0,$.jsx)(Z,{className:`text-sm`,children:a(`relationshipReceivesInto`,{organization:n[0].organizationName??a(`unknownOrganization`)})}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(iZ,{htmlFor:`field-receiving-organization-${e.invitationId}`,children:a(`relationshipReceivingOrganizationLabel`)}),(0,$.jsx)(bF,{name:`receiving-organization-${e.invitationId}`,schema:aSe,options:n.map(e=>({value:e.organizationId,label:e.organizationName??a(`unknownOrganization`)})),value:i,disabled:o,onChange:t=>d(n=>({...n,[e.invitationId]:t}))})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-element`,children:[(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.SM,disabled:o,onClick:()=>E(e),children:a(`relationshipDeclineButton`)}),n.length>0&&(0,$.jsx)(X,{size:Xd.SM,disabled:o||!i,onClick:()=>T(e),children:a(`relationshipReceiveButton`)})]})]},e.invitationId)})})})})]})]})};function J1(e){return Tb([e?Dd(e):void 0])}function Y1(e){if(e.providerRef)return Eb({providerRef:e.providerRef,translate:e.translate})}function X1({preset:e=q.DEFAULT,...t}){let n=ag(),r=bp(),i=kh(),a=(0,Q.useMemo)(()=>J1(n?.billingProviderRef),[n?.billingProviderRef]),{tBillingProduct:o,t:s,isReady:c}=K({keys:[`billing_products`,...a]}),l=G(J.LOW_LEVEL_BILLING_SUBSCRIPTION_STATUS,`SubscriptionStatus`)(e),u=t.status??n?.subscription?.status??null,d=t.planName??(n?.currentPlanKey?o(n.currentPlanKey,`name`):null),f=t.providerName??Y1({providerRef:n?.billingProviderRef,translate:s}),p=t.currentPeriodEnd??n?.subscription?.currentPeriodEnd??null,m=t.cancelAtPeriodEnd??n?.subscription?.cancelAtPeriodEnd,h=t.trialEnd===void 0?n?.subscription?.trialEnd??null:t.trialEnd,g=(0,Q.useMemo)(()=>{if(t.nextPayment!==void 0)return t.nextPayment;if(!n?.isSliceAvailable(Ds.PRICES)||!n.currentPlanProduct)return;let e=n.getPricesForProduct(n.currentPlanProduct._id),r=(e.find(e=>e.isDefault)??e[0])?.unitPrice;if(r&&r.currency)return r},[t.nextPayment,n?.currentPlanProduct,n?.getPricesForProduct]),_=t.onManageBilling??(n?.isSliceAvailable(Ds.BILLING_ACCOUNT)?()=>{i(()=>n.openCustomerPortal())}:void 0),v=t.unavailable??(!!n?.isEnabled&&(t.status===void 0||t.planName===void 0||t.currentPeriodEnd===void 0)&&[Ds.SUBSCRIPTION,Ds.PRODUCTS,Ds.PRICES].some(e=>!n.isSliceAvailable(e))),y=t.isLoading??n?.isLoading,b=t.error===void 0?n?.error?r(n.error):null:t.error;return c?(0,$.jsx)(l,{...t,status:u,planName:d,providerName:f,currentPeriodEnd:p,cancelAtPeriodEnd:m,trialEnd:h,nextPayment:g,onManageBilling:_,isLoading:y,error:b,unavailable:v}):null}function Z1({preset:e=q.DEFAULT,...t}){let n=ag(),r=bp(),i=kh(),a=Q.useMemo(()=>J1(n?.billingProviderRef),[n?.billingProviderRef]),{t:o}=K({keys:a}),s=G(J.LOW_LEVEL_BILLING_PORTAL_LINK,`BillingPortalLink`)(e),c=t.onOpenPortal??(()=>{n&&i(()=>n.openCustomerPortal())}),l=t.providerName??Y1({providerRef:n?.billingProviderRef,translate:o}),u=t.unavailable??(!!n?.isEnabled&&t.onOpenPortal===void 0&&[Ds.BILLING_ACCOUNT].some(e=>!n.isSliceAvailable(e))),d=t.isLoading??n?.isLoading,f=t.error===void 0?n?.error?r(n.error):null:t.error;return(0,$.jsx)(s,{...t,onOpenPortal:c,providerName:l,isLoading:d,error:f,unavailable:u})}var Q1;(function(e){e.IDLE=`idle`,e.PREVIEWING=`previewing`,e.READY=`ready`,e.CONFIRMING=`confirming`,e.FAILED=`failed`})(Q1||={});function sSe(e){let t=e.currency.toUpperCase(),n=sn(t);if(n===void 0||!Number.isSafeInteger(e.amount)||e.lineItems.some(e=>!Number.isSafeInteger(e.amount)))throw Error(`The invoice estimate contains unsupported monetary values.`);return{amount:{amount:BigInt(e.amount),currency:t,decimals:n},lineItems:e.lineItems.map(e=>({...e,amount:{amount:BigInt(e.amount),currency:t,decimals:n}})),periodStart:e.periodStart,periodEnd:e.periodEnd,timing:e.timing,effectiveAt:new Date(e.effectiveAt)}}function cSe(e){let[t,n]=(0,Q.useState)({phase:Q1.IDLE}),r=(0,Q.useRef)(0),i=(0,Q.useRef)(null),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(t);o.current=t;let s=JSON.stringify([e?.currentScope,e?.billingAccount?._id,e?.subscription?._id]),c=(0,Q.useRef)(s);c.current=s;let l=!!e?.isEnabled&&[Ds.BILLING_ACCOUNT,Ds.SUBSCRIPTION,Ds.PRODUCTS,Ds.PRICES].every(e.isSliceAvailable);return(0,Q.useEffect)(()=>(r.current+=1,i.current?.abort(),n({phase:Q1.IDLE}),()=>{r.current+=1,i.current?.abort()}),[s]),(0,Q.useEffect)(()=>{let e=o.current;a.current||e.phase===Q1.READY&&e.hasError||l||(r.current+=1,i.current?.abort(),n({phase:Q1.IDLE}))},[l]),{state:t,select:(0,Q.useCallback)(async t=>{if(!e||!l||!e.subscription||a.current)return;let o=++r.current;i.current?.abort();let u=new AbortController;i.current=u;let d={target:t,scopeIdentity:s};n({...d,phase:Q1.PREVIEWING});try{let i=await e.previewPlanChange(t,{signal:u.signal}),a=sSe(i);if(!i.previewToken)throw Error(`The invoice estimate has no confirmation binding.`);if(r.current!==o||c.current!==s)return;n({...d,phase:Q1.READY,response:i,preview:a})}catch{if(r.current!==o||u.signal.aborted)return;n({...d,phase:Q1.FAILED})}},[e,l,s]),cancel:(0,Q.useCallback)(()=>{a.current||(r.current+=1,i.current?.abort(),n({phase:Q1.IDLE}))},[]),confirm:(0,Q.useCallback)(async()=>{let t=o.current;if(!e||!l||a.current||t.phase!==Q1.READY||t.scopeIdentity!==c.current)return;a.current=!0;let i=r.current;n({...t,phase:Q1.CONFIRMING,hasError:!1});try{await e.confirmPlanChange({...t.target,previewToken:t.response.previewToken}),r.current===i&&n({phase:Q1.IDLE})}catch{r.current===i&&n({...t,phase:Q1.READY,hasError:!0})}finally{a.current=!1}},[e,l])}}function $1({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_BILLING_PLAN_CHANGE_PREVIEW,`PlanChangePreview`)(e);return(0,$.jsx)(n,{...t})}function e0({preset:e=q.DEFAULT,...t}){let n=ag(),r=bp(),i=cSe(n),a=(0,Q.useRef)(null),o=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let e=i.state.phase!==Q1.IDLE;o.current&&!e&&a.current?.isConnected&&a.current.focus(),o.current=e},[i.state.phase]),(0,Q.useEffect)(()=>{t.onSelectPlan&&i.cancel()},[t.onSelectPlan,i.cancel]);let s=kh(),{tBillingProduct:c,tBillingFeature:l,tBillingLimit:u,isReady:d}=K({keys:[`billing_products`,`billing_features`,`billing_limits`]}),f=G(J.LOW_LEVEL_BILLING_PRICING_TABLE,`PricingTable`)(e),p=(0,Q.useMemo)(()=>t.plans?t.plans:n?.products?n.products.filter(e=>e.type===Yi.PLAN&&e.isPublic&&e.isActive).filter(e=>!n.currentScope||!e.targetScopes||e.targetScopes.includes(n.currentScope)).map(e=>{let t=n.getPricesForProduct(e._id);return{key:e.key,name:c(e.key,`name`),description:c(e.key,`tagline`),planTier:e.planTier,sortOrder:e.sortOrder??0,grantedFeatures:(e.grantedFeatures??[]).map(e=>({id:e,label:l(e,`label`)})),grantedLimits:Object.entries(e.grantedLimits??{}).map(([e,t])=>({id:e,label:u(e,`label`),value:typeof t==`object`&&t?t.value??0:0})),isCurrent:e.key===n.currentPlanKey,prices:t.filter(e=>e.unitPrice&&e.unitPrice.currency).map(e=>({priceId:e._id,price:e.unitPrice,interval:e.interval,isDefault:e.isDefault??!0})),isRecommended:e.isRecommended===!0,priceDisclosure:e.priceDisclosure,isAcquirable:n.isProductAcquirable(e.key),isFree:t.length>0&&t.every(e=>e.unitPrice?.amount===0n),trialDays:e.behaviorPolicy?.trial?.days}}):[],[t.plans,n?.products,n?.currentScope,n?.currentPlanKey,n?.getPricesForProduct,n?.isProductAcquirable,c,l,u]),m=t.currentPlanKey===void 0?n?.currentPlanKey??null:t.currentPlanKey,h=n?.subscription?.pendingPlanChange,g=t.pendingPlanChange===void 0?h?{targetPlanName:(()=>{let e=n?.products?.find(e=>e._id===h.productId)?.key;return e?c(e,`name`):h.productId})(),effectiveAt:new Date(h.effectiveAt)}:null:t.pendingPlanChange,[_,v]=(0,Q.useState)(!1),y=t.onKeepCurrentPlan??(h&&n&&ve(h)?()=>{v(!0),s(async()=>{try{await n.cancelPendingPlanChange()}finally{v(!1)}})}:void 0),b=(0,Q.useCallback)((e,r)=>{t.onSelectPlan?t.onSelectPlan(e,r):n&&[Ds.BILLING_ACCOUNT,Ds.SUBSCRIPTION,Ds.PRODUCTS,Ds.PRICES].every(n.isSliceAvailable)&&(n.subscription?(document.activeElement instanceof HTMLElement&&(a.current=document.activeElement),i.select({newProductKey:e,newPriceId:r})):s(()=>n.openCheckout(e,r)))},[t.onSelectPlan,n,s,i.select]),x=t.unavailable??(!!n?.isEnabled&&t.plans===void 0&&[Ds.PRODUCTS,Ds.PRICES,Ds.SUBSCRIPTION].some(e=>!n.isSliceAvailable(e))),S=t.isLoading??n?.isLoading,C=t.error===void 0?n?.error?r(n.error):null:t.error;return d?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{...t,plans:p,currentPlanKey:m,onSelectPlan:b,isLoading:S,error:C,unavailable:x,isSelectionDisabled:t.isSelectionDisabled||i.state.phase===Q1.CONFIRMING||!!g,pendingPlanChange:g,onKeepCurrentPlan:y,isKeepingCurrentPlan:t.isKeepingCurrentPlan??_}),i.state.phase!==Q1.IDLE&&(0,$.jsx)($1,{targetPlanName:c(i.state.target.newProductKey,`name`),preview:`preview`in i.state?i.state.preview:null,isLoading:i.state.phase===Q1.PREVIEWING,isConfirming:i.state.phase===Q1.CONFIRMING,hasError:i.state.phase===Q1.FAILED||`hasError`in i.state&&i.state.hasError,onCancel:i.cancel,onConfirm:i.state.phase===Q1.READY||i.state.phase===Q1.CONFIRMING?()=>{i.confirm()}:void 0,onRetry:i.state.phase===Q1.FAILED?()=>{i.state.phase===Q1.FAILED&&i.select(i.state.target)}:void 0})]}):null}function t0({preset:e=q.DEFAULT,...t}){let n=ag(),r=bp(),i=kh(),{tBillingProduct:a,tBillingCreditPool:o,isReady:s}=K({keys:[`billing_products`,`billing_credit_pools`]}),c=G(J.LOW_LEVEL_BILLING_USAGE_DASHBOARD,`UsageDashboard`)(e),l=(0,Q.useMemo)(()=>t.products?t.products:n?.usage?.byProduct?Object.entries(n.usage.byProduct).map(([e,t])=>({productKey:e,productName:a(e,`name`),currentPeriodUsage:t.currentPeriodUsage,previousPeriodUsage:t.previousPeriodUsage,limit:t.limit,lastRecordedAt:t.lastRecordedAt})):[],[t.products,n?.usage?.byProduct,a]),u=(0,Q.useMemo)(()=>t.creditPools?t.creditPools:n?.creditPools?Object.entries(n.creditPools).map(([e,t])=>({poolKey:e,poolName:o(e,`name`),available:t.available,totalPurchased:t.totalPurchased,totalGranted:t.totalGranted??0,totalConsumed:t.totalConsumed})):[],[t.creditPools,n?.creditPools,o]),d=(0,Q.useCallback)(e=>{if(t.onTopUp){t.onTopUp(e);return}if(!n||![Ds.BILLING_ACCOUNT,Ds.PRODUCTS,Ds.PRICES,Ds.CREDIT_POOLS].every(n.isSliceAvailable))return;let r=n.products.find(t=>t.type===Yi.CREDIT_PACK&&t.purchaseConfig?.creditPoolKey===e);if(!r)return;let a=n.getPricesForProduct(r._id),o=a.find(e=>e.isDefault)??a[0];o&&i(()=>n.openCheckout(r.key,o._id))},[t.onTopUp,n,i]),f=t.usageUnavailable??(!!n?.isEnabled&&t.products===void 0&&!n.isSliceAvailable(Ds.USAGE)),p=t.creditPoolsUnavailable??(!!n?.isEnabled&&t.creditPools===void 0&&!n.isSliceAvailable(Ds.CREDIT_POOLS)),m=!!t.onTopUp||!!n&&[Ds.BILLING_ACCOUNT,Ds.PRODUCTS,Ds.PRICES,Ds.CREDIT_POOLS].every(n.isSliceAvailable),h=t.isLoading??n?.isLoading,g=t.error===void 0?n?.error?r(n.error):null:t.error;return s?(0,$.jsx)(c,{...t,products:l,creditPools:u,onTopUp:m?d:void 0,usageUnavailable:f,creditPoolsUnavailable:p,isLoading:h,error:g}):null}function n0({preset:e=q.DEFAULT,...t}){let n=ag(),r=bp(),i=kh(),a=Q.useMemo(()=>J1(n?.billingProviderRef),[n?.billingProviderRef]),{t:o}=K({keys:a}),s=G(J.LOW_LEVEL_BILLING_INVOICE_HISTORY,`InvoiceHistory`)(e),c=t.invoices??n?.invoices??[],l=t.onViewAll??(n?.isSliceAvailable(Ds.BILLING_ACCOUNT)?()=>{i(()=>n.openCustomerPortal())}:void 0),u=t.providerName??Y1({providerRef:n?.billingProviderRef,translate:o}),d=t.unavailable??(!!n?.isEnabled&&t.invoices===void 0&&[Ds.INVOICES].some(e=>!n.isSliceAvailable(e))),f=t.isLoading??n?.isLoading,p=t.error===void 0?n?.error?r(n.error):null:t.error;return(0,$.jsx)(s,{...t,invoices:c,providerName:u,onViewAll:l,isLoading:f,error:p,unavailable:d})}var lSe=()=>{let e=ag(),{tComponent:t,isReady:n}=K({component:J.APP_LAYOUTS_BILLING_SETTINGS}),r=(0,Q.useCallback)(e=>t(J.APP_LAYOUTS_BILLING_SETTINGS,e),[t]);if(!n)return null;if(!e?.isEnabled)return(0,$.jsxs)(MF,{children:[(0,$.jsx)(PF,{children:(0,$.jsx)(IF,{children:r(`disabledTitle`)})}),(0,$.jsx)(zF,{children:(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:r(`disabledDescription`)})})]});let i=e.isSliceAvailable(Ds.BILLING_ACCOUNT),a=[Ds.SUBSCRIPTION,Ds.PRODUCTS,Ds.PRICES].every(t=>e.isSliceAvailable(t));return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:r(`pageTitle`)}),(0,$.jsx)(X1,{}),i&&!a&&(0,$.jsx)(Z1,{}),(0,$.jsx)(e0,{}),(0,$.jsx)(t0,{}),(0,$.jsx)(n0,{})]})};function r0({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DESCRIPTION_LIST,`DescriptionList`)(e);return(0,$.jsx)(n,{...t})}function i0({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DESCRIPTION_TERM,`DescriptionTerm`)(e);return(0,$.jsx)(n,{...t})}function a0({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DESCRIPTION_DETAILS,`DescriptionDetails`)(e);return(0,$.jsx)(n,{...t})}function o0(e){switch(e){case Yu.USER:return Na.USER_PROVIDER_CREDENTIALS;case Yu.ORGANIZATION:return Na.ORG_PROVIDER_CREDENTIALS;case Yu.APPLICATION:return}}function uSe(e){return o0(e)!==void 0}function dSe(e,t){return e===Yu.APPLICATION?e:t===null?null:`${e}:${t}`}function s0(e){let t=o0(e.ownerScope);if(t===void 0)return;let n=e.registry.resourceConfigurations[t];if(!n)return;let r=n.operations.find(t=>t.operationIdentifier===e.operation&&t.isOperationDefault===!0&&t.isBulkOperation!==!0&&t.variantType===Ya.API_CALL);if(!r)return;let i={...pm.buildResourceOperationContextIdentifiers({...e.ownerScope===Yu.USER?{currentUserId:e.ownerId}:{currentOrganizationId:e.ownerId},primaryScope:n.resourcePrimaryScope,explicitContextResourceIdentifiers:{}}),[t]:e.credentialId};return{operationPathKey:gl.buildOperationPathKeyFromOperation(r),contextualParameters:V.buildContextualParameters(i,e.registry),parentResourcesRequirements:gn.buildParentResourcesRequirements(t,i,e.registry)}}function fSe(e,t){let{registry:n,doOperation:r}=wm(),[i,a]=(0,Q.useState)([]),[o,s]=(0,Q.useState)(!0),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(0),f=(0,Q.useRef)(null),p=dSe(e,t);(0,Q.useEffect)(()=>{if(p===null){a([]),s(!1),f.current=null;return}let n=!1,r=p;return f.current!==r&&(a([]),l(!1),s(!0),f.current=r),(async()=>{try{let r=await lc().listLinkedProviderConnections(e===Yu.APPLICATION||t===null?{ownerScope:e}:{ownerScope:e,ownerId:t});n||(a(r.connections??[]),l(!1))}catch{n||l(!0)}finally{n||s(!1)}})(),()=>{n=!0}},[p,e,t,u]);let m=(0,Q.useCallback)(()=>d(e=>e+1),[]),h=(0,Q.useCallback)(async i=>{if(p!==null){if(e===Yu.APPLICATION)try{await lc().disconnectApplicationProviderConnection(i.connectionRef)}finally{m()}else if(t!==null)try{for(let a of i.credentials){let i=s0({registry:n,ownerScope:e,ownerId:t,credentialId:a.credentialId,operation:W.DELETE});if(i===void 0)throw Error(`No DELETE operation is registered for the ${e} credential resource in this frontend.`);await r(i.operationPathKey,{contextualParameters:i.contextualParameters,parentResourcesRequirements:i.parentResourcesRequirements})}Xs({ownerScope:e,ownerId:t},i.connectionRef)}finally{m()}}},[r,t,p,e,n,m]),g=(0,Q.useCallback)(async(i,a)=>{if(t!==null)try{for(let o of i.credentials){let i=s0({registry:n,ownerScope:e,ownerId:t,credentialId:o.credentialId,operation:W.UPDATE});if(i===void 0)throw Error(`No UPDATE operation is registered for the ${e} credential resource in this frontend.`);await r(i.operationPathKey,{contextualParameters:i.contextualParameters,parentResourcesRequirements:i.parentResourcesRequirements,requestData:{enabled:a}})}}finally{m()}},[r,t,e,n,m]),_=(0,Q.useCallback)(async(i,a,o)=>{if(t!==null)try{let s=s0({registry:n,ownerScope:e,ownerId:t,credentialId:i,operation:a});if(s===void 0)throw Error(`No ${a} operation is registered for the ${e} credential resource in this frontend.`);await r(s.operationPathKey,{contextualParameters:s.contextualParameters,parentResourcesRequirements:s.parentResourcesRequirements,...o===void 0?{}:{requestData:o}})}finally{m()}},[r,t,e,n,m]),v=(0,Q.useCallback)((e,t)=>_(e,W.UPDATE,{description:t.trim()===``?null:t.trim()}),[_]),y=(0,Q.useCallback)(e=>_(e,W.DELETE),[_]);return{connections:i,loading:o,failed:c,reload:m,disconnect:h,holdsCredentialResource:uSe(e),setEnabled:g,setCredentialDescription:v,removeCredential:y}}var c0=J.APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS,pSe={[Yu.USER]:fee.shape.description.unwrap().maxLength??void 0,[Yu.ORGANIZATION]:Pr.shape.description.unwrap().maxLength??void 0},l0=kd().min(1),u0=Ld(),mSe=kd().min(1),hSe=(e,t)=>e.filter(e=>e.admissibleConnections.some(e=>e.ownerScope===t)),d0=(e,t)=>{let n=new Set(Object.values(So)),r=[];for(let i of e.admissibleConnections){if(i.ownerScope!==t||!n.has(i.delegation))continue;let e=i.delegation;r.includes(e)||r.push(e)}return r},gSe=(e,t)=>{let n=d0(e,t);return t===Yu.APPLICATION?n.filter(e=>e===So.SERVICE):n},f0=e=>({ownerScope:e.ownerScope,delegation:e.delegation,...e.ownerScope===Yu.APPLICATION||e.ownerId===null?{}:{ownerId:e.ownerId},...je(e)&&e.signedInUserId!==null?{actingForUserId:e.signedInUserId}:{}}),_Se=(e,t,n)=>e.map(e=>{let r=/^\{([A-Za-z_][A-Za-z0-9_]*)\}/.exec(e);if(r===null)return e;let i=(Object.hasOwn(t,r[1])?t[r[1]]:void 0)?.trim()??``;return i===``?n:`${i}${e.slice(r[0].length)}`}),p0;(function(e){e.SUPERSEDED=`SUPERSEDED`,e.DISABLED=`DISABLED`,e.NEEDS_REAUTHORIZATION=`NEEDS_REAUTHORIZATION`,e.WORKING=`WORKING`,e.NOT_YET_USED=`NOT_YET_USED`})(p0||={});var m0;(function(e){e.DISCONNECTED=`DISCONNECTED`,e.FAILED=`FAILED`})(m0||={});var vSe=e=>{if(e.supersededByConnectionRef!==void 0)return p0.SUPERSEDED;if(!e.enabled)return p0.DISABLED;switch(e.validationState){case gr.INVALID:return p0.NEEDS_REAUTHORIZATION;case gr.VALID:return p0.WORKING;case gr.UNVALIDATED:return p0.NOT_YET_USED}},ySe={[p0.SUPERSEDED]:`warning`,[p0.DISABLED]:`secondary`,[p0.NEEDS_REAUTHORIZATION]:`destructive`,[p0.WORKING]:`success`,[p0.NOT_YET_USED]:`secondary`},bSe={[p0.SUPERSEDED]:`statusSuperseded`,[p0.DISABLED]:`statusDisabled`,[p0.NEEDS_REAUTHORIZATION]:`statusNeedsReauthorization`,[p0.WORKING]:`statusWorking`,[p0.NOT_YET_USED]:`statusNotYetUsed`},xSe=(e,t)=>{if(t===void 0||t.connectionRef!==e.connectionRef)return;let n=new Set(e.grantedScopes??[]),r=t.requestableScopes.filter(e=>!n.has(e)),i=t.administratorConsentScopes.filter(e=>!n.has(e));if(r.length!==0||i.length!==0)return{requestableScopes:r,administratorConsentScopes:i,offer:t}},SSe=(e,t)=>Tb([...[...e.flatMap(e=>[e.providerRef,...e.servesRefs??[]]),...t.flatMap(e=>[e.connectionRef,...e.servesRefs,...e.supersededByConnectionRef===void 0?[]:[e.supersededByConnectionRef]])].map(Dd),...e.flatMap(e=>(e.credentialFields??[]).flatMap(t=>[Td(e.providerRef,t.slug,Ed.LABEL),Td(e.providerRef,t.slug,Ed.DESCRIPTION)])),...e.flatMap(e=>(e.connectionParameters??[]).flatMap(t=>[wd(e.providerRef,t,Ed.LABEL),wd(e.providerRef,t,Ed.DESCRIPTION)])),...t.flatMap(e=>e.credentials.map(e=>Td(e.providerRef,e.secretSlug,Ed.LABEL)))]),h0=(e,t,n,r)=>{let i=Td(e,t,n),a=r(i);return a!==i&&a.length>0?a:n===Ed.LABEL?t:i},g0=(e,t,n,r)=>{let i=wd(e,t,n),a=r(i);return a!==i&&a.length>0?a:n===Ed.LABEL?t:i},CSe=(e,t)=>{let n=e=>e.connectionRef??e.providerRef,r=new Set(t.map(e=>e.connectionRef));return[...t.map(t=>({connectionRef:t.connectionRef,connection:t,catalogueEntry:e.find(e=>n(e)===t.connectionRef)})),...e.filter(e=>!r.has(n(e))).map(e=>({connectionRef:n(e),catalogueEntry:e}))]},wSe=()=>{if(typeof window>`u`)return{};let e=new URLSearchParams(window.location.search);return{connected:e.get(`connected`)??void 0,connectionError:e.get(`connectionError`)??void 0,state:e.get(`state`)??void 0,code:e.get(`code`)??void 0}},TSe=()=>{if(typeof window>`u`)return;let e=new URL(window.location.href);e.searchParams.delete(`state`),e.searchParams.delete(`code`),window.history.replaceState(window.history.state,``,e.toString())},ESe=({connection:e,pending:t,catalogueEntry:n,ownerScope:r,ownerId:i,signedInUserId:a,label:o,t:s,tWith:c})=>{let l=(0,Q.useId)(),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),v=n===void 0?[]:d0(n,r),y=v.length===1?v[0]:v.find(e=>e===u),b=y!==void 0&&ji({ownerScope:r,delegation:y}),x=r===Yu.USER||e.linkedByUserId!==void 0&&e.linkedByUserId===a,S=(0,Q.useCallback)(async()=>{if(i!==null&&y!==void 0){h(!0),_(!1);try{let{authorizeUrl:e}=await lc().startProviderConnection(t.offer.providerRef,{target:f0({ownerScope:r,ownerId:i,delegation:y,signedInUserId:a}),addScopes:t.requestableScopes,forOperationId:t.offer.operationId,...b?{acknowledgesOrganizationWideUse:f}:{}});window.location.href=e}catch(e){h(!1),Kr(e)||_(!0)}}},[f,y,b,i,r,t,a]);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-xs`,children:s(`reauthorizationOfferDescription`)}),t.requestableScopes.length>0&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[s(`reauthorizationScopesPrefix`),` `,t.requestableScopes.join(`, `)]}),t.administratorConsentScopes.length>0&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[s(`reauthorizationAdministratorPrefix`),` `,t.administratorConsentScopes.join(`, `)]}),t.requestableScopes.length>0&&!x&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:s(`reauthorizationLinkerOnlyNotice`)}),t.requestableScopes.length>0&&x&&(0,$.jsxs)($.Fragment,{children:[v.length>1&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:s(`delegationHeading`)}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:s(`delegationDescription`)}),(0,$.jsx)(bF,{name:`delegation-${e.connectionRef}`,schema:l0,options:v.map(e=>({value:e,label:s(e===So.SERVICE?`delegationServiceOption`:`delegationUserOption`)})),value:u,placeholder:s(`delegationPlaceholder`),onChange:e=>{d(e),p(!1)}})]}),b&&(0,$.jsxs)(`div`,{className:`flex items-start gap-item-xs`,children:[(0,$.jsx)(AI,{name:`organizationWideUseAcknowledged-${e.connectionRef}`,schema:u0,checked:f,onCheckedChange:p,"aria-describedby":l}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:s(`organizationWideUseAcknowledgement`)}),(0,$.jsx)(Z,{id:l,className:`text-xs text-muted-foreground`,children:s(`organizationWideUseDescription`)})]})]}),(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(X,{size:Xd.SM,variant:Y.DEFAULT,"aria-label":c(`grantMoreAccessAccessibleName`,{provider:o}),disabled:m||i===null||y===void 0||b&&!f,onClick:S,children:s(`grantMoreAccessButton`)})})]}),g&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:s(`errorGeneric`)})})]})},DSe={[Vie.MESSAGING_ENDPOINT]:`vendorRegistrationMessagingEndpointLabel`},OSe=new Set([ii.PROVIDER_VENDOR_REGISTRATION_DEPLOYMENT_INCOMPLETE]),_0=e=>Ct(e)||Er(e)&&e.customMessageReference!==void 0&&OSe.has(e.customMessageReference);function kSe(e){if(e.encoding===av.BASE64){let t=atob(e.content),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return new Blob([n],{type:e.mediaType})}return new Blob([e.content],{type:e.mediaType})}var ASe=({providerRef:e,organizationId:t,label:n,t:r,tWith:i})=>{let[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),h=bp(),g=(0,Q.useMemo)(()=>[...new Set((s?.steps??[]).map(t=>Sd(e,t.ref)))],[e,s]),{t:_,isReady:v}=K({keys:g}),y=(0,Q.useCallback)(async()=>{o(!0),u(!0),f(null),c(null);try{c(await lc().getProviderVendorRegistration(e,{ownerScope:Yu.ORGANIZATION,ownerId:t},{silent:!0}))}catch(e){f(e)}finally{u(!1)}},[t,e]),b=(0,Q.useCallback)(e=>{navigator.clipboard?.writeText(e).then(()=>m(e),()=>m(null))},[]);return a?(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-xs font-medium text-muted-foreground`,children:r(`vendorRegistrationHeading`)}),l&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:r(`vendorRegistrationLoading`)}),d!==null&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:Er(d)?h(d,r(_0(d)?`vendorRegistrationRefused`:`vendorRegistrationFailed`)):r(`vendorRegistrationFailed`)}),_0(d)?(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:r(`vendorRegistrationRefusalFinal`)}):(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(X,{size:Xd.SM,variant:Y.OUTLINE,disabled:l,onClick:()=>{y()},children:r(`vendorRegistrationRetryButton`)})})]}),s!==null&&(0,$.jsxs)($.Fragment,{children:[(s.addresses??[]).length>0&&(0,$.jsx)(r0,{children:(s.addresses??[]).map(e=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(i0,{children:r(DSe[e.kind]??e.kind)}),(0,$.jsx)(a0,{children:(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-item-xs`,children:[(0,$.jsx)(`code`,{className:`select-all break-all text-xs`,children:e.url}),(0,$.jsx)(X,{size:Xd.SM,variant:Y.GHOST,"aria-label":i(`vendorRegistrationCopyAccessibleName`,{address:e.url}),onClick:()=>b(e.url),children:r(p===e.url?`vendorRegistrationCopiedButton`:`vendorRegistrationCopyButton`)})]})})]},e.kind))}),v&&(0,$.jsx)(`ol`,{className:`flex list-decimal flex-col gap-item-xs pl-5`,children:s.steps.map((t,n)=>(0,$.jsx)(`li`,{children:(0,$.jsx)(Z,{className:`text-xs`,children:_(Sd(e,t.ref),t.params)})},`${n}:${t.ref}`))})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-item-xs`,children:[(0,$.jsx)(X,{size:Xd.SM,variant:Y.GHOST,onClick:()=>{o(!1),m(null)},children:r(`vendorRegistrationHideButton`)}),s?.file!==void 0&&(0,$.jsx)(X,{size:Xd.SM,variant:Y.DEFAULT,onClick:()=>eb(kSe(s.file),s.file.name),children:i(`vendorRegistrationDownloadButton`,{file:s.file.name})})]})]}):(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(X,{size:Xd.SM,variant:Y.OUTLINE,"aria-label":i(`vendorRegistrationAccessibleName`,{provider:n}),onClick:()=>{y()},children:r(`vendorRegistrationButton`)})})},jSe=({connection:e,descriptionMaxLength:t,label:n,t:r,tWith:i,translateProvider:a,onSaveDescription:o,onRemove:s})=>{let[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),g=e.credentials.length>1,_=async e=>{h(e);try{await o(e,u)&&l(null)}finally{h(null)}},v=async e=>{h(e);try{await s(e)}finally{h(null),p(null)}};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-xs font-medium text-muted-foreground`,children:r(g?`credentialFieldsLabel`:`descriptionLabel`)}),(0,$.jsx)(`div`,{className:`flex flex-col gap-item-xs`,children:e.credentials.map(e=>{let o=c===e.credentialId,s=f===e.credentialId,h=m===e.credentialId,y=h0(e.providerRef,e.secretSlug,Ed.LABEL,a);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[g&&(0,$.jsx)(Z,{className:`text-sm font-medium`,children:y}),!o&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:e.description??r(`noDescription`)}),!o&&!s&&(0,$.jsx)(X,{size:Xd.SM,variant:Y.GHOST,"aria-label":i(`editDescriptionAccessibleName`,{provider:n,slot:y}),disabled:m!==null,onClick:()=>{l(e.credentialId),d(e.description??``),p(null)},children:r(`editDescriptionButton`)}),g&&!o&&!s&&(0,$.jsx)(X,{size:Xd.SM,variant:Y.GHOST,"aria-label":i(`removeSlotAccessibleName`,{provider:n,slot:y}),disabled:m!==null,onClick:()=>{p(e.credentialId),l(null)},children:r(`removeSlotButton`)})]}),o&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(iN,{"aria-label":i(`descriptionInputAccessibleName`,{provider:n,slot:y}),type:`text`,maxLength:t,autoFocus:!0,value:u,onChange:e=>d(e.target.value)}),(0,$.jsx)(X,{size:Xd.SM,variant:Y.DEFAULT,disabled:h,onClick:()=>{_(e.credentialId)},children:r(`saveDescriptionButton`)}),(0,$.jsx)(X,{size:Xd.SM,variant:Y.OUTLINE,disabled:h,onClick:()=>l(null),children:r(`cancelDescriptionButton`)})]}),s&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(Z,{className:`text-sm`,children:i(`removeSlotConfirmation`,{slot:y})}),(0,$.jsx)(X,{size:Xd.SM,variant:Y.DESTRUCTIVE,disabled:h,"aria-label":i(`removeSlotConfirmAccessibleName`,{provider:n,slot:y}),autoFocus:!0,onClick:()=>{v(e.credentialId)},children:r(`removeSlotConfirmButton`)}),(0,$.jsx)(X,{size:Xd.SM,variant:Y.OUTLINE,disabled:h,onClick:()=>p(null),children:r(`removeSlotCancelButton`)})]})]},e.credentialId)})})]})},v0=({ownerScope:e=Yu.USER})=>{let{tComponent:t,isReady:n,formatDateTime:r}=K({component:c0}),{user:i,currentOrganizationId:a}=Cg(),o=(0,Q.useCallback)(e=>t(c0,e),[t]),s=(0,Q.useCallback)((e,n)=>t(c0,e,n),[t]),c=(0,Q.useId)(),l=e===Yu.USER?i?._id??null:e===Yu.ORGANIZATION?a??null:null,u=e===Yu.APPLICATION||l!==null,[d,f]=(0,Q.useState)([]),[p,m]=(0,Q.useState)(!0),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)({}),[A,j]=(0,Q.useState)(wSe),M=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let{state:e,code:t}=A;if(e===void 0||t===void 0)return;M.current===null&&(TSe(),M.current=lc().completeProviderConnection({state:e,code:t}));let n=!1;return M.current.then(({connected:e})=>{n||j({connected:e})}).catch(()=>{n||j({connectionError:`failed`})}),()=>{n=!0}},[]),(0,Q.useEffect)(()=>{let t=!1;return(async()=>{try{let n=await lc().listConnectableProviders(e===Yu.APPLICATION?{ownerScope:e}:void 0);t||(f(n.providers??[]),v(!1))}catch{t||v(!0)}finally{t||m(!1)}})(),()=>{t=!0}},[e]);let N=(0,Q.useMemo)(()=>hSe(d,e),[d,e]),{connections:P,loading:F,failed:I,reload:ee,disconnect:L,holdsCredentialResource:R,setEnabled:te,setCredentialDescription:z,removeCredential:B}=fSe(e,l),ne=Zn(),re=(0,Q.useMemo)(()=>SSe(d,P),[d,P]),{t:ie}=K({keys:re}),ae=(0,Q.useCallback)(e=>Eb({providerRef:e,translate:ie}),[ie]),[oe,se]=(0,Q.useState)(null),[ce,le]=(0,Q.useState)(null),[ue,de]=(0,Q.useState)(null),fe=(0,Q.useCallback)(async e=>{le(e.connectionRef),de(null);try{await L(e),de(m0.DISCONNECTED),g(null)}catch(e){Kr(e)||de(m0.FAILED)}finally{le(null),se(null)}},[L]),[pe,me]=(0,Q.useState)(null),he=(0,Q.useCallback)(async(e,t)=>{me(e.connectionRef),de(null);try{await te(e,t),g(null)}catch(e){Kr(e)||g(o(`errorGeneric`))}finally{me(null)}},[te,o]),ge=(0,Q.useCallback)(async e=>{de(null);try{return await e(),g(null),!0}catch(e){return Kr(e)||g(o(`errorGeneric`)),!1}},[o]),_e=(0,Q.useCallback)((e,t)=>ge(()=>z(e,t)),[ge,z]),ve=(0,Q.useCallback)(e=>ge(()=>B(e)),[ge,B]),ye=(0,Q.useMemo)(()=>{if(N.length===0)return`disconnectNotice`;let e=N.filter(e=>e.revocationTellsVendor===!0).length;return e===0?`disconnectNotice`:e===N.length?`disconnectRevokesNotice`:`disconnectMixedNotice`},[N]),be=(0,Q.useMemo)(()=>d.filter(e=>(e.missingRegistration??[]).length>0).map(e=>({providerRef:e.providerRef,envVarNames:(e.missingRegistration??[]).map(e=>e.envVarName)})),[d]),xe=(0,Q.useMemo)(()=>N.find(e=>e.providerRef===y),[N,y]),Se=(0,Q.useCallback)(e=>{b(e),k({}),w(``),D(!1),g(null)},[]),Ce=(0,Q.useMemo)(()=>xe===void 0?[]:gSe(xe,e),[e,xe]),we=Ce.length===1?Ce[0]:Ce.find(e=>e===C),[Te,Ee]=(0,Q.useState)(null),De=we!==void 0&&ji({ownerScope:e,delegation:we}),Oe=(0,Q.useCallback)(async()=>{if(xe===void 0||!u||we===void 0)return;S(!0),g(null),Ee(null);let t=f0({ownerScope:e,ownerId:l,delegation:we,signedInUserId:i?._id??null});try{if(xe.authMethods?.includes(fc.OAUTH2_AUTHORIZATION_CODE)??!1){let{authorizeUrl:e}=await lc().startProviderConnection(xe.providerRef,{target:t,connectionParameters:O,...De?{acknowledgesOrganizationWideUse:E}:{}});window.location.href=e;return}let e=new Set((xe.credentialFields??[]).map(e=>e.slug)),n=Object.fromEntries(Object.entries(O).filter(([t,n])=>e.has(t)&&n.trim()!==``)),r=new Set(xe.connectionParameters??[]),i=Object.fromEntries(Object.entries(O).filter(([e,t])=>r.has(e)&&t.trim()!==``));await lc().storeProviderCredential(xe.providerRef,{target:t,values:n,...Object.keys(i).length===0?{}:{connectionParameters:i},...De?{acknowledgesOrganizationWideUse:E}:{}}),k({}),Ee(o(`credentialStoredNotice`)),S(!1),b(``),ee()}catch(e){S(!1),Kr(e)||g(o(`errorGeneric`))}},[O,we,De,E,l,u,e,ee,xe,o,i?._id]);if(!n)return null;let ke=CSe(N,P),Ae=xe?.authMethods?.includes(fc.OAUTH2_AUTHORIZATION_CODE)??!1,je=xe?.missingRegistration??[],Me=xe?.connectionParameters??[],Ne=xe?.connectionParameterChoices??{},Pe=xe?.credentialFields??[],Fe=xe?.scopes??[],Ie=[...Me,...Ae?[]:Pe.filter(e=>e.required).map(e=>e.slug)].some(e=>(O[e]??``).trim()===``);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[A.connected!==void 0&&(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:o(`connectedNotice`)})}),A.connectionError===`declined`&&(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:o(`declinedNotice`)})}),A.connectionError!==void 0&&A.connectionError!==`declined`&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:o(`failedNotice`)})}),Te&&(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:Te})}),_&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:o(`catalogueFailed`)})}),h&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:h})}),ue===m0.DISCONNECTED&&(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:o(`disconnectedNotice`)})}),ue===m0.FAILED&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:o(`disconnectFailedNotice`)})}),(0,$.jsxs)(`section`,{"aria-labelledby":c,className:`flex flex-col gap-group`,children:[(0,$.jsx)(BY,{level:3,id:c,children:o(`providersHeading`)}),p||F?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:o(`loading`)}):(0,$.jsxs)($.Fragment,{children:[I&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:o(`connectionsFailed`)})}),ke.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:o(`empty`)}):(0,$.jsx)(`ul`,{"aria-labelledby":c,className:`flex flex-col gap-group`,children:ke.map(({connectionRef:t,connection:n,catalogueEntry:a})=>{let c=ae(n===void 0?a?.providerRef??t:n.connectionRef),d=n===void 0?void 0:vSe(n),f=n===void 0||d===p0.SUPERSEDED?void 0:xSe(n,l===null?void 0:dr(ne,{ownerScope:e,ownerId:l},n.connectionRef)),p=oe===t,m=ce===t,h=pe===t,g=a!==void 0&&xe?.providerRef===a.providerRef,_=a!==void 0&&!(a.authMethods?.includes(fc.OAUTH2_AUTHORIZATION_CODE)??!1),v=n!==void 0&&_&&d!==p0.SUPERSEDED;return(0,$.jsx)(`li`,{children:(0,$.jsx)(MF,{children:(0,$.jsxs)(zF,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:c}),d===void 0?(0,$.jsx)(Hf,{variant:`outline`,children:o(`notConnectedBadge`)}):(0,$.jsx)(Hf,{variant:ySe[d],children:o(bSe[d])})]}),n!==void 0&&(0,$.jsxs)(r0,{children:[n.servesRefs.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(i0,{children:o(`servesLabel`)}),(0,$.jsx)(a0,{children:n.servesRefs.map(ae).join(`, `)})]}),(n.grantedScopes??[]).length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(i0,{children:o(`grantedScopesLabel`)}),(0,$.jsx)(a0,{children:(n.grantedScopes??[]).join(`, `)})]}),n.connectedAt!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(i0,{children:o(`connectedAtLabel`)}),(0,$.jsx)(a0,{children:r(n.connectedAt)})]}),n.validationError!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(i0,{children:o(`lastRefusalLabel`)}),(0,$.jsx)(a0,{children:n.validationError})]}),n.lastValidatedAt!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(i0,{children:o(`lastValidatedAtLabel`)}),(0,$.jsx)(a0,{children:r(n.lastValidatedAt)})]}),n.lastUsedAt!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(i0,{children:o(`lastUsedAtLabel`)}),(0,$.jsx)(a0,{children:r(n.lastUsedAt)})]}),n.linkedByUserId!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(i0,{children:o(`linkedByLabel`)}),(0,$.jsx)(a0,{children:n.linkedByUserName??n.linkedByUserId})]})]}),n!==void 0&&d!==p0.SUPERSEDED&&R&&(0,$.jsx)(jSe,{connection:n,descriptionMaxLength:pSe[e],label:c,t:o,tWith:s,translateProvider:ie,onSaveDescription:_e,onRemove:ve}),e===Yu.ORGANIZATION&&l!==null&&(a?.vendorRegistrationOwnerScopes??[]).includes(Yu.ORGANIZATION)&&(0,$.jsx)(ASe,{providerRef:a.providerRef,organizationId:l,label:c,t:o,tWith:s}),n!==void 0&&d===p0.SUPERSEDED&&n.supersededByConnectionRef!==void 0&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:s(`supersededNotice`,{connection:ae(n.supersededByConnectionRef)})}),n!==void 0&&!n.enabled&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`disabledNotice`)}),d===p0.NEEDS_REAUTHORIZATION&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`needsReauthorizationNotice`)}),n!==void 0&&f!==void 0&&(0,$.jsx)(ESe,{connection:n,pending:f,catalogueEntry:a,ownerScope:e,ownerId:l,signedInUserId:i?._id??null,label:c,t:o,tWith:s}),n!==void 0&&p?(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-xs`,children:s(`disconnectConfirmDescription`,{provider:c})}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(n.revocationTellsVendor?`disconnectRevokesNotice`:`disconnectNotice`)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-item-xs`,children:[(0,$.jsx)(X,{size:Xd.SM,variant:Y.GHOST,disabled:m,onClick:()=>se(null),children:o(`disconnectCancelButton`)}),(0,$.jsx)(X,{size:Xd.SM,variant:Y.DESTRUCTIVE,"aria-label":s(`disconnectConfirmAccessibleName`,{provider:c}),disabled:m,onClick:()=>{fe(n)},children:o(`disconnectConfirmButton`)})]})]}):(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-item-xs`,children:[a!==void 0&&!g&&n===void 0&&(0,$.jsx)(X,{size:Xd.SM,variant:Y.DEFAULT,"aria-label":s(`connectAccessibleName`,{provider:c}),onClick:()=>Se(a.providerRef),children:o(`connectButton`)}),a!==void 0&&!g&&v&&(0,$.jsx)(X,{size:Xd.SM,variant:Y.OUTLINE,"aria-label":s(`replaceCredentialAccessibleName`,{provider:c}),onClick:()=>Se(a.providerRef),children:o(`replaceCredentialButton`)}),a!==void 0&&!g&&d===p0.NEEDS_REAUTHORIZATION&&!v&&(0,$.jsx)(X,{size:Xd.SM,variant:Y.OUTLINE,"aria-label":s(`reconnectAccessibleName`,{provider:c}),onClick:()=>Se(a.providerRef),children:o(`reconnectButton`)}),n!==void 0&&d!==p0.SUPERSEDED&&R&&(0,$.jsx)(X,{size:Xd.SM,variant:Y.OUTLINE,"aria-label":s(n.enabled?`disableAccessibleName`:`enableAccessibleName`,{provider:c}),disabled:h||ce!==null,onClick:()=>{he(n,!n.enabled)},children:o(n.enabled?`disableButton`:`enableButton`)}),n!==void 0&&(0,$.jsx)(X,{size:Xd.SM,variant:Y.OUTLINE,"aria-label":s(`disconnectAccessibleName`,{provider:c}),disabled:ce!==null,onClick:()=>{se(t),de(null)},children:o(`disconnectButton`)})]}),g&&xe!==void 0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-group`,children:[(xe.servesRefs??[]).length>1&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[o(`servesLabel`),` `,(xe.servesRefs??[]).map(ae).join(`, `)]}),!Ae&&je.length===0&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`pastedCredentialNotice`)}),Ce.length>1&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:o(`delegationHeading`)}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`delegationDescription`)}),(0,$.jsx)(bF,{name:`delegation`,schema:l0,options:Ce.map(e=>({value:e,label:o(e===So.SERVICE?`delegationServiceOption`:`delegationUserOption`)})),value:C,placeholder:o(`delegationPlaceholder`),onChange:e=>{w(e),D(!1)}})]}),Ae&&Fe.length>0&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[o(`scopesPrefix`),` `,_Se(Fe,O,o(`scopeChosenBelow`)).join(`, `)]}),(Me.length>0||!Ae&&Pe.length>0)&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:o(`parametersHeading`)}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`parametersDescription`)})]}),[...Ae||xe===void 0?[]:Pe.map(e=>({key:e.slug,label:h0(xe.providerRef,e.slug,Ed.LABEL,ie),description:h0(xe.providerRef,e.slug,Ed.DESCRIPTION,ie),choices:void 0,secret:!0})),...xe===void 0?[]:Me.map(e=>({key:e,label:g0(xe.providerRef,e,Ed.LABEL,ie),description:g0(xe.providerRef,e,Ed.DESCRIPTION,ie),choices:Ne[e],secret:!1}))].map(e=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:e.label}),e.description!==void 0&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:e.description}),e.choices!==void 0&&(e.choices.hostSuffixes??[]).length===0?(0,$.jsx)(bF,{name:e.key,schema:mSe,options:e.choices.values.map(e=>({value:e,label:e})),value:O[e.key]??``,onChange:t=>k(n=>({...n,[e.key]:t}))}):(0,$.jsxs)($.Fragment,{children:[e.choices!==void 0&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[o(`parameterAdmittedHostsPrefix`),` `,[...e.choices.values,...(e.choices.hostSuffixes??[]).map(t=>e.choices?.position===xne.ORIGIN?`https://*${t}`:`*${t}`)].join(`, `)]}),(0,$.jsx)(iN,{"aria-label":e.label,type:e.secret?`password`:`text`,value:O[e.key]??``,onChange:t=>k(n=>({...n,[e.key]:t.target.value}))})]})]},e.key)),De&&(0,$.jsxs)(`div`,{className:`flex items-start gap-item-xs`,children:[(0,$.jsx)(AI,{name:`organizationWideUseAcknowledged`,schema:u0,checked:E,onCheckedChange:D,"aria-describedby":`organization-wide-use-description`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:o(`organizationWideUseAcknowledgement`)}),(0,$.jsx)(Z,{id:`organization-wide-use-description`,className:`text-xs text-muted-foreground`,children:o(`organizationWideUseDescription`)})]})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-item-xs`,children:[(0,$.jsx)(X,{size:Xd.SM,variant:Y.GHOST,disabled:x,onClick:()=>Se(``),children:o(`connectCancelButton`)}),(0,$.jsx)(X,{size:Xd.SM,variant:Y.DEFAULT,disabled:x||!u||xe.notConnectableBecause!==void 0&&xe.notConnectableBecause!==T.NO_AUTHORIZATION_FLOW||Ie||we===void 0||De&&!E,onClick:Oe,children:o(x?`connectingButton`:`connectButton`)})]})]})]})})},t)})})]})]}),be.length>0&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:o(`configurationGapsHeading`)}),(0,$.jsx)(Z,{className:`text-xs`,children:o(`configurationGapsDescription`)}),(0,$.jsx)(`ul`,{className:`list-disc pl-4`,children:be.map(e=>(0,$.jsxs)(`li`,{className:`text-xs`,children:[ae(e.providerRef),`: `,e.envVarNames.join(`, `)]},e.providerRef))})]})})}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(ye)})]})},y0=J.APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS,b0;(function(e){e[e.LAST_30_DAYS=30]=`LAST_30_DAYS`,e[e.LAST_90_DAYS=90]=`LAST_90_DAYS`,e[e.LAST_365_DAYS=365]=`LAST_365_DAYS`})(b0||={});var MSe=[b0.LAST_30_DAYS,b0.LAST_90_DAYS,b0.LAST_365_DAYS],NSe=Object.values(na);function x0(e){return`groupBy_${e}`}function S0(e){return`window_${e}`}function PSe(e,t){switch(t){case na.AGENT:return e.key.agentRef;case na.TOOL:return e.key.toolName;case na.CASE:return e.key.caseRef?`${e.key.caseRef.resourceType}:${e.key.caseRef.resourceId}`:void 0;case na.DECIDER:return e.key.deciderUserId}}function FSe(e,t){return e===null?null:new Intl.NumberFormat(t,{style:`percent`,maximumFractionDigits:1}).format(e)}var ISe=()=>{let{tComponent:e,isReady:t,currentLanguage:n}=K({component:y0}),{currentOrganizationId:r}=Cg(),i=(0,Q.useCallback)(t=>e(y0,t),[e]),[a,o]=(0,Q.useState)(na.AGENT),[s,c]=(0,Q.useState)(b0.LAST_90_DAYS),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!0),[p,m]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(!r){m(null),f(!1);return}let e=!1,t=new Date,n=new Date(t.getTime()-s*24*60*6e4);return f(!0),m(null),lc().summarizeAgentWorkOverrideRate({from:n.toISOString(),to:t.toISOString(),groupBy:a,organizationId:r}).then(t=>{e||u(t)}).catch(()=>{e||m(i(`errorGeneric`))}).finally(()=>{e||f(!1)}),()=>{e=!0}},[r,a,s,i]);let h=(0,Q.useMemo)(()=>l?.groupBy===a?l.groups:[],[l,a]),g=d||l!==null&&l.groupBy!==a;return t?(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:i(`pageTitle`)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`pageDescription`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-section`,children:[(0,$.jsx)(bO,{value:a,onValueChange:e=>o(e),children:(0,$.jsx)(xO,{children:NSe.map(e=>(0,$.jsx)(SO,{value:e,"data-ref":e,children:i(x0(e))},e))})}),(0,$.jsx)(`div`,{className:`flex gap-element`,role:`group`,"aria-label":i(`windowLabel`),children:MSe.map(e=>(0,$.jsx)(X,{size:Xd.SM,variant:e===s?Y.DEFAULT:Y.OUTLINE,"aria-pressed":e===s,onClick:()=>c(e),children:i(S0(e))},e))})]}),p&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:p})}),!(p&&h.length===0)&&(0,$.jsx)(MF,{children:(0,$.jsx)(zF,{className:`p-card`,children:r?g&&h.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`loading`)}):h.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`empty`)}):(0,$.jsxs)(NJ,{children:[(0,$.jsx)(PJ,{children:(0,$.jsxs)(IJ,{children:[(0,$.jsx)(LJ,{children:i(x0(a))}),(0,$.jsx)(LJ,{children:i(`columnAccepted`)}),(0,$.jsx)(LJ,{children:i(`columnAcceptedWithModifications`)}),(0,$.jsx)(LJ,{children:i(`columnRejected`)}),(0,$.jsx)(LJ,{children:i(`columnNotDecided`)}),(0,$.jsx)(LJ,{children:i(`columnOverrideRate`)})]})}),(0,$.jsx)(FJ,{children:h.map((e,t)=>{let r=PSe(e,a),o=FSe(e.overrideRate,n);return(0,$.jsxs)(IJ,{children:[(0,$.jsx)(RJ,{children:r??i(`unattributed`)}),(0,$.jsx)(RJ,{children:e.accepted}),(0,$.jsx)(RJ,{children:e.acceptedWithModifications}),(0,$.jsx)(RJ,{children:e.rejected}),(0,$.jsx)(RJ,{children:e.notDecided}),(0,$.jsx)(RJ,{children:o??i(`nothingDecided`)})]},r??`unattributed-${t}`)})})]}):(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`noOrganization`)})})})]}):null},C0=J.APP_LAYOUTS_AUTONOMOUS_AGENTS_SETTINGS,w0=lr(Ic.shape.status),T0=lr(Ic.shape.autonomousTrigger);function LSe(e){return`reason_${e}`}function RSe(e){return`concurrency_${e}`}function zSe(e){if(e.caseLimit!==void 0&&e.matchedCaseCount!==void 0)return{matched:e.matchedCaseCount,limit:e.caseLimit}}var E0;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(E0||={});var BSe=()=>{let{tComponent:e,t,isReady:n,formatDateTime:r}=K({component:C0,keys:[`system_enums`]}),{currentOrganizationId:i}=Cg(),a=(0,Q.useCallback)((t,n)=>e(C0,t,n),[e]),o=(0,Q.useCallback)((e,n)=>{if(!e)return n;let r=Bo(e,n),i=t(r);return i===r?n:i},[t]),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(E0.LOADING);if((0,Q.useEffect)(()=>{if(!i)return;let e=!1;return u(E0.LOADING),lc().readAutonomousAgentsOverview(i).then(t=>{e||(c(t),u(E0.READY))}).catch(()=>{e||u(E0.FAILED)}),()=>{e=!0}},[i]),!n)return null;let d=s&&s.organizationId===i?s:null,f=d?.agents??[],p=d?.undeclaredAgentRefusals??[],m=d?.refusalsScannedSince;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:a(`pageTitle`)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`pageDescription`)}),i?l===E0.FAILED?(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:a(`errorGeneric`)})}):l===E0.LOADING?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`loading`)}):f.length===0&&p.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`empty`)}):(0,$.jsxs)($.Fragment,{children:[f.map(e=>(0,$.jsx)(VSe,{agent:e,scannedSince:m,tc:a,word:o,formatDateTime:r},e.ref)),p.map(e=>(0,$.jsx)(MF,{"data-autonomous-agent-undeclared":e.autonomousAgentRef,children:(0,$.jsxs)(zF,{className:`flex flex-col gap-section p-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-element`,children:[(0,$.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:e.autonomousAgentRef}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`undeclaredAgent`)})]}),(0,$.jsx)(O0,{refusals:e.recentRefusals,scannedSince:m,tc:a,word:o,formatDateTime:r})]})},e.autonomousAgentRef))]}):(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`noOrganization`)})]})};function D0(e,t){return e?e.organizationRelationshipId===null?t(`partyOwn`):e.representingOrganizationName??t(`partyUnnamedRelationship`):null}function VSe({agent:e,scannedSince:t,tc:n,word:r,formatDateTime:i}){let a=D_(w0??``)?.values;return(0,$.jsx)(MF,{"data-autonomous-agent":e.ref,children:(0,$.jsxs)(zF,{className:`flex flex-col gap-section p-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-element`,children:[(0,$.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:e.ref}),(0,$.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-section gap-y-element text-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`systemLabel`)}),(0,$.jsx)(`dd`,{className:`font-mono`,children:e.systemRef}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`scheduleLabel`)}),(0,$.jsx)(`dd`,{children:e.schedule?(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(`code`,{className:`font-mono`,children:e.schedule.cronJobExpression}),e.schedule.perCaseResourceType?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:n(`perCase`)}):null]}):n(`scheduleNone`)}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`concurrencyLabel`)}),(0,$.jsx)(`dd`,{children:n(RSe(e.concurrency))})]})]}),(0,$.jsxs)(`section`,{className:`flex flex-col gap-element`,"aria-label":n(`recentRunsHeading`),children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold`,children:n(`recentRunsHeading`)}),e.recentRuns.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:n(`noRuns`)}):(0,$.jsxs)(NJ,{children:[(0,$.jsx)(PJ,{children:(0,$.jsxs)(IJ,{children:[(0,$.jsx)(LJ,{children:n(`columnStatus`)}),(0,$.jsx)(LJ,{children:n(`columnParty`)}),(0,$.jsx)(LJ,{children:n(`columnTrigger`)}),(0,$.jsx)(LJ,{children:n(`columnCase`)}),(0,$.jsx)(LJ,{children:n(`columnStarted`)}),(0,$.jsx)(LJ,{children:n(`columnFinished`)})]})}),(0,$.jsx)(FJ,{children:e.recentRuns.map(e=>(0,$.jsxs)(IJ,{"data-autonomous-run":e.executionId,children:[(0,$.jsx)(RJ,{children:(0,$.jsx)(Hf,{variant:a?.[e.status]?.color??`outline`,dot:!0,children:r(w0,e.status)})}),(0,$.jsx)(RJ,{"data-autonomous-party":!0,children:D0(e.party,n)}),(0,$.jsx)(RJ,{children:e.trigger?r(T0,e.trigger):null}),(0,$.jsx)(RJ,{className:`font-mono`,children:e.caseRef?.resourceId??null}),(0,$.jsx)(RJ,{children:i(e.createdAt)}),(0,$.jsx)(RJ,{children:e.finishedAt?i(e.finishedAt):(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:n(`notFinished`)})})]},e.executionId))})]}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:n(`allRunsHint`)})]}),(0,$.jsx)(O0,{refusals:e.recentRefusals,scannedSince:t,tc:n,word:r,formatDateTime:i})]})})}function O0({refusals:e,scannedSince:t,tc:n,word:r,formatDateTime:i}){return(0,$.jsxs)(`section`,{className:`flex flex-col gap-element`,"aria-label":n(`recentRefusalsHeading`),children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold`,children:n(`recentRefusalsHeading`)}),e.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:t?n(`noRefusalsSince`,{since:i(t)}):n(`noRefusals`)}):(0,$.jsxs)(NJ,{children:[(0,$.jsx)(PJ,{children:(0,$.jsxs)(IJ,{children:[(0,$.jsx)(LJ,{children:n(`columnRefusedAt`)}),(0,$.jsx)(LJ,{children:n(`columnParty`)}),(0,$.jsx)(LJ,{children:n(`columnTrigger`)}),(0,$.jsx)(LJ,{children:n(`columnReason`)})]})}),(0,$.jsx)(FJ,{children:e.map(e=>(0,$.jsxs)(IJ,{"data-autonomous-refusal":e.reason,children:[(0,$.jsx)(RJ,{children:i(e.refusedAt)}),(0,$.jsx)(RJ,{"data-autonomous-party":!0,children:D0(e.party,n)}),(0,$.jsx)(RJ,{children:r(T0,e.trigger)}),(0,$.jsx)(RJ,{children:n(LSe(e.reason),zSe(e))})]},`${e.occurrenceKey}:${e.refusedAt}:${e.party?e.party.organizationRelationshipId??`own`:`unknown`}`))})]})]})}function k0(e,t,n){let r=sn(t);if(r!==void 0)return n(Cr(BigInt(e),r),{style:`currency`,currency:t,minimumFractionDigits:r,maximumFractionDigits:r})}var A0=J.APP_LAYOUTS_MODEL_COST_BREAKDOWN_SETTINGS,j0;(function(e){e.APPLICATION=`application`,e.REPRESENTING_ORGANIZATION=`representing-organization`})(j0||={});var M0;(function(e){e[e.LAST_30_DAYS=30]=`LAST_30_DAYS`,e[e.LAST_90_DAYS=90]=`LAST_90_DAYS`,e[e.LAST_365_DAYS=365]=`LAST_365_DAYS`})(M0||={});var HSe=[M0.LAST_30_DAYS,M0.LAST_90_DAYS,M0.LAST_365_DAYS],USe=Object.values(Dr),N0;(function(e){e.GENERIC=`generic`,e.ACCESS_GRANT_REQUIRED=`accessGrantRequired`})(N0||={});function WSe(e){return e===N0.ACCESS_GRANT_REQUIRED?`errorAccessGrantRequired`:`errorGeneric`}function P0(e){return`groupBy_${e}`}function GSe(e){return`window_${e}`}function KSe(e){return`decisionTime_${e}`}function qSe(e,t){switch(t){case Dr.CASE:return e.key.caseRef?`${e.key.caseRef.resourceType} · ${e.key.caseRef.resourceId}`:void 0;case Dr.ORGANIZATION:return e.key.organizationId;case Dr.AGENT:return e.key.agentRef;case Dr.MODEL:return e.key.model?[e.key.provider,e.key.model].filter(Boolean).join(` · `):void 0}}function JSe(e){if(e.availability===ore.JOINED)return{decisions:e.decisionCount??0,minutes:Math.round((e.reviewDurationMs??0)/6e4)}}var F0=({scope:e})=>{let{tComponent:t,isReady:n,formatNumber:r}=K({component:A0}),i=(0,Q.useCallback)((e,n)=>t(A0,e,n),[t]),{currentOrganizationId:a}=Cg(),o=e===j0.REPRESENTING_ORGANIZATION?a??void 0:void 0,s=e===j0.REPRESENTING_ORGANIZATION&&!o,[c,l]=(0,Q.useState)(Dr.CASE),[u,d]=(0,Q.useState)(M0.LAST_30_DAYS),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(!0),[g,_]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(s){_(null),h(!1);return}let e=!1,t=new Date,n=new Date(t.getTime()-u*24*60*6e4);return h(!0),_(null),lc().summarizeModelCost({from:n.toISOString(),to:t.toISOString(),groupBy:c,...o?{organizationId:o}:{}}).then(t=>{e||p({summary:t,windowDays:u,organizationId:o})}).catch(t=>{e||(Er(t)&&t.customMessageReference===ii.AUTHORIZATIONS_APPLICATION_ACCESS_GRANT_REQUIRED?_(N0.ACCESS_GRANT_REQUIRED):_(N0.GENERIC))}).finally(()=>{e||h(!1)}),()=>{e=!0}},[c,u,o,s]);let v=f&&f.windowDays===u&&f.summary.groupBy===c&&f.organizationId===o?f.summary:null,y=(0,Q.useMemo)(()=>v?.groups??[],[v]),b=m||v===null;if(!n)return null;let x=e=>{let t=e.totals.flatMap(e=>{let t=k0(e.costMinor,e.currency,r);return t===void 0?[]:[t]});return t.length>0?t.join(`, `):i(`noPricedCost`)},S=e=>e.totals.reduce((e,t)=>e+t.totalTokens,0);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:i(e===j0.REPRESENTING_ORGANIZATION?`representingPageTitle`:`pageTitle`)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(e===j0.REPRESENTING_ORGANIZATION?`representingPageDescription`:`pageDescription`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-section`,children:[(0,$.jsx)(bO,{value:c,onValueChange:e=>l(e),children:(0,$.jsx)(xO,{children:USe.map(e=>(0,$.jsx)(SO,{value:e,"data-ref":e,children:i(P0(e))},e))})}),(0,$.jsx)(`div`,{className:`flex gap-element`,role:`group`,"aria-label":i(`windowLabel`),children:HSe.map(e=>(0,$.jsx)(X,{size:Xd.SM,variant:e===u?Y.DEFAULT:Y.OUTLINE,"aria-pressed":e===u,onClick:()=>d(e),children:i(GSe(e))},e))})]}),s?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`noOrganization`)}):g?(0,$.jsx)(UD,{variant:g===N0.ACCESS_GRANT_REQUIRED?`default`:`destructive`,children:(0,$.jsx)(GD,{children:i(WSe(g))})}):(0,$.jsx)(MF,{children:(0,$.jsxs)(zF,{className:`flex flex-col gap-element p-card`,children:[b&&y.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`loading`)}):y.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`empty`)}):(0,$.jsxs)(NJ,{children:[(0,$.jsx)(PJ,{children:(0,$.jsxs)(IJ,{children:[(0,$.jsx)(LJ,{children:i(P0(c))}),(0,$.jsx)(LJ,{children:i(`columnCost`)}),(0,$.jsx)(LJ,{children:i(`columnCalls`)}),(0,$.jsx)(LJ,{children:i(`columnUnpriced`)}),(0,$.jsx)(LJ,{children:i(`columnTokens`)}),(0,$.jsx)(LJ,{children:i(`columnClassifierCalls`)}),(0,$.jsx)(LJ,{children:i(`columnDocumentExtractionCalls`)}),(0,$.jsx)(LJ,{children:i(`columnPersonalDataWithheld`)}),c===Dr.CASE?(0,$.jsx)(LJ,{children:i(`columnDecisionTime`)}):null]})}),(0,$.jsx)(FJ,{children:y.map((e,t)=>{let n=qSe(e,c);return(0,$.jsxs)(IJ,{"data-model-cost-group":n??`unattributed`,children:[(0,$.jsx)(RJ,{className:n?`font-mono`:`text-muted-foreground`,children:n??i(`unattributed`)}),(0,$.jsx)(RJ,{className:`tabular-nums`,children:x(e)}),(0,$.jsx)(RJ,{className:`tabular-nums`,children:r(e.callCount)}),(0,$.jsx)(RJ,{className:`tabular-nums`,children:r(e.unpricedCallCount)}),(0,$.jsx)(RJ,{className:`tabular-nums`,children:r(S(e))}),(0,$.jsx)(RJ,{className:`tabular-nums`,children:r(e.classifierCallCount)}),(0,$.jsx)(RJ,{className:`tabular-nums`,children:r(e.documentExtractionCallCount)}),(0,$.jsx)(RJ,{className:`tabular-nums`,children:r(e.personalDataFieldsWithheld)}),c===Dr.CASE?(0,$.jsx)(RJ,{children:e.decisionTime?i(KSe(e.decisionTime.availability),JSe(e.decisionTime)):null}):null]},n??`unattributed-${t}`)})})]}),v&&v.unattributedCallCount>0?(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:i(`windowUnattributed`,{count:v.unattributedCallCount})}):null,v&&v.unpricedCallCount>0?(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:i(`windowUnpriced`,{count:v.unpricedCallCount})}):null]})})]})},I0=J.APP_LAYOUTS_REPRESENTATIVE_ACTIVITY_SETTINGS,L0;(function(e){e[e.LAST_7_DAYS=7]=`LAST_7_DAYS`,e[e.LAST_30_DAYS=30]=`LAST_30_DAYS`,e[e.LAST_365_DAYS=365]=`LAST_365_DAYS`})(L0||={});var YSe=[L0.LAST_7_DAYS,L0.LAST_30_DAYS,L0.LAST_365_DAYS];function XSe(e){return`window_${e}`}function R0(e){return`disclosure_${e}`}function ZSe(e){return`outcome_${e}`}function QSe(e){let t=[e.resourceType,e.operationIdentifier,e.resourceId].filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` · `):void 0}var $Se=()=>{let{tComponent:e,t,isReady:n,formatDateTime:r}=K({component:I0}),i=(0,Q.useCallback)((t,n)=>e(I0,t,n),[e]),{currentOrganizationId:a}=Cg(),o=a??void 0,[s,c]=(0,Q.useState)(L0.LAST_30_DAYS),[l,u]=(0,Q.useState)(null),[d,p]=(0,Q.useState)(!0),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(null),b=(0,Q.useCallback)(async e=>lc().readRepresentativeActivity(e),[]);(0,Q.useEffect)(()=>{if(!o){h(!1),p(!1);return}let e=!1,t=new Date,n=new Date(t.getTime()-s*24*60*6e4),r={organizationId:o,from:n.toISOString(),to:t.toISOString()};return p(!0),h(!1),_(!1),y(null),b(r).then(t=>{e||u({...r,rows:t.rows,nextCursor:t.nextCursor,windowDays:s})}).catch(()=>{e||h(!0)}).finally(()=>{e||p(!1)}),()=>{e=!0}},[o,s,b]);let x=(0,Q.useCallback)(()=>{if(!l?.nextCursor)return;let e=l;p(!0),_(!1),b({organizationId:e.organizationId,from:e.from,to:e.to,cursor:e.nextCursor}).then(t=>u(n=>n===e?{...e,rows:[...e.rows,...t.rows],nextCursor:t.nextCursor}:n)).catch(()=>_(!0)).finally(()=>p(!1))},[l,b]),S=l&&l.windowDays===s&&l.organizationId===o?l:null,C=S?.rows??[];if(!n)return null;let w=e=>{let n=Bo(Pa.CORE_AUDITABLE_EVENT_TYPE,e),r=t(n);return r===n?Xo(e):r};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:i(`pageTitle`)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`pageDescription`)}),(0,$.jsx)(`div`,{className:`flex gap-element`,role:`group`,"aria-label":i(`windowLabel`),children:YSe.map(e=>(0,$.jsx)(X,{size:Xd.SM,variant:e===s?Y.DEFAULT:Y.OUTLINE,"aria-pressed":e===s,onClick:()=>c(e),children:i(XSe(e))},e))}),o?m?(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:i(`errorGeneric`)})}):(0,$.jsx)(MF,{children:(0,$.jsxs)(zF,{className:`flex flex-col gap-element p-card`,children:[S===null?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`loading`)}):C.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`empty`)}):(0,$.jsxs)(NJ,{children:[(0,$.jsx)(PJ,{children:(0,$.jsxs)(IJ,{children:[(0,$.jsx)(LJ,{children:i(`columnWhen`)}),(0,$.jsx)(LJ,{children:i(`columnOrganization`)}),(0,$.jsx)(LJ,{children:i(`columnPerson`)}),(0,$.jsx)(LJ,{children:i(`columnEvent`)}),(0,$.jsx)(LJ,{children:i(`columnTarget`)}),(0,$.jsx)(LJ,{children:i(`columnOutcome`)}),(0,$.jsx)(LJ,{children:i(`columnDetail`)})]})}),(0,$.jsx)(FJ,{children:C.map(e=>{let t=QSe(e),n=v===e.eventId;return(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsxs)(IJ,{"data-representative-activity-row":e.eventId,"data-disclosure":e.disclosure,children:[(0,$.jsx)(RJ,{className:`tabular-nums`,children:r(e.createdAt)}),(0,$.jsx)(RJ,{className:e.grantingOrganizationName?void 0:`font-mono`,children:e.grantingOrganizationName??e.grantingOrganizationId}),(0,$.jsx)(RJ,{className:e.userName?void 0:e.userId?`font-mono`:`text-muted-foreground`,children:e.userName??e.userId??e.agentRef??i(`automatedActor`)}),(0,$.jsx)(RJ,{children:w(e.eventType)}),(0,$.jsx)(RJ,{className:`font-mono`,children:t??null}),(0,$.jsx)(RJ,{className:e.outcome===bie.FAILURE?`text-destructive`:void 0,children:i(ZSe(e.outcome))}),(0,$.jsx)(RJ,{children:e.disclosure===f.FULL?(0,$.jsx)(X,{size:Xd.SM,variant:Y.OUTLINE,"aria-expanded":n,onClick:()=>y(n?null:e.eventId),children:i(n?`hideDetail`:R0(f.FULL))}):(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:i(R0(f.METADATA))})})]}),n&&e.eventData?(0,$.jsx)(IJ,{children:(0,$.jsx)(RJ,{colSpan:7,children:(0,$.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-all text-xs`,"data-representative-activity-detail":e.eventId,children:JSON.stringify(e.eventData,null,2)})})}):null]},e.eventId)})})]}),g?(0,$.jsx)(Z,{className:`text-xs text-destructive`,children:i(`errorLoadMore`)}):null,S?.nextCursor?(0,$.jsx)(`div`,{children:(0,$.jsx)(X,{size:Xd.SM,variant:Y.OUTLINE,disabled:d,onClick:x,children:i(`loadMore`)})}):null]})}):(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`noOrganization`)})]})},z0=J.APP_LAYOUTS_AGENT_WORK_EVALUATION_EXPORT_SETTINGS,B0=864e5,eCe=b0.LAST_365_DAYS,tCe=[b0.LAST_30_DAYS,b0.LAST_90_DAYS,b0.LAST_365_DAYS],nCe=vte.shape.destination.maxLength??void 0,rCe=kd().min(1);function iCe(e,t){return`evaluation-dataset-${e}-${t}.jsonl`}function aCe(e,t){let n=e.resourceConfigurations[Na.EVALUATION_EXPORT_AUTHORIZATIONS],r=n?.operations.find(e=>e.operationIdentifier===W.READ&&e.isOperationDefault===!0&&e.variantType===Ya.API_CALL);if(!n||!r)return;let i=pm.buildResourceOperationContextIdentifiers({currentOrganizationId:t,primaryScope:n.resourcePrimaryScope,explicitContextResourceIdentifiers:{}});return{operationPathKey:gl.buildOperationPathKeyFromOperation(r),contextualParameters:V.buildContextualParameters(i,e)}}var oCe=()=>{let{tComponent:e,isReady:t}=K({component:z0}),{currentOrganizationId:n}=Cg(),{registry:r,doOperation:i}=wm(),a=(0,Q.useCallback)(t=>e(z0,t),[e]),o=(0,Q.useCallback)((t,n)=>e(z0,t,n),[e]),s=(0,Q.useRef)(a);s.current=a;let[c,l]=(0,Q.useState)([]),[u,d]=(0,Q.useState)(!0),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(b0.LAST_90_DAYS),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(T(null),!n)return;let e=aCe(r,n);if(e===void 0)return;let t=!1;return i(e.operationPathKey,{contextualParameters:e.contextualParameters},{silent:!0,riskLevel:ls.LOW}).then(e=>{t||T(e?.status===Tn.ACTIVE)}).catch(()=>{}),()=>{t=!0}},[n,i,r]);let E=w===!1;(0,Q.useEffect)(()=>{if(!n){l([]),d(!1);return}let e=!1,t=new Date;return d(!0),lc().summarizeAgentWorkOverrideRate({from:new Date(t.getTime()-eCe*B0).toISOString(),to:t.toISOString(),groupBy:na.AGENT,organizationId:n}).then(t=>{e||l([...new Set(t.groups.map(e=>e.key.agentRef).filter(e=>typeof e==`string`&&e.length>0))])}).catch(()=>{e||C(s.current(`errorGeneric`))}).finally(()=>{e||d(!1)}),()=>{e=!0}},[n]);let D=(0,Q.useCallback)(async()=>{if(!n||E||f===``||g.trim()===``)return;y(!0),C(null),x(null);let e=new Date;try{let t=await lc().exportEvaluationDataset({organizationId:n,agentRef:f,from:new Date(e.getTime()-m*B0).toISOString(),to:e.toISOString(),destination:g.trim()});eb(new Blob([t.jsonl],{type:`application/x-ndjson`}),iCe(f,t.exportId)),x({exportId:t.exportId,recordCount:t.recordCount})}catch(e){Kr(e)||C(a(`errorGeneric`))}finally{y(!1)}},[f,E,n,g,a,m]);return t?(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:a(`pageTitle`)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`pageDescription`)}),S&&(0,$.jsx)(UD,{variant:`destructive`,children:(0,$.jsx)(GD,{children:S})}),E&&(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:a(`authorizationMissingNotice`)})}),b&&(0,$.jsx)(UD,{children:(0,$.jsx)(GD,{children:o(`exportedNotice`,{count:b.recordCount})})}),(0,$.jsx)(MF,{children:(0,$.jsx)(zF,{className:`flex flex-col gap-group p-card`,children:n?u?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`loading`)}):c.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`noAgents`)}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:a(`agentLabel`)}),(0,$.jsx)(bF,{name:`agentRef`,schema:rCe,options:c.map(e=>({value:e,label:e})),value:f,placeholder:a(`agentPlaceholder`),onChange:e=>{p(e),x(null)}})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:a(`windowLabel`)}),(0,$.jsx)(`div`,{className:`flex gap-element`,role:`group`,"aria-label":a(`windowLabel`),children:tCe.map(e=>(0,$.jsx)(X,{size:Xd.SM,variant:e===m?Y.DEFAULT:Y.OUTLINE,"aria-pressed":e===m,onClick:()=>h(e),children:a(S0(e))},e))})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:a(`destinationLabel`)}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:a(`destinationDescription`)}),(0,$.jsx)(iN,{"aria-label":a(`destinationLabel`),type:`text`,maxLength:nCe,value:g,onChange:e=>_(e.target.value)})]}),(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(X,{size:Xd.SM,variant:Y.DEFAULT,disabled:v||E||f===``||g.trim()===``,onClick:()=>{D()},children:a(v?`runningButton`:`runButton`)})})]}):(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`noOrganization`)})})})]}):null},V0=new Set;function H0(e){let{resolvedFeatures:t,resolvedFeaturesResponse:n,featureDefinitions:r,unavailabilityPolicy:i,isLoading:a}=Nh(),{permissions:o}=Cg(),{track:s,isActive:c}=A$(),l=ag(),u=lm(),d=(0,Q.useMemo)(()=>{if(a)return{isAvailable:!0,behavior:co.DISABLE};let s=r.get(e);if(!s){let{behavior:t,debugTrace:n}=_g({reason:el.NOT_CONFIGURED,featureDef:void 0,policy:i,userRoles:[],billingEnabled:l?.isEnabled??!1});return{isAvailable:!1,reason:el.NOT_CONFIGURED,behavior:t,missingFeatures:[e],debugTrace:va.isDevelopment()?n:void 0}}let c=Xh(o,u?.currentOrganizationId??null);if(s.valueType===Fl.BOOLEAN){if(new Set(t.features).has(e))return{isAvailable:!0,behavior:co.DISABLE};let r=el.FEATURE_NOT_ENABLED,{behavior:a,suggestedProductRef:o,customComponentRef:u,debugTrace:d}=_g({reason:r,featureDef:s,policy:i,userRoles:c,billingEnabled:l?.isEnabled??!1}),f=n?.upgradeOptions?.[e]?.availableVia;return{isAvailable:!1,reason:r,behavior:a,missingFeatures:[e],upgradeOptions:f,suggestedProductRef:o,customComponentRef:u,debugTrace:va.isDevelopment()?d:void 0}}if(s.valueType===Fl.LIMIT){let r=t.limits[e];if(r===void 0||r===-1)return{isAvailable:!0,behavior:co.DISABLE};let a=t.currentUsage[e]??0;if(a<r)return{isAvailable:!0,behavior:co.DISABLE};let o=el.LIMIT_EXCEEDED,{behavior:u,suggestedProductRef:d,customComponentRef:f,debugTrace:p}=_g({reason:o,featureDef:s,policy:i,userRoles:c,billingEnabled:l?.isEnabled??!1}),m=n?.upgradeOptions?.[e]?.availableVia;return{isAvailable:!1,reason:o,behavior:u,limitInfo:{featureId:e,current:a,limit:r},upgradeOptions:m,suggestedProductRef:d,customComponentRef:f,debugTrace:va.isDevelopment()?p:void 0}}return{isAvailable:!0,behavior:co.DISABLE}},[e,a,t,n,r,i,o,u?.currentOrganizationId,l?.isEnabled]);return(0,Q.useEffect)(()=>{if(!c)return;let t=`${e}:${d.isAvailable}`;V0.has(t)||(V0.add(t),s(`feature_gate`,{featureRef:e,isAvailable:d.isAvailable,reason:d.reason}),d.isAvailable&&s(`feature_accessed`,{featureId:e}))},[e,d.isAvailable,d.reason,c,s]),d}function U0({featureId:e,children:t,renderUnavailable:n}){let r=H0(e),i=Uh();return r.isAvailable?(0,$.jsx)($.Fragment,{children:t}):r.behavior===co.HIDE?null:n?(0,$.jsx)($.Fragment,{children:n(r)}):(0,$.jsx)(ng,{behavior:r.behavior,missingFeatures:r.missingFeatures,limitInfo:r.limitInfo,upgradeOptionsCount:r.upgradeOptions?.length,customComponentRef:r.customComponentRef,onDismiss:void 0,onAction:()=>i(r)})}function sCe(e,t){switch(t.type){case`push`:return[...e,{id:Ch.generateStackEntryId(),context:t.context}];case`pop`:return e.length>1?e.slice(0,-1):e;case`resetToRoot`:return e.length>1?[e[0]]:e}}function cCe(e){return{navigate:t=>{Ch.isResourceOperationContent(t.content)?e.dispatch({type:`push`,context:t.content.resourceContext}):e.globalController.navigate(t)},navigateToResource:t=>e.dispatch({type:`push`,context:t}),goBack:()=>e.dispatch({type:`pop`}),closeOverlay:()=>e.dispatch({type:`resetToRoot`}),dismissZone:t=>e.globalController.dismissZone(t),canGoBack:()=>e.getDepth()>1,resourceRelationshipDepth:e.globalController.resourceRelationshipDepth}}function lCe({rootContext:e}){let t=RS(),[n,r]=(0,Q.useReducer)(sCe,e,e=>[{id:Ch.generateStackEntryId(),context:e}]),i=(0,Q.useRef)(n);i.current=n;let a=(0,Q.useMemo)(()=>cCe({dispatch:r,getDepth:()=>i.current.length,globalController:t}),[t]),o=n[n.length-1];return(0,$.jsx)(LS.Provider,{value:a,children:(0,$.jsx)(oX,{resourceContext:o.context,navigationZone:qn.OVERLAY,navigationInitiator:{sourceZone:qn.OVERLAY}},o.id)})}function uCe(e,t,n,r){return t!==td.APPLICATION||!r||e[Na.ORGANIZATIONS]!==void 0?e:(n.initiatorInfos??[]).some(e=>e.parameters?.some(e=>e.resourceType===Na.ORGANIZATIONS))?{...e,[Na.ORGANIZATIONS]:r}:e}function dCe(e,t,n){let r=(Array.isArray(e.operations)?e.operations:[]).filter(e=>String(e.operationIdentifier)===t);if(r.length===0)return;if(n)return r.find(e=>e.variantKey===n);let i=r.filter(e=>e.isOperationDefault===!0);if(i.length===1)return i[0];if(r.length===1)return r[0]}function fCe({message:e}){return(0,$.jsx)(`div`,{className:`p-card text-sm text-muted-foreground`,children:e})}function pCe({resourceType:e,operation:t,operationVariant:n}){let{registry:r}=wm(),i=lm(),a=(0,Q.useContext)(Mi)?.appIdentity?.applicationId??i?.currentApplicationId??null,o=(0,Q.useMemo)(()=>{let o=r.resourceConfigurations[e];if(!o)return;let s=dCe(o,t,n);if(!s)return;let c=uCe(pm.buildResourceOperationContextIdentifiers({currentUserId:i?.currentUserId,currentOrganizationId:i?.currentOrganizationId,currentApplicationId:a,currentAnonymousUserId:i?.currentAnonymousUserId,primaryScope:o.resourcePrimaryScope,liveAppScopeContextResourceIdentifiers:i?.buildContextResourceIdentifiers?.(),explicitContextResourceIdentifiers:{}}),o.resourcePrimaryScope,s,i?.currentOrganizationId),l=Wx(o,r.allResourceFieldIdentifiers)&&lo(s)&&c[e]===void 0?c[Na.USERS]:void 0,u=typeof l==`string`?{...c,[e]:l}:c,d=gn.buildParentResourcesRequirements(e,u,r);return gn.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:s,contextResourceIdentifiers:u,parentResourcesRequirements:d})},[r,e,t,n,i,a]);if(!o)return(0,$.jsx)(fCe,{message:`Settings surface unavailable for ${e} (${t}).`});let s=[e,t,n??``,i?.currentOrganizationId??``,i?.currentUserId??``,a??``].join(`|`);return(0,$.jsx)(lCe,{rootContext:o},s)}function mCe(e){return[...e.categories].sort((e,t)=>(e.order??0)-(t.order??0))}function hCe(e,t){return e.sections.filter(e=>e.categoryRef===t).sort((e,t)=>(e.order??0)-(t.order??0))}function gCe(e,t){let n=[...e.groups??[]].sort((e,t)=>(e.order??0)-(t.order??0)),r=new Set(n.map(e=>e.ref)),i=t.filter(e=>e.groupRef===void 0||!r.has(e.groupRef));return[...i.length>0?[{sections:i}]:[],...n.map(e=>({group:e,sections:t.filter(t=>t.groupRef===e.ref)})).filter(e=>e.sections.length>0)]}function _Ce(e,t){return t&&e.sections.some(e=>e.ref===t)?t:e.defaultSectionRef&&e.sections.some(t=>t.ref===e.defaultSectionRef)?e.defaultSectionRef:e.sections[0]?.ref}function vCe({panelRef:e}){switch(e){case kv.SECURITY:return(0,$.jsx)(Jxe,{});case kv.APPEARANCE:return(0,$.jsx)(rSe,{});case kv.INVITATIONS:return(0,$.jsx)(oSe,{});case kv.BILLING:return(0,$.jsx)(lSe,{});case kv.CONNECTED_ACCOUNTS:return(0,$.jsx)(v0,{ownerScope:Yu.USER});case kv.ORGANIZATION_CONNECTED_ACCOUNTS:return(0,$.jsx)(v0,{ownerScope:Yu.ORGANIZATION});case kv.APPLICATION_CONNECTED_ACCOUNTS:return(0,$.jsx)(v0,{ownerScope:Yu.APPLICATION});case kv.AGENT_WORK_OVERRIDE_RATE:return(0,$.jsx)(ISe,{});case kv.AUTONOMOUS_AGENTS:return(0,$.jsx)(BSe,{});case kv.MODEL_COST_BREAKDOWN:return(0,$.jsx)(F0,{scope:j0.APPLICATION});case kv.REPRESENTING_ORGANIZATION_MODEL_COST_BREAKDOWN:return(0,$.jsx)(F0,{scope:j0.REPRESENTING_ORGANIZATION});case kv.REPRESENTATIVE_ACTIVITY:return(0,$.jsx)($Se,{});case kv.AGENT_WORK_EVALUATION_EXPORT:return(0,$.jsx)(oCe,{})}}function W0({target:e,resolveSubTabLabel:t,subTabRef:n,onSubTabChange:r}){switch(e.kind){case Ov.ENGINE_PANEL:return(0,$.jsx)(vCe,{panelRef:e.panelRef});case Ov.CUSTOM_COMPONENT:{let t=wo.resolve(e.componentRef,q.DEFAULT);return t?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{className:`h-8 animate-pulse motion-reduce:animate-none bg-muted rounded`,"aria-hidden":`true`}),children:(0,$.jsx)(t,{})}):(0,$.jsx)(Yc,{componentType:e.componentRef,componentName:e.componentRef})}case Ov.RESOURCE_OPERATION:return(0,$.jsx)(pCe,{resourceType:e.resourceType,operation:e.operation,operationVariant:e.operationVariant});case Ov.SUB_TABS:return(0,$.jsx)(yCe,{target:e,resolveSubTabLabel:t,subTabRef:n,onSubTabChange:r})}}function yCe({target:e,resolveSubTabLabel:t,subTabRef:n,onSubTabChange:r}){let i=e.subTabs.some(e=>e.ref===n)?n:e.subTabs[0]?.ref;return e.subTabs.length===0?null:(0,$.jsxs)(bO,{value:i,onValueChange:e=>r?.(e),children:[(0,$.jsx)(xO,{children:e.subTabs.map(e=>(0,$.jsx)(SO,{value:e.ref,"data-ref":e.ref,children:t(e.ref,e.label)},e.ref))}),e.subTabs.map(e=>(0,$.jsx)(CO,{value:e.ref,children:(0,$.jsx)(W0,{target:e.target,resolveSubTabLabel:t})},e.ref))]})}var bCe=`inline-flex w-full cursor-pointer items-center justify-start gap-1.5 whitespace-nowrap rounded-md px-card-sm py-item text-sm font-medium no-underline [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`;function xCe({sectionRef:e,subTabRef:t}){let n=Z$(),r=(0,Q.useMemo)(()=>mCe(n),[n]),i=(0,Q.useMemo)(()=>_Ce(n,e),[n,e]),a=vh(),o=(0,Q.useCallback)(e=>{i&&a(`${Cn.settings}/${i}/${e}`,{replace:!0})},[i,a]),{UIConfig:s,getRecipe:c}=e_(),l=c(wi.SELECTABLE,B.FILLED),u=c(wi.TYPOGRAPHY,Lu.EYEBROW),d=c(wi.TYPOGRAPHY,Lu.LABEL),{renderIcon:f}=Rf(),p=s?.currentBreakpoint===ci.MOBILE,m=p&&!!e,h=(0,Q.useCallback)(()=>{a(Cn.settings,{replace:!0})},[a]),{tComponent:g,tSettingsHubCategory:_,tSettingsHubGroup:v,tSettingsHubSection:y,isReady:b}=K({component:J.APP_LAYOUTS_SETTINGS_HUB}),x=(0,Q.useCallback)(e=>g(J.APP_LAYOUTS_SETTINGS_HUB,e),[g]),S=(0,Q.useMemo)(()=>{let e=n.sections.find(e=>e.ref===i);return e?y(e.ref,e.label):void 0},[n.sections,i,y]),C=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{i&&C.current?.scrollIntoView({block:`nearest`,inline:`nearest`})},[i]),(0,$.jsx)(yb,{readiness:[{id:`settings-hub-labels`,isReady:b}],children:(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col min-w-0`,children:[(0,$.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center gap-item border-b px-card-lg`,children:[m&&(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.ICON_SM,"aria-label":x(`backToSections`),onClick:h,children:f(H.BACK,{size:fa.SM})}),(0,$.jsx)(`h2`,{className:`truncate text-base font-semibold tracking-tight`,children:m?S??x(`title`):x(`title`)})]}),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,$.jsx)(`nav`,{"aria-label":x(`sectionsNavLabel`),className:U(`overflow-y-auto px-card-sm py-card`,p?`w-full flex-1`:`w-60 shrink-0 border-e`,m&&`hidden`),children:r.map((e,t)=>{let r=hCe(n,e.ref);if(r.length===0)return null;let a=`settings-hub-category-${e.ref}`;return(0,$.jsxs)(Q.Fragment,{children:[t>0&&(0,$.jsx)(H1,{className:`my-item`}),(0,$.jsx)(`div`,{id:a,className:U(`px-card-sm py-card-sm`,u.base),children:_(e.ref,e.label)}),(0,$.jsx)(`div`,{role:`group`,"aria-labelledby":a,children:gCe(e,r).map(t=>(0,$.jsxs)(Q.Fragment,{children:[t.group&&(0,$.jsx)(`div`,{id:`${a}-group-${t.group.ref}`,className:U(`px-card-sm pt-card-sm pb-item-xs text-muted-foreground`,d.base),children:v(e.ref,t.group.ref,t.group.label)}),(0,$.jsx)(`div`,{role:t.group?`group`:void 0,"aria-labelledby":t.group?`${a}-group-${t.group.ref}`:void 0,children:t.sections.map(e=>{let t=e.ref===i;return(0,$.jsxs)(Rh,{ref:t?C:void 0,to:`${Cn.settings}/${e.ref}`,replace:!0,"data-ref":e.ref,"aria-current":t?`page`:void 0,"data-state":t?`active`:`inactive`,className:U(bCe,l.base,l.states.focus,l.states.selected,l.motion.transition),children:[e.icon&&f(e.icon,{size:fa.SM}),y(e.ref,e.label)]},e.ref)})})]},t.group?.ref??`__ungrouped`))})]},e.ref)})}),(0,$.jsx)(`div`,{className:U(`min-w-0 flex-1 overflow-y-auto p-card-lg`,p&&!m&&`hidden`),children:n.sections.filter(e=>e.ref===i).map(e=>(0,$.jsx)(Q.Fragment,{children:e.entitlementFeatureId?(0,$.jsx)(SCe,{featureId:e.entitlementFeatureId,keptConfigurationNotice:x(`entitlementLapsedConfigurationKept`),children:(0,$.jsx)(W0,{target:e.target,resolveSubTabLabel:y,subTabRef:e.ref===i?t:void 0,onSubTabChange:o})}):(0,$.jsx)(W0,{target:e.target,resolveSubTabLabel:y,subTabRef:e.ref===i?t:void 0,onSubTabChange:o})},e.ref))})]})]})})}function SCe({featureId:e,keptConfigurationNotice:t,children:n}){let r=H0(e),i=!r.isAvailable&&r.behavior!==co.HIDE,a=(r.upgradeOptions?.length??0)>0;return i?(0,$.jsxs)(`div`,{className:`space-y-card`,children:[(0,$.jsx)(UD,{variant:`info`,children:(0,$.jsx)(GD,{children:t})}),a&&(0,$.jsx)(U0,{featureId:e,children:null}),n]}):(0,$.jsx)(`div`,{className:`space-y-card`,children:(0,$.jsx)(U0,{featureId:e,children:n})})}function CCe(e){return e.requested===null||e.isMobile?null:e.requested===li.SECONDARY?e.secondaryShown&&e.secondaryHasContent?li.SECONDARY:null:e.requested===li.COMPANION&&e.companionShown&&e.companionHasContent?li.COMPANION:null}function wCe(e){if(e.key!==`Escape`||!e.emphasized||e.overlayOpen)return!1;let t=e.target instanceof HTMLElement?e.target:null;if(t===null)return!0;if(t.isContentEditable)return!1;let n=t.tagName;return n!==`INPUT`&&n!==`TEXTAREA`&&n!==`SELECT`}function TCe(e){let{homeCompositeViewRef:t,isAppRootPath:n,primaryStackTop:r}=e;if(n&&t&&!(r&&r.contentType!==hd.ENGINE_PAGE))return{contentType:hd.COMPOSITE_VIEW,viewRef:t}}function ECe(e){let{primaryContent:t,compositeViews:n}=e;return t?t.contentType===hd.COMPOSITE_VIEW?n?.some(e=>e.ref===t.viewRef)??!1:!0:!1}function G0(e){let{primaryContent:t,compositeViews:n,resolveExecutionView:r}=e;if(t){if(t.contentType===hd.RESOURCE_OPERATION)return t.resourceContext?.operation?.operationFrontendConfig;if(t.contentType===hd.COMPOSITE_VIEW)return n?.find(e=>e.ref===t.viewRef);if(t.contentType===hd.EXECUTION_VIEW)return r?.(t.viewRef)}}function K0({zone:e,zones:t,destinationOverride:n}){return e===li.PRIMARY?ta.COLLAPSE:n??t?.[e]?.onEmpty??ta.COLLAPSE}function q0(e){return e===ta.EMPTY_STATE}function J0(e){return e.hasContent&&!q0(e.behavior)}function DCe(e){return G0(e)?.adjacentZoneOnEmpty}var Y0={maxWidth:`content`,fillsHeight:!1};function OCe(e){let t=G0(e);return{maxWidth:t?.zoneContentMaxWidth??Y0.maxWidth,fillsHeight:t?.zoneContentFillsHeight??Y0.fillsHeight}}function X0(e){return{maxWidth:G0({primaryContent:e.zoneContent,compositeViews:e.compositeViews,resolveExecutionView:e.resolveExecutionView})?.zoneContentMaxWidth??Y0.maxWidth,fillsHeight:!1}}function kCe(e,t){return e.maxWidth===Y0.maxWidth?t:{...t,geometry:{responsiveMaxWidth:e.maxWidth}}}function ACe(e){return e.fillsHeight?`flex h-full min-h-0 flex-col`:void 0}var jCe=Q.lazy(()=>T_(()=>import(`./ChartView-Dxhrm4ZQ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),Z0=Jo.getLogger(),Q0=Z0.debugByType(`NavigationContentAreas`);Z0.setDebugTypeLogging(`NavigationContentAreas`,!1);var MCe={[ao.HOME]:eW,[ao.DECISIONS]:ZW},NCe=`no-entry`;function $0(e,t){let n=t||NCe,r=e=>Object.entries(e??{}).map(([e,t])=>`${e}:${t}`).join(`|`);switch(e.contentType){case hd.RESOURCE_OPERATION:{let t=e.resourceContext,r=Object.entries(t.contextResourceIdentifiers).map(([e,t])=>`${e}:${typeof t==`string`?t:t.resourceId}`).join(`|`);return`${e.contentType}-${t.resourceType}-${t.operationIdentifier}-${r}-${n}`}case hd.COMPOSITE_VIEW:case hd.CHART_VIEW:case hd.FULL_CUSTOM_VIEW:case hd.FLOWS_ACTORS_VIEW:case hd.EXECUTION_VIEW:return`${e.contentType}-${e.viewRef}-${e.contentType===hd.CHART_VIEW?e.runtimeDescriptor?.identity.insertedViewRef??``:``}-${r(e.contextResourceIdentifiers)}-${e.contentType===hd.CHART_VIEW?r(e.urlParamValues):``}-${n}`;case hd.CUSTOM_COMPONENT:return`${e.contentType}-${e.componentRef}-${r(e.contextResourceIdentifiers)}-${n}`;case hd.ENGINE_PAGE:return`${e.contentType}-${e.pageRef}-${n}`;case hd.INLINE_CREATE:return`${e.contentType}-${e.resourceContext.resourceType}-${e.resourceContext.operationIdentifier}-${n}`;case hd.ERROR_MODAL:return`${e.contentType}-${e.errorType}-${n}`;case hd.SETTINGS_HUB:return e.contentType;default:return`unknown-${e.contentType}-${n}`}}var e2=({content:e,zone:t,initiator:n,entryId:r})=>{let{tComponent:i,isReady:a}=K({component:J.HIGH_LEVEL_VIEWS_CHART}),{registry:o}=wm(),s=$0(e,r);if(Q0(`Rendering content`,{contentType:e.contentType,zone:t,contentKey:s}),e.contentType===hd.RESOURCE_OPERATION)return(0,$.jsx)(oX,{resourceContext:e.resourceContext,navigationZone:t,navigationInitiator:n},s);if(e.contentType===hd.COMPOSITE_VIEW)return(0,$.jsx)(JU,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers,navigationZone:t,navigationInitiator:n},s);if(e.contentType===hd.CHART_VIEW){if(!a)return null;let t=e.runtimeDescriptor?.chartDefinition.requiredFeatures??e.viewDefinition?.chartDefinition.requiredFeatures??e.requiredFeatures??Wp({viewRef:e.viewRef,registry:o})?.chartView.chartDefinition.requiredFeatures;return(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`p-container text-center text-muted-foreground`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:i(J.HIGH_LEVEL_VIEWS_CHART,`loading`)})}),children:(0,$.jsx)(lg,{requiredFeatures:t,children:(0,$.jsx)(jCe,{viewRef:e.viewRef,viewDefinition:e.viewDefinition,contextResourceIdentifiers:e.contextResourceIdentifiers,urlParamValues:e.urlParamValues,runtimeDescriptor:e.runtimeDescriptor})})},s)}if(e.contentType===hd.FULL_CUSTOM_VIEW)return(0,$.jsx)(SQ,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers,navigationZone:t},s);if(e.contentType===hd.FLOWS_ACTORS_VIEW)return(0,$.jsx)(QQ,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers},s);if(e.contentType===hd.EXECUTION_VIEW)return(0,$.jsx)(hX,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers,navigationZone:t},s);if(e.contentType===hd.CUSTOM_COMPONENT){let t=wo.resolve(e.componentRef,q.DEFAULT);return t?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{className:`h-8 animate-pulse motion-reduce:animate-none bg-muted rounded`,"aria-hidden":`true`}),children:(0,$.jsx)(t,{contextResourceIdentifiers:e.contextResourceIdentifiers})},s):(0,$.jsx)(Yc,{componentType:e.componentRef,componentName:e.componentRef})}if(e.contentType===hd.ENGINE_PAGE){let t=MCe[e.pageRef];return t?(0,$.jsx)(t,{},s):(0,$.jsx)(Yc,{componentType:String(e.pageRef),componentName:String(e.pageRef)},s)}if(e.contentType===hd.SETTINGS_HUB)return(0,$.jsx)(xCe,{sectionRef:e.sectionRef,subTabRef:e.subTabRef},s);if(e.contentType===hd.INLINE_CREATE){let r={...e.resourceContext,additionalContext:{...e.resourceContext.additionalContext,defaultValuesOverride:e.defaultValues}};return(0,$.jsx)(oX,{resourceContext:r,navigationZone:t,navigationInitiator:n},s)}return e.contentType===hd.ERROR_MODAL?(0,$.jsx)(wxe,{wildoError:e.wildoError},s):null};function t2(e,t){let n=`${e}-${t.replace(/[^A-Za-z0-9_-]/g,`_`)}`;return{tabId:`nav-zone-tab-${n}`,panelId:`nav-zone-tabpanel-${n}`}}var PCe=({zone:e,entry:t})=>{let{title:n}=f1(t,{keepOperationTitle:!0}),{tabId:r,panelId:i}=t2(e,t.id);return(0,$.jsx)(SO,{value:t.id,id:r,"aria-controls":i,children:n})},FCe=({zone:e,entries:t,activeEntryId:n,onSelect:r})=>(0,$.jsx)(bO,{value:n,onValueChange:t=>r(e,t),"data-zone-tab-bar":e,children:(0,$.jsx)(xO,{children:t.map(t=>(0,$.jsx)(PCe,{zone:e,entry:t},t.id))})}),n2=({zone:e,fallback:t,emptyState:n})=>{let{getTopEntry:r,getZoneState:i,setActiveTab:a}=Zx(),{navigationLayout:o}=e_(),s=Cxe(),c=r(e),l=i(e),u=o?.zones?.[e]?.contentModel===rr.TABBED,d=dg(l.stack,o?.zones?.[e]?.contentModel,l.activeTabId);Q0(`ZoneContentRenderer render`,{zone:e,hasTopEntry:!!c,stackDepth:l.stack.length,isVisible:l.isVisible,topEntryContentType:c?.content?.contentType,topEntryUrlPath:c?.urlPath,hasFallback:!!t});let f=l.stack;return f.length>0?(Q0(`ZoneContentRenderer → rendering persistent stack`,{zone:e,stackDepth:f.length}),(0,$.jsxs)($.Fragment,{children:[u&&f.length>0&&(0,$.jsx)(FCe,{zone:e,entries:f,activeEntryId:f[d]?.id,onSelect:a}),f.map((t,n)=>{let r=n===d,i=u?(()=>{let{tabId:n,panelId:r}=t2(e,t.id);return{role:`tabpanel`,id:r,"aria-labelledby":n}})():void 0;return(0,$.jsx)(`div`,{...i,style:{display:r?`contents`:`none`},inert:!r,children:s(t)?(0,$.jsx)(`div`,{className:`flex items-center justify-center w-full min-h-[200px]`,children:(0,$.jsx)(gb,{})}):(0,$.jsx)(e2,{content:t.content,zone:t.zone,initiator:t.initiator,entryId:t.id})},$0(t.content,t.id))})]})):t?(Q0(`ZoneContentRenderer → rendering fallback (routerChildren / Outlet)`,{zone:e}),(0,$.jsx)($.Fragment,{children:t})):n?(Q0(`ZoneContentRenderer → rendering empty state (onEmpty: EMPTY_STATE)`,{zone:e}),(0,$.jsx)($.Fragment,{children:n})):(Q0(`ZoneContentRenderer → rendering null (no entry, no fallback)`,{zone:e}),null)};function r2(e){return e===Wl.HORIZONTAL?Wl.VERTICAL:Wl.HORIZONTAL}var ICe=1280,i2=25,a2=i2;function o2(e,t){return Math.round(Math.max(5,Math.min(70,e/t*100)))}function LCe(e){let[t,n]=(0,Q.useState)(ICe);return(0,Q.useEffect)(()=>{let t=e.current;if(!t)return;let r=new ResizeObserver(e=>{let t=e[0];if(t){let e=t.contentRect.width;e>0&&n(e)}});return r.observe(t),()=>r.disconnect()},[e]),t}function s2(e,t,n){return Math.min(Math.max(e,Math.min(t,n)),n)}function c2(e){if(!e.isResizable)return{minSize:e.defaultSize,maxSize:e.defaultSize};let t=e.maxWidthPx?o2(e.maxWidthPx,e.containerWidth):75,n=e.minWidthPx?o2(e.minWidthPx,e.containerWidth):Math.min(a2,e.defaultSize);return{minSize:Math.min(n,t),maxSize:t}}var l2=1e-9;function RCe(e,t){let n=e.map(e=>e.defaultSize),r=e.map(e=>e.frozen?1/0:Math.floor(e.maxSize+l2)),i=e.map((e,t)=>Math.min(Math.ceil((e.frozen?Math.min(a2,e.defaultSize):e.minSize)-l2),r[t])),a=i.reduce((e,t)=>e+t,0),o,s=a>t;if(s)o=i.map(e=>e*t/a);else{let r=e.map(()=>!1);for(;;){let e=t-i.reduce((e,t,n)=>e+(r[n]?t:0),0),a=n.reduce((e,t,n)=>e+(r[n]?0:t),0),s=a>0?e/a:0,c=n.flatMap((e,t)=>!r[t]&&e*s<i[t]-l2?[t]:[]);if(c.length===0){o=n.map((e,t)=>r[t]?i[t]:e*s);break}for(let e of c)r[e]=!0}}let c=o.map(e=>Math.floor(e+l2)),l=Math.round(o.reduce((e,t)=>e+t,0))-c.reduce((e,t)=>e+t,0),u=o.map((e,t)=>({index:t,fraction:e-c[t]})).sort((e,t)=>t.fraction-e.fraction||e.index-t.index);for(let e=0;e<l;e+=1)c[u[e].index]+=1;e.forEach((e,t)=>{e.defaultSize=c[t],e.frozen?(e.minSize=e.defaultSize,e.maxSize=e.defaultSize):s&&(e.minSize=e.defaultSize)})}var u2;(function(e){e.SINGLE_ZONE=`single-zone`,e.MULTI_ZONE_STATIC=`multi-zone-static`,e.MULTI_ZONE_RESIZABLE=`multi-zone-resizable`})(u2||={});function d2(e){return!e.hasSecondaryZone&&!e.hasCompanionZone?u2.SINGLE_ZONE:e.hasSecondaryZone&&e.split?.resizable||e.hasCompanionZone&&e.split?.companion?.resizable?u2.MULTI_ZONE_RESIZABLE:u2.MULTI_ZONE_STATIC}function f2(e){let t=e.showSecondary?Math.max(0,e.secondaryPercent):0,n=e.showCompanion?Math.max(0,e.companionPercent):0,r=t+n;if(r<=75||r===0)return{secondary:t,companion:n};let i=75/r;return{secondary:t*i,companion:n*i}}function p2(e){return{primary:e.showSecondary||e.showCompanion,secondary:e.showSecondary&&e.showCompanion}}function m2(e,t,n,r,i){let a=0,o;if(n){let n=e.secondary,r=t?.resizable??!1,s=(t?.ratio??[50,50])[1];a+=s;let c=n?.minWidth,{minSize:l,maxSize:u}=c2({isResizable:r,defaultSize:s,minWidthPx:c,maxWidthPx:n?.maxWidth,containerWidth:i}),d=s2(s,l,u);a+=d-s,o={defaultSize:d,minSize:l,maxSize:u,frozen:!r}}let s;if(r){let n=e.companion,r=t?.companion,o=r?.resizable??!1,c=(r?.ratio??[70,30])[1];a+=c;let l=n?.minWidth,{minSize:u,maxSize:d}=c2({isResizable:o,defaultSize:c,minWidthPx:l,maxWidthPx:n?.maxWidth,containerWidth:i}),f=s2(c,u,d);a+=f-c,s={defaultSize:f,minSize:u,maxSize:d,frozen:!o}}let c=[o,s].filter(e=>e!==void 0);return a>75&&RCe(c,75),{primaryDefault:100-c.reduce((e,t)=>e+t.defaultSize,0),secondary:o,companion:s}}var zCe={...iD,geometry:{responsiveMaxWidth:`content`},containment:{gap:`none`}};function h2({children:e,geometry:t}){return(0,$.jsx)(AD,{variant:Ja.SHELL,emitPolicyVars:!0,policyOverride:kCe(t,zCe),className:U(`bg-transparent text-inherit`,ACe(t)),children:e})}var BCe=()=>{let{tComponent:e,isReady:t}=K({component:J.APP_LAYOUTS_MAIN_CONTAINER}),n=t?jp({tComponent:e,componentType:J.APP_LAYOUTS_MAIN_CONTAINER,key:`zoneEmptyState`}):``;return(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center p-container`,"data-zone-empty-state":`true`,children:(0,$.jsx)(`p`,{className:`max-w-xs text-center text-sm text-muted-foreground`,children:n})})},g2=`pointer-events-auto bg-surface-raised/80 backdrop-blur-sm`,_2=({emphasized:e,onToggle:t,floating:n=!0})=>{let{tComponent:r,isReady:i}=K({component:J.APP_LAYOUTS_MAIN_CONTAINER}),{renderIcon:a}=Rf(),o=i?jp({tComponent:r,componentType:J.APP_LAYOUTS_MAIN_CONTAINER,key:e?`zoneRestore`:`zoneExpand`}):``;return(0,$.jsx)(X,{type:`button`,size:Xd.ICON_SM,variant:Y.GHOST,className:n?g2:void 0,"aria-pressed":e,"aria-label":o||void 0,title:o||void 0,"data-zone-emphasis-toggle":e?`restore`:`expand`,onClick:t,children:a(e?H.MINIMIZE:H.MAXIMIZE,{size:fa.SM})})},v2=({onDismiss:e,floating:t=!0})=>{let{tComponent:n,isReady:r}=K({component:J.APP_LAYOUTS_MAIN_CONTAINER}),{renderIcon:i}=Rf(),a=r?jp({tComponent:n,componentType:J.APP_LAYOUTS_MAIN_CONTAINER,key:`zoneDismiss`}):``;return(0,$.jsx)(X,{type:`button`,size:Xd.ICON_SM,variant:Y.GHOST,className:t?g2:void 0,"aria-label":a||void 0,title:a||void 0,"data-zone-dismiss":`true`,onClick:e,children:i(H.CLOSE,{size:fa.SM})})};function VCe(){let{tComponent:e,isReady:t}=K({component:J.APP_LAYOUTS_MAIN_CONTAINER}),n=(0,Q.useCallback)(n=>t&&jp({tComponent:e,componentType:J.APP_LAYOUTS_MAIN_CONTAINER,key:n})||void 0,[e,t]);return{regionProps:(0,Q.useCallback)(e=>({role:`region`,"aria-label":n(HCe[e])}),[n]),resizeHandleLabel:n(`zoneResizeHandle`)}}var HCe={[li.PRIMARY]:`zoneRegionPrimary`,[li.SECONDARY]:`zoneRegionSecondary`,[li.COMPANION]:`zoneRegionCompanion`},UCe=({emphasized:e,onToggleEmphasis:t,onDismiss:n})=>(0,$.jsxs)(rV,{children:[(0,$.jsx)(_2,{emphasized:e,onToggle:t}),n&&(0,$.jsx)(v2,{onDismiss:n})]}),y2=({zone:e,emphasized:t,onToggleEmphasis:n,onDismiss:r,children:i})=>(0,$.jsxs)($B,{zone:e,controls:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_2,{emphasized:t,onToggle:n,floating:!1}),r&&(0,$.jsx)(v2,{onDismiss:r,floating:!1})]}),children:[(0,$.jsx)(UCe,{emphasized:t,onToggleEmphasis:n,onDismiss:r}),i]}),b2=({routerChildren:e})=>{Nye(),jye(),Mye();let{isZoneVisible:t,getZoneDepth:n,getTopContent:r,setFocusedZone:i,emphasizedZone:a,setEmphasizedZone:o,reconcileCollapsedZones:s,state:c}=Zx(),{dismissZone:l}=zS(),{setContentAreaWidth:u}=Zx(),{regionProps:d,resizeHandleLabel:f}=VCe(),{navigationLayout:p,UIConfig:m,shellAppearance:h,compositeViews:g,homeDefinition:_}=e_(),v=wg(),{registry:y}=wm(),b=(0,Q.useCallback)(e=>zp({viewRef:e,registry:y}),[y]),x=(0,Q.useRef)(null),S=LCe(x);(0,Q.useEffect)(()=>{u(S>0?S:void 0)},[S,u]);let C=m?.currentBreakpoint===ci.MOBILE,w=p?.zones,T=p?.split,E=h===At.CONTINUOUS?`bg-transparent text-foreground`:`bg-surface-raised text-surface-raised-foreground`,D=!!w?.secondary,O=!!w?.companion,k=t(li.SECONDARY)||n(li.SECONDARY)>0,A=t(li.COMPANION)||n(li.COMPANION)>0,j=r(li.PRIMARY),M=TCe({homeCompositeViewRef:_?.compositeViewReference,isAppRootPath:v.pathname===`/`,primaryStackTop:j})??j,N=(0,Q.useMemo)(()=>DCe({primaryContent:M,compositeViews:g,resolveExecutionView:b}),[M,g,b]),P=(0,Q.useMemo)(()=>OCe({primaryContent:M,compositeViews:g,resolveExecutionView:b}),[M,g,b]),F=(0,Q.useMemo)(()=>X0({zoneContent:r(li.SECONDARY),compositeViews:g,resolveExecutionView:b}),[r,g,b]),I=(0,Q.useMemo)(()=>X0({zoneContent:r(li.COMPANION),compositeViews:g,resolveExecutionView:b}),[r,g,b]),ee=K0({zone:li.SECONDARY,zones:w,destinationOverride:N}),L=K0({zone:li.COMPANION,zones:w,destinationOverride:N}),R=(0,$.jsx)(BCe,{}),te=(0,Q.useMemo)(()=>ECe({primaryContent:M,compositeViews:g}),[M,g]),z=ug({zoneConfig:w?.secondary,viewport:m?.currentBreakpoint,contentAreaWidth:S}),B=ug({zoneConfig:w?.companion,viewport:m?.currentBreakpoint,contentAreaWidth:S});Sxe({zones:w,viewport:m?.currentBreakpoint,contentAreaWidth:S,reconcileCollapsedZones:s,navigationState:c});let ne=!z&&D&&(k||te&&q0(ee)),re=!B&&O&&(A||te&&q0(L)),ie=d2({hasSecondaryZone:D,hasCompanionZone:O,split:T}),ae=(0,Q.useCallback)(()=>i(li.PRIMARY),[i]),oe=(0,Q.useCallback)(()=>i(li.SECONDARY),[i]),se=(0,Q.useCallback)(()=>i(li.COMPANION),[i]),ce=CCe({requested:a,isMobile:C,secondaryShown:ne,companionShown:re,secondaryHasContent:k,companionHasContent:A}),le=n(qn.OVERLAY)>0;(0,Q.useEffect)(()=>{if(ce===null)return;let e=e=>{wCe({key:e.key,emphasized:!0,overlayOpen:le,target:e.target})&&o(null)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[ce,le,o]);let ue=(0,Q.useCallback)(()=>o(ce===li.SECONDARY?null:li.SECONDARY),[ce,o]),de=(0,Q.useCallback)(()=>o(ce===li.COMPANION?null:li.COMPANION),[ce,o]),fe=(0,Q.useCallback)(()=>{o(null),l(li.SECONDARY)},[l,o]),pe=(0,Q.useCallback)(()=>{o(null),l(li.COMPANION)},[l,o]),me=J0({hasContent:k,behavior:ee}),he=J0({hasContent:A,behavior:L}),ge=ce!==null,_e=ce!==null&&ce!==li.SECONDARY,ve=ce!==null&&ce!==li.COMPANION,ye=(0,Q.useMemo)(()=>w?m2(w,T,ne,re,S):null,[w,T,ne,re,S]);if(ie===u2.SINGLE_ZONE)return(0,$.jsx)(AD,{asChild:!0,emitPolicyVars:!1,variant:Ja.SHELL,policyOverride:iD,children:(0,$.jsx)(`div`,{ref:x,className:`h-full overflow-auto p-container ${E}`,"data-content-area":`primary`,onPointerDown:ae,onFocus:ae,...d(li.PRIMARY),children:(0,$.jsx)(h2,{geometry:P,children:(0,$.jsx)(n2,{zone:li.PRIMARY,fallback:e})})})});if(ie===u2.MULTI_ZONE_RESIZABLE&&ye){let t=r2(T?.orientation);return(0,$.jsx)(AD,{asChild:!0,emitPolicyVars:!1,variant:Ja.SHELL,policyOverride:iD,children:(0,$.jsx)(`div`,{ref:x,className:`h-full ${E}`,children:(0,$.jsxs)(m1,{direction:t,autoSaveId:`nav-zones`,className:`h-full`,children:[(0,$.jsx)(h1,{defaultSize:ye.primaryDefault,minSize:i2,id:`nav-primary`,order:1,className:U(`h-full`,ge&&`hidden`),"data-zone-hidden":ge||void 0,children:(0,$.jsx)(`div`,{className:`h-full p-container ${P.fillsHeight?`overflow-hidden`:`overflow-auto`}`,"data-content-area":`primary`,onPointerDown:ae,onFocus:ae,...d(li.PRIMARY),children:(0,$.jsx)(h2,{geometry:P,children:(0,$.jsx)(n2,{zone:li.PRIMARY,fallback:e})})})}),ne&&ye.secondary&&(0,$.jsxs)($.Fragment,{children:[ce===null&&(0,$.jsx)(g1,{withHandle:!0,disabled:ye.secondary.frozen,"aria-label":f}),(0,$.jsx)(h1,{defaultSize:ye.secondary.defaultSize,minSize:ye.secondary.minSize,maxSize:ye.secondary.maxSize,id:`nav-secondary`,order:2,className:U(`h-full`,_e&&`hidden`),"data-zone-hidden":_e||void 0,children:(0,$.jsx)(`div`,{className:`h-full overflow-auto p-container`,"data-content-area":`secondary`,"data-zone-emphasized":ce===li.SECONDARY||void 0,onPointerDown:oe,onFocus:oe,...d(li.SECONDARY),children:(0,$.jsx)(y2,{zone:li.SECONDARY,emphasized:ce===li.SECONDARY,onToggleEmphasis:ue,onDismiss:me?fe:void 0,children:(0,$.jsx)(h2,{geometry:F,children:(0,$.jsx)(n2,{zone:li.SECONDARY,emptyState:R})})})})})]}),re&&ye.companion&&(0,$.jsxs)($.Fragment,{children:[ce===null&&(0,$.jsx)(g1,{withHandle:!0,disabled:ye.companion.frozen,"aria-label":f}),(0,$.jsx)(h1,{defaultSize:ye.companion.defaultSize,minSize:ye.companion.minSize,maxSize:ye.companion.maxSize,id:`nav-companion`,order:3,className:U(`h-full`,ve&&`hidden`),"data-zone-hidden":ve||void 0,children:(0,$.jsx)(`div`,{className:`h-full overflow-auto p-container`,"data-content-area":`companion`,"data-zone-emphasized":ce===li.COMPANION||void 0,onPointerDown:se,onFocus:se,...d(li.COMPANION),children:(0,$.jsx)(y2,{zone:li.COMPANION,emphasized:ce===li.COMPANION,onToggleEmphasis:de,onDismiss:he?pe:void 0,children:(0,$.jsx)(h2,{geometry:I,children:(0,$.jsx)(n2,{zone:li.COMPANION,emptyState:R})})})})})]})]})})})}let be=r2(T?.orientation)===Wl.VERTICAL,xe=f2({secondaryPercent:T?.ratio?.[1]??50,companionPercent:T?.companion?.ratio?.[1]??30,showSecondary:ne,showCompanion:re}),Se=(e,t)=>be?{height:t?`100%`:`${e}%`}:{width:t?`100%`:`${e}%`},Ce=p2({showSecondary:ne,showCompanion:re});return(0,$.jsx)(AD,{asChild:!0,emitPolicyVars:!1,variant:Ja.SHELL,policyOverride:iD,children:(0,$.jsxs)(`div`,{ref:x,className:U(`h-full flex`,be?`flex-col`:`flex-row`,E),children:[(0,$.jsx)(`div`,{className:U(`flex-1 h-full overflow-auto p-container`,Ce.primary&&ce===null&&(be?`border-b border-border`:`border-e border-border`),ge&&`hidden`),"data-content-area":`primary`,"data-zone-hidden":ge||void 0,onPointerDown:ae,onFocus:ae,...d(li.PRIMARY),children:(0,$.jsx)(h2,{geometry:P,children:(0,$.jsx)(n2,{zone:li.PRIMARY,fallback:e})})}),ne&&(0,$.jsx)(`div`,{className:U(`h-full overflow-auto p-container`,Ce.secondary&&ce===null&&(be?`border-b border-border`:`border-e border-border`),_e&&`hidden`),style:Se(xe.secondary,ce===li.SECONDARY),"data-content-area":`secondary`,"data-zone-hidden":_e||void 0,"data-zone-emphasized":ce===li.SECONDARY||void 0,onPointerDown:oe,onFocus:oe,...d(li.SECONDARY),children:(0,$.jsx)(y2,{zone:li.SECONDARY,emphasized:ce===li.SECONDARY,onToggleEmphasis:ue,onDismiss:me?fe:void 0,children:(0,$.jsx)(h2,{geometry:F,children:(0,$.jsx)(n2,{zone:li.SECONDARY,emptyState:R})})})}),re&&(0,$.jsx)(`div`,{className:U(`h-full overflow-auto p-container`,ve&&`hidden`),style:Se(xe.companion,ce===li.COMPANION),"data-content-area":`companion`,"data-zone-hidden":ve||void 0,"data-zone-emphasized":ce===li.COMPANION||void 0,onPointerDown:se,onFocus:se,...d(li.COMPANION),children:(0,$.jsx)(y2,{zone:li.COMPANION,emphasized:ce===li.COMPANION,onToggleEmphasis:de,onDismiss:he?pe:void 0,children:(0,$.jsx)(h2,{geometry:I,children:(0,$.jsx)(n2,{zone:li.COMPANION,emptyState:R})})})})]})})},WCe=()=>{let{state:e,getZoneState:t}=Zx(),{closeOverlay:n}=zS(),r=vh(),i=e.overlay,a=i.length>0?i[i.length-1]:void 0,o=i.length>0,s=B1(a?.appearance??pd.DIALOG),{title:c}=f1(a),l=(0,Q.useCallback)(i=>{if(!i){if(a?.content.contentType===hd.SETTINGS_HUB){let n=e.zones[li.PRIMARY]?.stack??[],i=e.zones[li.SECONDARY]?.stack??[],a=i[i.length-1],o=n[n.length-1]?.urlPath,s=(a?.hostedPane&&o?Ch.resolveBrowserUrlForZoneEntry({zone:li.SECONDARY,entryUrlPath:a.urlPath,paneContent:a.content,currentBrowserUrl:o,getZoneState:t}):o)??Cn.home;r(s,{replace:!0})}else n()}},[n,r,a,e.zones,t]),u=Z$(),{registry:d}=wm(),f=(0,Q.useCallback)(e=>d.resourceConfigurations[e]?.frontendConfiguration?.layout?.defaultDisplaySectionAppearance,[d]),p=a?.content.contentType===hd.SETTINGS_HUB?zxe(Kxe(u.sections,a.content.sectionRef??u.defaultSectionRef,f)):Bxe(s);return(0,$.jsx)(I1,{open:o,onOpenChange:l,title:c||void 0,titleVisuallyHidden:!0,config:{mode:s,modal:a?.overlayBehavior?.modal??!0,closeOnOutsideClick:a?.overlayBehavior?.closeOnOutsideClick??!0,showBackdrop:a?.overlayBehavior?.showBackdrop??!0,side:Ea.END},className:p,children:a&&(0,$.jsx)(e2,{content:a.content,zone:qn.OVERLAY,initiator:a.initiator,entryId:a.id})})},x2=()=>(0,$.jsx)(WCe,{});function S2(e){return typeof e==`object`&&!!e&&`placement`in e&&`collapsible`in e}function C2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w2(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e,n=t.position===void 0||t.position===pl.START||t.position===pl.END,r=t.items===void 0||Array.isArray(t.items);return n&&r}var T2;(function(e){e.ENUM=`enum`,e.RESOURCE_REFERENCE=`resource_reference`,e.RAW=`raw`})(T2||={});var E2;(function(e){e.STATIC=`static`,e.LINK=`link`,e.BUTTON=`button`})(E2||={});var D2;(function(e){e.BUTTON=`button`,e.TOGGLE=`toggle`,e.SLIDER=`slider`,e.SELECT=`select`})(D2||={});var O2;(function(e){e.COMMANDS=`commands`,e.RECORDS=`records`})(O2||={});function k2(e){switch(e){case Fu.COMMAND_MENU:return J.APPLICATION_LEVEL_COMMAND_MENU;case Fu.QUICK_ACTION_BUTTON:return J.APPLICATION_LEVEL_QUICK_ACTION_BUTTON;case Fu.NOTIFICATION_CENTER:return J.APPLICATION_LEVEL_NOTIFICATION_CENTER;case Fu.USER_DROPDOWN:return J.APPLICATION_LEVEL_USER_DROPDOWN;case Fu.CONTROL_PANEL:return J.APPLICATION_LEVEL_CONTROL_PANEL;case Fu.QUICK_SWITCHER:return J.APPLICATION_LEVEL_QUICK_SWITCHER;case Fu.NAVIGATION_CONTROL:return J.APPLICATION_LEVEL_NAVIGATION_BACK;case Fu.UTILITY_PANEL:return J.APPLICATION_LEVEL_UTILITY_PANEL;default:return null}}function A2(e,t){if(e.startsWith(`data:`)||e.startsWith(`blob:`))return!0;try{return new URL(e,t).origin===t}catch{return!1}}function j2(e){let{httpClient:t}=_u(),n=e!==void 0&&A2(e,window.location.origin),[r,i]=(0,Q.useState)(void 0);if((0,Q.useEffect)(()=>{if(i(void 0),e===void 0||n)return;let r=!1,a,o=new AbortController;return t.fetchFileBlob(e,{signal:o.signal,silent:!0}).then(e=>{r||(a=URL.createObjectURL(e),i(a))}).catch(()=>{r||i(void 0)}),()=>{r=!0,o.abort(),a&&URL.revokeObjectURL(a)}},[e,n,t]),e!==void 0)return n?e:r}function M2(e={}){let{composition:t=mr.SYMBOL,purpose:n=wee.PRIMARY,theme:r,includeOrganizationBrand:i=!0}=e,{appConfig:a}=_u(),{isDark:o,shellIdentity:s,organizationLogoUrl:c,organizationProductName:l}=e_(),u=s?s.brandAssets:a.brandAssets,d=s?s.name:a.appIdentity?eie(a.appIdentity):``,f=(0,Q.useMemo)(()=>{if(u?.length)return tr(u,{composition:t,theme:r??(o?_t.DARK:_t.LIGHT),purpose:n})},[u,t,n,r,o]),p=i&&!s,m=j2(p?c:void 0),h=p&&l||d;return p&&c?{name:h,logoUrl:m,logoComposition:void 0,markIsSingleColourOnDarkUi:!1}:{name:h,logoUrl:f?.url,logoComposition:f?.composition,markIsSingleColourOnDarkUi:f?.theme===_t.MONOCHROME&&o}}function N2(e){let t=e?.logoUrl,n=e?.name??``,[r,i]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>i(!1),[t]);let a=(0,Q.useCallback)(()=>i(!0),[]),o=!!t&&!r,s=o&&e?.logoComposition!==void 0&&e.logoComposition!==mr.SYMBOL;return{name:n,logoUrl:o?t:void 0,hasMark:o,markCarriesName:s,drawMarkLight:o&&e?.markIsSingleColourOnDarkUi===!0,isEmpty:!o&&n.length===0,onMarkError:a}}function P2(e,t,n,r,i,a){if(!n||!t||t.length===0)return[];let o=[],s=new Map;for(let c of t){let t=c.componentType;if(c.breakpoint&&c.breakpoint!==r||n[t]===!1||t===Fu.NAVIGATION_CONTROL&&!Bn(a?.backAffordanceOwner))continue;let l=k2(t);if(!l)continue;let u=s.get(t)??0;s.set(t,u+1),o.push({instanceId:`${e}:${t}-${u}`,component:t,frontendComponentType:l,placement:c.placement??i,presetName:c.presetName,triggerWidth:c.triggerWidth,triggerAppearance:c.triggerAppearance})}return o}function F2(e,t,n){let r=e=>{let n=t?.[e];if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n.hostedComponents;return Array.isArray(r)?r:void 0},i=(i,a)=>P2(i,r(i),t,n,a).some(t=>t.component===e);return!!t?.[Fu.MENUBAR]&&i(Fu.MENUBAR,pl.START)||!!t?.[Fu.SIDEBAR]&&i(Fu.SIDEBAR,Ma.TOP)}var I2=new Set;function L2(e){let t=typeof e==`string`?e:C2(e)?e.placement:void 0;if(t===void 0)return Ma.BOTTOM;if(ur(t))return t;let n=String(t);return I2.has(n)||(I2.add(n),Jo.getLogger().warn(`[app-shell] the status bar is configured at '${n}', which no shell layout places (only '${Ma.TOP}' and '${Ma.BOTTOM}'); it is shown at '${Ma.BOTTOM}'.`)),Ma.BOTTOM}function R2(){let{UIConfig:e,navigationLayout:t,appComponentsConfiguration:n}=e_(),{markComponentInitialized:r}=_u(),i=!!(t&&n);return(0,Q.useEffect)(()=>{i&&r(Ne.APP_MAIN_CONTAINER)},[i,r]),(0,Q.useMemo)(()=>{if(!i||!t||!n)return{hasMenubar:!1,hasSidebar:!1,hasStatusBar:!1,hasToolbar:!1,hasActivityBar:!1,hasQuickActionButton:!1,hasUtilityPanel:!1,quickActionButtonHostedInChrome:!1,utilityPanelHostedInChrome:!1,sidebarPlacement:pl.START,statusBarPlacement:Ma.BOTTOM,utilityPanelPlacement:pl.END,isLayoutReady:!1};let r=n[Fu.SIDEBAR],a=n[Fu.STATUS_BAR],o=n[Fu.UTILITY_PANEL],s=S2(r)?r.placement:pl.START;return{hasMenubar:!!n[Fu.MENUBAR],hasSidebar:!!r,hasStatusBar:!!a,hasToolbar:!!n[Fu.TOOLBAR],hasActivityBar:!!n[Fu.ACTIVITY_BAR],hasQuickActionButton:!!n[Fu.QUICK_ACTION_BUTTON],hasUtilityPanel:!!o,quickActionButtonHostedInChrome:F2(Fu.QUICK_ACTION_BUTTON,n,e?.currentBreakpoint),utilityPanelHostedInChrome:F2(Fu.UTILITY_PANEL,n,e?.currentBreakpoint),sidebarPlacement:s,statusBarPlacement:L2(a),utilityPanelPlacement:w2(o)?o.position??pl.END:pl.END,isLayoutReady:!0}},[i,t,n,e?.currentBreakpoint])}function GCe(e){(0,Q.useEffect)(()=>{if(!e)return;let t=Array.from(document.querySelectorAll(`link[rel~="icon"]`)),n=t.length===0?document.createElement(`link`):void 0;n&&(n.rel=`icon`,document.head.appendChild(n));let r=n?[n]:t,i=r.map(e=>e.getAttribute(`href`));return r.forEach(t=>{t.href=e}),()=>{n?n.remove():r.forEach((e,t)=>{let n=i[t];n==null?e.removeAttribute(`href`):e.setAttribute(`href`,n)})}},[e])}function z2(e=!1,t){let{markComponentInitialized:n,frontendConfiguration:r}=_u();(0,Q.useEffect)(()=>{n(Ne.PUBLIC_APP_CONTAINER)},[n]);let i=M2({includeOrganizationBrand:!1}),{shellIdentity:a}=e_(),o=e&&!a?t:void 0,s=j2(o?.logoUrl||void 0),c=j2(o?.faviconUrl||void 0),l=o?{name:o.productName||o.organizationName||i.name,logoUrl:o.logoUrl?s:i.logoUrl,logoComposition:void 0}:i,u=r.publicShellIdentityMode===gm.BRAND_HEADER?l:void 0;return GCe(c),{useCardLayout:e,isReady:!0,brandHeader:u,brandAccentColor:u?o?.primaryColor:void 0}}var KCe=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function B2(e){return!e||typeof document>`u`?null:document.getElementById(e)}var V2=(0,Q.createContext)(null);function H2(){return(0,Q.useContext)(V2)??void 0}function U2(e,t){let n=H2(),{getSurfacePolicy:r}=e_(),i=r?.(e,t)?.stacking?.portalTarget,a=typeof i==`string`&&i!==`inline`&&i!==`app-portal`&&i!==`reset`?i:null,[o,s]=(0,Q.useState)(()=>B2(a));return KCe(()=>{if(!a||typeof document>`u`){s(null);return}let e=B2(a);if(s(e),e||typeof MutationObserver>`u`)return;let t=new MutationObserver(()=>{let e=B2(a);e&&(s(e),t.disconnect())});return t.observe(document.body,{childList:!0,subtree:!0}),()=>t.disconnect()},[a]),i===`inline`?{container:void 0,shouldPortal:!1}:o?{container:o,shouldPortal:!0}:{container:n,shouldPortal:!0}}function W2(e){switch(e){case`content`:return`z-(--z-content)`;case`transient`:return`z-(--z-transient)`;case`guidance`:return`z-(--z-guidance)`;case`critical`:return`z-(--z-critical)`;default:return`z-(--z-overlay)`}}function G2(e,t){let{getSurfacePolicy:n}=e_(),r=n?.(e,t)?.stacking?.stackingTier;return W2(r)}function K2({preset:e=q.DEFAULT,...t}){let n=G(J.APPLICATION_LEVEL_ACTIVITY_BAR,`ApplicationLevel_ActivityBar`)(e);return(0,$.jsx)(n,{...t})}function q2({preset:e=q.DEFAULT,...t}){let n=G(J.APPLICATION_LEVEL_MENUBAR,`ApplicationLevel_MenuBar`)(e);return(0,$.jsx)(n,{...t})}function J2({preset:e=q.DEFAULT,...t}){let n=G(J.APPLICATION_LEVEL_QUICK_ACTION_BUTTON,`ApplicationLevel_QuickActionButton`)(e);return(0,$.jsx)(n,{...t})}function Y2({preset:e=q.DEFAULT,...t}){let n=G(J.APPLICATION_LEVEL_SIDEBAR,`ApplicationLevel_Sidebar`)(e);return(0,$.jsx)(n,{...t})}function X2({preset:e=q.DEFAULT,...t}){let n=G(J.APPLICATION_LEVEL_STATUS_BAR,`ApplicationLevel_StatusBar`)(e);return(0,$.jsx)(n,{...t})}function Z2({preset:e=q.DEFAULT,...t}){let n=G(J.APPLICATION_LEVEL_TOOLBAR,`ApplicationLevel_Toolbar`)(e);return(0,$.jsx)(n,{...t})}function Q2({preset:e=q.DEFAULT,...t}){let n=G(J.APPLICATION_LEVEL_UTILITY_PANEL,`ApplicationLevel_UtilityPanel`)(e);return(0,$.jsx)(n,{...t})}var $2=(0,Q.createContext)({getHostedComponentProps:()=>({})});function e4(){return(0,Q.useContext)($2)}function t4(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function qCe(e){return t4(e)}var JCe=new Set([Fu.COMMAND_MENU,Fu.NOTIFICATION_CENTER,Fu.QUICK_SWITCHER]);function n4({children:e}){let{appComponentsConfiguration:t,UIConfig:n,navigationLayout:r}=e_(),i=n?.currentBreakpoint,{on:a,emit:o}=vo(),{register:s}=J$(),{t:c}=K(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(0),h=t?.[Fu.MENUBAR],g=t?.[Fu.SIDEBAR],_=(0,Q.useMemo)(()=>{let e=t,n=t4(h)?P2(Fu.MENUBAR,h.hostedComponents,e,i,pl.START,r):[],a=t4(g)?P2(Fu.SIDEBAR,g.hostedComponents,e,i,Ma.TOP,r):[];return[...n,...a]},[t,h,g,i,r]),v=(0,Q.useMemo)(()=>new Set(_.map(e=>e.component)),[_]),y=(0,Q.useMemo)(()=>{let e=new Map;for(let t of _)JCe.has(t.component)&&(e.has(t.component)||e.set(t.component,t.instanceId));return e},[_]),b=e=>v.has(e),x=t?.[Fu.COMMAND_MENU],S=qCe(x)?x.openShortcut:void 0;(0,Q.useEffect)(()=>{if(b(Fu.COMMAND_MENU))return a(hc.HOTKEY_COMMAND_MENU_OPEN,()=>{u(e=>!e)})},[a,v]),(0,Q.useEffect)(()=>{if(b(Fu.NOTIFICATION_CENTER))return a(hc.HOTKEY_NOTIFICATIONS_OPEN,()=>{f(e=>!e)})},[a,v]),(0,Q.useEffect)(()=>{if(b(Fu.QUICK_SWITCHER))return a(hc.HOTKEY_QUICK_SWITCHER_OPEN,()=>{m(e=>e+1)})},[a,v]),(0,Q.useEffect)(()=>{if(b(Fu.COMMAND_MENU)&&S&&x!==!1)return s({id:`shell-hosted-command-menu-open-shortcut`,shortcut:S,description:c(`engine.hotkeys.commandMenuOpen`),scope:L.GLOBAL,group:vc.NAVIGATION,launcher:Fu.COMMAND_MENU,preventDefault:!0,handler:()=>{o(hc.HOTKEY_COMMAND_MENU_OPEN,{})}})},[x,S,o,s,c,v]);let C=(0,Q.useMemo)(()=>({getHostedComponentProps:(e,t)=>{let n=y.get(e)===t;switch(e){case Fu.COMMAND_MENU:return{listenForHotkeys:!1,isOpen:l,onOpenChange:u,renderDialog:n};case Fu.NOTIFICATION_CENTER:return{listenForHotkeys:!1,...n?{isOpen:d,onOpenChange:f}:{}};case Fu.QUICK_SWITCHER:return{focusTrigger:n?p:0};default:return{}}}}),[y,l,d,p]);return(0,$.jsx)($2.Provider,{value:C,children:e})}var r4=({element:e,flowRef:t,state:n,onComplete:r,onDismiss:i,t:a,children:o})=>{let{tComponent:s,isReady:c}=K({component:J.GUIDANCE_CHECKLIST}),{renderIcon:l}=Rf(),{flowStates:u}=wU(),[d,f]=(0,Q.useState)(!1),p=e,m=u[t],{completed:h,total:g}=(0,Q.useMemo)(()=>{let e=p.items??[],t=0;for(let n of e)m?.elements?.[n]?.status===go.COMPLETED&&t++;return{completed:t,total:e.length}},[p.items,m?.elements]),_=g>0?Math.round(h/g*100):0,v=(0,Q.useCallback)(()=>{f(e=>!e)},[]),y=(0,Q.useCallback)(()=>{i(p.ref)},[i,p.ref]);if(!c)return null;let b=a(`title`),x=a(`description`),S=s(J.GUIDANCE_CHECKLIST,`headerTitle`),C=s(J.GUIDANCE_CHECKLIST,`progress`,{completed:h,total:g}),w=d?s(J.GUIDANCE_CHECKLIST,`expand`):s(J.GUIDANCE_CHECKLIST,`collapse`),T=s(J.GUIDANCE_CHECKLIST,`dismiss`);return(0,$.jsxs)(MF,{className:`w-80 max-w-[calc(100vw-3rem)] overflow-hidden`,role:`region`,"aria-label":S||b,children:[(0,$.jsxs)(PF,{className:`flex-row items-center justify-between gap-2 py-3 px-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-sm truncate`,children:S||b}),(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.SM,onClick:v,"aria-expanded":!d,"aria-controls":`guidance-checklist-${p.ref}`,className:`text-xs text-muted-foreground px-1.5 py-0.5 h-auto`,children:w})]}),(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.ICON_SM,onClick:y,"aria-label":T,children:l(H.CLOSE,{size:fa.SM})})]}),p.showProgress&&(0,$.jsxs)(`div`,{className:`px-4 pb-2 flex items-center gap-2.5`,children:[(0,$.jsx)(I_,{value:_,className:`flex-1`,"aria-valuenow":h,"aria-valuemin":0,"aria-valuemax":g}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:C})]}),!d&&(0,$.jsxs)(zF,{id:`guidance-checklist-${p.ref}`,className:`pt-0 pb-4 px-4`,children:[x&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2 leading-normal`,children:x}),o&&(0,$.jsx)(`div`,{role:`list`,children:o})]})]})},i4=({element:e,flowRef:t,state:n,onComplete:r,onAction:i,t:a})=>{let{tComponent:o,isReady:s}=K({component:J.GUIDANCE_CHECKLIST_ITEM}),c=e,l=n?.status===go.COMPLETED,u=(0,Q.useCallback)(()=>{l||r(c.ref)},[l,r,c.ref]),d=(0,Q.useCallback)(()=>{c.actionRef&&i(c.actionRef)},[i,c.actionRef]);if(!s)return null;let f=a(`title`),p=a(`actionLabel`);return(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 py-2 border-b border-border/50 last:border-b-0`,role:`listitem`,children:[(0,$.jsx)(AI,{name:`__display`,schema:Ld(),checked:l,onCheckedChange:u,disabled:l,"aria-label":l?o(J.GUIDANCE_CHECKLIST_ITEM,`completed`):o(J.GUIDANCE_CHECKLIST_ITEM,`markComplete`)}),(0,$.jsx)(`span`,{className:`flex-1 min-w-0 text-sm leading-snug ${l?`line-through text-muted-foreground`:``}`,children:f}),p&&c.actionRef&&(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.SM,onClick:d,className:`shrink-0`,children:p})]})},a4=({element:e,flowRef:t,state:n,onComplete:r,onDismiss:i,t:a})=>{let o=(0,Q.useMemo)(()=>[`guidance.${t}`],[t]),{tComponent:s,tGuidanceTourStep:c,isReady:l}=K({component:J.GUIDANCE_TOUR,keys:o}),{getRecipe:u}=e_(),{renderIcon:d}=Rf(),f=H2(),p=e,m=u(wi.SURFACE,Ja.OVERLAY),h=(0,Q.useMemo)(()=>[...p.steps??[]].sort((e,t)=>e.order-t.order),[p.steps]),[g,_]=(0,Q.useState)(n?.lastStepIndex??0),[v,y]=(0,Q.useState)(null),b=(0,Q.useRef)(null),x=(0,Q.useRef)(null),S=h[g],C=h.length,w=g===C-1,T=g===0;(0,Q.useEffect)(()=>{if(!S?.targetSelector){y(null);return}let e=()=>{let e=document.querySelector(S.targetSelector);y(e?e.getBoundingClientRect():null)};e();let t=document.querySelector(S.targetSelector);t&&(x.current=new ResizeObserver(e),x.current.observe(t));let n=()=>e(),r=()=>e();return window.addEventListener(`resize`,r),window.addEventListener(`scroll`,n,!0),()=>{x.current?.disconnect(),window.removeEventListener(`resize`,r),window.removeEventListener(`scroll`,n,!0)}},[S?.targetSelector]);let E=(0,Q.useCallback)(()=>{w?r(p.ref,{lastStepIndex:g}):_(e=>e+1)},[w,r,p.ref,g]),D=(0,Q.useCallback)(()=>{T||_(e=>e-1)},[T]),O=(0,Q.useCallback)(()=>{i(p.ref)},[i,p.ref]);if((0,Q.useEffect)(()=>{let e=b.current;if(!e)return;let t=e=>{e.key===`Escape`&&(e.stopPropagation(),O())};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[O]),lD(b,!0),!l)return null;let k=s(J.GUIDANCE_TOUR,`next`),A=s(J.GUIDANCE_TOUR,`previous`),j=s(J.GUIDANCE_TOUR,`skip`),M=s(J.GUIDANCE_TOUR,`finish`),N=s(J.GUIDANCE_TOUR,`close`),P=s(J.GUIDANCE_TOUR,`stepProgress`,{current:g+1,total:C}),F=S?c(t,p.ref,S.ref,`title`):``,I=S?c(t,p.ref,S.ref,`description`):``;if(!S||typeof document>`u`)return null;let ee=YCe(S.placement??it.BOTTOM,v),L=f??document.body;return AN.createPortal((0,$.jsxs)(`div`,{className:`fixed inset-0 z-[calc(var(--z-guidance)+1)] pointer-events-auto`,"data-guidance-tour":p.ref,children:[v&&(0,$.jsxs)(`svg`,{className:`fixed inset-0 w-full h-full pointer-events-none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,$.jsx)(`defs`,{children:(0,$.jsxs)(`mask`,{id:`spotlight-${p.ref}`,children:[(0,$.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`white`}),(0,$.jsx)(`rect`,{x:v.left-4,y:v.top-4,width:v.width+8,height:v.height+8,rx:`8`,fill:`black`})]})}),(0,$.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,className:`fill-black/50`,mask:`url(#spotlight-${p.ref})`})]}),(0,$.jsx)(AD,{asChild:!0,emitPolicyVars:!1,variant:Ja.OVERLAY,children:(0,$.jsxs)(`div`,{ref:b,style:ee,role:`dialog`,"aria-modal":`true`,tabIndex:-1,"aria-label":F,className:U(`w-[340px] max-w-[calc(100vw-2rem)] rounded-xl overflow-hidden font-inherit text-sm pointer-events-auto`,m.base,`shadow-[var(--shadow-xl)]`),children:[(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.ICON_SM,onClick:O,"aria-label":N,className:`absolute top-2 end-2 z-[calc(var(--z-guidance)+2)]`,children:d(H.CLOSE,{size:fa.SM})}),(0,$.jsxs)(`div`,{className:`px-5 pt-5 pb-3`,children:[F&&(0,$.jsx)(`h3`,{className:`m-0 text-base font-semibold leading-tight pe-6`,children:F}),I&&(0,$.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground leading-normal`,children:I})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-5 pb-4`,children:[(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:P}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p.allowSkip&&(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.SM,onClick:O,children:j}),!T&&(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.SM,onClick:D,children:A}),(0,$.jsx)(X,{size:Xd.SM,onClick:E,children:w?M:k})]})]})]})})]}),L)};function YCe(e,t){if(!t)return{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`};switch(e){case it.TOP:return{position:`fixed`,bottom:window.innerHeight-t.top+12,left:t.left+t.width/2,transform:`translateX(-50%)`};case it.BOTTOM:return{position:`fixed`,top:t.bottom+12,left:t.left+t.width/2,transform:`translateX(-50%)`};case it.LEFT:return{position:`fixed`,top:t.top+t.height/2,right:window.innerWidth-t.left+12,transform:`translateY(-50%)`};case it.RIGHT:return{position:`fixed`,top:t.top+t.height/2,left:t.right+12,transform:`translateY(-50%)`};case it.CENTER:default:return{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`}}}var o4=({element:e,flowRef:t,state:n,onComplete:r,onDismiss:i,t:a})=>{let{tComponent:o,isReady:s}=K({component:J.GUIDANCE_TOOLTIP}),{getRecipe:c}=e_(),l=H2(),u=e,[d,f]=(0,Q.useState)(null),p=(0,Q.useRef)(!1),m=(0,Q.useRef)(null),h=c(wi.SURFACE,Ja.RAISED);(0,Q.useEffect)(()=>{if(!u.targetSelector)return;let e=()=>{let e=document.querySelector(u.targetSelector);f(e?e.getBoundingClientRect():null)};e();let t=document.querySelector(u.targetSelector);t&&(m.current=new ResizeObserver(e),m.current.observe(t));let n=()=>e(),r=()=>e();return window.addEventListener(`resize`,r),window.addEventListener(`scroll`,n,!0),()=>{m.current?.disconnect(),window.removeEventListener(`resize`,r),window.removeEventListener(`scroll`,n,!0)}},[u.targetSelector]),(0,Q.useEffect)(()=>{u.showOnce&&!p.current&&d&&n?.status!==go.COMPLETED&&(p.current=!0,r(u.ref))},[u.showOnce,u.ref,d,n?.status,r]);let g=(0,Q.useCallback)(()=>{i(u.ref)},[i,u.ref]),_=(0,Q.useCallback)(()=>{r(u.ref)},[r,u.ref]);if(!s||typeof document>`u`||!d)return null;let v=l??document.body,y=a(`title`),b=a(`content`),x=o(J.GUIDANCE_TOOLTIP,`dismiss`),S=o(J.GUIDANCE_TOOLTIP,`gotIt`),C=XCe(u.placement??it.BOTTOM,d);return AN.createPortal((0,$.jsx)(AD,{asChild:!0,emitPolicyVars:!1,variant:Ja.RAISED,children:(0,$.jsxs)(`div`,{style:C,role:`dialog`,"aria-label":y||b||void 0,"data-guidance-tooltip":u.ref,className:U(`w-70 max-w-[calc(100vw-2rem)] rounded-xl z-[calc(var(--z-guidance)+2)] font-inherit text-sm`,h.base,`shadow-[var(--shadow-lg)]`),children:[(0,$.jsxs)(`div`,{className:`px-4 pt-3.5 pb-2`,children:[y&&(0,$.jsx)(`div`,{className:`font-semibold text-sm mb-1`,children:y}),b&&(0,$.jsx)(`p`,{className:`m-0 text-xs text-muted-foreground leading-normal`,children:b})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 px-4 pb-3.5`,children:[(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.SM,onClick:g,children:x}),(0,$.jsx)(X,{size:Xd.SM,onClick:_,children:S})]})]})}),v)};function XCe(e,t){switch(e){case it.TOP:return{position:`fixed`,bottom:window.innerHeight-t.top+10,left:t.left+t.width/2,transform:`translateX(-50%)`};case it.BOTTOM:return{position:`fixed`,top:t.bottom+10,left:t.left+t.width/2,transform:`translateX(-50%)`};case it.LEFT:return{position:`fixed`,top:t.top+t.height/2,right:window.innerWidth-t.left+10,transform:`translateY(-50%)`};case it.RIGHT:return{position:`fixed`,top:t.top+t.height/2,left:t.right+10,transform:`translateY(-50%)`};case it.CENTER:default:return{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`}}}var s4=({element:e,t,onAction:n,onDismiss:r,onComplete:i})=>{let{tComponent:a,isReady:o}=K({component:J.GUIDANCE_MODAL}),s=e,c=s.ctaAction,l=s.dismissible??!0,u=s.imageUrl,d=s.videoUrl,f=(0,Q.useCallback)(()=>{c&&n(c),i(e.ref)},[c,n,i,e.ref]),p=(0,Q.useCallback)(()=>{r(e.ref)},[r,e.ref]),m=(0,Q.useCallback)(t=>{!t&&l&&r(e.ref)},[l,r,e.ref]);if(!o)return null;let h=t(`title`),g=t(`description`),_=t(`content`),v=t(`actionLabel`),y=h||a(J.GUIDANCE_MODAL,`defaultTitle`);return(0,$.jsx)(rG,{open:!0,onOpenChange:m,children:(0,$.jsxs)(aG,{showCloseButton:l,onPointerDownOutside:l?void 0:e=>e.preventDefault(),onEscapeKeyDown:l?void 0:e=>e.preventDefault(),className:`max-w-md`,...g?{}:{"aria-describedby":void 0},children:[d&&(0,$.jsx)(`video`,{src:d,controls:!0,className:`w-full max-h-60 object-cover -mt-6 -mx-6 mb-0 rounded-t-lg`,style:{width:`calc(100% + 3rem)`}}),!d&&u&&(0,$.jsx)(`img`,{src:u,alt:``,className:`w-full max-h-60 object-cover -mt-6 -mx-6 mb-0 rounded-t-lg`,style:{width:`calc(100% + 3rem)`}}),h||g?(0,$.jsxs)(sG,{children:[(0,$.jsx)(lG,{className:h?void 0:`sr-only`,children:y}),g&&(0,$.jsx)(uG,{children:g})]}):(0,$.jsx)(lG,{className:`sr-only`,children:y}),_&&(0,$.jsx)(`div`,{className:`text-sm text-foreground/80 leading-relaxed`,children:_}),(0,$.jsxs)(cG,{children:[l&&(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.SM,onClick:p,children:a(J.GUIDANCE_MODAL,`dismiss`)}),v&&(0,$.jsx)(X,{size:Xd.SM,onClick:f,children:v})]})]})})},ZCe={[Cu.INFO]:`info`,[Cu.SUCCESS]:`success`,[Cu.WARNING]:`warning`,[Cu.ERROR]:`destructive`},c4=({element:e,t,onAction:n,onDismiss:r})=>{let{tComponent:i,isReady:a}=K({component:J.GUIDANCE_BANNER}),{renderIcon:o}=Rf(),s=e,c=s.variant??Cu.INFO,l=s.position??Xa.TOP,u=s.dismissible??!0,d=s.actionRef,f=(0,Q.useCallback)(()=>{r(e.ref)},[r,e.ref]);if(!a)return null;let p=t(`title`),m=t(`content`),h=t(`actionLabel`),g=l===Xa.BOTTOM?`absolute bottom-0 inset-x-0 rounded-none border-x-0 border-b-0`:`absolute top-0 inset-x-0 rounded-none border-x-0 border-t-0`;return(0,$.jsx)(UD,{variant:ZCe[c],role:`status`,className:`pointer-events-auto ${g}`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 w-full min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5 flex-1 min-w-0`,children:[p&&(0,$.jsx)(WD,{children:p}),m&&(0,$.jsx)(GD,{children:m})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[h&&d&&(0,$.jsx)(X,{size:Xd.SM,onClick:()=>n(d),children:h}),u&&(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.ICON_SM,onClick:f,"aria-label":i(J.GUIDANCE_BANNER,`ariaClose`),title:i(J.GUIDANCE_BANNER,`dismiss`),children:o(H.CLOSE,{size:fa.SM})})]})]})})},QCe={[Cu.INFO]:`info`,[Cu.SUCCESS]:`success`,[Cu.WARNING]:`warning`,[Cu.ERROR]:`destructive`},l4=({element:e,t,onAction:n,onDismiss:r})=>{let{tComponent:i,isReady:a}=K({component:J.GUIDANCE_ANNOUNCEMENT}),{renderIcon:o}=Rf(),s=(0,Q.useCallback)(()=>{r(e.ref)},[r,e.ref]);if(!a)return null;let c=e,l=c.variant??Cu.INFO,u=c.dismissible??!0,d=t(`title`),f=t(`content`),p=t(`actionLabel`),m=c.actionRef,h=c.icon;return(0,$.jsxs)(UD,{variant:QCe[l],role:`status`,className:`pointer-events-auto relative`,children:[h&&(0,$.jsx)(`span`,{className:`text-xl leading-none shrink-0 mt-0.5`,"aria-hidden":`true`,children:h}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[d&&(0,$.jsx)(WD,{children:d}),f&&(0,$.jsx)(GD,{children:f}),p&&m&&(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(X,{size:Xd.SM,onClick:()=>n(m),children:p})})]}),u&&(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.ICON_SM,onClick:s,"aria-label":i(J.GUIDANCE_ANNOUNCEMENT,`dismiss`),className:`absolute top-2 end-2`,children:o(H.CLOSE,{size:fa.SM})})]})},$Ce={[ds.DEFAULT]:si.NEUTRAL,[ds.PRIMARY]:si.INFO,[ds.SECONDARY]:si.NEUTRAL,[ds.SUCCESS]:si.SUCCESS,[ds.WARNING]:si.WARNING,[ds.ERROR]:si.ERROR},u4=({element:e,t})=>{let n=e,r=n.variant??ds.DEFAULT,i=n.unlocked??!1,a=t(`title`),o=t(`content`),s=n.icon;return(0,$.jsxs)(Hf,{variant:s_($Ce[r]),className:i?``:`opacity-[var(--opacity-disabled)]`,children:[s&&(0,$.jsx)(`span`,{className:`text-xs leading-none`,"aria-hidden":`true`,children:s}),a||o]})},d4=({element:e,t,onAction:n,onDismiss:r})=>{let{tComponent:i,isReady:a}=K({component:J.GUIDANCE_CARD}),{renderIcon:o}=Rf(),s=e,c=`dismissible`in s&&typeof s.dismissible==`boolean`?s.dismissible:!0,l=s.actionRef,u=s.imageUrl,d=s.icon,f=(0,Q.useCallback)(()=>{r(e.ref)},[r,e.ref]);if(!a)return null;let p=t(`title`),m=t(`description`),h=t(`content`),g=t(`actionLabel`);return(0,$.jsxs)(MF,{className:`pointer-events-auto relative overflow-hidden`,children:[u&&(0,$.jsx)(`img`,{src:u,alt:``,className:`w-full max-h-[200px] object-cover`}),(0,$.jsx)(PF,{children:(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[d&&(0,$.jsx)(`span`,{className:`text-2xl leading-none shrink-0`,"aria-hidden":`true`,children:d}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[p&&(0,$.jsx)(`h3`,{className:`text-base font-semibold leading-snug`,children:p}),m&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 leading-normal`,children:m})]})]})}),h&&(0,$.jsx)(zF,{children:(0,$.jsx)(`div`,{className:`text-sm text-foreground/80 leading-relaxed`,children:h})}),g&&l&&(0,$.jsx)(FF,{children:(0,$.jsx)(X,{size:Xd.SM,onClick:()=>n(l),children:g})}),c&&(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.ICON_SM,onClick:f,"aria-label":i(J.GUIDANCE_CARD,`dismiss`),className:`absolute top-2 end-2`,children:o(H.CLOSE,{size:fa.SM})})]})},ewe=kd(),f4=({element:e,flowRef:t,t:n,onComplete:r})=>{let i=Q.useMemo(()=>t?[`guidance.${t}`]:[],[t]),{tComponent:a,tGuidanceSurveyQuestion:o,isReady:s}=K({component:J.GUIDANCE_SURVEY,keys:i}),c=e,l=c.questions??[],u=c.allowSkip??!0,[d,f]=(0,Q.useState)(0),[p,m]=(0,Q.useState)({}),[h,g]=(0,Q.useState)({}),[_,v]=(0,Q.useState)(!1),y=l[d],b=d===l.length-1,x=d===0,S=l.length,C=(0,Q.useCallback)(n=>o(t,e.ref,n.id,`question`),[t,e.ref,o]),w=(0,Q.useCallback)((n,r)=>o(t,e.ref,n.id,`options.${r}.label`),[t,e.ref,o]),T=(0,Q.useCallback)((e,t)=>{m(n=>({...n,[e]:t})),g(t=>({...t,[e]:!1}))},[]),E=(0,Q.useCallback)(()=>{if(!y||!y.required)return!0;let e=p[y.id];return!(e==null||e===``||Array.isArray(e)&&e.length===0)},[y,p]),D=(0,Q.useCallback)(async()=>{if(!E())y&&g(e=>({...e,[y.id]:!0}));else if(b){v(!1);try{await r(e.ref,{surveyAnswers:p})}catch{v(!0)}}else f(e=>e+1)},[E,b,r,e.ref,p,y]),O=(0,Q.useCallback)(()=>{x||f(e=>e-1)},[x]),k=(0,Q.useCallback)(async()=>{v(!1),await r(e.ref,{surveyAnswers:p,declineResourceBinding:!0})},[r,e.ref,p]);if(!s)return null;let A=(e,t)=>{switch(e.type){case Uu.TEXT:return(0,$.jsx)(iN,{value:t??``,onChange:t=>T(e.id,t.target.value)});case Uu.TEXTAREA:return(0,$.jsx)(LI,{value:t??``,onChange:t=>T(e.id,t.target.value),rows:3});case Uu.RADIO:case Uu.SINGLE_CHOICE:{let n=(e.options??[]).map(t=>({value:t.ref,label:w(e,t.ref)}));return(0,$.jsx)(DF,{schema:ewe,name:`survey-${e.id}`,value:t??``,onValueChange:t=>T(e.id,t),options:n,orientation:Wl.VERTICAL})}case Uu.CHECKBOX:return(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:(e.options??[]).map(n=>{let r=w(e,n.ref),i=Array.isArray(t)?t:[],a=i.includes(n.ref);return(0,$.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer rounded-md px-2 py-1.5 text-sm hover:bg-accent/5`,children:[(0,$.jsx)(AI,{name:`__display`,schema:Ld(),checked:a,onCheckedChange:()=>{let t=a?i.filter(e=>e!==n.ref):[...i,n.ref];T(e.id,t)}}),(0,$.jsx)(`span`,{children:r})]},n.ref)})});case Uu.RATING:{let n=typeof t==`number`?t:0;return(0,$.jsx)(`div`,{className:`flex gap-1`,role:`radiogroup`,"aria-label":C(e),children:[1,2,3,4,5].map(t=>(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.ICON,onClick:()=>T(e.id,t),"aria-label":a(J.GUIDANCE_SURVEY,`ratingStar`,{star:t,total:5}),className:t<=n?`text-warning`:`text-muted-foreground/40`,children:(0,$.jsx)(`span`,{className:`text-xl`,children:`★`})},t))})}default:return null}};if(l.length===0)return null;let j=n(`title`),M=n(`description`),N=S>0?Math.round((d+1)/S*100):0;return(0,$.jsxs)(MF,{className:`pointer-events-auto`,children:[(j||M)&&(0,$.jsxs)(PF,{children:[j&&(0,$.jsx)(`h3`,{className:`text-base font-semibold`,children:j}),M&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:M})]}),(0,$.jsxs)(zF,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(I_,{value:N,className:`flex-1`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:a(J.GUIDANCE_SURVEY,`questionProgress`,{current:d+1,total:S})})]}),y&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,$.jsxs)(`label`,{className:`text-sm font-medium`,children:[C(y),y.required&&(0,$.jsx)(`span`,{className:`text-destructive ml-1`,children:a(J.GUIDANCE_SURVEY,`required`)})]}),A(y,p[y.id]),h[y.id]&&(0,$.jsx)(`span`,{className:`text-xs text-destructive`,children:a(J.GUIDANCE_SURVEY,`required`)})]}),_&&(0,$.jsx)(UD,{variant:`destructive`,role:`alert`,children:(0,$.jsx)(GD,{children:a(J.GUIDANCE_SURVEY,`submissionFailed`)})})]}),(0,$.jsxs)(FF,{className:`flex justify-between items-center`,children:[(0,$.jsx)(`div`,{children:!x&&(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.SM,onClick:O,children:a(J.GUIDANCE_SURVEY,`previous`)})}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[u&&(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.SM,onClick:k,children:a(J.GUIDANCE_SURVEY,`skip`)}),(0,$.jsx)(X,{size:Xd.SM,onClick:D,children:b?a(J.GUIDANCE_SURVEY,`submit`):a(J.GUIDANCE_SURVEY,`next`)})]})]})]})},p4=()=>null,twe={[rd.CHECKLIST]:r4,[rd.CHECKLIST_ITEM]:i4,[rd.TOUR]:a4,[rd.TOOLTIP]:o4,[rd.MODAL]:s4,[rd.BANNER]:c4,[rd.ANNOUNCEMENT]:l4,[rd.BADGE]:u4,[rd.CARD]:d4,[rd.SURVEY]:f4},m4={[rd.CHECKLIST]:J.GUIDANCE_CHECKLIST,[rd.CHECKLIST_ITEM]:J.GUIDANCE_CHECKLIST_ITEM,[rd.TOUR]:J.GUIDANCE_TOUR,[rd.TOOLTIP]:J.GUIDANCE_TOOLTIP,[rd.MODAL]:J.GUIDANCE_MODAL,[rd.BANNER]:J.GUIDANCE_BANNER,[rd.ANNOUNCEMENT]:J.GUIDANCE_ANNOUNCEMENT,[rd.BADGE]:J.GUIDANCE_BADGE,[rd.CARD]:J.GUIDANCE_CARD,[rd.SURVEY]:J.GUIDANCE_SURVEY};function h4(e,t){return t?.[e]||wo.resolve(m4[e],q.DEFAULT)||twe[e]}var g4=class extends Q.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){Jo.getLogger().error(`GuidanceRenderer: element "${this.props.elementRef}" threw an error`,e)}render(){return this.state.hasError?null:this.props.children}};function _4(e){return`targetSelector`in e&&typeof e.targetSelector==`string`?e.targetSelector:e.targetField?`[data-guidance-field="${e.targetField}"]`:null}function v4(e){try{return!!document.querySelector(e)}catch{return y4.has(e)||(y4.add(e),Jo.getLogger().warn(`GuidanceRenderer: "${e}" is not a valid CSS selector, so the element targeting it can never be shown.`)),!1}}var y4=new Set;function nwe(e,t){if(typeof document>`u`)return!1;if(t.type===rd.TOOLTIP){let e=t.targetSelector;return typeof e==`string`&&v4(e)}if(t.type===rd.TOUR){let e=t.steps;return Array.isArray(e)&&e.length>0}if(e.renderMode===Uc.INLINE){let e=_4(t);return e===null||v4(e)}return!0}function rwe(e,t){let n=e=>{let n=t[e.type];return!!n&&n!==p4};return e.renderMode===Uc.CHECKLIST?e.elements.filter(e=>e.type===rd.CHECKLIST&&n(e)).length===0?[]:e.elements.filter(e=>(e.type===rd.CHECKLIST||e.type===rd.CHECKLIST_ITEM)&&n(e)):e.elements.filter(t=>n(t)&&nwe(e,t))}var iwe=({targetSelector:e,children:t})=>{let n=typeof document<`u`&&v4(e)?document.querySelector(e):null;return n?AN.createPortal((0,$.jsx)(`div`,{className:`absolute z-[calc(var(--z-guidance)-2)]`,children:t}),n):null},b4=({customRenderers:e})=>{let{activeFlows:t,flowStates:n,completeElement:r,dismissFlow:i,recordFlowPresented:a,reportFlowNotPresentable:o}=wU(),s=(0,Q.useMemo)(()=>t.map(e=>`guidance.${e.ref}`),[t]),{makeTrGuidanceElement:c,tGuidanceElement:l,isReady:u}=K({keys:s}),{emit:d}=vo(),f=H2(),p=wo.getRegistrationCount(),m=(0,Q.useRef)(null),h=(0,Q.useMemo)(()=>{let t={};for(let n of Object.values(rd)){let r=h4(n,e);r&&(t[n]=r)}let n=t,r=m.current;return r&&Object.values(rd).every(e=>r[e]===n[e])?r:(m.current=n,n)},[e,p]),g=(0,Q.useCallback)(e=>{d(hc.NAVIGATION_REQUEST,{operationRef:e,initiator:{sourceZone:hn}})},[d]),_=(0,Q.useCallback)((e,t,n)=>r(e,t,n),[r]),v=(0,Q.useCallback)((e,t)=>{i(e)},[i]),y=(0,Q.useMemo)(()=>{if(t.length===0)return null;let e=[],r=[],i=[];for(let a of t){let t=n[a.ref];if(a.renderMode===Uc.CHECKLIST){let e=a.elements.filter(e=>e.type===rd.CHECKLIST),n=a.elements.filter(e=>e.type===rd.CHECKLIST_ITEM);for(let r of e){let e=h[rd.CHECKLIST];if(!e||e===p4)continue;let o=t?.elements?.[r.ref],s=c(a.ref,r.ref,Tl(r)),l=h[rd.CHECKLIST_ITEM],u=l&&l!==p4?n.map(e=>{let n=t?.elements?.[e.ref],r=c(a.ref,e.ref,Tl(e));return(0,$.jsx)(g4,{elementRef:e.ref,children:(0,$.jsx)(l,{element:e,flowRef:a.ref,state:n,onComplete:(e,t)=>_(a.ref,e,t),onDismiss:e=>v(a.ref,e),onAction:g,t:r})},`${a.ref}-${e.ref}`)}):null,d=(0,$.jsx)(g4,{elementRef:r.ref,children:(0,$.jsx)(e,{element:r,flowRef:a.ref,state:o,onComplete:(e,t)=>_(a.ref,e,t),onDismiss:e=>v(a.ref,e),onAction:g,t:s,children:u})},`${a.ref}-${r.ref}`);i.push(d)}}else for(let n of a.elements){let i=h[n.type];if(!i||i===p4)continue;let o=t?.elements?.[n.ref],s=c(a.ref,n.ref,Tl(n)),l=(0,$.jsx)(g4,{elementRef:n.ref,children:(0,$.jsx)(i,{element:n,flowRef:a.ref,state:o,onComplete:(e,t)=>_(a.ref,e,t),onDismiss:e=>v(a.ref,e),onAction:g,t:s})},`${a.ref}-${n.ref}`);switch(a.renderMode){case Uc.OVERLAY:e.push(l);break;case Uc.INLINE:{let e=_4(n);e?r.push((0,$.jsx)(iwe,{targetSelector:e,children:l},`inline-${a.ref}-${n.ref}`)):r.push(l);break}}}}return{overlayElements:e,inlineElements:r,checklistElements:i}},[t,n,h,c,g,_,v]),b=(0,Q.useRef)(new Set);if((0,Q.useEffect)(()=>{if(u)for(let e of t){let t=rwe(e,h);if(o(e.ref,t.length===0),t.length===0)continue;let n=t.flatMap(t=>Tl(t).filter(n=>l(e.ref,t.ref,n)===void 0).map(n=>`guidance.${e.ref}.elements.${t.ref}.${n}`));if(n.length===0){a(e.ref);continue}let r=`${e.ref}|${n.join(`,`)}`;b.current.has(r)||(b.current.add(r),Jo.getLogger().warn(`GuidanceRenderer: flow "${e.ref}" is shown but NOT recorded as presented — its required labels are unresolved [${n.join(`, `)}]. Generate the labels; the flow will trigger again once they exist.`))}},[u,t,h,l,a]),!u||!y)return null;let{overlayElements:x,inlineElements:S,checklistElements:C}=y;if(!(x.length>0||S.length>0||C.length>0))return null;let w=typeof document<`u`?f??document.body:void 0,T=f?`absolute`:`fixed`;return(0,$.jsxs)($.Fragment,{children:[x.length>0&&w&&AN.createPortal((0,$.jsx)(`div`,{"data-guidance-layer":`overlay`,className:`${T} inset-0 z-(--z-guidance) pointer-events-none flex flex-col items-center justify-center gap-element`,children:x.map(e=>(0,$.jsx)(`div`,{className:`w-full max-w-md shrink-0 px-element empty:hidden`,children:e},e.key))}),w),S,C.length>0&&w&&AN.createPortal((0,$.jsx)(`div`,{"data-guidance-layer":`checklist`,className:`${T} bottom-6 end-6 z-[calc(var(--z-guidance)-1)]`,children:C}),w)]})},x4=(0,Q.createContext)(null),S4=(0,Q.createContext)(null),C4=(0,Q.createContext)(null);function w4(e){let t=(0,Q.useContext)(x4);if(!t)throw Error(`${e} must be rendered inside <AppShellProviders>, which supplies the layout it places regions from.`);return t}function T4(e){let[t,n]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{e&&n(!0)},[e]),t}function E4(){return(0,$.jsx)(AD,{asChild:!0,emitPolicyVars:!1,variant:Ja.SHELL,policyOverride:iD,children:(0,$.jsx)(`div`,{className:`h-screen w-screen bg-background flex items-center justify-center`,role:`status`,"aria-live":`polite`,children:(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(gb,{size:32,className:`text-primary mx-auto mb-field`,"aria-hidden":`true`})})})})}function D4({layout:e,children:t}){let[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),o=(0,Q.useCallback)(e=>{r(e)},[]),s=(0,Q.useCallback)(e=>{a(e)},[]);return(0,$.jsx)(x4.Provider,{value:e,children:(0,$.jsx)(S4.Provider,{value:o,children:(0,$.jsx)(C4.Provider,{value:s,children:(0,$.jsx)(V2.Provider,{value:i??n,children:(0,$.jsx)(n4,{children:t})})})})})}function O4(){let e=(0,Q.useContext)(C4);if(!e)throw Error(`AppShellOverlayPortalLayer must be rendered inside <AppShellProviders>, which exposes it as the portal container.`);return(0,$.jsx)(`div`,{ref:e,"data-shell-overlay-layer":``,className:`absolute left-0 top-0 h-0 w-0`})}function k4(e){let t=w4(`AppShellRegionOutlet`),{region:n,placement:r}=e,i=e=>r===void 0||r===e?e:null;switch(n){case _a.ACTIVITY_BAR:return t.hasActivityBar?(0,$.jsx)(K2,{}):null;case _a.MENUBAR:return t.hasMenubar?(0,$.jsx)(q2,{}):null;case _a.TOOLBAR:return t.hasToolbar?(0,$.jsx)(Z2,{}):null;case _a.SIDEBAR:{let e=i(t.sidebarPlacement);return t.hasSidebar&&e?(0,$.jsx)(Y2,{placement:e}):null}case _a.UTILITY_PANEL:{let e=i(t.utilityPanelPlacement);return t.hasUtilityPanel&&e&&!t.utilityPanelHostedInChrome?(0,$.jsx)(Q2,{position:e}):null}case _a.STATUS_BAR:{let e=i(t.statusBarPlacement);return t.hasStatusBar&&e?(0,$.jsx)(X2,{placement:e}):null}default:throw Error(`AppShellRegionOutlet has no rendering for region "${String(n)}".`)}}function A4({className:e,children:t}){let n=w4(`AppShellContentOutlet`),r=(0,Q.useContext)(S4);return(0,$.jsxs)(`main`,{ref:r??void 0,"data-component-area":_a.CONTENT,className:e,children:[(0,$.jsx)(b2,{routerChildren:t}),n.hasQuickActionButton&&!n.quickActionButtonHostedInChrome&&(0,$.jsx)(J2,{placement:`floating`})]})}function j4(){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(x2,{}),(0,$.jsx)(b4,{})]})}var M4;(function(e){e.INHERIT=`inherit`,e.COMPOSED=`composed`})(M4||={});var N4;(function(e){e.SHELL=`shell`,e.LAYOUT_2D=`layout-2d`,e.LAYOUT_3D=`layout-3d`})(N4||={});var P4=Symbol.for(`@wildo-ai/saas-frontend-lib/shell-layout-main-container`);function F4(e){return typeof e==`function`&&e[P4]===!0}function I4(e,t){switch(t.placement.kind){case M4.INHERIT:return e;case M4.COMPOSED:return t.placement.container;default:{let e=t.placement;throw Error(`The shell layout '${t.id}' has a placement this framework does not implement: ${JSON.stringify(e)}.`)}}}function L4(e,t,n,r,i){return Object.assign(e,{...i??{},[P4]:!0,captured:t,layout:n,layoutFamily:r})}function R4(e,t,n=N4.SHELL){let r=I4(e,t);function i(e){return(0,$.jsx)(r,{...e})}return L4(i,e,t,n)}function z4(e,t={}){let n=t.callerName??`registerShellLayout()`,r=!1;return{componentRef:J.APP_LAYOUTS_MAIN_CONTAINER,preset:q.DEFAULT,get isConfigurable(){return r},loadComponent:async()=>{let i=wo.resolve(J.APP_LAYOUTS_MAIN_CONTAINER,q.DEFAULT);if(!i)throw Error(`${n}: no Default APP_LAYOUTS_MAIN_CONTAINER is registered to capture. Call it from the engine module's \`componentRegistrations\`, which run after the framework presets — not from a module evaluated before them.`);let a=t.family??N4.SHELL,o=t.builtInLayouts&&Object.hasOwn(t.builtInLayouts,e.id)?t.builtInLayouts[e.id]:void 0;if(o!==void 0&&o!==e)throw Error(`${n}: the layout id '${e.id}' belongs to a built-in layout; give the application's own layout an id of its own.`);if(F4(i)&&(i.layout.id!==e.id||i.layoutFamily!==a)){let t=(t,n)=>i.layout.id===e.id?`'${t}' (${n})`:`'${t}'`;throw Error(`${n}: this application already registered the layout ${t(i.layout.id,i.layoutFamily)} and now asks for ${t(e.id,a)}. An application uses one layout: remove the other registration — or, if you just changed the layout in code, reload the page (the component registry outlives a hot reload).`)}r=wo.getMetadata(J.APP_LAYOUTS_MAIN_CONTAINER,q.DEFAULT)?.isConfigurable??!1;let s=F4(i)?i.captured:i,c=t.createContainer?t.createContainer(s,e):R4(s,e,a);if(c.layoutFamily!==a)throw Error(`${n}: the container was branded for the family '${c.layoutFamily}' while registering for '${a}'.`);return c}}}var B4;(function(e){e.APPEARED=`appeared`,e.CHANGED=`changed`})(B4||={});var V4;(function(e){e.REST=`rest`,e.BEHIND=`behind`,e.DISCARDED=`discarded`})(V4||={});var H4;(function(e){e.PANE_SWAP=`pane-swap`,e.COLUMN_RESIZE=`column-resize`})(H4||={});var U4;(function(e){e.STYLESHEET=`stylesheet`,e.FROM_PRESSED_ELEMENT=`from-pressed-element`})(U4||={});var W4;(function(e){e.INSTANT=`instant`,e.GROW=`grow`})(W4||={});var G4;(function(e){e.STYLESHEET=`stylesheet`,e.FROM_PRESSED_ELEMENT=`from-pressed-element`})(G4||={});var K4=.55,q4=`data-shell-proxy`,J4=`data-shell-object`,Y4=`data-shell-ghost-layer`,X4=`data-shell-ghost`,Z4;(function(e){e.DISCARDED=`discarded`,e.BEHIND=`behind`})(Z4||={});var Q4;(function(e){e.BACK=`back`,e.FRONT=`front`})(Q4||={});function $4(e){return`[data-component-area="${e}"]`}var e3=$4(_a.CONTENT),t3=`${e3} [data-content-area]:not([data-panel-id] *), ${e3} [data-panel-id^="nav-"]`;function n3(e){return`${e3} [data-content-area="${e}"]:not([data-panel-id] *), ${e3} [data-panel-id="nav-${e}"]`}function r3(e){if(e instanceof HTMLElement)return e.dataset.contentArea??e.dataset.panelId?.replace(/^nav-/,``)}var i3=new Set([li.SECONDARY,li.COMPANION]);function a3(e){let t=r3(e);return t!==void 0&&i3.has(t)}function o3(e){return i3.has(e)}var s3;(function(e){e.DROPDOWN_MENU=`dropdown-menu-content`,e.DROPDOWN_MENU_SUB=`dropdown-menu-sub-content`,e.CONTEXT_MENU=`context-menu-content`,e.CONTEXT_MENU_SUB=`context-menu-sub-content`,e.POPOVER=`popover-content`,e.HOVER_CARD=`hover-card-content`,e.TOOLTIP=`tooltip-content`,e.SELECT=`select-content`,e.MENUBAR=`menubar-content`,e.MENUBAR_SUB=`menubar-sub-content`,e.DIALOG=`dialog-content`,e.ALERT_DIALOG=`alert-dialog-content`,e.SHEET=`sheet-content`,e.DRAWER=`drawer-content`})(s3||={});var c3={[s3.DROPDOWN_MENU]:`--radix-dropdown-menu-content-transform-origin`,[s3.DROPDOWN_MENU_SUB]:`--radix-dropdown-menu-content-transform-origin`,[s3.CONTEXT_MENU]:`--radix-context-menu-content-transform-origin`,[s3.CONTEXT_MENU_SUB]:`--radix-context-menu-content-transform-origin`,[s3.POPOVER]:`--radix-popover-content-transform-origin`,[s3.HOVER_CARD]:`--radix-hover-card-content-transform-origin`,[s3.TOOLTIP]:`--radix-tooltip-content-transform-origin`,[s3.SELECT]:`--radix-select-content-transform-origin`,[s3.MENUBAR]:`--radix-menubar-content-transform-origin`,[s3.MENUBAR_SUB]:`--radix-menubar-content-transform-origin`},awe=[s3.DIALOG,s3.ALERT_DIALOG],l3=[s3.DIALOG,s3.ALERT_DIALOG,s3.SHEET,s3.DRAWER],u3=[`open`,`delayed-open`,`instant-open`];function owe(){return`:has([data-shell-overlay-layer] :is(${l3.map(e=>`[data-slot="${e}"]`).join(`, `)})[data-state="open"])`}var d3=new Map;function f3(e,t,n=document){let r=d3.get(e)??{sheet:null,users:0};if(d3.set(e,r),r.users+=1,r.users===1){if(`adoptedStyleSheets`in n&&typeof CSSStyleSheet<`u`&&`replaceSync`in CSSStyleSheet.prototype)r.sheet=new CSSStyleSheet,r.sheet.replaceSync(t),n.adoptedStyleSheets=[...n.adoptedStyleSheets,r.sheet];else{let r=n.createElement(`style`);r.dataset.shellLayoutStylesheet=e,r.textContent=t,n.head.appendChild(r),r.sheet===null&&console.warn(`[ShellLayout] The "${e}" layout's stylesheet was not applied: this browser has no constructable stylesheets (Chrome 73+, Firefox 101+, Safari 16.4+ have them) and the content security policy refused the <style> fallback. Allow 'unsafe-inline' in style-src, or support only browsers with constructable stylesheets.`)}}let i=!1;return()=>{if(i||(i=!0,--r.users,r.users>0))return;let{sheet:t}=r;t&&(n.adoptedStyleSheets=n.adoptedStyleSheets.filter(e=>e!==t));for(let t of n.head.querySelectorAll(`style[data-shell-layout-stylesheet]`))t.dataset.shellLayoutStylesheet===e&&t.remove();d3.delete(e)}}var swe=24,cwe=220,lwe=.5,p3=24,uwe=28,dwe=1500,m3=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function fwe(e){let t=e.cloneNode(!0);t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`inert`,``);for(let e of[t,...t.querySelectorAll(`*`)])for(let t of[`id`,`data-content-area`,`data-panel-id`,`data-component-area`,`data-slot`,`data-state`])e.removeAttribute(t);for(let e of t.querySelectorAll(`iframe, video, audio`))e.remove();return t}function h3(e,t){if(!(e instanceof HTMLElement))return!1;let n=e.offsetHeight;return n>=swe&&n<=cwe&&e.offsetWidth>=t*lwe}function g3(e,t){if(e.tagName!==t.tagName)return!1;let n=new Set(e.classList),r=new Set(t.classList);return n.size===0&&r.size===0||[...n].filter(e=>r.has(e)).length/Math.max(n.size,r.size)>=.5}function pwe(e,t){return(e.parentElement?[...e.parentElement.children]:[]).some(n=>n!==e&&h3(n,t)&&g3(n,e))}function _3(e){let t=e.closest(t3);if(!t)return null;let n=t.clientWidth;for(let r=e;r&&r!==t;r=r.parentElement)if(h3(r,n)&&pwe(r,n))return r;return null}var mwe=`button, a, [role="button"], [role="menuitem"], [role="option"]`;function v3(e){let t=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{if(t.current=null,!e)return;let n=e=>{if(!e)return;let n=_3(e),r=e.closest(mwe)??e;t.current={row:n?{...m3(n.getBoundingClientRect()),picture:fwe(n),element:n}:null,control:m3(r.getBoundingClientRect()),at:performance.now()}},r=e=>n(e.target instanceof Element?e.target:null),i=e=>{e.key===`Enter`||e.key===` `?n(document.activeElement):t.current=null};return document.addEventListener(`pointerdown`,r,!0),document.addEventListener(`keydown`,i,!0),()=>{document.removeEventListener(`pointerdown`,r,!0),document.removeEventListener(`keydown`,i,!0)}},[e]),(0,Q.useMemo)(()=>{let e=(e,n)=>{let r=t.current;return!r||performance.now()-r.at>n?null:(t.current=null,e(r))};return{takeRow:t=>e(e=>e.row,t),peekRow:e=>{let n=t.current;return n&&performance.now()-n.at<=e?n.row:null},takeControl:t=>e(e=>e.control,t)}},[])}function y3(e,t,n,r,i){let a=Math.round(r.durationMs*K4);if(a===0||typeof HTMLElement.prototype.animate!=`function`)return Promise.resolve();let o=e.getBoundingClientRect(),s=(e,t)=>({left:`${e.left-o.left}px`,top:`${e.top-o.top}px`,width:`${e.width}px`,height:`${e.height}px`,borderRadius:`${t}px`}),c=document.createElement(`div`);return c.setAttribute(q4,``),c.setAttribute(`aria-hidden`,`true`),Object.assign(c.style,{position:`absolute`,zIndex:`400`,pointerEvents:`none`,boxSizing:`border-box`,background:`var(--card, var(--background))`,border:`1px solid var(--primary, currentColor)`,boxShadow:`0 18px 40px -18px rgb(0 0 0 / 0.35)`}),Object.assign(c.style,s(t,10),{overflow:`hidden`}),t.picture&&(Object.assign(t.picture.style,{position:`absolute`,left:`0`,top:`0`,width:`${t.width}px`,height:`${t.height}px`,margin:`0`,pointerEvents:`none`}),c.appendChild(t.picture),t.picture.animate([{opacity:1},{opacity:0}],{duration:Math.round(a*.8),easing:`ease-in`,fill:`forwards`})),e.appendChild(c),i instanceof HTMLElement&&typeof i.animate==`function`&&i.animate([{opacity:0},{opacity:0,offset:K4},{opacity:1}],{duration:r.durationMs,easing:`linear`}),c.animate([s(t,10),s(n,14)],{duration:a,easing:r.easing,fill:`forwards`}).finished.catch(()=>void 0).then(()=>c.remove())}function b3(e,t,n,r){if(r.durationMs===0||typeof e.animate!=`function`)return;let i=n.getBoundingClientRect(),a=e.getBoundingClientRect(),o=Math.max(0,i.top+t.top-a.top),s=Math.max(0,i.left+t.left-a.left),c=Math.max(0,a.right-(i.left+t.left+t.width)),l=Math.max(0,a.bottom-(i.top+t.top+t.height));e.animate([{clipPath:`inset(${o}px ${c}px ${l}px ${s}px round 12px)`},{clipPath:`inset(0px 0px 0px 0px round 0px)`}],{duration:r.durationMs,easing:r.easing})}function x3(e,t,n,r){if(r.durationMs===0||typeof e.animate!=`function`)return;let i=n.getBoundingClientRect().left+t.left-e.getBoundingClientRect().left;Math.abs(i)<2||e.animate([{transform:`translateX(${i}px)`},{transform:`none`}],{duration:r.durationMs,easing:r.easing})}function S3(e){let t=e.clientWidth,n=[];for(let r of[e,...e.querySelectorAll(`*`)]){if(r.children.length<2||r.children.length<=n.length)continue;let e=[...r.children].filter(e=>h3(e,t)),i=[];for(let t of e){let e=i.find(e=>g3(e[0],t));e?e.push(t):i.push([t])}let a=i.reduce((e,t)=>t.length>e.length?t:e,[]);a.length>=2&&a.length>n.length&&a.length>=r.children.length*.6&&(n=a)}return n}function C3(e,t){if(t.durationMs===0||typeof e.animate!=`function`)return()=>void 0;let n=new WeakSet,r=0,i=()=>{a=0;for(let i of S3(e).slice(0,p3))n.has(i)||(n.add(i),i.animate([{opacity:0,transform:`translateY(12px) scale(0.98)`},{opacity:1,transform:`none`}],{duration:Math.round(t.durationMs*.8),easing:t.easing,delay:Math.min(r,p3)*uwe,fill:`backwards`}),r+=1)},a=0;i();let o=new MutationObserver(()=>{a||=(r=0,requestAnimationFrame(i))});o.observe(e,{childList:!0,subtree:!0});let s=setTimeout(()=>{cancelAnimationFrame(a),o.disconnect()},dwe);return()=>{clearTimeout(s),cancelAnimationFrame(a),o.disconnect()}}function w3(e,t,n){(0,Q.useEffect)(()=>{let r=e.current?.querySelector(`[data-shell-overlay-layer]`),i=e.current;if(!i||!r||t.dialogArrival!==G4.FROM_PRESSED_ELEMENT||t.durationMs===0)return;let a=new WeakSet,o=l3.filter(e=>e!==s3.DRAWER).map(e=>`[data-slot="${e}"][data-state="open"]`).join(`, `),s=new MutationObserver(()=>{for(let e of r.querySelectorAll(o)){if(a.has(e))continue;a.add(e);let r=n.takeControl(800);r&&y3(i,r,m3(e.getBoundingClientRect()),t,e)}});return s.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-state`]}),()=>s.disconnect()},[e,t,n])}var T3=`shell-pane-arrival`,E3=`data-shell-view-transition`,hwe=`
|
|
25
|
-
html[${E3}]::view-transition-old(root),
|
|
26
|
-
html[${E3}]::view-transition-new(root) { animation: none; }
|
|
27
|
-
::view-transition-group(${T3}) {
|
|
28
|
-
animation-duration: var(--shell-vt-duration, 320ms); animation-timing-function: var(--shell-vt-ease, ease);
|
|
29
|
-
overflow: clip; border-radius: var(--radius, 8px);
|
|
30
|
-
}
|
|
31
|
-
::view-transition-old(${T3}),
|
|
32
|
-
::view-transition-new(${T3}) { height: 100%; object-fit: none; object-position: left top; }
|
|
33
|
-
html:dir(rtl)::view-transition-old(${T3}),
|
|
34
|
-
html:dir(rtl)::view-transition-new(${T3}) { object-position: right top; }
|
|
35
|
-
::view-transition-old(${T3}) { animation: shell-vt-out calc(var(--shell-vt-duration, 320ms) * 0.6) ease-out both; }
|
|
36
|
-
::view-transition-new(${T3}) { animation: shell-vt-in var(--shell-vt-duration, 320ms) ease-in both; }
|
|
37
|
-
@keyframes shell-vt-out { to { opacity: 0; } }
|
|
38
|
-
@keyframes shell-vt-in { 0%, 40% { opacity: 0; } 100% { opacity: 1; } }
|
|
39
|
-
@media (prefers-reduced-motion: reduce) {
|
|
40
|
-
::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
|
|
41
|
-
}
|
|
42
|
-
`,gwe=Jo.getLogger(),D3=null;function _we(e=document){return typeof e.startViewTransition==`function`}function O3(e,t){for(let n of e.querySelectorAll(n3(t)))if(!n.hasAttribute(`data-zone-hidden`)&&n.offsetWidth>0)return n;return null}function vwe(e){let t=e.doc??document;return(n,{zone:r})=>{let i=e.stage(),a=t.startViewTransition;if(!i||typeof a!=`function`||e.axis.durationMs===0||!o3(r)||O3(i,r)){n();return}let o=e.origin.peekRow(800)?.element;if(!o?.isConnected){n();return}e.origin.takeRow(800);let s=t.documentElement,c={};D3=c;let l=null,u=()=>{o.style.removeProperty(`view-transition-name`),l?.style.removeProperty(`view-transition-name`),D3===c&&(D3=null,s.removeAttribute(E3),s.style.removeProperty(`--shell-vt-duration`),s.style.removeProperty(`--shell-vt-ease`))};s.setAttribute(E3,``),s.style.setProperty(`--shell-vt-duration`,`${e.axis.durationMs}ms`),s.style.setProperty(`--shell-vt-ease`,e.axis.easing),o.style.setProperty(`view-transition-name`,T3);try{a.call(t,()=>{o.style.removeProperty(`view-transition-name`);try{(0,AN.flushSync)(n)}catch(e){gwe.error(`A navigation commit failed inside the view-transition arrival`,{error:e,zone:r});return}let e=O3(i,r);if(e){for(let e of i.querySelectorAll(n3(r)))for(let t of e.getAnimations?.()??[])`animationName`in t&&t.finish();e.style.setProperty(`view-transition-name`,T3),l=e}}).finished.then(u,u)}catch{u(),n()}}}var ywe=`[${J4}], ${t3}`,k3=new WeakMap;function A3(e,t){let n=0,r=0,i=e;for(;i&&i!==t;){n+=i.offsetLeft,r+=i.offsetTop;let e=i.offsetParent;if(!e||!t.contains(e)&&e!==t)break;i=e}return{left:n,top:r}}function j3(e,t){let n=(0,Q.useRef)(t);n.current=t,(0,Q.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=0,i=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>s()),a=new Set,o=()=>{r=0;let e=new Set(t.querySelectorAll(ywe));for(let t of e)a.has(t)||(i?.observe(t),a.add(t));for(let t of a)e.has(t)||(i?.unobserve(t),a.delete(t));for(let r of e){let e=A3(r,t);n.current?.(r,e,t),r.offsetWidth>0&&r.offsetHeight>0&&k3.set(r,{...e,width:r.offsetWidth,height:r.offsetHeight})}},s=()=>{r||=requestAnimationFrame(o)};o(),i?.observe(t);let c=new MutationObserver(s);return c.observe(t,{childList:!0,subtree:!0}),window.addEventListener(`resize`,s),()=>{cancelAnimationFrame(r),i?.disconnect(),c.disconnect(),window.removeEventListener(`resize`,s)}},[e])}function M3(e,t){let[n,r]=(0,Q.useState)(t);return(0,Q.useEffect)(()=>r(t),[t]),(0,Q.useEffect)(()=>{let t=e.current;if(!t)return;let n=e=>{let t=(e.target instanceof Element?e.target:null)?.closest(`${$4(_a.CONTENT)} :is([data-content-area], [data-panel-id^="nav-"])`),n=t?r3(t):void 0;n&&r(n)};return t.addEventListener(`pointerdown`,n,!0),t.addEventListener(`focusin`,n,!0),()=>{t.removeEventListener(`pointerdown`,n,!0),t.removeEventListener(`focusin`,n,!0)}},[e]),{zone:n,bringForward:r}}var bwe=new Set(or);function N3(e,t){let n=Object.keys(e.state.zones).filter(e=>bwe.has(e)),r=n.map(t=>{let n=e.getTopEntry(t);return n?n.urlPath?.split(/[?#]/)[0]??n.id:``}),i=n.map((e,t)=>`${e}:${r[t]}`).join(`|`),a=(0,Q.useRef)(null),o=(0,Q.useRef)(t);o.current=t,(0,Q.useEffect)(()=>{let e=new Map(n.map((e,t)=>[e,r[t]??``])),t=a.current;if(a.current=e,t)for(let[n,r]of e){let e=t.get(n)??``;r!==``&&e!==r&&o.current(n,e===``?B4.APPEARED:B4.CHANGED)}},[i])}function P3(e){e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`inert`,``);for(let t of[e,...e.querySelectorAll(`*`)])for(let e of[`id`,`data-content-area`,`data-panel-id`,`data-zone-hidden`,`data-zone-emphasized`,`data-component-area`,J4])t.removeAttribute(e);for(let t of e.querySelectorAll(`iframe, video, audio`))t.remove()}function F3(e,t){for(let[n,r]of Object.entries(t))e.style.setProperty(n,r)}function I3(e){requestAnimationFrame(()=>requestAnimationFrame(e))}function L3(e,t){(0,Q.useLayoutEffect)(()=>{let n=e.current;if(!n)return;let r=n.querySelector(`[${Y4}="${Q4.BACK}"]`),i=n.querySelector(`[${Y4}="${Q4.FRONT}"]`);if(!r||!i)return;let a=new Map,o=t.durationMs,s=(e,r)=>{let i=document.createElement(`div`);return i.setAttribute(X4,e),i.setAttribute(`aria-hidden`,`true`),Object.assign(i.style,{position:`absolute`,left:`${r.left}px`,top:`${r.top}px`,width:`${r.width}px`,height:`${r.height}px`}),F3(i,t.ghostPose(V4.REST,{rect:r,stage:n})),i},c=e=>{let r=k3.get(e);if(!r||o===0||e.isConnected)return;let a=s(Z4.DISCARDED,r);P3(e),a.appendChild(e),i.appendChild(a),I3(()=>{F3(a,t.ghostPose(V4.DISCARDED,{rect:r,stage:n})),a.style.opacity=`0`}),setTimeout(()=>a.remove(),o+60)},l=()=>{let e=n.querySelector(`[data-zone-emphasized]`)&&t.drawsHiddenPanePicture?[...n.querySelectorAll(t3)].filter(e=>e.hasAttribute(`data-zone-hidden`)):[];for(let[r,i]of a){if(e.includes(r))continue;if(a.delete(r),o===0){i.remove();continue}let s=k3.get(r);s&&F3(i,t.ghostPose(V4.REST,{rect:s,stage:n})),i.style.opacity=`0`,setTimeout(()=>i.remove(),o)}for(let i of e){if(a.has(i))continue;let e=k3.get(i);if(!e)continue;let c=s(Z4.BEHIND,e),l=i.cloneNode(!0);P3(l),l.classList.remove(`hidden`),l.style.width=`100%`,l.style.height=`100%`,c.appendChild(l),a.set(i,c),o===0?(F3(c,t.ghostPose(V4.BEHIND,{rect:e,stage:n})),r.appendChild(c)):(c.style.opacity=`0`,r.appendChild(c),I3(()=>{F3(c,t.ghostPose(V4.BEHIND,{rect:e,stage:n})),c.style.opacity=`1`}))}},u=e=>e.matches(t3)?e:e.closest(`[data-panel-id^="nav-"]`),d=new MutationObserver(e=>{for(let r of e)if(r.type===`attributes`&&r.attributeName===`data-zone-emphasized`&&t.paneResize===W4.GROW){let e=r.target instanceof Element?u(r.target):null,i=e?k3.get(e):void 0;e&&i&&(r.target.hasAttribute(`data-zone-emphasized`)?b3(e,i,n,t):x3(e,i,n,t))}else if(r.type===`childList`)for(let e of r.removedNodes)e instanceof HTMLElement&&k3.has(e)&&a3(e)&&c(e);l()}),f=n.querySelector($4(_a.CONTENT))??n;return d.observe(f,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-zone-hidden`,`data-zone-emphasized`]}),l(),()=>{d.disconnect();for(let e of a.values())e.remove()}},[e,t]);let n=(0,Q.useRef)(()=>void 0);return(0,Q.useEffect)(()=>{n.current=n=>{let r=e.current;if(!r||t.durationMs===0)return;let i=r.querySelector(n3(n));i&&typeof i.animate==`function`&&i.animate([t.dipPeak(H4.PANE_SWAP,{stage:r})],{duration:t.durationMs,easing:t.easing})}},[e,t]),{dip:e=>n.current(e)}}var xwe=24;function R3(e,t){(0,Q.useEffect)(()=>{let n=e.current;if(!n||t.durationMs===0||typeof ResizeObserver>`u`)return;let r=[...n.querySelectorAll(`[${J4}]`)].filter(e=>e.querySelector(`:scope > ${$4(_a.SIDEBAR)}, :scope > ${$4(_a.UTILITY_PANEL)}`)),i=new Map,a=new Map,o=new ResizeObserver(e=>{for(let r of e){let e=r.target,o=e.offsetWidth,s=i.get(e);if(s===void 0||o===0){i.set(e,o);continue}if(Math.abs(o-s)<=xwe)continue;i.set(e,o);let c=performance.now();c-(a.get(e)??0)<t.durationMs||(a.set(e,c),e.animate([t.dipPeak(H4.COLUMN_RESIZE,{stage:n})],{duration:t.durationMs,easing:t.easing}))}});for(let e of r)o.observe(e);return()=>o.disconnect()},[e,t])}function z3(e,{axis:t,navigation:n,onObjectMeasured:r}){j3(e,r);let{dip:i}=L3(e,t),a=M3(e,n.focusedZone);R3(e,t);let o=v3(t.paneArrival===U4.FROM_PRESSED_ELEMENT||t.dialogArrival===G4.FROM_PRESSED_ELEMENT);w3(e,t,o),(0,Q.useEffect)(()=>{if(t.paneArrival!==U4.FROM_PRESSED_ELEMENT||!t.paneArrivalByViewTransition||t.durationMs===0||!_we())return;let n=f3(`shell-view-transition`,hwe),r=ise(vwe({stage:()=>e.current,origin:o,axis:t}));return()=>{r(),n()}},[e,o,t]);let s=(0,Q.useRef)(new Map);return(0,Q.useEffect)(()=>()=>{for(let e of s.current.values())e();s.current.clear()},[]),N3(n,(n,r)=>{r===B4.CHANGED&&i(n),a.bringForward(n);let c=e.current,l=c?.querySelector(n3(n));if(c&&l&&t.durationMs!==0){if(r===B4.APPEARED&&t.paneArrival===U4.FROM_PRESSED_ELEMENT&&a3(l)){let e=o.takeRow(800);e&&y3(c,e,l.getBoundingClientRect(),t,l)}t.cascadesRows&&(s.current.get(n)?.(),s.current.set(n,C3(l,t)))}}),{frontZone:a.zone}}var B3=Jo.getLogger(),Swe=B3.debugByType(`ComponentRegistryLoaderService`);B3.setDebugTypeLogging(`ComponentRegistryLoaderService`,!1);function Cwe(e){if(!e||e.length===0)return;let t=0;e.forEach(e=>{e&&Object.entries(e).forEach(([e,n])=>{let r=e;n&&Array.isArray(n)&&n.forEach(e=>{if(!e||!e.component)return;let n=e.variant||e.preset||q.DEFAULT;wo.isRegistered(r,n,e.category)||(wo.register(r,n,e.component,{isConfigurable:e.isConfigurable!==!1,category:e.category}),t++)})})}),t>0&&Swe(`✅ Custom components loaded: ${t} components registered`)}function wwe(){let e=wo.getRegistrationsByType(),t=new Map;return e.forEach((e,n)=>{let r=n.split(`_`).slice(0,-1).join(`_`)||`OTHER`;t.set(r,(t.get(r)||0)+e.length)}),{totalRegistered:wo.getRegistrationCount(),byCategory:t}}async function Twe(e){for(let t of e){let e=await t.loadComponent();wo.register(t.componentRef,t.preset??q.DEFAULT,e,{isConfigurable:t.isConfigurable??!1})}}var V3=(0,Q.forwardRef)(({name:e,value:t,onChange:n,onBlur:r,schema:i,disabled:a,readOnly:o,className:s,placeholder:c,controlSize:l=rf.MD,targetResourceType:u,optionDisplayMode:d,onClear:f,leadingAdornment:p,quickCreateSourceFieldName:m,onQuickCreateCreated:h},g)=>{let _=qD(),{tComponent:v,isReady:y}=K({component:[J.RESOURCES_FIELDS_RESOURCE_REFERENCE,J.RESOURCES_LAYOUTS_LIST]}),{renderIcon:b}=Rf(),x=l===rf.SM?`sm`:`md`,S=l===rf.SM?Xd.XS:Xd.SM,{options:C,isLoading:w,isLoadingCurrentValue:T,setIsOpen:E,handleSearchChange:D,getDisplayLabel:O,resourceType:k,isMultiple:A,normalizedValue:j,emptyMessage:M,defaultPlaceholder:N,fetchError:P}=TV({schema:i,name:e,value:t,targetResourceType:u}),{registry:F}=wm(),I=d??xie(i)?.edit?.optionDisplayMode??Qr,ee=k?F.resourceConfigurations[k]:void 0,L=ee?.mainSchema,R=P?jp({tComponent:v,componentType:J.RESOURCES_FIELDS_RESOURCE_REFERENCE,key:`fetchErrorEmptyMessage`,params:{message:P.message}}):M,te=Zz({sourceResourceType:ZT()?.hostResolvesRelationshipRoots===!0?void 0:_?.resourceType,sourceResourceId:_?.resourceId,sourceFieldName:m??e,sourceOperation:_?.operationType,relatedResourceType:k,contextResourceIdentifiers:_?.contextResourceIdentifiers,navigationZone:_?.navigationZone,operationType:_?.operationType,onCreated:async({resourceId:e})=>{if(h)await h(e);else if(A){let t=[...new Set([...j,e])];n(t.length>0?t:void 0)}else n(e)}}),z=(0,Q.useCallback)(e=>{n(e||void 0)},[n]),B=(0,Q.useCallback)(e=>{n(e.length>0?e:void 0)},[n]),ne=(0,Q.useCallback)(e=>T?`...`:O(e.value),[T,O]),re=(0,Q.useCallback)(e=>k&&L&&e.data&&typeof e.data==`object`?(0,$.jsx)(yG,{resourceType:k,schema:V.resolveRowSchema(ee,e.data)??L,data:e.data,primaryLabel:e.label,contextResourceIdentifiers:_?.contextResourceIdentifiers}):e.label,[k,ee,L,_?.contextResourceIdentifiers]),ie=I===qa.SUMMARY?re:void 0;return k?y?A?(0,$.jsxs)(`div`,{className:U(`flex items-start gap-element`,s),children:[(0,$.jsx)(jx,{ref:g,name:e,schema:i,options:C,value:j,onChange:B,renderOption:ie,onBlur:r,disabled:a||o,className:`flex-1`,placeholder:c||N,emptyMessage:R,onSearchChange:D,onOpenChange:E,isLoading:w,shouldFilter:!1,size:x,renderSelectedValue:ne}),te.canQuickCreate&&(0,$.jsx)(X,{type:`button`,size:S,variant:Y.OUTLINE,className:`shrink-0`,onClick:te.launchQuickCreate,disabled:a||o||te.isLaunching,"aria-label":v(J.RESOURCES_LAYOUTS_LIST,`create`),children:te.isLaunching?b(H.LOADER_2,{size:fa.SM,className:`animate-spin motion-reduce:animate-none`}):b(H.PLUS,{size:fa.SM})})]}):(0,$.jsxs)(`div`,{className:U(`flex items-start gap-element`,s),children:[(0,$.jsx)(Ax,{ref:g,name:e,schema:i,options:C,value:j[0]??``,onChange:z,renderOption:ie,onBlur:r,disabled:a||o,className:`flex-1`,placeholder:c||N,emptyMessage:R,onSearchChange:D,onOpenChange:E,isLoading:w,shouldFilter:!1,size:x,renderSelectedValue:ne,onClear:f,leadingAdornment:p}),te.canQuickCreate&&(0,$.jsx)(X,{type:`button`,size:S,variant:Y.OUTLINE,className:`shrink-0`,onClick:te.launchQuickCreate,disabled:a||o||te.isLaunching,"aria-label":v(J.RESOURCES_LAYOUTS_LIST,`create`),children:te.isLaunching?b(H.LOADER_2,{size:fa.SM,className:`animate-spin motion-reduce:animate-none`}):b(H.PLUS,{size:fa.SM})})]}):null:(0,$.jsx)(`div`,{className:U(`flex items-center gap-element px-card-sm py-card-sm rounded-md border border-destructive bg-destructive/10 text-destructive text-sm`,s),children:(0,$.jsxs)(`span`,{children:[`Unknown resource type for field: `,e]})})});V3.displayName=`ResourceFieldEditPreset_ResourceReference_Default`;var Ewe=V3;function Dwe(e){let t=e.registry.resourceConfigurations?.[e.resourceType]?.resourceFieldIdentifier??e.registry.allResourceFieldIdentifiers?.[e.resourceType],n=(t?e.record[t]:void 0)??e.record._id??e.record.id;return typeof n==`string`&&n!==``?n:void 0}var H3=U(`block rounded-md text-inherit no-underline transition-colors hover:bg-muted/40`,Jg(x_.OFFSET));function U3({label:e}){return(0,$.jsx)(Z,{as:`span`,variant:$u.INHERIT,children:e})}var Owe=({fieldName:e,value:t,resourceType:n,data:r,displayParams:i,labelFallback:a,schema:o,className:s})=>{let{registry:c,doOperation:l}=wm(),{emit:u}=vo(),d=wj(),f=qD(),p=Uj({explicitResourceType:n,schema:o,fieldName:e,registry:c})||V.resolveResourceTypeForForeignKey(e,o,c),{t:m,tComponent:h,formatDate:g,formatDateTime:_,isReady:v}=K({component:J.RESOURCES_FIELDS_RESOURCE_REFERENCE,resource:p}),y=bp(),b=(0,Q.useMemo)(()=>d?.contextualParameters&&Object.keys(d.contextualParameters).length>0?d.contextualParameters:f?.contextResourceIdentifiers?V.buildContextualParameters(f.contextResourceIdentifiers,c):{},[d?.contextualParameters,f?.contextResourceIdentifiers,c]),[x,S]=(0,Q.useState)(new Map),C=(0,Q.useRef)(new Map),w=(0,Q.useCallback)((e,t)=>{C.current.set(e,t),S(new Map(C.current))},[]),T=i?.mode??Bte,E=d?.parentReferenceConfig,{hidesWholeReference:D,visibleIds:O}=Q.useMemo(()=>Sj({parentReferenceConfig:E,referencedResourceType:p,referencedIds:Xw(t)}),[E,p,t]),k=!!(E&&p&&E.parentResourceType===p&&E.displayMode!==hr.NONE),A=(0,Q.useMemo)(()=>{if(!k||!E)return T;switch(E.displayMode){case hr.CONTEXT:case hr.BREADCRUMB:return T;case hr.BADGE:case hr.SUMMARY:return E.displayMode;default:return T}},[k,E,T]),j=(0,Q.useMemo)(()=>{if(k){if(E?.showParentLink===!1)return!1;if(E?.displayMode===hr.CONTEXT||E?.displayMode===hr.BREADCRUMB)return!0}return i?.linkable??!0},[k,E,i?.linkable]),M=d?.navigationZone??f?.navigationZone,N=Q.useMemo(()=>{if(!r||typeof r!=`object`||!p||Array.isArray(t))return null;let e=Dwe({record:r,resourceType:p,registry:c});return!e||e!==t||!Object.entries(r).some(([t,n])=>t!==`_id`&&t!==`id`&&n!=null&&n!==e)?null:V.computeFrontendResourceLabel({resourceType:p,registry:c,currentObject:r,t:m,formatDate:g,formatDateTime:_})},[r,p,t,c,m,g,_]),P=(0,Q.useMemo)(()=>{let e={},t=d?.contextResourceIdentifiers||f?.contextResourceIdentifiers;if(t)for(let[n,r]of Object.entries(t)){let t=typeof r==`string`?r:r?.resourceId;t&&(e[n]=t)}return e},[d?.contextResourceIdentifiers,f?.contextResourceIdentifiers]),F=(0,Q.useMemo)(()=>{if(!p)return null;let e=c.resourceConfigurations[p];if(!e)return null;let t=d?.contextResourceIdentifiers||f?.contextResourceIdentifiers,n=d?.resourceType||f?.resourceType,r=n&&t?gn.buildParentResourcesRequirements(n,t,c):[];return{refResourceConfig:e,ownFieldIdentifier:c.allResourceFieldIdentifiers?.[p],currentParentRequirements:r}},[p,c,d?.contextResourceIdentifiers,d?.resourceType,f?.contextResourceIdentifiers,f?.resourceType]),I=d?.resourceType?{resourceType:d.resourceType,id:d.resourceId}:f?{resourceType:f.resourceType,id:f.resourceId}:void 0,ee=I?.resourceType,L=I?.id,R=(0,Q.useCallback)(e=>Zm({hostIdentifiers:P,hostContextualParameters:b,hostParentRequirements:F?.currentParentRequirements,hostRecord:{resourceType:ee,id:L},targetResourceType:p??``,targetId:e,registry:c}),[P,b,F?.currentParentRequirements,ee,L,p,c]),te=(0,Q.useCallback)(e=>{if(!F||!p)return null;let{refResourceConfig:t,ownFieldIdentifier:n}=F,r=R(e),i={...r.identifiers,[p]:e},a={...r.contextualParameters,...n?{[n]:e}:{}},o=Th({resourceConfig:t,operations:t.operations??[],coreOperation:W.READ,registry:c,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:i,contextualParameters:a});if(!o)return null;let s=It.buildOperationFrontendRoutePaths(t,o,c.allResourceFieldIdentifiers);if(s.length===0)return null;try{let t=gn.selectMatchingRoutePath(s,i,p,n,r.parentRequirements,c.allResourceFieldIdentifiers);if(!t?.url)return null;let a=gn.buildParentResourcesRequirementsFromRouteParams(t.parameters??[],p,c),l={};for(let[e,t]of Object.entries(r.contextualParameters))t!=null&&(l[e]=String(t));n&&(l[n]=e);let u=Ch.resolveUrlPath(t.url,l);if(u&&!Ch.hasUnresolvedPlaceholders(u))return{url:u,parentResourcesRequirements:a,readOp:o}}catch{}return null},[F,c,p,R]),z=(0,Q.useCallback)(e=>{if(!F||!p)return null;let{refResourceConfig:t,ownFieldIdentifier:n}=F,r=R(e),i={...r.identifiers,[p]:e},a=Th({resourceConfig:t,operations:t.operations??[],coreOperation:W.READ,registry:c,hasResourceId:!0,requireFrontendAddressable:!1,contextResourceIdentifiers:i,contextualParameters:{...r.contextualParameters,...n?{[n]:e}:{}}});return!a||a.operationFrontendConfig?.surface!==Es.EMBEDDED?null:{readOp:a}},[F,c,p,R]),B=(0,Q.useCallback)(e=>{let t=te(e);if(t)return{readOp:t.readOp,parentResourcesRequirements:t.parentResourcesRequirements};if(!F||!p)return null;let{refResourceConfig:n,ownFieldIdentifier:r}=F,i=R(e),a={...i.contextualParameters,...r?{[r]:e}:{}},o=Th({resourceConfig:n,operations:n.operations??[],coreOperation:W.READ,registry:c,hasResourceId:!0,requireFrontendAddressable:!1,contextResourceIdentifiers:{...i.identifiers,[p]:e},contextualParameters:a});if(!o)return null;let s=V.selectOperationUrlInitiatorInfo({initiatorInfos:o.initiatorInfos??[],contextualParameters:a,targetResourceType:p,targetDefaultFieldIdentifier:r??``});return s?{readOp:o,parentResourcesRequirements:gn.buildParentResourcesRequirementsFromRouteParams(s.parameters,p,c)}:null},[te,F,p,R,c]),ne=(0,Q.useCallback)(async e=>{if(!p||!e)return;let t=C.current.get(e);if(!t||t.label===null&&!t.isLoading){w(e,{id:e,label:null,error:null,isLoading:!0});try{let t=B(e),{record:n,label:r}=await Qw({resourceType:p,id:e,registry:c,doOperation:l,...t?{readOperation:t.readOp,parentResourcesRequirements:t.parentResourcesRequirements}:{},contextualParameters:R(e).contextualParameters,t:m,formatDate:g,formatDateTime:_});w(e,{id:e,label:r,data:n,error:null,isLoading:!1})}catch(t){w(e,{id:e,label:null,error:y(t),isLoading:!1})}}},[p,c,l,w,m,g,_,R,y,B]);(0,Q.useEffect)(()=>{p&&O.length!==0&&A!==qa.ID&&(N&&O.length===1&&!C.current.has(O[0])?w(O[0],{id:O[0],label:N,data:r,error:null,isLoading:!1}):O.forEach(e=>{e&&!C.current.has(e)&&ne(e)}))},[p,O,A,ne,w,N]);let re=(0,Q.useCallback)((e,t)=>{if(!j||!p)return t;let n=A===qa.SUMMARY,r=te(e),i=!!(M&&r?.readOp&&r?.url),a=t=>{if(!i||!r||t.button!==0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)return;let n={...R(e).identifiers,[p]:e},a=gn.createFrontendResourceOperationContextFromOperation({resourceType:p,operation:r.readOp,contextResourceIdentifiers:n,parentResourcesRequirements:r.parentResourcesRequirements});t.preventDefault(),u(hc.NAVIGATION_REQUEST,{content:{contentType:hd.RESOURCE_OPERATION,resourceContext:a},initiator:{sourceZone:M},urlPath:r.url})};if(k&&E?.onNavigateToParent)return r?.url?(0,$.jsx)(Rh,{to:r.url,className:`text-primary hover:underline`,onClick:t=>{t.button!==0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||E.onNavigateToParent(e)!==!1&&t.preventDefault()},children:t}):(0,$.jsx)(`button`,{type:`button`,className:`block text-primary hover:underline bg-transparent border-none p-0 cursor-pointer text-left`,onClick:()=>{E.onNavigateToParent(e)},children:t});if(r?.url)return(0,$.jsx)(Rh,{to:r.url,className:n?H3:`text-primary hover:underline`,onClick:a,children:t});let o=z(e);return o?(0,$.jsx)(`button`,{type:`button`,className:n?U(H3,`w-full bg-transparent border-none p-0 cursor-pointer text-left`):`block text-primary hover:underline bg-transparent border-none p-0 cursor-pointer text-left`,onClick:t=>{if(t.button!==0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)return;t.preventDefault();let n=R(e),r=gn.createFrontendResourceOperationContextFromOperation({resourceType:p,operation:o.readOp,contextResourceIdentifiers:{...n.identifiers,[p]:e},parentResourcesRequirements:n.parentRequirements});u(hc.NAVIGATION_REQUEST,{content:{contentType:hd.RESOURCE_OPERATION,resourceContext:r},initiator:{sourceZone:M??qn.PRIMARY}})},children:t}):t},[u,A,F,j,k,M,E,te,z,p,R]),ie=(0,Q.useCallback)(e=>{if(A===qa.ID)return(0,$.jsx)(`span`,{className:`font-mono text-sm`,children:e});let t=x.get(e);if((t?.isLoading??!1)||!t)return(0,$.jsx)(Tm,{className:`h-4 w-24 inline-block`});if(t.error)return a?(0,$.jsx)(`span`,{className:`text-muted-foreground text-sm`,title:t.error,children:a}):(0,$.jsx)(`span`,{className:`text-muted-foreground text-sm italic`,title:`${e} · ${t.error}`,children:h(J.RESOURCES_FIELDS_RESOURCE_REFERENCE,`recordUnavailable`)});let n=!!p&&!!V.frontendResourceLabelDefinitionOf(c.resourceConfigurations?.[p]),r=(t.data&&p&&n?V.computeFrontendResourceLabel({resourceType:p,registry:c,currentObject:t.data,t:m,formatDate:g,formatDateTime:_}):null)||t.label||a||e;if(A===hr.BADGE){let t=j&&E?.onNavigateToParent?()=>E.onNavigateToParent(e):void 0;return(0,$.jsx)(Hf,{variant:`secondary`,className:t?`cursor-pointer hover:opacity-[var(--opacity-hover)]`:void 0,onClick:t,children:r})}if(A===hr.SUMMARY){if(k){let t=j&&E?.onNavigateToParent?()=>E.onNavigateToParent(e):void 0;return(0,$.jsx)(`span`,{className:`text-muted-foreground text-sm ${t?`cursor-pointer hover:text-foreground transition-colors`:``}`,onClick:t,role:t?`button`:void 0,tabIndex:t?0:void 0,onKeyDown:t?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())}:void 0,children:r})}if(t.data&&p){let n=c.resourceConfigurations[p],i=V.resolveRowSchema(n,t.data);if(i){let n=(0,$.jsx)(yG,{resourceType:p,schema:i,data:t.data,primaryLabel:r,contextResourceIdentifiers:R(e).identifiers});return j?re(e,n):n}}return re(e,(0,$.jsx)(U3,{label:r}))}return qa.LABEL,re(e,(0,$.jsx)(U3,{label:r}))},[A,x,p,k,E,re,c,j,m,h,g,_,a]);return D?null:O.length===0?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):!p&&A!==qa.ID?(0,$.jsx)(`div`,{className:s,title:`Unknown resource type - showing IDs`,children:O.length===1?(0,$.jsx)(`span`,{className:`font-mono text-sm`,children:O[0]}):(0,$.jsx)(`ul`,{className:`list-disc ps-4 space-y-item-xs`,children:O.map(e=>(0,$.jsx)(`li`,{className:`font-mono text-sm`,children:e},e))})}):O.length===1?(0,$.jsx)(`div`,{className:s,children:ie(O[0])}):(0,$.jsx)(`ul`,{className:U(`list-disc ps-4 space-y-item-xs`,s),children:O.map(e=>(0,$.jsx)(`li`,{children:ie(e)},e))})};function kwe(e,t){let n=B1(e),r={size:If.LG,closeOnEscape:!0,closeOnOutsideClick:t?.closeOnOutsideClick??!0,modal:t?.modal??!0,showBackdrop:t?.showBackdrop??!0};return n===yu.SHEET?{mode:n,side:Ea.END,...r}:{mode:n,...r}}var Awe=()=>{let{state:e}=Zx(),{closeOverlay:t}=zS(),n=e.overlay,r=n.length>0?n[n.length-1]:void 0,i=n.length>0,{title:a,description:o}=f1(r),s=(0,Q.useMemo)(()=>kwe(r?.appearance,r?.overlayBehavior),[r?.appearance,r?.overlayBehavior]),c=(0,Q.useCallback)(e=>{e||t()},[t]);return(0,$.jsx)(I1,{open:i,onOpenChange:c,title:a||void 0,description:o,config:s,children:r&&(0,$.jsx)(e2,{content:r.content,zone:qn.OVERLAY,initiator:r.initiator,entryId:r.id})})},W3=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>(0,$.jsx)(Awe,{});function jwe({preset:e=q.DEFAULT,...t}){let n=G(J.RESOURCES_LAYOUTS_CONTAINER_DIALOGS,`ResourceLayout_ContainerDialogs`)(e);return(0,$.jsx)(n,{...t})}var G3=({resourceContext:e,onFiltersChange:t})=>{let{registry:n}=wm(),{resourceType:r}=e,[i,a]=(0,Q.useState)({}),o=(0,Q.useMemo)(()=>n.resourceConfigurations[r],[n,r]),s=(0,Q.useMemo)(()=>HG.parseFilterFieldDefinitions(e.operation?.filterFields,void 0,o),[e.operation,o]),c=(0,Q.useCallback)(e=>{a(e),t?.(e)},[t]);return s.length===0?(0,$.jsx)(`div`,{className:`text-sm text-muted-foreground p-card`,children:`No filters available for this resource.`}):(0,$.jsx)(tq,{resourceType:r,filterFields:s,currentFilters:i,onFiltersChange:c})};function Mwe({preset:e=q.DEFAULT,...t}){let n=G(J.RESOURCES_LAYOUTS_FILTERS,`ResourceLayout_Filters`)(e);return(0,$.jsx)(n,{...t})}var Nwe=e=>(0,$.jsx)(DX,{...e,defaultViewMode:au.TABLE}),K3=e=>(0,$.jsx)(QY,{...e,showCharts:!1}),q3=(0,Q.memo)(({resourceContext:e,item:t,onNavigate:n,className:r})=>{let{resourceType:i}=e,{registry:a}=wm(),{t:o,formatDate:s,formatDateTime:c,isReady:l}=K({component:J.RESOURCES_LAYOUTS_READ_SUMMARY,resource:i}),u=(0,Q.useMemo)(()=>[`resources.${i}`,`components.${J.RESOURCES_LAYOUTS_READ_SUMMARY}`],[i]),d=a.resourceConfigurations[i],f=(0,Q.useMemo)(()=>V.computeFrontendResourceLabel({resourceType:i,registry:a,currentObject:t,t:o,formatDate:s,formatDateTime:c})||String(i),[t,i,a,o,s,c]),p=(0,Q.useMemo)(()=>V.resolveRowSchema(d,t),[d,t]),m=d?.frontendConfiguration?.layout?.summary;return l?(0,$.jsx)(yb,{i18nKeys:u,children:(0,$.jsx)(`div`,{className:[`flex flex-col gap-element-sm p-card rounded-lg`,n?`cursor-pointer hover:bg-muted/50 motion-safe:transition-colors`:``,r??``].filter(Boolean).join(` `),onClick:n?()=>n(t):void 0,role:n?`button`:void 0,tabIndex:n?0:void 0,onKeyDown:n?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(t))}:void 0,children:p&&m?(0,$.jsx)(yG,{resourceType:i,schema:p,data:t,primaryLabel:f,contextResourceIdentifiers:e.contextResourceIdentifiers}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-medium text-foreground truncate`,children:f}),p&&(0,$.jsx)(yG,{resourceType:i,schema:p,data:t,contextResourceIdentifiers:e.contextResourceIdentifiers})]})})}):null});function Pwe({preset:e,...t}){let n=t.resourceContext.operation.operationFrontendConfig?.displayPresetOverride?.resourceLayoutPresetKey,r=e??n??Oc.DEFAULT,i=G(J.RESOURCES_LAYOUTS_READ_SUMMARY,`ResourceLayout_ReadSummary`)(r);return(0,$.jsx)(i,{...t})}var Fwe=({resourceContext:e,item:t,summaryFields:n,fieldLabelsMap:r,onItemClick:i,operationsSlot:a,isSelected:o,className:s})=>{let{resourceType:c}=e,{registry:l}=wm(),{t:u,formatDate:d,formatDateTime:f,tResourceFieldEnumValue:p}=K({resource:c}),{tComponent:m}=K({component:J.LOW_LEVEL_FORM_FIELD}),h=l.resourceConfigurations[c],g=(0,Q.useMemo)(()=>V.computeFrontendResourceLabel({resourceType:c,registry:l,currentObject:t,t:u,formatDate:d,formatDateTime:f})||String(t[n[0]]??`${c}`),[t,c,l,n,u,d,f]),_=(0,Q.useMemo)(()=>{let e=V.resolveRowSchema(h,t);return e?sr.getObjectLikeFieldShape(e,{commonOnly:!1})??null:null},[h,t]),v=(0,Q.useCallback)(()=>{i?.(t)},[i,t]),y=(0,Q.useCallback)(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i?.(t))},[i,t]);return(0,$.jsxs)(`tr`,{"data-slot":`resource-list-item`,className:[`border-b border-border/50 motion-safe:transition-colors`,i?`cursor-pointer hover:bg-muted/50`:``,i?Jg(x_.INSET):``,o?`bg-primary/5`:``,s??``].filter(Boolean).join(` `),onClick:v,onKeyDown:y,tabIndex:i?0:void 0,"aria-label":g,"aria-selected":o,children:[n.map(n=>{let i=t[n];return(0,$.jsx)(RJ,{className:`px-card py-element text-sm align-middle`,truncate:!0,"aria-label":r[n],children:i==null?(0,$.jsx)(Jj,{noValueLabel:m(J.LOW_LEVEL_FORM_FIELD,`noValue`),typography:Xj(_?.[n]?sc(_[n]):void 0)}):(0,$.jsx)(FG,{fieldName:n,value:i,fieldSchema:_?.[n],fieldLabel:void 0,resourceType:c,record:t,collectionContextResourceIdentifiers:e.contextResourceIdentifiers,tResourceFieldEnumValue:p})},n)}),a&&(0,$.jsx)(RJ,{className:`px-card py-element text-sm align-middle text-end`,onClick:e=>e.stopPropagation(),children:a})]})},Iwe=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>(0,$.jsx)(nX,{resourceContext:e,navigationZone:t,navigationInitiator:n}),J3=({children:e=null})=>(0,$.jsx)(AX,{children:`PublicLayoutPreset_StaticContentContainer_Default`});function Lwe({preset:e=q.DEFAULT,...t}){let n=G(J.PUBLIC_LAYOUTS_STATIC_CONTENT_CONTAINER,`PublicLayout_StaticContentContainer`)(e);return(0,$.jsx)(n,{...t})}var Rwe=Q.lazy(()=>T_(()=>import(`./ChartView-Dxhrm4ZQ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),zwe=Q.lazy(()=>T_(()=>import(`./ChartWidget-CjyBqut4.js`).then(e=>e.n),__vite__mapDeps([10,1,2,3,9,4,5,6,11,12])));function Bwe(){wo.register(J.HIGH_LEVEL_VIEWS_CHART_ECHARTS,q.DEFAULT,Rwe,{isConfigurable:!1}),wo.register(J.HIGH_LEVEL_VIEWS_CHART_WIDGET,q.DEFAULT,zwe,{isConfigurable:!1}),wo.register(J.APP_LAYOUTS_ERROR_BOUNDARY,q.DEFAULT,rb,{isConfigurable:!0}),wo.register(J.APP_LAYOUTS_HOME,q.DEFAULT,$U,{isConfigurable:!0}),wo.register(J.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY,q.DEFAULT,sb,{isConfigurable:!0}),wo.register(J.PUBLIC_LAYOUTS_STATIC_CONTENT_CONTAINER,q.DEFAULT,J3,{isConfigurable:!0}),wo.register(J.PUBLIC_LAYOUTS_USER_AUTH,q.DEFAULT,kZ,{isConfigurable:!0}),wo.register(J.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL,q.DEFAULT,MZ,{isConfigurable:!0}),wo.register(J.PUBLIC_LAYOUTS_USER_INVITATION,q.DEFAULT,zZ,{isConfigurable:!0}),wo.register(J.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,q.DEFAULT,YZ,{isConfigurable:!0}),wo.register(J.PUBLIC_LAYOUTS_USER_REGISTER,q.DEFAULT,pQ,{isConfigurable:!0}),wo.register(J.PUBLIC_LAYOUTS_ONE_OFF_SESSION,q.DEFAULT,VZ,{isConfigurable:!0}),wo.register(J.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT,q.DEFAULT,KZ,{isConfigurable:!0}),wo.register(J.PUBLIC_LAYOUTS_AUTH_CALLBACK,q.DEFAULT,IX,{isConfigurable:!0}),wo.register(J.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY,q.DEFAULT,BX,{isConfigurable:!0}),wo.register(J.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,q.DEFAULT,yZ,{isConfigurable:!0}),wo.register(J.PUBLIC_LAYOUTS_ORGANIZATION_ONBOARDING,q.DEFAULT,wZ,{isConfigurable:!0}),wo.register(J.PUBLIC_LAYOUTS_MFA_CHALLENGE,q.DEFAULT,gZ,{isConfigurable:!0}),wo.register(J.PUBLIC_LAYOUTS_OAUTH_CONSENT,q.DEFAULT,ZZ,{isConfigurable:!0}),wo.register(J.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT,q.DEFAULT,iQ,{isConfigurable:!0}),wo.register(J.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM,q.DEFAULT,sQ,{isConfigurable:!0}),wo.register(J.PUBLIC_LAYOUTS_CHAT_IDENTITY_LINK,q.DEFAULT,nQ,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_BREADCRUMB,q.DEFAULT,LB,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_CONTAINER_DIALOGS,q.DEFAULT,W3,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_CONTAINER_NESTED,q.DEFAULT,PY,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_CREATE,q.DEFAULT,fG,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_ACTION,q.DEFAULT,eG,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_FILTERS,q.DEFAULT,G3,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_HEADER,q.DEFAULT,fV,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_LIST,Zo.DEFAULT,DX,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_LIST,Zo.TABLE,Nwe,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_OPERATIONS_BULK,q.DEFAULT,QJ,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,q.DEFAULT,IY,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_RECORD_SHARING,q.DEFAULT,JY,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_DANGER_ZONE,q.DEFAULT,VY,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_PAGINATION,q.DEFAULT,rK,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_READ,ol.DEFAULT,QY,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_READ,ol.EXPANDABLE,K3,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_READ_SUMMARY,Oc.DEFAULT,q3,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_READ_SUMMARY,Oc.TABLE_ROW,Fwe,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_SEARCH,xs.DEFAULT,nX,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_SEARCH,xs.TABLE,Iwe,{isConfigurable:!0}),wo.register(J.RESOURCES_LAYOUTS_UPDATE,q.DEFAULT,iX,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_BIGDECIMAL,q.DEFAULT,gL,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_BOOLEAN,q.DEFAULT,NI,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_DATE,q.DEFAULT,oN,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_DATETIME,q.DEFAULT,lN,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_ENUM,q.DEFAULT,cI,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_FILE,q.DEFAULT,qL,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_MONEY,q.DEFAULT,$I,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_DURATION,q.DEFAULT,tL,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_PHONE,q.DEFAULT,cL,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_ADDRESS,q.DEFAULT,pL,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_NUMBER,q.DEFAULT,XI,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_RANGE_BIGDECIMAL,q.DEFAULT,yL,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_RANGE_DATE,q.DEFAULT,_N,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_RANGE_DATETIME,q.DEFAULT,bN,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_RANGE_MONEY,q.DEFAULT,xL,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_RANGE_NUMBER,q.DEFAULT,mN,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_RANGE_TIME,q.DEFAULT,CN,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_STRING,q.DEFAULT,JI,{isConfigurable:!0}),wo.register(J.LOW_LEVEL_FORM_FIELD_TIME,q.DEFAULT,fN,{isConfigurable:!0}),wo.register(J.RESOURCES_FIELDS_RESOURCE_REFERENCE,q.DEFAULT,V3,{isConfigurable:!0,category:os.EDIT}),wo.register(J.RESOURCES_FIELDS_RESOURCE_REFERENCE,Cne.SEARCH,Ewe,{isConfigurable:!0,category:os.EDIT}),wo.register(J.RESOURCES_FIELDS_RESOURCE_REFERENCE,q.DEFAULT,Owe,{isConfigurable:!0,category:os.DISPLAY})}var Vwe=Jo.getLogger(),Y3=new Set([J.LOW_LEVEL_CONTENT_SECTION_CONTAINER,J.LOW_LEVEL_OVERLAY_CONTAINER,J.LOW_LEVEL_AI_FLOW_NODE,J.LOW_LEVEL_AI_FLOW_EXECUTION,J.LOW_LEVEL_AI_SYSTEM_CATALOG,J.LOW_LEVEL_AI_ACTOR,J.LOW_LEVEL_AI_EXECUTION_PLAN,J.LOW_LEVEL_AI_TASK_DETAIL,J.LOW_LEVEL_AI_TASK_MEMORY,J.LOW_LEVEL_AI_EXECUTION_USAGE,J.LOW_LEVEL_AI_GRAPH_VIEWER,J.LOW_LEVEL_AI_APPROVAL,J.LOW_LEVEL_AI_DECISION,J.LOW_LEVEL_AI_EXECUTION_STREAM,J.LOW_LEVEL_AI_ARTIFACT_BROWSER,J.LOW_LEVEL_AI_AGENT_CONFIG,J.GUIDANCE_CHECKLIST,J.GUIDANCE_CHECKLIST_ITEM,J.GUIDANCE_TOUR,J.GUIDANCE_TOOLTIP,J.GUIDANCE_MODAL,J.GUIDANCE_BANNER,J.GUIDANCE_ANNOUNCEMENT,J.GUIDANCE_BADGE,J.GUIDANCE_CARD,J.GUIDANCE_SURVEY,J.GUIDANCE_ONBOARDING_VIEW,J.PROGRESSION_MILESTONE_TRACKER,J.PROGRESSION_ACHIEVEMENT_BADGE,J.LIFECYCLE_HOME_ACTIVATION_PROGRESS,J.LIFECYCLE_HOME_WELCOME_BACK,J.LIFECYCLE_HOME_DASHBOARD,J.HIGH_LEVEL_VIEWS_COMPOSITE,J.HIGH_LEVEL_VIEWS_CHART,J.HIGH_LEVEL_VIEWS_FULL_CUSTOM,J.HIGH_LEVEL_VIEWS_FLOWS_ACTORS,J.HIGH_LEVEL_VIEWS_EXECUTION,J.HIGH_LEVEL_VIEWS_NOT_FOUND,J.APP_LAYOUTS_TEST_COMPONENT,J.APP_LAYOUTS_SECURITY_SETTINGS,J.APP_LAYOUTS_SETTINGS_HUB,J.APP_LAYOUTS_APPEARANCE_SETTINGS,J.APP_LAYOUTS_INVITATIONS_SETTINGS,J.APP_LAYOUTS_BILLING_SETTINGS,J.APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS,J.APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS,J.APP_LAYOUTS_AUTONOMOUS_AGENTS_SETTINGS,J.APP_LAYOUTS_MODEL_COST_BREAKDOWN_SETTINGS,J.APP_LAYOUTS_REPRESENTATIVE_ACTIVITY_SETTINGS,J.APP_LAYOUTS_AGENT_WORK_EVALUATION_EXPORT_SETTINGS,J.APP_LAYOUTS_SURFACE_ERROR_BOUNDARY,J.LOW_LEVEL_FORM_FIELD_FOREIGN_KEY,J.LOW_LEVEL_DISPLAY_FIELD_FOREIGN_KEY]);function X3(){let e=Object.values(J),t=[],n=0;for(let r of e)Y3.has(r)||(wo.hasComponentType(r)?n+=1:t.push(r));return{totalEnumValues:e.length,registeredCount:n,denyListedCount:Y3.size,missing:t}}function Hwe(e){let t=X3();if(t.missing.length===0)return t;let n=`[ComponentRegistry] Tier-1 completeness check failed: ${t.missing.length} FrontendComponentType value(s) have no registered preset.\n\nMissing entries:\n${t.missing.map(e=>` - ${e}`).join(`
|
|
43
|
-
`)}\n\nFor each missing entry you must EITHER:\n (1) register a default preset in registerDefaultPresets() / registerFrameworkLayouts(); OR\n (2) add the enum value to KNOWN_NON_REGISTERED_COMPONENT_TYPES in assert-registry-completeness.frontend.helper.ts with a one-line justification (Tier-1 slots resolve through the registry; Tier-2, framework-internal and i18n-bundle-only slots are rendered directly and are the only ones that belong in that list).`,r=typeof process<`u`&&!1;if(e?.strict||r)throw Error(n);return Vwe.warn(`component-registry.completeness-check.failed`,{message:n,missing:t.missing}),t}function Uwe(e){return Lee(e)}var Z3;(function(e){e.HEX=`hex`,e.RGB=`rgb`,e.HSL=`hsl`})(Z3||={});var Wwe=/^#([0-9a-f]{6})$/i,Gwe=/^#([0-9a-f]{3})$/i,Kwe=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*[\d.]+\s*)?\)$/i,qwe=/^hsla?\(\s*(\d{1,3}(?:\.\d+)?)\s*,\s*(\d{1,3}(?:\.\d+)?)%\s*,\s*(\d{1,3}(?:\.\d+)?)%\s*(?:,\s*[\d.]+\s*)?\)$/i;function Q3(e,t,n){return Math.min(n,Math.max(t,e))}function $3(e){let t=e.trim();if(t.length===0)return null;let n=Wwe.exec(t);if(n){let e=n[1];return{r:parseInt(e.slice(0,2),16),g:parseInt(e.slice(2,4),16),b:parseInt(e.slice(4,6),16)}}let r=Gwe.exec(t);if(r){let[e,t,n]=r[1].split(``);return{r:parseInt(`${e}${e}`,16),g:parseInt(`${t}${t}`,16),b:parseInt(`${n}${n}`,16)}}let i=Kwe.exec(t);if(i){let e=[i[1],i[2],i[3]].map(e=>parseInt(e,10));return e.some(e=>e>255)?null:{r:e[0],g:e[1],b:e[2]}}let a=qwe.exec(t);if(a){let e=parseFloat(a[1]),t=parseFloat(a[2]),n=parseFloat(a[3]);return e>360||t>100||n>100?null:i6(e,t,n)}return null}function e6(e){let t=t6(e);return t===null?null:$3(t)}function t6(e){let t=e.trim();if(t.length===0)return null;let n=document.createElement(`span`);if(n.style.color=``,n.style.color=t,n.style.color===``)return null;let r=document.createElement(`span`);r.style.display=`none`,r.appendChild(n),document.body.appendChild(r);try{r.style.color=`rgb(1, 2, 3)`;let e=window.getComputedStyle(n).color;return r.style.color=`rgb(4, 5, 6)`,e===window.getComputedStyle(n).color&&e||null}finally{document.body.removeChild(r)}}function n6({r:e,g:t,b:n}){let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=o-Math.min(r,i,a),c=0;return s!==0&&(c=o===r?((i-a)/s+(i<a?6:0))*60:o===i?((a-r)/s+2)*60:((r-i)/s+4)*60),{h:c,s:o===0?0:s/o*100,v:o*100}}function r6({h:e,s:t,v:n}){let r=(e%360+360)%360,i=Q3(t,0,100)/100,a=Q3(n,0,100)/100,o=a*i,s=o*(1-Math.abs(r/60%2-1)),c=a-o,l;return l=r<60?[o,s,0]:r<120?[s,o,0]:r<180?[0,o,s]:r<240?[0,s,o]:r<300?[s,0,o]:[o,0,s],{r:Math.round((l[0]+c)*255),g:Math.round((l[1]+c)*255),b:Math.round((l[2]+c)*255)}}function i6(e,t,n){let r=(e%360+360)%360,i=Q3(t,0,100)/100,a=Q3(n,0,100)/100,o=(1-Math.abs(2*a-1))*i,s=o*(1-Math.abs(r/60%2-1)),c=a-o/2,l;return l=r<60?[o,s,0]:r<120?[s,o,0]:r<180?[0,o,s]:r<240?[0,s,o]:r<300?[s,0,o]:[o,0,s],{r:Math.round((l[0]+c)*255),g:Math.round((l[1]+c)*255),b:Math.round((l[2]+c)*255)}}function a6({r:e,g:t,b:n}){let r=e=>Q3(Math.round(e),0,255).toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`}function o6(e,t){if(t===Z3.RGB)return`rgb(${Math.round(e.r)}, ${Math.round(e.g)}, ${Math.round(e.b)})`;if(t===Z3.HSL){let t=e.r/255,n=e.g/255,r=e.b/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=i-a,s=(i+a)/2,c=0,l=0;return o!==0&&(l=s>.5?o/(2-i-a):o/(i+a),c=i===t?((n-r)/o+(n<r?6:0))*60:i===n?((r-t)/o+2)*60:((t-n)/o+4)*60),`hsl(${Math.round(c)}, ${Math.round(l*100)}%, ${Math.round(s*100)}%)`}return a6(e)}function Jwe(e,t){return o6(r6(e),t)}function s6({r:e,g:t,b:n}){let r=e=>{let t=Q3(e,0,255)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(e)+.7152*r(t)+.0722*r(n)}var Ywe=()=>{let e=(0,Q.useContext)(OH);if(!e)throw Error(`useStepUpAuth must be used within a StepUpAuthProvider`);return e},c6=class extends Error{code;httpStatus;constructor(e,t,n){super(t),this.name=`CrossFrontendHandoffClientError`,this.code=e,this.httpStatus=n}};async function l6(e,t){let n;try{n=await lc().crossFrontendHandoff(e,t)}catch(e){throw Zwe(e)}if(!n||typeof n.handoffUrl!=`string`||typeof n.expiresAt!=`string`)throw new c6(`malformed_response`,`Cross-frontend handoff response missing required fields`,null);return{handoffUrl:n.handoffUrl,expiresAt:n.expiresAt}}var Xwe=new Set(Object.values(fae));function Zwe(e){if(e instanceof c6)return e;let t=e,n=typeof t?.response?.status==`number`?t.response.status:typeof t?.httpStatus==`number`?t.httpStatus:null;if(n===null)return new c6(`network`,t?.message??`Cross-frontend handoff request failed (no response)`,null);if(n===401)return new c6(`unauthenticated`,`Cross-frontend handoff requires an authenticated session`,401);let r=t?.response?.data?.error?.details?.code??t?.context?.code;return typeof r==`string`&&Xwe.has(r)?new c6(r,t?.message??`Cross-frontend handoff failed (HTTP ${n})`,n):new c6(`malformed_response`,t?.message??`Cross-frontend handoff failed (HTTP ${n})`,n)}function Qwe(){let[e,t]=(0,Q.useState)(`idle`),[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(0);return(0,Q.useEffect)(()=>(o.current=!1,()=>{o.current=!0}),[]),{status:e,data:n,error:i,requestHandoff:(0,Q.useCallback)(async(e,n)=>{let i=++s.current;t(`pending`),a(null);try{let a=await l6(e,n);return!o.current&&i===s.current&&(r(a),t(`success`)),a}catch(e){let n=e instanceof c6?e:new c6(`malformed_response`,e instanceof Error?e.message:`Cross-frontend handoff failed`,null);throw!o.current&&i===s.current&&(a(n),t(`error`)),n}},[]),reset:(0,Q.useCallback)(()=>{s.current++,t(`idle`),r(null),a(null)},[])}}function u6(e,t,n){if(e.visibleInModes&&e.visibleInModes.length>0&&(!t||!e.visibleInModes.includes(t)))return!1;if(e.scopeCondition)try{return e.scopeCondition(n)}catch{return!1}return!0}function d6(e,t,n,r=!1){let i=e.filter(e=>u6(e,t,n));return r&&i.length===0&&e.length>0&&(e.some(e=>e.contentKind===Le.GUIDANCE_WIDGET&&(!e.visibleInModes||e.visibleInModes.length===0))||console.warn(`[AppMode] All sidebar sections are hidden and no unconditionally-visible GUIDANCE_WIDGET section covers the empty state. Consider adding a GUIDANCE_WIDGET section without visibleInModes restrictions and a scopeCondition that activates when other sections are hidden.`)),i}function f6(e,t,n){return{appScopeValues:e,activeMode:t,availableModes:n}}function p6(e,t,n){let r=e.map(e=>{let r=!!(e.visibleInModes&&e.visibleInModes.length>0),i=`N/A`;r&&(i=!!t&&e.visibleInModes.includes(t));let a=!!e.scopeCondition,o=`N/A`;if(a)try{o=e.scopeCondition(n)}catch{o=!1}let s=u6(e,t,n);return{ref:e.ref,contentKind:e.contentKind,modeFilter:r?e.visibleInModes.join(`, `):`(all)`,modeMatch:i,hasScopeCondition:a,scopeMatch:o,visible:s}});console.group(`[SidebarVisibility] activeMode="${t??`none`}" | ${r.filter(e=>e.visible).length}/${r.length} sections visible`),console.table(r),console.log(`Scope params:`,n),console.groupEnd()}function $we(e){return H0(e)}function eTe({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_FEATURE_UNAVAILABLE_DIALOG,`FeatureUnavailableDialog`)(e);return(0,$.jsx)(n,{...t})}function tTe({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_FEATURE_LOCK_BADGE,`FeatureLockBadge`)(e);return(0,$.jsx)(n,{...t})}function m6({featureId:e,showLabel:t=!0,size:n=`sm`,preset:r=q.DEFAULT}){let{getLimit:i,getCurrentUsage:a}=Nh(),{t:s}=K(),c=i(e),l=a(e)??0;if(c===void 0||c===-1)return null;let u=Bo(o.LIMIT,e),d=s(u),f=d===u?e:d,p=G(J.LOW_LEVEL_FEATURE_LIMIT_INDICATOR,`FeatureLimitIndicator`)(r);return(0,$.jsx)(p,{usage:l,limit:c,label:f,showLabel:t,size:n})}var h6=ti.BILLING,g6={kind:ru.SETTINGS_SECTION,sectionRef:h6,category:ud.BILLING,searchKeywords:[`billing`,`subscription`,`plan`,`payment`,`invoice`,`upgrade`],runtimeAvailability:{requiredCapabilities:[`billingEnabled`]}};function _6(e){let t=jm(),n=CS(),r=(0,Q.useContext)(_h)?.user?._id,i=e!==void 0&&e===r;return(0,Q.useMemo)(()=>t?_(t.getAvailableResourceTypes().flatMap(e=>{let n=t.getResourceConfiguration(e);return n?[{resourceIdentifier:e,operations:n.operations??[]}]:[]}),i?{initiatorMayPerform:e=>th({resourceType:e.resourceIdentifier,roles:e.roles,operationIdentifier:e.operationIdentifier,resourceOperationLike:e.resourceOperationLike},n)}:{}):[],[t,n,i])}function v6(e){for(let t of e)for(let e of t)if(e.userNotifications?.some(e=>e.channel===Xn.SMS))return!0;return!1}function y6(e){let t=jm(),n=(0,Q.useContext)(_h)?.user?._id,r=e!==void 0&&e===n,i=(0,Q.useMemo)(()=>t?v6(t.getAvailableResourceTypes().map(e=>t.getResourceConfiguration(e)?.operations??[])):!1,[t]),[a,o]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{if(!i||!r){o(!1);return}let e=!1;return lc().getMyMethods().then(t=>{e||o((t.methods??[]).some(e=>e.method===Al.SMS_OTP&&e.enrolled))}).catch(()=>{e||o(!1)}),()=>{e=!0}},[i,r]),i&&r&&a}var nTe=e=>{let{resourceType:t,resourceId:n,scopeKey:r,scopeId:i,contextResourceIdentifiers:a,autoSubscribe:o=!0,onUpdated:s,onDeleted:c,onEditingStart:l,onEditingEnd:u,onCustomEvent:d}=e,f=Sp(),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)([]),y=(0,Q.useRef)(!1),b=(0,Q.useRef)(!1),x=(0,Q.useRef)(`useResourceRoom:${Math.random().toString(36).slice(2)}`),S=(0,Q.useRef)(async()=>void 0);b.current=p;let C=n?`${t}:${n}`:`${t}:${r}:${i}`,w=(0,Q.useCallback)(async()=>{if(p)return!0;let e=await f.claimResourceRoom({ownerKey:x.current,resourceType:t,resourceId:n,scopeKey:r,scopeId:i,contextResourceIdentifiers:a});return m(e.success),e.success&&e.editingUsers&&v(e.editingUsers),e.success},[f,t,n,r,i,a,p]),T=(0,Q.useCallback)(async()=>{p&&(await f.releaseResourceRoom({ownerKey:x.current,resourceType:t,resourceId:n,scopeKey:r,scopeId:i,contextResourceIdentifiers:a}),m(!1),v([]))},[f,t,n,r,i,a,p]);S.current=T;let E=(0,Q.useCallback)(async()=>{if(!n)return console.warn(`Cannot start editing without resourceId`),!1;let e=await f.startEditing({resourceType:t,resourceId:n,contextResourceIdentifiers:a});return e&&(g(!0),y.current=!0),e},[f,t,n,a]),D=(0,Q.useCallback)(()=>{n&&h&&(f.stopEditing({resourceType:t,resourceId:n}),g(!1),y.current=!1)},[f,t,n,h]),O=(0,Q.useCallback)((e,r,i)=>{n?f.sendCustomEvent({resourceType:t,resourceId:n,eventName:e,data:r,contextResourceIdentifiers:a,includeSelf:i}):console.warn(`Cannot send custom event without resourceId`)},[f,t,n,a]);return(0,Q.useEffect)(()=>{if(!f.isConnected||!p)return;let e=f.on(mi.RESOURCE_UPDATED,e=>{if(e.resourceType===t){if(n){if(e.resourceId!==n||e.deliveryTarget!==Lt.RESOURCE_ROOM_SYNC&&e.deliveryTarget!==Lt.RESOURCE_ROOM_NOTIFICATION)return}else if(e.deliveryTarget!==Lt.SCOPE_ROOM_NOTIFICATION)return;s?.(e)}}),r=f.on(mi.RESOURCE_DELETED,e=>{e.resourceType===t&&n&&e.resourceId===n&&c?.(e)}),i=f.on(mi.RESOURCE_EDITING_START,e=>{e.resourceType===t&&n&&e.resourceId===n&&(e.initiatorUserId&&v(t=>t.includes(e.initiatorUserId)?t:[...t,e.initiatorUserId]),l?.(e))}),a=f.on(mi.RESOURCE_EDITING_END,e=>{e.resourceType===t&&n&&e.resourceId===n&&(e.initiatorUserId&&v(t=>t.filter(t=>t!==e.initiatorUserId)),u?.(e))}),o=f.on(mi.RESOURCE_CUSTOM,e=>{e.resourceType===t&&n&&e.resourceId===n&&d?.(e)});return()=>{e(),r(),i(),a(),o()}},[f,p,t,n,s,c,l,u,d]),(0,Q.useEffect)(()=>{o&&f.isConnected&&!p&&w()},[o,f.isConnected,p,w]),(0,Q.useEffect)(()=>()=>{y.current&&n&&f.stopEditing({resourceType:t,resourceId:n})},[f,t,n]),(0,Q.useEffect)(()=>()=>{b.current&&S.current()},[C]),{isSubscribed:p,isEditing:h,editingUsers:_,subscribe:w,unsubscribe:T,startEditing:E,stopEditing:D,sendCustomEvent:O}},b6=`this-session`;function x6(e,t){let{emit:n}=vo(),{registry:r}=wm(),i=(0,Q.useRef)(!1),a=r.notificationBadgeDefinitions.find(t=>Os(t)===e),o=a?.source.kind===Vne.FRONTEND_PRODUCED;(0,Q.useEffect)(()=>{if(!o){!i.current&&va.isDevelopment()&&(i.current=!0,console.warn(a?`[usePublishNotificationBadgeCount] "${e}" is a ${a.source.kind} badge; its count is the backend's, so this page does not publish one.`:`[usePublishNotificationBadgeCount] "${e}" names no registered notification badge definition; nothing would draw it.`));return}if(t===null)return;let r=Gte(e);r&&y$(n,{badgeReference:Sre(r.scope,b6,r.identifier),badgeCount:Math.max(0,Math.trunc(t))})},[e,t,o,a,n])}function rTe({milestoneRef:e,className:t}){let n=EU(),{tComponent:r,isReady:i}=K({component:J.PROGRESSION_ACHIEVEMENT_BADGE}),{renderIcon:a}=Rf(),o=(0,Q.useMemo)(()=>(e,t)=>r(J.PROGRESSION_ACHIEVEMENT_BADGE,e,t),[r]),s=n.isMilestoneAchieved(e);if(!i)return null;let c=n.milestoneDefinitions.find(t=>t.identifier===e);if(!c)return null;let l=o(s?`achieved`:`locked`),u=s?a(H.CHECK,{size:fa.XS,className:`text-success`}):a(H.LOCK,{size:fa.XS});return(0,$.jsxs)(Hf,{variant:s?`default`:`outline`,className:U(`gap-1`,!s&&`opacity-60`,t),title:o(`description`),children:[u,(0,$.jsx)(`span`,{children:l}),s&&(c.points??0)>0&&(0,$.jsxs)(`span`,{className:`text-xs opacity-70`,children:[`+`,c.points]})]})}var S6=J.LOW_LEVEL_AI_ACTOR;function C6(e){return`role_${e}`}function w6(e){return`mode_${e}`}function T6(e){return`modeDesc_${e}`}var iTe={[bt.COORDINATOR]:H.USERS,[bt.TASK_PLANNER]:H.BOOK,[bt.OPERATOR]:H.WRENCH,[bt.ANALYZER]:H.SEARCH,[bt.REVIEWER]:H.CHECK_CIRCLE,[bt.HUMAN_IN_THE_LOOP]:H.LOCK,[bt.FLOW_EXECUTION]:H.ARROW_RIGHT},aTe={[Gr.AGENTIC]:H.BRAIN,[Gr.FLOW_EXECUTION]:H.ARROW_RIGHT,[Gr.HUMAN_INTERACTION]:H.USERS,[Gr.PROGRAMMATIC]:H.SETTINGS},oTe={[bt.COORDINATOR]:`default`,[bt.TASK_PLANNER]:`default`,[bt.OPERATOR]:`secondary`,[bt.ANALYZER]:`secondary`,[bt.REVIEWER]:`outline`,[bt.HUMAN_IN_THE_LOOP]:`destructive`,[bt.FLOW_EXECUTION]:`outline`},E6=e=>Object.values(bt).includes(e),sTe=e=>Object.values(Gr).includes(e),D6;(function(e){e.IDLE=`idle`,e.EXECUTING=`executing`,e.AWAITING_APPROVAL=`awaiting_approval`,e.COMPLETED=`completed`})(D6||={});var cTe={[D6.IDLE]:si.NEUTRAL,[D6.EXECUTING]:si.INFO,[D6.AWAITING_APPROVAL]:si.WARNING,[D6.COMPLETED]:si.SUCCESS};function lTe(e){return U($f[cTe[e]],e===D6.EXECUTING&&`motion-safe:animate-pulse`)}function O6(e){return`status_${e}`}var uTe=({systemName:e,actors:t,systemRef:n,executions:r,className:i,children:a,...o})=>{let{tComponent:s,isReady:c}=K({component:S6}),l=kW(),u=t,d=r??l?.executions,f=n&&l?.isLoading&&!u,p=Q.useMemo(()=>{if(!u)return new Map;let e=new Map;for(let t of u)e.set(t.roleCategory,(e.get(t.roleCategory)??0)+1);return e},[u]);return c?f?(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card`,i),"aria-label":s(S6,`loading`),...o,children:[(0,$.jsx)(Tm,{className:`h-6 w-48`}),(0,$.jsxs)(`div`,{className:`grid gap-card sm:grid-cols-2 lg:grid-cols-3`,children:[(0,$.jsx)(Tm,{className:`h-40`}),(0,$.jsx)(Tm,{className:`h-40`}),(0,$.jsx)(Tm,{className:`h-40`})]})]}):u&&u.length===0?(0,$.jsx)(`div`,{className:U(`flex flex-col items-center gap-element py-section text-center text-muted-foreground`,i),...o,children:(0,$.jsx)(`p`,{className:`text-sm`,children:s(S6,`noActors`)})}):(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card`,i),...o,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap items-center justify-between gap-element`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[e&&(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:s(S6,`teamTitle`,{name:e})}),u&&(0,$.jsx)(Z,{as:`span`,size:lu.XS,variant:$u.MUTED,children:s(S6,`teamSummary`,{count:String(u.length)})})]})}),u&&u.length>0&&(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Array.from(p.entries()).map(([e,t])=>(0,$.jsx)(Hf,{variant:`outline`,className:`text-2xs`,children:s(S6,`roleCount`,{role:E6(e)?s(S6,C6(e)):e,count:String(t)})},e))}),(0,$.jsx)(`div`,{className:`grid gap-card sm:grid-cols-2 lg:grid-cols-3`,children:u?u.map(e=>(0,$.jsx)(k6,{actor:e,status:dTe(e,dn(u)?.ref,n,d)},e.ref)):a})]}):null};function dTe(e,t,n,r){if(!r||!n||e.ref!==t)return D6.IDLE;let i=!1;for(let e of r.values())if(e.systemRef===n){if(e.status===SW.RUNNING||e.status===SW.STARTING)return D6.EXECUTING;if(e.status===SW.AWAITING_APPROVAL)return D6.AWAITING_APPROVAL;e.status===SW.COMPLETED&&(i=!0)}return i?D6.COMPLETED:D6.IDLE}var k6=({actor:e,actorRef:t,displayName:n,roleCategory:r,executionMode:i,description:a,agentRef:o,flowRef:s,status:c=D6.IDLE,currentTask:l,onAgentClick:u,onFlowClick:d,className:f,...p})=>{let{tComponent:m,isReady:h}=K({component:S6}),{renderIcon:g}=Rf();if(!h)return null;let _=e?.ref??t??``,v=e?.displayName??n??_,y=e?.roleCategory??r??``,b=e?.executionMode??i??``,x=a,S=e?.agentRef??o,C=e?.flowRef??s,w=m(S6,O6(c));return(0,$.jsxs)(MF,{className:U(`flex flex-col`,f),...p,children:[(0,$.jsxs)(PF,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(A6,{role:y}),(0,$.jsx)(j6,{mode:b})]}),(0,$.jsxs)(mj,{children:[(0,$.jsx)(hj,{asChild:!0,children:(0,$.jsx)(`span`,{role:`img`,"aria-label":w,className:U(`inline-block size-2.5 shrink-0 rounded-full`,lTe(c))})}),(0,$.jsx)(gj,{side:Ea.TOP,className:`text-xs`,children:w})]})]}),(0,$.jsx)(IF,{className:`text-sm`,children:v}),(0,$.jsx)(RF,{className:`text-xs`,children:_})]}),(0,$.jsxs)(zF,{className:`flex flex-col gap-element`,children:[x&&(0,$.jsx)(Z,{size:lu.XS,variant:$u.MUTED,"aria-label":m(S6,`description`),children:x}),l&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1 rounded-sm bg-primary/10 px-2 py-1`,"aria-label":m(S6,`currentTask`),children:[g(H.LOADER_2,{size:fa.SM,className:`animate-spin text-primary`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-medium text-primary`,children:l})]}),(S||C)&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[S&&(0,$.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 text-start text-xs text-muted-foreground hover:text-foreground`,onClick:()=>u?.(S),"aria-label":`${m(S6,`linkedAgent`)}: ${S}`,children:[g(H.BRAIN,{size:fa.SM,className:`shrink-0`}),(0,$.jsxs)(`span`,{className:`font-medium`,children:[m(S6,`linkedAgent`),`:`]}),(0,$.jsx)(`span`,{className:`truncate`,children:S})]}),C&&(0,$.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 text-start text-xs text-muted-foreground hover:text-foreground`,onClick:()=>d?.(C),"aria-label":`${m(S6,`linkedFlow`)}: ${C}`,children:[g(H.ARROW_RIGHT,{size:fa.SM,className:`shrink-0`}),(0,$.jsxs)(`span`,{className:`font-medium`,children:[m(S6,`linkedFlow`),`:`]}),(0,$.jsx)(`span`,{className:`truncate`,children:C})]})]})]})]})},A6=({role:e,className:t})=>{let{tComponent:n,isReady:r}=K({component:S6}),{renderIcon:i}=Rf();if(!r)return null;let a=E6(e),o=a?iTe[e]:void 0,s=a?n(S6,C6(e)):e;return(0,$.jsxs)(Hf,{variant:a?oTe[e]:`secondary`,className:U(`text-2xs gap-1`,t),children:[o&&i(o,{size:fa.XS}),s]})},j6=({mode:e,className:t})=>{let{tComponent:n,isReady:r}=K({component:S6}),{renderIcon:i}=Rf();if(!r)return null;let a=sTe(e),o=a?aTe[e]:void 0,s=a?n(S6,w6(e)):e,c=a?n(S6,T6(e)):void 0,l=(0,$.jsxs)(Hf,{variant:`outline`,className:U(`text-2xs gap-1`,t),children:[o&&i(o,{size:fa.XS}),s]});return c?(0,$.jsxs)(mj,{children:[(0,$.jsx)(hj,{asChild:!0,children:l}),(0,$.jsx)(gj,{side:Ea.TOP,className:`text-xs`,children:c})]}):l},fTe=Q.lazy(()=>T_(()=>import(`./flows-actors-graph-runtime-gROuX0bc.js`).then(e=>({default:e.AI_FlowExecutionCanvas})),__vite__mapDeps([13,1,2,3,14,4,5,6,7,12,15,16,11,10,9,8,17,18]))),pTe=Q.lazy(()=>T_(()=>import(`./flows-actors-graph-runtime-gROuX0bc.js`).then(e=>({default:e.AI_FlowExecutionSummary})),__vite__mapDeps([13,1,2,3,14,4,5,6,7,12,15,16,11,10,9,8,17,18]))),mTe=Q.lazy(()=>T_(()=>import(`./flows-actors-graph-runtime-gROuX0bc.js`).then(e=>({default:e.AI_FlowExecutionTimeline})),__vite__mapDeps([13,1,2,3,14,4,5,6,7,12,15,16,11,10,9,8,17,18]))),hTe=Q.lazy(()=>T_(()=>import(`./flows-actors-graph-runtime-gROuX0bc.js`).then(e=>({default:e.AI_FlowExecutionTimelineItem})),__vite__mapDeps([13,1,2,3,14,4,5,6,7,12,15,16,11,10,9,8,17,18]))),gTe=Q.lazy(()=>T_(()=>import(`./flows-actors-graph-runtime-gROuX0bc.js`).then(e=>({default:e.AI_GraphViewer})),__vite__mapDeps([13,1,2,3,14,4,5,6,7,12,15,16,11,10,9,8,17,18]))),M6=e=>(0,$.jsx)(tY,{doorName:`AI_GraphViewer`,fallback:(0,$.jsx)(nY,{className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Tm,{"aria-hidden":`true`,className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(gTe,{...e})})}),_Te=e=>(0,$.jsx)(tY,{doorName:`AI_FlowExecutionCanvas`,fallback:(0,$.jsx)(nY,{className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Tm,{"aria-hidden":`true`,className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(fTe,{...e})})}),vTe=e=>(0,$.jsx)(tY,{doorName:`AI_FlowExecutionSummary`,fallback:(0,$.jsx)(nY,{className:`h-14 w-full rounded-lg`}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Tm,{"aria-hidden":`true`,className:`h-14 w-full rounded-lg`}),children:(0,$.jsx)(pTe,{...e})})}),N6=e=>(0,$.jsx)(tY,{doorName:`AI_FlowExecutionTimeline`,fallback:(0,$.jsx)(nY,{className:`h-40 w-full rounded-md`}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Tm,{"aria-hidden":`true`,className:`h-40 w-full rounded-md`}),children:(0,$.jsx)(mTe,{...e})})}),yTe=e=>(0,$.jsx)(tY,{doorName:`AI_FlowExecutionTimelineItem`,fallback:(0,$.jsx)(`li`,{"aria-hidden":`true`,className:`ms-4`,children:(0,$.jsx)(nY,{className:`h-8 w-full`})}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`li`,{"aria-hidden":`true`,className:`ms-4`,children:(0,$.jsx)(Tm,{className:`h-8 w-full`})}),children:(0,$.jsx)(hTe,{...e})})}),P6=J.LOW_LEVEL_AI_SYSTEM_CATALOG,bTe=[`all`,`draft`,`active`,`inactive`,`deprecated`,`archived`];function xTe(e,t){let n=t.toLowerCase();return e.displayName.toLowerCase().includes(n)||e.description.toLowerCase().includes(n)||(e.category?.toLowerCase().includes(n)??!1)||(e.tags?.some(e=>e.toLowerCase().includes(n))??!1)}var STe=({className:e,defaultKindFilter:t=`all`,defaultStatusFilter:n=`all`,defaultViewMode:r=`grid`,onSelectSystem:i,onLaunch:a,...o})=>{let{tComponent:s,isReady:c}=K({component:P6}),{systems:l,isLoading:u,error:d,refreshSystems:f}=OW(),[p,m]=Q.useState(``),[h,g]=Q.useState(t),[_,v]=Q.useState(n),[y,b]=Q.useState(r),[x,S]=Q.useState(null),C=Q.useMemo(()=>l.filter(e=>!(h!==`all`&&e.kind!==h||_!==`all`&&e.status!==_||p&&!xTe(e,p))),[l,h,_,p]),w=Q.useMemo(()=>x?l.find(e=>e.ref===x):void 0,[l,x]),T=Q.useCallback(e=>{S(e),i?.(e)},[i]),E=Q.useCallback(()=>{S(null)},[]);return w?(0,$.jsx)(L6,{system:w,onBack:E,onLaunch:a,className:e,...o}):c?d?(0,$.jsxs)(`div`,{className:U(`flex flex-col items-center justify-center gap-card rounded-lg border bg-card p-section text-center`,e),...o,children:[(0,$.jsx)(Z,{variant:$u.DESTRUCTIVE,children:s(P6,`errorState`)}),(0,$.jsx)(X,{type:`button`,variant:Y.SECONDARY,size:Xd.SM,onClick:()=>void f(),children:s(P6,`retry`)})]}):(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card`,e),...o,children:[(0,$.jsx)(CTe,{searchQuery:p,onSearchChange:m,kindFilter:h,onKindFilterChange:g,statusFilter:_,onStatusFilterChange:v,viewMode:y,onViewModeChange:b,systemCount:C.length,totalCount:l.length}),u?(0,$.jsx)(wTe,{viewMode:y}):C.length===0?(0,$.jsx)(`div`,{className:`flex flex-col items-center justify-center gap-element rounded-lg border bg-card p-section text-center`,children:(0,$.jsx)(Z,{variant:$u.MUTED,children:l.length===0?s(P6,`emptyState`):s(P6,`emptyFilteredState`)})}):y===`grid`?(0,$.jsx)(`div`,{className:`grid gap-card sm:grid-cols-2 lg:grid-cols-3`,children:C.map(e=>(0,$.jsx)(F6,{system:e,onLaunch:a,onClick:()=>T(e.ref)},e.ref))}):(0,$.jsx)(`div`,{className:`flex flex-col gap-element`,children:C.map(e=>(0,$.jsx)(I6,{system:e,onLaunch:a,onClick:()=>T(e.ref)},e.ref))})]}):null},CTe=({searchQuery:e,onSearchChange:t,kindFilter:n,onKindFilterChange:r,statusFilter:i,onStatusFilterChange:a,viewMode:o,onViewModeChange:s,systemCount:c,totalCount:l})=>{let{tComponent:u,isReady:d}=K({component:P6});return d?(0,$.jsxs)(`div`,{className:`flex flex-col gap-element sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex flex-1 flex-wrap items-center gap-element`,children:[(0,$.jsx)(iN,{type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:u(P6,`searchPlaceholder`),className:`min-w-[180px] max-w-xs flex-1`}),(0,$.jsx)(bO,{value:n,onValueChange:e=>r(e),children:(0,$.jsxs)(xO,{children:[(0,$.jsx)(SO,{value:`all`,children:u(P6,`allKinds`)}),(0,$.jsx)(SO,{value:`flow`,children:u(P6,`kindFlow`)}),(0,$.jsx)(SO,{value:`actor`,children:u(P6,`kindActor`)})]})}),(0,$.jsx)(bF,{name:`statusFilter`,schema:kd(),options:bTe.map(e=>({value:e,label:u(P6,`status_${e}`)})),value:i,onChange:e=>a(e),placeholder:u(P6,`filterByStatus`),size:rf.SM})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(Z,{as:`span`,size:lu.XS,variant:$u.MUTED,children:u(P6,`systemCount`,{count:c,total:l})}),(0,$.jsx)(bO,{value:o,onValueChange:e=>s(e),children:(0,$.jsxs)(xO,{children:[(0,$.jsx)(SO,{value:`grid`,children:u(P6,`gridView`)}),(0,$.jsx)(SO,{value:`list`,children:u(P6,`listView`)})]})})]})]}):null},wTe=({viewMode:e})=>e===`list`?(0,$.jsx)(`div`,{className:`flex flex-col gap-element`,children:Array.from({length:4},(e,t)=>(0,$.jsx)(Tm,{className:`h-20 w-full rounded-lg`},t))}):(0,$.jsx)(`div`,{className:`grid gap-card sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6},(e,t)=>(0,$.jsx)(Tm,{className:`h-52 w-full rounded-lg`},t))}),F6=({system:e,onLaunch:t,className:n,...r})=>{let{tComponent:i,isReady:a}=K({component:P6}),o=e.status===`active`,s=e.frontendRelevantConfig;return a?(0,$.jsxs)(MF,{role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.currentTarget.click())},className:U(`flex cursor-pointer flex-col transition-shadow hover:shadow-[var(--shadow-md)]`,Jg(x_.OFFSET),!o&&`opacity-[var(--opacity-muted)]`,n),...r,children:[(0,$.jsxs)(PF,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(z6,{kind:e.kind}),(0,$.jsx)(B6,{status:e.status}),s.riskLevel!==`low`&&(0,$.jsx)(V6,{level:s.riskLevel})]}),(0,$.jsx)(IF,{className:`text-sm`,children:e.displayName}),(0,$.jsx)(RF,{className:`line-clamp-2 text-xs`,children:e.description})]}),(0,$.jsxs)(zF,{className:`flex flex-col gap-element`,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-element`,children:(0,$.jsx)(Hf,{variant:`outline`,className:`text-2xs`,children:i(P6,`scope_${s.primaryScope}`)})}),(e.category||e.tags&&e.tags.length>0)&&(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-element`,children:[e.category&&(0,$.jsx)(Hf,{variant:`outline`,className:`text-2xs`,children:e.category}),e.tags?.map(e=>(0,$.jsx)(Hf,{variant:`secondary`,className:`text-2xs`,children:e},e))]})]}),t&&(0,$.jsx)(FF,{className:`mt-auto`,children:(0,$.jsx)(X,{type:`button`,variant:o?Y.DEFAULT:Y.SECONDARY,disabled:!o,onClick:n=>{n.stopPropagation(),t(e.ref)},className:`w-full`,children:i(P6,`launch`)})})]}):null},I6=({system:e,onLaunch:t,className:n,...r})=>{let{tComponent:i,isReady:a}=K({component:P6}),o=e.status===`active`,s=e.frontendRelevantConfig;return a?(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.currentTarget.click())},className:U(`flex cursor-pointer items-center gap-card rounded-lg border bg-card p-card-sm transition-shadow hover:shadow-[var(--shadow-md)]`,Jg(x_.OFFSET),!o&&`opacity-[var(--opacity-muted)]`,n),...r,children:[(0,$.jsxs)(`div`,{className:`flex flex-1 items-center gap-card overflow-hidden`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-element`,children:[(0,$.jsx)(z6,{kind:e.kind}),(0,$.jsx)(B6,{status:e.status})]}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.displayName}),(0,$.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.description})]}),(0,$.jsx)(`div`,{className:`hidden shrink-0 items-center gap-element md:flex`,children:s.riskLevel!==`low`&&(0,$.jsx)(V6,{level:s.riskLevel})})]}),t&&(0,$.jsx)(X,{type:`button`,variant:o?Y.DEFAULT:Y.SECONDARY,disabled:!o,size:Xd.SM,onClick:n=>{n.stopPropagation(),t(e.ref)},children:i(P6,`launch`)})]}):null},L6=({system:e,onBack:t,onLaunch:n,className:r,...i})=>{let{tComponent:a,isReady:o}=K({component:P6}),s=kW(),c=e.frontendRelevantConfig,l=e.status===`active`,u=Q.useMemo(()=>{if(!s?.executions)return[];let t=[];return s.executions.forEach(n=>{n.systemRef===e.ref&&t.push(n)}),t},[s?.executions,e.ref]);return o?(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card`,r),...i,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-element`,children:[t&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.SM,onClick:t,className:`self-start`,children:a(P6,`backToCatalog`)}),(0,$.jsx)(`h2`,{className:`text-lg font-semibold`,children:e.displayName}),(0,$.jsx)(Z,{variant:$u.MUTED,children:e.description}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(z6,{kind:e.kind}),(0,$.jsx)(B6,{status:e.status}),c.riskLevel!==`low`&&(0,$.jsx)(V6,{level:c.riskLevel})]})]}),n&&(0,$.jsx)(X,{type:`button`,variant:l?Y.DEFAULT:Y.SECONDARY,disabled:!l,onClick:()=>n(e.ref),children:a(P6,`launch`)})]}),(0,$.jsxs)(bO,{defaultValue:`config`,children:[(0,$.jsxs)(xO,{children:[(0,$.jsx)(SO,{value:`config`,children:a(P6,`detailConfig`)}),e.kind===`flow`&&(0,$.jsx)(SO,{value:`preview`,children:a(P6,`flowPreview`)}),e.kind===`actor`&&(0,$.jsx)(SO,{value:`preview`,children:a(P6,`actorTeamPreview`)}),(0,$.jsx)(SO,{value:`executions`,children:a(P6,`executionHistory`)})]}),(0,$.jsx)(CO,{value:`config`,children:(0,$.jsxs)(`div`,{className:`grid gap-card sm:grid-cols-2`,children:[(0,$.jsxs)(MF,{children:[(0,$.jsx)(PF,{children:(0,$.jsx)(IF,{className:`text-sm`,children:a(P6,`detailConfig`)})}),(0,$.jsxs)(zF,{className:`flex flex-col gap-element text-sm`,children:[(0,$.jsx)(R6,{label:a(P6,`scope`),value:a(P6,`scope_${c.primaryScope}`)}),(0,$.jsx)(R6,{label:a(P6,`riskLevel`),value:(0,$.jsx)(V6,{level:c.riskLevel})})]})]}),(0,$.jsxs)(MF,{children:[(0,$.jsx)(PF,{children:(0,$.jsx)(IF,{className:`text-sm`,children:a(P6,`detailMetadata`)})}),(0,$.jsxs)(zF,{className:`flex flex-col gap-element text-sm`,children:[(0,$.jsx)(R6,{label:a(P6,`detailRef`),value:e.ref}),(0,$.jsx)(R6,{label:a(P6,`detailKind`),value:e.kind}),(0,$.jsx)(R6,{label:a(P6,`detailStatus`),value:e.status}),e.category&&(0,$.jsx)(R6,{label:a(P6,`detailCategory`),value:e.category}),e.tags&&e.tags.length>0&&(0,$.jsx)(R6,{label:a(P6,`detailTags`),value:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-element`,children:e.tags.map(e=>(0,$.jsx)(Hf,{variant:`secondary`,className:`text-2xs`,children:e},e))})}),e.metadata&&Object.keys(e.metadata).length>0&&(0,$.jsx)($.Fragment,{children:Object.entries(e.metadata).map(([e,t])=>(0,$.jsx)(R6,{label:e,value:t},e))})]})]})]})}),(0,$.jsx)(CO,{value:`preview`,children:(0,$.jsx)(MF,{children:(0,$.jsx)(zF,{className:`p-card`,children:(0,$.jsx)(Z,{variant:$u.MUTED,children:e.kind===`flow`?a(P6,`flowPreviewPlaceholder`):a(P6,`actorTeamPreviewPlaceholder`)})})})}),(0,$.jsx)(CO,{value:`executions`,children:u.length===0?(0,$.jsx)(`div`,{className:`flex items-center justify-center rounded-lg border bg-card p-section`,children:(0,$.jsx)(Z,{variant:$u.MUTED,children:a(P6,`noExecutions`)})}):(0,$.jsx)(hf,{className:`max-h-96`,children:(0,$.jsx)(`div`,{className:`flex flex-col gap-element`,children:u.map(e=>(0,$.jsx)(ETe,{execution:e},e.executionId))})})})]})]}):null},R6=({label:e,value:t})=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-card`,children:[(0,$.jsx)(Z,{as:`span`,size:lu.XS,variant:$u.MUTED,className:`font-medium`,children:e}),(0,$.jsx)(Z,{as:`span`,size:lu.XS,className:`text-end`,children:t})]}),TTe={[SW.IDLE]:`outline`,[SW.STARTING]:`secondary`,[SW.RUNNING]:`default`,[SW.AWAITING_APPROVAL]:`secondary`,[SW.COMPLETED]:`default`,[SW.CANCELLED]:`outline`,[SW.ERROR]:`destructive`},ETe=({execution:e})=>{let{tComponent:t,isReady:n}=K({component:P6});return n?(0,$.jsxs)(`div`,{className:`flex items-center gap-card rounded-lg border bg-card p-card-sm`,children:[(0,$.jsx)(Hf,{variant:TTe[e.status]??`secondary`,className:`text-2xs`,children:t(P6,`execStatus_${e.status}`)}),(0,$.jsx)(Z,{as:`span`,size:lu.XS,variant:$u.MUTED,className:`flex-1 truncate`,children:e.executionId})]}):null},z6=({kind:e,className:t})=>{let{tComponent:n,isReady:r}=K({component:P6});return r?(0,$.jsx)(Hf,{variant:e===`flow`?`default`:`secondary`,className:U(`text-2xs`,t),children:e===`flow`?n(P6,`kindFlow`):n(P6,`kindActor`)}):null},DTe={draft:{variant:`outline`,extraClass:`text-muted-foreground`},active:{variant:`default`},inactive:{variant:`secondary`,extraClass:`text-warning-subtle-foreground`},deprecated:{variant:`destructive`,extraClass:`opacity-[0.75]`},archived:{variant:`outline`,extraClass:`text-muted-foreground opacity-[var(--opacity-muted)]`}},B6=({status:e,className:t})=>{let{tComponent:n,isReady:r}=K({component:P6}),i=DTe[e]??{variant:`secondary`};return r?(0,$.jsx)(Hf,{variant:i.variant,className:U(`text-2xs`,i.extraClass,t),children:n(P6,`status_${e}`)}):null},OTe={low:{variant:`outline`},medium:{variant:`secondary`,extraClass:`text-warning-subtle-foreground`},high:{variant:`destructive`},critical:{variant:`destructive`,extraClass:`animate-pulse`}},V6=({level:e,className:t})=>{let{tComponent:n,isReady:r}=K({component:P6}),i=OTe[e]??{variant:`outline`};return r?(0,$.jsx)(Hf,{variant:i.variant,className:U(`text-2xs`,i.extraClass,t),children:n(P6,`riskLevel_${e}`)}):null},H6=J.LOW_LEVEL_AI_EXECUTION_PLAN,kTe=[yn.COMPLETED,yn.PROCESSING,yn.AWAITING_APPROVAL,yn.FAILED],U6=({plan:e,className:t,...n})=>{let{tComponent:r,isReady:i}=K({component:H6}),a=Q.useMemo(()=>new Map(e.stepStates.map(e=>[e.planStepId,e])),[e.stepStates]),o=Q.useMemo(()=>{let t={};for(let n of e.planSteps){let e=a.get(n._id)?.status??n.status;t[e]=(t[e]??0)+1}return t},[e.planSteps,a]),s=Q.useCallback(t=>e.planSteps.find(e=>e._id===t)?.name??t,[e.planSteps]);return i?(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card rounded-lg border bg-card p-card`,t),...n,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(H6,`title`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.goalDescription})]}),(0,$.jsx)(Tf,{status:e.status})]}),(0,$.jsx)(G6,{total:e.planSteps.length,statusCounts:o}),(0,$.jsx)(hf,{className:`max-h-80`,children:(0,$.jsx)(`ol`,{className:`flex flex-col gap-2`,children:e.planSteps.map((e,t)=>{let n=a.get(e._id);return(0,$.jsx)(W6,{step:e,index:t,resolvedStatus:n?.status??e.status,statusChanges:n?.statusChanges,nameOfStep:s},e._id)})})})]}):null},W6=({step:e,index:t,resolvedStatus:n,statusChanges:r,nameOfStep:i,className:a,...o})=>{let{tComponent:s,isReady:c,formatTime:l,formatList:u}=K({component:H6}),{statusWord:d,isReady:f}=sp(),{word:p,isReady:m}=xf(ep),{renderIcon:h}=Rf(),g=Q.useMemo(()=>hee(e),[e]),[_,v]=Q.useState(!1),y=g.length>0||r&&r.length>0;return!c||!f||!m?null:(0,$.jsxs)(`li`,{className:U(`flex items-start gap-element`,a),...o,children:[(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-0.5 pt-0.5`,children:[(0,$.jsx)(`span`,{className:`text-2xs font-mono text-muted-foreground`,children:t+1}),(0,$.jsx)(`div`,{className:U(`size-2.5 shrink-0 rounded-full`,_f(n))})]}),(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col gap-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium`,children:e.name??e._id}),(0,$.jsx)(Hf,{variant:`outline`,className:`text-2xs`,children:p(e.topic)}),(0,$.jsx)(Tf,{status:n})]}),e.description&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description}),y&&(0,$.jsxs)(FO,{open:_,onOpenChange:v,children:[(0,$.jsx)(IO,{asChild:!0,children:(0,$.jsxs)(X,{type:`button`,variant:Y.LINK,size:Xd.SM,className:`h-auto p-0 text-2xs`,children:[h(_?H.CHEVRON_DOWN:H.CHEVRON_RIGHT,{size:fa.XS}),s(H6,`stepDetails`)]})}),(0,$.jsxs)(LO,{className:`mt-1 flex flex-col gap-1`,children:[g.length>0&&(0,$.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:s(H6,`stepWaitsOn`,{steps:u(g.map(e=>i?.(e)??e))})}),r&&r.length>0&&(0,$.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:r.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-element text-2xs`,children:[(0,$.jsx)(`div`,{className:U(`size-1.5 rounded-full`,_f(e.status))}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:d(e.status)}),(0,$.jsx)(`time`,{className:`text-muted-foreground`,dateTime:e.timestamp,children:Zd.formatTimestamp(e.timestamp,l)})]},`${e.status}-${e.timestamp}-${t}`))}),(0,$.jsx)(`div`,{className:`flex gap-card text-2xs text-muted-foreground`,children:(0,$.jsx)(`span`,{children:s(H6,`stepCreatedAt`,{time:Zd.formatTimestamp(e.createdAt,l)})})})]})]})]})]})},G6=({total:e,statusCounts:t,className:n,...r})=>{let{tComponent:i,isReady:a}=K({component:H6}),{statusWord:o,isReady:s}=sp(),c=t[yn.COMPLETED]??0,l=e>0?Math.round(c/e*100):0,u=kTe.flatMap(n=>{let r=t[n]??0;return r>0&&e>0?[{status:n,width:r/e*100}]:[]}),d=Object.values(yn).flatMap(e=>{let n=t[e]??0;return e!==yn.COMPLETED&&n>0?[{status:e,count:n}]:[]});return!a||!s?null:(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-1`,n),...r,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:i(H6,`progress`,{completed:c,total:e})}),(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[l,`%`]})]}),(0,$.jsx)(`div`,{className:`flex h-1.5 w-full overflow-hidden rounded-full bg-secondary`,children:u.map(({status:e,width:t})=>(0,$.jsx)(`div`,{"data-plan-progress-segment":e,className:U(`h-full motion-safe:transition-all`,_f(e)),style:{width:`${t}%`}},e))}),d.length>0&&(0,$.jsx)(`div`,{className:`flex flex-wrap gap-card text-2xs text-muted-foreground`,children:d.map(({status:e,count:t})=>(0,$.jsxs)(`span`,{"data-plan-progress-legend":e,className:`flex items-center gap-0.5`,children:[(0,$.jsx)(`span`,{className:U(`inline-block size-1.5 rounded-full`,_f(e))}),i(H6,`progressLegendEntry`,{status:o(e),count:t})]},e))})]})},K6=J.LOW_LEVEL_AI_TASK_DETAIL;function q6(e){switch(e.kind){case xr.TASK:return e.taskId;case xr.PLAN_STEP:return e.planStepId;case xr.PLAN:return e.planId;case xr.ACTOR:return e.actorId;case xr.ACTOR_SYSTEM:return e.actorSystemId;case xr.FLOW:return e.flowId;case xr.FLOW_STEP:return e.stepId}}var J6=({task:e,nameOf:t,className:n,...r})=>{let{tComponent:i,isReady:a,formatDateTime:o}=K({component:K6}),{word:s,isReady:c}=xf(ep),{word:l,isReady:u}=xf(Gf),d=Object.keys(e.context).length>0,f=e.relationships.length>0,p=e.artifacts&&e.artifacts.length>0;return!a||!c||!u?null:(0,$.jsxs)(MF,{statusEdge:Mf(e.status),className:U(`flex flex-col`,n),...r,children:[(0,$.jsxs)(PF,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(Hf,{variant:`outline`,className:`text-2xs`,children:s(e.topic)}),(0,$.jsx)(Tf,{status:e.status}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-2xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:i(K6,`actor`)}),(0,$.jsx)(`span`,{className:`font-mono`,children:e.actors.actorRef})]})]}),(0,$.jsx)(IF,{className:`text-sm`,children:e.title}),(0,$.jsx)(RF,{className:`text-xs`,children:e.description})]}),(0,$.jsxs)(zF,{className:`flex flex-col gap-card-sm`,children:[e.input!==void 0&&(0,$.jsx)(Y6,{label:i(K6,`input`),children:(0,$.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-md bg-muted p-2 text-2xs`,children:typeof e.input==`string`?e.input:JSON.stringify(e.input,null,2)})}),e.output!==void 0&&(0,$.jsx)(Y6,{label:i(K6,`output`),children:(0,$.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-md bg-muted p-2 text-2xs`,children:typeof e.output==`string`?e.output:JSON.stringify(e.output,null,2)})}),(0,$.jsx)(Y6,{label:i(K6,`context`),children:d?(0,$.jsx)(`pre`,{className:`max-h-24 overflow-auto rounded-md bg-muted p-2 text-2xs`,children:JSON.stringify(e.context,null,2)}):(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground italic`,children:i(K6,`contextEmpty`)})}),f&&(0,$.jsx)(Y6,{label:i(K6,`relationships`),children:(0,$.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.relationships.map((e,n)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-element text-2xs`,"data-task-relationship":e.relation,children:[(0,$.jsx)(`span`,{className:`shrink-0`,children:l(e.relation)}),(0,$.jsx)(`span`,{className:`text-muted-foreground truncate`,children:t?.(e)??q6(e)})]},n))})}),p&&(0,$.jsx)(Y6,{label:i(K6,`artifacts`),children:(0,$.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.artifacts.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-element text-2xs`,children:[(0,$.jsx)(Hf,{variant:`outline`,className:`text-2xs`,children:e.type}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e.name})]},t))})}),e.actorStates.length>0&&(0,$.jsx)(Z6,{events:e.actorStates.flatMap(e=>e.statusChanges.map(t=>({status:t.status,timestamp:t.timestamp,actorRef:e.actorRef})))}),(e.startedAt||e.completedAt)&&(0,$.jsxs)(`div`,{className:`flex gap-card text-2xs text-muted-foreground`,children:[e.startedAt&&(0,$.jsxs)(`span`,{className:`flex gap-1`,children:[(0,$.jsx)(`span`,{children:i(K6,`started`)}),(0,$.jsx)(`span`,{children:Zd.formatTimestamp(e.startedAt,o)})]}),e.completedAt&&(0,$.jsxs)(`span`,{className:`flex gap-1`,children:[(0,$.jsx)(`span`,{children:i(K6,`completed`)}),(0,$.jsx)(`span`,{children:Zd.formatTimestamp(e.completedAt,o)})]}),e.startedAt&&(0,$.jsx)(`span`,{className:`font-mono`,children:Zd.formatDuration(e.startedAt,e.completedAt)})]})]})]})};function Y6({label:e,children:t,defaultOpen:n=!1}){return(0,$.jsxs)(FO,{defaultOpen:n,children:[(0,$.jsx)(IO,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,size:Xd.SM,className:`h-auto justify-start p-0 text-xs font-medium`,children:e})}),(0,$.jsx)(LO,{className:`mt-1`,children:t})]})}var X6=({tasks:e,nameOf:t,className:n,...r})=>{let{tComponent:i,isReady:a}=K({component:K6}),{statusWord:o,isReady:s}=sp(),{word:c,isReady:l}=xf(ep),[u,d]=Q.useState(null),[f,p]=Q.useState(null),[m,h]=Q.useState(`createdAt`),g=Q.useMemo(()=>[...new Set(e.map(e=>e.status))],[e]),_=Q.useMemo(()=>[...new Set(e.map(e=>e.topic))],[e]),v=Q.useMemo(()=>{let t=e;return u&&(t=t.filter(e=>e.status===u)),f&&(t=t.filter(e=>e.topic===f)),[...t].sort((e,t)=>m===`createdAt`?new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime():e.status.localeCompare(t.status))},[e,u,f,m]);return!a||!s||!l?null:(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card`,n),...r,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:i(K6,`filterByStatus`)}),(0,$.jsx)(X,{type:`button`,variant:u===null?Y.SECONDARY:Y.GHOST,size:Xd.SM,className:`h-6 text-2xs`,onClick:()=>d(null),children:i(K6,`filterAll`)}),g.map(e=>(0,$.jsx)(X,{type:`button`,variant:u===e?Y.SECONDARY:Y.GHOST,size:Xd.SM,className:`h-6 text-2xs`,onClick:()=>d(e===u?null:e),children:o(e)},e))]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:i(K6,`filterByTopic`)}),(0,$.jsx)(X,{type:`button`,variant:f===null?Y.SECONDARY:Y.GHOST,size:Xd.SM,className:`h-6 text-2xs`,onClick:()=>p(null),children:i(K6,`filterAll`)}),_.map(e=>(0,$.jsx)(X,{type:`button`,variant:f===e?Y.SECONDARY:Y.GHOST,size:Xd.SM,className:`h-6 text-2xs`,onClick:()=>p(e===f?null:e),children:c(e)},e))]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:i(K6,`sortBy`)}),(0,$.jsx)(X,{type:`button`,variant:m===`createdAt`?Y.SECONDARY:Y.GHOST,size:Xd.SM,className:`h-6 text-2xs`,onClick:()=>h(`createdAt`),children:i(K6,`sortDate`)}),(0,$.jsx)(X,{type:`button`,variant:m===`status`?Y.SECONDARY:Y.GHOST,size:Xd.SM,className:`h-6 text-2xs`,onClick:()=>h(`status`),children:i(K6,`sortStatus`)})]})]}),(0,$.jsx)(hf,{className:`max-h-[32rem]`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-card`,children:[v.length===0&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground italic`,children:i(K6,`noTasks`)}),v.map(e=>(0,$.jsx)(J6,{task:e,...t?{nameOf:t}:{}},e._id))]})})]})},Z6=({events:e,className:t,...n})=>{let{tComponent:r,isReady:i,formatTime:a}=K({component:K6}),o=Q.useMemo(()=>[...e].sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime()),[e]);return i?(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-1`,t),...n,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium`,children:r(K6,`timeline`)}),(0,$.jsx)(hf,{className:`max-h-40`,children:(0,$.jsx)(`ol`,{className:`relative border-s border-border ms-3 space-y-1.5`,children:o.map((e,t)=>{let n=t>0?Zd.formatDuration(o[t-1].timestamp,e.timestamp):void 0;return(0,$.jsxs)(`li`,{className:`ms-4`,children:[(0,$.jsx)(`div`,{className:U(`absolute -start-1.5 mt-1.5 size-3 rounded-full`,_f(e.status))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(Tf,{status:e.status}),e.actorRef&&(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:e.actorRef}),n&&(0,$.jsxs)(`span`,{className:`text-2xs text-muted-foreground`,children:[`+`,n]})]}),(0,$.jsx)(`time`,{className:`text-2xs text-muted-foreground`,dateTime:e.timestamp,children:Zd.formatTimestamp(e.timestamp,a)})]},`${e.status}-${e.timestamp}-${t}`)})})})]}):null},Q6=J.LOW_LEVEL_AI_TASK_MEMORY,ATe={short_term:`⚡`,long_term:`📦`,working:`🔧`},jTe=({memory:e,className:t,...n})=>{let{tComponent:r,isReady:i}=K({component:Q6}),a=e.shortTerm.entries.length+e.longTerm.entries.length+e.working.entries.length;return i?(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-card`,t),...n,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold`,children:r(Q6,`title`)}),(0,$.jsx)(Hf,{variant:`secondary`,className:`text-2xs`,children:a})]}),(0,$.jsx)($6,{scope:`short_term`,label:r(Q6,`shortTerm`),store:e.shortTerm,defaultOpen:!0}),(0,$.jsx)($6,{scope:`long_term`,label:r(Q6,`longTerm`),store:e.longTerm}),(0,$.jsx)($6,{scope:`working`,label:r(Q6,`working`),store:e.working})]}):null},$6=({scope:e,label:t,store:n,defaultOpen:r=!1,className:i,...a})=>{let{tComponent:o,isReady:s}=K({component:Q6}),c=ATe[e]??`📋`;return s?(0,$.jsxs)(FO,{defaultOpen:r,className:U(`rounded-md border`,i),...a,children:[(0,$.jsx)(IO,{asChild:!0,children:(0,$.jsxs)(X,{type:`button`,variant:Y.GHOST,className:`w-full justify-between p-card-sm`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-element text-xs font-medium`,children:[(0,$.jsx)(`span`,{children:c}),t,n.maxSize!=null&&(0,$.jsxs)(`span`,{className:`text-2xs text-muted-foreground`,children:[`(`,n.entries.length,`/`,n.maxSize,`)`]})]}),(0,$.jsx)(Hf,{variant:`secondary`,className:`text-2xs`,children:n.entries.length})]})}),(0,$.jsx)(LO,{children:(0,$.jsx)(hf,{className:`max-h-48`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 p-card-sm pt-0`,children:[n.entries.map(e=>(0,$.jsx)(e8,{entry:e},e.key)),n.entries.length===0&&(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground italic`,children:o(Q6,`scopeEmpty`)})]})})})]}):null},e8=({entry:e,className:t,...n})=>{let{tComponent:r,isReady:i,formatDateTime:a}=K({component:Q6}),o=e.expiresAt?new Date(e.expiresAt).getTime()<Date.now():!1;return i?(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-0.5 rounded-sm bg-muted p-1.5`,o&&`opacity-[var(--opacity-muted)]`,t),...n,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(`span`,{className:`text-2xs font-medium`,children:e.key}),(0,$.jsx)(Hf,{variant:`outline`,className:`text-2xs`,children:e.type}),o&&(0,$.jsx)(Hf,{variant:`destructive`,className:`text-2xs`,children:r(Q6,`expired`)}),e.expiresAt&&!o&&(0,$.jsxs)(`span`,{className:`text-2xs text-muted-foreground`,children:[r(Q6,`expires`),`: `,(0,$.jsx)(`time`,{dateTime:e.expiresAt,children:Zd.formatTimestamp(e.expiresAt,a)})]})]}),(0,$.jsx)(`pre`,{className:`max-h-16 overflow-auto text-2xs text-muted-foreground`,children:typeof e.value==`string`?e.value:JSON.stringify(e.value,null,2)}),e.metadata&&Object.keys(e.metadata).length>0&&(0,$.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap gap-1`,children:[(0,$.jsxs)(`span`,{className:`text-2xs text-muted-foreground`,children:[r(Q6,`metadata`),`:`]}),Object.entries(e.metadata).map(([e,t])=>(0,$.jsxs)(Hf,{variant:`outline`,className:`text-2xs`,children:[e,`: `,String(t)]},e))]}),(0,$.jsx)(`time`,{className:`text-2xs text-muted-foreground/60`,dateTime:e.timestamp,children:Zd.formatTimestamp(e.timestamp,a)})]}):null},t8=new WeakMap;function MTe(e){let{doOperation:t,operationPathKey:n,contextualParameters:r,executionId:i}=e,a=t8.get(t);a||(a=new Map,t8.set(t,a));let o=JSON.stringify([n,Object.entries(r).sort(([e],[t])=>e.localeCompare(t))]),s=a.get(o);if(!s){s={operationPathKey:n,contextualParameters:r,waiters:new Map},a.set(o,s);let e=a,i=s;setTimeout(()=>{e.delete(o),NTe(t,i)},0)}return new Promise((e,t)=>{let n=s.waiters.get(i)??[];n.push({resolve:e,reject:t}),s.waiters.set(i,n)})}async function NTe(e,t){let n=[...t.waiters.keys()];for(let r=0;r<n.length;r+=100){let i=n.slice(r,r+100);try{let n=await e(t.operationPathKey,{contextualParameters:t.contextualParameters,requestData:{executionIds:i}}),r=new Map((n?.items??[]).map(e=>[e.executionId,e.usage]));for(let e of i)for(let n of t.waiters.get(e)??[])n.resolve(r.get(e))}catch(e){for(let n of i)for(let r of t.waiters.get(n)??[])r.reject(e)}}}var PTe=Object.freeze({});function n8(e,t){return V.buildConfigurationError(ii.CONFIGURATION,{message:e,component:`useEmbeddedResourceContext`,...t})}function r8(e){return typeof e.operationIdentifier==`string`}function FTe(e,t,n,r,i){let a=(e?.operations??[]).filter(e=>!(String(e.operationIdentifier)!==n.operationIdentifier||n.variantType!==void 0&&e.variantType!==n.variantType||n.variantKey!==void 0&&e.variantKey!==n.variantKey||n.isOperationDefault!==void 0&&e.isOperationDefault!==n.isOperationDefault||n.isBulkOperation!==void 0&&e.isBulkOperation!==n.isBulkOperation)),o=a.filter(e=>e.isOperationDefault===!0&&e.isBulkOperation!==!0),s=a.length===1?a[0]:n.variantType===void 0&&n.variantKey===void 0&&n.isOperationDefault===void 0&&n.isBulkOperation===void 0&&o.length===1?o[0]:void 0;if(!s)throw n8(a.length===0?`Composite resource runtime cannot resolve operation "${n.operationIdentifier}" on resource "${t}".`:`Composite resource runtime found ambiguous operation "${n.operationIdentifier}" on resource "${t}".`,{resourceType:t,operationIdentifier:n.operationIdentifier,variantType:n.variantType,variantKey:n.variantKey,isOperationDefault:n.isOperationDefault,isBulkOperation:n.isBulkOperation,candidates:a.map(e=>({variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation}))});let c=e?mh({operation:s,resourceType:t,resourceConfig:e}):!1;if(e&&c&&s.isBulkOperation!==!0&&!ih({resourceConfig:e,operation:s,registry:r,hasResourceId:gn.getResourceId(i[t]).length>0,contextResourceIdentifiers:i,contextualParameters:V.buildContextualParameters(i,r)}))throw n8(`Composite resource runtime resolved operation "${n.operationIdentifier}" on resource "${t}", but it is not addressable in the current context.`,{resourceType:t,operationIdentifier:n.operationIdentifier});return s}function i8(e){return e.hostResourceType!==void 0&&e.target.resourceType===e.hostResourceType&&!e.target.resourceId&&!lo(e.operation)&&gn.selfReferenceForeignKeysOf(e.hostResourceType,e.registry).length>0}function a8(){let e=UU(),{registry:t}=wm(),n=e?.hostResourceType,r=e?.contextResourceIdentifiers??PTe,i=(0,Q.useMemo)(()=>{if(!n)return;let e=t.resourceConfigurations[n];if(!e)throw n8(`Composite resource runtime cannot resolve host resource "${n}" from the registry.`,{hostResourceType:n});return e},[n,t.resourceConfigurations]),a=(0,Q.useMemo)(()=>n?gn.buildParentResourcesRequirements(n,r,t):[],[r,n,t]),o=(0,Q.useMemo)(()=>{if(i)return Th({resourceConfig:i,operations:i.operations??[],coreOperation:W.READ,registry:t,hasResourceId:n?gn.getResourceId(r[n]).length>0:!1,requireFrontendAddressable:!0,contextResourceIdentifiers:r,contextualParameters:V.buildContextualParameters(r,t)})??i.operations?.[0]},[r,i,n,t]),s=(0,Q.useCallback)(e=>{let a=e.resourceType??n;if(!a)throw n8(`Composite resource runtime is only available inside resource-scoped composite views.`,{target:e});let o=a===n?i:t.resourceConfigurations[a];if(r8(e))return FTe(o,a,e,t,r);let s=e.operationLike===W.READ||e.operationLike===W.UPDATE||e.operationLike===W.DELETE,c=e.requireAddressable||s?o?Th({resourceConfig:o,operations:o.operations??[],coreOperation:e.operationLike,registry:t,hasResourceId:gn.getResourceId(r[a]).length>0,allowBulk:e.allowBulk,requireFrontendAddressable:!0,contextResourceIdentifiers:r,contextualParameters:V.buildContextualParameters(r,t)}):void 0:Il(o?.operations??[],e.operationLike,{requireAddressable:e.requireAddressable,allowBulk:e.allowBulk});if(!c)throw n8(`Composite resource runtime cannot resolve a preferred ${e.operationLike}-like operation on resource "${a}".`,{resourceType:a,operationLike:e.operationLike,requireAddressable:e.requireAddressable,allowBulk:e.allowBulk});return c},[r,i,n,t]),c=(0,Q.useCallback)((e,c)=>{if(!n)throw n8(`Composite resource runtime is only available inside resource-scoped composite views.`,{target:e});let l=e.resourceType??n,u=s({resourceType:l,...r8(e)?{operationIdentifier:e.operationIdentifier,variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation}:{operationLike:e.operationLike,requireAddressable:e.requireAddressable,allowBulk:e.allowBulk}}),d=i8({target:e,hostResourceType:n,operation:u,registry:t});if(l===n&&!d){let i=gn.getResourceId(r[n]),a=e.resourceId?{...Zm({hostIdentifiers:r,hostContextualParameters:{},hostRecord:{resourceType:n,id:i},targetResourceType:n,targetId:e.resourceId,registry:t}).identifiers,[n]:e.resourceId}:r,o=gn.buildParentResourcesRequirements(n,a,t,e.relationshipFieldOverrides),s=gn.createFrontendResourceOperationContextFromOperation({resourceType:n,operation:u,contextResourceIdentifiers:a,additionalContext:e.additionalContext,parentResourcesRequirements:o});return c&&e.pinnedFilters&&Object.keys(e.pinnedFilters).length>0?ZG({childContext:s,hostResourceType:n,hostResourceId:void 0,hostRelationships:void 0,selectedForeignKey:void 0,callerPinnedFilters:e.pinnedFilters,registry:t}):s}if(!o)throw n8(`Composite resource runtime cannot derive related resource operations from host "${n}" because no host operation is configured.`,{hostResourceType:n,targetResourceType:l});let f=gn.createFrontendResourceOperationContextFromOperation({resourceType:n,operation:o,contextResourceIdentifiers:r,parentResourcesRequirements:a}),p=gn.deriveChildResourceContext(f,{resourceType:l,operationIdentifier:String(u.operationIdentifier),operation:u,resourceId:e.resourceId,relationshipFieldOverrides:e.relationshipFieldOverrides,additionalContext:e.additionalContext},t);return c?ZG({childContext:p,hostResourceType:n,hostResourceId:gn.getResourceId(r[n])||void 0,hostRelationships:i?.resourceRelationships,selectedForeignKey:e.relationshipFieldOverrides?.[n],callerPinnedFilters:e.pinnedFilters,registry:t}):p},[r,o,i,n,a,t,s]),l=(0,Q.useCallback)(e=>c(e,!0),[c]),u=(0,Q.useCallback)(e=>V.flattenContextIdentifiers(c(e,!1).contextResourceIdentifiers),[c]),d=(0,Q.useCallback)(e=>{try{return l(e),!0}catch{return!1}},[l]);return(0,Q.useMemo)(()=>!n||!i?null:{hostResourceType:n,hostResourceId:gn.getResourceId(r[n]),hostResourceConfig:i,contextResourceIdentifiers:r,parentResourcesRequirements:a,resolveOperation:s,buildOperationContext:l,deriveRelatedScopeIdentifiers:u,canBuildOperationContext:d},[l,u,d,r,i,n,a,s])}function o8(){let e=a8();if(!e)throw n8(`useEmbeddedResourceContext() must be used within a resource-scoped CompositeView.`);return e}var s8=J.LOW_LEVEL_AI_EXECUTION_USAGE,c8;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(c8||={});function l8(e,t){return e.disclosure===ki.TOKENS_AND_COST?e.costs.flatMap(e=>{let n=k0(e.costMinor,e.currency,t);return n===void 0?[]:[{currency:e.currency,amount:n}]}):[]}function u8(e){return(t,n)=>e(s8,t,n)}function d8({readState:e,usage:t,className:n}){let{formatNumber:r,...i}=K({component:s8}),a=u8(i.tComponent);if(e===c8.LOADING)return null;if(e===c8.FAILED||!t)return(0,$.jsx)(`p`,{role:`status`,className:U(`text-sm text-muted-foreground`,n),"data-execution-usage":e,children:a(`readFailed`)});if(t.callCount===0&&t.classifierCallCount===0&&t.documentExtractionCallCount===0)return(0,$.jsx)(`p`,{className:U(`text-sm text-muted-foreground`,n),"data-execution-usage":`empty`,children:a(`noCalls`)});let o=l8(t,r),s=t.disclosure===ki.TOKENS_AND_COST?t.unpricedCallCount:0,c=[{key:`calls`,label:a(`calls`),value:r(t.callCount)},...s>0?[{key:`unpricedCalls`,label:a(`unpricedCalls`),value:r(s)}]:[],{key:`inputTokens`,label:a(`inputTokens`),value:r(t.promptTokens)},{key:`outputTokens`,label:a(`outputTokens`),value:r(t.completionTokens)},...t.reasoningTokens>0?[{key:`reasoningTokens`,label:a(`reasoningTokens`),value:r(t.reasoningTokens)}]:[],{key:`totalTokens`,label:a(`totalTokens`),value:r(t.totalTokens)},...t.classifierCallCount>0?[{key:`classifierCalls`,label:a(`classifierCalls`),value:r(t.classifierCallCount)}]:[],...t.documentExtractionCallCount>0?[{key:`documentExtractionCalls`,label:a(`documentExtractionCalls`),value:r(t.documentExtractionCallCount)}]:[],...t.personalDataFieldsWithheld>0?[{key:`personalDataWithheld`,label:a(`personalDataWithheld`),value:r(t.personalDataFieldsWithheld)}]:[],...o.map(e=>({key:`cost-${e.currency}`,label:a(`cost`),value:e.amount}))];return(0,$.jsxs)(`section`,{className:U(`flex flex-col gap-field`,n),"data-execution-usage":e,"aria-label":a(`title`),children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:a(`title`)}),(0,$.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-field gap-y-1 text-sm`,children:c.map(e=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,$.jsx)(`dd`,{className:`tabular-nums`,"data-execution-usage-row":e.key,children:e.value})]},e.key))})]})}function f8({className:e}){let t=a8(),{registry:n,doOperation:r}=wm(),i=(0,Q.useMemo)(()=>{if(!t?.hostResourceId)return;let e={resourceType:t.hostResourceType,resourceId:t.hostResourceId,operationIdentifier:Is.USAGE,isOperationDefault:!0};if(!t.canBuildOperationContext(e))return;let r=t.buildOperationContext(e);return{operationPathKey:gl.createOperationPathKeyFromOperation(r.operation),contextualParameters:V.buildContextualParameters(r.contextResourceIdentifiers,n),parentResourcesRequirements:r.parentResourcesRequirements}},[t,n]),[a,o]=(0,Q.useState)({state:c8.LOADING});return(0,Q.useEffect)(()=>{if(!i)return;let e=!0;return o({state:c8.LOADING}),r(i.operationPathKey,{contextualParameters:i.contextualParameters,parentResourcesRequirements:i.parentResourcesRequirements}).then(t=>{e&&o({state:c8.READY,usage:t})}).catch(()=>{e&&o({state:c8.FAILED})}),()=>{e=!1}},[i,r]),i?(0,$.jsx)(d8,{readState:a.state,...a.usage?{usage:a.usage}:{},...e?{className:e}:{}}):null}function p8({readState:e,usage:t,className:n}){let{formatNumber:r,...i}=K({component:s8}),a=u8(i.tComponent);if(e===c8.LOADING)return null;let o=(e,t)=>(0,$.jsx)(`span`,{className:U(`text-xs text-muted-foreground tabular-nums`,n),"data-execution-usage-summary":t,children:e});return e===c8.FAILED||!t?o(a(`readFailed`),c8.FAILED):t.callCount===0&&t.classifierCallCount===0&&t.documentExtractionCallCount===0?o(a(`noCalls`),`empty`):o([a(`summaryTokens`,{tokens:r(t.totalTokens)}),...l8(t,r).map(e=>e.amount)].join(` · `),e)}function m8({className:e}){let t=OR()?.resourceType,n=_k()?.data,r=wj().contextualParameters,{registry:i,doOperation:a}=wm(),o=typeof n?.executionId==`string`&&n.executionId!==``?n.executionId:void 0,s=(0,Q.useMemo)(()=>[...Nu.variants.values()].find(e=>e.resourceType===t)?.parentFieldIdentifier,[t]),c=s?r?.[s]:void 0,l=(0,Q.useMemo)(()=>{let e=t?i.resourceConfigurations[t]?.operations?.find(e=>e.operationIdentifier===Is.USAGES&&e.isOperationDefault):void 0;return e?gl.createOperationPathKeyFromOperation(e):void 0},[i,t]),[u,d]=(0,Q.useState)({state:c8.LOADING});return(0,Q.useEffect)(()=>{if(!o||!l||!s||typeof c!=`string`||c===``)return;let e=!0;return d({state:c8.LOADING}),MTe({doOperation:a,operationPathKey:l,contextualParameters:{[s]:c},executionId:o}).then(t=>{e&&d(t?{state:c8.READY,usage:t}:{state:c8.FAILED})}).catch(()=>{e&&d({state:c8.FAILED})}),()=>{e=!1}},[a,o,l,s,c]),!o||!l||typeof c!=`string`||c===``?null:(0,$.jsx)(p8,{readState:u.state,...u.usage?{usage:u.usage}:{},...e?{className:e}:{}})}function h8(e,t){let n={},r={},i={};for(let a of e.fields)n[a.key]=a.request.question,a.request.why&&(r[a.key]=a.request.why),a.request.kind===no.CHOICE?i[a.key]=Object.fromEntries((a.request.options??[]).map(e=>[e,Xe(a.request,e)])):a.request.kind===no.CONFIRM&&(i[a.key]={...t});let a=e.layout.kind===Br.SECTIONS?e.layout.sections:e.layout.kind===Br.WIZARD?e.layout.steps:[],o={};for(let e of a)o[e.name]={title:e.title,...e.description?{description:e.description}:{}};return{fields:n,descriptions:r,enums:i,sections:o}}var g8=Q.createContext(null);function _8(){let e=Q.useContext(g8),{control:t}=rw(),n=ew({control:t}),r=Q.useMemo(()=>e?.compiled.schema.safeParse(n).success??!1,[e?.compiled,n]);return Q.useEffect(()=>{e?.onCompleteChangeRef.current?.(r)},[r,e]),null}function ITe(){let e=Q.useContext(g8);if(!e)return null;let{layout:t,fields:n}=e.compiled;if(t.kind===Br.FLAT)return(0,$.jsxs)(hA,{autoInjectSubmitButton:!1,children:[n.map(e=>(0,$.jsx)(nR,{name:e.key},e.key)),(0,$.jsx)(_8,{})]});let r=t.kind===Br.SECTIONS?t.appearance:Mr.STEPPER,i=t.kind===Br.SECTIONS?t.sections:t.steps;return(0,$.jsxs)(hA,{autoInjectSubmitButton:!1,children:[i.map(e=>(0,$.jsx)(cA,{name:e.name,appearance:r,children:e.keys.map(e=>(0,$.jsx)(nR,{name:e},e))},e.name)),(0,$.jsx)(_8,{})]})}var LTe=()=>void 0;function v8(e){let t=JSON.stringify(e);return Q.useMemo(()=>e,[t])}function y8({fields:e,form:t,confirmWords:n,disabled:r,onReady:i,onCompleteChange:a,className:o}){let s=v8(e),c=v8(t),l=v8(n),u=Q.useMemo(()=>kre({fields:[...s],form:c}),[s,c]),d=Q.useMemo(()=>h8(u,l),[u,l]),f=Q.useRef(a);Q.useLayoutEffect(()=>{f.current=a},[a]);let p=Q.useMemo(()=>({compiled:u,onCompleteChangeRef:f}),[u]),m=Q.useCallback(e=>{i?.({async readValues(){if(!await e.trigger())return null;let t=u.schema.safeParse(e.getValues());if(!t.success)return null;let n=t.data;return u.fields.map(e=>({ref:e.request.ref,value:tie(n[e.key])}))}})},[u,i]);return(0,$.jsx)(`div`,{className:o,"data-human-decision-form":``,children:(0,$.jsx)(g8.Provider,{value:p,children:(0,$.jsx)(gE,{schema:u.schema,onSubmit:LTe,labels:d,disabled:r,layoutTemplate:ITe,onFormReady:m})})})}var b8=zs(J.LOW_LEVEL_AI_ARTIFACT_LIST,`AI_ArtifactList`,[`Item`,`Origin`,`TextContent`,`FileContent`,`StructuredContent`]);function x8({preset:e=q.DEFAULT,...t}){let n=b8(e);return(0,$.jsx)(n,{...t})}function S8({preset:e=q.DEFAULT,...t}){let n=b8(e);return(0,$.jsx)(n.Item,{...t})}function RTe({preset:e=q.DEFAULT,...t}){let n=b8(e);return(0,$.jsx)(n.Origin,{...t})}function zTe({preset:e=q.DEFAULT,...t}){let n=b8(e);return(0,$.jsx)(n.TextContent,{...t})}function BTe({preset:e=q.DEFAULT,...t}){let n=b8(e);return(0,$.jsx)(n.FileContent,{...t})}function VTe({preset:e=q.DEFAULT,...t}){let n=b8(e);return(0,$.jsx)(n.StructuredContent,{...t})}var HTe={[ui.TEXT]:`TEXT`,[ui.FILE]:`FILE`,[ui.RAW_DATA]:`RAW_DATA`,[ui.STRUCTURED]:`STRUCTURED`};function C8(e){let t=e.content;return{ref:e.ref,name:e.name,type:HTe[e.type]??`RAW_DATA`,description:e.description,origin:e.origin,createdAt:e.createdAt,content:e.content,mimeType:t?.mimeType,size:t?.size,metadata:e.metadata}}function UTe({artifacts:e,...t}){let n=Q.useMemo(()=>e.map(C8),[e]);return(0,$.jsx)(x8,{items:n,...t})}function WTe({artifact:e,...t}){let n=Q.useMemo(()=>C8(e),[e]);return(0,$.jsx)(S8,{item:n,...t})}function w8({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_AGENT_LIST,`AI_AgentList`)(e);return(0,$.jsx)(n,{...t})}function T8({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_AGENT_CARD,`AI_AgentCard`)(e);return(0,$.jsx)(n,{...t})}function GTe({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_AGENT_PROMPT_SPEC,`AI_AgentPromptSpec`)(e);return(0,$.jsx)(n,{...t})}function KTe({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_AGENT_CAPABILITIES,`AI_AgentCapabilities`)(e);return(0,$.jsx)(n,{...t})}var qTe={[_r.ACTIVE]:`ACTIVE`,[_r.INACTIVE]:`INACTIVE`,[_r.DEPRECATED]:`DEPRECATED`},JTe={[nc.GENERATION]:`GENERATION`,[nc.ANALYSIS]:`ANALYSIS`,[nc.TRANSFORMATION]:`TRANSFORMATION`,[nc.DECISION]:`DECISION`,[nc.CHAT]:`CHAT`,[nc.CUSTOM]:`CUSTOM`},YTe={[O.SECURITY]:`SECURITY`,[O.SAFETY]:`SAFETY`,[O.PRIVACY]:`PRIVACY`,[O.SCOPE]:`SCOPE`,[O.COMPLIANCE]:`COMPLIANCE`};function E8(e){let t=e.promptSpec;return{ref:e.ref,displayName:e.displayName,status:qTe[e.status]??`INACTIVE`,promptSpec:{role:t.role,persona:t.persona,skillType:JTe[t.skillType]??`CUSTOM`,constraints:t.constraints?.map(e=>({id:e.id,text:e.text,type:YTe[e.type]??`SCOPE`,onViolation:e.onViolation})),goal:t.goal,output:t.output?{type:t.output.type,fileFormat:t.output.fileFormat,lengthGuidance:t.output.lengthGuidance?.toUpperCase(),includeReasoning:t.output.includeReasoning,requiredSections:t.output.requiredSections}:void 0,instructions:t.instructions,hints:t.hints,uncertainty:t.uncertainty?{policy:t.uncertainty.policy.toUpperCase(),confidenceThreshold:t.uncertainty.confidenceThreshold}:void 0,outOfScope:t.outOfScope,examples:t.examples,style:t.style?{verbosity:t.style.verbosity?.toUpperCase(),tone:t.style.tone?.toUpperCase()}:void 0,curation:t.curation,metadata:t.metadata},capabilities:e.capabilities,config:{operationKey:e.config.operationKey,seed:`seed`in e.config?e.config.seed:void 0,modelName:e.config.model},version:e.version,createdAt:e.createdAt,updatedAt:e.updatedAt}}function XTe({agents:e,...t}){let n=Q.useMemo(()=>e.map(E8),[e]);return(0,$.jsx)(w8,{agents:n,...t})}function ZTe({agent:e,...t}){let n=Q.useMemo(()=>E8(e),[e]);return(0,$.jsx)(T8,{agent:n,...t})}var D8=Q.forwardRef(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_ACTION_BUTTON,`ActionButton`)(e);return(0,$.jsx)(r,{...t,ref:n})});D8.displayName=`ActionButton`;function O8({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_BUTTON_GROUP,`ButtonGroup`)(e);return(0,$.jsx)(n,{...t})}function k8({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_BUTTON_GROUP_TEXT,`ButtonGroupText`)(e);return(0,$.jsx)(n,{...t})}function QTe({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_BUTTON_GROUP_SEPARATOR,`ButtonGroupSeparator`)(e);return(0,$.jsx)(n,{...t})}function A8({as:e=`span`,children:t,className:n,textClassName:r,maxWidth:i=`100%`,tooltipSide:a=Ea.TOP,tooltipDelayDuration:o=300,alwaysShowTooltip:s=!1,...c}){let l=(0,Q.useRef)(null),[u,d]=(0,Q.useState)(!1),f=e===`span`?`span`:`div`,p=Q.useCallback(e=>{l.current=e},[]);(0,Q.useLayoutEffect)(()=>{let e=()=>{if(l.current){let e=l.current.scrollWidth>l.current.clientWidth;d(e)}};e();let t=new ResizeObserver(e);return l.current&&t.observe(l.current),()=>t.disconnect()},[t]);let m=(0,$.jsx)(e,{ref:p,"data-slot":`truncated-text`,className:U(`block truncate text-start`,r),style:{maxWidth:i},...c,children:t});return u||s?(0,$.jsxs)(mj,{delayDuration:o,children:[(0,$.jsx)(hj,{asChild:!0,children:(0,$.jsx)(f,{className:U(`inline-block w-full`,n),children:m})}),(0,$.jsx)(gj,{side:a,children:t})]}):(0,$.jsx)(f,{className:U(`inline-block w-full`,n),children:m})}var j8=zs(J.LOW_LEVEL_AVATAR,`Avatar`,[`Image`,`Fallback`]);function M8({preset:e=q.DEFAULT,...t}){let n=j8(e);return(0,$.jsx)(n,{...t})}function N8({preset:e=q.DEFAULT,...t}){let n=j8(e);return(0,$.jsx)(n.Image,{...t})}function P8({preset:e=q.DEFAULT,...t}){let n=j8(e);return(0,$.jsx)(n.Fallback,{...t})}function F8({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_NOTIFICATION_INDICATOR,`NotificationIndicator`)(e);return(0,$.jsx)(n,{...t})}F8.displayName=`NotificationIndicator`;function I8({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_IDENTIFIER,`Identifier`)(e);return(0,$.jsx)(n,{...t})}I8.displayName=`Identifier`;function L8({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DURATION,`Duration`)(e);return(0,$.jsx)(n,{...t})}L8.displayName=`Duration`;function R8({activation:e,metadata:t,fileId:n,fieldName:r,onOverlayRequested:i,getBlob:a,onOperationRequested:o,ariaLabel:s}){let c=(0,Q.useCallback)(async()=>{let e=t.url;if(!e)return;if(a)try{eb(await a(e),t.filename||`file`);return}catch{}let n=document.createElement(`a`);n.href=e,n.download=t.filename||`file`,document.body.appendChild(n),n.click(),n.remove()},[a,t.filename,t.url]),l=(0,Q.useCallback)(()=>{switch(e.policy){case tu.NONE:return;case tu.OVERLAY:i?.();return;case tu.DOWNLOAD:c();return;case tu.NEW_TAB:t.url&&window.open(t.url,`_blank`,`noopener,noreferrer`);return;case tu.CUSTOM:o?.({operationIdentifier:e.operationIdentifier,variantKey:e.variantKey,fieldName:r,fileId:n});return}},[e,c,r,n,t.url,o,i]);return(0,Q.useMemo)(()=>e.policy!==tu.NONE&&(e.policy===tu.OVERLAY?i:e.policy===tu.CUSTOM?o:t.url)?{interactive:!0,effectivePolicy:e.policy,activationProps:{role:`button`,tabIndex:0,"aria-label":s,onClick:e=>{e.stopPropagation(),l()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),l())}}}:{interactive:!1,activationProps:{},effectivePolicy:tu.NONE},[l,e.policy,s,t.url,o,i])}function z8({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_FILE_IMAGE,`DisplayFieldFileImage`)(e);return(0,$.jsx)(n,{...t})}function B8({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_FILE_VIDEO,`DisplayFieldFileVideo`)(e);return(0,$.jsx)(n,{...t})}function V8({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_FILE_AUDIO,`DisplayFieldFileAudio`)(e);return(0,$.jsx)(n,{...t})}function H8({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_FILE_DOCUMENT,`DisplayFieldFileDocument`)(e);return(0,$.jsx)(n,{...t})}function U8({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DISPLAY_FIELD_FILE_GALLERY,`DisplayFieldFileGallery`)(e);return(0,$.jsx)(n,{...t})}var $Te=G(J.APPLICATION_LEVEL_NOTIFICATION_CENTER,`NotificationCenter`),W8=({preset:e=q.DEFAULT})=>{let{notifications:t,removeNotification:n,clearAll:r}=qm(),{tComponent:i,isReady:a}=K({component:J.APPLICATION_LEVEL_NOTIFICATION_CENTER}),o=(0,Q.useMemo)(()=>Om(i,J.APPLICATION_LEVEL_NOTIFICATION_CENTER),[i]),s=(0,Q.useMemo)(()=>t.map(e=>({id:e.id,type:e.type,message:e.message,timestamp:e.timestamp,wasCelebration:e.wasCelebration,nextStep:e.nextStep})),[t]),c=$Te(e);return a?(0,$.jsx)(c,{notifications:s,sessionCount:s.length,onRemove:n,onClearAll:r,labelTitle:o(`title`),labelNoNotifications:o(`noNotificationsThisSession`),labelClearAll:o(`clearAll`),labelDismiss:o(`dismiss`),labelTimeJustNow:o(`timeJustNow`),formatTimeMinutesAgo:e=>o(`timeMinutesAgo`,{count:e}),formatTimeHoursAgo:e=>o(`timeHoursAgo`,{count:e}),formatTimeDaysAgo:e=>o(`timeDaysAgo`,{count:e})}):null};W8.displayName=`AppNotificationCenter`;var G8=({preset:e})=>{let{notifications:t}=qm(),n=t.length,[r,i]=(0,Q.useState)(!1),a=(0,Q.useRef)(null),o=(0,Q.useCallback)(e=>{a.current&&!a.current.contains(e.target)&&i(!1)},[]);(0,Q.useEffect)(()=>(r&&document.addEventListener(`mousedown`,o),()=>{document.removeEventListener(`mousedown`,o)}),[r,o]);let s=(0,Q.useCallback)(e=>{e.key===`Escape`&&i(!1)},[]);return(0,$.jsxs)(`div`,{ref:a,className:`relative`,onKeyDown:s,children:[(0,$.jsxs)(`button`,{type:`button`,className:`relative inline-flex items-center justify-center w-8 h-8 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors`,onClick:()=>i(e=>!e),"aria-label":`Notifications${n>0?` (${n} this session)`:``}`,"aria-expanded":r,"aria-haspopup":`true`,children:[(0,$.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,$.jsx)(`path`,{d:`M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9`}),(0,$.jsx)(`path`,{d:`M10.3 21a1.94 1.94 0 0 0 3.4 0`})]}),n>0&&(0,$.jsx)(`span`,{className:`absolute -top-0.5 -end-0.5 flex items-center justify-center h-4 min-w-[16px] px-1 text-[10px] font-bold bg-destructive text-destructive-foreground rounded-full`,children:vn(n)})]}),r&&(0,$.jsx)(`div`,{className:`absolute end-0 top-full mt-2 z-(--z-overlay) animate-in fade-in slide-in-from-top-2 duration-[var(--motion-duration-fast)]`,children:(0,$.jsx)(W8,{preset:e})})]})};G8.displayName=`AppLayout_NotificationCenter`;function K8({name:e,renderItem:t,sectionAppearance:n,objectItemLayout:r,className:i}){return(0,$.jsx)(nR,{name:e,renderField:t,sectionAppearance:n,objectItemLayout:r,className:i})}K8.displayName=`FormFieldArray`,Lk(K8,Pk.FIELD_SLOT);function q8({name:e,renderItem:t,sectionAppearance:n=Mr.GHOST,objectItemLayout:r,className:i,hideLabel:a,labelPlacement:o,hideDescription:s,labelStyle:c}){return(0,$.jsx)(TR,{name:e,renderField:t,sectionAppearance:n,objectItemLayout:r,labelStyle:c,className:i,hideLabel:a,labelPlacement:o,hideDescription:s})}q8.displayName=`DisplayFieldArray`;var eEe=bl(J.LOW_LEVEL_CALENDAR,`Calendar`),tEe=bl(J.LOW_LEVEL_CALENDAR_DAY_BUTTON,`CalendarDayButton`),J8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=eEe(e);return(0,$.jsx)(r,{...t,ref:n})});J8.displayName=`Calendar`;var Y8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=tEe(e);return(0,$.jsx)(r,{...t,ref:n})});Y8.displayName=`CalendarDayButton`;function X8({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_INLINE_EDIT_TEXT,`InlineEditText`)(e);return(0,$.jsx)(n,{...t})}X8.displayName=`InlineEditText`;var Z8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_FILE_UPLOAD,`FileUpload`)(e);return(0,$.jsx)(r,{...t,ref:n})});Z8.displayName=`FileUpload`;var Q8;(function(e){e.DEFAULT=`default`,e.OUTLINE=`outline`})(Q8||={});var $8=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=bl(J.LOW_LEVEL_TOGGLE,`Toggle`)(e);return(0,$.jsx)(r,{...t,ref:n})});$8.displayName=`Toggle`;function nEe({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_FORM,`FormRoot`)(e);return(0,$.jsx)(n,{...t})}function rEe({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_FORM_ITEM,`FormItem`)(e);return(0,$.jsx)(n,{...t})}function iEe({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_FORM_LABEL,`FormLabel`)(e);return(0,$.jsx)(n,{...t})}function aEe({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_FORM_CONTROL,`FormControl`)(e);return(0,$.jsx)(n,{...t})}function oEe({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_FORM_DESCRIPTION,`FormDescription`)(e);return(0,$.jsx)(n,{...t})}function sEe({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_FORM_MESSAGE,`FormMessage`)(e);return(0,$.jsx)(n,{...t})}function cEe({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_FORM_FIELD,`FormFieldPrimitive`)(e);return(0,$.jsx)(n,{...t})}var e5=Q.createContext({}),t5=Q.createContext({}),n5=()=>{let e=Q.useContext(e5),t=Q.useContext(t5),{getFieldState:n}=rw(),r=YC({name:e.name}),i=n(e.name,r);if(!e)throw Error(`useFormField should be used within <FormField>`);let{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...i}};function lEe({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_ASPECT_RATIO,`AspectRatio`)(e);return(0,$.jsx)(n,{...t})}var r5=zs(J.LOW_LEVEL_CAROUSEL,`Carousel`,[`Content`,`Item`,`Previous`,`Next`]);function i5({preset:e=q.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n,{...t})}function a5({preset:e=q.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.Content,{...t})}function o5({preset:e=q.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.Item,{...t})}function uEe({preset:e=q.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.Previous,{...t})}function dEe({preset:e=q.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.Next,{...t})}function fEe({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_DIVIDER,`Divider`)(e);return(0,$.jsx)(n,{...t})}function s5({notificationBadgeRef:e,label:t,className:n}){let{registry:r}=wm(),{getBadgeState:i}=S$(),a=e?r.notificationBadgeDefinitions.find(t=>Os(t)===e):void 0;if(!a)return null;let{count:o,pulse:s}=i(a),c=t?.trim()?t:Xo(Os(a));return(0,$.jsx)(F8,{mode:a.display.mode,tone:a.display.tone,count:o,pulse:s,label:c,className:n})}s5.displayName=`NavigationItemBadge`;var c5=zs(J.LOW_LEVEL_MENU_BAR,`Menubar`,[`Menu`,`Trigger`,`Content`,`Group`,`Item`,`CheckboxItem`,`RadioGroup`,`RadioItem`,`Label`,`Separator`,`Shortcut`,`Sub`,`SubTrigger`,`SubContent`]);function pEe({preset:e=q.DEFAULT,...t}){let n=c5(e);return(0,$.jsx)(n,{...t})}function mEe({preset:e=q.DEFAULT,...t}){let n=c5(e);return(0,$.jsx)(n.Menu,{...t})}var l5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=c5(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});l5.displayName=`MenubarTrigger`;var u5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=c5(e);return(0,$.jsx)(r.Content,{...t,ref:n})});u5.displayName=`MenubarContent`;function hEe({preset:e=q.DEFAULT,...t}){let n=c5(e);return(0,$.jsx)(n.Group,{...t})}function gEe({preset:e=q.DEFAULT,...t}){let n=c5(e);return(0,$.jsx)(n.Item,{...t})}function _Ee({preset:e=q.DEFAULT,...t}){let n=c5(e);return(0,$.jsx)(n.CheckboxItem,{...t})}function vEe({preset:e=q.DEFAULT,...t}){let n=c5(e);return(0,$.jsx)(n.RadioGroup,{...t})}function yEe({preset:e=q.DEFAULT,...t}){let n=c5(e);return(0,$.jsx)(n.RadioItem,{...t})}function bEe({preset:e=q.DEFAULT,...t}){let n=c5(e);return(0,$.jsx)(n.Label,{...t})}function xEe({preset:e=q.DEFAULT,...t}){let n=c5(e);return(0,$.jsx)(n.Separator,{...t})}function SEe({preset:e=q.DEFAULT,...t}){let n=c5(e);return(0,$.jsx)(n.Shortcut,{...t})}function CEe({preset:e=q.DEFAULT,...t}){let n=c5(e);return(0,$.jsx)(n.Sub,{...t})}function wEe({preset:e=q.DEFAULT,...t}){let n=c5(e);return(0,$.jsx)(n.SubTrigger,{...t})}var d5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=c5(e);return(0,$.jsx)(r.SubContent,{...t,ref:n})});d5.displayName=`MenubarSubContent`;var f5=zs(J.LOW_LEVEL_NAVBAR,`NavigationMenu`,[`List`,`Item`,`Content`,`Trigger`,`Link`,`Indicator`,`Viewport`]);function TEe({preset:e=q.DEFAULT,...t}){let n=f5(e);return(0,$.jsx)(n,{...t})}function EEe({preset:e=q.DEFAULT,...t}){let n=f5(e);return(0,$.jsx)(n.List,{...t})}function DEe({preset:e=q.DEFAULT,...t}){let n=f5(e);return(0,$.jsx)(n.Item,{...t})}function OEe({preset:e=q.DEFAULT,...t}){let n=f5(e);return(0,$.jsx)(n.Content,{...t})}function kEe({preset:e=q.DEFAULT,...t}){let n=f5(e);return(0,$.jsx)(n.Trigger,{...t})}function AEe({preset:e=q.DEFAULT,...t}){let n=f5(e);return(0,$.jsx)(n.Link,{...t})}function jEe({preset:e=q.DEFAULT,...t}){let n=f5(e);return(0,$.jsx)(n.Indicator,{...t})}function MEe({preset:e=q.DEFAULT,...t}){let n=f5(e);return(0,$.jsx)(n.Viewport,{...t})}var p5;(function(e){e.SIDEBAR=`sidebar`,e.FLOATING=`floating`,e.INSET=`inset`})(p5||={});var m5;(function(e){e.OFFCANVAS=`offcanvas`,e.ICON=`icon`,e.NONE=`none`})(m5||={});var h5;(function(e){e.DEFAULT=`default`,e.OUTLINE=`outline`})(h5||={});var g5=zs(J.LOW_LEVEL_SIDEBAR,`Sidebar`,[`Content`,`Footer`,`Group`,`GroupAction`,`GroupContent`,`GroupLabel`,`Header`,`Input`,`Inset`,`Menu`,`MenuAction`,`MenuBadge`,`MenuButton`,`MenuItem`,`MenuSkeleton`,`MenuSub`,`MenuSubButton`,`MenuSubItem`,`Provider`,`Rail`,`Separator`,`Trigger`]);function NEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n,{...t})}function PEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.Content,{...t})}function FEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.Footer,{...t})}function IEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.Group,{...t})}function LEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.GroupAction,{...t})}function REe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.GroupContent,{...t})}function zEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.GroupLabel,{...t})}function BEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.Header,{...t})}function VEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.Input,{...t})}function HEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.Inset,{...t})}function UEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.Menu,{...t})}function WEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.MenuAction,{...t})}function GEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.MenuBadge,{...t})}function KEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.MenuButton,{...t})}function qEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.MenuItem,{...t})}function JEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.MenuSkeleton,{...t})}function YEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.MenuSub,{...t})}function XEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.MenuSubButton,{...t})}function ZEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.MenuSubItem,{...t})}function QEe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.Provider,{...t})}function $Ee({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.Rail,{...t})}function eDe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.Separator,{...t})}function tDe({preset:e=q.DEFAULT,...t}){let n=g5(e);return(0,$.jsx)(n.Trigger,{...t})}var _5=zs(J.LOW_LEVEL_CONTEXT_MENU,`ContextMenu`,[`Trigger`,`Content`,`Group`,`Item`,`CheckboxItem`,`RadioGroup`,`RadioItem`,`Label`,`Separator`,`Shortcut`,`Sub`,`SubTrigger`,`SubContent`]);function nDe({preset:e=q.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n,{...t})}function rDe({preset:e=q.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Trigger,{...t})}var v5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=_5(e);return(0,$.jsx)(r.Content,{...t,ref:n})});v5.displayName=`ContextMenuContent`;function iDe({preset:e=q.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Group,{...t})}function aDe({preset:e=q.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Item,{...t})}function oDe({preset:e=q.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.CheckboxItem,{...t})}function sDe({preset:e=q.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.RadioGroup,{...t})}function cDe({preset:e=q.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.RadioItem,{...t})}function lDe({preset:e=q.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Label,{...t})}function uDe({preset:e=q.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Separator,{...t})}function dDe({preset:e=q.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Shortcut,{...t})}function fDe({preset:e=q.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Sub,{...t})}function pDe({preset:e=q.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.SubTrigger,{...t})}var y5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=_5(e);return(0,$.jsx)(r.SubContent,{...t,ref:n})});y5.displayName=`ContextMenuSubContent`;var b5=zs(J.LOW_LEVEL_DROPDOWN_MENU,`DropdownMenu`,[`Trigger`,`Content`,`Group`,`Item`,`CheckboxItem`,`RadioGroup`,`RadioItem`,`Label`,`Separator`,`Shortcut`,`Sub`,`SubTrigger`,`SubContent`]);function x5({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n,{...t})}var S5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=b5(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});S5.displayName=`DropdownMenuTrigger`;var C5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=b5(e);return(0,$.jsx)(r.Content,{...t,ref:n})});C5.displayName=`DropdownMenuContent`;function mDe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Group,{...t})}function w5({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Item,{...t})}function hDe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.CheckboxItem,{...t})}function gDe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.RadioGroup,{...t})}function _De({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.RadioItem,{...t})}function T5({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Label,{...t})}function E5({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Separator,{...t})}function vDe({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Shortcut,{...t})}function D5({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.Sub,{...t})}function O5({preset:e=q.DEFAULT,...t}){let n=b5(e);return(0,$.jsx)(n.SubTrigger,{...t})}var k5=(0,Q.forwardRef)(({preset:e=q.DEFAULT,...t},n)=>{let r=b5(e);return(0,$.jsx)(r.SubContent,{...t,ref:n})});k5.displayName=`DropdownMenuSubContent`;var A5=zs(J.LOW_LEVEL_HOVER_CARD,`HoverCard`,[`Trigger`,`Content`]);function j5({preset:e=q.DEFAULT,...t}){let n=A5(e);return(0,$.jsx)(n,{...t})}function M5({preset:e=q.DEFAULT,...t}){let n=A5(e);return(0,$.jsx)(n.Trigger,{...t})}function N5({preset:e=q.DEFAULT,...t}){let n=A5(e);return(0,$.jsx)(n.Content,{...t})}var P5=zs(J.LOW_LEVEL_PAGINATION,`Pagination`,[`Content`,`Item`,`Link`,`Previous`,`Next`,`Ellipsis`]);function yDe({preset:e=q.DEFAULT,...t}){let n=P5(e);return(0,$.jsx)(n,{...t})}function bDe({preset:e=q.DEFAULT,...t}){let n=P5(e);return(0,$.jsx)(n.Content,{...t})}function xDe({preset:e=q.DEFAULT,...t}){let n=P5(e);return(0,$.jsx)(n.Item,{...t})}function SDe({preset:e=q.DEFAULT,...t}){let n=P5(e);return(0,$.jsx)(n.Link,{...t})}function CDe({preset:e=q.DEFAULT,...t}){let n=P5(e);return(0,$.jsx)(n.Previous,{...t})}function wDe({preset:e=q.DEFAULT,...t}){let n=P5(e);return(0,$.jsx)(n.Next,{...t})}function TDe({preset:e=q.DEFAULT,...t}){let n=P5(e);return(0,$.jsx)(n.Ellipsis,{...t})}var F5=zs(J.LOW_LEVEL_STACKED_LAYOUT,`StackedLayout`,[`Header`,`Title`,`Subtitle`,`Actions`,`Toolbar`,`Body`,`Aside`,`Content`,`Section`]);function EDe({preset:e=q.DEFAULT,...t}){let n=F5(e);return(0,$.jsx)(n,{...t})}function DDe({preset:e=q.DEFAULT,...t}){let n=F5(e);return(0,$.jsx)(n.Header,{...t})}function ODe({preset:e=q.DEFAULT,...t}){let n=F5(e);return(0,$.jsx)(n.Title,{...t})}function kDe({preset:e=q.DEFAULT,...t}){let n=F5(e);return(0,$.jsx)(n.Subtitle,{...t})}function ADe({preset:e=q.DEFAULT,...t}){let n=F5(e);return(0,$.jsx)(n.Actions,{...t})}function jDe({preset:e=q.DEFAULT,...t}){let n=F5(e);return(0,$.jsx)(n.Toolbar,{...t})}function MDe({preset:e=q.DEFAULT,...t}){let n=F5(e);return(0,$.jsx)(n.Body,{...t})}function NDe({preset:e=q.DEFAULT,...t}){let n=F5(e);return(0,$.jsx)(n.Aside,{...t})}function PDe({preset:e=q.DEFAULT,...t}){let n=F5(e);return(0,$.jsx)(n.Content,{...t})}function FDe({preset:e=q.DEFAULT,...t}){let n=F5(e);return(0,$.jsx)(n.Section,{...t})}var I5=zs(J.LOW_LEVEL_AI_ARTIFACT,`AI_Artifact`,[`Header`,`Close`,`Content`,`Title`,`Description`,`Actions`,`Action`]);function IDe({preset:e=q.DEFAULT,...t}){let n=I5(e);return(0,$.jsx)(n,{...t})}function LDe({preset:e=q.DEFAULT,...t}){let n=I5(e);return(0,$.jsx)(n.Header,{...t})}function RDe({preset:e=q.DEFAULT,...t}){let n=I5(e);return(0,$.jsx)(n.Close,{...t})}function zDe({preset:e=q.DEFAULT,...t}){let n=I5(e);return(0,$.jsx)(n.Content,{...t})}function BDe({preset:e=q.DEFAULT,...t}){let n=I5(e);return(0,$.jsx)(n.Title,{...t})}function VDe({preset:e=q.DEFAULT,...t}){let n=I5(e);return(0,$.jsx)(n.Description,{...t})}function HDe({preset:e=q.DEFAULT,...t}){let n=I5(e);return(0,$.jsx)(n.Actions,{...t})}function UDe({preset:e=q.DEFAULT,...t}){let n=I5(e);return(0,$.jsx)(n.Action,{...t})}function L5({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_CODE_BLOCK,`AI_CodeBlock`)(e);return(0,$.jsx)(n,{...t})}function R5({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_DIFF_BLOCK,`AI_DiffBlock`)(e);return(0,$.jsx)(n,{...t})}var z5;(function(e){e.CONTEXT=`context`,e.ADDED=`added`,e.REMOVED=`removed`,e.NOTE=`note`})(z5||={});var WDe=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,GDe=/^diff --git (?:a\/)?(\S+) (?:b\/)?(\S+)$/,KDe=/^--- (?:a\/)?(.*)$/,qDe=/^\+\+\+ (?:b\/)?(.*)$/,JDe=/^Binary files .* differ$/,YDe=`/dev/null`;function B5(e){if(e===void 0)return;let t=e.trim();return t===YDe||t===``?void 0:t}function V5(e){let t=e.replace(/\r\n/g,`
|
|
44
|
-
`).split(`
|
|
45
|
-
`);t.length>0&&t[t.length-1]===``&&t.pop();let n=[],r=null,i=null,a=0,o=0,s=()=>{i&&r&&r.hunks.push({...i,lines:[...i.lines]}),i=null},c=()=>{s(),r&&n.push({...r.newPath??r.oldPath?{path:r.newPath??r.oldPath}:{},...r.oldPath?{oldPath:r.oldPath}:{},...r.newPath?{newPath:r.newPath}:{},isBinary:r.isBinary,hunks:r.hunks,added:r.added,removed:r.removed}),r=null},l=()=>{c(),r={pathHeaderSeen:!1,isBinary:!1,hunks:[],added:0,removed:0}};for(let e of t){let t=GDe.exec(e);if(t){l(),r.oldPath=B5(t[1]),r.newPath=B5(t[2]);continue}let n=i===null?KDe.exec(e):null;if(n){(!r||r.pathHeaderSeen||r.hunks.length>0)&&l(),r.pathHeaderSeen=!0,r.oldPath=B5(n[1]);continue}let c=i===null?qDe.exec(e):null;if(c){r||l(),r.newPath=B5(c[1]);continue}if(JDe.test(e)){r||l(),r.isBinary=!0;continue}let u=WDe.exec(e);if(u){r||l(),s();let t=Number(u[1]),n=Number(u[3]);i={header:e,oldStart:t,oldLines:u[2]===void 0?1:Number(u[2]),newStart:n,newLines:u[4]===void 0?1:Number(u[4]),lines:[]},a=t,o=n;continue}if(!i||!r)continue;let d=e.charAt(0),f=e.slice(1);switch(d){case`+`:i.lines.push({kind:z5.ADDED,text:f,newNumber:o}),o+=1,r.added+=1;break;case`-`:i.lines.push({kind:z5.REMOVED,text:f,oldNumber:a}),a+=1,r.removed+=1;break;case`\\`:i.lines.push({kind:z5.NOTE,text:f.trim()});break;default:i.lines.push({kind:z5.CONTEXT,text:d===` `?f:e,oldNumber:a,newNumber:o}),a+=1,o+=1}}return c(),n}function H5(e){return e.hunks.reduce((e,t)=>e+t.lines.length+1,0)}function XDe({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_IMAGE,`AI_Image`)(e);return(0,$.jsx)(n,{...t})}var U5=zs(J.LOW_LEVEL_AI_WEB_PREVIEW,`AI_WebPreview`,[`Navigation`,`NavigationButton`,`Url`,`Body`,`Console`]);function ZDe({preset:e=q.DEFAULT,...t}){let n=U5(e);return(0,$.jsx)(n,{...t})}function QDe({preset:e=q.DEFAULT,...t}){let n=U5(e);return(0,$.jsx)(n.Navigation,{...t})}function $De({preset:e=q.DEFAULT,...t}){let n=U5(e);return(0,$.jsx)(n.NavigationButton,{...t})}function eOe({preset:e=q.DEFAULT,...t}){let n=U5(e);return(0,$.jsx)(n.Url,{...t})}function tOe({preset:e=q.DEFAULT,...t}){let n=U5(e);return(0,$.jsx)(n.Body,{...t})}function nOe({preset:e=q.DEFAULT,...t}){let n=U5(e);return(0,$.jsx)(n.Console,{...t})}var W5=zs(J.LOW_LEVEL_AI_CONVERSATION,`AI_Conversation`,[`Content`,`EmptyState`,`ScrollButton`]);function G5({preset:e=q.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n,{...t})}function K5({preset:e=q.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.Content,{...t})}function q5({preset:e=q.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.EmptyState,{...t})}function J5({preset:e=q.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.ScrollButton,{...t})}var Y5=zs(J.LOW_LEVEL_AI_PROMPT_INPUT,`AI_PromptInput`,`Provider.Attachment.Attachments.Body.Textarea.Header.Footer.Tools.Button.Submit.ActionMenu.ActionMenuTrigger.ActionMenuContent.ActionMenuItem.ActionAddAttachments.SpeechButton.Select.SelectTrigger.SelectContent.SelectItem.SelectValue.Command.CommandInput.CommandList.CommandEmpty.CommandGroup.CommandItem.CommandSeparator.HoverCard.HoverCardTrigger.HoverCardContent.TabsList.Tab.TabLabel.TabBody.TabItem`.split(`.`));function X5({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n,{...t})}function rOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.Provider,{...t})}function iOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.Attachment,{...t})}function aOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.Attachments,{...t})}function oOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.Body,{...t})}function Z5({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.Textarea,{...t})}function sOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.Header,{...t})}function Q5({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.Footer,{...t})}function cOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.Tools,{...t})}function lOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.Button,{...t})}function $5({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.Submit,{...t})}function uOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.ActionMenu,{...t})}function dOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.ActionMenuTrigger,{...t})}function fOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.ActionMenuContent,{...t})}function pOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.ActionMenuItem,{...t})}function mOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.ActionAddAttachments,{...t})}function hOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.SpeechButton,{...t})}function gOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.Select,{...t})}function _Oe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.SelectTrigger,{...t})}function vOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.SelectContent,{...t})}function yOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.SelectItem,{...t})}function bOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.SelectValue,{...t})}function xOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.Command,{...t})}function SOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.CommandInput,{...t})}function COe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.CommandList,{...t})}function wOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.CommandEmpty,{...t})}function TOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.CommandGroup,{...t})}function EOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.CommandItem,{...t})}function DOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.CommandSeparator,{...t})}function OOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.HoverCard,{...t})}function kOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.HoverCardTrigger,{...t})}function AOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.HoverCardContent,{...t})}function jOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.TabsList,{...t})}function MOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.Tab,{...t})}function NOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.TabLabel,{...t})}function POe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.TabBody,{...t})}function FOe({preset:e=q.DEFAULT,...t}){let n=Y5(e);return(0,$.jsx)(n.TabItem,{...t})}var e7=zs(J.LOW_LEVEL_AI_SOURCES,`AI_Sources`,[`Trigger`,`Content`,`Source`]);function t7({preset:e=q.DEFAULT,...t}){let n=e7(e);return(0,$.jsx)(n,{...t})}function n7({preset:e=q.DEFAULT,...t}){let n=e7(e);return(0,$.jsx)(n.Trigger,{...t})}function r7({preset:e=q.DEFAULT,...t}){let n=e7(e);return(0,$.jsx)(n.Content,{...t})}function i7({preset:e=q.DEFAULT,...t}){let n=e7(e);return(0,$.jsx)(n.Source,{...t})}function a7({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_SUGGESTIONS,`AI_Suggestions`)(e);return(0,$.jsx)(n,{...t})}function o7({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_SUGGESTION,`AI_Suggestion`)(e);return(0,$.jsx)(n,{...t})}function IOe({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_CONFIRMATION,`AI_Confirmation`)(e);return(0,$.jsx)(n,{...t})}var s7=zs(J.LOW_LEVEL_AI_QUEUE,`AI_Queue`,[`List`,`Item`,`ItemIndicator`,`ItemContent`,`ItemDescription`,`ItemActions`,`ItemAction`,`ItemAttachment`,`ItemImage`,`ItemFile`,`Section`,`SectionTrigger`,`SectionLabel`,`SectionContent`,`TodoItem`,`MessageItem`]);function LOe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n,{...t})}function ROe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.List,{...t})}function zOe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Item,{...t})}function BOe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.ItemIndicator,{...t})}function VOe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.ItemContent,{...t})}function HOe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.ItemDescription,{...t})}function UOe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.ItemActions,{...t})}function WOe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.ItemAction,{...t})}function GOe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.ItemAttachment,{...t})}function KOe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.ItemImage,{...t})}function qOe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.ItemFile,{...t})}function JOe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Section,{...t})}function YOe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.SectionTrigger,{...t})}function XOe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.SectionLabel,{...t})}function ZOe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.SectionContent,{...t})}function QOe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.TodoItem,{...t})}function $Oe({preset:e=q.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.MessageItem,{...t})}var c7=zs(J.LOW_LEVEL_AI_TASK,`AI_Task`,[`Trigger`,`Content`,`Item`,`ItemFile`]);function eke({preset:e=q.DEFAULT,...t}){let n=c7(e);return(0,$.jsx)(n,{...t})}function tke({preset:e=q.DEFAULT,...t}){let n=c7(e);return(0,$.jsx)(n.Trigger,{...t})}function nke({preset:e=q.DEFAULT,...t}){let n=c7(e);return(0,$.jsx)(n.Content,{...t})}function rke({preset:e=q.DEFAULT,...t}){let n=c7(e);return(0,$.jsx)(n.Item,{...t})}function l7({preset:e=q.DEFAULT,...t}){let n=c7(e);return(0,$.jsx)(n.ItemFile,{...t})}var u7=zs(J.LOW_LEVEL_AI_TOOL,`AI_Tool`,[`Header`,`Content`,`Input`,`Output`]);function d7({preset:e=q.DEFAULT,...t}){let n=u7(e);return(0,$.jsx)(n,{...t})}function f7({preset:e=q.DEFAULT,...t}){let n=u7(e);return(0,$.jsx)(n.Header,{...t})}function p7({preset:e=q.DEFAULT,...t}){let n=u7(e);return(0,$.jsx)(n.Content,{...t})}function m7({preset:e=q.DEFAULT,...t}){let n=u7(e);return(0,$.jsx)(n.Input,{...t})}function h7({preset:e=q.DEFAULT,...t}){let n=u7(e);return(0,$.jsx)(n.Output,{...t})}function ike({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_EXECUTION_STREAM,`AI_ExecutionStream`)(e);return(0,$.jsx)(n,{...t})}function ake({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_CONNECTION,`AI_Connection`)(e);return(0,$.jsx)(n,{...t})}function oke({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_EDGE,`AI_Edge`)(e);return(0,$.jsx)(n,{...t})}function g7({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_PANEL,`AI_Panel`)(e);return(0,$.jsx)(n,{...t})}function ske({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_TOOLBAR,`AI_Toolbar`)(e);return(0,$.jsx)(n,{...t})}function cke({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_CONTEXT,`AI_Context`)(e);return(0,$.jsx)(n,{...t})}function lke({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_MODEL_SELECTOR,`AI_ModelSelector`)(e);return(0,$.jsx)(n,{...t})}function uke({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_OPEN_IN_CHAT,`AI_OpenInChat`)(e);return(0,$.jsx)(n,{...t})}function dke({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_LOADER,`AI_Loader`)(e);return(0,$.jsx)(n,{...t})}function _7({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_SHIMMER,`AI_Shimmer`)(e);return(0,$.jsx)(n,{...t})}var v7=zs(J.LOW_LEVEL_AI_CHAIN_OF_THOUGHT,`AI_ChainOfThought`,[`Header`,`Step`,`SearchResults`,`SearchResult`,`Content`,`Image`]);function y7({preset:e=q.DEFAULT,...t}){let n=v7(e);return(0,$.jsx)(n,{...t})}function b7({preset:e=q.DEFAULT,...t}){let n=v7(e);return(0,$.jsx)(n.Header,{...t})}function x7({preset:e=q.DEFAULT,...t}){let n=v7(e);return(0,$.jsx)(n.Step,{...t})}function fke({preset:e=q.DEFAULT,...t}){let n=v7(e);return(0,$.jsx)(n.SearchResults,{...t})}function pke({preset:e=q.DEFAULT,...t}){let n=v7(e);return(0,$.jsx)(n.SearchResult,{...t})}function S7({preset:e=q.DEFAULT,...t}){let n=v7(e);return(0,$.jsx)(n.Content,{...t})}function mke({preset:e=q.DEFAULT,...t}){let n=v7(e);return(0,$.jsx)(n.Image,{...t})}function hke({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_CHECKPOINT,`AI_Checkpoint`)(e);return(0,$.jsx)(n,{...t})}function gke({preset:e=q.DEFAULT,...t}){let n=G(J.LOW_LEVEL_AI_INLINE_CITATION,`AI_InlineCitation`)(e);return(0,$.jsx)(n,{...t})}var C7=zs(J.LOW_LEVEL_AI_PLAN,`AI_Plan`,[`Header`,`Trigger`,`Content`,`Title`,`Description`,`Action`,`Footer`]);function _ke({preset:e=q.DEFAULT,...t}){let n=C7(e);return(0,$.jsx)(n,{...t})}function vke({preset:e=q.DEFAULT,...t}){let n=C7(e);return(0,$.jsx)(n.Header,{...t})}function yke({preset:e=q.DEFAULT,...t}){let n=C7(e);return(0,$.jsx)(n.Trigger,{...t})}function bke({preset:e=q.DEFAULT,...t}){let n=C7(e);return(0,$.jsx)(n.Content,{...t})}function xke({preset:e=q.DEFAULT,...t}){let n=C7(e);return(0,$.jsx)(n.Title,{...t})}function Ske({preset:e=q.DEFAULT,...t}){let n=C7(e);return(0,$.jsx)(n.Description,{...t})}function Cke({preset:e=q.DEFAULT,...t}){let n=C7(e);return(0,$.jsx)(n.Action,{...t})}function wke({preset:e=q.DEFAULT,...t}){let n=C7(e);return(0,$.jsx)(n.Footer,{...t})}var w7=zs(J.LOW_LEVEL_AI_REASONING,`AI_Reasoning`,[`Trigger`,`Content`]);function T7({preset:e=q.DEFAULT,...t}){let n=w7(e);return(0,$.jsx)(n,{...t})}function E7({preset:e=q.DEFAULT,...t}){let n=w7(e);return(0,$.jsx)(n.Trigger,{...t})}function D7({preset:e=q.DEFAULT,...t}){let n=w7(e);return(0,$.jsx)(n.Content,{...t})}function O7(){let e=vh(),t=wg(),n=Cl[ao.HOME].route,{navigate:r}=zS(),{isNavigationItemActive:i}=Zx(),{emit:a}=vo();return{isNavigationItemActive:i,handleNavigationClick:(0,Q.useCallback)((e,t)=>{Ch.dispatchNavigationForItem(r,e,t)},[r]),handleHomeClick:(0,Q.useCallback)(()=>{Zh({emit:a,routerNavigate:e,homePath:n})},[a,e,n]),isHomeActive:(0,Q.useMemo)(()=>{let e=t.pathname;return e===n||n===`/`&&e===``},[t.pathname,n])}}function Tke(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Eke(e){switch(e){case ya.VERTICAL_RAIL:return{direction:mo.VERTICAL,borderSide:Ea.END,tooltipSide:Ea.END,orientation:mo.VERTICAL};case ya.HORIZONTAL_BAR:return{direction:mo.HORIZONTAL,borderSide:Ea.BOTTOM,tooltipSide:Ea.TOP,orientation:mo.HORIZONTAL};case ya.BOTTOM_TAB_BAR:return{direction:mo.HORIZONTAL,borderSide:Ea.TOP,tooltipSide:Ea.TOP,orientation:mo.HORIZONTAL};default:return{direction:mo.VERTICAL,borderSide:Ea.END,tooltipSide:Ea.END,orientation:mo.VERTICAL}}}function k7(){let{UIConfig:e,appComponentsConfiguration:t}=e_(),n=hS(),r=t?.[Fu.ACTIVITY_BAR],i=e?.currentBreakpoint===ci.MOBILE,a=(0,Q.useMemo)(()=>Tke(r)?i?r.mobileRendering??ya.BOTTOM_TAB_BAR:r.desktopRendering??ya.VERTICAL_RAIL:i?ya.BOTTOM_TAB_BAR:ya.VERTICAL_RAIL,[r,i]),o=(0,Q.useMemo)(()=>Eke(a),[a]);return{availableModes:(0,Q.useMemo)(()=>n?.availableModes??[],[n?.availableModes]),activeMode:n?.activeMode??null,setActiveMode:n?.setActiveMode??(()=>{}),hasModes:n?.hasModes??!1,activeRenderingMode:a,layout:o,isNavigationLoading:!n}}var A7=`engine:primary`;function j7(){return{requiredCapabilities:[ry.ANSWERER]}}function M7(e,t){return(e??[]).some(e=>e.kind===ru.ENGINE_PAGE&&e.pageRef===t||M7(e.children,t))}function Dke(e,t){if(!t||(e??[]).some(e=>e.contentKind===Le.NAVIGATION_LIST&&M7(e.children,ao.DECISIONS)))return e;let n={kind:ru.ENGINE_PAGE,pageRef:ao.DECISIONS,runtimeAvailability:j7()},r=(e??[]).findIndex(e=>e.contentKind===Le.NAVIGATION_LIST&&e.isPrimary===!0);return r===-1?[{contentKind:Le.NAVIGATION_LIST,ref:A7,isPrimary:!0,children:[n]},...e??[]]:(e??[]).map((e,t)=>{if(t!==r)return e;let i=e;return{...i,children:[n,...i.children]}})}function Oke(e,t){return!t||(e??[]).some(e=>e.kind===ru.ENGINE_PAGE&&e.pageRef===ao.DECISIONS)?e:[...e??[],{kind:ru.ENGINE_PAGE,pageRef:ao.DECISIONS,runtimeAvailability:j7()}]}function N7(){return{kind:ru.RESOURCE_OPERATION,resourceType:Na.ORGANIZATION_REPRESENTATIONS,operation:W.LIST,runtimeAvailability:{requiredCapabilities:[Av.REPRESENTS]}}}function P7(e){return(e??[]).some(e=>e.kind===ru.RESOURCE_OPERATION&&e.resourceType===Na.ORGANIZATION_REPRESENTATIONS&&e.operation===W.LIST||P7(e.children))}function kke(e,t){if(t?.includes(vm.CLIENTS)||(e??[]).some(e=>e.contentKind===Le.NAVIGATION_LIST&&P7(e.children)))return e;let n=N7(),r=(e??[]).findIndex(e=>e.contentKind===Le.NAVIGATION_LIST&&e.isPrimary===!0);return r===-1?[{contentKind:Le.NAVIGATION_LIST,ref:A7,isPrimary:!0,children:[n]},...e??[]]:(e??[]).map((e,t)=>{if(t!==r)return e;let i=e,a=i.children.findIndex(e=>e.kind!==ru.ENGINE_PAGE||e.pageRef!==ao.DECISIONS),o=a===-1?i.children.length:a;return{...i,children:[...i.children.slice(0,o),n,...i.children.slice(o)]}})}function Ake(e,t){return t?.includes(vm.CLIENTS)||(e??[]).some(e=>e.kind===ru.RESOURCE_OPERATION&&e.resourceType===Na.ORGANIZATION_REPRESENTATIONS&&e.operation===W.LIST)?e:[...e??[],N7()]}var F7=Jo.getLogger(),I7=F7.debugByType(`SidebarBehavior`);F7.setDebugTypeLogging(`SidebarBehavior`,!1);var L7=[ci.MOBILE,ci.VERT_TABLET,ci.DESKTOP];function R7(e,t){return L7.indexOf(e)<=L7.indexOf(t)}function z7(e,t){if(e===!1||!t)return!1;let n=S2(e)?e:void 0;return(n?.policy??xu.BURGER)===xu.BURGER&&R7(t,n?.responsiveBreakpoint??ci.MOBILE)}function B7(){let{UIConfig:e,appComponentsConfiguration:t}=e_(),n=t?.[Fu.SIDEBAR];return n!==!1&&n!==void 0&&z7(n,e?.currentBreakpoint)}function jke(){let e=Fs(as.SIDEBAR_COLLAPSED);return e===null?null:e===`true`}function V7(e={}){let{placement:t=pl.START,isCollapsed:n,onToggleCollapse:r}=e,i=O7(),{isNavigationItemActive:a}=i,o=Q$(),s=lm(),c=jS(),{UIConfig:l,appComponentsConfiguration:u,sidebarCompactLabelMode:d,navigationLayout:f,suppressedEngineNavigationEntries:p}=e_(),{navigate:m,navigateToResource:h}=zS(),{registry:g}=wm(),_=u?.[Fu.SIDEBAR],v=_!==!1,y=l?.currentBreakpoint,{on:b}=vo(),x=_u().appConfig.decisionInbox,S=S2(_)?_.contentSections:void 0,C=(0,Q.useMemo)(()=>v?kke(Dke(S,x),p):S,[v,S,x,p]),w=S2(_)?_.defaultSection:void 0,T=(S2(_)?_.homeDisplayMode:void 0)??Bu.NAVIGATION_ITEM,E=M2({theme:S2(_)?_.brandMarkTheme:void 0}),D=T===Bu.BRAND_HEADER?E:void 0,O=(0,Q.useMemo)(()=>{let e=S2(_)?_.hostedComponents:void 0;return P2(Fu.SIDEBAR,e,u,y,Ma.TOP,f)},[_,u,y,f]),k=c.activeMode,A=c.availableModes,j=c.allScopeValues,M=(0,Q.useMemo)(()=>{if(!C)return;let e=f6(j,k,A);return Ole(d6(C,k,e,va.isDevelopment()),c)},[C,k,A,j,c]);(0,Q.useEffect)(()=>{if(!va.isDevelopment()||!C||!window.__WILDO_DEBUG_SIDEBAR__)return;let e=f6(j,k,A);p6(C,k,e)},[C,k,A,j]);let N=(0,Q.useRef)(jke()),P=S2(_)?_.defaultCollapsed:void 0,[F,I]=(0,Q.useState)(N.current),ee=F??P??!1,L=(0,Q.useCallback)(e=>{I(e),eo(as.SIDEBAR_COLLAPSED,String(e))},[]),R=n===void 0?ee:n,te=v&&z7(_,y),[z,B]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{te||B(!1)},[te]);let[ne,re]=(0,Q.useState)(()=>{try{let e=localStorage.getItem(as.SIDEBAR_SECTION_COLLAPSED);return e?JSON.parse(e):{}}catch{return{}}}),[ie,ae]=(0,Q.useState)({}),[oe,se]=(0,Q.useState)(null),[ce,le]=(0,Q.useState)(``),[ue,de]=(0,Q.useState)(()=>{try{let e=Fs(as.SIDEBAR_FAVORITES),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}});(0,Q.useEffect)(()=>{eo(as.SIDEBAR_FAVORITES,JSON.stringify(ue))},[ue]),(0,Q.useEffect)(()=>{try{localStorage.setItem(as.SIDEBAR_SECTION_COLLAPSED,JSON.stringify(ne))}catch{}},[ne]);let fe=(0,Q.useMemo)(()=>{let e=y===ci.MOBILE,t=S2(_)?_:void 0,n=d===Rn.ICON_AND_LABEL;return{width:e?t?.mobileWidth??280:t?.width??256,collapsedWidth:e?t?.mobileCollapsedWidth??(n?80:56):t?.collapsedWidth??(n?88:64)}},[y,_,d]),pe=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let e=S2(_)?_:void 0;if(e?.policy!==xu.DRAWER||!y)return;let t=e.responsiveBreakpoint??ci.MOBILE,r=R7(y,t),i=pe.current;pe.current=r,i===!0&&!r&&n===void 0&&L(!1)},[y,_,n,L]);let me=(0,Q.useMemo)(()=>!M||!o?[]:$m(M,o),[M,o]),he=(0,Q.useMemo)(()=>{let e=me.map((e,t)=>Mke(e,t)),t=new Map,n=e=>{for(let r of e)t.has(r.id)||t.set(r.id,r),r.children?.length&&n(r.children)};for(let t of e)t.contentKind===Le.NAVIGATION_LIST&&t.section.behavior!==tt.FAVORITES&&(n(t.items),n(t.moreMenuItems));let r=e.map(e=>{if(e.contentKind!==Le.NAVIGATION_LIST||e.section.behavior!==tt.FAVORITES)return e;let n=ue.map(e=>t.get(e)).filter(e=>e!==void 0).map(e=>({...e,id:`favorite-${e.id}`,favoriteId:e.id,children:void 0}));return{...e,items:n}}).filter(e=>e.contentKind!==Le.NAVIGATION_LIST||e.items.length>0||e.moreMenuItems.length>0||e.section.inlineCreate!==dc.NONE),i=e=>e.section.isPrimary?0:e.section.behavior===tt.FAVORITES?1:2;return r.map((e,t)=>({group:e,declaredIndex:t})).sort((e,t)=>i(e.group)-i(t.group)||e.declaredIndex-t.declaredIndex).map(e=>e.group)},[me,ue]),ge=(0,Q.useMemo)(()=>{let e=[],t=n=>{for(let r of n)r.urlPath&&e.push({id:r.id,urlPath:r.urlPath}),r.children?.length&&t(r.children)};for(let e of he)t(e.items),t(e.moreMenuItems);return e},[he]),_e=(0,Q.useMemo)(()=>Ch.getMostSpecificActiveRoute(ge.map(e=>e.urlPath),a),[ge,a]),ve=(0,Q.useMemo)(()=>{if(_e)return ge.find(e=>e.urlPath===_e)?.id},[ge,_e]),ye=(0,Q.useCallback)(e=>!!ve&&e.id===ve,[ve]),be=!te&&R,xe=(0,Q.useMemo)(()=>({isCollapsible:!S2(_)||_.collapsible!==!1,responsivePolicy:S2(_)?_.policy:xu.BURGER,currentWidth:be?fe.collapsedWidth:fe.width}),[_,be,fe]),Se=(0,Q.useCallback)(()=>{te?B(e=>!e):r?r():L(!R)},[te,R,r,L]),Ce=(0,Q.useCallback)(()=>{B(!1)},[]),we=(0,Q.useRef)(Se);we.current=Se,(0,Q.useEffect)(()=>{if(v)return b(hc.HOTKEY_SIDEBAR_TOGGLE,()=>{we.current()})},[b,v]);let Te=(0,Q.useCallback)((e,t)=>{re(n=>({...n,[e]:t}))},[]),Ee=(0,Q.useCallback)(e=>{if(!e.collapsible)return!1;let t=ne[e.ref];return t===void 0?w&&e.ref===w?!1:e.defaultCollapsed??!1:t},[ne,w]),De=(0,Q.useCallback)(e=>{ae(t=>({...t,[e]:!t[e]}))},[]),Oe=(0,Q.useCallback)(e=>{I7(`handleNavigationClick`,{itemId:e.id,itemLabel:e.label,urlPath:e.urlPath}),i.handleNavigationClick(e,Fu.SIDEBAR),te&&B(!1)},[i.handleNavigationClick,te]),ke=(0,Q.useCallback)(()=>{I7(`handleHomeClick: START`),i.handleHomeClick(),te&&B(!1),I7(`handleHomeClick: DONE`)},[i.handleHomeClick,te]),Ae=(0,Q.useCallback)(e=>{se(e),le(``)},[]),je=(0,Q.useCallback)(()=>{se(null),le(``)},[]),Me=(0,Q.useCallback)((e,t)=>{if(!t)return;let n=(S2(_)?_.contentSections:void 0)?.find(t=>t.ref===e),r=n?.contentKind===Le.NAVIGATION_LIST&&n.inlineCreate===dc.DIALOG;if(!r&&!ce.trim())return;let i=(n?.contentKind===Le.NAVIGATION_LIST?n.inlineCreateField:void 0)??`title`,a=g.resourceConfigurations[t],o=a?.operations?.find(e=>String(e.operationIdentifier)===W.CREATE);if(!a||!o)return;let c=gn.createFrontendResourceOperationContextFromOperation({resourceType:t,operation:o,contextResourceIdentifiers:s?.buildContextResourceIdentifiers()??{},...r?{}:{additionalContext:{defaultValuesOverride:{[i]:ce.trim()}}}});r?h(c,Ch.createAppLevelInitiator(Fu.SIDEBAR),void 0,ln.OVERLAY):(m({content:{contentType:hd.RESOURCE_OPERATION,resourceContext:c},initiator:Ch.createAppLevelInitiator(Fu.SIDEBAR)}),je())},[ce,m,h,je,_,g,s]),Ne=(0,Q.useCallback)(e=>ie[e]??!1,[ie]),Pe=(0,Q.useCallback)(e=>ue.includes(e.favoriteId??e.id),[ue]),Fe=(0,Q.useCallback)(e=>{let t=e.favoriteId??e.id;de(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},[]),Ie=(0,Q.useMemo)(()=>(M??[]).some(e=>e.contentKind===Le.NAVIGATION_LIST&&e.behavior===tt.FAVORITES),[M]);return{groupedSections:he,hostedComponents:O,isCollapsed:be,isHomeActive:i.isHomeActive,dimensions:fe,sidebarConfig:xe,isNavigationLoading:!o,hasItems:he.length>0||T===Bu.NAVIGATION_ITEM,placement:t,isMobileDrawerMode:te,isMobileDrawerOpen:z,closeMobileDrawer:Ce,homeDisplayMode:T,brandHeader:D,isNavigationItemActive:ye,isSectionCollapsed:Ee,isItemCollapsed:Ne,handleNavigationClick:Oe,handleHomeClick:ke,handleToggleCollapse:Se,handleSetSectionCollapsed:Te,handleToggleItemCollapse:De,isItemFavorite:Pe,handleToggleItemFavorite:Fe,hasFavoritesSection:Ie,inlineCreate:{activeSection:oe,value:ce,start:Ae,cancel:je,submit:Me,setValue:le}}}function Mke(e,t){let n={ref:e.ref,label:e.label,showLabel:e.showLabel!==!1,collapsible:e.collapsible??!1,defaultCollapsed:e.defaultCollapsed??!1,behavior:tt.STATIC,inlineCreate:dc.NONE,nested:!1,maxNestingDepth:1};switch(e.contentKind){case Le.NAVIGATION_LIST:{let t={...n,behavior:e.behavior??tt.STATIC,inlineCreate:e.inlineCreate??dc.NONE,inlineCreateResourceType:e.inlineCreateResourceType,nested:e.nested??!0,maxNestingDepth:e.maxNestingDepth??1,isPrimary:e.isPrimary??!1,...e.isPrimary?{showLabel:!1,collapsible:!1}:{}},r=H7(e.items.map(e=>U7(e)).filter(e=>e!==null),t.nested??!0,t.maxNestingDepth??1);return{section:t,items:r.filter(e=>e.displayPolicy!==kr.SECTION_MORE_MENU),moreMenuItems:r.filter(e=>e.displayPolicy===kr.SECTION_MORE_MENU),contentKind:Le.NAVIGATION_LIST}}case Le.RESOURCE_BROWSER:return{section:n,items:[],moreMenuItems:[],contentKind:Le.RESOURCE_BROWSER,resourceType:e.resourceType,operation:e.operation,operationVariant:e.operationVariant,navigateOperation:e.navigateOperation,navigateOperationVariant:e.navigateOperationVariant,instanceFilter:e.instanceFilter,onInstanceClick:e.onInstanceClick};case Le.GUIDANCE_WIDGET:return{section:n,items:[],moreMenuItems:[],contentKind:Le.GUIDANCE_WIDGET,guidanceRef:e.guidanceRef};case Le.CUSTOM_COMPONENT:return{section:n,items:[],moreMenuItems:[],contentKind:Le.CUSTOM_COMPONENT,componentRef:e.componentRef}}}function H7(e,t,n){let r=t?Math.max(1,Math.floor(n)):0,i=e=>e.flatMap(e=>[{...e,children:void 0},...i(e.children??[])]),a=(e,t)=>e.flatMap(e=>{let n=e.children??[];return n.length===0?[e]:t===0?[{...e,children:void 0},...i(n)]:[{...e,children:a(n,t-1)}]});return a(e,r)}function Nke(e,t){F7.warn(`Navigation item "${e.id}" ${t} — dropped from the sidebar`,{itemId:e.id,ref:e.ref,contentType:e.contentType})}function U7(e){let t={id:e.id,ref:e.ref,label:e.label,urlPath:e.urlPath,iconReference:e.iconReference,displayPolicy:e.displayPolicy,notificationBadgeRef:e.notificationBadgeRef,children:e.children?.map(U7).filter(e=>e!==null)};return e.operation&&e.resourceContext?(va.isDevelopment()&&(e.resourceType||console.warn(`[SidebarBehavior] Resource item "${e.id}" missing resourceType`),e.operationIdentifier||console.warn(`[SidebarBehavior] Resource item "${e.id}" missing operationIdentifier`)),{...t,itemType:aa.RESOURCE,resourceType:e.resourceType??``,operationIdentifier:e.operationIdentifier??``,operation:e.operation,resourceContext:e.resourceContext}):e.contentType===hd.ENGINE_PAGE?e.pageRef?{...t,itemType:aa.ENGINE_PAGE,pageRef:e.pageRef}:(Nke(e,"declares contentType ENGINE_PAGE with no `pageRef`"),null):e.contentType===hd.SETTINGS_HUB?{...t,itemType:aa.SETTINGS_HUB,sectionRef:e.sectionRef}:e.componentRef?{...t,itemType:aa.CUSTOM_COMPONENT,componentRef:e.componentRef,contextResourceIdentifiers:e.contextResourceIdentifiers}:{...t,itemType:aa.VIEW,viewRef:e.viewRef??e.ref,contentType:e.contentType??hd.COMPOSITE_VIEW,contextResourceIdentifiers:e.contextResourceIdentifiers,flowsActorsSystemRef:e.flowsActorsSystemRef,fullCustomComponentRef:e.fullCustomComponentRef,requiredFeatures:e.requiredFeatures}}function W7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function G7(e={}){let{mode:t}=e,{UIConfig:n,appComponentsConfiguration:r,navigationLayout:i,homeDefinition:a}=e_(),o=Q$(),{navigate:s}=zS(),c=jS(),{isNavigationItemActive:l,isHomeActive:u,handleHomeClick:d}=O7(),f=a?.compositeViewReference,p=r?.[Fu.MENUBAR],m=n?.currentBreakpoint,h=M2({theme:W7(p)?p.brandMarkTheme:void 0}),g=W7(p)&&p.brandHeader===!0?h:void 0,_=(0,Q.useMemo)(()=>W7(p)?P2(Fu.MENUBAR,p.hostedComponents,r,m,pl.START,i):[],[r,p,m,i]),v=(0,Q.useMemo)(()=>W7(p)?Ple(p.items,c):void 0,[p,c]);return{containerComponents:_,brandHeader:g,isHomeActive:u,handleHomeClick:d,items:(0,Q.useMemo)(()=>{if(!o||!v?.length)return[];let e=ch(void 0,v,o),t=Ch.getMostSpecificActiveRoute(e.items.map(e=>e.urlPath),l),n=e=>u&&f!==void 0&&e.viewRef===f;return e.items.map(e=>({id:e.id,label:e.label,iconReference:e.iconReference,group:e.group,isActive:t!==void 0&&e.urlPath===t||n(e),...e.notificationBadgeRef?{notificationBadgeRef:e.notificationBadgeRef}:{},onExecute:()=>{Ch.dispatchNavigationForResolvedTarget(s,e,Fu.MENUBAR)}}))},[v,o,s,l,u,f]),menubarConfig:(0,Q.useMemo)(()=>{let e=t||(W7(p)?p.displayPolicy??`FIXED`:typeof p==`string`?p:`FIXED`),n=e===`OVERLAY`;return{mode:e,isOverlay:n,showMobileLayout:m===ci.MOBILE&&n}},[p,t,m]),mapToFrontendComponentType:k2}}function K7(e,t){if(!e)return;let n=e.resourceConfigurations[t.resourceType];if(!n?.mainSchema)return;let r=V.resolveFieldShapeOfAnyVariant(n),i=r?.[t.fieldIdentifier];if(i)return{schema:i,isPrimaryKeyFallback:!1};if(t.fieldIdentifier!==n.resourceFieldIdentifier)return;let a=r?._id??r?.id;return a?{schema:a,isPrimaryKeyFallback:!0}:void 0}function q7(e={}){let t=lm(),{on:n}=vo(),{registry:r}=wm(),[i,a]=(0,Q.useState)(0),o=e.focusTrigger??i;(0,Q.useEffect)(()=>{if(e.focusTrigger===void 0)return n(hc.HOTKEY_QUICK_SWITCHER_OPEN,()=>{a(e=>e+1)})},[n,e.focusTrigger]);let s=qw({mode:`onChange`,defaultValues:t?.customScopeValues??{}}),c=(0,Q.useRef)(!1),l=(0,Q.useCallback)((e,t)=>e==null?t?[]:void 0:Array.isArray(e)?t?e:e[0]:t?[e]:e,[]),u=(0,Q.useMemo)(()=>t?.customScopeFields?[...t.customScopeFields].sort((e,t)=>(e.position??999)-(t.position??999)):[],[t?.customScopeFields]),d=(0,Q.useMemo)(()=>{let e=new Map;if(!r)return e;for(let t of u){let n=K7(r,t);n&&e.set(t.fieldIdentifier,n)}return e},[u,r]);(0,Q.useEffect)(()=>{if(t?.customScopeValues){c.current=!0;for(let e of t.customScopeFields){let n=e.fieldIdentifier,r=t.customScopeValues[n],i=s.getValues(n),a=d.get(n)?.schema,o=a?sc(a)===bc.ARRAY:Array.isArray(r),c=l(r??null,o);JSON.stringify(i)!==JSON.stringify(c)&&s.setValue(n,c)}queueMicrotask(()=>{c.current=!1})}},[t?.customScopeValues,t?.customScopeFields,s,l,d]);let f=(0,Q.useMemo)(()=>{let e=new Set;for(let t of u)e.add(t.resourceType);return Array.from(e)},[u]),{tResourceHeader:p}=K({component:J.APPLICATION_LEVEL_QUICK_SWITCHER,resource:f}),m=(0,Q.useMemo)(()=>u.map(e=>e.fieldIdentifier),[u]),h=ew({control:s.control,name:m});(0,Q.useEffect)(()=>{c.current||m.forEach((e,n)=>{let r=h[n],i=t?.customScopeValues[e],a=d.get(e)?.schema,o=a?sc(a)===bc.ARRAY:!1,s;if(r===void 0||r===``||r===null)s=null;else if(o){let e=Array.isArray(r)?r.filter(e=>typeof e==`string`&&e.length>0):[String(r)];s=e.length>0?e:null}else s=Array.isArray(r)?r[0]??null:String(r);JSON.stringify(s)!==JSON.stringify(i??null)&&t?.setScopeValue(e,s,{initiator:wt.USER_SELECTION})})},[h,m,t,u,d]);let g=(0,Q.useCallback)(e=>{let n=e.dependsOn?t?.allScopeValues?.[e.dependsOn]:null;return e.dependsOn?Array.isArray(n)?n.length===0:!n:!1},[t?.allScopeValues]);return{fields:(0,Q.useMemo)(()=>u.flatMap(e=>{let t=e.fieldIdentifier,n=d.get(t);if(!n)return va.isDevelopment()&&console.warn(`[QuickSwitcher] No schema found for scope field "${t}" — field will not render.`),[];let{schema:r,isPrimaryKeyFallback:i}=n,a=sc(r)===bc.ARRAY,o=a?te(r)??r:r,c=sc(o),l=y(o)||i?T2.RESOURCE_REFERENCE:c===bc.ENUM?T2.ENUM:T2.RAW,u=p(e.resourceType,`title`),f=e.label||u||t;return[{fieldId:t,label:f,schema:r,valueSchema:o,disabled:g(e),isMultiple:a,controlKind:l,targetResourceType:i?e.resourceType:void 0,placeholder:u||f,optionDisplayMode:e.optionDisplayMode??Qr,presentation:e.presentation??om.CONTROL_ONLY,onClear:()=>s.setValue(t,a?[]:void 0,{shouldDirty:!0,shouldTouch:!0}),hasValue:(()=>{let e=s.getValues(t);return Array.isArray(e)?e.length>0:e!=null&&e!==``})(),definition:e}]}),[u,d,p,g,s,h]),formMethods:s,layoutDirection:(0,Q.useMemo)(()=>e.containerType===Fu.SIDEBAR?`vertical`:`horizontal`,[e.containerType]),focusTrigger:o}}function J7(e=Ma.BOTTOM){let{UIConfig:t,appComponentsConfiguration:n,shellAppearance:r}=e_(),{tComponent:i}=K({component:J.APPLICATION_LEVEL_STATUS_BAR}),{status:a}=Sp(),{notifications:o}=qm(),s=n?.[Fu.STATUS_BAR],c=t?.currentBreakpoint,l=C2(s)?s:void 0,u=l?.showConnectionStatus??!0,d=l?.showConnectionStatusOnMobile??!1,f=l?.showNotificationCount??!0,p=l?.showMemoryUsage??!1,m=(0,Q.useMemo)(()=>f?o.length:0,[f,o.length]),h=(0,Q.useMemo)(()=>(l?.statusItems??[]).map(e=>{let t=e.value==null?void 0:String(e.value);switch(e.type){case Zr.LINK:return{id:e.id,label:e.label,iconReference:e.icon,valueText:t,interaction:{type:E2.LINK,href:e.href}};case Zr.BUTTON:return{id:e.id,label:e.label,iconReference:e.icon,valueText:t,interaction:{type:E2.BUTTON,onClick:e.onClick}};case Zr.TEXT:default:return{id:e.id,label:e.label,iconReference:e.icon,valueText:t,interaction:{type:E2.STATIC}}}}),[l]),g=(0,Q.useMemo)(()=>{if(!l)return;let{backgroundClassName:e,textClassName:t,style:n}=l;if(e!==void 0||t!==void 0||n!==void 0)return{backgroundClassName:e,textClassName:t,style:n}},[l]),_=(0,Q.useMemo)(()=>{let e=c===ci.MOBILE;return{height:l?.height??(e?28:32)}},[c,l]),v=(0,Q.useMemo)(()=>{let t=e===Ma.TOP,n=e===Ma.BOTTOM,i=c===ci.MOBILE,a=r===At.CONTINUOUS;return{isTop:t,isBottom:n,isMobile:i,isContinuousShell:a,showBorder:l?.showBorder??!a}},[e,c,l,r]),y=(0,Q.useMemo)(()=>{let e=c===ci.MOBILE;return u&&(!e||d)},[c,u,d]),b=f&&m>0,x=(0,Q.useMemo)(()=>!p||typeof performance>`u`||!(`memory`in performance)?null:`${Math.round((performance.memory?.usedJSHeapSize??0)/1048576)}MB`,[p]),S=(0,Q.useMemo)(()=>vn(m),[m]);return{totalBadgeCount:m,connectionStatus:a,showConnectionStatus:u,showConnectionStatusOnMobile:d,shouldShowConnectionStatus:y,showNotificationCount:f,shouldShowNotificationCount:b,showMemoryUsage:p,memoryUsageLabel:x,notificationCountLabel:S,notificationCountAriaLabel:(0,Q.useMemo)(()=>i(J.APPLICATION_LEVEL_STATUS_BAR,`notificationCount`,{count:S}),[S,i]),connectionStatusLabel:(0,Q.useMemo)(()=>{switch(a){case dm.CONNECTED:return i(J.APPLICATION_LEVEL_STATUS_BAR,`connected`);case dm.CONNECTING:case dm.RECONNECTING:return i(J.APPLICATION_LEVEL_STATUS_BAR,`reconnecting`);case dm.DISCONNECTED:case dm.ERROR:default:return i(J.APPLICATION_LEVEL_STATUS_BAR,`disconnected`)}},[a,i]),statusItems:h,dimensions:_,statusBarConfig:v,authoredAppearance:g,currentBreakpoint:c}}function Pke(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Y7(){let{UIConfig:e,appComponentsConfiguration:t}=e_(),n=Q$(),{navigate:r}=zS(),i=jS(),a=t?.[Fu.TOOLBAR],o=e?.currentBreakpoint,s=o===ci.MOBILE,c=Pke(a)?a:void 0,l=(0,Q.useMemo)(()=>jle(c?.tools,i),[c?.tools,i]),u=(0,Q.useMemo)(()=>!l?.length||!n?[]:nh(l,n),[l,n]),d=(0,Q.useMemo)(()=>u.map(e=>({id:e.id,label:e.label,iconReference:e.iconReference,iconOnly:e.iconOnly,onClick:()=>Ch.dispatchNavigationForResolvedTarget(r,e,Fu.TOOLBAR)})),[u,r]),f=(0,Q.useMemo)(()=>({placement:c?.placement??`top`,compact:c?.compact??!1,showSeparator:c?.showSeparator??!0,hideOnMobile:c?.hideOnMobile??!1}),[c]);return{tools:d,toolbarConfig:f,shouldRender:d.length>0&&!(s&&f.hideOnMobile),currentBreakpoint:o}}function X7(e){return wo.isRegistered(e,q.DEFAULT)}function Z7(e,t,n=X7){return e.map(e=>{if(e.kind===ru.VIEW){let n=t.includes(e.viewRef);return!n&&typeof console<`u`&&console.warn(`[utility-panel] item "${e.label}" names viewRef "${e.viewRef}", which no declared application-scoped view carries. Declare it in the application's \`flowsActorsViews\`, or the panel has nothing to host for this item.`),{kind:ru.VIEW,viewRef:e.viewRef,resolvedViewRef:n?e.viewRef:null,icon:e.icon,label:e.label}}let r=n(e.componentRef);return!r&&typeof console<`u`&&console.warn(`[utility-panel] item "${e.label}" names componentRef "${e.componentRef}", which has no component registered under the default preset. Register it — an application component through its domain module's \`componentRegistrations\`, an engine one through its preset — or nothing will render for this item.`),{kind:ru.CUSTOM_COMPONENT,componentRef:e.componentRef,resolvedComponentRef:r?e.componentRef:null,icon:e.icon,label:e.label}})}function Q7(e){if(e)return or.map(t=>`${t}:${e.zones[t].stack.map(e=>e.id).join(`,`)}#${e.zones[t].activeTabId??``}`).join(`|`)}function $7(e=pl.END,t){let{UIConfig:n,appComponentsConfiguration:r,flowsActorsViews:i}=e_(),[a,o]=(0,Q.useState)(!1),s=Q7((0,Q.useContext)(Eh)?.state),c=(0,Q.useRef)(void 0);(0,Q.useEffect)(()=>{a?c.current===void 0?c.current=s:s!==c.current&&o(!1):c.current=void 0},[a,s]);let l=n?.currentBreakpoint,u=r?.[Fu.UTILITY_PANEL],d=w2(u)?u:void 0,f=(0,Q.useMemo)(()=>Z7(t??d?.items??[],i?.map(e=>e.ref)??[]),[d,t,i]),p=(0,Q.useMemo)(()=>d?.position??e,[d,e]),m=f.length===1?f[0]:void 0,h=m?.kind===ru.VIEW?lX(m.viewRef):void 0,g=(0,Q.useMemo)(()=>h?[cX({family:Ln.FLOWS_ACTORS,translationRef:h})]:[],[h]),{tComponent:_,tView:v,isReady:y}=K({component:J.APPLICATION_LEVEL_UTILITY_PANEL,keys:g}),b=h?v(Ln.FLOWS_ACTORS,h,`title`):m?.kind===ru.CUSTOM_COMPONENT?m.label:jp({tComponent:_,componentType:J.APPLICATION_LEVEL_UTILITY_PANEL,key:`title`}),x=d?.icon??(f.length===1?f[0].icon:void 0);return{isOpen:a,setIsOpen:o,items:f,itemCount:f.length,position:p,triggerIcon:x,panelName:b,isPanelNameReady:y,currentBreakpoint:l}}function Fke(e,t){let n=Number(e);return Number.isFinite(n)?n:t}function e9(e=pl.END,t=[]){let{UIConfig:n,appComponentsConfiguration:r}=e_(),i=Q$(),{navigate:a}=zS(),{tComponent:o}=K({component:J.APPLICATION_LEVEL_CONTROL_PANEL}),s=jS(),[c,l]=(0,Q.useState)(!1),u=n?.currentBreakpoint,d=r?.[Fu.CONTROL_PANEL],f=typeof d==`object`&&d?d.items:void 0,p=(0,Q.useMemo)(()=>Mle(f,s),[f,s]),m=(0,Q.useMemo)(()=>!p||!i?[]:Km(p,i),[p,i]),h=(0,Q.useMemo)(()=>{let e={uncategorized:[]};for(let t of m){let n=t.section??`uncategorized`;e[n]||(e[n]=[]),e[n].push(t)}return e},[m]),g=(0,Q.useMemo)(()=>t.map(e=>{let t=!e.onChange;switch(e.type){case D2.BUTTON:return{id:e.id,label:e.label,type:D2.BUTTON,disabled:t,onTrigger:()=>e.onChange?.(!0)};case D2.TOGGLE:{let n=e.value===!0;return{id:e.id,label:e.label,type:D2.TOGGLE,disabled:t,value:n,onToggle:()=>e.onChange?.(!n)}}case D2.SELECT:return{id:e.id,label:e.label,type:D2.SELECT,disabled:t,value:e.value,options:(e.options??[]).map(t=>({label:t.label,value:t.value,isSelected:e.value===t.value,onSelect:()=>e.onChange?.(t.value)}))};case D2.SLIDER:{let n=e.min??0,r=e.max??100,i=e.step??1,a=Fke(e.value,n);return{id:e.id,label:e.label,type:D2.SLIDER,disabled:t,value:a,min:n,max:r,step:i,onValueChange:t=>e.onChange?.(t)}}}}),[t]);return{isOpen:c,setIsOpen:l,groupedItems:h,sections:(0,Q.useMemo)(()=>Object.entries(h).filter(([,e])=>e.length>0).map(([e,t])=>({id:e,label:e===`uncategorized`?o(J.APPLICATION_LEVEL_CONTROL_PANEL,`actions`):o(J.APPLICATION_LEVEL_CONTROL_PANEL,e),items:t})),[h,o]),controls:g,handleItemClick:(0,Q.useCallback)(e=>{l(!1),Ch.dispatchNavigationForResolvedTarget(a,e,Fu.CONTROL_PANEL)},[a]),sheetSide:(0,Q.useMemo)(()=>{let t=e;return t===pl.START?Ea.START:t===pl.END?Ea.END:t===Ma.TOP?Ea.TOP:t===Ma.BOTTOM?Ea.BOTTOM:Ea.END},[e]),isNavigationLoading:!i,navigationItemCount:m.length,currentBreakpoint:u}}function t9(e,t,n,r){let i=J.APPLICATION_LEVEL_NOTIFICATION_CENTER,a=e(i,t,r);return a===`components.${i}.${t}`?n??a:a}function Ike(e,t,n,r){let i=t-e,a=Math.floor(i/6e4),o=Math.floor(i/36e5),s=Math.floor(i/864e5);return a<1?t9(n,`timeJustNow`):a<60?t9(n,`timeMinutesAgo`,void 0,{count:a}):o<24?t9(n,`timeHoursAgo`,void 0,{count:o}):s<7?t9(n,`timeDaysAgo`,void 0,{count:s}):r(e)}function Lke(e){switch(e){case`success`:return H.CHECK_CIRCLE;case`warning`:return H.WARNING;case`error`:return H.X_CIRCLE;default:return H.INFO}}function n9(e,t,n={}){let{notifications:r,clearAll:i,removeNotification:a}=qm(),{on:o}=vo(),{tComponent:s,formatDate:c}=K({component:J.APPLICATION_LEVEL_NOTIFICATION_CENTER}),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(()=>Date.now()),p=n.listenForHotkeys!==!1,m=e!==void 0&&t!==void 0,h=m?e:l,g=(0,Q.useRef)(h);g.current=h;let _=(0,Q.useCallback)(e=>{m&&t?t(e):u(e)},[m,t]);(0,Q.useEffect)(()=>{if(p)return o(hc.HOTKEY_NOTIFICATIONS_OPEN,()=>{_(!g.current)})},[o,p,_]),(0,Q.useEffect)(()=>{let e=globalThis.setInterval(()=>{f(Date.now())},6e4);return()=>globalThis.clearInterval(e)},[]);let v=(0,Q.useMemo)(()=>r.map(e=>{let t=``,n=e.message;return e.source===`resource`&&e.resourceContext?(t=t9(s,`resourceNotificationTitle`,e.resourceContext.resourceType,{resourceType:e.resourceContext.resourceType}),n||=t9(s,`resourceNotificationMessage`,e.resourceContext.operationIdentifier,{operation:e.resourceContext.operationIdentifier})):e.source===`custom`&&e.identifier&&(t=``),!t&&n&&(t=n,n=``),!t&&e.identifier&&(t=e.identifier),t||=s(J.APPLICATION_LEVEL_NOTIFICATION_CENTER,`title`),{id:e.id,type:e.type,source:e.source,timestamp:e.timestamp,displayTitle:t,displayMessage:n,relativeTimeLabel:Ike(e.timestamp,d,s,c),iconReference:Lke(e.type),nextStep:e.nextStep}}),[r,s,d,c]),y=(0,Q.useCallback)(e=>{a(e)},[a]);return{isOpen:h,setIsOpen:_,sessionNotifications:v,notificationCount:r.length,handleClearAll:i,dismissNotification:y}}var Rke=[ud.NAVIGATION,ud.ACTIONS],r9=0,zke=1e3,Bke=300,Vke=2,Hke=5,i9=Jo.getLogger(),Uke={[W.CREATE]:`keywordsCreate`,[W.CREATE_MANY]:`keywordsCreate`,[W.LIST]:`keywordsList`,[W.SEARCH]:`keywordsSearch`,[W.READ]:`keywordsRead`,[W.UPDATE]:`keywordsUpdate`,[W.UPDATE_MANY]:`keywordsUpdate`,[W.DELETE]:`keywordsDelete`,[W.DELETE_MANY]:`keywordsDelete`};function a9(e,t){let n=J.APPLICATION_LEVEL_COMMAND_MENU,r=`components.${n}.${t}`,i=e(n,t);return!i||i===r?[]:i.split(`,`).map(e=>e.trim()).filter(Boolean)}function Wke(e,t){if(!t)return[];let n=ul(t),r=n?Uke[n]:void 0;return r?a9(e,r):[]}function o9(e,t,n){return mre(n)?t(J.APPLICATION_LEVEL_COMMAND_MENU,n):e(`${Ji.COMMAND_CATEGORIES}.${n}.label`)}function s9(e,t,n){return n.category===void 0?e(`${Ji.RESOURCES}.${n.resourceType}.header.title`):o9(e,t,n.category)}function Gke(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function c9(e,t,n={}){let r=Q$(),{navigate:i,navigateToResource:a}=zS(),{registry:o,doOperation:s}=wm(),c=lm(),{appComponentsConfiguration:l,suppressedEngineNavigationEntries:u}=e_(),{on:d,emit:f}=vo(),{register:p}=J$(),{t:m,tComponent:h,formatDate:g,formatDateTime:_}=K({component:J.APPLICATION_LEVEL_COMMAND_MENU}),v=l?.[Fu.COMMAND_MENU],y=Gke(v)?v:void 0,b=y?.openShortcut,x=y?.showRecent!==!1,S=y?.maxRecentItems??5,C=y?.showShortcuts!==!1,w=y?.defaultCategory??ud.NAVIGATION,T=y?.categoryOrder??Rke,E=y?.policy===Am.OMNIBOX,D=y?.searchResources,O=y?.dialogWidth,k=jS(),A=(0,Q.useContext)(Mi)?.appConfig?.decisionInbox,M=(0,Q.useMemo)(()=>kle(Ake(Oke(y?.commands,A),u),k),[y?.commands,A,u,k]),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(``),[ee,R]=(0,Q.useState)([]),te=e!==void 0&&t!==void 0,z=te?e:N,B=(0,Q.useRef)(z);B.current=z;let ne=n.listenForHotkeys!==!1,re=(0,Q.useCallback)(e=>{te&&t?t(e):P(e),e||I(``)},[te,t]);(0,Q.useEffect)(()=>{if(ne)return d(hc.HOTKEY_COMMAND_MENU_OPEN,()=>{re(!B.current)})},[d,re,ne]),(0,Q.useEffect)(()=>{if(ne&&b&&v!==!1)return p({id:`app-command-menu-open-shortcut`,shortcut:b,description:m(`engine.hotkeys.commandMenuOpen`),scope:L.GLOBAL,group:vc.NAVIGATION,launcher:Fu.COMMAND_MENU,preventDefault:!0,handler:()=>{f(hc.HOTKEY_COMMAND_MENU_OPEN,{})}})},[b,v,p,f,m,ne]);let ie=(0,Q.useMemo)(()=>!M||!r?[]:Yh(M,r),[M,r]),ae=(0,Q.useMemo)(()=>ie.filter(e=>{let t=e.displayPolicy;return t===void 0||t===mt.ALWAYS?!0:t===mt.NEVER?!1:t===mt.RECENT?!0:t===mt.CONTEXTUAL?(va.isDevelopment()&&console.warn(`[CommandMenu] CONTEXTUAL displayPolicy requires a contextual source and is excluded from the global app-level menu for "${e.id}"`),!1):(va.isDevelopment()&&console.warn(`[CommandMenu] Unknown displayPolicy "${t}" for command "${e.id}" — treating as ALWAYS`),!0)}).map(e=>({id:e.id,label:e.label,shortcut:e.shortcut??``,iconReference:e.iconReference,category:e.category??w,keywords:[...Wke(h,e.operation),...e.searchKeywords??[]],displayPolicy:e.displayPolicy,onExecute:()=>{re(!1),R(t=>[e.id,...t.filter(t=>t!==e.id)].slice(0,S)),e.urlPath&&Ch.dispatchNavigationForResolvedTarget(i,e,Fu.COMMAND_MENU)}})),[ie,re,i,S,w,h]),oe=(0,Q.useMemo)(()=>{let e=new Map;for(let t of ae){if(t.displayPolicy===mt.RECENT)continue;let n=t.category,r=e.get(n)??[];r.push(t),e.set(n,r)}for(let t of e.values())t.sort((e,t)=>e.label.localeCompare(t.label));let t=[];for(let n of T){let r=e.get(n);r&&(t.push({category:n,label:o9(m,h,n),items:r}),e.delete(n))}for(let[n,r]of e.entries())t.push({category:n,label:o9(m,h,n),items:r});return t},[ae,T,m,h]),se=(0,Q.useMemo)(()=>{if(ee.length===0)return[];let e=new Map(ae.map(e=>[e.id,e]));return ee.map(t=>e.get(t)).filter(Boolean)},[ae,ee]),[ce,le]=(0,Q.useState)([]),[ue,de]=(0,Q.useState)(!1),fe=(0,Q.useRef)(s);fe.current=s;let pe=(0,Q.useRef)(o);pe.current=o;let me=(0,Q.useRef)(c);me.current=c;let he=(0,Q.useRef)(a);he.current=a;let ge=(0,Q.useRef)(re);ge.current=re;let _e=(0,Q.useRef)(m);_e.current=m;let ve=(0,Q.useRef)(g);ve.current=g;let ye=(0,Q.useRef)(_);ye.current=_;let be=(0,Q.useRef)(h);be.current=h;let xe=(0,Q.useRef)(D);xe.current=D;let Se=(0,Q.useRef)(null),Ce=(0,Q.useCallback)(e=>{let t=me.current,n=pm.buildInitiatorIds({userId:t?.currentUserId,organizationId:t?.currentOrganizationId,applicationId:t?.currentApplicationId,anonymousUserId:t?.currentAnonymousUserId});return{...pm.primaryScopeToContextIdentifiers(n,e),...t?.buildContextResourceIdentifiers()??{}}},[]),we=(0,Q.useCallback)((e,t)=>{let n=pe.current,r=n.resourceConfigurations[e];if(!r)return;let i=Il(r.operations??[],W.READ);if(!i){i9.warn(`[CommandMenu] Omnibox result has no addressable READ operation`,{resourceType:e,recordId:t});return}let a=l9({scopeIdentifiers:Ce(r.resourcePrimaryScope),resourceType:e,recordId:t,registry:n}),o=gn.buildParentResourcesRequirements(e,a,n),s=gn.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:i,contextResourceIdentifiers:a,parentResourcesRequirements:o});ge.current(!1),he.current(s,Ch.createAppLevelInitiator(Fu.COMMAND_MENU))},[Ce]),Te=(0,Q.useMemo)(()=>JSON.stringify(D??[]),[D]),Ee=E&&!!D&&D.length>0;(0,Q.useEffect)(()=>{if(Se.current&&=(clearTimeout(Se.current),null),!z||!Ee||F.trim().length<Vke){le([]),de(!1);return}let e=!1,t=F.trim();de(!0);let n=async()=>{let n=pe.current,r=xe.current??[],i=await Promise.all(r.map(async e=>{let r=n.resourceConfigurations[e.resourceType];if(!r)return i9.warn(`[CommandMenu] Omnibox searchResource not in registry — skipped`,{resourceType:e.resourceType}),null;let i;try{i=V.buildForeignKeySearchOperationPath(e.resourceType,n)}catch{return i9.warn(`[CommandMenu] Omnibox resource has no searchable SEARCH/LIST operation — skipped`,{resourceType:e.resourceType}),null}let a=V.buildForeignKeySearchParams(t,e.maxResults??Hke,{resourceType:e.resourceType,registry:n}),o;try{o=await fe.current(i,{contextualParameters:Ce(r.resourcePrimaryScope),queryParameters:a.queryParameters,dataMode:a.dataMode})}catch(t){return i9.error(`[CommandMenu] Omnibox search failed`,{resourceType:e.resourceType,...j(t),error:t}),null}let s=[];if(Array.isArray(o))s=o;else if(o&&typeof o==`object`){let e=o;s=e.data??e.items??[]}if(s.length===0)return null;let c=V.getResourceFieldIdentifierForType(e.resourceType,n),l=e.category??e.resourceType,u=e.resultDisplay===qa.LABEL||e.resultDisplay===qa.ID?qa.LABEL:qa.SUMMARY,d=[t,...a9(be.current,`keywordsSearch`),...e.searchKeywords??[]],f=s.flatMap(t=>{let r=V.getResourceObjectId(t,c);if(!r)return[];let i=V.computeFrontendResourceLabel({resourceType:e.resourceType,registry:n,currentObject:t,t:_e.current,formatDate:ve.current,formatDateTime:ye.current})??r;return[{id:`omnibox:${e.resourceType}:${r}`,resourceType:e.resourceType,record:t,label:i,keywords:d,onExecute:()=>we(e.resourceType,r)}]});return f.length===0?null:{category:l,label:s9(_e.current,be.current,e),displayMode:u,items:f}}));e||(le(i.filter(e=>e!==null)),de(!1))};return Se.current=setTimeout(()=>{n()},Bke),()=>{e=!0,Se.current&&=(clearTimeout(Se.current),null)}},[z,F,Ee,Te,Ce,we]);let De=(0,Q.useMemo)(()=>{let e=new Map;return(D??[]).forEach((t,n)=>{let r=t.category??t.resourceType;e.set(r,t.order??r9+n)}),e},[D]),Oe=(0,Q.useMemo)(()=>{let e=new Map;for(let t of D??[])e.set(t.category??t.resourceType,t);return e},[D]),ke=(0,Q.useMemo)(()=>ce.map(e=>{let t=Oe.get(e.category);return t?{...e,label:s9(m,h,t)}:e}),[ce,Oe,m,h]);return{isOpen:z,handleOpenChange:re,searchQuery:F,setSearchQuery:I,commandItems:ae,groupedItems:oe,recentItems:se,searchResultGroups:ke,orderedGroups:(0,Q.useMemo)(()=>{let e=[];return ke.forEach((t,n)=>{e.push({kind:O2.RECORDS,order:De.get(t.category)??r9+n,group:t})}),oe.forEach((t,n)=>{e.push({kind:O2.COMMANDS,order:zke+n,group:t})}),e.map((e,t)=>({entry:e,index:t})).sort((e,t)=>e.entry.order-t.entry.order||e.index-t.index).map(({entry:e})=>e)},[ke,oe,De]),isSearching:ue,isNavigationLoading:!r,showRecent:x,showShortcuts:C,openShortcut:b,authoredDialogWidth:O}}function l9(e){return{...Zm({hostIdentifiers:e.scopeIdentifiers,hostContextualParameters:{},targetResourceType:e.resourceType,targetId:e.recordId,registry:e.registry}).identifiers,[e.resourceType]:e.recordId}}function Kke(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function u9(){let{UIConfig:e,appComponentsConfiguration:t}=e_(),n=Q$(),{navigate:r}=zS(),i=jS(),a=t?.[Fu.QUICK_ACTION_BUTTON],o=Kke(a)?a:void 0,s=(0,Q.useMemo)(()=>Ale(o?.actions,i),[o?.actions,i]),c=(0,Q.useMemo)(()=>!s?.length||!n?[]:fh(s,n),[s,n]),l=(0,Q.useMemo)(()=>c.map(e=>({id:e.id,label:e.label,iconReference:e.iconReference,displayPolicy:e.displayPolicy,onClick:()=>Ch.dispatchNavigationForResolvedTarget(r,e,Fu.QUICK_ACTION_BUTTON)})),[c,r]),{primaryAction:u,menuActions:d}=(0,Q.useMemo)(()=>({primaryAction:l.find(e=>e.displayPolicy===cc.PRIMARY)??null,menuActions:l.filter(e=>e.displayPolicy!==cc.PRIMARY)}),[l]),[f,p]=(0,Q.useState)(!1);return{allItems:l,primaryAction:u,menuActions:d,isOpen:f,setIsOpen:p,handleActionClick:(0,Q.useCallback)(e=>{p(!1),e.onClick()},[]),hasActions:!!s?.length,isNavigationLoading:!!s?.length&&n===null,currentBreakpoint:e?.currentBreakpoint}}function qke(e){let{registry:t,doOperation:n}=wm(),r=(0,Q.useRef)(n);r.current=n;let i=(0,Q.useRef)(t);i.current=t;let[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(0),m=(0,Q.useMemo)(()=>{let e=t?.resourceConfigurations?.[Na.ORGANIZATIONS]?.operations.find(e=>e.operationIdentifier===W.SEARCH&&e.variantType===Ya.API_CALL&&e.variantKey===qee.MINE);return e?gl.buildOperationPathKeyFromOperation(e):null},[t]),h=a.trim(),g=e&&m!==null&&h.length>=2;return(0,Q.useEffect)(()=>{e||o(``)},[e]),(0,Q.useEffect)(()=>{if(!g||!m){p.current+=1,c(null),u(!1),f(!1);return}let e=++p.current;u(!0);let t=setTimeout(()=>{(async()=>{try{let t=V.buildForeignKeySearchParams(h,20,{resourceType:Na.ORGANIZATIONS,registry:i.current}),n=await r.current(m,{contextualParameters:{},queryParameters:t.queryParameters,dataMode:t.dataMode});if(p.current!==e)return;let a=Array.isArray(n)?n:n?.data??n?.items??[];c(a.filter(e=>!!e&&e._id!==void 0&&e._id!==null&&typeof e.name==`string`).map(e=>({_id:String(e._id),name:e.name}))),f(!1)}catch(t){if(p.current!==e)return;Jo.getLogger().warn(`[OrganizationSwitcher] Searching the person's own organizations failed`,{error:t}),c([]),f(!0)}finally{p.current===e&&u(!1)}})()},300);return()=>clearTimeout(t)},[g,m,h]),{query:a,setQuery:o,results:s,isSearching:l,failed:d}}function Jke(e){let{httpClient:t}=_u(),[n,r]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{if(!e){r(null);return}let n=!1,i=null,a=new AbortController;return t.fetchFileBlob(e,{signal:a.signal}).then(e=>{n||(i=URL.createObjectURL(e),r(i))}).catch(()=>{n||r(null)}),()=>{n=!0,a.abort(),i&&URL.revokeObjectURL(i)}},[e,t]),n}var d9=Object.freeze([]);function Yke(e){return typeof e==`object`&&!!e}var f9=[yp.USER_INFO,yp.ORG_SWITCHER,yp.SETTINGS,yp.LOGOUT];function p9(e,t){let{appComponentsConfiguration:n}=e_(),{user:r,organizations:i,getCurrentOrganization:a,setCurrentOrganization:o,logout:s,isAuthenticated:c,permissions:l}=Cg(),{registry:u}=wm(),d=Q$(),f=vh(),p=jS(),[m,h]=(0,Q.useState)(!1),g=n?.[Fu.USER_DROPDOWN],_=(0,Q.useMemo)(()=>{let e=Yke(g)?g:void 0;if(e)return{avatarDisplay:e.avatarDisplay??Jp.AVATAR_ONLY,sections:e.sections??f9,showOrgSwitcher:e.showOrgSwitcher??!0,showLogout:e.showLogout??!0,settingsEntries:e.settingsEntries??d9}},[g]),v=a(),y=_?.sections??f9,b=_?.avatarDisplay??Jp.AVATAR_ONLY,x=_?.showOrgSwitcher!==!1,S=_?.showLogout!==!1,C=_?.settingsEntries??d9;p.activeMode,p.availableModes,p.allScopeValues;let w=(0,Q.useMemo)(()=>e===Fu.MENUBAR?t===pl.END?{align:Qu.END,side:Ea.BOTTOM}:{align:Qu.START,side:Ea.BOTTOM}:e===Fu.SIDEBAR?t===Ma.BOTTOM?{align:Qu.END,side:Ea.END}:{align:Qu.START,side:Ea.END}:{align:Qu.END,side:Ea.BOTTOM},[e,t]),T=(0,Q.useMemo)(()=>d?C.flatMap(e=>{let t=oh({kind:ru.SETTINGS_SECTION,sectionRef:e},d);return t?[t]:[]}):[],[d,C]),E=(0,Q.useMemo)(()=>d?oh({kind:ru.SETTINGS_SECTION},d):null,[d]),D=r?.userSelfProfile,O=(0,Q.useMemo)(()=>{if(!D)return r?.email?.charAt(0).toUpperCase()||`?`;let e=D.firstName??``,t=D.lastName??``;return`${e.charAt(0)}${t.charAt(0)}`.toUpperCase()||r?.email?.charAt(0).toUpperCase()||`?`},[r,D]),k=(0,Q.useMemo)(()=>r?D?.firstName&&D?.lastName?`${D.firstName} ${D.lastName}`:r.email??``:``,[r,D]),A=(0,Q.useMemo)(()=>{let e=new Set((i??[]).map(e=>String(e._id)));return Kh(l?.accessProfile).filter(t=>!e.has(t)).length},[i,l?.accessProfile]),j=qke(m&&A>0),M=(0,Q.useCallback)(()=>{h(!1),s()},[s]),N=(0,Q.useCallback)(e=>{h(!1),o(e)},[o]),P=(0,Q.useCallback)(e=>{h(!1),f(e.urlPath||Cn.settings)},[f]),F=D?.avatar,I=Jke((0,Q.useMemo)(()=>{let e=String(D?.userId??r?._id??``),t=String(D?._id??``),n=F?.fileId;if(!u||!e||!t||!n)return null;let i=u.resourceConfigurations?.[Na.USER_SELF_PROFILES],a=V.resolveSingleResourceReadOperation(Na.USER_SELF_PROFILES,u);if(!i||!a)return null;let o={[Na.USER_SELF]:e},s=aH({registry:u,resourceConfig:i,operation:a,resourceType:Na.USER_SELF_PROFILES,fieldName:`avatar`,recordId:t,contextResourceIdentifiers:o,contextualParameters:V.buildContextualParameters(o,u),apiBaseUrl:va.getApiUrl()});return s?sH(`${s}/${encodeURIComponent(n)}`):null},[u,r,D,F?.fileId]))??void 0,ee=r?.email??``,L=(0,Q.useMemo)(()=>{let e=new Map;for(let t of r?.organizationMembers??[]){if(!Wie(t))continue;let n=t.representingOrganizationName;typeof n==`string`&&n.length>0&&e.set(String(t.organizationId),n)}return e},[r?.organizationMembers]);return{isOpen:m,setIsOpen:h,isUserAuthenticated:c()&&!!r,userInitials:O,displayName:k,email:ee,avatarUrl:I,currentOrganization:v?{_id:v._id,name:v.name}:void 0,organizations:(i??[]).map(e=>{let t=L.get(String(e._id));return{_id:e._id,name:e.name,...t?{viaOrganizationName:t}:{}}}),unlistedOrganizationCount:A,organizationSearchQuery:j.query,setOrganizationSearchQuery:j.setQuery,organizationSearchResults:j.results,isSearchingOrganizations:j.isSearching,organizationSearchFailed:j.failed,sections:y,avatarDisplay:b,showOrgSwitcher:x,showLogout:S,settingsTarget:E,settingsTargets:T,popupAlignment:w,handleLogout:M,handleSwitchOrg:N,handleNavigateToSettingsTarget:P}}function Xke({preset:e=q.DEFAULT,...t}){let n=G(J.APPLICATION_LEVEL_COMMAND_MENU,`ApplicationLevel_CommandMenu`)(e);return(0,$.jsx)(n,{...t})}function Zke({preset:e=q.DEFAULT,...t}){let n=G(J.APPLICATION_LEVEL_CONTROL_PANEL,`ApplicationLevel_ControlPanel`)(e);return(0,$.jsx)(n,{...t})}function Qke({preset:e=q.DEFAULT,...t}){let n=G(J.APPLICATION_LEVEL_USER_DROPDOWN,`ApplicationLevel_MenuUserOrg`)(e);return(0,$.jsx)(n,{...t})}function $ke(e){return e.tResourceEmptyState(e.resourceType,`title`)||e.tComponent(J.RESOURCES_LAYOUTS_LIST,`noItems`)}var m9=Jo.getLogger(),h9=m9.debugByType(`sidebar-resource-browser`);m9.setDebugTypeLogging(`sidebar-resource-browser`,!1);var eAe=[J.APPLICATION_LEVEL_SIDEBAR,J.RESOURCES_LAYOUTS_LIST],g9=({resourceType:e,operation:t,operationVariant:n,navigateOperation:r,navigateOperationVariant:i,instanceFilter:a,onInstanceClick:o,isCollapsed:s=!1})=>{let{registry:c,doOperation:l}=wm(),{navigateToResource:u}=zS(),d=lm(),{tResourceHeader:f,tResourceEmptyState:p,t:m,tComponent:h,formatDate:g,formatDateTime:_}=K({resource:e,component:eAe}),v=bp(),{renderIcon:y}=Rf(),[b,x]=(0,Q.useState)([]),[S,C]=(0,Q.useState)(!0),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),O=(0,Q.useRef)(l);O.current=l;let k=c.resourceConfigurations[e],A=(0,Q.useMemo)(()=>{if(k)return xh(k,t??W.LIST,n)},[k,t,n]),j=(0,Q.useMemo)(()=>{if(k)return r?xh(k,r,i):t&&t!==W.LIST?xh(k,t,n):xh(k,W.READ)??A},[k,r,i,t,n,A]),M=(0,Q.useMemo)(()=>{if(!k)return{};let e=pm.buildInitiatorIds({userId:d?.currentUserId,organizationId:d?.currentOrganizationId,applicationId:d?.currentApplicationId,anonymousUserId:d?.currentAnonymousUserId});return{...pm.primaryScopeToContextIdentifiers(e,k.resourcePrimaryScope),...d?.buildContextResourceIdentifiers()??{}}},[k,d?.currentUserId,d?.currentOrganizationId,d?.currentApplicationId,d?.currentAnonymousUserId,d]),N=(0,Q.useMemo)(()=>A?gl.createOperationPathKeyFromOperation(A):null,[A]);(0,Q.useEffect)(()=>{if(D(!!k&&!N),!N||!k){if(x([]),k&&!N){let r=`Sidebar resource browser cannot resolve operation "${t??W.LIST}" on resource "${e}".`;T(null),m9.warn(r,{resourceType:e,operationIdentifier:t??W.LIST,operationVariant:n})}else k||m9.warn(`Sidebar resource browser: resource type "${e}" is not registered.`,{resourceType:e}),T(null);C(!1);return}let r=!1;return(async()=>{C(!0),T(null);try{h9(`Fetching resource instances`,{resourceType:e,operationPathKey:N});let t=await O.current(N,{contextualParameters:M,queryParameters:{limit:100}});if(r)return;let n=Array.isArray(t)?t:t?.data??[];x(n),h9(`Fetched instances`,{count:n.length})}catch(t){if(r)return;T(v(t)),m9.error(`SidebarResourceBrowser fetch failed`,{resourceType:e,error:t})}finally{r||C(!1)}})(),()=>{r=!0}},[N,e,k,M,t,n]);let P=(0,Q.useMemo)(()=>a?b.filter(a):b,[b,a]),F=(0,Q.useMemo)(()=>im({tResourceHeader:f,resourceType:e,key:`title`}),[e,f]),I=(0,Q.useCallback)(t=>{let n=t.id??t._id??``;if(o)o({resourceType:e,instanceId:n,instanceData:t});else if(k&&j){let t={...M,[e]:n},r=gn.buildParentResourcesRequirements(e,t,c),i=gn.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:j,contextResourceIdentifiers:t,parentResourcesRequirements:r});u(i,Ch.createAppLevelInitiator(Fu.SIDEBAR))}else m9.warn(`SidebarResourceBrowser navigation skipped: no navigation operation resolved`,{resourceType:e,fetchOperationIdentifier:A?.operationIdentifier,navigationOperationIdentifier:r??W.READ,navigationOperationVariant:i,instanceId:n})},[e,o,k,j,r,i,M,c,u,A]),ee=(0,Q.useCallback)(t=>V.computeFrontendResourceLabel({resourceType:e,registry:c,currentObject:t,t:m,formatDate:g,formatDateTime:_})??String(t._id??``),[e,c,m,g,_]),L=(0,Q.useMemo)(()=>y({category:re.RESOURCES,resourceType:e},{size:fa.SM}),[y,e]),R=(0,Q.useMemo)(()=>A?[Dg({resourceType:e,operation:A.operationIdentifier})]:[],[e,A]),te=(0,Q.useMemo)(()=>[`resources.${e}`],[e]),z=(0,Q.useCallback)(()=>(0,$.jsx)(`div`,{className:`px-card-sm py-item-xs space-y-item-xs`,role:`status`,"aria-live":`polite`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`animate-pulse motion-reduce:animate-none h-7 bg-surface-sunken-accent rounded`,"aria-hidden":`true`},e))}),[]);if(!k)return(0,$.jsx)(`div`,{className:`px-card-sm py-item-xs text-xs text-destructive`,children:h(J.APPLICATION_LEVEL_SIDEBAR,`resourceBrowserUnavailable`)});let B=E||w?(0,$.jsx)(`div`,{className:`px-card-sm py-item-xs text-xs text-destructive`,children:E?h(J.APPLICATION_LEVEL_SIDEBAR,`resourceBrowserUnavailable`):w}):P.length===0?(0,$.jsx)(`div`,{className:`px-card-sm py-item-xs text-xs text-muted-foreground`,children:$ke({resourceType:e,tResourceEmptyState:p,tComponent:h})}):s?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-item-xs py-item-xs`,children:[(0,$.jsx)(`span`,{className:`flex-shrink-0`,children:L}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:P.length})]}):(0,$.jsx)(`div`,{className:`space-y-item-xs`,role:`listbox`,"aria-label":F,children:P.map((e,t)=>{let n=ee(e);e.id??e._id;let r=e.id??e._id??`sidebar-resource-${t}`;return(0,$.jsxs)(`button`,{type:`button`,role:`option`,onClick:()=>I(e),className:U(`w-full text-start px-card-sm py-item-xs text-sm rounded-sm hover:bg-surface-sunken-accent/50 transition-colors flex items-center gap-field-sm min-h-7`,Jg(x_.INSET)),children:[(0,$.jsx)(`span`,{className:`flex-shrink-0`,children:L}),(0,$.jsx)(`span`,{className:`truncate flex-1`,children:n})]},String(r))})});return(0,$.jsx)(yb,{i18nKeys:te,loadingScopes:R,readiness:[{id:`sidebar-resource-browser-data`,isReady:!S||w!==null}],renderLoading:z,children:B})};function tAe({preset:e=q.DEFAULT,...t}){let n=G(J.APPLICATION_LEVEL_NOTIFICATION_CENTER,`ApplicationLevel_NotificationCenter`)(e);return(0,$.jsx)(n,{...t})}function nAe({preset:e=q.DEFAULT,...t}){let n=G(J.APPLICATION_LEVEL_QUICK_SWITCHER,`ApplicationLevel_QuickSwitcher`)(e);return(0,$.jsx)(n,{...t})}var _9=({resourceContext:e})=>{let{registry:t,doOperation:n}=wm(),{resourceContext:r,navigationZone:i,navigationInitiator:a,resourceType:o,contextualParameters:s,reportError:c,navigateToPreferredRead:l,goBackWithinZone:u}=yC(),{closeOverlay:d}=zS(),{makeTrComponent:f,isReady:p}=K({component:J.RESOURCES_LAYOUTS_CREATE}),m=f(J.RESOURCES_LAYOUTS_CREATE),h=bp(),g=!!(r.additionalContext?.quickCreateRequest??e.additionalContext?.quickCreateRequest),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(void 0);(0,Q.useMemo)(()=>t.resourceConfigurations[o],[t,o]);let T=(0,Q.useCallback)(async()=>{let e=_.trim();if(!e)S(m(`saml.metadataUrlRequired`));else{b(!0),S(null);try{let t=gl.createOperationPathKey({resourceIdentifier:o,operationIdentifier:Fc.DISCOVER_ENDPOINTS,variantType:Ya.API_CALL,isOperationDefault:!0,isBulkOperation:!1}),i=await n(t,{contextualParameters:s,parentResourcesRequirements:r.parentResourcesRequirements,requestData:{metadataUrl:e}}),a=(i.x509Certificates??[]).join(`
|
|
46
|
-
`);w({protocol:Xte.SAML,displayName:i.entityId?.split(`/`).pop()??`SAML Connection`,saml:{entityId:i.entityId,ssoUrl:i.ssoUrl,sloUrl:i.sloUrl,nameIdFormat:i.nameIdFormat,x509CertificatePem:a}})}catch(e){S(h(e))}finally{b(!1)}}},[s,r.parentResourcesRequirements,n,_,o,h,m]),E=(0,Q.useCallback)(e=>{if(g){i===qn.OVERLAY?d():u();return}let n=Xz({result:e,resourceType:o,registry:t});n&&l({contextResourceIdentifiers:gn.buildRecordIdentifiersFromCollection(r.contextResourceIdentifiers,o,n),fallbackToGoBack:!1})||u()},[d,r.contextResourceIdentifiers,u,g,l,i,t,o]),D=(0,Q.useCallback)(e=>{c(e,`Form submission failed`,`ResourceLayoutPreset_Create_SamlWizard`)},[c]);if(!p)return null;let O=m(`saml.import`);return(0,$.jsx)(ND,{voice:void 0,children:(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(pV,{resourceContext:r,navigationZone:i,navigationInitiator:a}),(0,$.jsxs)(BT,{className:`max-w-2xl`,children:[(0,$.jsx)(HT,{children:m(`saml.metadataImport`)}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground mb-field`,children:m(`saml.metadataImportHelp`)}),(0,$.jsxs)(`div`,{className:`flex gap-field`,onKeyDown:e=>e.key===`Enter`&&T(),children:[(0,$.jsx)(rN,{name:`saml-metadata-url`,schema:kd(),type:`url`,placeholder:m(`saml.metadataUrlPlaceholder`),value:_,onChange:e=>v(String(e)),className:`flex-1`}),(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,onClick:T,disabled:y,children:y?m(`saml.importing`):O})]}),x&&(0,$.jsx)(`p`,{className:`text-sm text-destructive mt-item-xs`,role:`alert`,children:x}),C&&(0,$.jsx)(`p`,{className:`text-sm text-success-subtle-foreground mt-item-xs`,role:`status`,children:m(`saml.importSuccess`)})]}),(0,$.jsx)(xB,{resourceContext:r,navigationZone:i,onSuccess:E,onError:D,onCancel:i===qn.OVERLAY?()=>d():void 0,showErrorSummary:!0,className:`max-w-2xl`,defaultValuesOverride:C})]})})};function rAe({resourceContext:e}){let{resourceType:t,contextResourceIdentifiers:n}=e,{registry:r,doOperation:i}=wm(),{makeTrComponent:a,isReady:o}=K({component:J.RESOURCES_LAYOUTS_READ}),s=a(J.RESOURCES_LAYOUTS_READ),c=bp(),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),p=n,m=p.organizations?gn.getResourceId(p.organizations):void 0,h=p.applications?gn.getResourceId(p.applications):void 0,g=m==null?il.APPLICATION:il.ORGANIZATION,_=String(m??h??``),v=(0,Q.useMemo)(()=>_?`${va.getApiUrl()}/auth/saml/metadata/${g}/${_}`:null,[g,_]),y=(0,Q.useCallback)(async()=>{f(!0),u(null);try{let a=gl.createOperationPathKey({resourceIdentifier:t,operationIdentifier:Fc.TEST_CONNECTION,variantType:Ya.API_CALL,isOperationDefault:!0,isBulkOperation:!1}),o=V.buildContextualParameters(n,r),s=p[t]?gn.getResourceId(p[t]):``,c=await i(a,{contextualParameters:o,parentResourcesRequirements:e.parentResourcesRequirements,requestData:{connectionId:s}});u(c)}catch(e){u({overallStatus:`fail`,errors:[c(e)]})}finally{f(!1)}},[t,e.parentResourcesRequirements,n,r,i,p,c]);if(!o)return null;let b=s(`saml.testConnection`),x=s(`saml.downloadSpMetadata`);return(0,$.jsxs)(`div`,{className:`space-y-section max-w-4xl`,children:[(0,$.jsxs)(BT,{children:[(0,$.jsx)(HT,{children:s(`saml.samlTools`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-field`,children:[v&&(0,$.jsx)(X,{variant:Y.OUTLINE,asChild:!0,children:(0,$.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,children:x})}),(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,onClick:y,disabled:d,children:d?s(`saml.testing`):b})]})]}),l&&(0,$.jsxs)(BT,{className:l.overallStatus===`pass`?`border-success/50 bg-success/5`:l.overallStatus===`warning`?`border-warning/50 bg-warning/5`:`border-destructive/50 bg-destructive/5`,children:[(0,$.jsx)(HT,{children:s(`saml.testResults`)}),(0,$.jsxs)(`div`,{className:`space-y-item-sm text-sm`,children:[l.entityIdConfigured!==void 0&&(0,$.jsxs)(`p`,{children:[l.entityIdConfigured?`✓`:`✗`,` IdP Entity ID:`,` `,l.entityIdConfigured?`Configured`:`Not configured`]}),l.ssoUrlReachable!==void 0&&(0,$.jsxs)(`p`,{children:[l.ssoUrlReachable?`✓`:`✗`,` SSO URL:`,` `,l.ssoUrlReachable?`Reachable (${l.ssoUrlStatus??`OK`})`:`Not reachable`]}),l.sloUrlReachable!==void 0&&(0,$.jsxs)(`p`,{children:[l.sloUrlReachable?`✓`:`✗`,` SLO URL:`,` `,l.sloUrlReachable?`Reachable (${l.sloUrlStatus??`OK`})`:`Not reachable`]}),l.spMetadataValid!==void 0&&(0,$.jsxs)(`p`,{children:[l.spMetadataValid?`✓`:`✗`,` SP Metadata: `,l.spMetadataValid?`Valid`:`Invalid`]}),l.certificates?.map((e,t)=>{let n=e.daysRemaining??0,r=!e.valid||n<0||n<7?`text-destructive`:n<30?`text-warning-subtle-foreground`:``,i=e.fingerprint?e.fingerprint.slice(0,12)+(e.fingerprint.length>12?`…`:``):null;return(0,$.jsxs)(`div`,{className:`pl-item-sm ${r}`,children:[(0,$.jsxs)(`p`,{children:[e.valid?`✓`:`✗`,` Certificate `,t+1,`:`,` `,e.valid?`Valid`:`Invalid`,` — expires`,` `,e.expiresAt?.slice(0,10)??`N/A`,` (`,e.daysRemaining,` days)`,i!=null&&(0,$.jsxs)(`span`,{className:`text-muted-foreground text-xs ml-1`,children:[`(`,i,`)`]})]}),e.warnings?.length>0&&(0,$.jsx)(`p`,{className:`text-warning-subtle-foreground text-xs`,children:e.warnings.join(`; `)})]},t)}),l.errors?.map((e,t)=>(0,$.jsx)(`p`,{className:`text-destructive`,children:e},t)),l.warnings?.map((e,t)=>(0,$.jsx)(`p`,{className:`text-warning-subtle-foreground`,children:e},t)),(0,$.jsxs)(`p`,{className:`font-medium mt-item-sm`,children:[`Overall: `,l.overallStatus===`pass`?`✓ Pass`:l.overallStatus===`warning`?`⚠ Warning`:`✗ Fail`]})]})]})]})}var v9=e=>(0,$.jsx)(QY,{...e,showCharts:!1,children:(0,$.jsx)(rAe,{resourceContext:e.resourceContext})});function y9(e,t){return V.buildConfigurationError(ii.CONFIGURATION,{message:e,component:`useCompositeResourceOperationContextBuilder`,...t})}function iAe(e){return`operationIdentifier`in e}function aAe(e,t,n){let r=(e.operations??[]).filter(e=>!(String(e.operationIdentifier)!==n.operationIdentifier||n.variantType!==void 0&&e.variantType!==n.variantType||n.variantKey!==void 0&&e.variantKey!==n.variantKey||n.isOperationDefault!==void 0&&e.isOperationDefault!==n.isOperationDefault||n.isBulkOperation!==void 0&&e.isBulkOperation!==n.isBulkOperation));if(r.length===1)return r[0];let i=r.filter(e=>e.isOperationDefault===!0&&e.isBulkOperation!==!0);if(n.variantKey===void 0&&n.variantType===void 0&&n.isOperationDefault===void 0&&n.isBulkOperation===void 0&&i.length===1)return i[0];throw y9(r.length===0?`Composite resource-operation builder cannot resolve operation "${n.operationIdentifier}" on resource "${t}".`:`Composite resource-operation builder found ambiguous operation "${n.operationIdentifier}" on resource "${t}".`,{resourceType:t,operationIdentifier:n.operationIdentifier,variantType:n.variantType,variantKey:n.variantKey,isOperationDefault:n.isOperationDefault,isBulkOperation:n.isBulkOperation,candidates:r.map(e=>({variantType:e.variantType,variantKey:e.variantKey,isOperationDefault:e.isOperationDefault,isBulkOperation:e.isBulkOperation}))})}function oAe(e,t,n,r,i){if(!e)throw y9(`Composite resource-operation builder cannot resolve resource "${t}" from the registry.`,{resourceType:t});if(iAe(n)){let a=aAe(e,t,n);if(mh({operation:a,resourceType:t,resourceConfig:e})&&a.isBulkOperation!==!0&&!ih({resourceConfig:e,operation:a,registry:r,hasResourceId:gn.getResourceId(i[t]).length>0,contextResourceIdentifiers:i,contextualParameters:V.buildContextualParameters(i,r)}))throw y9(`Composite resource-operation builder resolved operation "${n.operationIdentifier}" on resource "${t}", but it is not addressable in the current context.`,{resourceType:t,operationIdentifier:n.operationIdentifier});return a}let a=n.operationLike,o=a===W.READ||a===W.UPDATE||a===W.DELETE,s=n.requireAddressable||o?Th({resourceConfig:e,operations:e.operations??[],coreOperation:a,registry:r,hasResourceId:gn.getResourceId(i[t]).length>0,allowBulk:n.allowBulk,requireFrontendAddressable:!0,contextResourceIdentifiers:i,contextualParameters:V.buildContextualParameters(i,r)}):Il(e.operations??[],a,{requireAddressable:n.requireAddressable,allowBulk:n.allowBulk});if(!s)throw y9(`Composite resource-operation builder cannot resolve a preferred ${String(n.operationLike)}-like operation on resource "${t}".`,{resourceType:t,operationLike:n.operationLike,requireAddressable:n.requireAddressable,allowBulk:n.allowBulk});return s}function b9(){let{registry:e}=wm(),t=qU(),n=lm();return{buildResourceOperationContext:(0,Q.useCallback)(r=>{let i=e.resourceConfigurations[r.resourceType],a=r.contextResourceIdentifiers??t?.contextResourceIdentifiers,o=a?V.flattenContextIdentifiers(a):void 0,s=pm.mergeContextResourceIdentifiers(void 0,n?.buildContextResourceIdentifiers()??{},o)??{},c=r.resourceId?{...Zm({hostIdentifiers:r.contextResourceIdentifiers?n?.buildContextResourceIdentifiers()??{}:s,hostContextualParameters:{},hostRecord:{resourceType:r.resourceType,id:r.contextResourceIdentifiers?``:gn.getResourceId(o?.[r.resourceType])},targetResourceType:r.resourceType,targetId:r.resourceId,registry:e}).identifiers,...r.contextResourceIdentifiers?o:{},[r.resourceType]:r.resourceId}:s,l=oAe(i,r.resourceType,r,e,c),u=gn.buildParentResourcesRequirements(r.resourceType,c,e,r.relationshipFieldOverrides);return gn.createFrontendResourceOperationContextFromOperation({resourceType:r.resourceType,operation:l,contextResourceIdentifiers:c,additionalContext:r.additionalContext,parentResourcesRequirements:u})},[n,t?.contextResourceIdentifiers,e])}}function x9({childContext:e,inlineLimit:t,showViewAllLink:n,childResourceType:r,onViewAll:i}){let{registry:a,doOperation:o}=wm(),{t:s,formatDate:c,formatDateTime:l,tComponent:u,isReady:d}=K({component:J.RESOURCES_LAYOUTS_CONTAINER_NESTED,resource:e.resourceType}),[f,p]=(0,Q.useState)([]),[m,h]=(0,Q.useState)(0),[g,_]=(0,Q.useState)(!0),[v,y]=(0,Q.useState)(!1),b=(0,Q.useRef)(o);b.current=o;let x=t,S=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]),C=(0,Q.useMemo)(()=>JSON.stringify(e.pinnedFilters??{}),[e.pinnedFilters]);if((0,Q.useEffect)(()=>{if(x===0){_(!1);return}let t=!1;return(async()=>{_(!0),y(!1);let n=a.resourceConfigurations[r],i=V.buildContextualParameters(e.contextResourceIdentifiers,a),o=e.operation&&ul(e.operation)===W.LIST?e.operation:n?Il((n.operations??[]).filter(t=>kY(t,e,i)),W.LIST):void 0,s=e.pinnedFilters;if(s&&o&&o!==e.operation&&Jo.getLogger().warn(`[related-resource-preview] the "${r}" preview is confined by a pin on its context's own operation, but would fetch through "${String(o.operationIdentifier)}", which may not declare that filter; it fetches nothing rather than an unconfined list (#3072).`),!o||s&&o!==e.operation){_(!1);return}let c=gl.createOperationPathKeyFromOperation(o);try{let n=await b.current(c,{contextualParameters:i,queryParameters:{page:1,limit:x,...s??{}},parentResourcesRequirements:e.parentResourcesRequirements});if(t)return;if(n&&typeof n==`object`&&`data`in n&&`pagination`in n){let e=n;p(e.data),h(e.pagination.total)}else Array.isArray(n)&&(p(n),h(n.length))}catch{t||y(!0)}finally{t||_(!1)}})(),()=>{t=!0}},[r,x,a,S,C]),g)return(0,$.jsx)(`div`,{className:`flex items-center justify-center py-card-sm`,children:(0,$.jsx)(gb,{size:20,className:`text-muted-foreground`})});if(v)return(0,$.jsx)(`p`,{className:`text-sm text-destructive`,children:u(J.RESOURCES_LAYOUTS_CONTAINER_NESTED,`previewLoadFailed`)});if(!d)return null;if(x===0){if(!n)return null;let e=jp({tComponent:u,componentType:J.RESOURCES_LAYOUTS_CONTAINER_NESTED,key:`viewAll`});return(0,$.jsx)(X,{variant:Y.LINK,size:Xd.SM,className:`px-0`,onClick:i,children:e})}if(f.length===0){let e=jp({tComponent:u,componentType:J.RESOURCES_LAYOUTS_CONTAINER_NESTED,key:`emptyState`});return(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e})}let w=m>x,T=jp({tComponent:u,componentType:J.RESOURCES_LAYOUTS_CONTAINER_NESTED,key:`viewAllWithCount`,params:{total:m}});return(0,$.jsxs)(`div`,{className:`space-y-xs`,children:[(0,$.jsx)(`ul`,{className:`space-y-xs`,children:f.map((e,t)=>{let n=e._id??e.id??t,i=V.computeFrontendResourceLabel({resourceType:r,registry:a,currentObject:e,t:s,formatDate:c,formatDateTime:l})??String(n);return(0,$.jsx)(`li`,{className:`text-sm px-sm py-xs rounded-radius border border-border bg-card`,children:i},n)})}),n&&w&&(0,$.jsx)(X,{variant:Y.LINK,size:Xd.SM,className:`px-0`,onClick:i,children:T})]})}function sAe({resourceType:e,limit:t,showViewAllLink:n=!0,viaForeignKey:r,className:i}){TY(e);let{buildOperationContext:a}=o8(),{navigationZone:o}=HU(),{navigate:s}=zS(),c=(0,Q.useMemo)(()=>a({resourceType:e,operationLike:W.LIST,relationshipFieldOverrides:r}),[a,e,JSON.stringify(r??null)]);return(0,$.jsx)(`div`,{className:i,children:(0,$.jsx)(x9,{childContext:c,inlineLimit:t,showViewAllLink:n&&!(c.pinnedFilters&&Object.keys(c.pinnedFilters).length>0),childResourceType:e,onViewAll:()=>s({content:{contentType:hd.RESOURCE_OPERATION,resourceContext:c},initiator:{sourceZone:o}})})})}var S9=({document:e,options:t={},className:n=``,onStatusChange:r,onAction:i,viewRef:a,guidanceFlowRef:o})=>{let{flowStates:s,completeElement:c,completeFlow:l,dismissFlow:u,skipFlow:d,isFlowPersistable:f,isLoading:p}=wU(),m=(0,Q.useId)(),h=o,g=h??e.ref,_=f(g),v=g??`onboarding-local-${m}`,y=a||e.ref||h||`onboarding`,b=(0,Q.useMemo)(()=>[`guidance.${y}`],[y]),{makeTrGuidanceElement:x,tComponent:S,isReady:C}=K({component:J.GUIDANCE_ONBOARDING_VIEW,keys:b});(0,Q.useEffect)(()=>{if(!_){let t=e.elements.map(e=>e.ref).join(`, `);console.warn(`[OnboardingView] Mounted with no persistable identity (ref="${g??`(none)`}", viewRef="${a??`(none)`}", elements=[${t}]). Dismiss, complete, and skip actions will only affect local component state and will NOT be persisted to the backend. To persist, either declare this onboarding view (by ref) in the app frontend config so it is registered, or pass the guidanceFlowRef prop matching a registered GuidanceFlowDefinition.`)}},[]);let w=(0,Q.useMemo)(()=>({...e.options,...t}),[e.options,t]),T=(0,Q.useMemo)(()=>[...e.elements].sort((e,t)=>e.order-t.order),[e.elements]),[E,D]=(0,Q.useState)(0),[O,k]=(0,Q.useState)({status:go.IN_PROGRESS,elements:{},triggerCount:1}),A=T.length;(0,Q.useEffect)(()=>{D(0),k({status:go.IN_PROGRESS,elements:{},triggerCount:1})},[v]);let j=_?s[g]??O:O,M=(0,Q.useCallback)(e=>j?.elements?.[e],[j]),N=(0,Q.useMemo)(()=>j?.elements?Object.values(j.elements).filter(e=>e.status===go.COMPLETED).length:0,[j]),P=(0,Q.useCallback)((e,t,n)=>{let r=t===go.COMPLETED?new Date:void 0;k(i=>({...i,elements:{...i.elements,[e]:{...i.elements[e],status:t,completedAt:r,surveyAnswers:n?.surveyAnswers??i.elements[e]?.surveyAnswers,lastStepIndex:n?.lastStepIndex??i.elements[e]?.lastStepIndex}}}))},[]),F=(0,Q.useCallback)(e=>{let t=new Date;k(n=>({...n,status:e,completedAt:e===go.COMPLETED?t:n.completedAt,dismissedAt:e===go.DISMISSED?t:n.dismissedAt}))},[]),I=(0,Q.useCallback)(async(e,t)=>{P(e,go.COMPLETED,t),_&&c(g,e,t),r?.(e,go.COMPLETED),E<A-1?D(e=>e+1):(F(go.COMPLETED),_&&l(g))},[c,l,E,_,g,r,P,F,A]),ee=(0,Q.useCallback)(e=>{P(e,go.DISMISSED),r?.(e,go.DISMISSED),w.allowDismiss&&(F(go.DISMISSED),_&&u(g))},[u,_,g,w.allowDismiss,r,P,F]),L=(0,Q.useCallback)(e=>{let t=T[E];i?.(t?.ref??``,e)},[i,T,E]),R=(0,Q.useCallback)(()=>{if(E<A-1){D(e=>e+1);return}let e=T[E];e?I(e.ref):(F(go.COMPLETED),_&&l(g))},[E,A,T,I,l,_,g,F]),te=(0,Q.useCallback)(()=>{E>0&&D(e=>e-1)},[E]),z=(0,Q.useCallback)(()=>{F(go.SKIPPED),_&&d(g)},[_,g,F,d]);if(!C||_&&p)return null;if(T.length===0)return(0,$.jsx)(`div`,{className:U(`p-container-xl text-center text-muted-foreground`,n),children:S(J.GUIDANCE_ONBOARDING_VIEW,`empty`)});if(ze(j?.status))return null;let B=T[E];if(!B)return null;let ne=h4(B.type),re=M(B.ref),ie=x(y,B.ref,Tl(B));return(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-element`,n),children:[w.showProgress&&A>1&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsxs)(`div`,{className:`flex justify-between items-center text-[0.8125rem] text-muted-foreground font-medium`,children:[(0,$.jsx)(`span`,{children:S(J.GUIDANCE_ONBOARDING_VIEW,`stepOf`,{current:E+1,total:A})}),(0,$.jsxs)(`span`,{className:`text-xs`,children:[N,`/`,A]})]}),(0,$.jsx)(I_,{value:A>0?(E+1)/A*100:0,className:`h-1`,"aria-label":S(J.GUIDANCE_ONBOARDING_VIEW,`stepOf`,{current:E+1,total:A}),"aria-valuenow":E+1,"aria-valuemin":1,"aria-valuemax":A})]}),ne&&(0,$.jsx)(ne,{element:B,flowRef:v,state:re,onComplete:I,onDismiss:ee,onAction:L,t:ie}),A>1&&(0,$.jsxs)(`div`,{className:`flex justify-between items-center pt-item`,children:[(0,$.jsx)(`div`,{children:E>0&&(0,$.jsx)(X,{variant:Y.OUTLINE,size:Xd.SM,onClick:te,children:S(J.GUIDANCE_ONBOARDING_VIEW,`back`)})}),(0,$.jsxs)(`div`,{className:`flex gap-item items-center`,children:[w.allowSkip&&(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.SM,onClick:z,children:S(J.GUIDANCE_ONBOARDING_VIEW,`skip`)}),(0,$.jsx)(X,{variant:Y.DEFAULT,size:Xd.SM,onClick:R,children:E===A-1?S(J.GUIDANCE_ONBOARDING_VIEW,`complete`):S(J.GUIDANCE_ONBOARDING_VIEW,`next`)})]})]}),A===1&&(0,$.jsxs)(`div`,{className:`flex justify-end gap-item items-center`,children:[w.allowDismiss&&(0,$.jsx)(X,{variant:Y.GHOST,size:Xd.SM,onClick:()=>ee(B.ref),children:S(J.GUIDANCE_ONBOARDING_VIEW,`dismiss`)}),(0,$.jsx)(X,{variant:Y.DEFAULT,size:Xd.SM,onClick:R,children:S(J.GUIDANCE_ONBOARDING_VIEW,`complete`)})]})]})},C9=Object.freeze({});function cAe(e,t){let n={};for(let r of t){let t=e[r.foreignKeyField];typeof t==`string`&&t.length>0&&(n[r.resourceType]=t)}return n}function w9(e){let{registry:t,doOperation:n}=wm(),[r,i]=(0,Q.useState)(C9),{hostResourceType:a,hostResourceId:o,hostResourceConfig:s,contextResourceIdentifiers:c,parentResourcesRequirements:l}=e,u=(0,Q.useMemo)(()=>o?(l??[]).filter(e=>{if(!e.foreignKeyField)return!1;let t=gn.getResourceId(c[e.resourceType]);return!(t&&t.length>0)}).map(e=>({resourceType:e.resourceType,foreignKeyField:e.foreignKeyField})):[],[l,c,o]),d=(0,Q.useMemo)(()=>u.map(e=>`${e.resourceType}:${e.foreignKeyField}`).sort().join(`|`),[u]),f=(0,Q.useMemo)(()=>V.buildContextResourceIdentifiersKey(c),[c]),p=(0,Q.useRef)(null),m=uV({resourceType:a,rowIds:[o,p.current],enabled:u.length>0&&!!o}),h=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{if(u.length===0||!o){i(C9);return}let e=V.buildContextualParameters(c,t),r=Th({resourceConfig:s,operations:s.operations??[],coreOperation:W.READ,registry:t,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:c,contextualParameters:e});if(!r){i(C9);return}let m=gl.createOperationPathKeyFromOperation(r),g=`${m}|${a}|${o}|${d}|${f}`,_=h.current===g;h.current=g;let v=!1;return n(m,{contextualParameters:e,parentResourcesRequirements:l}).then(e=>{if(v)return;let t=e&&typeof e==`object`&&!Array.isArray(e)&&!(`data`in e)?e:void 0;if(!t){i(C9);return}p.current=typeof t._id==`string`?t._id:null;let n=cAe(t,u);i(e=>Object.keys(n).length===0?C9:Object.keys(n).length===Object.keys(e).length&&Object.entries(n).every(([t,n])=>e[t]===n)?e:n)}).catch(()=>{!v&&!_&&i(C9)}),()=>{v=!0}},[d,f,o,a,m?.at]),r}function T9(e,t){return Object.keys(t).length===0?e:{...t,...e}}function E9(e){let{registry:t}=wm(),n=t.resourceConfigurations[e.resourceType]?.frontendConfiguration?.chartViews?.find(t=>t.ref===e.viewRef);if(!n)throw k9(`Composite chart runtime cannot resolve chart view "${e.viewRef}" on resource "${e.resourceType}".`,{resourceType:e.resourceType,viewRef:e.viewRef});let r=Np(e.resourceType,{ref:e.viewRef});return(0,$.jsx)(`div`,{className:e.className,children:(0,$.jsx)(lg,{requiredFeatures:n.chartDefinition.requiredFeatures,children:(0,$.jsx)(rY,{viewRef:r.insertedViewRef,viewDefinition:n,runtimeDescriptor:Op({identity:r,chartView:n,contextResourceIdentifiers:e.contextResourceIdentifiers??{}}),contextResourceIdentifiers:e.contextResourceIdentifiers,inputs:e.inputs,urlParamValues:e.urlParamValues,...e.height==null?{}:{height:e.height},localErrorOnly:!0})})})}function D9({resourceType:e,viewRef:t,contextResourceIdentifiers:n,inputs:r,urlParamValues:i,className:a,height:o}){let s=HU();return(0,$.jsx)(E9,{resourceType:e,viewRef:t,contextResourceIdentifiers:{...s.contextResourceIdentifiers??{},...n??{}},inputs:r,urlParamValues:i,className:a,height:o})}function lAe({document:e,viewRef:t,guidanceFlowRef:n,className:r}){return(0,$.jsx)(`div`,{className:r,children:(0,$.jsx)(S9,{document:e,viewRef:t,guidanceFlowRef:n})})}function uAe({viewRef:e,className:t}){let n=UU(),r=n?.hostResourceType?n.contextResourceIdentifiers?.[n.hostResourceType]??`no-row`:`no-host`;return(0,$.jsx)(`div`,{className:t,children:(0,$.jsx)(xY,{descentKey:`composite:${e}::${r}`,children:(0,$.jsx)(JU,{viewRef:e})})})}function O9(e,t,n,r){return(0,$.jsx)(`div`,{className:r,children:(0,$.jsx)(xY,{descentKey:`execution:${e}::${Object.values(n??{}).join(`,`)||`no-row`}`,children:(0,$.jsx)(hX,{viewRef:e,navigationZone:t,contextResourceIdentifiers:n})})})}function dAe({viewRef:e,contextResourceIdentifiers:t,className:n}){let r=HU();return O9(e,r.navigationZone,{...r.contextResourceIdentifiers??{},...t??{}},n)}function k9(e,t){return V.buildConfigurationError(ii.CONFIGURATION,{message:e,component:`ResourceEmbeds`,...t})}function A9(e){let t=V.getInstance().getAddressedRecordId(e);if(t)return`embed:${e.resourceType}::${t}`;let n=Object.fromEntries(Object.entries(e.contextResourceIdentifiers??{}).filter(([t])=>t!==e.resourceType));return`embed:${e.resourceType}::scope:${V.buildContextResourceIdentifiersKey(n)}`}function j9(e,t,n,r){return(0,$.jsx)(`div`,{className:r,children:(0,$.jsx)(xY,{descentKey:A9(e),children:(0,$.jsx)(aA.Provider,{value:!0,children:(0,$.jsx)(oX,{resourceContext:e,navigationZone:t,navigationInitiator:n})})})})}function M9({resourceContext:e,className:t}){let{navigationZone:n,navigationInitiator:r}=HU();return j9(e,n,r,t)}function fAe({className:e,...t}){let{navigationZone:n,navigationInitiator:r}=HU(),i=o8();return j9((0,Q.useMemo)(()=>i.buildOperationContext(t),[i,JSON.stringify(t)]),n,r,e)}function N9({className:e,...t}){TY(t.resourceType);let{navigationZone:n,navigationInitiator:r}=HU(),i=o8(),{registry:a}=wm(),o=(0,Q.useMemo)(()=>{if(!t.resourceType)throw k9(`EmbedRelatedResourceOperation() requires a target resourceType.`,{target:t});return i.buildOperationContext(t)},[i,JSON.stringify(t)]),s=(0,Q.useMemo)(()=>{let{hostResourceType:e,hostResourceId:n,hostResourceConfig:r}=i,s=t.resourceType===e&&!i8({target:t,hostResourceType:e,operation:o.operation,registry:a});if(!t.resourceType||s||!r?.resourceRelationships)return;let c=t.relationshipFieldOverrides?.[e],l=Za(r.resourceRelationships).map(t=>Fj({parentResourceType:e,relationship:t,registry:a})).filter(e=>e!==void 0).filter(e=>e.childResourceType===t.resourceType).filter(e=>c===void 0||e.foreignKeyField===c);if(l.length!==1)return;let u=l[0];return{parentResourceType:e,parentResourceId:n||void 0,childResourceType:u.childResourceType,foreignKeyField:u.foreignKeyField,relationshipEdgeKey:u.relationshipEdgeKey,inChildView:u.inChildView}},[i,a,o,JSON.stringify(t)]);return j9(o,n,(0,Q.useMemo)(()=>s?{...r??{sourceZone:n},sourceRelationship:s}:r,[r,n,s]),e)}function P9({resourceType:e,viaForeignKey:t,className:n}){return(0,$.jsx)(N9,{resourceType:e,operationLike:W.LIST,relationshipFieldOverrides:t,className:n})}function pAe({className:e}){let{navigationZone:t,navigationInitiator:n}=HU(),r=o8(),{hostResourceType:i,hostResourceId:a}=r;return j9((0,Q.useMemo)(()=>{if(!a)throw k9(`EmbedLinkedConversations() needs a host RECORD: place it on a READ surface, where the record it lists conversations for exists.`,{hostResourceType:i});return r.buildOperationContext({resourceType:Na.CONVERSATION_THREADS,operationLike:W.LIST,requireAddressable:!1,pinnedFilters:{[$t.RESOURCE_TYPE]:i,[$t.RESOURCE_ID]:a}})},[r,i,a]),t,n,e)}var mAe={[Na.USER_FLOW_ACTOR_EXECUTIONS]:Na.USER_AGENT_WORK_DECISIONS,[Na.ORGANIZATION_FLOW_ACTOR_EXECUTIONS]:Na.ORGANIZATION_AGENT_WORK_DECISIONS,[Na.APPLICATION_FLOW_ACTOR_EXECUTIONS]:Na.APPLICATION_AGENT_WORK_DECISIONS};function F9({executionId:e,className:t}){let{navigationZone:n,navigationInitiator:r}=HU(),i=o8(),{hostResourceType:a}=i;return j9((0,Q.useMemo)(()=>{let t=mAe[a];if(!t)throw k9(`EmbedExecutionDecisions() lists the decisions of a conversational RUN: place it on a flowActorExecutions READ surface.`,{hostResourceType:a});return i.buildOperationContext({resourceType:t,operationLike:W.LIST,requireAddressable:!1,pinnedFilters:{[Yr.KIND]:br.CONVERSATIONAL_EXECUTION,[Yr.ID]:e}})},[i,a,e]),n,r,t)}var I9=new Set;function hAe(e,t,n){let r=`${e}::${t}`;I9.has(r)||(I9.add(r),Jo.getLogger().warn(`[related-resource-list] the "${t}" LIST cannot be embedded on "${e}", so a section asking whether the viewer may read it is not drawn.${n?` ${n}`:``}`))}function L9(e,t){let n=o8(),r=CS(),i=t?JSON.stringify(t):``;return(0,Q.useMemo)(()=>{if(t===null)return!1;let a;try{a=n.buildOperationContext({resourceType:e,operationLike:W.LIST,requireAddressable:!1,pinnedFilters:t?JSON.parse(i):void 0})}catch(t){return hAe(n.hostResourceType,e,nK(t)),!1}let o=a.operation;return th({...o,resourceType:e},r)},[n,e,r,i,t===null])}function R9(e){let t=o8(),{hostResourceType:n}=t,{embedName:r,resourceType:i,pinnedFilters:a}=e,o=L9(i,a),s=JSON.stringify(a);return(0,Q.useMemo)(()=>{if(n!==Na.ORGANIZATION_REPRESENTATIONS)throw k9(`${r}() lists what belongs to one client relationship: place it on an organizationRepresentations READ surface.`,{hostResourceType:n});return o?t.buildOperationContext({resourceType:i,operationLike:W.LIST,requireAddressable:!1,pinnedFilters:JSON.parse(s)}):null},[t,n,o,r,i,s])}function z9({organizationRepresentationId:e,className:t}){let{navigationZone:n,navigationInitiator:r}=HU(),i=R9({embedName:`EmbedRepresentationTeam`,resourceType:Na.REPRESENTATIVE_ASSIGNMENTS,pinnedFilters:{[wte]:e}});return i?j9(i,n,r,t):null}function B9({organizationRelationshipId:e,className:t}){let{navigationZone:n,navigationInitiator:r}=HU(),i=R9({embedName:`EmbedRepresentationMailboxes`,resourceType:Na.RELATIONSHIP_MAILBOXES,pinnedFilters:{[I]:e}});return i?j9(i,n,r,t):null}function gAe({resourceType:e,viaForeignKey:t,className:n}){return(0,$.jsx)(N9,{resourceType:e,operationLike:W.SEARCH,relationshipFieldOverrides:t,className:n})}function _Ae({viewRef:e,inputs:t,urlParamValues:n,className:r,...i}){let a=o8(),o=a.buildOperationContext({...i,operationLike:W.READ}),s=w9(a);return(0,$.jsx)(E9,{resourceType:a.hostResourceType,viewRef:e,contextResourceIdentifiers:T9(V.flattenContextIdentifiers(o.contextResourceIdentifiers),s),inputs:t,urlParamValues:n,className:r})}function vAe({resourceType:e,viewRef:t,inputs:n,urlParamValues:r,className:i,...a}){if(!e)throw k9(`EmbedRelatedChart() requires a target resourceType.`,{target:a});let o=o8().deriveRelatedScopeIdentifiers({...a,resourceType:e,operationLike:W.LIST});return(0,$.jsx)(E9,{resourceType:e,viewRef:t,contextResourceIdentifiers:o,inputs:n,urlParamValues:r,className:i})}function yAe({viewRef:e,className:t,...n}){let{navigationZone:r}=HU(),i=o8(),a=i.buildOperationContext({...n,operationLike:W.READ}),o=w9(i);return O9(Cp(i.hostResourceType,{ref:e}).insertedViewRef,r,T9(V.flattenContextIdentifiers(a.contextResourceIdentifiers),o),t)}function bAe({resourceType:e,viewRef:t,className:n,...r}){let{navigationZone:i}=HU(),a=o8();if(!e)throw k9(`EmbedRelatedExecution() requires a target resourceType.`,{target:{resourceType:e,viewRef:t,...r}});let o=a.buildOperationContext({...r,resourceType:e,operationLike:W.READ});return O9(Cp(e,{ref:t}).insertedViewRef,i,V.flattenContextIdentifiers(o.contextResourceIdentifiers),n)}function xAe(e){if(!e.hostRelationships)return!1;let t=Za(e.hostRelationships).filter(t=>(t.resourceType1===e.hostResourceType?t.resourceType2:t.resourceType1)===e.targetResourceType);return t.length>0&&t.every(t=>!Nn.isRelationshipActiveForParent(t,e.hostRecord,{onMissingParentResource:`exclude`,onConditionError:`exclude`}))}var V9=new Set;function SAe(e,t,n){let r=`${e}::${t}`;V9.has(r)||(V9.add(r),Jo.getLogger().warn(`[related-resource-sections] "${t}" was placed on "${e}" but cannot be embedded here, so its section is omitted. Two causes are usual: the target exposes no ADDRESSABLE variant of the requested operation (a core verb declared REPOSITORY_ONLY or INTERNAL_CALL has no HTTP surface to embed), or nothing can confine its collection to this record — no route of it names the record and its operation admits no filter on the relationship's foreign key, or no live relationship links the two, so it would list every row (#3072). `+(n?`Here: ${n}`:"Give the target an addressable variant, point `operationLike` at one it does expose, or stop placing it.")))}function H9({targets:e,config:t,className:n}){DY();let r=(0,Q.useMemo)(()=>e.map(e=>typeof e==`string`?{resourceType:e}:e),[e]),i=a8(),a=i?.hostResourceType??``,o=i?.hostResourceConfig?.resourceRelationships,s=_k(),c=s?.data,{tResourceHeader:l,isReady:u}=K({component:J.RESOURCES_LAYOUTS_CONTAINER_NESTED}),d=(0,Q.useMemo)(()=>r.filter(e=>{if(!i)return!0;if(s&&xAe({hostResourceType:a,hostRelationships:o,targetResourceType:e.resourceType,hostRecord:c}))return!1;try{return i.buildOperationContext({resourceType:e.resourceType,operationLike:e.operationLike??W.LIST,relationshipFieldOverrides:e.viaForeignKey}),!0}catch(t){return SAe(a,e.resourceType,nK(t)),!1}}),[r,i,a,o,s,c]),f=(0,Q.useMemo)(()=>d.map(e=>({id:e.resourceType,title:im({tResourceHeader:l,resourceType:e.resourceType,key:`title`}),content:(0,$.jsx)(aA.Provider,{value:!0,children:(0,$.jsx)(N9,{resourceType:e.resourceType,operationLike:e.operationLike??W.LIST,relationshipFieldOverrides:e.viaForeignKey})})})),[d,l]);if(f.length===0)return null;let p=d.some(e=>{let t=e.operationLike??W.LIST;return t===W.LIST||t===W.SEARCH}),m=u?(0,$.jsx)(nk,{sections:f,config:t,className:n}):null;return p?(0,$.jsx)(`div`,{[DA]:!0,children:m}):m}function U9({className:e,children:t}){return(0,$.jsx)(`div`,{className:U(`flex min-w-0 flex-wrap items-center gap-x-element-sm gap-y-element-xs`,`[&>*:not(:first-child)]:shrink-0 [&>*:not(:first-child)]:w-auto [&>*:not(:first-child)]:max-w-full`,`[&>[data-summary-title]]:basis-auto`,`[&>:has(>[data-summary-title])]:w-auto [&>:has(>[data-summary-title])]:min-w-0 [&>:has(>[data-summary-title])]:flex-auto`,e),children:t})}function W9({name:e,className:t,children:n}){let[r]=(0,Q.useState)(()=>new Set),i=fO(),a=(0,Q.useContext)(dO),o=(0,Q.useRef)(!1),s=(0,Q.useCallback)(t=>{r.add(t),i?.registerStep(e,r)},[r,e,i]),c=(0,Q.useCallback)(t=>{r.delete(t),i?.registerStep(e,r)},[r,e,i]),l=(0,Q.useMemo)(()=>({registerField:s,unregisterField:c}),[s,c]);(0,Q.useEffect)(()=>{if(i&&!o.current){o.current=!0;let t=requestAnimationFrame(()=>{i.registerStep(e,r)});return()=>cancelAnimationFrame(t)}},[i,e,r]);let u=`wizard-step-${e}`;return(0,$.jsx)(zM.Provider,{value:l,children:(0,$.jsxs)(`div`,{className:U(`flex flex-col gap-field`,t),id:u,"data-guidance-wizard-step":e,role:`group`,"aria-labelledby":`wizard-tab-${e}`,tabIndex:-1,children:[n,a]})})}var CAe=Jo.getLogger(),wAe=new Set;function TAe(e,t){return e.size===t.size&&[...e].every(e=>t.has(e))}var EAe=new Set([`checkbox`,`radio`,`button`,`submit`,`reset`,`file`,`image`,`range`,`color`,`hidden`]),DAe=600;function G9(e,t=[]){return Q.Children.forEach(e,e=>{if(!Q.isValidElement(e))return;if(e.type===Q.Fragment){G9(e.props.children,t);return}if(e.type!==W9)return;let n=e.props.name;t.some(e=>e.name===n)?CAe.error(`[WizardLayout] Two steps are named "${n}"; a step name must be unique. The second is ignored.`):t.push({name:n,element:e})}),t}function OAe({className:e,initialStep:t=0,validateOnStepChange:n=!0,onStepChange:r,submitButton:i,children:a}){fde();let[o,s]=(0,Q.useState)(t),c=(0,Q.useRef)(new Map),l=(0,Q.useRef)(null),u=(0,Q.useRef)(!1),d=(0,Q.useRef)(0),[f,p]=(0,Q.useState)(t),[m,h]=(0,Q.useState)(wAe),g=rw(),_=ZT(),v=yE(),y=v?.claimFooter,b=(0,Q.useContext)(nz),x=b?.claim;(0,Q.useLayoutEffect)(()=>x?.(),[x]),(0,Q.useLayoutEffect)(()=>y?.(),[y]);let{tComponent:S,isReady:C}=K({component:J.LOW_LEVEL_FORM_MESSAGE}),w=(0,Q.useMemo)(()=>G9(a),[a]),T=w.length,E=Math.min(o,Math.max(T-1,0)),D=(0,Q.useCallback)((e,t)=>{c.current.set(e,t)},[]),O=(0,Q.useCallback)(()=>{let e=w[E]?.name;if(!e)return;let t=c.current.get(e);return t?Array.from(t):void 0},[E,w]),k=(0,Q.useMemo)(()=>({registerStep:D,getCurrentStepFieldNames:O,currentStep:E,totalSteps:T}),[D,O,E,T]),A=(e,t)=>_?.wizardStepLabels?.[e]?_.wizardStepLabels[e]:S(J.LOW_LEVEL_FORM_MESSAGE,`wizardStepDefault`,{index:String(t+1)}),j=()=>{l.current?.scrollIntoView({behavior:`smooth`,block:`start`})},M=e=>{let t=E;d.current=Date.now(),s(e),p(t=>Math.max(t,e)),r?.(t,e)};(0,Q.useEffect)(()=>{if(!g)return;let e=e=>{let t=new Set;w.forEach((n,r)=>{let i=c.current.get(n.name);i&&Array.from(i).some(t=>RC(e,t)!==void 0)&&t.add(r)}),h(e=>TAe(e,t)?e:t)};return e(g.formState.errors),g.subscribe({formState:{errors:!0},callback:({errors:t})=>e(t??{})})},[g,w]);let N=e=>{u.current=!0,M(e),j()},P=eO(e=>{let t=w.findIndex(t=>t.name===e);return t<0||t===E?!1:(M(t),!0)});(0,Q.useEffect)(()=>{if(!u.current)return;u.current=!1;let e=w[E]?.name;e&&document.getElementById(`wizard-step-${e}`)?.focus({preventScroll:!0})},[E,w]);let F=()=>{E>0&&N(E-1)},I=async e=>{e>E&&!await ee(E,e)||N(e)},ee=async(e,t)=>{if(!n||!g)return!0;let r=w.slice(e,t).flatMap(e=>Array.from(c.current.get(e.name)??[]));return fk(g,r)},L=async()=>{if(n&&g){let e=w[E]?.name,t=e?c.current.get(e):void 0;if(!await fk(g,t?Array.from(t):[]))return}E<T-1&&N(E+1)},R=E===0,te=E===T-1,z=e=>{if(e.key!==`Enter`||te||e.defaultPrevented||e.nativeEvent.isComposing)return;let t=e.target;t instanceof HTMLInputElement&&!EAe.has(t.type)&&(e.preventDefault(),L())},B=e=>{e.detail>1&&Date.now()-d.current<DAe&&(e.preventDefault(),e.stopPropagation())};if(!C)return null;let ne=S(J.LOW_LEVEL_FORM_MESSAGE,`wizardPrevious`),re=S(J.LOW_LEVEL_FORM_MESSAGE,`wizardNext`),ie=i??v?.submitButton??(0,$.jsx)(X,{type:`submit`,disabled:_?.disabled,children:S(J.LOW_LEVEL_FORM_MESSAGE,`wizardSubmit`)},`submit`),ae=_?.isExisting===!0;return(0,$.jsx)(uO.Provider,{value:k,children:(0,$.jsxs)(`div`,{className:e,"data-guidance-wizard":``,onKeyDown:z,children:[(0,$.jsx)(`div`,{ref:l,children:(0,$.jsx)(zO,{currentStep:E,totalSteps:T,orientation:Wl.HORIZONTAL,className:`mb-region`,role:`list`,errorSteps:m,onStepSelect:e=>{I(e)},isStepSelectable:e=>e!==E&&(_?.isExisting===!0||e<=f),children:w.map((e,t)=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsxs)(BO,{step:t,role:`listitem`,"aria-current":t===E?`step`:void 0,children:[(0,$.jsx)(VO,{step:t,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`flex flex-col items-center text-center`,children:(0,$.jsx)(UO,{step:t,children:(0,$.jsx)(`span`,{id:`wizard-tab-${e.name}`,children:A(e.name,t)})})})]}),t<T-1&&(0,$.jsx)(HO,{step:t,"aria-hidden":`true`})]},e.name))})}),w.map((e,t)=>{let n=_?.wizardStepDescriptions?.[e.name];return(0,$.jsxs)(`div`,{hidden:t!==E,...tO(P,e.name),children:[n?(0,$.jsx)(`p`,{className:`mb-field text-sm text-muted-foreground`,children:n}):null,(0,$.jsx)(ob,{children:(0,$.jsx)(dO.Provider,{value:t===T-1?b?.content??null:null,children:e.element})})]},e.name)}),v?.submissionNotice,(0,$.jsxs)(`div`,{className:`flex justify-between gap-field pt-field`,onClickCapture:B,children:[(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,onClick:F,disabled:R||_?.disabled,children:ne}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-element`,children:[v?.cancelButton,v?.draftSaveButton,(te||ae)&&(0,$.jsx)(Q.Fragment,{children:ie},`submit`),!te&&(0,$.jsx)(X,{type:`button`,variant:ae?Y.OUTLINE:void 0,onClick:L,disabled:_?.disabled,children:re},`next`)]})]})]})})}function K9({name:e,className:t,children:n}){let r=ZT(),i=_k(),{getRecipe:a}=e_(),o=r?.groupLabels?.[e]??i?.groupLabels?.[e];return(0,$.jsxs)(`div`,{className:t,"data-guidance-group":e,children:[o&&(0,$.jsx)(`h3`,{className:U(`col-span-full mb-element`,a(wi.TYPOGRAPHY,Lu.EYEBROW).base),children:o}),n]})}K9.displayName=`Group`;function q9({className:e,children:t}){return e?(0,$.jsx)(`div`,{className:e,children:t}):(0,$.jsx)($.Fragment,{children:t})}function J9({name:e,className:t,addLabel:n,removeLabel:r,minItems:i,maxItems:a,children:o}){let s=zD(e),{control:c}=rw(),{fields:l,append:u,remove:d}=Kw({control:c,name:s});Ok(s),BM(s);let{tComponent:f,isReady:p}=K({component:J.LOW_LEVEL_FORM_MESSAGE});if(!p)return null;let m=kAe(o),h=a===void 0||l.length<a,g=i===void 0||l.length>i,_=n??f(J.LOW_LEVEL_FORM_MESSAGE,`arrayAddItem`),v=f(J.LOW_LEVEL_FORM_MESSAGE,`arrayItemLabel`);return(0,$.jsxs)(`div`,{className:t,"data-guidance-array":e,children:[l.map((e,t)=>(0,$.jsxs)(`div`,{className:`relative`,"data-guidance-array-item":t,children:[(0,$.jsx)(LD,{pathPrefix:`${s}[${t}]`,children:m?Q.cloneElement(m):null}),g&&(0,$.jsx)(X,{type:`button`,variant:Y.GHOST,onClick:()=>d(t),className:`mt-1`,children:r??f(J.LOW_LEVEL_FORM_MESSAGE,`arrayRemoveItem`,{label:`${v} ${t+1}`})})]},e.id)),h&&(0,$.jsx)(X,{type:`button`,variant:Y.OUTLINE,onClick:()=>u({}),className:`mt-2`,children:_})]})}function kAe(e){let t=null;return Q.Children.forEach(e,e=>{!t&&Q.isValidElement(e)&&e.type===q9&&(t=e)}),t}Kk(J9);function AAe({className:e}){return(0,$.jsx)(`hr`,{className:e})}function jAe(e){let{resourceType:t,viewRef:n,contextResourceIdentifiers:r,inputs:i,urlParamValues:a,localErrorOnly:o=!1}=e,{registry:s}=wm(),{resolvedRegionalPreferences:c}=K(),l=s.resourceConfigurations[t]?.frontendConfiguration?.chartViews?.find(e=>e.ref===n);if(!l)throw Error(`useResourceChartData: resource "${t}" declares no chart view "${n}".`);let u=(0,Q.useMemo)(()=>Op({identity:Np(t,{ref:n}),chartView:l,contextResourceIdentifiers:r??{}}),[t,n,l,r]),d=L_({surfaceDefinition:l,runtimeDescriptor:u,explicitContextResourceIdentifiers:r,explicitInputs:i,urlParamValues:a});return M_(d?.chartDefinition,d?.executionChartRef,d?.resolvedInputs,d?.contextResourceIdentifiers,a,o,c.timezone)}function MAe(e,t){let n=(Array.isArray(e?.operations)?e.operations:[]).find(e=>String(e.operationIdentifier)===W.LIST&&e.isOperationDefault===!0);if(!n||!Array.isArray(n.roles))return;let r=n.roles.map(String);return t?r.filter(e=>t.includes(e)):r}function NAe(e,t){let n=e.accessProfile,r=Ou(n?.organizationOwnRows,t),i=we(n?.organizationAssignedRows,t);if(!r&&!i)return e.organizationRoles;let a=t=>is(t,e.roleTables.orgRolesConfig);return e.organizationRoles.filter(e=>Jee({role:e,ownRowsDeclaration:r,assignedRowsDeclaration:i,roleHierarchyOf:a}))}function Y9(e,t,n){return[e.dataQuery.mainResourceType,...(e.dataQuery.joins??[]).map(e=>e.resourceType)].every(r=>{let i=MAe(t.resourceConfigurations[r],e.accessControl?.roles);return!i||i.length===0?!1:Jm(i,{...n,organizationRoles:NAe(n,r)})})}var X9;(function(e){e.ONE=`one`,e.TWO=`two`,e.FULL=`full`})(X9||={});var Z9;(function(e){e.ONE=`one`,e.TWO=`two`})(Z9||={});var Q9;(function(e){e.TWO=`two`,e.THREE=`three`,e.FOUR=`four`})(Q9||={});function $9({tiles:e,columns:t=Q9.FOUR,className:n}){let{registry:r}=wm(),i=CS(),a=(0,Q.useMemo)(()=>e.flatMap(e=>{let t=r.resourceConfigurations[e.resourceType]?.frontendConfiguration?.chartViews?.find(t=>t.ref===e.chartViewRef);return t!==void 0&&!Y9(t.chartDefinition,r,i)?[]:[{tile:e,isFigure:t?.chartDefinition.chartType===Dre.KPI}]}),[e,r,i]);if(a.length===0)return null;let o=PAe[t];return(0,$.jsx)(`div`,{className:U(`@container w-full`,n),"data-chart-dashboard":!0,children:(0,$.jsx)(`div`,{className:U(`grid grid-cols-1 gap-group`,o.columns),children:a.map(({tile:e,isFigure:t})=>(0,$.jsx)(RAe,{tile:e,isFigure:t,grid:o},`${e.resourceType}:${e.chartViewRef}`))})})}var PAe={[Q9.TWO]:{columns:`@2xl:grid-cols-2`,spanTwo:`@2xl:col-span-2`,rowsTwo:`@2xl:row-span-2`},[Q9.THREE]:{columns:`@md:grid-cols-3`,spanTwo:`@md:col-span-2`,rowsTwo:`@md:row-span-2`},[Q9.FOUR]:{columns:`@2xl:grid-cols-2 @5xl:grid-cols-4`,spanTwo:`@2xl:col-span-2`,rowsTwo:`@2xl:row-span-2`}};function FAe(e,t){let n=e.span??X9.ONE;return U(n===X9.TWO&&t.spanTwo,n===X9.FULL&&`col-span-full`,e.rows===Z9.TWO&&t.rowsTwo)}var IAe=280,LAe=64;function RAe({tile:e,isFigure:t,grid:n}){let{tView:r}=K(),i=r(Ln.CHART,`resources.${e.resourceType}.${e.chartViewRef}`,`title`);return(0,$.jsxs)(`section`,{className:U(`flex min-w-0 flex-col gap-element`,FAe(e,n)),"data-chart-dashboard-tile":`${e.resourceType}:${e.chartViewRef}`,"data-chart-dashboard-figure":t?``:void 0,children:[i&&(0,$.jsx)(Z,{as:`div`,typography:Lu.EYEBROW,children:i}),(0,$.jsx)(D9,{resourceType:e.resourceType,viewRef:e.chartViewRef,height:e.height??(t?LAe:IAe)})]})}function zAe(e){let{tiles:t,...n}=e;function r(){return(0,$.jsx)(tW,{children:(0,$.jsx)($9,{tiles:t})})}return Pp(r,n)}function BAe(e,t=fm.APPLICATION){return xp.parse({ref:e,scope:t,options:{showProgress:!0,allowDismiss:!0,persistState:!0},elements:[]})}function VAe(e,t){return{...e,elements:[...e.elements,t]}}function HAe(e,t){return{...e,elements:e.elements.filter(e=>e.ref!==t)}}function UAe(e,t,n){return{...e,elements:e.elements.map(e=>e.ref===t?{...e,status:n}:e)}}function WAe(e){if(e.elements.length===0)return 0;let t=e.elements.filter(e=>e.status===go.COMPLETED).length;return Math.round(t/e.elements.length*100)}function GAe(e){return e.elements.every(e=>e.status===go.COMPLETED)}function KAe(e,t){return e.elements.filter(e=>e.type===t)}function qAe(e){return JSON.stringify(e,null,2)}function JAe(e){let t=JSON.parse(e);return xp.parse(t)}var YAe=t({ACTOR_TASK_TOPICS_VOCABULARY:()=>ep,AI_ActorCard:()=>k6,AI_ActorExecutionModeBadge:()=>j6,AI_ActorRoleBadge:()=>A6,AI_ActorTeam:()=>uTe,AI_AgentCapabilities:()=>KTe,AI_AgentCard:()=>T8,AI_AgentList:()=>w8,AI_AgentPromptSpec:()=>GTe,AI_ApprovalQueue:()=>cW,AI_ApprovalRequest:()=>sW,AI_Artifact:()=>IDe,AI_ArtifactAction:()=>UDe,AI_ArtifactActions:()=>HDe,AI_ArtifactClose:()=>RDe,AI_ArtifactContent:()=>zDe,AI_ArtifactDescription:()=>VDe,AI_ArtifactFileContent:()=>BTe,AI_ArtifactHeader:()=>LDe,AI_ArtifactItem:()=>S8,AI_ArtifactList:()=>x8,AI_ArtifactOrigin:()=>RTe,AI_ArtifactStructuredContent:()=>VTe,AI_ArtifactTextContent:()=>zTe,AI_ArtifactTitle:()=>BDe,AI_Canvas:()=>yf,AI_ChainOfThought:()=>y7,AI_ChainOfThoughtContent:()=>S7,AI_ChainOfThoughtHeader:()=>b7,AI_ChainOfThoughtImage:()=>mke,AI_ChainOfThoughtSearchResult:()=>pke,AI_ChainOfThoughtSearchResults:()=>fke,AI_ChainOfThoughtStep:()=>x7,AI_Checkpoint:()=>hke,AI_CodeBlock:()=>L5,AI_Confirmation:()=>IOe,AI_Connection:()=>ake,AI_Context:()=>cke,AI_Controls:()=>Pf,AI_Conversation:()=>G5,AI_ConversationContent:()=>K5,AI_ConversationEmptyState:()=>q5,AI_ConversationScrollButton:()=>J5,AI_ConversationThread:()=>LQ,AI_ConversationThreadComposer:()=>RQ,AI_ConversationThreadDiscussions:()=>zQ,AI_DecisionRequest:()=>lW,AI_DiffBlock:()=>R5,AI_Edge:()=>oke,AI_ExecutionPlan:()=>U6,AI_ExecutionPlanProgress:()=>G6,AI_ExecutionPlanStep:()=>W6,AI_ExecutionStream:()=>ike,AI_ExecutionUsage:()=>d8,AI_ExecutionUsageSummary:()=>p8,AI_FlowExecutionCanvas:()=>_Te,AI_FlowExecutionSummary:()=>vTe,AI_FlowExecutionTimeline:()=>N6,AI_FlowExecutionTimelineItem:()=>yTe,AI_FlowNodeStatusBadge:()=>Tf,AI_FlowNodeStepBadge:()=>Of,AI_GraphViewer:()=>M6,AI_HumanInputRequest:()=>uW,AI_Image:()=>XDe,AI_InlineCitation:()=>gke,AI_Loader:()=>dke,AI_Message:()=>UQ,AI_MessageAction:()=>qQ,AI_MessageActions:()=>KQ,AI_MessageAttachment:()=>Kye,AI_MessageAttachments:()=>qye,AI_MessageBranch:()=>Bye,AI_MessageBranchContent:()=>Vye,AI_MessageBranchNext:()=>Wye,AI_MessageBranchPage:()=>Gye,AI_MessageBranchPrevious:()=>Uye,AI_MessageBranchSelector:()=>Hye,AI_MessageContent:()=>WQ,AI_MessageResponse:()=>GQ,AI_MessageToolbar:()=>Jye,AI_ModelSelector:()=>lke,AI_Node:()=>Qf,AI_OpenInChat:()=>uke,AI_Panel:()=>g7,AI_Plan:()=>_ke,AI_PlanAction:()=>Cke,AI_PlanContent:()=>bke,AI_PlanDescription:()=>Ske,AI_PlanFooter:()=>wke,AI_PlanHeader:()=>vke,AI_PlanTitle:()=>xke,AI_PlanTrigger:()=>yke,AI_PromptInput:()=>X5,AI_PromptInputActionAddAttachments:()=>mOe,AI_PromptInputActionMenu:()=>uOe,AI_PromptInputActionMenuContent:()=>fOe,AI_PromptInputActionMenuItem:()=>pOe,AI_PromptInputActionMenuTrigger:()=>dOe,AI_PromptInputAttachment:()=>iOe,AI_PromptInputAttachments:()=>aOe,AI_PromptInputBody:()=>oOe,AI_PromptInputButton:()=>lOe,AI_PromptInputCommand:()=>xOe,AI_PromptInputCommandEmpty:()=>wOe,AI_PromptInputCommandGroup:()=>TOe,AI_PromptInputCommandInput:()=>SOe,AI_PromptInputCommandItem:()=>EOe,AI_PromptInputCommandList:()=>COe,AI_PromptInputCommandSeparator:()=>DOe,AI_PromptInputFooter:()=>Q5,AI_PromptInputHeader:()=>sOe,AI_PromptInputHoverCard:()=>OOe,AI_PromptInputHoverCardContent:()=>AOe,AI_PromptInputHoverCardTrigger:()=>kOe,AI_PromptInputProvider:()=>rOe,AI_PromptInputSelect:()=>gOe,AI_PromptInputSelectContent:()=>vOe,AI_PromptInputSelectItem:()=>yOe,AI_PromptInputSelectTrigger:()=>_Oe,AI_PromptInputSelectValue:()=>bOe,AI_PromptInputSpeechButton:()=>hOe,AI_PromptInputSubmit:()=>$5,AI_PromptInputTab:()=>MOe,AI_PromptInputTabBody:()=>POe,AI_PromptInputTabItem:()=>FOe,AI_PromptInputTabLabel:()=>NOe,AI_PromptInputTabsList:()=>jOe,AI_PromptInputTextarea:()=>Z5,AI_PromptInputTools:()=>cOe,AI_Queue:()=>LOe,AI_QueueItem:()=>zOe,AI_QueueItemAction:()=>WOe,AI_QueueItemActions:()=>UOe,AI_QueueItemAttachment:()=>GOe,AI_QueueItemContent:()=>VOe,AI_QueueItemDescription:()=>HOe,AI_QueueItemFile:()=>qOe,AI_QueueItemImage:()=>KOe,AI_QueueItemIndicator:()=>BOe,AI_QueueList:()=>ROe,AI_QueueMessageItem:()=>$Oe,AI_QueueSection:()=>JOe,AI_QueueSectionContent:()=>ZOe,AI_QueueSectionLabel:()=>XOe,AI_QueueSectionTrigger:()=>YOe,AI_QueueTodoItem:()=>QOe,AI_Reasoning:()=>T7,AI_ReasoningContent:()=>D7,AI_ReasoningTrigger:()=>E7,AI_RiskLevelBadge:()=>V6,AI_Shimmer:()=>_7,AI_Source:()=>i7,AI_Sources:()=>t7,AI_SourcesContent:()=>r7,AI_SourcesTrigger:()=>n7,AI_Suggestion:()=>o7,AI_Suggestions:()=>a7,AI_SystemCard:()=>F6,AI_SystemCardCompact:()=>I6,AI_SystemCatalog:()=>STe,AI_SystemDetail:()=>L6,AI_SystemKindBadge:()=>z6,AI_SystemStatusBadge:()=>B6,AI_Task:()=>eke,AI_TaskContent:()=>nke,AI_TaskDetail:()=>J6,AI_TaskItem:()=>rke,AI_TaskItemFile:()=>l7,AI_TaskList:()=>X6,AI_TaskMemory:()=>jTe,AI_TaskMemoryEntryItem:()=>e8,AI_TaskMemoryScope:()=>$6,AI_TaskTimeline:()=>Z6,AI_TaskTrigger:()=>tke,AI_Tool:()=>d7,AI_ToolContent:()=>p7,AI_ToolHeader:()=>f7,AI_ToolInput:()=>m7,AI_ToolOutput:()=>h7,AI_Toolbar:()=>ske,AI_WebPreview:()=>ZDe,AI_WebPreviewBody:()=>tOe,AI_WebPreviewConsole:()=>nOe,AI_WebPreviewNavigation:()=>QDe,AI_WebPreviewNavigationButton:()=>$De,AI_WebPreviewUrl:()=>eOe,APP_LEVEL_NAVIGATION_SOURCE:()=>hn,APP_SCOPE_FIELD_DEFAULT_POSITION:()=>999,ARRAY_ROW_TEMPLATE_GUTTER_CLASS:()=>`w-7`,Accordion:()=>TO,AccordionContent:()=>OO,AccordionItem:()=>EO,AccordionTrigger:()=>DO,ActionBar:()=>dC,ActionBarPopoverChrome:()=>cC,ActionButton:()=>D8,ActionPlacement:()=>Ks,ActionVisibility:()=>oo,ActivityBarRendering:()=>ya,ActivityBarRenderingSchema:()=>Ia,ActorActivity:()=>D6,Alert:()=>UD,AlertDescription:()=>GD,AlertDialog:()=>tT,AlertDialogAction:()=>cT,AlertDialogCancel:()=>lT,AlertDialogContent:()=>rT,AlertDialogDescription:()=>sT,AlertDialogFooter:()=>aT,AlertDialogHeader:()=>iT,AlertDialogTitle:()=>oT,AlertDialogTrigger:()=>nT,AlertTitle:()=>WD,AnalyticsContext:()=>j$,AnalyticsContextProvider:()=>N$,AnalyticsIdentityPublisherContext:()=>M$,AnalyticsProviderRegistry:()=>k$,AnonymousSessionProvider:()=>vp,AnonymousSessionStatus:()=>Poe,ApiNotReadyError:()=>kl,ApiReadinessChecker:()=>$ne,AppCelebrationOverlay:()=>p$,AppConfiguration_Frontend_Schema:()=>Fm,AppLayoutPreset_ErrorBoundary_Default:()=>rb,AppLayoutPreset_Home_Default:()=>$U,AppLayoutPreset_RouterErrorBoundary_Default:()=>sb,AppLayout_AuthenticatedRoute:()=>KH,AppLayout_ConsentGate:()=>BH,AppLayout_DocumentAcceptanceGate:()=>UH,AppLayout_ErrorBoundary:()=>ib,AppLayout_Home:()=>eW,AppLayout_MainContainer:()=>LH,AppLayout_NotificationCenter:()=>G8,AppLayout_RouterErrorBoundary:()=>cb,AppLevelComponentConfigurationSchema:()=>Soe,AppLoadingGate:()=>wb,AppLoadingIdentifier:()=>h,AppModeDefinitionSchema:()=>jee,AppModeProvider:()=>mS,AppNotificationCenter:()=>W8,AppScopeContext:()=>_oe,AppScopeProvider:()=>Lm,AppScopeSessionMode:()=>yr,AppShellContentOutlet:()=>A4,AppShellLoadingState:()=>E4,AppShellOverlayPortalLayer:()=>O4,AppShellOverlaysOutlet:()=>j4,AppShellProviders:()=>D4,AppShellRegionOutlet:()=>k4,ApplicationContext:()=>Mi,ApplicationLevelComponentType:()=>Fu,ApplicationLevel_ActivityBar:()=>K2,ApplicationLevel_CommandMenu:()=>Xke,ApplicationLevel_ControlPanel:()=>Zke,ApplicationLevel_MenuBar:()=>q2,ApplicationLevel_MenuUserOrg:()=>Qke,ApplicationLevel_NavigationBack:()=>EB,ApplicationLevel_NotificationCenter:()=>tAe,ApplicationLevel_QuickActionButton:()=>J2,ApplicationLevel_QuickSwitcher:()=>nAe,ApplicationLevel_Sidebar:()=>Y2,ApplicationLevel_StatusBar:()=>X2,ApplicationLevel_Toolbar:()=>Z2,ApplicationLevel_UtilityPanel:()=>Q2,ApplicationMainProvider:()=>u1,ArrayAutosavesContext:()=>mI,ArrayField:()=>J9,ArrayItemTemplate:()=>q9,AspectRatio:()=>lEe,AuthPage_OneOffSession:()=>UZ,AuthSessionContext:()=>yoe,AuthSessionProvider:()=>hm,AuthSessionUtils:()=>ah,Auth_AuthCallback:()=>LX,Auth_ChatIdentityLink:()=>rQ,Auth_ConfirmEmail:()=>NZ,Auth_EnrollmentRequired:()=>bZ,Auth_Invitation:()=>BZ,Auth_MagicLinkVerify:()=>VX,Auth_Main:()=>AZ,Auth_MfaChallenge:()=>_Z,Auth_OAuthConsent:()=>QZ,Auth_OAuthLoggedOut:()=>aQ,Auth_OAuthLogoutConfirm:()=>cQ,Auth_OneOffSession:()=>HZ,Auth_OrganizationOnboarding:()=>TZ,Auth_PasswordLost:()=>XZ,Auth_Register:()=>mQ,AutomatedArrayField:()=>SI,AutomatedForm:()=>gE,AutomatedLayoutFrontendUtils:()=>sr,AutomatedLayoutTemplateKind:()=>WT,AutomaticDisplayer:()=>UB,AutosaveFieldState:()=>hT,AutosaveIndicator:()=>qM,AutosaveProvider:()=>zE,AutosaveTrigger:()=>zn,Avatar:()=>M8,AvatarFallback:()=>P8,AvatarImage:()=>N8,BADGE_DISPLAY_CAP:()=>99,BADGE_VARIANT_INDICATOR:()=>v_,BILLING_COMMAND_MENU_ITEM:()=>g6,BILLING_SETTINGS_SECTION_REF:()=>h6,BackendProxyAnalyticsProvider:()=>O$,Badge:()=>Hf,BillingContext:()=>Qh,BillingPortalLink:()=>Z1,BillingProvider:()=>Vh,Breadcrumb:()=>OB,BreadcrumbEllipsis:()=>PB,BreadcrumbItem:()=>AB,BreadcrumbLink:()=>jB,BreadcrumbList:()=>kB,BreadcrumbPage:()=>MB,BreadcrumbSeparator:()=>NB,Button:()=>X,ButtonGroup:()=>O8,ButtonGroupSeparator:()=>QTe,ButtonGroupText:()=>k8,ButtonLabelOverflow:()=>cf,ButtonVariants_Variant:()=>Y,CATEGORY_LOADING_DEFAULTS:()=>Sb,CHART_ROUTE_CONTEXT_QUERY_PARAM_PREFIX:()=>_p,CHART_ROUTE_PATH_PREFIX:()=>qae,COLLECTION_SURFACE_ATTRIBUTE:()=>DA,COMMON_ENUM_DISPLAY_CONFIG:()=>R_,COMPOSITE_ROUTE_CONTEXT_QUERY_PARAM_PREFIX:()=>Lae,Calendar:()=>J8,CalendarDayButton:()=>Y8,Card:()=>MF,CardAction:()=>LF,CardActionPlacementSchema:()=>Lre,CardContent:()=>zF,CardDescription:()=>RF,CardFooter:()=>FF,CardHeader:()=>PF,CardLayoutStyle:()=>Pl,CardListbox:()=>NF,CardStatusEdge:()=>AF,CardTitle:()=>IF,Carousel:()=>i5,CarouselContent:()=>a5,CarouselItem:()=>o5,CarouselNext:()=>dEe,CarouselPrevious:()=>uEe,ChartDashboard:()=>$9,ChartDashboardColumns:()=>Q9,ChartDashboardTileRows:()=>Z9,ChartDashboardTileSpan:()=>X9,ChartEmptyState:()=>z_,ChartErrorState:()=>F_,ChartLoadingSkeleton:()=>Pm,ChartView:()=>rY,ChartWidget:()=>mg,ChatSignInCompletionOutcome:()=>ix,Checkbox:()=>AI,CheckboxRoot:()=>jI,ChipsInput:()=>pI,Code:()=>O_,Collapsible:()=>FO,CollapsibleContent:()=>LO,CollapsibleTrigger:()=>IO,CollectionBoardConfigSchema:()=>gne,CollectionCalendarConfigSchema:()=>_re,CollectionDisplayMode:()=>au,CollectionFilterPanelVisibility:()=>Io,CollectionFilterPresetContextValue:()=>ts,CollectionFilterPresetRelativeMonthRange:()=>ll,CollectionFilterPresetRelativeRange:()=>jc,CollectionFilterPresetSchema:()=>js,CollectionFilterPresetValueSchema:()=>Xne,CollectionTimelineConfigSchema:()=>Kte,CollectionToolbarPresence:()=>fu,ColorInput:()=>zI,ColorNotation:()=>Z3,Combobox:()=>Ax,ComboboxMultiple:()=>jx,Command:()=>DV,CommandBarPolicy:()=>Am,CommandDialog:()=>OV,CommandEmpty:()=>jV,CommandGroup:()=>MV,CommandInput:()=>kV,CommandItem:()=>NV,CommandList:()=>AV,CommandMenuCommandSchema:()=>u,CommandMenuDisplayPolicy:()=>mt,CommandMenuPaletteGroupKind:()=>O2,CommandMenuSearchResourceSchema:()=>Mne,CommandSeparator:()=>FV,CommandShortcut:()=>PV,ComponentNotInjected:()=>Yc,ComponentRegistryKeyBuilder:()=>oie,ComponentRegistryService:()=>wo,ComponentsViewportProvider:()=>p_,ComposedChildrenRegistryProvider:()=>CY,CompositeLayout:()=>tW,CompositeView:()=>JU,CompositeViewDefinitionBaseSchema:()=>goe,CompositeViewDefinitionSchema:()=>pp,CompositeViewProvider:()=>GU,CompositeView_BaseFieldsSchema:()=>poe,ConnectionStatusNotifier:()=>E$,ConsentBasedProviderActivationsContext:()=>Bx,ConsentBasedProviderSdksProvider:()=>Vx,ConsentGateStatus:()=>ux,ConsoleAnalyticsProvider:()=>D$,ContentAreaRenderBranch:()=>u2,ContentSection:()=>BT,ContentSectionContainer:()=>nk,ContentSectionGroup:()=>VT,ContentSectionLegend:()=>HT,ContextLoadingIdentifier:()=>Ko,ContextMenu:()=>nDe,ContextMenuCheckboxItem:()=>oDe,ContextMenuContent:()=>v5,ContextMenuGroup:()=>iDe,ContextMenuItem:()=>aDe,ContextMenuLabel:()=>lDe,ContextMenuRadioGroup:()=>sDe,ContextMenuRadioItem:()=>cDe,ContextMenuSeparator:()=>uDe,ContextMenuShortcut:()=>dDe,ContextMenuSub:()=>fDe,ContextMenuSubContent:()=>y5,ContextMenuSubTrigger:()=>pDe,ContextMenuTrigger:()=>rDe,ControlPanelControlType:()=>D2,ControlPanelItemSchema:()=>Kl,ConversationThreadEntryKind:()=>CQ,ConversationTurnState:()=>wQ,CoreIconRegistry:()=>kf,CrossFrontendHandoffClientError:()=>c6,CustomComponentItemRefSchema:()=>Ore,DEFAULT_ACTION_DISCLOSURE:()=>Lie,DEFAULT_BUTTON_COMPONENT_REQUIREMENT:()=>ap,DEFAULT_CHART_STYLE_PRESET:()=>Pg,DEFAULT_ICON_CONFIG:()=>Kf,DEFAULT_INSERTED_VIEW_LAUNCHER:()=>kae,DEFAULT_MATERIAL_RUNTIME_POLICY:()=>u_,DEFAULT_MAX_EMBEDDED_RESOURCE_DEPTH:()=>3,DEFAULT_SUMMARY_CHROME_MODE:()=>gG,DEFAULT_VALIDATION_MODE:()=>UT,DUPLICATE_KEY_ERROR_TYPE:()=>xT,DangerZone:()=>RY,DatePicker:()=>aN,DateRangePicker:()=>gN,DateTimePicker:()=>cN,DateTimeRangePicker:()=>yN,DecisionInboxCapability:()=>ry,DefaultHotkeyHandler:()=>e1,DescriptionDetails:()=>a0,DescriptionList:()=>r0,DescriptionTerm:()=>i0,DeviceInfoSchema:()=>qse,DeviceType:()=>Qy,Dialog:()=>rG,DialogClose:()=>oG,DialogContent:()=>aG,DialogDescription:()=>uG,DialogFooter:()=>cG,DialogHeader:()=>sG,DialogTitle:()=>lG,DialogTrigger:()=>iG,DiffLineKind:()=>z5,DirectoryProvisioningCapability:()=>Fv,DisabledActionHandling:()=>_o,DiscriminatorSwitch:()=>IR,DisplayChromeContext:()=>vk,DisplayChromeProvider:()=>yk,DisplayContextKind:()=>qA,DisplayContextKindProvider:()=>YA,DisplayDiscriminatorSwitch:()=>LR,DisplayField:()=>TR,DisplayFieldAddress:()=>aM,DisplayFieldArray:()=>q8,DisplayFieldBigDecimal:()=>oM,DisplayFieldBoolean:()=>Zj,DisplayFieldChrome:()=>xj,DisplayFieldCode:()=>sM,DisplayFieldDate:()=>pM,DisplayFieldDateTime:()=>mM,DisplayFieldDuration:()=>rM,DisplayFieldEditable:()=>cR,DisplayFieldEnum:()=>tM,DisplayFieldErrorBoundary:()=>ER,DisplayFieldFile:()=>uM,DisplayFieldFileAudio:()=>V8,DisplayFieldFileDocument:()=>H8,DisplayFieldFileGallery:()=>U8,DisplayFieldFileImage:()=>z8,DisplayFieldFileVideo:()=>B8,DisplayFieldJson:()=>lM,DisplayFieldMoney:()=>nM,DisplayFieldNumber:()=>eM,DisplayFieldPhone:()=>iM,DisplayFieldRangeBigDecimal:()=>dM,DisplayFieldRangeDate:()=>_M,DisplayFieldRangeDateTime:()=>vM,DisplayFieldRangeMoney:()=>fM,DisplayFieldRangeNumber:()=>gM,DisplayFieldRangeTime:()=>yM,DisplayFieldReadOnly:()=>DM,DisplayFieldString:()=>$j,DisplayFieldTime:()=>hM,DisplayLayout:()=>OA,DisplayTemplateProvider:()=>hk,DisplayValueDispatcher:()=>EM,Divider:()=>fEe,DocumentAcceptanceGateStatus:()=>VH,Drawer:()=>E1,DrawerClose:()=>k1,DrawerContent:()=>O1,DrawerDescription:()=>N1,DrawerFooter:()=>j1,DrawerHeader:()=>A1,DrawerTitle:()=>M1,DrawerTrigger:()=>D1,DropdownMenu:()=>x5,DropdownMenuCheckboxItem:()=>hDe,DropdownMenuContent:()=>C5,DropdownMenuGroup:()=>mDe,DropdownMenuItem:()=>w5,DropdownMenuLabel:()=>T5,DropdownMenuRadioGroup:()=>gDe,DropdownMenuRadioItem:()=>_De,DropdownMenuSeparator:()=>E5,DropdownMenuShortcut:()=>vDe,DropdownMenuSub:()=>D5,DropdownMenuSubContent:()=>k5,DropdownMenuSubTrigger:()=>O5,DropdownMenuTrigger:()=>S5,Duration:()=>L8,EMPTY_AUTH_STATE:()=>joe,ENGINE_DEFAULT_HOTKEY_EMIT_SHORTCUTS:()=>$$,ENGINE_PAGE_METADATA:()=>Cl,ENGINE_SETTINGS_DESTINATIONS:()=>Hv,ERROR_DEDUPLICATION_WINDOW_MS:()=>gee,ERROR_MAX_DUPLICATES:()=>3,EXECUTION_ROUTE_CONTEXT_QUERY_PARAM_PREFIX:()=>Toe,EmbedChart:()=>D9,EmbedComposite:()=>uAe,EmbedExecution:()=>dAe,EmbedExecutionDecisions:()=>F9,EmbedHostChart:()=>_Ae,EmbedHostExecution:()=>yAe,EmbedHostResourceOperation:()=>fAe,EmbedLinkedConversations:()=>pAe,EmbedOnboarding:()=>lAe,EmbedRelatedChart:()=>vAe,EmbedRelatedExecution:()=>bAe,EmbedRelatedResourceList:()=>P9,EmbedRelatedResourceOperation:()=>N9,EmbedRelatedResourceSearch:()=>gAe,EmbedRepresentationMailboxes:()=>B9,EmbedRepresentationTeam:()=>z9,EmbedResourceOperation:()=>M9,EmbedResourceOwnedChartView:()=>eve,EmbedResourceOwnedCompositeView:()=>vX,EmbedResourceOwnedExecutionView:()=>tve,EmbeddedResourceDescentBoundary:()=>xY,EmbeddedResourceHostProvider:()=>VU,EmphasisedActionLabelsProvider:()=>pC,EmptyState:()=>Cm,EmptyValueMark:()=>Jj,EngineNavigationEntry:()=>vm,EnginePageItemRefSchema:()=>Ws,EnginePageRef:()=>ao,EnginePageRefSchema:()=>Fre,EnvVariableLoaderFrontendService:()=>Oa,EphemeralSessionTokenStorage:()=>mm,ErrorBoundary:()=>ob,ErrorBuilderFrontend:()=>Ce,ErrorContext:()=>Iu,ErrorDisplay:()=>nb,ErrorManagementService:()=>Hi,ErrorPageActionSchema:()=>eoe,ErrorPageActionType:()=>Em,ErrorPageConfigDefinitionSchema:()=>Ooe,ErrorPageConfigSchema:()=>ioe,ErrorPageFeatureGuideItemSchema:()=>voe,ErrorPageLeadMagnetType:()=>Aoe,ErrorPageSupportAccessSchema:()=>ooe,ErrorPageSupportType:()=>coe,ErrorProvider:()=>xi,EventBusContext:()=>Gi,EventBusProvider:()=>ut,ExecutionAnchorSource:()=>gy,ExecutionConcreteOperationIdentitySchema:()=>xoe,ExecutionDirtyMarkerScope:()=>yy,ExecutionDirtyMarkerScopeContext:()=>Wy,ExecutionDirtyMarkerScopeProvider:()=>Gy,ExecutionFailedActionScope:()=>Cy,ExecutionNavigationHandlingMode:()=>_m,ExecutionNavigationPolicyDefinitionSchema:()=>doe,ExecutionNavigationPolicyExceptionRuleSchema:()=>$ae,ExecutionParticipationDefinitionSchema:()=>Noe,ExecutionParticipationPrefetchIntent:()=>_y,ExecutionParticipationSource:()=>Um,ExecutionRuntimeContext:()=>Ty,ExecutionRuntimeProvider:()=>Dy,ExecutionSurfaceInOperationSchema:()=>roe,ExecutionUsageReadState:()=>c8,ExecutionView:()=>hX,ExecutionViewAnchorBindingSource:()=>Vm,ExecutionViewAnchorDefinitionSchema:()=>Vae,ExecutionViewDefinitionSchema:()=>Sae,FILE_VALIDATION_ERROR_TYPE:()=>uI,FLOWS_ACTORS_RELATION_VOCABULARY:()=>Gf,FLOWS_ACTORS_STATUS_VOCABULARY:()=>zf,FLOW_STEP_CATEGORY_ICONS:()=>op,FLOW_TRIGGER_TYPE_LABEL_KEYS:()=>sf,FOCUS_INDICATOR_CLASSES:()=>Mg,FORM_ERROR_SUMMARY_ATTRIBUTE:()=>rO,FORM_LEVEL_ERROR_PATH:()=>bT,FRONTEND_DECLARED_SCHEMA_KEY:()=>Gu,FRONTEND_PRODUCED_BADGE_SCOPE_ID:()=>b6,FRONTEND_SCHEMA_KEY:()=>Ti,FeatureGate:()=>U0,FeatureLimitIndicator:()=>m6,FeatureLockBadge:()=>tTe,FeatureRouteGuard:()=>lg,FeatureUnavailableDialog:()=>eTe,FeatureUnavailablePrompt:()=>ng,FeaturesContext:()=>Oh,FeaturesProvider:()=>yg,Field:()=>wx,FieldContent:()=>Dx,FieldControlAriaProvider:()=>GM,FieldDescription:()=>Ox,FieldError:()=>kx,FieldLabel:()=>Tx,FieldScopeProvider:()=>LD,FieldSeparator:()=>Hce,FieldTiles:()=>LA,FieldTitle:()=>Ex,FieldValueMembersChromeBoundary:()=>xk,FieldVariants_Orientation:()=>Cx,FileUpload:()=>Z8,FilesPage_UploadGrant:()=>JZ,Files_UploadGrantDrop:()=>qZ,FlowStepCategory:()=>_ae,FlowsActorsContext:()=>EW,FlowsActorsExecutionStatus:()=>SW,FlowsActorsProvider:()=>DW,FlowsActorsUIUtils:()=>Zd,FlowsActorsView:()=>QQ,FlowsActorsViewDefinitionSchema:()=>wae,FlowsActors_AgentCard:()=>ZTe,FlowsActors_AgentList:()=>XTe,FlowsActors_ApprovalQueue:()=>XW,FlowsActors_ApprovalRequest:()=>BW,FlowsActors_ArtifactItem:()=>WTe,FlowsActors_ArtifactList:()=>UTe,FlowsActors_ExecutionUsage:()=>f8,FlowsActors_ExecutionUsageSummary:()=>m8,FocusIndicatorShape:()=>x_,Form:()=>qT,FormChromeContext:()=>uT,FormChromeProvider:()=>dT,FormContextUtils:()=>JD,FormControl:()=>aEe,FormDescription:()=>oEe,FormErrorSummary:()=>lO,FormErrorSummarySlot:()=>pO,FormField:()=>nR,FormFieldAddress:()=>mL,FormFieldAddress_Preset_Default:()=>pL,FormFieldArray:()=>K8,FormFieldBigDecimal:()=>_L,FormFieldBigDecimal_Preset_Default:()=>gL,FormFieldBoolean:()=>PI,FormFieldBoolean_Preset_Default:()=>NI,FormFieldCheckboxGroup:()=>sI,FormFieldChrome:()=>ZM,FormFieldCode:()=>vL,FormFieldComposite:()=>EN,FormFieldContext:()=>e5,FormFieldDate:()=>sN,FormFieldDateTime:()=>uN,FormFieldDateTime_Preset_Default:()=>lN,FormFieldDate_Preset_Default:()=>oN,FormFieldDuration:()=>nL,FormFieldDuration_Preset_Default:()=>tL,FormFieldEnum:()=>lI,FormFieldEnum_Preset_Default:()=>cI,FormFieldFile:()=>JL,FormFieldFile_Preset_Default:()=>qL,FormFieldLegendVoice:()=>PD,FormFieldMoney:()=>eL,FormFieldMoney_Preset_Default:()=>$I,FormFieldNumber:()=>ZI,FormFieldNumber_Preset_Default:()=>XI,FormFieldPhone:()=>lL,FormFieldPhone_Preset_Default:()=>cL,FormFieldPrimitive:()=>cEe,FormFieldRangeBigDecimal:()=>bL,FormFieldRangeBigDecimal_Preset_Default:()=>yL,FormFieldRangeDate:()=>vN,FormFieldRangeDateTime:()=>xN,FormFieldRangeDateTime_Preset_Default:()=>bN,FormFieldRangeDate_Preset_Default:()=>_N,FormFieldRangeMoney:()=>SL,FormFieldRangeMoney_Preset_Default:()=>xL,FormFieldRangeNumber:()=>hN,FormFieldRangeNumber_Preset_Default:()=>mN,FormFieldRangeTime:()=>wN,FormFieldRangeTime_Preset_Default:()=>CN,FormFieldString:()=>YI,FormFieldString_Preset_Default:()=>JI,FormFieldTime:()=>pN,FormFieldTime_Preset_Default:()=>fN,FormItem:()=>rEe,FormItemContext:()=>t5,FormLabel:()=>iEe,FormLayout:()=>hA,FormMessage:()=>sEe,FormRoot:()=>nEe,FormSchemaContext:()=>gT,FormSchemaKind:()=>mT,FormSchemaProvider:()=>_T,FormTemplateProvider:()=>YT,FrontEndEvent_BasicUser_Schema:()=>Gie,FrontendEventBadgeCountChangedSchema:()=>ae,FrontendEventBulkJobProgressSchema:()=>mte,FrontendEventCategory:()=>Yt,FrontendEventCategoryMap:()=>ite,FrontendEventCustomSchema:()=>bte,FrontendEventErrorOccuredSchema:()=>Ft,FrontendEventLoadingResourceSchema:()=>Gn,FrontendEventNoDataSchema:()=>Xre,FrontendEventNotifyCustomSchema:()=>On,FrontendEventOrgBillingStatusChangedSchema:()=>Nte,FrontendEventOrgStatusChangedSchema:()=>Dte,FrontendEventOrganizationBrandingChangedSchema:()=>Ra,FrontendEventResourceCustomSchema:()=>Mee,FrontendEventResourceEditingSchema:()=>p,FrontendEventResourceOperationSchema:()=>Nne,FrontendEventSchemas:()=>fie,FrontendEventUserLoginSchema:()=>jre,FrontendEventUserLogoutSchema:()=>Ol,FrontendEventUserPreferencesChangedSchema:()=>Qne,FrontendEventUserStatusChangedSchema:()=>nne,FrontendEvent_AnalyticsMomentAchievedSchema:()=>zre,FrontendEvent_AppScopeChangedSchema:()=>zl,FrontendEvent_GuidanceElementSchema:()=>yne,FrontendEvent_GuidanceFlowSchema:()=>yre,FrontendEvent_HotkeyCommandMenuOpenSchema:()=>vie,FrontendEvent_HotkeyNotificationsOpenSchema:()=>Ane,FrontendEvent_HotkeyQuickSwitcherOpenSchema:()=>Une,FrontendEvent_HotkeyShortcutsHelpSchema:()=>Ure,FrontendEvent_HotkeySidebarToggleSchema:()=>Tre,FrontendEvent_LifecycleStageChangedSchema:()=>Ps,FrontendEvent_MilestoneAchievedSchema:()=>hs,FrontendEvent_NavigationClearZoneSchema:()=>Yte,FrontendEvent_NavigationCloseSchema:()=>Oie,FrontendEvent_NavigationOrganizationFollowedSchema:()=>Bie,FrontendEvent_NavigationPopSchema:()=>mne,FrontendEvent_NavigationPushSchema:()=>Aie,FrontendEvent_NavigationReplaceSchema:()=>Yee,FrontendEvent_NavigationRequestSchema:()=>Ee,FrontendEvent_NavigationUrlPathUpdatedSchema:()=>Au,FrontendEvent_NavigationZoneChangedSchema:()=>Wi,FrontendEvent_PrimaryScopeChangedSchema:()=>lt,FrontendEvent_ProgressionUpdatedSchema:()=>Ge,FrontendEvent_ResourceCollectionFiltersChangedSchema:()=>yee,FrontendEvents:()=>hc,FrontendInsertedViewHostKind:()=>Qp,FrontendInsertedViewIdentitySchema:()=>Tae,FrontendInsertedViewKind:()=>Mp,FrontendResourceOperationAddressingMode:()=>Koe,FrontendResourceOperationContextSchema:()=>xe,FrontendResourceOperationPathSchema:()=>Vte,FrontendResourcePathSchema:()=>$r,FrontendResource_ParentResourceRequirementSchema:()=>c,FrontendView_DefinitionSchema:()=>dp,FrontendView_ScopeMode:()=>fm,FullCustomView:()=>SQ,FullCustomViewDefinitionSchema:()=>Uae,GENERIC_ERROR_WORDING_BY_ERROR_TYPE:()=>Iae,GRAPH_VIEW_ADMITS_PORT:()=>vae,GRAPH_VIEW_GATE_PORT:()=>xae,GRAPH_VIEW_IN_PORT:()=>`in`,GRAPH_VIEW_LAYOUT_GROUP_HEADER:()=>32,GRAPH_VIEW_LAYOUT_GROUP_MIN_WIDTH:()=>160,GRAPH_VIEW_LAYOUT_GROUP_PADDING:()=>16,GRAPH_VIEW_LAYOUT_NODE_SPACING:()=>40,GRAPH_VIEW_LAYOUT_RANK_SPACING:()=>80,GRAPH_VIEW_OUT_PORT:()=>`out`,GUIDANCE_ELEMENT_COMPONENT_TYPE:()=>m4,GUIDANCE_FALLBACK:()=>sU,GenericErrorWording:()=>hoe,GlobalErrorHandler:()=>pb,GoogleFontPresets:()=>Ng,GovernedDocumentAcceptanceControl:()=>uQ,GraphCanvasInteraction:()=>Uf,GraphHandleRole:()=>Vf,GraphLegendMark:()=>Xf,GraphNodeSide:()=>Jf,GraphViewEdgeKind:()=>lp,GraphViewLayoutDirection:()=>tf,GraphViewNodeKind:()=>gae,GraphViewerPresentation:()=>Cf,Group:()=>K9,GroupedSectionBody:()=>lA,GuidanceAnnouncement:()=>l4,GuidanceBadge:()=>u4,GuidanceBanner:()=>c4,GuidanceCard:()=>d4,GuidanceChecklist:()=>r4,GuidanceChecklistItem:()=>i4,GuidanceContext:()=>eU,GuidanceContextProvider:()=>CU,GuidanceModal:()=>s4,GuidanceRenderer:()=>b4,GuidanceSurvey:()=>f4,GuidanceTooltip:()=>o4,GuidanceTour:()=>a4,HOTKEY_DEFAULT_PRIORITY:()=>0,HOTKEY_FRAMEWORK_DEFAULT_PRIORITY:()=>B$,HOTKEY_SCOPE_SPECIFICITY:()=>V$,HTTP_ERROR_BEHAVIOR_MATRIX:()=>He,HeaderIconPlacement:()=>Tu,Heading:()=>zY,HomeDefinitionSchema:()=>woe,HostFormActionsFooter:()=>bE,HostedComponentInteractionsProvider:()=>n4,HostedTriggerAppearance:()=>cie,HotkeyBindingSchema:()=>ko,HotkeyDispatchableEvent:()=>Ye,HotkeyEmitShortcutSchema:()=>xee,HotkeyGroup:()=>vc,HotkeyRegistryContext:()=>G$,HotkeyRegistryProvider:()=>q$,HotkeyScope:()=>L,HotkeyShortcutsHelpDialog:()=>i1,HoverCard:()=>j5,HoverCardContent:()=>N5,HoverCardTrigger:()=>M5,HumanDecisionForm:()=>y8,I18nContext:()=>yc,I18nProvider:()=>eu,ICON_SIZE_MAP:()=>fd,INDICATOR_BADGE_VARIANT:()=>f_,IconCategory:()=>re,IconCategorySchema:()=>fte,IconPropsSchema:()=>Kt,IconRegistryBridge:()=>h$,IconRegistryContext:()=>tp,IconRegistryProvider:()=>Ef,IconRequestSchema:()=>tte,IconSize:()=>fa,IconSizeSchema:()=>Mt,Identifier:()=>I8,ImageCrop:()=>OL,InMemoryFrontendProviderRegistryFrontendService:()=>tx,InitializationStatusSchema:()=>Ze,InlineEditMutationError:()=>Tj,InlineEditState:()=>GT,InlineEditText:()=>X8,Input:()=>rN,InputGroup:()=>rL,InputGroupAddon:()=>iL,InputGroupButton:()=>aL,InputGroupInput:()=>oL,InputGroupText:()=>Dme,InputGroupTextarea:()=>sL,InputOTP:()=>UI,InputOTPGroup:()=>WI,InputOTPSeparator:()=>yme,InputOTPSlot:()=>GI,InputRoot:()=>iN,InsertedChartDeclarationSchema:()=>Dae,InsertedViewInputBindingSchema:()=>Eoe,InsertedViewInputBindingSource:()=>Aae,InsertedViewLauncherConfigSchema:()=>Pae,InsertedViewLauncherPlacement:()=>qp,InsertedViewRenderSlot:()=>bX,InvoiceHistory:()=>n0,Kbd:()=>t1,LIFECYCLE_DEFAULTS:()=>oU,LOCAL_STORAGE_KEYS:()=>as,Label:()=>iZ,LauncherItemRefSchema:()=>hre,LauncherItemTargetKind:()=>ru,LauncherItemTargetKindSchema:()=>Ene,LauncherRuntimeAvailabilityConfigSchema:()=>zne,LauncherVerificationErrorCode:()=>Xv,LauncherVerificationSeverity:()=>Yv,LayoutDivider:()=>AAe,LazyDoorErrorBoundary:()=>tY,LazyDoorUnavailableFrame:()=>nY,Link:()=>PX,LinkVariants_Underline:()=>MX,LinkVariants_Variant:()=>jX,LinkVariants_Weight:()=>NX,LoadingBarrier:()=>dce,LoadingContext:()=>dh,LoadingGate:()=>yb,LoadingOverlay:()=>_b,LoadingPhase:()=>Jl,LoadingProvider:()=>Qm,LoadingSpinner:()=>gb,LoadingTier:()=>Hc,LoadingTreatment:()=>wl,LoggerFrontendService:()=>Jo,MOBILE_DETAIL_MAX_PRIMARY_ACTIONS:()=>1,MOBILE_SUMMARY_MAX_PRIMARY_ACTIONS:()=>0,MainContextInitComponents:()=>Ne,MarkdownEditor:()=>RI,MaterialRefractiveBudgetManager:()=>y_,MaterialRuntimeGroup:()=>r_,MaterialRuntimePolicyProvider:()=>i_,MenuBarDisplayPolicy:()=>boe,Menubar:()=>pEe,MenubarCheckboxItem:()=>_Ee,MenubarContent:()=>u5,MenubarGroup:()=>hEe,MenubarHostedComponentSchema:()=>Vre,MenubarItem:()=>gEe,MenubarLabel:()=>bEe,MenubarLauncherItemSchema:()=>xre,MenubarMenu:()=>mEe,MenubarRadioGroup:()=>vEe,MenubarRadioItem:()=>yEe,MenubarSeparator:()=>xEe,MenubarShortcut:()=>SEe,MenubarSub:()=>CEe,MenubarSubContent:()=>d5,MenubarSubTrigger:()=>wEe,MenubarTrigger:()=>l5,MilestoneStatus:()=>OU,MissingRMMRuntimeError:()=>pa,ModifierKey:()=>R$,NAVIGATION_STRUCTURAL_ZONES:()=>or,NON_CANONICAL_SHELL_SURFACE_POLICY_OVERRIDE:()=>iD,NOTIFICATION_DISPLAY_POLICY:()=>Yoe,NOTIFICATION_SOURCE_OVERRIDES:()=>sg,NavigationBackHost:()=>wB,NavigationContentAreas:()=>b2,NavigationContentRenderer:()=>e2,NavigationContentSchema:()=>hi,NavigationContentType:()=>hd,NavigationContext:()=>Eh,NavigationInitiatorContextSchema:()=>oe,NavigationItemBadge:()=>s5,NavigationItemType:()=>aa,NavigationMenu:()=>TEe,NavigationMenuContent:()=>OEe,NavigationMenuIndicator:()=>jEe,NavigationMenuItem:()=>DEe,NavigationMenuLink:()=>AEe,NavigationMenuList:()=>EEe,NavigationMenuTrigger:()=>kEe,NavigationMenuViewport:()=>MEe,NavigationOperationOverrideSchema:()=>Be,NavigationOverlays:()=>x2,NavigationPlacementAdjustment:()=>Zt,NavigationProvider:()=>ph,NavigationSource:()=>Zi,NavigationStackEntrySchema:()=>xte,NavigationTransitionSource:()=>Rt,NavigationUtils:()=>Ch,NavigationZone:()=>qn,NavigationZoneSchema:()=>Zre,NetworkOfflineError:()=>In,NetworkOfflineReason:()=>Kre,NotificationBadgeMemoryBoundary:()=>x$,NotificationContext:()=>Sh,NotificationIndicator:()=>F8,NotificationProvider:()=>eh,ObjectScope:()=>FR,OfflineReplayPolicy:()=>bn,OnboardingView:()=>S9,OnboardingViewDefinitionSchema:()=>xp,OperationsConfirmCritical:()=>Jw,OverlayContainer:()=>I1,PRIMARY_SCOPE_FIELDS:()=>pee,PROFESSIONAL_QUALIFICATIONS_DECLARED_CAPABILITY:()=>Vv,PROGRESSION_DEFAULTS:()=>aU,PROVIDER_ADDRESS_LOOKUP_DEBOUNCE_MS:()=>300,PROVIDER_ADDRESS_LOOKUP_MINIMUM_QUERY_LENGTH:()=>3,Pagination:()=>yDe,PaginationContent:()=>bDe,PaginationEllipsis:()=>TDe,PaginationItem:()=>xDe,PaginationLink:()=>SDe,PaginationNext:()=>wDe,PaginationPrevious:()=>CDe,PasskeyAutofillExpiredError:()=>Hm,PasskeyAutofillSupersededError:()=>toe,PasskeySignInMediation:()=>Bm,PasswordInput:()=>VI,PendingDecisionsReadState:()=>hW,PersistentSessionTokenStorage:()=>Qae,PlanChangePreview:()=>$1,Popover:()=>pq,PopoverAnchor:()=>gq,PopoverContent:()=>hq,PopoverTrigger:()=>mq,PortalContainerContext:()=>V2,PricingTable:()=>e0,Progress:()=>I_,ProgressionAchievementBadge:()=>rTe,ProgressionMilestoneTracker:()=>zU,ProviderAddressLookupAttribution:()=>Nx,ProviderAddressLookupCombobox:()=>Fx,ProviderAddressLookupHost:()=>Rx,ProviderAddressLookupNotice:()=>Lx,ProviderAddressLookupPlaceWithoutAddressError:()=>Mx,ProviderAddressLookupRejectionKind:()=>yx,ProviderFilePickerHost:()=>Sx,ProviderFileSelectionRejectionKind:()=>_x,PublicLayoutPreset_AuthCallback_Default:()=>IX,PublicLayoutPreset_ChatIdentityLink_Default:()=>nQ,PublicLayoutPreset_EnrollmentRequired_Default:()=>yZ,PublicLayoutPreset_FileUploadGrant_Default:()=>KZ,PublicLayoutPreset_MagicLinkVerify_Default:()=>BX,PublicLayoutPreset_MfaChallenge_Default:()=>gZ,PublicLayoutPreset_OAuthConsent_Default:()=>ZZ,PublicLayoutPreset_OAuthLoggedOut_Default:()=>iQ,PublicLayoutPreset_OAuthLogoutConfirm_Default:()=>sQ,PublicLayoutPreset_OneOffSession_Default:()=>VZ,PublicLayoutPreset_OrganizationOnboarding_Default:()=>wZ,PublicLayoutPreset_StaticContentContainer_Default:()=>J3,PublicLayoutPreset_UserAuth_Default:()=>kZ,PublicLayoutPreset_UserConfirmEmail_Default:()=>MZ,PublicLayoutPreset_UserInvitation_Default:()=>zZ,PublicLayoutPreset_UserPasswordLost_Default:()=>YZ,PublicLayoutPreset_UserRegister_Default:()=>pQ,PublicLayout_LegalNotice:()=>gQ,PublicLayout_MainContainer:()=>AX,PublicLayout_StaticContentContainer:()=>Lwe,PublicLayout_Terms:()=>hQ,PublicShellIdentityMode:()=>gm,QuickActionButtonPlacement:()=>Ts,QuickActionButtonPlacementSchema:()=>Jne,QuickActionDisplayPolicy:()=>cc,QuickActionItemSchema:()=>Wte,QuickActionPlacement:()=>uoe,QuickSwitcherFieldControlKind:()=>T2,QuickSwitcherFieldPresentation:()=>om,QuickSwitcherPlacement:()=>Moe,QuickSwitcherScopeFieldSchema:()=>Loe,READ_RETRY_FIRST_DELAY_MS:()=>mY,READ_RETRY_MAX_DELAY_MS:()=>hY,REGIONAL_PREFERENCE_FRAMEWORK_FLOOR:()=>Kne,RETRYABLE_CLIENT_ERROR_STATUSES:()=>ic,REVEAL_FIELD_EVENT:()=>YD,RUNTIME_SCOPED_STORAGE_KEYS:()=>Wre,RadioGroup:()=>DF,RadioGroupItem:()=>kF,RadioGroupRoot:()=>OF,RangeSlider:()=>tN,RecordFactRole:()=>BA,RecordKeepingFacts:()=>zA,RecordState:()=>RA,RegionalReaderStanding:()=>Ga,RegionalReaderStandingPublisherContext:()=>Sne,RegistrationOutcome:()=>Gp,RelatedResourcePreview:()=>sAe,RelatedResourcePreviewSurface:()=>x9,RelatedResourceSections:()=>H9,RelationshipShapeCapability:()=>Nv,RelationshipSideCapability:()=>Av,ResizableHandle:()=>g1,ResizablePanel:()=>h1,ResizablePanelGroup:()=>m1,ResolvedInsertedChartDescriptorSchema:()=>Kae,ResolvedInsertedViewDescriptorSchema:()=>Xae,ResourceAutomatedForm:()=>xB,ResourceAutomaticDisplayer:()=>_Y,ResourceCollectionQuickFilterTabs:()=>uq,ResourceDisplayContext:()=>Cj,ResourceEmptyState:()=>cK,ResourceFieldDisplay_ResourceReference:()=>Qj,ResourceFieldEdit_ResourceReference:()=>CI,ResourceFormActionsProvider:()=>vE,ResourceFrontend_EmptyStateSecondaryActionType:()=>Lr,ResourceFrontend_GuidanceFlowTriggerType:()=>ure,ResourceHeaderContextProvider:()=>GB,ResourceHeaderLeading:()=>ZB,ResourceHeaderTitle:()=>XB,ResourceHeaderTitleHeading:()=>qB,ResourceHeaderTitlePlaceholder:()=>JB,ResourceLayoutInlineEditDefault:()=>k,ResourceLayoutPreset_Action_Default:()=>eG,ResourceLayoutPreset_Breadcrumb_Default:()=>LB,ResourceLayoutPreset_ContainerDialogs_Default:()=>W3,ResourceLayoutPreset_ContainerNested_Default:()=>PY,ResourceLayoutPreset_Create_Default:()=>fG,ResourceLayoutPreset_Create_SamlWizard:()=>_9,ResourceLayoutPreset_DangerZone_Default:()=>VY,ResourceLayoutPreset_Filters_Default:()=>G3,ResourceLayoutPreset_Header_Default:()=>fV,ResourceLayoutPreset_List_Default:()=>DX,ResourceLayoutPreset_OperationsBulk_Default:()=>QJ,ResourceLayoutPreset_OperationsItems_Default:()=>IY,ResourceLayoutPreset_Pagination_Default:()=>rK,ResourceLayoutPreset_ReadSummary_Default:()=>q3,ResourceLayoutPreset_Read_Default:()=>QY,ResourceLayoutPreset_Read_Expandable:()=>K3,ResourceLayoutPreset_Read_SsoSaml:()=>v9,ResourceLayoutPreset_RecordSharing_Default:()=>JY,ResourceLayoutPreset_Search_Default:()=>nX,ResourceLayoutPreset_Update_Default:()=>iX,ResourceLayout_Action:()=>tG,ResourceLayout_Breadcrumb:()=>zB,ResourceLayout_ContainerDialogs:()=>jwe,ResourceLayout_ContainerNested:()=>FY,ResourceLayout_Create:()=>pG,ResourceLayout_DangerZone:()=>HY,ResourceLayout_Filters:()=>Mwe,ResourceLayout_Header:()=>pV,ResourceLayout_InsertedViews:()=>SX,ResourceLayout_List:()=>OX,ResourceLayout_OperationBulk:()=>$J,ResourceLayout_OperationsItems:()=>LY,ResourceLayout_Pagination:()=>iK,ResourceLayout_Read:()=>eX,ResourceLayout_ReadSummary:()=>Pwe,ResourceLayout_RecordSharing:()=>YY,ResourceLayout_Search:()=>rX,ResourceLayout_Update:()=>aX,ResourceOperationActionPresentation:()=>rc,ResourceOperationActionScope:()=>ree,ResourceOperationFrontendConfigSchema:()=>Tr,ResourceOperationItemRefSchema:()=>wie,ResourceRegistryContext:()=>ym,ResourceRegistryProvider:()=>cm,ResourceSummaryDisplayer:()=>yG,ResourceViewItemRefSchema:()=>Pie,ResourcesRepositoryFrontendService:()=>ZS,RouterErrorBoundary:()=>ub,SCAFFOLD_SETTINGS_HUB_CONFIG:()=>cse,SCAFFOLD_SETTINGS_RAIL_GROUPS:()=>Uv,SCOPE_PARAM_PREFIX:()=>Jr,SERVER_ERROR_TYPE:()=>vT,SESSION_STORAGE_KEYS:()=>Ere,SETTINGS_HUB_TITLE_LABEL_KEY:()=>uh,SHELL_ANCHORED_POPUP_ORIGINS:()=>c3,SHELL_CENTRED_POPUP_SLOTS:()=>awe,SHELL_GHOST_ATTRIBUTE:()=>X4,SHELL_GHOST_LAYER_ATTRIBUTE:()=>Y4,SHELL_MODAL_POPUP_SLOTS:()=>l3,SHELL_OBJECT_ATTRIBUTE:()=>J4,SHELL_PANE_SELECTOR:()=>t3,SHELL_POPUP_OPEN_STATES:()=>u3,SHELL_PRESS_ORIGIN_MAX_AGE_MS:()=>800,SHELL_PROXY_ATTRIBUTE:()=>q4,SHELL_PROXY_FLIGHT_SHARE:()=>K4,STATUS_BAR_PLACEMENTS:()=>cee,SameSite:()=>$y,ScopeChangeInitiator:()=>wt,ScopeUtilsService:()=>pm,ScopedNavigationControllerContext:()=>LS,ScrollArea:()=>hf,ScrollAreaType:()=>mf,ScrollBar:()=>gf,Section:()=>cA,SectionLegendVoiceHost:()=>ND,SectionSaveButton:()=>dA,SectionStageBindingError:()=>KO,SectionStageState:()=>GO,Select:()=>bF,SelectContent:()=>CF,SelectGroup:()=>Npe,SelectItem:()=>TF,SelectLabel:()=>Ppe,SelectMultiple:()=>BF,SelectPosition:()=>vF,SelectRoot:()=>xF,SelectScrollDownButton:()=>Lpe,SelectScrollUpButton:()=>Ipe,SelectSeparator:()=>Fpe,SelectTrigger:()=>SF,SelectValue:()=>wF,Separator:()=>H1,SessionEndReason:()=>P,SessionEstablishment:()=>ac,SettingsHubVerificationErrorCode:()=>sy,SettingsHubVerificationSeverity:()=>oy,SettingsPanelRef:()=>kv,SettingsSectionItemRefSchema:()=>cne,SettingsSectionTargetKind:()=>Ov,Sheet:()=>v1,SheetClose:()=>Txe,SheetContent:()=>b1,SheetDescription:()=>w1,SheetFooter:()=>S1,SheetHeader:()=>x1,SheetTitle:()=>C1,SheetTrigger:()=>y1,ShellDialogArrival:()=>G4,ShellGhostKind:()=>Z4,ShellGhostLayer:()=>Q4,ShellGhostPose:()=>V4,ShellIdentitySchema:()=>noe,ShellLayoutFamily:()=>N4,ShellLayoutPlacementKind:()=>M4,ShellMotionDip:()=>H4,ShellPaneArrival:()=>U4,ShellPaneResize:()=>W4,ShellPlaceChange:()=>B4,ShellPopupSlot:()=>s3,Sidebar:()=>NEe,SidebarCollapsible:()=>m5,SidebarContent:()=>PEe,SidebarFooter:()=>FEe,SidebarGroup:()=>IEe,SidebarGroupAction:()=>LEe,SidebarGroupContent:()=>REe,SidebarGroupLabel:()=>zEe,SidebarHeader:()=>BEe,SidebarHomeDisplayMode:()=>Bu,SidebarHostedComponentSchema:()=>Wee,SidebarInput:()=>VEe,SidebarInset:()=>HEe,SidebarItemDisplayPolicy:()=>kr,SidebarItemSchema:()=>ge,SidebarMenu:()=>UEe,SidebarMenuAction:()=>WEe,SidebarMenuBadge:()=>GEe,SidebarMenuButton:()=>KEe,SidebarMenuButtonVariant:()=>h5,SidebarMenuItem:()=>qEe,SidebarMenuSkeleton:()=>JEe,SidebarMenuSub:()=>YEe,SidebarMenuSubButton:()=>XEe,SidebarMenuSubItem:()=>ZEe,SidebarProvider:()=>QEe,SidebarRail:()=>$Ee,SidebarResourceBrowser:()=>g9,SidebarResponsivePolicy:()=>xu,SidebarResponsivePolicySchema:()=>Li,SidebarSectionBehavior:()=>tt,SidebarSectionContentKind:()=>Le,SidebarSectionContentKindSchema:()=>mee,SidebarSectionInlineCreate:()=>dc,SidebarSectionSchema:()=>w,SidebarSection_CustomComponentSchema:()=>rre,SidebarSection_GuidanceWidgetSchema:()=>tee,SidebarSection_NavigationListSchema:()=>uee,SidebarSection_ResourceBrowserSchema:()=>Tee,SidebarSeparator:()=>eDe,SidebarTrigger:()=>tDe,SidebarVariant:()=>p5,Skeleton:()=>Tm,Slider:()=>$M,SliderRoot:()=>eN,StackedActions:()=>ADe,StackedAside:()=>NDe,StackedBody:()=>MDe,StackedContent:()=>PDe,StackedHeader:()=>DDe,StackedLayout:()=>EDe,StackedSection:()=>FDe,StackedSubtitle:()=>kDe,StackedTitle:()=>ODe,StackedToolbar:()=>jDe,StandardIconReference:()=>H,StandardIconReferenceSchema:()=>qre,StartApplicationFrontendService:()=>u$,StatusBarDisplayInteractionType:()=>E2,StatusBarItemSchema:()=>Ioe,StatusBarItemType:()=>Zr,StatusBarPlacementSchema:()=>Et,StepUpAuthContext:()=>OH,StepUpAuthProvider:()=>kH,StepUpRefusalOrigin:()=>qi,Stepper:()=>zO,StepperDescription:()=>WO,StepperIndicator:()=>VO,StepperItem:()=>BO,StepperSeparator:()=>HO,StepperTitle:()=>UO,Strong:()=>k_,Subheading:()=>BY,SubmitButton:()=>hO,SubscriptionStatus:()=>X1,SummaryFlow:()=>MR,SummaryHeader:()=>U9,SummaryLayout:()=>PR,SummaryMeta:()=>bG,SummaryTitle:()=>AR,SummaryTitlePlacement:()=>jR,SummaryTitleScale:()=>kR,Surface:()=>AD,SurfaceAction:()=>kD,SurfaceBody:()=>DD,SurfaceErrorBoundary:()=>eD,SurfaceFooter:()=>OD,SurfaceHeader:()=>ED,SurfacePolicyContext:()=>Ke,SurveyBindingWriteOutcome:()=>gU,Switch:()=>DI,SwitchRoot:()=>OI,TONE_DOT_CLASS:()=>of,TONE_INK:()=>hae,TONE_MARKER_COLOUR:()=>Df,TONE_MARKER_FILL:()=>$f,Table:()=>NJ,TableBody:()=>FJ,TableCaption:()=>Rge,TableCell:()=>RJ,TableFooter:()=>Lge,TableHead:()=>LJ,TableHeader:()=>PJ,TableRow:()=>IJ,Tabs:()=>bO,TabsActivationMode:()=>gO,TabsContent:()=>CO,TabsLevel:()=>_O,TabsLevelContext:()=>vO,TabsList:()=>xO,TabsTrigger:()=>SO,Text:()=>Z,TextDirection:()=>Jd,TextLink:()=>P_,TextSize:()=>lu,TextVariant:()=>$u,Textarea:()=>II,TextareaRoot:()=>LI,TimePicker:()=>dN,TimeRangePicker:()=>SN,Timeline:()=>Yf,TimelineActions:()=>Ff,TimelineBody:()=>bf,TimelineEntry:()=>Wf,TimelineMarker:()=>Zf,TimelineTime:()=>wf,Toaster:()=>m$,Toggle:()=>$8,ToggleGroup:()=>MO,ToggleGroupAppearance:()=>AO,ToggleGroupBoolean:()=>MI,ToggleGroupItem:()=>NO,ToggleGroupType:()=>kO,ToggleVariants_Variant:()=>Q8,ToolbarItemRefSchema:()=>vt,ToolbarItemSchema:()=>cn,Tooltip:()=>mj,TooltipContent:()=>gj,TooltipProvider:()=>_j,TooltipTrigger:()=>hj,TruncatedText:()=>A8,TypographyScope:()=>j_,UIContext:()=>__,UIProvider:()=>n_,UNIQUE_ERROR_TYPE:()=>yT,UpdateLikeMutationFallbackMode:()=>Nt,UsageDashboard:()=>t0,UserDropdownAvatarDisplay:()=>Jp,UserDropdownSection:()=>yp,UserOrgsContext:()=>_h,UserOrgsProvider:()=>Ym,UtilityPanelItemSchema:()=>nr,ValidationMode:()=>pr,ViewItemRefSchema:()=>zee,ViewLayout_Header:()=>mX,ViewNotFound:()=>E_,WINDOW_EVENTS_SLUGS:()=>de,WebSocketContext:()=>Sm,WebSocketEventBridge:()=>C$,WebSocketProvider:()=>Rm,WebSocketResourceValidationService:()=>aY,WebSocketStatus:()=>dm,WildoBackendHttpClient:()=>ca,WildoBackendHttpClient_ManualCalls:()=>jr,WildoBackendHttpClient_Resources:()=>Yx,WizardLayout:()=>OAe,WizardStep:()=>W9,ZoneContentRenderer:()=>n2,_clearContributedProviderComponentLoaders:()=>zce,actionBarItemCannotRun:()=>lC,actorActivityLabelKey:()=>O6,actorModeDescriptionKey:()=>T6,actorModeLabelKey:()=>w6,actorRoleLabelKey:()=>C6,actorSystemExecutionGraph:()=>ff,addElement:()=>VAe,allocateActionBarSlots:()=>uC,allowsDirectOperationFallback:()=>Un,appendFileServeVariant:()=>oH,appendNavChildrenToSidebarSection:()=>gv,applyChartColorPalette:()=>Wg,applyCustomTokens:()=>l_,applyDesignSystemConfiguration:()=>Ag,applyDesignTokens:()=>c_,applyFrontendConfigOverrides:()=>Zy,applyTypographyConfiguration:()=>Hg,assertExecutionDirtyMarkerShape:()=>by,assertExecutionEmbeddableContent:()=>Sy,assertExecutionFailedActionShape:()=>wy,assertExecutionLocalPanePayloadIsNotEmbeddableContent:()=>xy,assertExecutionPendingPrefetchShape:()=>vy,assertExecutionRuntimeContext:()=>Ey,assertRegistryCompleteness:()=>Hwe,assertSectionStageBinding:()=>qO,attachBackendErrorEnvelope:()=>iee,authFactorLevelForUiLevel:()=>Bae,backendNotificationDestination:()=>Qoe,backendNotificationI18nParams:()=>ese,badgeVariantIndicator:()=>g_,brandShellLayoutMainContainer:()=>L4,buildAppLoadingScope:()=>qoe,buildApplicationCompositeViewDefinitions:()=>Fp,buildApplicationCompositeViewTranslationRef:()=>Rp,buildApplicationViewTranslationRef:()=>koe,buildAuthoredIconRegistry:()=>g$,buildChartRouteUrlPath:()=>$p,buildCompositeRouteUrlPath:()=>Vp,buildContextLoadingScope:()=>Xoe,buildExecutionConcreteOperationIdentity:()=>Foe,buildExecutionDirtyMarker:()=>Kse,buildExecutionFailedAction:()=>jy,buildExecutionRouteUrlPath:()=>Yp,buildFileServeThumbnailUrl:()=>sH,buildFrontendInsertedViewRef:()=>Yae,buildFrontendModuleAppComponentsConfiguration:()=>Dv,buildFrontendModuleAppScope:()=>Tv,buildFrontendModuleConfigOverrides:()=>Xy,buildFrontendModuleRegistry:()=>wv,buildFrontendModuleSidebarSections:()=>Ev,buildLoadingScopeKey:()=>hh,buildOmniboxRecordContextIdentifiers:()=>l9,buildResolvedInsertedChartDescriptor:()=>Op,buildResourceCompositeViewTranslationRef:()=>Tp,buildResourceFileServeBaseUrl:()=>aH,buildResourceInsertedChartIdentity:()=>Np,buildResourceInsertedCompositeIdentity:()=>Ap,buildResourceInsertedExecutionIdentity:()=>Cp,buildResourceLoadingScope:()=>Dg,buildScopeConditionParams:()=>f6,buildSummaryRecordIdentifiers:()=>_G,calculateGlassBezelResponse:()=>m_,calculateGlassBoundaryCoverage:()=>d_,calculateGlassEdgeResponse:()=>o_,calculateGlassRefractionProfile:()=>a_,calculateRoundedRectangleOutwardNormal:()=>$g,canExportWithinAllowedMimeTypes:()=>RL,cardsAfterWithdrawal:()=>pW,cascadeShellRows:()=>C3,choreographyGraph:()=>bae,clampCropOffset:()=>ML,clampStaticSidePanels:()=>f2,classifyRecordFact:()=>GA,classifyRegistrationOutcome:()=>Roe,clearAllProviderScopeReauthorizationOffers:()=>b,clearAppliedDesignTokens:()=>Ug,clearProviderScopeReauthorizationOffer:()=>Xs,clickDownloadLink:()=>tb,cn:()=>U,collectBillingProviderLabelKeys:()=>J1,collectErroredFieldPaths:()=>iO,collectExecutionViewSurfaceRefsByOperation:()=>Cae,collectFrontendChartRegistrationRefs:()=>Doe,collectFrontendChartRegistrationRefsFromUIBehavior:()=>jae,collectFrontendProviderDisplayLabelKeys:()=>Tb,collectOperationLikeViewRefs:()=>Rae,collectResourceLabelFieldEntries:()=>al,combineModuleSidebarSections:()=>fv,composeConsentDecision:()=>fx,composeUiBehaviorPresentation:()=>GS,computeCoverScale:()=>jL,computeCropSourceRect:()=>NL,computePanelSizes:()=>m2,computeRegistryCompleteness:()=>X3,computeSurfacePolicyContextValue:()=>zr,configureClientInstanceIdPolicy:()=>Mo,consentWithdrawalCost:()=>px,contributeProviderComponentLoaders:()=>cx,conversationThreadModel:()=>kQ,countDiffLines:()=>H5,createComponentResolver:()=>G,createComponentResolverWithRef:()=>bl,createCompoundComponentResolver:()=>zs,createCompoundPreset:()=>Qte,createDesignSystemConfigurationFromSourceConfig:()=>Uwe,createEmojiIcon:()=>Bf,createEmptyOnboardingView:()=>BAe,createFrontendInsertedViewIdentity:()=>Zae,createFrontendProviderRegistryFrontendService:()=>nx,createOpenSessionOverlayModeResolver:()=>F1,createPolymorphicFrontendPreset:()=>Dee,createShellLayoutMainContainer:()=>R4,darkModeUtils:()=>Gg,debugSectionVisibility:()=>p6,decisionQuestionOf:()=>qW,decisionStepUpRequestOfRefusal:()=>Dt,defaultOfflineReplayPolicyForMethod:()=>wa,defaultTheme:()=>qg,defineChartDashboardView:()=>zAe,defineCompositeView:()=>Pp,deriveBreadcrumbAncestors:()=>IB,deriveConsentGateState:()=>dx,deriveDecisionInboxCapabilities:()=>ay,deriveDirectoryProvisioningCapabilities:()=>Lv,deriveRegionalReaderStanding:()=>Sie,deriveRelationshipShapeCapabilities:()=>Pv,deriveRelationshipSideCapabilities:()=>Mv,describeDecisionHolder:()=>VW,describeDecisionRequester:()=>UW,describePauseState:()=>LW,describeReasonCodeOptions:()=>IW,deserializeOnboardingView:()=>JAe,determineValidationMode:()=>TL,documentReadKey:()=>lQ,embeddedResourceDescentKey:()=>A9,emptyValueTypographyFor:()=>Xj,envLoader:()=>va,errorManagement:()=>st,evaluateGlassSurfaceHeight:()=>b_,executionPlanGraph:()=>df,exportCroppedImageFile:()=>BL,extractChartRouteContextResourceIdentifiers:()=>rm,extractChartRouteUrlParamValues:()=>tm,extractCompositeRouteContextResourceIdentifiers:()=>Kp,extractEphemeralFields:()=>sC,extractErrorInfo:()=>j,extractExecutionRouteContextResourceIdentifiers:()=>xm,extractPrimaryFontFamily:()=>Fg,extractSchemaFieldList:()=>zR,fieldRevealPanelAttributes:()=>tO,fieldsHoldingTheRecordName:()=>KA,fileTypeIsAccepted:()=>GZ,filterVisibleSections:()=>d6,findDuplicateAppScopeResourceTypes:()=>zm,findProviderScopeReauthorizationOffer:()=>dr,findUnknownDestinationRefs:()=>qv,flowGraph:()=>pf,flowGraphInputOf:()=>yae,flowGraphNodeId:()=>ef,flowNodeStatusIndicator:()=>Mf,flowStepCategory:()=>ip,flowTriggerTypeVisual:()=>lf,flowsActorsStatusColour:()=>Af,flowsActorsStatusDotClass:()=>_f,flowsActorsStatusIsMoving:()=>np,flyShellProxy:()=>y3,focusIndicatorClasses:()=>Jg,fontConfigToGoogleFontConfig:()=>Rg,forgetNotificationBadgeCounts:()=>b$,formatBadgeCount:()=>vn,formatHsvAsCssColor:()=>Jwe,formatRgbAsCssColor:()=>o6,generateChartConfig:()=>Vg,generateDefaultDisplayTemplate:()=>JR,generateDefaultFormTemplate:()=>UR,generateDefaultSummaryTemplate:()=>ez,generateGoogleFontsUrl:()=>Kg,generateTokensCSS:()=>w_,getChartColorPaletteFromCSS:()=>jg,getChartColors:()=>Xg,getClientInstanceId:()=>bre,getClientInstanceIdScope:()=>yie,getCommonEnumDisplayConfig:()=>D_,getCompletionPercentage:()=>WAe,getContentKey:()=>$0,getElementsByType:()=>KAe,getFieldError:()=>fI,getIconAnimation:()=>Nf,getLoadingStats:()=>wwe,getLocalStorageItem:()=>Fs,getManualCallsHttpClient:()=>lc,getNotificationDisplayBehavior:()=>Joe,getProviderScopeReauthorizationOffers:()=>lee,getReadinessChecker:()=>rne,getTailwindColor:()=>Lg,getZodErrorCode:()=>zme,getZodErrorParams:()=>EL,graphViewParentOf:()=>nf,graphViewerEdgeLabelKey:()=>Lf,growShellPane:()=>b3,hasValidAnimationSource:()=>jf,hslToRgb:()=>i6,hsvToRgb:()=>r6,humanDecisionFormLabels:()=>h8,humanDecisionQuestionOf:()=>KW,indicatorBadgeVariant:()=>s_,installShellLayoutStylesheet:()=>f3,isApiNotReadyError:()=>tl,isBackendRefusal:()=>Er,isBackendRefusalShownToUser:()=>Kr,isCollectionScopedOperation:()=>xt,isCroppableRasterImageFile:()=>kL,isCustomComponentNavigationItem:()=>jn,isDirectlyDisplayableImageUrl:()=>A2,isEmphasisButtonVariant:()=>uf,isEnginePageNavigationItem:()=>Fte,isErrorMarkedByHttpClient:()=>Ay,isFinalBackendRefusal:()=>Ct,isFrontendOperationAddressableForCurrentContext:()=>ih,isGlyphKey:()=>H$,isGoogleFont:()=>Yg,isHostedInShellChrome:()=>F2,isNamelessDisplayContent:()=>UA,isNetworkOfflineRejection:()=>ha,isOnboardingComplete:()=>GAe,isOperationAddressable:()=>fn,isOperationHeadless:()=>ar,isRecordSharingOffered:()=>qY,isRequiredFieldError:()=>dI,isResourceNavigationItem:()=>Ote,isResourceReachable:()=>soe,isSectionVisible:()=>u6,isSelfReferencingRelatedCollectionTarget:()=>i8,isSettingsHubNavigationItem:()=>Ba,isShellLayoutMainContainer:()=>F4,isShellSidePane:()=>a3,isShellSideZone:()=>o3,isSidebarConfigObject:()=>S2,isSpentOrganizationOnboardingSession:()=>hp,isStandaloneRoutableCompositeView:()=>zoe,isStandaloneRoutableExecutionView:()=>mp,isStandaloneRoutableInsertedChartView:()=>am,isStandaloneRoutableInsertedCompositeView:()=>gp,isStandaloneRoutableResolvedCompositeView:()=>Zp,isStatusBarConfigObject:()=>C2,isStatusBarPlacement:()=>ur,isUnrevokedScimTokenProbeNeeded:()=>Iv,isUtilityPanelComponentRegistered:()=>X7,isUtilityPanelConfigObject:()=>w2,isViewNavigationItem:()=>Pee,launcherItemRefKey:()=>hv,layoutGraphView:()=>af,listContributedProviderComponentLoaders:()=>lx,loadCroppableImage:()=>AL,loadCustomComponents:()=>Cwe,loadFontsFromTypography:()=>Zg,loadGoogleFonts:()=>Ig,makeComponentLabelResolver:()=>Om,makeShellPicture:()=>P3,mapApplicationLevelToFrontendComponentType:()=>k2,matchesExecutionConcreteOperationIdentity:()=>moe,matchesShortcut:()=>W$,mergeAppModes:()=>uv,mergeAppScope:()=>lv,mergeCommandMenuCommandLists:()=>_v,mergeDesignSystemConfiguration:()=>Bg,mergeFrontendComponentRegistrations:()=>Cv,mergeFrontendDomainModules:()=>bv,mergeFullCustomViewsByRef:()=>yv,mergeHotkeyEmitShortcuts:()=>X$,mergeMenubarLauncherItems:()=>vv,mergeQuickSwitcherFields:()=>mv,mergeSidebarSections:()=>dv,mergeSurfacePolicy:()=>gc,obtainStepUpToken:()=>AH,offsetWithin:()=>A3,olderHistoryCursor:()=>PQ,onboardingObligationsFromSessionState:()=>CZ,operationTargetsCurrentResource:()=>cg,organizationOnboardingNavigationTarget:()=>Xp,parkedOrganizationOnboardingSessionId:()=>Eae,parseChartColorPalette:()=>h_,parseCssColorToRgb:()=>$3,parseFrontendInsertedViewRef:()=>Up,parseShortcut:()=>U$,parseUnifiedDiff:()=>V5,pickInlineFieldWriteOperation:()=>rh,pickPreferredOperationForCoreSemanticAddressability:()=>Th,playbookCatalogGraph:()=>qf,playbookCatalogNodeId:()=>$d,polymorphicResourceUIBehavior:()=>di,polymorphicResourceUIBehaviorFrom:()=>Hie,providerScopeReauthorizationOfferKey:()=>See,pruneDirtyMarkersForPaneTransition:()=>Yy,pruneDirtyMarkersForScopeChange:()=>Jy,pruneFailedActionsForPaneTransition:()=>ky,pruneFailedActionsForPrefetchSettlement:()=>My,pruneFailedActionsForScopeChange:()=>Oy,publishNotificationBadgeCount:()=>y$,readAllConversationHistory:()=>FQ,readBrowserRegionalEvidence:()=>Nie,readComputedCssColorViaDom:()=>t6,readDisplayableErrorFacts:()=>fp,readProviderScopeReauthorizationOffer:()=>ht,receiveProviderAddressLookupSelection:()=>bx,receiveProviderFileSelections:()=>vx,recordProviderScopeReauthorizationOffer:()=>an,registerCommonEnum:()=>N_,registerFrameworkLayouts:()=>Bwe,registerFrontendComponentRegistrations:()=>Twe,registerIconAnimation:()=>vf,registerIconAnimations:()=>rp,registerShellLayout:()=>z4,registerStandardIcon:()=>cp,registerStandardIcons:()=>Sf,registryDeclaresSmsNotification:()=>v6,relationshipTargetRef:()=>q6,relativeLuminance:()=>s6,removeElement:()=>HAe,removeLocalStorageItem:()=>gs,replaceFileExtension:()=>zL,reportLauncherVerificationResults:()=>ny,reportSettingsHubVerificationResults:()=>uy,requestCrossFrontendHandoff:()=>l6,requestFieldReveal:()=>QD,resetClientInstanceIdPolicy:()=>jne,resolveActionDisclosure:()=>ie,resolveActionSurfaceOrganizationId:()=>nH,resolveApplicationLevelNavigationBackZone:()=>TB,resolveAuthoredOperationUnavailableReason:()=>bm,resolveAutomaticRelationshipDisplayShaping:()=>Rj,resolveBillingProviderDisplayName:()=>Y1,resolveCommandMenuCommands:()=>Yh,resolveComponentLabel:()=>jp,resolveCompositeViewDefinition:()=>kp,resolveCompositeViewPrimaryScope:()=>Gae,resolveContentAreaRenderBranch:()=>d2,resolveContextualDisplayParams:()=>QA,resolveControlPanelItems:()=>Km,resolveCssColorViaDom:()=>e6,resolveCurrentSectionStage:()=>JO,resolveDrawnActionVariant:()=>Qd,resolveEffectiveChromeMode:()=>YM,resolveEffectiveDisplayChromeMode:()=>yj,resolveEnumDisplayConfig:()=>B_,resolveErrorReferenceLabel:()=>Fae,resolveExecutionNavigationHandlingMode:()=>Ip,resolveExecutionViewDefinition:()=>zp,resolveFieldAutosaveTrigger:()=>BE,resolveFieldControlVariant:()=>Qg,resolveFrontendProviderDisplayLabel:()=>Eb,resolveFrontendResourceOperationAddressability:()=>tse,resolveGuidanceElementRenderer:()=>h4,resolveHostedComponents:()=>P2,resolveHotkeyBindings:()=>qh,resolveInsertedChartView:()=>Wp,resolveInsertedViewLauncherConfig:()=>Wm,resolveItemRef:()=>oh,resolveLoadingPolicy:()=>fce,resolveMenubarContent:()=>ch,resolveMilestoneLabel:()=>Goe,resolveOperationFeatureAvailability:()=>fg,resolveOperationIdempotencyHeaders:()=>Kx,resolveOperationRefusalLabel:()=>Lp,resolveOperationRequestTimeout:()=>Gx,resolveOptionalComponentLabel:()=>nm,resolveOptionalResourceHeaderDescription:()=>em,resolveQuickActions:()=>fh,resolveQuickSwitcherFieldSchema:()=>K7,resolveRecordOrganizationId:()=>Dh,resolveRefusalCodeLabel:()=>Bp,resolveRegionalFormatting:()=>one,resolveRelationshipInlineEditSurface:()=>Nj,resolveRelationshipNavigationSurface:()=>Lj,resolveRelationshipNestedReadSurface:()=>Fj,resolveRelationshipQuickCreateCreateOperation:()=>Oj,resolveRelationshipReadSurface:()=>Mj,resolveRelationshipSurfaceRuntime:()=>zj,resolveRelationshipWriteSurface:()=>jj,resolveResourceHeaderLabel:()=>im,resolveResourceLabelEnumSchema:()=>Dc,resolveResourceLabelSystemEnumName:()=>ys,resolveSearchGroupLabel:()=>s9,resolveSectionStageStates:()=>YO,resolveSettingsDestinationCatalog:()=>Gv,resolveSettingsHubConfig:()=>Kv,resolveShellLayoutPlacement:()=>I4,resolveSidebarMobileDrawerMode:()=>z7,resolveSidebarSections:()=>$m,resolveStatusBarPlacement:()=>L2,resolveSurfaceAutoFieldDensity:()=>ZL,resolveSurfaceAutoLabelPlacement:()=>XL,resolveSurfaceFormChromeMode:()=>YL,resolveSurfaceOverlayMode:()=>P1,resolveSurfacePolicyStackingClass:()=>W2,resolveToolbarTools:()=>nh,resolveTranslationKey:()=>Hp,resolveUpdateLikeMutationFallbackMode:()=>hl,resolveUserFacingErrorMessage:()=>wp,resolveUtilityPanelItems:()=>Z7,resolveVisibleEntryIndex:()=>dg,resourceExecutionView:()=>zae,resourceHasFieldWriteRoute:()=>En,resourceUIBehavior:()=>pte,resourceUIBehaviorFrom:()=>Jt,responsiveMaxWidthToCssValue:()=>mD,rgbToHex:()=>a6,rgbToHsv:()=>n6,sampleGlassRefractionProfile:()=>C_,saveBlobAsFile:()=>eb,scrollAndFocusFirstErroredField:()=>aO,sectionHeadingClassName:()=>FD,selectMaterialCapabilityTier:()=>t_,serializeOnboardingView:()=>qAe,serializeSurfaceOperation:()=>Ep,setLocalStorageItem:()=>eo,settingsHubSectionLabelKey:()=>Zoe,settingsSectionVisibilityOf:()=>gh,shapeSectionNesting:()=>H7,sharedErrorBuilder:()=>Du,shellModalOpenClause:()=>owe,shellPaneRows:()=>S3,shellPaneSelectorForZone:()=>n3,shellPaneZone:()=>r3,shellRegionSelector:()=>$4,shellRowBox:()=>_3,shellStageRects:()=>k3,shouldRequireCurrentContextAddressabilityForOperation:()=>mh,slideShellPaneHome:()=>x3,splitDividerOrientationToPanelGroupDirection:()=>r2,startApplicationService:()=>f$,staticZoneDividers:()=>p2,tellChatSignInCompletionSinks:()=>ax,toDateOrUndefined:()=>Xr,toast:()=>wh,turnStatusFromServer:()=>wW,unresolvedLabel:()=>Xo,updateElementStatus:()=>UAe,useActionOperationSurface:()=>rue,useActivityBarBehavior:()=>k7,useAnalytics:()=>A$,useAnonymousSession:()=>Hae,useAppLoading:()=>mb,useAppMode:()=>ule,useAppModeSafe:()=>hS,useAppScope:()=>Mm,useAppScopeInternal:()=>aoe,useAppScopeSafe:()=>lm,useAppShellFirstReady:()=>T4,useAppShellLayout:()=>R2,useApplication:()=>_u,useArrayItemAutosaveField:()=>hI,useAuthSession:()=>Dm,useBarrierParticipant:()=>uce,useBilling:()=>Lh,useBillingAction:()=>Uh,useBillingSafe:()=>ag,useBrandIdentity:()=>M2,useBrandPresentation:()=>N2,useChartData:()=>M_,useChatSignInCompletion:()=>ox,useClaimChildComposition:()=>DY,useCommandMenuBehavior:()=>c9,useComponentLoading:()=>hb,useComposedChildren:()=>V_e,useCompositeResourceOperationContextBuilder:()=>b9,useCompositeViewContext:()=>KU,useConsentBasedProviderActivations:()=>zx,useConsentGateBehavior:()=>zH,useContextualDisplayParams:()=>ZA,useControlPanelBehavior:()=>e9,useCreateOperationSurface:()=>eue,useCrossFrontendHandoff:()=>Qwe,useDisplayChromeContext:()=>bk,useDisplayContextKind:()=>XA,useDisplayTemplateContext:()=>gk,useDisplayableImageUrl:()=>j2,useDocumentAcceptanceGateBehavior:()=>HH,useEmbeddedResourceContext:()=>o8,useEmbeddedResourceDescent:()=>yY,useEmbeddedResourceHostContext:()=>HU,useEmitLoadingScope:()=>sh,useEmphasisedActionLabels:()=>mC,useError:()=>up,useEventBus:()=>vo,useEventEmit:()=>jie,useEventSubscription:()=>Xee,useExecution:()=>zse,useExecutionDirtyBridge:()=>Ky,useExecutionDirtyMarkerScope:()=>Bse,useExecutionParticipationDataPrefetch:()=>Gse,useExecutionParticipationPrefetch:()=>qy,useFeatureAvailability:()=>H0,useFeatureGate:()=>$we,useFeatures:()=>Nh,useFieldControlAria:()=>KM,useFieldRevealRequests:()=>eO,useFieldScope:()=>RD,useFileActivation:()=>R8,useFlowsActors:()=>OW,useFlowsActorsSafe:()=>kW,useFlowsActorsStatusWord:()=>sp,useFormChromeContext:()=>fT,useFormField:()=>n5,useFormSchemaContext:()=>KD,useFormTemplateContext:()=>XT,useGlobalNavigationController:()=>RS,useGrantedConsentPurposes:()=>mx,useGuidance:()=>wU,useHostedComponentInteractions:()=>e4,useHostlessResourceNavigation:()=>BS,useHotkey:()=>Ube,useHotkeyPause:()=>Gbe,useHotkeyRegistry:()=>J$,useHotkeyScope:()=>Kbe,useHotkeys:()=>Wbe,useI18n:()=>K,useIconRegistry:()=>Rf,useIsInFramedAncestor:()=>F,useKeepsHiddenPanelsMounted:()=>nO,useLauncherResolutionContext:()=>Q$,useLifecycle:()=>TU,useListOperationSurface:()=>$le,useLoading:()=>oce,useMaterialRuntime:()=>S_,useMenuBarBehavior:()=>G7,useMenuUserOrgBehavior:()=>p9,useMfaContinuationNavigation:()=>zX,useNavigationBehaviors:()=>O7,useNavigationController:()=>zS,useNavigationState:()=>Zx,useNotification:()=>qm,useNotificationBadges:()=>S$,useNotificationCenterBehavior:()=>n9,useNotificationPreferenceKinds:()=>_6,useOperationEnabled:()=>nC,useOperationFeatureAvailability:()=>jh,useOperationsEnabled:()=>iC,useOptionalAutosave:()=>RE,useOptionalCompositeResourceContext:()=>a8,useOptionalCompositeViewContext:()=>qU,useOptionalDisplayTemplateContext:()=>_k,useOptionalEmbeddedResourceHostContext:()=>UU,useOptionalFormSchemaContext:()=>qD,useOptionalFormTemplateContext:()=>ZT,useOptionalResourceFormActions:()=>yE,useOptionalResourceHeaderContext:()=>KB,useOverlayTitle:()=>f1,usePendingDecisions:()=>gW,usePortalContainer:()=>H2,useProgression:()=>EU,useProviderComponent:()=>gx,useProviderComponentChoices:()=>hx,useProviderScopeReauthorizationOffers:()=>Zn,usePublicShellLayout:()=>z2,usePublishNotificationBadgeCount:()=>x6,useQuickActionButtonBehavior:()=>u9,useQuickSwitcherBehavior:()=>q7,useReadOperationSurface:()=>Qle,useReadPageRecord:()=>ZY,useRegisterComposedChild:()=>TY,useReportAutomaticComposition:()=>OY,useResolvedAuthConfig:()=>dS,useResolvedFieldName:()=>zD,useResourceChartData:()=>jAe,useResourceDisplayContext:()=>wj,useResourceEmptyStateOffersPrimaryAction:()=>aK,useResourceOperationActions:()=>rH,useResourceOperationSurface:()=>gC,useResourceReachability:()=>Im,useResourceRegistry:()=>wm,useResourceRegistrySafe:()=>jm,useResourceRoom:()=>nTe,useResourceSearch:()=>TV,useResourceSelection:()=>iH,useSearchOperationSurface:()=>nue,useSectionLegendVoice:()=>MD,useServerErrorInjection:()=>rz,useSettingsHubConfig:()=>Jv,useShellColumnMotion:()=>R3,useShellDialogArrival:()=>w3,useShellFrontPane:()=>M3,useShellMotion:()=>z3,useShellPaneMotion:()=>L3,useShellPlaceChanges:()=>N3,useShellPressOrigin:()=>v3,useShellStageMeasurement:()=>j3,useSidebarBehavior:()=>V7,useSidebarMobileDrawerMode:()=>B7,useSmsConsentOffered:()=>y6,useStatusBarBehavior:()=>J7,useStepUpAuth:()=>Ywe,useSurfaceBodyScrollLock:()=>cD,useSurfaceFocusTrap:()=>lD,useSurfacePolicy:()=>oc,useSurfacePolicyPortalTarget:()=>U2,useSurfacePolicyStackingClass:()=>G2,useSurfaceVariant:()=>oee,useTemplateOwnsChildComposition:()=>EY,useThemePreferenceControl:()=>G1,useToolbarBehavior:()=>Y7,useTypographyScope:()=>A_,useUI:()=>e_,useUpdateOperationSurface:()=>tue,useUserFacingErrorMessage:()=>bp,useUserOrgs:()=>Cg,useUtilityPanelBehavior:()=>$7,useViewerMayListRelatedResource:()=>L9,useViewerMayPerformResourceOperation:()=>bxe,useVocabularyWord:()=>xf,useWebSocket:()=>Sp,utilityPanelWorkspaceSignature:()=>Q7,variant:()=>nte,verifyLauncherContent:()=>ty,verifySettingsHubContent:()=>ly,viewerBelongsToOrganization:()=>Og,viewerHoldsOneOfRoles:()=>Jm,viewerIsKnownOutsideOrganization:()=>$oe,viewerMayHaveDecisionsWaiting:()=>iy,viewerMayPerformOperation:()=>th,viewerMayReadChart:()=>Y9,waitForFontsLoaded:()=>zg,whenRendered:()=>$D,wildoErrorIsShownToUser:()=>pn,withErrorBoundary:()=>Yse,withFocusedDecisionFirst:()=>YW,withNewestHistoryPage:()=>MQ,withOlderHistoryPage:()=>NQ,withPendingSend:()=>TQ,withoutHiddenParentReference:()=>Sj,wrapWithAutosaveIndicator:()=>JM,zoneMutationTargetIndex:()=>Gh,zoneTabDomIds:()=>t2});export{G5 as $,AO as $a,lI as $i,U0 as $n,cx as $o,yG as $r,N6 as $t,E7 as A,iN as Aa,jR as Ai,$4 as An,hT as Ao,uQ as Ar,J8 as At,m7 as B,_j as Ba,TL as Bi,D4 as Bn,tw as Bo,zY as Br,M8 as Bt,q7 as C,CF as Ca,XB as Ci,G4 as Cn,XE as Co,LQ as Cr,a5 as Ct,k7 as D,SF as Da,FR as Di,U4 as Dn,XT as Do,wQ as Dr,n5 as Dt,B7 as E,xF as Ea,LR as Ei,H4 as En,qE as Eo,CQ as Er,t5 as Et,_7 as F,Jj as Fa,ML as Fi,I4 as Fn,sT as Fo,NX as Fr,B8 as Ft,i7 as G,cA as Ga,oL as Gi,G2 as Gn,uC as Go,RJ as Gr,k8 as Gt,l7 as H,ZA as Ha,rL as Hi,T4 as Hn,ew as Ho,nY as Hr,N8 as Ht,g7 as I,Cj as Ia,jL as Ii,A4 as In,aT as Io,AX as Ir,z8 as It,n7 as J,_k as Ja,AI as Ji,N2 as Jn,zS as Jo,IJ as Jr,f8 as Jt,t7 as K,hk as Ka,sL as Ki,z2 as Kn,mC as Ko,LJ as Kr,D8 as Kt,d7 as L,wj as La,NL as Li,E4 as Ln,iT as Lo,mX as Lr,R8 as Lt,S7 as M,ZM as Ma,kR as Mi,M4 as Mn,cT as Mo,PX as Mr,U8 as Mt,b7 as N,KM as Na,TR as Ni,L4 as Nn,lT as No,MX as Nr,H8 as Nt,T7 as O,wF as Oa,MR as Oi,W4 as On,ZT as Oo,kQ as Or,$8 as Ot,x7 as P,Qj as Pa,nR as Pi,z4 as Pn,rT as Po,jX as Pr,V8 as Pt,Z5 as Q,MO as Qa,hI as Qi,E2 as Qn,ux as Qo,bG as Qr,U6 as Qt,p7 as R,mj as Ra,BL as Ri,O4 as Rn,oT as Ro,QY as Rr,L8 as Rt,J7 as S,bF as Sa,ZB as Si,K4 as Sn,ZE as So,GQ as Sr,i5 as St,V7 as T,vF as Ta,TB as Ti,V4 as Tn,KE as To,FQ as Tr,e5 as Tt,o7 as U,OA as Ua,iL as Ui,e4 as Un,cC as Uo,NJ as Ur,A8 as Ut,h7 as V,hj as Va,EL as Vi,k4 as Vn,iw as Vo,tY as Vr,P8 as Vt,a7 as W,hA as Wa,aL as Wi,U2 as Wn,lC as Wo,FJ as Wr,O8 as Wt,Q5 as X,LO as Xa,DI as Xi,D2 as Xn,Fx as Xo,hq as Xr,X6 as Xt,X5 as Y,FO as Ya,jI as Yi,O2 as Yn,Zx as Yo,pq as Yr,m8 as Yt,$5 as Z,IO as Za,CI as Zi,T2 as Zn,Cx as Zo,mq as Zr,Z6 as Zt,c9 as _,FF as _a,kV as _i,Y4 as _n,WD as _o,t1 as _r,k5 as _t,P9 as a,KF as aa,lG as ai,m6 as an,DO as ao,F1 as ar,Xy as as,V5 as at,$7 as b,AF as ba,FV as bi,t3 as bn,AD as bo,KQ as br,h5 as bt,z9 as c,UF as ca,OW as ci,r6 as cn,_O as co,N1 as cr,Nv as cs,j5 as ct,b9 as d,VF as da,tW as di,e6 as dn,SO as do,b1 as dr,_v as ds,x5 as dt,eI as ea,rG as ei,M6 as en,NO as eo,H0 as er,_b as es,K5 as et,v9 as f,BF as fa,sH as fi,a6 as fn,tO as fo,w1 as fr,V_ as fs,C5 as ft,u9 as g,RF as ga,MV as gi,c3 as gn,GD as go,u1 as gr,D5 as gt,p9 as h,zF as ha,jV as hi,f3 as hn,UD as ho,y1 as hr,E5 as ht,F9 as i,qF as ia,sG as ii,g6 as in,EO as io,H1 as ir,eb as is,H5 as it,y7 as j,eN as ja,AR as ji,N4 as jn,tT as jo,iZ as jr,q8 as jt,D7 as k,rN as ka,PR as ki,s3 as kn,_T as ko,TQ as kr,Q8 as kt,M9 as l,HF as la,kW as li,$3 as ln,vO as lo,M1 as lr,Av as ls,N5 as lt,g9 as m,LF as ma,OV as mi,z3 as mn,nO as mo,C1 as mr,T5 as mt,U9 as n,YF as na,uG as ni,y6 as nn,TO as no,r0 as nr,nb as ns,J5 as nt,N9 as o,GF as oa,iG as oi,Z3 as on,bO as oo,E1 as or,Kv as os,R5 as ot,_9 as p,MF as pa,DV as pi,n6 as pn,eO as po,x1 as pr,w5 as pt,r7 as q,gk as qa,LI as qi,R2 as qn,BS as qo,PJ as qr,y8 as qt,H9 as r,qpe as ra,cG as ri,_6 as rn,OO as ro,i0 as rr,tb as rs,z5 as rt,B9 as s,WF as sa,BW as si,o6 as sn,CO as so,O1 as sr,Fv as ss,L5 as st,YAe as t,nI as ta,aG as ti,x6 as tn,kO as to,a0 as tr,gb as ts,q5 as tt,L9 as u,zpe as ua,SW as ui,s6 as un,xO as uo,v1 as ur,wv as us,M5 as ut,n9 as v,PF as va,NV as vi,l3 as vn,FD as vo,QQ as vr,O5 as vt,G7 as w,TF as wa,UB as wi,Q4 as wn,Uue as wo,RQ as wr,o5 as wt,Y7 as x,IF as xa,PV as xi,u3 as xn,iD as xo,WQ as xr,s5 as xt,e9 as y,NF as ya,AV as yi,J4 as yn,MD as yo,UQ as yr,S5 as yt,f7 as z,gj as za,AL as zi,j4 as zn,nT as zo,ZY as zr,I8 as zt};
|