@wildo-ai/application-creation-workbench 1.1.14 → 1.1.16
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 +568 -579
- package/dist/assets/{ChartEmptyState-DOlrd3QL.js → ChartEmptyState-DWIzkRcF.js} +1 -1
- package/dist/assets/ChartLoadingSkeleton-DJK8tr0I.js +1 -0
- package/dist/assets/{ChartView-nQvehKAl.js → ChartView-Db94VZQx.js} +2 -2
- package/dist/assets/ChartWidget-YVF2hpZO.js +5 -0
- package/dist/assets/{abnfDiagram-VCTEODGH-BOSMF_iF.js → abnfDiagram-VCTEODGH-CM0NR9TO.js} +1 -1
- package/dist/assets/af-CaISKfkL.js +1 -0
- package/dist/assets/ar-Dd3Ww6Iw.js +1 -0
- package/dist/assets/{architectureDiagram-5GKGNRK7-F_DICN7K.js → architectureDiagram-5GKGNRK7-BSvNpQhN.js} +1 -1
- package/dist/assets/badge-tone-CARgRBWT.js +5 -0
- package/dist/assets/bg-DNLi91F0.js +1 -0
- package/dist/assets/{blockDiagram-I7D4REHJ-vdakidUW.js → blockDiagram-I7D4REHJ-BSXJV2rP.js} +1 -1
- package/dist/assets/bn-BGBjHoNg.js +1 -0
- package/dist/assets/{c4Diagram-7LVT6UL2-cnHP-5K7.js → c4Diagram-7LVT6UL2-B17JSkcB.js} +1 -1
- package/dist/assets/ca-BJH1_2-1.js +1 -0
- package/dist/assets/channel-CADOmcrk.js +1 -0
- package/dist/assets/{chunk-4HAMMTFA-C6G-f7n3.js → chunk-4HAMMTFA-CA0aHXNY.js} +1 -1
- package/dist/assets/{chunk-75Z2AOVW-DiyJkf0q.js → chunk-75Z2AOVW-eNHd3ECu.js} +1 -1
- package/dist/assets/{chunk-DU6HZSFF-Dy7jxNH_.js → chunk-DU6HZSFF-DC0oD3wd.js} +2 -2
- package/dist/assets/{chunk-F27PBJKO-CkvHG7F6.js → chunk-F27PBJKO-CTaZkd0r.js} +1 -1
- package/dist/assets/{chunk-GMAD6QVW-DsY6Jtz4.js → chunk-GMAD6QVW-DAXYHrRx.js} +1 -1
- package/dist/assets/{chunk-GVQU2GXP-BE5D92zU.js → chunk-GVQU2GXP-pi_3BL4L.js} +1 -1
- package/dist/assets/{chunk-IMKFNOWR-CAwOIW4R.js → chunk-IMKFNOWR-D4wsR2Nz.js} +1 -1
- package/dist/assets/{chunk-L3NEJ4N5-B1mDlHi1.js → chunk-L3NEJ4N5-kKzd7vmD.js} +1 -1
- package/dist/assets/{chunk-OSK3NFVY-iylVXGs0.js → chunk-OSK3NFVY-B0dd8EQD.js} +1 -1
- package/dist/assets/{chunk-P2QGCYS3-CvcRZ6j9.js → chunk-P2QGCYS3-uHc1UExe.js} +1 -1
- package/dist/assets/{chunk-POPQ4Y6H-CNbcNXVN.js → chunk-POPQ4Y6H-BygwP6r8.js} +1 -1
- package/dist/assets/{chunk-PWAF6VOD-BorA01Hz.js → chunk-PWAF6VOD-UE_jt_hM.js} +1 -1
- package/dist/assets/{chunk-SHT3W25Y-DNWg7N7_.js → chunk-SHT3W25Y-Cv1i544N.js} +1 -1
- package/dist/assets/{chunk-SVP7TREG-C_gZGZzY.js → chunk-SVP7TREG-Ck1iP-B9.js} +1 -1
- package/dist/assets/{chunk-TICWLB2K-CG8L7csD.js → chunk-TICWLB2K-Dxy0ug7B.js} +1 -1
- package/dist/assets/classDiagram-ZZMXUADV-BXHE8nXn.js +1 -0
- package/dist/assets/classDiagram-v2-VYDZK3BY-BXHE8nXn.js +1 -0
- package/dist/assets/{cm6-editor-BrI954sl.js → cm6-editor-DhiCRNY6.js} +3 -3
- package/dist/assets/{code-block-IT6T5CEO-P8OONT1n.js → code-block-IT6T5CEO-DFDUp6nm.js} +1 -1
- package/dist/assets/context-JIvi_Be4.js +1 -0
- package/dist/assets/cs-QrUc_2-B.js +1 -0
- package/dist/assets/cy-C9ToLciu.js +1 -0
- package/dist/assets/{cynefinDiagram-5FMLGOSQ-Drk0vtFB.js → cynefinDiagram-5FMLGOSQ-C69B-hF_.js} +1 -1
- package/dist/assets/da-BeV-TIte.js +1 -0
- package/dist/assets/{dagre-GXQ25YYZ-CLrGf0om.js → dagre-GXQ25YYZ-CF3-iQQv.js} +1 -1
- package/dist/assets/de-AT-DsKGWx9m.js +1 -0
- package/dist/assets/de-DHWuASHw.js +1 -0
- package/dist/assets/{diagram-S7CK7UJ4-B-ZdgPTX.js → diagram-S7CK7UJ4-fI0poyzR.js} +1 -1
- package/dist/assets/{diagram-UQ7AKVKN-BkKvmg4L.js → diagram-UQ7AKVKN-Cejsbc8J.js} +1 -1
- package/dist/assets/{diagram-VSXAHHWV-HiaAFHhk.js → diagram-VSXAHHWV-CBv4QF-r.js} +1 -1
- package/dist/assets/{diagram-VX7I27RA-DwkAZ58D.js → diagram-VX7I27RA-BzXmKCQv.js} +1 -1
- package/dist/assets/{diagram-Z3DM3KII-D-cMFf4d.js → diagram-Z3DM3KII-DlMWqIOm.js} +1 -1
- package/dist/assets/{dist-OpJd06F1.js → dist-7qRR8v9X.js} +1 -1
- package/dist/assets/{dist-BHvGeTYl.js → dist-AFETXPuM.js} +1 -1
- package/dist/assets/{dist-7Nz9yNhS.js → dist-B3zMf34l.js} +1 -1
- package/dist/assets/{dist-DgFx0nHw.js → dist-B7LZVqmi.js} +1 -1
- package/dist/assets/{dist-CFrG-Mt_.js → dist-B8dHtIF5.js} +1 -1
- package/dist/assets/{dist-Cuhv1Fm_.js → dist-BNqD4FF5.js} +1 -1
- package/dist/assets/{dist-KJ6-32V3.js → dist-BPi3amKg.js} +1 -1
- package/dist/assets/{dist-DlNJgHFc.js → dist-Bqd9H35D.js} +1 -1
- package/dist/assets/{dist-BCRkZyjz.js → dist-BxMdxgPi.js} +1 -1
- package/dist/assets/{dist-CRpxTWEh.js → dist-BzKBUPIc.js} +1 -1
- package/dist/assets/{dist-BgSqI6_g.js → dist-C1JIB7wk.js} +1 -1
- package/dist/assets/{dist-CE3k7Kha.js → dist-CGO-gA39.js} +1 -1
- package/dist/assets/{dist-tfb1xShq.js → dist-CKvrtylC.js} +1 -1
- package/dist/assets/{dist-CPhv_Fl3.js → dist-CnWzIIZp.js} +1 -1
- package/dist/assets/{dist-5fOMJ27f.js → dist-CvaYKnIn.js} +1 -1
- package/dist/assets/{dist-DJ3oXpIs.js → dist-DAIjOsvl.js} +1 -1
- package/dist/assets/{dist-CstXuejQ.js → dist-DHiazivQ.js} +1 -1
- package/dist/assets/{dist-kKXf1Bjx.js → dist-DIV2542b.js} +1 -1
- package/dist/assets/{dist-BxwAVf7j.js → dist-DJE-oKsX.js} +1 -1
- package/dist/assets/{dist-CPuGLmxI.js → dist-DXJIV6Zs.js} +1 -1
- package/dist/assets/{dist-CJxRNwMR.js → dist-Da70oAVH.js} +1 -1
- package/dist/assets/{dist-Dy2TKEdf.js → dist-iVGPtgrw.js} +1 -1
- package/dist/assets/{dist-ByMsVuIk.js → dist-nXT3Wtvb.js} +1 -1
- package/dist/assets/{dropbox-picker-C9r5F3kM.js → dropbox-picker-YaUvIgU1.js} +1 -1
- package/dist/assets/{ebnfDiagram-PWID7BFC-DrvpEZ_f.js → ebnfDiagram-PWID7BFC-DTMbd2mv.js} +1 -1
- package/dist/assets/el-DMuXcfim.js +1 -0
- package/dist/assets/en-AU-DjLnSRR3.js +1 -0
- package/dist/assets/en-CA-DXNydqY9.js +1 -0
- package/dist/assets/en-GB-D4GWT5GI.js +1 -0
- package/dist/assets/{erDiagram-RLTQ6QDP-aafi4jCY.js → erDiagram-RLTQ6QDP-BZEe8VTH.js} +1 -1
- package/dist/assets/es-lfpxt6Ut.js +1 -0
- package/dist/assets/esm-Cbe65KfA.js +46 -0
- package/dist/assets/et-Bf88JUsX.js +1 -0
- package/dist/assets/eu-DV_CNSeH.js +1 -0
- package/dist/assets/fa-IR-DNJeY-Q5.js +1 -0
- package/dist/assets/fi-NNzsVdSt.js +1 -0
- package/dist/assets/flow-execution-BwY1ThjF.js +8 -0
- package/dist/assets/flowDiagram-HODETNUW-DbMxzAr_.js +1 -0
- package/dist/assets/flows-actors-graph-runtime-D-xOavtY.js +1 -0
- package/dist/assets/fr-B-yJDVw6.js +1 -0
- package/dist/assets/fr-CA-D84edDay.js +1 -0
- package/dist/assets/{ganttDiagram-EL5Y4UJY-CRmnjbyh.js → ganttDiagram-EL5Y4UJY-BdBwCB1x.js} +1 -1
- package/dist/assets/{gitGraphDiagram-WWUBYQGX-C4ebHhmy.js → gitGraphDiagram-WWUBYQGX-CIy0NCq6.js} +1 -1
- package/dist/assets/gl-Dp9qpDLE.js +1 -0
- package/dist/assets/{google-drive-picker-3-SZkSfN.js → google-drive-picker-DL6kxOGz.js} +1 -1
- package/dist/assets/graph-runtime-DcJcdZxk.js +1 -0
- package/dist/assets/he-Bq6yvypU.js +1 -0
- package/dist/assets/hi-CMOY0SGV.js +1 -0
- package/dist/assets/hr-tEZvbTHh.js +1 -0
- package/dist/assets/hu-4gHWGYaX.js +1 -0
- package/dist/assets/id-DWXCGwjx.js +1 -0
- package/dist/assets/index-B-LZopDR.js +202 -0
- package/dist/assets/index-CZ5sv4PP.css +2 -0
- package/dist/assets/{infoDiagram-27XIBGKW-CplMaWp5.js → infoDiagram-27XIBGKW-cmptKZNt.js} +1 -1
- package/dist/assets/is-CyAuvYgU.js +1 -0
- package/dist/assets/isSameWeek-BwCmz51m.js +1 -0
- package/dist/assets/{ishikawaDiagram-5VMMS53U-BREas_JM.js → ishikawaDiagram-5VMMS53U-BGkoqgNl.js} +1 -1
- package/dist/assets/it-D--xgPTt.js +1 -0
- package/dist/assets/ja-PiU5hzs0.js +1 -0
- package/dist/assets/{journeyDiagram-3NMN7TZE-DWHGp6os.js → journeyDiagram-3NMN7TZE-BOELkE0a.js} +1 -1
- package/dist/assets/{kanban-definition-UXKFOSKX-CP-1mPST.js → kanban-definition-UXKFOSKX-DMZEjs2i.js} +1 -1
- package/dist/assets/katex-CI0JW3i6.js +1 -0
- package/dist/assets/ko-CGrMXw-3.js +1 -0
- package/dist/assets/{line-C_Dg3XTF.js → line-s3zM1O9a.js} +1 -1
- package/dist/assets/linear-BUYtyba4.js +1 -0
- package/dist/assets/lt-wHK-2djA.js +1 -0
- package/dist/assets/lv-B305-5TD.js +1 -0
- package/dist/assets/{markdown-stream-runtime-CMB_Qu0K.js → markdown-stream-runtime-JIhfRcVj.js} +33 -33
- package/dist/assets/match-DcrfiQ0n.js +1 -0
- package/dist/assets/match-szcpBoWK.js +1 -0
- package/dist/assets/mermaid-VLURNSYL-DDUIX3qH.js +1 -0
- package/dist/assets/{mermaid.core-D_DICvzX.js → mermaid.core-a9Ql5m3p.js} +4 -4
- package/dist/assets/{mindmap-definition-YA3MSWOX-C20ANuWc.js → mindmap-definition-YA3MSWOX-DUzblAeW.js} +1 -1
- package/dist/assets/ms-DOzy1eba.js +1 -0
- package/dist/assets/mt-Cyhk7ljW.js +1 -0
- package/dist/assets/nb-CHftFpq-.js +1 -0
- package/dist/assets/nl-BLyVSbSF.js +1 -0
- package/dist/assets/{onedrive-picker-C_4mWMyM.js → onedrive-picker-B79jNUe8.js} +1 -1
- package/dist/assets/{pdf-viewer-By7fQHYQ.js → pdf-viewer-BZVcG_S1.js} +2 -2
- package/dist/assets/{pegDiagram-XKGWAZYB-DVbFO1Fa.js → pegDiagram-XKGWAZYB-BZ3P1nUf.js} +1 -1
- package/dist/assets/{pieDiagram-E7YTZNPT-DWtaagpj.js → pieDiagram-E7YTZNPT-B9NGIjBe.js} +1 -1
- package/dist/assets/pl-DcuB_1rF.js +1 -0
- package/dist/assets/pt-BLKOuKD1.js +1 -0
- package/dist/assets/pt-BR-DDPfvEv6.js +1 -0
- package/dist/assets/{public-runtime-f4VjjFok.js → public-runtime-8slf2C-u.js} +1 -1
- package/dist/assets/{quadrantDiagram-AXDQQJYC-CJvBFA_c.js → quadrantDiagram-AXDQQJYC-CjNDgU43.js} +1 -1
- package/dist/assets/{railroadDiagram-O6MQD6OU-Dygrn5Zv.js → railroadDiagram-O6MQD6OU-BBDx0rdy.js} +1 -1
- package/dist/assets/{requirementDiagram-BXWQKSXE-BpnohlUt.js → requirementDiagram-BXWQKSXE-BrhlVjUT.js} +1 -1
- package/dist/assets/ro-DbI8OToC.js +1 -0
- package/dist/assets/ru-BLDhwwC9.js +1 -0
- package/dist/assets/{sankeyDiagram-P5KCCOFB-Cyy3VaYL.js → sankeyDiagram-P5KCCOFB-DgJzdqPr.js} +1 -1
- package/dist/assets/{sequenceDiagram-WJ2MYXX4-GaYcTb-c.js → sequenceDiagram-WJ2MYXX4-nO_0feCR.js} +1 -1
- package/dist/assets/sk-7eBEpg_i.js +1 -0
- package/dist/assets/sl-D8mz35xz.js +1 -0
- package/dist/assets/{stateDiagram-D77RDMKH-DGiRCD9r.js → stateDiagram-D77RDMKH-DiHY7fmj.js} +1 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-B-ln1J6g.js +1 -0
- package/dist/assets/sv-BRKZ4Z4y.js +1 -0
- package/dist/assets/{swimlanes-42K2YHIH-D7xJP0pw.js → swimlanes-42K2YHIH-CYk23GX2.js} +1 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-Bz8yiJQl.js +8 -0
- package/dist/assets/ta-DKAQy049.js +1 -0
- package/dist/assets/th-BuRbTdYq.js +1 -0
- package/dist/assets/{timeline-definition-24CTP7MA-DTJnlCQe.js → timeline-definition-24CTP7MA-DoWeIqkB.js} +1 -1
- package/dist/assets/tr-_9-Ip53s.js +1 -0
- package/dist/assets/useI18n-V1cysfvg.js +171 -0
- package/dist/assets/value-CHmTzbgv.js +1 -0
- package/dist/assets/{vennDiagram-4TSXK5OY-CFat-M74.js → vennDiagram-4TSXK5OY-be67wLzm.js} +1 -1
- package/dist/assets/vi-DOgzte8u.js +1 -0
- package/dist/assets/{wardleyDiagram-VM6X3IG4-h29SCI73.js → wardleyDiagram-VM6X3IG4-AWMVCRIW.js} +1 -1
- package/dist/assets/{xychartDiagram-S5SC5T6Z-B8S8taDj.js → xychartDiagram-S5SC5T6Z-BpEpObCO.js} +1 -1
- package/dist/assets/zh-CN-Be160TvV.js +1 -0
- package/dist/assets/zh-HK-izvou4UE.js +1 -0
- package/dist/assets/zh-TW-B7tQDnE2.js +1 -0
- package/dist/index.html +11 -10
- package/package.json +9 -9
- package/dist/assets/ChartLoadingSkeleton-BlVB40sh.js +0 -1
- package/dist/assets/ChartWidget-CZ5NXj5y.js +0 -5
- package/dist/assets/af-1WnNPqq-.js +0 -1
- package/dist/assets/ar-I_OTuA6g.js +0 -1
- package/dist/assets/badge-tone-B1Pd5hFs.js +0 -5
- package/dist/assets/bg-BNynXrJg.js +0 -1
- package/dist/assets/bn-IoUqFxhs.js +0 -1
- package/dist/assets/ca-CWN_9uem.js +0 -1
- package/dist/assets/channel-Dn5Kml0R.js +0 -1
- package/dist/assets/classDiagram-ZZMXUADV-DZBHmNh2.js +0 -1
- package/dist/assets/classDiagram-v2-VYDZK3BY-DZBHmNh2.js +0 -1
- package/dist/assets/context-BNM55Snb.js +0 -1
- package/dist/assets/cs-CmgNpjMj.js +0 -1
- package/dist/assets/cy-zQX_QEXD.js +0 -1
- package/dist/assets/da-CjOdj32R.js +0 -1
- package/dist/assets/de-AT-BLeHD7-g.js +0 -1
- package/dist/assets/de-CwLcXmDQ.js +0 -1
- package/dist/assets/el-CWW60iH9.js +0 -1
- package/dist/assets/en-AU-BossA0Rn.js +0 -1
- package/dist/assets/en-CA-DATw2cVB.js +0 -1
- package/dist/assets/en-GB-CUli1ZoP.js +0 -1
- package/dist/assets/es-qp1wsCMr.js +0 -1
- package/dist/assets/esm-B3AZ9HP5.js +0 -7
- package/dist/assets/esm-GB9ACU6Q.js +0 -46
- package/dist/assets/et-CuSdGi0t.js +0 -1
- package/dist/assets/eu-xCnVjdHU.js +0 -1
- package/dist/assets/fa-IR-DZ3ibPOw.js +0 -1
- package/dist/assets/fi-g4XjAI_I.js +0 -1
- package/dist/assets/flowDiagram-HODETNUW-RzRAndm9.js +0 -1
- package/dist/assets/flows-actors-graph-runtime-DeTt1QCB.js +0 -1
- package/dist/assets/fr-BhOuGXkV.js +0 -1
- package/dist/assets/fr-CA-BYF9Kaol.js +0 -1
- package/dist/assets/gl-BLfeYzoG.js +0 -1
- package/dist/assets/graph-runtime-BbbtydnB.js +0 -1
- package/dist/assets/he-BXMp0P82.js +0 -1
- package/dist/assets/hi-BmH5--Ew.js +0 -1
- package/dist/assets/hr-CsQDZ0KK.js +0 -1
- package/dist/assets/hu-DiL5YUSE.js +0 -1
- package/dist/assets/id-1Vn21CD0.js +0 -1
- package/dist/assets/index-Bcdys-EF.css +0 -2
- package/dist/assets/index-TNOEipJX.js +0 -202
- package/dist/assets/is-CByKTwFK.js +0 -1
- package/dist/assets/isSameWeek-Bf15BL-p.js +0 -1
- package/dist/assets/it-CPNWwvi0.js +0 -1
- package/dist/assets/ja-D9Jm250G.js +0 -1
- package/dist/assets/katex-Dp9rtsw4.js +0 -1
- package/dist/assets/ko-CpsoMmES.js +0 -1
- package/dist/assets/linear-DMyAYyr-.js +0 -1
- package/dist/assets/lt-Ckx9bY2o.js +0 -1
- package/dist/assets/lv-DZt3HT5G.js +0 -1
- package/dist/assets/match-CLYNQBt4.js +0 -1
- package/dist/assets/match-_OgMbUjy.js +0 -1
- package/dist/assets/mermaid-VLURNSYL-DXNPK6wv.js +0 -1
- package/dist/assets/ms-C7UJy830.js +0 -1
- package/dist/assets/mt-8KsNOVwG.js +0 -1
- package/dist/assets/nb-C7YQIAOB.js +0 -1
- package/dist/assets/nl-UadnkhJV.js +0 -1
- package/dist/assets/node-nqfXDpgr.js +0 -2
- package/dist/assets/pl-DaJL5jLd.js +0 -1
- package/dist/assets/pt-BHQDKf9o.js +0 -1
- package/dist/assets/pt-BR-zn9BrDVb.js +0 -1
- package/dist/assets/ro-BdQOzb6t.js +0 -1
- package/dist/assets/ru-BmbP3F22.js +0 -1
- package/dist/assets/sk-Deobe1dz.js +0 -1
- package/dist/assets/sl-DDWo-_WQ.js +0 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-CZRVHb2L.js +0 -1
- package/dist/assets/sv-DQUMehtC.js +0 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-C2KDCowk.js +0 -8
- package/dist/assets/ta-CzkRFNns.js +0 -1
- package/dist/assets/th-DR6hfS-t.js +0 -1
- package/dist/assets/tr-ECW9jg6T.js +0 -1
- package/dist/assets/useI18n-CrrUk_L3.js +0 -171
- package/dist/assets/vi-D2nRiUXf.js +0 -1
- package/dist/assets/zh-CN-Cn0aI883.js +0 -1
- package/dist/assets/zh-HK-DxBG0PaI.js +0 -1
- package/dist/assets/zh-TW-DHK1J7Rs.js +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChartView-Db94VZQx.js","assets/rolldown-runtime-BWaJ3C7D.js","assets/jsx-runtime-lTuChwRC.js","assets/react-9WV3M1gM.js","assets/useI18n-V1cysfvg.js","assets/public-runtime-8slf2C-u.js","assets/bundle-mjs-H9shJLym.js","assets/badge-tone-CARgRBWT.js","assets/ChartEmptyState-DWIzkRcF.js","assets/ChartLoadingSkeleton-DJK8tr0I.js","assets/ChartWidget-YVF2hpZO.js","assets/react-dom-DQGBdIds.js","assets/preload-helper-7y9sWmk5.js","assets/flows-actors-graph-runtime-D-xOavtY.js","assets/flow-execution-BwY1ThjF.js","assets/src-C_gRsKqw.js","assets/value-CHmTzbgv.js"])))=>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,$T as o,$_ as s,$a as c,$g as l,$h as u,$i as d,$l as f,$n as p,$p as m,$r as h,$t as g,$v as _,$w as v,$x as y,A as b,AD as x,AE as S,AS as C,AT as w,A_ as T,Aa as E,Ab as D,Ag as O,Ah as k,Ai as A,An as j,Ao as M,Ap as N,Ar as P,At as F,Au as I,Aw as L,Ax as R,Ay as z,B,BC as ee,BD as te,BE as ne,BS as V,BT as re,B_ as ie,Ba as ae,Bb as oe,Bh as se,Bi as ce,Bm as le,Bn as ue,Bo as de,Bp as fe,Br as pe,Bt as me,Bv as he,Bw as ge,By as _e,C as ve,CC as ye,CE as be,CT as xe,Ca as Se,Cb as Ce,Cd as we,Cf as Te,Cg as Ee,Ch as De,Ci as Oe,Cm as ke,Cn as Ae,Cr as je,Ct as Me,Cv as Ne,Cw as Pe,Cx as Fe,D as Ie,DD as Le,DE as Re,DS as ze,DT as Be,Da as Ve,Dd as He,Df as Ue,Dg as We,Dh as Ge,Dl as Ke,Dm as qe,Dn as Je,Dr as Ye,Dt as Xe,Du as Ze,Dy as Qe,E as $e,ED as et,ET as tt,E_ as nt,Ea as rt,Ef as it,Eg as at,Ei as ot,Em as st,En as ct,Eo as lt,Er as ut,Et as dt,Eu as ft,Ew as pt,Ey as mt,F as ht,FD as H,FE as gt,FS as _t,FT as vt,Fa as yt,Fb as bt,Fd as xt,Ff as St,Fg as Ct,Fh as wt,Fi as Tt,Fl as Et,Fm as Dt,Fn as Ot,Fp as kt,Fr as At,Ft as U,Fu as jt,Fv as Mt,Fw as Nt,Fy as Pt,G as Ft,GS as It,GT as Lt,Ga as Rt,Gf as zt,Gg as Bt,Gi as Vt,Gm as Ht,Gn as Ut,Gp as Wt,Gr as Gt,Gt as Kt,Gv as qt,Gw as Jt,Gx as Yt,H as Xt,HC as Zt,HD as Qt,HE as $t,HS as en,HT as tn,Ha as nn,Hb as rn,Hg as an,Hh as on,Hi as sn,Hm as cn,Hn as ln,Hp as un,Hr as dn,Ht as fn,Hu as pn,Hv as mn,Hw as hn,Hx as gn,Hy as _n,I as vn,ID as yn,IE as bn,IT as xn,Ia as Sn,Ib as Cn,Ii as wn,In as Tn,Ip as En,Ir as Dn,Is as On,It as kn,Iv as An,Iw as jn,Iy as Mn,J as Nn,JC as Pn,JE as Fn,JS as In,JT as Ln,Ja as W,Jb as Rn,Jg as zn,Jh as Bn,Ji as Vn,Jl as Hn,Jn as Un,Jo as Wn,Jr as Gn,Jt as Kn,Jv as qn,Jw as Jn,Jy as Yn,K as Xn,KC as Zn,KE as Qn,KS as $n,KT as er,Ka as tr,Kb as eee,Kf as nr,Kg as rr,Kh as tee,Ki as ir,Km as nee,Kn as ree,Kr as iee,Kt as aee,Ku as ar,Kv as oee,Kw as or,Kx as see,Ky as sr,L as cr,LD as lr,LT as ur,La as cee,Lb as dr,Ld as fr,Lf as lee,Lg as pr,Lh as mr,Li as uee,Lm as hr,Ln as dee,Lr as gr,Lt as _r,Lv as fee,Lw as vr,Ly as yr,M as br,MD as xr,ME as Sr,MT as Cr,Ma as pee,Mb as mee,Mf as hee,Mg as gee,Mi as wr,Mm as Tr,Mn as Er,Mo as Dr,Mr as Or,Mt as _ee,Mu as kr,Mw as vee,N as yee,ND as Ar,NE as jr,NT as Mr,N_ as bee,Na as Nr,Nb as Pr,Nd as Fr,Nf as Ir,Ng as xee,Ni as Lr,Nm as See,Nn as Rr,Nr as zr,Nt as G,Nv as Cee,Nw as Br,O as Vr,OD as Hr,OE as Ur,OT as wee,Oa as Wr,Of as Tee,Og as Eee,Om as Gr,On as Dee,Oo as Oee,Op as kee,Or as Aee,Ot as Kr,Ou as qr,Ow as Jr,Oy as Yr,P as jee,PD as Mee,PE as Xr,PT as Zr,Pa as Nee,Pd as Qr,Pf as $r,Pg as ei,Ph as Pee,Pi as ti,Pm as ni,Pn as ri,Pp as Fee,Pr as Iee,Pt as ii,Pv as ai,Pw as Lee,Py as oi,Q as si,QE as ci,QT as li,Q_ as Ree,Qa as ui,Qb as zee,Qc as Bee,Qf as Vee,Qg as di,Qh as fi,Qi as pi,Ql as Hee,Qm as Uee,Qn as Wee,Qo as mi,Qp as hi,Qr as Gee,Qt as gi,Qw as Kee,Qx as _i,Qy as qee,R as vi,RD as yi,RT as bi,Ra as xi,Rb as Si,Rd as Ci,Rf as wi,Rg as Ti,Rh as Jee,Ri as Ei,Rm as Yee,Rn as Di,Rp as Oi,Rr as ki,Rt as Xee,Rv as Ai,Rw as ji,Ry as Mi,S as Ni,SC as Zee,SD as Pi,SE as Fi,ST as Qee,Sa as $ee,Sd as ete,Sh as Ii,Si as Li,Sm as Ri,Sn as zi,Sr as tte,St as nte,Sv as rte,Sw as ite,Sy as Bi,T as Vi,TD as Hi,TE as Ui,TT as Wi,Ta as Gi,Tc as Ki,Tf as qi,Tg as Ji,Ti as Yi,Tm as Xi,Tn as Zi,To as Qi,Tr as $i,Tt as ea,Tu as ate,Tx as ta,U as na,UC as ra,UD as K,UE as ia,UT as aa,U_ as ote,Ua as ste,Ub as cte,Uh as lte,Ui as ute,Um as dte,Un as fte,Uo as oa,Up as pte,Ur as sa,Ut as mte,Uu as ca,Uv as la,Uw as ua,Ux as da,Uy as fa,V as hte,VC as gte,VD as pa,VE as ma,VS as ha,VT as _te,Va as ga,Vb as _a,Vf as va,Vg as ya,Vh as vte,Vi as yte,Vm as ba,Vn as bte,Vp as xa,Vr as Sa,Vt as xte,Vv as Ste,Vw as Cte,W as Ca,WC as wa,WE as Ta,WS as Ea,WT as wte,Wa as Tte,Wb as Da,Wg as Oa,Wh as ka,Wi as Ete,Wl as Dte,Wm as Ote,Wn as kte,Wr as Aa,Wt as Ate,Wu as ja,Wv as Ma,Ww as Na,Wx as Pa,Wy as Fa,X as Ia,XC as jte,XE as Mte,XT as La,X_ as Ra,Xa as za,Xg as Nte,Xh as Ba,Xi as Va,Xl as Ha,Xn as Ua,Xo as Pte,Xp as Wa,Xr as Fte,Xt as Ga,Xw as Ka,Xx as qa,Xy as Ite,Y as Lte,YC as Rte,YT as zte,Y_ as Ja,Ya,Yb as Xa,Yf as Za,Yg as Qa,Yh as $a,Yi as eo,Yl as Bte,Ym as to,Yn as Vte,Yo as no,Yp as ro,Yr as Hte,Yt as io,Yw as Ute,Yx as ao,Z as Wte,ZC as oo,ZE as so,ZT as co,Za as lo,Zg as Gte,Zi as Kte,Zl as uo,Zn as qte,Zo as fo,Zr as Jte,Zt as po,Zw as Yte,Zx as Xte,Zy as mo,_ as Zte,_D as ho,_T as go,_a as Qte,_b as _o,_c as vo,_d as $te,_g as ene,_i as tne,_m as yo,_n as bo,_o as xo,_r as nne,_t as So,_x as Co,_y as wo,a as rne,aS as To,aT as ine,aa as Eo,ab as Do,ai as Oo,al as ane,am as ko,an as Ao,ao as one,ap as sne,ar as cne,at as lne,au as une,aw as jo,ax as Mo,b as dne,bC as No,bD as Po,bT as fne,ba as pne,bb as mne,bd as Fo,bf as Io,bg as Lo,bh as Ro,bi as zo,bn as Bo,bp as Vo,br as Ho,bt as Uo,bx as Wo,by as Go,c as Ko,cC as qo,cD as Jo,cE as Yo,cS as hne,cT as gne,ca as _ne,cb as Xo,ci as vne,cm as yne,cn as bne,cp as xne,cr as Sne,ct as Zo,cu as Cne,cw as wne,cx as Qo,d as Tne,dC as $o,dD as es,dE as ts,dS as ns,dT as rs,d_ as is,da as Ene,db as Dne,dd as as,di as One,dn as kne,do as Ane,dr as jne,dt as Mne,du as Nne,dw as os,dx as Pne,dy as Fne,eD as ss,eE as Ine,eS as cs,eT as ls,e_ as us,ea as Lne,eb as Rne,eg as zne,ei as Bne,em as Vne,en as ds,eo as Hne,er as Une,eu as Wne,ew as Gne,ey as fs,f as ps,fD as ms,fE as hs,fS as Kne,fT as gs,fa as _s,fb as qne,fg as Jne,fi as vs,fm as ys,fn as bs,fo as Yne,fr as Xne,ft as xs,fw as Ss,fy as Zne,g as Qne,gC as Cs,gD as ws,gE as Ts,gT as Es,ga as $ne,gb as ere,gd as Ds,gg as Os,gh as ks,gi as As,gm as js,gn as Ms,go as Ns,gr as Ps,gs as Fs,gt as Is,gx as Ls,gy as Rs,h as zs,hC as Bs,hD as Vs,hE as Hs,hT as Us,h_ as Ws,ha as Gs,hb as Ks,hi as qs,hl as Js,hn as Ys,ho as Xs,hp as Zs,hr as Qs,ht as $s,hu as ec,hw as tc,hx as nc,i as rc,iD as ic,iE as ac,iS as tre,ia as nre,id as rre,ii as oc,il as ire,in as sc,io as cc,ir as are,it as ore,iu as sre,iw as lc,j as uc,jD as dc,jE as fc,jT as cre,ja as pc,jb as lre,jf as ure,ji as dre,jm as fre,jn as mc,jo as pre,jp as mre,jr as hc,jt as gc,ju as hre,jw as _c,jx as gre,k as vc,kD as yc,kE as bc,kT as _re,k_ as vre,ka as xc,kg as yre,kh as Sc,ki as bre,km as Cc,ko as xre,kp as Sre,kr as Cre,kt as wc,ku as Tc,kw as Ec,ky as Dc,l as Oc,lC as kc,lD as Ac,lS as jc,lT as wre,la as Tre,lb as Mc,li as Nc,lm as Ere,ln as Pc,lp as Fc,lr as Dre,lt as Ore,lu as Ic,lw as Lc,m as Rc,mC as zc,mD as Bc,mE as Vc,mT as kre,m_ as Are,ma as jre,mi as Hc,ml as Uc,mm as Wc,mn as Gc,mo as Mre,mp as Nre,mr as Pre,mt as Fre,mw as Kc,n as qc,nD as Jc,nS as Yc,nT as Ire,na as Lre,nb as Xc,ng as Zc,nh as Rre,ni as Qc,nm as $c,nn as el,no as tl,np as zre,nr as Bre,nt as Vre,nu as Hre,nw as nl,nx as Ure,o as rl,oE as il,oS as al,oT as Wre,oa as Gre,oh as Kre,oi as ol,ol as qre,om as Jre,on as Yre,op as sl,or as Xre,ot as cl,ou as ll,ow as ul,ox as Zre,oy as dl,p as fl,pD as pl,pE as Qre,pT as $re,p_ as eie,pa as tie,pb as ml,pi as hl,pl as gl,pm as _l,pn as vl,po as yl,pp as bl,pr as nie,pt as rie,q as iie,qC as xl,qE as Sl,qT as aie,qa as oie,qg as Cl,qi as wl,qn as sie,qo as Tl,qp as cie,qr as lie,qt as El,qu as Dl,qv as uie,qw as die,qx as Ol,r as kl,rD as Al,rE as jl,rS as Ml,rT as Nl,ra as fie,ri as Pl,rl as pie,rn as Fl,ro as mie,rr as hie,rt as gie,rx as _ie,s as vie,sC as Il,sD as Ll,sE as Rl,sS as zl,sT as Bl,sa as Vl,sb as Hl,si as Ul,sl as Wl,sn as Gl,sp as yie,sr as bie,su as xie,sv as Kl,sw as Sie,sx as ql,sy as Jl,t as q,tD as Yl,tE as Xl,tS as Cie,tT as Zl,t_ as Ql,ta as wie,tb as $l,ti as Tie,tn as Eie,to as Die,tr as Oie,tt as eu,tu,tv as nu,tw as ru,tx as iu,ty as au,u as ou,uE as su,uS as cu,uT as lu,u_ as uu,ua as kie,ub as Aie,ug as jie,ui as Mie,um as du,un as Nie,uo as fu,ur as Pie,ut as Fie,uu as Iie,uw as pu,ux as mu,uy as Lie,v as Rie,vC as hu,vD as gu,vT as zie,va as Bie,vg as _u,vi as Vie,vm as vu,vn as yu,vp as Hie,vr as Uie,vv as bu,vw as xu,vy as Wie,w as Su,wE as Cu,wT as wu,wa as Gie,wd as Tu,wf as Kie,wg as Eu,wh as qie,wi as Du,wm as Jie,wn as Ou,wo as Yie,wr as Xie,wt as ku,wv as Au,ww as Zie,wx as Qie,x as $ie,xC as ju,xD as Mu,xE as Nu,xS as Pu,xT as Fu,xa as Iu,xb as Lu,xd as Ru,xg as zu,xh as Bu,xi as Vu,xl as Hu,xm as Uu,xn as Wu,xr as Gu,xt as Ku,xv as qu,xw as eae,xx as Ju,xy as tae,y as nae,yC as Yu,yD as Xu,yE as Zu,yT as rae,ya as iae,yb as Qu,yd as aae,yg as oae,yi as sae,yl as cae,yn as lae,yo as $u,yp as uae,yr as dae,ys as fae,yu as pae,yv as ed,yx as J,yy as mae,z as td,zC as nd,zD as rd,zE as id,zT as hae,z_ as ad,za as gae,zb as od,zg as sd,zh as _ae,zi as cd,zm as ld,zn as vae,zp as yae,zr as ud,zt as bae,zv as dd,zw as xae}from"./useI18n-V1cysfvg.js";import{B as fd,C as pd,Ci as md,Dt as Sae,E as hd,En as Cae,Es as wae,F as gd,I as _d,J as Tae,M as vd,N as yd,O as bd,P as xd,S as Sd,Si as Cd,T as Eae,Tt as wd,U as Td,Ur as Dae,W as Ed,X as Dd,Xr as Od,Y as Oae,_ as kae,at as kd,cr as Ad,ct as jd,et as Aae,fr as Md,g as jae,h as Mae,it as Nae,j as Nd,li as Pd,lt as Fd,m as Pae,na as Id,ot as Ld,p as Fae,q as Iae,rt as Lae,st as Rd,tr as zd,tt as Bd,u as Rae,ui as Vd,v as zae,w as Hd,wr as Bae,wt as Vae,x as Hae}from"./public-runtime-8slf2C-u.js";import{$t as Y,At as Ud,Bt as Uae,C as Wae,Ct as Gae,Dt as Wd,Et as Kae,Ft as Gd,Gt as qae,Ht as Jae,It as Yae,J as Xae,Jt as Zae,Kt as Qae,Lt as Kd,Mt as $ae,Nt as qd,Ot as eoe,Pt as Jd,Qt as toe,Rt as Yd,S as Xd,St as Zd,Tt as Qd,Ut as $d,Vt as ef,Wt as tf,X as nf,Xt as rf,Y as af,Yt as of,Z as sf,Zt as cf,_ as lf,_t as uf,an as df,at as ff,b as pf,bt as mf,ct as hf,dt as gf,en as _f,et as vf,ft as yf,g as bf,gt as xf,h as Sf,ht as Cf,in as wf,it as Tf,jt as Ef,kt as Df,lt as Of,mt as kf,n as Af,nn as jf,nt as Mf,on as Nf,ot as Pf,pt as Ff,q as If,qt as Lf,r as Rf,rn as zf,rt as Bf,sn as Vf,st as Hf,tn as X,tt as Uf,ut as Wf,v as Gf,vt as Kf,wt as qf,x as Jf,xt as Yf,y as Xf,yt as Zf,zt as Qf}from"./flow-execution-BwY1ThjF.js";import{$ as $f,$n as ep,A as tp,An as np,At as rp,B as ip,Bn as ap,Bt as noe,C as op,Cn as sp,Ct as roe,D as cp,Dn as lp,Dt as ioe,E as up,En as aoe,Et as dp,F as fp,Fn as pp,Ft as mp,G as hp,Gn as ooe,Gt as gp,H as soe,Hn as _p,Ht as coe,I as loe,In as vp,It as uoe,J as yp,Jn as doe,Jt as foe,K as poe,Kn as bp,Kt as xp,L as moe,Ln as Sp,Lt as hoe,M as goe,Mn as Cp,Mt as wp,N as Tp,Nn as Ep,Nt as Dp,O as _oe,On as voe,Ot as yoe,P as Op,Pn as kp,Pt as boe,Q as Ap,Qn as jp,Qt as Mp,R as Np,Rn as Pp,Rt as Fp,S as xoe,Sn as Ip,St as Soe,T as Coe,Tn as woe,Tt as Lp,U as Toe,Un as Eoe,Ut as Doe,V as Rp,Vn as zp,Vt as Ooe,W as koe,Wn as Bp,Wt as Vp,X as Hp,Xn as Aoe,Xt as Up,Y as Wp,Yn as joe,Yt as Gp,Z as Kp,Zn as Moe,Zt as qp,_ as Noe,_n as Jp,_t as Poe,a as Yp,an as Foe,at as Xp,b as Ioe,bn as Loe,bt as Roe,c as Zp,cn as zoe,ct as Qp,d as Boe,dn as Voe,dt as $p,er as em,et as Hoe,f as tm,fn as Uoe,ft as Woe,g as nm,gn as Goe,gt as Koe,h as rm,hn as im,ht as am,i as qoe,in as om,it as sm,j as cm,jn as Joe,jt as Yoe,k as Xoe,kn as Zoe,kt as lm,l as Qoe,ln as $oe,lt as um,m as ese,mn as tse,mt as nse,n as dm,nn as rse,nt as fm,o as pm,on as mm,ot as ise,p as hm,pn as ase,pt as ose,q as gm,qn as sse,qt as cse,r as _m,rn as vm,rt as ym,s as bm,sn as lse,st as xm,t as Sm,tn as Cm,tr as use,tt as wm,u as Tm,un as dse,ut as Em,v as fse,vn as pse,vt as mse,w as hse,wn as Dm,wt as gse,x as Om,xn as _se,xt as km,y as Am,yn as vse,yt as jm,z as yse,zn as bse,zt as Mm}from"./ChartLoadingSkeleton-DJK8tr0I.js";import{$ as xse,$t as Nm,A as Sse,At as Pm,B as Fm,Bt as Im,C as Lm,Ct as Rm,D as Cse,Dt as zm,E as wse,Et as Tse,F as Bm,Ft as Vm,G as Ese,Gt as Hm,H as Um,Ht as Wm,I as Dse,It as Gm,J as Ose,Jt as kse,K as Ase,Kt as jse,L as Mse,Lt as Nse,M as Km,Mt as qm,N as Jm,Nt as Ym,O as Xm,Ot as Zm,P as Qm,Pt as $m,Q as eh,Qt as th,R as nh,Rt as rh,S as ih,St as ah,T as oh,Tt as sh,U as Pse,Ut as ch,V as lh,Vt as Fse,W as Ise,Wt as uh,X as dh,Xt as fh,Yt as ph,Z as mh,Zt as Lse,_ as hh,_t as Rse,a as gh,an as zse,at as Bse,b as Vse,bt as _h,c as Hse,ct as Use,d as vh,dt as Wse,en as yh,et as Gse,f as Kse,ft as bh,g as qse,gt as Jse,h as xh,ht as Sh,i as Ch,in as wh,it as Yse,j as Xse,jt as Th,k as Eh,kt as Dh,l as Oh,lt as kh,m as Ah,mt as jh,nn as Mh,nt as Nh,o as Ph,on as Fh,ot as Ih,p as Lh,pt as Rh,q as zh,qt as Bh,r as Vh,rn as Hh,rt as Uh,s as Wh,sn as Gh,st as Kh,t as qh,tn as Jh,tt as Yh,u as Xh,ut as Zh,v as Qh,vt as $h,w as eg,wt as tg,x as ng,xt as rg,y as ig,yt as ag,z as og,zt as sg}from"./ChartWidget-YVF2hpZO.js";import{t as cg}from"./jsx-runtime-lTuChwRC.js";import{A as lg,B as ug,C as dg,D as fg,E as pg,F as mg,G as hg,H as gg,I as _g,J as vg,K as yg,L as bg,M as xg,N as Sg,O as Cg,P as wg,R as Tg,S as Eg,T as Dg,U as Og,V as kg,W as Ag,Y as jg,_ as Mg,a as Ng,b as Pg,c as Fg,d as Ig,f as Lg,g as Rg,h as zg,i as Bg,j as Vg,k as Hg,l as Ug,m as Wg,n as Gg,o as Kg,p as qg,q as Jg,r as Yg,s as Xg,t as Zg,u as Qg,v as $g,w as e_,x as t_,y as n_,z as r_}from"./badge-tone-CARgRBWT.js";import{t as i_}from"./preload-helper-7y9sWmk5.js";import{a as a_,c as o_,d as s_,f as c_,g as l_,h as u_,i as d_,l as f_,m as p_,n as m_,o as h_,p as Z,r as g_,s as __,t as v_,u as y_}from"./ChartEmptyState-DWIzkRcF.js";function b_(e,t){return e!==void 0||t!==void 0}var x_=`frontend_sdk`,S_=function(e){return e.STRING=`string`,e.NUMBER=`number`,e.BOOLEAN=`boolean`,e}({});function C_(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 w_(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 T_(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 E_(e,t){return(e??[]).filter(e=>{let n=t?.[e];return n==null||typeof n==`string`&&n.trim()===``})}function D_(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}.${x_} in the application's configuration (per environment in its infrastructure configuration), then run \`wildo config sync\`.`}var O_=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 k_(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 O_(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 A_=[];function j_(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 M_(e){let{previousRow:t,isStoredRow:n,...r}=e;if(!e.row||!t)return{contextResourceIdentifiers:j_(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=j_({...r,row:i,callContext:c}),u=j_({...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 N_(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)=>N_(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)&&N_(n[e],r[e]))}function P_(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=>N_(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 F_(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 I_(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 L_(e){let t=F_(e),n=new Map,r=new Set(t.keys());for(let e of r)n.set(e,I_(e,t));return n}var R_=function(e){return e.UTF8=`UTF8`,e.BASE64=`BASE64`,e}({}),z_=function(e){return e.NEXT_ACTIONS=`next_actions`,e.SUMMARY=`summary`,e.FLAT=`flat`,e.DETAILED=`detailed`,e}({}),B_=`summary`;function V_(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 H_(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:V_(n,r,e=>e.fieldIdentifier)}}function U_(e,t){return!e&&!t?[]:e?t?V_(e,t,e=>e.ref):[...e??[]]:[...t??[]]}function W_(e,t){return!e&&!t?[]:K_(e?t?V_(e,t,e=>e.ref):[...e??[]]:[...t??[]])}function G_(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===xc.NAVIGATION_LIST&&e.contentKind===xc.NAVIGATION_LIST?n=Y_(n,e.ref,e.children):n[t]=e}return K_(n)}function K_(e){let t;try{t=ui.isDevelopment()}catch{t=!1}if(!t)return e;let n=new Map,r=(e,t)=>{for(let i of e??[]){let e=J_(i),a=n.get(e)??[];a.push(t),n.set(e,a),r(i.children,t)}};for(let t of e)t.contentKind===xc.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 q_(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 J_(e){switch(e.kind){case _s.RESOURCE_OPERATION:return`resource_operation:${e.resourceType}:${e.operation}:${e.operationVariant??`default`}`;case _s.VIEW:return`${e.kind}:${e.viewRef}`;case _s.RESOURCE_VIEW:return`${e.kind}:${e.resourceType}:${e.viewRef}`;case _s.ENGINE_PAGE:return`engine_page:${e.pageRef}`;case _s.CUSTOM_COMPONENT:return`custom_component:${e.componentRef}`;case _s.SETTINGS_SECTION:return`settings_section:${e.sectionRef??`default`}`;default:throw Error(`launcherItemRefKey: no key for launcher item kind ${e.kind}`)}}function Y_(e,t,n){return e?.length?n.length?e.map(e=>{if(e.ref!==t||e.contentKind!==xc.NAVIGATION_LIST)return e;let r=e,i=new Set(r.children.map(J_)),a=n.filter(e=>!i.has(J_(e)));return a.length===0?e:{...r,children:[...r.children,...a]}}):[...e]:e??[]}function X_(e,t){return e?.length?t?.length?V_(e,t,J_):[...e]:[...t??[]]}function Z_(e,t){return e?.length?t?.length?V_(e,t,e=>`${J_(e)}:${e.group??`default`}`):[...e]:[...t??[]]}function Q_(e,t){return e?.length?t?.length?V_(e,t,e=>e.ref):[...e]:[...t??[]]}function Zse(...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 $_(e,t){let n=new Map;for(let r of[...e,...t])n.set(r.fieldIdentifier,r);return Array.from(n.values())}function ev(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 tv(e){let t=new Map,n=[];for(let r of e)for(let e of r.componentRegistrations??[]){let i=e.preset??H.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 Qse(...e){return{moduleIds:e.map(e=>e.moduleId),resourceUIBehavior:Object.assign({},...e.map(e=>e.resourceUIBehavior??{})),sidebarSections:e.reduce((e,t)=>G_(e,t.sidebarSections),[]),quickSwitcherFields:e.reduce((e,t)=>$_(e,t.quickSwitcherFields??[]),[]),compositeViews:e.flatMap(e=>Cp(e.compositeViews))}}function nv(...e){return{...Qse(...e),menubarItems:e.flatMap(e=>e.menubarItems??[]),commandMenuItems:e.reduce((e,t)=>X_(e,t.commandMenuItems),[]),sidebarSectionItems:e.flatMap(e=>e.sidebarSectionItems??[]),appScope:e.reduce((e,t)=>({...e,...t.appScope,fields:$_(e.fields??[],t.appScope?.fields??[])}),{}),fullCustomViews:e.reduce((e,t)=>Q_(e,t.fullCustomViews),[]),onboardingViews:ev([],e.flatMap(e=>e.onboardingViews??[]),e=>e.ref),guidanceFlows:ev([],e.flatMap(e=>e.guidanceFlows??[]),e=>e.ref),flowsActorsViews:ev([],e.flatMap(e=>e.flowsActorsViews??[]),e=>e.ref),componentRegistrations:$se(e)}}function $se(e){let{registrations:t,replaced:n}=tv(e);for(let e of n)tl.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 rv(e){let t=$_(e.appScope.fields??[],e.quickSwitcherFields);return t.length===0?e.appScope:{...e.appScope,fields:t}}function iv(e,t){let n=W_(e,t.sidebarSections);return t.sidebarSectionItems.reduce((e,t)=>Y_(e,t.sectionRef,t.items),n)}function av(e,t){let n=e[Ol.MENUBAR],r=e[Ol.SIDEBAR],i=e[Ol.COMMAND_MENU];return{...e,[Ol.MENUBAR]:n&&typeof n==`object`&&!Array.isArray(n)?{...n,items:Z_(n.items,t.menubarItems)}:n,[Ol.SIDEBAR]:r&&typeof r==`object`?{...r,contentSections:iv(r.contentSections,t)}:r,[Ol.COMMAND_MENU]:i&&typeof i==`object`?{...i,commands:X_(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 sv;(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.AGENT_ACTIVITY=`agent-activity`,e.APPLICATION_AGENT_ACTIVITY=`application-agent-activity`,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`})(sv||={});var cv;(function(e){e.REPRESENTS=`relationshipRepresents`,e.GRANTS=`relationshipGrants`,e.INVITES=`relationshipInvites`,e.LENDS=`relationshipLends`})(cv||={});function lv(e){return e.currentOrganizationId?e.organizations?.find(t=>t._id===e.currentOrganizationId)?.type:void 0}function uv(e){let t=lv(e),n=Au(e.organizationRelationships,e.organizationTypes,t),r=n.some(e=>e.side===ed.REPRESENTING);return{[cv.REPRESENTS]:r,[cv.GRANTS]:n.some(e=>e.side===ed.GRANTING),[cv.INVITES]:r&&Ne(e.organizationRelationships,t??void 0).length>0,[cv.LENDS]:n.some(t=>t.side===ed.GRANTING&&rte(e.organizationRelationships,t.kind))}}var dv;(function(e){e.ASKS_THE_OPERATOR=`relationshipAsksTheOperator`,e.NAMES_THE_OTHER_ORGANIZATION=`relationshipNamesTheOtherOrganization`})(dv||={});function fv(e){let t=Au(e.organizationRelationships,e.organizationTypes,lv(e)),n=Eee(e.organizationTypes),r=t=>{let r=e.organizationRelationships?.[t];return r?qu(r,n).standing:void 0};return{[dv.ASKS_THE_OPERATOR]:t.some(e=>e.side===ed.GRANTING&&r(e.kind)===bu.OPERATOR_IS_PARTY),[dv.NAMES_THE_OTHER_ORGANIZATION]:t.some(e=>r(e.kind)===bu.INDEPENDENT_PARTIES)}}var pv;(function(e){e.ENABLED=`scimEnabled`,e.ORGANIZATION_TYPE_ADMITS=`scimOrganizationTypeAdmitsDirectory`,e.SETTINGS_REACHABLE=`scimSettingsReachable`})(pv||={});function mv(e){return e.organizationTypeKnown&&!(e.featureOffered&&e.organizationTypeDirectoryProvisioned)}function hv(e){let t=e.featureOffered&&e.organizationTypeDirectoryProvisioned;return{[pv.ENABLED]:t,[pv.ORGANIZATION_TYPE_ADMITS]:e.organizationTypeDirectoryProvisioned,[pv.SETTINGS_REACHABLE]:t||e.holdsUnrevokedToken}}var gv=[Jl.ORG_OWNER,Jl.ORG_ADMIN],_v=[dl.APP_ADMIN_SUPER_ADMIN],vv=`billingEnabled`,yv=`professionalQualificationsDeclared`,bv=[{ref:sl.PROFILE,icon:W.PROFILE,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.USER_SELF_PROFILES,operation:J.READ}},{ref:sl.SECURITY,icon:W.LOCK,target:{kind:ov.ENGINE_PANEL,panelRef:sv.SECURITY}},{ref:sl.APPEARANCE,icon:W.PALETTE,target:{kind:ov.ENGINE_PANEL,panelRef:sv.APPEARANCE}},{ref:sl.PREFERENCES,icon:W.SLIDERS,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.USER_SELF_PREFERENCES,operation:J.READ}},{ref:sl.MY_INVITATIONS,icon:W.MAIL,target:{kind:ov.ENGINE_PANEL,panelRef:sv.INVITATIONS}},{ref:sl.DEACTIVATE_ACCOUNT,icon:W.USER_COG,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.USER_SELF,operation:Et.DEACTIVATE_ACCOUNT}},{ref:sl.MY_PROVIDER_CREDENTIALS,icon:W.PLUG,target:{kind:ov.ENGINE_PANEL,panelRef:sv.CONNECTED_ACCOUNTS}},{ref:sl.AUTHORIZED_APPS,icon:W.THIRD_PARTY_APP,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.OAUTH_CONSENT_GRANTS,operation:J.LIST}},{ref:sl.MY_DATA_SUBJECT_REQUESTS,icon:W.SHIELD,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.DATA_SUBJECT_REQUESTS,operation:J.LIST}},{ref:sl.MY_AGENT_PUSH_DELIVERIES,icon:W.NOTIFICATION,requiredEngineCapabilities:[jd.AI_LLM],target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.USER_A2A_PUSH_DELIVERY_LOG,operation:J.LIST}},{ref:sl.ORGANIZATION_GENERAL,icon:W.ORGANIZATION,requiredRoles:gv,target:{kind:ov.SUB_TABS,subTabs:[{ref:`organization-general-record`,label:`Organization`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATIONS,operation:J.READ}},{ref:`organization-general-profile`,label:`Profile`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_PROFILES,operation:J.READ}},{ref:`organization-general-preferences`,label:`Preferences`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_PREFERENCES,operation:J.READ}},{ref:`organization-general-notifications`,label:`Notifications`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_NOTIFICATIONS,operation:J.READ}}]}},{ref:sl.MEMBERS,icon:W.USERS,requiredRoles:gv,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_MEMBERS,operation:J.LIST}},{ref:sl.ORGANIZATION_UNITS,icon:W.HIERARCHY,requiredRoles:gv,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_UNITS,operation:J.LIST}},{ref:sl.BILLING,icon:W.CREDIT_CARD,requiredRoles:gv,runtimeAvailability:{requiredCapabilities:[vv]},target:{kind:ov.ENGINE_PANEL,panelRef:sv.BILLING}},{ref:sl.API_KEYS,icon:W.KEY,requiredRoles:gv,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORG_API_KEYS,operation:J.LIST}},{ref:sl.ORGANIZATION_OAUTH_CLIENTS,icon:W.LINK,requiredRoles:gv,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.OAUTH_CLIENTS_ORGANIZATION,operation:J.LIST}},{ref:sl.PROVIDER_CREDENTIALS,icon:W.PLUG,requiredRoles:gv,target:{kind:ov.ENGINE_PANEL,panelRef:sv.ORGANIZATION_CONNECTED_ACCOUNTS}},{ref:sl.SSO,icon:W.LOGIN,requiredRoles:gv,runtimeAvailability:{requiredCapabilities:[`ssoEnabled`]},entitlementFeatureId:Uu.SINGLE_SIGN_ON,target:{kind:ov.SUB_TABS,subTabs:[{ref:`sso-configuration`,label:`Configuration`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_SSO_CONFIG,operation:J.READ}},{ref:`sso-connections`,label:`Connections`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_SSO_CONNECTIONS,operation:J.LIST}}]}},{ref:sl.SCIM,icon:W.USER_COG,requiredRoles:gv,runtimeAvailability:{requiredCapabilities:[pv.SETTINGS_REACHABLE]},entitlementFeatureId:Uu.DIRECTORY_PROVISIONING,target:{kind:ov.SUB_TABS,subTabs:[{ref:`scim-provisioning`,label:`Provisioning`,runtimeAvailability:{requiredCapabilities:[pv.ENABLED]},target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_SCIM_PROVISIONING_CONFIG,operation:J.READ}},{ref:`scim-tokens`,label:`Tokens`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_SCIM_TOKENS,operation:J.LIST}}]}},{ref:sl.SIEM,icon:W.ACTIVITY,requiredRoles:gv,runtimeAvailability:{requiredCapabilities:[`siemEnabled`]},entitlementFeatureId:Uu.SECURITY_EVENT_EXPORT,target:{kind:ov.SUB_TABS,subTabs:[{ref:`siem-export`,label:`Export`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_SIEM_EXPORT_CONFIG,operation:J.READ}},{ref:`siem-failed-deliveries`,label:`Failed deliveries`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_SIEM_DELIVERY_DLQ,operation:J.LIST}}]}},{ref:sl.WEBHOOKS,icon:W.WEBHOOK,requiredRoles:gv,runtimeAvailability:{requiredCapabilities:[`webhooksEnabled`]},entitlementFeatureId:Uu.M2M_WEBHOOK_DELIVERY,target:{kind:ov.SUB_TABS,subTabs:[{ref:`webhooks-endpoints`,label:`Endpoints`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_WEBHOOK_CONFIG,operation:J.READ}},{ref:`webhooks-delivery-log`,label:`Delivery log`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG,operation:J.LIST}}]}},{ref:sl.INBOUND_DELIVERIES,icon:W.INBOX,requiredRoles:gv,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_INBOUND_DELIVERIES,operation:J.LIST}},{ref:sl.AGENT_PUSH_DELIVERIES,icon:W.NOTIFICATION,requiredRoles:gv,requiredEngineCapabilities:[jd.AI_LLM],target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_A2A_PUSH_DELIVERY_LOG,operation:J.LIST}},{ref:sl.RELATIONSHIPS,icon:W.HANDSHAKE,requiredRoles:gv,runtimeAvailability:{requiredCapabilities:[cv.GRANTS]},target:{kind:ov.SUB_TABS,subTabs:[{ref:`relationships-organizations`,label:`Organizations`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_RELATIONSHIPS,operation:J.LIST}},{ref:`relationships-delegated-capabilities`,label:`Delegated capabilities`,runtimeAvailability:{requiredCapabilities:[cv.LENDS]},target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.RELATIONSHIP_CAPABILITY_GRANTS,operation:J.LIST}}]}},{ref:sl.REPRESENTATIONS,icon:W.BRIEFCASE,requiredRoles:gv,runtimeAvailability:{requiredCapabilities:[cv.REPRESENTS]},target:{kind:ov.SUB_TABS,subTabs:[{ref:`representations-organizations`,label:`Organizations`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_REPRESENTATIONS,operation:J.LIST}},{ref:`representations-invitations`,label:`Invitations`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.RELATIONSHIP_INVITATIONS,operation:J.LIST}},{ref:`representations-model-cost`,label:`Model cost`,target:{kind:ov.ENGINE_PANEL,panelRef:sv.REPRESENTING_ORGANIZATION_MODEL_COST_BREAKDOWN}},{ref:`representations-activity`,label:`Activity`,target:{kind:ov.ENGINE_PANEL,panelRef:sv.REPRESENTATIVE_ACTIVITY}}]}},{ref:sl.AUDIT_LOGS,icon:W.SCROLL,requiredRoles:gv,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.AUDIT_LOGS,operation:J.LIST}},{ref:sl.OPERATOR_ACCESS,icon:W.SHIELD,requiredRoles:[...gv,Jl.ORG_DELEGATED_APPROVE_ACCESS_GRANTS],target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.PLATFORM_ACCESS_GRANTS,operation:J.LIST}},{ref:sl.ORGANIZATION_ENTITLEMENTS,icon:W.BADGE_CHECK,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_FEATURES,operation:J.READ}},{ref:sl.ORGANIZATION_REFERRALS,icon:W.GIFT,requiredRoles:[Jl.ORG_OWNER],runtimeAvailability:{requiredCapabilities:[vv]},target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.REFERRALS,operation:J.LIST}},{ref:sl.ORGANIZATION_LEGAL_HOLDS,icon:W.SCALE,requiredRoles:[Jl.ORG_OWNER],target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.LEGAL_HOLDS,operation:J.LIST}},{ref:sl.ORGANIZATION_PROFESSIONAL_QUALIFICATIONS,icon:W.BADGE_CHECK,requiredRoles:[Jl.ORG_ADMIN],runtimeAvailability:{requiredCapabilities:[yv]},target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.PROFESSIONAL_QUALIFICATIONS,operation:J.LIST}},{ref:sl.EMAIL_DOMAINS,icon:W.GLOBE,requiredRoles:gv,requiredEngineCapabilities:[jd.EMAIL_INBOUND],target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_EMAIL_DOMAINS,operation:J.LIST}},{ref:sl.CUSTOM_DOMAINS,icon:W.GLOBE,requiredRoles:gv,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_CUSTOM_DOMAINS,operation:J.LIST}},{ref:sl.RELATIONSHIP_MAILBOXES,icon:W.MAILBOX,requiredRoles:gv,requiredEngineCapabilities:[jd.EMAIL_INBOUND],runtimeAvailability:{requiredCapabilities:[cv.REPRESENTS]},target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.RELATIONSHIP_MAILBOXES,operation:J.LIST}},{ref:sl.CHAT_ACCOUNTS,icon:W.CHAT,requiredRoles:gv,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.CHAT_IDENTITY_LINKS,operation:J.LIST}},{ref:sl.MY_CHAT_ACCOUNTS,icon:W.CHAT,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.CHAT_IDENTITY_LINKS,operation:J.LIST,operationVariant:`own`}},{ref:sl.AGENT_RUNS,icon:W.BRAIN,requiredRoles:gv,requiredEngineCapabilities:[jd.AI_LLM],target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_FLOW_ACTOR_EXECUTIONS,operation:J.LIST}},{ref:sl.AUTONOMOUS_AGENTS,icon:W.CLOCK,requiredRoles:gv,requiredEngineCapabilities:[jd.AI_LLM],target:{kind:ov.ENGINE_PANEL,panelRef:sv.AUTONOMOUS_AGENTS}},{ref:sl.AGENT_ACTIVITY,icon:W.ACTIVITY,requiredRoles:gv,target:{kind:ov.ENGINE_PANEL,panelRef:sv.AGENT_ACTIVITY}},{ref:sl.CHAT_AGENTS,icon:W.CHAT,requiredRoles:gv,requiredEngineCapabilities:[jd.AI_LLM],target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_CHAT_SETTINGS,operation:J.LIST}},{ref:sl.AGENT_WORK_REVIEW,icon:W.BRAIN,requiredRoles:gv,requiredEngineCapabilities:[jd.AI_LLM],target:{kind:ov.SUB_TABS,subTabs:[{ref:`agent-work-override-rate`,label:`Override rate`,target:{kind:ov.ENGINE_PANEL,panelRef:sv.AGENT_WORK_OVERRIDE_RATE}},{ref:`agent-work-decisions`,label:`Decisions`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_AGENT_WORK_DECISIONS,operation:J.LIST}},{ref:`agent-behavior-reports`,label:`Reports`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.AGENT_BEHAVIOR_REPORTS,operation:J.LIST}},{ref:`agent-work-content-capture`,label:`Content capture`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.AGENT_WORK_CAPTURE_SETTINGS,operation:J.READ}},{ref:`agent-work-export-authorization`,label:`Export authorisation`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.EVALUATION_EXPORT_AUTHORIZATIONS,operation:J.READ}},{ref:`agent-work-run-export`,label:`Run an export`,target:{kind:ov.ENGINE_PANEL,panelRef:sv.AGENT_WORK_EVALUATION_EXPORT}},{ref:`agent-work-exports`,label:`Exports`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.EVALUATION_DATASET_EXPORTS,operation:J.LIST}}]}},{ref:sl.AGENT_POLICY,icon:W.BRAIN,requiredRoles:gv,requiredEngineCapabilities:[jd.AI_LLM],target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_AGENT_POLICIES,operation:J.READ}},{ref:sl.APPLICATION_GENERAL,icon:W.APP_WINDOW,requiredRoles:_v,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_METADATA,operation:J.READ}},{ref:sl.APPLICATION_VERSIONS,icon:W.HISTORY,requiredRoles:_v,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_VERSIONS,operation:J.LIST}},{ref:sl.APPLICATION_ENTITLEMENTS,icon:W.BADGE_CHECK,requiredRoles:_v,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_FEATURES,operation:J.READ}},{ref:sl.APPLICATION_API_KEYS,icon:W.KEY,requiredRoles:_v,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_API_KEYS,operation:J.LIST}},{ref:sl.APPLICATION_SSO,icon:W.LOGIN,requiredRoles:_v,target:{kind:ov.SUB_TABS,subTabs:[{ref:`application-sso-configuration`,label:`Configuration`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_SSO_CONFIG,operation:J.READ}},{ref:`application-sso-connections`,label:`Connections`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_SSO_CONNECTIONS,operation:J.LIST}}]}},{ref:sl.APPLICATION_SCIM,icon:W.USER_COG,requiredRoles:_v,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_SCIM_PROVISIONING_CONFIG,operation:J.READ}},{ref:sl.APPLICATION_SIEM,icon:W.ACTIVITY,requiredRoles:_v,target:{kind:ov.SUB_TABS,subTabs:[{ref:`application-siem-export`,label:`Export`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_SIEM_EXPORT_CONFIG,operation:J.READ}},{ref:`application-siem-failed-deliveries`,label:`Failed deliveries`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_SIEM_DELIVERY_DLQ,operation:J.LIST}}]}},{ref:sl.APPLICATION_WEBHOOKS,icon:W.WEBHOOK,requiredRoles:_v,target:{kind:ov.SUB_TABS,subTabs:[{ref:`application-webhooks-endpoints`,label:`Endpoints`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_WEBHOOK_CONFIG,operation:J.READ}},{ref:`application-webhooks-delivery-log`,label:`Delivery log`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_M2M_WEBHOOK_DELIVERY_LOG,operation:J.LIST}}]}},{ref:sl.BILLING_CATALOG,icon:W.PACKAGE,requiredRoles:_v,runtimeAvailability:{requiredCapabilities:[vv]},target:{kind:ov.SUB_TABS,subTabs:[{ref:`billing-catalog-products`,label:`Products`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.PRODUCTS,operation:J.LIST}},{ref:`billing-catalog-promotions`,label:`Promotions`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.PROMOTIONS,operation:J.LIST}}]}},{ref:sl.APPLICATION_PROVIDER_CONNECTIONS,icon:W.PLUG,requiredRoles:_v,target:{kind:ov.ENGINE_PANEL,panelRef:sv.APPLICATION_CONNECTED_ACCOUNTS}},{ref:sl.APPLICATION_OAUTH_CLIENTS,icon:W.LINK,requiredRoles:_v,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.OAUTH_CLIENTS_APPLICATION,operation:J.LIST}},{ref:sl.APPLICATION_ACCESS_GRANTS,icon:W.SHIELD,requiredRoles:_v,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_ACCESS_GRANTS,operation:J.LIST}},{ref:sl.APPLICATION_ORGANIZATIONS,icon:W.ORGANIZATION,requiredRoles:_v,target:{kind:ov.SUB_TABS,subTabs:[{ref:`application-organizations-directory`,label:`All organizations`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATIONS,operation:J.LIST,operationVariant:Kre.DIRECTORY}},{ref:`application-organizations-access-grants`,label:`Access windows`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_ACCESS_GRANTS,operation:J.LIST}}]}},{ref:sl.APPLICATION_DATA_SUBJECT_REQUESTS,icon:W.SHIELD,requiredRoles:[dl.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:Wo.DATA_SUBJECT_REQUESTS,operation:Dte.OPERATOR_QUEUE}},{ref:`application-data-subject-requests-access-grants`,label:`Access windows`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_ACCESS_GRANTS,operation:J.LIST}}]}},{ref:sl.APPLICATION_INBOUND_DELIVERIES,icon:W.INBOX,requiredRoles:[dl.APP_ADMIN_SUPER_ADMIN],target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_INBOUND_DELIVERIES,operation:J.LIST}},{ref:sl.APPLICATION_SMS_NUMBERS,icon:W.SMARTPHONE,requiredRoles:[dl.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[jd.SMS],target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.SMS_NUMBER_ASSIGNMENTS,operation:J.LIST}},{ref:sl.APPLICATION_AGENT_PUSH_DELIVERIES,icon:W.NOTIFICATION,requiredRoles:[dl.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[jd.AI_LLM],target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_A2A_PUSH_DELIVERY_LOG,operation:J.LIST}},{ref:sl.APPLICATION_AGENT_RUNS,icon:W.BRAIN,requiredRoles:[dl.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[jd.AI_LLM],target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_FLOW_ACTOR_EXECUTIONS,operation:J.LIST}},{ref:sl.APPLICATION_AGENT_ACTIVITY,icon:W.ACTIVITY,requiredRoles:[dl.APP_ADMIN_SUPER_ADMIN],target:{kind:ov.ENGINE_PANEL,panelRef:sv.APPLICATION_AGENT_ACTIVITY}},{ref:sl.APPLICATION_AGENT_WORK_REVIEW,icon:W.BRAIN,requiredRoles:[dl.APP_ADMIN_SUPER_ADMIN],requiredEngineCapabilities:[jd.AI_LLM],target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_AGENT_WORK_DECISIONS,operation:J.LIST}},{ref:sl.APPLICATION_AGENT_POLICY,icon:W.BRAIN,requiredRoles:_v,requiredEngineCapabilities:[jd.AI_LLM],target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_AGENT_POLICIES,operation:J.READ}},{ref:sl.APPLICATION_SYSTEM_OF_RECORD_PARTITIONS,icon:W.ORGANIZATION,requiredRoles:[dl.APP_ADMIN_SUPER_ADMIN],target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.SYSTEM_OF_RECORD_PARTITION_ASSIGNMENTS,operation:J.LIST}},{ref:sl.APPLICATION_MODEL_COSTS,icon:W.RECEIPT,requiredRoles:[dl.APP_ADMIN_SUPER_ADMIN,dl.APP_ADMIN_BILLING_MANAGER],requiredEngineCapabilities:[jd.AI_LLM],target:{kind:ov.SUB_TABS,subTabs:[{ref:`model-costs-by-month`,label:`By month`,target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.MODEL_COST_PERIOD_AGGREGATES,operation:J.LIST}},{ref:`model-costs-breakdown`,label:`Breakdown`,target:{kind:ov.ENGINE_PANEL,panelRef:sv.MODEL_COST_BREAKDOWN}}]}},{ref:sl.APPLICATION_RETENTION_ENFORCEMENT,icon:W.CLOCK,requiredRoles:[dl.APP_ADMIN_SUPER_ADMIN,dl.APP_AUDIT_EVIDENCE_READER],target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.RETENTION_ENFORCEMENT_RECORDS,operation:J.LIST}},{ref:sl.APPLICATION_AUDIT_LOGS,icon:W.SCROLL,requiredRoles:[dl.APP_ADMIN_SUPER_ADMIN,dl.APP_AUDIT_EVIDENCE_READER],target:{kind:ov.RESOURCE_OPERATION,resourceType:Wo.APPLICATION_AUDIT_LOGS,operation:J.LIST}}],xv=[{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}],ece={categories:[{ref:`account`,label:`Account`,scope:rn.USER_SELF,order:0},{ref:`organization`,label:`Organization`,scope:rn.ORGANIZATIONS,order:1,groups:xv},{ref:`administration`,label:`Administration`,scope:rn.APPLICATION,order:2,groups:xv}],placements:[{destinationRef:sl.PROFILE,categoryRef:`account`,label:`Profile`,order:0},{destinationRef:sl.SECURITY,categoryRef:`account`,label:`Security`,order:1},{destinationRef:sl.APPEARANCE,categoryRef:`account`,label:`Appearance`,order:2},{destinationRef:sl.PREFERENCES,categoryRef:`account`,label:`Preferences`,order:3},{destinationRef:sl.MY_INVITATIONS,categoryRef:`account`,label:`Invitations`,order:4},{destinationRef:sl.MY_PROVIDER_CREDENTIALS,categoryRef:`account`,label:`Integrations`,order:5},{destinationRef:sl.AUTHORIZED_APPS,categoryRef:`account`,label:`Authorized apps`,order:6},{destinationRef:sl.MY_AGENT_PUSH_DELIVERIES,categoryRef:`account`,label:`Agent push deliveries`,order:7},{destinationRef:sl.MY_DATA_SUBJECT_REQUESTS,categoryRef:`account`,label:`Data requests`,order:8},{destinationRef:sl.DEACTIVATE_ACCOUNT,categoryRef:`account`,label:`Deactivate account`,order:9},{destinationRef:sl.ORGANIZATION_GENERAL,categoryRef:`organization`,label:`General`,order:0},{destinationRef:sl.MEMBERS,categoryRef:`organization`,groupRef:`people`,label:`Members`,order:1},{destinationRef:sl.ORGANIZATION_UNITS,categoryRef:`organization`,groupRef:`people`,label:`Organization units`,order:2},{destinationRef:sl.ORGANIZATION_ENTITLEMENTS,categoryRef:`organization`,groupRef:`billing`,label:`Entitlements`,order:3},{destinationRef:sl.BILLING,categoryRef:`organization`,groupRef:`billing`,label:`Billing`,order:4},{destinationRef:sl.ORGANIZATION_REFERRALS,categoryRef:`organization`,groupRef:`billing`,label:`Referrals`,order:5},{destinationRef:sl.API_KEYS,categoryRef:`organization`,groupRef:`security`,label:`API keys`,order:6},{destinationRef:sl.ORGANIZATION_OAUTH_CLIENTS,categoryRef:`organization`,groupRef:`security`,label:`OAuth clients`,order:7},{destinationRef:sl.PROVIDER_CREDENTIALS,categoryRef:`organization`,groupRef:`integrations`,label:`Integrations`,order:8},{destinationRef:sl.SSO,categoryRef:`organization`,groupRef:`security`,label:`SSO — OIDC / SAML`,order:9},{destinationRef:sl.SCIM,categoryRef:`organization`,groupRef:`security`,label:`SCIM provisioning`,order:10},{destinationRef:sl.SIEM,categoryRef:`organization`,groupRef:`compliance`,label:`SIEM export`,order:11},{destinationRef:sl.WEBHOOKS,categoryRef:`organization`,groupRef:`integrations`,label:`Webhooks`,order:12},{destinationRef:sl.AGENT_PUSH_DELIVERIES,categoryRef:`organization`,groupRef:`integrations`,label:`Agent push deliveries`,order:13},{destinationRef:sl.AUDIT_LOGS,categoryRef:`organization`,groupRef:`compliance`,label:`Audit log`,order:14},{destinationRef:sl.OPERATOR_ACCESS,categoryRef:`organization`,groupRef:`security`,label:`Operator access`,order:15},{destinationRef:sl.INBOUND_DELIVERIES,categoryRef:`organization`,groupRef:`integrations`,label:`Inbound deliveries`,order:16},{destinationRef:sl.RELATIONSHIPS,categoryRef:`organization`,groupRef:`people`,label:`Relationships`,order:17},{destinationRef:sl.REPRESENTATIONS,categoryRef:`organization`,groupRef:`people`,label:`Representations`,order:18},{destinationRef:sl.ORGANIZATION_LEGAL_HOLDS,categoryRef:`organization`,groupRef:`compliance`,label:`Legal holds`,order:19},{destinationRef:sl.EMAIL_DOMAINS,categoryRef:`organization`,groupRef:`integrations`,label:`Email domains`,order:20},{destinationRef:sl.RELATIONSHIP_MAILBOXES,categoryRef:`organization`,groupRef:`integrations`,label:`Relationship mailboxes`,order:21},{destinationRef:sl.MY_CHAT_ACCOUNTS,categoryRef:`organization`,groupRef:`integrations`,label:`My chat accounts`,order:22},{destinationRef:sl.CHAT_ACCOUNTS,categoryRef:`organization`,groupRef:`integrations`,label:`Chat accounts`,order:23},{destinationRef:sl.AGENT_WORK_REVIEW,categoryRef:`organization`,groupRef:`ai`,label:`Agent work review`,order:24},{destinationRef:sl.AGENT_RUNS,categoryRef:`organization`,groupRef:`ai`,label:`Agent runs`,order:25},{destinationRef:sl.AUTONOMOUS_AGENTS,categoryRef:`organization`,groupRef:`ai`,label:`Autonomous agents`,order:26},{destinationRef:sl.AGENT_ACTIVITY,categoryRef:`organization`,groupRef:`ai`,label:`Agent activity`,order:31},{destinationRef:sl.CHAT_AGENTS,categoryRef:`organization`,groupRef:`ai`,label:`Chat agents`,order:27},{destinationRef:sl.AGENT_POLICY,categoryRef:`organization`,groupRef:`ai`,label:`Agent policy`,order:28},{destinationRef:sl.ORGANIZATION_PROFESSIONAL_QUALIFICATIONS,categoryRef:`organization`,groupRef:`people`,label:`Professional qualifications`,order:29},{destinationRef:sl.CUSTOM_DOMAINS,categoryRef:`organization`,groupRef:`integrations`,label:`Custom domains`,order:30},{destinationRef:sl.APPLICATION_GENERAL,categoryRef:`administration`,label:`General`,order:0},{destinationRef:sl.APPLICATION_ORGANIZATIONS,categoryRef:`administration`,label:`Organizations`,order:1},{destinationRef:sl.APPLICATION_SYSTEM_OF_RECORD_PARTITIONS,categoryRef:`administration`,label:`System-of-record partitions`,order:2},{destinationRef:sl.APPLICATION_ENTITLEMENTS,categoryRef:`administration`,groupRef:`billing`,label:`Entitlements`,order:3},{destinationRef:sl.BILLING_CATALOG,categoryRef:`administration`,groupRef:`billing`,label:`Plans & pricing`,order:4},{destinationRef:sl.APPLICATION_MODEL_COSTS,categoryRef:`administration`,groupRef:`billing`,label:`Model costs`,order:5},{destinationRef:sl.APPLICATION_API_KEYS,categoryRef:`administration`,groupRef:`security`,label:`API keys`,order:6},{destinationRef:sl.APPLICATION_OAUTH_CLIENTS,categoryRef:`administration`,groupRef:`security`,label:`OAuth clients`,order:7},{destinationRef:sl.APPLICATION_SSO,categoryRef:`administration`,groupRef:`security`,label:`SSO — OIDC / SAML`,order:8},{destinationRef:sl.APPLICATION_SCIM,categoryRef:`administration`,groupRef:`security`,label:`SCIM provisioning`,order:9},{destinationRef:sl.APPLICATION_SIEM,categoryRef:`administration`,groupRef:`compliance`,label:`SIEM export`,order:10},{destinationRef:sl.APPLICATION_PROVIDER_CONNECTIONS,categoryRef:`administration`,groupRef:`integrations`,label:`Integrations`,order:11},{destinationRef:sl.APPLICATION_WEBHOOKS,categoryRef:`administration`,groupRef:`integrations`,label:`Webhooks`,order:12},{destinationRef:sl.APPLICATION_AGENT_PUSH_DELIVERIES,categoryRef:`administration`,groupRef:`integrations`,label:`Agent push deliveries`,order:13},{destinationRef:sl.APPLICATION_AUDIT_LOGS,categoryRef:`administration`,groupRef:`compliance`,label:`Audit log`,order:14},{destinationRef:sl.APPLICATION_ACCESS_GRANTS,categoryRef:`administration`,groupRef:`security`,label:`Access grants`,order:15},{destinationRef:sl.APPLICATION_VERSIONS,categoryRef:`administration`,label:`Versions`,order:16},{destinationRef:sl.APPLICATION_INBOUND_DELIVERIES,categoryRef:`administration`,groupRef:`integrations`,label:`Inbound deliveries`,order:17},{destinationRef:sl.APPLICATION_RETENTION_ENFORCEMENT,categoryRef:`administration`,groupRef:`compliance`,label:`Retention enforcement`,order:18},{destinationRef:sl.APPLICATION_AGENT_WORK_REVIEW,categoryRef:`administration`,groupRef:`ai`,label:`Agent work review`,order:19},{destinationRef:sl.APPLICATION_AGENT_RUNS,categoryRef:`administration`,groupRef:`ai`,label:`Agent runs`,order:20},{destinationRef:sl.APPLICATION_AGENT_POLICY,categoryRef:`administration`,groupRef:`ai`,label:`Agent policy`,order:21},{destinationRef:sl.APPLICATION_AGENT_ACTIVITY,categoryRef:`administration`,groupRef:`ai`,label:`Agent activity`,order:24},{destinationRef:sl.APPLICATION_DATA_SUBJECT_REQUESTS,categoryRef:`administration`,groupRef:`compliance`,label:`Data subject requests`,order:22},{destinationRef:sl.APPLICATION_SMS_NUMBERS,categoryRef:`administration`,groupRef:`integrations`,label:`SMS numbers`,order:23}],defaultSectionRef:`profile`},Sv=new Map(bv.map(e=>[e.ref,e]));function Cv(e){let t=new Map(Sv),n=new Set,r=[],i=[];for(let a of e?.destinations??[])Sv.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 wv(e){if(e===void 0)return{categories:[],sections:[]};let t=Cv(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 Tv(e){if(e===void 0)return[];let t=Cv(e);return e.placements.map(e=>e.destinationRef).filter(e=>!t.byRef.has(e))}function Ev(){let{settingsHub:e}=Ng();return(0,Q.useMemo)(()=>wv(e),[e])}var Dv;(function(e){e.ERROR=`error`,e.WARNING=`warning`})(Dv||={});var Ov;(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`})(Ov||={});function tce(e){let t=new Map,n=new Set,r=new Map,i=new Map,a=new Map,o=(e,r)=>{e.scope===em.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 kv(e,t,n,r,i,a,o){let s=a===`application`?nce(e.viewRef,r,t,i,e):rce(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:Dv.ERROR,code:Ov.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 nce(e,t,n,r,i){return t.duplicateApplicationViewRefs.has(e)?(r.push({severity:Dv.ERROR,code:Ov.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:Dv.ERROR,code:Ov.VIEW_NOT_FOUND,context:n,message:`Application view "${e}" not found in any compatible special-view definition`,item:i}),null)}function rce(e,t,n,r){if(!t.resourceConfigurations[e.resourceType])return r.push({severity:Dv.ERROR,code:Ov.RESOURCE_NOT_FOUND,context:n,message:`Resource type "${e.resourceType}" not found in registry`,item:e}),null;if(zse({resourceType:e.resourceType,viewRef:e.viewRef,registry:t}).length>1)return r.push({severity:Dv.ERROR,code:Ov.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=Gh({resourceType:e.resourceType,viewRef:e.viewRef,registry:t});return i?i.scope===em.RESOURCE?{family:i.family}:(r.push({severity:Dv.ERROR,code:Ov.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:Dv.ERROR,code:Ov.VIEW_NOT_FOUND,context:n,message:`Resource view "${e.viewRef}" is not declared on resource "${e.resourceType}"`,item:e}),null)}function Av(e,t,n,r,i,a,o){switch(e.kind){case _s.RESOURCE_OPERATION:{let r=n.resourceConfigurations[e.resourceType];if(!r){i.push({severity:Dv.ERROR,code:Ov.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:Dv.ERROR,code:Ov.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:Dv.ERROR,code:Ov.OPERATION_NOT_FOUND,context:t,message:`Operation "${e.operation}" on resource "${e.resourceType}" is ambiguous without an explicit launcher operationVariant`,item:e})}break}case _s.VIEW:kv(e,t,n,r,i,`application`,o);break;case _s.RESOURCE_VIEW:kv(e,t,n,r,i,`resource`,o);break;case _s.ENGINE_PAGE:e.pageRef in Eo||i.push({severity:Dv.ERROR,code:Ov.ENGINE_PAGE_NOT_FOUND,context:t,message:`Engine page ref "${e.pageRef}" has no entry in ENGINE_PAGE_METADATA`,item:e});break;case _s.CUSTOM_COMPONENT:o&&!o(e.componentRef)&&i.push({severity:Dv.ERROR,code:Ov.HOSTED_COMPONENT_NOT_CONFIGURED,context:t,message:`Custom launcher component "${e.componentRef}" is not registered in ComponentRegistryService`,item:e});break;case _s.SETTINGS_SECTION:e.sectionRef!==void 0&&!a.has(e.sectionRef)&&i.push({severity:Dv.ERROR,code:Ov.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:Dv.ERROR,code:Ov.UNKNOWN_TARGET_KIND,context:t,message:`Unknown LauncherItemTargetKind: "${e.kind}"`,item:e})}}function jv(e,t,n,r){e.notificationBadgeRef&&!n.notificationBadgeDefinitions.some(t=>Fo(t)===e.notificationBadgeRef)&&r.push({severity:Dv.ERROR,code:Ov.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(Fo).join(`, `)||`(none)`}`,item:e})}function Mv(e,t,n,r,i,a,o){for(let s of e)Av(s,t,n,r,i,a,o),jv(s,t,n,i),s.children&&Mv(s.children,`${t}.children`,n,r,i,a,o)}function ice(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:Dv.WARNING,code:Ov.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:Dv.WARNING,code:Ov.VISIBLE_IN_MODES_ORPHAN,context:s,message:`visibleInModes ref "${t}" does not match any declared appMode`,item:e})}switch(e.contentKind){case xc.NAVIGATION_LIST:Mv(e.children,s,t,n,i,a,o);break;case xc.RESOURCE_BROWSER:{let n=e,r=t.resourceConfigurations[n.resourceType];if(!r){i.push({severity:Dv.ERROR,code:Ov.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:Dv.ERROR,code:Ov.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:Dv.ERROR,code:Ov.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})),U.frontendResourceLabelDefinitionOf(r)||i.push({severity:Dv.WARNING,code:Ov.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 xc.GUIDANCE_WIDGET:case xc.CUSTOM_COMPONENT:}}function Nv(e,t,n,r){let i=[],a=t.appComponentsConfiguration,o=tce(t),s=new Set(wv(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=Dm(u);for(let e of d)i.push({severity:Dv.ERROR,code:Ov.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:Dv.ERROR,code:Ov.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[Ol.SIDEBAR];if(typeof f==`object`&&f&&`contentSections`in f){let t=f.contentSections;if(t)for(let r of t)ice(r,e,o,c,i,s,n)}let p=a[Ol.COMMAND_MENU];if(typeof p==`object`&&p&&`commands`in p){let t=p.commands;if(t)for(let r of t)Av(r,`command_menu.commands`,e,o,i,s,n)}let m=a[Ol.HOTKEY];if(typeof m==`object`&&m&&`bindings`in m){let t=m.bindings;if(t)for(let r of t)Av(r,`hotkey.bindings`,e,o,i,s,n)}let h=a[Ol.QUICK_ACTION_BUTTON];if(typeof h==`object`&&h&&`actions`in h){let t=h.actions;if(t)for(let r of t)Av(r,`quick_action_button.actions`,e,o,i,s,n)}let g=a[Ol.CONTROL_PANEL];if(typeof g==`object`&&g&&`items`in g){let t=g.items;if(t)for(let r of t)Av(r,`control_panel.items`,e,o,i,s,n)}let _=a[Ol.TOOLBAR];if(typeof _==`object`&&_&&`tools`in _){let t=_.tools;if(t)for(let r of t)Av(r,`toolbar.tools`,e,o,i,s,n)}let v=a[Ol.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:Dv.ERROR,code:Ov.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)Av(r,`menubar.items`,e,o,i,s,n),jv(r,`menubar.items`,e,i)}}let y=a[Ol.ACTIVITY_BAR];return typeof y==`object`&&y?l.length===0&&i.push({severity:Dv.WARNING,code:Ov.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:Dv.WARNING,code:Ov.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}),ace(a,r?.organizationRoles,i),{errors:i,isValid:i.length===0}}function ace(e,t,n){if(!t?.length)return;let r=new Set([...Object.values(dl),...Object.values(Jl),...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:Dv.WARNING,code:Ov.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(Ol.SIDEBAR,`contentSections`).forEach((e,t)=>i(e,`sidebar.contentSections[${t}]`)),a(Ol.COMMAND_MENU,`commands`).forEach((e,t)=>i(e,`command_menu.commands[${t}]`)),a(Ol.HOTKEY,`bindings`).forEach((e,t)=>i(e,`hotkey.bindings[${t}]`)),a(Ol.QUICK_ACTION_BUTTON,`actions`).forEach((e,t)=>i(e,`quick_action_button.actions[${t}]`)),a(Ol.CONTROL_PANEL,`items`).forEach((e,t)=>i(e,`control_panel.items[${t}]`)),a(Ol.TOOLBAR,`tools`).forEach((e,t)=>i(e,`toolbar.tools[${t}]`)),a(Ol.MENUBAR,`items`).forEach((e,t)=>i(e,`menubar.items[${t}]`))}function Pv(e){if(e.isValid){console.log(`[LauncherVerification] ✓ All launcher content declarations are valid`);return}let t=e.errors.filter(e=>e.severity===Dv.ERROR).length,n=e.errors.filter(e=>e.severity===Dv.WARNING).length;console.group(`[LauncherVerification] ${t} error(s), ${n} warning(s)`);for(let t of e.errors){let e=t.severity===Dv.ERROR?`✗ ERROR`:`⚠ WARN`;console.warn(`${e} [${t.code}] ${t.context}: ${t.message}`)}console.groupEnd()}var Fv;(function(e){e.ANSWERER=`decisionInboxAnswerer`})(Fv||={});function Iv(e){let t=e.offer?.answeringRoles??[];if(t.length===0)return!1;let n=e.effectiveRoles,r=n.accessProfile;if(!r)return Im(t,n);let i=new Set;for(let e of r.roleEntries)if(e.relatedPrimaryScope===rn.ORGANIZATIONS&&e.relatedResourceId)for(let t of e.roles)i.add(t);return Im(t,{...n,organizationRoles:[...i]})}function Lv(e){return{[Fv.ANSWERER]:Iv(e)}}var Rv;(function(e){e.ERROR=`error`,e.WARNING=`warning`})(Rv||={});var zv;(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`})(zv||={});var oce={refsShadowingEngineDestinations:[],duplicateApplicationDestinationRefs:[]};function Bv(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 Vv(e,t=[],n=oce){let r=[];e.sections.length===0&&r.push({severity:Rv.ERROR,code:zv.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:Rv.ERROR,code:zv.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:Rv.ERROR,code:zv.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:Rv.ERROR,code:zv.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 Bv(e.categories.map(e=>e.ref)))r.push({severity:Rv.ERROR,code:zv.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 Bv(e.sections.map(e=>e.ref)))r.push({severity:Rv.ERROR,code:zv.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:Rv.ERROR,code:zv.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 Bv((t.groups??[]).map(e=>e.ref)))r.push({severity:Rv.ERROR,code:zv.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:Rv.ERROR,code:zv.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 Bv(t.target.subTabs.map(e=>e.ref)))r.push({severity:Rv.ERROR,code:zv.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:Rv.WARNING,code:zv.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 Hv(e){if(e.isValid){console.log(`[SettingsHubVerification] ✓ Settings Hub configuration is valid`);return}let t=e.errors.filter(e=>e.severity===Rv.ERROR).length,n=e.errors.filter(e=>e.severity===Rv.WARNING).length;console.group(`[SettingsHubVerification] ${t} error(s), ${n} warning(s)`);for(let t of e.errors){let e=t.severity===Rv.ERROR?`✗ ERROR`:`⚠ WARN`;console.warn(`${e} [${t.code}] ${t.context}: ${t.message}`)}console.groupEnd()}function sce(e){return typeof e==`object`&&!!e&&typeof e.reportCrash==`function`}function cce(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 lce(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.signInSucceeded==`function`&&typeof t.signInFailed==`function`}function Uv(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(kn.getResourceId(e.contextResourceIdentifiers[t]).length>0)return!0;let n=e.contextualParameters[t];return n!==void 0&&String(n).length>0})})})}function Wv(e,t,n){let r=ku(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 Gv(e){let t=e.registry.resourceConfigurations[e.resourceType]?.operations??[],n=t=>{let n=U.buildContextualParameters(t,e.registry);return e=>Uv({operation:e,contextResourceIdentifiers:t,contextualParameters:n})},r=n(e.scopes.contextResourceIdentifiers),i=e.scopes.previousContextResourceIdentifiers?n(e.scopes.previousContextResourceIdentifiers):void 0;return io(t,J.LIST).filter(e=>r(e)||(i?.(e)??!1))}function uce(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 dce(e){let t=e._version;return typeof t==`number`||typeof t==`string`&&/^\d+$/.test(t)}function Kv(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function qv(e){let{resourceType:t,registry:n}=e,r=ku(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=M_({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:Kv(e.row)??Kv(e.previousRow),previousRow:Kv(e.row)?Kv(e.previousRow):void 0,normalizeId:uce,isStoredRow:dce,typeOfFieldIdentifier:e=>n.fieldIdentifierToResourceType?.[e]}),s=Wv(t,o.contextResourceIdentifiers,n);return o.previousContextResourceIdentifiers?{contextResourceIdentifiers:s,previousContextResourceIdentifiers:Wv(t,o.previousContextResourceIdentifiers,n)}:{contextResourceIdentifiers:s}}function fce(e){let{emit:t,resourceConfig:n,registry:r,resourceType:i,operation:a,resourceContext:o,isWebSocketConnected:s,result:c}=e,l=Pc(o.additionalContext),u=gi(a),d=ku(o.contextResourceIdentifiers),f=Me({contextResourceIdentifiers:o.contextResourceIdentifiers,resourceType:i,result:c,isBulkOperation:a.isBulkOperation===!0});if(!zi(a,s)&&yu(a)){let e=n?.operations?[...n.operations]:[],{[i]:s,...p}=d,m=r?qv({resourceType:i,registry:r,callContext:o.contextResourceIdentifiers,...a.isBulkOperation===!0?{}:{row:c}}).contextResourceIdentifiers:p,h=r?U.buildContextualParameters(m,r):{},g=io(e,J.LIST).filter(e=>Uv({operation:e,contextResourceIdentifiers:r?m:o.contextResourceIdentifiers,contextualParameters:h})),_=g.length>0?g:[null];for(let e of _){let n=e??{operationIdentifier:J.LIST};t(hc.RESOURCE_REFRESH,{resourceType:i,operationIdentifier:String(n.operationIdentifier??J.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=io(e,J.READ,{requireAddressable:!0}).filter(e=>n&&r?Bh({resourceConfig:n,operation:e,registry:r,hasResourceId:f[i]!==void 0,contextResourceIdentifiers:f,contextualParameters:r?U.buildContextualParameters(f,r):h}):!0),s=a.length>0?a:[null],c=new Set;for(let e of s){let n=e??{operationIdentifier:J.READ},r=[U.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??J.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:Wu(c),...l?{optionalDiscriminator:l}:{}})}var $=cg(),Jv;(function(e){e.PARENT_RESOURCE_REQUIREMENT=`parent-resource-requirement`,e.ADDITIONAL_RESOURCE_REQUIREMENT=`additional-resource-requirement`})(Jv||={});var Yv;(function(e){e.INITIAL=`initial`,e.REFRESH=`refresh`})(Yv||={});function Xv(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!==Yv.INITIAL&&e.intent!==Yv.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 Zv;(function(e){e.EMBEDDED_CONTENT=`embedded-content`,e.LOCAL_PANE=`local-pane`,e.CUSTOM=`custom`})(Zv||={});function Qv(e){if(e.scope===Zv.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 $v(e){if(typeof e==`object`&&e&&e.contentType===Sa.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 ey(e){if(!e||e.contentType!==Sa.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 ty;(function(e){e.EMBEDDED_CONTENT=`embedded-content`,e.LOCAL_PANE=`local-pane`,e.CUSTOM=`custom`,e.PARTICIPATION_PREFETCH=`participation-prefetch`})(ty||={});function ny(e){if(e.scope===ty.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===ty.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 ry=(0,Q.createContext)(void 0);function iy(e){if(!e)throw Error(`Execution runtime context must be used within an ExecutionRuntimeProvider.`);return e}var ay=({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)(ry.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 sy(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===ty.LOCAL_PANE&&a.paneId!==t?n=!0:r[i]=a;return n?r:e}function cy(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.wildoError==`object`&&t.wildoError!==null}function ly(e){let t=e.markedByHttpClient??cy(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===ty.LOCAL_PANE?{...r,scope:e.scope,paneId:e.paneId}:e.scope===ty.EMBEDDED_CONTENT?{...r,scope:e.scope}:e.scope===ty.PARTICIPATION_PREFETCH?{...r,scope:e.scope,prefetchKey:e.prefetchKey}:{...r,scope:ty.CUSTOM},ny(i),i}function uy(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===ty.PARTICIPATION_PREFETCH&&a.prefetchKey===t?n=!0:r[i]=a;return n?r:e}var dy;(function(e){e.SINGLE=`single`,e.ARRAY=`array`})(dy||={});function pce(e){return e.foreignKeyField??e.resourceType}function fy(e){let t=(e.requirements??[]).filter(t=>pce(t)===e.bindingKey);return t.length===1?t[0]:void 0}function mce(e,t){let n=t.resourceConfigurations[e]?.resourceRelationships;if(!n)return[];let r=(e,t)=>wo.ensureCompiledRelationship.call(wo,e,t);return[...n.parentRelationships,...n.childRelationships,...n.selfRelationships].map(e=>r(e,t.allResourceFieldIdentifiers))}function py(e){let t=fy({bindingKey:e.bindingKey,requirements:e.requirements});if(t)return{ref:e.ref,source:e.source,requirement:t,contextValue:e.contextResourceIdentifiers?.[e.bindingKey]}}function hce(e){let t=hy(e.sourceParticipation);if(t===e.definition.targetResourceType)return;let n=mce(t,e.registry).filter(n=>{if(n.resourceType1!==e.definition.targetResourceType&&n.resourceType2!==e.definition.targetResourceType||e.definition.foreignKeyField&&wo.tryResolveRelationshipForeignKeyIdentity(n,e.registry.allResourceFieldIdentifiers)?.fieldIdentifier!==e.definition.foreignKeyField)return!1;let r=n.resourceType1===t?e.sourceResourceData:void 0;return wo.isRelationshipActiveForParent(n,r,{onMissingParentResource:`exclude`,onConditionError:`exclude`})});if(n.length===1)return{ref:e.ref,source:jm.RELATIONSHIP_PROJECTION,fromParticipationRef:e.definition.fromParticipationRef,relationship:n[0],currentResourceType:t}}function gce(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 jm.ANCHOR:if(e.anchor){let t=e.explicitContextResourceIdentifiers?.[e.anchor.bindingKey];if(t){let n=e.viewDefinition.anchor?.source===km.PARENT_RESOURCE_REQUIREMENT?e.viewDefinition.parentResourcesRequirements:e.viewDefinition.additionalResourceRequirements;c={ref:a,source:jm.ANCHOR,resourceType:e.anchor.mainResourceType,bindingKey:e.anchor.bindingKey,requirement:fy({bindingKey:e.anchor.bindingKey,requirements:n}),contextValue:t}}}break;case jm.PARENT_RESOURCE_REQUIREMENT:c=py({ref:a,source:jm.PARENT_RESOURCE_REQUIREMENT,bindingKey:s.bindingKey,requirements:e.viewDefinition.parentResourcesRequirements,contextResourceIdentifiers:e.contextResourceIdentifiers});break;case jm.ADDITIONAL_RESOURCE_REQUIREMENT:c=py({ref:a,source:jm.ADDITIONAL_RESOURCE_REQUIREMENT,bindingKey:s.bindingKey,requirements:e.viewDefinition.additionalResourceRequirements,contextResourceIdentifiers:e.contextResourceIdentifiers});break;case jm.RELATIONSHIP_PROJECTION:{let t=i(s.fromParticipationRef);t&&(c=hce({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 my(e){if(e.source===jm.ANCHOR||e.source===jm.PARENT_RESOURCE_REQUIREMENT||e.source===jm.ADDITIONAL_RESOURCE_REQUIREMENT)return e.contextValue}function hy(e){if(e.source===jm.ANCHOR)return e.resourceType;if(e.source===jm.PARENT_RESOURCE_REQUIREMENT||e.source===jm.ADDITIONAL_RESOURCE_REQUIREMENT)return e.requirement.resourceType;if(e.source===jm.RELATIONSHIP_PROJECTION){let t=e.relationship;return t.resourceType1===e.currentResourceType?t.resourceType2:t.resourceType1}throw Error(`Unknown execution participation source`)}function _ce(e){let t=my(e),n=kn.getResourceId(t);return n.length>0?n:void 0}function gy(e){if(e.source===jm.PARENT_RESOURCE_REQUIREMENT||e.source===jm.ADDITIONAL_RESOURCE_REQUIREMENT)return e.requirement}function _y(e){return e.source===jm.RELATIONSHIP_PROJECTION?e.relationship:void 0}function vce(e){let t=_y(e);return t?wo.getResolvedRelationshipSemantics(t):void 0}function yce(e,t){let n=_y(e);return n?wo.tryResolveRelationshipForeignKeyIdentity(n,t):void 0}function bce(e,t){if(e.source===jm.PARENT_RESOURCE_REQUIREMENT||e.source===jm.ADDITIONAL_RESOURCE_REQUIREMENT)return e.requirement.relationshipEdgeKey;if(e.source!==jm.RELATIONSHIP_PROJECTION)return;let n=yce(e,t.allResourceFieldIdentifiers);return U.buildRelationshipEdgeKey({parentResourceType:e.relationship.resourceType1,childResourceType:e.relationship.resourceType2,foreignKeyField:n?.fieldIdentifier??e.relationship.foreignKeyField})}function xce(e){if(e.source!==jm.RELATIONSHIP_PROJECTION)return dy.SINGLE;let t=e.relationship.resourceType1===e.currentResourceType?e.relationship.cardinality2:e.relationship.cardinality1;return Xa(t)?dy.SINGLE:dy.ARRAY}function vy(e){let t=my(e.participation);if(!t)return;let n=kn.getResourceId(t);if(!n)return;let r=hy(e.participation),i=U.getResourceFieldIdentifierForType(r,e.registry),a=kn.getFieldIdentifier(t),o=e.participation.source===jm.ANCHOR?e.participation.requirement?.foreignKeyField:gy(e.participation)?.foreignKeyField,s=a??o;return s&&s!==i?{fieldIdentifier:s,resourceId:n}:n}function Sce(e){let t={};for(let n of e.participationRefs){let r=e.participations[n];if(!r)throw U.buildConfigurationError(Lu.CONFIGURATION,{component:`buildExecutionParticipationContextualParameters`,message:`Unknown execution participation ref "${n}".`,participationRef:n});let i=vy({participation:r,registry:e.registry});if(!i)continue;let a=kn.getResourceId(i);if(!a)continue;let o=kn.getFieldIdentifier(i)??U.getResourceFieldIdentifierForType(hy(r),e.registry),s=t[o];if(s!==void 0&&s!==a)throw U.buildConfigurationError(Lu.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 Cce(e){return{participation:e.participation,resourceType:hy(e.participation),resourceId:_ce(e.participation),valueShape:xce(e.participation),contextValue:my(e.participation),contextIdentifier:vy({participation:e.participation,registry:e.registry}),requirement:gy(e.participation),relationship:vce(e.participation),rawRelationship:_y(e.participation),edgeKey:bce(e.participation,e.registry)}}function yy(e,t){return U.buildConfigurationError(Lu.CONFIGURATION,{message:e,component:`useExecutionResourceOperationContextBuilder`,...t})}function wce(e){return`operationIdentifier`in e}function Tce(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 yy(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 Ece(e,t,n,r,i,a){if(!e)throw yy(`Execution resource-operation builder cannot resolve resource "${t}" from the registry.`,{resourceType:t});if(wce(n)){let o=Tce(e,t,n),s=vl(o);if((s===J.READ||s===J.UPDATE||s===J.DELETE)&&o.isBulkOperation!==!0&&!Bh({resourceConfig:e,operation:o,registry:r,hasResourceId:kn.getResourceId(i[t])!==``,contextResourceIdentifiers:i,contextualParameters:a}))throw yy(`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===J.READ||n.operationLike===J.UPDATE||n.operationLike===J.DELETE,s=n.requireAddressable||o?fh({resourceConfig:e,operations:e.operations??[],coreOperation:n.operationLike,registry:r,hasResourceId:kn.getResourceId(i[t])!==``,allowBulk:n.allowBulk,requireFrontendAddressable:n.requireAddressable===!0,contextResourceIdentifiers:i,contextualParameters:a}):Gl(e.operations??[],n.operationLike,{requireAddressable:n.requireAddressable,allowBulk:n.allowBulk});if(!s)throw yy(`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 Dce(e){let t=e.currentValue?kn.getFieldIdentifier(e.currentValue):void 0;return t?{fieldIdentifier:t,resourceId:e.resourceId}:e.resourceId}function Oce(e){let t=e?.currentObject??e?.resource;return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}function kce(e){let t=Oce(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 by(){let{registry:e}=fm(),t=iy((0,Q.useContext)(ry));return{buildResourceOperationContext:(0,Q.useCallback)(n=>{let r=n.participationRef?t.participations[n.participationRef]:void 0;if(n.participationRef&&!r)throw yy(`Execution resource-operation builder cannot resolve participation "${n.participationRef}".`,{participationRef:n.participationRef});let i=n.resourceType??(r?hy(r):void 0);if(!i)throw yy("Execution resource-operation builder requires either `resourceType` or `participationRef`.",{target:n});let a={...t.contextResourceIdentifiers??{},...n.contextResourceIdentifiers??{}};if(r){let t=vy({participation:r,registry:e});if(!t&&!n.resourceId)throw yy(`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=kce({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:kn.getResourceId(r[i])},targetResourceType:i,targetId:c,registry:e}).identifiers,...n.contextResourceIdentifiers??{}}}c&&(a[i]=Dce({currentValue:a[i],resourceId:c}));let l=U.buildContextualParameters(a,e),u=Ece(o,i,n,e,a,l),d=kn.buildParentResourcesRequirements(i,a,e,n.relationshipFieldOverrides);return kn.createFrontendResourceOperationContextFromOperation({resourceType:i,operation:u,contextResourceIdentifiers:a,additionalContext:n.additionalContext,parentResourcesRequirements:d})},[t.contextResourceIdentifiers,t.participations,e])}}function Ace(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-action-${crypto.randomUUID()}`:`execution-action-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function xy(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-failure-${crypto.randomUUID()}`:`execution-failure-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function jce(){let e=iy((0,Q.useContext)(ry)),{registry:t}=fm(),{buildResourceOperationContext:n}=by(),{emit:r}=Uo(),i=(0,Q.useContext)(um)?.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,Cce({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?{}:Sce({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=vy({participation:i,registry:t});if(!a)return n;let o=hy(i),s=n[o];if(s){let t=kn.getResourceId(s),n=kn.getResourceId(a),i=kn.getFieldIdentifier(s),c=kn.getFieldIdentifier(a);if(t!==n||i!==c)throw U.buildConfigurationError(Lu.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=U.buildContextualParameters(l.contextResourceIdentifiers,t),g=wp({viewDefinition:e.viewDefinition,resourceType:u,operation:d}),_={...Hm.createOperationInitiator(e.navigationZone,d),...r.navigationInitiator??{}},v={contentType:Sa.RESOURCE_OPERATION,resourceContext:l},y=()=>(e.navigation.openEmbeddedContent({content:v,navigationInitiator:_}),!0),b=()=>{if(g===am.EMBED_LOCALLY)return y();let n=p?Tl.buildOperationFrontendRoutePaths(p,d,t.allResourceFieldIdentifiers):[],i=p&&n.length>0?kn.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=no.createOperationPathKeyFromOperation(d),S=async n=>{let i=sc({operation:d,requestData:n,additionalContext:l.additionalContext}),s={actionRuntimeId:Ace(),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 fce({emit:a.current,resourceConfig:p,registry:t,resourceType:u,operation:d,resourceContext:l,isWebSocketConnected:o.current,result:n}),n}catch(t){let n=cy(t),i=!n;i&&ct.handleError(t,{source:`promise`,resourceType:u,operationIdentifier:f,additionalContext:{executionRuntimeInstanceId:e.runtimeInstanceId,executionViewRef:e.viewDefinition.ref,operationPathKey:x}});let a={failureRuntimeId:xy(),originatingActionRuntimeId:s.actionRuntimeId,operationPathKey:x,resourceType:u,operationId:f,startedAt:s.startedAt,error:t,markedByHttpClient:n,bridgedByExecutionShell:i},o;o=r.failureScope?.scope===ty.LOCAL_PANE?{...a,scope:r.failureScope.scope,paneId:r.failureScope.paneId}:r.failureScope?.scope===ty.EMBEDDED_CONTENT?{...a,scope:r.failureScope.scope}:{...a,scope:ty.CUSTOM};let c=ly(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:J.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=cy(e.error),n=(e.bridgeToCanonicalBus??!0)&&!t;n&&ct.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:xy(),operationPathKey:e.operationPathKey,resourceType:e.resourceType,operationId:e.operationId,error:e.error,label:e.label,markedByHttpClient:t,bridgedByExecutionShell:n},i;return i=e.scope===ty.LOCAL_PANE?ly({...r,scope:e.scope,paneId:e.paneId}):e.scope===ty.EMBEDDED_CONTENT?ly({...r,scope:e.scope}):e.scope===ty.PARTICIPATION_PREFETCH?ly({...r,scope:e.scope,prefetchKey:e.prefetchKey}):ly({...r,scope:ty.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 Sy=(0,Q.createContext)(null);function Cy({scope:e,children:t}){let n=(0,Q.useMemo)(()=>e.scope===Zv.LOCAL_PANE?{scope:Zv.LOCAL_PANE,paneId:e.paneId}:e.scope===Zv.EMBEDDED_CONTENT?{scope:Zv.EMBEDDED_CONTENT}:{scope:Zv.CUSTOM},[e.scope,e.paneId]);return(0,$.jsx)(Sy.Provider,{value:n,children:t})}function Mce(){return(0,Q.useContext)(Sy)}function wy(e){let t=(0,Q.useContext)(ry),n=(0,Q.useContext)(Sy),{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:Zv.CUSTOM};if(!i){c.clearDirty(r);return}let t;return t=e.scope===Zv.LOCAL_PANE?{markerId:r,scope:Zv.LOCAL_PANE,paneId:e.paneId,label:a,markedAt:Date.now()}:e.scope===Zv.EMBEDDED_CONTENT?{markerId:r,scope:Zv.EMBEDDED_CONTENT,label:a,markedAt:Date.now()}:{markerId:r,scope:Zv.CUSTOM,label:a,markedAt:Date.now()},c.markDirty(t),()=>{c.clearDirty(r)}},[c,r,i,s?.scope,s?.paneId])}function Nce(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-prefetch-${crypto.randomUUID()}`:`execution-prefetch-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Pce(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-failure-${crypto.randomUUID()}`:`execution-failure-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Fce(e){return!e||typeof e!=`object`?!1:e.name===`AbortError`}function Ty(e){let t=iy((0,Q.useContext)(ry)),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=Nce(),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||Fce(t))return;if(l(t),e.bridgeFailuresToShellAggregator===!0){let n=ly({failureRuntimeId:Pce(),error:t,resourceType:e.resourceType,startedAt:c.startedAt,...e.label===void 0?{}:{label:e.label},scope:ty.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 Ice(e,t){return`participation-prefetch:${e}:${t}`}function Lce(e){let t=iy((0,Q.useContext)(ry)),{registry:n}=fm(),{buildResourceOperationContext:r}=by(),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=hy(i),{operationPathKey:o,contextualParameters:s,parentResourcesRequirements:c,label:l}=(0,Q.useMemo)(()=>{let t=r({participationRef:e.participationRef,operationLike:J.READ,requireAddressable:!0}),i=U.buildContextualParameters(t.contextResourceIdentifiers,n);return{operationPathKey:no.createOperationPathKeyFromOperation(t.operation),contextualParameters:i,parentResourcesRequirements:t.parentResourcesRequirements,label:e.label}},[r,e.label,e.participationRef,n]),u=e.prefetchKey??Ice(a,e.participationRef),d=e.bridgeFailuresToShellAggregator??e.intent===Yv.INITIAL,f=t.doOperation,p=(0,Q.useCallback)(async({signal:e})=>f(o,{contextualParameters:s,parentResourcesRequirements:c,dataMode:Co.RAW},{signal:e}),[s,f,o,c]);return Ty({prefetchKey:u,participationRefs:[e.participationRef],resourceType:a,intent:e.intent,run:p,...l===void 0?{}:{label:l},bridgeFailuresToShellAggregator:d})}function Ey(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 Dy(e,t){let n=!1,r={};for(let[i,a]of Object.entries(e))a.scope===Zv.LOCAL_PANE&&a.paneId!==t?n=!0:r[i]=a;return n?r:e}function Rce(e){let t={markerId:e.markerId,markedAt:e.markedAt??Date.now(),label:e.label},n;return n=e.scope===Zv.LOCAL_PANE?{...t,scope:e.scope,paneId:e.paneId}:{...t,scope:e.scope},Qv(n),n}function Oy(e){return{navigationLayout:()=>e.navigationLayout,designSystemConfiguration:()=>e.designSystemConfiguration,appComponentsConfiguration:()=>av(e.baseAppComponentsConfiguration,e.moduleRegistry),appScope:()=>rv(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 ky(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 Ay;(function(e){e.DESKTOP=`desktop`,e.MOBILE=`mobile`,e.TABLET=`tablet`,e.API=`api`})(Ay||={});var jy;(function(e){e.STRICT=`strict`,e.LAX=`lax`,e.NONE=`none`})(jy||={});var zce=Vd({userAgent:md().min(1,`User agent is required`),ipAddress:Dae(),deviceType:zd(Ay).default(Ay.DESKTOP),location:md().optional(),fingerprint:md().optional()});function My(e,t){let n=URL.createObjectURL(e);try{Ny(n,t)}finally{URL.revokeObjectURL(n)}}function Ny(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,document.body.appendChild(n);try{n.click()}finally{n.remove()}}function Py({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_ERROR_DISPLAY,`ErrorDisplay`)(e);return(0,$.jsx)(n,{...t})}var Fy=({error:e,errorInfo:t,resetError:n,navigateHome:r})=>{let i=ui.isDevelopment(),{tComponent:a,makeTrComponent:o,isReady:s}=q({component:K.APP_LAYOUTS_ERROR_BOUNDARY}),c=o(K.APP_LAYOUTS_ERROR_BOUNDARY);if(!s)return null;let l=[{label:c(`tryAgain`),onClick:n,variant:`destructive`,iconRef:W.TRY_AGAIN},{label:c(`goHome`),onClick:()=>{n(),r?.()},variant:`secondary`,iconRef:W.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)(Py,{variant:`error`,iconRef:W.ERROR_APPLICATION,title:c(`title`),message:c(`message`),actions:l,showDevInfo:i,devInfoTitle:c(`devInfoTitle`),devInfoSubtitle:c(`devInfoSubtitle`),devInfoSections:u})};function Iy({preset:e=H.DEFAULT,...t}){let n=qc(K.APP_LAYOUTS_ERROR_BOUNDARY,`AppLayout_ErrorBoundary`)(e);return(0,$.jsx)(n,{...t})}var Ly=tl.getLogger();Ly.debugByType(`ErrorBoundary`),Ly.setDebugTypeLogging(`ErrorBoundary`,!1);function Bce(e){let t=ah(),{emit:n}=Uo();return(0,$.jsx)(Iy,{...e,navigateHome:()=>kh({emit:n,routerNavigate:t})})}var Ry=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}),Ly.error(`ErrorBoundary caught an error:`,{error:e,errorInfo:t});let n=Ou.buildReactError(e,t);try{Di.emit(hc.ERROR_OCCURED,{error:n})}catch(e){Ly.warn(`Failed to emit error event:`,{dispatchError:e})}if(this.props.onError)try{this.props.onError(e,t)}catch(e){Ly.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)(Bce,{error:this.state.error,errorInfo:this.state.errorInfo,resetError:this.resetError})}return this.props.children}};function Vce(e,t){let n=n=>(0,$.jsx)(Ry,{...t,children:(0,$.jsx)(e,{...n})});return n.displayName=`withErrorBoundary(${e.displayName||e.name})`,n}function Hce(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 Uce(e){switch(e){case 404:return W.ERROR_NOT_FOUND;case 403:return W.ERROR_ACCESS_DENIED;case 500:case 502:case 503:case 504:return W.ERROR_SERVER;default:return W.ERROR}}var zy=({errorType:e,routeError:t,jsError:n,unknownError:r,navigate:i,navigateAction:a,navigateBack:o,navigateHome:s,errorPageConfig:c,userGuidance:l})=>{let u=ui.isDevelopment(),{tComponent:d,makeTrComponent:f,isReady:p}=q({component:K.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY}),m=f(K.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY),h=e=>Wp({tComponent:d,componentType:K.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY,key:e}),g=s??(()=>i(`/`));return p?e===`route`&&t?Kce(t,i,a,o??g,g,m,h,u,c,l):e===`javascript`&&n?qce(n,g,m,u):Jce(r,g,m,u):null};function Wce(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 Gce(e){return{type:mm.NAVIGATE,target:e.target,resourceOperationPath:e.resourceOperationPath,compositeViewReference:e.compositeViewReference}}function Kce(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=Wce(c,t,n,i,a,[{label:a(`goBack`),onClick:r,variant:`primary`,iconRef:W.BACK},{label:a(`goHome`),onClick:i,variant:`secondary`,iconRef:W.HOME}]),h;c?.featureGuide&&c.featureGuide.length>0&&(h=c.featureGuide.map(e=>({label:o(`errorPage_feature_${e.ref}`)??e.ref,onClick:()=>{let r=Gce(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)(Py,{variant:`default`,iconRef:Uce(u),statusCode:u,title:d,message:f,suggestion:p,actions:m,featureGuide:h,supportAccess:g,leadMagnet:_,userGuidance:l})}function qce(e,t,n,r){let i=[{label:n(`reload`),onClick:()=>window.location.reload(),variant:`destructive`,iconRef:W.RELOAD},{label:n(`goHome`),onClick:t,variant:`secondary`,iconRef:W.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)(Py,{variant:`error`,iconRef:W.ERROR_APPLICATION,title:n(`titleApplication`),message:n(`messageApplication`),actions:i,showDevInfo:r,devInfoTitle:n(`devInfoTitle`),devInfoSubtitle:n(`devInfoSubtitle`),devInfoSections:a})}function Jce(e,t,n,r){let i=[{label:n(`reload`),onClick:()=>window.location.reload(),variant:`primary`,iconRef:W.RELOAD},{label:n(`goHome`),onClick:t,variant:`secondary`,iconRef:W.HOME}],a=[];return r&&a.push({label:n(`debugInfoLabel`),content:Hce(e),variant:`default`}),(0,$.jsx)(Py,{variant:`default`,iconRef:W.ERROR_UNKNOWN,title:n(`titleUnknown`),message:n(`messageUnknown`),actions:i,showDevInfo:r,devInfoTitle:n(`devInfoTitle`),devInfoSubtitle:n(`devInfoSubtitle`),devInfoSections:a})}function By({preset:e=H.DEFAULT,...t}){let n=qc(K.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY,`AppLayout_RouterErrorBoundary`)(e);return(0,$.jsx)(n,{...t})}var Vy=tl.getLogger();function Yce(e){return e?Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`string`)):{}}var Hy=()=>{let e=tg(),t=ah(),{emit:n}=Uo(),r=(0,Q.useContext)(sm),i=Zp(),a=(0,Q.useContext)(mh),o=(0,Q.useContext)(Vi),s=(0,Q.useContext)(Oc),c=_h(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=_h(e)?Ou.buildRouterError(e,e.status):Ou.buildRouterError(e);return{wildoError:t,userGuidance:t.userGuidance}},[e]);Q.useEffect(()=>{if(u){Vy.error(`RouterErrorBoundary caught error:`,{wildoError:u,error:e});try{Di.emit(hc.ERROR_OCCURED,{error:u})}catch(e){Vy.warn(`Failed to dispatch error event:`,{dispatchError:e})}}},[u,e]);let f=(0,Q.useMemo)(()=>{let e={...i?.buildContextResourceIdentifiers?.()??{},...Yce(u?.context)};return u?.organizationId&&(e.organizationId=u.organizationId),e},[i,u]),p=Q.useCallback(()=>{kh({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:ki},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=Hm.resolveResourceUrl(i,a,f,t.allResourceFieldIdentifiers,n.parentResourcesRequirements)?.resolvedUrl;if(!o){p();return}m({content:{contentType:Sa.RESOURCE_OPERATION,resourceContext:kn.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:Sa.COMPOSITE_VIEW,viewRef:e.compositeViewReference,contextResourceIdentifiers:t},urlPath:kp(e.compositeViewReference,t)})}else!e.target||e.target===`/`?p():a?Zh({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){Vy.warn(`Cannot navigate to operation: resource registry not available`,{ref:e}),p();return}let{registry:t}=r,n=Hm.resolveOperationRef(e,f,t);if(!n||n.contentType!==Sa.RESOURCE_OPERATION){p();return}let{resourceContext:i}=n,a=t.resourceConfigurations[i.resourceType];if(!a){p();return}let o=Hm.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=Hm.resolveGoBackTarget({currentBrowserUrl:Hm.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?_h(e)?(0,$.jsx)(By,{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)(By,{errorType:`javascript`,jsError:e,navigate:t,navigateAction:h,navigateBack:_,navigateHome:p,errorPageConfig:l,userGuidance:g}):(0,$.jsx)(By,{errorType:`generic`,unknownError:e,navigate:t,navigateAction:h,navigateBack:_,navigateHome:p,errorPageConfig:l,userGuidance:g}):(0,$.jsx)(By,{errorType:`route`,routeError:{status:404,statusText:`Not Found`,data:{pathname:window.location.pathname}},navigate:t,navigateAction:h,navigateBack:_,navigateHome:p,errorPageConfig:l})},Xce=4e3,Uy=tl.getLogger(),Wy=Uy.debugByType(`GlobalErrorHandler`);Uy.setDebugTypeLogging(`GlobalErrorHandler`,!1);function Zce(e){switch(e){case Xo.CRITICAL:case Xo.HIGH:return`error`;case Xo.MEDIUM:return`warning`;case Xo.LOW:return`info`;default:return`error`}}function Gy({onError:e}){let{on:t}=Uo(),{handleWildoError:n}=$f(),{endSession:r,isAuthenticated:i,getEndedSessionReason:a}=hm(),{notifyError:o,notifyWarning:s,notifyInfo:c}=Fm(),{tErrorMessage:l,tErrorGuidance:u,isKeySettled:d}=q(),f=(0,Q.useRef)({tErrorMessage:l,tErrorGuidance:u});f.current={tErrorMessage:l,tErrorGuidance:u};let p=d(Bc.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()?(Wy(`triggerLogout requested - logging out via AuthSession`),r(Vre(e))):Wy(`triggerLogout requested but not authenticated - skipping logout`)},[r,i]),v=(0,Q.useCallback)(e=>{let t=He[e.type],n=e.severity||t?.severity||Xo.MEDIUM,r=fp(e,{translators:f.current}),i=Zce(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})}Wy(`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,Xce))},[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(Wy(`Received ERROR_OCCURED event`,{errorType:r.type,customMessageReference:r.customMessageReference,triggerLogout:r.triggerLogout}),ct.shouldSuppress(r)){Wy(`Error suppressed (duplicate)`,{errorType:r.type,customMessageReference:r.customMessageReference});return}let i=r.triggerLogout===!0;if(i){Wy(`triggerLogout=true - calling AuthSession logout handler`),_(r);let e=r.frontendActions||[];e.includes(Hl.DISCONNECT)&&(r={...r,frontendActions:e.filter(e=>e!==Hl.DISCONNECT)})}Wy(`Error occurred`,{errorType:r.type,customMessageReference:r.customMessageReference});let o=r.suppressUserDisplay===!0,s=Tn(r),c=r.frontendActions||[],l=r;o||i&&a()!==null?l={...r,frontendActions:c.filter(e=>e!==Hl.NOTIFY&&e!==Hl.SHOW_TOAST&&e!==Hl.SHOW_MODAL)}:s&&(b(r),l={...r,frontendActions:c.filter(e=>e!==Hl.NOTIFY&&e!==Hl.SHOW_TOAST)}),e&&e(r),n(l)},[n,e,_,b,a]);return(0,Q.useEffect)(()=>{Wy(`Subscribing to ERROR_OCCURED events`,{eventName:hc.ERROR_OCCURED});let e=t(hc.ERROR_OCCURED,x);return()=>{Wy(`Unsubscribing from ERROR_OCCURED events`),e()}},[t,x]),null}var Qce=()=>{let e=(0,Q.useContext)(Qm);if(!e)throw Error(`useLoading must be used within a LoadingProvider`);return e};function Ky(){let e=(0,Q.useContext)(Qm);if(!e)throw Error(`useAppLoading must be used within a LoadingProvider`);return{isAppLoading:e.isAppLoading,sources:e.appLoadingSources}}function qy(e,t){let n=(0,Q.useContext)(Qm);if(!n)throw Error(`useComponentLoading must be used within a LoadingProvider`);let r=nh(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 $ce({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 Jy({preset:e=H.DEFAULT,...t}){let n=Ko.resolve(K.LOW_LEVEL_LOADING_SPINNER,e);return n?(0,$.jsx)(n,{...t}):(0,$.jsx)($ce,{...t})}function Yy({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_LOADING_OVERLAY,`LoadingOverlay`)(e);return(0,$.jsx)(n,{...t})}function ele(e){switch(e){case`overlay`:return{initialLoad:Oo.OPACITY_OVERLAY,refresh:Oo.OPACITY_OVERLAY};case`spinner-only`:return{initialLoad:Oo.SPINNER,refresh:Oo.SPINNER};case`skeleton-children`:return{initialLoad:Oo.SKELETON,refresh:Oo.OPACITY_OVERLAY};default:return}}var tle=`contents [:where([class*='space-y-'])>&]:block`,Xy=new Set([Oo.OPACITY_OVERLAY,Oo.HIDDEN,Oo.INVISIBLE]);function Zy({loadingScopes:e,i18nKeys:t,readiness:n,policy:r,renderLoading:i,renderError:a,timeoutMs:o,children:s}){let c=(0,Q.useContext)(Qm);if(!c)throw Error(`LoadingGate must be used within a LoadingProvider`);let l=gc(),u=r??ele(l.interactiveState?.loadingDisplay),d=(0,Q.useMemo)(()=>({keys:t??[]}),[t]),{requestKeys:f,isKeySettled:p,isReady:m}=q(d),h=(0,Q.useMemo)(()=>e?.length?e.map(e=>{let t=nh(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)?Pl.INITIAL:h.some(e=>e.isLoading&&e.hasLoadedOnce)?Pl.REFRESH:Pl.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(nh(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??Oo.OPACITY_OVERLAY,E=u?.initialLoad??Oo.SKELETON,D=Xy.has(T)||Xy.has(E);if(y)return D?(0,$.jsx)(`div`,{className:tle,"data-loading-gate":`ready`,children:s}):(0,$.jsx)($.Fragment,{children:s});let O=b===Pl.REFRESH?T:E,k={phase:b,scope:h[0]?.scope??{customIdentifier:`loading-gate`}};switch(O){case Oo.CUSTOM:return(0,$.jsx)($.Fragment,{children:i?.(k)??s});case Oo.SKELETON:return(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:`Loading`}),i?i(k):(0,$.jsx)(pm,{template:`auto`,density:`auto`,"aria-hidden":`true`})]});case Oo.SPINNER:return(0,$.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,$.jsx)(Jy,{size:32})});case Oo.OPACITY_OVERLAY:return(0,$.jsxs)(`div`,{className:`relative`,"data-loading-gate":`loading`,children:[s,(0,$.jsx)(Yy,{})]});case Oo.HIDDEN:return(0,$.jsx)(`div`,{style:{display:`none`},"data-loading-gate":`loading`,children:s});case Oo.INVISIBLE:return(0,$.jsx)(`div`,{style:{visibility:`hidden`},"data-loading-gate":`loading`,children:s});case Oo.FULL_SCREEN:return(0,$.jsx)(`div`,{className:`fixed inset-0 z-(--z-critical) flex items-center justify-center bg-background/80`,children:(0,$.jsx)(Jy,{size:48})});default:return(0,$.jsx)($.Fragment,{children:s})}}var Qy;(function(e){e.PENDING=`pending`,e.READY=`ready`,e.ERROR=`error`})(Qy||={});var $y=(0,Q.createContext)(null);function nle(){let e=(0,Q.useContext)($y);if(!e)throw Error(`useBarrierParticipant must be used within a LoadingBarrier`);return e}function rle({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:Qy.PENDING}),a(e=>e+1)),{markReady:()=>{let t=i.current.get(e);t&&t.status!==Qy.READY&&(i.current.set(e,{status:Qy.READY}),a(e=>e+1))},markError:t=>{let n=i.current.get(e);n&&n.status!==Qy.ERROR&&(i.current.set(e,{status:Qy.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===Qy.READY),m=Array.from(f.values()).some(e=>e.status===Qy.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!==Qy.READY),n=e.map(([e])=>({customIdentifier:e})),r=e.find(([,e])=>e.error)?.[1]?.error;return(0,$.jsx)($y.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:Qy.PENDING});l(e=>e+1),a(e=>e+1)}})})}let g=!p;return(0,$.jsx)($y.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)(Jy,{size:32})})]})})}var eb={[Qt.RESOURCES_LAYOUTS]:{initialLoad:Oo.SKELETON,refresh:Oo.OPACITY_OVERLAY},[Qt.RESOURCES_FIELDS]:{initialLoad:Oo.SKELETON,refresh:Oo.OPACITY_OVERLAY},[Qt.HIGH_LEVEL_VIEWS]:{initialLoad:Oo.SKELETON,refresh:Oo.OPACITY_OVERLAY},[Qt.APPLICATION_LEVEL_COMPONENTS]:{initialLoad:Oo.SKELETON,refresh:Oo.HIDDEN},[Qt.PUBLIC_LAYOUTS]:{initialLoad:Oo.SPINNER,refresh:Oo.SPINNER}};function ile(e,t){let n=eb[e]??{};return{initialLoad:t?.initialLoad??n.initialLoad??Oo.SKELETON,refresh:t?.refresh??n.refresh??Oo.OPACITY_OVERLAY,customRenderer:t?.customRenderer??n.customRenderer,disableInteraction:t?.disableInteraction??n.disableInteraction,skeletonSchema:t?.skeletonSchema??n.skeletonSchema}}var tb=tl.getLogger(),ale=tb.debugByType(`AppLoadingGate`);tb.setDebugTypeLogging(`AppLoadingGate`,!1);function nb({renderLoading:e,children:t}){let{isAppLoading:n,sources:r}=Ky(),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)(()=>{ale(`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)(Jy,{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)(Jy,{size:48})}))]})}function rb(e){return Array.from(new Set(e.filter(e=>typeof e==`string`&&e.length>0)))}function ib(e){let t=e.displayNameLabelKey??xd(e.providerRef),n=e.translate?.(t);return n&&n!==t?n:e.displayName??e.fallbackLabel??e.providerRef}function ab(...e){let t=k_(`FrontendApp`,e);return Mae(`FrontendApp`,t.modules.values()),t}var ob=`@wildo-ai/external-connectors-public`,ole={metadata:_d({ref:`dropbox`,packageName:ob,tier:Nd.MAIN,origin:hd}),providerCapabilities:[Fd.FRONTEND_FILE_PICKER],protocols:[Os.FRONTEND_SDK],publicConfig:{},publicConfigSchema:C_({appKey:{kind:S_.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:{[Fd.FRONTEND_FILE_PICKER]:{selectionDelivery:pd.BROWSER_READABLE_URL}},complianceProfile:{deploymentModels:[Td.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:Ed.ACCOUNT_RESIDENCY}])),vendorLegalEntityName:`Dropbox, Inc.`,storageRegionTerritories:{"United States":[`us`],Australia:[`au`,`us`],"European Union":[`eu`,`us`],Japan:[`jp`,`us`],"United Kingdom":[`gb`,`us`]},storageRegionConditions:Object.fromEntries([`Australia`,`European Union`,`Japan`,`United Kingdom`].map(e=>[e,`Holds only for an eligible team whose request for this storage location Dropbox has approved.`])),evidence:[{facts:[fd.STORAGE_REGION_TERRITORIES],source:`https://help.dropbox.com/security/physical-location-data-storage`,verifiedAt:`2026-11-16`},{facts:[fd.PROCESSING_REGIONS,fd.PROCESSING_REGION_REACH],source:`https://help.dropbox.com/security/physical-location-data-storage`,verifiedAt:`2026-11-10`}]}},sle={metadata:_d({ref:`google-drive`,packageName:ob,tier:Nd.MAIN,origin:hd}),providerCapabilities:[Fd.FRONTEND_FILE_PICKER],protocols:[Os.FRONTEND_SDK],publicConfig:{},publicConfigSchema:C_({appId:{kind:S_.STRING,description:`Google Cloud project NUMBER the Drive Picker is registered under.`},developerKey:{kind:S_.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:{[Fd.FRONTEND_FILE_PICKER]:{selectionDelivery:pd.REMOTE_REFERENCE}},fileStorage:zae.GOOGLE_DRIVE,complianceProfile:{deploymentModels:[Td.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:Ed.ACCOUNT_RESIDENCY}])),evidence:[{facts:[fd.DEPLOYMENT_MODELS,fd.PROCESSING_REGIONS],source:`https://knowledge.workspace.google.com/admin/compliance/choose-a-geographic-location-for-your-data`,verifiedAt:`2026-11-06`},{facts:[fd.PROCESSING_REGIONS],source:`https://policies.google.com/privacy`,verifiedAt:`2026-11-06`},{facts:[fd.PROCESSING_REGION_REACH],source:`https://knowledge.workspace.google.com/admin/compliance/choose-a-geographic-location-for-your-data`,verifiedAt:`2026-11-10`}]}},cle=`Google Maps`,lle=[ole,sle,{metadata:_d({ref:`google-places`,packageName:ob,tier:Nd.MAIN,origin:hd}),providerCapabilities:[Fd.FRONTEND_ADDRESS_LOOKUP],protocols:[],publicConfig:{},publicConfigSchema:C_({}),components:{[Fd.FRONTEND_ADDRESS_LOOKUP]:{placeIdRetention:Sd.NONE,addressLookup:{suggestOperationId:`address_suggest`,retrieveOperationId:`address_retrieve`,sessionTokenInput:`sessionToken`,attributionMark:cle}}},complianceProfile:{deploymentModels:[Td.VENDOR_HOSTED],processingRegions:[`Servers around the world`],evidence:[{facts:[fd.DEPLOYMENT_MODELS,fd.PROCESSING_REGIONS],source:`https://policies.google.com/privacy`,verifiedAt:`2026-11-06`}]}},{metadata:_d({ref:`microsoft-onedrive`,packageName:ob,tier:Nd.MAIN,origin:hd}),providerCapabilities:[Fd.FRONTEND_FILE_PICKER],protocols:[Os.FRONTEND_SDK],publicConfig:{},publicConfigSchema:C_({clientId:{kind:S_.STRING,description:`Azure application (client) id the OneDrive picker is registered under.`},pickerRedirectUri:{kind:S_.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:{[Fd.FRONTEND_FILE_PICKER]:{selectionDelivery:pd.BROWSER_READABLE_URL}},complianceProfile:{deploymentModels:[Td.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:Ed.ACCOUNT_RESIDENCY}])),evidence:[{facts:[fd.DEPLOYMENT_MODELS,fd.PROCESSING_REGIONS],source:`https://learn.microsoft.com/en-us/microsoft-365/enterprise/m365-dr-service-spo`,verifiedAt:`2026-11-06`},{facts:[fd.PROCESSING_REGIONS],source:`https://learn.microsoft.com/en-us/microsoft-365/enterprise/o365-data-locations`,verifiedAt:`2026-11-06`},{facts:[fd.PROCESSING_REGIONS],source:`https://www.microsoft.com/en-us/privacy/privacystatement`,verifiedAt:`2026-11-06`},{facts:[fd.PROCESSING_REGION_REACH],source:`https://learn.microsoft.com/en-us/microsoft-365/enterprise/m365-dr-service-spo`,verifiedAt:`2026-11-10`}]}}];ab({modules:new Map(lle.map(e=>[e.metadata.ref,e]))});var sb=function(e){return e.AT_SURFACE_START=`at_surface_start`,e.ON_DEMAND=`on_demand`,e}({});function cb(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 lb=Object.freeze({browserHosted:!1}),ub=Object.freeze({browserHosted:!0,consentPurposes:Object.freeze([])}),db=Object.freeze({FRONTEND_PRODUCT_ANALYTICS:Object.freeze({browserHosted:!0,consentPurposes:Object.freeze([Bd.ANALYTICS])}),FRONTEND_ERROR_MONITORING:ub,FRONTEND_CAPTCHA:ub,FRONTEND_SEARCH:ub,FRONTEND_FILE_PICKER:ub,FRONTEND_ADDRESS_LOOKUP:ub,FRONTEND_CHAT_SIGN_IN_COMPLETION:ub,SSO_OAUTH2:ub,BILLING:lb,EMAIL_TRANSACTIONAL:lb,EMAIL_MARKETING:lb,EMAIL_INBOUND:lb,SMS:lb,ELECTRONIC_SIGNATURE:lb,EMBEDDED_ELECTRONIC_SIGNATURE:lb,SSO_SAML:lb,LLM_CHAT:lb,LLM_EMBEDDINGS:lb,DOCUMENT_TEXT_EXTRACTION:lb,PROMPT_INJECTION_SCREENING:lb,OUTPUT_MODERATION:lb,CODING_AGENT:lb,IMAGE_GENERATION:lb,LLM_OBSERVABILITY:lb,OBSERVABILITY_TELEMETRY:lb,COMPLIANCE_AUDIT_TRAIL:lb,KEY_MANAGEMENT:lb});function fb(e){return Object.prototype.hasOwnProperty.call(db,e)?db[e]:void 0}function pb(e){return(e.providerCapabilities??[]).filter(e=>fb(e)?.browserHosted!==!0)}function mb(e){let t=new Set(Aae);return(e.consentPurposes??[]).filter(e=>!t.has(e))}function hb(e){let t=[...e.consentPurposes??[]];for(let n of e.providerCapabilities??[]){let e=fb(n);e?.browserHosted===!0&&t.push(...e.consentPurposes)}return Rd(t)}function gb(e,t){return pb(e).length>0||mb(e).length>0?!1:Ld(t,hb(e)).length===0}function _b(e,t){return Ld(t,hb(e))}function vb(e,t,n){let r=pb(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=mb(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 ${_b(t,n).join(`, `)}, which has not been granted on this surface.`}function yb(e,t){let n=hb(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 bb(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 xb(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 ule(e,t){if(e===void 0||t===void 0)return e===t;let n=Eae(t);return Hae.every(t=>xb(e[t]??[],n[t]))}function dle(e){return e.issues!==void 0}function fle(e,t,n,r,i){let a=kae({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(dle(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 ple(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&&!ule(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&&Hd(a.sdk)!==Hd(o.sdk?.descriptor)&&t({kind:`GENERATED_ARTIFACT_STALE`,providerRef:i,message:`Provider "${i}" declares ${Hd(o.sdk?.descriptor)} but its served entry says ${Hd(a.sdk)}. Regenerate with \`wildo config sync\`.`}),o!==void 0){for(let[e,n]of Object.entries(o.components??{})){let r=bb(cb(n)),o=a.components?.[e],s=o===void 0?void 0:bb(cb(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&&!xb(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&&w_(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=yb(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=E_([...new Set([...T_(o?.publicConfigSchema),...a.requiredPublicConfigKeys??[]])],u);e.length>0&&(t({kind:`PUBLIC_CONFIG_NOT_SUPPLIED`,providerRef:i,message:D_({providerRef:i,missingKeys:e})}),o=void 0,d=void 0)}if(o?.publicConfigSchema!==void 0){let e=fle(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 mle(e){let t=ple(e);return ab({modules:new Map([...t].map(([e,t])=>[e,{...t,providerCapabilities:t.providerCapabilities,protocols:t.protocols,consentPurposes:t.consentPurposes}]))})}var Sb=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 Cb(e,t){let n=e.sdk;if(n?.activation!==sb.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 wb(e){let t=e.trim();return/[.!?]$/.test(t)?t:`${t}.`}function hle(){return typeof globalThis<`u`&&globalThis.window!==void 0}async function Tb(e){let t=t=>{e.onDiagnostic?.(t)},n=new Map,r=e.isBrowser??hle;for(let i of e.modules){let a=i.sdk;if(a===void 0)continue;let o=i.metadata.ref,s=(a.activation??sb.AT_SURFACE_START)===sb.ON_DEMAND;if(e.onDemand===void 0){if(s)continue}else{let{verdict:n,cause:r}=Cb(i,e.onDemand);if(n===Sb.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===Sb.PREDICATE_FAILED&&t({kind:`ON_DEMAND_PREDICATE_FAILED`,providerRef:o,message:`Provider "${o}"'s servesOnDemandContext threw: ${wb(Qu(r))} Its SDK was not loaded.`,cause:r}),n!==Sb.SERVES)continue}if(!gb(i,e.grantedConsentPurposes??[])){t({kind:`WITHHELD_PENDING_CONSENT`,providerRef:o,message:`${vb(o,i,e.grantedConsentPurposes??[])} Its SDK was not loaded.`});continue}let c=yb(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 ${Hd(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),hb(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 ${Hd(a.descriptor)}): ${wb(Qu(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 gle(){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 Eb=`data-wildo-provider-script`,Db=`data-wildo-provider-script-state`;function _le(e){if(e===void 0)return[];let t=[];for(let n of e)if(!(hb(n).length>0)&&gb(n,[]))for(let e of n.scripts??[])t.push({providerRef:n.metadata.ref,declaration:e});return t}function vle(e,t){return[...e.querySelectorAll(`script[${Eb}]`)].find(e=>e.getAttribute(`src`)===t)}function yle(e,t){let{providerRef:n,declaration:r}=t,i=e.createElement(`script`);return i.src=r.src,i.setAttribute(Eb,n),i.setAttribute(Db,`loading`),i.addEventListener(`load`,()=>i.setAttribute(Db,`loaded`),{once:!0}),i.addEventListener(`error`,()=>i.setAttribute(Db,`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 ble(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 xle(e){let t=e.getAttribute(Db);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 Ob(e,t){let n=await Promise.all(e.map(async e=>({script:e,state:await xle(vle(t,e.declaration.src)??yle(t,e))})));return{loaded:n.filter(e=>e.state===`loaded`).map(e=>e.script),failed:n.filter(e=>e.state===`failed`).map(e=>ble(e.script))}}function Sle(){return typeof document<`u`}var Cle=e=>Ob(e,document);function wle(e){return typeof e==`object`&&!!e&&e[Symbol.toStringTag]===`Module`}function Tle(e){return typeof e==`function`||typeof e==`object`&&!!e}function Ele(e){let t=t=>{e?.onDiagnostic?.(t)},n=new Map,r=new Map,i=e?.loadScripts??Cle,a=e?.hasBrowserDocument??Sle,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=yb(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=gb(r,n);return{permitted:i,missingPurposes:i?[]:_b(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(!gb(p,c))return t({kind:`WITHHELD_PENDING_CONSENT`,capability:e,providerRef:o,message:`${vb(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: ${mne(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 wle(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):Tle(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 kb(e,t){return`${e}:${t}`}function Dle(e){let t=new Map;for(let n of e??[])t.set(kb(n.capability,n.providerRef),n);return t}function Ole(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(kb(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:cb(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 kle(e,t){let n=new Set;for(let e of t)n.add(e.providerRef);return _le([...e].filter(e=>!n.has(e.metadata.ref)))}var Ab=function(e){return e.NONE=`NONE`,e.LOADING=`LOADING`,e.READY=`READY`,e.UNAVAILABLE=`UNAVAILABLE`,e.CONSENT_REQUIRED=`CONSENT_REQUIRED`,e}({}),jb=Object.freeze([]);function Mb(){return{status:`NONE`,Component:null,missingConsentPurposes:jb}}function Ale(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(Mb()),()=>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:jb}),t.resolve(n,r,i).then(e=>{s&&a(e===null?{status:`UNAVAILABLE`,Component:null,missingConsentPurposes:jb}:{status:`READY`,Component:e,missingConsentPurposes:jb})}),()=>{s=!1}}var Nb=class{registry=ab({modules:new Map});initialize(e){this.registry=mle({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 Tb({surface:ta.SAAS_APP,modules:this.registry.getProvidersByProviderCapability(e.capability),onDemand:e,onDiagnostic:t})}providersServingOnDemand(e){return this.registry.getProvidersByProviderCapability(e.capability).filter(t=>Cb(t,e).verdict===Sb.SERVES).map(e=>e.metadata.ref)}};function Pb(e){let t=new Nb;return t.initialize(e),t}var Fb=tl.getLogger(),Ib;(function(e){e.SUCCEEDED=`succeeded`,e.FAILED=`failed`})(Ib||={});function Lb(e,t){let n=0;for(let[r,i]of e.activations)if(!lce(i.handle))Fb.warn(`A chat sign-in completion provider returned a handle that is not a FrontendChatSignInCompletionSink`,{providerRef:r});else try{t===Ib.SUCCEEDED?i.handle.signInSucceeded():i.handle.signInFailed(),n+=1}catch(e){Fb.warn(`A chat sign-in completion provider failed to tell its host`,{providerRef:r,error:e})}return n}function Rb(e){let t=(0,Q.useContext)(Vi)?.frontendProviderRegistry,n=(0,Q.useMemo)(()=>e===void 0?void 0:{capability:Fd.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===Ib.SUCCEEDED&&e===Ib.FAILED||i.current===e&&o?.repeat!==!0)return 0;i.current=e,a.current??=t.activateOnDemand(n,e=>Fb.warn(`Chat sign-in completion provider diagnostic`,{kind:e.kind,providerRef:e.providerRef,message:e.message}));try{let t=Lb(await a.current,e);return t===0&&(a.current=null),t}catch(e){return Fb.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 zb=new Map;function Bb(e){zb=Dle([...zb.values(),...e])}function Vb(){return zb}function jle(){zb=new Map}var Hb;(function(e){e.NOT_APPLICABLE=`notApplicable`,e.REQUIRED=`required`,e.PROMPT=`prompt`,e.SATISFIED=`satisfied`})(Hb||={});function Ub(e){let t=Rd(e.serviceConsentRequirement?.requiredPurposes),n=Rd(e.privacy?.consentedPurposes),r=Ld(n,t),i=Nae({requiredPurposes:t,analyticsEnabled:e.analyticsEnabled,analyticsRequiresConsent:e.analyticsRequiresConsent,capabilityDeclaredPurposes:e.capabilityDeclaredConsentPurposes}).filter(e=>!t.includes(e)),a=Lae(e.privacy),o=i.filter(e=>!a.includes(e)),s={requiredPurposes:t,missingRequiredPurposes:r,optionalPurposes:i,promptedPurposes:o,grantedPurposes:n,gatedProcessing:t.length>0?e.serviceConsentRequirement?.gatedProcessing:void 0};return r.length>0?{...s,status:Hb.REQUIRED}:e.privacy===null||e.privacy===void 0||t.length===0&&i.length===0?{...s,status:Hb.NOT_APPLICABLE}:o.length>0?{...s,status:Hb.PROMPT}:{...s,status:Hb.SATISFIED}}function Wb(e,t,n){let r=e.filter(e=>!t.includes(e)),i=t.filter(e=>n.includes(e));return Rd([...r,...i])}function Gb(e,t,n){let r=Wb(e.grantedPurposes,t,n);return Ld(r,e.requiredPurposes)}function Kb(){let e=(0,Q.useContext)(ih),t=e?.privacy?.consentedPurposes,n=(0,Q.useMemo)(()=>Rd(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(Wb(n,e,e),e)},[n,r]);return{granted:n,grant:i?a:void 0}}function qb(e){let{frontendProviderRegistry:t,providerComponentRegistry:n}=Su();return n===void 0?[]:n.listProviders(e).map(e=>{let n=t?.getProviderByRef(e);return{providerRef:e,displayNameLabelKey:n?.metadata.displayNameLabelKey??xd(e),displayName:n?.metadata.displayName,fileStorage:n?.fileStorage}})}function Jb(e,t){let{providerComponentRegistry:n}=Su(),{granted:r}=Kb(),i=r.join(`,`),[a,o]=(0,Q.useState)(()=>Mb());return(0,Q.useEffect)(()=>Ale({registry:n,capability:e,providerRef:t,grantedConsentPurposes:r,onState:o}),[e,t,n,i]),a}var Yb;(function(e){e.PROVIDER_DECLARED_NO_DELIVERY=`PROVIDER_DECLARED_NO_DELIVERY`,e.DELIVERY_CONTRADICTS_DECLARATION=`DELIVERY_CONTRADICTS_DECLARATION`})(Yb||={});function Xb(e){let t=e.descriptor?.selectionDelivery;if(t===void 0)return{accepted:[],rejections:[{kind:Yb.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:Yb.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 Zb;(function(e){e.PLACE_ID_CONTRADICTS_DECLARATION=`PLACE_ID_CONTRADICTS_DECLARATION`,e.ADDRESS_REFUSED_BY_FIELD=`ADDRESS_REFUSED_BY_FIELD`})(Zb||={});function Qb(e){let t=e.descriptor?.placeIdRetention??Sd.NONE,{address:n,placeId:r}=e.selection;return r!==void 0&&t===Sd.NONE?{rejection:{kind:Zb.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:Zb.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 $b=Fd.FRONTEND_FILE_PICKER;function ex(e){let{providerComponentRegistry:t,frontendProviderRegistry:n}=Su(),r=qb($b),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}=Jb($b,o),{grant:f}=Kb(),p=(0,Q.useMemo)(()=>o===void 0?{}:n?.getProviderByRef(o)?.publicConfig??{},[o,n]),m=e.constraints,h=e.multiple,g=(0,Q.useMemo)(()=>jae({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=Xb({providerRef:o,descriptor:t?.describe($b,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!==Ab.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 vc().getProviderConnectionAccessToken(o))?.accessToken},[o]);if(a.length===0)return null;let T=e.renderChooser?.({choices:a,chosen:o,choose:s})??Mle({choices:a,chosen:o,choose:s}),E=a.find(e=>e.providerRef===o),D=l===Ab.CONSENT_REQUIRED&&E!==void 0?(e.renderConsentRequired??Nle)({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===Ab.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 Mle(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 Nle(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 tx;(function(e){e.VERTICAL=`vertical`,e.HORIZONTAL=`horizontal`,e.RESPONSIVE=`responsive`})(tx||={});function nx({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_FIELD,`Field`)(e);return(0,$.jsx)(n,{...t})}function rx({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_FIELD_LABEL,`FieldLabel`)(e);return(0,$.jsx)(n,{...t})}function ix({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_FIELD_TITLE,`FieldTitle`)(e);return(0,$.jsx)(n,{...t})}function ax({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_FIELD_CONTENT,`FieldContent`)(e);return(0,$.jsx)(n,{...t})}function ox({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_FIELD_DESCRIPTION,`FieldDescription`)(e);return(0,$.jsx)(n,{...t})}function sx({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_FIELD_ERROR,`FieldError`)(e);return(0,$.jsx)(n,{...t})}function Ple({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_FIELD_SEPARATOR,`FieldSeparator`)(e);return(0,$.jsx)(n,{...t})}var cx=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=qc(K.LOW_LEVEL_COMBOBOX,`Combobox`)(e);return(0,$.jsx)(r,{...t,ref:n})});cx.displayName=`Combobox`;var lx=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=qc(K.LOW_LEVEL_COMBOBOX_MULTIPLE,`ComboboxMultiple`)(e);return(0,$.jsx)(r,{...t,ref:n})});lx.displayName=`ComboboxMultiple`;var Fle=md(),ux=class extends Error{constructor(){super(`The chosen place has no postal address the field can hold.`),this.name=`ProviderAddressLookupPlaceWithoutAddressError`}};function dx({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 fx(e){return e instanceof Error?e:Error(String(e))}function px(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}=q({component:[K.LOW_LEVEL_FORM_FIELD_ADDRESS]}),m=(e,t)=>p(K.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(fx(e));return}n(r).then(n=>{e===x.current&&v(t.readSuggestions(n))}).catch(t=>{e===x.current&&(v([]),o(fx(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(fx(e));return}r(a).then(e=>{let n=t.readAddress(e);n===void 0?o(new ux):i({address:n})}).catch(e=>o(fx(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(pl.LOOKUP_NO_RESULTS):m(pl.LOOKUP_TYPE_MORE,{minimum:3});return(0,$.jsx)(cx,{schema:Fle,name:d,value:``,options:T,onChange:D,onSearchChange:g,onOpenChange:O,shouldFilter:!1,isLoading:y,disabled:u,placeholder:m(pl.LOOKUP_PLACEHOLDER),searchPlaceholder:m(pl.LOOKUP_SEARCH_PLACEHOLDER),emptyMessage:k,listFooter:f===void 0?void 0:(0,$.jsx)(dx,{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 mx=Fd.FRONTEND_ADDRESS_LOOKUP,Ile=rs(Ja).consentedPurposes,hx;(function(e){e.UNAVAILABLE=`UNAVAILABLE`,e.ADDRESS_REFUSED=`ADDRESS_REFUSED`})(hx||={});function Lle(){return globalThis.crypto.randomUUID()}function gx({host:e,addressSchema:t,fieldName:n}){let{providerComponentRegistry:r,frontendProviderRegistry:i}=Su(),{t:a,tComponent:o,tResourceFieldEnumValue:s,currentLanguage:c}=q({component:[K.LOW_LEVEL_FORM_FIELD_ADDRESS]}),l=(e,t)=>o(K.LOW_LEVEL_FORM_FIELD_ADDRESS,e,t),u=qb(mx),d=(0,Q.useMemo)(()=>u.filter(e=>r?.describe(mx,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:_}=Jb(mx,m),{grant:v}=Kb(),[y,b]=(0,Q.useState)(void 0),x=m===void 0?void 0:r?.describe(mx,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??=Lle(),r={...r,[n]:C.current}),(await vc().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=Qb({providerRef:m,descriptor:x,selection:n,addressSchema:t});r.accepted===void 0?b(hx.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 ux?hx.ADDRESS_REFUSED:hx.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===Ab.UNAVAILABLE?hx.UNAVAILABLE:y;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,"data-address-lookup":m??``,children:[(0,$.jsx)(rx,{htmlFor:`field-${N}`,className:`text-sm text-muted-foreground`,children:l(pl.LOOKUP_LABEL)}),d.length>1?(0,$.jsx)(`div`,{role:`group`,className:`flex flex-wrap gap-item-xs`,children:d.map(e=>(0,$.jsx)(Y,{type:`button`,size:df.SM,variant:e.providerRef===m?X.DEFAULT:X.OUTLINE,"aria-pressed":e.providerRef===m,onClick:()=>{b(void 0),w(),p(e.providerRef)},children:M(e)},e.providerRef))}):null,h===Ab.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(Wo.USER_SELF_PREFERENCES,`privacy.consentedPurposes`,e,Ile)).join(`, `);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:l(pl.LOOKUP_CONSENT_REQUIRED,{provider:M(j),purposes:e})}),v===void 0?null:(0,$.jsx)(Y,{type:`button`,size:df.SM,variant:X.OUTLINE,onClick:()=>void v(_),children:l(pl.LOOKUP_CONSENT_GRANT,{purposes:e})})]})})()}):null,h===Ab.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(pl.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===hx.UNAVAILABLE?pl.LOOKUP_UNAVAILABLE:pl.LOOKUP_ADDRESS_REFUSED)})]})}function _x(){return(0,Q.useContext)(vx)}var vx=(0,Q.createContext)([]),Rle=tl.getLogger();function zle(e){return[...e].sort().join(`,`)}var yx=({children:e})=>{let t=(0,Q.useContext)(Vi),n=t?.frontendProviderRegistry,{on:r}=Uo(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)([]),c=(0,Q.useRef)(gle());(0,Q.useEffect)(()=>r(hc.USER_PREFERENCES_CHANGED,e=>{if(e.privacy===null){a([]);return}let t=e.privacy?.consentedPurposes;t!==void 0&&a(Rd(t))}),[r]);let l=t?.appConfig?.analytics?.enabled===!0,u=(0,Q.useMemo)(()=>(n?.listAll()??[]).filter(e=>hb(e).length>0&&(l||!e.providerCapabilities.includes(Fd.FRONTEND_PRODUCT_ANALYTICS))),[n,l]),d=(0,Q.useMemo)(()=>{let e=i??[],t=new Set(u.flatMap(e=>hb(e)));return e.filter(e=>t.has(e))},[u,i]),f=zle(d);return(0,Q.useEffect)(()=>{if(u.length===0||d.length===0){s([]);return}let e=c.current.start(()=>Tb({surface:ta.SAAS_APP,modules:u,grantedConsentPurposes:d,onDiagnostic:e=>{Rle.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)(vx.Provider,{value:o,children:e})},bx=tl.getLogger(),xx=bx.debugByType(`ResourceReadCache`);bx.setDebugTypeLogging(`ResourceReadCache`,!1);var Ble=200,Vle=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(),xx(`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),xx(`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&&xx(`invalidated by resource type`,{resourceType:e,dropped:t})}clear(){let e=this.entries.size;this.entries.clear(),e>0&&xx(`cleared`,{dropped:e})}evictIfOverCapacity(){if(this.entries.size<=Ble)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 Hle(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(e instanceof Date)return`D${e.getTime()}`;if(n.has(e))throw Error(`not renderable`);if(n.add(e),Array.isArray(e))return`[${e.map(r).join(`,`)}]`;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw Error(`not renderable`);return`{${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 Sx(e,t){let n=t?.[Wo.USERS];return e?.primaryKeyIdentifiesInitiator===!0&&n!==void 0&&e.resourceFieldIdentifier===n}function Cx(e,t){return e?.timeout===void 0?t.clientRequestTimeoutMs===void 0?{}:{timeout:t.clientRequestTimeoutMs}:{}}function Ule(){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 wx(e,t){return t.idempotencyKey===void 0||Object.keys(e?.headers??{}).some(e=>e.toLowerCase()===Io.IDEMPOTENCY_KEY)?{}:{headers:{...e?.headers,[Io.IDEMPOTENCY_KEY]:Wt(Ule())}}}function Wle(e){return typeof e==`string`||typeof e==`number`}function Tx(e){let t=vl(e);return t===J.READ||t===J.LIST||t===J.SEARCH}function Gle(e){return!Tx(e)&&vl(e)!==J.COUNT&&e.httpVerb!==En.GET}function Ex(e){return Tx(e)&&e.hasCustomResponseDto!==!0}var Dx=class e extends Ca{resourcesRegistry;errorBuilder;constructor(e,t={}){super(t),this.resourcesRegistry=e,this.errorBuilder=new Ae}buildError(e,t,n){let r=this.errorBuilder.buildWildoError_Frontend(Mc.INTERNAL,{customMessageReference:e,operationPathKey:t,context:n}),i=Error(e);return i.wildoError=r,i}readCache=new Vle;getReadCache(){return this.readCache}resolveCacheableRead(e,t,n){let r=t.resourceIdentifier,i=Hle(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===rn.APPLICATION){let e=this.readCache.getApplicationId();e&&(o.applicationId=e)}if(a===rn.ORGANIZATIONS&&!o.organizationId){let e=this.readCache.getOrganizationId();e&&(o.organizationId=e)}return{key:i,resourceType:r,scopes:Jre(o,a)}}async doOperation(e,t,n){let r=no.parseOperationPathKey(e),i=this.findOperation(r);if(!i)throw this.buildError(Lu.FRONTEND_RESOURCE_OPERATION_NOT_FOUND,e,{operationPathKey:e});Tx(i)||this.readCache.invalidateResourceType(i.resourceIdentifier);let a=Ex(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 oe.API_CALL:return this.executeApiCallOperation(i,t,n).then(e=>(a&&this.readCache.store(a.key,e,a.resourceType,a.scopes),Gle(i)&&Sx(this.resourcesRegistry.resourceConfigurations[i.resourceIdentifier],this.resourcesRegistry.allResourceFieldIdentifiers)&&this.revalidateSession(),e));default:throw i.variantType,this.buildError(Lu.FRONTEND_RESOURCE_UNSUPPORTED_OPERATION_TYPE,e,{operationPathKey:e})}}async executeSearchOperation(e,t,n){let r=no.parseOperationPathKey(e),i=this.findOperation(r);if(!i)throw this.buildError(Lu.FRONTEND_RESOURCE_OPERATION_NOT_FOUND,e,{operationPathKey:e,operationType:`search`});if(vl(i)!==J.SEARCH)throw this.buildError(Lu.FRONTEND_RESOURCE_SEARCH_OPERATION_INVALID,e,{operationPathKey:e,actualOperationIdentifier:i.operationIdentifier});let a=Ex(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(De(e,n))return this.validateResponseData(n,lte,void 0,!1);if(Ote(e,n))return this.validateResponseData(n,dte,void 0,!1);let r=this.selectResponseDto(e,t);return this.validateResponseData(n,r,void 0,zee(e))}selectResponseDto(e,t){let n=Ii.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 Id?this.buildError(Lu.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=no.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!==oe.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(Lu.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,...Cx(n,e),...wx(n,e),params:o,riskLevel:e.riskLevel||od.MEDIUM,resourceType:e.resourceIdentifier,operationIdentifier:String(e.operationIdentifier),variantKey:e.variantKey,isBulkOperation:e.isBulkOperation,isOperationDefault:e.isOperationDefault,loading:n?.loading??{tier:oc.COMPONENT,phase:Pl.INITIAL}},c;switch(e.httpVerb){case En.GET:c=await this.get(i,s);break;case En.POST:c=await this.post(i,t.requestData,s);break;case En.PUT:c=await this.put(i,t.requestData,s);break;case En.DELETE:c=await this.delete(i,t.requestData===void 0?s:{...s,data:t.requestData});break;case En.PATCH:c=await this.patch(i,t.requestData,s);break;default:throw this.buildError(Lu.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(Lu.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!==Co.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,...Cx(n,r),params:c,riskLevel:r.riskLevel||od.MEDIUM,resourceType:r.resourceIdentifier,operationIdentifier:String(r.operationIdentifier),variantKey:e.variantKey,isBulkOperation:e.isBulkOperation,isOperationDefault:e.isOperationDefault,loading:n?.loading??{tier:oc.COMPONENT,phase:Pl.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(Lu.FRONTEND_RESOURCE_NO_ENDPOINT_AVAILABLE,void 0,{reason:`No initiator infos available for this operation`});let o=U.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(Lu.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(Wle(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=no.extractOperationPath(n),r=no.createOperationPathKey(t);e.push(r)}}return e}getOperationDetails(e){let t=no.parseOperationPathKey(e);return this.findOperation(t)}},Ox=tl.getLogger();Ox.debugByType(`useNavigationState`),Ox.setDebugTypeLogging(`useNavigationState`,!1);function kx(){let e=(0,Q.useContext)(mh);if(!e)throw Error(`useNavigationState must be used within a NavigationProvider`);return e}var Ax;(function(e){e.ELEMENT=`element`,e.CREATE=`create`})(Ax||={});var jx=(0,Q.createContext)({isAvailable:!1,target:null,open:()=>void 0,close:()=>void 0,isElementActive:()=>!1,isCreateActive:!1});function Mx({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===Ax.ELEMENT&&n.elementId===e:!1,[n]),s=(0,Q.useMemo)(()=>({isAvailable:!0,target:n,open:i,close:a,isElementActive:o,isCreateActive:n?.kind===Ax.CREATE}),[n,i,a,o]);return(0,$.jsx)(jx.Provider,{value:s,children:t})}function Nx(){return(0,Q.useContext)(jx)}var Px=tl.getLogger(),Fx=Px.debugByType(`useNavigationController`);Px.setDebugTypeLogging(`useNavigationController`,!1);function Ix(e){let t=e?.operationFrontendConfig?.surface;return t!==Si.EMBEDDED&&t!==Si.API_ONLY}function Lx(e,t,n=!1){Hm.isInTransaction()||Hm.beginTransaction(`controller_url_update`),e(t,{replace:n})}function Rx(e){if(!Hm.isResourceOperationContent(e))return{operation:J.LIST,effectiveOperation:J.LIST,actionPresentationIsAuthored:!1};let t=e.resourceContext.operation;return{operation:t?.operationIdentifier??J.LIST,effectiveOperation:vl(t),resourceType:e.resourceContext.resourceType,operationSurface:t?.operationFrontendConfig?.surface,operationOverrides:t?.operationFrontendConfig?.navigationOverrides,actionPresentationTransition:kne(Gc(t)),actionPresentationIsAuthored:t?.operationFrontendConfig?.actionPresentation!==void 0}}var Kle={[ql.SECONDARY]:ql.PRIMARY,[ql.COMPANION]:ql.SECONDARY};function qle(e){let t=Bx(e);return t?.persistent===!0&&t.targetZone===e.placedZone}function zx(e){let t=Bx(e);return t?(t.collapsedFromZone??t.targetZone)===ql.PRIMARY:!1}function Bx(e){let t=Kle[e.paneZone];if(!e.layout||!t)return;let n=Hm.isResourceOperationContent(e.content)?Jle(e.content.resourceContext,e.registry,e.viewport):void 0,r={[ql.PRIMARY]:!0};return t===ql.SECONDARY&&(r[ql.SECONDARY]=!0),yh.resolve({...Rx(e.content),relationshipTransition:n,sourceZone:t,focusedZone:t,viewport:e.viewport,contentAreaWidth:e.contentAreaWidth,zoneOccupancy:r,zoneDepth:{}},e.layout)}function Jle(e,t,n){let r=(e.parentResourcesRequirements??[]).filter(e=>!e.isPrimaryScope),i=r[r.length-1];if(!i)return;let a=Hm.findRelationshipBetween(i.resourceType,e.resourceType,t,i.foreignKeyField);return Jh(a?.display?.inParentNavigation?.transition,n??Yo.DESKTOP)}function Vx(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:kn.selfReferenceForeignKeysOf(t.resourceType,r).includes(i)?e[i]={fieldIdentifier:i,resourceId:n}:e[t.resourceType]={fieldIdentifier:i,resourceId:n}}function Hx(e){let{resourceType:t,contextResourceIdentifiers:n,parentResourcesRequirements:r,registry:i,emit:a,getZoneState:o}=e;if(!e.replaceExisting&&o(ql.PRIMARY).stack.length>0)return;let s=i.resourceConfigurations?.[t];if(!s)return;let c={...n};delete c[t];let l=Gl(io(s.operations??[],J.LIST,{allowBulk:!0}).filter(e=>Ei(e.operationFrontendConfig)),J.LIST,{allowBulk:!0});if(!l)return;let u=Hm.resolveResourceUrl(s,l,ku(c),i.allResourceFieldIdentifiers,r)?.resolvedUrl;a(hc.NAVIGATION_REPLACE,{zone:ql.PRIMARY,content:{contentType:Sa.RESOURCE_OPERATION,resourceContext:kn.createFrontendResourceOperationContextFromOperation({resourceType:t,operation:l,contextResourceIdentifiers:c,parentResourcesRequirements:r})},...u?{urlPath:u}:{},stackEntryId:Hm.generateStackEntryId(),initiator:{sourceZone:ql.PRIMARY},navigationSource:e.navigationSource??Gt.URL_SYNC,transition:Mo.REPLACE})}function Ux(e,t,n){return e?.admitsCrossTenantPlatformAdministration!==!0||n?.({...e,resourceType:t})===!0}function Wx(e,t,n,r,i,a,o,s){let c=e.resourceContext.parentResourcesRequirements;if(!c||c.length===0)return;let l=[];if(t===ql.SECONDARY?l.push(ql.PRIMARY):t===ql.COMPANION&&l.push(ql.SECONDARY,ql.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),_=Hm.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&&Vx(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=Hm.resolveAncestorOperationConfig(_,h,{registry:n,contextResourceIdentifiers:S,contextualParameters:U.buildContextualParameters(S,n)}),w=Ux(C,m,s?.viewerMayPerform)?C:null;if(t===ql.PRIMARY&&(!w||Hm.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&&Vx(t,i,e,n)}Hx({resourceType:g,contextResourceIdentifiers:t,parentResourcesRequirements:e,registry:n,emit:i,getZoneState:o,navigationSource:Gt.CONTROLLER,replaceExisting:!!s?.overwriteExisting});continue}if(!w)continue;let T=vl(w);x&&T===J.READ&&(b[m]=x);let E=kn.createFrontendResourceOperationContextFromOperation({resourceType:m,operation:w,contextResourceIdentifiers:b,parentResourcesRequirements:y}),D={contentType:Sa.RESOURCE_OPERATION,resourceContext:E},O;if(Ix(w)){let e=Hm.resolveResourceUrl(h,w,ku(b),n.allResourceFieldIdentifiers,y);e?.resolvedUrl&&(O=e.resolvedUrl)}let k=Hm.generateStackEntryId();Fx(`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:Gt.CONTROLLER,transition:Mo.REPLACE}),t===ql.PRIMARY&&O&&a&&Lx(a,O,!0)}}function Yle(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 Xle(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 Zle={minLength:15,maxLength:128,requireUppercase:!1,requireLowercase:!1,requireNumbers:!1,requireSpecialChars:!1,expiryDays:0};function Gx(){let{auth:e,appConfig:t}=Su(),n=(0,Q.useContext)(ih),r=ui.loadEnvironmentConfig().frontendServiceName;return(0,Q.useMemo)(()=>{let i=Yle(r,t.frontendServices),a=Xle(r,n?.user?.userTypes,t.frontendServices)??i,o=(a?t.userTypes?.[a]:null)?.auth??null,s=o?.passwordPolicy??Zle,c=o?.registration,l=at.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&&de(l.data.mode,Ji.PUBLIC_SELF_SERVICE),additionalProfileQuestions:l.data.additionalProfileQuestions??[],profileNamesCollectedAt:xee(l.data)}:{mode:We.DISABLED,allowedMethods:[],frontendServiceAllowsRegistration:!1,publicRegistrationAvailable:!1,additionalProfileQuestions:[],profileNamesCollectedAt:Eu.REGISTRATION};return{resolvedUserType:a,userTypeAuth:o,globalAuth:e,passwordPolicy:s,registrationConfig:d}},[r,t,e,n?.user?.userTypes])}var Kx=(0,Q.createContext)(void 0),Qle=`wildo:appMode:`;function $le(e,t){return`${Qle}${e??`default`}:${t??`anon`}`}function eue(e){try{return localStorage.getItem(e)}catch{return null}}function tue(e,t){try{localStorage.setItem(e,t)}catch{}}function qx(e,t){if(e.length===0)return null;let n=new Set(e.map(e=>e.ref)),r=eue(t);if(r&&n.has(r))return r;let i=e.find(e=>e.isDefault);return i?i.ref:e[0].ref}var Jx=({children:e})=>{let{frontendConfiguration:t,appConfig:n}=Su(),{resolvedUserType:r}=Gx(),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)(()=>$le(n?.appIdentity?.appName,void 0),[n?.appIdentity?.appName]),[s,c]=(0,Q.useState)(()=>qx(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=qx(a,o);c(t)},[a,o]);let l=(0,Q.useCallback)(e=>{a.some(t=>t.ref===e)&&(c(e),tue(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)(Kx.Provider,{value:u,children:e})};function nue(){let e=(0,Q.useContext)(Kx);if(!e)throw Error(`useAppMode must be used within an AppModeProvider`);return e}function Yx(){return(0,Q.useContext)(Kx)??null}var rue=tl.getLogger(),iue=100,Xx;(function(e){e.PENDING=`pending`,e.HELD=`held`,e.NONE=`none`,e.UNKNOWN=`unknown`,e.STALE=`stale`})(Xx||={});function Zx(e){return e?e.state===Xx.HELD||(e.state===Xx.PENDING||e.state===Xx.STALE)&&e.previouslyHeld===!0:!1}var Qx=new Map,$x=new Set;function aue(e){return $x.add(e),()=>{$x.delete(e)}}function eS(){for(let e of $x)e()}function tS(e){let t=Qx.get(e);t&&t.state!==Xx.STALE&&(Qx.set(e,{state:Xx.STALE,previouslyHeld:Zx(t)}),eS())}function oue(e,t){return e?.find(e=>e.operationIdentifier===t&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===oe.API_CALL)}function sue(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 cue(e){let t=e;return t?.wildoError?.type===Mc.NOT_FOUND||t?.wildoError?.context?.httpStatus===404||t?.response?.status===404||t?.status===404}function lue(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 nS(e,t,n){let r=(0,Q.useContext)(sm),i=Zp(),a=(0,Q.useContext)(ea),o=i?.currentUserId??null,s=i?.currentOrganizationId??null,c=r?.registry,l=(0,Q.useMemo)(()=>oue(c?.resourceConfigurations[e.resourceType]?.operations,e.operation),[c,e.resourceType,e.operation]),u=c?.resourceConfigurations[Wo.ORGANIZATIONS]?.resourceFieldIdentifier,d=!!l&&Wm({...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)(aue,()=>f?Qx.get(f):void 0,()=>void 0);(0,Q.useEffect)(()=>{let t=f?Qx.get(f):void 0;if(!f||t&&t.state!==Xx.STALE||!l||!u||!s)return;let n=p.current;if(!n)return;let r={state:Xx.PENDING,previouslyHeld:Zx(t)};Qx.set(f,r),eS();let i=e=>{Qx.get(f)===r&&(Qx.set(f,{state:e}),eS())},a=no.buildOperationPathKeyFromOperation(l),o={[u]:s};(async()=>{try{if(e.operation===J.READ){let e=lue(await n(a,{contextualParameters:o},{silent:!0}));i(e&&m.current(e)?Xx.HELD:Xx.NONE);return}for(let e=1;;e+=1){let{rows:t,totalPages:r}=sue(await n(a,{contextualParameters:o,queryParameters:{page:e,limit:iue}},{silent:!0}));if(t.some(e=>m.current(e))){i(Xx.HELD);return}if(e>=r||t.length===0){i(Xx.NONE);return}}}catch(t){if(e.operation===J.READ&&cue(t)){i(Xx.NONE);return}rue.warn(`Could not read whether the organization holds this configuration`,{probe:e.key,organizationId:s,error:t}),i(Xx.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&&tS(e)},[f]),(0,Q.useEffect)(()=>{if(f)return a.on(hc.RESOURCE_OPERATION_EXECUTED,()=>tS(f),t=>t.resourceType===e.resourceType&&!oa(t.operation??{operationIdentifier:t.operationIdentifier}))},[a,f,e.resourceType]),Zx(h)}var uue={key:`scim-unrevoked-token`,resourceType:Wo.ORGANIZATION_SCIM_TOKENS,operation:J.LIST,matches:e=>e.isActive===!0};function due(e,t){return nS(uue,e,t)}function rS(){return iS(void 0)}function iS(e){let t=(0,Q.useContext)(ih)?.permissions??null,n=Zp()?.currentOrganizationId??null,r=ig(),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 aS(){let e=iS(void 0),t=(0,Q.useRef)(e);return t.current=e,(0,Q.useCallback)(e=>Wm(e,t.current),[])}function oS(){let e=(0,Q.useContext)(Vi)?.appConfig,t=e?.organizationRelationships,n=e?.organizationTypes,r=(0,Q.useContext)(ih)?.organizations,i=Zp()?.currentOrganizationId??null;return(0,Q.useMemo)(()=>({organizationRelationships:t,organizationTypes:n,organizations:r,currentOrganizationId:i}),[t,n,r,i])}function sS(){let e=oS();return(0,Q.useMemo)(()=>uv(e),[e])}function fue(){let e=oS();return(0,Q.useMemo)(()=>fv(e),[e])}function cS(){let e=(0,Q.useContext)(ih)?.organizations,t=Zp()?.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 pue(){let e=(0,Q.useContext)(Vi)?.appConfig?.organizationTypes,t=cS();return(0,Q.useMemo)(()=>gee(e,t),[e,t])}var mue={key:`sso-connection`,resourceType:Wo.ORGANIZATION_SSO_CONNECTIONS,operation:J.LIST,matches:()=>!0},lS=e=>Array.isArray(e)&&e.length>0,uS=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},hue={key:`sso-policy`,resourceType:Wo.ORGANIZATION_SSO_CONFIG,operation:J.READ,matches:e=>{let t=uS(e.enforcement),n=uS(e.domains),r=uS(e.emergencyAccess),i=uS(e.oauth2ProviderRestrictions);return t.requireSSO===!0||lS(n.verifiedDomains)||lS(n.ssoEnabledDomains)||lS(r.breakGlassAccounts)||lS(i.allowedProviders)||lS(i.blockedProviders)||i.requireEnterpriseSSOOnly===!0||lS(e.socialCredentialOverrides)}},gue={key:`siem-export-enabled`,resourceType:Wo.ORGANIZATION_SIEM_EXPORT_CONFIG,operation:J.READ,matches:e=>e.enabled===!0},_ue={key:`webhook-config-configured`,resourceType:Wo.ORGANIZATION_WEBHOOK_CONFIG,operation:J.READ,matches:e=>e.enabled===!0||lS(e.endpoints)},vue=e=>!1;function dS(){let e=Yx(),t=Zp(),n=rS(),r=(0,Q.useContext)(hh),i=r?.resolvedFeatures,a=r?.isFeatureOffered??vue,o=Lh(),s=!!r&&r.isLoading!==!0&&(t?.currentOrganizationId??null)===r.resolvedForOrganizationId,c=a(Uu.SINGLE_SIGN_ON),l=s&&!c,u=nS(mue,l,n),d=nS(hue,l,n),f=c||u||d,p=a(Uu.DIRECTORY_PROVISIONING),m=cS(),h=pue(),g=due(s&&mv({featureOffered:p,organizationTypeKnown:m!==void 0,organizationTypeDirectoryProvisioned:h}),n),_=(0,Q.useMemo)(()=>hv({featureOffered:p,organizationTypeDirectoryProvisioned:h,holdsUnrevokedToken:g}),[p,h,g]),v=a(Uu.SECURITY_EVENT_EXPORT),y=nS(gue,s&&!v,n),b=v||y,x=a(Uu.M2M_WEBHOOK_DELIVERY),S=nS(_ue,s&&!x,n),C=x||S,w=sS(),T=fue(),E=(0,Q.useContext)(Vi)?.appConfig?.decisionInbox,D=Object.keys((0,Q.useContext)(Vi)?.appConfig?.professionalQualificationKinds??{}).length>0,O=(0,Q.useMemo)(()=>Lv({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,[yv]:D}}),[e?.activeMode,e?.availableModes,t?.allScopeValues,n,i?.features,o?.isEnabled,f,_,b,C,w,T,O,D])}function fS(e,t){return(e?.requiredCapabilities??[]).every(e=>!!t.runtimeCapabilities[e])&&Im(e?.requiredRoles,t.effectiveRoles)}function pS(e,t){return e.flatMap(e=>fS(e.runtimeAvailability,t)?e.children?.length?[{...e,children:pS(e.children,t)}]:[e]:[])}function yue(e,t){return{...e,children:pS(e.children,t)}}function bue(e,t){if(!e?.length)return e;let n=[];for(let r of e)fS(r.runtimeAvailability,t)&&(r.contentKind===xc.NAVIGATION_LIST?n.push(yue(r,t)):n.push(r));return n}function xue(e,t){return mS(e,t)}function mS(e,t){return e?.length?e.filter(e=>fS(e.runtimeAvailability,t)):e}function Sue(e,t){return mS(e,t)}function Cue(e,t){return mS(e,t)}function wue(e,t){return mS(e,t)}function Tue(e,t){return mS(e,t)}function Eue(e,t){return mS(e,t)}var hS=tl.getLogger(),gS=new Set,_S=(0,Q.createContext)(null);function vS(){let{emit:e}=Uo(),{resourceRelationshipDepth:t,getZoneDepth:n,getZoneState:r,contentAreaWidth:i}=kx(),{navigationLayout:a,currentBreakpoint:o,compositeViews:s,fullCustomViews:c,flowsActorsViews:l}=Ng(),{user:u}=ng(),d=Zp(),{registry:f,getOperationContextNeeds:p}=fm(),m=ah(),h=aS(),g=(0,Q.useRef)(0),_=rg(),v=(0,Q.useRef)(Hm.buildBrowserUrl(_.pathname,_.search));v.current=Hm.buildBrowserUrl(_.pathname,_.search);let y=Nx(),b=(0,Q.useCallback)((t=ql.PRIMARY)=>{if(r(t).stack.length===0)return;if(t===Gn.OVERLAY){e(hc.NAVIGATION_POP,{zone:t});return}let n=Hm.resolveGoBackTarget({zone:t,currentBrowserUrl:v.current,getZoneState:r});n&&(e(hc.NAVIGATION_POP,{zone:t}),n.browserUrl&&Lx(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(Fx(`navigate() called`,{contentType:_.contentType,sourceZone:x.sourceZone,urlPath:S}),_.contentType===Sa.SETTINGS_HUB){m(S??za.settings);return}if(!a){Fx(`navigate() aborted: no navigationLayout`);return}let t=tm.extractPrimaryScopeFromContent(_,f,s,c,l),D=tm.buildInitiatorIds({userId:d?.currentUserId,organizationId:d?.currentOrganizationId,applicationId:d?.currentApplicationId,anonymousUserId:d?.currentAnonymousUserId}),O=tm.primaryScopeToContextIdentifiers(D,t),k=d?.buildContextResourceIdentifiers()??{},A=Hm.isResourceOperationContent(_)?_.resourceContext.contextResourceIdentifiers??{}:{},j={...O,...k,...A,...C},M={};for(let[e,t]of Object.entries(j)){let n=kn.getResourceId(t);if(n){M[e]=n;let r=kn.getFieldIdentifier(t);r&&(M[r]=n)}}let N=!1,P=Rx(_),F=P.operationSurface,I,L,R=_;if(Hm.isResourceOperationContent(_)){let e=_.resourceContext.operation;if(F===Si.API_ONLY){hS.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=Gse({initiatorInfos:e.initiatorInfos,targetResourceType:t,registry:f,ownIdentifiers:{...A,...C},tenancyIdentifiers:O,parentResourcesRequirements:_.resourceContext.parentResourcesRequirements}),i=Hm.resolveResourceUrl(r,e,M,f.allResourceFieldIdentifiers,n??_.resourceContext.parentResourcesRequirements,n!==void 0);i&&(i.templateUrl,I=i.routePathParameters,L=i.resolvedUrl)}N=Ix(e)&&!!(L??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){Fx(`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];R={..._,resourceContext:{..._.resourceContext,contextResourceIdentifiers:{...a,...C,...o?{[t]:o}:{},..._.resourceContext.contextResourceIdentifiers}}}}else if(_.contentType===Sa.COMPOSITE_VIEW||_.contentType===Sa.CHART_VIEW||_.contentType===Sa.FULL_CUSTOM_VIEW||_.contentType===Sa.EXECUTION_VIEW||_.contentType===Sa.FLOWS_ACTORS_VIEW){let e={..._.contextResourceIdentifiers??{},...C};R={..._,contextResourceIdentifiers:Object.keys(e).length>0?e:void 0}}else if(_.contentType===Sa.CUSTOM_COMPONENT){let e={...O,...k,..._.contextResourceIdentifiers??{},...C};R={..._,contextResourceIdentifiers:Object.keys(e).length>0?e:void 0}}x.sourceZone===`appLevel`&&(Kh(e,`app_level_navigation`),Fx(`APP_LEVEL clean break: cleared SECONDARY + COMPANION + OVERLAY`)),Hm.isResourceOperationContent(R)&&Hm.calculateResourceRelationshipDepth(R.resourceContext.parentResourcesRequirements);let z={},B={};for(let e of ud){let t=r(e).stack.length;B[e]=t,z[e]=t>0}let ee=x.sourceZone,te=P.operation,ne=P.effectiveOperation,V=P.resourceType,re=ee!==`appLevel`&&ee!==Gn.OVERLAY?ee:void 0,ie={sourceZone:ee,...P,relationshipTransition:w,relationshipMaxDepth:T,viewport:o,contentAreaWidth:i,zoneOccupancy:z,zoneDepth:B,focusedZone:re},ae=yh.resolve(ie,a),oe=ae.provenance.adjustments.includes(Aa.PERSISTENT_SPLIT_ESCALATED_NO_COMPANION);if(oe||ae.provenance.adjustments.includes(Aa.SPLIT_ESCALATED_NO_ADJACENT_ZONE)){let e=`${V??`view`}:${te}`;gS.has(e)||(gS.add(e),hS.warn(oe?"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:V,operation:te,decidedBy:ae.provenance.transitionSource,remedy:oe?"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(Fx(`Policy resolved`,{targetZone:ae.targetZone,transition:ae.transition,decidedBy:ae.provenance.transitionSource,authoredAs:ae.provenance.authoredTransition,adjustments:ae.provenance.adjustments,appearance:ae.appearance,collapsed:ae.collapsed,collapsedFromZone:ae.collapsedFromZone,ephemeral:ae.ephemeral,persistent:ae.persistent}),ae.transition===Mo.INPLACE){let e=Hm.isResourceOperationContent(R)?Due(R,ne):void 0;if(e&&y.isAvailable){Fx(`INPLACE resolved to the element-level host`,{kind:e.kind}),y.open(e);return}Fx(`INPLACE has no element-level host here — degrading to overlay`,{hasTarget:!!e,hostAvailable:y.isAvailable}),ae=yh.degradeInPlaceToOverlay(ie,a,ae)}ae.transition===Mo.PROMOTE&&(Kh(e,`promote_navigation`),Fx(`PROMOTE clean break: cleared SECONDARY + COMPANION + OVERLAY`)),x.sourceZone===Gn.OVERLAY&&ae.targetZone!==Gn.OVERLAY&&ae.transition!==Mo.PROMOTE&&(Use(e,`overlay_breakout_navigation`),Fx(`OVERLAY breakout: closed the overlay it was launched from`,{targetZone:ae.targetZone,transition:ae.transition})),(ae.targetZone===ql.SECONDARY||ae.targetZone===ql.COMPANION)&&Hm.isResourceOperationContent(R)&&Wx(R,ae.targetZone,f,M,e,m,r,{viewerMayPerform:h});let se=Hm.generateStackEntryId(),ce=L??S,le=ae.targetZone!==Gn.OVERLAY,ue=R.contentType===Sa.EXECUTION_VIEW&&Dp({viewRef:R.viewRef,registry:f})?.isAddressable===!0,de=R.contentType===Sa.COMPOSITE_VIEW||R.contentType===Sa.CHART_VIEW||R.contentType===Sa.FULL_CUSTOM_VIEW||ue||R.contentType===Sa.FLOWS_ACTORS_VIEW||R.contentType===Sa.ENGINE_PAGE,fe=le&&!!ce&&(N||de),pe=fe?R.contentType===Sa.COMPOSITE_VIEW?kp(R.viewRef,R.contextResourceIdentifiers):R.contentType===Sa.CHART_VIEW?Vp(R.viewRef,R.contextResourceIdentifiers,R.urlParamValues):R.contentType===Sa.EXECUTION_VIEW?Lp(R.viewRef,R.contextResourceIdentifiers):ce:void 0,me=Hm.getTopEntry(r(ql.PRIMARY)),he=ae.targetZone===ql.SECONDARY&&fe&&pe!==void 0&&Hm.hostedPaneApplies({paneContent:R,primaryTop:me}),ge={zone:ae.targetZone,content:R,urlPath:pe,stackEntryId:se,initiator:x,navigationSource:Gt.CONTROLLER,transition:ae.transition,appearance:ae.appearance,overlayBehavior:ae.overlayBehavior,ephemeral:ae.ephemeral,persistent:ae.persistent,...he?{hostedPane:!0}:{},...ae.collapsedFromZone?{collapsedFromZone:ae.collapsedFromZone}:{}},_e=ae.targetZone===Gn.OVERLAY&&x.sourceZone===Gn.OVERLAY,ve=ae.transition===Mo.PUSH||_e,ye=le?r(ae.targetZone):void 0,be=ye&&ye.activeTabId===void 0?ye.stack[ye.stack.length-2]:void 0;if(ae.transition===Mo.PUSH&&pe!==void 0&&be?.urlPath&&Hm.urlsAddressSameDestination(be.urlPath,pe)){Fx(`PUSH names the entry beneath — going back instead`,{zone:ae.targetZone,finalUrlPath:pe}),b(ae.targetZone);return}Fx(`Emitting navigation event`,{event:ve?`PUSH`:`REPLACE`,zone:ae.targetZone,finalUrlPath:pe,hostedPane:he,stacksOnOverlay:_e}),Ih(()=>{if(e(ve?hc.NAVIGATION_PUSH:hc.NAVIGATION_REPLACE,ge),fe&&pe){let e=E===!0||ae.transition===Mo.REPLACE||ae.transition===Mo.PROMOTE,t=he||ae.targetZone===ql.COMPANION?Hm.resolveBrowserUrlForZoneEntry({zone:ae.targetZone,entryUrlPath:pe,paneContent:R,currentBrowserUrl:v.current,getZoneState:r})??pe:pe;Lx(m,t,e)}},{zone:ae.targetZone})}catch(e){hS.error(`useNavigationController navigation failed`,{error:e,requestId:n,sourceZone:x.sourceZone,contentType:_.contentType,urlPath:S,resourceType:Hm.isResourceOperationContent(_)?_.resourceContext.resourceType:void 0,operationIdentifier:Hm.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:Sa.RESOURCE_OPERATION,resourceContext:e};x({content:i,initiator:t,urlPath:n,relationshipTransition:r})},[x]),C=(0,Q.useCallback)(()=>{let t=Hm.getTopEntry(r(Gn.OVERLAY));t&&e(hc.NAVIGATION_CLOSE,{zone:Gn.OVERLAY,stackEntryId:t.id})},[e,r]),w=(0,Q.useCallback)(t=>{if(t===ql.PRIMARY||r(t).stack.length===0)return;let n=Hm.resolveZoneDismissUrl({zone:t,currentBrowserUrl:v.current,getZoneState:r});e(hc.NAVIGATION_CLEAR_ZONE,{zone:t}),n&&Lx(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 Due(e,t){let n=e.resourceContext,r=n.operation;if(!r)return;if(t===J.CREATE||t===J.CREATE_MANY)return{kind:Ax.CREATE,operation:r,resourceContext:n};let i=kn.getAddressedRecordId(n);return i?{kind:Ax.ELEMENT,elementId:i,operation:r,resourceContext:n}:void 0}function yS(){let e=(0,Q.useContext)(_S),t=vS();return e??t}function bS(){let{registry:e}=fm(),{navigateToResource:t}=yS(),n=(0,Q.useCallback)(n=>{let{resourceType:r,resourceId:i,contextResourceIdentifiers:a={},sourceZone:o=ql.PRIMARY}=n;if(!i)return!1;let s=e.resourceConfigurations[r];if(!s)return!1;let c=kn.buildRecordIdentifiersFromCollection(a,r,i),l=Oue(s,e,c);return l?(t(kn.createFrontendResourceOperationContextFromOperation({resourceType:r,operation:l,contextResourceIdentifiers:c}),{sourceZone:o,sourceOperation:J.READ}),!0):!1},[e,t]);return(0,Q.useMemo)(()=>({navigateToResourceRead:n}),[n])}function Oue(e,t,n){let r=r=>fh({resourceConfig:e,operations:e?.operations??[],coreOperation:J.READ,registry:t,hasResourceId:!0,requireFrontendAddressable:r,contextResourceIdentifiers:n,contextualParameters:U.buildContextualParameters(n,t)}),i=r(!0);if(i)return i;let a=r(!1);return a?.operationFrontendConfig?.surface===Si.EMBEDDED?a:void 0}function xS(e,t){let n=e.filterFields;return n&&Object.keys(n).length>0||vl(e)!==J.LIST?n:t.find(e=>String(e.operationIdentifier)===J.SEARCH&&e.isOperationDefault===!0)?.filterFields}function kue(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 Aue(e){let{collectionDisplayConfig:t,operation:n,resourceOperations:r}=e;if(!t)return;let{displayMode:i,userSwitchableDisplayMode:a,board:o}=t;if(i===vs.BOARD&&!o)return`displayMode BOARD requires collectionDisplayConfig.board: { groupByField } naming the enum field its columns come from`;if(!o)return;if(i!==vs.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=xS(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&&!kue(r,o.transitionOperation))return`board.transitionOperation ${JSON.stringify(o.transitionOperation)} names no operation this resource's frontend registry holds`}var jue=[{mode:vs.CALENDAR,configKey:`calendar`,shape:`{ dateField }`,fields:e=>e.calendar?[[`calendar.dateField`,e.calendar.dateField]]:void 0},{mode:vs.TIMELINE,configKey:`timeline`,shape:`{ startField, endField }`,fields:e=>e.timeline?[[`timeline.startField`,e.timeline.startField],[`timeline.endField`,e.timeline.endField]]:void 0}];function Mue(e){let{collectionDisplayConfig:t,operation:n,resourceOperations:r}=e;if(!t)return;let{displayMode:i,userSwitchableDisplayMode:a}=t;for(let e of jue){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===vs.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=xS(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 SS(e){return e?._zod?.def?.type===`object`}function CS(e,t){let n=t[so]??{},r=e[so]??{};return Object.fromEntries(Object.entries(n).filter(([e,t])=>r[e]!==t))}function wS(e,t){let n=su(e,[]);return n[so]={...n[so]??{},...t},n}function TS(e,t,n,r={}){if(n===t)return e;if(!SS(e)||!SS(t)||!SS(n))return n;let i=rs(e),a=rs(t),o=rs(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=CS(n,t);Object.keys(o).length>0&&(s[e]=wS(r,o))}let c=Object.keys(s).length===0?e:hs(e,s);if(r.objectLevel){let r=CS(t,n);if(Object.keys(r).length>0){if(c===e)c=wS(e,r);else{let e=c;e[so]={...e[so]??{},...r}}}}return c}function Nue(e,t){try{let n=rs(e),r=rs(t);return Object.entries(n).some(([e,t])=>{let n=r[e];return n?t===n||li(t)===n:!1})}catch{return!1}}function ES(e,t,n){if(!e)return;let r=_r.getObjectLikeFieldShape(e,{commonOnly:!1}),i=_r.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=xu(r);if(Object.keys(a).length===0)continue;let o=xu(t);Object.keys(a).some(e=>!(e in o)||o[e]!==a[e])&&(t[so]={...o,...a})}}var Pue=[Al.IS_FOREIGN_KEY,Al.FOREIGN_KEY_UI];function Fue(e,t){if(!e||!t)return e;let n=_r.getObjectLikeFieldShape(e,{commonOnly:!1}),r=_r.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||!wu(n)||wu(t)||Zl(t)===jr.ARRAY!=(Zl(n)===jr.ARRAY))continue;let a=xu(n),o={};for(let e of Pue)e in a&&(o[e]=a[e]);let s=su(t,[]);s[so]={...xu(t),...o},i.set(t,s)}return i.size===0?e:Iue(e,i)}function Iue(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=ts(e,i);return r.delete(e),n.set(e,s),s};return i(e)}function Lue(e){let t=wae.get(e)?.[on];return typeof t==`string`?t:void 0}function Rue(e,t,n){let r=new Map,i=new Map,a=new Map,o=(e,t)=>{let s=Lue(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=ts(e,e=>o(e,s));return d.delete(e),l.set(e,f),f};return o(e,t)}function DS(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))DS(e[r],t[r],n);return}for(let e of[`innerType`,`element`,`valueType`,`in`,`out`])DS(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)=>DS(e,o[t],n))}function OS(e,t){if(e===void 0)return;let n=!1,r=e.inheritedSchemas.map(e=>{let r=t(e.schema),i=OS(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 kS(e,t,n){for(let t of Object.values(rs(e)??{}))n.add(t);for(let e of t?.inheritedSchemas??[])kS(e.schema,e.inheritenceSchemaDefinition,n)}function zue(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:OS(e,e=>r(e)?TS(e,t,n):e)}var AS=class{httpClient;registry=null;isInitialized=!1;declaredFieldInstancesByResource=new Map;presentationSubstitutionsByResource=new Map;resourcesHttpClient=null;constructor(e){this.httpClient=e}buildConfigurationError(e,t){let n=Ou.buildWildoError_Frontend(Mc.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,...Fe},s=[...n||[],...Pte],c=P_(s);if(c.length>0)throw this.buildConfigurationError(Lu.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=wo.ensureCompiledRelationships.call(wo,s,o),u=[...r??[]].filter(e=>Ju.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=>!Ju.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={};fo&&Object.keys(fo).length>0&&Object.entries(fo).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);Sre(h,l,o),Ii.rebuildResourceConfigurationsOperationDtos(h),this.overlayUiBehaviorDtoDecorators(h,i),this.substitutePresentationIntoCustomDtos(h),this.carryReferenceIdentityOntoCustomRequestDtos(h);let g=wo.buildFieldIdentifierToResourceTypeMap({allResourceFieldIdentifiers:o,allResourceRelationships:l,getMainSchema:e=>h[e]?.mainSchema,fieldIdentifierPriority:Qie,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.`)}}),_=wo.buildManyToManyScopeJunctionMap(l,o);this.registry={allResourceFieldIdentifiers:o,fieldIdentifierToResourceType:g,manyToManyScopeJunctions:_,notificationBadgeDefinitions:[...A_,...a??[]],additionalUserNotificationDefinitions:[],resourceRelationships:l,resourceConfigurations:h,subtreeMap:L_(l)},this.generateUrlsForApiCallOperations(h,o),this.resourcesHttpClient=new Dx(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(Lu.CONFIGURATION,{message:`Failed to initialize frontend resources: ${Qu(e)}`})}}normalizeResourceConfigurationRelationships(e,t){for(let n of Object.values(e))n.resourceRelationships={parentRelationships:wo.ensureCompiledRelationships.call(wo,n.resourceRelationships.parentRelationships,t),childRelationships:wo.ensureCompiledRelationships.call(wo,n.resourceRelationships.childRelationships,t),selfRelationships:wo.ensureCompiledRelationships.call(wo,n.resourceRelationships.selfRelationships,t)}}carryReferenceIdentityOntoCustomRequestDtos(e){for(let t of Object.values(e))for(let e of t.operations??[])e.hasCustomRequestDto&&(e.requestDto=Fue(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;DS(r,n.mainSchema,o);let s=(e,t)=>{e?.inheritedSchemas.forEach((e,n)=>{let r=t?.inheritedSchemas[n];DS(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]=Rue(i,t,this.presentationSubstitutionsByResource))}}}overlayUiBehaviorDtoDecorators(e,t){if(t)for(let[n,r]of Object.entries(t)){let t=r[Du];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||(ES(e.responseDto,t,i),ES(e.contextDto,t,i)),e.hasCustomRequestDto||ES(e.requestDto,t,i),ES(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===oe.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[Du],d=new Set;if(kS(n.mainSchema,n.inheritenceSchemaDefinition,d),this.declaredFieldInstancesByResource.set(e,d),u&&u!==n.mainSchema){let t=n.mainSchema,r=TS(t,i[Oe]??t,u,{objectLevel:!0});if(this.presentSchemas(e,n,{mainSchema:r,inheritenceSchemaDefinition:zue(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===J.CREATE||n===J.UPDATE)&&!e.hasCustomRequestDto&&Nue(e.requestDto,t)&&(e.requestDto=kee(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??rn.ORGANIZATIONS,s),p=this.buildResourceExecutionViewDefinitions(n.resourcePrimaryScope??rn.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?Si.EMBEDDED:Si.API_ONLY)};continue}if(n.operationFrontendConfig.surface===Si.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=Aue({collectionDisplayConfig:n.operationFrontendConfig.collectionDisplayConfig,operation:n,resourceOperations:t.operations});if(r)throw Error(`[ResourcesRegistry] Operation "${String(n.operationIdentifier)}" on resource "${e}": ${r}.`);let i=Mue({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:pp(e,n),scope:em.RESOURCE,isAddressable:!0,operationLike:r.operationLike??J.READ,primaryScope:t,sectionRefs:r.sectionRefs,viewComponent:r.viewComponent,icon:r.icon,...r.conversationSystemRef?{conversationSystemRef:r.conversationSystemRef}:{}})):[]}buildResourceExecutionViewDefinitions(e,t){return t?Object.entries(t).map(([t,n])=>({ref:t,scope:em.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!==cte.STANDALONE);e.length>0&&(n.length=0,n.push(...e))}if(i.foreignKeyField&&n.length>0){let e=n.filter(({rel:e})=>wo.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier===i.foreignKeyField);n.length=0,n.push(...e)}if(n.length===0){if(ui.isDevelopment()){let n=[...t.childRelationships.map(e=>`${e.resourceType2} (FK: ${wo.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier??`unresolved`})`),...t.parentRelationships.map(e=>`${e.resourceType1} (FK: ${wo.tryResolveRelationshipForeignKeyIdentity(e,r)?.fieldIdentifier??`unresolved`})`),...t.selfRelationships.map(e=>`${e.resourceType1} (FK: ${wo.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(ui.isDevelopment()){let t=n.map(({rel:e})=>wo.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&&ui.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&&=Ure.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=wo.tryResolveRelationshipForeignKeyIdentity(r,n)?.fieldIdentifier;if(!i)continue;let a=r.display?.inChildView?.parentDisplay??iu.CONTEXT,o,s;switch(a){case iu.CONTEXT:o=ma.LABEL,s=!0;break;case iu.BREADCRUMB:o=ma.LABEL,s=!1;break;case iu.BADGE:o=ma.LABEL,s=!1;break;case iu.SUMMARY:o=ma.SUMMARY,s=!0;break;case iu.NONE:o=ma.ID,s=!1;break;default:o=ma.LABEL,s=!0}let c={display:{mode:o,linkable:s}},l=e=>{let t=rs(e)?.[i];if(!t||!wu(t)||xu(t)[Al.FOREIGN_KEY_UI]!==void 0)return e;let n=su(t,[{ref:Al.FOREIGN_KEY_UI,params:c}]);return hs(e,{[i]:n})};this.presentSchemas(e,t,{mainSchema:l(t.mainSchema),inheritenceSchemaDefinition:OS(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(Lu.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{Tl.updateOperationUrls(r,t)}catch(e){console.error(`Failed to generate URLs for resource type ${n}:`,e)}}getResourcesRegistry(){if(!this.isInitialized)throw this.buildConfigurationError(Lu.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(Lu.FRONTEND_RESOURCES_NOT_INITIALIZED,{method:`getResourcesHttpClient`});return this.resourcesHttpClient}getApplicationHttpClient(){return this.httpClient}validateForeignKeyResolution(e,t){let n=wo.collectUnresolvableForeignKeyFields({mainSchemasByResourceType:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.mainSchema])),variantSchemasByResourceType:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Rs(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),ui.isDevelopment())throw this.buildConfigurationError(Lu.FRONTEND_FK_RESOLUTION_FAILED,{unresolvedFKFields:n,message:t})}}validateFileDisplayPolicyCoherence(e){let t=[];for(let[n,r]of Object.entries(e)){let e=[r.mainSchema,...Rs(r.inheritenceSchemaDefinition)].flatMap(e=>Object.entries(rs(e)??{})),i=new Set;for(let[r,a]of e){if(i.has(r))continue;let e=a,o=_c(e);if(!o?.nature)continue;let s=Jr(e);if(!s)continue;let c=s.presentation!==void 0&&s.presentation!==bn.CARD,l=s.activation?.policy===Xr.OVERLAY;(c||l)&>e(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),ui.isDevelopment())throw this.buildConfigurationError(Lu.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 Fh({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(Lu.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 jS(e){return no.createOperationPathKeyFromOperation(e)}function MS(e){let t=e?.requiredFeatures;return t?Array.isArray(t)||!t.appliesWhen:!1}function NS(e){return!!(e.enabledCondition||e.requiredFeatures)}function PS(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 FS(e){let{operation:t,currentObject:n,inputDto:r,objectContext:i,resourceType:a,enabled:o=!0}=e,{getResourcesRegistry:s,doOperation:c}=fm(),{user:l,permissions:u}=ng(),d=Zp(),f=Lh(),p=s(),{resolvedFeatures:m,resolvedFeaturesResponse:h,featureDefinitions:g,unavailabilityPolicy:_,isLoading:v}=vh(),y=(0,Q.useMemo)(()=>Qp(t),[t]),b=PS(l?._id,d?.primaryScopeValues?.organizationId,d?.primaryScopeValues?.applicationId),x=(0,Q.useMemo)(()=>{if(v)return MS(t)?{isAvailable:!1,behavior:js.DISABLE}:void 0;let e=Oh(u,d?.currentOrganizationId??null);return Wh(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)(()=>!NS(t)),[w,T]=(0,Q.useState)(()=>NS(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),xm({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 Bue(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 IS(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(`,`)||!Bue(r.featureAvailability,e.featureAvailability))return!1}return!0}function LS(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}=fm(),{user:f,permissions:p}=ng(),m=Zp(),h=Lh(),g=u(),{resolvedFeatures:_,resolvedFeaturesResponse:v,featureDefinitions:y,unavailabilityPolicy:b,isLoading:x}=vh(),S=PS(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(jS(e),{isEnabled:!0})}),w(e=>IS(e,t)?e:t);return}if(!e.length||!a){w(e=>e.size===0?e:new Map);return}let t=!1,c=Oh(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=jS(e),c=x?MS(e)?{isAvailable:!1,behavior:js.DISABLE}:void 0:Wh(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(Qp(e).needsUserContext&&!f)o.set(t,{isEnabled:!1,featureAvailability:c});else try{let u=t=>xm({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:Pee(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=>IS(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 RS(e,t,n){let r=e(t,n,`title`);return r&&!r.startsWith(`resources.`)?r:n}function Vue(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=Tl.buildOperationFrontendRoutePaths(n,r,t.allResourceFieldIdentifiers);if(e.length===0)return null;let i=kn.selectMatchingRoutePath(e,a,n.resourceIdentifier,n.resourceFieldIdentifier,s,t.allResourceFieldIdentifiers),f=Hm.resolveUrlPath(i.url,o);if(Hm.hasUnresolvedPlaceholders(f))return null;let p=new URLSearchParams;p.set(xre,l),p.set(M,u);for(let[e,t]of Object.entries(d??{}))t!==void 0&&t!==``&&e!==`format`&&e!==`rowScope`&&zS(p,e,t);return`${c}${Ir}${f}?${p.toString()}`}catch{return null}}function zS(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))zS(e,`${t}[${r}]`,i);else e.append(t,String(n))}}async function Hue(e){My(await e.getBlob(e.url),pre(String(e.resourceType),e.format,new Date))}function BS(e,t){if(!e)return[];let n=_r.getObjectLikeFieldShape(e,{commonOnly:!1});if(!n)return[];let r=[];for(let[e,i]of Object.entries(n))Qee(i)&&t[e]&&r.push({fieldName:e,value:t[e],schema:i});return r}var VS;(function(e){e.PANEL=`panel`,e.LIST=`list`})(VS||={});function HS(e){return e.type===`separator`?!1:e.type===`subgroup`?e.disabled===!0:e.disabled===!0||e.unavailability!==void 0}function US(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=>!HS(e)),...i.filter(HS)].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 WS({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_ACTION_BAR,`ActionBar`)(e);return(0,$.jsx)(n,{...t})}var GS=(0,Q.createContext)(!1);function KS({children:e}){return(0,$.jsx)(GS.Provider,{value:!0,children:e})}function qS(){return(0,Q.useContext)(GS)}function Uue(e,t,n,r){return U.buildConfigurationError(Lu.CONFIGURATION,{component:e,message:`${e}() requires a ${t}-like operation host, but received "${n}" for operation "${r}".`,expectedKind:t,actualKind:n,operationIdentifier:r})}function Wue(e){let t=e?.currentObject??e?.resource;return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}function JS(e,t,n){if(!n)return e;let r=e[t];if(kn.getResourceId(r)===n)return e;let i=r?kn.getFieldIdentifier(r):void 0;return{...e,[t]:i?{fieldIdentifier:i,resourceId:n}:n}}function YS({resourceContext:e,navigationZone:t,navigationInitiator:n,updateLikeMutationFallbackMode:r}){let{registry:i,doOperation:a}=fm(),{navigateToResource:o,goBack:s}=yS(),{handleError:c}=$f(),{resourceType:l,operation:u}=e,d=r??eo(u,i.resourceConfigurations[l]?.operations),f=String(u.operationIdentifier),p=(0,Q.useMemo)(()=>i.resourceConfigurations[l],[i,l]),m=(0,Q.useMemo)(()=>vl(u),[u]),h=(0,Q.useMemo)(()=>Eie(u),[u]),g=(0,Q.useMemo)(()=>Hm.createOperationInitiator(t,u),[t,u]),_=(0,Q.useMemo)(()=>Wue(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)(()=>JS(e.contextResourceIdentifiers,l,v),[v,e.contextResourceIdentifiers,l]),b=(0,Q.useMemo)(()=>({...e,contextResourceIdentifiers:y}),[y,e]),x=(0,Q.useMemo)(()=>U.buildContextualParameters(y,i),[y,i]),S=(0,Q.useCallback)(e=>!!kn.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(el(u)&&!Vn(d))throw new ir({surfaceName:`useResourceOperationSurface.executeCurrentOperation()`,resourceType:l,operationIdentifier:f});let t=no.createOperationPathKeyFromOperation(u),n=sc({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===J.READ||e===J.UPDATE||e===J.DELETE?fh({resourceConfig:p,operations:p.operations??[],coreOperation:e,registry:i,hasResourceId:S(y),allowBulk:t?.allowBulk,requireFrontendAddressable:!0,contextResourceIdentifiers:y,contextualParameters:x}):Gl(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=JS(t,l,v),c=U.buildContextualParameters(s,i);if(Nm({operation:e,resourceType:l,resourceConfig:p})&&e.isBulkOperation!==!0&&!Bh({resourceConfig:p,operation:e,registry:i,hasResourceId:S(s),contextResourceIdentifiers:s,contextualParameters:c}))return!1;let u=kn.createFrontendResourceOperationContextFromOperation({resourceType:l,operation:e,contextResourceIdentifiers:s,parentResourcesRequirements:n}),d=Tl.buildOperationFrontendRoutePaths(p,e,i.allResourceFieldIdentifiers),f=d.length>0?kn.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=JS(e?.contextResourceIdentifiers??b.contextResourceIdentifiers,l,v),n=e?.parentResourcesRequirements??b.parentResourcesRequirements,r=U.buildContextualParameters(t,i),a=fh({resourceConfig:p,operations:p.operations??[],coreOperation:J.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 XS(e,t,n){let r=YS(e),i=Ms(r.operation);if(i!==t)throw Uue(n,t,i,r.operationId);return r}function Gue(e){return XS(e,`read`,`useReadOperationSurface`)}function Kue(e){return XS(e,`list`,`useListOperationSurface`)}function que(e){return XS(e,`create`,`useCreateOperationSurface`)}function Jue(e){return XS(e,`update`,`useUpdateOperationSurface`)}function ZS(e){return XS(e,`search`,`useSearchOperationSurface`)}function QS(e){return XS(e,`action`,`useActionOperationSurface`)}var $S=(0,Q.createContext)(null);function eC(){let e=(0,Q.useContext)($S);if(!e)throw Error(`useResourceOperationViewContext() must be used within a <ResourceOperationViewProvider>. This is provided automatically for routed resource operation layouts.`);return e}function tC(){return(0,Q.useContext)($S)}function nC({resourceContext:e,navigationZone:t,navigationInitiator:n,inlineParentContext:r,children:i}){let a=YS({resourceContext:e,navigationZone:t,navigationInitiator:n}),o=(0,Q.useMemo)(()=>({...a,inlineParentContext:r}),[r,a]);return(0,$.jsx)($S.Provider,{value:o,children:i})}var rC=e(Kte(),1),iC=e=>e.type===`checkbox`,aC=e=>e instanceof Date,oC=e=>e==null,sC=e=>typeof e==`object`,cC=e=>!oC(e)&&!Array.isArray(e)&&sC(e)&&!aC(e),lC=e=>cC(e)&&e.target?iC(e.target)?e.target.checked:e.target.value:e,Yue=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,uC=(e,t)=>e.has(Yue(t)),Xue=e=>{let t=e.constructor&&e.constructor.prototype;return cC(t)&&t.hasOwnProperty(`isPrototypeOf`)},dC=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function fC(e){if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(dC&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&!(cC(e)&&Xue(e)))return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=fC(e[t]));return r}var pC=e=>/^\w*$/.test(e),mC=e=>e===void 0,hC=e=>Array.isArray(e)?e.filter(Boolean):[],gC=e=>hC(e.replace(/["|']|\]/g,``).split(/\.|\[/)),_C=(e,t,n)=>{if(!t||!cC(e))return n;let r=(pC(t)?[t]:gC(t)).reduce((e,t)=>oC(e)?e:e[t],e);return mC(r)||r===e?mC(e[t])?n:e[t]:r},vC=e=>typeof e==`boolean`,yC=e=>typeof e==`function`,bC=(e,t,n)=>{let r=-1,i=pC(t)?[t]:gC(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=cC(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(t===`__proto__`||t===`constructor`||t===`prototype`)return;e[t]=a,e=e[t]}},xC={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`},SC={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},CC={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},wC=Q.createContext(null);wC.displayName=`HookFormControlContext`;var TC=()=>Q.useContext(wC),EC=(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]!==SC.all&&(t._proxyFormState[i]=!r||SC.all),n&&(n[i]=!0),e[i]}});return i},DC=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function OC(e){let t=TC(),{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 DC(()=>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(()=>EC(o,n,c.current,!1),[o,n])}var kC=e=>typeof e==`string`,AC=(e,t,n,r,i)=>kC(e)?(r&&t.watch.add(e),_C(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),_C(n,e))):(r&&(t.watchAll=!0),n),jC=e=>oC(e)||!sC(e);function MC(e,t,n=new WeakSet){if(jC(e)||jC(t))return Object.is(e,t);if(aC(e)&&aC(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(aC(r)&&aC(e)||cC(r)&&cC(e)||Array.isArray(r)&&Array.isArray(e)?!MC(r,e,n):!Object.is(r,e))return!1}}return!0}function NC(e){let t=TC(),{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=AC(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=AC(r,n._names,e||n._formValues,!1,c.current);if(l.current){let e=l.current(t);MC(e,u.current)||(m(e),u.current=e)}else m(t)}},[n._formValues,n._names,a,r]);DC(()=>(d.current===n&&MC(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=!_&&!MC(v,r);return _||e?h():null},[a,_,r,v,h]);return y===null?p:y}function PC(e){let t=TC(),{name:n,disabled:r,control:i=t,shouldUnregister:a,defaultValue:o,exact:s=!0}=e,c=uC(i._names.array,n),l=NC({control:i,name:n,defaultValue:Q.useMemo(()=>_C(i._formValues,n,_C(i._defaultValues,n,o)),[i,n,o]),exact:s}),u=OC({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,...vC(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;let m=Q.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!_C(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!_C(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!_C(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!_C(u.validatingFields,n)},error:{enumerable:!0,get:()=>_C(u.errors,n)}}),[u,n]),h=Q.useCallback(e=>p.current.onChange({target:{value:lC(e),name:n},type:xC.CHANGE}),[n]),g=Q.useCallback(()=>p.current.onBlur({target:{value:_C(i._formValues,n),name:n},type:xC.BLUR}),[n,i._formValues]),_=Q.useCallback(e=>{let t=_C(i._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>yC(e.focus)&&e.focus(),select:()=>yC(e.select)&&e.select(),setCustomValidity:t=>yC(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>yC(e.reportValidity)&&e.reportValidity()})},[i._fields,n]),v=Q.useMemo(()=>({name:n,value:l,...vC(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,...vC(d.current.disabled)?{disabled:d.current.disabled}:{}});let r=(e,t)=>{let n=_C(i._fields,e);n&&n._f&&(n._f.mount=t)};if(r(n,!0),e){let e=fC(_C(i._options.defaultValues,n,d.current.defaultValue));bC(i._defaultValues,n,e),mC(_C(i._formValues,n))&&bC(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 FC=e=>e.render(PC(e)),IC=Q.createContext(null);IC.displayName=`HookFormContext`;var LC=()=>Q.useContext(IC),RC=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(IC.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(wC.Provider,{value:m},t))},zC=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},BC=e=>Array.isArray(e)?e:[e],VC=()=>{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 HC(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&cC(i)&&a){let e=HC(i,a);cC(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var UC=e=>cC(e)&&!Object.keys(e).length,WC=e=>e.type===`file`,GC=e=>{if(!dC)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},KC=e=>e.type===`select-multiple`,qC=e=>e.type===`radio`,Zue=e=>qC(e)||iC(e),JC=e=>GC(e)&&e.isConnected;function Que(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;)e=mC(e)?r++:e[t[r++]];return e}function $ue(e){for(let t in e)if(e.hasOwnProperty(t)&&!mC(e[t]))return!1;return!0}function YC(e,t){let n=Array.isArray(t)?t:pC(t)?[t]:gC(t),r=n.length===1?e:Que(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(cC(r)&&UC(r)||Array.isArray(r)&&$ue(r))&&YC(e,n.slice(0,-1)),e}var ede=e=>{for(let t in e)if(yC(e[t]))return!0;return!1};function XC(e){return Array.isArray(e)||cC(e)&&!ede(e)}function ZC(e,t={}){for(let n in e){let r=e[n];XC(r)?(t[n]=Array.isArray(r)?[]:{},ZC(r,t[n])):mC(r)||(t[n]=!0)}return t}function QC(e,t,n){n||=ZC(t);for(let r in e){let i=e[r];if(XC(i))mC(t)||jC(n[r])?n[r]=ZC(i,Array.isArray(i)?[]:{}):QC(i,oC(t)?{}:t[r],n[r]);else{let e=t[r];n[r]=!MC(i,e)}}return n}var $C={value:!1,isValid:!1},ew={value:!0,isValid:!0},tw=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&&!mC(e[0].attributes.value)?mC(e[0].value)||e[0].value===``?ew:{value:e[0].value,isValid:!0}:ew:$C}return $C},nw=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>mC(e)?e:t?e===``?NaN:e&&+e:n&&kC(e)?new Date(e):r?r(e):e,rw={isValid:!1,value:null},iw=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,rw):rw;function aw(e){let t=e.ref;return WC(t)?t.files:qC(t)?iw(e.refs).value:KC(t)?[...t.selectedOptions].map(({value:e})=>e):iC(t)?tw(e.refs).value:nw(mC(t.value)?e.ref.value:t.value,e)}var tde=(e,t,n,r)=>{let i={};for(let n of e){let e=_C(t,n);e&&bC(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},ow=e=>e instanceof RegExp,sw=e=>mC(e)?e:ow(e)?e.source:cC(e)?ow(e.value)?e.value.source:e.value:e,cw=e=>({isOnSubmit:!e||e===SC.onSubmit,isOnBlur:e===SC.onBlur,isOnChange:e===SC.onChange,isOnAll:e===SC.all,isOnTouch:e===SC.onTouched}),lw=`AsyncFunction`,nde=e=>!!e&&!!e.validate&&!!(yC(e.validate)&&e.validate.constructor.name===lw||cC(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===lw)),rde=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),uw=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),dw=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=_C(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(dw(a,t))break}else if(cC(a)&&dw(a,t))break}}};function fw(e,t,n){let r=_C(e,n);if(r||pC(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=_C(t,r),o=_C(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 ide=(e,t,n,r)=>{n(e);let{name:i,...a}=e;return UC(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||SC.all))},ade=(e,t,n)=>!e||!t||e===t||BC(e).some(e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e))),ode=(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,sde=(e,t)=>!hC(_C(e,t)).length&&YC(e,t),pw=(e,t,n)=>{let r=BC(_C(e,n));return bC(r,`root`,t[n]),bC(e,n,r),e};function mw(e,t,n=`validate`){if(kC(e)||Array.isArray(e)&&e.every(kC)||vC(e)&&!e)return{type:n,message:kC(e)?e:``,ref:t}}var hw=e=>cC(e)&&!ow(e)?e:{value:e,message:``},gw=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=_C(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{i&&y.reportValidity&&(y.setCustomValidity(vC(e)?``:e||``),y.reportValidity())},x={},S=qC(o),C=iC(o),w=S||C,T=(g||WC(o))&&mC(o.value)&&mC(v)||GC(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length,E=zC.bind(null,h,r,x),D=(e,t,n,r=CC.maxLength,i=CC.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||oC(v))||vC(v)&&!v||C&&!tw(s).isValid||S&&!iw(s).isValid)){let{value:e,message:t}=kC(c)?{value:!!c,message:c}:hw(c);if(e&&(x[h]={type:CC.required,message:t,ref:y,...E(CC.required,t)},!r))return b(t),x}if(!T&&(!oC(d)||!oC(f))){let e,t,n=hw(f),i=hw(d);if(!oC(v)&&!isNaN(v)){let r=o.valueAsNumber||v&&+v;oC(n.value)||(e=r>n.value),oC(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`;kC(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),kC(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,CC.max,CC.min),!r))return b(x[h].message),x}if((l||u)&&!T&&(kC(v)||a&&Array.isArray(v))){let e=hw(l),t=hw(u),n=!oC(e.value)&&v.length>+e.value,i=!oC(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&&kC(v)){let{value:e,message:t}=hw(p);if(ow(e)&&!v.match(e)&&(x[h]={type:CC.pattern,message:t,ref:o,...E(CC.pattern,t)},!r))return b(t),x}if(m){if(yC(m)){let e=mw(await m(v,n),y);if(e&&(x[h]={...e,...E(CC.validate,e.message)},!r))return b(e.message),x}else if(cC(m)){let e={};for(let t in m){if(!UC(e)&&!r)break;let i=mw(await m[t](v,n),y,t);i&&(e={...i,...E(t,i.message)},b(i.message),r&&(x[h]=e))}if(!UC(e)&&(x[h]={ref:y,...e},!r))return x}}return b(!0),x},cde={mode:SC.onSubmit,reValidateMode:SC.onChange,shouldFocusError:!0};function lde(e={}){let t={...cde,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:yC(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=(cC(t.defaultValues)||cC(t.values))&&fC(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:fC(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:VC(),state:VC()},m=t.criteriaMode===SC.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=UC((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?bC(n.validatingFields,e,r):YC(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!UC(n.validatingFields)}))},v=(e,s=[],c,l,u=!0,m=!0)=>{if(l&&c&&!t.disabled){if(o.action=!0,m&&Array.isArray(_C(r,e))){let t=c(_C(r,e),l.argA,l.argB);u&&bC(r,e,t)}if(m&&Array.isArray(_C(n.errors,e))){let t=c(_C(n.errors,e),l.argA,l.argB);u&&bC(n.errors,e,t),sde(n.errors,e)}if((d.touchedFields||f.touchedFields)&&m&&Array.isArray(_C(n.touchedFields,e))){let t=c(_C(n.touchedFields,e),l.argA,l.argB);u&&bC(n.touchedFields,e,t)}(d.dirtyFields||f.dirtyFields)&&(n.dirtyFields=QC(i,a)),p.state.next({name:e,isDirty:O(e,s),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else bC(a,e,s)},y=(e,t)=>{bC(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=_C(r,e);if(c){let r=_C(a,e,mC(n)?_C(i,e):n);mC(r)||s&&s.defaultChecked||t?bC(a,e,t?r:aw(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=MC(_C(i,e),r);l=!!_C(n.dirtyFields,e),t?YC(n.dirtyFields,e):bC(n.dirtyFields,e,!0),u.dirtyFields=n.dirtyFields,c||=(d.dirtyFields||f.dirtyFields)&&l!==!t}if(a){let t=_C(n.touchedFields,e);t||(bC(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=_C(n.errors,e),s=(d.isValid||f.isValid)&&vC(r)&&n.isValid!==r;if(t.delayError&&i?(c=h(()=>y(e,i)),c(t.delayError)):(clearTimeout(l),c=null,i?bC(n.errors,e,i):YC(n.errors,e)),(i?!MC(o,i):o)||!UC(a)||s){let t={...a,...s&&vC(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,tde(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=_C(t,r);e?bC(n.errors,r,e):YC(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&&nde(l._f);u&&d.validatingFields&&_([r.name],!0);let f=await gw(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&&(_C(f,r.name)?c?pw(n.errors,f,r.name):bC(n.errors,r.name,f[r.name]):YC(n.errors,r.name))}!UC(c)&&await E(c,i,o)}}return o.valid},D=()=>{for(let e of s.unMount){let t=_C(r,e);t&&(t._f.refs?t._f.refs.every(e=>!JC(e)):!JC(t._f.ref))&&V(e)}s.unMount=new Set},O=(e,n)=>!t.disabled&&(e&&n&&bC(a,e,n),!MC(L(),i)),k=(e,t,n)=>AC(e,s,{...o.mount?a:mC(t)?i:kC(e)?{[e]:t}:t},n,t),A=e=>hC(_C(o.mount?a:i,e,t.shouldUnregister?_C(i,e,[]):[])),j=(e,t,n={})=>{let i=_C(r,e),o=t;if(i){let n=i._f;n&&(!n.disabled&&bC(a,e,nw(t,n)),o=GC(n.ref)&&oC(t)?``:t,KC(n.ref)?[...n.ref.options].forEach(e=>e.selected=o.includes(e.value)):n.refs?iC(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):WC(n.ref)?n.ref.value=``:(n.ref.value=o,n.ref.type||p.state.next({name:e,values:fC(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=_C(r,o);(s.array.has(e)||cC(a)||c&&!c._f)&&!aC(a)?M(o,a,n):j(o,a,n)}},N=(e,t,c={})=>{let l=_C(r,e),u=s.array.has(e),m=fC(t);bC(a,e,m),u?(p.array.next({name:e,values:fC(a)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&c.shouldDirty&&p.state.next({name:e,dirtyFields:QC(i,a),isDirty:O(e,m)})):l&&!l._f&&!oC(m)?M(e,m,c):j(e,m,c),uw(e,s)?p.state.next({...n,name:e,values:fC(a)}):p.state.next({name:o.mount?e:void 0,values:fC(a)})},P=async e=>{o.mount=!0;let i=e.target,l=i.name,u=!0,h=_C(r,l),v=e=>{u=Number.isNaN(e)||aC(e)&&isNaN(e.getTime())||MC(e,_C(a,l,e))},y=cw(t.mode),b=cw(t.reValidateMode);if(h){let o,x,T=i.type?aw(h._f):lC(e),D=e.type===xC.BLUR||e.type===xC.FOCUS_OUT,O=!rde(h._f)&&!t.resolver&&!_C(n.errors,l)&&!h._f.deps||ode(D,_C(n.touchedFields,l),n.isSubmitted,b,y),k=uw(l,s,D);bC(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=!UC(A)||k;if(!D&&p.state.next({name:l,type:e.type,values:fC(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=fw(n.errors,r,l),i=fw(e,r,t.name||l);o=i.error,l=i.name,x=UC(e)}}else _([l],!0),o=(await gw(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(_C(n.errors,t)&&e.focus)return e.focus(),1},I=async(e,i={})=>{let a,o,c=BC(e);if(t.resolver){let t=await T(mC(e)?e:c);a=UC(t),o=e?!c.some(e=>_C(t,e)):a}else e?(o=(await Promise.all(c.map(async e=>{let t=_C(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({...!kC(e)||(d.isValid||f.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&dw(r,F,e?c:s.mount),o},L=(e,t)=>{let r={...o.mount?a:i};return t&&(r=HC(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),mC(e)?r:kC(e)?_C(r,e):e.map(e=>_C(r,e))},R=(e,t)=>({invalid:!!_C((t||n).errors,e),isDirty:!!_C((t||n).dirtyFields,e),error:_C((t||n).errors,e),isValidating:!!_C(n.validatingFields,e),isTouched:!!_C((t||n).touchedFields,e)}),z=e=>{let t=e?BC(e):void 0;t?.forEach(e=>YC(n.errors,e)),t?t.forEach(e=>{p.state.next({name:e,errors:n.errors})}):p.state.next({errors:{}})},B=(e,t,i)=>{let a=(_C(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=_C(n.errors,e)||{};bC(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()},ee=(e,t)=>yC(e)?p.state.subscribe({next:n=>`values`in n&&e(k(void 0,t),n)}):k(e,t,!0),te=e=>p.state.subscribe({next:t=>{ade(e.name,t.name,e.exact)&&ide(t,e.formState||d,fe,e.reRenderRoot)&&e.callback({values:{...a},...n,...t,defaultValues:i})}}).unsubscribe,ne=e=>(o.mount=!0,f={...f,...e.formState},te({...e,formState:{...u,...e.formState}})),V=(e,o={})=>{for(let c of e?BC(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||(YC(r,c),YC(a,c)),!o.keepError&&YC(n.errors,c),!o.keepDirty&&YC(n.dirtyFields,c),!o.keepTouched&&YC(n.touchedFields,c),!o.keepIsValidating&&YC(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&YC(i,c);p.state.next({values:fC(a)}),p.state.next({...n,...o.keepDirty?{isDirty:O()}:{}}),!o.keepIsValid&&g()},re=({disabled:e,name:t})=>{if(vC(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()}},ie=(e,n={})=>{let a=_C(r,e),c=vC(n.disabled)||vC(t.disabled);return bC(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a?re({disabled:vC(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:sw(n.min),max:sw(n.max),minLength:sw(n.minLength),maxLength:sw(n.maxLength),pattern:sw(n.pattern)}:{},name:e,onChange:P,onBlur:P,ref:c=>{if(c){ie(e,n),a=_C(r,e);let t=mC(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=Zue(t),s=a._f.refs||[];if(o?s.find(e=>e===t):t===a._f.ref)return;bC(r,e,{_f:{...a._f,...o?{refs:[...s.filter(JC),t,...Array.isArray(_C(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),x(e,!1,void 0,t)}else a=_C(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(uC(s.array,e)&&o.action)&&s.unMount.add(e)}}},ae=()=>t.shouldFocusError&&dw(r,F,s.mount),oe=e=>{vC(e)&&(p.state.next({disabled:e}),dw(r,(t,n)=>{let i=_C(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))},se=(e,i)=>async o=>{let c;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=fC(a);if(p.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await w();_(),n.errors=e,l=fC(t)}else await E(r);if(s.disabled.size)for(let e of s.disabled)YC(l,e);if(YC(n.errors,`root`),UC(n.errors)){p.state.next({errors:{}});try{await e(l,o)}catch(e){c=e}}else i&&await i({...n.errors},o),ae(),setTimeout(ae);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:UC(n.errors)&&!c,submitCount:n.submitCount+1,errors:n.errors}),c)throw c},ce=(e,t={})=>{_C(r,e)&&(mC(t.defaultValue)?N(e,fC(_C(i,e))):(N(e,t.defaultValue),bC(i,e,fC(t.defaultValue))),t.keepTouched||YC(n.touchedFields,e),t.keepDirty||(YC(n.dirtyFields,e),n.isDirty=t.defaultValue?O(e,fC(_C(i,e))):O()),t.keepError||(YC(n.errors,e),d.isValid&&g()),p.state.next({...n}))},le=(e,c={})=>{let l=e?fC(e):i,u=fC(l),f=UC(e),m=f?i:u;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...Object.keys(QC(i,a))]);for(let t of Array.from(e)){let e=_C(n.dirtyFields,t),r=_C(a,t),i=_C(m,t);e&&!mC(r)?bC(m,t,r):!e&&!mC(i)&&N(t,i)}}else{if(dC&&mC(e))for(let e of s.mount){let t=_C(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(GC(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(c.keepFieldsRef)for(let e of s.mount)N(e,_C(m,e));else r={}}a=t.shouldUnregister?c.keepDefaultValues?fC(i):{}:fC(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&&!UC(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||MC(e,i)),isSubmitted:c.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:f?{}:c.keepDirtyValues?c.keepDefaultValues&&a?QC(i,a):n.dirtyFields:c.keepDefaultValues&&e?QC(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})},ue=(e,n)=>le(yC(e)?e(a):e,{...t.resetOptions,...n}),de=(e,t={})=>{let n=_C(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&yC(e.select)&&e.select()})}},fe=e=>{n={...n,...e}},pe={control:{register:ie,unregister:V,getFieldState:R,handleSubmit:se,setError:B,_subscribe:te,_runSchema:w,_updateIsValidating:_,_focusError:ae,_getWatch:k,_getDirty:O,_setValid:g,_setFieldArray:v,_setDisabledField:re,_setErrors:b,_getFieldArray:A,_reset:le,_resetDefaultValues:()=>yC(t.defaultValues)&&t.defaultValues().then(e=>{ue(e,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:D,_disableForm:oe,_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:ie,handleSubmit:se,watch:ee,setValue:N,getValues:L,reset:ue,resetField:ce,clearErrors:z,unregister:V,setError:B,setFocus:de,getFieldState:R};return{...pe,formControl:pe}}var _w=()=>{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)})},vw=(e,t,n={})=>n.shouldFocus||mC(n.shouldFocus)?n.focusName||`${e}.${mC(n.focusIndex)?t:n.focusIndex}.`:``,yw=(e,t)=>[...e,...BC(t)],bw=e=>Array.isArray(e)?e.map(()=>void 0):void 0;function xw(e,t,n){return[...e.slice(0,t),...BC(n),...e.slice(t)]}var Sw=(e,t,n)=>Array.isArray(e)?(mC(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[],Cw=(e,t)=>[...BC(t),...BC(e)];function ude(e,t){let n=0,r=[...e];for(let e of t)r.splice(e-n,1),n++;return hC(r).length?r:[]}var ww=(e,t)=>mC(t)?[]:ude(e,BC(t).sort((e,t)=>e-t)),Tw=(e,t,n)=>{[e[t],e[n]]=[e[n],e[t]]},Ew=(e,t,n)=>(e[t]=n,e);function Dw(e){let t=TC(),{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(_w)),u=Q.useRef(!1);n._names.array.add(r),Q.useMemo(()=>o&&s.length>=0&&n.register(r,o),[n,r,s.length,o]),DC(()=>n._subjects.array.subscribe({next:({values:e,name:t})=>{if(t===r||!t){let t=_C(e,r);Array.isArray(t)&&(c(t),l.current=t.map(_w))}}}).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,uw(r,n._names)&&n._subjects.state.next({...n._formState}),u.current&&(!cw(n._options.mode).isOnSubmit||n._formState.isSubmitted)&&!cw(n._options.reValidateMode).isOnSubmit){if(n._options.resolver)n._runSchema([r]).then(e=>{n._updateIsValidating([r]);let t=_C(e.errors,r),i=_C(n._formState.errors,r);(i?!t&&i.type||t&&(i.type!==t.type||i.message!==t.message):t&&t.type)&&(t?bC(n._formState.errors,r,t):YC(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{let e=_C(n._fields,r);e&&e._f&&!(cw(n._options.reValidateMode).isOnSubmit&&cw(n._options.mode).isOnSubmit)&&gw(e,n._names.disabled,n._formValues,n._options.criteriaMode===SC.all,n._options.shouldUseNativeValidation,!0).then(e=>!UC(e)&&n._subjects.state.next({errors:pw(n._formState.errors,e,r)}))}}n._subjects.state.next({name:r,values:fC(n._formValues)}),n._names.focus&&dw(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(()=>(!_C(n._formValues,r)&&n._setFieldArray(r),()=>{n._options.shouldUnregister||a?n.unregister(r):((e,t)=>{let r=_C(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);Tw(i,e,t),Tw(l.current,e,t),d(i),c(i),n._setFieldArray(r,i,Tw,{argA:e,argB:t},!1)},[d,r,n]),move:Q.useCallback((e,t)=>{let i=n._getFieldArray(r);Sw(i,e,t),Sw(l.current,e,t),d(i),c(i),n._setFieldArray(r,i,Sw,{argA:e,argB:t},!1)},[d,r,n]),prepend:Q.useCallback((e,t)=>{let i=BC(fC(e)),a=Cw(n._getFieldArray(r),i);n._names.focus=vw(r,0,t),l.current=Cw(l.current,i.map(_w)),d(a),c(a),n._setFieldArray(r,a,Cw,{argA:bw(e)})},[d,r,n]),append:Q.useCallback((e,t)=>{let i=BC(fC(e)),a=yw(n._getFieldArray(r),i);n._names.focus=vw(r,a.length-1,t),l.current=yw(l.current,i.map(_w)),d(a),c(a),n._setFieldArray(r,a,yw,{argA:bw(e)})},[d,r,n]),remove:Q.useCallback(e=>{let t=ww(n._getFieldArray(r),e);l.current=ww(l.current,e),d(t),c(t),!Array.isArray(_C(n._fields,r))&&bC(n._fields,r,void 0),n._setFieldArray(r,t,ww,{argA:e})},[d,r,n]),insert:Q.useCallback((e,t,i)=>{let a=BC(fC(t)),o=xw(n._getFieldArray(r),e,a);n._names.focus=vw(r,e,i),l.current=xw(l.current,e,a.map(_w)),d(o),c(o),n._setFieldArray(r,o,xw,{argA:e,argB:bw(t)})},[d,r,n]),update:Q.useCallback((e,t)=>{let i=fC(t),a=Ew(n._getFieldArray(r),e,i);l.current=[...a].map((t,n)=>!t||n===e?_w():l.current[n]),d(a),c([...a]),n._setFieldArray(r,a,Ew,{argA:e,argB:i},!0,!1)},[d,r,n]),replace:Q.useCallback(e=>{let t=BC(fC(e));l.current=t.map(_w),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]||_w()})),[s,i])}}function Ow(e={}){let t=Q.useRef(void 0),n=Q.useRef(void 0),[r,i]=Q.useState({isDirty:!1,isValidating:!1,isLoading:yC(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:yC(e.defaultValues)?void 0:e.defaultValues});if(!t.current){if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!yC(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...i}=lde(e);t.current={...i,formState:r}}}let a=t.current.control;return a._options=e,DC(()=>{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&&!MC(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(()=>EC(r,a),[a,r]),t.current}function kw({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_OPERATIONS_CONFIRM_CRITICAL,`OperationsConfirmCritical`)(e);return(0,$.jsx)(n,{...t})}function dde(e){let{resourceType:t,resourceConfiguration:n,formFieldShape:r,organizationUnitNarrowing:i}=e;return!r||!Object.prototype.hasOwnProperty.call(r,Oi)||n?.persistenceAdapter!==Ge.HTTP_API||!i?!1:i[t]?.unitFieldName!==Oi}function fde(e){let{resourceType:t,resourceConfiguration:n,formFieldShape:r,readThroughCreateOrganizationUnits:i}=e;if(r&&Object.prototype.hasOwnProperty.call(r,Oi)&&n?.persistenceAdapter===Ge.HTTP_API)return i?.[t]}function Aw(e){if(!e.registry.manyToManyScopeJunctions)return;let t=wo.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 jw(e){return e==null||e===``?[]:Array.isArray(e)?e.filter(e=>typeof e==`string`&&e!==``):[e]}function pde(e){let t=U.getResourceFieldIdentifierForType(e.resourceType,e.registry);return e.items.flatMap(n=>{let r=U.getResourceObjectId(n,t);return r?[{value:r,label:U.computeFrontendResourceLabel({resourceType:e.resourceType,registry:e.registry,currentObject:n,t:e.t,formatDate:e.formatDate,formatDateTime:e.formatDateTime})??r,data:n}]:[]})}function Mw(e){if(!e.operation)return;let t=U.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 kn.buildParentResourcesRequirementsFromRouteParams(t.parameters,e.resourceType,e.registry)}async function Nw(e){let t=Aw({resourceType:e.resourceType,registry:e.registry,contextualParameters:e.contextualParameters??{}});if(t){let n=Mw({operation:U.pickDefaultOperationFromConfig(e.registry,e.resourceType,J.SEARCH)??U.pickDefaultOperationFromConfig(e.registry,e.resourceType,J.LIST),resourceType:e.resourceType,registry:e.registry,contextualParameters:t}),r=await e.doOperation(U.buildForeignKeySearchOperationPath(e.resourceType,e.registry),{contextualParameters:t,...n?{parentResourcesRequirements:n,parentChainIsExact:!0}:{},queryParameters:{_id:e.id,limit:1},dataMode:U.foreignKeyReferenceDataMode(e.resourceType,e.registry)},{silent:!0,riskLevel:od.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:U.computeFrontendResourceLabel({resourceType:e.resourceType,registry:e.registry,currentObject:i,t:e.t,formatDate:e.formatDate,formatDateTime:e.formatDateTime})??e.id}}let n=U.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&&Bh({resourceConfig:r,operation:e.readOperation,registry:e.registry,hasResourceId:kn.getResourceId(i[e.resourceType]).length>0,contextResourceIdentifiers:i,contextualParameters:a})?e.readOperation:fh({resourceConfig:r,operations:r.operations??[],coreOperation:J.READ,registry:e.registry,hasResourceId:!0,contextResourceIdentifiers:i,contextualParameters:a}):e.readOperation,s=U.buildForeignKeyReadOperationPath(e.resourceType,e.registry,o),c=e.parentResourcesRequirements??Mw({operation:U.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:od.LOW});return{record:l,label:U.computeFrontendResourceLabel({resourceType:e.resourceType,registry:e.registry,currentObject:l,t:e.t,formatDate:e.formatDate,formatDateTime:e.formatDateTime})??e.id}}function mde(e){let{resourceType:t,ids:n,hostContextualParameters:r}=e,{registry:i,doOperation:a}=fm(),{t:o,formatDate:s,formatDateTime:c}=q({}),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=Gl(n.registry.resourceConfigurations?.[t]?.operations??[],J.READ)??null,{label:i}=await Nw({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 hde(e){if(!e.roleEntries||e.roleTables.unresolvableRoles!==Ns.INERT)return;let{appRolesConfig:t,orgRolesConfig:n}=e.roleTables;return Mre({roleEntries:e.roleEntries,organizationId:e.organizationId,resolveHierarchy:(e,r)=>xo(e,r===rn.APPLICATION?t:n),resolveRolesWithinAuthority:Xs(e.rolesWithinAuthority)})}function gde(e){let t=Zl(e)===jr.ARRAY?pu(e):e;return t&&Zl(t)===jr.ENUM?pt(t):[]}function Pw(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.length>0):typeof e==`string`&&e.length>0?[e]:[]}function _de(e){let{fieldShape:t,ceiling:n,record:r}=e;if(!t||!n)return;let i={};for(let[e,a]of Object.entries(t)){if(!w(a))continue;let t=gde(a);t.length!==0&&(i[e]={values:yl(n,t,Pw(r?.[e]))})}return Object.keys(i).length>0?i:void 0}function vde(e){let{fieldShape:t,ceiling:n,record:r}=e;if(!t||!n||n.kind===Yne.UNBOUNDED)return;let i={};for(let[e,a]of Object.entries(t))w(a)&&Zl(a)===jr.STRING&&La(a)===Yl.ORGANIZATION_ROLE&&(i[e]=yl(n,[...n.grantableRoles],Pw(r?.[e])));return Object.keys(i).length>0?i:void 0}var Fw=rc(K.LOW_LEVEL_ALERT_DIALOG,`AlertDialog`,[`Trigger`,`Content`,`Header`,`Footer`,`Title`,`Description`,`Action`,`Cancel`]);function Iw({preset:e=H.DEFAULT,...t}){let n=Fw(e);return(0,$.jsx)(n,{...t})}var Lw=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=Fw(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});Lw.displayName=`AlertDialogTrigger`;var Rw=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=Fw(e);return(0,$.jsx)(r.Content,{...t,ref:n})});Rw.displayName=`AlertDialogContent`;function zw({preset:e=H.DEFAULT,...t}){let n=Fw(e);return(0,$.jsx)(n.Header,{...t})}function Bw({preset:e=H.DEFAULT,...t}){let n=Fw(e);return(0,$.jsx)(n.Footer,{...t})}var Vw=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=Fw(e);return(0,$.jsx)(r.Title,{...t,ref:n})});Vw.displayName=`AlertDialogTitle`;var Hw=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=Fw(e);return(0,$.jsx)(r.Description,{...t,ref:n})});Hw.displayName=`AlertDialogDescription`;function Uw({preset:e=H.DEFAULT,...t}){let n=Fw(e);return(0,$.jsx)(n.Action,{...t})}function Ww({preset:e=H.DEFAULT,...t}){let n=Fw(e);return(0,$.jsx)(n.Cancel,{...t})}var Gw=(0,Q.createContext)(void 0);function Kw({formChromeMode:e,sectionChromeMode:t,children:n}){let r=(0,Q.useMemo)(()=>({formChromeMode:e,sectionChromeMode:t}),[e,t]);return(0,$.jsx)(Gw.Provider,{value:r,children:n})}function qw(){return(0,Q.useContext)(Gw)??{}}function yde(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 Jw;(function(e){e.REQUEST_DTO=`request-dto`,e.MAIN_SCHEMA=`main-schema`})(Jw||={});var Yw;(function(e){e.IDLE=`idle`,e.SAVING=`saving`,e.SAVED=`saved`,e.ERROR=`error`})(Yw||={});var Xw=(0,Q.createContext)(null);function Zw({schema:e,schemaKind:t=Jw.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)(Xw.Provider,{value:m,children:(0,$.jsx)(RC,{...n,children:d})})}var Qw=`server`,$w=`server-unique`,eT=`_root`,tT=`record-duplicate-key`,nT=(e,t,n)=>{if(e&&`reportValidity`in e){let r=_C(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},rT=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?nT(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>nT(t,n,e))}},iT=(e,t)=>{t.shouldUseNativeValidation&&rT(e,t);let n={};for(let r in e){let i=_C(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.refs?i.refs[0]:i&&i.ref});if(aT(t.names||Object.keys(e),r)){let e=Object.assign({},_C(n,r));bC(e,`root`,a),bC(n,r,e)}else bC(n,r,a)}return n},aT=(e,t)=>{let n=sT(t);return e.some(e=>oT(e).match(`^${n}\\.\\d+`))};function oT(e){return e.replace(/\[(\d+)]/g,`.$1`).replace(/[[\]]/g,``)}function sT(e){return oT(e).replace(/[.*+?^${}()|\\]/g,`\\$&`)}var cT=new Set([`code`,`message`,`path`,`input`]);function lT(e){let t={};for(let[n,r]of Object.entries(e))cT.has(n)||(t[n]=r);return Object.keys(t).length>0?t:void 0}function uT(e,t){let n={};for(let r of e){let e=yde(r)||`_root`,i=r.code,a=typeof i==`string`?i:``;if(!n[e]){let t=lT(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 dT(e){return uT(e,!1)}function fT(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:iT(uT(a.issues,!i.shouldUseNativeValidation&&i.criteriaMode===`all`),i)};let o=a.value;return i.shouldUseNativeValidation&&rT({},i),{values:t.raw?Object.assign({},n):o,errors:{}}}}function pT(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date)}function mT(e){try{return e.safeParse(void 0).success&&!e.safeParse([]).success}catch{return!1}}function hT(e){if(Jt(e)!==null)return!0;let t=li(e);return gs(t)===`union`&&(t.options??[]).some(e=>Jt(e)!==null)}function gT(e,t){if(!t||!pT(e)||!hT(t))return e;let n=re(t),r;for(let i of Object.keys(e)){let a=Na(t,i);if(!a)continue;let o=e[i],s=o;if(Array.isArray(o)){if(o.length===0){if(!n&&mT(a)){r??={...e},delete r[i];continue}}else{let e=pu(a);if(e&&hT(e)){let t=o.map(t=>gT(t,e));t.some((e,t)=>e!==o[t])&&(s=t)}}}else pT(o)&&hT(a)&&(s=gT(o,a));s!==o&&(r??={...e},r[i]=s)}return r??e}function _T(e){(0,Q.useEffect)(()=>{let t=e.watch((t,{name:n,type:r})=>{if(r!==`change`&&n===void 0)return;let i=e.getFieldState(eT).error;i&&i.type!==`server`&&i.type!==`server-unique`&&e.trigger(eT)});return()=>t.unsubscribe()},[e])}var vT=Q.createContext(void 0);function yT(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())_C(o,e)||bC(o,e,{type:`file-validation`,message:n});return Object.keys(o).length>0?{values:{},errors:o}:a}}function bT({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_CONTENT_SECTION,`ContentSection`)(e);return(0,$.jsx)(n,{...t})}function xT({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_CONTENT_SECTION_GROUP,`ContentSectionGroup`)(e);return(0,$.jsx)(n,{...t})}function ST({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_CONTENT_SECTION_LEGEND,`ContentSectionLegend`)(e);return(0,$.jsx)(n,{...t})}var CT=Jc.ON_BLUR,wT;(function(e){e.FORM=`form`,e.DISPLAY=`display`})(wT||={});var TT;(function(e){e.DISPLAY=`display`,e.EDITING=`editing`,e.SAVING=`saving`,e.SAVED=`saved`,e.ERROR=`error`})(TT||={});function ET({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??CT,x=n??e,S=Q.useRef(new Map).current,C=fT(x),w=Ow({resolver:yT(((e,t,n)=>C(gT(e,x),t,n)),S),defaultValues:r,mode:b,disabled:l});_T(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)(Zw,{schema:e,schemaKind:t,form:w,resourceType:d,validationMode:o,validateFieldUrl:m,resourceId:h,operationType:g,contextResourceIdentifiers:_,parentResourcesRequirements:v,navigationZone:y,children:(0,$.jsx)(vT.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})})})})}ET.displayName=`Form`;var DT=ET,OT=(0,Q.createContext)(null);function kT({value:e,children:t}){return(0,$.jsx)(OT.Provider,{value:e,children:t})}function AT(){let e=(0,Q.useContext)(OT);if(!e)throw Error(`useFormTemplateContext() must be used within a <FormTemplateProvider>. This is provided automatically by AutomatedForm.`);return e}function jT(){return(0,Q.useContext)(OT)}function MT(e,t){return e===void 0?t!==`update`:!Fl(e)}function NT(e){return e.match(/[^.[\]]+/g)??[]}function PT(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]=PT(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]=PT(a[n],r),a)}function FT(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:FT(e[t],r)}let i=e;if(Object.prototype.hasOwnProperty.call(i,n))return FT(i[n],r)}function IT(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]=IT(a[t],i,n),a}let a=typeof e==`object`&&e&&!Array.isArray(e)?e:{};return{...a,[r]:IT(a[r],i,n)}}function LT(e,t){let n={};for(let r of t){let t=NT(r);if(t.length===0)continue;let i=FT(e,t);i!==void 0&&(n=IT(n,t,i))}return n}function RT(e,t,n){let r=NT(t);return r.length===0?e:IT(e,r,n)}function zT(e,t,n){if(!n)return e;let r=new Set(t.map(NT).filter(e=>e.length===1).map(e=>e[0])),i=new Set,a=e;for(let o of t){let t=NT(o);if(t.length<2)continue;let s=t[0];if(r.has(s))continue;let c=FT(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=IT(a,t,c)}}return a}function BT(e,t){let n={};for(let[r,i]of Object.entries(e))(i!==null||VT(t,r))&&(n[r]=i);return n}function VT(e,t){if(!e)return!1;let n=Na(e,t);return n?n.safeParse(null).success:!1}function HT(e,t){let n=t.omitClearedFields?BT(e,t.schema):e;for(let e of t.hiddenFieldNames??[]){let t=NT(e);t.length!==0&&(n=PT(n,t))}if(t.contextFieldValues&&Object.keys(t.contextFieldValues).length>0)for(let[e,r]of Object.entries(t.contextFieldValues)){let t=NT(e);t.length!==0&&(n=IT(n,t,r))}return n}function UT(e){return e!==void 0&&zie(e)}function WT(e,t){let n=Jt(e);return n&&Object.hasOwn(n,t)?n[t]:void 0}function GT(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date)}function KT(e,t){let n=new Set;for(let r of e){let[e,...i]=NT(r);if(e===void 0)continue;let a=e,o=t?Na(t,e):void 0;if(o!==void 0&&!o.safeParse(void 0).success)n.add(a);else{for(let e of i){if(!UT(o))break;a=`${a}.${e}`,o=WT(o,e)}n.add(a)}}let r=[...n];return r.filter(e=>!r.some(t=>t!==e&&e.startsWith(`${t}.`)))}function bde(e,t){let n=e=>e==null||e===``||e===!1||Array.isArray(e)&&e.length===0;return n(e)?!n(t):!(0,rC.default)(e,t)}function xde(e){let t=new Set(e.writtenAsHeld??[]),n=new Set(e.variantFields??[]),r={},i=(e,t,n,a)=>{if(UT(n)&>(e))for(let[r,o]of Object.entries(e))i(o,GT(t)?t[r]:void 0,WT(n,r),`${a}.${r}`);else bde(e,t)&&(r[a]=e===void 0||e===``?null:e)};for(let[a,o]of Object.entries(e.values)){let s=e.schema?Na(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 qT(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>t.some(t=>e===t||e.startsWith(`${t}.`)||t.startsWith(`${e}.`))))}var JT;(function(e){e.CLEAR=`clear`,e.EMPTY=`empty`,e.TURN_OFF=`turn_off`})(JT||={});function Sde(e,t,n,r=[]){if(!t||!n||r.includes(e))return;let i=KT([e],n);if(i.length!==1||i[0]!==e)return;let a;if(e.includes(`.`)){let n=ge(t,e);a=n?co(n):void 0}else if(a=Na(t,e),a&&!a.safeParse(void 0).success)return;if(!a)return;let o=a,s=gs(li(o)),c=s===`boolean`?{kind:JT.TURN_OFF,value:!1}:s===`array`?{kind:JT.EMPTY,value:[]}:{kind:JT.CLEAR,value:null};return o.safeParse(c.value).success?c:void 0}function Cde(e){return e.writesRecordFields||e.hasCallerSectionHandler}function YT(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 XT(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 ZT(e,t,n){return e===t?n:n===_r.unresolvedFieldLabel(e)?_r.unresolvedFieldLabel(t):n}function QT(e,t,n,r=`display`,i={}){let{t:a,tResourceFieldDisplay:o,tResourceFieldEdit:s,tResourceFieldEnumValue:c,tResourceSection:l,tResourceWizardStep:u,isReady:d}=q({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=YT(n),c;try{c=fl(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?ZT(c,n,(r===`edit`?s:o)(t.resourceType,c,`label`,a)):ZT(c,n,o(``,c,`label`,a))}return i},[e,t,n,r,p?.fields,h,o,s]),_=(0,Q.useMemo)(()=>{let i={},a=YT(n),c;try{c=fl(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=_r.getObjectLikeFieldShape(e,{commonOnly:!1})}catch{return{}}if(!i)return{};for(let[e,a]of Object.entries(i))if((r===`display`?Jr(a)?.tooltip===!0:Ec(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=fl(e)}catch{return p?.enums??{}}for(let{path:e,schema:i}of r){let r=Rc(i);if(r){if(p?.enums?.[e])n[e]=p.enums[e];else if(t){let a=pt(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(XT(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(XT(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 $T({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:L}=q({component:K.LOW_LEVEL_FORM_MESSAGE}),{fieldLabels:R,fieldDescriptions:z,fieldTooltips:B,enumLabels:ee,sectionLabels:te,sectionDescriptions:ne,wizardStepLabels:V,wizardStepDescriptions:re,groupLabels:ie,isReady:ae}=QT(e,u?.resourceContext,t,`edit`,{layoutRefs:h,overrides:{fields:u?.fields,descriptions:u?.descriptions,enums:u?.enums,sections:u?.sections,wizardSteps:u?.wizardSteps}}),oe=(0,Q.useMemo)(()=>!_||Object.keys(_).length===0?t:{...t,..._},[t,_]),se=MT(m,p||f),ce=(0,Q.useContext)(Vi)?.appConfig,le=(0,Q.useRef)(new Map),ue=(0,Q.useCallback)((e,t)=>{le.current.set(e,t)},[]),de=(0,Q.useCallback)(e=>{if(!S)return e;let t=Object.fromEntries(Object.entries(S).map(([t,n])=>[t,(n.readsReferences?le.current.get(t):void 0)??Wl(n,{appConfig:ce,currentObject:C,values:e,references:{}})]));return ane(e,t)},[S,C,ce]),fe=(0,Q.useMemo)(()=>t=>n(HT(de(t),{hiddenFieldNames:v,contextFieldValues:_,omitClearedFields:se,schema:e})),[n,_,v,se,de]),pe=(0,Q.useMemo)(()=>{if(E)return(t,n,r)=>{let i=n.length>0?LT(r,n):r;return E(t,n,HT(de(i),{hiddenFieldNames:v,contextFieldValues:_,omitClearedFields:se,schema:e}))}},[E,_,v,se,de]),me=(0,Q.useMemo)(()=>({schema:e,fieldLabels:R,fieldDescriptions:z,fieldTooltips:B,enumLabels:ee,sectionLabels:te,sectionDescriptions:ne,groupLabels:ie,wizardStepLabels:V,wizardStepDescriptions:re,readOnly:s,disabled:o,fileUploadContext:g,contextFieldValues:_,hiddenFieldNames:v,generatedFieldOverrides:y,allowedValuesByField:b,roleGrantPickerOffersByField:x,requestFieldOffers:S,requestFieldOfferRecord:C,reportRequestFieldOffer:ue,onSectionSave:pe,operationType:p||f,operationRef:d,isExisting:(p||f)===`update`,inheritanceConfig:w,hostResolvesRelationshipRoots:A}),[e,R,z,B,ee,te,ne,ie,V,re,s,o,g,_,v,y,b,x,S,C,ue,w,A,pe,p,f,d]);if(!L||!ae){let e=Math.min(Math.max(Object.keys(R??{}).length,1),8);return(0,$.jsx)(`div`,{className:G(`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)(pm,{className:`h-4 w-28`}),(0,$.jsx)(pm,{className:`h-9 w-full`})]},t))})}return(0,$.jsx)(DT,{schema:e,defaultValues:oe,onSubmit:fe,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)(kT,{value:me,children:(0,$.jsx)(Kw,{formChromeMode:T,children:(0,$.jsx)(F,{})})})})}$T.displayName=`AutomatedForm`;var eE=$T,tE=(0,Q.createContext)(null);function nE({value:e,children:t}){return(0,$.jsx)(tE.Provider,{value:e,children:t})}function rE(){return(0,Q.useContext)(tE)}function iE(){let e=rE();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 aE;(function(e){e.IDLE=`IDLE`,e.QUEUED=`QUEUED`,e.SAVING=`SAVING`,e.ERROR=`ERROR`,e.CONFLICT=`CONFLICT`,e.DELETED=`DELETED`})(aE||={});var oE;(function(e){e.MUTATION_RESULT=`mutation_result`,e.REMOTE_UPDATE=`remote_update`,e.CONFLICT_RESET=`conflict_reset`,e.RESOURCE_DELETED=`resource_deleted`})(oE||={});var sE;(function(e){e.AUTOSAVE=`autosave`,e.SUBMIT=`submit`,e.DRAFT=`draft`,e.PUBLISH=`publish`,e.SECTION=`section`,e.INLINE=`inline`,e.CUSTOM=`custom`})(sE||={});var cE;(function(e){e.FORM=`form`,e.DISPLAY=`display`,e.ORCHESTRATOR=`orchestrator`,e.CUSTOM=`custom`})(cE||={});var lE;(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`})(lE||={});var uE;(function(e){e.SUCCESS=`success`,e.ERROR=`error`})(uE||={});var dE;(function(e){e.ACCEPT_REMOTE=`accept-remote`,e.LAST_WRITE_WINS=`last-write-wins`})(dE||={});var fE;(function(e){e.VERSION_CONFLICT=`version_conflict`,e.REMOTE_UPDATE=`remote_update`})(fE||={});var pE;(function(e){e.LOCAL=`local`,e.REMOTE=`remote`})(pE||={});var mE;(function(e){e[e.LOW=0]=`LOW`,e[e.NORMAL=1]=`NORMAL`,e[e.HIGH=2]=`HIGH`,e[e.IMMEDIATE=3]=`IMMEDIATE`})(mE||={});var hE=class extends Error{name=`MutationCancelledError`;source;constructor(e){super(`Mutation cancelled`),this.source=e}},gE=class extends Error{name=`ResourceDeletedError`;constructor(){super(`Resource has been deleted`)}},_E=class extends Error{name=`BackpressureRejectedError`;constructor(){super(`Queue at maximum depth — mutation rejected`)}},vE=tl.getLogger(),wde=vE.debugByType(`AutosaveContext`);vE.setDebugTypeLogging(`AutosaveContext`,!1);var yE={enabled:!1,defaultTrigger:Ts.DEBOUNCE,debounceMs:500,savedStateDurationMs:2e3},bE={state:Yw.IDLE},xE=(0,Q.createContext)(null);function SE(){return(0,Q.useContext)(xE)}function CE({children:e,labels:t,validateField:n,onSave:r,rmm:i,config:a,onSaveSuccess:o,onSaveError:s}){let c=(0,Q.useMemo)(()=>({...yE,...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===Yw.SAVING),[l]),g=LC();(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]??bE,...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:Yw.SAVED,lastSavedAt:Date.now()}),m.current[e]=setTimeout(()=>{_(e,{state:Yw.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:Yw.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:Yw.IDLE});return}if(c.signal.aborted)return;_(e,{state:Yw.SAVING});try{if(r)await r(e,a,c.signal);else if(i){let n=await i.queueMutation({[e]:a},{type:sE.AUTOSAVE,priority:mE.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===lE.TRANSIENT)i=t.errorNetwork;else if(r?.type===lE.VALIDATION)i=t.errorValidation;else if(r?.type===lE.CONFLICT)i=t.errorConflict;else if(n instanceof _E){wde(`executeSave: backpressure rejection — resetting field to idle`,{fieldName:e}),_(e,{state:Yw.IDLE});return}else if(n instanceof hE){_(e,{state:Yw.IDLE});return}else if(n instanceof gE){_(e,{state:Yw.ERROR,lastError:t.errorResourceDeleted});return}else i=t.errorGeneric;_(e,{state:Yw.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===Ts.NONE)return;p.current[e]={value:t,trigger:n},b(e);let r=new AbortController;if(n===Ts.BLUR)w(e,t,r);else if(n===Ts.DEBOUNCE){let n=c.debounceMs??yE.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??Yw.IDLE,[l]),O=(0,Q.useCallback)(e=>l[e]??bE,[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)(xE.Provider,{value:k,children:e})}function wE(e,t=Ts.DEBOUNCE,n=!1){return e===void 0?t:e===!0?n?Ts.DEBOUNCE:Ts.BLUR:typeof e==`object`?e.enabled===!1?Ts.NONE:e.trigger?e.trigger:n?Ts.DEBOUNCE:Ts.BLUR:t}var TE=(0,Q.createContext)(null);function Tde(){return(0,Q.useContext)(TE)}var Ede={[JT.CLEAR]:{action:`bulkClearField`,pending:`bulkFieldWillBeCleared`,pendingUncounted:`bulkFieldWillBeClearedOnSelection`},[JT.EMPTY]:{action:`bulkEmptyField`,pending:`bulkFieldWillBeEmptied`,pendingUncounted:`bulkFieldWillBeEmptiedOnSelection`},[JT.TURN_OFF]:{action:`bulkTurnOffField`,pending:`bulkFieldWillBeTurnedOff`,pendingUncounted:`bulkFieldWillBeTurnedOffOnSelection`}};function EE({fieldName:e,label:t,disabled:n,onSaveFieldNow:r,children:i}){let a=Tde(),o=SE(),{tComponent:s}=q({component:K.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=Ede[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(K.LOW_LEVEL_FORM_FIELD,u.pendingUncounted):s(K.LOW_LEVEL_FORM_FIELD,u.pending,{count:f}):null}),(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.SM,"aria-describedby":p,onClick:()=>{d?a.setCleared(e,!1):(o?.cancelPendingUnder(e),a.setCleared(e,!0),r?.(void 0))},children:s(K.LOW_LEVEL_FORM_FIELD,d?`bulkFieldUndoClear`:u.action)})]})]})}function DE(e){if(!e)return[];try{let t=_r.getObjectLikeFieldShape(e,{commonOnly:!0})??{};return Object.entries(t).filter(([,e])=>fne(e)).map(([e])=>e)}catch{return[]}}function OE(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 Dde(e){let{formFieldShape:t,inheritanceConfig:n,defaultValuesOverride:r}=e,i={};if(t)for(let[e,n]of Object.entries(t)){let t=eae(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 kE(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function AE(...e){return t=>{let n=!1,r=e.map(e=>{let r=kE(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():kE(e[t],null)}}}}function jE(...e){return Q.useCallback(AE(...e),e)}var Ode=Symbol.for(`react.lazy`),ME=Q.use;function kde(e){return typeof e==`object`&&!!e&&`then`in e}function NE(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Ode&&`_payload`in e&&kde(e._payload)}function PE(e){let t=Ade(e),n=Q.forwardRef((e,n)=>{let{children:r,...i}=e;NE(r)&&typeof ME==`function`&&(r=ME(r._payload));let a=Q.Children.toArray(r),o=a.find(Mde);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 FE=PE(`Slot`);function Ade(e){let t=Q.forwardRef((e,t)=>{let{children:n,...r}=e;if(NE(n)&&typeof ME==`function`&&(n=ME(n._payload)),Q.isValidElement(n)){let e=Pde(n),i=Nde(r,n.props);return n.type!==Q.Fragment&&(i.ref=t?AE(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 IE=Symbol(`radix.slottable`);function jde(e){let t=({children:e})=>(0,$.jsx)($.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=IE,t}function Mde(e){return Q.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===IE}function Nde(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 Pde(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 Fde=tl.getLogger(),LE=K.APP_LAYOUTS_SURFACE_ERROR_BOUNDARY,RE=class extends Q.Component{state={error:null,errorInfo:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){Fde.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)(Ide,{error:this.state.error,errorInfo:this.state.errorInfo,onRetry:this.resetError,titleAs:this.props.titleAs}):this.props.children}};function Ide(e){return(0,Q.useContext)(Oc)?(0,$.jsx)(Lde,{...e}):(0,$.jsx)(zE,{...e,label:e=>`components.${LE}.${e}`})}function Lde(e){let{makeTrComponent:t,isReady:n}=q({component:LE});return n?(0,$.jsx)(zE,{...e,label:t(LE)}):e.titleAs?(0,$.jsx)(e.titleAs,{className:`sr-only`}):null}function zE({error:e,errorInfo:t,onRetry:n,titleAs:r,label:i}){let a=ui.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)(Py,{variant:`error`,title:i(`title`),message:i(`message`),actions:[{label:i(`tryAgain`),onClick:n,variant:`primary`}],showDevInfo:a,devInfoTitle:i(`devInfoTitle`),devInfoSections:o})]})}var BE=`data-surface-scroll-lock-count`,VE,Rde=`a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])`,HE={a11y:{landmarkRole:`none`}};function UE(e){return Array.from(e.querySelectorAll(Rde)).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`)}function WE(){return typeof document>`u`?0:Number(document.body.getAttribute(BE)??0)}function GE(e){typeof document<`u`&&(e<=0?(document.body.removeAttribute(BE),document.body.style.overflow=VE??``,VE=void 0):(WE()===0&&(VE=document.body.style.overflow),document.body.setAttribute(BE,String(e)),document.body.style.overflow=`hidden`))}function KE(e){Q.useEffect(()=>{if(e&&typeof document<`u`)return GE(WE()+1),()=>GE(WE()-1)},[e])}function qE(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;(UE(n)[0]??n).focus({preventScroll:!0});let i=e=>{if(e.key!==`Tab`)return;let t=UE(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 zde=tl.getLogger();function JE(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 YE(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 Bde(e){switch(e){case`nowrap`:return`nowrap`;case`balance`:return`balance`;case`pretty`:return`pretty`;case`wrap`:return`wrap`;default:return}}function Vde(e){switch(e){case`tabular`:return`tabular-nums`;case`lining`:return`lining-nums`;case`inherit`:return`inherit`;default:return}}function Hde(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 Ude(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 XE(e){switch(e){case`stack`:return`column`;case`row`:case`inherit`:return e;case`column-reverse-on-mobile`:return`row`;default:return}}function ZE(e){switch(e){case`column-reverse-on-mobile`:return`column-reverse`;case`stack`:return`column`;case`row`:case`inherit`:return e;default:return}}function QE(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 $E(e){return e===void 0?void 0:{maxInlineSize:QE(e)}}function Wde(e){switch(e){case`sm`:case`md`:case`lg`:case`xl`:case`measure`:case`centered-readable`:case`content`:return`auto`;default:return`0px`}}function Gde(e){switch(e){case`strip`:return`0px`;default:return`var(--surface-policy-padding-inline)`}}function eD(e){switch(e){case`always`:case`when-orphan`:case`never`:return e;default:return}}function tD(e){switch(e){case`inherit`:case`one-tier-tighter`:case`fixed`:return e;default:return}}function nD(e){switch(e){case`collapse`:case`preserve`:return e;default:return}}function rD(e){switch(e){case`border`:case`gap`:case`rule`:case`none`:return e;default:return}}function Kde(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 iD(e){switch(e){case`wrap-children`:case`self-selectable`:case`forbidden`:return e;default:return}}function aD(e){switch(e){case`self`:case`children`:case`none`:return e;default:return}}function qde(e){switch(e){case`region`:case`dialog`:case`alertdialog`:case`complementary`:case`navigation`:case`status`:case`main`:return e;default:return}}function oD(e){return!!(e&&e!==`none`)}function sD(e){return e?`flex`:`block`}function cD(e){return e?`column`:`row`}function Jde(e){let t=e.containment,n=e.nesting,r=e.content,i=e.interactiveState,a=e.geometry,o=e.stacking,s=e.composition,c=oD(t?.gap);return{"--surface-policy-display":sD(c),"--surface-policy-flex-direction":cD(c),"--surface-policy-padding-block":JE(t?.paddingBlock),"--surface-policy-padding-inline":JE(t?.paddingInline),"--surface-policy-overflow":t?.overflow,"--surface-policy-max-height":t?.maxHeight===`none`?`none`:t?.maxHeight,"--surface-policy-gap":YE(t?.gap),"--surface-policy-header-gap":YE(t?.slotGap?.header??t?.gap),"--surface-policy-body-gap":YE(t?.slotGap?.body??t?.gap),"--surface-policy-footer-gap":YE(t?.slotGap?.footer??t?.gap),"--surface-policy-framing-mode":eD(n?.framingMode),"--surface-policy-nested-radius-strategy":tD(n?.nestedRadiusStrategy),"--surface-policy-first-child-edge-strategy":nD(n?.firstChildEdgeStrategy),"--surface-policy-divider-strategy":rD(n?.dividerStrategy),"--surface-policy-z-tier":Ude(o?.stackingTier),"--surface-policy-numeric-align":Vde(r?.numericAlignment),"--surface-policy-text-wrap":Bde(r?.wrapStrategy),"--surface-policy-overflow-wrap":Hde(r?.overlongTokenStrategy),"--surface-policy-safe-area":a?.safeAreaPadding?`env(safe-area-inset-bottom)`:`0px`,"--surface-policy-action-alignment":XE(a?.actionAlignment),"--surface-policy-action-alignment-mobile":ZE(a?.actionAlignment),"--surface-policy-responsive-max-width":QE(a?.responsiveMaxWidth),"--surface-policy-responsive-max-width-margin":Wde(a?.responsiveMaxWidth),"--surface-policy-embedded-table-padding-inline":Gde(s?.embeddedTablePadding),"--surface-policy-child-adaptive-gap":s?.childAdaptiveDensity?`var(--sp-field)`:void 0,"--surface-policy-selectable-semantics":iD(i?.selectableSemantics),"--surface-policy-gesture-opt-in":aD(i?.gestureOptIn)}}function Yde(e,t,n,r){Q.useRef(!1),r&&[e,t].filter(Boolean).join(` `)}function Xde(e,t,n,r,i,a){return r?{...Jde(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 lD=Q.forwardRef(function({variant:e=V.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}=Ng(),C=x?.(It.SURFACE,e),w=y?.(It.SURFACE,e),T=b?.(t??C?.material),E=Q.useContext(Xe),D=Q.useMemo(()=>S?S(e,n,E?.policy):wc(In[e],void 0,void 0,n,{variant:e,parentPolicy:E?.policy,logger:zde}),[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(()=>Kr(e,D,E,M),[M,E,D,e]),P=!!E?.isInFramedAncestor,F=P?E?.nearestFramedAncestorVariant??void 0:void 0,I=Kde(D.nesting?.nestedRadiusStrategy,P);Yde(c,r&&Q.isValidElement(u)?u.props.className:void 0,n,i);let L=r?FE:`div`,R=Q.useRef(null),z=t_(T,R),B=Q.useCallback(e=>{R.current=e,typeof v==`function`?v(e):v&&(v.current=e)},[v]),ee=d??qde(D.a11y?.landmarkRole),te=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:{...ee===void 0?{}:{role:ee},...f===void 0?{}:{"aria-label":f},...te===void 0?{}:{"aria-labelledby":te}},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};qE(R,ie),KE(ae),Q.useEffect(()=>{},[o,f,p,O,D.a11y?.labelStrategy,ee,e]);let ce=i?{"data-slot":`surface`,"data-surface":``,"data-inline-size-tier":D.geometry?.responsiveMaxWidth}:{},le=D.interactiveState?.errorBoundary===`self`,ue=le?Zde(u,r,s):{children:u,boundsContent:!1},de=(0,$.jsx)(L,{ref:B,..._,...ce,"data-material-kind":z[`data-material-kind`],"data-material-tier":z[`data-material-tier`],"data-material-variant":z[`data-material-variant`],"data-material-depth":z[`data-material-depth`],"data-material-composition":z[`data-material-composition`],"data-material-group":z[`data-material-group`],"data-material-refractive-budget":z[`data-material-refractive-budget`],...se,"data-surface-focus-trap":ie?``:void 0,"data-surface-scroll-containment":ae?``:void 0,"data-surface-framing-mode":i?eD(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?tD(D.nesting?.nestedRadiusStrategy):void 0,"data-surface-first-child-edge-strategy":i?nD(D.nesting?.firstChildEdgeStrategy):void 0,"data-surface-divider-strategy":i?rD(D.nesting?.dividerStrategy):void 0,"data-surface-selectable-semantics":i?iD(D.interactiveState?.selectableSemantics):void 0,"data-surface-gesture-opt-in":i?aD(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:G(w,c),style:Xde(D,z.style,l,i,N.rendersOwnFrame,I),children:ue.children});return(0,$.jsx)(Xe.Provider,{value:N,children:le&&!ue.boundsContent?(0,$.jsx)(RE,{children:de}):de})});function Zde(e,t,n){if(!t)return{children:(0,$.jsx)(RE,{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)(RE,{titleAs:n,children:r})),boundsContent:!0}}lD.displayName=`Surface`;function uD(e,t,n){let r=t.containment?.slotGap?.[e]??t.containment?.gap,i=oD(r);return{"--surface-policy-slot-display":sD(i),"--surface-policy-slot-flex-direction":cD(i),[`--surface-policy-${e}-gap`]:YE(r),...n}}var dD=Q.forwardRef(function({className:e,id:t,style:n,...r},i){let a=gc(),o=Q.useContext(Xe),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:G(e),style:uD(`header`,a,n),...r})});dD.displayName=`Surface.Header`;var fD=Q.forwardRef(function({className:e,style:t,...n},r){let i=gc();return(0,$.jsx)(`div`,{ref:r,"data-slot":`surface-body`,className:G(e),style:uD(`body`,i,t),...n})});fD.displayName=`Surface.Body`;var pD=Q.forwardRef(function({className:e,style:t,...n},r){let i=gc(),a=i.containment?.slotGap?.footer??i.containment?.gap,o=oD(a),s=!!(i.geometry?.actionAlignment&&i.geometry.actionAlignment!==`inherit`);return(0,$.jsx)(`div`,{ref:r,"data-slot":`surface-footer`,className:G(e),style:{"--surface-policy-slot-display":sD(o||s),"--surface-policy-slot-flex-direction":cD(o),"--surface-policy-footer-gap":YE(a),"--surface-policy-action-alignment":s?XE(i.geometry?.actionAlignment):void 0,"--surface-policy-action-alignment-mobile":s?ZE(i.geometry?.actionAlignment):void 0,...t},...n})});pD.displayName=`Surface.Footer`;var mD=Q.forwardRef(function({className:e,...t},n){return(0,$.jsx)(`div`,{ref:n,"data-slot":`surface-action`,className:G(e),...t})});mD.displayName=`Surface.Action`;var hD=Object.assign(lD,{Header:dD,Body:fD,Footer:pD,Action:mD}),gD=Q.createContext(void 0);function Qde(e){return e===Ea.EYEBROW?Ea.EYEBROW:Ea.LABEL}function _D(){return Q.useContext(gD)}function vD({voice:e,children:t}){return Q.createElement(gD.Provider,{value:e},t)}function yD({children:e}){let t=_D();return Q.createElement(gD.Provider,{value:Qde(t)},e)}var $de=`text-base`;function bD(e){return G(e(It.TYPOGRAPHY,Ea.HEADING).base,$de)}var xD=(0,Q.createContext)({pathPrefix:``});function SD({pathPrefix:e,children:t}){return(0,$.jsx)(xD.Provider,{value:{pathPrefix:e},children:t})}function CD(){return(0,Q.useContext)(xD)}function wD(e){let{pathPrefix:t}=CD();return t?`${t}.${e}`:e}var TD=(0,Q.createContext)(null);function ED(e){let t=(0,Q.useContext)(TD);(0,Q.useLayoutEffect)(()=>{t?.registerSlot(e)},[e,t])}function efe(){let e=(0,Q.useContext)(TD);(0,Q.useLayoutEffect)(()=>{e?.registerWizardRoot()},[e])}var DD=rc(K.LOW_LEVEL_ALERT,`Alert`,[`Title`,`Description`]);function OD({preset:e=H.DEFAULT,...t}){let n=DD(e);return(0,$.jsx)(n,{...t})}function kD({preset:e=H.DEFAULT,...t}){let n=DD(e);return(0,$.jsx)(n.Title,{...t})}function AD({preset:e=H.DEFAULT,...t}){let n=DD(e);return(0,$.jsx)(n.Description,{...t})}function jD(){let e=(0,Q.useContext)(Xw);if(!e)throw Error(`useFormSchemaContext must be used within a FormSchemaProvider`);return e}function MD(){return(0,Q.useContext)(Xw)}var tfe=tl.getLogger().debugByType(`FormErrorCategorization`),ND=class e{constructor(){}static ROOT_ERROR_PATHS=new Set([``,`root`,`_`]);static ROOT_ERROR_PREFIX=eT;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 tfe(`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}}},PD=`wildo:reveal-field`,FD=`data-reveal-container`,ID=`data-reveal-panel`;function LD(e){let t={revealed:!1};return e.dispatchEvent(new CustomEvent(PD,{bubbles:!0,detail:t})),t.revealed}function RD(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 zD(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(FD)!==t)continue;let e=i.getAttribute(ID);e!==null&&n.current(e)&&r&&(r.revealed=!0);return}};return document.addEventListener(PD,e),()=>document.removeEventListener(PD,e)},[t]),t}function BD(e,t){return{[FD]:e,[ID]:t}}function VD(){return LC()!=null}var HD=`data-form-error-summary`;function UD(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 nfe(e){return typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/["\\]/g,`\\$&`)}function WD(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="${nfe(t)}"]`);if(e){n=e;break}}if(!n)return e.some(e=>ND.isFormLevelErrorPath(e))?(rfe(),!0):!1;let i=n;return LD(i)?RD(i,()=>GD(i)):GD(i),!0}function rfe(e=20){let t=typeof requestAnimationFrame==`function`?requestAnimationFrame:e=>setTimeout(e,16),n=0,r=()=>{let i=document.querySelector(`[${HD}]`);i?(i.scrollIntoView({behavior:`smooth`,block:`center`}),i.focus({preventScroll:!0})):n<e&&(n+=1,t(r))};r()}function GD(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 KD=tl.getLogger(),ife=KD.debugByType(`FormErrorSummary`);KD.setDebugTypeLogging(`FormErrorSummary`,!1);function qD({title:e,className:t,maxErrors:n=10,stepFieldNames:r}){let{formState:i}=LC(),{renderIcon:a}=ef(),o=gc(),s=MD(),c=s?.resourceType,{tResourceFieldEdit:l,tComponent:u,isReady:d}=q({component:K.LOW_LEVEL_FORM_MESSAGE,...c?{resource:c}:{}}),f=e??u(K.LOW_LEVEL_FORM_MESSAGE,`formErrorsTitle`),{fieldErrors:p,crossFieldErrors:m,serverErrors:h}=ND.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=>ND.isFormLevelErrorPath(e.path)||_(e.path)),[h,_]),y=(0,Q.useMemo)(()=>g?p.filter(e=>_(e.path)):[],[p,g,_]),b=[...m,...v,...y],x=jT()?.fieldLabels,S=(0,Q.useMemo)(()=>_r.createFieldLabelResolver(c,l,s?.schema,x),[c,l,s?.schema,x]);if(b.length===0||!d)return null;ife(`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)(OD,{variant:`destructive`,className:G(t),role:`alert`,"data-testid":`form-error-summary`,[HD]:``,tabIndex:-1,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-element`,children:[a(W.ERROR,{size:tr.SM,className:`mt-0.5`}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(kD,{className:`mb-element`,children:f}),(0,$.jsxs)(AD,{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:[ND.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(K.LOW_LEVEL_FORM_MESSAGE,`moreErrors`,{count:b.length-n})})]})]})]})})}qD.displayName=`FormErrorSummary`;var JD=qD,YD=(0,Q.createContext)(null),XD=(0,Q.createContext)(null);function ZD(){return(0,Q.useContext)(YD)}function QD({className:e}){ED(`errorSummary`);let t=ZD();return(0,$.jsx)(JD,{className:e,stepFieldNames:t?.getCurrentStepFieldNames()})}function $D({loading:e,children:t,width:n=`4em`,className:r}){return e?(0,$.jsx)(pm,{"aria-hidden":`true`,className:G(`inline-block h-[1em] align-[-0.125em] rounded-sm`,r),style:{width:n}}):t}$D.displayName=`SkeletonText`;function eO({className:e,label:t,submittingLabel:n,fullWidth:r,disabled:i}){ED(`submitButton`);let{formState:a}=LC(),o=jT(),{tComponent:s,isReady:c}=q({component:K.LOW_LEVEL_FORM_MESSAGE}),l=t===void 0&&!c,u=t??(c?s(K.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)(Y,{type:`submit`,disabled:d,className:r?`w-full`:void 0,children:(0,$.jsx)($D,{loading:l,width:`5em`,children:f})})})}eO.displayName=`SubmitButton`;var tO;(function(e){e.AUTOMATIC=`automatic`,e.MANUAL=`manual`})(tO||={});var nO;(function(e){e.PRIMARY=`primary`,e.SECONDARY=`secondary`})(nO||={});var rO=Q.createContext(null),iO=rc(K.LOW_LEVEL_TABS,`Tabs`,[`List`,`Trigger`,`Content`]);function aO({preset:e=H.DEFAULT,...t}){let n=iO(e);return(0,$.jsx)(n,{...t})}function oO({preset:e=H.DEFAULT,...t}){let n=iO(e);return(0,$.jsx)(n.List,{...t})}function sO({preset:e=H.DEFAULT,...t}){let n=iO(e);return(0,$.jsx)(n.Trigger,{...t})}function cO({preset:e=H.DEFAULT,...t}){let n=iO(e);return(0,$.jsx)(n.Content,{...t})}var lO=rc(K.LOW_LEVEL_ACCORDION,`Accordion`,[`Item`,`Trigger`,`Content`]);function uO({preset:e=H.DEFAULT,...t}){let n=lO(e);return(0,$.jsx)(n,{...t})}function dO({preset:e=H.DEFAULT,...t}){let n=lO(e);return(0,$.jsx)(n.Item,{...t})}function fO({preset:e=H.DEFAULT,...t}){let n=lO(e);return(0,$.jsx)(n.Trigger,{...t})}function pO({preset:e=H.DEFAULT,...t}){let n=lO(e);return(0,$.jsx)(n.Content,{...t})}var mO;(function(e){e.SINGLE=`single`,e.MULTIPLE=`multiple`})(mO||={});var hO;(function(e){e.SEGMENTED=`segmented`,e.CHIPS=`chips`})(hO||={});var gO=rc(K.LOW_LEVEL_TOGGLE_GROUP,`ToggleGroup`,[`Item`]),_O=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=gO(e);return(0,$.jsx)(r,{...t,ref:n})});_O.displayName=`ToggleGroup`;function vO({preset:e=H.DEFAULT,...t}){let n=gO(e);return(0,$.jsx)(n.Item,{...t})}var yO=rc(K.LOW_LEVEL_COLLAPSIBLE,`Collapsible`,[`Trigger`,`Content`]);function bO({preset:e=H.DEFAULT,...t}){let n=yO(e);return(0,$.jsx)(n,{...t})}function xO({preset:e=H.DEFAULT,...t}){let n=yO(e);return(0,$.jsx)(n.Trigger,{...t})}function SO({preset:e=H.DEFAULT,...t}){let n=yO(e);return(0,$.jsx)(n.Content,{...t})}var CO=rc(K.LOW_LEVEL_STEPPER,`Stepper`,[`Item`,`Indicator`,`Separator`,`Title`,`Description`]);function wO({preset:e=H.DEFAULT,...t}){let n=CO(e);return(0,$.jsx)(n,{...t})}function TO({preset:e=H.DEFAULT,...t}){let n=CO(e);return(0,$.jsx)(n.Item,{...t})}function EO({preset:e=H.DEFAULT,...t}){let n=CO(e);return(0,$.jsx)(n.Indicator,{...t})}function DO({preset:e=H.DEFAULT,...t}){let n=CO(e);return(0,$.jsx)(n.Separator,{...t})}function OO({preset:e=H.DEFAULT,...t}){let n=CO(e);return(0,$.jsx)(n.Title,{...t})}function kO({preset:e=H.DEFAULT,...t}){let n=CO(e);return(0,$.jsx)(n.Description,{...t})}var AO;(function(e){e.REACHED=`reached`,e.CURRENT=`current`,e.NOT_REACHED=`not_reached`})(AO||={});var jO=class extends Error{constructor(e){super(`[Section STAGES] ${e}`),this.name=`SectionStageBindingError`}};function MO(e,t,n){let r=t.join(`, `);if(e===void 0)throw new jO(`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 jO(`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 jO(`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 jO(`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 jO(`stageBinding.stageOfValue names ${c.map(e=>`"${e}"`).join(`, `)}, which ${c.length===1?`is not a section`:`are not sections`} of the group (${r}).`)}function NO(e,t){return typeof t==`string`&&Object.prototype.hasOwnProperty.call(e.stageOfValue,t)?e.stageOfValue[t]:null}function PO(e,t){let n=t===null?-1:e.indexOf(t);return e.map((e,t)=>n<0||t>n?AO.NOT_REACHED:t===n?AO.CURRENT:AO.REACHED)}var afe=new Set([ci.DEFAULT,ci.CARD,ci.GHOST,ci.COLLAPSIBLE]);function FO(e){return afe.has(e)}function ofe(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??ci.DEFAULT;if(FO(o)){i.push({type:`node`,node:a});continue}let s=o,c=sfe(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 sfe(e,t){switch(e){case ci.INLINE:return JSON.stringify({mode:e,gap:t.gap});case ci.GRID:return JSON.stringify({mode:e,columns:t.columns,gap:t.gap,minColumnWidth:t.minColumnWidth});case ci.COLUMNS:return JSON.stringify({mode:e,columns:t.columns,gap:t.gap});case ci.VERTICAL_TABS:return JSON.stringify({mode:e,navWidth:t.navWidth});case ci.ACCORDION:return JSON.stringify({mode:e,allowMultiple:t.allowMultiple});case ci.EXPANDABLE:return JSON.stringify({mode:e,initialVisibleCount:t.initialVisibleCount});case ci.STEPPER:return JSON.stringify({mode:e,allowSkip:t.allowSkip,showProgress:t.showProgress,orientation:t.orientation});case ci.TABS:case ci.PILLS:case ci.TIMELINE:case ci.STAGES:return JSON.stringify({mode:e});default:return JSON.stringify({mode:e})}}function cfe(e){let t=e.sections[0].props,n=e.mode,r={mode:n,ariaLabel:void 0,ariaLabelledBy:void 0};switch(n){case ci.INLINE:return{...r,mode:n,gap:t.gap};case ci.GRID:return{...r,mode:n,columnCount:t.columns,gap:t.gap,minColumnWidth:t.minColumnWidth};case ci.COLUMNS:return{...r,mode:n,columnCount:t.columns,gap:t.gap};case ci.TABS:{let t=e.sections.find(e=>e.props.defaultFocus);return{...r,mode:n,defaultActive:t?.props.name??e.sections[0].props.name}}case ci.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 ci.PILLS:{let t=e.sections.find(e=>e.props.defaultFocus);return{...r,mode:n,defaultActive:t?.props.name??e.sections[0].props.name}}case ci.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 ci.EXPANDABLE:return{...r,mode:n,initialVisibleCount:t.initialVisibleCount};case ci.STEPPER:return{...r,mode:n,allowSkip:t.allowSkip,showProgress:t.showProgress,orientation:t.orientation??Ui.VERTICAL};case ci.TIMELINE:return{...r,mode:n};case ci.STAGES:return{...r,mode:n};default:return{mode:ci.INLINE}}}function lfe(e){switch(e){case`grouped`:case`flat`:case`separator-only`:return e;default:return`card-each`}}function IO(e){switch(e){case`flat`:return{appearance:ci.DEFAULT};case`separator-only`:return{appearance:ci.DEFAULT,className:`border-b pb-field last:border-b-0 last:pb-0`};default:return{appearance:ci.CARD}}}var LO=({sections:e,className:t})=>{let{getRecipe:n}=Ng(),r=n(It.SURFACE,V.CARD),i=n(It.TYPOGRAPHY,Ea.EYEBROW),a=GO();return(0,$.jsx)(hD,{asChild:!0,emitPolicyVars:!1,variant:V.CARD,policyOverride:{nesting:{framingMode:`always`}},children:(0,$.jsx)(`div`,{role:`region`,"aria-label":a(`contentSectionsRegion`),className:G(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:G(`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:ci.DEFAULT,disabled:e.disabled,children:e.content})]},e.id))})})};function RO(e,t){let{appearance:n,className:r}=IO(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 zO(e,t=e.content,n=`card-each`){let{appearance:r,className:i}=IO(n);return(0,$.jsx)(bT,{panel:!0,appearance:r,className:i,children:t},e.id)}function BO({section:e}){let{getRecipe:t}=Ng();return e.description==null?e.content:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:G(`mb-field`,t(It.TYPOGRAPHY,Ea.DESCRIPTION).base),children:e.description}),e.content]})}var VO=({sections:e,config:t,className:n,onSectionChange:r})=>{let i=lfe(gc().autoRender?.autoSectionWrap);if(e.length===0)return t.emptyStateMessage?(0,$.jsx)(dm,{title:t.emptyStateMessage,variant:`compact`,className:n}):null;if(e.length===1&&!t.showSingleSectionNav)return i===`grouped`?(0,$.jsx)(LO,{sections:e,className:n}):(0,$.jsx)(`div`,{className:n,children:RO(e[0],{wrapMode:i})});switch(t.mode){case ci.DEFAULT:case ci.CARD:case ci.GHOST:case ci.INLINE:return(0,$.jsx)(KO,{sections:e,config:t,className:n,sectionWrapMode:i});case ci.GRID:return(0,$.jsx)(dfe,{sections:e,config:t,className:n,sectionWrapMode:i});case ci.COLUMNS:return(0,$.jsx)(ffe,{sections:e,config:t,className:n,sectionWrapMode:i});case ci.TABS:return(0,$.jsx)(pfe,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case ci.VERTICAL_TABS:return(0,$.jsx)(gfe,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case ci.PILLS:return(0,$.jsx)(_fe,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case ci.ACCORDION:return(0,$.jsx)(vfe,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case ci.COLLAPSIBLE:return(0,$.jsx)(bfe,{sections:e,config:t,className:n,sectionWrapMode:i});case ci.EXPANDABLE:return(0,$.jsx)(Sfe,{sections:e,config:t,className:n,sectionWrapMode:i});case ci.STEPPER:return(0,$.jsx)(Cfe,{sections:e,config:t,className:n,sectionWrapMode:i,onSectionChange:r});case ci.TIMELINE:return(0,$.jsx)(wfe,{sections:e,config:t,className:n,sectionWrapMode:i});case ci.STAGES:return(0,$.jsx)(Tfe,{sections:e,config:t,className:n,sectionWrapMode:i});default:return(0,$.jsx)(KO,{sections:e,config:{mode:ci.INLINE},className:n,sectionWrapMode:i})}},HO={sm:`gap-element`,md:`gap-field`,lg:`gap-section`},ufe={sm:`var(--spacing-element)`,md:`var(--spacing-field)`,lg:`var(--spacing-section)`},UO=`300px`,WO=K.LOW_LEVEL_CONTENT_SECTION_CONTAINER;function GO(){let{tComponent:e}=q({component:WO});return(0,Q.useCallback)((t,n)=>{let r=e(WO,t,n);return r===`${Bc.COMPONENTS}.${WO}.${t}`?``:r},[e])}var KO=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=HO[(`gap`in t?t.gap:void 0)??`md`],a=GO();return r===`grouped`?(0,$.jsx)(LO,{sections:e,className:n}):(0,$.jsx)(`div`,{className:G(`flex flex-col`,i,n),role:`region`,"aria-label":t.ariaLabel??a(`contentSectionsRegion`),children:e.map(e=>RO(e,{wrapMode:r}))})},dfe=({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=HO[a],c=GO(),l=i?`max(${o}, calc((100% - ${i-1} * ${ufe[a]}) / ${i}))`:o,u={gridTemplateColumns:`repeat(${i?`auto-fill`:`auto-fit`}, minmax(min(100%, ${l}), 1fr))`};return(0,$.jsx)(`div`,{className:G(`grid`,s,n),style:u,role:`region`,"aria-label":t.ariaLabel??c(`contentGridRegion`),children:e.map(e=>RO(e,{wrapMode:r}))})},ffe=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=HO[t.gap??`md`],a=GO(),o=t.columnCount===`auto`||t.columnCount===void 0?UO:`${t.columnCount} ${UO}`;return(0,$.jsx)(`div`,{className:G(i,n),style:{columns:o},role:`region`,"aria-label":t.ariaLabel??a(`contentColumnsRegion`),children:e.map(e=>(0,$.jsx)(`div`,{className:G(`break-inside-avoid mb-field`,r===`separator-only`&&`border-b pb-field last:border-b-0 last:pb-0`),children:RO(e,{wrapMode:r===`separator-only`?`flat`:r})},e.id))})};function qO(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:zD(e=>e!==a&&(o(e),!0))}}var pfe=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let a=GO(),o=VD(),{active:s,select:c,revealContainerId:l}=qO(t,e,i);return(0,$.jsxs)(aO,{value:s,className:n,onValueChange:c,children:[(0,$.jsx)(oO,{"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}:{},...BD(l,e.id),className:`animate-in fade-in-0 duration-[var(--motion-duration-fast)]`,children:zO(e,(0,$.jsx)(BO,{section:e}),r)},e.id))]})},mfe=36;function hfe(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 gfe=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let a=GO(),o=VD(),{active:s,select:c,revealContainerId:l}=qO(t,e,i),u=t.navWidth??`w-48`,[d,f]=hfe(mfe);return(0,$.jsx)(`div`,{ref:d,className:`min-w-0`,"data-vertical-tabs-stacked":f||void 0,children:(0,$.jsxs)(aO,{value:s,orientation:f?Ui.HORIZONTAL:Ui.VERTICAL,className:G(`mt-field`,n),onValueChange:c,children:[(0,$.jsx)(oO,{className:f?void 0:G(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}:{},...BD(l,e.id),className:`min-w-0 flex-1 animate-in fade-in-0 duration-[var(--motion-duration-fast)]`,children:zO(e,(0,$.jsx)(BO,{section:e}),r)},e.id))]})})},_fe=({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}=Ng(),u=GO(),d=(0,Q.useId)(),f=(0,Q.useRef)(null),p=l(It.SELECTABLE,kc.FILLED),m=VD(),h=e=>`${d}-tab-${e}`,g=e=>`${d}-panel-${e}`,_=e=>{c(e),i?.(e)},v=zD(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,...BD(v,e.id),className:G(`animate-in fade-in-0 duration-[var(--motion-duration-fast)]`,Dg(e_.INSET)),children:zO(e,(0,$.jsx)(BO,{section:e}),r)},e.id);return(0,$.jsxs)(`div`,{className:G(`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:G(`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)]})},vfe=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let a=t.defaultExpanded??[e[0]?.id],o=t.allowMultiple??!1,s=VD(),{getRecipe:c}=Ng(),l=bD(c),[u,d]=(0,Q.useState)(o?a:a.slice(0,1)),f=e=>{d(e),i?.(o?e:e[0]??``)},p=zD(e=>!u.includes(e)&&(f(o?[...u,e]:[e]),!0)),m=e.map(e=>(0,$.jsxs)(dO,{value:e.id,disabled:e.disabled,children:[(0,$.jsx)(fO,{className:G(e.disabled&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`),children:(0,$.jsxs)(`span`,{className:G(`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)(pO,{...s?{forceMount:!0,hidden:!u.includes(e.id)}:{},...BD(p,e.id),children:zO(e,(0,$.jsx)(BO,{section:e}),`flat`)})]},e.id));return o?(0,$.jsx)(uO,{type:mO.MULTIPLE,value:u,className:n,onValueChange:e=>f(e),children:m}):(0,$.jsx)(uO,{type:mO.SINGLE,value:u[0]??``,className:n,collapsible:!0,onValueChange:e=>f(e?[e]:[]),children:m})},yfe=`all`,bfe=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let[i,a]=(0,Q.useState)(!0),o=GO(),s=t.triggerLabel?.open??o(`accordionCollapseAll`),c=t.triggerLabel?.closed??o(`accordionExpandAll`),l=o(`accordionSectionCount`,{count:e.length}),u=VD(),d=zD(()=>!i&&(a(!0),!0));return(0,$.jsxs)(bO,{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)(xO,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.SM,"aria-expanded":i,children:i?s:c})})]}),(0,$.jsx)(SO,{className:`space-y-field mt-field`,...u?{forceMount:!0,hidden:!i}:{},...BD(d,yfe),children:e.map(e=>RO(e,{titleTag:`h4`,wrapMode:r}))})]})},xfe=`folded`,Sfe=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=t.initialVisibleCount??3,[a,o]=(0,Q.useState)(!1),s=GO(),c=a?e:e.slice(0,i),l=e.length-i,u=t.showMoreLabel??s(`expandableShowMore`,{count:l}),d=t.showLessLabel??s(`expandableShowLess`),f=VD(),{renderIcon:p}=ef(),m=zD(()=>!a&&(o(!0),!0));return(0,$.jsxs)(`div`,{className:G(`flex flex-col gap-field`,n),children:[f?(0,$.jsxs)($.Fragment,{children:[e.slice(0,i).map(e=>RO(e,{wrapMode:r})),l>0&&(0,$.jsx)(`div`,{className:`flex flex-col gap-field`,hidden:!a,...BD(m,xfe),children:e.slice(i).map(e=>RO(e,{wrapMode:r}))})]}):c.map(e=>RO(e,{wrapMode:r})),l>0&&(0,$.jsxs)(Y,{type:`button`,variant:X.GHOST,size:df.SM,className:`self-start`,onClick:()=>o(!a),"aria-expanded":a,children:[a?d:u,p(a?W.CHEVRON_UP:W.CHEVRON_DOWN,{size:tr.SM})]})]})},Cfe=({sections:e,config:t,className:n,sectionWrapMode:r,onSectionChange:i})=>{let[a,o]=(0,Q.useState)(0),s=GO(),c=(0,Q.useId)(),l=t.orientation??Ui.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=VD(),_=zD(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,...BD(_,e.id),className:`animate-in fade-in-0 duration-[var(--motion-duration-fast)]`,children:zO(e,(0,$.jsx)(BO,{section:e}),r)},e.id);return(0,$.jsxs)(`div`,{className:G(`flex flex-col gap-section`,n),children:[(0,$.jsx)(`nav`,{id:c,"aria-label":t.ariaLabel??s(`stepperProgressNav`),children:(0,$.jsx)(wO,{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)(TO,{step:n,role:`listitem`,"aria-current":n===a?`step`:void 0,children:[(0,$.jsx)(EO,{step:n,"aria-hidden":`true`}),(0,$.jsx)(OO,{step:n,children:t.title})]}),n<e.length-1&&(0,$.jsx)(DO,{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)(Y,{type:`button`,variant:X.OUTLINE,onClick:()=>h(a-1),disabled:a===0,children:p}),a<e.length-1&&(0,$.jsx)(Y,{type:`button`,onClick:()=>h(a+1),children:f})]})]})]})},wfe=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=GO();return(0,$.jsx)(`div`,{className:n,role:`region`,"aria-label":t.ariaLabel??i(`timelineRegion`),children:(0,$.jsx)(Gd,{className:`gap-section`,children:e.map((e,t)=>(0,$.jsx)(Yd,{children:(0,$.jsx)(Kd,{children:zO(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)(Jd,{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))})})},Tfe=({sections:e,config:t,className:n,sectionWrapMode:r})=>{let i=GO(),a=t.currentStage;if(a===void 0)return e.map(e=>e.id).join(`|`),(0,$.jsx)(KO,{sections:e,config:{mode:ci.INLINE},className:n,sectionWrapMode:r});let o=PO(e.map(e=>e.id),a),s=o.indexOf(AO.CURRENT);return(0,$.jsx)(`div`,{className:n,role:`region`,"aria-label":t.ariaLabel??i(`stagesRegion`),"data-current-stage":a??void 0,children:(0,$.jsx)(wO,{currentStep:s,totalSteps:e.length,orientation:Ui.VERTICAL,role:`list`,children:e.map((t,n)=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsxs)(TO,{step:n,role:`listitem`,"data-stage":t.id,"data-stage-state":o[n],"aria-current":o[n]===AO.CURRENT?`step`:void 0,children:[(0,$.jsx)(EO,{step:n,"aria-hidden":`true`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(OO,{step:n,children:t.title}),t.description!=null&&(0,$.jsx)(kO,{step:n,children:t.description}),(0,$.jsx)(`div`,{className:`mt-field`,children:t.content})]})]}),n<e.length-1&&(0,$.jsx)(DO,{step:n,"aria-hidden":`true`,className:`ms-[calc(1rem-1px)] my-element`})]},t.id))})})};VO.displayName=`ContentSectionContainer`;function JO(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))JO(i,e===`root`?t:`${t}.${e}`,n)}function YO(e,t){let n=[];for(let r of t)JO(e.getFieldState(r).error,r,n);return n}var XO=e=>e.type===`server`||e.type===`server-unique`;async function ZO(e,t){if(t.length===0)return!0;let n=YO(e,t).filter(e=>XO(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=YO(e,t),a=e,o=Efe(a);for(let e of i)XO(e.error)||o.has(e.path)||a.setValue(e.path,a.getValues(e.path),{shouldTouch:!0,shouldDirty:!1,shouldValidate:!1});return WD(i.map(e=>e.path)),!1}function Efe(e){let t=e.control._names?.array;return t instanceof Set?t:new Set}var QO=(0,Q.createContext)(null);function $O({value:e,children:t}){return(0,$.jsx)(QO.Provider,{value:e,children:t})}function ek(){let e=(0,Q.useContext)(QO);if(!e)throw Error(`useDisplayTemplateContext() must be used within a <DisplayTemplateProvider>. This is provided automatically by AutomaticDisplayer / ResourceAutomaticDisplayer.`);return e}function tk(){return(0,Q.useContext)(QO)}var nk=(0,Q.createContext)(void 0);function rk({displayChromeMode:e,sectionChromeMode:t,children:n}){let r=(0,Q.useMemo)(()=>({displayChromeMode:e,sectionChromeMode:t}),[e,t]);return(0,$.jsx)(nk.Provider,{value:r,children:n})}function ik(){return(0,Q.useContext)(nk)??{}}function ak({children:e}){let{displayChromeMode:t}=ik();return(0,$.jsx)(rk,{displayChromeMode:t,sectionChromeMode:void 0,children:e})}var ok;(function(e){e.FORM=`form`,e.DISPLAY=`display`,e.COMPOSITE=`composite`})(ok||={});var sk=new Set(Object.values(Cu));function Dfe(e){if(typeof e==`string`)return sk.has(e)?e:Cu.STACKED;let t={};for(let[n,r]of Object.entries(e))t[n]=r&&sk.has(r)?r:Cu.STACKED;return t}function Ofe(e){return FO(e)}var ck=(0,Q.createContext)(null);function lk(){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 uk(e){let t=(0,Q.useContext)(ck);(0,Q.useEffect)(()=>(t?.registerField(e),()=>{t?.unregisterField(e)}),[t,e])}var dk=[],fk=()=>()=>{};function pk(){let e=(0,Q.useContext)(ck);return(0,Q.useSyncExternalStore)(e?e.subscribeToRegisteredFields:fk,e?e.getRegisteredFields:()=>dk)}function mk(e){let t=(0,Q.useContext)(ck),[n]=(0,Q.useState)(()=>({}));(0,Q.useLayoutEffect)(()=>()=>{t?.clearSlotPresence(n)},[t,n]),(0,Q.useLayoutEffect)(()=>{t?.reportSlotPresence(n,e)},[t,n,e])}function hk(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 gk;(function(e){e.FIELD_SLOT=`field_slot`,e.FIELD_SLOT_CONTAINER=`field_slot_container`})(gk||={});var _k=Symbol.for(`wildo.sectionContentRole`);function vk(e){return e!==null&&(typeof e==`function`||typeof e==`object`)?e[_k]:void 0}function yk(e,t){Object.defineProperty(e,_k,{value:t,enumerable:!1})}var bk;(function(e){e.FIELD_SLOTS=`field_slots`,e.NOTHING=`nothing`,e.CONTENT=`content`})(bk||={});function xk(e,t,n){let r=!1;for(let i of Q.Children.toArray(e)){if(!(0,Q.isValidElement)(i))return bk.CONTENT;let e=i.props,a;if(i.type===Q.Fragment)a=xk(e.children,t,n);else if(typeof i.type==`string`)a=!i.type.includes(`-`)&&xk(e.children,t,n)===bk.FIELD_SLOTS?bk.FIELD_SLOTS:bk.CONTENT;else{let r=i.type[_k],o=typeof e.name==`string`?e.name:void 0,s=o?t?`${t}.${o}`:o:t;r===gk.FIELD_SLOT?(n.push({path:s,hasOwnSchema:e.schema!==void 0}),a=bk.FIELD_SLOTS):a=r===gk.FIELD_SLOT_CONTAINER?xk(e.children,s,n):bk.CONTENT}if(a===bk.CONTENT)return bk.CONTENT;a===bk.FIELD_SLOTS&&(r=!0)}return r?bk.FIELD_SLOTS:bk.NOTHING}function Sk(e){return xk(e,``,[])===bk.FIELD_SLOTS}function Ck(e,t=``){let n=[];return xk(e,t,n)===bk.FIELD_SLOTS?n:null}var wk=(0,Q.createContext)(null);function Tk(){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 Ek(e){return e.match(/^[^.[\]]+/)?.[0]??e}var Dk=Symbol.for(`wildo.placesNamedField`);function Ok(e){Object.defineProperty(e,Dk,{value:!0,enumerable:!1})}var kk=1e4,Ak=5e4,jk=200;function Mk(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<kk;)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>jk||++a>Ak)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(Fk(t,`children`),a,0,o+1);return}let c=Nk(e);if(c===gk.FIELD_SLOT||Pk(e)){n.push(r(Fk(t,`name`),a));return}let l=c===gk.FIELD_SLOT_CONTAINER?r(Fk(t,`name`),a):a;for(let e of i)s(Fk(t,e),l,e===`children`?0:1,o+1)};return s(e,t,0,0),n.filter(e=>e!==``)}function Nk(e){try{return vk(e)}catch{return}}function Pk(e){try{return e!==null&&(typeof e==`function`||typeof e==`object`)&&e[Dk]===!0}catch{return!1}}function Fk(e,t){try{return e[t]}catch{return}}function Ik(e){let t=(0,Q.useContext)(wk),n=e.map(Ek).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 Lk(e,t){let n=(0,Q.useContext)(wk);Ik((0,Q.useMemo)(()=>n?Mk(e,t):[],[n,e,t]))}var Rk=(0,Q.createContext)(null);function zk({value:e,children:t}){let n=(0,Q.useMemo)(()=>e,[e]);return(0,$.jsx)(Rk.Provider,{value:n,children:t})}function Bk(){return(0,Q.useContext)(Rk)}var Vk=(0,Q.createContext)(!1);function Hk(){return(0,Q.useContext)(Vk)}var Uk=tl.getLogger();function Wk(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??ci.DEFAULT,u=jT(),d=tk(),f=Bk(),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?ok.FORM:d?ok.DISPLAY:f?ok.COMPOSITE:ok.DISPLAY;if(S===ok.COMPOSITE&&i)throw U.buildConfigurationError(Lu.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=lk(),w=hk(C),{pathPrefix:T}=CD();Lk(a,T);let E=w&&Sk(a);if(!Ofe(l))return(0,$.jsx)($.Fragment,{children:a});let D=(0,$.jsx)(Vk.Provider,{value:!!_,children:(0,$.jsxs)(ck.Provider,{value:C,children:[(0,$.jsx)(Kk,{hostKind:S,chromeMode:i,children:a}),x&&(0,$.jsx)(qk,{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===ok.COMPOSITE?t:void 0,hidden:E||void 0,children:D})}Wk.displayName=`Section`;function Gk({hostKind:e,sectionProps:t,providesHeading:n=!1}){let{children:r,chromeMode:i,saveable:a,name:o,className:s,disabled:c}=t,l=lk(),u=r;return u=e===ok.FORM?(0,$.jsxs)(ck.Provider,{value:l,children:[(0,$.jsx)(Kk,{hostKind:e,chromeMode:i,children:r}),a&&(0,$.jsx)(qk,{sectionName:o,disabled:c})]}):(0,$.jsx)(Kk,{hostKind:e,chromeMode:i,children:r}),(0,$.jsx)(Vk.Provider,{value:n,children:(0,$.jsx)(`div`,{className:s?`space-y-field ${s}`:`space-y-field`,"data-guidance-section":o,"data-composite-section":e===ok.COMPOSITE?o:void 0,children:u})})}function Kk({hostKind:e,chromeMode:t,children:n}){let{displayChromeMode:r}=ik(),{formChromeMode:i}=qw();return t?e===ok.FORM?(0,$.jsx)(Kw,{formChromeMode:i,sectionChromeMode:t,children:n}):e===ok.DISPLAY?(0,$.jsx)(rk,{displayChromeMode:r,sectionChromeMode:Dfe(t),children:n}):n:n}function qk({sectionName:e,disabled:t}){let n=LC(),r=jT(),i=pk(),[a,o]=(0,Q.useState)(!1),{tComponent:s,isReady:c}=q({component:K.LOW_LEVEL_FORM_MESSAGE}),l=r?.onSectionSave;if(!l||!c)return null;let u=async()=>{if(i.length!==0&&await ZO(n,i)){o(!0);try{let t=n.getValues();await l(e,i,t)}catch(t){Uk.error(`[SectionSaveButton] The section save handler threw.`,{sectionName:e,error:t})}finally{o(!1)}}},d=s(K.LOW_LEVEL_FORM_MESSAGE,`sectionSaving`),f=s(K.LOW_LEVEL_FORM_MESSAGE,`sectionSave`);return(0,$.jsx)(`div`,{className:`flex justify-end pt-item`,children:(0,$.jsx)(Y,{type:`button`,variant:X.SECONDARY,size:df.SM,onClick:u,disabled:t||a||i.length===0,children:a?d:f})})}function Jk(e){return(0,Q.isValidElement)(e)&&e.type===Wk}tl.getLogger();function Yk(e,t){return ofe(e,Jk,t)}function Xk(e){return cfe(e)}function Zk({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=rE()!==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=jT();Lk(t,``);let m=(0,Q.useMemo)(()=>$k(t,p),[t,p]);return(0,$.jsx)(TD.Provider,{value:f,children:(0,$.jsx)(vD,{voice:void 0,children:(0,$.jsx)(SD,{pathPrefix:``,children:(0,$.jsx)(`div`,{className:G(`mr-auto w-full`,e),style:{maxInlineSize:QE(i)},"data-inline-size-tier":i,"data-guidance-form":``,"data-slot":`form-layout`,children:(0,$.jsxs)(Ry,{children:[s.errorSummary?(0,$.jsx)(QD,{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)(eO,{className:`mt-6`}):null]})})})})})}function Qk(e,t){if(!t)return!1;let n=Ck(e);return n!==null&&n.length>0&&n.every(e=>!e.hasOwnSchema&&_r.resolveFieldSchemaPath(t,e.path)===void 0)}function $k(e,t){let n=Yk(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=>!Qk(e.props.children,t?.schema));if(r.length===0)return null;let i={...e.group,sections:r},a=Xk(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)(eA,{sectionProps:e.props,providesHeading:!!o[e.props.name]})}));return(0,$.jsx)(VO,{sections:c,config:a},`group-${i.mode}-${n}`)})})}function eA({sectionProps:e,providesHeading:t}){return(0,$.jsx)(Gk,{hostKind:ok.FORM,sectionProps:e,providesHeading:t})}function tA(e){let t=e.match(/^(.+)\[(\d+)]$/);return t?{key:t[1],index:parseInt(t[2],10)}:{key:e}}function nA(e,t){return Array.isArray(e)?[...e]:typeof e==`object`&&e?{...e}:t?.index==null?{}:[]}function rA(e,t){if(!e)return;let n=t.split(`.`),r=e;for(let e of n){let{key:t,index:n}=tA(e),i=_r.getObjectLikeFieldShape(r,{commonOnly:!1})??null;if(!i||!(t in i))return;if(r=i[t],n!=null){let e=li(r).element;if(!e)return;r=e}}return r}function iA(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}=tA(e);if(r=r[t],n!=null){if(!Array.isArray(r))return;r=r[n]}}return r}function aA(e,t){if(!t||!e)return e;let n=iA(e,t);if(typeof n==`object`&&n&&!Array.isArray(n))return n}function oA(e,t,n){let r=tA(t.split(`.`)[0]).key,i=sA(e??{},t,n);return{[r]:i[r]}}function sA(e,t,n){let r=t.split(`.`).map(tA),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=nA(r[e.index],o);r[e.index]=s,a=s;return}if(i){a[e.key]=n;return}let s=nA(a[e.key],o);a[e.key]=s,a=s}),i}function cA(e,t){if(e==null)return;if(typeof e!=`object`||Array.isArray(e)||!Object.keys(e).some(e=>e===Yo.MOBILE||e===Yo.VERT_TABLET||e===Yo.DESKTOP))return e;let n=e;return n[t]??n[Yo.DESKTOP]??n[Yo.VERT_TABLET]??n[Yo.MOBILE]}var lA=`data-collection-surface`;function uA({className:e,children:t,responsiveMaxWidth:n}){let r=tk(),i=(0,Q.useMemo)(()=>dA(t,r),[t,r]);return(0,$.jsx)(SD,{pathPrefix:``,children:(0,$.jsx)(vD,{voice:Ea.EYEBROW,children:(0,$.jsx)(`div`,{className:G(`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:$E(n),"data-inline-size-tier":n??`derived`,"data-guidance-display":!0,children:i})})})}function dA(e,t){let n=Yk(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=fA(Xk(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)(pA,{sectionProps:e.props,providesHeading:!!a[e.props.name]})}));return(0,$.jsx)(VO,{sections:s,config:i},`group-${r.mode}-${n}`)})})}function fA(e,t,n){if(e.mode!==ci.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 jO(`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?rA(n.schema,c.field):void 0;MO(c,a,l?pt(l):void 0);let u=n.isLoading?null:NO(c,iA(n.data,c.field));return{...e,currentStage:u}}function pA({sectionProps:e,providesHeading:t}){return(0,$.jsx)(Gk,{hostKind:ok.DISPLAY,sectionProps:e,providesHeading:t})}var mA=(0,Q.createContext)(!1);function hA(){return(0,Q.useContext)(mA)}var gA=new Set([jr.ARRAY,jr.SET,jr.TUPLE,jr.RECORD,jr.MAP,jr.OBJECT,jr.VERSIONED_OBJECT,jr.CODE,jr.FILE,jr.ADDRESS]),_A=new Set([ss.MULTILINE,ss.MARKDOWN,ss.UNTRUSTED_HTML]);function vA(e,t,n){return n===ma.SUMMARY?!0:e?gA.has(e)?!0:e===jr.STRING&&!!t&&_A.has(t):!1}function yA({className:e,children:t}){let{displayChromeMode:n}=ik();return(0,$.jsx)(mA.Provider,{value:!0,children:(0,$.jsx)(rk,{displayChromeMode:n,sectionChromeMode:Cu.TILE,children:(0,$.jsx)(`dl`,{"data-slot":`field-tiles`,className:G(`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})})})}yA.displayName=`FieldTiles`;function bA({className:e,children:t}){let{displayChromeMode:n}=ik();return(0,$.jsx)(rk,{displayChromeMode:n,sectionChromeMode:Cu.HIDDEN,children:(0,$.jsx)(`div`,{"data-slot":`record-state`,className:G(`flex min-w-0 flex-wrap items-center gap-x-group gap-y-item [&>*]:w-auto empty:hidden`,e),children:t})})}bA.displayName=`RecordState`;function xA({className:e,children:t}){let{displayChromeMode:n}=ik();return(0,$.jsx)(rk,{displayChromeMode:n,sectionChromeMode:Cu.INLINE,children:(0,$.jsx)(`div`,{"data-slot":`record-keeping-facts`,className:G(`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})})}xA.displayName=`RecordKeepingFacts`;var SA;(function(e){e.STATE=`state`,e.CONTENT=`content`,e.FACT=`fact`,e.RECORD_KEEPING=`record_keeping`,e.IDENTITY_PLUMBING=`identity_plumbing`})(SA||={});var CA=S.BADGE,wA=new Set([Cu.HIDDEN,Cu.COMPACT]);function TA(e){let t=Jr(e)?.chromeMode;return Zl(e)!==jr.OBJECT&&typeof t==`string`&&wA.has(t)}var EA=new Set([...D.filter(e=>!lre.includes(e)),...eee]);function DA(e,t,n){if(U.isIdentityOnlySummaryField(e,n))return SA.IDENTITY_PLUMBING;let r=Zl(t),i=Jr(t);return r===jr.ENUM&&i?.displayMode===CA?SA.STATE:EA.has(e)?SA.RECORD_KEEPING:TA(t)?SA.CONTENT:SA.FACT}function OA(e){if(!e.data||typeof e.data!=`object`)return[];let t=e.registry.resourceConfigurations?.[e.resourceType];if(!U.frontendResourceLabelDefinitionOf(t))return[];let n=U.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=U.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 kA;(function(e){e.DISPLAY=`display`,e.SUMMARY=`summary`})(kA||={});var AA=(0,Q.createContext)(kA.DISPLAY);function jA({kind:e,children:t}){return(0,$.jsx)(AA.Provider,{value:e,children:t})}function MA(){return(0,Q.useContext)(AA)}function NA(e){return PA(e,(0,Q.useContext)(AA))}function PA(e,t){if(t!==kA.SUMMARY)return e?.display;if(e?.display||e?.summaryOverride)return{...e?.display,...e?.summaryOverride}}function FA(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 IA({children:e}){let{displayChromeMode:t}=ik();return(0,$.jsx)(mA.Provider,{value:!1,children:(0,$.jsx)(rk,{displayChromeMode:t,sectionChromeMode:void 0,children:e})})}function LA({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)(IA,{children:i})})]}):(0,$.jsx)($.Fragment,{children:i})}function RA(e,t){if(e!=null)return typeof e==`string`?e:e[t]??e[Yo.DESKTOP]}var zA=(0,Q.createContext)(!1);function BA(){return(0,Q.useContext)(zA)}var VA=new Set([jr.BOOLEAN,jr.NUMBER,jr.BIGINT,jr.BIGDECIMAL,jr.RANGE_NUMBER,jr.RANGE_BIGDECIMAL]),HA=new Set([jr.DATE,jr.DATETIME,jr.TIME,jr.RANGE_DATE,jr.RANGE_DATETIME,jr.RANGE_TIME]),UA=new Set([Cu.COMPACT,Cu.HIDDEN]);function WA(e){return e!==void 0&&VA.has(e)}function GA(e){return!FA(e)}function KA(e){let t=0;return e.map(({schemaType:e,present:n})=>!n||e===void 0||!HA.has(e)?!1:(t+=1,t>1))}function qA(e){let t=KA(e);return e.map(({schemaType:e,present:n},r)=>n&&(WA(e)||t[r]))}function JA(e,t){let n=qA(t);return t.map(({present:t,declaredChrome:r},i)=>{if(!t)return!1;let a=r??e;return a===void 0?n[i]:!UA.has(a)})}var YA=rc(K.LOW_LEVEL_TOOLTIP,`Tooltip`,[`Trigger`,`Content`,`Provider`]);function XA({preset:e=H.DEFAULT,...t}){let n=YA(e);return(0,$.jsx)(n,{...t})}function ZA({preset:e=H.DEFAULT,...t}){let n=YA(e);return(0,$.jsx)(n.Trigger,{...t})}function QA({preset:e=H.DEFAULT,...t}){let n=YA(e);return(0,$.jsx)(n.Content,{...t})}function $A({preset:e=H.DEFAULT,...t}){let n=YA(e);return(0,$.jsx)(n.Provider,{...t})}function ej({provenance:e,className:t}){let n=uae(e.system),r=(0,Q.useMemo)(()=>[n],[n]),{tComponent:i,t:a,formatDateTimeForDisplayMode:o,isReady:s}=q({component:K.LOW_LEVEL_FORM_FIELD,keys:r});if(!s)return null;let c=a(n),l=o(e.currentAsOf,be.AUTO);return(0,$.jsx)(ox,{className:t,"data-field-provenance":``,children:i(K.LOW_LEVEL_FORM_FIELD,`syncedFromAsOf`,{system:c,asOf:l})})}ej.displayName=`DisplayFieldProvenanceNote`;function tj(e,t){return RA(e,t)??Cu.STACKED}function nj({text:e}){let{renderIcon:t}=ef(),{tComponent:n,isReady:r}=q({component:K.LOW_LEVEL_FORM_FIELD});return r?(0,$.jsxs)(XA,{children:[(0,$.jsx)(ZA,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.ICON_SM,className:`ms-1 rounded-full`,"aria-label":n(K.LOW_LEVEL_FORM_FIELD,`moreInformation`),tabIndex:-1,children:t(W.INFO,{size:tr.XS})})}),(0,$.jsx)(QA,{children:e})]}):null}function rj({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}=Ng(),_=hA(),v=g(It.TYPOGRAPHY,Ea.DESCRIPTION),y=g(It.TYPOGRAPHY,Ea.EYEBROW),b=(0,Q.useMemo)(()=>tj(e,m),[e,m]),x=o??(b===Cu.INLINE?`start`:`top`),S=!s&&!!t&&x!==`hidden`&&b!==Cu.COMPACT&&b!==Cu.HIDDEN,C=!c&&!!r&&b!==Cu.COMPACT&&b!==Cu.HIDDEN,w=!!l,T=w?(0,$.jsx)(ej,{provenance:l}):null,E=!S&&!s&&t&&(x===`hidden`||d)?(0,$.jsx)(`span`,{className:`sr-only`,children:d?`${t}: `:t}):null;if(b===Cu.HIDDEN)return(0,$.jsxs)($.Fragment,{children:[E,p]});if(b===Cu.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)(hD,{asChild:!0,variant:V.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:G(`flex min-w-0 flex-col gap-item`,f),children:[o&&(0,$.jsxs)(e,{className:G(`flex min-w-0 items-center`,S&&y.base),children:[o,S&&s&&(0,$.jsx)(nj,{text:s})]}),(0,$.jsxs)(n,{className:`m-0 min-w-0 font-medium [overflow-wrap:anywhere]`,children:[(0,$.jsx)(IA,{children:p}),T]})]})})}if(b===Cu.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===Cu.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:G(`flex flex-wrap items-baseline gap-x-1.5 gap-y-element-xs`,f),children:[E,S&&(0,$.jsxs)(`span`,{className:G(`shrink-0`,v.base),children:[t,`:`,i&&(0,$.jsx)(nj,{text:i})]}),(0,$.jsx)(`div`,{className:`min-w-0`,children:p}),C&&(0,$.jsx)(ox,{className:`w-full`,children:r}),w&&(0,$.jsx)(ej,{provenance:l,className:`w-full`})]});if(b===Cu.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:G(`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`:G(`flex-row gap-section`,C?`items-start`:`items-center`),f),children:[(0,$.jsxs)(`div`,{className:G(`flex min-w-0 flex-col gap-element-xs`,!h&&`flex-1`),children:[E,S&&(0,$.jsxs)(rx,{children:[t,i&&(0,$.jsx)(nj,{text:i})]}),C&&(0,$.jsx)(ox,{children:r})]}),(0,$.jsxs)(`div`,{className:G(`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)(nx,{orientation:tx.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:G(e&&`flex-row-reverse`,f),children:[E,(0,$.jsxs)(ax,{children:[S&&(0,$.jsx)(ix,{children:(0,$.jsxs)(rx,{className:v.base,children:[t,i&&(0,$.jsx)(nj,{text:i})]})}),C&&(0,$.jsx)(ox,{children:r}),T]}),p]})}return(0,$.jsxs)(nx,{orientation:tx.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===Re.TITLE?(0,$.jsxs)(`div`,{className:G(`pt-item-xs`,y.base),children:[t,i&&(0,$.jsx)(nj,{text:i})]}):(0,$.jsxs)(rx,{className:v.base,children:[t,i&&(0,$.jsx)(nj,{text:i})]})),p,C&&(0,$.jsx)(ox,{children:r}),T]})}rj.displayName=`DisplayFieldChrome`;function ij(e){let t=e.parentReferenceConfig,n=[...e.referencedIds];if(!t||t.displayMode!==iu.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 aj=(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 oj(){return(0,Q.useContext)(aj)}var sj=class extends Error{name=`InlineEditMutationError`;mutationError;constructor(e,t){super(e),this.mutationError=t}};function cj(e,t){return e!==Cn.REFERENCE&&e!==Cn.ASSOCIATION?!1:t??!0}function lj(e,t){let n=t.resourceConfigurations?.[e];return n?[...n.resourceRelationships.parentRelationships,...n.resourceRelationships.childRelationships,...n.resourceRelationships.selfRelationships]:[]}function uj(e){let t=e.registry.resourceConfigurations?.[e.relatedResourceType];if(!t)return;let n=(t.operations??[]).filter(e=>!e.isBulkOperation&&(e.operationIdentifier===J.CREATE||e.resourceOperationLike===J.CREATE));return n.find(e=>e.variantKey===`quick-add`)??Gl(n,J.CREATE)??n[0]}function dj(e,t){let n=cj(e.semantics.nature,e.relationship.display?.interaction?.allowQuickCreate);return{sourceKind:`relationshipObject`,relatedResourceType:e.relatedResourceType,relationshipNature:e.semantics.nature,allowQuickCreate:n,relatedCreateOperation:uj({relatedResourceType:e.relatedResourceType,registry:t})}}function fj(e){let t=e.fieldName.split(`.`)[0],n=lj(e.resourceType,e.registry).flatMap(n=>{if(n.resourceType1!==e.resourceType&&n.resourceType2!==e.resourceType)return[];let r=wo.ensureCompiledRelationship.call(wo,n,e.registry.allResourceFieldIdentifiers);if(wo.tryResolveRelationshipForeignKeyIdentity(r,e.registry.allResourceFieldIdentifiers)?.fieldIdentifier!==t)return[];let i=wo.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:cj(i.nature,r.display?.interaction?.allowQuickCreate),relatedCreateOperation:uj({relatedResourceType:a,registry:e.registry})}]});if(n.length<=1)return n[0];if(ui.isDevelopment())throw U.buildConfigurationError(Lu.CONFIGURATION,{resourceType:e.resourceType,fieldName:e.fieldName,reason:`Ambiguous FK relationship quick-create mapping.`,matchCount:n.length})}function pj(e){let t=U.resolveRelationshipObjectFieldSemantics({resourceType:e.resourceType,fieldName:e.fieldName,operationType:e.operationType,registry:e.registry});if(t)return{...t,sourceKind:`relationshipObject`,quickCreate:dj(t,e.registry)}}function mj(e){let t=U.resolveRelationshipObjectFieldSemantics({resourceType:e.resourceType,fieldName:e.fieldName,registry:e.registry});if(t)return{...t,sourceKind:`relationshipObject`,objectIdentity:wo.resolveRelationshipObjectIdentityForResource(t.relationship,e.resourceType,e.registry.allResourceFieldIdentifiers)}}function hj(e){let t=pj(e);if(t)return e.relatedResourceType&&t.relatedResourceType!==e.relatedResourceType?void 0:{sourceFieldName:e.fieldName,quickCreate:t.quickCreate};let n=fj({resourceType:e.resourceType,fieldName:e.fieldName,relatedResourceType:e.relatedResourceType,registry:e.registry});if(n)return{sourceFieldName:e.fieldName,quickCreate:n}}function gj(e){let t=e.resolvedSemantics?.handling?.dtoModelMode;return t?t===bt.NESTED_RESOURCE:wo.resolveRelationshipNature(e).nature===Cn.COMPOSITION}function _j(e){if(!wo.isRelationshipActiveForParent(e.relationship,e.parentData,{onMissingParentResource:`exclude`,onConditionError:`exclude`})||!gj(e.relationship))return;let t=e.relationship.resourceType1===e.parentResourceType?e.relationship.resourceType2:e.relationship.resourceType1,n=wo.tryResolveRelationshipForeignKeyIdentity(e.relationship,e.registry.allResourceFieldIdentifiers);if(!n?.fieldIdentifier)return;let r=e.relationship.display?.inParentNavigation,i=Xa(e.relationship.cardinality2),a=e.viewport??Yo.DESKTOP,o=vj(i),s=Jh(r?.transition,a),c=e.registry.resourceConfigurations[t]?.resourceRelationships,l=c?[...c.parentRelationships,...c.selfRelationships].find(t=>t.resourceType1===e.parentResourceType&&wo.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:U.buildRelationshipEdgeKey({parentResourceType:e.parentResourceType,childResourceType:t,foreignKeyField:n.fieldIdentifier}),navigationConfig:r,transition:s,contentSectionConfig:o,isOneToOne:i}}function vj(e){return e?{mode:ci.INLINE}:{mode:ci.TABS}}function yj(e){if(!e.navigationZone||!Hm.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??iu.CONTEXT,showParentLink:n?.showParentLink??!0}}}function bj(e){let t=e.schema?rs(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),_j({parentResourceType:e.resourceType,relationship:a.relationship,parentData:e.parentData,registry:e.registry})){n.add(a.rootFieldName);continue}if(a.semantics.nature===Cn.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 xj(e){let t={};return e.resourceType&&e.fieldName&&(t.writeSurface=pj({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=hj({resourceType:e.resourceType,fieldName:e.fieldName,operationType:e.operationType,relatedResourceType:e.relatedResourceType,registry:e.registry})),t.navigationSurface=yj({inlineParentContext:e.inlineParentContext,navigationZone:e.navigationZone,navigationInitiator:e.navigationInitiator,getZoneState:e.getZoneState}),t}function Sj(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 Cj(e){if(e)return e.includes(`.`)?e.split(`.`).pop():e}function wj(e){let t=ite(e.schema);if(!t||!e.parentData||!e.currentResourceType||!e.registry)return;let n=Cj(e.fieldName);if(!n)return;let r=wo.getForeignKeyCandidateReferencedTypes(n,e.currentResourceType,e.registry.resourceRelationships);if(r.length!==0)return wo.resolveDiscriminatedPolymorphicForeignKeyTarget({record:e.parentData,discriminatorField:t.discriminatorField,variants:t.variants,candidateReferencedTypes:r,getResourcePrimaryScope:t=>e.registry?.resourceConfigurations[t]?.resourcePrimaryScope})}function Tj(e){return e.explicitResourceType||(e.schema?Br(e.schema)?.referencedResourceType:void 0)||(e.fieldName?e.registry?.fieldIdentifierToResourceType?.[e.fieldName]:void 0)||void 0}function Ej(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 Dj(e){let t=e.resourceLinkTrail?.resourceType??e.currentResourceType,n=Sj(e.fieldName,e.resourceLinkTrail);if(t&&n&&e.registry)return mj({resourceType:t,fieldName:n,registry:e.registry})}function Oj(e){return jw(e)}function kj(e){if(e.schema&&xe(e.schema))return{referencedResourceType:Tj({explicitResourceType:wj({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:Oj(e.value)};let t=Dj(e);if(t&&t.semantics.nature!==Cn.COMPOSITION&&t.objectIdentity)return{referencedResourceType:t.relatedResourceType,referencedIds:Oj(Ej(e.value,t.objectIdentity.relationshipIdentifierField))}}function Aj({noValueLabel:e,typography:t,className:n}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{typography:t,className:G(`text-muted-foreground italic`,n),"aria-hidden":`true`,children:`—`}),(0,$.jsx)(`span`,{className:`sr-only`,children:e})]})}var jj=new Set([jr.NUMBER,jr.BIGDECIMAL,jr.MONEY,jr.DURATION,jr.DATE,jr.TIME,jr.DATETIME,jr.RANGE_NUMBER,jr.RANGE_BIGDECIMAL,jr.RANGE_MONEY,jr.RANGE_DATE,jr.RANGE_TIME,jr.RANGE_DATETIME]);function Mj(e){return e&&jj.has(e)?Ea.DATA:void 0}function Nj({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_BOOLEAN,`DisplayFieldBoolean`)(e);return(0,$.jsx)(n,{...t})}function Pj({preset:e=H.DEFAULT,...t}){let n=qc(K.RESOURCES_FIELDS_RESOURCE_REFERENCE,`ResourceFieldDisplay_ResourceReference`,pa.DISPLAY)(e);return(0,$.jsx)(n,{...t})}function Fj({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_STRING,`DisplayFieldString`)(e);return(0,$.jsx)(n,{...t})}function Ij({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_NUMBER,`DisplayFieldNumber`)(e);return(0,$.jsx)(n,{...t})}function Lj({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_ENUM,`DisplayFieldEnum`)(e);return(0,$.jsx)(n,{...t})}function Rj({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_MONEY,`DisplayFieldMoney`)(e);return(0,$.jsx)(n,{...t})}function zj({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_DURATION,`DisplayFieldDuration`)(e);return(0,$.jsx)(n,{...t})}function Bj({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_PHONE,`DisplayFieldPhone`)(e);return(0,$.jsx)(n,{...t})}function Vj({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_ADDRESS,`DisplayFieldAddress`)(e);return(0,$.jsx)(n,{...t})}function Hj({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_BIGDECIMAL,`DisplayFieldBigDecimal`)(e);return(0,$.jsx)(n,{...t})}function Uj({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_CODE,`DisplayFieldCode`)(e);return(0,$.jsx)(n,{...t})}function Wj(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 Gj({value:e,maxHeight:t,...n}){let r=(0,Q.useMemo)(()=>{let t=Wj(e);return t?{content:t,language:`json`}:null},[e]);return(0,$.jsx)(Uj,{...n,value:r,maxHeight:t,wordWrap:!0})}var Kj=Wo.APPROVAL_SEALS,qj;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(qj||={});var Jj;(function(e){e.IDLE=`idle`,e.CHECKING=`checking`,e.DONE=`done`,e.FAILED=`failed`})(Jj||={});function Yj({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_APPROVAL_SEAL,`ApprovalSeal`)(e);return(0,$.jsx)(n,{...t})}function kfe(e){return typeof e==`string`&&e.length>0?e:void 0}var Afe=3e3,jfe=20;function Mfe(e){return Rr(e)&&e.errorType===Mc.NOT_FOUND}function Xj(e){let[t,n]=(0,Q.useState)({state:qj.LOADING}),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)({state:Jj.IDLE}),[s,c]=(0,Q.useState)(!1),l=e?.key;(0,Q.useEffect)(()=>{if(!e)return;let t=!0,r=0,a;n({state:qj.LOADING}),i(!1),o({state:Jj.IDLE});let s=()=>{Promise.resolve().then(e.load).then(i=>{t&&(n({state:qj.READY,view:i}),e.pollWhilePending&&i.state===fu.PENDING&&r<jfe&&(r+=1,a=setTimeout(s,Afe)))}).catch(r=>{t&&(e.notFoundIsNone&&Mfe(r)?i(!0):n({state:qj.FAILED}))})};return s(),()=>{t=!1,a&&clearTimeout(a)}},[l]);let u=t.view?.jws;return{read:t,none:r,check:a,onCheck:(0,Q.useCallback)(()=>{u&&(o({state:Jj.CHECKING}),vc().checkApprovalSeal(u).then(e=>o({state:Jj.DONE,outcome:Ane(e)})).catch(()=>o({state:Jj.FAILED})))},[u]),onDownloadManifestedCopy:(0,Q.useCallback)(()=>{e?.download&&(c(!0),e.download().then(t=>My(t,e.downloadName)).catch(()=>void 0).finally(()=>c(!1)))},[l]),downloading:s}}function Zj({state:e,offersCopy:t=!0,movedFieldLabels:n,description:r,className:i}){let{tResourceFieldEnumValue:a}=q(),{read:o,check:s,onCheck:c,onDownloadManifestedCopy:l,downloading:u}=e,d=o.view,f=Zne.shape;return(0,$.jsx)(Yj,{readState:o.state,...d?{view:d}:{},...n?{movedFieldLabels:n}:{},...r?{description:r}:{},...d?.meaning?{meaningLabel:a(Kj,`meaning`,d.meaning,f.meaning)}:{},...d?.outcome?{outcomeLabel:a(Kj,`outcome`,d.outcome,f.outcome)}:{},checkState:s.state,...s.outcome?{checkOutcome:s.outcome}:{},...d?.jws?{onCheck:c}:{},...t&&d?.deliverable?.manifestedCopyAvailable?{onDownloadManifestedCopy:l,downloadingManifestedCopy:u}:{},...i?{className:i}:{}})}function Nfe({field:e,hideWhenNone:t,className:n}){let{resourceType:r,resourceId:i}=oj(),a=tk(),o=a?.data,s=kfe(o?.[e]),c=Pfe(o),l=s&&r&&i?{sealId:s,resourceType:String(r),resourceId:String(i),field:e}:void 0,u=Xj(l?{key:`${l.sealId}|${l.resourceType}|${l.resourceId}|${e}|${c}`,load:()=>vc().readApprovalSealOnRecord(l),download:()=>vc().downloadApprovalSealManifestedCopy(l),downloadName:`approval-${l.sealId}.pdf`}:void 0);if(!o)return null;if(!l)return t||!r?null:(0,$.jsx)(Yj,{readState:qj.READY,view:{sealId:``,state:fu.NO_SEAL},...n?{className:n}:{}});let d=u.read.view?.currency?.movedFields.map(e=>a?.fieldLabels?.[e]??e);return(0,$.jsx)(Zj,{state:u,...d?{movedFieldLabels:d}:{},...n?{className:n}:{}})}function Pfe(e){let t=e?.updatedAt,n=t instanceof Date?t.toISOString():typeof t==`string`?t:``,[r,i]=(0,Q.useState)(0),a=(0,Q.useRef)(e);return(0,Q.useEffect)(()=>{a.current!==e&&(a.current=e,n||i(e=>e+1))},[e,n]),n||String(r)}function Qj({fileId:e,className:t}){let n=Xj({key:e,load:()=>vc().readApprovalSealOnFile(e),download:()=>vc().downloadApprovalSealFileManifestedCopy(e),downloadName:`approval-${e}.pdf`,notFoundIsNone:!0});return n.none||n.read.state===qj.LOADING?null:(0,$.jsx)(Zj,{state:n,...t?{className:t}:{}})}function $j({decisionRef:e,description:t,className:n}){let r=Xj({key:e,load:()=>vc().readApprovalSealOfDecision(e),downloadName:`approval-${e}.pdf`,notFoundIsNone:!0,pollWhilePending:!0});return r.none?null:(0,$.jsx)(Zj,{state:r,offersCopy:!1,...t?{description:t}:{},...n?{className:n}:{}})}function eM({preset:e=H.DEFAULT,...t}){let{httpClient:n}=Su(),r=(0,Q.useMemo)(()=>({get:async e=>n.get(e),getBlob:(e,t)=>n.fetchFileBlob(e,t)}),[n]),i=qc(K.LOW_LEVEL_DISPLAY_FIELD_FILE,`DisplayFieldFile`)(e),a=MA(),o=tk(),s=a===kA.DISPLAY&&o!==null,c=t.value&&`fileId`in t.value?t.value.fileId:void 0,l=typeof c==`string`&&c.length>0?c:void 0;return!s||!l?(0,$.jsx)(i,{...t,httpOperations:r}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(i,{...t,httpOperations:r}),(0,$.jsx)(Qj,{fileId:l})]})}function tM({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_RANGE_BIGDECIMAL,`DisplayFieldRangeBigDecimal`)(e);return(0,$.jsx)(n,{...t})}function nM({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_RANGE_MONEY,`DisplayFieldRangeMoney`)(e);return(0,$.jsx)(n,{...t})}function rM({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_DATE,`DisplayFieldDate`)(e);return(0,$.jsx)(n,{...t})}function iM({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_DATETIME,`DisplayFieldDateTime`)(e);return(0,$.jsx)(n,{...t})}function aM({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_TIME,`DisplayFieldTime`)(e);return(0,$.jsx)(n,{...t})}function oM({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_RANGE_NUMBER,`DisplayFieldRangeNumber`)(e);return(0,$.jsx)(n,{...t})}function sM({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_RANGE_DATE,`DisplayFieldRangeDate`)(e);return(0,$.jsx)(n,{...t})}function cM({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_RANGE_DATETIME,`DisplayFieldRangeDateTime`)(e);return(0,$.jsx)(n,{...t})}function lM({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_RANGE_TIME,`DisplayFieldRangeTime`)(e);return(0,$.jsx)(n,{...t})}var uM=tl.getLogger(),Ffe=uM.debugByType(`DisplayValueDispatcher`);uM.setDebugTypeLogging(`DisplayValueDispatcher`,!1);function Ife(e){return e?[...e.parentRelationships??[],...e.childRelationships??[],...e.selfRelationships??[]]:[]}function dM(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 fM(e,t,n,r){if(!e||!t||!r)return null;let i=Cj(e);if(!i)return null;if(n){let e=r.resourceConfigurations[n]?.resourceRelationships;for(let a of Ife(e))try{let e=wo.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)&&dM({record:o,resourceType:s,registry:r}))return o}catch{}}let a=Wie.extractBaseName(i);if(!a||a===i)return null;let o=t[a];return o&&typeof o==`object`&&!Array.isArray(o)&&dM({record:o,resourceType:r.fieldIdentifierToResourceType?.[i],registry:r})?o:null}function pM(e){let t=e.value,n=t?.fileIds?.length??+!!t?.fileId;return n>0?(0,$.jsx)(Z,{className:e.className,children:e.tComponent(K.LOW_LEVEL_FORM_FIELD,`fileCount`,{count:n})}):(0,$.jsx)(Z,{className:G(`text-muted-foreground italic`,e.className),children:e.tComponent(K.LOW_LEVEL_FORM_FIELD,`noFile`)})}function mM(e){return typeof e?.getMetadata==`string`&&e.getMetadata.trim()!==``}var Lfe=5;function hM(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)(pm,{className:`h-5 w-full`});default:return(0,$.jsx)(Aj,{noValueLabel:t,typography:Mj(n)})}}function gM({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:y,isReady:b}=q({component:[K.LOW_LEVEL_FORM_FIELD,K.LOW_LEVEL_BUTTON]}),x=Q.useContext(sm)?.registry,{resourceType:S}=oj(),{getRecipe:C}=Ng(),{renderIcon:w}=ef(),T=C(It.INDICATOR,Il.ERROR),E=C(It.TYPOGRAPHY,Ea.LABEL),D=C(It.TYPOGRAPHY,Ea.BODY),O=C(It.DIVIDER),k={schema:e,label:i,className:a,forceDisplayLabel:!1,forceDisplayDescription:!1,forceHideLabel:!0,forceHideDescription:!0},A=MA(),j=l?.resourceType,M=l?.pathPrefix,N=Q.useMemo(()=>Dj({fieldName:r,resourceLinkTrail:l,currentResourceType:S,registry:x}),[r,j,M,S,x]),P=N?.objectIdentity,F=Q.useMemo(()=>{if(P)return Ej(n,P.relationshipIdentifierField)},[P,n]);if(!b)return null;if((l?.linkDepth??0)>=Lfe)return(0,$.jsx)(Z,{className:`text-muted-foreground italic text-sm`,children:_(K.LOW_LEVEL_FORM_FIELD,`resourceLinkLimitReached`)});let I=t=>_(K.LOW_LEVEL_FORM_FIELD,Sie[Lt(e,t)]),L=t===jr.UNKNOWN?Us(n)??jr.UNKNOWN:t;if(n==null||L===jr.STRING&&n===``)return hM(d,I(!1),L);if(s){let t={schema:e,className:a};switch(s){case`string`:return(0,$.jsx)(Fj,{...t,value:n});case`number`:return(0,$.jsx)(Ij,{...t,value:n});case`boolean`:return(0,$.jsx)(Nj,{...t,value:n});case`enum`:return(0,$.jsx)(Lj,{...t,value:n,labels:o});case`code`:return(0,$.jsx)(Uj,{...t,value:n});case`money`:return(0,$.jsx)(Rj,{...t,value:n});case`duration`:return(0,$.jsx)(zj,{...t,value:n});case`phone`:return(0,$.jsx)(Bj,{...t,value:n});case`address`:return(0,$.jsx)(Vj,{...t,value:n});case`bigdecimal`:return(0,$.jsx)(Hj,{...t,value:n});case`file`:{let e=r?_r.normalizeSchemaFieldPath(r):void 0,i=e&&f?.[e];return mM(i)?(0,$.jsx)(eM,{...t,fieldName:r,value:n,endpoints:{getMetadata:i.getMetadata,serve:i.serve}}):pM({value:n,className:t.className,tComponent:_})}case`date`:return(0,$.jsx)(rM,{...t,value:n});case`time`:return(0,$.jsx)(aM,{...t,value:n});case`datetime`:return(0,$.jsx)(iM,{...t,value:n});case`range-number`:return(0,$.jsx)(oM,{...t,value:n});case`range-date`:return(0,$.jsx)(sM,{...t,value:n});case`range-time`:return(0,$.jsx)(lM,{...t,value:n});case`range-datetime`:return(0,$.jsx)(cM,{...t,value:n});case`range-bigdecimal`:return(0,$.jsx)(tM,{...t,value:n});case`range-money`:return(0,$.jsx)(nM,{...t,value:n});case`simple-text`:break;default:Ffe(`Unrecognized displayComponent — falling back to schema-type dispatch`,{displayComponent:s,fieldName:r})}}if(L===jr.VERSIONED_FOREIGN_KEY){let t=fM(r,c,S,x);return(0,$.jsx)(Pj,{fieldName:r||``,value:n,data:t??void 0,labelFallback:Ln(e,c),displayParams:Nt(e),schema:e,className:a})}if(xe(e)){let t=fM(r,c,S,x),i=wj({schema:e,fieldName:r,parentData:c,currentResourceType:S,registry:x});return(0,$.jsx)(Pj,{fieldName:r||``,value:n,data:t??void 0,labelFallback:Ln(e,c),resourceType:i,displayParams:Nt(e),schema:e,className:a})}if(ls(e)&&n&&typeof n==`object`&&!Array.isArray(n)){let{resourceType:t,resourceId:i}=n;if(typeof t==`string`&&t!==``&&typeof i==`string`&&i!==``)return(0,$.jsx)(Pj,{fieldName:r||``,value:i,resourceType:t,schema:e,className:a})}if(N&&N.semantics.nature!==Cn.COMPOSITION&&P)return(0,$.jsx)(Pj,{fieldName:r||``,value:F??null,data:!Array.isArray(n)&&n&&typeof n==`object`?n:void 0,resourceType:N.relatedResourceType,className:a});let R=N&&r?{resourceType:N.relatedResourceType,pathPrefix:r,linkDepth:(l?.linkDepth??0)+1}:l;if(L===jr.ARRAY&&Array.isArray(n)){if(n.length===0)return hM(d,I(!0));let t=li(e).element,s=t?Zl(t):jr.UNKNOWN,c=os(e),l=PA(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===Vc.CHIPS&&s===jr.STRING&&!u)return(0,$.jsxs)(`div`,{role:`list`,"aria-label":i||r||_(K.LOW_LEVEL_FORM_FIELD,`list`),"data-list-style":`chips`,className:G(`flex flex-row flex-wrap gap-item`,a),children:[v.map((e,t)=>(0,$.jsx)(Jd,{role:`listitem`,variant:`secondary`,children:String(e)},t)),y>0&&!p&&(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.SM,"aria-label":_(K.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y}),onClick:m,children:_(K.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y})})]});let b=c?.objectItemLayout??Hs.CARD,x=s===jr.OBJECT&&t?Jt(t):null,S=b===Hs.ROW&&!!x,C=s!==jr.OBJECT&&!u&&f!==`horizontal`&&(l?.listStyle===void 0||l.listStyle===Vc.PLAIN);return(0,$.jsxs)(`div`,{role:`list`,"aria-label":i||r||_(K.LOW_LEVEL_FORM_FIELD,`list`),"data-list-shape":C?`primitive`:void 0,className:G(S?`flex w-full min-w-0 flex-col gap-element`:f===`horizontal`||l?.listStyle===Vc.CHIPS?`flex flex-row gap-element flex-wrap`:l?.listStyle===Vc.SEPARATED?`flex flex-col divide-y divide-border`:s===jr.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:G(s===jr.OBJECT&&`py-item-xs`,l?.listStyle===Vc.SEPARATED&&`py-card-sm first:pt-0 last:pb-0`),children:a??(0,$.jsx)(_R,{schema:t??e,schemaType:s,value:n,enumLabels:o,name:r?`${r}[${i}]`:void 0,resourceLinkTrail:R})},i)}):S&&x?v.map((e,n)=>{let i=e&&typeof e==`object`?e:{},a=ua(t),o=_r.getArrayItemPrimaryField(t).name,s=[...a.filter(e=>Zl(x[e])===jr.BOOLEAN),...a.filter(e=>Zl(x[e])!==jr.BOOLEAN)];return(0,$.jsx)(`div`,{role:`listitem`,className:`flex w-full min-w-0 items-center gap-element`,children:(0,$.jsx)(rk,{displayChromeMode:Cu.COMPACT,sectionChromeMode:void 0,children:s.map(e=>(0,$.jsx)(_R,{schema:x[e],schemaType:Zl(x[e]),value:i[e],hideLabel:e===o,labelPlacement:e===o?void 0:`hidden`,name:r?`${r}[${n}].${e}`:void 0,className:G(`w-auto`,e===o?`min-w-0 flex-1 [overflow-wrap:anywhere]`:Zl(x[e])===jr.STRING?`min-w-0 [overflow-wrap:anywhere]`:`shrink-0`),resourceLinkTrail:R},e))})},n)}):v.map((n,i)=>(0,$.jsx)(`div`,{role:`listitem`,className:G(l?.listStyle===Vc.BULLETS&&s!==jr.OBJECT&&f!==`horizontal`&&`ms-4 list-item list-disc marker:text-muted-foreground/60`,s===jr.OBJECT&&!S&&f!==`horizontal`&&`py-item-xs`),children:(0,$.jsx)(_R,{schema:t??e,schemaType:s,value:n,enumLabels:o,name:r?`${r}[${i}]`:void 0,resourceLinkTrail:R})},i)),y>0&&!p&&(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.SM,className:`self-start`,"aria-label":_(K.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y}),onClick:m,children:_(K.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y})})]})}if((L===jr.OBJECT||L===jr.VERSIONED_OBJECT)&&typeof n==`object`){let t=wte(e,n),o=t??e,s=Jt(o),c=ua(o),l=(t?or(t):void 0)??or(e),u=l?.display?.displayMode||`vertical`,f=l?.display?.maxItems||void 0;if(!s||c.length===0)return hM(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&&Jr(s[e])?.chromeMode===Cu.COMPACT):[];return(0,$.jsxs)(`div`,{role:`group`,"aria-label":i||r||_(K.LOW_LEVEL_FORM_FIELD,`object`),className:G(`ps-card relative`,u===`horizontal`?`flex flex-row gap-field flex-wrap`:`flex flex-col gap-element`,a),children:[(0,$.jsx)(`div`,{className:G(`absolute start-0 top-0 bottom-0 w-0.5`,O.base),"aria-hidden":`true`}),(0,$.jsx)(ak,{children:v.map(e=>{let t=s[e],i=Zl(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)(_R,{schema:t,schemaType:i,value:a,name:o,hideLabel:!0,parentData:n,resourceLinkTrail:R})}),b.map(e=>(0,$.jsx)(_R,{schema:s[e],schemaType:Zl(s[e]),value:n[e],name:r?`${r}.${e}`:e,parentData:n,resourceLinkTrail:R},e))]},e):(0,$.jsx)(_R,{schema:t,schemaType:i,value:a,name:o,className:u===`horizontal`?`w-auto`:void 0,parentData:n,resourceLinkTrail:R},e)})}),y>0&&!h&&(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.SM,className:`self-start`,"aria-label":_(K.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y}),onClick:g,children:_(K.LOW_LEVEL_FORM_FIELD,`showMore`,{count:y})})]})}if(L===jr.BOOLEAN)return(0,$.jsx)(Nj,{...k,value:n});if(L===jr.ENUM)return(0,$.jsx)(Lj,{...k,value:n,labels:o});if(L===jr.STRING)return(0,$.jsx)(Fj,{...k,value:n});if(L===jr.NUMBER||L===jr.BIGINT)return(0,$.jsx)(Ij,{...k,value:n});if(L===jr.MONEY)return(0,$.jsx)(Rj,{...k,value:n});if(L===jr.DURATION)return(0,$.jsx)(zj,{...k,value:n});if(L===jr.PHONE)return(0,$.jsx)(Bj,{...k,value:n});if(L===jr.ADDRESS)return(0,$.jsx)(Vj,{...k,value:n});if(L===jr.BIGDECIMAL)return(0,$.jsx)(Hj,{...k,value:n});if(L===jr.CODE)return(0,$.jsx)(Uj,{...k,value:n});if(L===jr.FILE){let e=r?_r.normalizeSchemaFieldPath(r):void 0,t=e&&f?.[e];return mM(t)?(0,$.jsx)(eM,{...k,fieldName:r,value:n,endpoints:{getMetadata:t.getMetadata,serve:t.serve}}):pM({value:n,className:a,tComponent:_})}if(L===jr.RANGE_BIGDECIMAL)return(0,$.jsx)(tM,{...k,value:n});if(L===jr.RANGE_MONEY)return(0,$.jsx)(nM,{...k,value:n});if(L===jr.DATE)return(0,$.jsx)(rM,{...k,value:n});if(L===jr.DATETIME)return(0,$.jsx)(iM,{...k,value:n});if(L===jr.TIME)return(0,$.jsx)(aM,{...k,value:n});if(L===jr.RANGE_NUMBER)return(0,$.jsx)(oM,{...k,value:n});if(L===jr.RANGE_DATE)return(0,$.jsx)(sM,{...k,value:n});if(L===jr.RANGE_DATETIME)return(0,$.jsx)(cM,{...k,value:n});if(L===jr.RANGE_TIME)return(0,$.jsx)(lM,{...k,value:n});if(L===jr.RECORD&&typeof n==`object`&&n){let t=Object.entries(n);if(t.length===0)return hM(d,I(!0));let i=v(e),o=Kee(e),s=o?Bl(o):void 0,c=e=>{if(!s)return e;let t=ye(s,e),n=y(t);return n===t?e:n};return(0,$.jsxs)(`div`,{className:G(`ps-card relative flex flex-col gap-element`,a),children:[(0,$.jsx)(`div`,{className:G(`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:G(E.base,`shrink-0`),children:c(e)}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(_R,{schema:i??void 0,schemaType:i?Zl(i):void 0,value:t,name:r?`${r}.${e}`:e,hideLabel:!0,parentData:n,resourceLinkTrail:R})})]},e))]})}if(L===jr.SET&&(n instanceof Set||Array.isArray(n))){let t=Array.from(n);if(t.length===0)return hM(d,I(!0));let i=Ire(e);return(0,$.jsx)(`div`,{className:G(`flex flex-col gap-element-xs`,a),children:t.map((e,t)=>(0,$.jsx)(_R,{schema:i??void 0,schemaType:i?Zl(i):void 0,value:e,name:r?`${r}.${t}`:String(t),hideLabel:!0,resourceLinkTrail:R},`${r??`set`}-${t}`))})}if(L===jr.TUPLE&&Array.isArray(n)){if(n.length===0)return hM(d,I(!0));let t=gne(e);return(0,$.jsx)(`div`,{className:G(`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)(_R,{schema:i??void 0,schemaType:i?Zl(i):void 0,value:e,name:r?`${r}.${n}`:String(n),hideLabel:!0,resourceLinkTrail:R})},`${r??`tuple`}-${n}`)})})}if(L===jr.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 hM(d,I(!0));let i=vr(e);return(0,$.jsxs)(`div`,{className:G(`ps-card relative flex flex-col gap-element`,a),children:[(0,$.jsx)(`div`,{className:G(`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:G(E.base,`shrink-0`),children:(0,$.jsx)(_R,{schema:i?.keySchema??void 0,schemaType:i?.keySchema?Zl(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)(_R,{schema:i?.valueSchema??void 0,schemaType:i?.valueSchema?Zl(i.valueSchema):void 0,value:t,name:r?`${r}.${n}.value`:`${n}.value`,hideLabel:!0,resourceLinkTrail:R})})]},`${r??`map`}-${n}`))]})}return L===jr.UNKNOWN?(0,$.jsx)(Gj,{...k,value:n}):(0,$.jsxs)(`div`,{className:G(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:_(K.LOW_LEVEL_FORM_FIELD,`unsupportedDisplayType`)}),(0,$.jsx)(s_,{className:G(`px-item-xs rounded`,T.states.hover),children:L})]})}gM.displayName=`DisplayValueDispatcher`;function _M(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)(rj,{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)(gM,{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)})})}_M.displayName=`DisplayFieldReadOnly`;function vM(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}=Ng(),x=b(It.TYPOGRAPHY,Ea.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)(ST,{className:`sr-only`,children:a}),a!=null&&!p&&!D&&(g===Re.TITLE?(0,$.jsx)(`div`,{className:G(`pt-item-xs`,x.base),children:a}):(0,$.jsx)(ST,{children:a})),o!=null&&!m&&(0,$.jsx)(ox,{children:o}),(0,$.jsx)(gM,{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)})]})}vM.displayName=`DisplayFieldReadOnlyArraySection`;function yM(e){return e.replace(/\[(\d+)\]/g,`.$1`)}function bM(e,t){let n=yM(e),r=yM(t);return r===n||r.startsWith(n+`.`)}function xM(e,t){return bM(e,t)||bM(t,e)}function SM(e,t){return t?yM(t).split(`.`).filter(Boolean).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e):e}var CM=()=>()=>{},Rfe={lastEvent:null},wM=()=>Rfe,TM=tl.getLogger(),EM=TM.debugByType(`FormErrorExtraction`);TM.setDebugTypeLogging(`FormErrorExtraction`,!1);function DM(e){if(!e||typeof e!=`object`)return EM(`extractServerValidationErrors: not an object, skipping`,{errorType:typeof e}),null;let t=e;if(t.customMessageReference===Lu.VERSION_CONFLICT)return EM(`extractServerValidationErrors: version conflict, not a validation error`),null;EM(`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(OM(n)&&zfe(r))return EM(`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(OM(e)&&t){let n=qne(t);if(n&&Object.keys(n).length>0)return EM(`extractServerValidationErrors: MATCHED via raw response`,{httpStatus:e,fieldCount:Object.keys(n).length,fields:Object.keys(n)}),{httpStatus:e,validationErrors:n}}}return EM(`extractServerValidationErrors: NO validation errors found`),null}function OM(e){return e===400||e===409||e===422}function zfe(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length>0}var Bfe=Object.freeze([]);function Vfe(e){let{declaration:t,record:n,appConfig:r,fieldName:i}=e,a=t?.readsFields??Bfe,o=NC({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=Hfe(t?.readsReferences);return(0,Q.useMemo)(()=>t?Wl(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)):pie,[t,r,n,c,l,i])}function Hfe(e){let t=(0,Q.useMemo)(()=>Object.keys(e??{}),[e]),n=NC({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}=fm(),{t:o,formatDate:s,formatDateTime:c}=q({}),l=MD(),u=tC(),d=(0,Q.useMemo)(()=>l?.contextResourceIdentifiers?U.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=Gl(i.registry.resourceConfigurations?.[t]?.operations??[],J.READ)??null;Nw({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 kM=(0,Q.createContext)(null);function AM(e){let t=(0,Q.useContext)(kM);(0,Q.useEffect)(()=>(t?.registerField(e),()=>{t?.unregisterField(e)}),[e,t])}var jM=tl.getLogger(),MM=jM.debugByType(`FieldUniquenessValidation`);jM.setDebugTypeLogging(`FieldUniquenessValidation`,!1);function Ufe({fieldName:e,fieldSchema:t}){let n=MD(),r=LC(),{httpClient:i}=Su(),{tErrorValidation:a}=q(),o=(0,Q.useRef)(null),s=(0,Q.useRef)(!1),c=t?Mr(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}MM(`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 MM(`Uniqueness check response`,{fieldName:e,valid:o.valid,error:o.error}),!o.valid&&o.error?(r.setError(e,{type:$w,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`){MM(`Uniqueness check aborted (superseded)`,{fieldName:e});return}jM.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 Wfe(e){return e==null||e===``||Array.isArray(e)&&e.length===0}function NM(e){let t=LC(),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&&Wfe(a)?(t.setValue(e,a,{shouldTouch:!0,shouldDirty:!1,shouldValidate:!1}),!0):(r(),!1)},[t,e]),noteInputReceived:(0,Q.useCallback)(()=>{n.current=!0},[])}}var PM=(0,Q.createContext)({}),FM=(0,Q.createContext)(void 0);function IM({invalid:e,describedBy:t,labelId:n,children:r}){let i=t.filter(Boolean).join(` `),a=(0,Q.useMemo)(()=>({...e?{"aria-invalid":!0}:{},...i?{"aria-describedby":i}:{}}),[e,i]);return(0,$.jsx)(PM.Provider,{value:a,children:(0,$.jsx)(FM.Provider,{value:n,children:r})})}function LM(){return(0,Q.useContext)(PM)}function RM(){return(0,Q.useContext)(FM)}function zM({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AUTOSAVE_INDICATOR,`AutosaveIndicator`)(e);return(0,$.jsx)(n,{...t})}function BM(e,t){let{saveState:n,saveErrorMessage:r,onRetrySave:i,variant:a=`block`}=t;return!n||n===Yw.IDLE?e:a===`inline`?(0,$.jsxs)(`div`,{className:`relative inline-flex`,children:[e,(0,$.jsx)(zM,{state:n,errorMessage:r,onRetry:i,position:`inline`,className:`ml-element`})]}):(0,$.jsxs)(`div`,{className:`relative`,children:[e,(0,$.jsx)(zM,{state:n,errorMessage:r,onRetry:i,position:`absolute-right`,className:i?void 0:`pointer-events-none`})]})}function VM(e,t,n){return e==null?bc.STACKED:typeof e==`string`?e:e[t]??e[Yo.DESKTOP]??bc.STACKED}function HM({text:e}){let{renderIcon:t}=ef(),{tComponent:n,isReady:r}=q({component:K.LOW_LEVEL_FORM_FIELD});return r?(0,$.jsxs)(XA,{children:[(0,$.jsx)(ZA,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.ICON_SM,className:`ms-1 rounded-full`,"aria-label":n(K.LOW_LEVEL_FORM_FIELD,`moreInformation`),tabIndex:-1,children:t(W.INFO,{size:tr.XS})})}),(0,$.jsx)(QA,{children:e})]}):null}function UM({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}=Ng(),x=(0,Q.useMemo)(()=>VM(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===bc.INLINE?`inline`:`top`),D=!o&&!!t&&E!==`hidden`&&x!==bc.COMPACT&&x!==bc.HIDDEN,O=!s&&!!n&&x!==bc.COMPACT&&x!==bc.HIDDEN,k=!c&&!!r&&x!==bc.HIDDEN,A=!o&&t&&E===`hidden`?(0,$.jsx)(rx,{id:T,htmlFor:S,className:`sr-only`,children:t}):null,j=E===`start`||E===`inline`?`inline`:`block`,M=BM((0,$.jsx)(IM,{invalid:!!r,describedBy:[O?C:void 0,k?w:void 0],labelId:D||A?T:void 0,children:(0,$.jsx)(EE,{fieldName:p,label:t,disabled:m,onSaveFieldNow:f,children:v})}),{saveState:l,saveErrorMessage:u,onRetrySave:d,variant:j});if(x===bc.HIDDEN)return(0,$.jsxs)($.Fragment,{children:[A,M]});if(x===bc.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)(sx,{id:w,children:r})]});if(E===`start`||E===`inline`){let e=(0,$.jsxs)(ax,{children:[D&&(0,$.jsx)(ix,{children:(0,$.jsxs)(rx,{id:T,htmlFor:S,children:[t,i&&(0,$.jsx)(`span`,{className:`text-destructive ms-0.5`,"aria-hidden":`true`,children:`*`}),h&&(0,$.jsx)(HM,{text:h})]})}),O&&(0,$.jsx)(ox,{id:C,children:n}),k&&(0,$.jsx)(sx,{id:w,children:r})]});return(0,$.jsxs)(nx,{orientation:tx.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===bc.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:G(`flex flex-col gap-field`,_),children:[A,D&&(0,$.jsxs)(`label`,{id:T,htmlFor:S,className:G(`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)(HM,{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===bc.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:G(`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`:G(`flex-row gap-section`,O?`items-start`:`items-center has-[textarea]:items-start`),_),children:[(0,$.jsxs)(`div`,{className:G(`flex min-w-0 flex-col gap-element-xs`,!e&&`flex-1`),children:[A,D&&(0,$.jsxs)(`label`,{id:T,htmlFor:S,className:G(`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)(HM,{text:h})]}),O&&(0,$.jsx)(ox,{id:C,children:n})]}),(0,$.jsxs)(`div`,{className:G(`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)(sx,{id:w,children:r})]})]})}return(0,$.jsxs)(nx,{orientation:tx.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)(rx,{id:T,htmlFor:S,children:[t,i&&(0,$.jsx)(`span`,{className:`text-destructive ms-0.5`,"aria-hidden":`true`,children:`*`}),h&&(0,$.jsx)(HM,{text:h})]}),M,O&&(0,$.jsx)(ox,{id:C,children:n}),k&&(0,$.jsx)(sx,{id:w,children:r})]})}UM.displayName=`FormFieldChrome`;var WM=rc(K.LOW_LEVEL_SLIDER,`Slider`,[`Root`]),Gfe=kl(K.LOW_LEVEL_RANGE_SLIDER,`RangeSlider`),GM=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=WM(e);return(0,$.jsx)(r,{...t,ref:n})});GM.displayName=`Slider`;var KM=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=WM(e);return(0,$.jsx)(r.Root,{...t,ref:n})});KM.displayName=`SliderRoot`;var qM=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=Gfe(e);return(0,$.jsx)(r,{...t,ref:n})});qM.displayName=`RangeSlider`;var JM=rc(K.LOW_LEVEL_INPUT,`Input`,[`Root`]),YM=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=JM(e);return(0,$.jsx)(r,{...t,ref:n})});YM.displayName=`Input`;var XM=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=JM(e);return(0,$.jsx)(r.Root,{...t,ref:n})});XM.displayName=`InputRoot`;var ZM=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_DATEPICKER,`DatePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});ZM.displayName=`DatePicker`;var QM=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=q({component:K.LOW_LEVEL_FORM_FIELD_DATE}),i=n?.dateFormat;return(0,$.jsx)(ZM,{ref:t,...e,dateFormat:i,calendarDate:e.schema?go(e.schema):!1,timeZone:n?.timezone})}),$M=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_DATE,`FormFieldDate`)(e);return(0,$.jsx)(r,{...t,ref:n})});$M.displayName=`FormFieldDate`;var eN=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_DATETIME_PICKER,`DateTimePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});eN.displayName=`DateTimePicker`;var tN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=q({component:K.LOW_LEVEL_FORM_FIELD_DATETIME});return(0,$.jsx)(eN,{ref:t,...e,dateFormat:n?.dateFormat,timeFormat:n?.timeFormat,timeZone:n?.timezone})}),nN=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_DATETIME,`FormFieldDateTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});nN.displayName=`FormFieldDateTime`;var rN=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_TIMEPICKER,`TimePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});rN.displayName=`TimePicker`;var iN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=q({component:K.LOW_LEVEL_FORM_FIELD_TIME});return(0,$.jsx)(rN,{ref:t,...e,timeFormat:n?.timeFormat})}),aN=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_TIME,`FormFieldTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});aN.displayName=`FormFieldTime`;var oN=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=Nf.MD},y)=>{let{tComponent:b,isReady:x}=q({component:K.LOW_LEVEL_FORM_FIELD_RANGE_NUMBER}),S=Ka(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=b_(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`,L=`${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)(XM,{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:L,className:`sr-only`,children:f}),(0,$.jsx)(XM,{id:L,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(K.LOW_LEVEL_FORM_MESSAGE,`rangeFromMustBeLessThanTo`)})]}):null}),sN=Q.forwardRef(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_RANGE_NUMBER,`FormFieldRangeNumber`)(e);return(0,$.jsx)(r,{...t,ref:n})});sN.displayName=`FormFieldRangeNumber`;var cN=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_DATE_RANGE_PICKER,`DateRangePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});cN.displayName=`DateRangePicker`;var lN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=q({component:K.LOW_LEVEL_FORM_FIELD_RANGE_DATE}),i=e.schema?Ka(e.schema):void 0,a=e.minDate??ii(i?.min),o=e.maxDate??ii(i?.max),s=i?!i.fromOptional:!1,c=i?!i.toOptional:!1;return(0,$.jsx)(cN,{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})}),uN=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_RANGE_DATE,`FormFieldRangeDate`)(e);return(0,$.jsx)(r,{...t,ref:n})});uN.displayName=`FormFieldRangeDate`;var dN=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_DATETIME_RANGE_PICKER,`DateTimeRangePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});dN.displayName=`DateTimeRangePicker`;var fN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=q({component:K.LOW_LEVEL_FORM_FIELD_RANGE_DATETIME}),i=e.schema?Ka(e.schema):void 0,a=e.minDate??ii(i?.min),o=e.maxDate??ii(i?.max),s=i?!i.fromOptional:!1,c=i?!i.toOptional:!1;return(0,$.jsx)(dN,{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})}),pN=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_RANGE_DATETIME,`FormFieldRangeDateTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});pN.displayName=`FormFieldRangeDateTime`;var mN=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_TIME_RANGE_PICKER,`TimeRangePicker`)(e);return(0,$.jsx)(r,{...t,ref:n})});mN.displayName=`TimeRangePicker`;var hN=Q.forwardRef((e,t)=>{let{resolvedRegionalPreferences:n,isReady:r}=q({component:K.LOW_LEVEL_FORM_FIELD_RANGE_TIME});return(0,$.jsx)(mN,{ref:t,schema:e.schema,name:e.name,...e,timeFormat:n?.timeFormat})}),gN=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_RANGE_TIME,`FormFieldRangeTime`)(e);return(0,$.jsx)(r,{...t,ref:n})});gN.displayName=`FormFieldRangeTime`;function _N({name:e,schema:t,label:n,hideLabel:r,description:i,disabled:a,className:o,renderField:s,fieldLabels:c={},excludedChildKeys:l}){let u=Jt(t),d=ua(t),f=jT();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)(yD,{children:(0,$.jsx)(ST,{children:n})}),i&&(0,$.jsx)(ox,{children:i}),(0,$.jsx)(xT,{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)(yD,{children:(0,$.jsx)(ST,{children:n})}),i&&(0,$.jsx)(ox,{children:i}),(0,$.jsx)(xT,{children:m.map(t=>{let n=u[t],r=`${e}.${t}`,i=c[t]??f?.fieldLabels?.[_r.labelDictionaryPath(r)]??_r.unresolvedFieldLabel(t);return(0,$.jsx)(JL,{name:r,schema:n,label:i,disabled:a},t)})})]})}_N.displayName=`FormFieldComposite`;var vN=_N,Kfe=0;function yN(){return`kv-${++Kfe}-${Date.now()}`}function qfe(e){return!e||typeof e!=`object`?[]:Object.entries(e).map(([e])=>({id:yN(),key:e,pendingValue:void 0}))}function Jfe(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 Yfe({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}=Ng(),m=p(It.TYPOGRAPHY,Ea.DESCRIPTION),{formChromeMode:h,sectionChromeMode:g}=qw(),_=gc(),v=g??h??VL(_.autoRender?.autoFieldChrome),y=HL(_.autoRender?.autoLabelPlacement),b=UL(_.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)(Y,{type:`button`,variant:X.GHOST,size:df.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(W.CLOSE,{size:tr.SM})}),(0,$.jsxs)(`div`,{className:`pt-item space-y-field`,children:[(0,$.jsx)(UM,{mode:v,label:l,error:o,labelPlacement:y,hideError:x,fieldName:`${r}.__key_${e.id}`,disabled:i,children:(0,$.jsx)(YM,{schema:md(),name:`${r}.__key_${e.id}`,value:e.key,onChange:e=>S(String(e)),disabled:i,controlSize:b})}),C?(0,$.jsx)(JL,{name:`${r}.${e.key}`,schema:n,label:u,disabled:i}):(0,$.jsx)(`p`,{className:G(m.base,`py-card-sm px-card-sm rounded-md border border-dashed border-border`),children:d})]})]})}function bN({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}=LC(),{renderIcon:h}=ef(),g=SE(),_=g!==null&&wE(Ec(t)?.autosave,g.config.defaultTrigger,!0)!==Ts.NONE?g:null,{tComponent:v,isReady:y,resolvedRegionalPreferences:b}=q({component:K.LOW_LEVEL_FORM_MESSAGE}),x=b?.timezone,{getRecipe:S}=Ng(),C=S(It.TYPOGRAPHY,Ea.DESCRIPTION),w=v(K.LOW_LEVEL_FORM_MESSAGE,`recordAddEntry`),T=v(K.LOW_LEVEL_FORM_MESSAGE,`recordKeyLabel`),E=v(K.LOW_LEVEL_FORM_MESSAGE,`recordValueLabel`),D=v(K.LOW_LEVEL_FORM_MESSAGE,`recordEmptyMessage`),O=v(K.LOW_LEVEL_FORM_MESSAGE,`recordDuplicateKey`),k=v(K.LOW_LEVEL_FORM_MESSAGE,`recordEnterKeyFirst`),A=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>()=>{A.current=!1},[]);let[j,M]=(0,Q.useState)(()=>qfe(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:tT,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=Jfe(t,e,l,n);c(e,r,{shouldDirty:!0,shouldValidate:!0}),_&&_.triggerSave(e,r,Ts.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:yN(),key:``,pendingValue:_r.getDefaultValueForSchema(o,{timeZone:x})};M(t=>[...t,e])},[i,o,x]),L=(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)(yD,{children:(0,$.jsx)(ST,{children:n})}),r&&(0,$.jsx)(ox,{children:r}),(0,$.jsxs)(xT,{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)(Yfe,{entry:t,index:n,valueSchema:o,parentName:e,disabled:i,canRemove:!i,keyError:a,onKeyChange:F,onRemove:L,keyLabel:T,valueLabel:E,emptyKeyPlaceholder:k,renderIcon:h},t.id)}),(0,$.jsxs)(Y,{type:`button`,variant:X.OUTLINE,onClick:I,disabled:i,className:`w-full`,children:[h(W.PLUS,{size:tr.SM,className:`me-element`}),w]}),j.length===0&&(0,$.jsx)(`p`,{className:G(C.base,`text-center py-card`),children:D})]})]}):null}bN.displayName=`FormFieldRecord`;var xN=bN,SN=e(i());function Xfe(){var e=[...arguments];return(0,Q.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var CN=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function wN(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function TN(e){return`nodeType`in e}function EN(e){return e?wN(e)?e:TN(e)?e.ownerDocument?.defaultView??window:window:window}function DN(e){let{Document:t}=EN(e);return e instanceof t}function ON(e){return!wN(e)&&e instanceof EN(e).HTMLElement}function kN(e){return e instanceof EN(e).SVGElement}function AN(e){return e?wN(e)?e.document:TN(e)?DN(e)?e:ON(e)||kN(e)?e.ownerDocument:document:document:document}var jN=CN?Q.useLayoutEffect:Q.useEffect;function MN(e){let t=(0,Q.useRef)(e);return jN(()=>{t.current=e}),(0,Q.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Zfe(){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 NN(e,t){t===void 0&&(t=[e]);let n=(0,Q.useRef)(e);return jN(()=>{n.current!==e&&(n.current=e)},t),n}function PN(e,t){let n=(0,Q.useRef)();return(0,Q.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function FN(e){let t=MN(e),n=(0,Q.useRef)(null);return[n,(0,Q.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function IN(e){let t=(0,Q.useRef)();return(0,Q.useEffect)(()=>{t.current=e},[e]),t.current}var LN={};function RN(e,t){return(0,Q.useMemo)(()=>{if(t)return t;let n=LN[e]==null?0:LN[e]+1;return LN[e]=n,e+`-`+n},[e,t])}function zN(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 BN=zN(1),VN=zN(-1);function Qfe(e){return`clientX`in e&&`clientY`in e}function HN(e){if(!e)return!1;let{KeyboardEvent:t}=EN(e.target);return t&&e instanceof t}function $fe(e){if(!e)return!1;let{TouchEvent:t}=EN(e.target);return t&&e instanceof t}function UN(e){if($fe(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 Qfe(e)?{x:e.clientX,y:e.clientY}:null}var WN=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[WN.Translate.toString(e),WN.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),GN=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function epe(e){return e.matches(GN)?e:e.querySelector(GN)}var tpe={display:`none`};function npe(e){let{id:t,value:n}=e;return Q.createElement(`div`,{id:t,style:tpe},n)}function rpe(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 ipe(){let[e,t]=(0,Q.useState)(``);return{announce:(0,Q.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var KN=(0,Q.createContext)(null);function ape(e){let t=(0,Q.useContext)(KN);(0,Q.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function ope(){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 spe={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
|
+
`},cpe={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 lpe(e){let{announcements:t=cpe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=spe}=e,{announce:a,announcement:o}=ipe(),s=RN(`DndLiveRegion`),[c,l]=(0,Q.useState)(!1);if((0,Q.useEffect)(()=>{l(!0)},[]),ape((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(npe,{id:r,value:i.draggable}),Q.createElement(rpe,{id:s,announcement:o}));return n?(0,SN.createPortal)(u,n):u}var qN;(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`})(qN||={});function JN(){}function YN(e,t){return(0,Q.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function XN(){var e=[...arguments];return(0,Q.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var ZN=Object.freeze({x:0,y:0});function QN(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function $N(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function upe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function eP(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 tP(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function nP(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 rP=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=nP(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=QN(nP(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort($N)},dpe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=eP(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=eP(r),o=i.reduce((e,t,r)=>e+QN(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort($N)};function fpe(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 ppe=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=fpe(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(upe)};function mpe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function iP(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ZN}function hpe(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 gpe=hpe(1);function _pe(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 vpe(e,t,n){let r=_pe(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 ype={ignoreTransform:!1};function aP(e,t){t===void 0&&(t=ype);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=EN(e).getComputedStyle(e);t&&(n=vpe(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 oP(e){return aP(e,{ignoreTransform:!0})}function bpe(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function xpe(e,t){return t===void 0&&(t=EN(e).getComputedStyle(e)),t.position===`fixed`}function Spe(e,t){t===void 0&&(t=EN(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 sP(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(DN(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!ON(i)||kN(i)||n.includes(i))return n;let a=EN(e).getComputedStyle(i);return i!==e&&Spe(i,a)&&n.push(i),xpe(i,a)?n:r(i.parentNode)}return e?r(e):n}function cP(e){let[t]=sP(e,1);return t??null}function lP(e){return!CN||!e?null:wN(e)?e:TN(e)?DN(e)||e===AN(e).scrollingElement?window:ON(e)?e:null:null}function uP(e){return wN(e)?e.scrollX:e.scrollLeft}function dP(e){return wN(e)?e.scrollY:e.scrollTop}function fP(e){return{x:uP(e),y:dP(e)}}var pP;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(pP||={});function mP(e){return!CN||!e?!1:e===document.scrollingElement}function hP(e){let t={x:0,y:0},n=mP(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 Cpe={x:.2,y:.2};function wpe(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Cpe);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=hP(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=pP.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=pP.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=pP.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=pP.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Tpe(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 gP(e){return e.reduce((e,t)=>BN(e,fP(t)),ZN)}function Epe(e){return e.reduce((e,t)=>e+uP(t),0)}function Dpe(e){return e.reduce((e,t)=>e+dP(t),0)}function Ope(e,t){if(t===void 0&&(t=aP),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);cP(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var kpe=[[`x`,[`left`,`right`],Epe],[`y`,[`top`,`bottom`],Dpe]],_P=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=sP(t),r=gP(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of kpe)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})}},vP=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 Ape(e){let{EventTarget:t}=EN(e);return e instanceof t?e:AN(e)}function yP(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 bP;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(bP||={});function xP(e){e.preventDefault()}function jpe(e){e.stopPropagation()}var SP;(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`})(SP||={});var CP={start:[SP.Space,SP.Enter],cancel:[SP.Esc],end:[SP.Space,SP.Enter,SP.Tab]},Mpe=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case SP.Right:return{...n,x:n.x+25};case SP.Left:return{...n,x:n.x-25};case SP.Down:return{...n,y:n.y+25};case SP.Up:return{...n,y:n.y-25}}},wP=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 vP(AN(t)),this.windowListeners=new vP(EN(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(bP.Resize,this.handleCancel),this.windowListeners.add(bP.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(bP.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Ope(n),t(ZN)}handleKeyDown(e){if(HN(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=CP,coordinateGetter:a=Mpe,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}:ZN;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=VN(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}=hP(n),p=Tpe(n),m={x:Math.min(i===SP.Right?p.right-p.width/2:p.right,Math.max(i===SP.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===SP.Down?p.bottom-p.height/2:p.bottom,Math.max(i===SP.Down?p.top:p.top+p.height/2,u.y))},h=i===SP.Right&&!s||i===SP.Left&&!c,g=i===SP.Down&&!l||i===SP.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===SP.Right&&e<=d.x||i===SP.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}r.x=a?n.scrollLeft-e:i===SP.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===SP.Down&&e<=d.y||i===SP.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}r.y=a?n.scrollTop-e:i===SP.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,BN(VN(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()}};wP.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=CP,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 TP(e){return!!(e&&`distance`in e)}function EP(e){return!!(e&&`delay`in e)}var DP=class{constructor(e,t,n){n===void 0&&(n=Ape(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=AN(i),this.documentListeners=new vP(this.document),this.listeners=new vP(n),this.windowListeners=new vP(EN(i)),this.initialCoordinates=UN(r)??ZN,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(bP.Resize,this.handleCancel),this.windowListeners.add(bP.DragStart,xP),this.windowListeners.add(bP.VisibilityChange,this.handleCancel),this.windowListeners.add(bP.ContextMenu,xP),this.documentListeners.add(bP.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(EP(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(TP(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(bP.Click,jpe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(bP.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=UN(e)??ZN,s=VN(n,o);if(!t&&a){if(TP(a)){if(a.tolerance!=null&&yP(s,a.tolerance))return this.handleCancel();if(yP(s,a.distance))return this.handleStart()}if(EP(a)&&yP(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===SP.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Npe={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},OP=class extends DP{constructor(e){let{event:t}=e,n=AN(t.target);super(e,Npe,n)}};OP.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 Ppe={move:{name:`mousemove`},end:{name:`mouseup`}},kP;(function(e){e[e.RightClick=2]=`RightClick`})(kP||={});var Fpe=class extends DP{constructor(e){super(e,Ppe,AN(e.event.target))}};Fpe.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==kP.RightClick&&(r?.({event:n}),!0)}}];var AP={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Ipe=class extends DP{constructor(e){super(e,AP)}static setup(){return window.addEventListener(AP.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(AP.move.name,e)};function e(){}}};Ipe.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 jP;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(jP||={});var MP;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(MP||={});function Lpe(e){let{acceleration:t,activator:n=jP.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=MP.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=zpe({delta:d,disabled:!a}),[m,h]=Zfe(),g=(0,Q.useRef)({x:0,y:0}),_=(0,Q.useRef)({x:0,y:0}),v=(0,Q.useMemo)(()=>{switch(n){case jP.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case jP.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===MP.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}=wpe(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 Rpe={x:{[pP.Backward]:!1,[pP.Forward]:!1},y:{[pP.Backward]:!1,[pP.Forward]:!1}};function zpe(e){let{delta:t,disabled:n}=e,r=IN(t);return PN(e=>{if(n||!r||!e)return Rpe;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[pP.Backward]:e.x[pP.Backward]||i.x===-1,[pP.Forward]:e.x[pP.Forward]||i.x===1},y:{[pP.Backward]:e.y[pP.Backward]||i.y===-1,[pP.Forward]:e.y[pP.Forward]||i.y===1}}},[n,t,r])}function Bpe(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return PN(e=>t==null?null:r??e??null,[r,t])}function Vpe(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 NP;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(NP||={});var PP;(function(e){e.Optimized=`optimized`})(PP||={});var FP=new Map;function Hpe(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=NN(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=PN(t=>{if(d&&!n)return FP;if(!t||t===FP||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 _P(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 NP.Always:return!1;case NP.BeforeDragging:return n;default:return!n}}}function IP(e,t){return PN(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Upe(e,t){return IP(e,t)}function Wpe(e){let{callback:t,disabled:n}=e,r=MN(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 LP(e){let{callback:t,disabled:n}=e,r=MN(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 Gpe(e){return new _P(aP(e),e)}function RP(e,t,n){t===void 0&&(t=Gpe);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=Wpe({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=LP({callback:a});return jN(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Kpe(e){return iP(e,IP(e))}var zP=[];function qpe(e){let t=(0,Q.useRef)(e),n=PN(n=>e?n&&n!==zP&&e&&t.current&&e.parentNode===t.current.parentNode?n:sP(e):zP,[e]);return(0,Q.useEffect)(()=>{t.current=e},[e]),n}function Jpe(e){let[t,n]=(0,Q.useState)(null),r=(0,Q.useRef)(e),i=(0,Q.useCallback)(e=>{let t=lP(e.target);t&&n(e=>e?(e.set(t,fP(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=lP(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,fP(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=>{lP(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,Q.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>BN(e,t),ZN):gP(e):ZN,[e,t])}function BP(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!==ZN;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?VN(e,n.current):ZN}function Ype(e){(0,Q.useEffect)(()=>{if(!CN)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 Xpe(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 VP(e){return(0,Q.useMemo)(()=>e?bpe(e):null,[e])}var HP=[];function Zpe(e,t){t===void 0&&(t=aP);let[n]=e,r=VP(n?EN(n):null),[i,a]=(0,Q.useState)(HP);function o(){a(()=>e.length?e.map(e=>mP(e)?r:new _P(t(e),e)):HP)}let s=LP({callback:o});return jN(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Qpe(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return ON(t)?t:e}function $pe(e){let{measure:t}=e,[n,r]=(0,Q.useState)(null),i=LP({callback:(0,Q.useCallback)(e=>{for(let{target:n}of e)if(ON(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=FN((0,Q.useCallback)(e=>{let n=Qpe(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 eme=[{sensor:OP,options:{}},{sensor:wP,options:{}}],tme={current:{}},UP={draggable:{measure:oP},droppable:{measure:oP,strategy:NP.WhileDragging,frequency:PP.Optimized},dragOverlay:{measure:aP}},WP=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}},nme={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new WP,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:JN},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:UP,measureDroppableContainers:JN,windowRect:null,measuringScheduled:!1},rme={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:JN,draggableNodes:new Map,over:null,measureDroppableContainers:JN},GP=(0,Q.createContext)(rme),KP=(0,Q.createContext)(nme);function ime(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new WP}}}function ame(e,t){switch(t.type){case qN.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case qN.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 qN.DragEnd:case qN.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case qN.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new WP(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case qN.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 WP(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case qN.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new WP(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function ome(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,Q.useContext)(GP),a=IN(r),o=IN(n?.id);return(0,Q.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!HN(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=epe(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function sme(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function cme(e){return(0,Q.useMemo)(()=>({draggable:{...UP.draggable,...e?.draggable},droppable:{...UP.droppable,...e?.droppable},dragOverlay:{...UP.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function lme(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;jN(()=>{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=iP(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=cP(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var qP=(0,Q.createContext)({...ZN,scaleX:1,scaleY:1}),JP;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(JP||={});var YP=(0,Q.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=eme,collisionDetection:o=ppe,measuring:s,modifiers:c,...l}=e,[u,d]=(0,Q.useReducer)(ame,void 0,ime),[f,p]=ope(),[m,h]=(0,Q.useState)(JP.Uninitialized),g=m===JP.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??tme,rect:S},[_,x]),w=(0,Q.useRef)(null),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),k=NN(l,Object.values(l)),A=RN(`DndDescribedBy`,t),j=(0,Q.useMemo)(()=>b.getEnabled(),[b]),M=cme(s),{droppableRects:N,measureDroppableContainers:P,measuringScheduled:F}=Hpe(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),I=Bpe(v,_),L=(0,Q.useMemo)(()=>D?UN(D):null,[D]),R=De(),z=Upe(I,M.draggable.measure);lme({activeNode:_==null?null:v.get(_),config:R.layoutShiftCompensation,initialRect:z,measure:M.draggable.measure});let B=RP(I,M.draggable.measure,z),ee=RP(I?I.parentElement:null),te=(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(te.current.over?.id),V=$pe({measure:M.dragOverlay.measure}),re=V.nodeRef.current??I,ie=g?V.rect??B:null,ae=!!(V.nodeRef.current&&V.rect),oe=Kpe(ae?null:B),se=VP(re?EN(re):null),ce=qpe(g?ne??I:null),le=Zpe(ce),ue=sme(c,{transform:{x:y.x-oe.x,y:y.y-oe.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:B,containerNodeRect:ee,draggingNodeRect:ie,over:te.current.over,overlayNodeRect:V.rect,scrollableAncestors:ce,scrollableAncestorRects:le,windowRect:se}),de=L?BN(L,y):null,fe=Jpe(ce),pe=BP(fe),me=BP(fe,[B]),he=BN(ue,pe),ge=ie?gpe(ie,ue):null,_e=C&&ge?o({active:C,collisionRect:ge,droppableRects:N,droppableContainers:j,pointerCoordinates:de}):null,ve=tP(_e,`id`),[ye,be]=(0,Q.useState)(null),xe=mpe(ae?ue:BN(ue,me),ye?.rect??null,B),Se=(0,Q.useRef)(null),Ce=(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:te,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,SN.unstable_batchedUpdates)(()=>{r?.(i),h(JP.Initializing),d({type:qN.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(Se.current),O(a)})},onMove(e){d({type:qN.DragMove,coordinates:e})},onEnd:s(qN.DragEnd),onCancel:s(qN.DragCancel)});Se.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=te.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===qN.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=qN.DragCancel)}w.current=null,(0,SN.unstable_batchedUpdates)(()=>{d({type:e}),h(JP.Uninitialized),be(null),E(null),O(null),Se.current=null;let t=e===qN.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),we=Vpe(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,Ce(n,t))},[v,Ce]));Ype(a),jN(()=>{B&&m===JP.Initializing&&h(JP.Initialized)},[B,m]),(0,Q.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=te.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:he.x,y:he.y},over:i};(0,SN.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[he.x,he.y]),(0,Q.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=te.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(ve),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,SN.unstable_batchedUpdates)(()=>{be(s),a?.(c),f({type:`onDragOver`,event:c})})},[ve]),jN(()=>{te.current={activatorEvent:D,active:C,activeNode:I,collisionRect:ge,collisions:_e,droppableRects:N,draggableNodes:v,draggingNode:re,draggingNodeRect:ie,droppableContainers:b,over:ye,scrollableAncestors:ce,scrollAdjustedTranslate:he},S.current={initial:ie,translated:ge}},[C,I,_e,ge,v,re,ie,N,b,ye,ce,he]),Lpe({...R,delta:y,draggingRect:ge,pointerCoordinates:de,scrollableAncestors:ce,scrollableAncestorRects:le});let Te=(0,Q.useMemo)(()=>({active:C,activeNode:I,activeNodeRect:B,activatorEvent:D,collisions:_e,containerNodeRect:ee,dragOverlay:V,draggableNodes:v,droppableContainers:b,droppableRects:N,over:ye,measureDroppableContainers:P,scrollableAncestors:ce,scrollableAncestorRects:le,measuringConfiguration:M,measuringScheduled:F,windowRect:se}),[C,I,B,D,_e,ee,V,v,b,N,ye,P,ce,le,M,F,se]),Ee=(0,Q.useMemo)(()=>({activatorEvent:D,activators:we,active:C,activeNodeRect:B,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:ye,measureDroppableContainers:P}),[D,we,C,B,d,A,v,ye,P]);return Q.createElement(KN.Provider,{value:p},Q.createElement(GP.Provider,{value:Ee},Q.createElement(KP.Provider,{value:Te},Q.createElement(qP.Provider,{value:xe},i)),Q.createElement(ome,{disabled:n?.restoreFocus===!1})),Q.createElement(lpe,{...n,hiddenTextDescribedById:A}));function De(){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}}}),ume=(0,Q.createContext)(null),XP=`button`,dme=`Draggable`;function fme(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=RN(dme),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,Q.useContext)(GP),{role:p=XP,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,Q.useContext)(g?qP:ume),[v,y]=FN(),[b,x]=FN(),S=Xpe(o,t),C=NN(n);return jN(()=>(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===XP?!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 pme(){return(0,Q.useContext)(KP)}var mme=`Droppable`,hme={timeout:25};function gme(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=RN(mme),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,Q.useContext)(GP),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}={...hme,...i},_=NN(h??r),v=LP({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]=FN((0,Q.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=NN(t);return(0,Q.useEffect)(()=>{v&&y.current&&(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,Q.useEffect)(()=>(s({type:qN.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:qN.UnregisterDroppable,key:a,id:r})),[r]),(0,Q.useEffect)(()=>{n!==u.current.disabled&&(s({type:qN.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 ZP(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function _me(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function QP(e){return e!==null&&e>=0}function vme(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 yme(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var $P=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=ZP(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}},eF={scaleX:1,scaleY:1},tF=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,...eF}:null}let s=bme(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...eF}:r<t&&r>=a?{x:0,y:o.height+s,...eF}:{x:0,y:0,...eF}};function bme(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 nF=`Sortable`,rF=Q.createContext({activeIndex:-1,containerId:nF,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:$P,disabled:{draggable:!1,droppable:!1}});function iF(e){let{children:t,id:n,items:r,strategy:i=$P,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=pme(),d=RN(nF,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=!vme(p,_.current),y=g!==-1&&h===-1||v,b=yme(a);jN(()=>{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:_me(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return Q.createElement(rF.Provider,{value:x},t)}var xme=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return ZP(n,r,i).indexOf(t)},Sme=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},Cme={duration:200,easing:`ease`},aF=`transform`,wme=WN.Transition.toString({property:aF,duration:0,easing:`linear`}),Tme={roleDescription:`sortable`};function Eme(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,Q.useState)(null),s=(0,Q.useRef)(n);return jN(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=aP(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 oF(e){let{animateLayoutChanges:t=Sme,attributes:n,disabled:r,data:i,getNewIndex:a=xme,id:o,strategy:s,resizeObserverConfig:c,transition:l=Cme}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,Q.useContext)(rF),y=Dme(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}=gme({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}=fme({id:o,data:x,attributes:{...Tme,...n},disabled:y.draggable}),L=Xfe(E,j),R=!!D,z=R&&!m&&QP(f)&&QP(g),B=!_&&N,ee=z?(B&&z?I:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,te=QP(f)&&QP(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ne=D?.id,V=(0,Q.useRef)({activeId:ne,items:u,newIndex:te,containerId:d}),re=u!==V.current.items,ie=t({active:D,containerId:d,isDragging:N,isSorting:R,id:o,index:b,items:u,newIndex:V.current.newIndex,previousItems:V.current.items,previousContainerId:V.current.containerId,transition:l,wasDragging:V.current.activeId!=null}),ae=Eme({disabled:!ie,index:b,node:w,rect:C});return(0,Q.useEffect)(()=>{R&&V.current.newIndex!==te&&(V.current.newIndex=te),d!==V.current.containerId&&(V.current.containerId=d),u!==V.current.items&&(V.current.items=u)},[R,te,d,u]),(0,Q.useEffect)(()=>{if(ne===V.current.activeId)return;if(ne!=null&&V.current.activeId==null){V.current.activeId=ne;return}let e=setTimeout(()=>{V.current.activeId=ne},50);return()=>clearTimeout(e)},[ne]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:te,items:u,isOver:T,isSorting:R,isDragging:N,listeners:M,node:w,overIndex:g,over:P,setNodeRef:L,setActivatorNodeRef:F,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:ae??ee,transition:oe()};function oe(){if(ae||re&&V.current.newIndex===b)return wme;if(!(B&&!HN(O)||!l)&&(R||ie))return WN.Transition.toString({...l,property:aF})}}function Dme(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function sF(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 Ome=[SP.Down,SP.Right,SP.Up,SP.Left],cF=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(Ome.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 SP.Down:r.top<a.top&&t.push(n);break;case SP.Up:r.top>a.top&&t.push(n);break;case SP.Left:r.left>a.left&&t.push(n);break;case SP.Right:r.left<a.left&&t.push(n)}});let c=dpe({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=tP(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=sP(c).some((e,t)=>s[t]!==e),i=lF(e,t),a=kme(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:VN(u,l)}}}};function lF(e,t){return!sF(e)||!sF(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function kme(e,t){return!sF(e)||!sF(t)||!lF(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var uF;(function(e){e.POPPER=`popper`,e.ITEM_ALIGNED=`item-aligned`})(uF||={});var dF=rc(K.LOW_LEVEL_SELECT,`Select`,[`Root`,`Trigger`,`Content`,`Value`,`Item`,`Group`,`Label`,`Separator`,`ScrollUpButton`,`ScrollDownButton`]),fF=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=dF(e);return(0,$.jsx)(r,{...t,ref:n})});fF.displayName=`Select`;function pF({preset:e=H.DEFAULT,...t}){let n=dF(e);return(0,$.jsx)(n.Root,{...t})}var mF=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=dF(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});mF.displayName=`SelectTrigger`;var hF=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=dF(e);return(0,$.jsx)(r.Content,{...t,ref:n})});hF.displayName=`SelectContent`;function gF({preset:e=H.DEFAULT,...t}){let n=dF(e);return(0,$.jsx)(n.Value,{...t})}var _F=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=dF(e);return(0,$.jsx)(r.Item,{...t,ref:n})});_F.displayName=`SelectItem`;function Ame({preset:e=H.DEFAULT,...t}){let n=dF(e);return(0,$.jsx)(n.Group,{...t})}function jme({preset:e=H.DEFAULT,...t}){let n=dF(e);return(0,$.jsx)(n.Label,{...t})}function Mme({preset:e=H.DEFAULT,...t}){let n=dF(e);return(0,$.jsx)(n.Separator,{...t})}function Nme({preset:e=H.DEFAULT,...t}){let n=dF(e);return(0,$.jsx)(n.ScrollUpButton,{...t})}function Pme({preset:e=H.DEFAULT,...t}){let n=dF(e);return(0,$.jsx)(n.ScrollDownButton,{...t})}var vF=rc(K.LOW_LEVEL_RADIO_GROUP,`RadioGroup`,[`Root`]),yF=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=vF(e);return(0,$.jsx)(r,{...t,ref:n})});yF.displayName=`RadioGroup`;function bF({preset:e=H.DEFAULT,...t}){let n=vF(e);return(0,$.jsx)(n.Root,{...t})}function xF({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_RADIO,`RadioGroupItem`)(e);return(0,$.jsx)(n,{...t})}var SF;(function(e){e.ABSENT=`absent`})(SF||={});var CF=rc(K.LOW_LEVEL_CARD,`Card`,[`Listbox`,`Header`,`Footer`,`Title`,`Action`,`Description`,`Content`]);function wF({preset:e=H.DEFAULT,...t}){let n=CF(e);return(0,$.jsx)(n,{...t})}function TF({preset:e=H.DEFAULT,...t}){let n=CF(e);return(0,$.jsx)(n.Listbox,{...t})}function EF({preset:e=H.DEFAULT,...t}){let n=CF(e);return(0,$.jsx)(n.Header,{...t})}function DF({preset:e=H.DEFAULT,...t}){let n=CF(e);return(0,$.jsx)(n.Footer,{...t})}function OF({preset:e=H.DEFAULT,...t}){let n=CF(e);return(0,$.jsx)(n.Title,{...t})}function kF({preset:e=H.DEFAULT,...t}){let n=CF(e);return(0,$.jsx)(n.Action,{...t})}function AF({preset:e=H.DEFAULT,...t}){let n=CF(e);return(0,$.jsx)(n.Description,{...t})}function jF({preset:e=H.DEFAULT,...t}){let n=CF(e);return(0,$.jsx)(n.Content,{...t})}var Fme=kl(K.LOW_LEVEL_SELECT_MULTIPLE,`SelectMultiple`),MF=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=Fme(e);return(0,$.jsx)(r,{...t,ref:n})});MF.displayName=`SelectMultiple`;function Ime(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 NF(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,Lme(i,...t)]}function Lme(...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 PF(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var FF=globalThis?.document?Q.useLayoutEffect:()=>{},Rme=Q.useInsertionEffect||FF;function IF({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=zme({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=Bme(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function zme({defaultProp:e,onChange:t}){let[n,r]=Q.useState(e),i=Q.useRef(n),a=Q.useRef(t);return Rme(()=>{a.current=t},[t]),Q.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Bme(e){return typeof e==`function`}function LF(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 RF(e){let[t,n]=Q.useState(void 0);return FF(()=>{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 Vme(e,t){return Q.useReducer((e,n)=>t[e][n]??e,e)}var zF=e=>{let{present:t,children:n}=e,r=Hme(t),i=typeof n==`function`?n({present:r.isPresent}):Q.Children.only(n),a=jE(r.ref,Ume(i));return typeof n==`function`||r.isPresent?Q.cloneElement(i,{ref:a}):null};zF.displayName=`Presence`;function Hme(e){let[t,n]=Q.useState(),r=Q.useRef(null),i=Q.useRef(e),a=Q.useRef(`none`),[o,s]=Vme(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return Q.useEffect(()=>{let e=BF(r.current);a.current=o===`mounted`?e:`none`},[o]),FF(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=BF(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),FF(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=BF(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=BF(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 BF(e){return e?.animationName||`none`}function Ume(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 VF=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=PE(`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 Wme(e,t){e&&SN.flushSync(()=>e.dispatchEvent(t))}var HF=`Checkbox`,[Gme,Kme]=NF(HF),[qme,UF]=Gme(HF);function Jme(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]=IF({prop:n,defaultProp:i??!1,onChange:c,caller:HF}),[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:!ZF(i)&&i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,$.jsx)(qme,{scope:t,...b,children:Yme(d)?d(b):r})}var WF=`CheckboxTrigger`,GF=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}=UF(WF,e),h=jE(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)(VF.button,{type:`button`,role:`checkbox`,"aria-checked":ZF(c)?`mixed`:c,"aria-required":l,"data-state":QF(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:PF(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:PF(n,e=>{d(e=>ZF(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});GF.displayName=WF;var KF=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)(Jme,{__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)(GF,{...d,ref:t,__scopeCheckbox:n}),e&&(0,$.jsx)(XF,{__scopeCheckbox:n})]})})});KF.displayName=HF;var qF=`CheckboxIndicator`,JF=Q.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=UF(qF,n);return(0,$.jsx)(zF,{present:r||ZF(a.checked)||a.checked===!0,children:(0,$.jsx)(VF.span,{"data-state":QF(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});JF.displayName=qF;var YF=`CheckboxBubbleInput`,XF=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}=UF(YF,e),m=jE(n,p),h=LF(a),g=RF(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=ZF(a),n.call(e,!ZF(a)&&a),e.dispatchEvent(t)}},[f,h,a,i]);let _=Q.useRef(!ZF(a)&&a);return(0,$.jsx)(VF.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%)`}})});XF.displayName=YF;function Yme(e){return typeof e==`function`}function ZF(e){return e===`indeterminate`}function QF(e){return ZF(e)?`indeterminate`:e?`checked`:`unchecked`}var Xme=Object.freeze([]),$F=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:_}=q({keys:[`errors_validation`],component:[K.LOW_LEVEL_FORM_FIELD,K.LOW_LEVEL_FORM_MESSAGE]}),{renderIcon:v}=ef(),{getRecipe:y}=Ng(),b=y(It.FORM_CONTROL,_t.CHECKBOX),x=pu(e),S=x?y_(x):void 0,C=u??S?.edit?.editDirection??`vertical`,w=d??S?.edit?.editColumnsCount??1,T=x?pt(x):[],E=l??T.map(e=>({value:e,label:e})),[D,O]=Q.useState(s??[]),k=b_(i,a),A=k?i??Xme: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(K.LOW_LEVEL_FORM_FIELD,`noResults`)}):null:_?(0,$.jsx)($.Fragment,{children:(0,$.jsx)(`div`,{ref:N,role:`group`,className:G(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)(KF,{id:r,checked:t,onCheckedChange:t=>j(e.value,t===!0),onBlur:F,disabled:i,"data-slot":`checkbox`,className:G(`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)(JF,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current transition-none`,children:v(W.CHECK,{size:tr.SM})})}),(0,$.jsx)(`label`,{htmlFor:r,className:G(`text-sm font-normal cursor-pointer select-none`,i&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`),children:e.label})]},e.value)})})}):null});$F.displayName=`FormFieldCheckboxGroup`;var Zme={[fc.SELECT]:!1,[fc.RADIO]:!1,[fc.RADIO_ICON_ONLY]:!0,[fc.TOGGLE]:!1,[fc.TOGGLE_ICON_ONLY]:!0,[fc.CARD]:!1,[fc.CARD_ICON_ONLY]:!0,[fc.COMBOBOX]:!1},Qme={[fc.SELECT]:Ta.VERTICAL,[fc.RADIO]:Ta.VERTICAL,[fc.RADIO_ICON_ONLY]:Ta.HORIZONTAL,[fc.TOGGLE]:Ta.HORIZONTAL,[fc.TOGGLE_ICON_ONLY]:Ta.HORIZONTAL,[fc.CARD]:Ta.VERTICAL,[fc.CARD_ICON_ONLY]:Ta.VERTICAL,[fc.COMBOBOX]:Ta.VERTICAL},$me={[Sr.CHECKBOX]:!1,[Sr.SELECT]:!1,[Sr.TOGGLE]:!1,[Sr.TOGGLE_ICON_ONLY]:!0,[Sr.CARD]:!1,[Sr.CARD_ICON_ONLY]:!0,[Sr.COMBOBOX]:!1},ehe={[Sr.CHECKBOX]:Ta.VERTICAL,[Sr.SELECT]:Ta.VERTICAL,[Sr.TOGGLE]:Ta.HORIZONTAL,[Sr.TOGGLE_ICON_ONLY]:Ta.HORIZONTAL,[Sr.CARD]:Ta.VERTICAL,[Sr.CARD_ICON_ONLY]:Ta.VERTICAL,[Sr.COMBOBOX]:Ta.VERTICAL},the=2,nhe=4,eI=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=Nf.MD},_)=>{let{renderIcon:v}=ef(),{tComponent:y,isReady:b}=q({component:K.LOW_LEVEL_FORM_FIELD}),x=a??c,S=h===!0||Array.isArray(x),C=(S?pu(e):void 0)??e,w=y_(C),T=er(C),E=aie(C),D=S?$me[E]??!1:Zme[T]??!1,O=S?ehe[E]:Qme[T],k=w?.edit?.editDirection??O??Ta.VERTICAL,A=w?.edit?.editColumnsCount??(D?nhe:the),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===Nf.SM?`sm`:`md`,I=g===Nf.SM?df.SM:df.MD,L=pt(C)??[],R=u??L.map(e=>({value:e,label:e})),z=Q.useCallback((e,t)=>{if(typeof e==`string`)return v(e,{size:tr.SM,className:t});let n=ga[tr.SM];return Q.createElement(e,{size:n,className:t})},[v]),B=Q.useCallback(e=>{if(!N)return null;let t=j?.[e]?.icon??M;return t?z(t,`shrink-0`):null},[j,M,N,z]),ee=Q.useCallback(e=>{let t=B(e.value);if(D&&t!==null)return(0,$.jsxs)(XA,{children:[(0,$.jsx)(ZA,{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)(QA,{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:G(Ud,qd[Yg(t)])}),e.label]})}return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-element-sm`,children:[t,e.label]})},[D,B,j,w?.defaultColor]),te=Q.useMemo(()=>N||D||P?ee:void 0,[N,D,P,ee]),[ne,V]=Q.useState(c??(S?[]:``)),re=b_(a,o),ie=a??ne,ae=Q.useCallback(e=>{r||(re?o?.(e):V(e))},[re,o,r]),oe=Q.useCallback(()=>{s?.()},[s]),se={schema:e,name:t,disabled:n,className:i,validationMode:l,autoFocus:p,controlSize:g},ce=k===Ta.HORIZONTAL?Ui.HORIZONTAL:Ui.VERTICAL;if(!b)return null;if(S){let t=Array.isArray(ie)?ie:ie?[ie]:[],a=Lc(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?R:R.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||ae(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(K.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectExactly`,{count:a.minLength}):y(K.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectRange`,{min:a.minLength,max:a.maxLength}):a.minLength===void 0?y(K.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectUpTo`,{count:a.maxLength}):y(K.LOW_LEVEL_FORM_MESSAGE,`checkboxSelectAtLeast`,{count:a.minLength}),` `,`(`,y(K.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 Sr.CHECKBOX:return h((0,$.jsx)($F,{ref:_,...se,options:c,value:t,onChange:l,onBlur:oe,controlSize:g}));case Sr.SELECT:return h((0,$.jsx)(MF,{ref:_,...se,options:c,value:t,onChange:l,onBlur:oe,placeholder:d,size:g,renderOptionLabel:te}));case Sr.TOGGLE:case Sr.TOGGLE_ICON_ONLY:return h((0,$.jsx)(_O,{ref:_,type:mO.MULTIPLE,appearance:hO.CHIPS,value:t,onValueChange:e=>l(Array.isArray(e)?e:e?[e]:[]),disabled:n||r,size:I,orientation:ce,className:i,children:c.map(e=>(0,$.jsx)(vO,{value:e.value,"aria-label":e.label,disabled:e.disabled,children:ee(e)},e.value))}));case Sr.CARD:case Sr.CARD_ICON_ONLY:return h((0,$.jsx)(TF,{ref:_,"aria-multiselectable":!0,"aria-disabled":n||r?!0:void 0,"aria-required":f,className:G(`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)(wF,{"data-option":e.value,"aria-disabled":a?!0:void 0,"aria-label":D?e.label:void 0,className:G(`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:ee(e)},e.value)})}));case Sr.COMBOBOX:return h((0,$.jsx)(lx,{ref:_,...se,options:c,value:t,onChange:l,onBlur:oe,placeholder:d,disabled:n||r,autoFocus:p,size:F,showSelectAll:!0,emptyMessage:y(K.LOW_LEVEL_FORM_FIELD,`noResults`),searchPlaceholder:y(K.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`),renderOption:te?e=>te(e):void 0}));default:return h((0,$.jsx)($F,{ref:_,...se,options:c,value:t,onChange:l,onBlur:oe,controlSize:g}))}}switch(T){case fc.SELECT:return(0,$.jsx)(fF,{ref:_,...se,options:R,value:ie,onChange:ae,onBlur:oe,placeholder:d,size:g,renderOptionLabel:te});case fc.RADIO:case fc.RADIO_ICON_ONLY:return(0,$.jsx)(yF,{ref:_,...se,options:R,value:ie,onValueChange:ae,onBlur:oe,orientation:ce,renderOptionLabel:ee});case fc.TOGGLE:case fc.TOGGLE_ICON_ONLY:return(0,$.jsx)(_O,{ref:_,type:mO.SINGLE,value:ie,onValueChange:e=>{(e||m)&&ae(e)},disabled:n||r,size:I,orientation:ce,className:i,children:R.map(e=>(0,$.jsx)(vO,{value:e.value,"aria-label":e.label,disabled:e.disabled,children:ee(e)},e.value))});case fc.CARD:case fc.CARD_ICON_ONLY:return(0,$.jsx)(TF,{ref:_,"aria-disabled":n||r?!0:void 0,"aria-required":f,className:G(`grid gap-element`,i),style:{gridTemplateColumns:`repeat(${A}, minmax(0, 1fr))`},children:R.map(e=>{let t=ie===e.value,i=n===!0||r===!0||e.disabled===!0;return(0,$.jsx)(wF,{"data-option":e.value,"aria-disabled":i?!0:void 0,"aria-label":D?e.label:void 0,className:G(`p-card-sm text-sm font-medium`,D&&`flex items-center justify-center`,i&&`cursor-not-allowed opacity-[var(--opacity-disabled)]`),option:{onSelect:()=>{i||ae(e.value)}},selected:t,...i?{tabIndex:-1}:{},children:ee(e)},e.value)})});case fc.COMBOBOX:return(0,$.jsx)(cx,{ref:_,...se,options:R,value:ie,onChange:ae,onBlur:oe,placeholder:d,disabled:n||r,autoFocus:p,size:F,emptyMessage:y(K.LOW_LEVEL_FORM_FIELD,`noResults`),searchPlaceholder:y(K.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`),renderOption:te?e=>te(e):void 0,renderSelectedValue:te});default:return(0,$.jsx)(fF,{ref:_,...se,options:R,value:ie,onChange:ae,onBlur:oe,placeholder:d,size:g})}}),tI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_ENUM,`FormFieldEnum`)(e);return(0,$.jsx)(r,{...t,ref:n})});tI.displayName=`FormFieldEnum`;var nI=`file-validation`,rhe=/received (undefined|null)\b/i,ihe=/expected .+, received (undefined|null)/i;function rI(e){return rhe.test(e)||ihe.test(e)}function iI(e,t,n,r){if(!(e.error?.type===`server`||e.error?.type===`server-unique`||e.isTouched||t||(n===Jc.ON_CHANGE||n===Jc.ON_TOUCHED)&&e.isDirty)||!e.error)return;if(rI(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 aI({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_CHIPS_INPUT,`ChipsInput`)(e);return(0,$.jsx)(n,{...t})}aI.displayName=`ChipsInput`;var oI=(0,Q.createContext)(!0);function sI(e){let{setValue:t}=LC(),n=NC({name:e}),r=SE(),i=(0,Q.useContext)(oI)?r:null;return{value:n,setValue:(0,Q.useCallback)(n=>{t(e,n,{shouldDirty:!0,shouldTouch:!0}),i?.triggerSave(e,n,Ts.DEBOUNCE)},[t,e,i])}}function cI(e){if(e)return`translate3d(${Math.round(e.x)}px, ${Math.round(e.y)}px, 0)`}var ahe={activationConstraint:{distance:8}},ohe={coordinateGetter:cF};function lI({listeners:e,attributes:t,disabled:n,ariaLabel:r,renderIcon:i}){return(0,$.jsx)(`button`,{type:`button`,className:G(`shrink-0 cursor-grab touch-none rounded p-0.5 text-muted-foreground/60`,`hover:text-muted-foreground hover:bg-accent/50`,Dg(e_.OFFSET),`active:cursor-grabbing`,n&&`pointer-events-none opacity-0`),"aria-label":r,tabIndex:n?-1:0,...t,...e,children:i(W.GRIP_VERTICAL,{size:tr.SM})})}function she({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}=oF({id:e,disabled:!s||i}),D={transform:cI(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)(lI,{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)(Y,{type:`button`,variant:X.GHOST,size:df.ICON,onClick:()=>_(y),disabled:i||o||l,className:`h-5 w-5`,"aria-label":f,children:b(W.CHEVRON_UP,{size:tr.XS})}),(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.ICON,onClick:()=>v(y),disabled:i||o||u,className:`h-5 w-5`,"aria-label":p,children:b(W.CHEVRON_DOWN,{size:tr.XS})})]}),(0,$.jsx)(`div`,{className:`flex-1`,children:h?h(t,r):(0,$.jsx)(JL,{name:t,schema:r,label:n,disabled:i})}),a&&(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.ICON,onClick:()=>g(y),disabled:i||o,className:`shrink-0 mb-element`,"aria-label":m,children:b(W.DELETE,{size:tr.SM})})]})}var uI=`w-12`,dI=`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 fI({fieldName:e,itemSchema:t,primaryFieldName:n,disabled:r,only:i}){let a=jT(),o=Jt(t),s=ua(t);if(!o||s.length===0)return null;if(ls(t))return i===`boolean`?null:(0,$.jsx)(Kw,{formChromeMode:bc.COMPACT,sectionChromeMode:void 0,children:(0,$.jsx)(JL,{name:e,schema:t,labelPlacement:`hidden`,disabled:r,className:`min-w-0 flex-1`})});let c=s.filter(e=>Zl(o[e])===jr.BOOLEAN),l=s.filter(e=>Zl(o[e])!==jr.BOOLEAN),u=i===`boolean`?c:i===`body`?l:[...c,...l];return(0,$.jsx)(Kw,{formChromeMode:bc.COMPACT,sectionChromeMode:void 0,children:u.map(t=>{let i=`${e}.${t}`,s=a?.fieldLabels?.[_r.labelDictionaryPath(i)]??_r.unresolvedFieldLabel(t);return(0,$.jsx)(JL,{name:i,schema:o[t],label:s,labelPlacement:`hidden`,disabled:r,className:G(`w-auto`,t===n?`min-w-0 flex-1`:`shrink-0`)},t)})})}function che({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}=oF({id:e,disabled:!l||o}),k={transform:cI(E),transition:D,opacity:O?.5:void 0,zIndex:O?10:void 0,position:`relative`},A=NC({name:i?`${t}.${i}`:t}),j=typeof A==`string`&&A.trim()!==``?A.trim():typeof A==`number`?String(A):n;return r===Hs.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:G(`absolute -left-5 top-1/2 -translate-y-1/2`,dI),children:(0,$.jsx)(lI,{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)(Y,{type:`button`,variant:X.GHOST,size:df.ICON,onClick:()=>y(x),disabled:o||c||d,className:`h-5 w-5`,"aria-label":m,children:S(W.CHEVRON_UP,{size:tr.XS})}),(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.ICON,onClick:()=>b(x),disabled:o||c||f,className:`h-5 w-5`,"aria-label":h,children:S(W.CHEVRON_DOWN,{size:tr.XS})})]}),!_&&(0,$.jsx)(`div`,{className:G(`flex shrink-0 items-center`,uI),children:(0,$.jsx)(fI,{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)(fI,{fieldName:t,itemSchema:a,primaryFieldName:i,disabled:o,only:`body`})}),s&&(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.ICON,onClick:()=>v(x),disabled:o||c,className:G(`shrink-0`,dI),"aria-label":g,children:S(W.DELETE,{size:tr.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)(lI,{listeners:w,attributes:C,disabled:o,ariaLabel:p,renderIcon:S}),u&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.ICON,onClick:()=>y(x),disabled:o||c||d,className:`h-5 w-5`,"aria-label":m,children:S(W.CHEVRON_UP,{size:tr.XS})}),(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.ICON,onClick:()=>b(x),disabled:o||c||f,className:`h-5 w-5`,"aria-label":h,children:S(W.CHEVRON_DOWN,{size:tr.XS})})]}),(0,$.jsx)(`span`,{className:`truncate`,children:j})]}),s&&(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.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(W.CLOSE,{size:tr.SM})}),(0,$.jsx)(`div`,{className:`pt-item`,children:_?_(t,a):(0,$.jsx)(JL,{name:t,schema:a,label:n,hideLabel:!0,disabled:o})})]})}function lhe({primaryField:e,itemSchema:t,onAdd:n,disabled:r,addLabel:i,placeholder:a,leadingGutterClassName:o}){let{renderIcon:s}=ef(),{resolvedRegionalPreferences:c}=q(),l=c?.timezone,u=Zl(e.schema)===jr.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:{..._r.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:G(`shrink-0`,o)}),(0,$.jsx)(XM,{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)(Y,{type:`button`,variant:X.OUTLINE,onClick:g,disabled:!h,"aria-label":i,children:s(W.PLUS,{size:tr.SM})})]})}function uhe({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}=LC(),x=NM(e),{renderIcon:S}=ef(),{tComponent:C,tErrorValidation:w,isReady:T,resolvedRegionalPreferences:E}=q({component:K.LOW_LEVEL_FORM_MESSAGE,keys:[`errors_validation`]}),D=E?.timezone,{getRecipe:O}=Ng(),k=O(It.TYPOGRAPHY,Ea.DESCRIPTION),{formChromeMode:A,sectionChromeMode:j}=qw(),M=gc(),N=Ec(t),P=N?.chromeMode??d??j??A??VL(M.autoRender?.autoFieldChrome),F=HL(M.autoRender?.autoLabelPlacement),I=UL(M.autoRender?.autoFieldDensity),L=M.autoRender?.autoErrorPlacement===`summary-at-surface-top`,R=SE(),z=(0,Q.useContext)(oI)?R:null,B=z?t=>z.triggerSave(e,t,Ts.BLUR):void 0,ee=s??C(K.LOW_LEVEL_FORM_MESSAGE,`arrayAddItem`),te=c??C(K.LOW_LEVEL_FORM_MESSAGE,`arrayItemLabel`),ne=C(K.LOW_LEVEL_FORM_MESSAGE,`arrayEmptyMessage`),V=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(V.current=!0,()=>{V.current=!1}),[]);let[re,ie]=(0,Q.useState)(!1),{fields:ae,append:oe,remove:se,move:ce}=Dw({control:g,name:e}),le=pu(t),ue=Lc(t),de=le?Zl(le):`unknown`,fe=h!==void 0&&de===jr.STRING,pe=de===jr.ENUM||fe,me=os(t)?.edit,he=p??os(t)?.objectItemLayout??Hs.CARD,ge=me?.isSortable,_e=ge==null||!!ge&&me?.dnd!==!1,ve=ge?me?.upDownIcons??!1:!1,ye=l&&_e&&!i&&ae.length>1,be=XN(YN(OP,ahe),YN(wP,ohe)),xe=(0,Q.useMemo)(()=>ae.map(e=>e.id),[ae]),Se=ue.maxLength===void 0||ae.length<ue.maxLength,Ce=ue.minLength===void 0||ae.length>ue.minLength,we=(0,Q.useCallback)(()=>{ie(!0),setTimeout(async()=>{if(V.current&&(await b(e),V.current&&(ie(!1),z))){let t=v(e);z.triggerSave(e,t,Ts.DEBOUNCE)}},0)},[b,e,z,v]),Te=(0,Q.useCallback)(()=>{if(!Se||i||re)return;let e=_r.getDefaultValueForSchema(le,{timeZone:D});oe(e),we()},[Se,i,re,le,oe,we,D]),Ee=(0,Q.useCallback)(e=>{!Se||i||re||(oe(e),we())},[Se,i,re,oe,we]),De=(0,Q.useCallback)(e=>{!Ce||i||re||(se(e),we())},[Ce,i,re,se,we]),Oe=(0,Q.useCallback)(e=>{e>0&&!i&&!re&&(ce(e,e-1),we())},[ce,i,re,we]),ke=(0,Q.useCallback)(e=>{e<ae.length-1&&!i&&!re&&(ce(e,e+1),we())},[ae.length,ce,i,re,we]),Ae=(0,Q.useCallback)(e=>{let{active:t,over:n}=e;if(n&&t.id!==n.id){let e=ae.findIndex(e=>e.id===t.id),r=ae.findIndex(e=>e.id===n.id);e!==-1&&r!==-1&&(ce(e,r),we())}},[ae,ce,we]);if(!le||!T)return null;if(pe){let o=N?.validationMode??Jc.ON_BLUR,s=!fe&&h!==void 0?pt(le).filter(e=>h.includes(e)):void 0,c=fe?h.map(e=>({value:e,label:m?.[e]??e})):s?s.map(e=>({value:e,label:m?.[e]??e})):m?pt(le).map(e=>({value:e,label:m[e]??e})):void 0;return(0,$.jsx)(FC,{name:e,control:g,shouldUnregister:!0,render:({field:s,fieldState:l})=>(0,$.jsx)(UM,{mode:P,label:n,description:r,error:iI(l,y.isSubmitted,o,w),labelPlacement:F,hideError:L,saveState:z?.getFieldState(e),saveErrorMessage:z?.getFieldStateInfo(e).lastError,onRetrySave:z?()=>z.retryFieldSave(e):void 0,onSaveFieldNow:B,fieldName:e,disabled:i,className:a,children:(0,$.jsx)(tI,{multiple:!0,schema:t,options:c,name:e,disabled:i,value:Array.isArray(s.value)?s.value:[],onChange:t=>{x.noteInputReceived(),s.onChange(t),z?.triggerSave(e,t,Ts.DEBOUNCE)},onBlur:()=>{x.handleFieldBlur(s.onBlur)},controlSize:I})})})}if(de===jr.STRING&&os(t)?.display?.listStyle===Vc.CHIPS){let t=N?.validationMode??Jc.ON_BLUR,o=e=>{let n=le.safeParse(e);if(n.success)return;let r=n.error.issues[0];return iI({isTouched:!0,error:{type:r?.code??`custom`,message:r?.message,params:r?lT(r):void 0}},!0,t,w)};return(0,$.jsx)(FC,{name:e,control:g,shouldUnregister:!0,render:({field:s,fieldState:c})=>(0,$.jsx)(UM,{mode:P,label:n,description:r,error:iI(c,y.isSubmitted,t,w),labelPlacement:F,hideError:L,saveState:z?.getFieldState(e),saveErrorMessage:z?.getFieldStateInfo(e).lastError,onRetrySave:z?()=>z.retryFieldSave(e):void 0,onSaveFieldNow:B,fieldName:e,disabled:i,className:a,children:(0,$.jsx)(aI,{id:`field-${e}`,value:Array.isArray(s.value)?s.value.filter(e=>typeof e==`string`):[],onChange:t=>{x.noteInputReceived(),s.onChange(t),z?.triggerSave(e,t,Ts.DEBOUNCE)},onBlur:()=>{x.handleFieldBlur(s.onBlur)},validateItem:o,maxItems:ue.maxLength,disabled:i,invalid:!!c.error,controlSize:I})})})}let je=z?.getFieldStateInfo(e),Me=z&&je&&je.state!==Yw.IDLE?(0,$.jsx)(zM,{state:je.state,errorMessage:je.lastError,onRetry:()=>z.retryFieldSave(e),position:`inline`,size:`sm`,className:`ms-element align-middle`}):null,Ne=_(e,y),Pe=Ne.error?.root?.message||Ne.error?.message,Fe=!(!Pe||L),Ie=_r.resolveArrayAddMode(t,le),Le=_r.getArrayItemPrimaryField(le),Re=Ie===Qre.QUICK_ADD?Le:null,ze=de!==`object`&&de!==`array`,Be=(0,$.jsxs)($.Fragment,{children:[Fe&&(0,$.jsx)(`p`,{id:`${e}-error`,className:`text-sm text-destructive mt-item-xs`,role:`alert`,children:Pe}),(0,$.jsxs)(xT,{className:G(he===Hs.ROW?void 0:`space-y-field`),style:he===Hs.ROW?{rowGap:`var(--spacing-element)`}:void 0,children:[(0,$.jsx)(YP,{sensors:be,collisionDetection:rP,onDragEnd:Ae,children:(0,$.jsx)(iF,{items:xe,strategy:tF,children:ae.map((t,n)=>{let r=`${e}.${n}`,a=`${te} ${n+1}`,s=C(K.LOW_LEVEL_FORM_MESSAGE,`arrayDragHandle`,{label:a}),c=C(K.LOW_LEVEL_FORM_MESSAGE,`arrayMoveUp`,{label:a}),l=C(K.LOW_LEVEL_FORM_MESSAGE,`arrayMoveDown`,{label:a}),u=C(K.LOW_LEVEL_FORM_MESSAGE,`arrayRemoveItem`,{label:a});return ze?(0,$.jsx)(she,{id:t.id,fieldName:r,fieldLabel:a,itemSchema:le,disabled:i,canRemove:Ce,isValidating:re,reorderable:ye,showUpDownIcons:ve,isFirst:n===0,isLast:n===ae.length-1,dragHandleAriaLabel:s,moveUpAriaLabel:c,moveDownAriaLabel:l,removeAriaLabel:u,renderField:o,onRemove:De,onMoveUp:Oe,onMoveDown:ke,index:n,renderIcon:S},t.id):(0,$.jsx)(che,{id:t.id,fieldName:r,fieldLabel:a,layout:he,primaryFieldName:Le.name,itemSchema:le,disabled:i,canRemove:Ce,isValidating:re,reorderable:ye,showUpDownIcons:ve,isFirst:n===0,isLast:n===ae.length-1,dragHandleAriaLabel:s,moveUpAriaLabel:c,moveDownAriaLabel:l,removeAriaLabel:u,renderField:o,onRemove:De,onMoveUp:Oe,onMoveDown:ke,index:n,renderIcon:S},t.id)})})}),Se&&Re?(0,$.jsx)(lhe,{primaryField:Re,itemSchema:le,onAdd:Ee,disabled:i||re,addLabel:ee,leadingGutterClassName:he===Hs.ROW&&!ze?o?`w-7`:uI:void 0}):Se?(0,$.jsxs)(Y,{type:`button`,variant:X.OUTLINE,onClick:Te,disabled:i||re,className:`w-full`,children:[S(W.PLUS,{size:tr.SM,className:`me-element`}),ee]}):null,ae.length===0&&(i||!Se)&&(0,$.jsx)(`p`,{className:G(k.base,`text-center py-card`),children:ne})]})]});if(P===bc.SETTINGS_ROW&&u===void 0)return(0,$.jsx)(UM,{mode:bc.SETTINGS_ROW,label:n,description:r,labelPlacement:F,onSaveFieldNow:B,fieldName:e,disabled:i,className:a,error:Pe,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":Fe?`${e}-error`:void 0,children:[Me,Be]})});let Ve=!f&&(u===ci.CARD||u===ci.COLLAPSIBLE),He=u!==ci.COLLAPSIBLE;return(0,$.jsxs)(bT,{appearance:u??ci.GHOST,legend:Ve?(0,$.jsxs)($.Fragment,{children:[n,He&&Me]}):void 0,description:Ve?r:void 0,disabled:i,className:G(a,Pe&&`border-destructive`),"data-field":e,"data-testid":`field-array-${e}`,"aria-invalid":!!Pe,"aria-describedby":Fe?`${e}-error`:void 0,children:[Ve?!He&&Me:f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(yD,{children:(0,$.jsx)(ST,{className:`sr-only`,children:n})}),Me]}):(0,$.jsx)(yD,{children:(0,$.jsxs)(ST,{children:[n,Me]})}),!Ve&&r&&!f&&(0,$.jsx)(ox,{children:r}),(0,$.jsx)(EE,{fieldName:e,label:n,disabled:i,onSaveFieldNow:B,children:Be})]})}function pI(e){let t=SE(),n=t!==null&&wE(Ec(e.schema)?.autosave,t.config.defaultTrigger,!0)!==Ts.NONE;return(0,$.jsx)(oI.Provider,{value:n,children:(0,$.jsx)(uhe,{...e})})}pI.displayName=`AutomatedArrayField`;var mI=pI,hI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.RESOURCES_FIELDS_RESOURCE_REFERENCE,`ResourceFieldEdit_ResourceReference`,pa.EDIT)(e);return(0,$.jsx)(r,{...t,ref:n})});hI.displayName=`ResourceFieldEdit_ResourceReference`;function dhe(e,t){let n=e?.resourceReferenceTargets;if(n)return n[t]??[]}function fhe(e,t){if(t)return e?.resourceType===t?e:{resourceType:t}}function phe(e,t){return e?.resourceType?t?{resourceType:e.resourceType,resourceId:t}:{resourceType:e.resourceType}:e}function mhe(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 hhe=[Bc.RESOURCES];function gI(e,t){return Jt(li(e))?.[t]??e}var _I=Q.forwardRef(({types:e,value:t,onChange:n,schema:r,name:i,...a},o)=>{let{tComponent:s,tResourceHeader:c}=q({component:K.RESOURCES_FIELDS_RESOURCE_REFERENCE,keys:hhe}),l=Q.useMemo(()=>mhe(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)(fF,{ref:o,...a,schema:gI(r,`resourceType`),name:`${i}.resourceType`,options:l,value:t?.resourceType||void 0,onChange:e=>n?.(fhe(t,e)),placeholder:s(K.RESOURCES_FIELDS_RESOURCE_REFERENCE,l.length>0?`selectTypePlaceholder`:`noTypesAvailable`)}),t?.resourceType?(0,$.jsx)(hI,{...a,schema:gI(r,`resourceId`),name:`${i}.resourceId`,targetResourceType:t.resourceType,value:t.resourceId,onChange:e=>n?.(phe(t,Array.isArray(e)?e[0]:e))}):null]})});_I.displayName=`FormFieldResourceReference`;var vI=rc(K.LOW_LEVEL_SWITCH,`Switch`,[`Root`]),yI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=vI(e);return(0,$.jsx)(r,{...t,ref:n})});yI.displayName=`Switch`;var bI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=vI(e);return(0,$.jsx)(r.Root,{...t,ref:n})});bI.displayName=`SwitchRoot`;var xI=rc(K.LOW_LEVEL_CHECKBOX,`Checkbox`,[`Root`]),SI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=xI(e);return(0,$.jsx)(r,{...t,ref:n})});SI.displayName=`Checkbox`;var CI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=xI(e);return(0,$.jsx)(r.Root,{...t,ref:n})});CI.displayName=`CheckboxRoot`;var wI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_TOGGLE_GROUP_BOOLEAN,`ToggleGroupBoolean`)(e);return(0,$.jsx)(r,{...t,ref:n})});wI.displayName=`ToggleGroupBoolean`;var TI=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}=q({component:K.LOW_LEVEL_FORM_FIELD_BOOLEAN}),h=tc(e),g=aa(e),_=h?.labellingValue??`yes/no`,[v,y]=Q.useState(c??!1),b=b_(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(K.LOW_LEVEL_FORM_FIELD_BOOLEAN,E),k=()=>T?_.falseValue:p(K.LOW_LEVEL_FORM_FIELD_BOOLEAN,D);if(!m)return null;switch(g){case Zu.TOGGLE:return(0,$.jsx)(wI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C});case Zu.SWITCH:return(0,$.jsx)(yI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C});case Zu.CHECKBOX:return(0,$.jsx)(SI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C});case Zu.RADIO:let e=[{value:`true`,label:O()},{value:`false`,label:k()}];return(0,$.jsx)(yF,{ref:f,...w,options:e,value:x?`true`:`false`,onValueChange:e=>S(e===`true`),onBlur:C});default:return(0,$.jsx)(yI,{ref:f,...w,checked:x,onCheckedChange:S,onBlur:C})}}),EI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_BOOLEAN,`FormFieldBoolean`)(e);return(0,$.jsx)(r,{...t,ref:n})});EI.displayName=`FormFieldBoolean`;var DI=rc(K.LOW_LEVEL_TEXTAREA,`Textarea`,[`Root`]),OI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=DI(e);return(0,$.jsx)(r,{...t,ref:n})});OI.displayName=`Textarea`;var kI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=DI(e);return(0,$.jsx)(r.Root,{...t,ref:n})});kI.displayName=`TextareaRoot`;function AI({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_MARKDOWN_EDITOR,`MarkdownEditor`)(e);return(0,$.jsx)(n,{...t})}AI.displayName=`MarkdownEditor`;var jI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_COLOR_INPUT,`ColorInput`)(e);return(0,$.jsx)(r,{...t,ref:n})});jI.displayName=`ColorInput`;var MI=(0,Q.forwardRef)(({name:e,value:t,onChange:n,onBlur:r,disabled:i,readOnly:a,className:o,autoFocus:s,controlSize:c=Nf.MD,clearable:l,labelledBy:u,controlId:d,monthPlaceholder:f},p)=>{let{tComponent:m,resolvedRegionalPreferences:h}=q({component:K.LOW_LEVEL_FORM_FIELD_STRING}),g=ul(t),[_,v]=Q.useState(g?.month),[y,b]=Q.useState(String(g?g.year:new Date().getUTCFullYear()));Q.useEffect(()=>{let e=ul(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(()=>zl.monthNames(h),[h]),w=(e,r)=>{if(e===void 0||!/^\d{4}$/.test(r))return;let i=lc(Number(r),e);i!==t&&n?.(i)},T=()=>{let e=ul(t);e&&!/^\d{4}$/.test(y)&&b(String(e.year)),r?.()},E=i||a,D=l===!0&&ul(t)!==void 0;return(0,$.jsxs)(`div`,{className:G(`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)(pF,{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)(mF,{ref:S,id:d??`field-${e}`,size:c,className:`w-full`,"aria-label":m(K.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthMonth`),autoFocus:s,children:(0,$.jsx)(gF,{placeholder:f??m(K.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthMonthPlaceholder`)})}),(0,$.jsx)(hF,{children:C.map((e,t)=>(0,$.jsx)(_F,{value:String(t+1),textValue:e,children:e},t+1))})]})}),(0,$.jsx)(`div`,{className:`w-28 shrink-0`,children:(0,$.jsx)(XM,{type:`number`,inputMode:`numeric`,min:1,max:9999,step:1,name:`${e}.year`,controlSize:c,"aria-label":m(K.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)(Y,{type:`button`,variant:X.GHOST,size:c===Nf.SM?df.SM:df.MD,disabled:E,onClick:()=>{n?.(``),x.current?.focus()},children:m(K.LOW_LEVEL_FORM_FIELD_STRING,`yearMonthClear`)})]})});MI.displayName=`YearMonthInput`;var NI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_PASSWORD_INPUT,`PasswordInput`)(e);return(0,$.jsx)(r,{...t,ref:n})});NI.displayName=`PasswordInput`;var PI=rc(K.LOW_LEVEL_INPUT_OTP,`InputOTP`,[`Group`,`Slot`,`Separator`]),FI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=PI(e);return(0,$.jsx)(r,{...t,ref:n})});FI.displayName=`InputOTP`;function II({preset:e=H.DEFAULT,...t}){let n=PI(e);return(0,$.jsx)(n.Group,{...t})}function LI({preset:e=H.DEFAULT,...t}){let n=PI(e);return(0,$.jsx)(n.Slot,{...t})}function ghe({preset:e=H.DEFAULT,...t}){let n=PI(e);return(0,$.jsx)(n.Separator,{...t})}function _he(e,t){let n=e?.organizationRoles;if(!n||n.length===0)return;let r=e?.organizationTypes;return!t||!r?n:n.filter(e=>O(r,t,e))}function vhe(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 yhe=[Bc.ROLES],RI=Q.forwardRef(({roles:e,value:t,onChange:n,clearable:r,...i},a)=>{let{tComponent:o,tRole:s}=q({component:K.LOW_LEVEL_FORM_FIELD_STRING,keys:yhe}),c=Q.useMemo(()=>vhe(e,t,e=>s(e,`label`)),[e,t,s]),l=(0,$.jsx)(fF,{ref:a,...i,options:c,value:t||void 0,onChange:e=>n?.(e),placeholder:o(K.LOW_LEVEL_FORM_FIELD_STRING,`organizationRolePlaceholder`)});return!r||!t?l:(0,$.jsxs)(`span`,{className:`flex items-center gap-element`,children:[l,(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,disabled:i.disabled||i.readOnly,onClick:()=>n?.(``),children:o(K.LOW_LEVEL_FORM_FIELD_STRING,`organizationRoleClear`)})]})});RI.displayName=`FormFieldStringOrganizationRole`;function bhe(){let{appConfig:e}=Su(),{organizations:t,currentOrganizationId:n}=ng(),r=t.find(e=>e._id===n)?.type;return _he(e,r)}function xhe(e){if(e.roleTable===Sl.ANOTHER_ORGANIZATION)return e.offeredRoles;if(e.table)return e.offeredRoles?e.table.filter(t=>e.offeredRoles.includes(t)):e.table}var zI=Q.forwardRef(({fallback:e,roleTable:t=Sl.CURRENT_ORGANIZATION,offeredRoles:n,...r},i)=>{let a=xhe({table:bhe(),roleTable:t,offeredRoles:n});return a?(0,$.jsx)(RI,{ref:i,roles:a,...r}):(0,$.jsx)($.Fragment,{children:e})});zI.displayName=`FormFieldStringOrganizationRoleOrFallback`;var BI=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=Nf.MD,type:m,clearable:h,offeredValues:g},_)=>{let v=m??`text`,y=Wre(e);ine(e);let b=La(e),x=y?.edit?.textareaRows??4,[S,C]=Q.useState(c??``),w=b_(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 Yl.INPUT:return(0,$.jsx)(YM,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d,type:v});case Yl.TEXTAREA:return(0,$.jsx)(OI,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,rows:x,autoComplete:d});case Yl.MARKDOWN:return(0,$.jsx)(AI,{value:T,onChange:E,onBlur:D,placeholder:u,disabled:n,readOnly:r,autoFocus:f,minRows:x,ariaLabel:t,className:i});case Yl.COLOR:return(0,$.jsx)(jI,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u});case Yl.YEAR_MONTH:return(0,$.jsx)(MI,{ref:_,...O,value:T,onChange:E,onBlur:D,clearable:h});case Yl.PASSWORD:return(0,$.jsx)(NI,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d});case Yl.OTP:{let r=die(e)?.maxLength??6;return(0,$.jsx)(FI,{ref:_,name:t,className:i,maxLength:r,value:T,onChange:E,onBlur:D,disabled:n,autoComplete:d,autoFocus:f,controlSize:p,children:(0,$.jsx)(II,{children:Array.from({length:r},(e,t)=>(0,$.jsx)(LI,{index:t},t))})})}case Yl.ORGANIZATION_ROLE:{let e=(0,$.jsx)(YM,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d,type:v});return(0,$.jsx)(zI,{ref:_,...O,value:T,onChange:E,onBlur:D,clearable:h,fallback:e,roleTable:y?.edit?.organizationRoleTable??Sl.CURRENT_ORGANIZATION,...g?{offeredRoles:g}:{}})}default:return(0,$.jsx)(YM,{ref:_,...O,value:T,onChange:E,onBlur:D,placeholder:u,autoComplete:d,type:v})}}),VI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_STRING,`FormFieldString`)(e);return(0,$.jsx)(r,{...t,ref:n})});VI.displayName=`FormFieldString`;var HI=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=Nf.MD},_)=>{let{renderIcon:v}=ef(),y=g===Nf.SM?df.ICON_SM:df.ICON;hn(e);let b=zte(e),x=Cte(e),S=f??x.min,C=p??x.max,w=d??x.step??1,[T,E]=Q.useState(c??0),D=b_(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 Qn.INPUT:return(0,$.jsx)(YM,{ref:_,...P,type:`number`,value:k,onChange:A,onBlur:j,placeholder:u,step:w,min:S,max:C});case Qn.SLIDER:return(0,$.jsx)(GM,{ref:_,...P,value:[O],onValueChange:e=>A(e[0]),onBlur:j,min:S??0,max:C??100,step:w,showValue:!0});case Qn.STEPPER:let e=t??`stepper-field`;return(0,$.jsxs)(`div`,{className:G(`flex items-center gap-element`,i),children:[(0,$.jsx)(Y,{type:`button`,variant:X.OUTLINE,size:y,onClick:N,disabled:n||S!==void 0&&O<=S,children:v(W.MINUS,{size:tr.SM})}),(0,$.jsx)(XM,{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)(Y,{type:`button`,variant:X.OUTLINE,size:y,onClick:M,disabled:n||C!==void 0&&O>=C,children:v(W.PLUS,{size:tr.SM})})]});default:return(0,$.jsx)(YM,{ref:_,...P,type:`number`,value:k,onChange:A,onBlur:j,placeholder:u,step:w,min:S,max:C})}}),UI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_NUMBER,`FormFieldNumber`)(e);return(0,$.jsx)(r,{...t,ref:n})});UI.displayName=`FormFieldNumber`;var WI=Q.forwardRef(({controlSize:e,className:t,wrapperClassName:n,children:r,disabled:i,...a},o)=>{let{getRecipe:s,fieldVariant:c}=Ng(),{renderIcon:l}=ef(),u=s(It.FORM_CONTROL,jg(c));return(0,$.jsxs)(`div`,{"data-slot":`native-select`,className:G(`relative flex`,n),children:[(0,$.jsx)(`select`,{ref:o,disabled:i,"data-size":e,className:G(`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(W.CHEVRON_DOWN,{size:tr.SM,className:`opacity-[var(--opacity-muted)]`})})]})});WI.displayName=`ThemedNativeSelect`;function She(e,t,n){return me(e,t).map(e=>{let t=jc[e],r=n(e);return{value:e,label:`${t.symbol} ${r}`}}).sort((e,t)=>{let n=jc[e.value],r=jc[t.value];return n.isMajor&&!r.isMajor?-1:!n.isMajor&&r.isMajor?1:e.label.localeCompare(t.label)})}var GI=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=Nf.MD},h)=>{let{tSystemEnum:g,tComponent:_,isReady:v}=q({component:K.LOW_LEVEL_FORM_FIELD_MONEY,keys:[`system_enums`]}),{getRecipe:y,fieldVariant:b}=Ng(),x=y(It.FORM_CONTROL,jg(b)),S=Q.useCallback(e=>g(Le.AVAILABLE_CURRENCY,e),[g]),C=ji(e),w=C?.currenciesAllowed,T=C?.appEnabledOnly??!0,E=C?.allowCurrencyChange??!0,D=Q.useMemo(()=>She(w,T,S),[w,T,S]),O=Q.useCallback(e=>ns(e)?.decimals??2,[]),k=Q.useCallback(()=>bae(e),[e]),[A,j]=Q.useState(c??k()),M=b_(a,o),N=a??A,P=Q.useMemo(()=>N.amount===0n?``:jl(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=ac(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:Xl(N.amount,N.decimals,t),currency:e,decimals:t};M?o?.(n):j(n)},[N,M,o,O]),L=Q.useCallback(()=>{s?.()},[s]),R=`field-${t}`,z=ns(N.currency)?.symbol??N.currency;return(0,$.jsxs)(`div`,{className:G(`flex gap-element`,i),children:[(0,$.jsx)(XM,{ref:h,id:R,type:`number`,step:10**-N.decimals,min:C?.minAmount===void 0?void 0:jl(C.minAmount,N.decimals),max:C?.maxAmount===void 0?void 0:jl(C.maxAmount,N.decimals),value:P,onChange:F,onBlur:L,disabled:n,readOnly:r,placeholder:u??`0.00`,prefix:z,wrapperClassName:`flex-1`,className:`tabular-nums`,autoFocus:f,controlSize:m}),E?(0,$.jsx)(WI,{value:N.currency,onChange:e=>I(e.target.value),disabled:n||r,controlSize:m,wrapperClassName:`w-32`,"aria-label":_(K.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:G(`flex items-center text-sm text-muted-foreground`,x.sizes?.[m]),children:S(N.currency)})]})}),KI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_MONEY,`FormFieldMoney`)(e);return(0,$.jsx)(r,{...t,ref:n})});KI.displayName=`FormFieldMoney`;var Che=[Ur.SECONDS,Ur.MINUTES,Ur.HOURS,Ur.DAYS,Ur.WEEKS],qI=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=Nf.MD},m)=>{let{tSystemEnum:h,tComponent:g,isReady:_}=q({component:K.LOW_LEVEL_FORM_FIELD_DURATION,keys:[`system_enums`]}),v=Zie(e),y=v?.allowedUnits&&v.allowedUnits.length>0?v.allowedUnits:Che,b=v?.minValue,x=v?.maxValue,S=Q.useCallback(e=>h(Le.DURATION_UNIT,e),[h]),C=Q.useCallback(()=>Xee(e),[e]),[w,T]=Q.useState(c??C()),E=b_(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:G(`flex gap-element`,i),children:[(0,$.jsx)(XM,{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)(WI,{value:D.unit,onChange:e=>A(e.target.value),disabled:n||r,controlSize:p,wrapperClassName:`w-32`,"aria-label":g(K.LOW_LEVEL_FORM_FIELD_DURATION,`unit`),children:y.map(e=>(0,$.jsx)(`option`,{value:e,children:S(e)},e))})]})});qI.displayName=`FormFieldDuration_Preset_Default`;var JI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_DURATION,`FormFieldDuration`)(e);return(0,$.jsx)(r,{...t,ref:n})});JI.displayName=`FormFieldDuration`;var YI=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_INPUT_GROUP,`InputGroup`)(e);return(0,$.jsx)(r,{...t,ref:n})});YI.displayName=`InputGroup`;function XI({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_INPUT_GROUP_ADDON,`InputGroupAddon`)(e);return(0,$.jsx)(n,{...t})}function ZI({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_INPUT_GROUP_BUTTON,`InputGroupButton`)(e);return(0,$.jsx)(n,{...t})}function whe({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_INPUT_GROUP_TEXT,`InputGroupText`)(e);return(0,$.jsx)(n,{...t})}function QI({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_INPUT_GROUP_INPUT,`InputGroupInput`)(e);return(0,$.jsx)(n,{...t})}function $I({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_INPUT_GROUP_TEXTAREA,`InputGroupTextarea`)(e);return(0,$.jsx)(n,{...t})}var The=`US`;function Ehe(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 Dhe(e){let t;try{t=new Intl.DisplayNames([e],{type:`region`})}catch{t=void 0}let n=new Intl.Collator(e);return a().map(e=>({code:e,name:t?.of(e)??e,dialCode:ru(e)})).sort((e,t)=>n.compare(e.name,t.name))}function Ohe(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 khe(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 eL=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=Nf.MD},p)=>{let{tComponent:m,currentLanguage:h}=q({component:[K.LOW_LEVEL_FORM_FIELD_PHONE]}),g=Jn(e)?.defaultCountry??The,_=Q.useMemo(()=>Dhe(h),[h]),[v,y]=Q.useState(g),[b,x]=Q.useState(``),S=Q.useRef(null),C=Q.useRef(null),w=Q.useRef(null),T=Q.useRef(``),E=Q.useCallback(e=>{w.current=e,typeof p==`function`?p(e):p&&(p.current=e)},[p]),D=a??c??``;Q.useEffect(()=>{if(D===S.current)return;if(S.current=D,C.current=null,!D.trim()){x(``),T.current=``;return}let e=nl(D,g),t=e?e.formatNational():D;e?.country&&y(e.country),x(t),T.current=t},[D,g]),Q.useLayoutEffect(()=>{let e=C.current;C.current=null;let t=w.current;if(e===null||!t||document.activeElement!==t)return;let n=khe(t.value,e);t.setSelectionRange(n,n)},[b]);let O=Q.useCallback((e,t)=>{let n=t.replace(/\D/g,``);if(!n)return``;let r=nl(n,e);return r?r.format(`E.164`):`+${ru(e)}${n}`},[]),k=Q.useCallback((e,t)=>{let n=O(e,t);S.current=n,o?.(n)},[o,O]),A=Q.useCallback(e=>{let t=e.target.value;y(t);let n=T.current.replace(/\D/g,``),r=n?oo(n,t):``;x(r),T.current=r,n&&k(t,r)},[k]),j=Q.useCallback(e=>{let t=e.target.value,n=e.target.selectionStart??t.length;if(t.trim().startsWith(`+`)){let e=jte(t);if(e){let n=ru(e),r=t.replace(/\D/g,``),i=r.startsWith(n)?r.slice(n.length):r,a=O(e,i),s=nl(a),c=s?s.formatNational():oo(i,e);y(e),x(c),T.current=c,C.current=null,S.current=a,o?.(a);return}x(t),T.current=t;let n=`+${t.replace(/\D/g,``)}`;S.current=n,o?.(n);return}let r=T.current,i=t.length===r.length-1,a=i?t:oo(t,v);C.current=i?null:Ohe(t,n),x(a),T.current=a,k(v,a)},[v,k,o,O]),M=Q.useCallback(()=>{s?.()},[s]),N=Q.useMemo(()=>l||Gne(v)||``,[l,v]),P=ru(v),F=`field-${t}`,I=m(K.LOW_LEVEL_FORM_FIELD_PHONE,`country`);return(0,$.jsxs)(YI,{className:G(`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:G(`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:Ehe(v)}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[`+`,P]}),(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:A,disabled:n||r,"aria-label":I,"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)(QI,{ref:E,id:F,name:t,type:`tel`,inputMode:`tel`,value:b,onChange:j,onBlur:M,disabled:n,readOnly:r,placeholder:N,autoFocus:u,autoComplete:d??`tel`,className:`ps-2`})]})});eL.displayName=`FormFieldPhone_Preset_Default`;var tL=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_PHONE,`FormFieldPhone`)(e);return(0,$.jsx)(r,{...t,ref:n})});tL.displayName=`FormFieldPhone`;var nL=[{part:Pn.LINE1,autoComplete:`address-line1`},{part:Pn.LINE2,autoComplete:`address-line2`},{part:Pn.CITY,autoComplete:`address-level2`},{part:Pn.STATE,autoComplete:`address-level1`},{part:Pn.POSTAL_CODE,autoComplete:`postal-code`}];function rL(e,t){return{[Pn.LINE1]:e?.line1??``,[Pn.LINE2]:e?.line2??``,[Pn.CITY]:e?.city??``,[Pn.STATE]:e?.state??``,[Pn.POSTAL_CODE]:e?.postalCode??``,[Pn.COUNTRY]:e?.country??t??``,[xl.LATITUDE]:e?.coordinates?String(e.coordinates.latitude):``,[xl.LONGITUDE]:e?.coordinates?String(e.coordinates.longitude):``}}function iL(e){return e.trim()===``?NaN:Number(e)}function Ahe(e){let t=nL.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:iL(e.latitude),longitude:iL(e.longitude)}}}}function jhe(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]:a()).map(e=>({code:e,name:n?.of(e)??e})).sort((e,t)=>r.compare(e.name,t.name))}var aL=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=Nf.MD},m)=>{let{tComponent:h,currentLanguage:g}=q({component:[K.LOW_LEVEL_FORM_FIELD_ADDRESS]}),_=wne(e),v=_?.defaultCountry,y=_?.withCoordinates===!0,b=a??c,[x,S]=Q.useState(()=>rL(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=rL(b,v);C.current=e,S(e)},[T,v]);let E=Q.useMemo(()=>jhe(g,_?.countriesAllowed),[g,_?.countriesAllowed]),D=Q.useCallback(e=>{C.current=e,S(e);let t=Ahe(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(rL(n,v))},[D,v,k]),j=Q.useCallback(e=>{e.currentTarget.contains(e.relatedTarget)||s?.()},[s]),M=`field-${t}`,N=e=>e===Pn.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)(rx,{htmlFor:r,className:`text-sm text-muted-foreground`,children:t}),n({id:r,...i&&{"aria-invalid":!0,"aria-describedby":a}}),i&&(0,$.jsx)(sx,{id:a,children:i})]},e)},F=({part:e,autoComplete:i})=>P(e,h(K.LOW_LEVEL_FORM_FIELD_ADDRESS,e),a=>(0,$.jsx)(XM,{...a,ref:e===Pn.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===Pn.LINE1?l:void 0,controlSize:p})),I=e=>P(`coordinates.${e}`,h(K.LOW_LEVEL_FORM_FIELD_ADDRESS,e),i=>(0,$.jsx)(XM,{...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})),[L,R,z,B,ee]=nL,te=E.some(e=>e.code===x.country);return(0,$.jsxs)(`div`,{className:G(`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(L),F(R),(0,$.jsxs)(`div`,{className:`grid gap-element sm:grid-cols-2`,children:[F(z),F(ee)]}),F(B),P(Pn.COUNTRY,h(K.LOW_LEVEL_FORM_FIELD_ADDRESS,Pn.COUNTRY),e=>(0,$.jsxs)(WI,{...e,name:`${t}.${Pn.COUNTRY}`,value:x.country,onChange:e=>O(Pn.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(K.LOW_LEVEL_FORM_FIELD_ADDRESS,`countryPlaceholder`)}),x.country!==``&&!te&&(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(xl.LATITUDE),I(xl.LONGITUDE)]})]})});aL.displayName=`FormFieldAddress_Preset_Default`;var oL=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_ADDRESS,`FormFieldAddress`)(e);return(0,$.jsx)(r,{...t,ref:n})});oL.displayName=`FormFieldAddress`;var sL;(function(e){e.MAIN_SCHEMA=`main-schema`,e.PATCH_REQUEST_DTO=`patch-request-dto`,e.VALUE_OBJECT=`value-object`})(sL||={});var Mhe={[sL.MAIN_SCHEMA]:{isClearable:xn,normalizeClearedValue:ur},[sL.PATCH_REQUEST_DTO]:{isClearable:tn,normalizeClearedValue:bi},[sL.VALUE_OBJECT]:{isClearable:o,normalizeClearedValue:hae}};function Nhe({schemaKind:e,rootSchema:t,fieldName:n}){if(e===Jw.MAIN_SCHEMA)return sL.MAIN_SCHEMA;if(!t)return sL.PATCH_REQUEST_DTO;let r=n.replace(/\[(\d+)\]/g,`.$1`).split(`.`).filter(Boolean).slice(0,-1).join(`.`),i=r?_r.resolveFieldSchemaPath(t,r):t;return i?re(i)?sL.PATCH_REQUEST_DTO:sL.VALUE_OBJECT:sL.PATCH_REQUEST_DTO}var cL=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=Nf.MD},_)=>{let{formatNumber:v,isReady:y}=q({component:K.LOW_LEVEL_FORM_FIELD_BIGDECIMAL}),{renderIcon:b}=ef(),x=g===Nf.SM?df.ICON_SM:df.ICON,S=Kc(e),C=hn(e),w=S?.edit?.editMode??C?.edit?.editMode??Qn.INPUT,T=Ss(e),E=f??T.min,D=p??T.max,O=T.precision,k=d??(O===void 0?`1`:new Rl(1).div(new Rl(10).pow(O)).toString()),A=Kc(e)?.edit?.defaultValue,[j,M]=Q.useState(c??A??`0`),N=b_(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]),L=Q.useCallback(()=>{s?.()},[s]),R=Q.useCallback(e=>{let t=e.target.value;if(t===``||t===`-`||t===`.`||t===`-.`)N?o?.(t):M(t);else try{new Rl(t),I(t)}catch{/^-?\d*\.?\d*$/.test(t)&&(N?o?.(t):M(t))}},[N,o,I]),z=()=>{try{let e=new Rl(P||`0`),t=new Rl(k),n=e.plus(t);(D===void 0||n.lte(new Rl(D)))&&I(n.toString())}catch{I(k)}},B=()=>{try{let e=new Rl(P||`0`),t=new Rl(k),n=e.minus(t);(E===void 0||n.gte(new Rl(E)))&&I(n.toString())}catch{I(new Rl(k).neg().toString())}},ee=Q.useCallback(e=>{let t=e[0];I(O===void 0?t.toString():t.toFixed(O))},[I,O]);switch(w){case Qn.INPUT:return(0,$.jsx)(XM,{ref:_,id:t,type:`text`,inputMode:`decimal`,value:P,onChange:R,onBlur:L,disabled:n,readOnly:r,placeholder:u,className:G(`tabular-nums`,i),autoFocus:h,controlSize:g});case Qn.SLIDER:let e=E?parseFloat(E):0,a=D?parseFloat(D):100,o=parseFloat(k);return(0,$.jsxs)(`div`,{ref:_,className:G(`flex items-center gap-field`,i),children:[(0,$.jsx)(KM,{value:[F],onValueChange:ee,onValueCommit:()=>L(),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 Qn.STEPPER:let s=t??`stepper-field`,c=E!==void 0&&(()=>{try{return new Rl(P||`0`).lte(new Rl(E))}catch{return!1}})(),l=D!==void 0&&(()=>{try{return new Rl(P||`0`).gte(new Rl(D))}catch{return!1}})();return(0,$.jsxs)(`div`,{className:G(`flex items-center gap-element`,i),children:[(0,$.jsx)(Y,{type:`button`,variant:X.OUTLINE,size:x,onClick:B,disabled:n||r||c,children:b(W.MINUS,{size:tr.SM})}),(0,$.jsx)(XM,{ref:_,id:s,type:`text`,inputMode:`decimal`,value:P,onChange:R,onBlur:L,disabled:n,readOnly:r,className:`w-24 text-center tabular-nums`,autoFocus:h,controlSize:g}),(0,$.jsx)(Y,{type:`button`,variant:X.OUTLINE,size:x,onClick:z,disabled:n||r||l,children:b(W.PLUS,{size:tr.SM})})]});default:return(0,$.jsx)(XM,{ref:_,id:t,type:`text`,inputMode:`decimal`,value:P,onChange:R,onBlur:L,disabled:n,readOnly:r,placeholder:u,className:G(`tabular-nums`,i),autoFocus:h,controlSize:g})}}),lL=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_BIGDECIMAL,`FormFieldBigDecimal`)(e);return(0,$.jsx)(r,{...t,ref:n})});lL.displayName=`FormFieldBigDecimal`;var uL=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_CODE,`FormFieldCode`)(e);return(0,$.jsx)(r,{...t,ref:n})});uL.displayName=`FormFieldCode`;var dL=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=Nf.MD},_)=>{let{tComponent:v,isReady:y}=q({component:K.LOW_LEVEL_FORM_FIELD_RANGE_BIGDECIMAL}),b=Ka(e),x=Ss(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=b_(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`,L=`${I}-from`,R=`${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:L,className:`sr-only`,children:f}),(0,$.jsx)(XM,{ref:_,id:L,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:R,className:`sr-only`,children:p}),(0,$.jsx)(XM,{id:R,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(K.LOW_LEVEL_FORM_MESSAGE,`rangeFromMustBeLessThanTo`)})]}):null}),fL=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_RANGE_BIGDECIMAL,`FormFieldRangeBigDecimal`)(e);return(0,$.jsx)(r,{...t,ref:n})});fL.displayName=`FormFieldRangeBigDecimal`;function Phe(e,t){let n=Object.keys(jc);return t&&(n=Kne()),n=n.filter(t=>cu(t,e)),n.map(e=>({value:e,label:`${jc[e].symbol} ${e}`})).sort((e,t)=>{let n=jc[e.value],r=jc[t.value];return n.isMajor&&!r.isMajor?-1:!n.isMajor&&r.isMajor?1:e.label.localeCompare(t.label)})}var pL=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=Nf.MD},h)=>{let{tComponent:g,isReady:_}=q({component:K.LOW_LEVEL_FORM_FIELD_RANGE_MONEY}),{getRecipe:v,fieldVariant:y}=Ng(),b=v(It.FORM_CONTROL,jg(y)),x=ji(e),S=xae(e),C=Ka(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(()=>Phe(w,T),[w,T]),N=Q.useCallback(e=>ns(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,L]=Q.useState(c?.from?.currency??c?.to?.currency??E),R=b_(a,o),z=a??P,B=N(I),ee=Q.useMemo(()=>!z.from||!z.to||z.from.amount===0n&&z.to.amount===0n?!1:jl(z.from.amount,z.from.decimals)>jl(z.to.amount,z.to.decimals),[z.from,z.to]),te=Q.useMemo(()=>!z.from||z.from.amount===0n?``:jl(z.from.amount,z.from.decimals).toFixed(z.from.decimals),[z.from]),ne=Q.useMemo(()=>!z.to||z.to.amount===0n?``:jl(z.to.amount,z.to.decimals).toFixed(z.to.decimals),[z.to]),V=Q.useCallback(e=>{let t=e.target.value,n;if(t&&t!==``){let e=ac(t,B);e!==null&&(n={amount:e,currency:I,decimals:B})}let r={...z,from:n};R?o?.(r):F(r)},[z,I,B,R,o]),re=Q.useCallback(e=>{let t=e.target.value,n;if(t&&t!==``){let e=ac(t,B);e!==null&&(n={amount:e,currency:I,decimals:B})}let r={...z,to:n};R?o?.(r):F(r)},[z,I,B,R,o]),ie=Q.useCallback(e=>{let t=N(e);L(e);let n,r;z.from&&z.from.amount!==0n&&(n={amount:Xl(z.from.amount,z.from.decimals,t),currency:e,decimals:t}),z.to&&z.to.amount!==0n&&(r={amount:Xl(z.to.amount,z.to.decimals,t),currency:e,decimals:t});let i={from:n,to:r};R?o?.(i):F(i)},[z,N,R,o]),ae=Q.useCallback(()=>{s?.()},[s]),oe=t??`range-money-field`,se=`${oe}-from`,ce=`${oe}-to`,le=ns(I)?.symbol??I;return _?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(XM,{ref:h,id:se,type:`number`,step:10**-B,value:te,onChange:V,onBlur:ae,disabled:n,readOnly:r,placeholder:u,prefix:le,wrapperClassName:`flex-1`,className:G(`tabular-nums`,ee&&`border-destructive`),"aria-invalid":ee,"aria-required":!A,min:O===void 0?void 0:jl(O,B),max:k===void 0?void 0:jl(k,B),autoFocus:p,controlSize:m}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),(0,$.jsx)(XM,{id:ce,type:`number`,step:10**-B,value:ne,onChange:re,onBlur:ae,disabled:n,readOnly:r,placeholder:d,prefix:le,wrapperClassName:`flex-1`,className:G(`tabular-nums`,ee&&`border-destructive`),"aria-invalid":ee,"aria-required":!j,min:O===void 0?void 0:jl(O,B),max:k===void 0?void 0:jl(k,B),controlSize:m}),D?(0,$.jsx)(WI,{value:I,onChange:e=>ie(e.target.value),disabled:n||r,controlSize:m,wrapperClassName:`w-24`,"aria-label":g(K.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:G(`flex items-center text-sm text-muted-foreground`,b.sizes?.[m]),children:I})]}),ee&&(0,$.jsx)(`p`,{className:`text-destructive text-sm`,role:`alert`,children:g(K.LOW_LEVEL_FORM_MESSAGE,`rangeFromMustBeLessThanTo`)})]}):null}),mL=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FORM_FIELD_RANGE_MONEY,`FormFieldRangeMoney`)(e);return(0,$.jsx)(r,{...t,ref:n})});mL.displayName=`FormFieldRangeMoney`;var hL=class extends Error{};function gL(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 hL(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 Fhe(e){let t=Date.now()+(e.timeoutMs??12e4),n=e.metadata;for(;;){if(e.signal.throwIfAborted(),n&&n.fileId!==e.fileId||n&&!Object.values(ne).includes(n.readiness))throw new hL(e.unverifiedMessage);if(n?.readiness===ne.READY)return n;if(n&&n.readiness!==ne.PROCESSING)throw new hL(e.unavailableMessage);if(e.onPending(),!e.getMetadata||Date.now()>=t)throw new hL(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 gL(e.getMetadata,e.signal,t-Date.now(),e.unverifiedMessage)}catch{throw e.signal.throwIfAborted(),new hL(e.unverifiedMessage)}}}function _L(e,t){return t||(!e||typeof e!=`object`?Jc.ON_BLUR:kre(e)?Jc.ON_CHANGE:Jc.ON_BLUR)}function Ihe(e){return e.issues[0]?.code??`unknown`}function vL(e){let t={};for(let[n,r]of Object.entries(e))n!==`code`&&n!==`message`&&n!==`path`&&(t[n]=r);return t}function Lhe(e){let t=_c(e.schema);return t?{allowedMimeTypes:t.allowedMimeTypes,maxSize:t.maxSize,maxFiles:t.maxFiles}:{}}var Rhe={[id.IMAGE]:`accepted_type_image`,[id.VIDEO]:`accepted_type_video`,[id.AUDIO]:`accepted_type_audio`,[id.PDF]:`accepted_type_pdf`,[id.OFFICE]:`accepted_type_office`,[id.ARCHIVE]:`accepted_type_archive`,[id.ALL]:`accepted_types_all`},zhe={[Zn.TEXT]:`accepted_type_text`,[Zn.MARKDOWN]:`accepted_type_markdown`,[Zn.JSON]:`accepted_type_json`,[Zn.TYPESCRIPT]:`accepted_type_typescript`,[Zn.TYPESCRIPT_JSX]:`accepted_type_typescript_react`,[Zn.YAML]:`accepted_type_yaml`};function yL(e,t){let n=e=>t(K.LOW_LEVEL_FORM_FIELD_FILE,e);return e.length===0?n(`accepted_types_all`):e.map(e=>{switch(e.category){case nd.NATURE:return n(Rhe[e.nature]);case nd.AGENT_FORMAT:return n(zhe[e.format]);case nd.MIME_SUBTYPE:return e.subtype.toUpperCase()}}).join(`, `)}var bL=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_IMAGE_CROP,`ImageCrop`)(e);return(0,$.jsx)(r,{...t,ref:n})});bL.displayName=`ImageCrop`;function xL(e){return!(!e.type.startsWith(`image/`)||e.type===`image/svg+xml`)}async function SL(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 CL(e,t,n,r){return Math.max(n/e,r/t)}function wL(e,t,n,r){let i=Math.max(0,(t*n-r)/2);return Math.min(i,Math.max(-i,e))}function TL(e){let{naturalWidth:t,naturalHeight:n,viewportWidth:r,viewportHeight:i,transform:a}=e,o=CL(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 EL=`image/png`,DL=`image/jpeg`,OL=`image/webp`,kL=[EL,DL,OL],Bhe={[EL]:`png`,[DL]:`jpg`,[OL]:`webp`},Vhe=[.92,.85,.78,.7,.6,.5];function AL(e){return kL.some(t=>ra(t,e))}function Hhe(e,t,n){return new Promise(r=>e.toBlob(r,t,n))}function jL(e,t){return`${e.replace(/\.[^./\\]+$/,``)}.${t}`}async function ML(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=kL.filter(e=>ra(e,s)),m=[];p.includes(r.type)&&r.type!==DL&&m.push(r.type);for(let e of[EL,OL,DL])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],jL(r.name,Bhe[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===DL&&(f.save(),f.globalCompositeOperation=`destination-over`,f.fillStyle=`#ffffff`,f.fillRect(0,0,l,u),f.restore());let t=e===EL?[void 0]:Vhe;for(let n of t){let t=await Hhe(d,e,n);if(!t)continue;let r=_(t);if(r)return r;if(e===EL)break}}if(!g)throw Error(`image_encode_failed`);return h(g)}function Uhe(e){return e!=null&&`fileId`in e}function NL(e){return e!=null&&`fileIds`in e}var Whe=0;function PL(){return`upload-${Date.now()}-${++Whe}`}function FL(e){return e instanceof Error?e.code===`ERR_CANCELED`||e.name===`AbortError`:!1}function IL(e,t){return t&&e.override?e.override:e.upload}function Ghe(e,t){return!!IL(e,t)}function LL(e){return!!e.upload}function Khe(e,t){return e&&e.trim()!==``?e:t}function RL(e,t){return t instanceof hL?t.message:e}var zL=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}=q({component:K.LOW_LEVEL_FORM_FIELD_FILE,keys:[`errors_validation`,`system_enums`]}),{frontendProviderRegistry:C}=Su(),{renderIcon:w}=ef(),{getRecipe:T}=Ng(),E=T(It.FORM_CONTROL,_t.DEFAULT),D=d??y(K.LOW_LEVEL_FORM_FIELD_FILE,`choose_file`),O=f??y(K.LOW_LEVEL_FORM_FIELD_FILE,`replace`),k=y(K.LOW_LEVEL_FORM_FIELD_FILE,`drag_and_drop`),A=y(K.LOW_LEVEL_FORM_FIELD_FILE,`remove`),j=y(K.LOW_LEVEL_FORM_FIELD_FILE,`upload_failed`),M=y(K.LOW_LEVEL_FORM_FIELD_FILE,`metadata_load_failed`),N=y(K.LOW_LEVEL_FORM_FIELD_FILE,`uploads_unavailable`),P=y(K.LOW_LEVEL_FORM_FIELD_FILE,`file_attached`),F=_c(e),I=Lhe({schema:e}),L=I.allowedMimeTypes,R=I.maxSize,z=F?.minSize,B=F?.overridable??!0,te=L?ee(L):void 0,V=F?.multiple??!1,re=I.maxFiles,ie=F?.imageConstraints,ae=F?.videoConstraints,oe=F?.audioConstraints,se=F?.documentConstraints,ce=_L(e,l),[le,ue]=Q.useState(a??null),[de,fe]=Q.useState(),pe=Q.useRef(n);Q.useEffect(()=>{pe.current!==void 0&&n==null&&de&&fe(void 0),pe.current=n},[n,de]);let[me,he]=Q.useState(new Map),ge=Q.useRef(me);ge.current=me;let[_e,ve]=Q.useState(0),[ye,be]=Q.useState(new Map),[xe,Se]=Q.useState(!1),Ce=Q.useRef(new Set),we=Q.useRef(0),[Te,Ee]=Q.useState(new Set),De=y(K.LOW_LEVEL_FORM_FIELD_FILE,`file_processing`),Oe=y(K.LOW_LEVEL_FORM_FIELD_FILE,`file_unavailable`),ke=y(K.LOW_LEVEL_FORM_FIELD_FILE,`file_readiness_unverified`),Ae=Q.useCallback(()=>{we.current+=1;for(let e of Ce.current)e.abort();for(let e of ge.current.values())e.abortController.abort();Ce.current.clear()},[]),je=Q.useRef(null),Me=b_(n,r),Ne=n??le,Pe=Array.from(me.values()).some(e=>e.status===`uploading`),Fe=Uhe(Ne)?Ne.fileId:null,Ie=NL(Ne)?Ne.fileIds:[],Le=V?LL(u):Ghe(u,Fe),Re=Q.useRef(Ie);Re.current=Ie;let ze=Q.useMemo(()=>Ie.join(`,`),[Ie]),Be=Q.useRef(ye);Be.current=ye;let Ve=Fe?ye.get(Fe)??null:null,He=Fe?[Fe]:Ie,Ue=He.some(e=>ye.get(e)?.readiness===ne.UNAVAILABLE)?Oe:He.some(e=>![ne.READY,ne.ATTACHED].includes(ye.get(e)?.readiness))?De:void 0,We=Array.from(me.values()).find(e=>e.status===`error`)?.error,Ge=Pe||Te.size>0?De:We??Ue;Q.useEffect(()=>{p?.(de??Ge)},[de,Ge,p]);let Ke=Q.useCallback(async e=>h.get(e),[h]),qe=Q.useCallback(async e=>h.delete(e),[h]);Q.useEffect(()=>()=>Ae(),[u.getMetadata,u.upload,u.override,h,Ke,Ae]);let Je=Q.useRef({endpoint:u.getMetadata,get:Ke});Q.useEffect(()=>{let e=Fe?[Fe]:Ie,t=Je.current.endpoint!==u.getMetadata||Je.current.get!==Ke;if(Je.current={endpoint:u.getMetadata,get:Ke},t&&(Be.current=new Map,be(new Map)),e.length===0){be(new Map),fe(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=Be.current.get(e);if(!(n&&[ne.READY,ne.ATTACHED,ne.UNAVAILABLE].includes(n.readiness))){if(!u.getMetadata)o=!0;else try{let n=await gL(()=>Ke(`${u.getMetadata}/${encodeURIComponent(e)}/metadata`),r.signal,12e4,M);if(n.fileId!==e||!Object.values(ne).includes(n.readiness))throw Error(`Invalid file metadata`);s.set(e,n),n.readiness===ne.PROCESSING&&(t=!0)}catch{o=!0,t=!0,console.warn(`Unable to load file metadata for one or more files.`)}}})),n||(be(e=>{let t=new Map(e);for(let[e,n]of s)t.set(e,n);return t}),fe(e=>o?M:e===M?void 0:e),t&&(i=setTimeout(a,2e3)))};return a(),()=>{n=!0,r.abort(),i&&clearTimeout(i)}},[Fe,ze,u.getMetadata,Ke,M]);let Ye=Q.useCallback(async(e,t)=>{let n=new AbortController,r=()=>n.abort();t?.aborted&&n.abort(),t?.addEventListener(`abort`,r,{once:!0}),Ce.current.add(n);try{let t=await Fhe({...e,signal:n.signal,getMetadata:u.getMetadata?()=>Ke(`${u.getMetadata}/${encodeURIComponent(e.fileId)}/metadata`):void 0,onPending:()=>Ee(t=>new Set(t).add(e.fileId)),unavailableMessage:Oe,unverifiedMessage:ke});return n.signal.throwIfAborted(),{fileId:e.fileId,metadata:t}}finally{t?.removeEventListener(`abort`,r),Ce.current.delete(n),Ee(t=>{let n=new Set(t);return n.delete(e.fileId),n})}},[Ke,u.getMetadata,Oe,ke]),Xe=Q.useCallback(e=>{if(L&&L.length>0&&!ra(e.type,L)){let e=yL(Zt(L),y);return y(K.LOW_LEVEL_FORM_FIELD_FILE,`file_type_not_allowed`,{accepted:e})}},[L,y]),Ze=Q.useCallback(e=>{let t=Xe(e);if(t)return t;if(R&&e.size>R){let e=S(R);return y(K.LOW_LEVEL_FORM_FIELD_FILE,`file_too_large`,{max:e})}if(z&&e.size<z){let e=S(z);return y(K.LOW_LEVEL_FORM_FIELD_FILE,`file_too_small`,{min:e})}},[Xe,R,z,y,S]),Qe=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 gL(s,a,void 0,ke):await s();return a?.throwIfAborted(),Ye(c,a)},[h,Ye,ke]),$e=Q.useCallback(async t=>{Ae();let n=we.current,i=IL(u,Fe);if(!i){fe(N);return}let a=Ze(t);if(a){fe(a);return}let o=PL(),s=new AbortController;he(new Map([[o,{tempId:o,fileName:t.name,progress:0,status:`uploading`,abortController:s}]])),ve(0),p?.(De),fe(void 0);try{let a=await Qe(t,i,!!Fe,Fe,e=>{ve(e),he(t=>{let n=new Map(t),r=n.get(o);return r&&n.set(o,{...r,progress:e}),n})},s.signal);if(n!==we.current)return;let c={fileId:a.fileId,updatedAt:new Date};if(Me||ue(c),r?.(c),a.metadata&&be(e=>{let t=new Map(e);return t.set(a.fileId,a.metadata),t}),ce!==`onSubmit`){let t=e.safeParse(c);if(!t.success){let e=t.error.issues[0];if(e){let t={...vL(e),message:e.message},n=v(e.code,`msg`,t);fe(n)}}}}catch(e){if(s.signal.aborted||n!==we.current||FL(e))return;fe(RL(j,e))}finally{he(e=>{let t=new Map(e);return t.delete(o),t}),ve(0)}},[Fe,u,Me,r,N,Ze,ce,e,v,Qe,Ae,p,De,j]),et=Q.useCallback(async e=>{let t=we.current;if(!LL(u)){fe(N);return}let n=Re.current.length;if(re&&n+e.length>re){fe(y(K.LOW_LEVEL_FORM_FIELD_FILE,`too_many_files`,{max:re}));return}let i=[];for(let t of e){let e=Ze(t);if(e){fe(e);return}i.push(t)}p?.(De),fe(void 0);let a=new Map,o=[];for(let e of i){let t=PL(),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})}he(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 Qe(n,u.upload,!1,null,t=>{he(n=>{let r=new Map(n),i=r.get(e);return i&&r.set(e,{...i,progress:t}),r})},r.signal);return he(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&&be(e=>{let n=new Map(e);return n.set(t.fileId,t.metadata),n}),t.fileId}catch(n){throw r.signal.aborted||t!==we.current||FL(n)?(he(t=>{let n=new Map(t);return n.delete(e),n}),n):(he(t=>{let r=new Map(t),i=r.get(e);return i&&r.set(e,{...i,status:`error`,error:RL(j,n)}),r}),n)}})),c=[];for(let e of s)e.status===`fulfilled`&&c.push(e.value);if(c.length>0&&t===we.current){let e=[...Re.current,...c];Re.current=e;let t={fileIds:e,updatedAt:new Date};Me||ue(t),r?.(t)}he(e=>{let t=new Map(e);for(let[e,n]of t)n.status===`done`&&t.delete(e);return t})},[u,Me,re,r,y,Qe,Ze,j,N,p,De]),tt=ie?.aspectRatio,nt=vee(e)?.display?.preview?.shape,[rt,it]=Q.useState(null),at=Q.useCallback(e=>{it(null),$e(e)},[$e]),ot=Q.useCallback(()=>{it(null)},[]),st=Q.useCallback(e=>{it(null),$e(e)},[$e]),ct=Q.useCallback(e=>{if(e.length!==0){if(V)et(e);else{let t=e[0];if(tt&&xL(t)&&AL(L)){let e=Xe(t);if(e){fe(e);return}fe(void 0),it(t);return}$e(t)}}},[V,et,$e,tt,Xe,L]),lt=Q.useCallback(async(e,t)=>{V||Ae();let n=we.current,i=V?t:t.slice(0,1),a=V?u.upload:IL(u,Fe);if(!a){fe(N);return}p?.(De),fe(void 0);let o=await Promise.allSettled(i.map(async t=>{let n=PL();Ee(e=>new Set(e).add(n));let r=new AbortController;Ce.current.add(r);try{let n=await gL(()=>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,ke);r.signal.throwIfAborted();let i=await Ye(n,r.signal);return i.metadata&&be(e=>{let t=new Map(e);return t.set(i.fileId,i.metadata),t}),i.fileId}finally{Ce.current.delete(r),Ee(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===we.current){let e=V?{fileIds:[...Re.current,...s],updatedAt:new Date}:{fileId:s[0],updatedAt:new Date};NL(e)&&(Re.current=e.fileIds),Me||ue(e),r?.(e)}if(s.length<i.length&&n===we.current){let e=o.find(e=>e.status===`rejected`);fe(RL(y(K.LOW_LEVEL_FORM_FIELD_FILE,`provider_link_failed`),e?.status===`rejected`?e.reason:void 0))}},[Fe,u,h,Me,V,r,N,y,Ye,Ae,p,De,ke]),ut=Q.useCallback(async(e,t)=>{V||Ae();let n=we.current,r=new AbortController,i=PL();Ce.current.add(r),p?.(De),Ee(e=>new Set(e).add(i));try{let i=[],a=[],o=!1;for(let e of t)if(e.kind===pd.BROWSER_READABLE_FILE)i.push(e.file);else if(e.kind===pd.BROWSER_READABLE_URL)try{let t=await gL(()=>fetch(e.url,{signal:r.signal}),r.signal,12e4,ke);if(!t.ok){o=!0;continue}let n=await gL(()=>t.blob(),r.signal,12e4,ke);i.push(new File([n],e.displayName??`file`,{type:e.mimeType??n.type}))}catch{if(r.signal.aborted||n!==we.current)return;o=!0}else a.push(e);if(r.signal.aborted||n!==we.current)return;if(a.length>0){await lt(e,a);return}if(o&&i.length===0){fe(y(K.LOW_LEVEL_FORM_FIELD_FILE,`provider_fetch_failed`));return}if(i.length===0)return;fe(o?y(K.LOW_LEVEL_FORM_FIELD_FILE,`provider_fetch_failed`):void 0),ct(i)}finally{Ce.current.delete(r),Ee(e=>{let t=new Set(e);return t.delete(i),t})}},[ct,lt,y,V,Ae,p,De,ke]),dt=Q.useCallback(()=>{fe(y(K.LOW_LEVEL_FORM_FIELD_FILE,`provider_picker_failed`))},[y]),ft=Q.useCallback(e=>{let t=e.target.files;t&&t.length>0&&ct(Array.from(t)),je.current&&(je.current.value=``)},[ct]),pt=o||s,mt=pt||!Le,ht=Q.useCallback(e=>{e.preventDefault(),e.stopPropagation(),!mt&&!Pe&&Se(!0)},[mt,Pe]),H=Q.useCallback(e=>{e.preventDefault(),e.stopPropagation(),Se(!1)},[]),vt=Q.useCallback(e=>{if(e.preventDefault(),e.stopPropagation(),Se(!1),mt||Pe)return;let t=e.dataTransfer.files;t&&t.length>0&&ct(Array.from(t))},[mt,Pe,ct]),yt=Q.useCallback(async()=>{if(Ae(),Fe){if(u.delete)try{let e=`${u.delete}/${encodeURIComponent(Fe)}`;await qe(e)}catch(e){if(FL(e))return;fe(RL(j,e));return}fe(void 0),Me||ue(null),r?.(null),be(e=>{let t=new Map(e);return t.delete(Fe),t})}},[Fe,u,Me,r,qe,j]),bt=Q.useCallback(async e=>{if(Ae(),u.delete)try{let t=`${u.delete}/${encodeURIComponent(e)}`;await qe(t)}catch(e){if(FL(e))return;fe(RL(j,e));return}fe(void 0);let t=Re.current.filter(t=>t!==e);Re.current=t;let n=t.length>0?{fileIds:t,updatedAt:new Date}:null;Me||ue(n),r?.(n),be(t=>{let n=new Map(t);return n.delete(e),n})},[u,Me,r,qe,j]),xt=Q.useCallback(e=>{let t=ge.current.get(e);t&&t.abortController.abort(),he(t=>{let n=new Map(t);return n.delete(e),n})},[]),St=Q.useCallback(()=>{!mt&&!Pe&&je.current?.click()},[mt,Pe]),Ct=e=>e?e.startsWith(`image/`)?W.FILE_IMAGE:e.startsWith(`video/`)?W.FILE_VIDEO:e.startsWith(`audio/`)?W.FILE_AUDIO:e===`application/pdf`?W.FILE_TEXT:e.includes(`spreadsheet`)||e.includes(`excel`)?W.FILE_SPREADSHEET:e.includes(`presentation`)||e.includes(`powerpoint`)?W.FILE_PRESENTATION:e.includes(`document`)||e.includes(`word`)?W.FILE_TEXT:e.includes(`zip`)||e.includes(`rar`)||e.includes(`7z`)?W.FILE_ARCHIVE:W.FILE:W.FILE,wt=(e,t=tr.MD)=>w(Ct(e),{size:t}),Tt=yL(Zt(L),y),Et=F?.nature,Dt=(e,t=!1)=>pt?null:(0,$.jsxs)(`div`,{className:G(`flex items-center gap-element`,t?`flex-shrink-0`:``),children:[!t&&B&&Le&&(0,$.jsx)(Y,{type:`button`,variant:X.OUTLINE,size:df.SM,onClick:St,disabled:Pe,children:O}),(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.SM,onClick:e,disabled:Pe,className:G(`text-destructive hover:text-destructive`,t&&`h-6 w-6 p-0`),"aria-label":A,title:A,children:w(W.CLOSE,{size:tr.SM})})]}),Ot=(e,t,n=!1)=>(0,$.jsxs)(`div`,{className:G(`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:G(`font-medium text-primary hover:underline truncate`,n&&`text-sm`),children:t.filename}):(0,$.jsx)(`span`,{className:G(`font-medium truncate`,n&&`text-sm`),children:Khe(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]})]})]}),kt=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:wt(e.mimeType,tr.MD)}),Ot(``,e),Dt(yt)]})]}),At=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:wt(e.mimeType,tr.MD)}),Ot(``,e),Dt(yt)]})]}),U=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:wt(e.mimeType,tr.MD)}),Ot(``,e),Dt(yt)]}),(0,$.jsx)(`audio`,{src:e.url,controls:!0,className:`w-full h-8`,preload:`metadata`})]}),jt=(e,t)=>{if(t&&![ne.READY,ne.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:wt(void 0,tr.LG)}),Ot(e,null),Dt(yt)]});let n=wa(Et,t.mimeType);return n===gt.IMAGE&&(t.url||t.thumbnailUrl)?kt(t):n===gt.VIDEO&&t.url?At(t):n===gt.AUDIO&&t.url?U(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:wt(t.mimeType,tr.LG)}),Ot(e,t),Dt(yt)]})},Mt=(e,t)=>{t&&![ne.READY,ne.ATTACHED].includes(t.readiness)&&(t={...t,url:void 0,thumbnailUrl:void 0});let n=wa(Et,t?.mimeType),r=()=>bt(e);return n===gt.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:Ot(e,t,!0)}),Dt(r,!0)]},e):n===gt.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:wt(t.mimeType,tr.MD)}),(0,$.jsx)(`div`,{className:`flex-1 min-w-0`,children:Ot(e,t,!0)}),Dt(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:wt(t?.mimeType,tr.MD)}),(0,$.jsx)(`div`,{className:`flex-1 min-w-0`,children:Ot(e,t??null,!0)}),Dt(r,!0)]},e)},Nt=()=>(0,$.jsxs)(`div`,{className:`space-y-element`,children:[Ie.map(e=>{let t=ye.get(e);return Mt(e,t)}),Array.from(me.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)(Jy,{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(W.WARNING,{size:tr.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)(Y,{type:`button`,variant:X.GHOST,size:df.SM,onClick:()=>xt(e.tempId),className:`text-muted-foreground hover:text-destructive h-6 w-6 p-0`,"aria-label":y(K.LOW_LEVEL_FORM_FIELD_FILE,`cancel`),title:y(K.LOW_LEVEL_FORM_FIELD_FILE,`cancel`),children:w(W.CLOSE,{size:tr.SM})})]},e.tempId))]}),Pt=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`},Ft=Q.useMemo(()=>{let e=[];if(z&&R?e.push(y(K.LOW_LEVEL_FORM_FIELD_FILE,`constraint_size_range`,{min:S(z),max:S(R)})):z&&e.push(y(K.LOW_LEVEL_FORM_FIELD_FILE,`constraint_min_size`,{min:S(z)})),ie){let{minWidth:t,maxWidth:n,minHeight:r,maxHeight:i,aspectRatio:a}=ie;if(t||r){let n=t??`–`,i=r??`–`;e.push(y(K.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(K.LOW_LEVEL_FORM_FIELD_FILE,`constraint_image_max_dimensions`,{width:String(t),height:String(r)}))}a&&e.push(y(K.LOW_LEVEL_FORM_FIELD_FILE,`constraint_image_aspect_ratio`,{width:String(a.width),height:String(a.height)}))}return ae&&ae.maxDuration&&e.push(y(K.LOW_LEVEL_FORM_FIELD_FILE,`constraint_video_max_duration`,{duration:Pt(ae.maxDuration)})),oe&&oe.maxDuration&&e.push(y(K.LOW_LEVEL_FORM_FIELD_FILE,`constraint_audio_max_duration`,{duration:Pt(oe.maxDuration)})),se&&se.maxPages&&e.push(y(K.LOW_LEVEL_FORM_FIELD_FILE,`constraint_document_max_pages`,{pages:se.maxPages})),V&&re&&e.push(y(K.LOW_LEVEL_FORM_FIELD_FILE,`constraint_max_files`,{max:re})),e},[z,R,ie,ae,oe,se,V,re,y,S]),Lt=()=>Ft.length===0?null:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-x-group gap-y-item-xs mt-item-xs`,children:Ft.map((e,t)=>(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e},t))}),Rt=(e=!1)=>(0,$.jsx)(`div`,{onClick:St,onDragOver:ht,onDragLeave:H,onDrop:vt,className:G(`relative flex flex-col items-center justify-center rounded-md border-2 border-dashed cursor-pointer`,e?`p-card-sm`:`p-container`,xe&&`border-primary bg-primary/5`,mt&&`opacity-[var(--opacity-disabled)] cursor-not-allowed`,Pe&&!V&&`pointer-events-none`,de&&`border-destructive`,!mt&&!Pe&&`hover:border-primary hover:bg-primary/5`,E.motion.transition),children:Pe&&!V?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Jy,{size:32,className:`text-primary mb-element`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:_e<0?y(K.LOW_LEVEL_FORM_FIELD_FILE,`uploading_indeterminate`):y(K.LOW_LEVEL_FORM_FIELD_FILE,`uploading`,{progress:_e})}),(0,$.jsx)(`div`,{className:`w-full max-w-xs h-1 bg-muted rounded-full mt-element overflow-hidden`,children:_e<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}%`}})})]}):(0,$.jsxs)($.Fragment,{children:[!e&&(0,$.jsx)(`span`,{className:`mb-element`,"aria-hidden":`true`,children:w(W.UPLOAD,{size:tr.XL})}),(0,$.jsx)(`span`,{className:G(`font-medium`,e?`text-xs`:`text-sm`),children:e?y(K.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:[Tt,R&&!z&&` • ${y(K.LOW_LEVEL_FORM_FIELD_FILE,`max_size`,{size:S(R)})}`]}),Lt()]})]})}),zt=V&&(!re||Ie.length<re),Bt=()=>(0,$.jsx)(ex,{multiple:V,constraints:I,acceptedStorages:F?.storageAccepted,onSelect:ut,onProviderFailure:dt,renderConsentRequired:({choice:e,missingPurposes:t,grant:n})=>{let r=t.map(e=>b(Wo.USER_SELF_PREFERENCES,`privacy.consentedPurposes`,e,qhe)).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(K.LOW_LEVEL_FORM_FIELD_FILE,`provider_consent_required`,{provider:i,purposes:r})}),n===void 0?null:(0,$.jsx)(Y,{type:`button`,size:df.SM,variant:X.OUTLINE,onClick:()=>void n(),children:y(K.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)(Y,{type:`button`,size:df.SM,variant:e.providerRef===t?X.DEFAULT:X.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:[(de??Ge)&&(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:de??Ge}),Te.size>0&&(0,$.jsx)(Y,{type:`button`,onClick:Ae,children:y(K.LOW_LEVEL_FORM_FIELD_FILE,`cancel`)}),(0,$.jsx)(`input`,{ref:je,type:`file`,accept:te,multiple:V,onChange:ft,className:`hidden`,disabled:mt}),V?(0,$.jsxs)(`div`,{className:`space-y-element`,children:[(Ie.length>0||me.size>0)&&Nt(),!mt&&zt&&Rt(Ie.length>0),!mt&&Ie.length===0&&!zt&&Rt(!1),!mt&&zt&&Bt()]}):Fe?jt(Fe,Ve):Le?(0,$.jsxs)($.Fragment,{children:[Rt(!1),!mt&&Bt()]}):null,rt&&tt&&(0,$.jsx)(bL,{file:rt,aspectRatio:tt,maskShape:nt,maxOutputWidth:ie?.maxWidth,maxOutputHeight:ie?.maxHeight,maxOutputSizeBytes:R,allowedMimeTypes:L,onConfirm:at,onCancel:ot,onUncroppable:st})]}):null}),qhe=rs(Ja).consentedPurposes,BL=(0,Q.forwardRef)(({preset:e=H.DEFAULT,httpOperations:t,...n},r)=>{let{httpClient:i}=Su(),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=kl(K.LOW_LEVEL_FORM_FIELD_FILE,`FormFieldFile`)(e),s={...n,httpOperations:a};return(0,$.jsx)(o,{...s,ref:r})});BL.displayName=`FormFieldFile`;var Jhe=[`shipping`,`billing`],Yhe=[`home`,`work`,`mobile`,`fax`,`pager`],Xhe=[`webauthn`];function Zhe(e){if(!e)return{leadingModifiers:[],trailingModifiers:[]};let t=Array.isArray(e)?e:[e],n=Array.from(new Set(t)),r=n.find(e=>Jhe.includes(e)),i=n.find(e=>Yhe.includes(e)),a=n.find(e=>Xhe.includes(e));return{leadingModifiers:[...r?[r]:[],...i?[i]:[]],trailingModifiers:a?[a]:[]}}function Qhe({identifier:e,modifier:t}){if(!e)return;let{leadingModifiers:n,trailingModifiers:r}=Zhe(t);return[...n,e,...r].join(` `)}function VL(e){switch(e){case`stacked`:return bc.STACKED;case`inline`:return bc.INLINE;case`compact`:return bc.COMPACT;default:return}}function HL(e){switch(e){case`top`:case`start`:case`inline`:case`hidden`:return e;default:return}}function UL(e){switch(e){case`sm`:return Nf.SM;case`md`:return Nf.MD;default:return}}var WL=300;function $he(e,t,n=WL){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 ege(e){return!!(e?.upload||e?.override)}function GL(e){return e??void 0}function tge(e,t,n=Jc.ON_BLUR,r=!1,i,a=bi){let{debouncedTrigger:o,cancelDebounce:s}=$he(e.trigger,t,WL),c=SE(),l=(i?Ec(i):void 0)?.autosave,u=wE(l,c?.config.defaultTrigger,r),d=c?.getFieldStateInfo(t),f=d?.state??Yw.IDLE,p=d?.lastError,m=(0,Q.useCallback)(()=>{c?.retryFieldSave?.(t)},[c,t]),{validateUniqueness:h}=Ufe({fieldName:t,fieldSchema:i}),{handleFieldBlur:g,noteInputReceived:_}=NM(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===Ts.BLUR){let n=e.getValues(t);c.triggerSave(t,n,Ts.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===Ts.DEBOUNCE&&c.triggerSave(t,d,Ts.DEBOUNCE)},[e,t,n,r,o,c,u,i,a,_]),autosaveFieldState:f,autosaveError:p,handleRetrySave:m,saveFieldNow:(0,Q.useMemo)(()=>c?.config.enabled&&u!==Ts.NONE?e=>c.triggerSave(t,e,Ts.BLUR):void 0,[c,u,t])}}function nge(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 rge(e){if(!nge(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 KL({inputProps:e,value:t,isGeneratedPdfField:n,onBlur:r,inputRef:i}){let{tComponent:a}=q({component:K.LOW_LEVEL_FORM_FIELD_FILE}),o=rge(t),s=o===0?``:o>1?a(K.LOW_LEVEL_FORM_FIELD_FILE,`files_attached`,{count:o}):a(K.LOW_LEVEL_FORM_FIELD_FILE,`file_attached`),c=a(K.LOW_LEVEL_FORM_FIELD_FILE,n?`generated_pdf_read_only`:`uploads_unavailable_placeholder`);return(0,$.jsx)(YM,{...e,value:s,onChange:()=>void 0,onBlur:r,ref:i,placeholder:c,type:`text`,readOnly:!0,disabled:!0})}function ige(e,t,n,r){return Ec(e)?.validationMode||t||n||_r.getDefaultValidationMode(r)}function age(e,t){return t.some(t=>e===t||e.startsWith(`${t}.`)||e.startsWith(`${t}[`))}function oge(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 sge(e,t){return _r.resolveFieldSchemaPath(e,t)}function qL({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:y,renderField:b,sectionAppearance:x,objectItemLayout:S,fileUploadContext:C,autoFocus:w,excludedChildKeys:T,quickCreateSourceFieldName:E}){let D=LC(),O=jD(),k=gc(),{registry:A}=fm(),j=Q.useContext(Vi)?.appConfig,{tErrorValidation:M,t:N,isReady:P}=q({keys:[`errors_validation`]}),F=jT(),I=wD(e),L=F?.allowedValuesByField?.[I],R=d??L?.values;AM(I),uk(I),Ik([I]);let z=!/\.\d+(\.|$)/.test(I),B=t??sge(F?.schema,I),ee=(0,Q.useMemo)(()=>B?Rne(j,Bl(B)):void 0,[B,j]),te=Vfe({declaration:F?.requestFieldOffers?.[I],record:F?.requestFieldOfferRecord,appConfig:j,fieldName:I}),ne=(0,Q.useMemo)(()=>{if(!B)return;let e=Zl(B),t=e===jr.ARRAY?pu(B):void 0,n=ee??(e===jr.ENUM?pt(B):void 0)??(t&&Zl(t)===jr.ENUM?pt(t):void 0);return qre(te,n)},[B,ee,te]),V=!!B&&!R&&Zl(B)===jr.STRING&&La(B)===Yl.ORGANIZATION_ROLE,re=V?void 0:ne,ie=V?F?.roleGrantPickerOffersByField?.[I]:void 0,ae=(0,Q.useMemo)(()=>ie?ne?ne.filter(e=>ie.includes(e)):ie:ne,[ne,ie]),oe=re?R?R.filter(e=>re.includes(e)):re:R??ee,se=F?.reportRequestFieldOffer,ce=!!F?.requestFieldOffers?.[I];(0,Q.useEffect)(()=>{ce&&se?.(I,te)},[ce,se,I,te]);let le=_r.labelDictionaryPath(I),ue=n??F?.fieldLabels?.[le]??e,de=r??F?.fieldDescriptions?.[le],fe=i??F?.fieldTooltips?.[le],pe=u??F?.enumLabels?.[le]??(d?void 0:L?.labels),me=m??F?.disabled,he=C??F?.fileUploadContext,ge=F?.generatedFieldOverrides?.[I],_e=[...Object.keys(F?.contextFieldValues??{}),...F?.hiddenFieldNames??[],...Object.keys(F?.generatedFieldOverrides??{})],ve=ge==null&&age(I,_e),be=B?Nl(B):void 0,Se=I.includes(`.`)?I.slice(0,I.lastIndexOf(`.`)):``,Ce=be?oge(be,Se):void 0,we=Ce?_r.getShowWhenWatchFields(Ce):[],Te=NC({name:we.length>0?we:[]}),Ee=Array.isArray(Te)?Te:we.length>0?[Te]:[],De=NC({name:F?.inheritanceConfig?.discriminatorField?[F.inheritanceConfig.discriminatorField]:[]}),Oe=Array.isArray(De)?De[0]:De,ke=I.match(/^[^.[\]]+/)?.[0]??I,Ae=(0,Q.useMemo)(()=>{if(!Ce)return!0;let e=Object.fromEntries(we.map((e,t)=>[e,Ee[t]]));return _r.evaluateShowWhen(Ce,e)},[Ce,we,Ee]),je=(0,Q.useMemo)(()=>!F?.inheritanceConfig?.discriminatorField||_r.computeFieldVisibility(F.schema,ke,{[F.inheritanceConfig.discriminatorField]:Oe},F.inheritanceConfig),[Oe,F?.inheritanceConfig,F?.schema,ke]),Me=B?Zl(B):jr.STRING,Ne=B?Ec(B):void 0,Pe=F?.hostResolvesRelationshipRoots===!0,Fe=(0,Q.useMemo)(()=>{if(!(Pe||!B||!O.resourceType||Me!==jr.OBJECT&&Me!==jr.ARRAY))return pj({resourceType:O.resourceType,fieldName:I,operationType:O.operationType,registry:A})},[Pe,B,O.operationType,O.resourceType,I,A,Me]),Ie=Me===jr.STRING||Me===jr.CODE||Me===jr.NUMBER||Me===jr.BIGINT||Me===jr.MONEY||Me===jr.BIGDECIMAL,Le=B?ige(B,p,O.validationMode,Me):p??O.validationMode??Jc.ON_BLUR,Re=h??F?.readOnly??(B?wee(B,O.operationType):!1),ze=Mhe[Nhe({schemaKind:O?.schemaKind,rootSchema:F?.schema,fieldName:I})],Be=ze.normalizeClearedValue,Ve=B?ze.isClearable(B):!1,{createBlurHandler:He,createChangeHandler:Ue,autosaveFieldState:We,autosaveError:Ge,handleRetrySave:Ke,saveFieldNow:qe}=tge(D,I,Le,Ie,B,Be),Je=w??(F?void 0:Ne?.autoFocus),Ye=Ne,Xe=Qhe({identifier:Ye?.autoComplete,modifier:Ye?.autoCompleteModifier}),Ze=(0,Q.useMemo)(()=>B?!_re(B):!1,[B]),Qe=Q.useContext(vT),$e=(0,Q.useRef)(Symbol(`file-field-validation`)).current;(0,Q.useEffect)(()=>()=>{Qe?.delete($e)},[Qe,$e,I]);let{setError:et,clearErrors:tt,getFieldState:nt}=D,rt=(0,Q.useCallback)(e=>{let t=e=>{let t=nt(I).error;(t?.type!==`file-validation`||t.message!==e)&&et(I,{type:nI,message:e})};if(e)Qe?.set($e,{name:I,message:e}),t(e);else{Qe?.delete($e);let e=[...Qe?.values()??[]].find(e=>e.name===I);if(e){t(e.message);return}nt(I).error?.type===`file-validation`&&tt(I)}},[et,tt,nt,I,Qe,$e]),it=D.getFieldState(I,D.formState),at=iI(it,D.formState.isSubmitted,Le,M),{formChromeMode:ot,sectionChromeMode:st}=qw(),ct=VL(k.autoRender?.autoFieldChrome),lt=Ne?.chromeMode??st??ot??ct,ut=a??HL(k.autoRender?.autoLabelPlacement),dt=c??UL(k.autoRender?.autoFieldDensity),ft=l!==!1&&k.autoRender?.autoErrorPlacement===`summary-at-surface-top`,mt=te.kind===ire.NOT_OFFERED,ht=!!B&&(ve||!Ae||!je||mt);if(mk(!!B&&!ht),(0,Q.useEffect)(()=>{ht&&!z&&I&&D.getValues(I)!==void 0&&D.setValue(I,void 0,{shouldDirty:!1,shouldValidate:!1})},[ht,z,I,D]),(0,Q.useEffect)(()=>{if(!ne||!I)return;let e=D.getValues(I);if(e==null)return;let t=new Set(ne);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})},[ne,I,D]),!B||ht)return null;if(ge!=null)return(0,$.jsx)($.Fragment,{children:ge});let H=Ne?.forceHide,gt={mode:lt,label:ue,description:de,tooltip:fe,labelPlacement:ut,error:at,required:Ze,hideLabel:o??H?.label,hideDescription:s??H?.description,hideError:H?.error||ft,saveState:We,saveErrorMessage:Ge,onRetrySave:Ke,onSaveFieldNow:qe,fieldName:I,disabled:me,className:g},_t={schema:B,clearable:Ve,name:I,disabled:me,readOnly:Re,validationMode:Le,required:Ze,autoFocus:Je||void 0,controlSize:dt},vt=!(!Fe||Fe.semantics.nature===Cn.COMPOSITION&&Fe.nestedMutationConfig),yt=Me===jr.RANGE_NUMBER||Me===jr.RANGE_DATE||Me===jr.RANGE_DATETIME||Me===jr.RANGE_TIME||Me===jr.RANGE_BIGDECIMAL||Me===jr.RANGE_MONEY;if(yt){let e=Yte(B),t=f??Ne?.component??ic(e??Mte.NUMBER);return(0,$.jsx)(FC,{name:I,control:D.control,shouldUnregister:z,render:({field:e})=>{let n=He(e.onBlur),r=Ue(e.onChange),i={..._t,value:GL(D.getValues(I)),onBlur:n},a=(()=>{let n=e.ref;switch(t){case $t.RANGE_SLIDER:return(0,$.jsx)(qM,{...i,onValueChange:r,ref:n});case $t.DATE_RANGE:return(0,$.jsx)(uN,{...i,onChange:r,ref:n});case $t.DATETIME_RANGE:return(0,$.jsx)(pN,{...i,onChange:r,ref:n});case $t.TIME_RANGE:return(0,$.jsx)(gN,{...i,onChange:r,ref:n});case $t.BIGDECIMAL_RANGE:return(0,$.jsx)(fL,{...i,onChange:r,ref:n});case $t.MONEY_RANGE:return(0,$.jsx)(mL,{...i,onChange:r,ref:n});default:return{[jr.RANGE_BIGDECIMAL]:(0,$.jsx)(fL,{...i,onChange:r,ref:n}),[jr.RANGE_MONEY]:(0,$.jsx)(mL,{...i,onChange:r,ref:n}),[jr.RANGE_DATE]:(0,$.jsx)(uN,{...i,onChange:r,ref:n}),[jr.RANGE_DATETIME]:(0,$.jsx)(pN,{...i,onChange:r,ref:n}),[jr.RANGE_TIME]:(0,$.jsx)(gN,{...i,onChange:r,ref:n}),[jr.RANGE_NUMBER]:(0,$.jsx)(sN,{...i,onChange:r,ref:n})}[Me]??(0,$.jsx)(qM,{...i,onValueChange:r,ref:n})}})();return(0,$.jsx)(UM,{...gt,children:a})}})}let bt=e=>(0,$.jsx)(EE,{fieldName:I,label:ue,disabled:me,onSaveFieldNow:qe,children:e});if(Me===jr.OBJECT){if(vt)return null;let e=ls(B),t=e?dhe(j,e):void 0;return t?xt(e=>(0,$.jsx)(_I,{..._t,types:t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):bt((0,$.jsx)(vN,{name:I,schema:B,label:ue,hideLabel:o,description:de,disabled:me,className:g,renderField:b,excludedChildKeys:T}))}if(Me===jr.RECORD){let e=v(B);return e?bt((0,$.jsx)(xN,{name:I,schema:B,label:ue,description:de,disabled:me,className:g,valueSchema:e,keySchema:null})):null}if(Me===jr.MAP){let e=vr(B);return e?bt((0,$.jsx)(xN,{name:I,schema:B,label:ue,description:de,disabled:me,className:g,valueSchema:e.valueSchema,keySchema:e.keySchema})):null}if(Me===jr.ARRAY)return vt?null:(0,$.jsx)(mI,{name:I,schema:B,label:ue,description:de,disabled:me,className:g,renderField:b,sectionAppearance:x,objectItemLayout:S,enumLabels:pe,allowedValues:oe});function xt(e,t){return(0,$.jsx)(FC,{name:I,control:D.control,shouldUnregister:z,render:({field:n})=>(0,$.jsx)(UM,{...gt,...t,children:e({value:GL(D.getValues(I)),onChange:Ue(n.onChange),onBlur:He(n.onBlur),ref:n.ref})})})}if(oe){let e=Bl(B),t=t=>{if(!e)return;let n=ye(e,t),r=N(n);return r===n?void 0:r},n=oe.map(e=>({value:e,label:pe?.[e]??t(e)??e}));return xt(e=>(0,$.jsx)(tI,{..._t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,options:n}))}let St=f;if(St&&!yt)switch(St){case $t.INPUT:case $t.TEXTAREA:return xt(e=>(0,$.jsx)(VI,{..._t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_,autoComplete:Xe,type:y}));case $t.SLIDER:return xt(e=>(0,$.jsx)(UI,{..._t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));case $t.CHECKBOX:case $t.SWITCH:return xt(e=>(0,$.jsx)(EI,{..._t,checked:e.value,onCheckedChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));case $t.SELECT:case $t.RADIO_GROUP:case $t.CHECKBOX_GROUP:{let e=pe?YL(B,pe):void 0;return xt(t=>(0,$.jsx)(tI,{..._t,value:t.value,onChange:t.onChange,onBlur:t.onBlur,ref:t.ref,options:e}))}case $t.DATE:return xt(e=>(0,$.jsx)($M,{..._t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));case $t.DATETIME:return xt(e=>(0,$.jsx)(nN,{..._t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));case $t.TIME:return xt(e=>(0,$.jsx)(aN,{..._t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}))}if(Me===jr.MONEY)return xt(e=>(0,$.jsx)(KI,{..._t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Me===jr.DURATION)return xt(e=>(0,$.jsx)(JI,{..._t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Me===jr.PHONE)return xt(e=>(0,$.jsx)(tL,{..._t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_,autoComplete:Xe}));if(Me===jr.ADDRESS){let e=Object.fromEntries(Rte().map(e=>[e,iI({...D.getFieldState(`${I}.${e}`,D.formState),isTouched:it.isTouched,isDirty:it.isDirty},D.formState.isSubmitted,Le,M)])),t=it.error;return xt(t=>(0,$.jsx)(oL,{..._t,value:t.value,onChange:t.onChange,onBlur:t.onBlur,ref:t.ref,partErrors:e,renderLookup:e=>(0,$.jsx)(gx,{host:e,addressSchema:B,fieldName:I})}),t!==void 0&&(t.message!==void 0||t.type!==void 0)?void 0:{error:void 0})}if(Me===jr.BIGDECIMAL)return xt(e=>(0,$.jsx)(lL,{..._t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Me===jr.CODE)return xt(e=>(0,$.jsx)(uL,{..._t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));if(Me===jr.FILE){let e=_r.normalizeSchemaFieldPath(I),t=he?.[e],n=Cr(B);return!n&&ege(t)?xt(e=>(0,$.jsx)(BL,{..._t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,endpoints:t,onValidationError:rt}),{wideControl:!0}):n?(0,$.jsx)(UM,{...gt,children:(0,$.jsx)(KL,{inputProps:_t,value:D.getValues(I),isGeneratedPdfField:!0})}):xt(e=>(0,$.jsx)(UM,{...gt,children:(0,$.jsx)(KL,{inputProps:_t,value:e.value,isGeneratedPdfField:!1,onBlur:e.onBlur,inputRef:e.ref})}))}if(xe(B))return xt(e=>(0,$.jsx)(hI,{..._t,quickCreateSourceFieldName:E,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));if(Me===jr.BOOLEAN)return xt(e=>(0,$.jsx)(EI,{..._t,checked:e.value,onCheckedChange:e.onChange,onBlur:e.onBlur,ref:e.ref}));if(Me===jr.STRING)return xt(e=>(0,$.jsx)(VI,{..._t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_,autoComplete:Xe,type:y,...V&&ae?{offeredValues:ae}:{}}));if(Me===jr.NUMBER||Me===jr.BIGINT)return xt(e=>(0,$.jsx)(UI,{..._t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref,placeholder:_}));if(Me===jr.ENUM){let e=pe?YL(B,pe):void 0;return xt(t=>(0,$.jsx)(tI,{..._t,value:t.value,onChange:t.onChange,onBlur:t.onBlur,ref:t.ref,options:e}))}return Me===jr.DATE?xt(e=>(0,$.jsx)($M,{..._t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):Me===jr.DATETIME?xt(e=>(0,$.jsx)(nN,{..._t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):Me===jr.TIME?xt(e=>(0,$.jsx)(aN,{..._t,value:e.value,onChange:e.onChange,onBlur:e.onBlur,ref:e.ref})):(0,$.jsx)(UM,{...gt,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:Me}),(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e,`)`]})]})})}qL.displayName=`FormField`;var JL=qL;yk(JL,gk.FIELD_SLOT);function YL(e,t){return pt(e).map(e=>({value:e,label:t?.[e]??e}))}var XL=tl.getLogger();function ZL(e,t){let n=e instanceof sj?e.mutationError:void 0,r=n?n.validationErrors?DM({httpStatus:n.status??400,validationErrors:n.validationErrors}):null:DM(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 QL=XL.debugByType(`DisplayFieldEditable`);XL.setDebugTypeLogging(`DisplayFieldEditable`,!1);function $L(e,t){return t.some(t=>e===t||e.startsWith(t+`[`)||bM(t,e))}function cge(e){return!!(e?.upload||e?.override)}var lge={mode:`direct`,saveOn:`blur`,showSaveButton:!1,showCancelButton:!0};function eR(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}=q({component:[K.LOW_LEVEL_FORM_FIELD,K.LOW_LEVEL_BUTTON]}),{getRecipe:D}=Ng(),{renderIcon:O}=ef(),k=oj(),{registry:A}=fm(),j=D(It.INDICATOR,Il.SUCCESS),[M,N]=(0,Q.useState)(TT.DISPLAY),[P,F]=(0,Q.useState)(null),I=(0,Q.useRef)(null),L=(0,Q.useRef)(null),R=(0,Q.useRef)(null),z=(0,Q.useRef)(null),[B,ee]=(0,Q.useState)(!1),[te,ne]=(0,Q.useState)(null),[V,re]=(0,Q.useState)(!1),[ie,ae]=(0,Q.useState)(!1),oe=(0,Q.useRef)(r);(0,Q.useEffect)(()=>{oe.current!==r&&(re(!1),ae(!1),ne(null),oe.current=r)},[r]);let se=M!==TT.DISPLAY,ce=M===TT.SAVING,le=C??null,ue=(0,Q.useSyncExternalStore)(le?.subscribe??CM,le?.getSnapshot??wM),de=jn(t)??lge,fe=(0,Q.useMemo)(()=>{if(i&&k.resourceType)return hj({resourceType:k.resourceType,fieldName:i,operationType:J.UPDATE,registry:A})},[i,A,k.resourceType]),pe=(0,Q.useMemo)(()=>{if(i)return y?.[_r.normalizeSchemaFieldPath(i)]},[i,y]),me=n!==jr.FILE||!Cr(t)&&cge(pe),he=(0,Q.useMemo)(()=>i?.includes(`.`)?i.split(`.`).pop():i??`value`,[i]),ge=(0,Q.useMemo)(()=>Vd({[he]:t}),[he,t]),_e=Ow({resolver:fT(ge),defaultValues:{[he]:r},mode:CT});(0,Q.useEffect)(()=>{M===TT.DISPLAY&&(_e.reset({[he]:r}),F(null))},[r,M,_e,he,t]),(0,Q.useEffect)(()=>{if(se&&I.current){let e=setTimeout(()=>{let e=I.current?.querySelector(`input, textarea, select, [tabindex]:not([tabindex="-1"])`);e&&e.focus()},0);return()=>clearTimeout(e)}},[se]),(0,Q.useEffect)(()=>{M===TT.ERROR&&L.current?.focus()},[M]),(0,Q.useEffect)(()=>()=>{R.current!=null&&clearTimeout(R.current)},[]);let ve=(0,Q.useCallback)(async()=>{if(i){if(!await _e.trigger(he))_e.setValue(he,_e.getValues(he),{shouldTouch:!0,shouldDirty:!1,shouldValidate:!1}),N(TT.EDITING);else{F(null),N(TT.SAVING);try{let e=_e.getValues(he);await S(i,e),QL(`inline edit save`,{fieldName:i,value:e}),N(TT.SAVED),R.current=setTimeout(()=>{N(TT.DISPLAY),R.current=null},500)}catch(e){if(e instanceof sj&&e.mutationError?.type===lE.CONFLICT)return;let t=ZL(e,i);if(t!==void 0){let e=ml(t)?T(t.code,`msg`,t.params):t;_e.setError(he,{type:Qw,message:e}),N(TT.EDITING);return}F(w(K.LOW_LEVEL_FORM_FIELD,`save_failed`)),N(TT.ERROR)}}}},[_e,he,i,S,w,T]);(0,Q.useEffect)(()=>{let e=_e.watch((e,{name:t})=>{t===he&&_e.getFieldState(he).error?.type===`server`&&_e.clearErrors(he)});return()=>e.unsubscribe()},[_e,he]);let ye=(0,Q.useCallback)(()=>{i&&QL(`inline edit cancel`,{fieldName:i}),_e.reset({[he]:r}),F(null),N(TT.DISPLAY)},[_e,he,r,i]),be=(0,Q.useCallback)(async e=>{if(i){ne(e),F(null),ee(!0);try{await S(i,e),QL(`inline boolean toggle`,{fieldName:i,value:e})}catch(e){if(ne(null),!(e instanceof sj&&e.mutationError?.type===lE.CONFLICT)){let t=ZL(e,i);F(t===void 0?w(K.LOW_LEVEL_FORM_FIELD,`save_failed`):ml(t)?T(t.code,`msg`,t.params):t)}}finally{ee(!1)}}},[i,S,w,T]),xe=(0,Q.useRef)(w);xe.current=w,(0,Q.useEffect)(()=>{if(!le||!ue?.lastEvent||!i)return;let e=ue.lastEvent;if(e.id!==z.current)switch(z.current=e.id,e.type){case oE.REMOTE_UPDATE:$L(i,e.changedFields)&&M===TT.EDITING&&(QL(`RMM event cancelling inline edit`,{fieldName:i,eventType:e.type}),ye());break;case oE.CONFLICT_RESET:{let t=SM(e.currentData,i);_e.reset({[he]:t}),M!==TT.DISPLAY&&(QL(`RMM event resetting inline edit after conflict`,{fieldName:i,eventType:e.type}),F(xe.current(K.LOW_LEVEL_FORM_FIELD,`field_reset_after_conflict`)),N(TT.ERROR));break}case oE.MUTATION_RESULT:e.result.success&&e.source.type!==cE.DISPLAY&&e.result.savedFields&&$L(i,e.result.savedFields)&&M===TT.EDITING&&(QL(`RMM event cancelling inline edit`,{fieldName:i,eventType:e.type}),ye());break;case oE.RESOURCE_DELETED:M===TT.EDITING&&(QL(`RMM event cancelling inline edit`,{fieldName:i,eventType:e.type}),ye())}},[ue?.lastEvent?.id,le,i,M,he,_e,ye]);let Se=(0,Q.useCallback)(e=>{if(de.saveOn===`blur`&&I.current){let t=e.relatedTarget;I.current.contains(t)||ve()}},[de.saveOn,ve]),Ce=n===jr.CODE||Be(t),we=(0,Q.useCallback)(e=>{e.key===`Escape`?(e.preventDefault(),ye()):e.key===`Enter`&&(Ce?(e.ctrlKey||e.metaKey)&&(e.preventDefault(),ve()):e.shiftKey||(e.preventDefault(),ve()))},[ve,ye,Ce]);function Te(){return(0,$.jsx)(gM,{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:V,onExpandArrayItems:()=>re(!0),showAllObjectFields:ie,onExpandObjectFields:()=>ae(!0)})}function Ee(){let e=te??!!r;return(0,$.jsxs)(`div`,{className:`inline-flex items-center gap-element`,children:[B&&(0,$.jsx)(`span`,{className:`text-muted-foreground`,"aria-hidden":`true`,children:O(W.LOADER_2,{size:tr.SM,className:`animate-spin motion-reduce:animate-none`})}),P&&!B&&(0,$.jsx)(`span`,{className:`text-destructive text-xs`,role:`alert`,children:P}),(0,$.jsx)(bI,{checked:e,onCheckedChange:be,disabled:B,"aria-label":a||i||void 0})]})}function De(){return(0,$.jsxs)(Y,{type:`button`,variant:X.GHOST,className:G(`group relative inline-flex items-center gap-element h-auto px-card-sm py-item-xs`),onClick:()=>{i&&QL(`inline edit start`,{fieldName:i}),N(TT.EDITING)},"aria-label":w(K.LOW_LEVEL_FORM_FIELD,`editField`,{label:a||i||``}),children:[(0,$.jsx)(`span`,{className:`flex-1`,children:Te()}),(0,$.jsx)(`span`,{className:`text-muted-foreground opacity-0 group-hover:opacity-100 motion-safe:transition-opacity`,children:O(W.EDIT,{size:tr.SM})})]})}function Oe(){let e=i?`inline-edit-error-${i.replace(/\./g,`-`)}`:void 0,n=M===TT.ERROR&&!!P;return(0,$.jsx)(Zw,{schema:ge,schemaKind:Jw.MAIN_SCHEMA,form:_e,resourceType:k.resourceType,resourceId:k.resourceId,operationType:J.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:Se,onKeyDown:we,"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)(JL,{name:he,quickCreateSourceFieldName:fe?.sourceFieldName,schema:t,label:``,description:``,disabled:ce,placeholder:a,enumLabels:l,respectSurfaceErrorPlacement:!1,fileUploadContext:pe?{[he]:pe}:void 0,className:`inline-edit-field`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-item-xs shrink-0 pt-item-xs`,children:[M===TT.SAVED&&(0,$.jsx)(`div`,{className:j.base,"aria-hidden":`true`,children:O(W.CHECK,{size:tr.SM})}),de.showSaveButton&&M!==TT.SAVED&&(0,$.jsx)(Y,{type:`button`,size:df.SM,variant:X.DEFAULT,onClick:ve,disabled:ce,"aria-label":w(K.LOW_LEVEL_BUTTON,`save`),children:M===TT.SAVING?O(W.LOADER_2,{size:tr.SM,className:`animate-spin motion-reduce:animate-none`}):O(W.CHECK,{size:tr.SM})}),de.showCancelButton&&(0,$.jsx)(Y,{type:`button`,size:df.SM,variant:X.GHOST,onClick:ye,disabled:ce,"aria-label":w(K.LOW_LEVEL_BUTTON,`cancel`),children:O(W.CLOSE,{size:tr.SM})})]})]}),n&&(0,$.jsxs)(OD,{id:e,variant:`destructive`,role:`alert`,className:`flex items-center gap-element py-card-sm`,children:[O(W.ERROR,{size:tr.SM,className:`shrink-0`}),(0,$.jsx)(AD,{className:`flex-1 m-0`,children:(0,$.jsx)(Z,{children:P})}),(()=>{let e=w(K.LOW_LEVEL_BUTTON,`retry`);return(0,$.jsx)(Y,{ref:L,type:`button`,size:df.SM,variant:X.GHOST,onClick:ve,disabled:ce,"aria-label":e,title:e,children:O(W.TRY_AGAIN,{size:tr.SM})})})()]})]})})}if(!E)return null;let ke;return ke=n===jr.BOOLEAN&&i?Ee():se&&i&&me?Oe():me?De():Te(),(0,$.jsx)(rj,{mode:g,label:a,description:o,tooltip:s,provenance:c,name:i,labelPlacement:_,hideLabel:m,hideDescription:h,wide:b,announceName:x,className:p,children:ke})}eR.displayName=`DisplayFieldEditable`;function tR({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=Ow({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=oj(),y=e.includes(`.`)?e.slice(0,e.lastIndexOf(`.`)):void 0,b=QT(p,{resourceType:v.resourceType,operationId:J.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:J.UPDATE,isExisting:!0}),[p,b]),S=d===!0||c===Cu.HIDDEN||c===Cu.COMPACT,C=(0,Q.useMemo)(()=>({enabled:!0}),[]),{tComponent:w}=q({component:K.RESOURCES_LAYOUTS_CREATE}),T=(0,Q.useMemo)(()=>({errorNetwork:w(K.RESOURCES_LAYOUTS_CREATE,`autosaveErrorNetwork`),errorValidation:w(K.RESOURCES_LAYOUTS_CREATE,`autosaveErrorValidation`),errorGeneric:w(K.RESOURCES_LAYOUTS_CREATE,`autosaveErrorGeneric`),errorConflict:w(K.RESOURCES_LAYOUTS_CREATE,`autosaveErrorConflict`),errorResourceDeleted:w(K.RESOURCES_LAYOUTS_CREATE,`autosaveErrorResourceDeleted`)}),[w]),E=(0,Q.useCallback)(async()=>{await a(e,h.getValues(f))},[a,e,h,f]);return(0,$.jsx)(RC,{...h,children:(0,$.jsx)(Zw,{schema:p,form:h,resourceType:v.resourceType,resourceId:v.resourceId,operationType:J.UPDATE,contextResourceIdentifiers:v.contextResourceIdentifiers,navigationZone:v.navigationZone,children:(0,$.jsx)(kT,{value:x,children:(0,$.jsx)(CE,{onSave:E,labels:T,config:C,children:(0,$.jsx)(`div`,{ref:g,children:(0,$.jsx)(mI,{name:f,schema:t,label:r,description:i,renderField:o,sectionAppearance:s,objectItemLayout:l,enumLabels:u,hideLabel:S,chromeMode:c===Cu.SETTINGS_ROW?bc.SETTINGS_ROW:void 0})})})})})})}tR.displayName=`DisplayFieldEditableArray`;var uge=tR,dge=Cd({slug:md().regex(Nre,`A slot slug is lowerCamelCase with no separators.`).max(40).refine(e=>e!==bl,{error:`"${bl}" is reserved: the environment builder emits ${Zs(`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:Md(),description:md().min(1)}),nR=e=>Ad(dge).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.`})});Cd({addressSlots:nR(`credential address`),secretSlots:nR(`credential secret`)});var fge={[Vo.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."}]},[Vo.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.`}]},[Vo.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.`}]},[Vo.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.`}]},[Vo.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.`}]},[Vo.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.`}]},[Vo.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.`}]},[Vo.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.`}]}},pge=function(e){return e.KEY_ID_SUPPLIED=`key-id-supplied`,e.X509_THUMBPRINT_DERIVED=`x509-thumbprint-derived`,e}({}),mge=function(e){return e.REQUEST_BODY=`request-body`,e.BASIC_HEADER=`basic-header`,e}({}),rR=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}({}),iR=Pd().int().min(30).max(86400),aR={dialects:Ad(zd(Bi)).min(1).optional()},oR=Bae(`kind`,[Cd({kind:Od(Vo.ODOO_API_KEY_IN_ARGS).systemEnum(`SystemOfRecordCredentialKind`),...aR}),Cd({kind:Od(Vo.API_KEY_HEADER).systemEnum(`SystemOfRecordCredentialKind`),...aR,headerName:md().regex(/^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/,`A header name is an RFC 9110 token.`).max(64),valuePrefix:md().max(32).optional()}),Cd({kind:Od(Vo.API_KEY_QUERY).systemEnum(`SystemOfRecordCredentialKind`),...aR,parameterName:md().regex(/^[A-Za-z0-9_.-]+$/,`A query parameter name is alphanumeric with -._`).max(64)}),Cd({kind:Od(Vo.BASIC).systemEnum(`SystemOfRecordCredentialKind`),...aR}),Cd({kind:Od(Vo.OAUTH2_CLIENT_CREDENTIALS_SECRET).systemEnum(`SystemOfRecordCredentialKind`),...aR,clientAuthentication:zd(mge),tokenLifetimeFallbackSeconds:iR}),Cd({kind:Od(Vo.OAUTH2_CLIENT_CREDENTIALS_CERTIFICATE).systemEnum(`SystemOfRecordCredentialKind`),...aR,assertionHeaderPolicy:zd(pge),assertionSigningAlgorithm:zd(rR),assertionLifetimeSeconds:Pd().int().min(30).max(600),tokenLifetimeFallbackSeconds:iR}),Cd({kind:Od(Vo.OAUTH2_JWT_BEARER).systemEnum(`SystemOfRecordCredentialKind`),...aR,assertionSigningAlgorithm:zd(rR),assertionLifetimeSeconds:Pd().int().min(30).max(600),tokenLifetimeFallbackSeconds:iR}),Cd({kind:Od(Vo.MTLS_CLIENT_CERTIFICATE).systemEnum(`SystemOfRecordCredentialKind`),...aR})]),hge=function(e){return e.SKIP=`skip`,e.NEXT_LINK_ONLY=`next-link-only`,e}({}),sR=function(e){return e.FIELD=`field`,e.PATH_SEGMENT=`path-segment`,e}({}),gge=function(e){return e.SCALAR=`scalar`,e.MANY2ONE_PAIR=`many2one-pair`,e}({}),cR=Cd({kind:zd(sR),remoteField:md().min(1).max(120),codec:zd(mae),valueShape:zd(gge)}),lR=function(e){return e.CSRF_TOKEN_HANDSHAKE=`csrf-token-handshake`,e}({}),_ge=`@odata.etag`;Cd({vendor:md().regex(/^[a-z][a-z0-9-]*$/,`A vendor id is lower-kebab-case.`).max(40),dialects:Ad(zd(Bi)).min(1),addressSlots:nR(`vendor address`),credentialOffers:Ad(oR).min(1),odataListPaging:zd(hge).optional(),partition:cR.optional(),incrementalExtractionModes:Ad(zd(fe)).optional(),odataExpiredChangePositionErrorCodes:Ad(md().regex(R)).optional(),actionCallShapes:Ad(zd(tae)).optional(),rowVersionField:md().min(1).max(120).optional(),writePrerequisites:Ad(zd(lR)).optional()}).superRefine((e,t)=>{e.rowVersionField!==void 0&&e.dialects.includes(Bi.ODATA)&&e.rowVersionField!==`@odata.etag`&&t.addIssue({code:`custom`,path:[`rowVersionField`],message:`An OData vendor's row version is its entity tag, "${_ge}" — got "${e.rowVersionField}".`});for(let[n,r]of(e.actionCallShapes??[]).entries())e.dialects.includes(Go[r])||t.addIssue({code:`custom`,path:[`actionCallShapes`,n],message:`Action call shape "${r}" is spoken over ${Go[r]}, which this vendor's dialects do not list.`});e.odataExpiredChangePositionErrorCodes!==void 0&&!(e.incrementalExtractionModes??[]).includes(fe.ODATA_DELTA_LINK)&&t.addIssue({code:`custom`,path:[`odataExpiredChangePositionErrorCodes`],message:`An expired change-position code is read only by the "${fe.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=>vge(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 fge[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.`})}),Cd({vendor:md().regex(/^[a-z][a-z0-9-]*$/,`A vendor id is lower-kebab-case.`).max(40),partition:cR.optional(),credentialOffers:Ad(oR).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 vge(e,t){return e.dialects===void 0||e.dialects.includes(t)}Object.freeze({[Bi.ODATA]:{translatesSort:!0,sendsRowWrites:!0},[Bi.ODATA_V2]:{translatesSort:!0,sendsRowWrites:!1},[Bi.ODOO_JSONRPC]:{translatesSort:!0,sendsRowWrites:!0},[Bi.ODOO_JSON2]:{translatesSort:!0,sendsRowWrites:!0},[Bi.REST_JSON]:{translatesSort:!1,sendsRowWrites:!0}}),Object.freeze({[lR.CSRF_TOKEN_HANDSHAKE]:!1}),Object.freeze({[sR.FIELD]:!0,[sR.PATH_SEGMENT]:!1});function yge(e){if(e.direction===xa.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!==xa.BIDIRECTIONAL||pte(n)===yae.REMOTE)&&un(n).length>0&&t.add(n.localField);return[...t]}var bge=`external-data-provenance`,xge=Cd({system:Hie,currentAsOf:Sae().nullable()}),Sge=3e5,uR=new WeakMap;function Cge(e){let t=uR.get(e);return t||(t=new Set(yge(e)),uR.set(e,t)),t}function wge(e){let{resourceConfiguration:t,contextualParameters:n}=e,r=(t.operations??[]).filter(e=>mre(e,J.LIST));if(r.length!==1)return;let i=r[0].initiatorInfos??[];if(i.length===0)return;let a=U.selectOperationUrlInitiatorInfo({initiatorInfos:i,contextualParameters:n,targetResourceType:t.resourceIdentifier,targetDefaultFieldIdentifier:t.resourceFieldIdentifier});if(!a)return;let o=Hm.resolveUrlPath(a.url,n);if(o&&!Hm.hasUnresolvedPlaceholders(o))return`${o}/${bge}`}var dR=new WeakMap,fR=new Set;function Tge(e){let t=dR.get(e);return t||(t={cache:new Map,inFlight:new Map},dR.set(e,t)),t}function Ege(){for(let e of fR)e()}function Dge(e){return fR.add(e),()=>{fR.delete(e)}}function Oge(e,t,n=Date.now()){let r=e&&t?dR.get(t)?.cache.get(e):void 0;return r?Math.max(0,r.fetchedAt+Sge-n):void 0}function kge(e,t){if(e&&t)return dR.get(t)?.cache.get(e)?.value}function pR(e,t,n=Date.now()){let{cache:r,inFlight:i}=Tge(t),a=r.get(e);if(a&&n-a.fetchedAt<3e5||i.has(e))return;let o=(async()=>{let n;try{let r=xge.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),Ege()})();i.set(e,o)}function Age(e){let{resourceType:t,contextualParameters:n}=oj(),r=ym(),i=(0,Q.useContext)(Vi)?.httpClient,a=t?r?.registry.resourceConfigurations[t]:void 0,o=a?.externalDataPipeline,s=e.enabled&&!!o&&!!e.fieldName&&Cge(o).has(e.fieldName),c=(0,Q.useMemo)(()=>s&&a?wge({resourceConfiguration:a,contextualParameters:n??{}}):void 0,[s,a,n]),l=(0,Q.useSyncExternalStore)(Dge,()=>kge(c,i));return(0,Q.useEffect)(()=>{if(!c||!i)return;pR(c,i);let e=Oge(c,i);if(e===void 0)return;let t=setTimeout(()=>pR(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 mR=tl.getLogger();function jge(e){switch(e){case`stacked`:return Cu.STACKED;case`inline`:return Cu.INLINE;case`compact`:return Cu.COMPACT;default:return}}function Mge(e){switch(e){case`em-dash`:case`placeholder`:case`hidden`:case`skeleton`:return e;default:return}}function Nge(e){switch(e){case`top`:case`start`:case`inline`:case`hidden`:return e;default:return}}function hR(e,t){return!e||!t||t.length===0?!1:t.some(t=>e===t||e.startsWith(`${t}.`)||e.startsWith(`${t}[`))}function gR(e){let t=tk(),{pathPrefix:n}=CD(),r=gc(),i=MA(),a=e.name,o=a?n?`${n}.${a}`:a:void 0,s=e.schema??(o?rA(t?.schema,o):void 0),c=e.schemaType??(s?Zl(s):void 0),l=e.value??(o?iA(t?.data,o):void 0),u=o===void 0?void 0:_r.labelDictionaryPath(o),d=o?_r.isArrayItemPath(o):!1,f=d?void 0:u,p=f?_r.unresolvedFieldLabel(f.split(`.`).pop()??f):void 0,m=e.label??(f?t?.fieldLabels?.[f]:void 0)??p,h=s?$re(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===kA.SUMMARY?L(s):Jr(s):void 0,b=e.displayComponent??y?.component,x=e.parentData??aA(t?.data,n||void 0),S=e.disableInlineEdit??!1,C=e.className,w=hR(o,t?.hiddenFieldNames),T=hR(o,t?.inlineEditDisabledFieldNames),{displayChromeMode:E,sectionChromeMode:D}=ik(),O=hA(),k=BA(),A=jge(r.autoRender?.autoFieldChrome),j=i===kA.SUMMARY&&k&&y?.chromeMode===void 0&&D===void 0&&WA(c),M=y?.chromeMode??D??(j?Cu.INLINE:void 0)??E??A,N=e.labelPlacement??(y?.chromeMode===void 0?Nge(r.autoRender?.autoLabelPlacement):void 0),P=e.labelStyle??y?.labelStyle,F=vA(c,y?.displayMode,s?Nt(s)?.mode:void 0),I=t?.breakpoint,R=I?cA(y?.forceHide,I):y?.forceHide,z=R?.label===!0,B=R?.description===!0,ee=e.hideLabel===!0||z,te=e.hideDescription===!0||B||j,{canInlineEdit:ne,doInlineUpdate:V,fileUploadContext:re,rmm:ie,defaultInlineEdit:ae,defaultEmptyValue:oe,parentReferenceConfig:se,resourceType:ce}=oj(),le=ym()?.registry,ue=oe??Mge(r.autoRender?.autoEmptyValue),de=Age({fieldName:!n&&!d?o:void 0,enabled:i!==kA.SUMMARY&&!e.resourceLinkTrail}),fe=o&&s&&tt(s),pe=!!o&&!!s&&ae===wr.WRITABLE_FIELDS&&Fu(s),me=!S&&!T&&ne&&(!!fe||pe);if(w||s&&Wi(s))return(0,$.jsx)($.Fragment,{});let he=RA(M,I??Yo.DESKTOP),ge=O&&he!==Cu.TILE,_e=!ee&&N!==`hidden`&&he!==Cu.HIDDEN&&he!==Cu.COMPACT,ve=!ee&&(N===`hidden`||i===kA.SUMMARY),ye=!_e&&!ve;if(t?.isLoading??!1)return(0,$.jsx)(LA,{active:ge,name:o,label:m,termAnnounced:ye,children:(0,$.jsx)(rj,{mode:M,label:m,labelStyle:P,name:o,labelPlacement:N,hideLabel:ee,hideDescription:!0,tooltip:_,wide:F,announceName:i===kA.SUMMARY,children:(0,$.jsx)(pm,{className:`h-5 w-full`})})});let be=s?Nl(s):void 0,xe=n&&x?x:t?.data;if(be&&xe&&!_r.evaluateShowWhen(be,xe))return(0,$.jsx)($.Fragment,{});if(se?.displayMode===iu.NONE&&o){let t=kj({schema:s,value:l,fieldName:o,parentData:x,resourceLinkTrail:e.resourceLinkTrail,currentResourceType:ce,registry:le});if(t&&ij({parentReferenceConfig:se,...t}).hidesWholeReference)return(0,$.jsx)($.Fragment,{})}let Se=(O||i===kA.SUMMARY)&&!me;if((y?.hideWhenEmpty??Se)&&FA(l))return(0,$.jsx)($.Fragment,{});if(!s||!c)return mR.error(`[DisplayField] Cannot resolve schema for field`,{name:o}),(0,$.jsx)($.Fragment,{});let Ce={schema:s,schemaType:c,value:l,fieldName:o,label:m,description:g,tooltip:_,provenance:de,enumLabels:v,displayComponent:b,parentData:x,resourceLinkTrail:e.resourceLinkTrail,renderItem:e.renderField,className:C,hideLabel:ee,hideDescription:te,resolvedChromeMode:M,resolvedLabelPlacement:N,resolvedLabelStyle:P,resolvedEmptyValue:ue,fileUploadContext:re,wideValue:F,announceName:i===kA.SUMMARY};return(0,$.jsx)(vR,{name:o,children:me&&c===jr.ARRAY?(0,$.jsx)(LA,{active:O,name:o,label:m,children:(0,$.jsx)(uge,{name:o,schema:s,value:l,label:m,description:g,doInlineUpdate:V,renderField:e.renderField,sectionAppearance:e.sectionAppearance,objectItemLayout:e.objectItemLayout,enumLabels:v,hideLabel:ee,displayChromeMode:I?cA(M,I):typeof M==`string`?M:void 0})}):me?(0,$.jsx)(LA,{active:ge,name:o,label:m,termAnnounced:ye,children:(0,$.jsx)(eR,{...Ce,doInlineUpdate:V,rmm:ie})}):c===jr.ARRAY&&e.sectionAppearance?(0,$.jsx)(LA,{active:O,name:o,label:m,children:(0,$.jsx)(vM,{...Ce,sectionAppearance:e.sectionAppearance})}):(0,$.jsx)(LA,{active:ge,name:o,label:m,termAnnounced:ye,children:(0,$.jsx)(_M,{...Ce})})})}gR.displayName=`DisplayField`;var _R=gR,vR=class extends Q.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){let n=this.props.name;mR.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}},yR=(0,Q.createContext)(null);function Pge({value:e,children:t}){return(0,$.jsx)(yR.Provider,{value:e,children:t})}function bR(){return(0,Q.useContext)(yR)}var xR;(function(e){e.DEFAULT=`default`,e.ENTRY=`entry`,e.SECTION=`section`,e.DOCUMENT=`document`})(xR||={});var Fge={[xR.DEFAULT]:void 0,[xR.ENTRY]:`h5`,[xR.SECTION]:`h4`,[xR.DOCUMENT]:`h3`};function SR({name:e,scale:t=xR.DEFAULT,className:n}){let r=bR(),{getRecipe:i}=Ng(),a=Fge[t],o=i(It.TYPOGRAPHY,Ea.HEADING),s=a?G(o.base,o.sizes?.[a]):void 0;if(r?.titleMountTracker&&(r.titleMountTracker.titleMounted=!0),e)return(0,$.jsx)(u_,{className:s,children:(0,$.jsx)(`div`,{"data-summary-title":``,className:G(`min-w-0 flex-1 text-foreground`,s?`leading-tight`:`font-medium leading-tight`,n),children:(0,$.jsx)(_R,{name:e,hideLabel:!0})})});let c=r?.primaryLabel;return c?(0,$.jsx)(Z,{as:`p`,"data-summary-title":``,className:G(`min-w-0 flex-1 font-medium text-foreground`,n),truncate:!0,children:c}):null}var CR;(function(e){e.AUTO=`auto`,e.TEMPLATE_OWNED=`template-owned`})(CR||={});var wR;(function(e){e.STACK=`stack`,e.ROW=`row`})(wR||={});var Ige={[wR.STACK]:`flex flex-col gap-element text-sm`,[wR.ROW]:`flex flex-wrap items-center gap-x-group gap-y-item text-sm`};function TR(e){let t=!1;return Q.Children.forEach(e,e=>{if(t||!(0,Q.isValidElement)(e))return;if(e.type===SR){t=!0;return}let n=e.props?.children;n!==void 0&&TR(n)&&(t=!0)}),t}function ER({flow:e=wR.STACK,className:t,titlePlacement:n=CR.AUTO,children:r}){let i=n===CR.AUTO&&!TR(r);return(0,$.jsx)(SD,{pathPrefix:``,children:(0,$.jsxs)(`div`,{className:G(Ige[e],t),children:[i&&(0,$.jsx)(SR,{}),r]})})}function DR({name:e,className:t,children:n}){let{pathPrefix:r}=CD(),i=r?`${r}.${e}`:e,a=(0,$.jsx)(SD,{pathPrefix:i,children:n});return t?(0,$.jsx)(`div`,{className:t,children:a}):a}yk(DR,gk.FIELD_SLOT_CONTAINER);function OR({field:e,variants:t,fallback:n}){let r=NC({name:wD(e)}),i=r==null?void 0:t[String(r)];return(0,$.jsx)($.Fragment,{children:i??n??null})}function kR({field:e,variants:t,fallback:n}){let r=wD(e),i=iA(tk()?.data,r),a=i==null?void 0:t[String(i)];return(0,$.jsx)($.Fragment,{children:a??n??null})}function AR(e,t,n){let r=Zl(t),i=Nl(t);return{name:e,schema:t,schemaType:r,showWhenParams:i,showWhenWatchFields:i?PR(i):void 0,isDiscriminator:n===e}}function jR(e,t){let n=_r.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];Zr(r)||Es(r)||i.push(AR(e,r,t))}return i}function MR(e){return rs(e)}function NR(e){let t=li(e);if(!rae(t))return null;let n=lu(t,`discriminator`),r=wre(t,`options`)??[];if(!n||r.length===0)return null;let i=e=>!!e&&!Zr(e)&&!Es(e),a=r.map(e=>new Set(ua(e))),o=[...a[0]??new Set].filter(e=>e!==n&&a.every(t=>t.has(e))),s=Jt(r[0]),c=s?o.filter(e=>i(s[e])).map(e=>AR(e,s[e])):[],l=[];for(let e of r){let t=Jt(e);if(!t)continue;let r=Pe(t[n])[0];r!=null&&l.push({value:String(r),schema:e,fields:Object.keys(t).filter(e=>e!==n&&!o.includes(e)&&i(t[e])).map(e=>AR(e,t[e]))})}return{discriminator:n,commonFields:c,variants:l}}function Lge(e){let t=NR(e);if(t)return{discriminatorField:t.discriminator,inheritedSchemas:t.variants.map(e=>({discriminatorFieldValue:e.value,schema:e.schema}))}}function Rge(e){let t=NR(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)(JL,{name:e.name},e.name))}));return(0,$.jsxs)(DR,{name:e.name,children:[(0,$.jsx)(JL,{name:t.discriminator}),t.commonFields.map(e=>(0,$.jsx)(JL,{name:e.name},e.name)),Object.keys(n).length>0&&(0,$.jsx)(OR,{field:t.discriminator,variants:n})]},e.name)}function PR(e){let t=Array.isArray(e.conditions)?e.conditions:[e.conditions];return[...new Set(t.map(e=>e.field))]}function FR(e,t){let n=t?.inheritanceConfig??Lge(e),r=jR(e,n?.discriminatorField);wT.FORM;let i=t?.includeSubmitButton!==!1,a=t?.includeErrorSummary!==!1;if(r.length===0){let e=()=>(0,$.jsx)(Zk,{autoInjectSubmitButton:i});return e.displayName=`GeneratedFormTemplate(empty)`,e}let o=Hge(r),s=o.length>0,c=new Set(r.map(e=>e.name)),l=()=>{let e=zge(s,o),t=jT(),l=new Set(Object.keys(t?.contextFieldValues??{}));for(let e of t?.hiddenFieldNames??[])l.add(e);return(0,$.jsxs)(Zk,{autoInjectSubmitButton:i,children:[a&&(0,$.jsx)(QD,{}),r.map(r=>{let i=!!t?.generatedFieldOverrides?.[r.name],a=l.has(r.name)&&!i?null:Bge(r,n,c,l,t?.generatedFieldOverrides,e,o);return!r.showWhenParams||!e||zR(r.showWhenParams,e,o)?a:null}),i&&(0,$.jsx)(eO,{})]})};return l.displayName=`GeneratedFormTemplate`,l}function zge(e,t){let n=NC({name:e?t:[]});return e?Array.isArray(n)?n:[n]:void 0}function Bge(e,t,n,r,i,a,o){return i?.[e.name]?(0,$.jsx)(JL,{name:e.name},e.name):e.isDiscriminator&&t&&n&&r?Vge(e,t,n,r,i):e.schemaType===jr.OBJECT?IR(e,a,o):(0,$.jsx)(JL,{name:e.name},e.name)}function Vge(e,t,n,r,i){let a={};if(t.inheritedSchemas)for(let e of t.inheritedSchemas){let t=Jt(e.schema),o=ua(e.schema);if(t&&o.length>0){let s=o.filter(e=>!Zr(t[e])&&!Es(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)(JL,{name:e},e))}))}}let o=Object.keys(a).length>0;return(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(JL,{name:e.name}),o&&(0,$.jsx)(OR,{field:t.discriminatorField,variants:a})]},e.name)}function IR(e,t,n,r=``){if(e.showWhenParams&&t&&n&&!zR(RR(e.showWhenParams,r),t,n))return null;let i=Rge(e);if(i)return i;let a=MR(e.schema),o=Object.keys(a).filter(e=>{let t=a[e];return!Zr(t)&&!Es(t)});if(o.length===0)return(0,$.jsx)(JL,{name:e.name},e.name);let s=r?`${r}.${e.name}`:e.name;return(0,$.jsx)(DR,{name:e.name,children:o.map(e=>{let r=a[e];return Zl(r)===jr.OBJECT?IR(AR(e,r),t,n,s):(0,$.jsx)(JL,{name:e},e)})},e.name)}function Hge(e){let t=new Set;for(let n of e)LR(n,t);return[...t]}function LR(e,t,n=``){if(e.showWhenParams){let r=RR(e.showWhenParams,n);for(let e of PR(r))t.add(e)}if(e.schemaType!==jr.OBJECT)return;let r=MR(e.schema),i=n?`${n}.${e.name}`:e.name;for(let[e,n]of Object.entries(r))Zr(n)||Es(n)||LR(AR(e,n),t,i)}function RR(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 zR(e,t,n){let r={};for(let e=0;e<n.length;e++)r[n[e]]=t[e];return _r.evaluateShowWhen(e,r)}function BR(e,t={}){let n=NR(e);if(n)return()=>(0,$.jsx)(uA,{children:t.factsAsTiles?Wge(n,t.resourceConfig):GR(n,t.resourceConfig)});let r=jR(e);if(wT.DISPLAY,r.length===0)return()=>(0,$.jsx)(uA,{});let i=VR(r,t.resourceConfig);if(t.factsAsTiles)return()=>(0,$.jsxs)(uA,{children:[i.state.length>0&&(0,$.jsx)(bA,{children:i.state.map(HR)}),i.content.map(WR),i.facts.length>0&&(0,$.jsx)(yA,{children:i.facts.map(WR)}),i.recordKeeping.length>0&&(0,$.jsx)(xA,{children:i.recordKeeping.map(WR)})]});let a=[...i.state,...i.content,...i.facts,...i.recordKeeping];return()=>(0,$.jsx)(uA,{children:a.map(WR)})}function VR(e,t){let n={state:[],content:[],facts:[],recordKeeping:[]};for(let r of e)switch(DA(r.name,r.schema,t)){case SA.STATE:(n.state.length===0?n.state:n.facts).push(r);break;case SA.CONTENT:n.content.push(r);break;case SA.FACT:n.facts.push(r);break;case SA.RECORD_KEEPING:n.recordKeeping.push(r);break;case SA.IDENTITY_PLUMBING:}return n}function HR(e){return(0,$.jsx)(_R,{name:e.name,labelPlacement:`hidden`},e.name)}function Uge({children:e}){let{displayChromeMode:t}=ik();return(0,$.jsx)(rk,{displayChromeMode:t,sectionChromeMode:Cu.INLINE,children:e})}function UR(e){return TA(e.schema)}function Wge(e,t){let n=VR(e.commonFields,t),r={},i={};for(let t of e.variants){let e=t.fields.filter(UR),n=t.fields.filter(e=>!UR(e));e.length>0&&(r[t.value]=(0,$.jsx)($.Fragment,{children:e.map(WR)})),n.length>0&&(i[t.value]=(0,$.jsx)($.Fragment,{children:n.map(WR)}))}return(0,$.jsxs)($.Fragment,{children:[n.state.length>0&&(0,$.jsx)(bA,{children:n.state.map(HR)}),n.content.map(WR),Object.keys(r).length>0&&(0,$.jsx)(kR,{field:e.discriminator,variants:r}),(0,$.jsxs)(yA,{children:[(0,$.jsx)(_R,{name:e.discriminator}),n.facts.map(WR),Object.keys(i).length>0&&(0,$.jsx)(kR,{field:e.discriminator,variants:i})]}),n.recordKeeping.length>0&&(0,$.jsx)(xA,{children:n.recordKeeping.map(WR)})]})}function WR(e){return e.schemaType===jr.OBJECT?Gge(e):(0,$.jsx)(_R,{name:e.name},e.name)}function GR(e,t){let n=VR(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(WR)}));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_R,{name:e.discriminator}),r.map(WR),Object.keys(i).length>0&&(0,$.jsx)(kR,{field:e.discriminator,variants:i})]})}function Gge(e){let t=NR(e.schema);if(t)return(0,$.jsx)(DR,{name:e.name,children:GR(t)},e.name);let n=MR(e.schema),r=Object.keys(n).filter(e=>{let t=n[e];return!Zr(t)&&!Es(t)});return r.length===0?(0,$.jsx)(_R,{name:e.name},e.name):(0,$.jsx)(DR,{name:e.name,children:r.map(e=>WR(AR(e,n[e])))},e.name)}function KR(e,t){let n=_r.getObjectLikeFieldShape(e,{commonOnly:!0}),r=n?Object.keys(n):[];if(!n||r.length===0)return()=>(0,$.jsx)(ER,{titlePlacement:CR.AUTO});let i=e=>!U.isIdentityOnlySummaryField(e,t),a=r.filter(e=>{let t=n[e];return i(e)&&!Es(t)&&cre(t)}),o=a.length>0?a:r.filter(e=>i(e)&&!Es(n[e])),s=t?.frontendConfiguration?.layout?.defaultChromeMode?.summary!==void 0,c=o.map(e=>Zl(n[e]));return()=>{let e=tk(),t=e?.data,n=t!==void 0&&e?.isLoading!==!0,r=o.map(e=>!n||GA(t?.[e])),i=s?[]:KA(o.map((e,t)=>({schemaType:c[t],present:r[t]})));return(0,$.jsx)(ER,{titlePlacement:CR.AUTO,children:o.map((e,t)=>r[t]?i[t]?(0,$.jsx)(Uge,{children:(0,$.jsx)(_R,{name:e})},e):(0,$.jsx)(_R,{name:e},e):null)})}}function Kge(e,t){return t!==J.UPDATE||!e?!1:Object.values(e).some(e=>{let t=Ec(e)?.autosave;return t===void 0?!1:t===!0||typeof t==`object`&&t.enabled!==!1})}function qR(e,t){return e?.cause instanceof Error?e.cause:Error(e?.message??t)}var JR=(0,Q.createContext)(null);function YR(e){let{tErrorValidation:t,tErrorMessage:n,t:r}=q(),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=ND.isFormLevelErrorPath(a)?eT:a,c=(ml(o)&&o.code===Aie.DECLARED_REFUSAL?Op({tErrorMessage:n,t:r},o.params?.refusalCode):void 0)??(ml(o)?t(o.code,`msg`,o.params):o);e.current.setError(s,{type:Qw,message:c}),i.current.add(s)}),WD(Object.keys(a).map(e=>ND.isFormLevelErrorPath(e)?eT:e)))},[e,t,n,r]),clearServerErrors:s}}function XR(e){let{resourceType:t,contextResourceIdentifiers:n,rowValues:r,registry:i}=e;if(!n||!r||typeof r!=`object`||Array.isArray(r))return;let a;for(let[e,o]of Object.entries(r)){if(typeof o!=`string`||o.length===0)continue;let r=i.fieldIdentifierToResourceType?.[e];if(!r||r===t)continue;let s=n[r];if(s==null)continue;let c=kn.getResourceId(s);c&&c!==o&&(a??={...n},a[r]=o)}return a}function ZR(e,t){if(e)return Object.fromEntries(Object.entries(e).map(([e,n])=>[t?.[e]??e,n]))}function QR(e){return e?.requestFieldRowFields}function $R(e,t){let{emit:n}=Uo(),r=(0,Q.useContext)(um),{registry:i}=fm(),a=r?.isConnected??!1,o=(0,Q.useMemo)(()=>{let t=i.resourceConfigurations[e.resourceType],{[e.resourceType]:n,...r}=ku(e.contextResourceIdentifiers),a=U.buildContextualParameters(r,i);return io(t?.operations??[],J.LIST).filter(e=>Uv({operation:e,contextResourceIdentifiers:r,contextualParameters:a}))},[e.contextResourceIdentifiers,e.resourceType,i]);return(0,Q.useCallback)((r,i)=>{if(Ht(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:Me({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:e.resourceType,result:r,isBulkOperation:t.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements,optionalDiscriminator:Pc(e.additionalContext),resultSummary:Wu(r),...i?.partialWrite?{isPartialWrite:!0}:{}});let s=t.admitsCrossTenantPlatformAdministration===!0;if(!t.isBulkOperation&&!s||zi(t,a))return;let{[e.resourceType]:c,...l}=ku(e.contextResourceIdentifiers),u=o.length>0?o:[null];for(let t of u)n(hc.RESOURCE_REFRESH,{resourceType:e.resourceType,operationIdentifier:String(t?.operationIdentifier??J.LIST),operation:t??{operationIdentifier:J.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 qge(e){let{apiBaseUrl:t,initiatorInfo:n,contextualParameters:r}=e,i=Hm.resolveUrlPath(n.url,r);if(i&&!Hm.hasUnresolvedPlaceholders(i))return`${t}${i}/validate-field`}var ez=tl.getLogger(),tz=ez.debugByType(`HttpTransportAdapter`);ez.setDebugTypeLogging(`HttpTransportAdapter`,!1);function Jge(e){let t=e?.context;if(!t||typeof t!=`object`)return;let n=t,r=Dne.safeParse(n.versionConflict);return r.success?r.data:void 0}function Yge(e){let t=e.httpStatus;return t!=null&&typeof t==`number`&&!Number.isNaN(t)}function Xge(e){return e>=500?lE.SERVER:e>=400&&!mc.has(e)?lE.REFUSED:lE.TRANSIENT}function nz(e,t,n){let r=e?.validationErrors;return typeof r==`object`&&r&&Object.keys(r).length>0?{type:lE.VALIDATION,status:t,validationErrors:r,message:n}:{type:lE.REFUSED,status:t,message:n}}var Zge=class{_doOperation;constructor(e){this._doOperation=e}async execute(e){tz(`execute`,{operationPathKey:e.operationPathKey,fields:e.requestData?Object.keys(e.requestData):[],expectedVersion:e.expectedVersion});try{let t={};e.expectedVersion!=null&&(t[Io.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=Ht(r);if(i)return tz(`execute: held for approval`,{decisionRef:i.decisionRef}),{status:uE.SUCCESS,heldForApproval:i};let a=r,o={status:uE.SUCCESS,data:a??void 0,newVersion:a?._version,fieldMeta:a?._field_meta};return tz(`execute: success`,{newVersion:o.newVersion}),o}catch(t){let n=this._mapError(t,e.expectedVersion!=null);return tz(`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!==lE.SERVER&&n.error.type!==lE.TRANSIENT||Ia(e)||cl(e)||(n.error.resendable=si(e,Wte.REDISPATCH))),n}_classifyError(e,t){if(dee(e))return{status:uE.ERROR,error:{type:lE.ABORT}};if(Ia(e)||cl(e))return{status:uE.ERROR,error:{type:lE.TRANSIENT,message:e.message}};let n=Yge(e)?e.httpStatus:void 0;if(n!=null)switch(n){case 400:case 422:return{status:uE.ERROR,error:{type:lE.VALIDATION,status:n,validationErrors:e.validationErrors,message:e.message??String(e)}};case 404:case 410:return{status:uE.ERROR,error:{type:lE.NOT_FOUND,status:n}};case 409:if(e?.customMessageReference===Lu.VERSION_CONFLICT){let r=Jge(e);return!r&&!t?{status:uE.ERROR,error:nz(e,n,e?.message??String(e))}:r?{status:uE.ERROR,error:{type:lE.CONFLICT,status:n,conflictDetails:r}}:{status:uE.ERROR,error:{type:lE.SERVER,status:n,message:`Version conflict response missing authoritative conflict details.`}}}return{status:uE.ERROR,error:nz(e,n,e?.message??String(e))};default:return{status:uE.ERROR,error:{type:Xge(n),status:n,message:String(e)}}}return{status:uE.ERROR,error:{type:lE.TRANSIENT,message:Qu(e)}}}},Qge=15e3,$ge=3e4,e_e=[1e3,3e3],t_e=2e3,n_e=3e5;function rz(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}:{},...iz(e)}}function iz(e){let t=tp(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 az=tl.getLogger(),oz=az.debugByType(`ResourceMutationManager`);az.setDebugTypeLogging(`ResourceMutationManager`,!1);var r_e=64;function i_e(e,t){let n=yM(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 sz(e,t){let n=Object.keys(e).filter(e=>yM(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=yM(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}lz(r,i,e[i])}return r}var cz=new Set([sE.SECTION,sE.AUTOSAVE,sE.INLINE]);function lz(e,t,n){let r=yM(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 uz;(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`})(uz||={});var dz={type:cE.FORM,subscriberId:`autosave`},fz={maxQueueDepth:5,softTimeoutMs:Qge,hardTimeoutMs:$ge},a_e=class{resourceType;_resourceId;_confirmedData=null;_version=null;_pendingFields=new Map;_queue=[];_activeMutation=null;_state=aE.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=[...e_e];_serverRetryDelay=t_e;_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??fz.maxQueueDepth,softTimeoutMs:t?.softTimeoutMs??fz.softTimeoutMs,hardTimeoutMs:t?.hardTimeoutMs??fz.hardTimeoutMs},this._crdtFieldNames=Tc({mainSchema:e.resourceSchema,inheritenceSchemaDefinition:e.resourceInheritance}),this._discriminatorFieldNames=DE(e.resourceSchema),this.subscribe=this.subscribe.bind(this),this.getSnapshot=this.getSnapshot.bind(this),oz(`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=hre(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===aE.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=Tc({mainSchema:this._config.resourceSchema,inheritenceSchemaDefinition:this._config.resourceInheritance}),this._discriminatorFieldNames=DE(this._config.resourceSchema)),oz(`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===aE.DELETED)return;this._confirmedData={...e},this._version=t,this._clearAuthoritativeRecoveryTimer(),this._allowSettledSelfEventRepair=!1;let r=n??e._field_meta;this._fieldMeta=r==null?null:kr(r),this._invalidateSnapshot(),oz(`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===aE.DELETED)return oz(`queueMutation: rejected — resource deleted`,{resourceId:this._resourceId}),Promise.reject(new gE);let n=t?.priority??mE.LOW,r=t?.type??sE.AUTOSAVE,i=t?.source??dz;return this._queue.length>=this._backpressure.maxQueueDepth&&n<=mE.LOW?(oz(`queueMutation: rejected — backpressure`,{queueDepth:this._queue.length,maxDepth:this._backpressure.maxQueueDepth}),Promise.reject(new _E)):(oz(`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>=mE.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:uz.QUEUE_MUTATION}),this._processQueue()}))}autosave(e){this.queueMutation(e,{type:sE.AUTOSAVE,priority:mE.LOW,source:dz}).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:sE.AUTOSAVE,priority:e?.priority??mE.NORMAL,source:e?.source??dz,signal:e?.signal})}cancelPendingMutations(e){if(this._state!==aE.DELETED){oz(`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 hE(e)),null);for(let t of this._queue)t.reject(new hE(e));this._queue=[],this._deferredSelfEvents=[],this._pendingFieldTimestamps.clear(),this._transition({type:uz.CANCEL})}}acknowledgeConflict(){this._state===aE.CONFLICT&&(oz(`acknowledgeConflict`,{resourceId:this._resourceId}),this._transition({type:uz.CONFLICT_ACKNOWLEDGED}),this._processQueue())}_isOwnEcho(e){return this._producedVersions.has(e)}_recordProducedVersion(e){if(e!=null&&(this._producedVersions.add(e),this._producedVersions.size>r_e)){let e=this._producedVersions.values().next().value;e!==void 0&&this._producedVersions.delete(e)}}applyRemoteUpdate(e,t,n,r){if(this._state!==aE.DELETED){if(this._isOwnEcho(t)){if(this._activeMutation!==null){oz(`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,oz(`applyRemoteUpdate: accepting settled own-echo after canonical read-back miss`,{version:t}),this._applyRemoteUpdateInternal(e,t,n,r,!0);return}oz(`applyRemoteUpdate: own-echo discarded (no in-flight mutation)`,{version:t})}else this._activeMutation!==null&&n!==void 0&&n===this._config.currentUserId?(oz(`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){oz(`handleDeletion`,{reason:e,deletedBy:t,resourceId:this._resourceId}),this._transition({type:uz.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===aE.SAVING,isDeleted:this._state===aE.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(){oz(`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){oz(`destroy: flushPendingFields failed`,{resourceId:this._resourceId,attempt:e,error:Qu(t)});break}this._pendingFields.size>0&&oz(`destroy: completing with pending fields remaining (flush exhausted or failed)`,{resourceId:this._resourceId,pendingFieldCount:this._pendingFields.size}),(this._activeMutation||this._queue.length>0)&&(oz(`destroy: waiting for drain`,{queueDepth:this._queue.length}),await new Promise(e=>{this._onDrainCallbacks.push(e)})),this._clearTimers(),this._clearAuthoritativeRecoveryTimer(),this._snapshotListeners.clear(),oz(`destroy: complete`,{resourceId:this._resourceId})}_transition(e){let t=this._state;switch(e.type){case uz.QUEUE_MUTATION:if(this._state===aE.IDLE)this._state=aE.QUEUED;else if(this._state===aE.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 hE(e.entry.source))}this._state=aE.QUEUED}this._invalidateSnapshot();return;case uz.START_SAVING:this._state===aE.QUEUED&&(this._state=aE.SAVING,this._lastError=null,this._startBackpressureTimers());break;case uz.SAVE_SUCCESS:{this._state=this._queue.length>0||this._pendingFields.size>0?aE.QUEUED:aE.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:oE.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 uz.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:lE.SERVER,message:`Unknown error`};if(this._lastError=n,t===lE.CONFLICT){this._clearTimers(),this._state=aE.CONFLICT;let t=[...new Set([...e.savedFields,...this._pendingFields.keys()])];for(let e of this._queue)e.reject(new hE);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:oE.CONFLICT_RESET,discardedFields:t,reason:fE.VERSION_CONFLICT,currentData:a,currentVersion:o,conflictDetails:r,id:++this._eventCounter};break}if(t===lE.ABORT){this._clearTimers();let e=this._queue.length>0||this._pendingFields.size>0?aE.QUEUED:aE.IDLE;this._state=e,e===aE.IDLE&&(this._lastError=null);break}if(t===lE.VALIDATION||t===lE.NOT_FOUND||t===lE.REFUSED){if(this._clearTimers(),t===lE.VALIDATION&&this._activeMutation)for(let t of e.savedFields)this._pendingFields.has(t)||this._pendingFields.set(t,this._activeMutation.savingFields[t]);this._lastEvent={type:oE.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?aE.QUEUED:aE.IDLE;break}let r=this._activeMutation?.retryCount??0,i=n.resendable===!1?0:t===lE.TRANSIENT?this._retryDelays.length:+(t===lE.SERVER);if(r<i){let a=t===lE.TRANSIENT?this._retryDelays[r]:this._serverRetryDelay;this._state=aE.ERROR,this._lastEvent={type:oE.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===aE.ERROR&&this._activeMutation&&(this._activeMutation.retryCount++,oz(`retry: attempt`,{mutationId:this._activeMutation.entry.id,retryCount:this._activeMutation.retryCount,maxRetries:i,delayMs:a}),this._transition({type:uz.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 hE);this._queue=[],this._pendingFields.clear(),this._pendingFieldTimestamps.clear(),this._deferredSelfEvents=[],this._lastEvent={type:oE.MUTATION_RESULT,result:{success:!1,savedFields:e.savedFields,error:n,retriesRemaining:0},source:e.source,id:++this._eventCounter},this._state=aE.IDLE,this._emitTerminalMutationFailureNotification(n,a);break}case uz.RETRY:this._state===aE.ERROR&&(this._state=aE.SAVING);break;case uz.CONFLICT_DETECTED:this._clearTimers(),this._state=aE.CONFLICT,this._activeMutation&&=(this._activeMutation.abortController.abort(),this._activeMutation.entry.reject(new hE),null);for(let e of this._queue)e.reject(new hE);this._queue=[],this._pendingFields.clear(),this._pendingFieldTimestamps.clear(),this._deferredSelfEvents=[],this._confirmedData={...e.currentData},this._version=e.currentVersion,this._lastEvent={type:oE.CONFLICT_RESET,discardedFields:e.discardedFields,reason:e.reason,currentData:e.currentData,currentVersion:e.currentVersion,conflictDetails:e.conflictDetails,id:++this._eventCounter};break;case uz.CONFLICT_ACKNOWLEDGED:this._state===aE.CONFLICT&&(this._state=this._queue.length>0?aE.QUEUED:aE.IDLE,this._lastError=null);break;case uz.CANCEL:this._state=aE.IDLE,this._lastError=null;break;case uz.DELETE:this._clearTimers(),this._activeMutation&&=(this._activeMutation.abortController.abort(),this._activeMutation.entry.reject(new gE),null);for(let e of this._queue)e.reject(new gE);this._queue=[],this._pendingFields.clear(),this._pendingFieldTimestamps.clear(),this._deferredSelfEvents=[],this._state=aE.DELETED,this._lastEvent={type:oE.RESOURCE_DELETED,reason:e.reason,deletedBy:e.deletedBy,id:++this._eventCounter};break;case uz.REMOTE_UPDATE:this._lastEvent={type:oE.REMOTE_UPDATE,changedFields:e.changedFields,mergedFields:e.mergedFields,version:e.version,initiatorUserId:e.initiatorUserId,crdtResolutions:e.crdtResolutions,id:++this._eventCounter}}this._state!==t&&oz(`_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=no.parseOperationPathKey(n)}catch{}try{Di.emit(hc.NOTIFY_RESOURCE_ERROR,{resourceType:this.resourceType,parentResourcesRequirements:[],operationIdentifier:String(r.operationIdentifier??J.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===lE.TRANSIENT?Lu.NETWORK:rz(e.cause).errorCustomMessageReference,errorHttpStatus:e.status,errorRefusalCode:rz(e.cause).errorRefusalCode,...iz(e.cause),mutationErrorType:e.type,discardedFields:t}})}catch(e){oz(`_emitTerminalMutationFailureNotification: emit failed`,{resourceId:this._resourceId,error:Qu(e)})}}_processQueue(){if(this._activeMutation!==null||this._queue.length===0||this._state===aE.CONFLICT||this._state===aE.DELETED||this._state===aE.ERROR)return;let e=this._queue.shift(),t;if(e.type===sE.SUBMIT||e.type===sE.DRAFT||e.type===sE.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]}oz(`_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 hE(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:uz.START_SAVING}),this._executeTransport(this._activeMutation)}_executeTransport(e){let t=e;oz(`_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??(cz.has(e.entry.type)?OE(sz(e.savingFields,this._confirmedData),this._discriminatorFieldNames,this._confirmedData):sz(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){oz(`_executeTransport: stale callback — ignored`,{mutationId:t.entry.id});return}let n=Object.keys(t.savingFields),i=t.entry.source,a=e.status===uE.SUCCESS&&!e.heldForApproval&&r?.readBackOnSuccess?await this._readBackConfirmedState(e):e;if(a.status===uE.SUCCESS){oz(`_executeTransport: success`,{mutationId:t.entry.id,savedFields:n,newVersion:a.newVersion});let e=a.fieldMeta??a.data?._field_meta;e!=null&&(this._fieldMeta=kr(e));for(let e of n)this._pendingFieldTimestamps.delete(e);let r=Object.entries(t.savingFields).filter(([,e])=>e===null).map(([e])=>e),o=cz.has(t.entry.type)?t.savingFields:void 0;this._transition({type:uz.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 oz(`_executeTransport: error`,{mutationId:t.entry.id,errorType:a.error?.type,errorStatus:a.error?.status,errorMessage:a.error?.message,savedFields:n}),this._transition({type:uz.SAVE_ERROR,result:a,savedFields:n,source:i}),this._state===aE.ERROR||(this._state===aE.CONFLICT?(this._activeMutation=null,this._processDeferredSelfEvents(a.newVersion),this._invalidateSnapshot(),t.entry.resolve({success:!1,savedFields:n,error:{type:lE.CONFLICT,conflictDetails:a.error?.conflictDetails}}),this._notifyDrained()):a.error?.type===lE.ABORT?(this._activeMutation=null,this._processDeferredSelfEvents(a.newVersion),this._invalidateSnapshot(),t.entry.reject(new hE(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){oz(`_executeTransport: stale rejection — ignored`,{mutationId:t.entry.id});return}let n=Object.keys(t.savingFields),r=t.entry.source;oz(`_executeTransport: transport rejected`,{mutationId:t.entry.id,error:Qu(e),savedFields:n}),this._transition({type:uz.SAVE_ERROR,result:{status:uE.ERROR,error:{type:lE.TRANSIENT,message:Qu(e),cause:e}},savedFields:n,source:r}),this._state===aE.ERROR||(this._activeMutation=null,this._processDeferredSelfEvents(void 0),this._invalidateSnapshot(),t.entry.resolve({success:!1,savedFields:n,error:{type:lE.TRANSIENT,message:Qu(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:Co.RAW,signal:void 0});return n.status===uE.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(),oz(`_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&&i_e(t,r)!==void 0||lz(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))lz(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))lz(e,t,n);for(let[t,n]of this._pendingFields)lz(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===aE.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))lz(o,e,t);for(let[e,t]of this._pendingFields)lz(o,e,t);if(this._version!==null&&(i?t<this._version:t<=this._version)){oz(`_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=>xM(e,t)));oz(`_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)||(lz(g,t,e[t]),m.push(t));for(let t of f){let n=u.find(e=>xM(t,e)),i=r?.[t]?.ts??0,a=n?this._pendingFieldTimestamps.get(n)??0:0,o=I(i,a);h[t]=o,o===qr.INCOMING?(n&&(this._pendingFields.delete(n),this._pendingFieldTimestamps.delete(n)),lz(g,t,e[t]),m.push(t),oz(`CRDT LWW: remote wins`,{field:t,remoteTs:i,localTs:a})):oz(`CRDT LWW: local wins (keep pending)`,{field:t,remoteTs:i,localTs:a})}this._confirmedData=g,r!=null&&(this._fieldMeta={...kr(this._fieldMeta),...kr(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:uz.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=>xM(e,t)),n=t?this._pendingFieldTimestamps.get(t)??0:0,i=r?.[e]?.ts??0;if(t&&I(i,n)===qr.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))lz(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,SM(b,e)])),submittedValues:Object.fromEntries(d.map(e=>[e,SM(o,e)]))};this._transition({type:uz.CONFLICT_DETECTED,discardedFields:x,reason:fE.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,oz(`_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}oz(`_processDeferredSelfEvents: discarded (version matches response)`,{version:n.version})}else oz(`_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===aE.DELETED||(this._authoritativeRecoveryTimer=setTimeout(()=>{this._authoritativeRecoveryTimer=null,this._retryAuthoritativeRecovery()},this._serverRetryDelay))}_clearAuthoritativeRecoveryTimer(){this._authoritativeRecoveryTimer&&=(clearTimeout(this._authoritativeRecoveryTimer),null)}async _retryAuthoritativeRecovery(){if(this._state===aE.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:Co.RAW,signal:void 0});if(t.status!==uE.SUCCESS||!t.data){oz(`_retryAuthoritativeRecovery: canonical reread still unavailable`,{errorType:t.error?.type,errorStatus:t.error?.status});return}let n=t.newVersion??this._version;n==null?oz(`_retryAuthoritativeRecovery: canonical reread missing version`,{resourceId:this._resourceId}):(oz(`_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&&(oz(`backpressure: soft timeout`,{mutationId:this._activeMutation.entry.id,timeoutMs:this._backpressure.softTimeoutMs}),this._lastEvent={type:oE.MUTATION_RESULT,result:{success:!1,error:{type:lE.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(),oz(`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 hE(this._activeMutation.entry.source)),null),this._deferredSelfEvents=[];let t=this._queue.length>0||this._pendingFields.size>0?aE.QUEUED:aE.IDLE;this._state=t,this._lastError=t===aE.IDLE?null:{type:lE.TRANSIENT,message:`Hard timeout exceeded`},this._lastEvent={type:oE.MUTATION_RESULT,result:{success:!1,error:{type:lE.TRANSIENT,message:`Hard timeout exceeded`},retriesRemaining:0},source:e??dz,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)}oz(`_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=[]}}},pz=tl.getLogger(),mz=pz.debugByType(`RMMRegistry`);pz.setDebugTypeLogging(`RMMRegistry`,!1);var o_e=class{_instances=new Map;_activeInstanceListeners=new Set;_activeInstancesEmitScheduled=!1;MAX_INSTANCES;_clockOffset=0;constructor(e){this.MAX_INSTANCES=e?.maxInstances??200,mz(`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,mz(`getOrCreate: cancelled pending destroy`,{key:r}));let e=i.rmm.readOperationPathKey;return n.readOperationPathKey!==void 0&&e!==void 0&&n.readOperationPathKey!==e&&pz.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(),mz(`getOrCreate: reused`,{key:r,refCount:i.refCount}),this._emitActiveInstancesChanged(),i.rmm}i?.destroying&&(mz(`getOrCreate: old instance mid-destroy, replacing`,{key:r}),this._instances.delete(r)),this._evictIfNeeded();let a=new a_e(n);return this._clockOffset!==0&&(a.clockOffset=this._clockOffset),this._instances.set(r,{rmm:a,refCount:1,destroyTimer:null,lastAccessedAt:Date.now(),destroying:!1}),mz(`getOrCreate: created`,{key:r,instanceCount:this._instances.size}),this._instances.size>=this.MAX_INSTANCES*.8&&pz.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--,mz(`release`,{key:e,refCount:t.refCount}),t.refCount<=0&&(t.refCount=0,t.destroyTimer||=setTimeout(()=>{t.destroyTimer=null,t.destroying=!0,mz(`release: destroy timer fired`,{key:e}),t.rmm.destroy().then(()=>this.remove(e)).catch(()=>{mz(`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),mz(`remove`,{key:e,remainingInstances:this._instances.size}),this._emitActiveInstancesChanged())}destroy(){mz(`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(()=>{mz(`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),mz(`_evictIfNeeded: evicting LRU`,{key:e,lastAccessedAt:t}),n.rmm.destroy().catch(()=>{mz(`_evictIfNeeded: eviction cleanup failed`,{key:e})}),this._instances.delete(e)}else pz.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)})))}},hz=tl.getLogger(),s_e=hz.debugByType(`RMMClockSync`);hz.setDebugTypeLogging(`RMMClockSync`,!1);function c_e(e){return e.length===0?0:e.reduce((e,t)=>t.rtt<e.rtt?t:e).offset}async function l_e(e){let t=[];for(let n=0;n<5;n++)try{let n=Date.now(),r=await fetch(`${e}${ure[hee.HEALTH_TIME]}`),i=Date.now(),a=r.headers.get(Io.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 gz(e,t){let n=await l_e(e);if(n.length>0){let e=c_e(n),r=n.reduce((e,t)=>Math.min(e,t.rtt),1/0);t.setClockOffset(e),s_e(`calibrated`,{offset:e,sampleCount:n.length,minRtt:r})}return Date.now()}var _z=(0,Q.createContext)(void 0);function u_e({children:e,options:t,apiBaseUrl:n}){let r=(0,Q.useMemo)(()=>new o_e(t),[]),i=(0,Q.useRef)(0);return(0,Q.useEffect)(()=>{if(!n)return;gz(n,r).then(e=>{i.current=e});let e=setInterval(()=>{gz(n,r).then(e=>{i.current=e})},n_e);return()=>{clearInterval(e)}},[r,n]),(0,Q.useEffect)(()=>{if(!n)return;function e(){document.visibilityState===`visible`&&Date.now()-i.current>=3e5&&gz(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)(_z.Provider,{value:r,children:e})}var vz=Co.RAW;function yz(e,t,n){let r=t.resourceConfigurations[e],i=r?.operations??[],a=(e,n)=>fh({resourceConfig:r,operations:e,coreOperation:J.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):Gl(i,J.READ);if(s||!n||n.hasResourceId===!0)return s;let c=io(i,J.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 bz(e,t,n){let r=t.resourceConfigurations[e]?.operations??[],i=io(r,J.READ),a=yz(e,t,n);if(a)return no.createOperationPathKeyFromOperation(a);if(i.length===0||n)return;let o=i.filter(e=>e.isOperationDefault===!0&&e.isBulkOperation!==!0);if(o.length===1)return no.createOperationPathKeyFromOperation(o[0])}function xz(e){return e.loadedOperationPathKey===e.canonicalReadOperationPathKey&&e.dataMode===vz}async function Sz(e){return e.doOperation(e.readOperationPathKey,{contextualParameters:e.contextualParameters,parentResourcesRequirements:e.parentResourcesRequirements,dataMode:vz})}var Cz=tl.getLogger(),wz=Cz.debugByType(`useListInvalidation`);Cz.setDebugTypeLogging(`useListInvalidation`,!1);function Tz(e,t){let n=(0,Q.useSyncExternalStore)(e?.subscribe??CM,e?.getSnapshot??wM),{emit:r}=Uo(),i=(0,Q.useContext)(um)?.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===oE.MUTATION_RESULT&&n.lastEvent.result.success&&!a.current){let t=n.lastEvent.result,i=qv({resourceType:e.resourceType,registry:o.current.registry,callContext:o.current.contextResourceIdentifiers,previousRow:t.previousConfirmedData,row:t.responseData}),s=Gv({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??J.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:J.LIST}};r(hc.RESOURCE_REFRESH,n)}wz(`list invalidation triggered`,{resourceType:e.resourceType,isConnected:a.current})}},[n.lastEvent?.id])}var Ez=tl.getLogger(),Dz=Ez.debugByType(`useResourceRMM`);Ez.setDebugTypeLogging(`useResourceRMM`,!1);var Oz={strategy:dE.ACCEPT_REMOTE},kz;(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`})(kz||={});function Az(e){let{resourceType:t,resourceId:n,doOperationRef:r,contextualParameters:i,parentResourcesRequirements:a,contextResourceIdentifiers:o,resourceSchema:s,resourceInheritance:c,enabled:l=!0,conflictPolicy:u=Oz,directFallbackAccepted:d=!1,actingOperation:f}=e,p=(0,Q.useContext)(_z),{registry:m}=fm(),h=(0,Q.useContext)(ih),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)(()=>U.buildContextResourceIdentifiersKey(o),[o]),x=(0,Q.useMemo)(()=>JSON.stringify(a??null),[a]),S=n?String(n):``,C=(0,Q.useMemo)(()=>new Zge((...e)=>r.current(...e)),[]),w=iS(th(t,S||void 0,o)),T=(0,Q.useMemo)(()=>ph({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?no.createOperationPathKeyFromOperation(T):null,[t,T]),D=(0,Q.useMemo)(()=>bz(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:kz.PROVIDER_MISSING:kz.NO_ELIGIBLE_UPDATE_OPERATION:kz.MISSING_RESOURCE_ID:kz.DISABLED,[l,S,p,T]),k=(0,Q.useMemo)(()=>O===kz.DISABLED?(Dz(`RMM unavailable because attachment is disabled for this surface.`,{resourceType:t,resourceId:S}),null):O===kz.MISSING_RESOURCE_ID?(Dz(`RMM unavailable because no resource id is attached to the current surface.`,{resourceType:t}),null):O===kz.NO_ELIGIBLE_UPDATE_OPERATION&&d?(Dz(`RMM unavailable because no eligible UPDATE-like operation resolves; the caller runs directly, as the operation declared.`,{resourceType:t,resourceId:S}),null):O===kz.NO_ELIGIBLE_UPDATE_OPERATION?(Ez.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===kz.PROVIDER_MISSING?(Ez.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:ku(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:ku(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??CM,k?.getSnapshot??wM);return Tz(k,{contextResourceIdentifiers:ku(o),parentResourcesRequirements:a??[],registry:m}),{rmm:k,rmmSnapshot:A,rmmRegistry:p??null,rmmUnavailableReason:O,canonicalReadOperationPathKey:D}}function jz(e,t){return e.replace(`{fields}`,t.join(`, `))}function Mz(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 Nz(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 Pz=e=>{let{renderIcon:t}=ef();if(e.type===`conflict`){let n=e.conflictDetails?.conflictingFields?.length?e.conflictDetails.conflictingFields:e.discardedFields;return(0,$.jsxs)(OD,{variant:`warning`,children:[t(W.WARNING,{size:tr.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)(kD,{children:e.labels.title}),(0,$.jsx)(AD,{children:jz(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:Nz(Mz(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:Nz(Mz(e.conflictDetails?.submittedValues,t),e.labels.emptyValue)})]})]},t))})]}),(0,$.jsx)(Y,{variant:X.OUTLINE,size:df.SM,onClick:e.onDismiss,className:`shrink-0`,children:e.labels.acknowledgeButton})]})]})}return(0,$.jsxs)(OD,{variant:`info`,className:`mb-item-xs`,children:[t(W.INFO,{size:tr.SM}),(0,$.jsxs)(`div`,{className:`flex flex-1 items-center justify-between`,children:[(0,$.jsx)(AD,{children:jz(e.labels.message,e.changedFields)}),(0,$.jsx)(Y,{variant:X.GHOST,size:df.SM,onClick:e.onDismiss,"aria-label":e.labels.dismissAriaLabel,className:`shrink-0`,children:t(W.CLOSE,{size:tr.SM})})]})]})},Fz=`relationship.quick_create.completed`;function Iz(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`quick-create-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Lz(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 Rz(e){let{registry:t}=fm(),{on:n}=Uo(),{navigate:r}=yS(),[i,a]=(0,Q.useState)(!1),o=(0,Q.useRef)(null),s=(0,Q.useMemo)(()=>{if(e.sourceResourceType&&e.sourceFieldName)return xj({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===Fz&&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=Iz();o.current=n,a(!0);let i={requestId:n,sourceResourceType:e.sourceResourceType,sourceResourceId:e.sourceResourceId,sourceFieldName:e.sourceFieldName,relatedResourceType:s.relatedResourceType},l=kn.createFrontendResourceOperationContextFromOperation({resourceType:s.relatedResourceType,operation:c,contextResourceIdentifiers:kn.withoutSelfReferencingParents(e.contextResourceIdentifiers??{},s.relatedResourceType,t),additionalContext:{quickCreateRequest:i},isOperationDefault:c.isOperationDefault??!0,isBulkOperation:c.isBulkOperation??!1,variantKey:c.variantKey});r({content:{contentType:Sa.RESOURCE_OPERATION,resourceContext:l},initiator:Hm.createOperationInitiator(e.navigationZone,e.sourceOperation),relationshipTransition:e.navigationZone===`overlay`?Mo.SPLIT:{transition:Mo.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 zz(e){e.emit(hc.RESOURCE_CUSTOM_EVENT,{resourceType:e.resourceType,resourceId:e.resourceId,eventName:Fz,data:{requestId:e.requestId,resourceType:e.resourceType,resourceId:e.resourceId,data:e.data}})}function Bz(e){return(0,$.jsx)(UM,{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 Vz=tl.getLogger();function Hz(e){ui.isDevelopment()&&Vz.warn(`[${e.componentName}] ${e.message}`,e.context)}function Uz(e){let t=e.formSchemaContext.contextResourceIdentifiers??{};return{contextResourceIdentifiers:t,parentResourcesRequirements:e.formSchemaContext.parentResourcesRequirements??(Object.keys(t).length>0?U.getInstance().buildParentResourcesRequirements(e.formSchemaContext.resourceType,t,e.registry):[]),contextualParameters:U.buildContextualParameters(t,e.registry)}}function Wz(e,t){if(!e)return;let n=t.split(`.`),r=e;for(let e of n){let t=Jt(li(r));if(!t||(r=t[e],!r))return}return r}var Gz=tl.getLogger();function Kz(e){let t=LC(),n=jD(),r=jT(),{registry:i,doOperation:a}=fm();uk(e.fieldName);let{formChromeMode:o,sectionChromeMode:s}=qw(),c=gc(),{tComponent:l}=q(),u=Wz(r?.schema,e.fieldName);return{formContext:t,formSchemaContext:n,templateContext:r,registry:i,doOperation:a,fieldSchema:u,resolvedChromeMode:(u?Ec(u):void 0)?.chromeMode??s??o??VL(c.autoRender?.autoFieldChrome),resolvedLabelPlacement:HL(c.autoRender?.autoLabelPlacement),resolvedControlSize:UL(c.autoRender?.autoFieldDensity),hideInlineErrorForPolicy:c.autoRender?.autoErrorPlacement===`summary-at-surface-top`,fieldLabel:r?.fieldLabels?.[e.fieldName]??_r.formatFieldPathFallback(e.fieldName),fieldDescription:r?.fieldDescriptions?.[e.fieldName],fieldTooltip:r?.fieldTooltips?.[e.fieldName],disabled:r?.disabled,readOnly:r?.readOnly,labels:{saveLabel:l(K.LOW_LEVEL_BUTTON,`save`),savingLabel:l(K.LOW_LEVEL_FORM_FIELD,`saving`),clearLabel:l(K.LOW_LEVEL_FORM_FIELD,`clearSelection`),saveFailedLabel:l(K.LOW_LEVEL_FORM_FIELD,`save_failed`),saveConflictLabel:l(K.LOW_LEVEL_FORM_FIELD,`save_conflict`),saveUnavailableLabel:l(K.LOW_LEVEL_FORM_FIELD,`save_unavailable`)}}}function qz(e){(0,Q.useEffect)(()=>{!e.rmm&&ui.isDevelopment()&&(e.allowsDirectOperationFallback?Gz.warn(`[${e.componentName}] Resource mutation manager unavailable; relationship writes are using weaker-guarantee direct-operation fallback.`,e.context):Gz.warn(`[${e.componentName}] Resource mutation manager unavailable; relationship writes are disabled.`,e.context))},[e.allowsDirectOperationFallback,e.componentName,e.context,e.rmm])}function Jz({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}}=Kz({fieldName:o}),O=u.allResourceFieldIdentifiers?.[s],k=c.watch(o),A=k??n,j=!f||Zl(f)===jr.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),[L,R]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(void 0);(0,Q.useEffect)(()=>{I(void 0),R(!1),B(void 0)},[o,l.resourceId]),(0,Q.useEffect)(()=>{I(void 0),R(!1),B(void 0)},[P.join(`|`)]);let ee=F??(j?P:P[0]),te=(0,Q.useMemo)(()=>[...new Set(jw(ee))],[ee]),ne=!i&&!a||!M,V=(0,Q.useMemo)(()=>{if(te.length!==P.length)return!0;let e=new Set(P);return te.some(t=>!e.has(t))},[P,te]);qz({rmm:i,allowsDirectOperationFallback:a,componentName:`GeneratedAssociationRelationshipField`,context:(0,Q.useMemo)(()=>({fieldName:o}),[o])});let re=(0,Q.useCallback)(e=>{M&&(I(e),B(void 0))},[M]),ie=(0,Q.useCallback)(()=>{M&&(I(j?[]:void 0),B(void 0))},[M,j]),ae=(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)B(D);else{R(!0),B(void 0);try{let{contextualParameters:n,parentResourcesRequirements:r}=Uz({formSchemaContext:l,registry:u}),a=e.map(e=>N.get(e)??{[O]:e}),s=no.createOperationPathKeyFromOperation(t),f={...El([l.resourceId]),peerIds:e};if(i){let e=await i.queueMutation({[o]:j?a:a[0]??null},{type:sE.CUSTOM,priority:mE.NORMAL,source:{type:cE.FORM,subscriberId:`generated-association:${o}`},transportOverride:{operationPathKey:s,contextualParameters:n,parentResourcesRequirements:r,requestData:f,readBackOnSuccess:!0}});if(!e.success){B(e.error?.type===lE.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){Hz({componentName:`GeneratedAssociationRelationshipField`,message:`Failed to update association relationship`,context:{fieldName:o,action:`save`,desiredPeerIds:e,error:t}}),B(T)}finally{R(!1)}}}},[a,P,N,d,o,c,l.contextResourceIdentifiers,l.parentResourcesRequirements,l.resourceId,l.resourceType,M,V,j,t,u,O,T,D,i]),oe=(0,Q.useCallback)(async()=>{await ae(te)},[te,ae]);return!f||!O?null:(0,$.jsx)(Bz,{fieldName:o,resolvedChromeMode:p,resolvedLabelPlacement:m,resolvedControlSize:h,hideInlineErrorForPolicy:g,fieldLabel:_,fieldDescription:v,fieldTooltip:y,disabled:b,actionError:z,unavailableLabel:D,isUnavailable:ne,controls:(0,$.jsx)(hI,{schema:j?Ad(md()).optional():md().optional(),name:o,quickCreateSourceFieldName:e.quickCreate?o:void 0,value:ee,onChange:re,targetResourceType:s,onQuickCreateCreated:e=>{let t=[...new Set([...te,e])];I(j?t:e),B(void 0),ae(t)},onBlur:()=>{},disabled:b||x||L||ne,readOnly:x,controlSize:h,required:!1,autoFocus:void 0}),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{type:`button`,size:df.SM,className:`shrink-0`,disabled:!V||L||x||ne,onClick:()=>{oe()},children:L?C:S}),(0,$.jsx)(Y,{type:`button`,variant:X.OUTLINE,size:df.SM,className:`shrink-0`,disabled:te.length===0||L||x||ne,onClick:ie,children:w})]})})}function Yz({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}}=Kz({fieldName:a});o&&Wz(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),[L,R]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(void 0);(0,Q.useEffect)(()=>{P(void 0),I(void 0),R(!1),B(void 0)},[a,l.resourceId]),(0,Q.useEffect)(()=>{P(void 0),I(void 0),R(!1),B(void 0)},[M]);let ee=F===void 0?M:F??void 0,te=N??ee;qz({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),B(void 0))},[]),V=(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??te:void 0;if(e!==`set`||p&&p!==ee){if(!r&&!i)B(O);else{R(!0),B(void 0);try{let t=no.createOperationPathKeyFromOperation(u),{contextualParameters:n,parentResourcesRequirements:i}=Uz({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={...El([l.resourceId]),...e===`set`?{targetId:p}:{}};if(r){let c=await r.queueMutation({[a]:e===`set`?s:null,[o]:e===`set`?p:null},{type:sE.CUSTOM,priority:mE.NORMAL,source:{type:cE.FORM,subscriberId:`generated-reference:${a}`},transportOverride:{operationPathKey:t,contextualParameters:n,parentResourcesRequirements:i,requestData:m,readBackOnSuccess:!0}});if(!c.success){B(c.error?.type===lE.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){Hz({componentName:`GeneratedReferenceRelationshipField`,message:`Failed to update reference relationship`,context:{fieldName:a,foreignKeyFieldName:o,action:e,error:t}}),B(E)}finally{R(!1)}}}},[n,te,ee,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)(Bz,{fieldName:a,resolvedChromeMode:m,resolvedLabelPlacement:h,resolvedControlSize:g,hideInlineErrorForPolicy:_,fieldLabel:v,fieldDescription:y,fieldTooltip:b,disabled:x,actionError:z,unavailableLabel:O,isUnavailable:!r&&!i,controls:(0,$.jsx)(hI,{schema:md().optional(),name:o,quickCreateSourceFieldName:e.quickCreate?a:void 0,value:te,onChange:ne,onQuickCreateCreated:e=>{P(e),B(void 0),V(`set`,e)},onBlur:()=>{},disabled:x||S||L||!r&&!i,readOnly:S,controlSize:g,required:!1,autoFocus:void 0}),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{type:`button`,size:df.SM,className:`shrink-0`,disabled:!N||N===ee||L||S||!r&&!i,onClick:()=>{V(`set`)},children:L?w:C}),n&&(0,$.jsx)(Y,{type:`button`,variant:X.OUTLINE,size:df.SM,className:`shrink-0`,disabled:!ee||L||S||!r&&!i,onClick:()=>{V(`clear`)},children:T})]})})}var Xz=tl.getLogger(),Zz=Xz.debugByType(`ResourceAutomatedForm`);Xz.setDebugTypeLogging(`ResourceAutomatedForm`,!1);function Qz(e,t){return t.replace(/\[(\d+)\]/g,`.$1`).split(`.`).filter(Boolean).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e)}function $z(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=Qz(e,a);o!==void 0&&(i[a]=o)}return i}function eB(e,t){let n=e=>e==null||e===``;return n(e)||n(t)?n(e)&&n(t):(0,rC.default)(e,t)}function tB(e){return e.validationErrors?DM({httpStatus:e.status??400,validationErrors:e.validationErrors})!==null:!1}function nB(e){let t=(e.userNotifications||[]).find(e=>{let t=e.channel,n=e.target;return t===Ks.FRONT_END_SUCCESS&&n===ere.USER_SELF});return t?{identifier:t.identifier,level:t.level||_o.SUCCESS}:null}function rB(e){switch(e){case J.CREATE:return`create`;case J.UPDATE:case J.UPDATE_MANY:return`saveChanges`;case J.DELETE:return`delete`;default:return`submit`}}function iB(e){return!e.success&&e.error?.type===lE.CONFLICT}function aB(e){return bs(e.operationIdentifier,e.resourceOperationLike)===J.READ||el(e)}function oB(e,t,n,r){if(!e||g(t))return e;let i=n?Object.keys(n):[],a=r?_r.getObjectLikeFieldShape(r):void 0;if(i.length!==0&&a)return i.every(e=>Object.prototype.hasOwnProperty.call(a,e))?e:void 0}function sB({Template:e,requestFieldNames:t}){let n=Tk(),r=jT(),[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)(JL,{name:e},e))}):null,claim:c}),[c,l,i]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(wk.Provider,{value:n,children:(0,$.jsx)(JR.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:QE(`measure`)},"data-guidance-unplaced-request-fields":``,children:i.map(e=>(0,$.jsx)(JL,{name:e},e))})]})}function cB({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:_}=fm(),{emit:v}=Uo(),{tComponent:y,tResourceOperation:b,isReady:x}=q({component:K.RESOURCES_LAYOUTS_CREATE,resource:e.resourceType}),S=cp(),C=(0,Q.useRef)(h),w=(0,Q.useRef)(v),T=(0,Q.useRef)(n),E=(0,Q.useRef)(t),D=(0,Q.useRef)(null),O=(0,Q.useRef)(d);C.current=h,w.current=v,T.current=n,E.current=t,O.current=d;let k=(0,Q.useMemo)(()=>new Ae,[]),{resourceType:A,operation:M,contextResourceIdentifiers:N}=e,P=$R(e,M),F=(0,Q.useContext)(lh),I=(0,Q.useRef)(F);I.current=F;let L=(0,Q.useCallback)(e=>Ht(e)?(I.current?.notifyInfo(y(K.RESOURCES_LAYOUTS_CREATE,`operationSentForApproval`)),!0):!1,[y]),R=m??eo(M,_.resourceConfigurations[A]?.operations),z=String(M.operationIdentifier),B=M.variantKey,ee=M.admitsCrossTenantPlatformAdministration===!0,te=(0,Q.useMemo)(()=>({variantKey:B,admitsCrossTenantPlatformAdministration:ee}),[ee,B]),ne=bs(z,M.resourceOperationLike?String(M.resourceOperationLike):void 0),V=z,re=M.resourceOperationLike?String(M.resourceOperationLike):void 0,ie=re??V,ae=MT(ne,ie),[se,ce]=(0,Q.useState)(!1),[le,ue]=(0,Q.useState)(!1),[de,fe]=(0,Q.useState)(!1),[pe,me]=(0,Q.useState)(void 0),[he,ge]=(0,Q.useState)(`none`),[_e,ve]=(0,Q.useState)(null),ye=(0,Q.useRef)(null),{initAutoClearing:be,injectServerErrors:Se,clearServerErrors:Ce}=YR(ye),[we,Te]=(0,Q.useState)(null),[Ee,De]=(0,Q.useState)(null),[Oe,ke]=(0,Q.useState)(u?.isDraft??!1),[je,Ne]=(0,Q.useState)(null),[Pe,Fe]=(0,Q.useState)(null),Ie=(0,Q.useRef)(null),Le=(0,Q.useMemo)(()=>{let e=M.requestDto;if(!e)return Xz.error(`[ResourceAutomatedForm] No requestDto found for operation ${z} on resource ${A}`),e;if(M.isBulkOperation===!0&&e instanceof Cae){let t=qie.filter(t=>t in e.shape),n=t.length>0?e.omit(Object.fromEntries(t.map(e=>[e,!0]))):e;return Fl(ne)?Ine(n):n}return e},[ne,M,z,A]),Re=(0,Q.useMemo)(()=>_.resourceConfigurations[A],[_,A]),ze=(0,Q.useMemo)(()=>DE(Re?.mainSchema),[Re]),Be=(0,Q.useMemo)(()=>ne===J.READ||z===J.UPDATE?new Set:new Set([Re?.mainSchema,...Rs(Re?.inheritenceSchemaDefinition)].flatMap(e=>[...vt(e)])),[ne,z,Re]),Ve=(0,Q.useCallback)((e,t=!0)=>{let n=f??{},r=t?{...e,...n}:{...e};for(let e of Be)Object.prototype.hasOwnProperty.call(n,e)||delete r[e];return r},[f,Be]);(0,Q.useMemo)(()=>M.operationFrontendConfig,[M]);let He=Re?.frontendConfiguration?.layout?.refs,Ue=Re?.frontendConfiguration?.layout?.defaultChromeMode?.edit,We=(0,Q.useMemo)(()=>{let e=Re?.inheritenceSchemaDefinition;if(e)return{discriminatorField:e.discriminatorField,withoutInheritanceDiscriminatorFieldValues:e.withoutInheritanceDiscriminatorFieldValues,inheritedSchemas:e.inheritedSchemas}},[Re]),Ge=(0,Q.useMemo)(()=>{if(Le)return _r.getObjectLikeFieldShape(Le)},[Le]),Ke=(0,Q.useMemo)(()=>oB(Re?.frontendConfiguration?.layout?.edit,M.operationIdentifier,Ge,Re?.inheritenceSchemaDefinition?Vd(U.resolveFieldShapeOfAnyVariant(Re)??{}):Re?.mainSchema),[Re,M.operationIdentifier,Ge]),qe=Re?.frontendConfiguration?.draftableConfig,Je=(0,Q.useMemo)(()=>{if(qe||u)return!qe&&u?u:qe&&!u?{enabled:!0,isDraft:!1,discriminator:qe.discriminator,draftValue:qe.draftValue,publishedValue:qe.publishedValue,requireConfirmationToPublish:qe.requireConfirmationToPublish}:{...qe,...u,enabled:u?.enabled??!!qe}},[qe,u]);(0,Q.useEffect)(()=>{Je?.isDraft!==void 0&&ke(Je.isDraft)},[Je?.isDraft]);let Ye=(0,Q.useMemo)(()=>U.buildContextResourceIdentifiersKey(N),[N]),Xe=(0,Q.useMemo)(()=>U.buildContextualParameters(N,_),[Ye,_]),Ze=(0,Q.useMemo)(()=>{if(!Ge)return{};let t=U.resolveSemanticContextFieldValues({resourceType:A,parentResourcesRequirements:e.parentResourcesRequirements,contextResourceIdentifiers:N,contextualParameters:Xe,registry:_}),n={};for(let[e,r]of Object.entries(t))Ge[e]&&(n[e]=r);return n},[Ye,Xe,Ge,_,e.parentResourcesRequirements,A]),Qe=(0,Q.useMemo)(()=>{if(!Ge)return{};let e={};for(let t of Object.keys(Ge)){let n=pj({resourceType:A,fieldName:t,operationType:ie,registry:_});n&&(e[t]=n)}return e},[ie,Ge,_,A]),$e=Re?.operations??[],et=(0,Q.useContext)(ih)?.permissions?.accessProfile,tt=et?.organizationUnitNarrowing,nt=(0,Q.useMemo)(()=>ne===J.CREATE?fde({resourceType:A,resourceConfiguration:Re,formFieldShape:Ge,readThroughCreateOrganizationUnits:et?.readThroughCreateOrganizationUnits}):void 0,[et?.readThroughCreateOrganizationUnits,ne,Ge,Re,A]),rt=mde({resourceType:Wo.ORGANIZATION_UNITS,ids:nt,hostContextualParameters:Xe}),it=ig(),at=Zp()?.currentOrganizationId??void 0,ot=Re?.resourcePrimaryScope===rn.ORGANIZATIONS&&String(Xe[Pr[rn.ORGANIZATIONS]]??at??``)||void 0,st=(0,Q.useMemo)(()=>hde({roleEntries:et?.roleEntries,organizationId:ot,roleTables:it,rolesWithinAuthority:et?.rolesWithinAuthority}),[et?.roleEntries,et?.rolesWithinAuthority,ot,it]),ct=(0,Q.useMemo)(()=>_de({fieldShape:Ge,ceiling:st,record:pe}),[Ge,st,pe]),lt=(0,Q.useMemo)(()=>vde({fieldShape:Ge,ceiling:st,record:pe}),[Ge,st,pe]),ut=(0,Q.useMemo)(()=>{let e=nt?{[Oi]:{values:nt,labels:rt}}:void 0;return e||ct?{...ct,...e}:void 0},[nt,rt,ct]),dt=(0,Q.useMemo)(()=>{if(!Ge)return[];let e=[];for(let t of Object.values(Qe)){let n=t.rootFieldName,r=e=>$e.find(t=>t.isBulkOperation===!0&&String(t.operationIdentifier)===wo.buildRelationshipBulkOperationIdentifier(e,n));(()=>{if(t.semantics.nature===Cn.COMPOSITION&&t.nestedMutationConfig)return!0;if(t.semantics.nature===Cn.REFERENCE){let e=t.foreignKeyIdentity?.fieldIdentifier,n=e?Ge[e]:void 0;return!!(n&&xe(n)&&!Object.prototype.hasOwnProperty.call(Ze,e??``))||!!r(Da.SET)}return t.semantics.nature===Cn.ASSOCIATION&&!!r(Da.REPLACE)})()?e.push(n):ui.isDevelopment()&&Xz.warn(`[ResourceAutomatedForm] Keeping relationship root visible because no business-facing editor is available`,{resourceType:A,operationType:ie,fieldName:n,relationshipNature:t.semantics.nature,hasNestedMutationConfig:!!t.nestedMutationConfig})}return dde({resourceType:A,resourceConfiguration:Re,formFieldShape:Ge,organizationUnitNarrowing:tt})&&e.push(Oi),e},[Ze,ie,Ge,tt,Qe,Re,$e,A]),ft=(0,Q.useMemo)(()=>no.createOperationPathKeyFromOperation(M),[M]),pt=(0,Q.useMemo)(()=>el(M),[M]),mt=(0,Q.useMemo)(()=>{let e=kn.getAddressedRecordId({resourceType:A,operation:M,contextResourceIdentifiers:N});if(e)return e;let t=pe&&typeof pe==`object`?pe._id:void 0;return typeof t==`string`&&t.length>0?t:null},[Ye,pe,A,M]),ht=(0,Q.useMemo)(()=>JSON.stringify(e.parentResourcesRequirements??[]),[e.parentResourcesRequirements]),H=(0,Q.useMemo)(()=>!mt||N[A]?N:{...N,[A]:mt},[Ye,mt,A]),gt=(0,Q.useMemo)(()=>{let e=Re?.resourceFieldIdentifier;return!mt||!e||String(Xe[e]??``)===mt?Xe:{...Xe,[e]:mt}},[Xe,Re?.resourceFieldIdentifier,mt]),_t=(0,Q.useMemo)(()=>{if(!pt||ne!==J.UPDATE||M.operationIdentifier!==J.UPDATE||!Re)return ft;let e=fh({resourceConfig:Re,operations:$e,coreOperation:J.UPDATE,registry:_,hasResourceId:!!mt,contextResourceIdentifiers:H,contextualParameters:gt});return e?no.createOperationPathKeyFromOperation(e):ft},[Ye,H,gt,ne,pt,M.operationIdentifier,ft,_,Re,mt,$e]),yt=(0,Q.useMemo)(()=>{let t=pt&&ne===J.UPDATE&&z!==J.UPDATE;return{operationPathKey:_t,contextualParameters:gt,parentResourcesRequirements:e.parentResourcesRequirements,...t?{readBackOnSuccess:!0}:{}}},[gt,_t,ne,pt,z,e.parentResourcesRequirements]),bt=(0,Q.useCallback)(t=>sc({operation:M,requestData:t,additionalContext:e.additionalContext}),[M,e.additionalContext]),{rmm:xt,rmmSnapshot:St,canonicalReadOperationPathKey:Ct}=Az({resourceType:A,resourceId:mt,doOperationRef:C,contextualParameters:gt,parentResourcesRequirements:e.parentResourcesRequirements,contextResourceIdentifiers:H,resourceSchema:Re?.mainSchema,resourceInheritance:Re?.inheritenceSchemaDefinition,enabled:pt&&!!mt,conflictPolicy:{strategy:dE.ACCEPT_REMOTE},directFallbackAccepted:Vn(R),actingOperation:te});wy({markerId:`rmm:${A}:${mt??``}`,isDirty:!!xt&&St.hasUnsavedChanges});let wt=(0,Q.useMemo)(()=>Vn(R),[R]),Tt=pt&&!wt,Et=(0,Q.useCallback)(e=>{if(Tt&&!xt)throw new ir({surfaceName:e,resourceType:A,operationIdentifier:z})},[z,Tt,A,xt]);(0,Q.useEffect)(()=>{Tt&&!xt&&ui.isDevelopment()&&Xz.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:A,operationIdentifier:z,hasResourceId:mt!==null,updateLikeMutationFallbackMode:R})},[z,Tt,mt,A,xt,R]);let Dt=(0,Q.useMemo)(()=>{if(!Re||!pt||!mt||!Ge)return{};let e={};for(let[t,n]of Object.entries(Qe)){let r=n.rootFieldName,i=e=>$e.find(t=>t.isBulkOperation===!0&&String(t.operationIdentifier)===wo.buildRelationshipBulkOperationIdentifier(e,r));if(n.semantics.nature===Cn.REFERENCE){let r=n.foreignKeyIdentity?.fieldIdentifier;if(!r)continue;let a=Ge[r];if(a&&xe(a)&&!Object.prototype.hasOwnProperty.call(Ze,r))continue;let o=i(Da.SET),s=i(Da.CLEAR);if(!o){ui.isDevelopment()&&Xz.warn(`[ResourceAutomatedForm] Skipping reference override because generated bulk set operation is unavailable`,{resourceType:A,fieldName:t,foreignKeyFieldName:r});continue}e[t]=(0,$.jsx)(Yz,{writeSurface:n,setOperation:o,clearOperation:s,rmm:xt,allowDirectOperationFallback:wt})}else if(n.semantics.nature===Cn.ASSOCIATION){let r=i(Da.REPLACE),a=pe?Qz(pe,t):void 0,o=!!(pe&&typeof pe==`object`&&Object.prototype.hasOwnProperty.call(pe,t));if(!r){ui.isDevelopment()&&Xz.warn(`[ResourceAutomatedForm] Skipping association override because generated bulk replace operation is unavailable`,{resourceType:A,fieldName:t});continue}e[t]=(0,$.jsx)(Jz,{writeSurface:n,replaceOperation:r,initialRelationshipValue:a,hasHydratedInitialValue:o,rmm:xt,allowDirectOperationFallback:wt})}}return e},[Ze,pe,ie,Ge,pt,_,Re,mt,$e,A,Qe,xt,wt]),Ot=(0,Q.useCallback)((e,t,n)=>{let r=ye.current;if(r)for(let i of e){if(n&&Object.prototype.hasOwnProperty.call(n,i)&&!eB(r.getValues(i),n[i]))continue;let e=Qz(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(!xt||!St?.lastEvent)return;let e=St.lastEvent;switch(e.type){case oE.MUTATION_RESULT:{let{result:t}=e;if(t.success&&t.savedFields&&Ot(t.savedFields,St.confirmedData,t.savedValues),!t.success&&t.error?.type===lE.VALIDATION&&t.error.validationErrors){let e=DM({httpStatus:t.error.status??400,validationErrors:t.error.validationErrors});e&&Se(e.validationErrors)}break}case oE.REMOTE_UPDATE:if(ye.current)for(let t of e.changedFields)ye.current.getFieldState(t).isDirty||ye.current.setValue(t,Qz(St.confirmedData,t),{shouldDirty:!1,shouldValidate:!1});Fe({changedFields:e.changedFields,initiatorUserId:e.initiatorUserId}),Ie.current&&clearTimeout(Ie.current),Ie.current=setTimeout(()=>{Fe(null),Ie.current=null},3e3);break;case oE.CONFLICT_RESET:ye.current&&ye.current.reset(Ve(e.currentData,!1)),Ce(),Ne({discardedFields:e.discardedFields,conflictingFields:e.conflictDetails?.conflictingFields??e.discardedFields,reason:e.reason,conflictDetails:e.conflictDetails});break;case oE.RESOURCE_DELETED:Zz(`RMM resource deleted event`,{reason:e.reason})}},[St?.lastEvent?.id]),(0,Q.useEffect)(()=>()=>{Ie.current&&=(clearTimeout(Ie.current),null)},[]);let kt=(0,Q.useCallback)(()=>{xt?.acknowledgeConflict(),Ne(null)},[xt]),At=(0,Q.useMemo)(()=>{let e={resourceContext:{resourceType:A,operationId:z}};return{...e,...o,navigation:{...e.navigation,...o?.navigation}}},[A,z,o]),jt=(0,Q.useMemo)(()=>{let t=ne===J.CREATE,n=el(M);if(!t&&!n)return null;try{let t=n?mt:null,r=ui.getApiUrl();if(!Re?.resourceFieldIdentifier)throw U.buildConfigurationError(Lu.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:e.resourceType,component:`ResourceAutomatedForm`});let i=Re.resourceFieldIdentifier,a={...gt};t&&(a[i]=t);let o=M.variantType===oe.API_CALL?M:Re&&n?fh({resourceConfig:Re,operations:Re.operations??[],coreOperation:J.UPDATE,registry:_,hasResourceId:!!mt,contextResourceIdentifiers:H,contextualParameters:gt}):Re?Gl(Re.operations??[],J.CREATE):void 0,s;if(o){let t=Tl.buildOperationFrontendRoutePaths(Re,o,_.allResourceFieldIdentifiers);if(t.length>0){let n=kn.selectMatchingRoutePath(t,H,Re.resourceIdentifier,i,e.parentResourcesRequirements);s=`${Ir}${n.url}`,s=Hm.resolveUrlPath(s,a),s&&Hm.hasUnresolvedPlaceholders(s)&&(Xz.warn(`[ResourceAutomatedForm] Unresolved placeholders in routed API basePath; disabling route-derived helpers`,{basePath:s,resourceType:A,operationIdentifier:z}),s=void 0)}}return s?{apiBaseUrl:r,basePath:s,contextualParameters:a,resourceFieldIdentifier:i}:null}catch(e){return Xz.error(`[ResourceAutomatedForm] Error computing resource API base:`,e),null}},[H,gt,ne,M,_,Re,e,mt,A]),Mt=(0,Q.useMemo)(()=>{if(!Le||!jt||!Re?.resourceFieldIdentifier)return{};let t={},n=el(M),{apiBaseUrl:r,contextualParameters:i}=jt;try{let a=M.variantType===oe.API_CALL?M:n?fh({resourceConfig:Re,operations:Re.operations??[],coreOperation:J.UPDATE,registry:_,hasResourceId:!!mt,contextResourceIdentifiers:H,contextualParameters:gt}):Gl(Re.operations??[],J.CREATE);if(!a)return t;let o=Tl.buildOperationFrontendRoutePaths(Re,a,_.allResourceFieldIdentifiers);if(o.length===0)return t;let s=kn.selectMatchingRoutePath(o,H,Re.resourceIdentifier,Re.resourceFieldIdentifier,e.parentResourcesRequirements),c=`${r}/api/v1/files`,l=_r.collectUploadableFileFieldPaths(Le);for(let e of l){let a=Tl.buildFileUploadRouteForOperation({operationRouteUrl:s.url,operationParameters:s.parameters,targetResourceType:A,targetResourceFieldIdentifier:Re.resourceFieldIdentifier,fieldName:e,requiresTargetResourceId:n,isFrontend:!0}),o=Hm.resolveUrlPath(a.url,i);if(Hm.hasUnresolvedPlaceholders(o)){Xz.warn(`[ResourceAutomatedForm] Unresolved placeholders in file upload path, skipping endpoint`,{fieldName:e,uploadPath:o});continue}let l=`${r}${Ir}${o}`;t[e]={upload:l,override:n?l:void 0,getMetadata:c,delete:n?void 0:c}}}catch(e){Xz.error(`[ResourceAutomatedForm] Error generating file upload context:`,e)}return t},[H,Le,M,ht,jt,Re,A]),Nt=(0,Q.useMemo)(()=>{if(!jt||!Re)return;let t=U.resolveFieldShapeOfAnyVariant(Re);if(!t||!Object.values(t).some(e=>Mr(e)))return;let n=Gl(Re.operations??[],J.CREATE),r=n?.initiatorInfos?.length?U.selectOperationUrlInitiatorInfo({initiatorInfos:n.initiatorInfos,contextualParameters:jt.contextualParameters,targetResourceType:Re.resourceIdentifier,targetDefaultFieldIdentifier:jt.resourceFieldIdentifier,parentResourcesRequirements:e.parentResourcesRequirements}):void 0;if(!r)return;let i=qge({apiBaseUrl:jt.apiBaseUrl,initiatorInfo:r,contextualParameters:jt.contextualParameters});return i||Xz.warn(`[ResourceAutomatedForm] validate-field URL has unresolved parameters; blur-time validation disabled`,{initiatorUrl:r.url,resourceType:A}),i},[jt,Re,e.parentResourcesRequirements,A]),Pt=(0,Q.useMemo)(()=>mt??void 0,[mt]),Ft=(0,Q.useMemo)(()=>{if(!xt)return yz(A,_,{hasResourceId:!!mt,contextResourceIdentifiers:H,contextualParameters:gt,actingOperation:te})},[Ye,H,gt,te,_,mt,A,xt]),It=(0,Q.useMemo)(()=>xt?Ct:Ft?no.createOperationPathKeyFromOperation(Ft):bz(A,_,{hasResourceId:!!mt,contextResourceIdentifiers:H,contextualParameters:gt,actingOperation:te}),[Ft,Ye,H,gt,te,_,mt,A,xt,Ct]),Lt=(0,Q.useMemo)(()=>aB(M),[M]),Rt=(0,Q.useRef)(null),zt=FS({operation:M,currentObject:Lt?pe:void 0,resourceType:A,enabled:Lt&&se&&!_e}),Bt=(0,Q.useMemo)(()=>pe&&Ve(pe),[pe,Ve]),Vt=M.isBulkOperation===!0&&Fl(ne),Ut=(0,Q.useMemo)(()=>{if(!Lt)return Vt?f:Dde({formFieldShape:Ge,inheritanceConfig:We,defaultValuesOverride:f})},[Lt,Ge,We,f,Vt]),Wt=(0,Q.useCallback)((e,t,n={})=>xde({values:e,seed:void 0,schema:Le,writtenAsHeld:t,variantFields:ze,clears:n}),[ze,Le]),[Gt,Kt]=(0,Q.useState)({}),qt=(0,Q.useRef)(Gt),Jt=bne(e.additionalContext),Yt=(0,Q.useMemo)(()=>{let e=new Map;return t=>{if(Vt)return e.has(t)||e.set(t,Sde(t,M.requestDto,Le,ze)),e.get(t)}},[ze,Le,M.requestDto,Vt]),Xt=(0,Q.useCallback)((e,t)=>{let n=t?Yt(e):void 0;if(t&&!n)return;let r={...qt.current};if(n?r[e]=n.value:delete r[e],qt.current=r,Kt(r),!n)return;let i=n.kind===JT.EMPTY?[]:n.kind!==JT.TURN_OFF&&void 0;ye.current?.setValue(e,i,{shouldDirty:!0}),ye.current?.clearErrors(e)},[Yt]),Zt=(0,Q.useRef)(new Map),Qt=(0,Q.useCallback)(e=>{let t=Zt.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)}},[]),$t=(0,Q.useRef)(_t);(0,Q.useEffect)(()=>{$t.current!==_t&&($t.current=_t,Object.keys(qt.current).length!==0&&(qt.current={},Kt({})))},[_t]);let en=(0,Q.useCallback)(()=>Object.fromEntries(Object.entries(qt.current).filter(([e])=>Zt.current.has(e))),[]),tn=(0,Q.useCallback)(e=>{let t=Object.keys(e);if(t.length===0)return;let n={...qt.current};for(let e of t)delete n[e];qt.current=n,Kt(n)},[]),nn=(0,Q.useMemo)(()=>Vt?{selectionCount:Jt,clearFor:Yt,isCleared:e=>Object.hasOwn(Gt,e),setCleared:Xt,registerField:Qt}:null,[Yt,Gt,Jt,Qt,Xt,Vt]);(0,Q.useEffect)(()=>{if(!Lt){me(f??void 0),ge(`create`),ce(!0);return}let t=JSON.stringify({canonicalReadOperationPathKey:It,contextResourceIdentifiersKey:Ye,parentResourcesRequirementsKey:ht});if(se&&Rt.current===t){if(xt&&pe&&typeof xt.getSnapshot==`function`&&xt.getSnapshot().confirmedData===null&&typeof xt.setInitialState==`function`){let e=pe;xt.setInitialState(e,e._version??0,e._field_meta)}return}let n=!1;return(async()=>{ve(null);try{if(!It)throw Error(`No addressable canonical READ operation is available for this resource form context.`);let r=await Sz({doOperation:C.current,readOperationPathKey:It,contextualParameters:gt,parentResourcesRequirements:e.parentResourcesRequirements});if(n)return;let i=r;xt&&xt.setInitialState(i,i._version??0,i._field_meta),me(f?{...i,...f}:r),Rt.current=t,ge(t),ce(!0)}catch(e){if(n)return;let t=e instanceof Error?e:Error(String(e)),r=j(e),i=k.buildWildoError_Frontend(Mc.NOT_FOUND,{customMessageReference:Lu.FRONTEND_FORM_READ_OPERATION_NOT_AVAILABLE,operationPathKey:It,context:{resourceType:A,operationIdentifier:z,originalErrorMessage:t.message,originalErrorStack:t.stack,httpCode:r.code,httpContext:r.context}});ve({wildoError:i,message:S(e)}),T.current?.(t)}})(),()=>{n=!0}},[Lt,It,A,Ye,gt,ht,k,z,f,xt,se,pe]);let an=(0,Q.useCallback)(async t=>{D.current?.(),ue(!0),Ce(),Zz(`handleSubmit: starting`,{operationPathKey:ft,dataKeys:Object.keys(t||{})});try{let n;if(xt){let e=pt&&XR({resourceType:A,contextResourceIdentifiers:H,rowValues:ZR(t,QR(M)),registry:_})!==void 0,r=await xt.queueMutation(t,{type:sE.SUBMIT,priority:mE.HIGH,source:{type:cE.FORM,subscriberId:`submit`},transportOverride:e?{...yt,readBackOnSuccess:!1}:yt});if(!r.success){if(iB(r))return;if(r.error?.type===lE.VALIDATION){T.current?.(qR(r.error,`Validation failed`));return}throw qR(r.error,`Submit failed`)}n=r.heldForApproval??r.responseData}else{Et(`ResourceAutomatedForm submit`);let e=Object.keys(Ze),r=Vt?en():{},i=Vt?Wt(t,e,r):t,a=z===J.UPDATE||z===J.UPDATE_MANY;if(Vt&&a&&Object.keys(i).every(t=>e.includes(t))){Se({[eT]:y(K.RESOURCES_LAYOUTS_CREATE,`bulkNothingToChange`)});return}n=await C.current(yt.operationPathKey,{contextualParameters:yt.contextualParameters,requestData:bt(i),parentResourcesRequirements:yt.parentResourcesRequirements},{silent:!0}),tn(r)}if(Zz(`handleSubmit: success`,{operationPathKey:ft}),L(n)){E.current?.(n);return}let r=nB(M);if(r){let t=r.level===_o.WARNING?hc.NOTIFY_RESOURCE_WARNING:r.level===_o.ERROR?hc.NOTIFY_RESOURCE_ERROR:r.level===_o.INFO?hc.NOTIFY_RESOURCE_INFO:hc.NOTIFY_RESOURCE_SUCCESS;w.current(t,{...e,contextResourceIdentifiers:Me({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:A,result:n,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Wu(n),additionalContext:{...e.additionalContext,notificationIdentifier:r.identifier,notificationLevel:r.level,result:n}})}let i=e.additionalContext?.quickCreateRequest;if(i?.requestId&&ne===J.CREATE){let e=Lz({result:n,resourceType:A,registry:_});e&&zz({emit:w.current,requestId:i.requestId,resourceType:A,resourceId:e,data:typeof n==`object`&&n&&!Array.isArray(n)?n:void 0})}E.current?.(n)}catch(t){if(t instanceof hE)return;let n=t instanceof Error?t:Error(String(t));Zz(`handleSubmit: error caught`,{message:n.message,operationPathKey:ft});let r=DM(t);r?(Zz(`handleSubmit: server validation errors detected`,{httpStatus:r.httpStatus,fields:Object.keys(r.validationErrors)}),Se(r.validationErrors)):(Zz(`handleSubmit: general error (not validation)`,{message:n.message}),w.current(hc.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:ku(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,error:n.message,...rz(t)}})),T.current?.(n)}finally{ue(!1)}},[Et,Ze,H,yt,pt,_,A,Se,bt,z,ft,Xe,M,e,xt,y,Wt,tn,en,Vt]),on=e=>{Zz(`handleError: client-side validation failed`,{errorCount:Object.keys(e).length,fields:Object.keys(e)}),Xz.warn(`[ResourceAutomatedForm] Form validation errors`,e),WD(UD(e))};(0,Q.useEffect)(()=>{if(!f||!ye.current)return;let e=pe?Ve(pe):f;ye.current.reset(e)},[f]);let sn=(0,Q.useCallback)(e=>{if(ye.current=e,be(e),f){let t=pe?Ve(pe):f;e.reset(t)}},[be,f]),cn=(0,Q.useCallback)(async e=>ye.current?ye.current.trigger(e):(Zz(`validateAutosaveField: form methods unavailable, failing closed`,{fieldName:e}),!1),[]),ln=(0,Q.useCallback)(async(e,t,n)=>{Et(`ResourceAutomatedForm autosave`);let r=()=>{if(n.aborted)throw new DOMException(`Autosave aborted`,`AbortError`)};r();let i=!xt&&Vt?qT(en(),KT([e],Le)):{},a=!xt&&Vt?Wt(LT(RT(ye.current?.getValues()??{},e,t),KT([e],Le)),[],i):void 0;if(a&&Object.keys(a).length===0)return;let o=xt?xt.queueMutation({[e]:t},{type:sE.AUTOSAVE,priority:mE.LOW,transportOverride:yt}).then(e=>{if(!e.success)throw e.error??Error(`Autosave failed`)}):C.current(yt.operationPathKey,{contextualParameters:yt.contextualParameters,requestData:bt(a??OE(oA(ye.current?.getValues()??null,e,t),ze,pe)),parentResourcesRequirements:yt.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(),tn(i)},[Et,yt,pe,ze,Le,bt,xt,Wt,tn,en,Vt]),un=(0,Q.useCallback)(async(t,n,r)=>{if(n.length===0){ui.isDevelopment()&&Xz.warn(`[ResourceAutomatedForm] Skipping section save because no fields were registered for the section.`,{resourceType:A,sectionRef:t});return}let i=HT(LT(r,n),{hiddenFieldNames:dt,contextFieldValues:Ze,omitClearedFields:ae,schema:Le});try{if(O.current){await O.current(t,n,i);return}let a;if(xt){let e=await xt.queueMutation($z(i,n),{type:sE.SECTION,priority:mE.NORMAL,source:{type:cE.FORM,subscriberId:`section:${t}`},transportOverride:yt});if(!e.success){if(iB(e)||e.error?.type===lE.VALIDATION&&tB(e.error))return;throw qR(e.error,`Section save failed`)}a=e.heldForApproval??e.responseData}else{Et(`ResourceAutomatedForm section save`);let e,t={};if(Vt){let i=Object.keys(Ze);t=qT(en(),KT(n,Le));let a={...ye.current?.getValues()??r};for(let e of Object.keys(M.requestFieldOffers??{}))e in r?a[e]=r[e]:delete a[e];let o=Wt(HT(LT(a,KT(n,Le)),{hiddenFieldNames:dt,contextFieldValues:Ze,omitClearedFields:ae,schema:Le}),i,t);if((z===J.UPDATE||z===J.UPDATE_MANY)&&Object.keys(o).every(e=>i.includes(e))){Se({[eT]:y(K.RESOURCES_LAYOUTS_CREATE,`bulkNothingToChange`)});return}e=bt(o)}else{let t=pe;e=bt(OE(zT(i,n,t),ze,t))}a=await C.current(yt.operationPathKey,{contextualParameters:yt.contextualParameters,requestData:e,parentResourcesRequirements:yt.parentResourcesRequirements},{silent:!0}),Ht(a)||Ot(n,a,Object.fromEntries(n.map(e=>[e,Qz(i,e)]))),tn(t)}if(L(a))return;P(a,{partialWrite:!0}),w.current(hc.NOTIFY_RESOURCE_SUCCESS,{...e,contextResourceIdentifiers:Me({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:A,result:a,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Wu(a),additionalContext:{...e.additionalContext,sectionRef:t,fieldNames:n,notificationIdentifier:`section_saved`,notificationLevel:_o.SUCCESS}})}catch(n){if(n instanceof hE)return;let r=DM(n);if(r){Se(r.validationErrors);return}let i=n instanceof Error?n:Error(String(n));w.current(hc.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:ku(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,sectionRef:t,error:i.message,...rz(n)}})}},[P,Et,yt,Ze,pe,ze,Le,dt,Se,Ot,bt,ae,z,e,A,xt,y,Wt,tn,en,Vt]),dn=(0,Q.useMemo)(()=>l===void 0&&Kge(Ge,ie),[l,ie,Ge]),fn=Fl(ne)&&M.requiresApproval===void 0,pn=l?.enabled===!0;(0,Q.useEffect)(()=>{pn&&!fn&&ui.isDevelopment()&&Xz.warn(`[ResourceAutomatedForm] autosaveConfig is ignored: autosave saves fields of records that exist, and this form creates one or runs an action.`,{resourceType:A,operationIdentifier:z})},[fn,pn,z,A]);let mn=(0,Q.useMemo)(()=>({enabled:fn&&(l?.enabled??dn),defaultTrigger:l?.defaultTrigger??(dn?Ts.NONE:Ts.DEBOUNCE),debounceMs:l?.debounceMs??500,savedStateDurationMs:2e3}),[l,fn,dn]),hn=(0,Q.useMemo)(()=>{if(!Le||!Je?.enabled)return null;try{let e=V===J.CREATE?`CREATE`:Fl(V)?`UPDATE`:`CREATE`,t=re===J.CREATE?`CREATE`:re&&Fl(re)?`UPDATE`:re===J.READ?`READ`:void 0;return _te(Le,{operationType:e,operationLike:t,isDraftMode:!0})}catch{return null}},[Le,Je?.enabled,V,re]),gn=(0,Q.useCallback)(async t=>{if(Je?.enabled){D.current?.(),fe(!0),Ce();try{let n,r=!0;if(Je?.onSaveDraft)n=await Je.onSaveDraft(t),r=n!==void 0;else{let e=Je?.discriminator||`_isDraft`,r=Je?.draftValue??!0,i={...t,[e]:r};if(xt){let e=await xt.queueMutation(i,{type:sE.DRAFT,priority:mE.HIGH,source:{type:cE.FORM,subscriberId:`draft`},transportOverride:{...yt,requestData:i}});if(!e.success){if(iB(e))return;throw qR(e.error,`Draft save failed`)}n=e.heldForApproval??e.responseData}else Et(`ResourceAutomatedForm draft save`),n=await C.current(yt.operationPathKey,{contextualParameters:yt.contextualParameters,requestData:bt(i),parentResourcesRequirements:yt.parentResourcesRequirements},{silent:!0})}if(L(n)){E.current?.(n);return}ke(!0),r&&(w.current(hc.NOTIFY_RESOURCE_SUCCESS,{...e,contextResourceIdentifiers:Me({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:A,result:n,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Wu(n),additionalContext:{...e.additionalContext,notificationIdentifier:`draftSaved`}}),E.current?.(n))}catch(t){if(t instanceof hE)return;let n=DM(t);n?Se(n.validationErrors):w.current(hc.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:ku(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,notificationIdentifier:`draftSaveFailed`,...rz(t)}}),T.current?.(t)}finally{fe(!1)}}},[Et,yt,Je,bt,e,A,Se,xt]),_n=(0,Q.useCallback)(async t=>{if(Je?.enabled){D.current?.(),ue(!0),Ce();try{let n,r=!0;if(Je?.onPublish)n=await Je.onPublish(t),r=n!==void 0;else{let e=Je?.discriminator||`_isDraft`,r=Je?.publishedValue??!1,i={...t,[e]:r};if(xt){let e=await xt.queueMutation(i,{type:sE.PUBLISH,priority:mE.HIGH,source:{type:cE.FORM,subscriberId:`publish`},transportOverride:{...yt,requestData:i}});if(!e.success){if(iB(e))return;throw qR(e.error,`Publish failed`)}n=e.heldForApproval??e.responseData}else Et(`ResourceAutomatedForm publish`),n=await C.current(yt.operationPathKey,{contextualParameters:yt.contextualParameters,requestData:bt(i),parentResourcesRequirements:yt.parentResourcesRequirements},{silent:!0})}if(L(n)){E.current?.(n);return}if(ke(!1),r){let t=nB(M);t&&w.current(hc.NOTIFY_RESOURCE_SUCCESS,{...e,contextResourceIdentifiers:Me({contextResourceIdentifiers:e.contextResourceIdentifiers,resourceType:A,result:n,isBulkOperation:e.operation?.isBulkOperation===!0}),parentResourcesRequirements:e.parentResourcesRequirements||[],resultSummary:Wu(n),additionalContext:{...e.additionalContext,notificationIdentifier:t.identifier}}),E.current?.(n)}}catch(t){if(t instanceof hE)return;let n=DM(t);n?Se(n.validationErrors):w.current(hc.NOTIFY_RESOURCE_ERROR,{...e,contextResourceIdentifiers:ku(e.contextResourceIdentifiers),parentResourcesRequirements:e.parentResourcesRequirements||[],additionalContext:{...e.additionalContext,notificationIdentifier:`publishFailed`,...rz(t)}}),T.current?.(t)}finally{ue(!1)}}},[Et,yt,Je,bt,e,A,M,Se,xt]),vn=(0,Q.useCallback)(async e=>{Je?.enabled&&(Je?.requireConfirmationToPublish?Te(e):await _n(e))},[Je,_n]),yn=(0,Q.useCallback)(async()=>{we&&(await _n(we),Te(null))},[we,_n]),bn=(0,Q.useCallback)(()=>{Te(null)},[]),xn=ds(M.riskLevel),Sn=M.riskLevel===od.CRITICAL,wn=Rn(M)?void 0:null,Tn=b(A,String(M.operationIdentifier),`description`)||void 0,En=(0,Q.useMemo)(()=>RS(b,A,String(M.operationIdentifier)),[b,A,M.operationIdentifier]),Dn=!!(Je?.enabled&&hn),On=(0,Q.useCallback)(e=>{Dn?vn(e):an(e)},[Dn,vn,an]),An=(0,Q.useCallback)(e=>{xn?De(e):On(e)},[xn,On]),jn=(0,Q.useCallback)(()=>{let e=Ee;De(null),e!==null&&On(e)},[Ee,On]),Mn=(0,Q.useCallback)(()=>{De(null)},[]),Nn=(0,Q.useMemo)(()=>{let e=g(z)?y(K.RESOURCES_LAYOUTS_CREATE,rB(ne??z)):En,t=y(K.RESOURCES_LAYOUTS_CREATE,`submitting`);if(Je?.enabled&&hn){let e=Je?.publishLabel?y(K.RESOURCES_LAYOUTS_CREATE,Je.publishLabel):y(K.RESOURCES_LAYOUTS_CREATE,`publish`),t=y(K.RESOURCES_LAYOUTS_CREATE,`publishing`);return(0,$.jsx)(Y,{type:`submit`,disabled:le||de||i,children:le?t:e})}return(0,$.jsx)(Y,{type:`submit`,disabled:le||i,children:le?t:e})},[ne,z,En,le,de,i,y,Je,hn]),Pn=(0,Q.useMemo)(()=>{if(!r)return null;let e=y(K.RESOURCES_LAYOUTS_CREATE,`cancel`);return(0,$.jsx)(Y,{type:`button`,variant:X.OUTLINE,disabled:le||de,onClick:r,children:e})},[r,le,de,y]),Fn=(0,Q.useMemo)(()=>{if(!Je?.enabled||!hn)return null;let e=Je?.saveDraftLabel?y(K.RESOURCES_LAYOUTS_CREATE,Je.saveDraftLabel):y(K.RESOURCES_LAYOUTS_CREATE,`saveAsDraft`),t=y(K.RESOURCES_LAYOUTS_CREATE,`savingDraft`);return(0,$.jsx)(uB,{draftSchema:hn,omitClearedFields:ae,submissionSchema:Le,onSaveDraft:gn,disabled:de||le||i,isSavingDraft:de,label:e,savingLabel:t})},[Je,hn,gn,de,le,i,y]),In=je?{title:y(K.RESOURCES_LAYOUTS_CREATE,je.reason===fE.VERSION_CONFLICT?`conflictTitleVersion`:`conflictTitleRemote`),message:y(K.RESOURCES_LAYOUTS_CREATE,je.reason===fE.VERSION_CONFLICT?`conflictMessageVersion`:`conflictMessageRemote`),acknowledgeButton:y(K.RESOURCES_LAYOUTS_CREATE,`conflictAcknowledge`),currentValue:y(K.RESOURCES_LAYOUTS_CREATE,`conflictCurrentValue`),submittedValue:y(K.RESOURCES_LAYOUTS_CREATE,`conflictSubmittedValue`),emptyValue:y(K.LOW_LEVEL_FORM_FIELD,`noValue`)}:void 0,Ln=(0,Q.useMemo)(()=>!je||!In?null:(0,$.jsx)(Pz,{type:`conflict`,discardedFields:je.discardedFields,conflictDetails:je.conflictDetails,labels:In,onDismiss:kt}),[je,In,kt]),[W,zn]=(0,Q.useState)(0),Bn=(0,Q.useCallback)(()=>(zn(e=>e+1),()=>zn(e=>e-1)),[]),Hn=(0,Q.useMemo)(()=>({submitButton:Nn,draftSaveButton:Fn,cancelButton:Pn,submissionNotice:Ln,claimFooter:Bn,footerClaimed:W>0}),[Nn,Fn,Pn,Ln,Bn,W]),Un=(0,Q.useMemo)(()=>{if(Lt)return String(Ft?.operationIdentifier??U.resolveSingleResourceReadOperation(A,_)?.operationIdentifier??J.READ)},[Ft,Lt,A,_]),Wn=(0,Q.useMemo)(()=>!Lt||!Un?[]:[{resourceType:A,operation:Un}],[Lt,A,Un]),Gn=(0,Q.useMemo)(()=>[`components.${K.RESOURCES_LAYOUTS_CREATE}`],[]),Kn=(0,Q.useMemo)(()=>Lt?[{id:`form-data`,isReady:se}]:[],[Lt,se]),qn=(0,Q.useMemo)(()=>({errorNetwork:y(K.RESOURCES_LAYOUTS_CREATE,`autosaveErrorNetwork`),errorValidation:y(K.RESOURCES_LAYOUTS_CREATE,`autosaveErrorValidation`),errorGeneric:y(K.RESOURCES_LAYOUTS_CREATE,`autosaveErrorGeneric`),errorConflict:y(K.RESOURCES_LAYOUTS_CREATE,`autosaveErrorConflict`),errorResourceDeleted:y(K.RESOURCES_LAYOUTS_CREATE,`autosaveErrorResourceDeleted`)}),[y]),Jn=(0,Q.useMemo)(()=>{if(!Le)return null;if(Ke){let e=Ke,t=g(M.operationIdentifier)?null:jR(Le,We?.discriminatorField).map(e=>e.name),n=()=>(0,$.jsxs)($.Fragment,{children:[t?(0,$.jsx)(sB,{Template:e,requestFieldNames:t}):(0,$.jsx)(e,{}),(0,$.jsx)(iE,{})]});return n.displayName=`ResourceFormTemplate(explicit)`,n}let e=FR(Le,{inheritanceConfig:We,includeSubmitButton:!1,includeErrorSummary:s}),t=()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(e,{}),(0,$.jsx)(iE,{})]});return t.displayName=`ResourceFormTemplate`,t},[Ke,Le,We,s,M.operationIdentifier]);if(!x)return null;if(_e){let e=y(K.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:_e.message})]})})}if(Lt&&se&&!zt.isLoading&&!zt.isEnabled){let e=y(K.RESOURCES_LAYOUTS_CREATE,`operationUnavailableTitle`),t=y(K.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 Yn=Lt?Bt??f:Ut??f;if(!Le){let e=y(K.RESOURCES_LAYOUTS_CREATE,`configurationError`),t=y(K.RESOURCES_LAYOUTS_CREATE,`noSchemaFound`,{operation:z,resource:A});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 Xn=y(K.RESOURCES_LAYOUTS_CREATE,`confirmPublishTitle`),Zn=y(K.RESOURCES_LAYOUTS_CREATE,`confirmPublishMessage`),Qn=y(K.RESOURCES_LAYOUTS_CREATE,`cancel`),$n=y(K.RESOURCES_LAYOUTS_CREATE,`publish`),er=Pe?{message:y(K.RESOURCES_LAYOUTS_CREATE,`remoteUpdateMessage`),dismissAriaLabel:y(K.RESOURCES_LAYOUTS_CREATE,`dismiss`)}:void 0,tr=(0,$.jsx)(Zy,{i18nKeys:Gn,loadingScopes:Wn,readiness:Kn,children:(0,$.jsxs)(`div`,{className:a,children:[(0,$.jsx)(Iw,{open:!!we,onOpenChange:e=>!e&&bn(),children:(0,$.jsxs)(Rw,{children:[(0,$.jsxs)(zw,{children:[(0,$.jsx)(Vw,{children:Xn}),(0,$.jsx)(Hw,{children:Zn})]}),(0,$.jsxs)(Bw,{children:[(0,$.jsx)(Ww,{onClick:bn,children:Qn}),(0,$.jsx)(Uw,{onClick:yn,children:$n})]})]})}),Ee!==null&&(0,$.jsx)(kw,{open:!0,onOpenChange:e=>{e||Mn()},cancelCallback:Mn,validationCallback:jn,label:En,confirmLabel:En,description:wn,detail:Tn,requireTypedConfirmation:Sn,confirmationPhrase:Sn?En:``}),Pe&&er&&(0,$.jsx)(Pz,{type:`remote-update`,changedFields:Pe.changedFields,labels:er,onDismiss:()=>Fe(null)}),(0,$.jsx)(TE.Provider,{value:nn,children:(0,$.jsx)(nE,{value:Hn,children:(0,$.jsx)(eE,{schema:Le,defaultValues:Yn,onSubmit:An,onError:on,validationMode:c,disabled:i||le,labels:At,layoutRefs:He,operationRef:z,operationType:V,operationLike:re,coreOperation:ne,fileUploadContext:Mt,contextFieldValues:Ze,hiddenFieldNames:dt,generatedFieldOverrides:Dt,allowedValuesByField:ut,roleGrantPickerOffersByField:lt,requestFieldOffers:M.requestFieldOffers,requestFieldOfferRecord:Lt?pe:void 0,inheritanceConfig:We,onSectionSave:Cde({writesRecordFields:Fl(ne),hasCallerSectionHandler:d!==void 0})?un:void 0,onFormReady:sn,warnOnUnsavedChanges:!0,validateFieldUrl:Nt,resourceType:A,hostResolvesRelationshipRoots:!0,resourceId:Pt,contextResourceIdentifiers:H,parentResourcesRequirements:e.parentResourcesRequirements,navigationZone:p,chromeMode:Ue,layoutTemplate:Jn},he)})})]})});return mn.enabled?(0,$.jsxs)(CE,{labels:qn,validateField:cn,onSave:ln,rmm:xt??void 0,config:mn,children:[(0,$.jsx)(lB,{cancelRef:D}),tr]}):tr}function lB({cancelRef:e}){let t=SE();return Q.useEffect(()=>(t&&(e.current=t.cancelAllPending),()=>{e.current=null}),[t,e]),null}function uB({draftSchema:e,onSaveDraft:t,disabled:n,isSavingDraft:r,label:i,savingLabel:a,omitClearedFields:o,submissionSchema:s}){let c=LC(),l=jT(),u=(0,Q.useCallback)(async()=>{if(!c)return;let n=c.getValues(),r=e.safeParse(gT(n,e));if(r.success){let e=HT(r.data,{hiddenFieldNames:l?.hiddenFieldNames,contextFieldValues:l?.contextFieldValues,omitClearedFields:o,schema:s});c.clearErrors(),await t(e)}else{let e=dT(r.error.issues),t=Object.keys(e);for(let[t,n]of Object.entries(e))c.setError(t,n);WD(t)}},[c,l?.contextFieldValues,l?.hiddenFieldNames,e,t]);return(0,$.jsx)(Y,{type:`button`,variant:X.OUTLINE,disabled:n,onClick:u,children:r?a:i})}var dB;(function(e){e.SHELL=`shell`,e.SURFACE=`surface`})(dB||={});function fB(e,t,n=!0){return e||(n?t:ql.PRIMARY)}function pB({preset:e=H.DEFAULT,host:t=dB.SHELL,...n}){let r=(0,Q.useContext)(Xg)?.navigationLayout?.backAffordanceOwner;if(!(t===dB.SHELL?nc(r):Ls(r)))return null;let i=qc(K.APPLICATION_LEVEL_NAVIGATION_BACK,`ApplicationLevel_NavigationBack`)(e);return(0,$.jsx)(i,{...n})}var mB=rc(K.LOW_LEVEL_BREADCRUMB,`Breadcrumb`,[`List`,`Item`,`Link`,`Page`,`Separator`,`Ellipsis`]);function hB({preset:e=H.DEFAULT,...t}){let n=mB(e);return(0,$.jsx)(n,{...t})}function gB({preset:e=H.DEFAULT,...t}){let n=mB(e);return(0,$.jsx)(n.List,{...t})}function _B({preset:e=H.DEFAULT,...t}){let n=mB(e);return(0,$.jsx)(n.Item,{...t})}function vB({preset:e=H.DEFAULT,...t}){let n=mB(e);return(0,$.jsx)(n.Link,{...t})}function yB({preset:e=H.DEFAULT,...t}){let n=mB(e);return(0,$.jsx)(n.Page,{...t})}function bB({preset:e=H.DEFAULT,...t}){let n=mB(e);return(0,$.jsx)(n.Separator,{...t})}function xB({preset:e=H.DEFAULT,...t}){let n=mB(e);return(0,$.jsx)(n.Ellipsis,{...t})}function SB(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 CB(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 wB=({resourceContext:e,navigationZone:t,navigationInitiator:n,maxDepth:r=5})=>{let{resourceType:i,contextResourceIdentifiers:a,parentResourcesRequirements:o}=e,{registry:s,doOperation:c}=fm(),l=aS(),{tResourceHeader:u,t:d,formatDate:f,formatDateTime:p,isReady:m}=q({resource:i}),{navigate:h}=yS(),g=(0,Q.useRef)(c);g.current=c;let _=(0,Q.useMemo)(()=>CB({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=U.buildForeignKeyFetchParams(e.resourceType,e.resourceId,s),r=SB({segment:e,contextResourceIdentifiers:a}),i=t?fh({resourceConfig:t,operations:(t.operations??[]).filter(t=>Ux(t,e.resourceType,l)),coreOperation:J.READ,registry:s,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:r,contextualParameters:{...U.buildContextualParameters(r,s),...n.contextualParameters??{}}}):void 0,o=U.tryBuildForeignKeyReadOperationPath(e.resourceType,s,i),c=()=>{let t=Kp({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:{...U.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:U.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=SB({segment:e,contextResourceIdentifiers:a}),r=fh({resourceConfig:t,operations:(t.operations??[]).filter(t=>!cd(t.operationFrontendConfig)&&Ux(t,e.resourceType,l)),coreOperation:J.READ,registry:s,hasResourceId:!0,contextResourceIdentifiers:n,contextualParameters:U.buildContextualParameters(n,s)});if(r)return{segmentResourceConfig:t,segmentContextIdentifiers:n,readOp:r}},S=(0,Q.useMemo)(()=>new Map(_.map(e=>[TB(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=kn.createFrontendResourceOperationContextFromOperation({resourceType:e.resourceType,operation:o,contextResourceIdentifiers:a,isOperationDefault:!0,parentResourcesRequirements:e.ancestorRequirements}),l;if(Ei(o.operationFrontendConfig)){let t=Tl.buildOperationFrontendRoutePaths(i,o,s.allResourceFieldIdentifiers);l=kn.selectMatchingRoutePath(t,a,i.resourceIdentifier,i.resourceFieldIdentifier,e.ancestorRequirements)?.url}h({content:{contentType:Sa.RESOURCE_OPERATION,resourceContext:c},urlPath:l,initiator:{sourceZone:t}})};return _.length===0||!m?null:(0,$.jsx)(hB,{children:(0,$.jsx)(gB,{children:b.map(e=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(_B,{children:S.get(TB(e))?(0,$.jsx)(vB,{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)(bB,{})]},TB(e)))})})};function TB(e){return`${e.resourceType}-${e.resourceId}`}function EB({preset:e=H.DEFAULT,...t}){let n=qc(K.RESOURCES_LAYOUTS_BREADCRUMB,`ResourceLayout_Breadcrumb`)(e);return(0,$.jsx)(n,{...t})}var DB=tl.getLogger(),OB=DB.debugByType(`AutomaticDisplayer`);DB.setDebugTypeLogging(`AutomaticDisplayer`,!1);function kB({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=wl.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}=fm(),A=(0,Q.useContext)(Xg)?.UIConfig?.currentBreakpoint??Yo.DESKTOP,{fieldLabels:j,fieldDescriptions:M,fieldTooltips:N,enumLabels:P,sectionLabels:F,sectionDescriptions:I,groupLabels:L}=QT(e,r?.resourceContext,t,`display`,{layoutRefs:i,fieldPathPrefix:r?.fieldPathPrefix,overrides:{fields:r?.fields,enums:r?.enums,sections:r?.sections}}),R=iS(th(a,o,c)),z=(0,Q.useCallback)(()=>{if(d===null)return null;if(d!==void 0){let e=d.variantType===oe.API_CALL,t=d.resourceOperationLike??d.operationIdentifier,n=d.operationIdentifier===J.UPDATE;if(!e||!n||d.isBulkOperation===!0||t!==J.UPDATE)throw OB(`Rejected invalid inlineEditOperation`,{operationIdentifier:String(d.operationIdentifier),variantType:d.variantType,variantKey:d.variantKey,isBulkOperation:d.isBulkOperation,effectiveOperation:String(t)}),new sj(`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=U.getResourceFieldIdentifierForType(a,k),n=kn.buildRecordIdentifiersFromCollection(c,a,o),r={...s??{},[t]:o};return ph({resourceConfig:e,operations:e.operations??[],registry:k,hasResourceId:kn.getResourceId(n[a]).length>0,requireFrontendAddressable:!0,contextResourceIdentifiers:n,contextualParameters:r,viewer:R})??null},[c,s,d,k,o,a,R]),B=(0,Q.useMemo)(()=>z()!==null,[z]),ee=(0,Q.useMemo)(()=>DE(e),[e]),te=(0,Q.useCallback)(async(n,r)=>{let i=e?Na(e,n):void 0,c=i?ur(i,r):r;if(OB(`doInlineUpdate`,{fieldName:n,path:p?`custom`:_?`rmm`:`fallback`}),p)await p(n,c),g?.(n,c);else if(_){let e=d?{operationPathKey:no.createOperationPathKeyFromOperation(d)}:void 0,t=await _.queueMutation({[n]:c},{type:sE.INLINE,priority:mE.LOW,source:{type:cE.DISPLAY,subscriberId:`display-inline`},transportOverride:e});if(!t.success)throw new sj(t.error?.message??`Inline edit failed`,t.error);g?.(n,c)}else if(Vn(v)&&a&&o){let e=z();if(!e)throw Error(`No UPDATE operation configured for resource "${a}". Inline editing requires an UPDATE.default operation.`);let r=no.createOperationPathKeyFromOperation(e),i=U.getResourceFieldIdentifierForType(a,k),u={...s,[i]:o};await O(r,{contextualParameters:u,parentResourcesRequirements:l,requestData:OE(oA(t,n,c),ee,t)}),g?.(n,c)}else throw new ir({surfaceName:`AutomaticDisplayer inline edit`,resourceType:a??`unknown`,operationIdentifier:d?.operationIdentifier??J.UPDATE})},[p,_,a,o,s,l,O,k,g,z,v,d,ee,t,e]),ne=!m&&(!!p||!!_||Vn(v)&&!!a&&!!o&&B),V=(0,Q.useMemo)(()=>({resourceType:a,resourceId:o,doInlineUpdate:te,canInlineEdit:ne,defaultInlineEdit:S,defaultEmptyValue:C,fileUploadContext:h,contextualParameters:s,contextResourceIdentifiers:c,navigationZone:u,parentReferenceConfig:f,rmm:_}),[a,o,te,ne,S,C,h,s,c,u,f,_]),re=(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:L,defaultSectionAppearance:w,breakpoint:A,hiddenFieldNames:T,inlineEditDisabledFieldNames:E,onFileActivationOperation:D}),[e,t,b,j,M,N,P,F,I,L,w,A,T,E,D]);return(0,$.jsx)(aj.Provider,{value:V,children:(0,$.jsx)(mA.Provider,{value:!1,children:(0,$.jsx)(rk,{displayChromeMode:x,children:(0,$.jsx)($O,{value:re,children:(0,$.jsx)(`div`,{className:G(`space-y-section`,n),children:y?Q.createElement(y):null})})})})})}kB.displayName=`AutomaticDisplayer`;var AB=kB,jB=(0,Q.createContext)(null);function MB({value:e,children:t}){return(0,$.jsx)(jB.Provider,{value:e,children:t})}function NB(){return(0,Q.useContext)(jB)}function PB({title:e,hostProvidesHeading:t,className:n}){let r=G(`min-w-0 truncate`,IB(),n);return t?(0,$.jsx)(`h2`,{className:r,children:e}):(0,$.jsx)(`h1`,{className:r,children:e})}function FB({className:e}){return(0,$.jsx)(`div`,{className:G(`min-w-0`,IB(),e),"aria-hidden":`true`,"data-resource-header-title-pending":`true`,children:(0,$.jsx)(pm,{className:`h-[1lh] w-48 max-w-full`})})}function IB(){let e=(0,Q.useContext)(Xg);return(e?e.getRecipe(It.TYPOGRAPHY,Ea.RESOURCE_TITLE):Eg.typography?.[Ea.RESOURCE_TITLE])?.base}function LB({className:e}){let t=NB();t?.titleMountTracker&&(t.titleMountTracker.titleMounted=!0);let n=t?.title,r=n?(0,$.jsx)(PB,{title:n,hostProvidesHeading:t?.hostProvidesHeading,className:e}):t?.titlePending?(0,$.jsx)(FB,{}):null;return r?t?.titleTarget===void 0?r:t.titleTarget?(0,SN.createPortal)(r,t.titleTarget):null:null}function RB({children:e}){let t=NB();return t?.leadingTarget===void 0?(0,$.jsx)($.Fragment,{children:e}):t.leadingTarget?(0,SN.createPortal)(e,t.leadingTarget):null}var zB=(0,Q.createContext)(null);function BB({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)(zB.Provider,{value:d,children:n})}function VB(e){let t=(0,Q.useContext)(zB);return!!t&&t.zone===e}var HB;(function(e){e.OWN_ROW=`own_row`,e.IN_HEADER=`in_header`,e.OVERLAY=`overlay`})(HB||={});function UB(){let e=(0,Q.useContext)(zB);return!e||e.claimant==null?HB.OWN_ROW:e.claimantOnScreen?HB.IN_HEADER:HB.OVERLAY}function WB({children:e}){let t=UB();return t===HB.IN_HEADER?null:(0,$.jsx)(`div`,{className:G(`pointer-events-none sticky top-0 z-10 flex justify-end gap-element`,t===HB.OVERLAY&&`-mb-8`),"data-zone-chrome-presence":t,children:e})}function GB(e,t,n=!0){let r=(0,Q.useContext)(zB),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 KB=`@container/resource-header`,qB=new Set([J.READ,J.LIST,J.SEARCH,J.COUNT,J.DELETE,J.DELETE_MANY]);function JB(e,t){if(e.resourceType!==t.resourceType||e.isBulkOperation)return!1;let n=vl(e.operation??{operationIdentifier:e.operationIdentifier});return n!==void 0&&qB.has(n)?!1:XB(e,t)}function YB(e,t){return e.resourceType!==t.resourceType||e.isBulkOperation||e.relaysRowDeletion||vl(e.operation??{operationIdentifier:e.operationIdentifier})!==J.READ?!1:XB(e,t)}function XB(e,t){let n=e.contextResourceIdentifiers?.[t.resourceType];if(n==null)return!1;let r=String(kn.getResourceId(n));return t.shownRowIds.some(e=>e!=null&&e!==``&&e===r)}function ZB(e){let{on:t}=Uo(),[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=>JB(e,{resourceType:a,shownRowIds:i.current})),n=t(hc.RESOURCE_REFRESH,()=>r({at:Date.now(),madeElsewhere:!0}),e=>YB(e,{resourceType:a,shownRowIds:i.current}));return()=>{e(),n()}},[o,t,a]),n}function QB({className:e,actions:t,bar:n}){return(0,$.jsxs)(`div`,{className:G(e||`flex-1`,KB,`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)(FB,{})}),t&&(0,$.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center`,children:(0,$.jsx)(KS,{children:t})})]})]})}var $B=({resourceContext:e,navigationZone:t,navigationInitiator:n,title:r,description:i,className:a,actions:o,parentReferenceConfig:s,heldRecord:c})=>{let l=Hk(),u=tC(),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}=q({component:K.RESOURCES_LAYOUTS_HEADER,resource:p}),S=cp(),{registry:C,doOperation:w}=fm(),{renderIcon:T}=ef();String(m.operationIdentifier);let E=kn.getPrimaryResourceIdentifier(f),D=(0,Q.useMemo)(()=>C.resourceConfigurations[p],[C,p]),O=d?.resourceConfig??D,k=U.frontendResourceLabelDefinitionOf(O),A=vl(m),M=Ao(m),N=A===J.READ?O?.frontendConfiguration?.layout?.header:void 0,P=!!k&&!!E&&M,F=(!!k||!!N)&&!!E&&M,I=!!O,[L,R]=(0,Q.useState)(void 0),[z,B]=(0,Q.useState)(!1),ee=c!==void 0,te=c?c.record:L,ne=c?c.record===void 0&&!c.failed:z,[V,re]=(0,Q.useState)(null),ie=(0,Q.useMemo)(()=>U.buildContextResourceIdentifiersKey(h),[h]),ae=(0,Q.useMemo)(()=>U.buildContextualParameters(h,C),[ie,C]),oe=d?.contextualParameters??ae,se=(0,Q.useMemo)(()=>Object.entries(oe).map(([e,t])=>`${e}:${t}`).sort().join(`|`),[oe]),ce=(0,Q.useMemo)(()=>JSON.stringify(f.parentResourcesRequirements??null),[f.parentResourcesRequirements]),le=(0,Q.useMemo)(()=>m.operationIdentifier===J.READ?m:d?.resolvePreferredOperation(J.READ,{requireAddressable:!0})??yz(p,C,{hasResourceId:!!E,contextResourceIdentifiers:h,contextualParameters:oe}),[m,d,p,C,E,h,oe]),ue=(0,Q.useMemo)(()=>U.tryBuildForeignKeyReadOperationPath(p,C,le),[p,C,le]),de=qy(og({resourceType:p,operation:le?le.operationIdentifier??J.READ:J.READ,discriminator:E??void 0})),fe=(0,Q.useRef)(w);(0,Q.useEffect)(()=>{fe.current=w},[w]);let pe=ZB({resourceType:p,rowIds:[E?String(E):null,L&&(typeof L._id==`string`||typeof L._id==`number`)?String(L._id):null],enabled:!ee&&F&&!!E}),me=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(ee||!F||!O||!ue)return;let e=!1,t=`${ue}|${ie}|${se}|${ce}`,n=me.current===t;return me.current=t,(async()=>{n||(B(!0),R(void 0)),re(null);try{let t=await fe.current(ue,{contextualParameters:oe,parentResourcesRequirements:f.parentResourcesRequirements});if(e)return;t&&typeof t==`object`&&!Array.isArray(t)&&R(t)}catch(t){if(e)return;let r=j(t);tl.getLogger().error(`[ResourceLayoutPreset_Header_Default] Error fetching resource label:`,{resourceType:p,operationPathKey:ue,...r,error:t}),re({...r,message:S(t)}),n||R(void 0)}finally{e||B(!1)}})(),()=>{e=!0}},[ee,F,ue,ie,se,ce,I,p,pe?.at]);let he=(0,Q.useMemo)(()=>!te||!P?null:U.computeFrontendResourceLabel({resourceType:p,registry:C,currentObject:te,objectContext:f,initiatorUserContext:void 0,t:v,formatDate:y,formatDateTime:b}),[te,P,p,C,f,v,y,b]),ge=bo(m.operationIdentifier,O?.operations),_e=(0,Q.useMemo)(()=>r||_(p,ge,`title`),[r,_,p,ge]),ve=A===J.LIST||A===J.SEARCH,ye=Bo(m),be=!ye&&P?he:null,xe=(0,Q.useMemo)(()=>i||be||(ve?Hp({tResourceHeader:g,resourceType:p})??null:null),[i,be,ve,g,p]),Se=(0,Q.useMemo)(()=>P&&ye?ne||de.isInitialLoad?null:he||(E?`#${E}`:null):null,[P,ye,ne,de.isInitialLoad,he,E]),Ce=m.operationFrontendConfig?.headerIconPlacement,we=(0,Q.useMemo)(()=>Ce===ot.TEMPLATE_OWNED?null:T({category:nn.RESOURCES,resourceType:p},{size:tr.MD}),[T,p,Ce]),Te=!!Se,Ee=l&&!Te,De=P&&ye&&!Te&&(ne||de.isInitialLoad),Oe=(0,Q.useMemo)(()=>U.resolveRowSchema(O,te),[O,te]),ke=(0,Q.useMemo)(()=>({resourceContext:{resourceType:p,operationId:J.READ}}),[p]),[Ae,je]=(0,Q.useState)(null),[Me,Ne]=(0,Q.useState)(null),[Pe,Fe]=(0,Q.useState)(null),[Ie,Le]=(0,Q.useState)(!0);(0,Q.useEffect)(()=>{if(!Pe||typeof IntersectionObserver>`u`)return;let e=new IntersectionObserver(e=>{let t=e[e.length-1];t&&Le(t.isIntersecting)});if(typeof e?.observe==`function`)return e.observe(Pe),()=>e.disconnect?.()},[Pe]);let Re=VB(t)&&!l,ze=GB(t,!l&&(x||De),Ie),Be=(0,Q.useMemo)(()=>{if(l||Ko.resolve(K.RESOURCES_LAYOUTS_BREADCRUMB,H.DEFAULT)!==wB)return s;let e=CB({parentResourcesRequirements:f.parentResourcesRequirements,contextResourceIdentifiers:f.contextResourceIdentifiers});if(s)return e.some(e=>e.resourceType===s.parentResourceType&&e.resourceId===s.parentResourceId)?{...s,displayMode:iu.NONE}:s;let t=e[e.length-1];return t?{parentResourceType:t.resourceType,parentResourceId:t.resourceId,displayMode:iu.NONE}:void 0},[s,l,f.parentResourcesRequirements,f.contextResourceIdentifiers]),Ve=(0,Q.useRef)({titleMounted:!1}).current,He=(0,Q.useMemo)(()=>({resourceType:p,title:Te?Se:l&&De?null:_e,titlePending:De&&(l||!_e),titleMountTracker:Ve,hostProvidesHeading:l,titleTarget:Ae,leadingTarget:Me}),[p,Te,Se,_e,Ve,l,De,Ae,Me]);(0,Q.useEffect)(()=>{});let Ue=(0,$.jsxs)(`div`,{ref:Fe,className:G(`flex min-w-0 items-center gap-element pb-item-sm`,Re?`min-h-8`:`empty:hidden`),"data-slot":`resource-header-bar`,children:[(0,$.jsx)(pB,{host:dB.SURFACE,navigationZone:t}),!l&&(0,$.jsx)(EB,{resourceContext:f,navigationZone:t,navigationInitiator:n}),ze&&(0,$.jsx)(`div`,{className:`ms-auto flex shrink-0 items-center gap-element`,children:ze})]});if(!x)return De?(0,$.jsx)(QB,{className:a,actions:o,bar:Ue}):o?(0,$.jsx)(`div`,{className:G(`flex items-center justify-end gap-field`,a),children:(0,$.jsx)(KS,{children:o})}):null;if(Ee)return De?(0,$.jsx)(QB,{className:a,actions:o}):o?(0,$.jsx)(`div`,{className:G(`flex items-center justify-end gap-field`,a),children:(0,$.jsx)(KS,{children:o})}):null;let We=!!N&&!!Oe;return(0,$.jsxs)(`div`,{className:G(a||`flex-1`,KB,`flex min-w-0 flex-col`),"data-slot":`resource-header`,children:[Ue,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-field`,"data-slot":`resource-header-title-line`,children:[we&&(0,$.jsx)(`div`,{className:`shrink-0`,children:we}),We&&(0,$.jsx)(`span`,{ref:Ne,className:`flex shrink-0 items-center gap-field empty:hidden`,"data-slot":`resource-header-leading`}),We?(0,$.jsx)(`div`,{ref:je,className:`flex min-w-0 flex-1 basis-60 items-center`,"data-slot":`resource-header-title`}):(0,$.jsx)(PB,{title:(Te?Se:_e)??``,hostProvidesHeading:l,className:`flex-1 basis-60`}),o&&(0,$.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center`,children:(0,$.jsx)(KS,{children:o})})]}),We&&(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)(MB,{value:He,children:(0,$.jsx)(AB,{schema:Oe,data:te,labels:ke,resourceType:p,resourceId:E?String(E):void 0,contextualParameters:oe,contextResourceIdentifiers:h,parentResourcesRequirements:f.parentResourcesRequirements,navigationZone:t,parentReferenceConfig:Be,disableInlineEdit:!0,layoutTemplate:N,defaultDisplayChromeMode:Cu.INLINE,isLoading:!te})})}),!Te&&xe&&(0,$.jsx)(`p`,{className:`mt-item-xs text-sm text-muted-foreground`,children:xe}),V&&(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:V.message,children:[T(W.WARNING,{size:tr.XS}),(0,$.jsx)(`span`,{children:V.message})]})]})};function eV({preset:e=H.DEFAULT,...t}){let n=qc(K.RESOURCES_LAYOUTS_HEADER,`ResourceLayout_Header`)(e);return(0,$.jsx)(n,{...t})}function tV({onSuccess:e,errorMessage:t,errorComponent:n}){let{resourceContext:r,resourceType:i,operation:a,reportError:o,goBackWithinZone:s,navigateToPreferredRead:c,executeCurrentOperation:l}=eC(),{doOperation:u,registry:d}=fm(),{tComponent:f}=q({component:K.RESOURCES_LAYOUTS_ACTION,resource:i}),p=(0,Q.useRef)(u);p.current=u;let[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(null),b=(0,Q.useMemo)(()=>el(a),[a]),x=b&&Vn(eo(a,d.resourceConfigurations[i]?.operations)),S=(0,Q.useMemo)(()=>JSON.stringify({contextResourceIdentifiers:U.buildContextResourceIdentifiersKey(r.contextResourceIdentifiers??{}),parentResourcesRequirements:r.parentResourcesRequirements??[]}),[r.contextResourceIdentifiers,r.parentResourcesRequirements]),C=(0,Q.useMemo)(()=>{let e=r.contextResourceIdentifiers?.[i];return e?kn.getResourceId(e)??null:null},[r.contextResourceIdentifiers,i])??(v?.contextKey===S&&typeof v.row._id==`string`&&v.row._id.length>0?v.row._id:null),w=(0,Q.useMemo)(()=>!C||r.contextResourceIdentifiers?.[i]?r.contextResourceIdentifiers:{...r.contextResourceIdentifiers,[i]:C},[r.contextResourceIdentifiers,C,i]),T=(0,Q.useMemo)(()=>U.buildContextualParameters(w,d),[w,d]),E=a?.variantKey,D=a?.admitsCrossTenantPlatformAdministration===!0,O=(0,Q.useMemo)(()=>({variantKey:E,admitsCrossTenantPlatformAdministration:D}),[D,E]),k=(0,Q.useMemo)(()=>bz(i,d,{hasResourceId:!!C,contextResourceIdentifiers:w,contextualParameters:T,actingOperation:O}),[w,T,C,O,d,i]),{rmm:A}=Az({resourceType:i,resourceId:C,doOperationRef:p,contextualParameters:T,parentResourcesRequirements:r.parentResourcesRequirements,contextResourceIdentifiers:w,resourceSchema:d.resourceConfigurations[i]?.mainSchema,resourceInheritance:d.resourceConfigurations[i]?.inheritenceSchemaDefinition,enabled:b&&!!C,conflictPolicy:{strategy:dE.ACCEPT_REMOTE},directFallbackAccepted:x,actingOperation:O}),j=(0,Q.useMemo)(()=>yp({tComponent:f,componentType:K.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),[f]),M=$R((0,Q.useMemo)(()=>w===r.contextResourceIdentifiers?r:{...r,contextResourceIdentifiers:w},[w,r]),a),N=(0,Q.useContext)(lh),P=(0,Q.useRef)(N);P.current=N;let F=(0,Q.useCallback)((t,n)=>{Ht(t)&&P.current?.notifyInfo(yp({tComponent:f,componentType:K.RESOURCES_LAYOUTS_ACTION,key:`operationSentForApproval`})),M(t),n&&!Ht(t)?(e?.(t),c({contextResourceIdentifiers:n})):e?e(t):s()},[M,s,c,e,f]),I=(0,Q.useCallback)(e=>F(e,b&&!Ht(e)?XR({resourceType:i,contextResourceIdentifiers:w,rowValues:e,registry:d}):void 0),[w,b,d,i,F]),L=(0,Q.useCallback)(e=>{o(e,t,n)},[n,t,o]);return(0,Q.useEffect)(()=>{if(!b||C||!k)return;let e=!1;return _(!0),Sz({doOperation:p.current,readOperationPathKey:k,contextualParameters:T,parentResourcesRequirements:r.parentResourcesRequirements}).then(t=>{e||y({contextKey:S,row:t})}).catch(t=>{e||L(t instanceof Error?t:Error(String(t)))}).finally(()=>{e||_(!1)}),()=>{e=!0}},[S,k,T,r.parentResourcesRequirements,C,L,b]),(0,Q.useEffect)(()=>{if(A&&v&&v.contextKey===S&&(typeof A.getSnapshot!=`function`||A.getSnapshot().confirmedData===null)&&typeof A.setInitialState==`function`){let e=v.row;A.setInitialState(e,e._version??0,e._field_meta)}},[S,v,A]),{execute:(0,Q.useCallback)(async e=>{h(!0);try{let t,n=b?XR({resourceType:i,contextResourceIdentifiers:w,rowValues:ZR(e,QR(a)),registry:d}):void 0;if(b&&(A||!x)){if(!A)throw new ir({surfaceName:`useOperationDirectExecution`,resourceType:i,operationIdentifier:String(a.operationIdentifier)});let o=await A.queueMutation({},{type:sE.CUSTOM,priority:mE.HIGH,source:{type:cE.CUSTOM,subscriberId:`direct-execution:${String(a.operationIdentifier)}`},transportOverride:{operationPathKey:no.createOperationPathKeyFromOperation(a),contextualParameters:T,parentResourcesRequirements:r.parentResourcesRequirements,requestData:e??{},readBackOnSuccess:n===void 0}});if(!o.success)throw qR(o.error,j);t=o.heldForApproval??o.responseData}else if(b){if(!C)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 p.current(no.createOperationPathKeyFromOperation(a),{contextualParameters:T,parentResourcesRequirements:r.parentResourcesRequirements,requestData:e??{}})}else t=await l(e);F(t,n)}catch(e){L(e instanceof Error?e:Error(j))}finally{h(!1)}},[T,r.parentResourcesRequirements,w,l,L,F,x,b,C,a,i,A,j,d]),isExecuting:m,isBootstrapping:g,completeWithSuccess:I,reportFailure:L}}var nV=tl.getLogger(),rV;(function(e){e.FULL=`full`,e.COMPACT=`compact`})(rV||={});function iV({...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}=eC(),p=e.resourceContext?.operation,m=p?no.createOperationPathKeyFromOperation(p):void 0,h=f?no.createOperationPathKeyFromOperation(f):void 0;(0,Q.useEffect)(()=>{m&&h&&m!==h&&nV.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}=q({component:K.RESOURCES_LAYOUTS_ACTION,resource:d}),y=(0,Q.useMemo)(()=>[`resources.${d}`,`components.${K.RESOURCES_LAYOUTS_ACTION}`],[d]),[b,x]=(0,Q.useState)(!1),{execute:S,isExecuting:C,isBootstrapping:w,completeWithSuccess:T,reportFailure:E}=tV({onSuccess:r,errorMessage:t,errorComponent:n}),D=(0,Q.useMemo)(()=>_(d,String(f.operationIdentifier),`title`),[f.operationIdentifier,d,_]),O=(0,Q.useMemo)(()=>yp({tComponent:g,componentType:K.RESOURCES_LAYOUTS_ACTION,key:`runningAction`,params:{actionLabel:D}}),[D,g]),k=(0,Q.useCallback)(async()=>{await S()},[S]),A=!Yre(f)&&!gi(f),j=f.riskLevel===od.CRITICAL,M=(0,Q.useMemo)(()=>RS(_,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===rV.COMPACT;return v===!1?null:(0,$.jsx)(Zy,{i18nKeys:y,children:(0,$.jsxs)(`div`,{className:I?`space-y-field`:`space-y-section`,children:[!I&&(0,$.jsx)(eV,{resourceContext:c,navigationZone:l,navigationInitiator:u,actions:o}),!I&&s,A?(0,$.jsx)(cB,{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:yp({tComponent:g,componentType:K.RESOURCES_LAYOUTS_ACTION,key:`confirmMessage`})}),(0,$.jsx)(Y,{type:`button`,variant:X.DEFAULT,onClick:N,disabled:C||w,children:C||w?O:D})]}),b&&(0,$.jsx)(kw,{open:!0,onOpenChange:e=>{e||F()},cancelCallback:F,validationCallback:P,requireTypedConfirmation:!0,confirmationPhrase:M})]})})}function aV({resourceContext:e,navigationZone:t,onSuccess:n,onCancel:r,errorMessage:i,errorComponent:a}){let o=sV();return(0,$.jsx)(nC,{resourceContext:e,navigationZone:t,children:(0,$.jsx)(`div`,{ref:o,className:`contents`,"data-slot":`resource-operation-detached-host`,children:(0,$.jsx)(iV,{resourceContext:e,navigationZone:t,chrome:rV.COMPACT,onSuccess:n,onCancel:r,errorMessage:i,errorComponent:a})})})}var oV=`input:not([type="hidden"]):not([disabled]), textarea:not([disabled]), select:not([disabled]), [role="combobox"]:not([aria-disabled="true"])`;function sV(){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(oV);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 cV({resourceContext:e,navigationZone:t,onDismiss:n}){let{tComponent:r}=q({component:K.RESOURCES_LAYOUTS_ACTION}),i=(0,Q.useCallback)(()=>{n()},[n]);return(0,$.jsx)(aV,{resourceContext:e,navigationZone:t,onSuccess:i,onCancel:n,errorMessage:yp({tComponent:r,componentType:K.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),errorComponent:`ResourceOperationActionPopoverBody`})}var lV=10,uV=300,dV=2;function fV({schema:e,name:t,value:n,targetResourceType:r}){let{registry:i,doOperation:a}=fm(),{t:o,formatDate:s,formatDateTime:c,tComponent:l,tResourceFieldEdit:u}=q({component:K.RESOURCES_FIELDS_RESOURCE_REFERENCE}),d=cp(),f=MD(),p=tC(),m=(0,Q.useMemo)(()=>f?.contextResourceIdentifiers?U.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:kn.getAddressedRecordId(p.resourceContext)}:void 0,y=(0,Q.useRef)(v);y.current=v;let b=Zl(e)===jr.ARRAY,x=b&&pu(e)||e,S=(0,Q.useMemo)(()=>Tj({explicitResourceType:r,schema:Br(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,L]=(0,Q.useState)(null),R=(0,Q.useMemo)(()=>jw(n),[n]),z=(0,Q.useMemo)(()=>S?Gl(i.resourceConfigurations?.[S]?.operations??[],J.READ)??null:null,[i,S]),B=(0,Q.useCallback)(async e=>{if(S){O(!0),L(null);try{let t=U.buildForeignKeySearchOperationPath(S,i),n=U.buildForeignKeySearchParams(e,lV,{resourceType:S,registry:i}),r=kn.withoutSelfReferencingParents(_.current,S,i),a=Aw({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(pde({items:u,resourceType:S,registry:i,t:o,formatDate:s,formatDateTime:c}))}catch(t){let n=j(t);tl.getLogger().error(`[useResourceSearch] Failed to fetch options:`,{resourceType:S,query:e,...n,error:t}),L({...n,message:d(t)}),E([])}finally{O(!1)}}},[S,i,o,s,c]),ee=(0,Q.useRef)(P);ee.current=P;let te=(0,Q.useCallback)(async()=>{if(!S||R.length===0)return;let e=R.filter(e=>!ee.current.has(e));if(e.length===0)return;A(!0);let t=new Map(ee.current);for(let n of e)try{let{label:e}=await Nw({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:z,t:o,formatDate:s,formatDateTime:c});t.set(n,e)}catch{t.set(n,n)}F(t),A(!1)},[S,R,i,z,o,s,c]);(0,Q.useEffect)(()=>{te()},[te]),(0,Q.useEffect)(()=>{if(C)return h.current&&clearTimeout(h.current),M.length>=dV?h.current=setTimeout(()=>{B(M)},uV):M.length===0&&B(),()=>{h.current&&clearTimeout(h.current)}},[M,C,B]);let ne=(0,Q.useCallback)(e=>{N(e)},[]),V=(0,Q.useCallback)(e=>{w(e),e?L(null):N(``)},[]),re=(0,Q.useCallback)(e=>P.get(e)||e,[P]),ie=(0,Q.useMemo)(()=>M.length>0&&M.length<dV?l(K.RESOURCES_FIELDS_RESOURCE_REFERENCE,`minSearchChars`,{count:String(dV)}):l(K.RESOURCES_FIELDS_RESOURCE_REFERENCE,`noResults`),[M,l]),ae=f?.resourceType;return{options:T,isLoading:D,isLoadingCurrentValue:k,isOpen:C,setIsOpen:V,handleSearchChange:ne,getDisplayLabel:re,resourceType:S,isMultiple:b,normalizedValue:R,emptyMessage:ie,defaultPlaceholder:(0,Q.useMemo)(()=>{if(!b&&ae){let e=u(ae,_r.labelDictionaryPath(t),`label`);if(e)return yp({tComponent:l,componentType:K.RESOURCES_FIELDS_RESOURCE_REFERENCE,key:`selectReferencePlaceholder`,params:{target:e}})}return l(K.RESOURCES_FIELDS_RESOURCE_REFERENCE,`selectPlaceholder`)},[ae,b,t,l,u]),fetchError:I}}var pV=rc(K.LOW_LEVEL_COMMAND,`Command`,[`Dialog`,`Input`,`List`,`Empty`,`Group`,`Item`,`Shortcut`,`Separator`]);function mV({preset:e=H.DEFAULT,...t}){let n=pV(e);return(0,$.jsx)(n,{...t})}function hV({preset:e=H.DEFAULT,...t}){let n=pV(e);return(0,$.jsx)(n.Dialog,{...t})}function gV({preset:e=H.DEFAULT,...t}){let n=pV(e);return(0,$.jsx)(n.Input,{...t})}function _V({preset:e=H.DEFAULT,...t}){let n=pV(e);return(0,$.jsx)(n.List,{...t})}function vV({preset:e=H.DEFAULT,...t}){let n=pV(e);return(0,$.jsx)(n.Empty,{...t})}function yV({preset:e=H.DEFAULT,...t}){let n=pV(e);return(0,$.jsx)(n.Group,{...t})}function bV({preset:e=H.DEFAULT,...t}){let n=pV(e);return(0,$.jsx)(n.Item,{...t})}function xV({preset:e=H.DEFAULT,...t}){let n=pV(e);return(0,$.jsx)(n.Shortcut,{...t})}function SV({preset:e=H.DEFAULT,...t}){let n=pV(e);return(0,$.jsx)(n.Separator,{...t})}var CV=7;function wV({resourceContext:e,navigationZone:t,currentValue:n,onDismiss:r}){return(0,$.jsx)(nC,{resourceContext:e,navigationZone:t,children:(0,$.jsx)(TV,{currentValue:n,onDismiss:r})})}function TV({currentValue:e,onDismiss:t}){let{operation:n,resourceType:r}=eC(),{tComponent:i}=q({component:K.RESOURCES_LAYOUTS_ACTION,resource:r}),a=(0,Q.useMemo)(()=>Ys(n),[n]),{execute:o,isExecuting:s,isBootstrapping:c}=tV({onSuccess:t,errorMessage:yp({tComponent:i,componentType:K.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===Ate.REFERENCE?(0,$.jsx)(DV,{choice:a,currentValue:e,busy:u,onPick:l}):(0,$.jsx)(EV,{choice:a,currentValue:e,busy:u,onPick:l})}function EV({choice:e,currentValue:t,busy:n,onPick:r}){let{resourceType:i,operation:a}=eC(),{tComponent:o,isReady:s}=q({component:K.LOW_LEVEL_FORM_FIELD}),{enumLabels:c,isReady:l}=QT(a.requestDto,{resourceType:i,operationId:String(a.operationIdentifier)},void 0,`edit`),u=(0,Q.useMemo)(()=>pt(e.fieldSchema)??[],[e.fieldSchema]),d=c[e.fieldName],f=u.length>CV;return s===!1||l===!1?(0,$.jsx)(OV,{}):(0,$.jsxs)(mV,{shouldFilter:f,children:[f&&(0,$.jsx)(gV,{placeholder:o(K.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`)}),(0,$.jsxs)(_V,{children:[(0,$.jsx)(vV,{children:o(K.LOW_LEVEL_FORM_FIELD,`noResults`)}),(0,$.jsx)(yV,{children:u.map(e=>{let i=d?.[e]??e;return(0,$.jsx)(kV,{value:e,label:i,isCurrent:e===t,disabled:n,onPick:r},e)})})]})]})}function DV({choice:e,currentValue:t,busy:n,onPick:r}){let{tComponent:i,isReady:a}=q({component:K.LOW_LEVEL_FORM_FIELD}),{options:o,isLoading:s,setIsOpen:c,handleSearchChange:l,emptyMessage:u,fetchError:d}=fV({schema:e.fieldSchema,name:e.fieldName,value:t});return(0,Q.useEffect)(()=>(c(!0),()=>c(!1)),[]),a===!1?(0,$.jsx)(OV,{}):(0,$.jsxs)(mV,{shouldFilter:!1,children:[(0,$.jsx)(gV,{placeholder:i(K.LOW_LEVEL_FORM_FIELD,`searchPlaceholder`),onValueChange:l,autoFocus:!0}),(0,$.jsxs)(_V,{children:[(0,$.jsx)(vV,{children:s?(0,$.jsx)(OV,{}):d?.message??u}),(0,$.jsx)(yV,{children:o.map(e=>(0,$.jsx)(kV,{value:e.value,label:e.label,isCurrent:e.value===t,disabled:n||e.disabled===!0,onPick:r},e.value))})]})]})}function OV(){return(0,$.jsx)(`span`,{className:`flex justify-center py-element`,children:(0,$.jsx)(Jy,{size:16})})}function kV({value:e,label:t,isCurrent:n,disabled:r,onPick:i}){let{renderIcon:a}=ef();return(0,$.jsxs)(bV,{value:e,keywords:[t],disabled:r,onSelect:()=>i(e),"aria-current":n?`true`:void 0,"data-choice-value":e,children:[a(W.CHECK,{size:tr.SM,className:G(`me-2 shrink-0`,n?`opacity-100`:`opacity-0`)}),(0,$.jsx)(`span`,{className:`truncate`,children:t})]})}function AV(e){return e}function jV(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(kn.getResourceId(t[e]).length>0)return!0;let r=n[e];return r!==void 0&&String(r).length>0}))})}var MV={[J.UPDATE]:10,[J.CREATE]:20,[J.DELETE]:90,[J.DELETE_MANY]:90,[J.UPDATE_MANY]:10},NV=50,PV=0;function FV(e){let t=e.generatedOperation?.export;if(t?.formats?.length&&t.rowScopes?.length)return t}function IV(e){if(!e)return;let{page:t,limit:n,...r}=e;return r}function LV(e){let t=e.rowScope===Sc.FULL_RESULT_SET?`all rows`:`this page`;return`${e.format.toUpperCase()} — ${t}`}function RV(e){let t=e.generatedOperation?.kind===k.GENERATED_FILE_REGENERATE?e.generatedOperation:void 0,n=typeof t?.fieldName==`string`?t.fieldName:typeof e.operationIdentifier==`string`?wo.parseGeneratedFileRegenerateOperationIdentifier(e.operationIdentifier)?.fieldName:void 0;return n&&n.length>0?n:void 0}function zV(e){switch(e){case od.CRITICAL:case od.HIGH:return X.DESTRUCTIVE;default:return X.GHOST}}function BV(e){return e?{unavailability:e}:{}}var VV={[J.READ]:`viewDetails`,[J.UPDATE]:`edit`,[J.DELETE]:`delete`},HV=[];function UV(e,t){let n=e?.[Wo.ORGANIZATIONS],r=n?kn.getResourceId(n):``;return r.length>0?r:t??null}function WV(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}=fm(),{permissions:T}=ng(),E=Zp(),{navigateToResource:D}=yS(),{tComponent:O,tResourceOperation:A,tResourceFieldDisplay:j,isReady:M}=q({component:K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,resource:t}),N=cp(),{renderIcon:P}=ef(),F=Nx(),{emit:I,on:L}=Uo(),R=(0,Q.useContext)(um)?.isConnected??!1,z=(0,Q.useContext)(Vi),B=(0,Q.useRef)(z);B.current=z;let ee=(0,Q.useRef)(x);ee.current=x;let te=(0,Q.useContext)(lh),ne=(0,Q.useRef)(te);ne.current=te;let V=(0,Q.useRef)(w),re=(0,Q.useRef)(I),ie=(0,Q.useRef)(R);V.current=w,re.current=I,ie.current=R;let[ae,ce]=(0,Q.useState)({open:!1,label:``,requiresTypedConfirmation:!1,confirmationPhrase:``,description:null,confirmLabel:``,callback:null}),[le,ue]=(0,Q.useState)(!1),de=(0,Q.useRef)(new Set),[fe,pe]=(0,Q.useState)(null),[me,he]=(0,Q.useState)(()=>new Set),[ge,_e]=(0,Q.useState)(null),[ve,ye]=(0,Q.useState)(null),be=(0,Q.useRef)(null),xe=(0,Q.useMemo)(()=>C.resourceConfigurations[t],[C,t]),Se=n===dr.DETAIL&&Nie({resourceRelationships:xe?.resourceRelationships,currentObject:r,contextResourceIdentifiers:a}),Ce=(0,Q.useMemo)(()=>sn(n,xe?.frontendConfiguration?.layout?.actionDisclosure),[n,xe]),we=JSON.stringify(a??{}),Te=(0,Q.useMemo)(()=>a,[we]),Ee=JSON.stringify(o??[]),De=(0,Q.useMemo)(()=>o??[],[Ee]),Oe=r?._id??(xe?.resourceFieldIdentifier?r?.[xe.resourceFieldIdentifier]:void 0),ke=typeof Oe==`string`&&Oe.length>0?Oe:void 0,Ae=(0,Q.useMemo)(()=>{if(!ke)return Te;let e=Te[t];if(kn.getResourceId(e)===ke)return Te;let n=e?kn.getFieldIdentifier(e):void 0;return{...Te,[t]:n?{fieldIdentifier:n,resourceId:ke}:ke}},[Te,ke,t]),je=JSON.stringify(l??[]),Ne=(0,Q.useMemo)(()=>l??[],[je]),Pe=UV(Te,E?.currentOrganizationId),Fe=T?.appLevel??HV,Ie=Pe?T?.organizations?.[Pe]??HV:HV,Le=Fe.join(`,`),Re=Ie.join(`,`),ze=(0,Q.useMemo)(()=>Fe,[Le]),Be=ig(),Ve=(0,Q.useMemo)(()=>Ie,[Re]),He=T?.accessProfile??null,Ue=(0,Q.useMemo)(()=>({applicationRoles:[...ze],organizationRoles:[...Ve],roleTables:Be,organizationId:Pe??null,accessProfile:He}),[ze,Ve,Be,Pe,He]),We=dS(),Ge=(0,Q.useMemo)(()=>(xe?.operations??[]).filter(e=>!fS(e.operationFrontendConfig?.runtimeAvailability,We)).map(e=>no.createOperationPathKeyFromOperation(e)).sort().join(`
|
|
11
|
+
`),[xe,We]),Ke=(0,Q.useMemo)(()=>new Set(Ge?Ge.split(`
|
|
12
|
+
`):[]),[Ge]),qe=x?.isSearchActive,Je=x?.listingVariantKeys!==void 0,Ye=x?.listingVariantKeys?.list,Xe=x?.listingVariantKeys?.search,Ze=(0,Q.useMemo)(()=>Je?{list:Ye,search:Xe}:void 0,[Je,Ye,Xe]),Qe=(0,Q.useMemo)(()=>{let e=(xe?.operations??[]).filter(e=>po(e)),t=e.some(e=>e.generatedOperation?.kind===k.GENERATED_COLLECTION_EXPORT&&e.generatedOperation.sourceCoreOperation===J.SEARCH),n=e.some(e=>e.generatedOperation?.kind===k.GENERATED_COLLECTION_EXPORT&&e.generatedOperation.sourceCoreOperation!==J.SEARCH);return t&&n},[xe]),$e=(0,Q.useMemo)(()=>{if(!xe)return[];let e=xe.operations||[],n=new Set(Ne);return e.filter(e=>{let r=String(e.operationIdentifier),i=e.isBulkOperation??!1;if(n.has(r)||e.operationFrontendConfig?.actionVisibility===Ul.HIDDEN||Ke.has(no.createOperationPathKeyFromOperation(e))||cd(e.operationFrontendConfig)&&!po(e))return!1;let a=Ga(e,{addressesTheContextSingletonRecord:Se});if(p){if(!a||i)return!1}else if(a)return!1;if(!Kn(e,Ze)||qe!==void 0&&Qe&&po(e)&&(e.generatedOperation?.kind===k.GENERATED_COLLECTION_EXPORT&&e.generatedOperation.sourceCoreOperation===J.SEARCH)!==qe||u&&!i||!u&&(i||lae(e)))return!1;let o=e.variantType;return!(o&&o!==oe.API_CALL||!Wm({...e,resourceType:t,resourcePrimaryScope:xe?.resourcePrimaryScope},Ue))})},[xe,t,Ne,Ke,u,p,Ue,qe,Ze,Qe,Se]),et=LS($e,{currentObject:r,resourceType:t,selectionObjects:d,...i?{subjectDataMode:i}:{},...Pe?{organizationId:Pe}:{}}),tt=(0,Q.useMemo)(()=>U.buildContextualParameters(Ae,C),[Ae,C]),nt=(0,Q.useMemo)(()=>!!kn.getResourceId(Ae[t]),[Ae,t]),rt=v??Pc(_),it=(0,Q.useCallback)(e=>xe?e.isBulkOperation===!0?jV(e,Ae,tt):!Nm({operation:e,resourceType:t,resourceConfig:xe})||Bh({resourceConfig:xe,operation:e,registry:C,hasResourceId:nt,contextResourceIdentifiers:Ae,contextualParameters:tt}):!0,[Ae,tt,nt,C,xe,t]),at=(0,Q.useCallback)(e=>{let n=String(e.operationIdentifier);if(po(e)){let t=FV(e),n=t?Dr(t):[],r=yp({tComponent:O,componentType:K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`collectionExport`});return n.length===1?`${r} ${n[0].format.toUpperCase()}`:r}if(gi(e)){let n=RV(e);return yp(n?{tComponent:O,componentType:K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`generatedFileRegenerateNamed`,params:{field:j(t,n,`label`)}}:{tComponent:O,componentType:K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`generatedFileRegenerate`})}let r=VV[n];return r?yp({tComponent:O,componentType:K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:r}):RS(A,t,n)},[O,A,j,t]),ot=(0,Q.useCallback)(e=>P({category:nn.OPERATION_RESOURCES,resourceType:t,operationReference:String(e.operationIdentifier)},{size:tr.SM}),[P,t]),st=(0,Q.useCallback)(e=>{let t=e.operationFrontendConfig;return t?.displayPriority===void 0?MV[vl(e)??String(e.operationIdentifier)]??NV:t.displayPriority},[]),ct=(0,Q.useCallback)(e=>me.has(no.createOperationPathKeyFromOperation(e)),[me]),lt=(0,Q.useCallback)(()=>g?.matchedCount??d?.length??h?.length??0,[g,h,d]),ut=(0,Q.useRef)(lt);ut.current=lt,(0,Q.useEffect)(()=>{if(rt)return L(hc.RESOURCE_OPERATION_EXECUTED,e=>{let t=ka(e.resultSummary);t&&pe({jobId:t.jobId,attemptedCount:ut.current()})},e=>e.resourceType===t&&e.isBulkOperation===!0&&e.optionalDiscriminator===rt)},[L,t,rt]);let dt=(0,Q.useCallback)(e=>g?se(e):vte(e),[g]),ft=(0,Q.useCallback)(e=>e.isBulkOperation===!0&<()>dt(e),[lt,dt]),pt=(0,Q.useCallback)((e,n)=>{if(ft(e))return{reason:yp({tComponent:O,componentType:K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`bulkSelectionTooLarge`,params:{maxSelection:dt(e),selectedCount:lt()}})};if(n.isEnabled||n.featureAvailability&&!n.featureAvailability.isAvailable)return;let r=String(e.operationIdentifier),i=cm(A,t,r),a=n.ineligibleSelectionIndices;if(e.isBulkOperation===!0&&a&&a.length>0&&d?.length){let e=yp({tComponent:O,componentType:K.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:yp({tComponent:O,componentType:K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`keepEligibleOnly`,params:{eligibleCount:n.length}}),onSelect:()=>f(n)}}:{}}}return{reason:i??yp({tComponent:O,componentType:K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`unavailableForItem`})}},[ft,dt,lt,f,t,h,d,O,A]),mt=(0,Q.useCallback)(e=>{let t=jS(e);return et.has(t)?et.get(t):e.enabledCondition||e.requiredFeatures?{isEnabled:!1}:{isEnabled:!0}},[et]),ht=(0,Q.useCallback)(e=>mt(e).isEnabled,[mt]),H=(0,Q.useCallback)(e=>kn.createFrontendResourceOperationContextFromOperation({resourceType:t,operation:e,contextResourceIdentifiers:Ae,additionalContext:{...e.isBulkOperation===!0&&g?{[xte]:{...g.filters?{filters:g.filters}:{},...g.search?{search:g.search}:{},...g.listing?{listing:g.listing}:{},matchedCount:g.matchedCount}}:e.isBulkOperation===!0&&h?.length?{[fn]:h}:{},...rt?{[mte]:rt}:{}},parentResourcesRequirements:De,isOperationDefault:e.isOperationDefault??!0}),[t,Ae,De,h,g,rt]),gt=(0,Q.useCallback)(e=>{if(!xe)return;let t=H(e),n=U.flattenContextIdentifiers(Ae),r=Hm.resolveResourceUrl(xe,e,n,C.allResourceFieldIdentifiers,De)?.resolvedUrl;D(t,Hm.createOperationInitiator(s,c),r)},[xe,H,Ae,De,C,D,s,c]),_t=(0,Q.useCallback)(async(e,n)=>{let r=FV(e),i=B.current?.httpClient;if(!r||!i){ne.current?.notifyError?.(O(K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportUnavailable`));return}let o=ee.current,s=e.resourceOperationLike===J.SEARCH;if(o?.isSearchActive&&!s){ne.current?.notifyError?.(O(K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportClearSearch`));return}let{format:c,rowScope:l}=n,u=Vue({registry:C,resourceConfig:xe,exportOperation:e,resourceType:t,contextResourceIdentifiers:ku(a),contextualParameters:tt,parentResourcesRequirements:De,apiBaseUrl:ui.getApiUrl(),format:c,rowScope:l,listingQuery:l===Sc.FULL_RESULT_SET?IV(o?.params):o?.params});if(!u)ne.current?.notifyError?.(O(K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportUnaddressable`));else try{await Hue({url:u,resourceType:t,format:c,getBlob:e=>i.fetchFileBlob(e)})}catch(e){ne.current?.notifyError?.(N(e,O(K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`collectionExportFailed`)))}},[C,xe,t,a,tt,De,O,N]),vt=(0,Q.useCallback)(async e=>{if(!xe)return;let n=no.createOperationPathKeyFromOperation(e);if(!de.current.has(n)){de.current.add(n),he(new Set(de.current)),ue(!0);try{let n=no.createOperationPathKeyFromOperation(e),r=e.isBulkOperation??!1,i=e.operationFrontendConfig?.rowTargetRequestField,a=i?kn.getResourceId(Ae[t]):``,o=r&&g?aee(g):r&&h?.length?El(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 V.current(n,{contextualParameters:tt,parentResourcesRequirements:De,...o?{requestData:o}:{}},{silent:!0});if(Ht(c)){ne.current?.notifyInfo(yp({tComponent:O,componentType:K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`operationSentForApproval`}));return}let l=ka(c);l&&ne.current?.notifyInfo(yp({tComponent:O,componentType:K.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=gi(e),r=Me({contextResourceIdentifiers:Ae,resourceType:t,result:c,isBulkOperation:e.isBulkOperation===!0}),i=U.buildContextualParameters(r,C),a=Wu(c);if(!zi(e,ie.current)&&yu(e)){let a=qv({resourceType:t,registry:C,callContext:Ae,...e.isBulkOperation===!0?{}:{previousRow:s,row:c}}),o=Gv({resourceType:t,registry:C,scopes:a}),l=o.length>0?o:[null];for(let e of l){let n=e??{operationIdentifier:J.LIST};re.current(hc.RESOURCE_REFRESH,{resourceType:t,operationIdentifier:String(n.operationIdentifier??J.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:De,...rt?{optionalDiscriminator:rt}:{}})}if(n){let e=io(xe.operations??[],J.READ,{requireAddressable:!0}).filter(e=>Bh({resourceConfig:xe,operation:e,registry:C,hasResourceId:kn.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:J.READ},i=[kn.getResourceId(r[t]),String(n.operationIdentifier),n.variantType??``,n.variantKey??``,n.isBulkOperation??!1].join(`:`);a.has(i)||(a.add(i),re.current(hc.RESOURCE_REFRESH,{resourceType:t,operationIdentifier:String(n.operationIdentifier??J.READ),operation:n,variantType:e?.variantType,isOperationDefault:e?.isOperationDefault??!0,isBulkOperation:e?.isBulkOperation??!1,variantKey:e?.variantKey,contextResourceIdentifiers:r,parentResourcesRequirements:De,...rt?{optionalDiscriminator:rt}:{}}))}}}re.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:De,resultSummary:a,...rt?{optionalDiscriminator:rt}:{}}),b?.(e)};if(c&&typeof c==`object`){let t=BS(e.responseDto,c);if(t.length>0){ye(t),be.current=d;return}}d()}catch(n){console.error(`[useResourceOperationActions] Operation ${String(e.operationIdentifier)} failed:`,n);let r=n&&typeof n==`object`?n:{};re.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:ku(Ae),parentResourcesRequirements:De,additionalContext:{error:r.message??Qu(n),errorCustomMessageReference:r.customMessageReference,errorHttpStatus:r.httpStatus,errorRefusalCode:rz(n).errorRefusalCode,...iz(n)}})}finally{ue(!1),de.current.delete(n),he(new Set(de.current))}}},[xe,t,C,tt,Ae,De,h,rt,b]),yt=(0,Q.useCallback)(e=>{if(po(e)){let t=FV(e),n=t?Dr(t):[];n.length>0&&_t(e,n[0]);return}let n=String(e.operationIdentifier),r=e.riskLevel,i=Gc(e);if(i===Lr.INLINE&&F.isAvailable){let n=kn.getResourceId(Ae[t]);if(n){F.open({kind:Ax.ELEMENT,elementId:n,operation:e,resourceContext:H(e)});return}}if(i===Lr.POPOVER||i===Lr.DROPDOWN)_e(no.createOperationPathKeyFromOperation(e));else if(Kt(i)||i===Lr.INLINE)gt(e);else if(ds(r)){let t=n===J.DELETE?yp({tComponent:O,componentType:K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`confirmDelete`}):at(e),i=r===od.CRITICAL,a=e.isBulkOperation===!0?lt():0,o=[a>0?yp({tComponent:O,componentType:K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`confirmAppliesToSelection`,params:{count:a}}):void 0,Rn(e)?yp({tComponent:O,componentType:K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`confirmCannotBeUndone`}):void 0].filter(e=>!!e);ce({open:!0,label:t,requiresTypedConfirmation:i,confirmationPhrase:i?at(e):``,description:o.length>0?o.join(` `):null,confirmLabel:at(e),callback:()=>vt(e)})}else vt(e)},[gt,vt,O,at,d,h]),bt=(0,Q.useCallback)(e=>{let t=Gc(e);t===Lr.POPOVER||t===Lr.DROPDOWN?gt(e):yt(e)},[gt,yt]),xt=(0,Q.useCallback)(async()=>{ae.callback&&await ae.callback(),ce({open:!1,label:``,requiresTypedConfirmation:!1,confirmationPhrase:``,description:null,confirmLabel:``,callback:null})},[ae.callback]),St=(0,Q.useCallback)(()=>{ce({open:!1,label:``,requiresTypedConfirmation:!1,confirmationPhrase:``,description:null,confirmLabel:``,callback:null})},[]),Ct=(0,Q.useCallback)(()=>{ye(null);let e=be.current;be.current=null,e?.()},[]),wt=(0,Q.useCallback)(e=>{let n=Gc(e);if(!(n===Lr.POPOVER||n===Lr.DROPDOWN||n===Lr.INLINE&&!F.isAvailable)||!xe)return;let r=no.createOperationPathKeyFromOperation(e),i=()=>_e(null),a=A(t,bo(e.operationIdentifier,xe.operations),`title`);if(n===Lr.DROPDOWN){let t=Ys(e),n=e.isBulkOperation===!0||!t?void 0:S.current?.[t.rowFieldName];return{open:ge===r,onOpenChange:e=>_e(e?r:null),title:a,chrome:VS.LIST,content:Q.createElement(wV,{resourceContext:H(e),navigationZone:s,onDismiss:i,...typeof n==`string`?{currentValue:n}:{}})}}return{open:ge===r,onOpenChange:e=>_e(e?r:null),title:a,content:Q.createElement(cV,{resourceContext:H(e),navigationZone:s,onDismiss:i})}},[xe,t,A,ge,H,s,F.isAvailable]);return{items:(0,Q.useMemo)(()=>{if(!xe)return[];let e=xe.operations||[],t=new Map;for(let e of $e.filter(it)){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=>mt(e).isEnabled),t=Ue.organizationRoles.length>0?e.filter(e=>e.admitsCrossTenantPlatformAdministration!==!0):[],i=$u(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=mt(a),s=a.operationFrontendConfig?.actionVisibility,c=!(!o.featureAvailability||o.featureAvailability.isAvailable);if((s??(Ce.disabledActionHandling===Li.HIDE&&!c?Ul.WHEN_AVAILABLE:Ul.ALWAYS))===Ul.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,mt(e)])),u=a.riskLevel,f=a.operationFrontendConfig?.actionVariant??zV(u),p=ot(a),h=at(a),g=st(a),_=a.operationFrontendConfig?.actionPlacement??(ds(u)&&Rn(a)?ol.DANGER_ZONE:ol.PRIMARY);if(m&&_!==m)continue;let v=!o.isEnabled||ft(a);if(v&&o.featureAvailability&&!o.featureAvailability.isAvailable){let e=o.featureAvailability;switch(e.behavior){case js.HIDE:continue;case js.DISABLE:break;case js.UPGRADE_PROMPT:case js.ADDON_PROMPT:case js.LIMIT_UPGRADE_PROMPT:case js.CONTACT_ADMIN:case js.CUSTOM:i.length===1?r.push({type:`button`,icon:p,label:h,variant:f,onClick:()=>yt(a),disabled:!0,featureLocked:!0,featureAvailability:AV(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:AV(e),_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)});continue}}let y=po(a)?FV(a):void 0;if(y){let e=Dr(y);e.length===1?r.push({type:`button`,icon:p,label:h,variant:f,onClick:()=>{_t(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:LV(e),variant:f,riskLevel:u,operationIdentifier:String(a.operationIdentifier),onClick:()=>{_t(a,e)},disabled:v})),disabled:v,_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier)})}else if(i.length===1){let e=wt(a);r.push({type:`button`,icon:p,label:h,variant:f,onClick:e?()=>gt(a):()=>yt(a),...e?{popover:e}:{},disabled:v,...v?BV(pt(a,o)):{},...ct(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===js.HIDE)return[];let n=e.variantKey,r=n?`${h} (${n})`:h,i=e.riskLevel;return[{type:`button`,icon:ot(e),label:r,variant:zV(i),riskLevel:i,operationIdentifier:String(e.operationIdentifier),onClick:()=>bt(e),disabled:!t.isEnabled||ft(e),...!t.isEnabled||ft(e)?BV(pt(e,t)):{},...t.featureAvailability&&!t.featureAvailability.isAvailable?{featureLocked:!0,featureAvailability:AV(t.featureAvailability)}:{}}]}),t=!o.isEnabled&&e.every(e=>e.disabled===!0);if(e.length===0){let e=wt(a);r.push({type:`button`,icon:p,label:h,variant:f,onClick:e?()=>gt(a):()=>yt(a),...e?{popover:e}:{},disabled:v,...v?BV(pt(a,o)):{},...ct(a)?{busy:!0}:{},_priority:g,_group:_,riskLevel:u,operationIdentifier:String(a.operationIdentifier),...o.featureAvailability&&!o.featureAvailability.isAvailable?{featureLocked:!0,featureAvailability:AV(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===dr.SUMMARY&&m!==ol.DANGER_ZONE&&!y){let t=xe?fh({resourceConfig:xe,operations:e,coreOperation:J.READ,registry:C,hasResourceId:nt,requireFrontendAddressable:!0,contextResourceIdentifiers:Ae,contextualParameters:tt}):void 0;if(t){let e=yp({tComponent:O,componentType:K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,key:`viewDetails`});r.push({type:`button`,icon:P(W.EYE,{size:tr.SM}),label:e,variant:X.GHOST,onClick:()=>gt(t),disabled:!1,_priority:PV,_group:ol.PRIMARY})}}let i=e=>+(e===ol.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===ol.DANGER_ZONE&&o===ol.PRIMARY&&a.push({type:`separator`}),a.push(n),o=t;return a},[xe,Ae,tt,nt,Ue,it,C,t,$e,et,n,Ce,y,ot,at,st,ht,mt,pt,ft,ct,yt,bt,gt,wt,_t,O,P,d]),isConfirmDialogOpen:ae.open,confirmDialogLabel:ae.label,confirmDialogDescription:ae.description,confirmDialogConfirmLabel:ae.confirmLabel,confirmRequiresTypedConfirmation:ae.requiresTypedConfirmation,confirmConfirmationPhrase:ae.confirmationPhrase,onConfirm:xt,onCancel:St,isExecuting:le,acceptedBackgroundRun:fe,ephemeralFields:ve,onEphemeralAcknowledge:Ct}}function GV(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 KV(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=Tl.buildOperationFrontendRoutePaths(n,r,t.allResourceFieldIdentifiers);if(e.length===0)return null;let d=kn.selectMatchingRoutePath(e,s,n.resourceIdentifier,n.resourceFieldIdentifier,l,t.allResourceFieldIdentifiers),f={...c,[n.resourceFieldIdentifier]:o},p=Tl.buildFileUploadRouteForOperation({operationRouteUrl:d.url,operationParameters:d.parameters,targetResourceType:i,targetResourceFieldIdentifier:n.resourceFieldIdentifier,fieldName:a,requiresTargetResourceId:!0,isFrontend:!0}),m=Hm.resolveUrlPath(p.url,f);return Hm.hasUnresolvedPlaceholders(m)?null:`${u}${Ir}${m}`}catch{return null}}function qV(e,t){return t===Tu.ORIGINAL?e:`${e}${e.includes(`?`)?`&`:`?`}variant=${encodeURIComponent(t)}`}function JV(e){return qV(e,Tu.THUMBNAIL)}function YV(e,t){let n=e.VITE_API_BASE_URL;return n?{...e,VITE_API_BASE_URL:Oee(n,t)}:e}function XV(e){return Q.createElement(Jse,{flushSync:SN.flushSync,...e})}ag();var ZV=`wildo:reauthentication`,QV=`wildo:reauthentication-callback`,$V;(function(e){e.POPUP_BLOCKED=`popup_blocked`,e.CANCELLED=`cancelled`,e.TIMED_OUT=`timed_out`,e.FAILED=`failed`})($V||={});var eH=class extends Error{reason;constructor(e){super(`Federated re-authentication did not complete: ${e}`),this.reason=e,this.name=`FederatedReAuthenticationFailure`}},tH=6e5,nH=`wildo-reauthentication`,rH=`popup=yes,width=520,height=680`;function iH(){return window.open(`about:blank`,nH,rH)}function aH(e){let t=new BroadcastChannel(ZV);t.postMessage({type:QV,...e}),t.close()}function oH(e,t=tH){return new Promise((n,r)=>{let i=new BroadcastChannel(ZV),a=!1,o=t=>{a||(a=!0,i.close(),clearTimeout(l),e?.removeEventListener(`abort`,c),t())},s=()=>o(()=>r(new eH($V.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 eH($V.FAILED)))};let l=setTimeout(()=>o(()=>r(new eH($V.TIMED_OUT))),t);e?.aborted?s():e?.addEventListener(`abort`,c)})}async function sH(e,t,n,r){if(!n)throw new eH($V.POPUP_BLOCKED);let i=vc();try{let{authorizationUrl:a}=await i.startFederatedReAuthentication(e,t);n.location.href=a;let o=await oH(r);return await i.exchangeFederatedReAuthentication(o)}catch(e){try{n.close()}catch{}throw e instanceof eH?e:new eH($V.FAILED)}}var cH=[mt.PASSKEY,mt.TOTP,mt.PASSWORD],lH={[$V.POPUP_BLOCKED]:et.REAUTH_PROVIDER_POPUP_BLOCKED,[$V.CANCELLED]:et.REAUTH_PROVIDER_FAILED,[$V.TIMED_OUT]:et.REAUTH_PROVIDER_TIMED_OUT,[$V.FAILED]:et.REAUTH_PROVIDER_FAILED},uH={[mt.PASSKEY]:et.REAUTH_WITH_PASSKEY,[mt.TOTP]:et.REAUTH_WITH_TOTP,[mt.PASSWORD]:et.REAUTH_WITH_PASSWORD};async function dH(e){try{let{methods:t,identityLinks:n}=await vc().getReAuthenticationMethods(e),r=new Set(t);return{methods:cH.filter(e=>r.has(e)),identityLinks:n??[]}}catch{return{methods:[...cH],identityLinks:[]}}}function fH(e,t){switch(e){case mt.PASSWORD:return t.password.trim()?{method:e,password:t.password}:null;case mt.TOTP:return/^\d{6,8}$/.test(t.code.trim())?{method:e,code:t.code.trim()}:null;case mt.PASSKEY:return{method:e};default:return null}}function pH(e,t){let n=t.origin===na.GRANTING_ORGANIZATION,r=t.decisionRequirement?.minimumAssurance;return{methods:e.methods.filter(e=>!n||e!==mt.PASSWORD).filter(e=>{if(r===void 0)return!0;let t=Fne(e);return t!==void 0&&Lie(t,r)}),identityLinks:n||t.decisionRequirement?[]:[...e.identityLinks]}}var mH=({open:e,purpose:t,origin:n=na.ACCOUNT_OR_OPERATION,decisionRequirement:r,onConfirm:i,onCancel:a,failure:o,isLoading:s})=>{let c=cp(),{tComponent:l,isReady:u}=q({component:K.APP_LAYOUTS_SECURITY_SETTINGS}),d=(0,Q.useCallback)(e=>l(K.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 dH(t).then(e=>{if(i)return;let{methods:t,identityLinks:a}=pH(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)(()=>fH(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:iH()});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)(kw,{open:e,onOpenChange:A,cancelCallback:k,validationCallback:O,label:d(et.REAUTH_TITLE),children:(0,$.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,$.jsx)(Z,{className:`text-sm`,children:d(n===na.GRANTING_ORGANIZATION?et.REAUTH_GRANTING_ORGANIZATION_DESCRIPTION:et.REAUTH_DESCRIPTION)}),o!==null&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:o instanceof eH?d(lH[o.reason]):c(o,d(et.ERROR))})}),D&&(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:d(et.REAUTH_NO_ACCEPTED_METHOD)})}),f&&f.length+m.length>1&&(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":d(et.REAUTH_TITLE),children:[f.map(e=>(0,$.jsx)(Y,{type:`button`,size:df.SM,variant:e===g?X.DEFAULT:X.OUTLINE,"aria-pressed":e===g,disabled:s,onClick:()=>{_(e),y(null)},children:d(uH[e])},e)),m.map(e=>(0,$.jsx)(Y,{type:`button`,size:df.SM,variant:e.identityLinkId===v?.identityLinkId?X.DEFAULT:X.OUTLINE,"aria-pressed":e.identityLinkId===v?.identityLinkId,disabled:s,onClick:()=>{y(e),_(null)},children:l(K.APP_LAYOUTS_SECURITY_SETTINGS,et.REAUTH_WITH_PROVIDER,{provider:e.displayName})},e.identityLinkId))]}),v&&(0,$.jsx)(Z,{className:`text-sm`,children:l(K.APP_LAYOUTS_SECURITY_SETTINGS,et.REAUTH_PROVIDER_PROMPT,{provider:v.displayName})}),g===mt.PASSWORD&&(0,$.jsxs)(nx,{children:[(0,$.jsx)(rx,{children:d(et.REAUTH_PASSWORD)}),(0,$.jsx)(XM,{type:`password`,autoComplete:`current-password`,value:x,onChange:e=>S(e.target.value),placeholder:d(et.REAUTH_PASSWORD_PLACEHOLDER),disabled:s,onKeyDown:j})]}),g===mt.TOTP&&(0,$.jsxs)(nx,{children:[(0,$.jsx)(rx,{children:d(et.REAUTH_TOTP_CODE)}),(0,$.jsx)(XM,{inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:8,value:C,onChange:e=>w(e.target.value.replace(/\D/g,``)),placeholder:d(et.REAUTH_TOTP_CODE_PLACEHOLDER),disabled:s,onKeyDown:j})]}),g===mt.PASSKEY&&(0,$.jsx)(Z,{className:`text-sm`,children:d(et.REAUTH_PASSKEY_PROMPT)})]})}):null},hH=(0,Q.createContext)(void 0),gH=({children:e})=>{let{setStepUpAuthHandler:t}=fm(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(oi.STEP_UP),[u,d]=(0,Q.useState)(na.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=na.ACCOUNT_OR_OPERATION,n)=>n?(g.current&&await g.current.catch(()=>void 0),l(oi.STEP_UP),d(t),p(n),y()):g.current?(e===oi.STEP_UP&&l(oi.STEP_UP),t===na.GRANTING_ORGANIZATION&&d(na.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)(()=>(vc().setStepUpAuthHandler(v),b.current(v),()=>{vc().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 _H(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)(hH.Provider,{value:C,children:[e,(0,$.jsx)(mH,{open:n,purpose:c,origin:u,...f?{decisionRequirement:f.requirement}:{},onConfirm:x,onCancel:S,failure:i,isLoading:o})]})};async function _H(e,t=oi.STEP_UP,n,r){let i=vc(),a=r?{decisionBinding:r}:{};switch(e.method){case mt.PASSWORD:return i.reAuthenticate(mt.PASSWORD,{password:e.password,...a},t);case mt.TOTP:return i.reAuthenticate(mt.TOTP,{code:e.code,...a},t);case mt.PASSKEY:{let e=await i.reAuthPasskeyOptions(void 0,r),n=await Toe({optionsJSON:e});return i.reAuthenticate(mt.PASSKEY,{passkeyResponse:n,...a},t)}case mt.EXTERNAL_OAUTH2:case mt.ORG_OPENID_CONNECT:case mt.ORG_SAML:return sH(e.identityLinkId,t,e.popup,n)}}var vH=tl.getLogger();function yH(){let e=Rm(),{registry:t}=fm(),n=t.resourceConfigurations[Wo.ORGANIZATIONS]?.resourceFieldIdentifier;return n?e[n]:void 0}function bH(){let e=yH(),{registry:t,doOperation:n}=fm(),{auth:r,user:i}=ng(),a=Zp(),o=(0,Q.useRef)(n);o.current=n;let s=t.resourceConfigurations[Wo.ORGANIZATIONS],c=s?.resourceFieldIdentifier,l=a?.currentUserId??null,u=!!i&&(!l||i._id===l),d=!!r.accessToken&&r.sessionType!==Ce.ONE_OFF&&!r.isRestoringSession&&r.sessionRestored&&u,f=!!r.accessToken&&r.sessionType!==Ce.ONE_OFF&&u,p=!!e&&f&&Eh(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=Xm(s);if(!n){t(eg.INCONCLUSIVE);return}let r=!1;return o.current(no.buildOperationPathKeyFromOperation(n),{contextualParameters:{[c]:e}},{silent:!0}).then(()=>{r||t(eg.ADMITTED)}).catch(n=>{if(r)return;let i=ct.isAuthorizationError(n)||ct.isNotFoundError(n);i||vH.warn(`Could not verify access to the organization addressed by the route`,{organizationId:e,error:n}),t(i?eg.REFUSED:eg.INCONCLUSIVE)}),()=>{r=!0}},[m,_,e,c,s]),e?p?eg.ACTIVE_MEMBERSHIP:d?_??eg.VERIFYING:eg.UNDECIDABLE:eg.NOT_ADDRESSED}var xH=(0,Q.createContext)(null);function SH(e){let t=yH(),n=Zp(),{user:r,organizations:i,permissions:a,followRouteOrganization:o}=ng(),{emit:s}=Uo(),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=wse({routeOrganizationId:t,access:e,routeOrganizationLoaded:!!t&&i.some(e=>e._id===t),routeOrganizationConferred:Sse(a?.accessProfile,t),currentOrganizationId:c,arrivalSettled:m});return(0,Q.useEffect)(()=>{h===oh.FOLLOWING&&t&&l&&(p(l),o(t)&&s(hc.NAVIGATION_ORGANIZATION_FOLLOWED,{organizationId:t}))},[h,t,l,o,s]),h}function CH(){let e=(0,Q.useContext)(Xg),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 wH({preset:e=H.DEFAULT,...t}){CH();let n=qc(K.APP_LAYOUTS_MAIN_CONTAINER,`AppLayout_MainContainer`)(e);return(0,$.jsx)(n,{...t})}var TH=tl.getLogger();function EH(){let{appConfig:e}=Su(),{privacy:t,recordConsentDecision:n,logout:r}=ng(),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)([]),u=(0,Q.useMemo)(()=>Ub({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=Gb(u,e,t);if(i.length>0&&!r)l(i);else{l([]),a(!0);try{await n(Wb(u.grantedPurposes,e,t),e)}catch(e){TH.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 DH({preset:e=H.DEFAULT,children:t}){let n=EH();if(n.status===Hb.NOT_APPLICABLE||n.status===Hb.SATISFIED)return(0,$.jsx)($.Fragment,{children:t});let r=qc(K.APP_LAYOUTS_CONSENT_GATE,`AppLayout_ConsentGate`)(e);return n.status===Hb.REQUIRED?(0,$.jsx)(r,{gate:n}):(0,$.jsxs)($.Fragment,{children:[t,(0,$.jsx)(r,{gate:n})]})}var OH;(function(e){e.NOT_APPLICABLE=`NOT_APPLICABLE`,e.CHECKING=`CHECKING`,e.SATISFIED=`SATISFIED`,e.REQUIRED=`REQUIRED`,e.UNAVAILABLE=`UNAVAILABLE`})(OH||={});function kH(){let{appConfig:e}=Su(),{logout:t}=ng(),{resolvedUserType:n}=Gx(),r=e.compliance?.governedDocumentAcceptanceMode??Ws.EXPLICIT_CHECKBOX,i=uu(e.compliance),a=n!==null&&(e.compliance?.governedDocumentReleases??[]).some(e=>e.allowedInteractionKinds.includes(nt.CONTRACT_ACCEPTED)&&(!i||e.approvalState===bee.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 vc().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:is(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?OH.UNAVAILABLE:o===void 0?OH.CHECKING:o.length===0?OH.SATISFIED:OH.REQUIRED:OH.NOT_APPLICABLE,T=r===Ws.IMPLIED_BY_REGISTERING||u,E=(0,Q.useCallback)(async()=>{if(T&&b.length!==0){h(!0),_(!1),y(!1);try{let e=await vc().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(Rr(e)&&e.customMessageReference===Lu.GOVERNED_DOCUMENT_RELEASE_SUPERSEDED)try{let e=await vc().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===OH.REQUIRED?o?.[0]?.reason:void 0,acceptance:D,canAccept:T,isSaving:m,saveFailed:g,releaseSuperseded:v,accept:E,signOut:t}}function AH({preset:e=H.DEFAULT,children:t}){let n=kH();if(n.status!==OH.REQUIRED)return(0,$.jsx)($.Fragment,{children:t});let r=qc(K.APP_LAYOUTS_DOCUMENT_ACCEPTANCE_GATE,`AppLayout_DocumentAcceptanceGate`)(e);return(0,$.jsx)(r,{gate:n})}var jH=()=>(0,$.jsx)(`div`,{className:`flex items-center justify-center w-full min-h-[200px]`,children:(0,$.jsx)(Jy,{})}),MH=()=>{let e=ah(),{notifyWarning:t}=Fm(),{tErrorMessage:n,tErrorGuidance:r}=q(),i=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{i.current||(i.current=!0,t(fp({type:Mc.AUTHORIZATION,customMessageReference:Lu.AUTHORIZATION_ORGANIZATION_NOT_ACCESSIBLE},{translators:{tErrorMessage:n,tErrorGuidance:r}})),e(za.home,{replace:!0}))},[e,t,n,r]),(0,$.jsx)(jH,{})},NH=({redirectTo:e=za.login})=>{let{auth:t}=ng(),n=(0,Q.useContext)(Vi)?.shellCompanions??[],r=Zp(),i=rg(),a=bH(),o=SH(a),s=yH()??null,c=a===eg.VERIFYING||a===eg.REFUSED||o===oh.FOLLOWING,l=(0,Q.useMemo)(()=>({routeOrganizationId:s,routeContentHeld:c}),[s,c]),u=r?.currentOrganizationId,d=!!t.accessToken,f=td(i),p=vi(e,f);if(!d)return(0,$.jsx)(Rh,{to:p,replace:!0});if(t.isRestoringSession||!t.sessionRestored&&!u)return(0,$.jsx)(wH,{children:(0,$.jsx)(jH,{})});let m=(0,$.jsx)(jh,{});return a===eg.REFUSED?m=(0,$.jsx)(MH,{}):c&&(m=(0,$.jsx)(jH,{})),(0,$.jsx)(xH.Provider,{value:l,children:(0,$.jsx)(AH,{children:(0,$.jsxs)(DH,{children:[n.map((e,t)=>(0,$.jsx)(e,{},t)),(0,$.jsx)(wH,{children:m})]})})})},PH=new Set;function FH(e){let{resourceType:t,guidanceFlows:n,urlPatterns:r}=e;return n.map(e=>{let n=`${t}.${e.ref}`,i=IH(e,t,r),a=e.elements.map((e,t)=>LH(e,t)),o=a.filter(e=>e.type===pr.CHECKLIST_ITEM).map(e=>e.ref),s=0;for(let e of a)e.type===pr.CHECKLIST&&(s++,e.items=s===1?o:[]);return s>1&&o.length>0&&!PH.has(n)&&(PH.add(n),tl.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??ys.USER,renderMode:e.renderMode,trigger:i,audience:e.audience,priority:e.priority??100,elements:a}})}function IH(e,t,n){let r=e.trigger;switch(r.type){case`FIRST_VISIT`:{let r=n?.[e.bindToOperation];return{type:ya.ROUTE_MATCH,routePattern:r??`/${t.toLowerCase()}`}}case`MANUAL`:return{type:ya.MANUAL};case`DELAYED`:return{type:ya.DELAYED,delayMs:r.delayMs??1e3};case`EVENT`:{let n=r.eventName??`${t}:${e.bindToOperation}`;return{type:ya.EVENT,eventName:n}}default:return{type:ya.MANUAL}}}function LH(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 pr.TOOLTIP:return{...r,type:pr.TOOLTIP,targetSelector:n??``,placement:RH(e.placement)};case pr.TOUR:return{...r,type:pr.TOUR,steps:(e.steps??[]).map((e,t)=>({ref:e.ref,order:t,placement:RH(e.placement)??Oa.BOTTOM,targetSelector:e.targetSelector??(e.targetField?`[data-guidance-field="${e.targetField}"]`:void 0),...e.targetField?{targetField:e.targetField}:{}}))};case pr.MODAL:return{...r,type:pr.MODAL,dismissible:!0,...e.actionRef?{ctaAction:e.actionRef}:{}};case pr.BANNER:return{...r,type:pr.BANNER,...e.actionRef?{actionRef:e.actionRef}:{}};case pr.ANNOUNCEMENT:return{...r,type:pr.ANNOUNCEMENT,...e.actionRef?{actionRef:e.actionRef}:{}};case pr.BADGE:return{...r,type:pr.BADGE,...n?{targetSelector:n}:{}};case pr.CARD:return{...r,type:pr.CARD,...e.actionRef?{actionRef:e.actionRef}:{}};case pr.SURVEY:return{...r,type:pr.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 pr.CHECKLIST:return{...r,type:pr.CHECKLIST,items:[]};case pr.CHECKLIST_ITEM:return{...r,type:pr.CHECKLIST_ITEM,...e.actionRef?{actionRef:e.actionRef}:{}};default:return{...r,type:e.type}}}function RH(e){if(!e)return;let t=e.toUpperCase();if(t in Oa)return Oa[t]}var zH={achievedMilestoneRefs:new Set,stagesReached:new Set};function BH(e,t,n){if(!e)return!0;let r=t.scopedState[n]??zH;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 VH=(0,Q.createContext)(null),HH=[],UH={},WH=[],GH={[Xi.USER]:null,[Xi.ORGANIZATION]:null},KH={scopedStates:GH,isMilestoneAchieved:()=>!1,getMilestoneAchievement:()=>void 0,getCategoryProgress:()=>void 0,totalPoints:0,milestoneDefinitions:WH,isLoading:!1},qH={currentStage:null,stageEnteredAt:null,isEnabled:!1,isLoading:!1,hasReachedStage:()=>!1,activationProgress:{criteriaMet:{},criteria:[],totalCriteria:0,metCriteria:0,isFullyActivated:!1}},JH={activeFlows:HH,flowStates:UH,activateFlow:()=>{},recordFlowPresented:()=>{},reportFlowNotPresentable:()=>{},completeElement:async()=>{},completeFlow:()=>{},dismissFlow:()=>{},skipFlow:()=>{},isFlowActive:()=>!1,isFlowCompleted:()=>!1,isFlowPersistable:()=>!1,isLoading:!1,progression:KH,lifecycle:qH};function YH(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===oe.API_CALL)??null:null}var XH;(function(e){e.LOADED=`loaded`,e.ABSENT=`absent`,e.UNAVAILABLE=`unavailable`})(XH||={});var ZH=new Set;function QH(e,t){let n=`${e}:${t}`;ZH.has(n)||(ZH.add(n),tl.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 $H(e,t){return t?{...e,flows:{...e.flows,...t.flows}}:e}async function eU(e,t,n){let r=du[e],i=YH(n,r,J.READ);if(!i)return QH(r,J.READ),{outcome:XH.UNAVAILABLE};let a=no.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{}},{silent:!0});return{outcome:XH.LOADED,state:e??{flows:{}}}}catch(e){return ct.isNotFoundError(e)?{outcome:XH.ABSENT}:{outcome:XH.UNAVAILABLE}}}async function tU(e,t,n){let r=du[e],i=YH(n,r,J.CREATE);if(!i)return QH(r,J.CREATE),{outcome:XH.UNAVAILABLE};let a=no.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{},requestData:{flows:{}}},{silent:!0});return{outcome:XH.LOADED,state:e??{flows:{}}}}catch{return eU(e,t,n)}}async function nU(e,t,n,r){let i=du[e],a=YH(r,i,J.UPDATE);if(!a){QH(i,J.UPDATE);return}let o=no.buildOperationPathKeyFromOperation(a);try{await n(o,{contextualParameters:{},requestData:t})}catch{}}var rU;(function(e){e.WRITTEN=`written`,e.NOT_BOUND=`not_bound`,e.NO_OPERATION=`no_operation`,e.REFUSED=`refused`})(rU||={});async function iU(e,t,n,r){if(e.type!==pr.SURVEY)return rU.NOT_BOUND;let i=e,a=i.bindTo?.resourceType;if(!a)return rU.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 rU.NOT_BOUND;let s=YH(r,a,J.UPDATE);if(!s)return tl.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}),rU.NO_OPERATION;let c=no.buildOperationPathKeyFromOperation(s);try{return await n(c,{contextualParameters:{},requestData:o}),rU.WRITTEN}catch(t){return tl.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)}),rU.REFUSED}}async function aU(e,t,n){let r=Jie[e],i=YH(n,r,J.READ);if(!i)return{outcome:XH.UNAVAILABLE};let a=no.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{}},{silent:!0});return{outcome:XH.LOADED,state:e??{milestonesAchieved:{},operationCounts:{},totalPoints:0,valueMomentsAchieved:{},categoriesProgress:{}}}}catch(e){return ct.isNotFoundError(e)?{outcome:XH.ABSENT}:{outcome:XH.UNAVAILABLE}}}async function oU(e){if(!e)return[];try{return(await vc().getMilestoneDefinitions({silent:!0}))?.definitions??[]}catch{return[]}}var sU={[Gr.USER]:null,[Gr.ORGANIZATION]:null};async function cU(e,t,n){let r=qe[e],i=YH(n,r,J.READ);if(!i)return{outcome:XH.UNAVAILABLE};let a=no.buildOperationPathKeyFromOperation(i);try{let e=await t(a,{contextualParameters:{}},{silent:!0});return e?{outcome:XH.LOADED,state:e}:{outcome:XH.ABSENT}}catch(e){return ct.isNotFoundError(e)?{outcome:XH.ABSENT}:{outcome:XH.UNAVAILABLE}}}function lU(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 _l.OVERLAY:i||=(r.push(e),!0);break;case _l.CHECKLIST:a||=(r.push(e),!0);break;case _l.INLINE:r.push(e)}return r}var uU=({children:e})=>{let t=(0,Q.useContext)(Vi),{on:n,emit:r}=Uo(),i=ng(),a=Zp(),o=fm(),s=(0,Q.useContext)(hh),c=(0,Q.useRef)(o);c.current=o;let l=(0,Q.useMemo)(()=>tl.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=FH({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??ys.USER,elements:t.elements,renderMode:t.renderMode});for(let t of p)e.has(t.ref)||e.set(t.ref,{ref:t.ref,scope:ys.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)({...GH}),[I,L]=(0,Q.useState)(!0),R=(0,Q.useRef)(!1),[z,B]=(0,Q.useState)(WH),ee=t?.appConfig?.lifecycle,te=!!ee?.enabled,[ne,V]=(0,Q.useState)({...sU}),[re,ie]=(0,Q.useState)(te),ae=(0,Q.useRef)(!1),oe=(0,Q.useMemo)(()=>ee?.activationCriteria,[ee?.activationCriteria]),se=i.user?._id??null,ce=!!i.auth.accessToken,le=!!t?.appConfig?.analytics?.enabled,ue=s?.isLoading??!1,de=ce&&h&&!k.current,fe=ce&&h?D||de:!1;Jm({identifier:Qc.PROGRESSION,isLoading:I}),Jm({identifier:Qc.LIFECYCLE,isLoading:re});let pe=(0,Q.useMemo)(()=>{let e=[ys.USER];return a?.currentOrganizationId&&e.push(ys.ORGANIZATION),e},[a?.currentOrganizationId]);(0,Q.useEffect)(()=>{y.current=_},[_]);let me=(0,Q.useRef)(pe);(0,Q.useEffect)(()=>{me.current!==pe&&(k.current=!1,R.current=!1,ae.current=!1,j.current.clear(),x.current.clear(),S.current=!1,xe.current.clear(),Se.current.clear(),w.current+=1,me.current=pe,ce&&h&&O(!0),ce&&L(!0),ce&&te&&ie(!0),N(e=>{if(!(ys.ORGANIZATION in e))return e;let t={...e};return delete t[ys.ORGANIZATION],t}),F(e=>({...e,[Xi.ORGANIZATION]:null})),V(e=>({...e,[Gr.ORGANIZATION]:null})),E(e=>{let t=new Set(e);for(let e of d)(e.scope??ys.USER)===ys.ORGANIZATION&&t.delete(e.ref);return t}))},[pe,d,h,ce,te,N]);let he=(0,Q.useRef)({isAuthenticated:ce,userId:se});(0,Q.useEffect)(()=>{let e=he.current,t=e.isAuthenticated&&!ce,n=e.userId!==null&&se!==null&&e.userId!==se;if(he.current={isAuthenticated:ce,userId:se},t||n){for(let e of A.current.values())clearTimeout(e);A.current.clear(),k.current=!1,R.current=!1,ae.current=!1,j.current.clear(),x.current.clear(),S.current=!1,xe.current.clear(),Se.current.clear(),w.current+=1,M({}),E(new Set),F({...GH}),B(WH),V({...sU}),O(ce&&h),L(ce),ie(ce&&te)}},[M,se,h,ce,te]);let ge=(0,Q.useMemo)(()=>{let e={};for(let t of pe){let n=_[t];n?.flows&&Object.assign(e,n.flows)}return e},[_,pe]),_e=(0,Q.useMemo)(()=>{let e=new Set;for(let[t,n]of Object.entries(ge))n.status===Ti.COMPLETED&&e.add(t);let t=Oh(i.permissions,a?.currentOrganizationId).filter(Boolean),n=s?.resolvedFeatures?.features??[],r=s?.resolvedFeatures?.limits??{},o=s?.resolvedFeatures?.currentUsage??{},c={};for(let e of[ys.USER,ys.ORGANIZATION]){let t=P[Ere[e]],n=ne[yne[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)=>ge[e]?.elements?.[t]?.surveyAnswers?.[n]}},[ge,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||!ce)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:pe,flowCount:m.size});let r=await Promise.allSettled(pe.map(async t=>{let n=await eU(t,e.doOperation,e.registry);return n.outcome===XH.ABSENT&&(u(`Auto-creating guidance state for scope ${t}`),n=await tU(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===XH.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]=$H(r,e[n]);return t}),n=!0,O(!1),u(`Guidance state loaded`,{scopeCount:Object.keys(i).length})})().catch(e=>{tl.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,pe,ce,u,N]);let ve=(0,Q.useMemo)(()=>{let e=[Xi.USER];return a?.currentOrganizationId&&e.push(Xi.ORGANIZATION),e},[a?.currentOrganizationId]);(0,Q.useEffect)(()=>{if(R.current||!ce)return;R.current=!0;let e=!1,t=!1;return(async()=>{let n=c.current;u(`Initializing progression state`,{scopes:ve});let[r,i]=await Promise.all([Promise.allSettled(ve.map(async e=>({scope:e,read:await aU(e,n.doOperation,n.registry)}))),oU(le&&n.hasResource(Wo.USER_PROGRESSION_STATE))]);if(e)return;let a={...GH};for(let e of r){if(e.status!==`fulfilled`)continue;let{scope:t,read:n}=e.value;n.outcome===XH.LOADED?a[t]=n.state:u(`Progression state unavailable for scope ${t} — showing nothing rather than zeroes`)}F(e=>({...e,...a})),i.length>0&&B(i),t=!0,L(!1),u(`Progression state loaded`,{scopeCount:Object.values(a).filter(Boolean).length,milestoneDefinitionCount:i.length})})().catch(e=>{tl.getLogger().warn(`GuidanceContext: progression initialization failed`,{error:e}),R.current=!1,L(!1)}),()=>{e=!0,t||(R.current=!1)}},[le,ve,ce,u]);let ye=(0,Q.useMemo)(()=>{if(!te)return[];let e=[Gr.USER];return a?.currentOrganizationId&&e.push(Gr.ORGANIZATION),e},[te,a?.currentOrganizationId]);(0,Q.useEffect)(()=>{if(ae.current||!ce||!te)return;ae.current=!0;let e=!1,t=!1;return(async()=>{let n=c.current;ie(!0),u(`Initializing lifecycle state`,{scopes:ye});let r=await Promise.allSettled(ye.map(async e=>({scope:e,read:await cU(e,n.doOperation,n.registry)})));if(e)return;let i={...sU};for(let e of r){if(e.status!==`fulfilled`)continue;let{scope:t,read:n}=e.value;n.outcome===XH.LOADED?i[t]=n.state:n.outcome===XH.ABSENT&&(i[t]=mi.createInitialLifecycleState())}V(e=>({...e,...i})),t=!0,ie(!1),u(`Lifecycle state loaded`,{scopeCount:Object.values(i).filter(Boolean).length})})().catch(e=>{tl.getLogger().warn(`GuidanceContext: lifecycle initialization failed`,{error:e}),ae.current=!1,ie(!1)}),()=>{e=!0,t||(ae.current=!1)}},[ye,ce,te,u]);let be=(0,Q.useCallback)((e,t=y.current)=>{let n=[ys.USER,ys.ORGANIZATION].filter(n=>t[n]?.flows?.[e]!==void 0);return n.find(n=>t[n]?.flows?.[e]?.status===Ti.IN_PROGRESS)??n[0]??g[e]??ys.USER},[g]),xe=(0,Q.useRef)(new Set),Se=(0,Q.useRef)(new Set),Ce=(0,Q.useRef)(new Set),we=(0,Q.useCallback)(async e=>{if(Ce.current.has(e))return;Ce.current.add(e);let t=w.current;try{let n=c.current,r=await aU(e,n.doOperation,n.registry);if(r.outcome!==XH.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{Ce.current.delete(e)}},[u]),Te=(0,Q.useCallback)(async e=>{if(x.current.has(e)||S.current||Se.current.has(e))return;Se.current.add(e);let t=w.current;try{let n=c.current,r=await eU(e,n.doOperation,n.registry);if(r.outcome===XH.ABSENT&&(r=await tU(e,n.doOperation,n.registry)),r.outcome!==XH.LOADED||!b.current||w.current!==t)return;x.current.add(e),tl.getLogger().info(`GuidanceContext: guidance state for scope "${e}" recovered — persistence resumes for this scope.`),xe.current.delete(e),N(t=>({...t,[e]:$H(r.state,t[e])}))}finally{Se.current.delete(e)}},[N]),Ee=(0,Q.useCallback)((e,t,n)=>{let r=y.current,i=n?.scopeOverride??be(e,r),a=x.current.has(i),s=r[i]??{flows:{}},c=t(s.flows[e]??{status:Ti.NOT_STARTED,elements:{},triggerCount:0}),l={...s,flows:{...s.flows,[e]:c}};M({...r,[i]:l}),a?nU(i,l,o.doOperation,o.registry):(xe.current.has(i)||(xe.current.add(i),tl.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.`)),Te(i))},[M,be,o,Te]),De=(0,Q.useCallback)(e=>{let t=f.get(e);if(!t)return;let n=g[e]??ys.USER;if(!pe.includes(n))return;if(ue&&t.audience?.requiredFeatures){j.current.add(e);return}let r=ge[e];Bt(r?.status)||r?.status===Ti.IN_PROGRESS&&T.has(e)||BH(t.audience,_e,t.scope??ys.USER)&&(u(`Activating flow: ${e}`),E(t=>{let n=new Set(t);return n.add(e),n}))},[f,ge,T,_e,g,pe,u,ue]),Oe=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{for(let e of Oe.current)T.has(e)||Oe.current.delete(e);let e=!1;for(let t of ke.current)T.has(t)||(ke.current.delete(t),e=!0);e&&je(new Set(ke.current))},[T]);let ke=(0,Q.useRef)(new Set),[Ae,je]=(0,Q.useState)(new Set),Me=(0,Q.useCallback)((e,t)=>{ke.current.has(e)!==t&&(t?ke.current.add(e):ke.current.delete(e),je(new Set(ke.current)))},[]),Ne=(0,Q.useCallback)(e=>{if(!T.has(e)||Oe.current.has(e))return;let t=f.get(e);t&&(Oe.current.add(e),Ee(e,e=>({...e,status:Ti.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]??ys.USER}))},[T,f,g,Ee,r]);(0,Q.useEffect)(()=>{if(!(fe||ue||d.length===0))for(let e of d){if(e.trigger.type!==ya.FIRST_VISIT)continue;let t=ge[e.ref];t&&t.triggerCount!==0||De(e.ref)}},[fe,ue,pe]),(0,Q.useEffect)(()=>{if(ue||j.current.size===0)return;let e=Array.from(j.current);j.current.clear();for(let t of e)De(t)},[ue,De]);let Pe=(0,Q.useMemo)(()=>d.filter(e=>e.trigger.type===ya.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(!(fe||Pe.length===0))return n(hc.NAVIGATION_ZONE_CHANGED,e=>{let t=e.currentContent?.urlPath;if(t)for(let e of Pe)e._compiledPattern.test(t)&&De(e.ref)})},[fe,Pe,n,De]);let Fe=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{if(fe||d.length===0)return;let e=d.filter(e=>e.trigger.type===ya.EVENT&&e.trigger.eventName);if(e.length!==0){for(let t of e){let e=t.trigger.eventName;e.includes(`:`)||Fe.current.has(t.ref)||(Fe.current.add(t.ref),tl.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&&De(t.ref)})}},[fe,d,n,De]);let Ie=(0,Q.useRef)(De);(0,Q.useEffect)(()=>{Ie.current=De},[De]),(0,Q.useEffect)(()=>{if(fe||d.length===0)return;let e=d.filter(e=>e.trigger.type===ya.DELAYED&&e.trigger.delayMs);if(e.length!==0){for(let t of e){if(A.current.has(t.ref))continue;let e=setTimeout(()=>{Ie.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()}}},[fe,d]);let Le=(0,Q.useMemo)(()=>lU(d.filter(e=>T.has(e.ref)),Ae),[d,T]),Re=(0,Q.useCallback)(e=>{fe||De(e)},[De,fe]),ze=(0,Q.useCallback)(e=>{E(t=>{let n=new Set(t);return n.delete(e),n});let t=m.get(e),n=be(e);t?.renderMode&&r(hc.GUIDANCE_FLOW_COMPLETED,{flowRef:e,renderMode:t.renderMode,triggerSource:`frontend`,scope:n}),u(`Flow completed: ${e}`)},[m,be,r,u]),Be=(0,Q.useCallback)(e=>{if(!m.has(e))return;let t=ge[e];Bt(t?.status)||(Ee(e,e=>({...e,status:Ti.COMPLETED,completedAt:new Date})),ze(e))},[Ee,m,ge,ze]),Ve=(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 iU(a,i,e.doOperation,e.registry);if(t===rU.REFUSED||t===rU.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||ge[e]?.elements?.[n.ref]?.status===Ti.COMPLETED);if(Ee(e,e=>({...e,status:s?Ti.COMPLETED:e.status===Ti.NOT_STARTED?Ti.IN_PROGRESS:e.status,...s?{completedAt:new Date}:{},elements:{...e.elements,[t]:{status:Ti.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&&ze(e)},[Ee,m,r,u,ze,ge]),He=(0,Q.useCallback)(e=>{if(!m.has(e))return;let t=ge[e];if(Bt(t?.status))return;Ee(e,e=>({...e,status:Ti.DISMISSED,dismissedAt:new Date})),E(t=>{let n=new Set(t);return n.delete(e),n});let n=m.get(e),i=be(e);n?.renderMode&&r(hc.GUIDANCE_FLOW_DISMISSED,{flowRef:e,renderMode:n.renderMode,triggerSource:`frontend`,scope:i}),u(`Flow dismissed: ${e}`)},[Ee,m,ge,be,r,u]),Ue=(0,Q.useCallback)(e=>{if(!m.has(e))return;let t=ge[e];Bt(t?.status)||(Ee(e,e=>({...e,status:Ti.SKIPPED})),E(t=>{let n=new Set(t);return n.delete(e),n}),u(`Flow skipped: ${e}`))},[Ee,m,ge,u]),We=(0,Q.useCallback)(e=>T.has(e),[T]),Ge=(0,Q.useCallback)(e=>ge[e]?.status===Ti.COMPLETED,[ge]),Ke=(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}),Ee(e.flowRef,e=>({...e,status:Ti.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}),Ee(e.flowRef,e=>({...e,status:Ti.DISMISSED,dismissedAt:new Date}),{scopeOverride:e.scope}))});return()=>{e(),t(),r()}},[n,u,Ee]),(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`),we(t),n)}),e.reward?.type===Ri.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===Ri.CELEBRATION&&e.reward?.celebrationLevel){let t=st(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`),we(t),n)})});return()=>{e(),t()}},[n,u,r,s,we]),(0,Q.useEffect)(()=>{if(!te)return;let e=n(hc.LIFECYCLE_STAGE_CHANGED,e=>{u(`Lifecycle stage changed: ${e.previousStage} → ${e.newStage} (scope: ${e.scope})`);let t=e.scope;V(n=>{let r=n[t]??mi.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,te]);let qe=(0,Q.useMemo)(()=>{let e=e=>{for(let t of Object.values(Xi))if(P[t]?.milestonesAchieved[e])return!0;return!1},t=e=>{for(let t of Object.values(Xi)){let n=P[t]?.milestonesAchieved[e];if(n)return n}},n=e=>{let t;for(let n of Object.values(Xi)){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(Xi)){let t=P[e];t&&(r+=t.totalPoints)}return{scopedStates:P,isMilestoneAchieved:e,getMilestoneAchievement:t,getCategoryProgress:n,totalPoints:r,milestoneDefinitions:z,isLoading:I}},[P,I,z]),Je=(0,Q.useMemo)(()=>{if(!te)return qH;let e=ne[Gr.USER],t=e?.currentStage??null,n=e?.stageEnteredAt?new Date(e.stageEnteredAt):null,r=t=>e?fre(e,t):!1,i=e?.activationCriteriaMet??{},a=oe?.criteria??[],o=a.length,s=Object.values(i).filter(Boolean).length;return{currentStage:t,stageEnteredAt:n,isEnabled:!0,isLoading:re,hasReachedStage:r,activationProgress:{criteriaMet:i,criteria:a,totalCriteria:o,metCriteria:s,isFullyActivated:o>0?s>=o:t!==Cc.SIGNED_UP}}},[te,ne,re,oe]),Ye=(0,Q.useMemo)(()=>({activeFlows:Le,flowStates:ge,activateFlow:Re,recordFlowPresented:Ne,reportFlowNotPresentable:Me,completeElement:Ve,completeFlow:Be,dismissFlow:He,skipFlow:Ue,isFlowActive:We,isFlowCompleted:Ge,isFlowPersistable:Ke,isLoading:fe,progression:qe,lifecycle:Je}),[Le,ge,Re,Ne,Ve,Be,He,Ue,We,Ge,Ke,fe,qe,Je]);return(0,$.jsx)(VH.Provider,{value:Ye,children:e})};function dU(){return(0,Q.useContext)(VH)??JH}function fU(){let e=(0,Q.useContext)(VH);return(0,Q.useMemo)(()=>e?.lifecycle??qH,[e?.lifecycle])}function pU(){let e=(0,Q.useContext)(VH);return(0,Q.useMemo)(()=>e?.progression??KH,[e?.progression])}var mU=new Set,hU;(function(e){e.ACHIEVED=`achieved`,e.IN_PROGRESS=`in-progress`,e.LOCKED=`locked`})(hU||={});function gU(e,t){return e.scopedStates[t]!=null}function _U(e,t){return e.filter(e=>gU(t,e.scope??Xi.USER)).map(e=>{let n=t.getMilestoneAchievement(e.identifier);if(n)return{definition:e,status:hU.ACHIEVED,achievement:n};if(e.dependencies?.length&&!e.dependencies.every(e=>t.isMilestoneAchieved(e)))return{definition:e,status:hU.LOCKED};let r=`${e.trigger.resourceType}:${e.trigger.operation}`,i=e.scope??Xi.USER,a=t.scopedStates[i]?.operationCounts?.[r]??0;return{definition:e,status:hU.IN_PROGRESS,currentCount:a}})}function vU(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===hU.ACHIEVED).length,totalCount:t.length,totalPoints:t.reduce((e,t)=>t.status===hU.ACHIEVED?e+(t.definition.points??0):e,0)}))}function yU(e,t){return t(e,`title`)}function bU(e,t){return t(e)}function xU(e,t){return e.filter(e=>e.status===hU.IN_PROGRESS).sort((e,t)=>SU(t)-SU(e)).slice(0,t)}function SU(e){let t=e.definition.threshold;return!t||e.definition.type!==ke.COUNT_THRESHOLD?0:Math.min(1,(e.currentCount??0)/t)}function CU(e){return e.status===hU.IN_PROGRESS&&e.definition.type===ke.COUNT_THRESHOLD&&e.definition.threshold!=null&&e.definition.threshold>0}function wU({item:e,name:t,tTracker:n,showPoints:r,showStatusIcon:i}){let{renderIcon:a}=ef(),o=e.status===hU.ACHIEVED?a(W.CHECK,{size:tr.SM,className:`text-success`}):e.status===hU.LOCKED?a(W.LOCK,{size:tr.SM,className:`text-muted-foreground`}):a(W.CLOCK,{size:tr.SM,className:`text-primary`}),s=n(e.status===hU.ACHIEVED?`achieved`:e.status===hU.LOCKED?`locked`:`inProgress`),c=CU(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)(Jd,{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)(h_,{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 TU({completed:e,total:t,tTracker:n}){return(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(h_,{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 EU({variant:e=B_,actionableLimit:t=3,className:n}={}){let r=pU(),{tComponent:i,tMilestone:a,tMilestoneCategory:o,isReady:s}=q({component:K.PROGRESSION_MILESTONE_TRACKER,keys:[Bc.MILESTONES]}),c=(0,Q.useMemo)(()=>(e,t)=>i(K.PROGRESSION_MILESTONE_TRACKER,e,t),[i]),l=(0,Q.useMemo)(()=>_U(r.milestoneDefinitions,r),[r]),u=(0,Q.useMemo)(()=>vU(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===hU.ACHIEVED).length,f=l.length,p=c(`title`),m=c(`description`),h=e=>yU(e.definition.identifier,a),g=Object.values(z_).includes(e)?e:B_;g!==e&&!mU.has(e)&&(mU.add(e),tl.getLogger().warn(`ProgressionMilestoneTracker: unknown variant "${e}" — falling back to "${B_}". Valid values: ${Object.values(z_).join(`, `)}.`));let _=(()=>{switch(g){case z_.NEXT_ACTIONS:{let e=xU(l,t);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(TU,{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)(wU,{item:e,name:h(e),tTracker:c,showPoints:!1,showStatusIcon:!1},e.definition.identifier))})]})}case z_.SUMMARY:{let[e]=xU(l,1);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(TU,{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)(wU,{item:e,name:h(e),tTracker:c,showPoints:!1,showStatusIcon:!1})})]})]})}case z_.FLAT:return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsx)(TU,{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:bU(e.category,o)}),(0,$.jsx)(`div`,{role:`list`,className:`divide-y divide-border`,children:e.milestones.map(e=>(0,$.jsx)(wU,{item:e,name:h(e),tTracker:c,showPoints:!1,showStatusIcon:!0},e.definition.identifier))})]},e.category))]});case z_.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:bU(e.category,o)}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:c(`progressDisplay`,{completed:e.completedCount,total:e.totalCount})})]}),(0,$.jsx)(h_,{value:e.totalCount>0?e.completedCount/e.totalCount*100:0,className:`h-2`,"aria-label":bU(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)(wU,{item:e,name:h(e),tTracker:c,showPoints:!0,showStatusIcon:!0},e.definition.identifier))})]},e.category))})}})(),v=g===z_.SUMMARY||g===z_.DETAILED;return(0,$.jsxs)(wF,{role:`region`,"aria-label":p,className:n,"data-progression-variant":g,children:[(0,$.jsxs)(EF,{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)(Jd,{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)(jF,{className:`pt-0`,children:_})]})}var DU=(0,Q.createContext)(null);function OU({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)(DU.Provider,{value:a,children:i})}function kU(){let e=(0,Q.useContext)(DU);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 AU(){return(0,Q.useContext)(DU)}var jU=(0,Q.createContext)(null);function MU({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)(OU,{hostResourceType:i,contextResourceIdentifiers:a,navigationZone:n,navigationInitiator:r,children:(0,$.jsx)(jU.Provider,{value:s,children:o})})}function NU(){let e=(0,Q.useContext)(jU);if(!e)throw Error(`useCompositeViewContext must be used within a CompositeViewProvider`);return e}function PU(){return(0,Q.useContext)(jU)}var FU=Q.createContext(null),IU=({viewRef:e,document:t,hostResourceType:n,contextResourceIdentifiers:r,navigationZone:i,navigationInitiator:a,linkedConversation:o})=>{let s=PU(),{registry:c}=fm(),l=Zp(),{UIConfig:u,compositeViews:d}=Ng(),f=u?.currentBreakpoint,p=Q.useMemo(()=>jp(e),[e]),m=n??(p?.hostKind===Bp.RESOURCE&&p.viewKind===bp.COMPOSITE_VIEW?p.hostRef:void 0)??s?.hostResourceType,h=r??s?.contextResourceIdentifiers,g=(0,Q.useMemo)(()=>t??_p({viewRef:e,compositeViews:d,registry:c}),[t,e,d,c]);(0,Q.useEffect)(()=>{},[g,h,e]);let _=(0,Q.useMemo)(()=>{let e=tm.buildInitiatorIds({userId:l?.currentUserId,organizationId:l?.currentOrganizationId,applicationId:l?.currentApplicationId,anonymousUserId:l?.currentAnonymousUserId}),t=g?.primaryScope?tm.primaryScopeToContextIdentifiers(e,g.primaryScope):{},n=l?.buildContextResourceIdentifiers()??{},r=tm.filterCustomScopeContextResourceIdentifiers(n);if(!g)return tm.mergeContextResourceIdentifiers(t,r,h);let i=g.scope===em.RESOURCE&&m?[{resourceType:m,requirement:_a.OPTIONAL,isPrimaryScope:!1}]:[],a=[...g.additionalResourceRequirements??[],...i],o=tm.getAllowedViewBindingKeys({primaryScope:g.primaryScope,parentResourcesRequirements:g.parentResourcesRequirements,additionalResourceRequirements:a});return tm.resolveViewContextResourceIdentifiers({surfaceName:`CompositeView`,surfaceRef:g.ref,primaryScope:g.primaryScope,parentResourcesRequirements:g.parentResourcesRequirements,additionalResourceRequirements:a,primaryScopeContext:t,customScopeContext:r,explicitContextResourceIdentifiers:tm.scopeContextToBindingContract(h,o)})},[l,l?.currentAnonymousUserId,l?.currentApplicationId,l?.currentOrganizationId,l?.currentUserId,g,m,h]),v=U.buildContextResourceIdentifiersKey(_),y=(0,Q.useMemo)(()=>_,[v]),b=i??s?.navigationZone??Gn.PRIMARY,x=a??s?.navigationInitiator,S=Q.useContext(FU),C=g?.conversationSystemRef,w=(0,Q.useMemo)(()=>o&&C?{...o,systemRef:C}:null,[o,C]),T=o&&g&&!C?o:void 0;if((0,Q.useEffect)(()=>{T?.onSettled()},[T]),!g)return(0,$.jsx)(a_,{viewKind:`composite`,viewRef:e});let E=g.viewComponent;return(0,$.jsx)(MU,{viewDefinition:g,breakpoint:f,navigationZone:b,navigationInitiator:x,hostResourceType:m,contextResourceIdentifiers:y,children:(0,$.jsx)(FU.Provider,{value:w??S,children:(0,$.jsx)(E,{viewRef:g.ref,viewDefinition:g})})})};function LU({activationProgress:e}){let{tLifecycle:t,tActivationCriterion:n,isReady:r}=q({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===ote.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 RU({stage:e}){let{tLifecycle:t,tLifecycleStage:n}=q({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}=q({keys:[`lifecycle`]}),{milestoneDefinitions:n,isLoading:r}=pU(),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)(EU,{})})]})}function BU(){let{tComponent:e}=q({component:K.APP_LAYOUTS_HOME});return(0,$.jsx)(`div`,{style:{padding:`2rem`,maxWidth:600,margin:`0 auto`,textAlign:`center`},children:(0,$.jsx)(`h2`,{children:e(K.APP_LAYOUTS_HOME,`welcomeTitle`)})})}var VU=({})=>{let{currentStage:e,isEnabled:t,isLoading:n,activationProgress:r}=fU(),{homeDefinition:i}=Ng(),{registry:a}=fm(),o=rg(),{navigate:s}=yS(),c=Zp(),{tComponent:l,isReady:u}=q({component:K.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=Hm.resolveResourceUrl(t,n,c?.buildContextResourceIdentifiers?.()??{},a.allResourceFieldIdentifiers,e.parentResourcesRequirements);return r?.resolvedUrl?{content:{contentType:Sa.RESOURCE_OPERATION,resourceContext:kn.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:ki},replaceBrowserHistory:!0})},[f,o.pathname,s]),d)return(0,$.jsx)(IU,{viewRef:d,navigationZone:Gn.PRIMARY});if(!u)return null;if(n)return(0,$.jsx)(`div`,{style:{padding:`2rem`,textAlign:`center`},children:l(K.APP_LAYOUTS_HOME,`loading`)});if(!t||!e)return(0,$.jsx)(BU,{});switch(e){case Cc.SIGNED_UP:return(0,$.jsx)(LU,{activationProgress:r});case Cc.REACTIVATED:return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(RU,{stage:e}),(0,$.jsx)(zU,{})]});case Cc.DORMANT:case Cc.ACTIVATED:case Cc.ENGAGED:default:return(0,$.jsx)(zU,{})}};function HU({preset:e=H.DEFAULT,...t}){let n=qc(K.APP_LAYOUTS_HOME,`AppLayout_Home`)(e);return(0,$.jsx)(n,{...t})}function UU({className:e,children:t,containerConfig:n,sectionMetadata:r,onSectionChange:i}){let a=PU(),o=a?.viewDefinition.translationRef,s=(0,Q.useMemo)(()=>o?[`${Bc.COMPOSITE_VIEWS}.${o}`]:[],[o]),{tCompositeViewSection:c}=q({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)(()=>WU(t,n,l,r,i),[t,n,l,r,i]);return(0,$.jsx)(zk,{value:{sectionEntries:l},children:(0,$.jsx)(`div`,{className:G(`flex flex-col gap-section`,e),"data-composite-layout":!0,children:u})})}function WU(e,t,n,r,i){let a=Yk(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 JU(o.sections,r).map((e,s)=>{let c=qU(Xk({...o,sections:e}),KU(e,t,r)),l=e.map(e=>GU(e,n));return(0,$.jsx)(VO,{sections:l,config:c,onSectionChange:i},`composite-group-${o.mode}-${a}-${s}`)})})})}function GU(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)(Gk,{hostKind:ok.COMPOSITE,sectionProps:e.props,providesHeading:!!n?.title})}}function KU(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 qU(e,t){return t?{...e,...t}:e}function JU(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 YU({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_APPROVAL_REQUEST,`AI_ApprovalRequest`)(e);return(0,$.jsx)(n,{...t})}function XU({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_APPROVAL_QUEUE,`AI_ApprovalQueue`)(e);return(0,$.jsx)(n,{...t})}function ZU({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_DECISION_REQUEST,`AI_DecisionRequest`)(e);return(0,$.jsx)(n,{...t})}function QU({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_HUMAN_INPUT_REQUEST,`AI_HumanInputRequest`)(e);return(0,$.jsx)(n,{...t})}var $U=tl.getLogger(),eW=new Set(Object.values(Mi));function tW(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 nW(e){let t=e?.response?.data;return t&&typeof t.kind==`string`&&eW.has(t.kind)?t:void 0}var rW;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(rW||={});function iW(){let{httpClient:e}=Su(),{on:t}=up(),[n,r]=(0,Q.useState)([]),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(rW.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=`${Ir}${Hn($r.FLOWS_ACTORS_DECISIONS)}`,r=await e.get(n,{silent:!0});c.current&&t===d.current&&(p(r?.decisions??[]),s(rW.READY))}catch(e){$U.warn(`Pending decisions could not be read`,{error:e instanceof Error?e.message:`unknown`}),c.current&&t===d.current&&s(rW.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:Mi.NOT_ACTIONABLE};let i=`${Ir}${Hn($r.FLOWS_ACTORS_DECISION_ACT,{decisionRef:t,act:n})}`,a=async t=>{try{return await e.post(i,r,{silent:!0,...t?{headers:{[Io.REAUTH_TOKEN]:t}}:{}})}catch(e){let t=nW(e);if(!t)throw e;return t}},o=i=>n===yr.ANSWER&&r.presentationId!==void 0?e.stepUpForDecision({binding:{decisionRef:t,presentationId:r.presentationId},requirement:i}):Promise.resolve(void 0),s={kind:Mi.NOT_ACTIONABLE,reason:fa.DECISION_STEP_UP_REQUIRED},c;l.current.add(t);try{let e=n===yr.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===Mi.NOT_ACTIONABLE&&c.reason===fa.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=`${Ir}${Hn($r.FLOWS_ACTORS_DECISION_CANDIDATES,{decisionRef:t})}`;try{return(await e.get(n,{silent:!0}))?.candidates??[]}catch(e){if(nW(e))return[];throw e}},[e]);return(0,Q.useEffect)(()=>{c.current=!0,m();let e=t(ro.FLOWS_ACTORS_DECISION_ROUTED,()=>{m()}),n=t(ro.FLOWS_ACTORS_DECISION_WITHDRAWN,e=>{if(!e?.decisionRef||l.current.has(e.decisionRef))return;let t=tW(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 aW=tl.getLogger(),oW=aW.debugByType(`FlowsActorsContext`);aW.setDebugTypeLogging(`FlowsActorsContext`,!1);var sW=500;function cW(e,...t){let n=[...e,...t];return n.length>sW?n.slice(n.length-sW):n}function lW(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 cW(e,t)}var uW;(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`})(uW||={});var dW={[Do.COMPLETED]:uW.COMPLETED,[Do.CANCELLED]:uW.CANCELLED,[Do.AWAITING_APPROVAL]:uW.AWAITING_APPROVAL,[Do.PROCESSING]:uW.RUNNING,[Do.PENDING]:uW.STARTING,[Do.READY]:uW.STARTING,[Do.FAILED]:uW.ERROR,[Do.ABORTED]:uW.ERROR};function fW(e){return dW[e]??uW.ERROR}function pW(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 mW=(0,Q.createContext)(void 0),hW=({children:e})=>{let{appConfig:t,frontendConfiguration:n,httpClient:r}=Su(),i=ng(),a=Zp(),{on:o,emit:s,isConnected:c}=up(),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);Jm({identifier:Qc.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)oW(`Cannot refresh systems - API endpoint not configured`);else if(!r)oW(`Cannot refresh systems - httpClient not available`);else{b(!0),S(null);try{let e=await r.get(`${Ir}${Hn($r.FLOWS_ACTORS_FRONTEND_INFO)}`);f(e.systems),m(e.autonomousAgents),g(e.chatAgents),v(e.chatConnectionRefs),E(!0),oW(`Systems refreshed`,{count:e.systems.length})}catch(e){if(ct.isNotFoundError(e)){oW(`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),oW(`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)oW(`Cannot fetch conversation history - httpClient not available`);else try{let i=`${Ir}${Hn($r.FLOWS_ACTORS_HISTORY)}`,o=t===void 0?void 0:Ma({...a?.currentOrganizationId?{organizationId:a.currentOrganizationId}:{},...t}),s=`?systemRef=${encodeURIComponent(e)}${o===void 0?``:`&contextRef=${encodeURIComponent(o)}`}`+(n.before?`&before=${encodeURIComponent(n.before)}`:``)+(n.executionId?`&executionId=${encodeURIComponent(n.executionId)}`:``),c=qse(cie,await r.get(`${i}${s}`));oW(`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===uW.ERROR&&(r.errorCode===Xc.DECISION_PENDING||r.errorCode===Xc.DECISION_PRESENTATION_STALE||r.errorCode===Xc.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:uW.AWAITING_APPROVAL,messages:[],pendingApproval:pW(n.pendingApproval)}))}return t??e}),{executions:c.executions,hasOlder:c.hasOlder===!0}}catch(t){if(ct.isNotFoundError(t))return oW(`FlowsActors history surface not available - returning empty history`,{systemRef:e}),{executions:[],hasOlder:!1};aW.warn(`Failed to fetch conversation history`,{systemRef:e,error:t instanceof Error?t.message:`unknown`});return}},[r,a?.currentOrganizationId]),j=(0,Q.useCallback)((e,t,n)=>A(e,t,n?.before?{before:n.before}:{}),[A]),M=(0,Q.useCallback)(async(e,t,n)=>{let r=await A(e,t,{executionId:n});if(r!==void 0)return r.executions.find(e=>e.executionId===n)??null},[A]),N=(0,Q.useCallback)(async e=>{if(!r){oW(`Cannot delete conversation - httpClient not available`);return}let t=`${Ir}${Hn($r.FLOWS_ACTORS_HISTORY)}`;await r.delete(`${t}?executionId=${encodeURIComponent(e)}`),oW(`Conversation deleted`,{executionId:e})},[r]),P=(0,Q.useCallback)((e,t,n,r,i)=>{if(!c)return oW(`Cannot start execution — WebSocket not connected`,{systemRef:e}),null;let o=n??crypto.randomUUID();oW(`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:uW.STARTING,messages:[]}),n}),s(ro.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]),F=(0,Q.useCallback)((e,t,n,r,i,a)=>{let o=D.current.get(e);o?c?(oW(`Responding to approval`,{executionId:e,approvalId:t,approved:n,modified:i!==void 0}),s(ro.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?uW.RUNNING:e.status,errorCode:void 0,recoverable:void 0,pendingApproval:void 0,answeredApproval:e.pendingApproval?{approval:e.pendingApproval,...i?{submittedToolArgs:i}:{}}:void 0}))):oW(`Cannot respond to approval — WebSocket not connected`,{executionId:e,approvalId:t}):oW(`Cannot respond to approval — execution not found`,{executionId:e,approvalId:t})},[c,s,O]),I=(0,Q.useCallback)((e,t,n,r)=>{let i=D.current.get(e),a=i?.pendingApproval;if(!i||!a?.question||!a.decisionRef||!c){oW(`Cannot answer a question — no paused question, or the WebSocket is not connected`,{executionId:e});return}let o=t===jie.ANSWER;s(ro.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:uW.RUNNING,errorCode:void 0,recoverable:void 0,pendingApproval:void 0,answeredApproval:e.pendingApproval?{approval:e.pendingApproval}:void 0}))},[c,s,O]),L=(0,Q.useCallback)(e=>D.current.get(e),[]),R=(0,Q.useCallback)(e=>d.find(t=>t.ref===e),[d]),z=(0,Q.useCallback)(e=>{let t=D.current.get(e);t&&c&&s(ro.FLOWS_ACTORS_CANCEL,{systemRef:t.systemRef,executionId:e})},[c,s]),B=(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 ee=(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===uW.STARTING||r.status===uW.RUNNING)&&(t??=new Map(e),t.set(n,{...r,status:uW.ERROR,recoverable:!0,errorCode:Xc.CONNECTION_LOST}));return t??e})},[c]),(0,Q.useEffect)(()=>{if(!c)return;let e=o(ro.FLOWS_ACTORS_STARTED,e=>{oW(`Execution started`,{executionId:e.executionId}),O(e.executionId,e=>({...e,status:uW.RUNNING}))}),t=o(ro.FLOWS_ACTORS_MESSAGE,e=>{oW(`Execution message`,{executionId:e.executionId,type:e.messageType,messageId:e.messageId,isFinal:e.isFinal});let t=Vne.safeParse(e.data);if(t.success){let{approvalId:n,toolName:r}=t.data;oW(`Approval requested`,{executionId:e.executionId,approvalId:n,toolName:r}),O(e.executionId,e=>({...e,status:uW.AWAITING_APPROVAL,answeredApproval:void 0,pendingApproval:pW(t.data)}))}O(e.executionId,t=>({...t,messages:lW(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(ro.FLOWS_ACTORS_COMPLETED,e=>{oW(`Execution completed`,{executionId:e.executionId,status:e.status,duration:e.duration}),O(e.executionId,t=>({...t,status:fW(e.status),pendingApproval:void 0,duration:e.duration,...e.usage?{usage:e.usage}:{}}))}),r=o(ro.FLOWS_ACTORS_ERROR,e=>{oW(`Execution error`,{executionId:e.executionId,errorCode:e.errorCode,recoverable:e.recoverable}),O(e.executionId,t=>{if(e.recoverable&&e.errorCode===Xc.APPROVAL_MODIFICATION_REJECTED&&t.answeredApproval)return{...t,status:uW.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===Xc.APPROVAL_REASON_CODE_REJECTED&&t.answeredApproval)return{...t,status:uW.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===Xc.SERVICE_CONSENT_REQUIRED&&t.answeredApproval)return{...t,status:uW.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===Xc.DECISION_PENDING&&n!==void 0&&n===e.waitingDecisionRef?t:{...t,status:uW.ERROR,recoverable:e.recoverable,errorCode:e.errorCode,pendingApproval:void 0,answeredApproval:void 0}})});return()=>{e(),t(),n(),r()}},[c,o,O]);let ne=(0,Q.useMemo)(()=>({systems:d,autonomousAgents:p,chatAgents:h,chatConnectionRefs:_,requestAgentDeclarations:ee,isLoading:y,error:x,executions:C,startExecution:P,respondToApproval:F,answerQuestion:I,cancelExecution:z,clearExecution:B,getExecution:L,getSystem:R,refreshSystems:k,fetchConversationHistory:j,fetchConversation:M,deleteConversation:N}),[d,p,h,_,ee,y,x,C,P,F,I,z,B,L,R,k,j,M,N]);return(0,$.jsx)(mW.Provider,{value:ne,children:e})};function gW(){let e=(0,Q.useContext)(mW);if(!e)throw Error(`useFlowsActors must be used within a FlowsActorsProvider`);return e}function _W(){return(0,Q.useContext)(mW)}var vW={[Wa.AGENT_NOT_REGISTERED]:`refusalAgentNotRegistered`,[Wa.TOOL_NOT_DECLARED]:`refusalToolNotDeclared`,[Wa.TOOL_NO_LONGER_GATED]:`refusalToolNoLongerGated`,[Wa.APPROVAL_ROUTE_CHANGED]:`refusalApprovalRouteChanged`,[Wa.AGENT_NOT_ACTIVE]:`refusalAgentNotActive`,[Wa.AGENT_SUSPENDED]:`refusalAgentSuspended`,[Wa.CONTENT_POLICY_TIGHTENED]:`refusalContentPolicyTightened`,[Wa.AGENT_STANDING_UNREADABLE]:`refusalAgentStandingUnreadable`,[Wa.ARGUMENTS_INVALID]:`refusalArgumentsInvalid`,[Wa.ARGUMENTS_NOT_RUN_AS_WRITTEN]:`refusalArgumentsNotRunAsWritten`,[Wa.ARGUMENTS_CANNOT_BE_CORRECTED]:`refusalArgumentsCannotBeCorrected`,[Wa.CREDENTIAL_NOT_ACCEPTED]:`refusalCredentialNotAccepted`,[Wa.SIGNING_KEY_NOT_CONFIGURED]:`refusalSigningKeyNotConfigured`,[Wa.CALL_NOT_REWRITABLE]:`refusalCallNotRewritable`,[Wa.RECORD_NOT_REACHABLE]:`refusalRecordNotReachable`,[Wa.DELIVERABLE_FILE_NOT_EDITABLE]:`refusalDeliverableFileNotEditable`},yW=`refusalReasonUnstated`,bW=new Set(Object.values(Wa));function xW(e,t){return t(bW.has(e.reason)?vW[e.reason]:yW,{toolName:e.toolName??``,arguments:(e.argumentPaths??[]).join(`, `)})}var SW=5;function CW(e,t,n){let r={arguments:(e.argumentNames??[]).join(`, `)||t(`noticeTheseArguments`)};return{[Mi.APPLIED]:void 0,[Mi.NOT_ACTIONABLE]:e.reason===fa.PRESENTATION_STALE?t(`noticePresentationStale`):e.reason===fa.CLOCK_ALREADY_PAUSED?t(`noticeClockAlreadyPaused`):e.reason===fa.CLOCK_NOT_PAUSED?t(`noticeClockNotPaused`):e.reason===fa.PAUSE_STATE_NOT_DECLARED?t(`noticePauseStateNotDeclared`):t(`noticeNotActionable`),[Mi.LAPSED]:t(`noticeLapsed`),[Mi.REQUESTER_AUTHORITY_LAPSED]:t(`noticeRequesterAuthorityLapsed`),[Mi.MODIFICATION_REJECTED]:e.reason===fa.EDITED_CALL_NOT_REACHABLE?t(`noticeEditedCallNotReachable`,r):e.reason===fa.CALL_NOT_RUN_AS_READ?t(`noticeCallNotRunAsRead`,r):e.reason===fa.CREDENTIAL_NOT_ACCEPTED?t(`noticeCredentialNotAccepted`,r):e.reason===fa.CALL_CANNOT_RUN?wW(e,t,n):e.reason===fa.ARGUMENTS_CANNOT_BE_CORRECTED?t(`noticeArgumentsCannotBeCorrected`,r):t(`noticeModificationRejected`),[Mi.REASON_CODE_REJECTED]:t(`noticeReasonCodeRejected`),[Mi.CONSENT_REQUIRED]:t(`noticeConsentRequired`),[Mi.TARGET_REFUSED]:e.reason===fa.NO_TARGET?t(`noticeNoEscalationTarget`):t(`noticeTargetRefused`),[Mi.SUPERSEDED]:t(`noticeSuperseded`)}[e.kind]}function wW(e,t,n){let r=e.callRefusalReason!==void 0&&Object.hasOwn(vW,e.callRefusalReason)?vW[e.callRefusalReason]:void 0;return r===void 0?t(`noticeCallCannotRun`):t(r,{toolName:n??``,arguments:(e.argumentNames??[]).join(`, `)})}function TW(e,t){let n=e.find(e=>e.decisionRef===t)?.presentationId;return n?{presentationId:n}:{}}function EW(e,t){if(e&&e.length!==0)return e.map(e=>({value:e,label:t(Pt,e)}))}function DW(e,t){return t(qee.HUMAN_DECISION_PAUSE_STATE,e)}var OW=[Bc.SYSTEM_ENUMS,Bc.ROLES],kW=[];function AW({executionId:e,...t}){let{executions:n,respondToApproval:r,answerQuestion:i}=gW(),[a,o]=Q.useState(null),[s,c]=Q.useState(null),l=Q.useRef(null),u=n.get(e),d=u?.pendingApproval,f=d?.toolName,{t:p,roleLabel:m,toolLabel:h,operationLabel:g,tComponent:_,tSystemEnum:v}=RW(Q.useMemo(()=>f?[f]:[],[f]),kW),y=Q.useCallback((t,n,i,a)=>{o(t),c(l.current),r(e,t,!0,n,i,...a?[a]:[])},[e,r]),b=Q.useCallback((t,n,i)=>{o(t),c(l.current),i?r(e,t,!1,n,void 0,i):r(e,t,!1,n)},[e,r]),x=Q.useCallback((t,n,r,a)=>{o(t),c(l.current),i(e,n,r,a)},[e,i]),S=Q.useCallback(e=>_(K.LOW_LEVEL_AI_APPROVAL,e),[_]);if(Q.useEffect(()=>{o(null)},[d]),!u||!d)return s?(0,$.jsx)($j,{decisionRef:s.decisionRef,description:s.title}):null;let{approvalId:C,riskLevel:w,expiresAt:T,toolName:E,toolArgs:D,toolInputSchema:O,modificationRefusal:k,rejectedToolArgs:A,routeKind:j,reasonCodes:M,reasonCodeRefused:N,question:P,presentation:F}=d,I=PW(F?.title??le({plane:_n.CONVERSATIONAL,toolName:E??``}).title,p,m,h,g);l.current=d.decisionRef?{decisionRef:d.decisionRef,title:I}:null;let L=j===void 0||j===sr.OWNER;return P?(0,$.jsx)(YU,{approvalId:C,actionDescription:P.title,executionId:e,systemRef:u.systemRef,expiresAt:T,answerable:L,question:IW(P,S),onAnswer:x,isProcessing:a===C,...t}):(0,$.jsx)(YU,{approvalId:C,actionDescription:I,riskLevel:w,executionId:e,systemRef:u.systemRef,expiresAt:T,answerable:L,actionNotice:L?N?_(K.LOW_LEVEL_AI_APPROVAL,`noticeReasonCodeRejected`):void 0:_(K.LOW_LEVEL_AI_APPROVAL,`awaitingReview`),reasonCodeOptions:L?EW(M,v):void 0,allowArgumentModification:L,toolName:E,toolLabel:E?h(E):void 0,executionContext:D,presentedArguments:d.presentation?hr(d.presentation):void 0,argumentsSchema:O,argumentModificationError:k?xW(k,(e,t)=>_(K.LOW_LEVEL_AI_APPROVAL,e,t)):void 0,rejectedArguments:A,onApprove:y,onDeny:b,isProcessing:a===C,...t})}function jW(e,t,n,r){return{[sr.OWNER]:()=>t(`holderOwner`),[sr.ASSIGNEE]:()=>e.claimedAt?t(`holderClaimedByYou`,{when:r(e.claimedAt)}):t(`holderAssignedToYou`),[sr.ROLE]:()=>e.eligibleRole?t(`holderRole`,{role:n(e.eligibleRole)}):void 0}[e.kind]()}var MW={[Fa.USER]:void 0,[Fa.MACHINE]:`requesterAutonomousAgent`,[Fa.DELEGATED_CLIENT]:`requesterConnectedApplication`};function NW(e,t){let n=MW[e];return n?t(n):void 0}function PW(e,t,n,r,i=(e,t)=>`${Bc.RESOURCES}.${e}.operations.${t}.${Hi.TITLE}`){switch(e.kind){case ld.LABEL:return e.params?t(e.labelRef,Object.fromEntries(Object.entries(e.params).map(([e,a])=>[e,typeof a==`object`?PW(a,t,n,r,i):String(a)]))):t(e.labelRef);case ld.ROLE:return n(e.roleKey);case ld.TOOL:return r(e.toolName);case ld.RESOURCE_OPERATION:return i(e.resourceType,e.operationIdentifier);case ld.TEXT:return e.text;default:return e}}function FW(e,t,n=e=>e,r=e=>e,i){let a=e.presentation?{presentedArguments:hr(e.presentation)}:{},o=PW(e.presentation?.title??le(e).title,t,n,r,i);return e.plane===_n.OPERATION_APPROVAL&&e.operationApproval?{actionDescription:o,executionContext:e.operationApproval.requestedValues,...a}:e.plane===_n.REPRESENTATIVE_ADMISSION&&e.representativeAdmission||ba(e)?{actionDescription:o}:{actionDescription:o,toolName:e.toolName,toolLabel:r(e.toolName),executionContext:e.toolArgs,...a}}function IW(e,t){return{description:e.description,options:e.options.map(e=>({ref:e.ref,label:PW(cn(e),t,e=>e,e=>e),intent:e.intent,...e.description?{description:e.description}:{}})),fields:e.fields,...e.form?{form:e.form}:{}}}function LW(e,t){if(e.request&&ba(e))return IW(e.request,t)}function RW(e,t){let n=Q.useMemo(()=>[...OW,...e.map(uie),...t.map(e=>`${Bc.RESOURCES}.${e}`)],[e,t]),{t:r,tComponent:i,tRole:a,tSystemEnum:o,tResourceOperation:s,formatDateTime:c}=q({component:K.LOW_LEVEL_AI_APPROVAL,keys:n});return{t:Q.useCallback((e,t)=>i(K.LOW_LEVEL_AI_APPROVAL,e,t),[i]),roleLabel:Q.useCallback(e=>a?a(e,`label`):e,[a]),toolLabel:Q.useCallback(e=>{let t=oee(e,fee.TITLE),n=r(t);return n===t||n.length===0?e:n},[r]),operationLabel:Q.useCallback((e,t)=>s(e,t,Hi.TITLE),[s]),tComponent:i,tSystemEnum:o,formatDateTime:c}}function zW(e,t){let n=new URLSearchParams(t).get(Mn);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 BW(e){let{decisions:t,readState:n,refresh:r,act:i,candidates:a}=iW(),o=Q.useMemo(()=>zW(t,window.location.search),[t]),{t:s,roleLabel:c,toolLabel:l,operationLabel:u,tSystemEnum:d,formatDateTime:f}=RW(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,b]=Q.useState([]),x=Q.useRef(new Map),S=Q.useRef(new Map),C=Q.useCallback(async(e,t,n)=>{m(t=>new Set(t).add(e));let r=x.current.get(e);try{let a=await i(e,t,n);t===yr.ANSWER&&a.kind===Mi.APPLIED&&b(t=>[{decisionRef:e,...r?{title:r}:{}},...t.filter(t=>t.decisionRef!==e)].slice(0,SW));let o=CW(a,s,S.current.get(e));g(t=>{let n=new Map(t);return o===void 0?n.delete(e):n.set(e,o),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]),w=Q.useMemo(()=>o.map(e=>({approvalId:e.decisionRef,executionId:e.executionId,systemRef:e.systemRef,systemName:e.systemDisplayName,riskLevel:e.riskLevel,question:LW(e,s),holderNotice:jW(e.route,s,c,f),requesterNotice:NW(e.requesterKind,s),...FW(e,s,c,l,u),expiresAt:e.expiresAt?new Date(e.expiresAt):void 0,createdAt:new Date(e.requestedAt),canEscalate:e.permittedActs.includes(yr.ESCALATE)&&e.declaresEscalationTarget,canClaim:e.permittedActs.includes(yr.CLAIM),canUnclaim:e.permittedActs.includes(yr.UNCLAIM),canReassign:e.permittedActs.includes(yr.REASSIGN),reassignCandidates:_.get(e.decisionRef),actionNotice:h.get(e.decisionRef),canPauseClock:e.permittedActs.includes(yr.PAUSE_CLOCK)&&!e.clockPause&&e.pauseStates.length>0,canResumeClock:e.permittedActs.includes(yr.RESUME_CLOCK)&&!!e.clockPause,pauseStateOptions:e.pauseStates.map(e=>({value:e,label:DW(e,d)})),deadlineNotice:e.nextDeadline?s(e.nextDeadline.kind===Yn.CLAIM?`deadlineClaimBy`:`deadlineDecisionBy`,{when:f(e.nextDeadline.dueAt)}):void 0,clockPausedNotice:e.clockPause?s(`clockPausedIn`,{pauseState:DW(e.clockPause.pauseStateRef,d)}):void 0,reasonCodeOptions:EW(e.reasonCodes,d),allowArgumentModification:e.plane===_n.CONVERSATIONAL,argumentsSchema:e.toolInputSchema})),[o,_,h,s,c,l,u,d,f]);x.current=new Map(w.flatMap(e=>typeof e.actionDescription==`string`?[[e.approvalId,e.actionDescription]]:[])),S.current=new Map(w.flatMap(e=>e.toolLabel?[[e.approvalId,e.toolLabel]]:[]));let T=Q.useCallback((e,t,n,r,i)=>{let a=o.find(t=>t.decisionRef===e)?.plane,c=a?Yee[a]:void 0;if(!c){g(t=>new Map(t).set(e,s(`noticeNotActionable`)));return}let l=t?c.approve:c.deny;C(e,yr.ANSWER,{answer:{decisionId:e,optionRef:l,values:[]},...TW(o,e),...n?{reason:n}:{},...r?{modifiedToolArgs:r}:{},...i?{reasonCode:i}:{}})},[C,o,s]),E=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,$.jsxs)($.Fragment,{children:[(0,$.jsx)(XU,{items:w,onApprove:(e,t,n,r)=>T(e,!0,t,n,r),onDeny:(e,t,n)=>T(e,!1,t,void 0,n),onEscalate:(e,t)=>void C(e,yr.ESCALATE,t?{reason:t}:{}),onAnswer:(e,t,n,r,i)=>void C(e,yr.ANSWER,{answer:{decisionId:e,optionRef:t,values:[...n]},...TW(o,e),...r?{reason:r}:{},...i?{reasonCode:i}:{}}),onClaim:e=>void C(e,yr.CLAIM,{}),onUnclaim:e=>void C(e,yr.UNCLAIM,{}),onReassignOpen:E,onReassign:(e,t,n)=>void C(e,yr.REASSIGN,{targetUserId:t,...n?{reason:n}:{}}),onPauseClock:(e,t)=>void C(e,yr.PAUSE_CLOCK,{pauseStateRef:t}),onResumeClock:e=>void C(e,yr.RESUME_CLOCK,{}),processingIds:p,isLoading:n===rW.LOADING,loadFailed:n===rW.FAILED,onRetry:()=>{r()},...e}),y.map(e=>(0,$.jsx)($j,{decisionRef:e.decisionRef,...e.title?{description:e.title}:{}},e.decisionRef))]})}function VW(){return(0,$.jsx)(UU,{children:(0,$.jsx)(Wk,{name:`decisions`,appearance:ci.CARD,children:(0,$.jsx)(BW,{})})})}function HW(e){return e.operationFrontendConfig?.customView}function UW(e){return e.operationFrontendConfig?.displayPresetOverride?.resourceLayoutPresetKey}var WW=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>{let{tComponent:r,isReady:i}=q({component:K.RESOURCES_LAYOUTS_ACTION});return i?(0,$.jsx)(iV,{resourceContext:e,navigationZone:t,navigationInitiator:n,errorMessage:yp({tComponent:r,componentType:K.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),errorComponent:`ResourceLayoutPreset_Action_Default`}):null};function GW({preset:e,...t}){let n=HW(t.resourceContext.operation);if(n)return(0,$.jsx)(n,{...t});let r=UW(t.resourceContext.operation),i=e??r??H.DEFAULT,a=qc(K.RESOURCES_LAYOUTS_ACTION,`ResourceLayout_Action`)(i);return(0,$.jsx)(a,{...t})}var KW=rc(K.LOW_LEVEL_DIALOG,`Dialog`,[`Trigger`,`Content`,`Close`,`Header`,`Footer`,`Title`,`Description`]);function qW({preset:e=H.DEFAULT,...t}){let n=KW(e);return(0,$.jsx)(n,{...t})}var JW=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=KW(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});JW.displayName=`DialogTrigger`;var YW=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=KW(e);return(0,$.jsx)(r.Content,{...t,ref:n})});YW.displayName=`DialogContent`;function XW({preset:e=H.DEFAULT,...t}){let n=KW(e);return(0,$.jsx)(n.Close,{...t})}function ZW({preset:e=H.DEFAULT,...t}){let n=KW(e);return(0,$.jsx)(n.Header,{...t})}function QW({preset:e=H.DEFAULT,...t}){let n=KW(e);return(0,$.jsx)(n.Footer,{...t})}var $W=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=KW(e);return(0,$.jsx)(r.Title,{...t,ref:n})});$W.displayName=`DialogTitle`;var eG=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=KW(e);return(0,$.jsx)(r.Description,{...t,ref:n})});eG.displayName=`DialogDescription`;function tG({open:e,onAcknowledge:t,fields:n,resourceType:r}){let{tComponent:i,tResourceFieldDisplay:a,isReady:o}=q({component:K.RESOURCES_LAYOUTS_CREATE,resource:r}),s=Q.useRef(n);if(s.current=n,(0,Q.useEffect)(()=>()=>{s.current=[]},[]),!o)return null;let c=yp({tComponent:i,componentType:K.RESOURCES_LAYOUTS_CREATE,key:`ephemeral.title`}),l=yp({tComponent:i,componentType:K.RESOURCES_LAYOUTS_CREATE,key:`ephemeral.warning`}),u=yp({tComponent:i,componentType:K.RESOURCES_LAYOUTS_CREATE,key:`ephemeral.acknowledge`});return(0,$.jsx)(qW,{open:e,onOpenChange:()=>{},children:(0,$.jsxs)(YW,{className:`sm:max-w-lg`,onPointerDownOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),showCloseButton:!1,children:[(0,$.jsxs)(ZW,{children:[(0,$.jsx)($W,{className:`text-warning-foreground`,children:c}),(0,$.jsx)(eG,{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)(Fj,{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)(QW,{children:(0,$.jsx)(Y,{onClick:t,children:u})})]})})}var nG=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>{let{tComponent:r,isReady:i}=q({component:K.RESOURCES_LAYOUTS_CREATE}),{resourceType:a,operation:o,resourceConfig:s,isSemanticCustomOperation:c,navigateToPreferredRead:l,reportError:u,goBackWithinZone:d}=YS({resourceContext:e,navigationZone:t,navigationInitiator:n}),f=yp({tComponent:r,componentType:K.RESOURCES_LAYOUTS_CREATE,key:`formSubmissionFailed`}),p=yp({tComponent:r,componentType:K.RESOURCES_LAYOUTS_CREATE,key:`semanticOperationFailed`}),{closeOverlay:m}=yS(),h=e.additionalContext?.defaultValuesOverride,g=!!e.additionalContext?.quickCreateRequest,[_,v]=(0,Q.useState)(null),y=(0,Q.useCallback)(n=>{if(g)t===Gn.OVERLAY?m():d();else if(s){if(n){let r=n._id||n[s.resourceFieldIdentifier];if(r){l({contextResourceIdentifiers:kn.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,a,String(r)),fallbackToGoBack:!1,transitionOverride:t===Gn.OVERLAY?Mo.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=BS(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===Gn.OVERLAY?()=>m():void 0,[t,m]);return i?c?(0,$.jsx)(iV,{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)(eV,{resourceContext:e,navigationZone:t,navigationInitiator:n}),(0,$.jsx)(cB,{resourceContext:e,defaultValuesOverride:h,navigationZone:t,onSuccess:b,onError:S,onCancel:C,showErrorSummary:!0}),_&&(0,$.jsx)(tG,{open:!0,onAcknowledge:x,fields:_.fields,resourceType:a})]}):null};function rG({preset:e,...t}){let n=HW(t.resourceContext.operation);if(n)return(0,$.jsx)(n,{...t});let r=UW(t.resourceContext.operation),i=e??r??H.DEFAULT,a=qc(K.RESOURCES_LAYOUTS_CREATE,`ResourceLayout_Create`)(i);return(0,$.jsx)(a,{...t})}var iG=700;function aG(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},iG))},[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 oG=Cu.HIDDEN;function sG(e){let{resourceType:t,resourceConfig:n,data:r,hostIdentifiers:i}=e,a={...i??{}},o=n?.resourcePrimaryScope;if(o){let e=r[Pr[o]];typeof e==`string`&&e.length>0&&(a[mee[o]]=e)}let s=n?.resourceFieldIdentifier,c=s?U.getResourceObjectId(r,s):void 0;return c&&(a[t]=c),a}function cG({resourceType:e,schema:t,data:n,className:r,primaryLabel:i=null,contextResourceIdentifiers:a}){let{registry:o}=fm(),s=(0,Q.useMemo)(()=>o.resourceConfigurations[e],[o,e]),c=(0,Q.useMemo)(()=>sG({resourceType:e,resourceConfig:s,data:n,hostIdentifiers:a}),[e,s,n,a]),l=(0,Q.useMemo)(()=>U.buildContextualParameters(c,o),[c,o]),u=U.getInstance().getResourceId(c[e])||void 0,d=s?.frontendConfiguration?.layout?.summary,f=s?.frontendConfiguration?.layout?.defaultChromeMode?.summary,p=(0,Q.useMemo)(()=>d??KR(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:J.READ}}),[e]);return(0,$.jsx)(jA,{kind:kA.SUMMARY,children:(0,$.jsx)(Pge,{value:h,children:(0,$.jsx)(zA.Provider,{value:f===void 0,children:(0,$.jsx)(AB,{schema:t,data:n,resourceType:e,resourceId:u,contextResourceIdentifiers:c,contextualParameters:l,className:r,labels:g,disableInlineEdit:!0,layoutTemplate:p,defaultDisplayChromeMode:f??oG,isLoading:!1})})})})}cG.displayName=`ResourceSummaryDisplayer`;var lG=cG;function uG({className:e,children:t}){return(0,$.jsx)(`div`,{className:G(`flex min-w-0 flex-wrap items-center gap-x-group gap-y-item`,`[&>*]:w-auto`,e),children:t})}var dG=`a[href], button, input, select, textarea, summary, [contenteditable="true"], [role="button"], [role="link"], [role="checkbox"], [role="switch"], [role="menuitem"], [role="option"], [role="tab"]`;function fG(e){let t=e.target,n=e.currentTarget;if(!(t instanceof Element)||t===n)return!1;let r=t.closest(dG);return r!==null&&r!==n&&n.contains(r)}var pG=`15rem`,mG=`border border-border rounded-lg divide-y divide-border list-none m-0 p-0`,hG=`px-card py-card-sm`,gG=`ps-card`,_G=`flex items-start gap-element-sm`,vG=`border-s border-transparent ${gG}`,yG=`grid gap-element list-none m-0 p-0`;function bG(e){return e===void 0?mG:G(yG)}function xG(e){if(e===void 0)return;let t=Math.min(Math.max(Math.trunc(e),1),6);return{gridTemplateColumns:`repeat(auto-fill, minmax(max(${pG}, ${`calc((100% - ${t-1} * var(--spacing-element)) / ${t})`}), 1fr))`}}var SG={vertical:No.MIDDLE,horizontal:Cs.END,orientation:Ui.HORIZONTAL},CG={[No.TOP]:`items-start`,[No.MIDDLE]:`items-center`,[No.BOTTOM]:`items-end`};function wG(e=SG){let{vertical:t,horizontal:n,orientation:r=Ui.HORIZONTAL}=e,i=r===Ui.VERTICAL?`flex flex-col gap-element-sm`:`flex gap-element-sm`;return n===Cs.MIDDLE?{containerClass:`flex ${t===No.TOP?`flex-col-reverse`:`flex-col`} gap-element-sm`,contentClass:`min-w-0`,actionsClass:`${i} self-center`}:{containerClass:`flex ${n===Cs.START?`flex-row-reverse`:``} ${CG[t]} gap-element-sm`.replace(/\s+/g,` `).trim(),contentClass:`min-w-0 flex-1`,actionsClass:`${i} shrink-0`}}var TG=async()=>{throw Error(`A collection cell does not edit in place.`)};function EG(e){let t=oj(),n=ym()?.registry,{resourceType:r,record:i,collectionContextResourceIdentifiers:a}=e;return(0,Q.useMemo)(()=>{if(!n||!i)return t;let e=sG({resourceType:r,resourceConfig:n.resourceConfigurations[r],data:i,hostIdentifiers:a??t.contextResourceIdentifiers});return{...t,resourceType:r,resourceId:kn.getResourceId(e[r])||void 0,contextResourceIdentifiers:e,contextualParameters:U.buildContextualParameters(e,n),canInlineEdit:!1,doInlineUpdate:TG,defaultInlineEdit:void 0,fileUploadContext:void 0,rmm:null}},[t,n,i,r,a])}function DG({fieldName:e,value:t,fieldSchema:n,fieldLabel:r,resourceType:i,record:a,collectionContextResourceIdentifiers:o,tResourceFieldEnumValue:s,fieldLabelVisible:c=!1}){let l=EG({resourceType:i,record:a,collectionContextResourceIdentifiers:o}),u=(0,Q.useMemo)(()=>{let t=n?Rc(n):void 0;if(!t)return;let r=pt(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:en.MUTED,size:ha.XS,children:[r,`:`]}):(0,$.jsxs)(`span`,{className:`sr-only`,children:[r,`: `]})),n?(0,$.jsx)(aj.Provider,{value:l,children:(0,$.jsx)(rk,{displayChromeMode:Cu.COMPACT,children:(0,$.jsx)(_R,{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 OG({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 U.buildConfigurationError(Lu.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:t,component:`ResourceListItemRenderer`});let v=n.resourceFieldIdentifier,y=U.getResourceObjectId(e,v),{t:b,formatDate:x,formatDateTime:S}=q({resource:t}),C=(0,Q.useMemo)(()=>{let n=U.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 GA(n)?String(n)!==C:!1}),[a,e,C]),T=(0,Q.useMemo)(()=>U.resolveRowSchema(n,e),[n,e]),E=(0,Q.useMemo)(()=>T?_r.getObjectLikeFieldShape(T,{commonOnly:!1})??null:null,[T]),D=Q.useContext(Xg),O=D?.UIConfig?.currentBreakpoint??Yo.DESKTOP,k=RA(n?.frontendConfiguration?.layout?.defaultChromeMode?.summary,O),A=(0,Q.useMemo)(()=>JA(k,w.map(e=>{let t=E?.[e];return{schemaType:t?Zl(t):void 0,present:!0,declaredChrome:t?RA(L(t)?.chromeMode,O):void 0}})),[k,w,E,O]),j=n?.frontendConfiguration?.layout?.summary,M=_?.hover??``,N=_?.transition??``,P=wG(u),F=D?.UIConfig?.currentBreakpoint===Yo.MOBILE,I=d&&m&&F,R=aG(()=>p?.(e),{enabled:d&&!!p&&F}),z=!!c||I,B=()=>{R.consumeLongPress()||(I?p?.(e):c?.(e))};return(0,$.jsxs)(`div`,{"data-slot":`resource-list-item`,className:G(`group/list-item`,hG,N,z&&`relative`,z&&M,z&&`cursor-pointer`,f&&`bg-primary/5`,d&&`select-none`,g),onClick:z?e=>{fG(e)||B()}:void 0,...R.handlers,children:[z&&(0,$.jsx)(`button`,{type:`button`,"aria-label":String(C),className:G(`absolute inset-0 rounded-[inherit] outline-none`,Dg(e_.INSET)),onClick:e=>{e.stopPropagation(),B()}}),(0,$.jsxs)(`div`,{className:G(_G,z&&`relative`),children:[d&&(0,$.jsx)(`div`,{className:G(`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)(CI,{checked:f,onCheckedChange:()=>p?.(e),"aria-label":h??String(C)})}),(0,$.jsxs)(`div`,{className:G(P.containerClass,`min-w-0 flex-1`),children:[(0,$.jsx)(`div`,{className:G(`space-y-item-xs`,P.contentClass),children:j&&T?(0,$.jsx)(lG,{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)(uG,{children:w.map((n,r)=>{let a=e[n];return(0,$.jsx)(DG,{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 kG({navigationZone:e,className:t}){let n=Nx(),{tComponent:r}=q({component:K.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:G(`p-container`,t),children:(0,$.jsx)(aV,{resourceContext:a.resourceContext,navigationZone:e,onSuccess:i,onCancel:i,errorMessage:yp({tComponent:r,componentType:K.RESOURCES_LAYOUTS_ACTION,key:`executionFailed`}),errorComponent:`ResourceInPlaceOperationRow`})}):null}var AG;(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`})(AG||={});var jG=new Set;function MG(e,t){return NG(e,t,go)}function NG(e,t,n){if(!e)return jG;let r=new Set;for(let i of[e,...Rs(t)]){let e=_r.getObjectLikeFieldShape(i,{commonOnly:!1});for(let[t,i]of Object.entries(e??{}))n(i)&&r.add(t)}return r.size>0?r:jG}var PG=class e{constructor(){}static detectSummaryFields(e){return U.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(!_ae(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?Pr[n]:void 0;r&&t.add(r);let i=(`initiatorInfos`in e.operation?e.operation.initiatorInfos:void 0)??[];if(i.length>0){let n=U.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=NG(a?.mainSchema,a?.inheritenceSchemaDefinition,jo),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=Zl(t),c=AG.UNKNOWN;if(mr(t)){s.push({fieldName:e,schema:t,fieldType:AG.NUMBER_RANGE,enumValues:void 0,referenceTargetResourceType:void 0});continue}if(Jee(t)){s.push({fieldName:e,schema:t,fieldType:AG.YEAR_MONTH_RANGE,enumValues:void 0,referenceTargetResourceType:void 0});continue}let l,u;switch(a){case jr.STRING:c=AG.STRING;break;case jr.NUMBER:case jr.BIGDECIMAL:c=AG.NUMBER;break;case jr.BOOLEAN:c=AG.BOOLEAN;break;case jr.ENUM:c=AG.ENUM;try{l=pt(li(t))}catch{l=[]}break;case jr.DATE:case jr.DATETIME:c=AG.DATE;break;default:c=AG.STRING}if(c===AG.STRING&&n){let t=n.registry.fieldIdentifierToResourceType?.[e];t&&(c=AG.REFERENCE,u=t)}c===AG.STRING&&(jo(t)||o.has(e))&&(c=AG.YEAR_MONTH),s.push({fieldName:e,schema:t,fieldType:c,enumValues:l,referenceTargetResourceType:u})}return s}},FG=new Set([J.LIST,J.SEARCH,J.COUNT]);function IG(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&&wo.resolveForeignKeyHolderResourceType(t)===e.targetResourceType).map(t=>({relationship:t,foreignKeyField:wo.tryResolveRelationshipForeignKeyIdentity(t,e.registry.allResourceFieldIdentifiers)?.fieldIdentifier})).filter(t=>e.selectedForeignKey===void 0||t.foreignKeyField===e.selectedForeignKey)}var LG;(function(e){e.NAMES_HOST=`names_host`,e.OTHER=`other`,e.NO_ROUTE=`no_route`})(LG||={});function RG(e){return zG(e)===LG.NAMES_HOST}function zG(e){let{childContext:t,hostResourceType:n,hostResourceId:r,registry:i,edgeForeignKeyFields:a}=e,o=t.operation.initiatorInfos??[],s=U.buildContextualParameters(t.contextResourceIdentifiers,i),c=U.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)?LG.NAMES_HOST:LG.OTHER:LG.NO_ROUTE}function BG(e,t){return U.buildConfigurationError(Lu.CONFIGURATION,{message:e,component:`confineRelatedCollectionToHost`,...t})}function VG(e,t,n){let r=n.resourceConfigurations[t]?.operations??[];return new Set(Object.keys(xS(e,r)??{}))}function HG(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=U.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:U.buildRelationshipEdgeKey({parentResourceType:e.resourceType,childResourceType:n,foreignKeyField:e.relationshipField}),requirement:r?.requirement??_a.MANDATORY,isPrimaryScope:r?.isPrimaryScope??!1,...r?.primaryScope?{primaryScope:r.primaryScope}:{}}}),h={...t,contextResourceIdentifiers:f,parentResourcesRequirements:m};if(RG({childContext:h,hostResourceType:n,hostResourceId:r,registry:a,edgeForeignKeyFields:i}))return h}}function UG(e){let{childContext:t,hostResourceId:n,callerPinnedFilters:r,registry:i}=e,{operation:a}=t,o=a.isBulkOperation===!0?void 0:vl(a);if(!o||!FG.has(o))return t;if(r&&Object.keys(r).length>0){let a=KG(t,r,i,GG.CALLER);if(!n)return a;try{return WG({...e,childContext:a,hostResourceId:n})}catch(e){if(e.wildoError?.context?.conflictingKey!==void 0)throw e;return a}}return n?WG({...e,hostResourceId:n}):t}function WG(e){let{childContext:t,hostResourceType:n,hostResourceId:r,hostRelationships:i,selectedForeignKey:a,registry:o}=e,{operation:s,resourceType:c}=t,l=i?IG({hostResourceType:n,hostRelationships:i,targetResourceType:c,selectedForeignKey:a,registry:o}):[];if(a!==void 0&&l.length===0)throw BG(`"${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=zG({childContext:t,hostResourceType:n,hostResourceId:r,registry:o,edgeForeignKeyFields:u});if(d===LG.NAMES_HOST)return t;let f=l.length<=1?HG({childContext:t,hostResourceType:n,hostResourceId:r,edgeForeignKeyFields:u,registry:o}):void 0;if(f)return f;if(d===LG.NO_ROUTE)return t;if(l.length===0)throw BG(`"${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 BG(`"${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 BG(`"${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 KG(t,{[p]:r},o,GG.RELATIONSHIP,n)}var GG;(function(e){e.CALLER=`caller`,e.RELATIONSHIP=`relationship`})(GG||={});function KG(e,t,n,r,i){let a=r===GG.CALLER?`the embed's own filter`:`the relationship's foreign key`,{operation:o,resourceType:s}=e;if(vl(o)===J.COUNT)throw BG(`"${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=VG(o,s,n),l=Object.keys(t).find(e=>!c.has(e));if(l!==void 0&&r===GG.CALLER)throw BG(`"${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 BG(`"${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 BG(`"${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 qG(e){let{searchOperation:t}=e;if(!t)return!1;let n=Object.keys(e.pinnedFilters??{});if(n.length>0){let r=VG(t,e.resourceType,e.registry);if(!n.every(e=>r.has(e)))return!1}let r=t=>U.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 JG(e){let t=e?.wildoError?.context?.message;return typeof t==`string`&&t.length>0?t:e instanceof Error?e.message:void 0}var YG=({pagination:e,onPaginationChange:t,className:n})=>{let{tComponent:r,isReady:i}=q({component:K.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(K.RESOURCES_LAYOUTS_PAGINATION,`paginationLabel`),className:G(`flex items-center justify-between`,n),children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"aria-live":`polite`,children:r(K.RESOURCES_LAYOUTS_PAGINATION,`showing`,{from:a,to:o,total:e.total})}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[(0,$.jsx)(Y,{variant:X.OUTLINE,size:df.SM,disabled:e.page<=1,"aria-label":r(K.RESOURCES_LAYOUTS_PAGINATION,`previousPage`),onClick:s,children:r(K.RESOURCES_LAYOUTS_PAGINATION,`previous`)}),(0,$.jsx)(Y,{variant:X.OUTLINE,size:df.SM,disabled:e.page>=e.totalPages,"aria-label":r(K.RESOURCES_LAYOUTS_PAGINATION,`nextPage`),onClick:c,children:r(K.RESOURCES_LAYOUTS_PAGINATION,`next`)})]})]})};function XG({preset:e=H.DEFAULT,...t}){let n=qc(K.RESOURCES_LAYOUTS_PAGINATION,`ResourceLayout_Pagination`)(e);return(0,$.jsx)(n,{...t})}function ZG(e,t){let n=gc();return _m(n.interactiveState?.emptyDisplay)===`placeholder`&&QG(e,t)}function QG(e,t){return e?.primaryAction!==!1&&t}var $G=qc(K.RESOURCES_LAYOUTS_EMPTY_STATE,`ResourceEmptyState`);function eK({resourceType:e,config:t,hasCreateOperation:n=!1,onCreateAction:r,variant:i=`default`,title:a,description:o,preset:s=H.DEFAULT}){let{tResourceEmptyState:c,tResourceOperation:l,tComponent:u,isReady:d}=q({component:[K.RESOURCES_LAYOUTS_EMPTY_STATE,K.RESOURCES_LAYOUTS_LIST],resource:e}),{activateFlow:f}=dU(),p=gc(),m=_m(p.interactiveState?.emptyDisplay),h=(0,Q.useMemo)(()=>a||c(e,`title`)||yp({tComponent:u,componentType:K.RESOURCES_LAYOUTS_LIST,key:`noItems`}),[a,e,c,u]),g=(0,Q.useMemo)(()=>a?o:c(e,`description`),[a,o,e,c]),_=QG(t,n),v=(0,Q.useMemo)(()=>{if(_)return l(e,J.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===A.LINK)return{label:i,onClick:()=>{window.open(r,`_blank`,`noopener,noreferrer`)}};if(n===A.GUIDANCE)return{label:i,onClick:()=>f(r)}},[t?.secondaryAction,e,c,f]),x=$G(s);return!d||m===`render-children`||qoe(m)?null:(0,$.jsx)(x,{title:h,description:g,iconRef:y,primaryActionLabel:v,onPrimaryAction:_?r:void 0,showPrimaryAction:_,secondaryAction:b,variant:i,hidden:Yp(m),style:Yp(m)?{display:`none`}:void 0})}function tK(e){return e==null||e===``?!1:Array.isArray(e)?e.length>0:typeof e!=`object`||Object.keys(e).length>0}function nK(e){return e.isSearchActive||Object.values(e.filterValues).some(tK)}function rK(e){return!(e.hasLoadedOnce&&e.itemCount===0&&!e.isNarrowed&&e.emptyStateOffersCreate)}var iK=300;function aK({enabled:e,debounceMs:t=iK,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 oK=({query:e,onChange:t,onClear:n,resourceType:r,autoFocus:i,onFocus:a,onBlur:o,onKeyDown:s})=>{let{tComponent:c,isReady:l}=q({component:K.RESOURCES_LAYOUTS_LIST}),{renderIcon:u}=ef(),d=u(W.SEARCH,{size:tr.SM}),f=u(W.X_MARK,{size:tr.SM});if(!l)return null;let p=c(K.RESOURCES_LAYOUTS_LIST,`searchPlaceholder`);return(0,$.jsx)(XM,{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)(Y,{type:`button`,variant:X.GHOST,size:df.ICON_SM,onClick:n,"aria-label":c(K.RESOURCES_LAYOUTS_LIST,`clearSearch`),className:`me-1`,children:f}):void 0})};function sK(e){let{resolvedRegionalPreferences:t}=q(),{registry:n}=fm(),r=n.resourceConfigurations[e],i=r?.mainSchema,a=r?.inheritenceSchemaDefinition,o=(0,Q.useMemo)(()=>MG(i,a),[i,a]),s=t?.timezone,c=(0,Q.useContext)(ih)?.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 cK=864e5;function lK(e,t){return new Date(e.getTime()+t*cK)}function uK(e,t,n,r){let i=e=>n?e:zl.startOfZonedDay(e,r),a={};return e!==void 0&&(a.startDate=i(e)),t!==void 0&&(a.endDate=new Date(i(lK(t,1)).getTime()-1)),a}function dK(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 fK(e,t,n){if(typeof e!=`object`||!e||e instanceof Date||Array.isArray(e))return;let r=e,i=dK(r.startDate),a=dK(r.endDate);if(!i&&!a)return;let o=e=>zl.calendarDateToday({timezone:t?`UTC`:n},e);return{firstDay:i?o(i):void 0,lastDay:a?o(a):void 0}}function pK(e){return typeof e==`string`&&ul(e)!==void 0?e:void 0}function mK(e){let t=pK(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=pK(n),a=pK(r);return{...i===void 0?{}:{startMonth:i},...a===void 0?{}:{endMonth:a}}}function hK(e,t,n){let r={...mK(e)},i=pK(n);return i===void 0?delete r[t]:r[t]=i,r.startMonth===void 0&&r.endMonth===void 0?void 0:r}var gK={[As.TODAY]:e=>({firstDay:e,lastDay:e}),[As.YESTERDAY]:e=>({firstDay:lK(e,-1),lastDay:lK(e,-1)}),[As.LAST_7_DAYS]:e=>({firstDay:lK(e,-6),lastDay:e}),[As.LAST_30_DAYS]:e=>({firstDay:lK(e,-29),lastDay:e}),[As.THIS_MONTH]:e=>({firstDay:new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1)),lastDay:e}),[As.THIS_YEAR]:e=>({firstDay:new Date(Date.UTC(e.getUTCFullYear(),0,1)),lastDay:e}),[As.BEFORE_TODAY]:e=>({lastDay:lK(e,-1)}),[As.BEFORE_NOW]:e=>({lastDay:lK(e,-1)}),[As.NEXT_7_DAYS]:e=>({firstDay:e,lastDay:lK(e,6)}),[As.NEXT_30_DAYS]:e=>({firstDay:e,lastDay:lK(e,29)})},_K=new Set([As.BEFORE_NOW]),vK;(function(e){e.EXACT_BOUNDS=`exact_bounds`,e.ENDS_EARLIER_TODAY=`ends_earlier_today`})(vK||={});function yK(e,t,n,r){let i=r.calendarDateFields.has(t);return _K.has(e)&&!i?{window:{endDate:new Date(r.now.getTime())},readBack:vK.ENDS_EARLIER_TODAY}:{window:xK(gK[e](n),i,r.timeZone),readBack:vK.EXACT_BOUNDS}}function bK(e,t,n){if(!NK(e)||e.startDate!==void 0||e.endDate===void 0)return!1;let r=uK(t,void 0,!1,n.timeZone).startDate,i=e.endDate.getTime();return r!==void 0&&i>=r.getTime()&&i<=n.now.getTime()}function xK(e,t,n){return uK(e.firstDay,e.lastDay,t,n)}var SK={[qs.THIS_MONTH]:e=>({first:e,last:e}),[qs.LAST_MONTH]:e=>({first:e-1,last:e-1}),[qs.NEXT_MONTH]:e=>({first:e+1,last:e+1}),[qs.THIS_QUARTER]:e=>({first:e-e%3,last:e-e%3+2}),[qs.LAST_QUARTER]:e=>({first:e-e%3-3,last:e-e%3-1}),[qs.LAST_3_MONTHS]:e=>({first:e-2,last:e}),[qs.LAST_12_MONTHS]:e=>({first:e-11,last:e}),[qs.YEAR_TO_DATE]:e=>({first:e-e%12,last:e}),[qs.THIS_YEAR]:e=>({first:e-e%12,last:e-e%12+11})};function CK(e){return lc(Math.floor(e/12),e%12+1)}function wK(e,t){let n=SK[e](t.getUTCFullYear()*12+t.getUTCMonth());return{startMonth:CK(n.first),endMonth:CK(n.last)}}var TK={[Hc.CURRENT_USER]:e=>e.userId!==void 0&&e.userId.length>0?e.userId:void 0};function EK(e){return typeof e==`object`&&!!e&&`contextValue`in e}function DK(e){return typeof e==`object`&&!!e&&`relativeMonthRange`in e}function OK(e){return typeof e==`object`&&!!e&&`relativeRange`in e}function kK(e,t){let n=zl.calendarDateToday({timezone:t.timeZone},t.now),r={};for(let[i,a]of Object.entries(e.filters))if(OK(a))r[i]=yK(a.relativeRange,i,n,t).window;else if(DK(a))r[i]=wK(a.relativeMonthRange,n);else if(EK(a)){let e=TK[a.contextValue](t.viewer);if(e===void 0)return null;r[i]=e}else r[i]=a;return r}function AK(e,t){return Object.values(e.filters).every(e=>!EK(e)||TK[e.contextValue](t)!==void 0)}function jK(e,t){if(NK(t)){if(!NK(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(PK(t))return PK(e)&&e.min===t.min&&e.max===t.max;if(MK(t)||MK(e)){let n=mK(e),r=mK(t);return(n.startMonth!==void 0||n.endMonth!==void 0)&&n.startMonth===r.startMonth&&n.endMonth===r.endMonth}return e===t}function MK(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`&&ul(t)!==void 0)}function NK(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 PK(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 FK(e,t,n){let r=kK(e,n);if(r===null)return!1;let i=Object.entries(r),a=zl.calendarDateToday({timezone:n.timeZone},n.now);return i.length>0&&i.every(([r,i])=>{let o=e.filters[r];return o!==void 0&&OK(o)&&yK(o.relativeRange,r,a,n).readBack===vK.ENDS_EARLIER_TODAY?bK(t[r],a,n):jK(t[r],i)})}function IK(e,t,n){let r=kK(e,n);if(r===null)return t;let i={...t};if(FK(e,t,n)){for(let e of Object.keys(r))delete i[e];return i}return{...i,...r}}function LK(e,t,n){let r=new Set;for(let i of e)if(FK(i,t,n))for(let e of Object.keys(i.filters))r.add(e);return r}var RK=/^(\d{4})-(\d{2})-(\d{2})$/;function zK(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=RK.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 BK(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=zK(t.startDate,n),a=zK(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=zK(e,n);return i?r(i):null}var VK=({resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r,presetFilters:i,className:a})=>{let{tResourceFieldDisplay:o,tResourceFieldEnumValue:s,tComponent:c,formatDate:l,isReady:u}=q({component:K.RESOURCES_LAYOUTS_FILTERS,resource:e}),{renderIcon:d}=ef(),f=e=>c(K.RESOURCES_LAYOUTS_FILTERS,e),p=sK(e),m=p.calendarDateFields,h=(0,Q.useMemo)(()=>{if(!i||i.length===0)return t;let e=LK(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(W.X_MARK,{size:tr.XS});return(0,$.jsxs)(`div`,{className:G(`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===AG.REFERENCE)o=(0,$.jsx)(HK,{field:t,value:String(i)});else if(t.fieldType===AG.ENUM){let n=s(e,r,String(i),t.schema);typeof n==`string`&&(o=n)}else if(t.fieldType===AG.BOOLEAN)o=f(i?`booleanYes`:`booleanNo`);else if(t.fieldType===AG.YEAR_MONTH){let e=l(String(i),{yearMonth:!0});e!==``&&(o=e)}else if(t.fieldType===AG.YEAR_MONTH_RANGE){let{startMonth:e,endMonth:t}=mK(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===AG.DATE){let e=BK(i,l,m.has(t.fieldName));e!==null&&(o=e)}else if(t.fieldType===AG.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)(Y,{type:`button`,variant:X.GHOST,size:df.ICON_SM,onClick:()=>y(r),className:`ms-0.5 h-4 w-4 p-0`,"aria-label":f(`removeFilter`),children:b})]},r)}),(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.SM,onClick:v,className:`text-xs text-muted-foreground`,children:f(`clearAll`)})]})},HK=({field:e,value:t})=>{let{getDisplayLabel:n,isLoadingCurrentValue:r}=fV({schema:e.schema,name:e.fieldName,value:t,targetResourceType:e.referenceTargetResourceType});return r?(0,$.jsx)($.Fragment,{children:`…`}):(0,$.jsx)($.Fragment,{children:n(t)})};function UK(e,t){return(t?t.map(t=>e[t]):Object.values(e)).filter(e=>e!=null&&e!==``).length}var WK=`filters-panel`,GK=({activeCount:e,isExpanded:t,onToggle:n,className:r})=>{let{tComponent:i,isReady:a}=q({component:K.RESOURCES_LAYOUTS_FILTERS}),{renderIcon:o}=ef();if(!a)return null;let s=(e=>i(K.RESOURCES_LAYOUTS_FILTERS,e))(`filters`);return(0,$.jsxs)(Y,{variant:X.GHOST,size:df.SM,onClick:n,"aria-expanded":t,"aria-controls":WK,"aria-label":s,title:s,"data-slot":`collection-toolbar-filters-trigger`,className:G(`gap-element-sm`,r),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:o(W.FILTER,{size:tr.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})]})},KK=({resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r,className:i})=>{let{tResourceFieldDisplay:a,tResourceFieldEnumValue:o,tComponent:s,resolvedRegionalPreferences:c,isReady:l}=q({component:K.RESOURCES_LAYOUTS_FILTERS,resource:e}),{timeZone:u,calendarDateFields:d}=sK(e),f=e=>s(K.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:WK,className:G(`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)(p_e,{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))})},qK=({resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r,className:i})=>{let[a,o]=(0,Q.useState)(!1),s=UK(n,t.map(e=>e.fieldName));return t.length===0?null:(0,$.jsxs)(`div`,{className:G(`space-y-element-sm`,i),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-element-sm flex-wrap`,children:[(0,$.jsx)(GK,{activeCount:s,isExpanded:a,onToggle:()=>o(e=>!e)}),(0,$.jsx)(VK,{resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r})]}),a&&(0,$.jsx)(KK,{resourceType:e,filterFields:t,currentFilters:n,onFiltersChange:r})]})},d_e={[Zu.TOGGLE]:fc.TOGGLE,[Zu.RADIO]:fc.RADIO,[Zu.SWITCH]:fc.SELECT,[Zu.CHECKBOX]:fc.SELECT},JK;(function(e){e.ANY=``,e.YES=`true`,e.NO=`false`})(JK||={});function f_e(e){return zd(JK).enumUI({edit:{editMode:d_e[aa(e)]}})}var p_e=({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)(()=>f_e(e.schema),[e.schema]);switch(e.fieldType){case AG.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)(hI,{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:Nf.SM})]});case AG.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)(XM,{type:`text`,value:u,onChange:m})]});case AG.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)(XM,{type:`number`,value:u,onChange:h})]});case AG.BOOLEAN:{let r=[{value:JK.ANY,label:o(`booleanAny`)},{value:JK.YES,label:o(`booleanYes`)},{value:JK.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)(tI,{name:e.fieldName,schema:g,options:r,value:t===void 0?JK.ANY:String(t),onChange:e=>i(e===JK.ANY?void 0:e===JK.YES),controlSize:Nf.SM})]})}case AG.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)(tI,{name:e.fieldName,schema:e.schema,options:s,value:t??``,onChange:e=>i(e||void 0),controlSize:Nf.SM})]})}case AG.DATE:{let r=fK(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)(cN,{name:e.fieldName,schema:e.schema,value:a,onChange:e=>{let t=e?.from??e?.to;i(t?uK(t,e?.to??t,s,c):void 0)},placeholder:o(`anyValue`),dateFormat:l,timeZone:c,controlSize:Nf.SM})]})}case AG.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)(MI,{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:Nf.SM})]});case AG.YEAR_MONTH_RANGE:{let r=mK(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)(MI,{name:`${e.fieldName}.startMonth`,schema:e.schema,value:r.startMonth,onChange:e=>i(hK(t,`startMonth`,e)),clearable:!0,labelledBy:`${p} ${a}`,controlId:`${p}-start-month`,monthPlaceholder:o(`anyValue`),controlSize:Nf.SM}),(0,$.jsx)(`span`,{id:s,className:`text-xs text-muted-foreground`,children:o(`monthRangeEnd`)}),(0,$.jsx)(MI,{name:`${e.fieldName}.endMonth`,schema:e.schema,value:r.endMonth,onChange:e=>i(hK(t,`endMonth`,e)),clearable:!0,labelledBy:`${p} ${s}`,controlId:`${p}-end-month`,monthPlaceholder:o(`anyValue`),controlSize:Nf.SM})]})}case AG.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)(XM,{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)(XM,{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)(XM,{type:`text`,value:u,onChange:m})]})}},YK=`__wildo-quick-filter-all__`,m_e=md(),h_e=`@max-[32rem]/collection-toolbar:hidden`,g_e=`hidden @max-[32rem]/collection-toolbar:block`,XK=({resourceType:e,field:t,value:n,onChange:r,className:i})=>{let{tComponent:a,tResourceFieldDisplay:o,tResourceFieldEnumValue:s,isReady:c}=q({component:K.RESOURCES_LAYOUTS_FILTERS}),l=(0,Q.useCallback)(e=>{typeof e==`string`&&e!==``&&r(e===YK?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(K.RESOURCES_LAYOUTS_FILTERS,`enumAll`),p=a(K.RESOURCES_LAYOUTS_FILTERS,`quickFilterLabel`,{field:d}),m=[{value:YK,label:f},...u.map(n=>({value:n,label:s(e,t.fieldName,n,t.schema)}))],h=n??YK;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_O,{type:mO.SINGLE,value:h,onValueChange:l,size:df.SM,rovingFocus:!0,loop:!0,className:G(`justify-start`,h_e,i),"data-slot":`collection-quick-filter`,"aria-label":p,children:m.map(e=>(0,$.jsx)(vO,{value:e.value,size:df.SM,children:e.label},e.value))}),(0,$.jsx)(`div`,{className:G(g_e,i),"data-slot":`collection-quick-filter-select`,children:(0,$.jsx)(fF,{name:`quick-filter-${t.fieldName}`,schema:m_e,options:m,value:h,onChange:e=>l(e),"aria-label":p,size:Nf.SM})})]})},__e=({resourceType:e,presets:t,currentFilters:n,onFiltersChange:r,className:i})=>{let{tResourceFilterPreset:a}=q({component:K.RESOURCES_LAYOUTS_FILTERS}),o=new Date,s=sK(e),c=(0,Q.useMemo)(()=>t.filter(e=>FK(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(IK(o,n,{now:new Date,...s}))},[c,t,n,r,s]);return t.length===0?null:(0,$.jsx)(_O,{type:mO.MULTIPLE,appearance:hO.CHIPS,value:c,onValueChange:l,size:df.SM,orientation:Ui.HORIZONTAL,className:i,"data-slot":`collection-filter-presets`,children:t.map(t=>{let n=a(e,t.ref,`label`);return(0,$.jsx)(vO,{value:t.ref,size:df.SM,"data-preset":t.ref,disabled:!AK(t,s.viewer),children:n},t.ref)})})},ZK=rc(K.LOW_LEVEL_POPOVER,`Popover`,[`Trigger`,`Content`,`Anchor`]);function QK({preset:e=H.DEFAULT,...t}){let n=ZK(e);return(0,$.jsx)(n,{...t})}var $K=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=ZK(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});$K.displayName=`PopoverTrigger`;var eq=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=ZK(e);return(0,$.jsx)(r.Content,{...t,ref:n})});eq.displayName=`PopoverContent`;function tq({preset:e=H.DEFAULT,...t}){let n=ZK(e);return(0,$.jsx)(n.Anchor,{...t})}function v_e(e){if(e)return`translate3d(${Math.round(e.x)}px, ${Math.round(e.y)}px, 0)`}var y_e={activationConstraint:{distance:8}},b_e={coordinateGetter:cF};function x_e({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}=oF({id:e.field,disabled:!n}),_=e.direction===`asc`,v={transform:v_e(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:G(`shrink-0 cursor-grab touch-none rounded p-0.5 text-muted-foreground/60`,`hover:bg-accent/50 hover:text-muted-foreground`,Dg(e_.OFFSET),`active:cursor-grabbing`),"aria-label":i,...d,...f,children:u(W.GRIP_VERTICAL,{size:tr.SM})}),(0,$.jsx)(`span`,{className:`flex-1 truncate text-sm`,children:r}),(0,$.jsxs)(Y,{type:`button`,variant:X.OUTLINE,size:df.SM,onClick:()=>c(t),className:`h-6 gap-1 px-2 text-xs`,children:[u(_?W.CHEVRON_UP:W.CHEVRON_DOWN,{size:tr.XS}),_?a:o]}),(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.ICON_SM,className:`h-5 w-5 p-0 text-muted-foreground`,onClick:()=>l(t),"aria-label":s,children:u(W.X_MARK,{size:tr.XS})})]})}var nq=({resourceType:e,sortFields:t,currentSorts:n,onSortChange:r,className:i})=>{let{tResourceFieldDisplay:a,tComponent:o,isReady:s}=q({component:K.RESOURCES_LAYOUTS_LIST,resource:e}),{renderIcon:c}=ef(),[l,u]=(0,Q.useState)(!1),d=XN(YN(OP,y_e),YN(wP,b_e)),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(ZP([...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(K.RESOURCES_LAYOUTS_LIST,e),x=n.length,S=x>1,C=c(W.ARROWS_UP_DOWN,{size:tr.SM}),w=b(`sortAsc`),T=b(`sortDesc`),E=b(`removeSort`),D=b(`reorderSort`);return(0,$.jsxs)(QK,{open:l,onOpenChange:u,children:[(0,$.jsx)($K,{asChild:!0,children:(0,$.jsxs)(Y,{type:`button`,variant:X.GHOST,size:df.SM,"aria-label":b(`sortLabel`),"data-slot":`collection-toolbar-sort-trigger`,className:G(`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)(eq,{align:ia.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)(Y,{type:`button`,variant:X.GHOST,size:df.SM,onClick:y,className:`h-auto py-0.5 text-xs text-muted-foreground`,children:b(`clearSort`)})]}),(0,$.jsx)(YP,{sensors:d,collisionDetection:rP,onDragEnd:_,children:(0,$.jsx)(iF,{items:m,strategy:tF,children:(0,$.jsx)(`div`,{className:`space-y-element-sm`,children:n.map((e,t)=>(0,$.jsx)(x_e,{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)(Y,{type:`button`,variant:X.GHOST,size:df.SM,onClick:()=>v(e),className:`h-6 gap-1 px-2 text-xs`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:c(W.PLUS,{size:tr.XS})}),f(e)]},e))})]})]})]})},rq=[{mode:vs.CARDS,icon:W.VIEW_LIST,labelKey:`viewCards`},{mode:vs.TABLE,icon:W.VIEW_TABLE,labelKey:`viewTable`},{mode:vs.BOARD,icon:W.VIEW_BOARD,labelKey:`viewBoard`},{mode:vs.CALENDAR,icon:W.VIEW_CALENDAR,labelKey:`viewCalendar`},{mode:vs.TIMELINE,icon:W.VIEW_TIMELINE,labelKey:`viewTimeline`}],S_e=[vs.CARDS,vs.TABLE],C_e=e=>rq.some(t=>t.mode===e),w_e=({viewMode:e,onViewModeChange:t,availableModes:n=S_e,className:r})=>{let{tComponent:i,isReady:a}=q({component:K.RESOURCES_LAYOUTS_LIST}),{renderIcon:o}=ef();if(!a)return null;let s=e=>i(K.RESOURCES_LAYOUTS_LIST,e);return(0,$.jsx)(_O,{type:mO.SINGLE,value:e,onValueChange:r=>{typeof r==`string`&&C_e(r)&&n.includes(r)&&r!==e&&t(r)},size:df.SM,"aria-label":s(`viewModeLabel`),className:G(`shrink-0`,r),"data-slot":`collection-view-mode`,children:rq.filter(({mode:e})=>n.includes(e)).map(({mode:e,icon:t,labelKey:n})=>{let r=s(n);return(0,$.jsx)(vO,{value:e,size:df.SM,"aria-label":r,title:r,children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:o(t,{size:tr.SM})})},e)})})};function iq({count:e,onClear:t,matchAllOffer:n,isMatchAllSelected:r,className:i}){let{tComponent:a}=q({component:K.RESOURCES_LAYOUTS_LIST}),{renderIcon:o}=ef();return(0,$.jsxs)(`div`,{className:G(`flex items-center gap-element-sm`,i),"data-slot":`collection-selection`,children:[(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:G(`text-sm font-medium text-muted-foreground whitespace-nowrap`,e===0&&`sr-only`),children:e>0?a(K.RESOURCES_LAYOUTS_LIST,r?`allMatchingSelected`:`selectedCount`,{count:e}):``}),n&&!r&&(0,$.jsx)(Y,{type:`button`,variant:X.LINK,size:df.SM,onClick:n.onSelectAllMatching,children:a(K.RESOURCES_LAYOUTS_LIST,`selectAllMatching`,{count:n.matchedCount})}),e>0&&(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.ICON_SM,onClick:t,"aria-label":a(K.RESOURCES_LAYOUTS_LIST,`clearSelection`),children:o(W.X_MARK,{size:tr.XS})})]})}function aq(e,t){return e===0||t===0?!1:t>=e||`indeterminate`}function oq({state:e,onToggle:t,className:n}){let{tComponent:r}=q({component:K.RESOURCES_LAYOUTS_LIST}),i=r(K.RESOURCES_LAYOUTS_LIST,`selectAll`);return(0,$.jsx)(`span`,{className:G(`inline-flex shrink-0 items-center`,vG,n),"data-slot":`collection-select-all`,title:i,children:(0,$.jsx)(CI,{checked:e,onCheckedChange:()=>t(),"aria-label":i})})}var sq;(function(e){e.LABELLED=`labelled`,e.ICONS=`icons`,e.CAPPED=`capped`})(sq||={});var T_e={[sq.LABELLED]:sq.ICONS,[sq.ICONS]:sq.CAPPED,[sq.CAPPED]:sq.CAPPED},cq=(0,Q.createContext)(null);function lq({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)(cq.Provider,{value:i,children:r})}function E_e(){return(0,Q.useContext)(cq)?.density??null}function D_e(e){let t=(0,Q.useContext)(cq)?.reportActionSet;(0,Q.useLayoutEffect)(()=>{t?.(e)},[t,e])}var uq;(function(e){e.NONE=`none`,e.WORKING=`working`,e.FINISHED=`finished`})(uq||={});function O_e(e){let t=(0,Q.useContext)(cq)?.reportBackgroundRun;(0,Q.useLayoutEffect)(()=>{t?.(e)},[t,e]),(0,Q.useLayoutEffect)(()=>()=>t?.(uq.NONE),[t])}function dq(e){let[t,n]=(0,Q.useState)(e);e&&!t&&n(!0);let[r,i]=(0,Q.useState)(uq.NONE);return{isBulkBarMounted:e||t,backgroundRunState:r,onBackgroundRunChange:i}}function fq(e,t){let[n,r]=(0,Q.useState)(sq.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(sq.LABELLED)},[s]),(0,Q.useLayoutEffect)(()=>{if(!t){r(sq.LABELLED);return}let n=e.current;n&&n.scrollWidth>n.clientWidth+1&&r(e=>T_e[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(sq.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 k_e=`motion-safe:transition-[width] motion-safe:duration-[var(--motion-duration-normal)] motion-safe:ease-[var(--motion-easing-default)] motion-reduce:transition-none`,A_e=`@container/collection-toolbar`,j_e=`@max-[32rem]/collection-toolbar:order-last @max-[32rem]/collection-toolbar:basis-full`,M_e=`@max-[32rem]/collection-toolbar:hidden`,pq;(function(e){e.REFINE=`refine`,e.SELECTION=`selection`})(pq||={});var N_e=({resourceType:e,quickFilter:t,presetFilters:n,search:r,filterFields:i,filterPanel:a=hl.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}=q({component:K.RESOURCES_LAYOUTS_LIST}),{renderIcon:x}=ef(),S=b(K.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!==hl.HIDDEN,D=!!c&&c.sortFields.length>0,O=UK(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=fq(M,A),P=dq(A);return(0,$.jsxs)(`div`,{className:G(A_e,`flex flex-col gap-element-sm`,h),"data-slot":`collection-toolbar`,children:[t&&(0,$.jsx)(XK,{resourceType:e,field:t.field,value:t.value,onChange:t.onChange}),(0,$.jsxs)(`div`,{ref:M,className:G(`flex items-center gap-element`,A?`flex-nowrap`:`flex-wrap`),"data-slot":`collection-toolbar-row`,"data-mode":A?pq.SELECTION:pq.REFINE,children:[f&&(0,$.jsx)(oq,{state:f.state,onToggle:f.onToggle}),!A&&(0,$.jsxs)($.Fragment,{children:[r&&!k&&(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.ICON_SM,onClick:()=>_(!0),"aria-label":S,title:S,"data-slot":`collection-toolbar-search-trigger`,children:x(W.SEARCH,{size:tr.SM})}),r&&k&&(0,$.jsx)(`div`,{className:G(`overflow-hidden shrink-0 w-64 max-w-full`,k_e),"data-state":`open`,children:(0,$.jsx)(oK,{query:r.query,onChange:r.onChange,onClear:r.onClear,resourceType:e,autoFocus:!0,onFocus:()=>_(!0),onBlur:C,onKeyDown:w})}),E&&(0,$.jsx)(GK,{activeCount:O,isExpanded:v,onToggle:()=>y(e=>!e)}),D&&(0,$.jsx)(nq,{resourceType:e,sortFields:c.sortFields,currentSorts:c.sortStates,onSortChange:c.onSortChange}),j&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:G(`h-5 w-px bg-border`,M_e),"aria-hidden":`true`}),(0,$.jsx)(__e,{resourceType:e,presets:n,currentFilters:o,onFiltersChange:s,className:j_e})]})]}),d&&(0,$.jsx)(iq,{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)(w_e,{viewMode:l.viewMode,onViewModeChange:l.onViewModeChange,availableModes:l.availableModes}),!A&&m,p&&P.isBulkBarMounted&&(0,$.jsx)(lq,{density:N.density,onActionSetChange:N.reportActionSet,onBackgroundRunChange:P.onBackgroundRunChange,children:p}),!A&&P.backgroundRunState!==uq.WORKING&&u]})]}),E&&v&&!A&&(0,$.jsx)(KK,{resourceType:e,filterFields:i,currentFilters:o,onFiltersChange:s}),T&&(0,$.jsx)(VK,{resourceType:e,filterFields:i,currentFilters:o,onFiltersChange:s,...n?{presetFilters:n}:{}})]})};function mq(e,t){return typeof e==`function`?e(t):e}function hq(e,t){return n=>{t.setState(t=>({...t,[e]:mq(n,t[e])}))}}function gq(e){return e instanceof Function}function P_e(e){return Array.isArray(e)&&e.every(e=>typeof e==`number`)}function F_e(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 _q(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 vq(e,t,n,r){return{debug:()=>e?.debugAll??e[t],key:!1,onChange:r}}function I_e(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:_q(()=>[e,n,t,i],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),vq(e.options,`debugCells`,`cell.getContext`))};return e._features.forEach(r=>{r.createCell==null||r.createCell(i,n,t,e)},{}),i}function L_e(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:_q(()=>[!0],()=>[c,...c.columns?.flatMap(e=>e.getFlatColumns())],vq(e.options,`debugColumns`,`column.getFlatColumns`)),getLeafColumns:_q(()=>[e._getOrderColumnsFn()],e=>{var t;return(t=c.columns)!=null&&t.length?e(c.columns.flatMap(e=>e.getLeafColumns())):[c]},vq(e.options,`debugColumns`,`column.getLeafColumns`))};for(let t of e._features)t.createColumn==null||t.createColumn(c,e);return c}var yq=`debugHeaders`;function bq(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 R_e={createTable:e=>{e.getHeaderGroups=_q(()=>[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 xq(t,[...a,...s,...o],e)},vq(e.options,yq,`getHeaderGroups`)),e.getCenterHeaderGroups=_q(()=>[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))),xq(t,n,e,`center`)),vq(e.options,yq,`getCenterHeaderGroups`)),e.getLeftHeaderGroups=_q(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>xq(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`left`),vq(e.options,yq,`getLeftHeaderGroups`)),e.getRightHeaderGroups=_q(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>xq(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`right`),vq(e.options,yq,`getRightHeaderGroups`)),e.getFooterGroups=_q(()=>[e.getHeaderGroups()],e=>[...e].reverse(),vq(e.options,yq,`getFooterGroups`)),e.getLeftFooterGroups=_q(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),vq(e.options,yq,`getLeftFooterGroups`)),e.getCenterFooterGroups=_q(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),vq(e.options,yq,`getCenterFooterGroups`)),e.getRightFooterGroups=_q(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),vq(e.options,yq,`getRightFooterGroups`)),e.getFlatHeaders=_q(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),vq(e.options,yq,`getFlatHeaders`)),e.getLeftFlatHeaders=_q(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),vq(e.options,yq,`getLeftFlatHeaders`)),e.getCenterFlatHeaders=_q(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),vq(e.options,yq,`getCenterFlatHeaders`)),e.getRightFlatHeaders=_q(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),vq(e.options,yq,`getRightFlatHeaders`)),e.getCenterLeafHeaders=_q(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),vq(e.options,yq,`getCenterLeafHeaders`)),e.getLeftLeafHeaders=_q(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),vq(e.options,yq,`getLeftLeafHeaders`)),e.getRightLeafHeaders=_q(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),vq(e.options,yq,`getRightLeafHeaders`)),e.getLeafHeaders=_q(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>[...e[0]?.headers??[],...t[0]?.headers??[],...n[0]?.headers??[]].map(e=>e.getLeafHeaders()).flat(),vq(e.options,yq,`getLeafHeaders`))}};function xq(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=bq(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)=>bq(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 z_e=(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:()=>F_e(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:_q(()=>[e.getAllLeafColumns()],t=>t.map(t=>I_e(e,s,t,t.id)),vq(e.options,`debugRows`,`getAllCells`)),_getAllCellsByColumnId:_q(()=>[s.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),vq(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},B_e={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()}}},Sq=(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))};Sq.autoRemove=e=>Mq(e);var Cq=(e,t,n)=>{var r;return!!((r=e.getValue(t))!=null&&(r=r.toString())!=null&&r.includes(n))};Cq.autoRemove=e=>Mq(e);var wq=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};wq.autoRemove=e=>Mq(e);var Tq=(e,t,n)=>e.getValue(t)?.includes(n);Tq.autoRemove=e=>Mq(e);var Eq=(e,t,n)=>!n.some(n=>{var r;return!((r=e.getValue(t))!=null&&r.includes(n))});Eq.autoRemove=e=>Mq(e)||!(e!=null&&e.length);var Dq=(e,t,n)=>n.some(n=>e.getValue(t)?.includes(n));Dq.autoRemove=e=>Mq(e)||!(e!=null&&e.length);var Oq=(e,t,n)=>e.getValue(t)===n;Oq.autoRemove=e=>Mq(e);var kq=(e,t,n)=>e.getValue(t)==n;kq.autoRemove=e=>Mq(e);var Aq=(e,t,n)=>{let[r,i]=n,a=e.getValue(t);return a>=r&&a<=i};Aq.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]},Aq.autoRemove=e=>Mq(e)||Mq(e[0])&&Mq(e[1]);var jq={includesString:Sq,includesStringSensitive:Cq,equalsString:wq,arrIncludes:Tq,arrIncludesAll:Eq,arrIncludesSome:Dq,equals:Oq,weakEquals:kq,inNumberRange:Aq};function Mq(e){return e==null||e===``}var V_e={getDefaultColumnDef:()=>({filterFn:`auto`}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:hq(`columnFilters`,e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);return typeof n==`string`?jq.includesString:typeof n==`number`?jq.inNumberRange:typeof n==`boolean`||typeof n==`object`&&n?jq.equals:Array.isArray(n)?jq.arrIncludes:jq.weakEquals},e.getFilterFn=()=>gq(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn===`auto`?e.getAutoFilterFn():t.options.filterFns?.[e.columnDef.filterFn]??jq[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=mq(n,i?i.value:void 0);if(Nq(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=>mq(t,e)?.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&Nq(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 Nq(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||t===void 0||typeof t==`string`&&!t}var Pq={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(!P_e(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},H_e={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:hq(`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 Pq.sum;if(Object.prototype.toString.call(n)===`[object Date]`)return Pq.extent},e.getAggregationFn=()=>{if(!e)throw Error();return gq(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn===`auto`?e.getAutoAggregationFn():t.options.aggregationFns?.[e.columnDef.aggregationFn]??Pq[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 U_e(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 W_e={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:hq(`columnOrder`,e)}),createColumn:(e,t)=>{e.getIndex=_q(e=>[Bq(t,e)],t=>t.findIndex(t=>t.id===e.id),vq(t.options,`debugColumns`,`getIndex`)),e.getIsFirstColumn=n=>Bq(t,n)[0]?.id===e.id,e.getIsLastColumn=n=>{let r=Bq(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=_q(()=>[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 U_e(i,t,n)},vq(e.options,`debugTable`,`_getOrderColumnsFn`))}},Fq=()=>({left:[],right:[]}),G_e={getInitialState:e=>({columnPinning:Fq(),...e}),getDefaultOptions:e=>({onColumnPinningChange:hq(`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=_q(()=>[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))},vq(t.options,`debugRows`,`getCenterVisibleCells`)),e.getLeftVisibleCells=_q(()=>[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`})),vq(t.options,`debugRows`,`getLeftVisibleCells`)),e.getRightVisibleCells=_q(()=>[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`})),vq(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?Fq():e.initialState?.columnPinning??Fq()),e.getIsSomeColumnsPinned=t=>{let n=e.getState().columnPinning;return t?!!n[t]?.length:!!(n.left?.length||n.right?.length)},e.getLeftLeafColumns=_q(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),vq(e.options,`debugColumns`,`getLeftLeafColumns`)),e.getRightLeafColumns=_q(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),vq(e.options,`debugColumns`,`getRightLeafColumns`)),e.getCenterLeafColumns=_q(()=>[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))},vq(e.options,`debugColumns`,`getCenterLeafColumns`))}};function K_e(e){return e||(typeof document<`u`?document:null)}var Iq={size:150,minSize:20,maxSize:2**53-1},Lq=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),q_e={getDefaultColumnDef:()=>Iq,getInitialState:e=>({columnSizing:{},columnSizingInfo:Lq(),...e}),getDefaultOptions:e=>({columnResizeMode:`onEnd`,columnResizeDirection:`ltr`,onColumnSizingChange:hq(`columnSizing`,e),onColumnSizingInfoChange:hq(`columnSizingInfo`,e)}),createColumn:(e,t)=>{e.getSize=()=>{let n=t.getState().columnSizing[e.id];return Math.min(Math.max(e.columnDef.minSize??Iq.minSize,n??e.columnDef.size??Iq.size),e.columnDef.maxSize??Iq.maxSize)},e.getStart=_q(e=>[e,Bq(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),vq(t.options,`debugColumns`,`getStart`)),e.getAfter=_q(e=>[e,Bq(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),vq(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(),zq(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=zq(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=K_e(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=J_e()?{passive:!1}:!1;zq(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?Lq():e.initialState.columnSizingInfo??Lq())},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}},Rq=null;function J_e(){if(typeof Rq==`boolean`)return Rq;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 Rq=e,Rq}function zq(e){return e.type===`touchstart`}var Y_e={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:hq(`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=_q(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),vq(t.options,`debugRows`,`_getAllVisibleCells`)),e.getVisibleCells=_q(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],vq(t.options,`debugRows`,`getVisibleCells`))},createTable:e=>{let t=(t,n)=>_q(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join(`_`)],e=>e.filter(e=>e.getIsVisible==null?void 0:e.getIsVisible()),vq(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 Bq(e,t){return t?t===`center`?e.getCenterVisibleLeafColumns():t===`left`?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var X_e={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()}}},Z_e={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:hq(`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=()=>jq.includesString,e.getGlobalFilterFn=()=>{let{globalFilterFn:t}=e.options;return gq(t)?t:t===`auto`?e.getGlobalAutoFilterFn():e.options.filterFns?.[t]??jq[t]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},Q_e={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:hq(`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()}}}},Vq=0,Hq=10,Uq=()=>({pageIndex:Vq,pageSize:Hq}),$_e={getInitialState:e=>({...e,pagination:{...Uq(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:hq(`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=>mq(t,e)),e.resetPagination=t=>{e.setPagination(t?Uq():e.initialState.pagination??Uq())},e.setPageIndex=t=>{e.setPagination(n=>{let r=mq(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?Vq:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageIndex)??Vq)},e.resetPageSize=t=>{var n;e.setPageSize(t?Hq:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageSize)??Hq)},e.setPageSize=t=>{e.setPagination(e=>{let n=Math.max(1,mq(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=mq(t,e.options.pageCount??-1);return typeof r==`number`&&(r=Math.max(-1,r)),{...n,pageCount:r}}),e.getPageOptions=_q(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},vq(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}},Wq=()=>({top:[],bottom:[]}),eve={getInitialState:e=>({rowPinning:Wq(),...e}),getDefaultOptions:e=>({onRowPinningChange:hq(`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?Wq():e.initialState?.rowPinning??Wq()),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=_q(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,`top`),vq(e.options,`debugRows`,`getTopRows`)),e.getBottomRows=_q(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,`bottom`),vq(e.options,`debugRows`,`getBottomRows`)),e.getCenterRows=_q(()=>[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))},vq(e.options,`debugRows`,`getCenterRows`))}},tve={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:hq(`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=>{Gq(i,t.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=_q(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Kq(e,n):{rows:[],flatRows:[],rowsById:{}},vq(e.options,`debugTable`,`getSelectedRowModel`)),e.getFilteredSelectedRowModel=_q(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Kq(e,n):{rows:[],flatRows:[],rowsById:{}},vq(e.options,`debugTable`,`getFilteredSelectedRowModel`)),e.getGroupedSelectedRowModel=_q(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Kq(e,n):{rows:[],flatRows:[],rowsById:{}},vq(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 Gq(o,e.id,n,r?.selectChildren??!0,t),o})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return qq(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return Jq(e,n)===`some`},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return Jq(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)}}}},Gq=(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=>Gq(e,t.id,n,r,i))};function Kq(e,t){let n=e.getState().rowSelection,r=[],i={},a=function(e,t){return e.map(e=>{var t;let o=qq(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 qq(e,t){return t[e.id]??!1}function Jq(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()&&(qq(e,t)?a=!0:i=!1),e.subRows&&e.subRows.length)){let n=Jq(e,t);n===`all`?a=!0:(n===`some`&&(a=!0),i=!1)}}),i?`all`:a?`some`:!1}var Yq=/([0-9]+)/gm,nve=(e,t,n)=>Qq(Zq(e.getValue(n)).toLowerCase(),Zq(t.getValue(n)).toLowerCase()),rve=(e,t,n)=>Qq(Zq(e.getValue(n)),Zq(t.getValue(n))),ive=(e,t,n)=>Xq(Zq(e.getValue(n)).toLowerCase(),Zq(t.getValue(n)).toLowerCase()),ave=(e,t,n)=>Xq(Zq(e.getValue(n)),Zq(t.getValue(n))),ove=(e,t,n)=>{let r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},sve=(e,t,n)=>Xq(e.getValue(n),t.getValue(n));function Xq(e,t){return e===t?0:e>t?1:-1}function Zq(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function Qq(e,t){let n=e.split(Yq).filter(Boolean),r=t.split(Yq).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 $q={alphanumeric:nve,alphanumericCaseSensitive:rve,text:ive,textCaseSensitive:ave,datetime:ove,basic:sve},cve=[R_e,Y_e,W_e,G_e,B_e,V_e,X_e,Z_e,{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:`auto`,sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:hq(`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 $q.datetime;if(typeof n==`string`&&(r=!0,n.split(Yq).length>1))return $q.alphanumeric}return r?$q.text:$q.basic},e.getAutoSortDir=()=>typeof t.getFilteredRowModel().flatRows[0]?.getValue(e.id)==`string`?`asc`:`desc`,e.getSortingFn=()=>{if(!e)throw Error();return gq(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn===`auto`?e.getAutoSortingFn():t.options.sortingFns?.[e.columnDef.sortingFn]??$q[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())}},H_e,Q_e,$_e,eve,tve,q_e];function lve(e){let t=[...cve,...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=mq(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:_q(()=>[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}),vq(e,`debugColumns`,`_getDefaultColumnDef`)),_getColumnDefs:()=>n.options.columns,getAllColumns:_q(()=>[n._getColumnDefs()],e=>{let t=function(e,r,i){return i===void 0&&(i=0),e.map(e=>{let a=L_e(n,e,i,r),o=e;return a.columns=o.columns?t(o.columns,a,i+1):[],a})};return t(e)},vq(e,`debugColumns`,`getAllColumns`)),getAllFlatColumns:_q(()=>[n.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),vq(e,`debugColumns`,`getAllFlatColumns`)),_getAllFlatColumnsById:_q(()=>[n.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),vq(e,`debugColumns`,`getAllFlatColumnsById`)),getAllLeafColumns:_q(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),vq(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 uve(){return e=>_q(()=>[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=z_e(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},vq(e.options,`debugTable`,`getRowModel`,()=>e._autoResetPageIndex()))}function dve(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=Q.useState(()=>({current:lve(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 eJ=rc(K.LOW_LEVEL_TABLE,`Table`,[`Header`,`Body`,`Footer`,`Row`,`Head`,`Cell`,`Caption`]);function tJ({preset:e=H.DEFAULT,...t}){let n=eJ(e);return(0,$.jsx)(n,{...t})}function nJ({preset:e=H.DEFAULT,...t}){let n=eJ(e);return(0,$.jsx)(n.Header,{...t})}function rJ({preset:e=H.DEFAULT,...t}){let n=eJ(e);return(0,$.jsx)(n.Body,{...t})}function fve({preset:e=H.DEFAULT,...t}){let n=eJ(e);return(0,$.jsx)(n.Footer,{...t})}function iJ({preset:e=H.DEFAULT,...t}){let n=eJ(e);return(0,$.jsx)(n.Row,{...t})}function aJ({preset:e=H.DEFAULT,...t}){let n=eJ(e);return(0,$.jsx)(n.Head,{...t})}function oJ({preset:e=H.DEFAULT,...t}){let n=eJ(e);return(0,$.jsx)(n.Cell,{...t})}function pve({preset:e=H.DEFAULT,...t}){let n=eJ(e);return(0,$.jsx)(n.Caption,{...t})}function sJ(e,t){return e===void 0?null:typeof e==`function`?e(t):e}var mve=({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}=q({component:K.RESOURCES_LAYOUTS_LIST,resource:t}),{renderIcon:b}=ef(),x=Nx(),{getRecipe:S}=Ng(),C=S(It.INTERACTIVE,qo.GHOST),w=S(It.TYPOGRAPHY,Ea.EYEBROW),T=(0,Q.useMemo)(()=>U.resolveFieldShapeOfAnyVariant(n)??null,[n]),E=(0,Q.useMemo)(()=>new Set(s),[s]),D=dve({data:e,columns:(0,Q.useMemo)(()=>{let e=[];u&&e.push({id:`__select`,header:()=>(0,$.jsx)(CI,{checked:p,onCheckedChange:()=>m?.(),"aria-label":v(K.RESOURCES_LAYOUTS_LIST,`selectAll`)}),cell:({row:e})=>(0,$.jsx)(CI,{checked:d?.(e.original)??!1,onCheckedChange:()=>f?.(e.original),"aria-label":v(K.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)(Y,{type:`button`,variant:X.GHOST,size:df.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`?W.CHEVRON_UP:W.CHEVRON_DOWN,{size:tr.XS}),c.length>1&&(0,$.jsx)(`span`,{className:`text-[10px] font-semibold tabular-nums`,children:e+1})]})]})},cell:({row:e})=>(0,$.jsx)(DG,{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(K.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:uve(),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(K.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:G(`px-card-sm py-element-sm text-start`,w.base),style:{width:e.getSize()===150?void 0:e.getSize()},children:e.isPlaceholder?null:sJ(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=U.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)(kG,{navigationZone:r})})},e.id);let i=!_||_(e.original);return(0,$.jsx)(`tr`,{"data-slot":`resource-list-item`,className:G(i&&(C.states.hover||`hover:bg-muted/30`),`transition-colors motion-reduce:transition-none`,i&&`cursor-pointer`,i&&Dg(e_.INSET),d?.(e.original)&&`bg-primary/5`),onClick:i?t=>{fG(t)||g(e.original)}:void 0,role:`row`,"aria-selected":u?d?.(e.original)??!1:void 0,tabIndex:i?0:void 0,onKeyDown:i?t=>{fG(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)(oJ,{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:sJ(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)})})]})})})})},hve=`__wildo-board-ungrouped__`;function gve(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:hve,value:null,label:null,items:[],total:o,loading:!1,failed:!1}),a}function _ve(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 vve(e,t){if(e.length===0)return;let n=t(e);return n.find(e=>e.isOperationDefault===!0)??n[0]}function yve(e,t){return{[e]:t}}async function bve(e){let t=yve(e.groupByField,e.targetValue);try{await e.call(t)}catch(t){return e.reportRefusal(t),!1}return e.applyMove(t),!0}function xve(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 cJ=`application/x-wildo-board-card`,Sve=[];function Cve(e,t){let n=e?.operations??Sve,r=LS(n,{currentObject:t,resourceType:e?.resourceType,subjectDataMode:e?.subjectDataMode,organizationId:e?.organizationId});return vve(n.filter(e=>r.get(jS(e))?.isEnabled===!0),e=>$u(e))}function wve({item:e,index:t,itemId:n,columnValue:r,transition:i,isMoving:a,hintId:o,renderCard:s,onDragStart:c,onDragEnd:l,onKeyboardMove:u}){let d=Cve(i,e),f=d!==void 0&&!a;return(0,$.jsx)(`li`,{className:G(`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(cJ,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 Tve({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=xve(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:G(`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(cJ)||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)(wve,{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)(Y,{variant:X.GHOST,size:df.SM,disabled:e.loading,"data-board-load-more":e.key,onClick:()=>t(e.value),children:n(e.total-e.items.length)})]},e.key)})]})}function lJ(e){return e.toISOString().slice(0,10)}function uJ(e){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1))}function dJ(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+t,1))}function fJ(e){return lJ(e).slice(0,7)}function Eve(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 Dve(e,t){let n=uJ(e),r=(n.getUTCDay()-t+7)%7,i=lK(dJ(n,1),-1),a=[],o=lK(n,-r);for(;o.getTime()<=i.getTime();){let e=[];for(let t=0;t<7;t++)e.push({day:o,key:lJ(o),inMonth:o.getUTCMonth()===n.getUTCMonth()}),o=lK(o,1);a.push(e)}return a}function Ove(e){let t=e[0],n=e[e.length-1];return{firstDay:t[0].day,lastDay:n[n.length-1].day}}function pJ(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 zl.calendarDateToday({timezone:t?`UTC`:n},r)}function kve(e){let t=new Map;for(let n of e.items){let r=pJ(n[e.dateField],e.calendarField,e.timeZone);if(!r)continue;let i=lJ(r),a=t.get(i);a?a.push(n):t.set(i,[n])}return t}function Ave(e,t,n){return uK(e.firstDay,e.lastDay,t,n)}function mJ(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 jve(e,t){if(typeof e!=`object`||!e||e instanceof Date||Array.isArray(e))return{...t};let n=e,r=[mJ(n.startDate),t.startDate].filter(e=>e!==void 0),i=[mJ(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 Mve(e,t){if(!t||Object.keys(t).length===0)return e;let n={...e};for(let[r,i]of Object.entries(t))n[r]=jve(e[r],i);return n}function Nve(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 Pve(e,t,n){if(`days`in t)return lK(e,t.days);if(`months`in t){let n=dJ(uJ(e),t.months),r=lK(dJ(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`?lK(e,-r):lK(e,6-r)}var Fve=[];function Ive({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}=ef(),S=(0,Q.useRef)(null),[C,w]=(0,Q.useState)(()=>uJ(r).getTime()===uJ(n).getTime()?r:uJ(n)),T=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{w(e=>uJ(e).getTime()===uJ(n).getTime()?e:uJ(n))},[n]);let E=lJ(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=uJ(e);t.getTime()!==uJ(n).getTime()&&a(t)},[n,a]),O=(e,t)=>{if(e.target!==e.currentTarget)return;let n=Nve(e.key);n&&(e.preventDefault(),D(Pve(t,n,i)))},k=lJ(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)(Y,{variant:X.OUTLINE,size:df.ICON_SM,"aria-label":h,title:h,onClick:()=>a(dJ(n,-1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:x(W.CHEVRON_LEFT,{size:tr.SM})})}),(0,$.jsx)(Y,{variant:X.OUTLINE,size:df.ICON_SM,"aria-label":g,title:g,onClick:()=>a(dJ(n,1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:x(W.CHEVRON_RIGHT,{size:tr.SM})})}),(0,$.jsx)(`h3`,{id:b,className:`text-sm font-medium`,"aria-live":`polite`,children:o}),(0,$.jsx)(Y,{variant:X.GHOST,size:df.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)??Fve,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:G(`h-24 border align-top p-item-xs`,Dg(e_.INSET),!r&&`bg-muted/30 text-muted-foreground`),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:G(`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)(Y,{variant:X.GHOST,size:df.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 Lve(e){let t=uJ(e),n=dJ(t,1),r=[];for(let e=t;e.getTime()<n.getTime();e=lK(e,1))r.push(e);return r}var hJ=864e5;function Rve(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=pJ(e[n],i,o),s=pJ(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)/hJ)+1,p=Math.round((Math.min(d.getTime(),l)-c)/hJ)+1;u.push({item:e,startDay:t,endDay:d,startColumn:f,endColumn:p,continuesBefore:t.getTime()<c,continuesAfter:d.getTime()>l})}return u}function zve(e){let{startField:t,endField:n,startIsCalendarDate:r,endIsCalendarDate:i,timeZone:a,firstDay:o,lastDay:s}=e;return{[t]:uK(void 0,s,r,a),[n]:uK(o,void 0,i,a)}}var gJ=lJ;function Bve(e){return{gridTemplateColumns:`minmax(8rem, 12rem) repeat(${e}, minmax(1.5rem, 1fr))`}}function Vve({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:_}=ef(),v=(0,Q.useRef)(null),y=gJ(r),b=Bve(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)(Y,{variant:X.OUTLINE,size:df.ICON_SM,"aria-label":p,title:p,onClick:()=>i(dJ(n,-1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:_(W.CHEVRON_LEFT,{size:tr.SM})})}),(0,$.jsx)(Y,{variant:X.OUTLINE,size:df.ICON_SM,"aria-label":m,title:m,onClick:()=>i(dJ(n,1)),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:_(W.CHEVRON_RIGHT,{size:tr.SM})})}),(0,$.jsx)(`h3`,{className:`text-sm font-medium`,"aria-live":`polite`,children:a}),(0,$.jsx)(Y,{variant:X.GHOST,size:df.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=gJ(e);return(0,$.jsx)(`span`,{"data-timeline-day":t,"data-today":t===y?`true`:void 0,className:G(`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=G(`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)(Y,{variant:X.GHOST,size:df.XS,"data-timeline-bar":p,"aria-label":h,title:h,className:G(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:G(g,`flex items-center`),style:_,onKeyDown:x,children:m})]},p)})})]})})]})}function _J(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 Hve(e){let{requestPage:t,pageLimit:n,maxPages:r=5}=e,i=async e=>{let r=_J(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 vJ(e,t,n){let r=e[t];return r!=null&&r!==``&&!(Array.isArray(r)?r.includes(n):r===n)?null:{...e,[t]:n}}function Uve(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 Wve(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 yJ={items:[],total:0,page:0,loading:!1,failed:!1};function Gve(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,{...yJ,items:[],loading:Kve(r,o,e)}])));for(let t of n){let n=vJ(r,o,t);n&&i(n,1,a).then(n=>{if(e)return;let r=_J(n);u(e=>new Map(e).set(t,r?{items:r.items,total:r.total,page:1,loading:!1,failed:!1}:{...yJ,items:[],failed:!0}))},()=>{e||u(e=>new Map(e).set(t,{...yJ,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=vJ(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=_J(await n(o,c,r));u(n=>{let r=n.get(e)??s;return new Map(n).set(e,t?Wve(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=>Uve(i,{itemId:e,fromValue:t,toValue:n,movedFields:r,getItemId:d.current.getItemId}))},[])}}function Kve(e,t,n){return vJ(e,t,n)!==null}function qve(e){let{on:t}=Uo(),[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 Jve(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 bJ=({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=df.ICON_SM,labelDisplayMode:f=$o.INLINE,className:p})=>{let m=E_e(),{resourceType:h,operation:g}=e,{on:_}=Uo(),v=(0,Q.useId)(),{isReady:y,tComponent:b,tErrorMessage:x,tResourceOperation:S}=q({component:K.RESOURCES_LAYOUTS_OPERATIONS_BULK,resource:h}),C=(0,Q.useMemo)(()=>ku(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]),w=(0,Q.useMemo)(()=>[`resources.${h}`,`components.${K.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:L}=WV({resourceType:h,displayMode:dr.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}),R=qve(L),z=r.length>0||!!a||!!o?.length,B=a?`match:${JSON.stringify(a)}`:z?`ids:${T.join(`,`)}`:``,[ee,te]=(0,Q.useState)(null),[ne,V]=(0,Q.useState)(null);R?.finished&&ee?.jobId!==R.jobId&&te({jobId:R.jobId,selectionKey:B});let re=!!R?.finished&&ee?.jobId===R.jobId&&B!==``&&B!==ee.selectionKey;re&&ne!==R.jobId&&V(R.jobId);let ie=R&&!re&&R.jobId!==ne?R:null;return O_e(ie?ie.finished?uq.FINISHED:uq.WORKING:uq.NONE),D_e((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,rC.default)(ku(t.contextResourceIdentifiers),C)})},[_,l,C,h,v]),y?ie?(0,$.jsx)(Zy,{i18nKeys:w,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-element-sm`,"data-slot":`bulk-background-run`,children:[!ie.finished&&(0,$.jsx)(h_,{value:ie.processedCount,max:Math.max(ie.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:ie.finished?b(K.RESOURCES_LAYOUTS_OPERATIONS_BULK,`backgroundRunFinished`,{succeededCount:ie.processedCount-ie.failedCount,failedCount:ie.failedCount}):b(K.RESOURCES_LAYOUTS_OPERATIONS_BULK,`backgroundRunProgress`,{processedCount:ie.processedCount,attemptedCount:ie.attemptedCount})}),ie.finished&&ie.failures.length>0&&(0,$.jsxs)(QK,{children:[(0,$.jsx)($K,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:X.LINK,size:df.SM,children:b(K.RESOURCES_LAYOUTS_OPERATIONS_BULK,`viewFailures`)})}),(0,$.jsxs)(eq,{className:`w-96 max-h-80 overflow-auto`,children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-element-sm`,children:Jve(ie.failures,e=>Tp({tErrorMessage:x,tResourceOperation:S,resourceType:h,operationIdentifier:ie.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(K.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)(Y,{type:`button`,variant:X.LINK,size:df.SM,onClick:()=>s(ie.failures.map(e=>e.resourceId)),children:b(K.RESOURCES_LAYOUTS_OPERATIONS_BULK,`selectRefusedRows`,{count:ie.failures.length})}),ie.failures.length<ie.failedCount&&(0,$.jsx)(`p`,{className:`mt-element-sm text-xs text-muted-foreground`,children:b(K.RESOURCES_LAYOUTS_OPERATIONS_BULK,`failuresPartialList`,{shownCount:ie.failures.length,failedCount:ie.failedCount})})]})]})]})}):!z||D.length===0?null:(0,$.jsx)(Zy,{i18nKeys:w,children:(0,$.jsxs)(`div`,{"data-slot":`operations-bulk`,className:G(`flex items-center`,p),children:[(0,$.jsx)(WS,{items:D,size:d,labelDisplayMode:m===null||m===sq.LABELLED?f:$o.TOOLTIP,...m===sq.CAPPED?{maxDisplayed:2}:{}}),O&&(0,$.jsx)(kw,{open:O,onOpenChange:e=>{e||F()},cancelCallback:F,validationCallback:P,label:k,description:A,confirmLabel:j,requireTypedConfirmation:M,confirmationPhrase:N})]})}):null};function xJ({preset:e=H.DEFAULT,...t}){let n=qc(K.RESOURCES_LAYOUTS_OPERATIONS_BULK,`ResourceLayout_OperationBulk`)(e);return(0,$.jsx)(n,{...t})}var Yve=({resourceContext:e,navigationZone:t,size:n=df.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:_}=WV({resourceType:a,displayMode:dr.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)(WS,{items:s,size:n,labelDisplayMode:$o.INLINE,className:r}),c&&(0,$.jsx)(kw,{open:c,onOpenChange:e=>{e||h()},cancelCallback:h,validationCallback:m,label:l,description:u,confirmLabel:d,requireTypedConfirmation:f,confirmationPhrase:p}),g&&(0,$.jsx)(tG,{open:!0,onAcknowledge:_,fields:g,resourceType:a})]})},Xve=`__wildo-ungrouped__`;function Zve(e,t,n,r,i){let a=MG(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??Xve,l=o[o.length-1];l&&l.key===c?l.items.push(n):o.push({key:c,label:s,items:[n]})}return o}var Qve=`wildo-collection-view-mode:`;function SJ(e){return`${Qve}${e}`}function $ve(e){let t=$s(SJ(e));return t!==null&&Object.values(vs).includes(t)?t:null}function eye(e,t){So(SJ(e),t)}function tye(e,t){let[n,r]=(0,Q.useState)(()=>$ve(e)??t);return{viewMode:n,setViewMode:(0,Q.useCallback)(t=>{r(t),eye(e,t)},[e])}}function nye(e){return e instanceof Error?e:Error(String(e))}var CJ=class extends Q.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){let n=nye(e);tl.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 wJ({className:e,style:t}){return(0,$.jsx)(`div`,{"aria-hidden":`true`,"data-lazy-door":`unavailable`,className:G(`rounded-md border border-dashed border-muted-foreground/40 bg-muted/30`,e),style:t})}var rye=Q.lazy(()=>i_(()=>import(`./ChartView-Db94VZQx.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));function iye({height:e}){let{tComponent:t,isReady:n}=q({component:K.HIGH_LEVEL_VIEWS_CHART_WIDGET});return n?(0,$.jsx)(`div`,{style:{minHeight:e},"data-lazy-door":`unavailable`,children:(0,$.jsx)(dm,{variant:`compact`,iconRef:W.ERROR_APPLICATION,title:t(K.HIGH_LEVEL_VIEWS_CHART_WIDGET,`chartFailed`),respectSurfaceEmptyDisplay:!1,className:`h-full min-h-[120px] border-0`})}):null}var TJ=e=>(0,$.jsx)(CJ,{doorName:`ChartView`,fallback:(0,$.jsx)(iye,{height:e.height??400}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Sm,{height:e.height??400}),children:(0,$.jsx)(rye,{...e})})});function aye(e){return typeof e.resourceType==`string`&&e.resourceType.length>0}function oye(e){return e.foreignKeyField??e.resourceType}function sye(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===km.PARENT_RESOURCE_REQUIREMENT?e.parentResourcesRequirements:e.additionalResourceRequirements)??[]).filter(e=>aye(e)?oye(e)===n:!1);return a.length===1?{mainResourceType:a[0].resourceType,mainResourceId:i,bindingKey:n,source:r===km.PARENT_RESOURCE_REQUIREMENT?Jv.PARENT_RESOURCE_REQUIREMENT:Jv.ADDITIONAL_RESOURCE_REQUIREMENT}:null}function cye(e){return e.explicitTemplate?e.explicitTemplate:e.displaySchema?BR(e.displaySchema,{factsAsTiles:e.defaultDisplayChromeMode===void 0,...e.resourceConfig?{resourceConfig:e.resourceConfig}:{}}):null}function EJ(e){return e??void 0}var DJ=class{resourcesRegistry;errorBuilder;constructor(e){this.resourcesRegistry=e,this.errorBuilder=new Ae}buildError(e,t,n){let r=this.errorBuilder.buildWildoError_Frontend(Mc.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&&(EJ(e.variantType)===void 0||t.variantType===e.variantType)&&(EJ(e.variantKey)===void 0||t.variantKey===e.variantKey)&&(EJ(e.isOperationDefault)===void 0||!!t.isOperationDefault===e.isOperationDefault)&&(EJ(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=>no.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`&&Wn.getCoreResourceOperationFromOperation(t)!==J.READ?null:t:e.validationTarget===`canonical-read`?null:this.findOperation(e)}selectResponseDto(e,t){return Ii.selectResponseDto(e,t)}validateResourceData(e,t,n){if(!t)return e;try{return t.parse(e)}catch(t){throw t instanceof Id?this.buildError(Lu.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(Lu.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(Lu.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(Lu.FRONTEND_RESOURCE_RESPONSE_VALIDATION_FAILED,r,{arrayIndex:n,originalError:e})}throw e}})}},OJ=tl.getLogger(),kJ=OJ.debugByType(`RMMWebSocketBridge`);OJ.setDebugTypeLogging(`RMMWebSocketBridge`,!1);function AJ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function jJ(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)=>jJ(e,t[n])):AJ(e)||AJ(t)?!AJ(e)||!AJ(t)?!1:[...new Set([...Object.keys(e),...Object.keys(t)])].every(n=>jJ(e[n],t[n])):!1}function MJ(e,t,n=``,r={}){if(jJ(e,t))return r;if(Array.isArray(e)||Array.isArray(t))return n&&(r[n]=e),r;if(AJ(e)&&AJ(t)){let i=[...new Set([...Object.keys(e),...Object.keys(t)])];for(let a of i){let i=n?`${n}.${a}`:a;MJ(e[a],t[a],i,r)}return r}if(AJ(e)){for(let[t,i]of Object.entries(e))MJ(i,void 0,n?`${n}.${t}`:t,r);return r}return n&&(r[n]=e),r}function lye(e,t){return MJ(e,t)}async function NJ(e){let{resourceType:t,resourceId:n,rmm:r,doOperation:i}=e;if(r.getSnapshot().isDeleted)return;let a=r.readOperationPathKey;if(!a){kJ(`authoritative refetch skipped: missing canonical read operation`,{resourceType:t,resourceId:n});return}let o=await Sz({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)&&(kJ(`authoritative refetch: applying newer state`,{resourceType:t,resourceId:n,localVersion:l.version,serverVersion:c}),r.setInitialState(s,c,s._field_meta))}var uye=()=>{let{on:e,isConnected:t,connectionCount:n,claimResourceRoom:r,releaseResourceRoom:i}=up(),a=(0,Q.useContext)(_z),{doOperation:o,getResourcesRegistry:s}=fm(),c=(0,Q.useMemo)(()=>s(),[s]),l=(0,Q.useMemo)(()=>new DJ(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),NJ({resourceType:e,resourceId:t,rmm:n,doOperation:u.current}).catch(n=>{kJ(`authoritative refetch failed`,{resourceType:e,resourceId:t,error:Qu(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(ro.RESOURCE_UPDATED,e=>{if(e.deliveryTarget===$c.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!==$c.RESOURCE_ROOM_SYNC){kJ(`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(!AJ(n)||r==null){kJ(`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:vz,validationTarget:`canonical-read`})}catch(n){kJ(`RESOURCE_UPDATED: sync payload failed canonical-read validation, scheduling authoritative refetch`,{resourceType:e.resourceType,resourceId:e.resourceId,error:Qu(n)}),m(e.resourceType,e.resourceId,t);return}let o=t.getSnapshot(),s=o.confirmedData??{},c=lye(i,s);Object.keys(c).length===0&&r===o.version?kJ(`RESOURCE_UPDATED: no changes detected, skipping`,{resourceType:e.resourceType,resourceId:e.resourceId,version:r}):(kJ(`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(ro.RESOURCE_DELETED,e=>{let t=a.get(e.resourceType,e.resourceId);t&&(kJ(`RESOURCE_DELETED → handleDeletion`,{resourceType:e.resourceType,resourceId:e.resourceId,initiatorUserId:e.initiatorUserId}),t.handleDeletion(pE.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){kJ(`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},PJ=tl.getLogger(),FJ=PJ.debugByType(`ResourceAutomaticDisplayer`),IJ=2e3,LJ=3e4;PJ.setDebugTypeLogging(`ResourceAutomaticDisplayer`,!1);function RJ({resourceContext:e,onError:t,className:n,labelsOverride:r,dataMode:i,onDataLoaded:a,parentReferenceConfig:o,navigationZone:s,updateLikeMutationFallbackMode:c=wl.RMM_REQUIRED,recordNameShownAbove:l=!1}){let{doOperation:u,registry:d}=fm(),{emit:f,resourceRefreshEvent:p}=Uo(),{lastRefreshAt:m}=p({ctx:e}),{tComponent:h,isReady:g,t:_,formatDate:v,formatDateTime:y}=q({component:K.RESOURCES_LAYOUTS_READ,resource:e.resourceType}),[b]=sh(),x=(0,Q.useMemo)(()=>[`resources.${e.resourceType}`,`components.${K.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 Ae,[]),{resourceType:O,operation:k,contextResourceIdentifiers:A}=e,j=String(k.operationIdentifier),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(!1),B=(0,Q.useMemo)(()=>[{resourceType:O,operation:j}],[O,j]),ee=(0,Q.useMemo)(()=>kn.extractDataMode(b,i),[b,i]),te=(0,Q.useMemo)(()=>ee??Co.RAW,[ee]),ne=(0,Q.useMemo)(()=>{let e;switch(te){case Co.SUMMARY:e=k.summaryDto||k.responseDto;break;case Co.CONTEXT:e=k.contextDto||k.responseDto;break;case Co.RAW:default:e=k.responseDto}return e||PJ.error(`[ResourceAutomaticDisplayer] No DTO found`,{operationIdentifier:j,resourceType:O,dataMode:te}),e},[te,k,j,O]),V=(0,Q.useMemo)(()=>d.resourceConfigurations[O],[d,O]),re=V?.frontendConfiguration?.layout?.refs,ie=(0,Q.useMemo)(()=>U.buildContextResourceIdentifiersKey(A),[A]),ae=(0,Q.useMemo)(()=>U.buildContextualParameters(A,d),[ie,d]),oe=(0,Q.useMemo)(()=>no.createOperationPathKeyFromOperation(k),[k]),se=(0,Q.useMemo)(()=>({resourceContext:{resourceType:O,operationId:j},...r}),[O,j,r]),ce=(0,Q.useMemo)(()=>{if(ne)try{let e=_r.collectFileFieldPaths(ne);if(e.length===0)return;let t=ui.getApiUrl(),n=`${t}/api/v1/files`,r={},i=M?String(M._id??M[V?.resourceFieldIdentifier??`_id`]??``):``;if(V&&i)for(let n of e){let e=KV({registry:d,resourceConfig:V,operation:k,resourceType:O,fieldName:n,recordId:i,contextResourceIdentifiers:A,contextualParameters:ae,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}},[ne,V,k,d,A,ae,O,M]);(0,Q.useEffect)(()=>{let e=!1,t,n=IJ,r=async(i=!1)=>{i||L(null);try{let t=await S.current(oe,{contextualParameters:ae,parentResourcesRequirements:E.current.parentResourcesRequirements,dataMode:te},{silent:!0});if(e)return;L(null),N(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(Mc.NOT_FOUND,{customMessageReference:Lu.FRONTEND_FORM_READ_OPERATION_NOT_AVAILABLE,operationPathKey:oe,context:{resourceType:O,operationIdentifier:j,originalErrorMessage:o.message,originalErrorStack:o.stack,httpCode:s.code,httpContext:s.context}});if(L(c),(eu(a)||cl(a))&&(t!==void 0&&clearTimeout(t),t=setTimeout(()=>{t=void 0,r(!0)},n),n=Math.min(n*2,LJ)),i)return;let l=E.current,{errorRefusalCode:u}=rz(a);C.current(hc.NOTIFY_RESOURCE_ERROR,{...l,contextResourceIdentifiers:ku(l.contextResourceIdentifiers),parentResourcesRequirements:l.parentResourcesRequirements||[],additionalContext:{...l.additionalContext,error:o.message,errorCustomMessageReference:Lu.FRONTEND_FORM_READ_OPERATION_NOT_AVAILABLE,...u?{errorRefusalCode:u}:{},...iz(a)}}),w.current?.(o),FJ(`fetch error`,{resourceType:O,error:o.message})}};return r(),()=>{e=!0,t!==void 0&&clearTimeout(t)}},[O,oe,ie,D,j,te,m,P]);let le=(0,Q.useMemo)(()=>{let e=A?.[O];if(e)return kn.getResourceId(e);if(M){let e=U.getResourceFieldIdentifierForType(O,d),t=M[e];if(t!=null)return t;let n=V?.mainSchema?Ute(V.mainSchema):void 0;if(n)return M[n]}},[A,O,M,d,V?.mainSchema]),ue=(0,Q.useMemo)(()=>!le||A?.[O]?A:{...A,[O]:String(le)},[A,le,O]),de=(0,Q.useMemo)(()=>{let e=V?.resourceFieldIdentifier;if(!le||!e)return ae;let t=String(le);return String(ae[e]??``)===t?ae:{...ae,[e]:t}},[ae,le,V?.resourceFieldIdentifier]),fe=iS(th(V?.resourceIdentifier,le==null?void 0:String(le),ue)),pe=(0,Q.useMemo)(()=>{if(V)return ph({resourceConfig:V,operations:V.operations??[],registry:d,hasResourceId:le!=null,contextResourceIdentifiers:ue,contextualParameters:de,viewer:fe})},[ue,de,le,k,d,V,fe]),me=(0,Q.useMemo)(()=>pe!==void 0,[pe]),he=$R(e,pe??k),ge=(0,Q.useRef)(null);ge.current=pe?e=>he(e,{partialWrite:!0}):null;let{rmm:_e,rmmSnapshot:ve}=Az({resourceType:O,resourceId:le==null?null:String(le),doOperationRef:S,contextualParameters:de,parentResourcesRequirements:e.parentResourcesRequirements,contextResourceIdentifiers:ue,resourceSchema:V?.mainSchema,resourceInheritance:V?.inheritenceSchemaDefinition,enabled:me&&le!=null,conflictPolicy:{strategy:dE.ACCEPT_REMOTE}}),ye=(0,Q.useRef)(null);ye.current=typeof M?._id==`string`||typeof M?._id==`number`?String(M._id):null;let be=_e!==null&&!R,xe=(0,Q.useRef)(!1),Se=ZB({resourceType:O,rowIds:[le==null?null:String(le),ye.current],enabled:le!=null});(0,Q.useEffect)(()=>{if(Se!=null&&le!=null){if(be&&_e!==null&&!Se.madeElsewhere){let e=String(le);NJ({resourceType:O,resourceId:e,rmm:_e,doOperation:S.current}).catch(t=>{PJ.warn(`[ResourceAutomaticDisplayer] Re-reading the row after it changed failed`,{resourceType:O,resourceId:e,error:Qu(t)})})}be&&xe.current||F(Se.at)}},[Se]);let Ce=(0,Q.useMemo)(()=>_e?_e.readOperationPathKey:bz(O,d,{hasResourceId:le!=null,contextResourceIdentifiers:ue,contextualParameters:de}),[d,O,_e,le,ue,de]),we=R?null:_e;(0,Q.useEffect)(()=>{FJ(`RMM obtained`,{resourceType:O,resourceId:le==null?void 0:String(le),rmmExists:!!_e})},[_e,O,le]),(0,Q.useEffect)(()=>{z(!1)},[Ce,le,oe,O]),(0,Q.useEffect)(()=>{if(!_e||!M)return;let e=_e.getSnapshot();if(e.confirmedData!==null&&m==null)return;if(!Ce){z(!0),PJ.warn(`[ResourceAutomaticDisplayer] Cannot seed RMM without an addressable canonical READ`,{resourceType:O,resourceId:le==null?void 0:String(le)});return}let t=!1;return(async()=>{let n=xz({loadedOperationPathKey:oe,canonicalReadOperationPathKey:Ce,dataMode:te}),r=n?M:await Sz({doOperation:S.current,readOperationPathKey:Ce,contextualParameters:de,parentResourcesRequirements:E.current.parentResourcesRequirements});if(t)return;if(typeof r!=`object`||!r){z(!0);return}let i=r,a=i._version??0;_e.setInitialState(i,a,i._field_meta),z(!1),FJ(`setInitialState`,{resourceType:O,resourceId:le==null?void 0:String(le),version:a,fieldCount:Object.keys(i).length,refreshDriven:e.confirmedData!==null,seededFromCanonicalRead:!n})})().catch(e=>{z(!0),PJ.warn(`[ResourceAutomaticDisplayer] Failed to seed RMM from canonical read`,{resourceType:O,resourceId:le==null?void 0:String(le),error:Qu(e)})}),()=>{t=!0}},[_e,M,te,oe,Ce,de,O,le,m]),(0,Q.useEffect)(()=>{if(!_e||!ve?.lastEvent)return;let e=ve.lastEvent;FJ(`RMM event`,{type:e.type,resourceType:O,resourceId:le==null?void 0:String(le)});let t=Ce?!xz({loadedOperationPathKey:oe,canonicalReadOperationPathKey:Ce,dataMode:te}):!1,n=()=>{t&&S.current(oe,{contextualParameters:de,parentResourcesRequirements:E.current.parentResourcesRequirements,dataMode:te}).then(e=>{N(e)}).catch(e=>{PJ.warn(`[ResourceAutomaticDisplayer] Summary/context refetch failed (RMM handler)`,{resourceType:O,error:Qu(e)})})};switch(e.type){case oE.MUTATION_RESULT:e.result.success&&(e.source.type===cE.DISPLAY&&(C.current(hc.NOTIFY_RESOURCE_SUCCESS,{...E.current,contextResourceIdentifiers:Me({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}),ge.current?.(e.result.responseData)),n());break;case oE.REMOTE_UPDATE:case oE.CONFLICT_RESET:n();break;case oE.RESOURCE_DELETED:}},[ve?.lastEvent?.id]);let Te=(0,Q.useMemo)(()=>xz({loadedOperationPathKey:oe,canonicalReadOperationPathKey:Ce,dataMode:te}),[Ce,te,oe]),Ee=te===Co.SUMMARY||te===Co.CONTEXT,De=!Ee&&Te&&_e&&ve.optimisticData?ve.optimisticData:M;xe.current=!Ee&&Te&&be;let Oe=be?ve.optimisticData:null;(0,Q.useEffect)(()=>{if(De==null)return;let e=Te?De:Oe??void 0;T.current?.(De,{holdsCanonicalRecord:Te||be,canonicalRecord:e})},[De,Te,be,Oe]),(0,Q.useEffect)(()=>{FJ(`effectiveData source`,{dataMode:te,usingRmmData:Te&&!!ve?.optimisticData})},[Te,te,ve?.optimisticData]);let ke=(0,Q.useCallback)((e,t)=>{N(n=>n&&sA(n,e,t)),C.current(hc.NOTIFY_RESOURCE_SUCCESS,{...E.current,contextResourceIdentifiers:Me({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:sA({},e,t)}),ge.current?.(sA({},e,t))},[O]),je=V?.frontendConfiguration?.layout?.display,Ne=V?.frontendConfiguration?.layout?.defaultChromeMode?.display,Pe=V?.frontendConfiguration?.layout?.defaultInlineEdit,Fe=V?.frontendConfiguration?.layout?.defaultEmptyValue,Ie=V?.frontendConfiguration?.layout?.defaultDisplaySectionAppearance,Le=(0,Q.useMemo)(()=>cye({explicitTemplate:je,displaySchema:ne,defaultDisplayChromeMode:Ne,resourceConfig:V}),[je,ne,Ne,V]),Re=WV({resourceType:e.resourceType,displayMode:dr.DETAIL,currentObject:De,currentObjectDataMode:te,contextResourceIdentifiers:e.contextResourceIdentifiers??{},parentResourcesRequirements:e.parentResourcesRequirements,navigationZone:s??ql.PRIMARY,sourceOperation:e.operation}),ze=(0,Q.useCallback)(t=>{let n=Re.items.find(e=>e.type!==`separator`&&e.type!==`subgroup`&&e.operationIdentifier===t.operationIdentifier);n?.onClick?n.onClick():ui.isDevelopment()&&tl.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.`)},[Re.items,e.resourceType]),Be=(0,Q.useMemo)(()=>{if(je)return{hiddenFieldNames:[],inlineEditDisabledFieldNames:[]};let e=bj({resourceType:O,schema:ne,parentData:De,registry:d}),t=V?.frontendConfiguration?.layout?.defaultInlineEdit===wr.WRITABLE_FIELDS,n=ne?_r.getObjectLikeFieldShape(ne,{commonOnly:!1}):void 0,r=l&&!t?OA({resourceType:O,registry:d,data:De,t:_,formatDate:v,formatDateTime:y}).filter(e=>{let t=n?.[e];return!t||!tt(t)}):[];return r.length===0?e:{...e,hiddenFieldNames:[...e.hiddenFieldNames,...r]}},[ne,De,je,d,O,V,l,_,v,y]),Ve=!De,He=(0,Q.useCallback)(async e=>{let t=V?.operations?.find(t=>String(t.operationIdentifier)===e&&t.isOperationDefault===!0);if(!t)throw Error(`${O} declares no operation ${e}`);return S.current(no.createOperationPathKeyFromOperation(t),{contextualParameters:ae,parentResourcesRequirements:E.current.parentResourcesRequirements},{silent:!0})},[V,O,ae]);if(g===!1)return null;if(I){let t=V?.frontendConfiguration?.layout?.readFailure;if(t)return(0,$.jsx)(`div`,{className:n,children:(0,$.jsx)(t,{error:I,resourceContext:e,askOperation:He})});let r=h(K.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(!ne){let e=h(K.RESOURCES_LAYOUTS_READ,`configurationError`),t=h(K.RESOURCES_LAYOUTS_READ,`noSchemaFound`,{operation:j,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)(Zy,{i18nKeys:x,loadingScopes:B,children:(0,$.jsx)(AB,{schema:ne,data:De,className:n,labels:se,layoutRefs:re,resourceType:O,resourceId:le?String(le):void 0,contextualParameters:de,contextResourceIdentifiers:ue,parentResourcesRequirements:e.parentResourcesRequirements,navigationZone:s,inlineEditOperation:pe??null,parentReferenceConfig:o,fileUploadContext:ce,rmm:we,onInlineEditSuccess:!we&&Vn(c)?ke:void 0,updateLikeMutationFallbackMode:c,layoutTemplate:Le,isLoading:Ve,defaultDisplayChromeMode:Ne,defaultInlineEdit:Pe,defaultEmptyValue:Fe,defaultSectionAppearance:Ie,hiddenFieldNames:Be.hiddenFieldNames,inlineEditDisabledFieldNames:Be.inlineEditDisabledFieldNames,onFileActivationOperation:ze})})}RJ.displayName=`ResourceAutomaticDisplayer`;var zJ=RJ,dye=Object.freeze(new Set),fye=Object.freeze({depth:0,visited:dye}),BJ=(0,Q.createContext)(fye);function VJ(){return(0,Q.useContext)(BJ)}var HJ=new Set;function pye(e,t,n,r){HJ.has(`${e}:${t}`)||(HJ.add(`${e}:${t}`),tl.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 UJ({descentKey:e,maxDepth:t=3,children:n}){let r=VJ(),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?(pye(e,i?`cycle`:`depth`,a,t),null):(0,$.jsx)(BJ.Provider,{value:s,children:n})}var WJ=(0,Q.createContext)(null);function GJ({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)&&mye([...e.placed])}),(0,$.jsx)(WJ.Provider,{value:n,children:e})}var KJ=new Set;function mye(e){let t=e.slice().sort().join(`,`);KJ.has(t)||(KJ.add(t),tl.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 qJ(e){let t=(0,Q.useContext)(WJ);t&&e&&t.placed.add(e)}function JJ(){let e=(0,Q.useContext)(WJ);return e?e.owned.current||e.placed.size>0:!1}function YJ(){let e=(0,Q.useContext)(WJ);e&&(e.owned.current=!0)}var hye=Object.freeze(new Set);function XJ(e){let t=(0,Q.useContext)(WJ);t&&e&&(t.composedAutomatically.current=!0)}function gye(){return(0,Q.useContext)(WJ)?.placed??hye}function _ye(e,t){if(!t)return;let n=kn.getResourceId(e[t]);return typeof n==`string`&&n.length>0?n:void 0}function ZJ(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=>_ye(t.contextResourceIdentifiers,e)!==void 0||n[e]!==void 0&&String(n[e]).length>0)))}function QJ(e){let t=e.operations.filter(t=>ZJ(t,e.childContext,e.contextualParameters));return Gl(t,J.LIST)}function vye(e){return e.isOneToOne}function yye(e){return e===ci.COLLAPSIBLE}function bye(e){let t=[];for(let n of e){let e=n.contentSectionConfig.mode;if(yye(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 $J=new Set;function eY(e,t,n){let r=`${e}->${t}`;$J.has(r)||($J.add(r),tl.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: ${Qu(n)}`))}var tY=new Set;function xye(e,t){let n=`${e}->${t.childResourceType}`;tY.has(n)||(tY.add(n),tl.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 nY=({resourceContext:e,navigationZone:t,navigationInitiator:n,parentData:r})=>{let{resourceType:i}=e,{registry:a}=fm(),{tResourceHeader:o,isReady:s}=q({component:K.RESOURCES_LAYOUTS_CONTAINER_NESTED,resource:i}),{navigate:c}=yS(),{currentBreakpoint:l}=Ng(),u=JJ(),d=(0,Q.useMemo)(()=>[`resources.${i}`,`components.${K.RESOURCES_LAYOUTS_CONTAINER_NESTED}`],[i]),f=(0,Q.useMemo)(()=>a.resourceConfigurations[i],[a,i]),p=(0,Q.useMemo)(()=>f?.resourceRelationships?wt(f.resourceRelationships):[],[f]),m=(0,Q.useMemo)(()=>{if(p.length===0)return[];let t=[];for(let n of p){let s=_j({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=kn.deriveChildResourceContext(e,{resourceType:c,operationIdentifier:d?J.READ:J.LIST,relationshipFieldOverrides:{[i]:s.foreignKeyField}},a)}catch(e){eY(i,c,e);continue}let m=U.buildContextualParameters(p.contextResourceIdentifiers,a),h=d?fh({resourceConfig:u,operations:u.operations??[],coreOperation:J.READ,registry:a,hasResourceId:!!kn.getResourceId(p.contextResourceIdentifiers?.[c]),contextResourceIdentifiers:p.contextResourceIdentifiers,contextualParameters:m}):p&&m?QJ({operations:u.operations??[],childContext:p,contextualParameters:m}):void 0;if(!d&&h){let t;try{t=kn.deriveChildResourceContext(e,{resourceType:c,operationIdentifier:String(h.operationIdentifier),operation:h,relationshipFieldOverrides:{[i]:s.foreignKeyField}},a)}catch(e){eY(i,c,e);continue}let n=kn.getResourceId(e.contextResourceIdentifiers?.[i])||void 0,r=s.relationship.isPrimaryScope===!0;if(n!==void 0)try{r=UG({childContext:t,hostResourceType:i,hostResourceId:n,hostRelationships:f?.resourceRelationships,selectedForeignKey:s.foreignKeyField,registry:a})===t}catch{r=!1}if(!r)continue}if(!h){xye(i,s);continue}let g=Kp({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)(()=>bye(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)=>kn.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=kn.deriveChildResourceContext(e,{resourceType:t.childResourceType,operationIdentifier:J.READ,relationshipFieldOverrides:{[i]:t.foreignKeyField}},a),o=U.buildContextualParameters(r.contextResourceIdentifiers,a);return fh({resourceConfig:n,operations:n.operations??[],coreOperation:J.READ,registry:a,hasResourceId:!!kn.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=kn.deriveChildResourceContext(e,{resourceType:t.childResourceType,operationIdentifier:J.LIST,relationshipFieldOverrides:{[i]:t.foreignKeyField}},a),o=U.buildContextualParameters(r.contextResourceIdentifiers,a);return QJ({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:Sa.RESOURCE_OPERATION,resourceContext:r},initiator:{sourceZone:t,sourceOperation:vl(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)(Y,{variant:X.OUTLINE,onClick:()=>b(e),children:e.label},e.relationshipEdgeKey);let r=a.resourceConfigurations[e.childResourceType];if(vye(e)){let t=r?v(e):void 0;if(t){let n=_(e,t);return(0,$.jsx)(zJ,{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)(YY,{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)(UJ,{descentKey:`nested:${e.relationshipEdgeKey}::${g||`no-row`}`,children:(0,$.jsx)(Vk.Provider,{value:!0,children:x(e)})})}),[x,g]);return XJ(m.length>0&&s&&!u),m.length===0||!s||u?null:(0,$.jsx)(Zy,{i18nKeys:d,children:(0,$.jsx)(`div`,{className:`space-y-section`,children:h.items.map((e,t)=>e.type===`single`?(0,$.jsx)(VO,{config:{...e.config.contentSectionConfig,...e.config.contentSectionConfig.mode===ci.COLLAPSIBLE?{showSingleSectionNav:!0}:{}},sections:[S(e.config)]},e.config.relationshipEdgeKey):(0,$.jsx)(VO,{config:e.configs[0].contentSectionConfig,sections:e.configs.map(S)},`relationship-group-${e.mode}-${t}`))})})};function rY({preset:e=H.DEFAULT,...t}){let n=qc(K.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=dr.DETAIL,onOperationExecuted:o,size:s=df.ICON_SM,maxDisplayed:c,excludeOperations:l,placementFilter:u,hostRowOpensRead:d=!1,orientation:f,className:p})=>{let{resourceType:m,operation:h}=e,g=ym()?.getResourceConfiguration(m)?.frontendConfiguration?.layout,_=g?.actionLabelDisplayMode?.[a],v=Q.useContext(Xg)?.UIConfig?.currentBreakpoint===Yo.MOBILE,y=g?.actionDisclosure?.[a]?.maxPrimaryActions??c??(v?a===dr.SUMMARY?0:1:void 0)??sn(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}=WV({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)(WS,{items:b,maxDisplayed:y,labelDisplayMode:_,orientation:f,size:s,className:p}),x&&(0,$.jsx)(kw,{open:x,onOpenChange:e=>{e||O()},cancelCallback:O,validationCallback:D,label:S,description:C,confirmLabel:w,requireTypedConfirmation:T,confirmationPhrase:E}),k&&(0,$.jsx)(tG,{open:!0,onAcknowledge:A,fields:k,resourceType:m})]})});function aY({preset:e=H.DEFAULT,...t}){let n=qc(K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,`ResourceLayout_OperationsItems`)(e);return(0,$.jsx)(n,{...t})}function oY({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DANGER_ZONE,`DangerZone`)(e);return(0,$.jsx)(n,{...t})}function sY({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_HEADING,`Heading`)(e);return(0,$.jsx)(n,{...t})}function cY({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_SUBHEADING,`Subheading`)(e);return(0,$.jsx)(n,{...t})}var lY=({resourceContext:e,navigationZone:t,currentObject:n,onOperationExecuted:r,className:i,responsiveMaxWidth:a})=>{let{resourceType:o,operation:s}=e,{tComponent:c,tResourceOperation:l}=q({component:K.RESOURCES_LAYOUTS_DANGER_ZONE,resource:o}),{items:u,isConfirmDialogOpen:d,confirmDialogLabel:f,confirmDialogDescription:p,confirmDialogConfirmLabel:m,confirmRequiresTypedConfirmation:h,confirmConfirmationPhrase:g,onConfirm:_,onCancel:v}=WV({resourceType:o,displayMode:dr.DETAIL,currentObject:n,contextResourceIdentifiers:e.contextResourceIdentifiers,parentResourcesRequirements:e.parentResourcesRequirements,additionalContext:e.additionalContext,navigationZone:t,sourceOperation:s,placementFilter:ol.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(K.RESOURCES_LAYOUTS_DANGER_ZONE,e),x=b(`title`),S=e=>{switch(e){case od.CRITICAL:return b(`descriptionCritical`);case od.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:G(`mr-auto w-full flex flex-col gap-field-sm`,i),style:$E(a),children:[(0,$.jsx)(sY,{level:3,children:x}),(0,$.jsx)(oY,{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)(c_,{children:e.label}),(0,$.jsx)(Z,{variant:en.MUTED,size:ha.SM,children:C(e)})]}),(0,$.jsx)(Y,{variant:wf(e.variant,HS(e)),disabled:e.disabled,onClick:e.onClick,className:`shrink-0 self-start sm:self-auto`,"data-operation-id":e.operationIdentifier,children:e.label})]},t))}),d&&(0,$.jsx)(kw,{open:d,onOpenChange:e=>{e||v()},cancelCallback:v,validationCallback:_,label:f,description:p,confirmLabel:m,requireTypedConfirmation:h,confirmationPhrase:g})]})};function uY({preset:e=H.DEFAULT,...t}){let n=qc(K.RESOURCES_LAYOUTS_DANGER_ZONE,`ResourceLayout_DangerZone`)(e);return(0,$.jsx)(n,{...t})}var Sye=tl.getLogger(),dY;(function(e){e.IDLE=`idle`,e.LOADING=`loading`,e.READY=`ready`,e.NOT_SHAREABLE=`not_shareable`,e.FAILED=`failed`})(dY||={});function fY(e,t){return(e?.resourceConfigurations[Wo.ORGANIZATION_RELATIONSHIPS]?.operations)?.find(e=>String(e.operationIdentifier)===t&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===oe.API_CALL)}function pY(e,t,n,r){let i=Wo.ORGANIZATION_RELATIONSHIPS,a={...tm.buildResourceOperationContextIdentifiers({currentOrganizationId:n,primaryScope:e.resourceConfigurations[i]?.resourcePrimaryScope,explicitContextResourceIdentifiers:{}}),...r?{[i]:r}:{}};return{operationPathKey:no.buildOperationPathKeyFromOperation(t),contextualParameters:U.buildContextualParameters(a,e),parentResourcesRequirements:kn.buildParentResourcesRequirements(i,a,e)}}function Cye(e){let t=e;return(t?.response?.data?.error?.details?.code??t?.context?.code)===nee.RELATIONSHIP_RECORD_NOT_SHAREABLE}var mY={relationships:[],viaRelationshipId:null,sharedWithRelationshipIds:[],commonToEveryRelationship:!1};function wye(e){let t=(0,Q.useContext)(sm),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)(dY.IDLE),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(mY),{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=fY(n,to.READ_RECORD_SHARING);if(!f||!n||!e||!p||!h||!t){y.current=void 0,_(void 0),s(dY.IDLE),l(!1),d(mY);return}let i=!1,a=`${p}|${m}|${h}`;return y.current===a?l(!0):(y.current=void 0,l(!1),d(mY),s(dY.LOADING)),(async()=>{try{let r=pY(n,t,p),o=Uee.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(dY.READY),l(!1)}catch(e){if(i)return;if(y.current=void 0,_(a),l(!1),d(mY),Cye(e)){s(dY.NOT_SHAREABLE);return}Sye.warn(`[RecordSharing] The record's sharing could not be read`,{resourceType:m,backendRefusal:Rr(e)}),s(dY.FAILED)}})(),()=>{i=!0}},[f,n,p,m,h,i]);let b=(0,Q.useCallback)(async(e,t)=>{let i=r.current,o=fY(n,e);if(!n||!i||!o||!p||!h)throw Error(`The ${e} operation of organization relationships is not available in this frontend.`);let s=pY(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(to.SHARE_RECORD,e),[b]),S=(0,Q.useCallback)(e=>b(to.UNSHARE_RECORD,e),[b]);return o!==dY.IDLE&&o!==dY.LOADING&&g!==v?{readState:dY.LOADING,refreshing:!1,relationships:mY.relationships,viaRelationshipId:mY.viaRelationshipId,sharedWithRelationshipIds:mY.sharedWithRelationshipIds,commonToEveryRelationship:mY.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 Tye(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 hY(e){let t=e.registry?.resourceConfigurations[e.resourceType];if(!t||!kt(e.resourceType,t.resourcePrimaryScope)||Fee.includes(e.resourceType)||!e.recordId||!e.currentOrganizationId||e.recordOrganizationId!==e.currentOrganizationId||!e.grants)return!1;let n=e.registry?.resourceConfigurations[Wo.ORGANIZATION_RELATIONSHIPS]?.resourcePrimaryScope,r=t=>!!t&&Wm({...t,resourceType:Wo.ORGANIZATION_RELATIONSHIPS,resourcePrimaryScope:n},e.viewer);return r(fY(e.registry,to.READ_RECORD_SHARING))&&r(fY(e.registry,to.SHARE_RECORD))&&!!fY(e.registry,to.UNSHARE_RECORD)}var gY=({resourceContext:e,currentObject:t,className:n,responsiveMaxWidth:r})=>{let{resourceType:i}=e,{tComponent:a,formatList:o}=q({component:K.RESOURCES_LAYOUTS_RECORD_SHARING,resource:i}),s=(e,t)=>a(K.RESOURCES_LAYOUTS_RECORD_SHARING,e,t),c=(0,Q.useContext)(sm)?.registry,l=Zp()?.currentOrganizationId??void 0,u=Tye(t,c?.resourceConfigurations[i]?.resourceFieldIdentifier),d=(typeof t?.organizationId==`string`&&t.organizationId.length>0?t.organizationId:void 0)??th(i,u,e.contextResourceIdentifiers),f=iS(d),p=sS()[cv.GRANTS],m=hY({registry:c,resourceType:i,recordId:u,recordOrganizationId:d,currentOrganizationId:l,grants:p,viewer:f}),h=wye({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!==dY.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!==dY.READY&&h.readState!==dY.FAILED||h.readState===dY.READY&&h.viaRelationshipId===null&&h.sharedWithRelationshipIds.length===0&&D.length===0&&M.length===0)return null;let L=b||h.refreshing,R=e=>{x(!0),e().then(()=>_(void 0)).catch(()=>void 0).finally(()=>x(!1))},z=fY(c,to.SHARE_RECORD),B=e=>{ds(z?.riskLevel)?y(e):R(()=>h.share(e))};return(0,$.jsxs)(`section`,{"data-slot":`record-sharing-section`,"data-inline-size-tier":r,className:G(`mr-auto w-full flex flex-col gap-field-sm`,n),style:$E(r),children:[(0,$.jsx)(sY,{level:3,children:s(`title`)}),(0,$.jsx)(wF,{className:`rounded-xl p-0 overflow-hidden divide-y divide-border`,children:h.readState===dY.FAILED?(0,$.jsx)(`div`,{className:`px-card py-card`,children:(0,$.jsx)(Z,{variant:en.MUTED,size:ha.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:ha.SM,children:h.viaRelationshipId===null?s(`ownRecord`):s(`createdThrough`,{relationship:E(h.viaRelationshipId)})}),h.viaRelationshipId!==null&&!F?.confersNow&&(0,$.jsx)(Z,{variant:en.MUTED,size:ha.SM,children:s(`relationshipInactive`)}),h.viaRelationshipId!==null&&F?.confersNow&&!F.rolesReachRecord&&(0,$.jsx)(Z,{variant:en.MUTED,size:ha.SM,children:s(`creatorCannotRead`)}),(0,$.jsx)(Z,{variant:en.MUTED,size:ha.SM,children:h.commonToEveryRelationship?s(`commonToEveryRelationship`):s(P?`notReadableByRelationships`:`description`)}),M.length>0&&!h.commonToEveryRelationship&&(0,$.jsx)(Z,{variant:en.MUTED,size:ha.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:en.MUTED,size:ha.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)(c_,{children:E(e)}),t!==void 0&&(0,$.jsx)(Z,{variant:en.MUTED,size:ha.SM,children:t})]}),(0,$.jsx)(Y,{variant:X.OUTLINE,disabled:L,onClick:()=>R(()=>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)(fF,{name:`recordSharingRelationship`,schema:md(),options:D.map(e=>({value:e.relationshipId,label:E(e.relationshipId)})),value:A,onChange:_,placeholder:s(`chooseRelationship`),size:Nf.SM,disabled:L}),(0,$.jsx)(Y,{variant:X.SECONDARY,disabled:L||!A,onClick:()=>{A&&B(A)},className:`shrink-0 self-start sm:self-auto`,children:s(`share`)})]})]})}),j!==void 0&&(0,$.jsx)(kw,{open:!0,onOpenChange:e=>{e||y(void 0)},cancelCallback:()=>y(void 0),validationCallback:()=>{let e=j;y(void 0),R(()=>h.share(e))},label:s(`confirmShareTitle`,{relationship:E(j)}),description:s(`confirmShareDescription`),confirmLabel:s(`share`)})]})};function _Y({preset:e=H.DEFAULT,...t}){let n=qc(K.RESOURCES_LAYOUTS_RECORD_SHARING,`ResourceLayout_RecordSharing`)(e);return(0,$.jsx)(n,{...t})}var vY=(0,Q.createContext)(void 0);function yY(){return(0,Q.useContext)(vY)}function Eye(e){let{registry:t,doOperation:n}=fm(),[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?wt(n.resourceRelationships):[]).some(e=>e.discriminator!=null||e.condition!=null)},[e.enabled,e.resourceContext.resourceType,t]),o=ZB({resourceType:e.resourceContext.resourceType,rowIds:[kn.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=U.buildContextualParameters(e.resourceContext.contextResourceIdentifiers,t),c=kn.getResourceId(e.resourceContext.contextResourceIdentifiers?.[e.resourceContext.resourceType]),l=fh({resourceConfig:r,operations:r.operations??[],coreOperation:J.READ,registry:t,hasResourceId:!!c,contextResourceIdentifiers:e.resourceContext.contextResourceIdentifiers,contextualParameters:o});if(!l){i(void 0);return}let u=no.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 bY=({resourceContext:e,navigationZone:t,navigationInitiator:n,inlineParentContext:r,children:i,showCharts:a=!0})=>{let{goBack:o,canGoBack:s,navigate:c}=yS(),{getZoneState:l}=kx(),{registry:u}=fm(),{tComponent:d,isReady:f}=q({component:K.RESOURCES_LAYOUTS_READ}),{resourceContext:p,resourceType:m,operation:h,isSemanticCustomOperation:g,reportError:_,resolvePreferredOperation:v,navigateToResourceOperation:y}=YS({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)===J.READ,A=(0,Q.useMemo)(()=>k?{record:w,failed:S}:void 0,[k,w,S]),j=yp({tComponent:d,componentType:K.RESOURCES_LAYOUTS_READ,key:`displayFailed`}),M=yp({tComponent:d,componentType:K.RESOURCES_LAYOUTS_READ,key:`semanticOperationFailed`}),N=Eye({resourceContext:p,enabled:g}),P=(0,Q.useMemo)(()=>yj({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===Sa.RESOURCE_OPERATION&&a.content.resourceContext.resourceType===r&&kn.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):kn.buildParentResourcesRequirements(r,f,u),g={};for(let e of h){let t=e.foreignKeyField??e.resourceType,n=f[t]??f[e.resourceType],r=kn.getResourceId(n);r&&(e.foreignKeyField?g[t]={fieldIdentifier:e.foreignKeyField,resourceId:r}:g[e.resourceType]=r)}g[r]=e;let _=U.buildContextualParameters(g,u),v=fh({resourceConfig:d,operations:d.operations??[],coreOperation:J.READ,registry:u,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:g,contextualParameters:_});if(!v)return!1;let y=kn.createFrontendResourceOperationContextFromOperation({resourceType:r,operation:v,contextResourceIdentifiers:g,parentResourcesRequirements:h}),b=Hm.resolveResourceUrl(d,v,ku(g),u.allResourceFieldIdentifiers,h);return c({content:{contentType:Sa.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??iu.CONTEXT,showParentLink:e.showParentLink,onNavigateToParent:F}},[P,F]),L=(0,Q.useCallback)(e=>{C(!0),_(e,j,`ResourceLayoutPreset_Read_Default`)},[j,_]),R=(0,Q.useCallback)(e=>{let n=vl(e);if(n!==J.DELETE&&n!==J.DELETE_MANY)return;if(s(t)||t!==ql.PRIMARY){o(t);return}let r=v(J.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]),z=(0,Q.useMemo)(()=>U.flattenContextIdentifiers(p.contextResourceIdentifiers),[p.contextResourceIdentifiers]);return f===!1?null:g?(0,$.jsx)(OU,{hostResourceType:p.resourceType,contextResourceIdentifiers:z,navigationZone:t,navigationInitiator:n,children:(0,$.jsxs)(GJ,{children:[(0,$.jsx)(iV,{resourceContext:p,navigationZone:t,navigationInitiator:n,errorMessage:M,errorComponent:`ResourceLayoutPreset_Read_Default`,headerActions:(0,$.jsx)(UY,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:VY.ACTION_BAR}),recordNavigation:(0,$.jsx)(UY,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:VY.RECORD_NAVIGATION})}),(0,$.jsxs)(vD,{voice:Ea.EYEBROW,children:[(0,$.jsx)(UY,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:VY.CONTENT}),(0,$.jsx)(rY,{resourceContext:p,navigationZone:t,navigationInitiator:n,parentData:N})]})]})}):(0,$.jsx)(OU,{hostResourceType:p.resourceType,contextResourceIdentifiers:z,navigationZone:t,navigationInitiator:n,children:(0,$.jsx)(GJ,{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)(eV,{resourceContext:p,navigationZone:t,navigationInitiator:n,parentReferenceConfig:I,heldRecord:A,actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(UY,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:VY.ACTION_BAR}),(0,$.jsx)(aY,{resourceContext:p,currentObject:b,navigationZone:t,navigationInitiator:n,displayMode:dr.DETAIL,placementFilter:ol.PRIMARY,size:df.ICON_SM,onOperationExecuted:R})]})}),(0,$.jsx)(UY,{resourceContext:p,navigationZone:t,navigationInitiator:n,showCharts:a,renderSlot:VY.RECORD_NAVIGATION}),(0,$.jsx)(`div`,{"data-record-body":!0,children:(0,$.jsx)(zJ,{resourceContext:p,navigationZone:t,onError:L,onDataLoaded:O,parentReferenceConfig:I,recordNameShownAbove:!0})}),(0,$.jsx)(UY,{resourceContext:p,navigationZone:t,showCharts:a,renderSlot:VY.CONTENT}),(0,$.jsxs)(vD,{voice:Ea.EYEBROW,children:[(0,$.jsx)(vY.Provider,{value:b,children:i}),(0,$.jsx)(rY,{resourceContext:p,navigationZone:t,navigationInitiator:n,parentData:b})]}),(0,$.jsx)(_Y,{resourceContext:p,navigationZone:t,navigationInitiator:n,currentObject:b,className:`[max-inline-size:var(--record-body-max-inline-size)]`}),(0,$.jsx)(uY,{resourceContext:p,navigationZone:t,navigationInitiator:n,currentObject:b,onOperationExecuted:R,className:`[max-inline-size:var(--record-body-max-inline-size)]`})]})})})},xY=(0,Q.createContext)(new Set);function SY({preset:e,...t}){let n=HW(t.resourceContext.operation),r=UW(t.resourceContext.operation),i=e??r??yi.DEFAULT,a=(0,Q.useContext)(xY),o=(0,Q.useMemo)(()=>no.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)(xY.Provider,{value:c,children:(0,$.jsx)(n,{...t})});let l=qc(K.RESOURCES_LAYOUTS_READ,`ResourceLayout_Read`)(i);return(0,$.jsx)($.Fragment,{children:(0,$.jsx)(l,{...t})})}var CY=tl.getLogger(),wY=({resourceContext:e,navigationZone:t,navigationInitiator:n,dataMode:r})=>{let{resourceType:i,operation:a,resourceConfig:o,operationInitiator:s,contextualParameters:c,navigateToResourceOperation:l}=YS({resourceContext:e,navigationZone:t,navigationInitiator:n}),{tComponent:u,tResourceFieldDisplay:d,tResourceFieldEnumValue:f}=q({component:[K.RESOURCES_LAYOUTS_SEARCH,K.RESOURCES_LAYOUTS_LIST],resource:i}),p=cp(),m=e=>u(K.RESOURCES_LAYOUTS_SEARCH,e),{renderIcon:h}=ef(),{getRecipe:g}=Ng(),_=g(It.INTERACTIVE,qo.GHOST),{registry:v,doOperation:y}=fm(),[b]=sh(),x=a.operationFrontendConfig?.collectionDisplayConfig,S=x?.cardLayout,C=x?.cardActionPlacement,w=x?.selectable??!1,T=S?.style===Nc.GRID,E=S?.style===Nc.GRID?S.columns:void 0,D=o?.resourceFieldIdentifier,O=GV({idField:D}),k=Nx(),[A,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)([]),L=(0,Q.useRef)(null),R=fq(L,O.selectionCount>0),z=dq(O.selectionCount>0),B=F.length>0&&F.every(e=>O.isSelected(e)),ee=(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]),[te,ne]=(0,Q.useState)(null),[V,re]=(0,Q.useState)(!1),[ie,ae]=(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}}),[oe,se]=(0,Q.useState)(!1),[ce,le]=(0,Q.useState)([]),[ue,de]=(0,Q.useState)({});(0,Q.useEffect)(()=>{O.clearSelection()},[N,ue]);let fe=(0,Q.useMemo)(()=>[`resources.${i}`,`components.${K.RESOURCES_LAYOUTS_SEARCH}`],[i]),pe=a?.operationIdentifier??J.SEARCH,{isInitialLoad:me,isRefreshing:he}=qy(og({resourceType:i,operation:pe})),ge=(0,Q.useRef)(y),_e=(0,Q.useRef)(e),ve=(0,Q.useRef)(ce),ye=(0,Q.useRef)(ue);ge.current=y,_e.current=e,ve.current=ce,ye.current=ue;let be=(0,Q.useMemo)(()=>U.buildContextResourceIdentifiersKey(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]),xe=(0,Q.useMemo)(()=>PG.searchOperationAcceptsATerm(a),[a]),Se=(0,Q.useMemo)(()=>PG.detectSummaryFields(o),[o]),Ce=(0,Q.useMemo)(()=>yp({tComponent:u,componentType:K.RESOURCES_LAYOUTS_SEARCH,key:`resultsLabel`}),[u]),we=(0,Q.useMemo)(()=>{let e={};for(let t of Se)e[t]=d(i,t,`label`);return e},[Se,i,d]),Te=(0,Q.useCallback)(e=>o?fh({resourceConfig:o,operations:o.operations??[],coreOperation:J.READ,registry:v,hasResourceId:kn.getResourceId(e[i]).length>0,requireFrontendAddressable:!0,contextResourceIdentifiers:e,contextualParameters:U.buildContextualParameters(e,v)})??null:null,[v,o,i]),{sortFields:Ee,filterFields:De,filtersEnabled:Oe}=(0,Q.useMemo)(()=>{let t=a,n=t?.sortFields??[],r=PG.parseFilterFieldDefinitions(t?.filterFields,o?{registry:v,resourceConfig:o,operation:a,contextualParameters:c,parentResourcesRequirements:e.parentResourcesRequirements}:void 0),i=PG.withoutPinnedFilterFields(r,e.pinnedFilters);return{sortFields:n,filterFields:i,filtersEnabled:i.length>0}},[a,v,o,c,e.parentResourcesRequirements,e.pinnedFilters]),ke=(0,Q.useMemo)(()=>kn.extractDataMode(b,r),[b,r]),Ae=(0,Q.useMemo)(()=>no.createOperationPathKeyFromOperation(a),[a]),je=PG.matchListingOf(a);(0,Q.useEffect)(()=>{let e=setTimeout(()=>{P(A)},300);return()=>clearTimeout(e)},[A]);let Me=ce.map(e=>`${e.field}:${e.direction}`).join(`,`),Ne=(0,Q.useMemo)(()=>JSON.stringify(ue),[ue]),Pe=(0,Q.useMemo)(()=>JSON.stringify(e.pinnedFilters??{}),[e.pinnedFilters]),{emit:Fe}=Uo();(0,Q.useEffect)(()=>{Fe(hc.RESOURCE_COLLECTION_FILTERS_CHANGED,{resourceType:i,filterValues:ye.current})},[Ne,i,Fe]);let Ie=`${i}|${Ae}|${be}|${N}|${ie.page}|${ie.limit}|${Me}|${Ne}|${Pe}|${xe}`;(0,Q.useEffect)(()=>{if(!N&&!V&&xe)return;let e=!1,t=!1,n=()=>{t||(t=!0,se(!1))};return(async()=>{se(!0),ne(null),re(!0);try{let t=PG.withPinnedFilters(ye.current,_e.current.pinnedFilters),n=Object.keys(t).length>0?t:void 0,r={contextualParameters:c,searchQuery:N||void 0,filters:n,pagination:{page:ie.page,limit:ie.limit},sort:ve.current.length?[...ve.current]:void 0,parentResourcesRequirements:_e.current.parentResourcesRequirements,dataMode:ke},i=await ge.current(Ae,r);if(e)return;if(i&&typeof i==`object`&&`data`in i&&`pagination`in i){let e=i;I(e.data),ae(e.pagination)}else Array.isArray(i)&&(I(i),ae(e=>({...e,total:i.length,totalPages:1})))}catch(t){if(e)return;let n=j(t);ne({message:p(t)}),CY.error(`[ResourceLayoutPreset_Search_Default] Search error:`,{...n,error:t})}finally{e||n()}})(),()=>{e=!0,n()}},[Ie]);let Le=(0,Q.useCallback)(e=>{if(!o)return;let t=U.getResourceObjectId(e,o.resourceFieldIdentifier);if(!t){CY.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=kn.buildRecordIdentifiersFromCollection(_e.current.contextResourceIdentifiers,i,t),r=Te(n);r&&l({operation:r,contextResourceIdentifiers:n,parentResourcesRequirements:_e.current.parentResourcesRequirements,initiatorOverride:s})},[o,o?.resourceFieldIdentifier,i,l,s,Te]),Re=(0,Q.useCallback)(e=>{le(e),ae(e=>({...e,page:1}))},[]),ze=(0,Q.useCallback)(e=>{de(e),ae(e=>({...e,page:1}))},[]),Be=(0,Q.useCallback)(e=>{e.preventDefault(),P(A)},[A]),Ve=h(W.SEARCH,{size:tr.SM});return(0,$.jsx)(Zy,{i18nKeys:fe,readiness:[{id:`search-initial-load`,isReady:!me}],renderLoading:()=>(0,$.jsx)(pm,{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)(eV,{resourceContext:e,navigationZone:t,navigationInitiator:n}),xe&&(0,$.jsxs)(`form`,{onSubmit:Be,role:`search`,className:`flex gap-element`,children:[(0,$.jsx)(`div`,{className:`flex-1`,children:(0,$.jsx)(XM,{type:`text`,value:A,onChange:e=>M(e.target.value),placeholder:m(`placeholder`),"aria-label":m(`placeholder`),prefix:Ve})}),(0,$.jsx)(Y,{type:`submit`,disabled:oe,children:m(`search`)})]}),(Oe||Ee.length>0&&V)&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-element-sm`,children:[Oe&&De.length>0&&(0,$.jsx)(qK,{resourceType:i,filterFields:De,currentFilters:ue,onFiltersChange:ze}),Ee.length>0&&V&&(0,$.jsx)(nq,{resourceType:i,sortFields:Ee,currentSorts:ce,onSortChange:Re})]}),w&&V&&(F.length>0||O.selectionCount>0||z.backgroundRunState!==uq.NONE)&&(0,$.jsxs)(`div`,{ref:L,className:`flex flex-nowrap items-center gap-element`,"data-slot":`collection-selection-row`,children:[F.length>0&&(0,$.jsx)(oq,{state:aq(F.length,F.filter(e=>O.isSelected(e)).length),onToggle:ee}),(0,$.jsx)(iq,{count:O.selectionCount,onClear:O.clearSelection,...B&&!O.matchAllSelection&&ie.total>F.length&&je?{matchAllOffer:{matchedCount:ie.total,onSelectAllMatching:()=>O.selectAllMatching({filters:PG.withPinnedFilters(ue,e.pinnedFilters),...N?{search:N}:{},listing:je,matchedCount:ie.total})}}:{},...O.matchAllSelection?{isMatchAllSelected:!0}:{}}),z.isBulkBarMounted&&(0,$.jsx)(`div`,{className:`ms-auto min-w-0`,children:(0,$.jsx)(lq,{density:R.density,onActionSetChange:R.reportActionSet,onBackgroundRunChange:z.onBackgroundRunChange,children:(0,$.jsx)(xJ,{resourceContext:e,navigationZone:t,navigationInitiator:n,selectedItems:O.selectedItems,selectedItemsDataMode:ke,matchAllSelection:O.matchAllSelection,explicitIdSelection:O.explicitIdSelection,onSelectIds:O.selectIds,idField:D,onSelectionClear:O.clearSelection,onSelectionReplace:O.selectAll})})})]}),te&&(0,$.jsx)(Py,{variant:`error`,iconRef:W.ERROR_APPLICATION,title:yp({tComponent:u,componentType:K.RESOURCES_LAYOUTS_SEARCH,key:`errorLoading`}),message:te.message}),k.isCreateActive&&(0,$.jsx)(kG,{navigationZone:t,className:`border border-border rounded-lg`}),V&&!te&&(0,$.jsxs)($.Fragment,{children:[F.length===0?(0,$.jsx)(`div`,{className:`text-center py-section text-muted-foreground text-sm`,role:`status`,children:yp({tComponent:u,componentType:K.RESOURCES_LAYOUTS_LIST,key:`noSearchResults`})}):(0,$.jsx)(`div`,{className:`space-y-item-sm`,children:(0,$.jsx)(`ul`,{role:`list`,"aria-label":Ce,style:xG(E),className:G(bG(E),he&&`opacity-70 transition-opacity duration-150 motion-reduce:transition-none`),"aria-busy":me||he||void 0,children:F.map((n,r)=>{let a=o?.resourceFieldIdentifier;if(!a)throw U.buildConfigurationError(Lu.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:i,component:`ResourceLayoutPreset_Search`});let s=U.getResourceObjectId(n,a);return k.isElementActive(s)?(0,$.jsx)(`li`,{className:G(`list-none`,T&&`border border-border rounded-lg overflow-hidden`),children:(0,$.jsx)(kG,{navigationZone:t})},s||r):(0,$.jsx)(`li`,{className:G(`list-none`,T&&`border border-border rounded-lg overflow-hidden`),children:(0,$.jsx)(OG,{item:n,resourceType:i,resourceConfig:o,registry:v,collectionContextResourceIdentifiers:e.contextResourceIdentifiers,summaryFields:Se,fieldLabelsMap:we,tResourceFieldEnumValue:f,onItemClick:Le,cardActionPlacement:C,selectable:w,isSelected:O.isSelected(n),selectionActive:O.selectionCount>0,onToggleSelect:O.toggleSelection,selectAriaLabel:u(K.RESOURCES_LAYOUTS_LIST,`selectRow`,{row:r+1}),interactiveClasses:{hover:_.states.hover,transition:_.motion.transition}})},s||r)})})}),(0,$.jsx)(XG,{pagination:ie,onPaginationChange:ae})]})]})})};function TY({preset:e,...t}){let n=HW(t.resourceContext.operation),r=UW(t.resourceContext.operation),i=e??r??te.DEFAULT,a=n?(0,$.jsx)(n,{...t}):Q.createElement(qc(K.RESOURCES_LAYOUTS_SEARCH,`ResourceLayout_Search`)(i),t);return(0,$.jsx)(Mx,{resourceType:t.resourceContext.resourceType,children:(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,[lA]:!0,children:a})})}var EY=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>{let{tComponent:r,isReady:i}=q({component:K.RESOURCES_LAYOUTS_UPDATE}),{resourceContext:a,operation:o,isSemanticCustomOperation:s,navigateToPreferredRead:c,goBackWithinZone:l,reportError:u}=YS({resourceContext:e,navigationZone:t,navigationInitiator:n}),d=yp({tComponent:r,componentType:K.RESOURCES_LAYOUTS_UPDATE,key:`formUpdateFailed`}),f=yp({tComponent:r,componentType:K.RESOURCES_LAYOUTS_UPDATE,key:`semanticOperationFailed`}),{closeOverlay:p}=yS(),m=(0,Q.useCallback)(()=>{o.isBulkOperation?l():c({transitionOverride:t===Gn.OVERLAY?Mo.PROMOTE:void 0})},[l,c,t,o.isBulkOperation]),h=$R(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===Gn.OVERLAY?()=>p():void 0,[t,p]);return i?s?(0,$.jsx)(iV,{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)(eV,{resourceContext:a,navigationZone:t,navigationInitiator:n}),(0,$.jsx)(cB,{resourceContext:a,navigationZone:t,onSuccess:g,onError:_,onCancel:v,showErrorSummary:!0})]}):null};function DY({preset:e,...t}){let n=HW(t.resourceContext.operation);if(n)return(0,$.jsx)(n,{...t});let r=UW(t.resourceContext.operation),i=e??r??H.DEFAULT,a=qc(K.RESOURCES_LAYOUTS_UPDATE,`ResourceLayout_Update`)(i);return(0,$.jsx)(a,{...t})}function OY({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)(rG,{...r});break;case`list`:a=(0,$.jsx)(YY,{...r});break;case`read`:a=(0,$.jsx)(SY,{...r});break;case`update`:a=(0,$.jsx)(DY,{...r});break;case`search`:a=(0,$.jsx)(TY,{...r});break;default:a=(0,$.jsx)(GW,{...r})}return(0,$.jsx)(nC,{...r,children:a})}function kY(e){return`${Bc.COMPOSITE_VIEWS}.${e}`}function AY(e){return`${Bc.VIEWS}.${e.family}.${e.translationRef}`}function jY(e){return`app.${e}`}function MY(e,t){return`resources.${e}.${t}`}function NY(e){let t=jp(e);if(!t)return Ep(e);if(t.viewKind===bp.COMPOSITE_VIEW)return t.hostKind===Bp.RESOURCE?pp(t.hostRef,t.localRef):Ep(t.localRef)}function PY(e){let t=jp(e.viewRef);if(e.contentType===Sa.CHART_VIEW)return t?.viewKind===bp.CHART_VIEW?{family:ho.CHART,translationRef:MY(t.hostRef,t.localRef)}:{family:ho.CHART,translationRef:jY(e.viewRef)};if(e.contentType===Sa.EXECUTION_VIEW)return t?.viewKind===bp.EXECUTION_VIEW?{family:ho.EXECUTION,translationRef:MY(t.hostRef,t.localRef)}:{family:ho.EXECUTION,translationRef:jY(e.viewRef)};if(e.contentType===Sa.FULL_CUSTOM_VIEW)return{family:ho.FULL_CUSTOM,translationRef:jY(e.viewRef)};if(e.contentType===Sa.FLOWS_ACTORS_VIEW)return{family:ho.FLOWS_ACTORS,translationRef:jY(e.viewRef)}}function FY(e){if(e.contentType===Sa.COMPOSITE_VIEW){let t=NY(e.viewRef);return t?e.tCompositeView(t,`title`):e.viewRef}let t=PY({viewRef:e.viewRef,contentType:e.contentType});return t?e.tView(t.family,t.translationRef,`title`):e.viewRef}var Dye={[Sa.FULL_CUSTOM_VIEW]:`view-custom-`,[Sa.EXECUTION_VIEW]:`view-execution-`,[Sa.FLOWS_ACTORS_VIEW]:`view-flows-`,[Sa.CHART_VIEW]:`view-chart-`},IY=({viewRef:e,contentType:t,hasAuthoredIcon:n=!1,iconViewRef:r,navigationZone:i=Gn.PRIMARY,className:a})=>{let o=Hk(),s=(0,Q.useMemo)(()=>{if(t===Sa.COMPOSITE_VIEW){let t=NY(e);return t?[kY(t)]:[]}let n=PY({viewRef:e,contentType:t});return n?[AY(n)]:[]},[e,t]),{tCompositeView:c,tView:l,isReady:u}=q({keys:s}),{renderIcon:d}=ef(),{title:f,description:p}=(0,Q.useMemo)(()=>{if(t===Sa.COMPOSITE_VIEW){let t=NY(e);return t?{title:c(t,`title`),description:c(t,`description`)}:{title:``,description:``}}let n=PY({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=Dye[t];return i?d({category:nn.CUSTOM,customReference:`${i}${r??e}`},{size:tr.LG}):null},[n,t,e,r,d]);return!u||o||!f?null:(0,$.jsxs)(`div`,{className:G(a),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-field`,children:[(0,$.jsx)(pB,{host:dB.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 Oye(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`execution-${crypto.randomUUID()}`:`execution-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}var LY=({viewRef:e,viewDefinition:t,contextResourceIdentifiers:n,navigationZone:r=Gn.PRIMARY})=>{let i=Zp(),{doOperation:a,registry:o}=fm(),{navigate:s}=yS(),{tComponent:c,isReady:l}=q({component:K.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??Dp({viewRef:e,registry:o}),C=(0,Q.useMemo)(()=>Oye(),[S?.ref]);(0,Q.useEffect)(()=>{},[n,S,e]);let w=(0,Q.useMemo)(()=>{let e=tm.buildInitiatorIds({userId:i?.currentUserId,organizationId:i?.currentOrganizationId,applicationId:i?.currentApplicationId,anonymousUserId:i?.currentAnonymousUserId}),t=S?.primaryScope?tm.primaryScopeToContextIdentifiers(e,S.primaryScope):{},r=i?.buildContextResourceIdentifiers()??{},a=tm.filterCustomScopeContextResourceIdentifiers(r);if(!S)return tm.mergeContextResourceIdentifiers(t,a,n);let o=tm.getAllowedViewBindingKeys({primaryScope:S.primaryScope,parentResourcesRequirements:S.parentResourcesRequirements,additionalResourceRequirements:S.additionalResourceRequirements});return tm.resolveViewContextResourceIdentifiers({surfaceName:`ExecutionView`,surfaceRef:S.ref,primaryScope:S.primaryScope,parentResourcesRequirements:S.parentResourcesRequirements,additionalResourceRequirements:S.additionalResourceRequirements,primaryScopeContext:t,customScopeContext:a,explicitContextResourceIdentifiers:tm.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?sye(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?gce({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=>{ey(e.content),d(e),y(e=>Ey(e,Zv.EMBEDDED_CONTENT)),x(e=>oy(e,ty.EMBEDDED_CONTENT))},closeEmbeddedContent:()=>{d(null),y(e=>Ey(e,Zv.EMBEDDED_CONTENT)),x(e=>oy(e,ty.EMBEDDED_CONTENT))},openLocalPane:(e,t)=>{$v(t),p({paneId:e,payload:t}),y(t=>Dy(t,e)),x(t=>sy(t,e))},closeLocalPane:()=>{p(null),y(e=>Dy(e,null)),x(e=>sy(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=>{Xv(e),_(t=>({...t,[e.prefetchRuntimeId]:e}))},endParticipationPrefetch:e=>{_(t=>{if(!(e in t))return t;let{[e]:n,...r}=t;return r})},markDirty:e=>{Qv(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=>{ny(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=>uy(t,e))}}),[s,r]);if(!S)return(0,$.jsx)(a_,{viewKind:`execution`,viewRef:e});if(!l)return null;let k=e=>yp({tComponent:c,componentType:K.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)(ay,{viewDefinition:S,contextResourceIdentifiers:w,runtimeInstanceId:C,navigationZone:r,doOperation:a,navigation:O,anchor:T,participations:D,runtimeState:E,children:[(0,$.jsx)(IY,{viewRef:e??S.ref,iconViewRef:S.ref,contentType:Sa.EXECUTION_VIEW,hasAuthoredIcon:!!S.icon,navigationZone:r,className:`mb-group`}),(0,$.jsx)(Ry,{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)(Y,{type:`button`,variant:X.LINK,size:df.SM,onClick:()=>{O.closeEmbeddedContent()},children:k(`embeddedClose`)})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,$.jsx)(Cy,{scope:{scope:Zv.EMBEDDED_CONTENT},children:(0,$.jsx)(OY,{resourceContext:M.resourceContext,navigationZone:r,navigationInitiator:j?.navigationInitiator})})})]})]}):N})]})};function RY(e){let t={};for(let[n,r]of Object.entries(e.contextResourceIdentifiers)){let e=kn.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 zY(e,t){return!e||e.length===0||e.every(e=>{if(e.requirement!==_a.MANDATORY||e.isPrimaryScope)return!0;let n=e.foreignKeyField?t[e.foreignKeyField]:void 0,r=t[e.resourceType];return!!(n??r)})}function BY({resourceContext:e,viewRef:t,navigationZone:n,navigationInitiator:r}){let i=(0,Q.useMemo)(()=>vp(e.resourceType,{ref:t}),[e.resourceType,t]),a=(0,Q.useMemo)(()=>RY(e),[e]);return(0,$.jsx)(IU,{viewRef:i.insertedViewRef,contextResourceIdentifiers:a,navigationZone:n,navigationInitiator:r})}function kye({resourceContext:e,viewRef:t,inputs:n,urlParamValues:r,className:i}){let{registry:a}=fm(),o=(0,Q.useMemo)(()=>xp(e.resourceType,{ref:t}),[e.resourceType,t]),s=(0,Q.useMemo)(()=>RY(e),[e]),c=a.resourceConfigurations[e.resourceType]?.frontendConfiguration?.chartViews?.find(e=>e.ref===t);if(!c)throw jye(`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)(Vh,{requiredFeatures:c.chartDefinition.requiredFeatures,children:(0,$.jsx)(TJ,{viewRef:o.insertedViewRef,viewDefinition:c,runtimeDescriptor:gp({identity:o,chartView:c,contextResourceIdentifiers:s}),contextResourceIdentifiers:s,inputs:n,urlParamValues:r,localErrorOnly:!0})})})}function Aye({resourceContext:e,viewRef:t,navigationZone:n,className:r}){let i=(0,Q.useMemo)(()=>dp(e.resourceType,{ref:t}),[e.resourceType,t]),a=(0,Q.useMemo)(()=>RY(e),[e]);return(0,$.jsx)(`div`,{className:r,children:(0,$.jsx)(LY,{viewRef:i.insertedViewRef,navigationZone:n,contextResourceIdentifiers:a})})}function jye(e,t){return U.buildConfigurationError(Lu.CONFIGURATION,{component:`ResourceOwnedViewEmbeds`,message:e,...t})}var VY;(function(e){e.ACTION_BAR=`action_bar`,e.RECORD_NAVIGATION=`record_navigation`,e.CONTENT=`content`,e.ALL=`all`})(VY||={});var HY=(0,Q.createContext)(new Set);function UY({resourceContext:e,navigationZone:t,navigationInitiator:n,className:r=``,chartHeight:i=320,showCharts:a=!0,renderSlot:o=VY.ALL}){let{registry:s}=fm(),c=(0,Q.useContext)(HY),{navigate:l}=yS(),{renderIcon:u}=ef(),d=s.resourceConfigurations[e.resourceType]?.frontendConfiguration,f=(0,Q.useMemo)(()=>(d?.compositeViews??[]).map(e=>kY(e.translationRef)),[d?.compositeViews]),p=(0,Q.useMemo)(()=>[...(d?.chartViews??[]).map(t=>AY({family:ho.CHART,translationRef:MY(e.resourceType,t.ref)})),...(d?.executionViews??[]).map(t=>AY({family:ho.EXECUTION,translationRef:MY(e.resourceType,t.ref)}))],[d?.chartViews,d?.executionViews,e.resourceType]),{tCompositeView:m,tResourceHeader:h,tResourceOperation:g,tView:_}=q({keys:[...f,...p]}),v=(0,Q.useMemo)(()=>RY(e),[e]),y=e.operation,b=y.isOperationDefault===!0||!y.variantKey,x=String(y.operationIdentifier),S=_D(),C=x===J.READ?Ea.EYEBROW:S,{getRecipe:w}=Ng(),T=(0,Q.useMemo)(()=>b?x:mp([x,String(y.variantKey)]),[x,b,y.variantKey]),E=(0,Q.useMemo)(()=>b?(d?.compositeViews??[]).filter(e=>String(e.operationLike)===x&&zY(e.parentResourcesRequirements,v)):[],[v,x,d?.compositeViews,b]),D=(0,Q.useMemo)(()=>b?(d?.chartViews??[]).filter(e=>String(e.operationLike)===x&&zY(e.parentResourcesRequirements,v)):[],[v,x,d?.chartViews,b]),O=(0,Q.useMemo)(()=>(d?.executionViews??[]).filter(e=>(e.surfaceInOperations??[]).some(e=>mp(e)===T)&&zY(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)=>FY({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?WY({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:_(ho.CHART,MY(e.resourceType,t.ref),`title`)});for(let r of O)WY({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===VY.ALL)return k;let e={[Fp.ACTION_BAR]:VY.ACTION_BAR,[Fp.RECORD_NAVIGATION]:VY.RECORD_NAVIGATION,[Fp.CONTENT_CARD]:VY.CONTENT};return k.flatMap(t=>{if(t.type!==`launcher-group`)return o===VY.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)(vD,{voice:C,children:(0,$.jsx)(`div`,{className:G(`space-y-section`,r),"data-testid":`resource-layout-inserted-views`,children:j.map((r,a)=>r.type===`embedded-composite`?(0,$.jsx)(HY.Provider,{value:new Set([...c,r.ref]),children:(0,$.jsx)(BY,{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:G(`mb-element-sm`,C?w(It.TYPOGRAPHY,C).base:`text-sm font-medium text-foreground`),children:r.title}),(0,$.jsx)(Vh,{requiredFeatures:r.chartView.chartDefinition.requiredFeatures,children:(0,$.jsx)(TJ,{viewDefinition:r.chartView,runtimeDescriptor:gp({identity:xp(e.resourceType,r.chartView),chartView:r.chartView,contextResourceIdentifiers:v}),height:i,localErrorOnly:!0})})]},`chart:${r.ref}:${a}`):(0,$.jsx)(Mye,{renderSlot:o,children:r.views.map(e=>(0,$.jsx)(Vh,{requiredFeatures:e.requiredFeatures,children:(0,$.jsxs)(Y,{"data-testid":`inserted-view-launcher-${e.ref}`,type:`button`,variant:e.presentation.emphasized?X.DEFAULT:o===VY.RECORD_NAVIGATION?X.GHOST:X.OUTLINE,size:df.SM,onClick:()=>A(e),"aria-label":e.presentation.showLabel?void 0:e.label,title:e.presentation.showLabel&&o!==VY.ACTION_BAR?void 0:e.label,children:[e.iconReference?u(e.iconReference,{size:tr.SM}):e.kind===Sa.COMPOSITE_VIEW?u({category:nn.COMPOSITE_VIEW,viewReference:e.ref},{size:tr.SM}):u({category:nn.CUSTOM,customReference:`view-execution-${e.ref}`},{size:tr.SM}),e.presentation.showLabel&&(0,$.jsx)(`span`,{className:o===VY.ACTION_BAR?`@max-[48rem]/resource-header:sr-only`:void 0,children:e.label})]})},`${e.kind}:${e.ref}`))},`launcher-group:${a}`))})})}function Mye({renderSlot:e,children:t}){return e===VY.ACTION_BAR?(0,$.jsx)($.Fragment,{children:t}):e===VY.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 Nye(e){return e?.contentType===Sa.COMPOSITE_VIEW||e?.contentType===Sa.EXECUTION_VIEW}function WY(e){let{resolvedSegments:t,resolutionContext:n,resourceType:r,viewRef:i,operationIdentifier:a,familyLabel:o,launcher:s}=e,c=qm({kind:_s.RESOURCE_VIEW,resourceType:r,viewRef:i},n);if(!c)throw GY(`Operation "${String(a)}" on resource "${r}" could not resolve resource-owned ${o} view "${i}".`);if(!Nye(c))throw GY(`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:Mm(s)},u=t[t.length-1];u?.type===`launcher-group`?u.views.push(l):t.push({type:`launcher-group`,views:[l]})}function GY(e){return U.buildConfigurationError(Lu.CONFIGURATION,{component:`ResourceLayout_InsertedViews`,message:e})}var KY=tl.getLogger(),qY=KY.debugByType(`ResourceLayoutPreset_List_Default`);KY.setDebugTypeLogging(`ResourceLayoutPreset_List_Default`,!1);var JY=({resourceContext:e,navigationZone:t,navigationInitiator:n,dataMode:r,sourceRelationship:i,showCharts:a=!0,defaultViewMode:o=vs.CARDS})=>{let{resourceType:s,operation:c,operationId:l,resourceConfig:u,operationInitiator:d,contextualParameters:f,resolvePreferredOperation:p,navigateToResourceOperation:m}=YS({resourceContext:e,navigationZone:t,navigationInitiator:n}),{tResourceHeader:h,tResourceFieldDisplay:g,tResourceFieldEnumValue:_,tResourceOperation:v,tComponent:y,formatDate:b,formatDateTime:x,isReady:S,resolvedRegionalPreferences:C}=q({component:K.RESOURCES_LAYOUTS_LIST,resource:s}),{t:w}=q({resource:s}),T=cp(),{renderIcon:E}=ef(),{registry:D,doOperation:O}=fm(),[k]=sh(),{getRecipe:A}=Ng(),M=A(It.INTERACTIVE,qo.GHOST),N=(0,Q.useMemo)(()=>({...d,sourceRelationship:i??n?.sourceRelationship}),[d,i,n?.sourceRelationship]),P=c.operationFrontendConfig?.collectionDisplayConfig,F=P?.displayMode??o??vs.CARDS,I=P?.userSwitchableDisplayMode??!1,L=P?.quickFilterField,R=PG.withoutPresetsAssigningPinnedFields(P?.presetFilters,e.pinnedFilters),z=e.collectionToolbar!==zo.HIDDEN,B=P?.filterPanel,ee=P?.temporalGroupField,te=P?.enumGroupField,ne=P?.board,V=P?.calendar,re=P?.timeline,ie=P?.cardLayout,ae=P?.cardActionPlacement,oe=P?.selectable??!1,se=ie?.style===Nc.GRID,ce=ie?.style===Nc.GRID?ie.columns:void 0,{viewMode:le,setViewMode:ue}=tye(s,F),de=I?le:F,fe=(0,Q.useMemo)(()=>[vs.CARDS,vs.TABLE,...ne?[vs.BOARD]:[],...V?[vs.CALENDAR]:[],...re?[vs.TIMELINE]:[]],[ne,V,re]),pe=fe.includes(de)?de:vs.CARDS,me=u?.resourceFieldIdentifier,he=Nx(),ge=GV({idField:me}),[_e,ve]=(0,Q.useState)([]),ye=_e.length>0&&_e.every(e=>ge.isSelected(e)),be=aq(_e.length,_e.filter(e=>ge.isSelected(e)).length),{isSelected:xe,selectItem:Se,deselectItem:Ce,toggleSelection:we}=ge,Te=(0,Q.useCallback)(()=>{_e.length>0&&_e.every(e=>xe(e))?_e.forEach(e=>Ce(e)):_e.forEach(e=>Se(e))},[_e,xe,Se,Ce]),[Ee,De]=(0,Q.useState)(null),[Oe,ke]=(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}}),[Ae,je]=(0,Q.useState)(!1),[Me,Ne]=(0,Q.useState)([]),[Pe,Fe]=(0,Q.useState)({}),Ie=(0,Q.useMemo)(()=>[`resources.${s}`,`components.${K.RESOURCES_LAYOUTS_LIST}`],[s]),Le=(0,Q.useMemo)(()=>[{id:`initial-data`,isReady:Ae}],[Ae]),Re=(0,Q.useCallback)(()=>{ke(e=>({...e,page:1}))},[]),ze=(0,Q.useRef)(O),Be=(0,Q.useRef)(Me),Ve=(0,Q.useRef)(Pe);ze.current=O,Be.current=Me,Ve.current=Pe,(0,Q.useMemo)(()=>U.buildContextResourceIdentifiersKey(e.contextResourceIdentifiers),[e.contextResourceIdentifiers]);let He=(0,Q.useMemo)(()=>Object.entries(f).map(([e,t])=>`${e}:${t}`).sort().join(`|`),[f]),Ue=iS(UV(e.contextResourceIdentifiers,void 0)??void 0),We=(0,Q.useMemo)(()=>{if(!u)return{create:null,read:null,search:null};let t=p(J.CREATE,{requireLiteralIdentifier:!0}),n=t?.operationFrontendConfig;return{create:t&&n&&!cd(n)&&n.actionVisibility!==Ul.HIDDEN&&Wm({...t,resourceType:e.resourceType,resourcePrimaryScope:u.resourcePrimaryScope},Ue)?t:null,read:p(J.READ,{requireAddressable:!0})||null,search:p(J.SEARCH)||null}},[u,p,Ue,e.resourceType]),Ge=(0,Q.useCallback)(e=>{if(!u)return null;let t=t=>fh({resourceConfig:u,operations:u.operations??[],coreOperation:J.READ,registry:D,hasResourceId:kn.getResourceId(e[s]).length>0,requireFrontendAddressable:t,preferredVariantKey:c?.variantKey,contextResourceIdentifiers:e,contextualParameters:U.buildContextualParameters(e,D)})??null,n=t(!0);if(n)return n;let r=t(!1);return r&&r.operationFrontendConfig&&!cd(r.operationFrontendConfig)?r:null},[c,D,u,s]),Ke=(0,Q.useMemo)(()=>{let e=[{resourceType:s,operation:l}];return We.search&&e.push({resourceType:s,operation:String(We.search.operationIdentifier)}),e},[s,l,We.search]),qe=(0,Q.useMemo)(()=>u?.frontendConfiguration?.emptyState,[u]),{sortFields:Je,filterFields:Ye,searchEnabled:Xe,filtersEnabled:Ze}=(0,Q.useMemo)(()=>{let t=c,n=We.search,r=(t?.sortFields?.length?t.sortFields:n?.sortFields)??[],i=t?.filterFields&&Object.keys(t.filterFields).length>0?t.filterFields:n?.filterFields,a=PG.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:PG.withoutPinnedFilterFields(a,e.pinnedFilters),searchEnabled:o,filtersEnabled:s}},[We.search,c,D,u,f,e.parentResourcesRequirements,e.pinnedFilters]),Qe=C?.timezone,$e=(0,Q.useMemo)(()=>Eve(C?.locale),[C?.locale]),et=zl.calendarDateToday({timezone:Qe}),[tt,nt]=(0,Q.useState)(()=>uJ(et)),rt=(0,Q.useCallback)(e=>nt(uJ(e)),[]),it=V&&pe===vs.CALENDAR?Ye.find(e=>e.fieldName===V.dateField&&e.fieldType===AG.DATE):void 0,at=(0,Q.useMemo)(()=>V?MG(u?.mainSchema,u?.inheritenceSchemaDefinition).has(V.dateField):!1,[V,u]),ot=(0,Q.useMemo)(()=>Dve(tt,$e),[tt,$e]),st=!!re&&pe===vs.TIMELINE&&[re.startField,re.endField].every(e=>Ye.some(t=>t.fieldName===e&&t.fieldType===AG.DATE)),ct=(0,Q.useMemo)(()=>MG(u?.mainSchema,u?.inheritenceSchemaDefinition),[u]),lt=(0,Q.useMemo)(()=>Lve(tt),[tt]),ut=(0,Q.useMemo)(()=>{if(V&&it)return{[V.dateField]:Ave(Ove(ot),at,Qe)};if(re&&st)return zve({startField:re.startField,endField:re.endField,startIsCalendarDate:ct.has(re.startField),endIsCalendarDate:ct.has(re.endField),timeZone:Qe,firstDay:lt[0],lastDay:lt[lt.length-1]})},[V,it,ot,at,Qe,re,st,ct,lt]),dt=(0,Q.useRef)(ut);dt.current=ut;let ft=(0,Q.useMemo)(()=>JSON.stringify(ut??{}),[ut]);(0,Q.useEffect)(()=>{ke(e=>e.page===1?e:{...e,page:1})},[ft]);let{quickFilterDef:pt,panelFilterFields:mt}=(0,Q.useMemo)(()=>{if(!L)return{quickFilterDef:void 0,panelFilterFields:Ye};let e=Ye.find(e=>e.fieldName===L&&e.fieldType===AG.ENUM&&(e.enumValues?.length??0)>0);return e?{quickFilterDef:e,panelFilterFields:Ye.filter(t=>t!==e)}:{quickFilterDef:void 0,panelFilterFields:Ye}},[Ye,L]),ht=(0,Q.useMemo)(()=>PG.detectSummaryFields(u),[u]),H=(0,Q.useMemo)(()=>yp({tComponent:y,componentType:K.RESOURCES_LAYOUTS_LIST,key:`errorLoading`}),[y]),gt=(0,Q.useMemo)(()=>v(s,J.CREATE,`title`),[v,s]),_t=(0,Q.useMemo)(()=>yp({tComponent:y,componentType:K.RESOURCES_LAYOUTS_LIST,key:`noSearchResults`}),[y]),vt=(0,Q.useMemo)(()=>yp({tComponent:y,componentType:K.RESOURCES_LAYOUTS_LIST,key:`listLabel`}),[y]),yt=(0,Q.useMemo)(()=>{let e={};for(let t of ht)e[t]=g(s,t,`label`);return e},[ht,s,g]),bt=(0,Q.useMemo)(()=>kn.extractDataMode(k,r,Co.SUMMARY),[k,r]),xt=(0,Q.useMemo)(()=>no.createOperationPathKeyFromOperation(c),[c]),St=(0,Q.useMemo)(()=>PG.searchOperationAcceptsATerm(We.search)&&qG({listOperation:c,searchOperation:We.search??void 0,contextualParameters:f,parentResourcesRequirements:e.parentResourcesRequirements,pinnedFilters:e.pinnedFilters,resourceType:s,resourceFieldIdentifier:String(u?.resourceFieldIdentifier??``),registry:D}),[We.search,f,c,D,u,e.parentResourcesRequirements,e.pinnedFilters,s]),Ct=(0,Q.useMemo)(()=>!We.search||!St?null:no.createOperationPathKeyFromOperation(We.search),[We.search,St]),wt=aK({enabled:Xe&&!!We.search&&St,onDebouncedChange:Re}),Tt=wt.debouncedQuery;(0,Q.useEffect)(()=>{ge.clearSelection()},[Pe,Tt]);let Et=(0,Q.useRef)(e);Et.current=e;let Dt=Me.map(e=>`${e.field}:${e.direction}`).join(`,`),Ot=(0,Q.useMemo)(()=>JSON.stringify(Pe),[Pe]),kt=e.pinnedFilters,At=(0,Q.useMemo)(()=>JSON.stringify(kt??{}),[kt]),{emit:jt,resourceCollectionRefreshEvent:Mt}=Uo(),{lastRefreshAt:Nt}=Mt({ctx:(0,Q.useMemo)(()=>({...e,contextResourceIdentifiers:U.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)(()=>{jt(hc.RESOURCE_COLLECTION_FILTERS_CHANGED,{resourceType:s,filterValues:Ve.current})},[Ot,s,jt]);let Pt=Tt.length>0&&!!Ct,Ft=`${s}|${Pt?Ct:xt}|${He}|${Oe.limit}|${Dt}|${Ot}|${At}|${ft}|${Tt}|${Nt??0}`,Lt=`${Ft}|page:${Oe.page}`,Rt=(0,Q.useCallback)(async(e,t,n)=>{let r=PG.withPinnedFilters(e,Et.current.pinnedFilters);if(Pt&&Ct){qY(`Calling doOperation (SEARCH via inline search)`,{searchOperationPathKey:Ct,query:Tt});let e={contextualParameters:f,searchQuery:Tt,filters:Object.keys(r).length>0?r:void 0,pagination:{page:t,limit:n},sort:Be.current.length?[...Be.current]:void 0,parentResourcesRequirements:Et.current.parentResourcesRequirements,dataMode:bt};return ze.current(Ct,e)}qY(`Calling doOperation (LIST)`,{operationPathKey:xt});let i={page:t,limit:n};return Be.current.length&&(i.sort=Be.current.map(e=>`${e.field}:${e.direction}`).join(`,`)),Object.entries(r).forEach(([e,t])=>{t!=null&&t!==``&&(i[e]=t)}),ze.current(xt,{contextualParameters:f,queryParameters:i,parentResourcesRequirements:Et.current.parentResourcesRequirements,dataMode:bt})},[Pt,Ct,Tt,f,bt,xt]),zt=(0,Q.useRef)(Rt);zt.current=Rt;let Bt=Pt?We.search?.maxPaginatedResultPerPageLimit??50:c?.maxPaginatedResultPerPageLimit??100,[Vt,Ht]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{qY(`useEffect triggered`,{fetchKey:Lt,resourceType:s});let e=!1;return(async()=>{qY(`fetchData started`,{fetchKey:Lt,operationPathKey:xt,contextualParameters:f}),De(null);try{let t=Mve(Ve.current,dt.current);if(dt.current){let n=await Hve({requestPage:(e,n)=>zt.current(t,e,n),pageLimit:Bt});if(e)return;ve(n.items),Ht(n.notShown),je(!0);return}let n=await zt.current(t,Oe.page,Oe.limit);if(qY(`doOperation completed`,{resultType:Array.isArray(n)?`array`:typeof n,resultLength:Array.isArray(n)?n.length:void 0}),e)return;if(Ht(0),n&&typeof n==`object`&&`data`in n&&`pagination`in n){let e=n;ve(e.data),ke(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)&&(ve(n),ke(e=>e.total===n.length&&e.totalPages===1?e:{...e,total:n.length,totalPages:1}));je(!0)}catch(t){if(e){qY(`Fetch cancelled after error`,{fetchKey:Lt});return}let n=j(t);De({message:T(t)}),KY.error(`Fetch error`,{...n,error:t,fetchKey:Lt})}finally{qY(`fetchData finally block`,{cancelled:e,fetchKey:Lt})}})(),()=>{qY(`useEffect cleanup`,{cancelled:e,fetchKey:Lt}),e=!0}},[Lt]);let Ut=(0,Q.useCallback)(e=>{Ne(e),ke(e=>({...e,page:1}))},[]),Wt=(0,Q.useCallback)(e=>{Fe(e),ke(e=>({...e,page:1}))},[]),Gt=(0,Q.useCallback)(e=>{L&&(Fe(t=>{let n={...t};return e===void 0?delete n[L]:n[L]=e,n}),ke(e=>({...e,page:1})))},[L]),Kt=(0,Q.useMemo)(()=>{if(!te||pe!==vs.CARDS)return null;let e=Ye.find(e=>e.fieldName===te),t=e?.enumValues??[];if(t.length===0)return null;let n=new Map(t.map(e=>[e,[]])),r=[];for(let e of _e){let t=e[te],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,te,r,e?.schema),items:t})}return r.length>0&&i.push({key:`__wildo-ungrouped__`,label:null,items:r}),i},[_e,te,pe,Ye,_,s]),qt=(0,Q.useMemo)(()=>Kt||!ee||pe!==vs.CARDS?null:Zve(_e,ee,u?.mainSchema,b,u?.inheritenceSchemaDefinition),[_e,ee,pe,b,Kt,u]),Jt=Kt??qt,Yt=ne&&pe===vs.BOARD?Ye.find(e=>e.fieldName===ne.groupByField):void 0,Xt=(0,Q.useMemo)(()=>Yt?.fieldType===AG.ENUM?Yt.enumValues??[]:[],[Yt]),Zt=(0,Q.useCallback)(e=>U.getResourceObjectId(e,String(u?.resourceFieldIdentifier??``))??``,[u?.resourceFieldIdentifier]),Qt=Gve({enabled:Xt.length>0,vocabulary:Xt,groupByField:ne?.groupByField??``,readerFilters:Pe,reloadKey:Ft,pageSize:Oe.limit,requestPage:Rt,getItemId:Zt}),$t=(0,Q.useMemo)(()=>!ne||!Yt?null:gve({vocabulary:Xt,labelOf:e=>_(s,ne.groupByField,e,Yt.schema),pages:Qt.pages,collectionTotal:Ae?Oe.total:void 0}),[ne,Yt,Xt,Qt.pages,Ae,Oe.total,_,s]),en=(0,Q.useMemo)(()=>{if(!ne||!u)return;let t=_ve(u.operations??[],ne.transitionOperation).filter(e=>Wm({...e,resourceType:s,resourcePrimaryScope:u.resourcePrimaryScope},Ue));if(t.length!==0)return{operations:t,resourceType:s,subjectDataMode:bt,organizationId:UV(e.contextResourceIdentifiers,void 0)??void 0}},[ne,u,s,Ue,bt,e.contextResourceIdentifiers]),tn=(0,Q.useCallback)(async(t,n,r)=>{if(!ne)return;let i=Zt(t);if(!i)return;let a=kn.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,i);await bve({groupByField:ne.groupByField,targetValue:n,call:t=>O(no.createOperationPathKeyFromOperation(r),{contextualParameters:U.buildContextualParameters(a,D),requestData:t,parentResourcesRequirements:e.parentResourcesRequirements}),applyMove:e=>{let r=t[ne.groupByField];typeof r==`string`&&Qt.applyMove(i,r,n,e)},reportRefusal:e=>dh.error(T(e))})},[ne,Qt.applyMove,Zt,e.contextResourceIdentifiers,e.parentResourcesRequirements,s,O,D,T]),nn=(0,Q.useMemo)(()=>!V||!it?new Map:kve({items:_e,dateField:V.dateField,calendarField:at,timeZone:Qe}),[V,it,_e,at,Qe]),rn=(0,Q.useMemo)(()=>!re||!st?[]:Rve({items:_e,startField:re.startField,endField:re.endField,startIsCalendarDate:ct.has(re.startField),endIsCalendarDate:ct.has(re.endField),timeZone:Qe,days:lt}),[re,st,_e,ct,Qe,lt]),an=C?.locale,on=(0,Q.useMemo)(()=>{let e=new Intl.DateTimeFormat(an||void 0,{weekday:`short`,timeZone:`UTC`});return(ot[0]??[]).map(({day:t})=>e.format(t))},[an,ot]),sn=(0,Q.useMemo)(()=>new Intl.DateTimeFormat(an||void 0,{day:`numeric`,timeZone:`UTC`}),[an]),cn=(0,Q.useCallback)(e=>{let t=U.computeFrontendResourceLabel({resourceType:s,registry:D,currentObject:e,t:w,formatDate:b,formatDateTime:x});return String(t||Zt(e))},[s,D,w,b,x,Zt]),ln=(0,Q.useCallback)(()=>{u?We.create?m({operation:We.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,We.create,m,e.contextResourceIdentifiers,e.parentResourcesRequirements,N]),un=(0,Q.useCallback)(t=>{if(!u)return!1;let n=U.getResourceObjectId(t,u.resourceFieldIdentifier);return n?Ge(kn.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,n))!==null:!1},[u,e.contextResourceIdentifiers,s,Ge]),dn=(0,Q.useCallback)(t=>{if(!u)return;let n=U.getResourceObjectId(t,u.resourceFieldIdentifier);if(!n){KY.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=kn.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,n),i=Ge(r);i&&m({operation:i,contextResourceIdentifiers:r,parentResourcesRequirements:e.parentResourcesRequirements,initiatorOverride:N})},[u,m,u?.resourceFieldIdentifier,e.contextResourceIdentifiers,e.parentResourcesRequirements,s,N,Ge]),fn=(0,Q.useCallback)((n,r)=>{let i=u?.resourceFieldIdentifier;if(!i)return null;let a=U.getResourceObjectId(n,i),o=a?kn.buildRecordIdentifiersFromCollection(e.contextResourceIdentifiers,s,a):e.contextResourceIdentifiers,c=Ge(o),l=kn.createFrontendResourceOperationContextFromOperation({resourceType:s,operation:c??e.operation,contextResourceIdentifiers:o});return(0,$.jsx)(aY,{resourceContext:l,navigationZone:t,navigationInitiator:N,currentObject:n,currentObjectDataMode:bt,displayMode:dr.SUMMARY,size:df.ICON_SM,orientation:r,hostRowOpensRead:!0})},[u,s,e.contextResourceIdentifiers,e.operation,Ge,t,N,bt]),pn=(e,n)=>{let r=u?.resourceFieldIdentifier;if(!r)throw U.buildConfigurationError(Lu.FRONTEND_RESOURCE_FIELD_IDENTIFIER_NOT_FOUND,{resourceType:s,component:`ResourceLayoutPreset_List`});let i=U.getResourceObjectId(e,r);return he.isElementActive(i)?(0,$.jsx)(`li`,{className:G(`list-none`,se&&`border border-border rounded-lg overflow-hidden`),children:(0,$.jsx)(kG,{navigationZone:t})},i||n):(0,$.jsx)(`li`,{className:G(`list-none`,se&&`border border-border rounded-lg overflow-hidden`),children:mn(e,n)},i||n)},mn=(t,n)=>(0,$.jsx)(OG,{item:t,resourceType:s,resourceConfig:u,registry:D,collectionContextResourceIdentifiers:e.contextResourceIdentifiers,summaryFields:ht,fieldLabelsMap:yt,tResourceFieldEnumValue:_,onItemClick:un(t)?dn:void 0,cardActionPlacement:ae,selectable:oe,isSelected:ge.isSelected(t),selectionActive:ge.selectionCount>0,onToggleSelect:ge.toggleSelection,selectAriaLabel:y(K.RESOURCES_LAYOUTS_LIST,`selectRow`,{row:n+1}),operationsSlot:fn(t,ae?.orientation),interactiveClasses:{hover:`hover:bg-muted/50`,transition:M.motion.transition}}),hn=E(W.PLUS,{size:tr.SM}),gn=We.create?(0,$.jsxs)(Y,{onClick:ln,size:df.SM,"data-slot":`collection-create`,className:`inline-flex items-center gap-element`,children:[hn,(0,$.jsx)(`span`,{children:gt})]}):void 0,_n=nK({isSearchActive:Pt,filterValues:Pe}),vn=z&&!!We.create,yn=ZG(qe,vn),bn=rK({hasLoadedOnce:Ae,itemCount:_e.length,isNarrowed:_n,emptyStateOffersCreate:yn})?gn:void 0,xn=(0,Q.useMemo)(()=>(u?.operations??[]).some(e=>Ga(e)),[u]),Sn=(0,Q.useMemo)(()=>{let e={page:Oe.page,limit:Oe.limit};Me.length&&(e.sort=Me.map(e=>`${e.field}:${e.direction}`).join(`,`));for(let[t,n]of Object.entries(PG.withPinnedFilters(Pe,kt)))n!=null&&n!==``&&(e[t]=n);Pt&&(e.q=Tt);let t={list:PG.variantKeyOf(c),...We.search?{search:PG.variantKeyOf(We.search)}:{}};return{params:e,isSearchActive:!!Tt,listingVariantKeys:t}},[Oe.page,Oe.limit,Me,Pe,kt,Tt,Pt,c,We.search]),Cn=PG.matchListingOf(PG.listingOperationShown({inlineSearchTerm:Tt,listOperation:c,searchOperation:We.search})),wn=xn?(0,$.jsx)(Yve,{resourceContext:e,navigationZone:t,navigationInitiator:N,collectionExportQuery:Sn}):void 0;return S?Ee?(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(eV,{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:H}),(0,$.jsx)(`p`,{className:`text-sm text-destructive/80 mt-item-xs`,children:Ee.message})]})]}):(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(eV,{resourceContext:e,navigationZone:t,navigationInitiator:N}),z&&(0,$.jsx)(N_e,{resourceType:s,quickFilter:pt?{field:pt,value:Pe[pt.fieldName],onChange:Gt}:void 0,presetFilters:R,search:wt.isVisible?{query:wt.query,onChange:wt.handleChange,onClear:wt.handleClear}:void 0,filterFields:Ze?mt:[],filterPanel:B,filterValues:Pe,onFiltersChange:Wt,sort:pe===vs.CARDS&&Je.length>0?{sortFields:Je,sortStates:Me,onSortChange:Ut}:void 0,viewMode:I?{viewMode:pe,onViewModeChange:ue,availableModes:fe}:void 0,primaryAction:bn,collectionActions:wn,...oe&&pe!==vs.TABLE&&_e.length>0?{selectAll:{state:be,onToggle:Te}}:{},selection:oe?{count:ge.selectionCount,onClear:ge.clearSelection,...ye&&!ge.matchAllSelection&&Oe.total>_e.length&&Cn?{matchAllOffer:{matchedCount:Oe.total,onSelectAllMatching:()=>ge.selectAllMatching({filters:PG.withPinnedFilters(Pe,kt),...Tt?{search:Tt}:{},listing:Cn,matchedCount:Oe.total})}}:{},...ge.matchAllSelection?{isMatchAllSelected:!0}:{}}:void 0,bulkActions:oe?(0,$.jsx)(xJ,{resourceContext:e,navigationZone:t,navigationInitiator:N,selectedItems:ge.selectedItems,selectedItemsDataMode:bt,matchAllSelection:ge.matchAllSelection,explicitIdSelection:ge.explicitIdSelection,onSelectIds:ge.selectIds,idField:me,onSelectionClear:ge.clearSelection,onSelectionReplace:ge.selectAll}):void 0}),(0,$.jsx)(Zy,{i18nKeys:Ie,loadingScopes:Ke,readiness:Le,renderLoading:()=>(0,$.jsx)(pm,{template:pe===vs.TABLE?`table`:se?`card`:`list`,density:`auto`,count:Oe.limit,"aria-hidden":`true`}),children:(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(UY,{resourceContext:e,navigationZone:t,showCharts:a}),he.isCreateActive&&(0,$.jsx)(kG,{navigationZone:t,className:`border border-border rounded-lg`}),ut&&Vt>0&&(0,$.jsx)(OD,{variant:`warning`,"data-slot":`collection-window-not-shown`,children:(0,$.jsx)(AD,{children:y(K.RESOURCES_LAYOUTS_LIST,`displayWindowRowsNotShown`,{count:Vt})})}),V&&it?(0,$.jsx)(Ive,{weeks:ot,itemsByDay:nn,month:tt,today:et,firstDayOfWeek:$e,onMonthChange:rt,monthHeading:b(fJ(tt),{yearMonth:!0}),weekdayLabels:on,dayNumberLabel:e=>sn.format(e),dayLabel:(e,t)=>y(K.RESOURCES_LAYOUTS_LIST,`calendarDayItemCount`,{date:b(e,{calendarDate:!0}),count:t}),getItemId:Zt,getItemLabel:cn,canOpenItem:un,onOpenItem:dn,calendarLabel:vt,previousMonthLabel:y(K.RESOURCES_LAYOUTS_LIST,`displayPreviousMonth`),nextMonthLabel:y(K.RESOURCES_LAYOUTS_LIST,`displayNextMonth`),todayLabel:y(K.RESOURCES_LAYOUTS_LIST,`displayToday`),keyboardHint:y(K.RESOURCES_LAYOUTS_LIST,`calendarKeyboardHint`)}):re&&st?(0,$.jsx)(Vve,{days:lt,placements:rn,month:tt,today:et,onMonthChange:rt,monthHeading:b(fJ(tt),{yearMonth:!0}),dayNumberLabel:e=>sn.format(e),getItemId:Zt,getItemLabel:cn,barLabel:(e,t,n)=>y(K.RESOURCES_LAYOUTS_LIST,`timelineItemSpan`,{label:cn(e),from:b(t,{calendarDate:!0}),to:b(n,{calendarDate:!0})}),canOpenItem:un,onOpenItem:dn,timelineLabel:vt,previousMonthLabel:y(K.RESOURCES_LAYOUTS_LIST,`displayPreviousMonth`),nextMonthLabel:y(K.RESOURCES_LAYOUTS_LIST,`displayNextMonth`),todayLabel:y(K.RESOURCES_LAYOUTS_LIST,`displayToday`),emptyMonthLabel:y(K.RESOURCES_LAYOUTS_LIST,`timelineEmptyMonth`)}):_e.length===0?_n?(0,$.jsx)(`div`,{className:`text-center py-section text-muted-foreground text-sm`,role:`status`,children:_t}):(0,$.jsx)(eK,{resourceType:s,config:qe,hasCreateOperation:vn,onCreateAction:ln,variant:z?`default`:`compact`,title:e.emptyStateWords?.title,description:e.emptyStateWords?.description}):pe===vs.TABLE?(0,$.jsx)(mve,{items:_e,resourceType:s,resourceConfig:u,navigationZone:t,summaryFields:ht,contextResourceIdentifiers:e.contextResourceIdentifiers,fieldLabelsMap:yt,sortFields:Je,sortStates:Me,onSortChange:Ut,selectable:oe,isRowSelected:xe,onToggleRow:we,allSelected:ye,onToggleAll:Te,renderRowActions:fn,onRowClick:dn,canOpenRow:un}):$t?(0,$.jsx)(Tve,{columns:$t,onLoadMore:e=>{Qt.loadMore(e)},loadMoreLabel:e=>y(K.RESOURCES_LAYOUTS_LIST,`boardLoadMore`,{count:e}),columnLoadFailedLabel:y(K.RESOURCES_LAYOUTS_LIST,`boardColumnLoadFailed`),ungroupedNote:e=>y(K.RESOURCES_LAYOUTS_LIST,`boardUngroupedNote`,{count:e}),renderCard:mn,getItemId:Zt,transition:en,onMoveItem:tn,boardLabel:vt,ungroupedLabel:y(K.RESOURCES_LAYOUTS_LIST,`boardUngrouped`),columnCountLabel:e=>y(K.RESOURCES_LAYOUTS_LIST,`boardColumnCount`,{count:e}),moveHint:y(K.RESOURCES_LAYOUTS_LIST,`boardMoveHint`)}):Jt?(0,$.jsx)(`div`,{className:`space-y-card`,"data-slot":`collection-groups`,children:Jt.map((e,t)=>{let n=Jt.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??vt,className:bG(ce),style:xG(ce),children:e.items.map((e,t)=>pn(e,n+t))})]},`${e.key}:${t}`)})}):(0,$.jsx)(`ul`,{role:`list`,"aria-label":vt,className:bG(ce),style:xG(ce),children:_e.map(pn)}),!$t&&!ut&&(0,$.jsx)(XG,{pagination:Oe,onPaginationChange:ke})]})})]}):null};function YY({preset:e,...t}){let n=HW(t.resourceContext.operation),r=e??UW(t.resourceContext.operation)??lr.DEFAULT,i=n?(0,$.jsx)(n,{...t}):Q.createElement(qc(K.RESOURCES_LAYOUTS_LIST,`ResourceLayout_List`)(r),t);return(0,$.jsx)(Mx,{resourceType:t.resourceContext.resourceType,children:(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,[lA]:!0,children:i})})}var XY=tl.getLogger(),Pye=XY.debugByType(`PublicLayout_MainContainer`);XY.setDebugTypeLogging(`PublicLayout_MainContainer`,!1);function ZY({preset:e=H.DEFAULT,...t}){let n=qc(K.PUBLIC_LAYOUTS_MAIN_CONTAINER,`PublicLayout_MainContainer`)(e);return Pye(`Render preset=${e} card=${t.useCardLayout?`yes`:`no`} component=${n.displayName??n.name??`anonymous`}`),(0,$.jsx)(n,{...t})}var QY;(function(e){e.DEFAULT=`default`,e.MUTED=`muted`,e.CONTRAST=`contrast`,e.DESTRUCTIVE=`destructive`,e.SUCCESS=`success`,e.INHERIT=`inherit`})(QY||={});var $Y;(function(e){e.HOVER=`hover`,e.ALWAYS=`always`,e.NONE=`none`})($Y||={});var eX;(function(e){e.NORMAL=`normal`,e.MEDIUM=`medium`,e.SEMIBOLD=`semibold`})(eX||={});function tX({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_LINK,`Link`)(e);return(0,$.jsx)(n,{...t})}var nX=({href:e,onClick:t,children:n})=>(0,$.jsx)(Z,{children:(0,$.jsx)(tX,{href:e,onClick:t,children:n})}),rX=({code:e,errorParam:t,errorDescription:n})=>{let{handleAuthCodeExchange:r,auth:i}=hm(),{tComponent:a,isReady:o}=q({component:K.PUBLIC_LAYOUTS_AUTH_CALLBACK}),s=cp(),c=rg(),l=e=>a(K.PUBLIC_LAYOUTS_AUTH_CALLBACK,e),u=(0,Q.useMemo)(()=>B(c.search),[c.search]),d=(0,Q.useMemo)(()=>vi(za.login,u),[u]),f=(0,Q.useMemo)(()=>Xt(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(Ll.ERROR_GENERIC))):e?i.accessToken||i.onboardingSessionId?h.current=!0:(h.current=!0,r(e).catch(e=>{m(s(e,l(Ll.ERROR_EXCHANGE_FAILED)))})):(h.current=!0,m(l(Ll.ERROR_NO_CODE))))},[e,t,n,i.accessToken,i.onboardingSessionId,r]);let g=Rp(i,u);return g?(0,$.jsx)(Rh,{to:g,replace:!0}):i.accessToken&&!i.isLoading?(0,$.jsx)(Rh,{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)(sY,{children:l(Ll.ERROR_TITLE)})]}),(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:p})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(nX,{href:d,children:l(Ll.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)(Jy,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:l(Ll.VERIFYING)})]}):null};function iX({preset:e=H.DEFAULT,...t}){let n=qc(K.PUBLIC_LAYOUTS_AUTH_CALLBACK,`Auth_AuthCallback`)(e);return(0,$.jsx)(n,{...t})}var Fye=()=>{let[e]=sh(),t=e.get(`code`),n=e.get(`error`),r=e.get(`error_description`);return(0,$.jsx)(ZY,{useCardLayout:!0,children:(0,$.jsx)(iX,{code:t,errorParam:n,errorDescription:r})})},aX;(function(e){e.REPORTED=`reported`,e.NOTHING_TO_REPORT=`nothing_to_report`})(aX||={});var Iye=()=>{let[e]=sh(),{tComponent:t,isReady:n}=q({component:K.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(aX.NOTHING_TO_REPORT):(aH(t?{code:t}:{error:n??void 0}),i(aX.REPORTED),window.close())},[e]),!n||r===null?null:(0,$.jsx)(ZY,{useCardLayout:!0,children:(0,$.jsx)(Z,{className:`text-sm`,children:t(K.PUBLIC_LAYOUTS_AUTH_CALLBACK,r===aX.REPORTED?Ll.REAUTH_RETURNING:Ll.REAUTH_NO_RESULT)})})};function oX({mfaRequired:e,mfaSessionId:t,usableSecondFactorMethods:n,email:r,authRedirectTarget:i}){let a=ah();(0,Q.useEffect)(()=>{e&&t&&(n.length===0?a(vi(za.enrollmentRequired,i),{replace:!0}):a(vi(`${za.mfaChallenge}?sessionId=${t}&email=${encodeURIComponent(r||``)}`,i),{replace:!0}))},[e,t,n,a,r,i])}var sX=({token:e,email:t,redirect:n})=>{let r=hte(n)?n:void 0,{handleMagicLinkVerify:i,auth:a}=hm(),{tComponent:o,isReady:s}=q({component:K.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY}),c=cp(),l=e=>o(K.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY,e),u=za.login,[d,f]=(0,Q.useState)(null),p=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{p.current||(!e||!t?(p.current=!0,f(l(Vs.ERROR_INVALID_LINK))):a.accessToken?p.current=!0:(p.current=!0,i(e,t).then(e=>{!e.success&&!e.requiresMFA&&f(c(null,l(Vs.ERROR_VERIFICATION_FAILED)))}).catch(e=>{f(c(e,l(Vs.ERROR_EXPIRED)))})))},[e,t,a.accessToken,i]),oX({mfaRequired:a.mfaRequired,mfaSessionId:a.mfaSessionId,usableSecondFactorMethods:a.usableSecondFactorMethods,email:t??void 0,authRedirectTarget:r});let m=Rp(a,r);return m?(0,$.jsx)(Rh,{to:m,replace:!0}):a.accessToken&&!a.isLoading?(0,$.jsx)(Rh,{to:r??za.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)(sY,{children:l(Vs.ERROR_TITLE)})]}),(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:d})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(nX,{href:u,children:l(Vs.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)(Jy,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:l(Vs.VERIFYING)})]}):null};function cX({preset:e=H.DEFAULT,...t}){let n=qc(K.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY,`Auth_MagicLinkVerify`)(e);return(0,$.jsx)(n,{...t})}var Lye=()=>{let[e]=sh(),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)(ZY,{useCardLayout:!0,children:(0,$.jsx)(cX,{token:t,email:n,redirect:r})})},Rye=()=>{let{auth:e}=ng(),{tComponent:t,isReady:n}=q({component:K.PUBLIC_LAYOUTS_USER_AUTH});return n?(0,$.jsxs)(Zk,{children:[(0,$.jsx)(JL,{name:`email`}),(0,$.jsx)(JL,{name:`password`}),e.error&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:e.error})}),(0,$.jsx)(eO,{label:(e=>t(K.PUBLIC_LAYOUTS_USER_AUTH,e))(Hr.SUBMIT),submittingLabel:`…`,fullWidth:!0})]}):null},zye=({email:e,onSuccess:t,onError:n,isLoading:r,t:i})=>{let{authenticateWithPassword:a}=ng(),o=cp(),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)(eE,{schema:Hre,defaultValues:c,onSubmit:s,validationMode:Jc.ON_BLUR,disabled:r,labels:{fields:{email:i(Hr.EMAIL_ADDRESS),password:i(Hr.PASSWORD)}},layoutTemplate:Rye},`password-auth`)},lX={[mt.PASSWORD]:W.KEY,[mt.PASSKEY]:W.FINGERPRINT,[mt.MAGIC_LINK]:W.MAIL,[mt.EMAIL_OTP]:W.MAIL,[mt.SMS_OTP]:W.MESSAGE_CIRCLE,[mt.TOTP]:W.SMARTPHONE,[mt.ORG_SAML]:W.ORGANIZATION,[mt.ORG_OPENID_CONNECT]:W.ORGANIZATION,[mt.EXTERNAL_OAUTH2]:W.LINK},Bye={[mt.PASSWORD]:Hr.METHOD_PASSWORD,[mt.MAGIC_LINK]:Hr.METHOD_MAGIC_LINK,[mt.PASSKEY]:Hr.METHOD_PASSKEY,[mt.SMS_OTP]:Hr.METHOD_SMS_OTP,[mt.ORG_SAML]:Hr.METHOD_ORG_SSO,[mt.ORG_OPENID_CONNECT]:Hr.METHOD_ORG_SSO,[mt.EXTERNAL_OAUTH2]:Hr.METHOD_EXTERNAL_OAUTH2};function Vye(e,t,n){if(e===mt.ORG_SAML||e===mt.ORG_OPENID_CONNECT)return t.offeredMethod?.config?.displayName?.trim()||void 0;if(e!==mt.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=Vye(e,t,t.resolveSocialProviderLabel);if(n&&t.continueWithTemplate.includes(`{provider}`))return t.continueWithTemplate.replace(`{provider}`,n);let r=Bye[e];return r?t.translateLabel(r):e}var dX=({method:e})=>{let{renderIcon:t}=ef();return t(lX[e],{size:tr.SM})},Hye=({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 vc().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)(sY,{children:n(Hr.MAGIC_LINK_SENT_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:n(Hr.MAGIC_LINK_SENT_DESCRIPTION)}),(0,$.jsx)(Z,{children:(0,$.jsx)(tX,{href:`#`,onClick:e=>{e.preventDefault(),a(!1)},children:n(Hr.MAGIC_LINK_TRY_ANOTHER_METHOD)})})]}):(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsxs)(Y,{variant:X.OUTLINE,className:`w-full`,labelOverflow:_f.WRAP,onClick:c,disabled:o||t,children:[(0,$.jsx)(dX,{method:mt.MAGIC_LINK}),o?`…`:n(Hr.MAGIC_LINK_SEND)]})})};function fX({fieldName:e,submitLabel:t,submittingLabel:n,fieldProps:r}){let{formState:i}=LC();return(0,$.jsxs)(Zk,{children:[(0,$.jsx)(JL,{name:e,...r}),i.errors.root&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:i.errors.root.message})}),(0,$.jsx)(eO,{label:t,submittingLabel:n,fullWidth:!0})]})}var pX=5e3,Uye=({sessionId:e,onSuccess:t,isLoading:n,t:r})=>{let{handleMfaVerify:i}=hm(),a=cp(),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 vc().smsOTPDelivery(e);if(t)return;if(n){g(!0);return}}catch{}!t&&Date.now()-n<12e4&&(r=setTimeout(()=>{i()},pX))}};return r=setTimeout(()=>{i()},pX),()=>{t=!0,r!==void 0&&clearTimeout(r)}},[p,e]);let _=(0,Q.useMemo)(()=>()=>(0,$.jsx)(fX,{fieldName:`code`,submitLabel:r(ws.VERIFY_BUTTON),submittingLabel:r(ws.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 vc().smsOTPSend(e),g(!1),c(!0),m(e=>e+1)}catch(e){let t=a(e,r(ws.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,mt.SMS_OTP,n.code.trim());o.success?t(o):b(a(null,r(ws.ERROR_INVALID_CODE)))}catch(e){b(a(e,r(ws.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(ws.SMS_OTP_SENT)}),h&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:r(ws.SMS_OTP_UNDELIVERED)})}),(0,$.jsx)(eE,{schema:Ic,defaultValues:{code:``},onSubmit:S,validationMode:Jc.ON_BLUR,disabled:n||l,onFormReady:v,labels:{fields:{code:r(ws.SMS_OTP_CODE_LABEL)}},layoutTemplate:_},`sms-otp-challenge`),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(Y,{variant:X.GHOST,size:df.SM,onClick:x,disabled:l,children:r(ws.RESEND_CODE)})})]}):(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:r(ws.SMS_OTP_DESCRIPTION)}),(0,$.jsxs)(Y,{className:`w-full`,labelOverflow:_f.WRAP,onClick:x,disabled:l||n,children:[(0,$.jsx)(dX,{method:mt.SMS_OTP}),r(l?ws.SMS_OTP_SENDING:ws.SMS_OTP_SEND)]}),d&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:d})})]})},Wye=({sessionId:e,onSuccess:t,isLoading:n,t:r})=>{let{handleMfaVerify:i}=hm(),a=cp(),o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),p=(0,Q.useMemo)(()=>()=>(0,$.jsx)(fX,{fieldName:`code`,submitLabel:r(ws.VERIFY_BUTTON),submittingLabel:r(ws.VERIFYING),fieldProps:{autoFocus:!0}}),[r]),m=(0,Q.useCallback)(e=>{o.current=e},[]),h=(0,Q.useCallback)(()=>{o.current?.clearErrors(`root`)},[]),g=(0,Q.useCallback)(e=>{o.current?.setError(`root`,{type:`server`,message:e})},[]),_=(0,Q.useCallback)(async()=>{u(!0),f(null),h();try{await vc().mfaEmailOTPSend(e),c(!0)}catch(e){let t=a(e,r(ws.ERROR_GENERIC));s?g(t):f(t)}finally{u(!1)}},[e,s,h,g,r,a]),v=(0,Q.useCallback)(async n=>{h();try{let o=await i(e,mt.EMAIL_OTP,n.code.trim());o.success?t(o):g(a(null,r(ws.ERROR_INVALID_CODE)))}catch(e){g(a(e,r(ws.ERROR_INVALID_CODE)))}},[e,i,t,r,h,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(ws.EMAIL_OTP_SENT)}),(0,$.jsx)(eE,{schema:sre,defaultValues:{code:``},onSubmit:v,validationMode:Jc.ON_BLUR,disabled:n||l,onFormReady:m,labels:{fields:{code:r(ws.EMAIL_OTP_CODE_LABEL)}},layoutTemplate:p},`email-otp-challenge`),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(Y,{variant:X.GHOST,size:df.SM,onClick:_,disabled:l,children:r(ws.RESEND_CODE)})})]}):(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:r(ws.EMAIL_OTP_DESCRIPTION)}),(0,$.jsxs)(Y,{className:`w-full`,labelOverflow:_f.WRAP,onClick:_,disabled:l||n,children:[(0,$.jsx)(dX,{method:mt.EMAIL_OTP}),r(l?ws.EMAIL_OTP_SENDING:ws.EMAIL_OTP_SEND)]}),d&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:d})})]})},Gye=({sessionId:e,onSuccess:t,isLoading:n,t:r})=>{let{handleMfaVerify:i}=hm(),a=cp(),o=(0,Q.useRef)(null),s=(0,Q.useMemo)(()=>()=>(0,$.jsx)(fX,{fieldName:`code`,submitLabel:r(ws.VERIFY_BUTTON),submittingLabel:r(ws.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,mt.TOTP,n.code.trim());o.success?t(o):u(a(null,r(ws.ERROR_INVALID_CODE)))}catch(e){u(a(e,r(ws.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(ws.TOTP_DESCRIPTION)}),(0,$.jsx)(eE,{schema:Iie,defaultValues:{code:``},onSubmit:d,validationMode:Jc.ON_BLUR,disabled:n,onFormReady:c,labels:{fields:{code:r(ws.TOTP_CODE_LABEL)}},layoutTemplate:s},`totp-challenge`)]})},Kye=({sessionId:e,onSuccess:t,onError:n,isLoading:r,t:i,factorLevel:a})=>{let{handlePasskeyAuth:o}=hm(),s=cp(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useMemo)(()=>a===`first`?Hr:ws,[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)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:u})}),(0,$.jsxs)(Y,{className:`w-full`,labelOverflow:_f.WRAP,onClick:m,disabled:c||r,children:[(0,$.jsx)(dX,{method:mt.PASSKEY}),i(c?f.PASSKEY_AUTHENTICATING:f.PASSKEY_BUTTON)]})]}):(0,$.jsx)(`div`,{className:`space-y-item`,children:(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:i(f.PASSKEY_UNSUPPORTED)})})})},qye=Ir,Jye=({methodConfig:e,isLoading:t,t:n,factorLevel:r})=>{let[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c=rg(),l=e.config?.displayName||`SSO`,u=e.config?.connectionId,d=td(c),f=(0,Q.useCallback)(()=>{if(!u){s(n(Hr.SSO_CONFIGURATION_ERROR));return}a(!0);let e=Hn($r.AUTH_SAML_LOGIN,{connectionId:u}),t=vc().getBaseURL(),r=t===window.location.origin?window.location.origin:``;window.location.href=`${t}${qye}${e}?returnUrl=${encodeURIComponent(`${r}${d}`)}`},[u,d,n]),p=r===`first`?n(Hr.CONTINUE_WITH).replace(`{provider}`,l):l;return(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsxs)(Y,{variant:X.OUTLINE,className:`w-full`,labelOverflow:_f.WRAP,onClick:f,disabled:t||i,children:[(0,$.jsx)(dX,{method:mt.ORG_SAML}),i?`…`:p]}),o&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:o})})]})},Yye=({methodConfig:e,isLoading:t,t:n,factorLevel:r})=>{let[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c=rg(),l=cp(),u=e.config?.displayName||`SSO`,d=e.config?.connectionId,f=e.config?.scopeType,p=e.config?.scopeId,m=f===Dc.ORGANIZATION?p:void 0,h=td(c),g=f===Dc.APPLICATION?p:void 0,_=(0,Q.useCallback)(async()=>{if(!d)s(n(Hr.SSO_CONFIGURATION_ERROR));else{a(!0),s(null);try{let e=vc();if(!m&&!g){s(n(Hr.SSO_CONFIGURATION_ERROR)),a(!1);return}let t=m?await e.getEnterpriseSSOAuthorizationUrl(m,d,h):await e.getAppEnterpriseSSOAuthorizationUrl(d,h,{headers:{[Io.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(Hr.CONTINUE_WITH).replace(`{provider}`,u):u;return(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsxs)(Y,{variant:X.OUTLINE,className:`w-full`,labelOverflow:_f.WRAP,onClick:_,disabled:t||i,children:[(0,$.jsx)(dX,{method:mt.ORG_OPENID_CONNECT}),i?`…`:v]}),o&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:o})})]})},mX=({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 hX(e){return ib({providerRef:e.providerRef,displayName:e.displayName,displayNameLabelKey:e.displayNameLabelKey,fallbackLabel:e.brandLabel,translate:e.translate})}function gX(e){let t=e.publicProviders;return t?Object.entries(t).map(([e,t])=>({key:e,providerRef:e,displayName:t.displayName,displayNameLabelKey:xd(e)})):[]}var _X={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`})})}},vX={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`})]})},yX=({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=_X[o]??null,u=hX({providerRef:o,displayName:s,displayNameLabelKey:c,brandLabel:l?.label,translate:a}),d=l?.brandClass??vX.brandClass,f=l?.icon??vX.icon;return(0,$.jsxs)(Y,{type:`button`,variant:X.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)(mX,{label:o})]}),Xye=({methodConfig:e,isLoading:t,t:n})=>{let{initiateOAuth2Login:r}=ng(),{appConfig:i}=Su(),a=rg(),[o,s]=(0,Q.useState)(null),c=cp(),l=e.oauth2ProviderRefs||[],u=(0,Q.useMemo)(()=>gX({publicProviders:Object.fromEntries(l.map(e=>[e,i.auth?.socialOAuth2Providers?.[e]??{}]))}),[i.auth?.socialOAuth2Providers,l]),d=(0,Q.useMemo)(()=>rb(u.map(e=>e.displayNameLabelKey)),[u]),{t:f}=q({keys:d}),p=(0,Q.useMemo)(()=>td(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)(yX,{providers:u,onProviderClick:m,isLoading:t,continueWithLabel:n(Hr.CONTINUE_WITH),translate:f}),o&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:o})})]})},bX={};bX[mt.PASSWORD]=zye,bX[mt.MAGIC_LINK]=Hye,bX[mt.SMS_OTP]=Uye,bX[mt.EMAIL_OTP]=Wye,bX[mt.TOTP]=Gye,bX[mt.PASSKEY]=Kye,bX[mt.ORG_SAML]=Jye,bX[mt.ORG_OPENID_CONNECT]=Yye,bX[mt.EXTERNAL_OAUTH2]=Xye;var xX={};function SX(e,t){xX[e]=t}var CX;(function(e){e.REFLOW=`reflow`,e.LIST=`list`})(CX||={});var wX=({methods:e,labelFor:t,onSelect:n,disabled:r,layout:i=CX.REFLOW,className:a})=>{if(e.length===0)return null;let o=i===CX.REFLOW;return(0,$.jsx)(`div`,{className:G(o?`flex flex-wrap gap-element`:`flex flex-col gap-item`,a),children:e.map(e=>(0,$.jsxs)(Y,{type:`button`,variant:X.OUTLINE,labelOverflow:_f.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)(dX,{method:e}),(0,$.jsx)(`span`,{children:t(e)})]},e))})};function TX({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_LABEL,`Label`)(e);return(0,$.jsx)(n,{...t})}var Zye=n(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),EX=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)}})),DX=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}}})),Qye=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})),$ye=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})),ebe=n((e=>{var t=EX().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}})),tbe=n((e=>{var t=EX().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),nbe=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}})),OX=n((e=>{var t=DX(),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}}})),rbe=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]]}})),ibe=n((e=>{var t=rbe();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}})),abe=n(((e,t)=>{var n=ibe();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})),kX=n((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),AX=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)}})),jX=n((e=>{var t=kX(),n=AX();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}}})),obe=n((e=>{var t=EX(),n=OX(),r=DX(),i=jX(),a=kX(),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}})),sbe=n((e=>{var t=EX(),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}})),cbe=n(((e,t)=>{var n=jX();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})),lbe=n(((e,t)=>{var n=jX(),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})),ube=n(((e,t)=>{var n=jX();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})),dbe=n(((e,t)=>{var n=jX(),r=EX();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})),fbe=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)})),pbe=n((e=>{var t=jX(),n=cbe(),r=lbe(),i=ube(),a=dbe(),o=AX(),s=EX(),c=fbe();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()))}})),mbe=n((e=>{var t=EX(),n=DX(),r=Qye(),i=$ye(),a=ebe(),o=tbe(),s=nbe(),c=OX(),l=abe(),u=obe(),d=sbe(),f=jX(),p=pbe();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)}})),MX=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}}})),hbe=n((e=>{var t=MX();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)}})),gbe=n((e=>{var t=MX();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}})),_be=e(n((e=>{var t=Zye(),n=mbe(),r=hbe(),i=gbe();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 NX(e){return e?{[Io.AUTH_SESSION_ID]:e}:void 0}var PX=({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=cp(),x=(0,Q.useRef)(null),S=(0,Q.useMemo)(()=>()=>(0,$.jsx)(fX,{fieldName:`code`,submitLabel:i(es.TOTP_VERIFY_BUTTON),submittingLabel:i(es.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=NX(e);x.current={sessionId:e,promise:vc().mfaTOTPSetup(t?{headers:t}:void 0)}}let n=x.current.promise;return(async()=>{try{let e=await n;if(t)return;let r=await _be.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(es.ENROLL_ERROR));_(n),v.current(n)}})(),()=>{t=!0}},[e]);let E=(0,Q.useCallback)(async r=>{w();try{let n=NX(e),a=await vc().mfaTOTPVerifySetup(r.code.trim(),n?{headers:n}:void 0);a.verified?t(a.enrollmentSession):T(i(es.ENROLL_ERROR))}catch(e){let t=b(e,i(es.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(es.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(es.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(es.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)(wF,{children:(0,$.jsxs)(jF,{className:`space-y-2 pt-4`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:i(es.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)(TX,{className:`flex items-center gap-2 cursor-pointer mt-2`,children:[(0,$.jsx)(CI,{checked:m,onCheckedChange:e=>h(e===!0)}),(0,$.jsx)(Z,{className:`text-xs`,children:i(es.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(es.TOTP_VERIFY_LABEL)}),(0,$.jsx)(eE,{schema:Nne,defaultValues:{code:``},onSubmit:E,validationMode:Jc.ON_BLUR,disabled:r||D,onFormReady:C,labels:{fields:{code:i(es.TOTP_VERIFY_LABEL)}},layoutTemplate:S},`totp-enrollment-verify`)]}),g&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:g})})]})};SX(mt.TOTP,PX);function vbe(e){return e?{[Io.AUTH_SESSION_ID]:e}:void 0}SX(mt.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=cp(),u=typeof window<`u`&&!!window.PublicKeyCredential,d=(0,Q.useCallback)(async()=>{o(!0),c(null);try{let n=vbe(e),r=await vc().passkeyRegisterOptions(n?{headers:n}:void 0),i=await hp({optionsJSON:r});t((await vc().passkeyRegisterVerify({response:i},n?{headers:n}:void 0)).enrollmentSession)}catch(e){let t=e?.name===`NotAllowedError`?i(es.PASSKEY_CANCELLED):l(e,i(es.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(es.PASSKEY_DESCRIPTION)}),s&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:s})}),(0,$.jsx)(Y,{className:`w-full`,onClick:d,disabled:a||r,children:i(a?es.PASSKEY_REGISTERING:es.PASSKEY_REGISTER_BUTTON)})]}):(0,$.jsx)(`div`,{className:`space-y-item`,children:(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:i(es.PASSKEY_UNSUPPORTED)})})})});function FX(e){return e?{[Io.AUTH_SESSION_ID]:e}:void 0}var IX=({sessionId:e,onComplete:t,onError:n,isLoading:r,t:i})=>{let a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),s=cp(),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),m=(0,Q.useMemo)(()=>()=>(0,$.jsx)(fX,{fieldName:`phoneNumber`,submitLabel:i(es.PHONE_SEND_CODE),submittingLabel:i(es.PHONE_SENDING),fieldProps:{type:`tel`,placeholder:`+1 555 123 4567`,autoFocus:!0}}),[i]),h=(0,Q.useMemo)(()=>()=>(0,$.jsx)(fX,{fieldName:`code`,submitLabel:i(es.PHONE_VERIFY_BUTTON),submittingLabel:i(es.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=FX(e);await vc().phoneVerifySend(a,t?{headers:t}:void 0),l(a),d(!0)}catch(e){let t=s(e,i(es.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=FX(e),a=await vc().phoneVerifyConfirm(c.trim(),r.code.trim(),n?{headers:n}:void 0);a.verified?t(a.enrollmentSession):x(i(es.ENROLL_ERROR))}catch(e){let t=s(e,i(es.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(es.PHONE_CODE_SENT)}),(0,$.jsx)(eE,{schema:Cne,defaultValues:{code:``},onSubmit:T,validationMode:Jc.ON_BLUR,disabled:f||r,onFormReady:_,labels:{fields:{code:i(es.PHONE_CODE_LABEL)}},layoutTemplate:h},`phone-enrollment-verify`),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(Y,{variant:X.GHOST,size:df.SM,onClick:w,disabled:f,children:i(es.PHONE_RESEND)})})]}):(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:i(es.PHONE_DESCRIPTION)}),(0,$.jsx)(eE,{schema:xie,defaultValues:{phoneNumber:c},onSubmit:C,validationMode:Jc.ON_BLUR,disabled:f||r,onFormReady:g,labels:{fields:{phoneNumber:i(es.PHONE_NUMBER_LABEL)}},layoutTemplate:m},`phone-enrollment-start`)]})};SX(mt.SMS_OTP,IX);var ybe={[mt.SMS_OTP]:ws.SMS_OTP_TITLE,[mt.EMAIL_OTP]:ws.EMAIL_OTP_TITLE,[mt.TOTP]:ws.TOTP_TITLE,[mt.PASSKEY]:ws.PASSKEY_TITLE},LX=({sessionId:e,sessionEmail:t=``})=>{let{getSessionState:n,auth:r}=hm(),i=(0,Q.useMemo)(()=>[K.PUBLIC_LAYOUTS_MFA_CHALLENGE,K.PUBLIC_LAYOUTS_USER_AUTH],[]),{tComponent:a,isReady:o}=q({component:i}),s=rg(),c=e=>a(K.PUBLIC_LAYOUTS_MFA_CHALLENGE,e),l=(0,Q.useMemo)(()=>gm(a,K.PUBLIC_LAYOUTS_USER_AUTH),[a]),u=(0,Q.useMemo)(()=>B(s.search),[s.search]),d=(0,Q.useMemo)(()=>vi(za.login,u),[u]),f=(0,Q.useMemo)(()=>Xt(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=>bX[e.method]);n.length===0?(e.availableEnrollmentMethods||[]).filter(e=>xX[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=Rp(r,u);if(D)return(0,$.jsx)(Rh,{to:D,replace:!0});if(r.accessToken&&!r.isLoading)return(0,$.jsx)(Rh,{to:f,replace:!0});if(x&&e)return(0,$.jsx)(Rh,{to:vi(`${za.enrollmentRequired}?sessionId=${encodeURIComponent(e)}&email=${encodeURIComponent(t)}`,u),replace:!0});if(!o)return null;if(!e||y){let e={expired:ws.ERROR_EXPIRED,no_methods:ws.ERROR_NO_METHODS,generic:ws.ERROR_GENERIC},t=y?e[y]:ws.ERROR_GENERIC;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`text-center space-y-item-xs mb-group`,children:(0,$.jsx)(sY,{children:c(ws.TITLE)})}),(0,$.jsx)(OD,{variant:y===`no_methods`?`default`:`destructive`,children:(0,$.jsx)(AD,{children:c(t)})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(nX,{href:d,children:c(ws.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)(Jy,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`text-muted-foreground`,children:c(ws.VERIFYING)})]}):(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(sY,{children:c(ws.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto text-muted-foreground`,children:c(ws.SUB_TITLE)})]}),!h&&p.length>1&&(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium`,children:c(ws.SELECT_METHOD)}),(0,$.jsx)(wX,{layout:CX.LIST,methods:p.map(e=>e.method),labelFor:e=>{let t=ybe[e];return t?c(t):e},onSelect:g})]}),h&&(()=>{let n=bX[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)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:_})}),h&&p.length>1&&(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(Y,{variant:X.GHOST,size:df.SM,onClick:E,children:c(ws.CHANGE_METHOD)})}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(nX,{href:d,children:c(ws.BACK_TO_LOGIN)})})]})};function RX({preset:e=H.DEFAULT,...t}){let n=qc(K.PUBLIC_LAYOUTS_MFA_CHALLENGE,`Auth_MfaChallenge`)(e);return(0,$.jsx)(n,{...t})}var bbe=()=>{let[e]=sh(),t=e.get(`sessionId`),n=e.get(`email`)||``;return(0,$.jsx)(ZY,{useCardLayout:!0,children:(0,$.jsx)(RX,{sessionId:t,sessionEmail:n})})},zX={[mt.TOTP]:es.TOTP_TITLE,[mt.PASSKEY]:es.PASSKEY_TITLE,[mt.SMS_OTP]:es.PHONE_TITLE},BX=e=>{let{auth:t,completeEnrollmentSession:n,getSessionState:r,adoptPendingMfaSession:i}=hm(),{logout:a}=ng(),{tComponent:o,isReady:s}=q({component:K.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED}),c=ah(),l=rg(),u=e=>o(K.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,e),d=(0,Q.useMemo)(()=>B(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)(()=>moe()),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&&loe()};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)(()=>vi(za.login,d),[d]),S=(0,Q.useMemo)(()=>Xt(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=>xX[e]),[t.availableEnrollmentMethods]),A=(0,Q.useMemo)(()=>{let e=t.mfaSessionId;if(!e)return vi(za.mfaChallenge,d);let n=t.identification?.email||g;return vi(`${za.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=Rp(t,d);if(N)return(0,$.jsx)(Rh,{to:N,replace:!0});if(t.accessToken&&!t.isLoading)return(0,$.jsx)(Rh,{to:S,replace:!0});if(!t.mfaRequired)return _&&!v?(0,$.jsx)($.Fragment,{}):(0,$.jsx)(Rh,{to:x,replace:!0});let P=t.usableSecondFactorMethods.length>0;if(t.mfaSessionId&&k.length===0&&P)return(0,$.jsx)(Rh,{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)(sY,{children:u(es.TITLE)})}),(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:u(es.NO_METHODS_AVAILABLE)})}),(0,$.jsx)(Y,{variant:X.OUTLINE,className:`w-full`,onClick:()=>a(),children:u(es.LOGOUT_BUTTON)})]});if(T)return(0,$.jsxs)(`div`,{className:`text-center space-y-group py-section`,children:[(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:u(es.ENROLL_SUCCESS)})}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:u(es.LOADING)})]});let F=C?xX[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)(sY,{children:u(es.TITLE)}),(0,$.jsx)(Z,{className:`text-muted-foreground max-w-sm mx-auto`,children:u(es.DESCRIPTION)})]}),D&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:D})}),!C&&(0,$.jsxs)(`div`,{className:`space-y-item`,children:[(0,$.jsx)(Z,{className:`text-sm font-medium text-center`,children:u(es.SELECT_METHOD)}),(0,$.jsx)(wX,{layout:CX.LIST,methods:k,labelFor:e=>u(zX[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)(Y,{variant:X.GHOST,size:df.SM,onClick:()=>{w(null),O(null)},children:`←`}),(0,$.jsx)(Z,{className:`text-sm font-medium`,children:u(zX[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)(Y,{variant:X.OUTLINE,className:`w-full`,onClick:()=>a(),children:u(es.LOGOUT_BUTTON)})})]})};function VX({preset:e=H.DEFAULT,...t}){let n=qc(K.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,`Auth_EnrollmentRequired`)(e);return(0,$.jsx)(n,{...t})}var xbe=()=>(0,$.jsx)(ZY,{useCardLayout:!0,children:(0,$.jsx)(VX,{})}),HX=K.PUBLIC_LAYOUTS_ORGANIZATION_ONBOARDING,UX=Q.createContext(null),Sbe=()=>{let{tComponent:e,isReady:t}=q({component:HX}),n=Q.useContext(UX);return t?(0,$.jsxs)(Zk,{children:[(0,$.jsx)(JL,{name:`organizationName`}),n&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:n})}),(0,$.jsx)(eO,{label:e(HX,Mu.SUBMIT_BUTTON),submittingLabel:`…`,fullWidth:!0})]}):null},Cbe=()=>{let{tComponent:e,isReady:t}=q({component:HX}),n=Q.useContext(UX);return t?(0,$.jsxs)(Zk,{children:[(0,$.jsx)(JL,{name:`firstName`}),(0,$.jsx)(JL,{name:`lastName`}),n&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:n})}),(0,$.jsx)(eO,{label:e(HX,Mu.PROFILE_SUBMIT_BUTTON),submittingLabel:`…`,fullWidth:!0})]}):null};function WX(e){let t=e?.pendingObligations;if(!Array.isArray(t))return[ll.ORGANIZATION];let n=new Set(Object.values(ll));return t.filter(e=>typeof e==`string`&&n.has(e))}var GX=e=>{let{auth:t,completeOrganizationOnboarding:n,completeProfileOnboarding:r,abandonOrganizationOnboarding:i,getSessionState:a}=hm(),{tComponent:o,isReady:s}=q({component:HX}),c=e=>o(HX,e),l=cp(),u=rg(),d=ah(),f=(0,Q.useMemo)(()=>B(u.search),[u.search]),p=(0,Q.useMemo)(()=>Xt(u.search),[u.search]),m=(0,Q.useMemo)(()=>vi(za.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(WX(e))}).catch(()=>{n||v([ll.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(Mu.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(Mu.COMPLETION_ERROR)))}},[n,c]),S=(0,Q.useCallback)(()=>{i(),d(m,{replace:!0})},[i,d,m]);if(t.accessToken&&!t.isLoading)return(0,$.jsx)(Rh,{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)(sY,{children:c(Mu.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:c(Mu.SESSION_EXPIRED)})]}),(0,$.jsx)(Z,{className:`text-sm`,children:(0,$.jsx)(tX,{href:m,children:c(Mu.SIGN_IN_AGAIN_LINK)})})]});if(_===null)return null;let C=(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(Y,{variant:X.GHOST,onClick:S,children:c(Mu.USE_DIFFERENT_ACCOUNT)})});return y===ll.PROFILE_NAMES?(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(sY,{children:c(Mu.PROFILE_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:c(Mu.PROFILE_DESCRIPTION)})]}),(0,$.jsx)(UX.Provider,{value:h,children:(0,$.jsx)(eE,{schema:Ha,defaultValues:{firstName:``,lastName:``},onSubmit:b,validationMode:Jc.ON_BLUR,disabled:t.isLoading,layoutTemplate:Cbe,labels:{fields:{firstName:c(Mu.FIRST_NAME),lastName:c(Mu.LAST_NAME)}}},ll.PROFILE_NAMES)}),C]}):(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(sY,{children:c(Mu.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:c(Mu.DESCRIPTION)})]}),(0,$.jsx)(UX.Provider,{value:h,children:(0,$.jsx)(eE,{schema:Bte,defaultValues:{organizationName:``},onSubmit:x,validationMode:Jc.ON_BLUR,disabled:t.isLoading,layoutTemplate:Sbe,labels:{fields:{organizationName:c(Mu.ORGANIZATION_NAME)}}},ll.ORGANIZATION)}),C]})};function KX({preset:e=H.DEFAULT,...t}){let n=qc(HX,`Auth_OrganizationOnboarding`)(e);return(0,$.jsx)(n,{...t})}var wbe=()=>(0,$.jsx)(ZY,{useCardLayout:!0,children:(0,$.jsx)(KX,{})}),qX=({label:e})=>{let{appConfig:t}=Su(),n=eie(t.compliance,Tae.PRIVACY_NOTICE,new Date().toISOString());return n===void 0?null:(0,$.jsx)(Z,{children:(0,$.jsx)(tX,{href:n,external:!0,"data-privacy-notice-link":``,children:e})})},JX=tl.getLogger(),YX=JX.debugByType(`Auth_Main`);JX.setDebugTypeLogging(`Auth_Main`,!1);var Tbe=()=>{let{auth:e}=ng(),{tComponent:t,isReady:n}=q({component:K.PUBLIC_LAYOUTS_USER_AUTH});return n?(0,$.jsxs)(Zk,{children:[(0,$.jsx)(JL,{name:`email`}),e.error&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:e.error})}),(0,$.jsx)(eO,{label:(e=>t(K.PUBLIC_LAYOUTS_USER_AUTH,e))(Hr.CONTINUE),submittingLabel:`…`,fullWidth:!0})]}):null};function Ebe(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 Dbe=3e3,Obe={[Yr.SAML_LOGIN_FAILED]:{label:Hr.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[Yr.SAML_AUTH_FAILED]:{label:Hr.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[Yr.MISSING_PARAMS]:{label:Hr.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[Yr.OAUTH_FAILED]:{label:Hr.PROVIDER_SIGN_IN_FAILED,variant:`destructive`},[Yr.SAML_SLO_FAILED]:{label:Hr.PROVIDER_SIGN_OUT_FAILED,variant:`warning`}},XX=({})=>{let{auth:e,identifyByEmail:t,initiateOAuth2Login:n}=ng(),{signInWithPasskey:r,endedSessionReason:i}=hm(),a=Gx(),o=rg(),s=(0,Q.useMemo)(()=>gX({publicProviders:a.globalAuth?.socialOAuth2Providers}),[a.globalAuth?.socialOAuth2Providers]),c=(0,Q.useMemo)(()=>rb(s.map(e=>e.displayNameLabelKey)),[s]),{t:l,tComponent:u,isReady:d}=q({component:K.PUBLIC_LAYOUTS_USER_AUTH,keys:c}),f=e=>u(K.PUBLIC_LAYOUTS_USER_AUTH,e),p=za,m=(0,Q.useMemo)(()=>Xt(o.search),[o.search]),h=(0,Q.useMemo)(()=>B(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}=Obe[e]??{label:Hr.PROVIDER_SIGN_IN_FAILED,variant:`destructive`};return{text:u(K.PUBLIC_LAYOUTS_USER_AUTH,t),variant:n}},[o.search,u]),_=i===Or.ACCOUNT_NOT_ACTIVE?{text:f(Hr.ACCOUNT_NOT_ACTIVE_NOTICE),variant:`destructive`}:i===Or.SESSION_ENDED?{text:f(Hr.SESSION_ENDED_NOTICE),variant:`info`}:null,v=(0,Q.useMemo)(()=>vi(p.passwordLost,h),[h,p.passwordLost]),y=(0,Q.useMemo)(()=>vi(p.register,h),[h,p.register]),[b,x]=(0,Q.useState)(null);oX({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=>bX[e.method]),[S,e.identification]),E=(0,Q.useMemo)(()=>{if(T.length===0)return null;let t=e.identification?.defaultFirstFactorMethod;return t&&bX[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=>{},[]),P=s.length>0,F=!S||!e.identification?.userExists,I=P&&F,L=(0,Q.useMemo)(()=>{let e=qi(a.userTypeAuth?.authMethodsEnabled);return P||e.delete(mt.EXTERNAL_OAUTH2),e},[P,a.userTypeAuth?.authMethodsEnabled]),R=!a.userTypeAuth?.authMethodsEnabled||L.size>0,ee=I&&R,te=it(a.userTypeAuth?.authMethodsEnabled).has(mt.PASSKEY)&&e.purpose!==z.REAUTH&&typeof window<`u`&&!!window.PublicKeyCredential,ne=F&&!R&&!te&&!I,V=!F&&T.length===0,re=(0,Q.useRef)(!1),[ie,ae]=(0,Q.useState)(0),oe=(0,Q.useCallback)(async()=>{re.current=!0;try{await r(Om.MODAL)}catch{}finally{re.current=!1,ae(e=>e+1)}},[r]),se=(0,Q.useRef)(r);se.current=r,(0,Q.useEffect)(()=>{if(!d||!F||!te)return;let e=!1;return(async()=>{if(await koe())for(await Ebe(Dbe);!e;)try{await se.current(Om.CONDITIONAL);return}catch(e){if(!(e instanceof Am)||re.current)return}})(),()=>{e=!0,poe.cancelCeremony()}},[d,F,te,ie]),(0,Q.useEffect)(()=>{YX(`Render isReady=${d} accessToken=${e.accessToken?`yes`:`no`} authLoading=${e.isLoading?`yes`:`no`} identification=${S?`yes`:`no`} showIdentify=${F?`yes`:`no`} activeMethod=${D??`none`}`)},[d,e.accessToken,e.isLoading,S,F,D]);let ce=Rp(e,h);return ce?(0,$.jsx)(Rh,{to:ce,replace:!0}):e.accessToken?(0,$.jsx)(Rh,{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)(sY,{children:e.purpose===z.REAUTH?f(Hr.REAUTH_TITLE):f(Hr.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:e.purpose===z.REAUTH?f(Hr.REAUTH_SUB_TITLE):f(Hr.SUB_TITLE)})]}),I&&(0,$.jsx)(yX,{providers:s,onProviderClick:A,isLoading:e.isLoading,continueWithLabel:f(Hr.CONTINUE_WITH),translate:l,dividerLabel:f(Hr.DIVIDER_OR),showDivider:ee}),!e.error&&_&&(0,$.jsx)(OD,{variant:_.variant,"data-session-ended-notice":i??void 0,children:(0,$.jsx)(AD,{children:_.text})}),!e.error&&g&&(0,$.jsx)(OD,{variant:g.variant,children:(0,$.jsx)(AD,{children:g.text})}),F&&R&&(0,$.jsx)(eE,{schema:tu,defaultValues:{email:``},onSubmit:j,validationMode:Jc.ON_BLUR,disabled:e.isLoading,labels:{fields:{email:f(Hr.EMAIL_ADDRESS)}},layoutTemplate:Tbe},`identify`),F&&te&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(mX,{label:f(Hr.DIVIDER_OR)}),(0,$.jsxs)(Y,{variant:X.OUTLINE,className:`w-full`,labelOverflow:_f.WRAP,onClick:oe,disabled:e.isLoading,"data-passkey-sign-in":``,children:[(0,$.jsx)(dX,{method:mt.PASSKEY}),f(Hr.PASSKEY_SIGN_IN)]})]}),D&&!F&&(()=>{let t=bX[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&&!F&&(0,$.jsx)(Z,{children:f(Hr.ORGANIZATION_ENFORCED_METHOD)}),O.length>0&&!F&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(mX,{label:f(Hr.OTHER_METHODS_DIVIDER)}),(0,$.jsx)(wX,{methods:O.map(e=>e.method),labelFor:e=>uX(e,{offeredMethod:O.find(t=>t.method===e),socialProviders:s,continueWithTemplate:f(Hr.CONTINUE_WITH),translateLabel:e=>f(e),resolveSocialProviderLabel:e=>hX({providerRef:e.providerRef,displayName:e.displayName,displayNameLabelKey:e.displayNameLabelKey,brandLabel:_X[e.providerRef]?.label,translate:l})}),onSelect:x,disabled:e.isLoading})]}),ne&&(0,$.jsx)(OD,{"data-auth-no-entry-point":``,children:(0,$.jsx)(AD,{children:f(Hr.NO_SIGN_IN_METHOD_AVAILABLE)})}),V&&(0,$.jsx)(OD,{"data-auth-no-method-for-address":``,children:(0,$.jsx)(AD,{children:f(Hr.NO_SIGN_IN_METHOD_FOR_ADDRESS)})}),!R&&!S&&e.error&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:e.error})}),(0,$.jsxs)(`div`,{className:`text-center space-y-item pt-group`,children:[D===mt.PASSWORD&&!F&&(0,$.jsx)(Z,{children:(0,$.jsx)(tX,{href:v,children:f(Hr.FORGOT_PASSWORD)})}),e.purpose!==z.REAUTH&&a.registrationConfig.publicRegistrationAvailable&&(0,$.jsxs)(Z,{children:[f(Hr.NO_ACCOUNT),` `,(0,$.jsx)(tX,{href:y,children:f(Hr.SIGNUP_LINK)})]}),(0,$.jsx)(qX,{label:f(Hr.PRIVACY_NOTICE_LINK)})]})]}):null};function ZX({preset:e=H.DEFAULT,...t}){let n=qc(K.PUBLIC_LAYOUTS_USER_AUTH,`Auth_Main`)(e);return YX(`Resolve wrapper preset=${e} component=${n.displayName??n.name??`anonymous`}`),(0,$.jsx)(n,{...t})}var QX=tl.getLogger(),kbe=QX.debugByType(`AuthPage_Main`);QX.setDebugTypeLogging(`AuthPage_Main`,!1);var Abe=()=>{let{auth:e}=hm(),{isReady:t}=q({component:[K.PUBLIC_LAYOUTS_USER_AUTH,K.LOW_LEVEL_FORM_MESSAGE],keys:[`errors_validation`]});return kbe(`Render ready=${t}`),t?(0,$.jsx)(ZY,{useCardLayout:!0,organizationBranding:e.identification?.organizationBranding,children:(0,$.jsx)(ZX,{})}):(0,$.jsx)(`div`,{className:`flex min-h-screen w-screen items-center justify-center bg-background`,children:(0,$.jsx)(Jy,{size:48})})},jbe=60,$X=({token:e,email:t})=>{let{auth:n,handleEmailVerification:r}=hm(),{tComponent:i,isReady:a}=q({component:K.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL}),o=cp(),s=e=>i(K.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL,e),c=za.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(yc.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]),oX({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 vc().resendVerificationEmail(m),_(`sent`),y(jbe)}catch(e){_(`error`),x(o(e,s(yc.ERROR_MESSAGE)))}}},[m,v]),w=Rp(n,void 0);return w?(0,$.jsx)(Rh,{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)(sY,{children:s(yc.ERROR_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(yc.INVALID_LINK)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(nX,{href:c,children:s(yc.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)(sY,{children:s(yc.SESSION_CONFLICT_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(yc.SESSION_CONFLICT_DESCRIPTION).replace(`{email}`,t)})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-sm`,children:[(0,$.jsx)(Y,{type:`button`,onClick:()=>{p(!1),S()},children:s(yc.SESSION_CONFLICT_VERIFY_BUTTON).replace(`{email}`,t)}),(0,$.jsx)(Y,{type:`button`,variant:X.OUTLINE,onClick:()=>{window.location.href=za.home},children:s(yc.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)(sY,{children:s(yc.SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(yc.SUCCESS_MESSAGE)})]}),(0,$.jsx)(Rh,{to:za.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)(sY,{children:s(yc.ERROR_TITLE)})]}),(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:l})}),(0,$.jsxs)(`div`,{className:`mt-group space-y-item-sm`,children:[(0,$.jsx)(Z,{className:`text-sm text-center`,children:s(yc.RESEND_DESCRIPTION)}),(0,$.jsxs)(`div`,{className:`flex gap-item-xs`,children:[(0,$.jsx)(YM,{name:`__display`,schema:md(),type:`email`,placeholder:s(yc.RESEND_EMAIL_PLACEHOLDER),value:m,onChange:e=>h(String(e)),disabled:g===`sending`||v>0}),(0,$.jsx)(Y,{type:`button`,variant:X.OUTLINE,onClick:C,disabled:!m||g===`sending`||v>0,children:g===`sending`?s(yc.RESEND_SENDING):v>0?`${s(yc.RESEND_COOLDOWN)} (${v}s)`:s(yc.RESEND_BUTTON)})]}),g===`sent`&&(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:s(yc.RESEND_SUCCESS)})}),g===`error`&&b&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:b})})]}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(nX,{href:c,children:s(yc.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)(Jy,{size:24,className:`text-primary`})}),(0,$.jsx)(sY,{children:s(yc.TITLE)}),(0,$.jsxs)(Z,{className:`max-w-sm mx-auto`,children:[s(yc.VERIFYING),` `,t]})]})}):null};function eZ({preset:e=H.DEFAULT,...t}){let n=qc(K.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL,`Auth_ConfirmEmail`)(e);return(0,$.jsx)(n,{...t})}var Mbe=()=>{let[e]=sh(),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)(ZY,{useCardLayout:!0,children:(0,$.jsx)(eZ,{token:t,email:n})})},tZ={minLength:15,maxLength:128,requireUppercase:!1,requireLowercase:!1,requireNumbers:!1,requireSpecialChars:!1,expiryDays:0},nZ=({fieldName:e,policy:t,t:n,blocklistContext:r})=>{let{watch:i}=LC(),a=i(e)||``,o=(0,Q.useMemo)(()=>{if(!a)return[];let e=[];return e.push({label:n(Pi.MIN_LENGTH).replace(`{minLength}`,String(t.minLength)),passed:a.length>=t.minLength}),e.push({label:n(Pi.MAX_LENGTH).replace(`{maxLength}`,String(t.maxLength)),passed:a.length<=t.maxLength}),t.requireUppercase&&e.push({label:n(Pi.UPPERCASE),passed:/[A-Z]/.test(a)}),t.requireLowercase&&e.push({label:n(Pi.LOWERCASE),passed:/[a-z]/.test(a)}),t.requireNumbers&&e.push({label:n(Pi.NUMBER),passed:/\d/.test(a)}),t.requireSpecialChars&&e.push({label:n(Pi.SPECIAL_CHAR),passed:/[^A-Za-z0-9]/.test(a)}),e.push({label:n(Pi.BLOCKLISTED),passed:!Tee(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 rZ({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 iZ(e,t,n){return e.map(e=>{let r=t(e);return e===Lo.MIN_LENGTH?r.replace(`{minLength}`,String(n.minLength??8)):e===Lo.MAX_LENGTH?r.replace(`{maxLength}`,String(n.maxLength??128)):r})}function aZ(e,t,n){if(!e||typeof e!=`object`)return null;let r=e;if(r.message!==Lu.VALIDATION_PASSWORD_POLICY_VIOLATION)return null;let i=r.context,a=i?.violations;return!Array.isArray(a)||a.length===0?null:iZ(a,t,{minLength:i.minLength??n.minLength??8,maxLength:i.maxLength??n.maxLength??128}).join(`. `)}var Nbe=new Set([mt.PASSWORD,mt.ORG_SAML,mt.ORG_OPENID_CONNECT,mt.EXTERNAL_OAUTH2,mt.MAGIC_LINK,mt.PASSKEY]),Pbe=({invitationEmail:e,passwordPolicy:t})=>{let{formState:n}=LC(),{tComponent:r,isReady:i}=q({component:K.PUBLIC_LAYOUTS_USER_INVITATION}),a=e=>r(K.PUBLIC_LAYOUTS_USER_INVITATION,e);return i?(0,$.jsxs)(Zk,{children:[(0,$.jsx)(rZ,{email:e}),(0,$.jsx)(JL,{name:`firstName`}),(0,$.jsx)(JL,{name:`lastName`}),(0,$.jsx)(JL,{name:`password`}),(0,$.jsx)(JL,{name:`confirmPassword`}),(0,$.jsx)(nZ,{fieldName:`password`,policy:t,t:a}),n.errors.root&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:n.errors.root.message})}),(0,$.jsx)(eO,{label:a(x.ACCEPT_INVITATION),submittingLabel:a(x.ACCEPTING_INVITATION),fullWidth:!0})]}):null},Fbe=({invitationEmail:e,t,tAuth:n})=>{let{formState:r}=LC();return(0,$.jsxs)(Zk,{children:[e&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center`,children:e}),(0,$.jsx)(JL,{name:`firstName`}),(0,$.jsx)(JL,{name:`lastName`}),r.errors.root&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:r.errors.root.message})}),(0,$.jsx)(eO,{label:n(Hr.MAGIC_LINK_SEND),submittingLabel:n(Hr.MAGIC_LINK_SEND),fullWidth:!0})]})},Ibe=({invitationEmail:e,disabled:t,onSubmit:n,t:r,tAuth:i})=>{let a=(0,Q.useRef)(null),o=cp(),s=(0,Q.useMemo)(()=>uo.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(x.UNEXPECTED_ERROR))})}},[n,r,o]);return(0,$.jsx)(eE,{schema:s,defaultValues:{firstName:``,lastName:``},onSubmit:c,validationMode:Jc.ON_BLUR,disabled:t,onFormReady:e=>{a.current=e},labels:{fields:{firstName:r(x.FIRST_NAME),lastName:r(x.LAST_NAME)}},layoutTemplate:()=>(0,$.jsx)(Fbe,{invitationEmail:e,t:r,tAuth:i})})},Lbe=({invitationEmail:e,error:t,t:n})=>(0,$.jsxs)(Zk,{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(x.PASSKEY_DESCRIPTION)}),(0,$.jsx)(JL,{name:`firstName`}),(0,$.jsx)(JL,{name:`lastName`}),t&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:t})}),(0,$.jsx)(eO,{label:n(x.PASSKEY_CREATE),submittingLabel:n(x.PASSKEY_CREATING),fullWidth:!0})]}),Rbe=({invitationEmail:e,disabled:t,error:n,onSubmit:r,t:i})=>{let a=typeof window<`u`&&!!window.PublicKeyCredential,o=(0,Q.useMemo)(()=>uo.pick({firstName:!0,lastName:!0}),[]);return a?(0,$.jsx)(eE,{schema:o,defaultValues:{firstName:``,lastName:``},onSubmit:e=>r(e.firstName?.trim()||void 0,e.lastName?.trim()||void 0),validationMode:Jc.ON_BLUR,disabled:t,labels:{fields:{firstName:i(x.FIRST_NAME),lastName:i(x.LAST_NAME)}},layoutTemplate:()=>(0,$.jsx)(Lbe,{invitationEmail:e,error:n,t:i})}):(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:i(x.PASSKEY_UNAVAILABLE_HINT)})})},oZ=({token:e,email:t})=>{let{auth:n,acceptInvitation:r}=hm(),{handleError:i}=$f(),a=cp(),o=Gx(),s=(0,Q.useMemo)(()=>[K.PUBLIC_LAYOUTS_USER_INVITATION,K.PUBLIC_LAYOUTS_USER_AUTH],[]),{tComponent:c,isReady:l}=q({component:s}),u=rg(),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,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(!0),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(null),L=(0,Q.useCallback)(e=>c(K.PUBLIC_LAYOUTS_USER_INVITATION,e),[c]),R=(0,Q.useCallback)(e=>c(K.PUBLIC_LAYOUTS_USER_AUTH,e),[c]),z=(0,Q.useMemo)(()=>gm(c,K.PUBLIC_LAYOUTS_USER_AUTH),[c]),ee=za.login,te=(0,Q.useMemo)(()=>Xt(u.search),[u.search]),ne=(0,Q.useMemo)(()=>B(u.search),[u.search]),V=k?.inviteeEmail??t,re=(0,Q.useMemo)(()=>k?.passwordPolicy??o.passwordPolicy??tZ,[k?.passwordPolicy,o.passwordPolicy]),ie=(0,Q.useMemo)(()=>uo.refine(e=>!e.password||e.password===e.confirmPassword,{message:L(x.PASSWORD_MISMATCH),path:[`confirmPassword`]}),[L]),ae=(0,Q.useCallback)(e=>{d.current=e},[]);(0,Q.useEffect)(()=>{if(!e||n.accessToken){M(!1);return}let t=!1;return M(!0),P(null),vc().getInvitationInfo(e).then(e=>{t||A(e)}).catch(e=>{t||P(a(e,L(x.UNEXPECTED_ERROR)))}).finally(()=>{t||M(!1)}),()=>{t=!0}},[e,n.accessToken]);let oe=(0,Q.useMemo)(()=>(k?.availableFirstFactorMethods??[]).filter(e=>Nbe.has(e.method)),[k]),se=oe.length>0,ce=n.isLoading||D||v,le=(0,Q.useMemo)(()=>oe[0]?.method??null,[oe]),ue=F??le,de=oe.filter(e=>e.method!==ue);oX({mfaRequired:n.mfaRequired,mfaSessionId:n.mfaSessionId,usableSecondFactorMethods:n.usableSecondFactorMethods,email:V||void 0,authRedirectTarget:ne});let fe=(0,Q.useCallback)(async t=>{if(d.current?.clearErrors(`root`),t.password){let e=Ue.validatePasswordAgainstPolicy(t.password,re);if(!e.valid){d.current?.setError(`root`,{type:`policy`,message:iZ(e.violations,L,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&&E(!0)}catch(e){d.current?.setError(`root`,{type:`server`,message:a(e,L(x.UNEXPECTED_ERROR))})}},[r,re,L,e,a]),pe=(0,Q.useCallback)(async(t,n)=>{S(null),y(!0);try{let i=await r({invitationToken:e,firstName:t,lastName:n,credentialMethod:mt.PASSKEY});if(i?.signInRequired){E(!0);return}let a=i?.passkeyRegistrationOptions;if(a)try{let e=await hp({optionsJSON:a});await vc().passkeyRegisterVerify({response:e})}catch{}}catch(e){S(a(e,L(x.UNEXPECTED_ERROR)))}finally{y(!1)}},[r,e,L,a]),me=(0,Q.useCallback)(async(t,n)=>{O(!0);try{(await vc().acceptInvitation({invitationToken:e,firstName:t,lastName:n,credentialMethod:mt.MAGIC_LINK,redirect:ne})).nextStep===Qe.SIGN_IN_REQUIRED?E(!0):w(!0)}catch(e){throw i(e,`Invitation acceptance failed (magic link)`,{credentialMethod:mt.MAGIC_LINK}),e}finally{O(!1)}},[e,i,ne]),he=(0,Q.useCallback)(async()=>{if(_(null),!e)_(L(x.INVALID_LINK));else{p(!0);try{await vc().rejectInvitation({invitationToken:e}),h(!0)}catch(e){_(a(e,L(x.UNEXPECTED_ERROR)))}finally{p(!1)}}},[L,e,a]),ge=(0,Q.useCallback)(e=>{},[]),_e=(0,Q.useCallback)(e=>{},[]);return n.accessToken&&!v?(0,$.jsx)(Rh,{to:te,replace:!0}):l?e?m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(sY,{children:L(x.DECLINE_SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:L(x.DECLINE_SUCCESS_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(nX,{href:ee,children:L(x.CONTINUE_LINK)})})]}):T?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(sY,{children:L(x.SIGN_IN_REQUIRED_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:L(x.SIGN_IN_REQUIRED_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(nX,{href:ee,children:L(x.LOGIN_LINK)})})]}):C?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(sY,{children:R(Hr.MAGIC_LINK_SENT_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:R(Hr.MAGIC_LINK_SENT_DESCRIPTION)}),V&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:V})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(nX,{href:ee,children:L(x.LOGIN_LINK)})})]}):j?(0,$.jsx)(`div`,{className:`flex items-center justify-center py-group`,children:(0,$.jsx)(Jy,{size:40})}):N||!k?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(sY,{children:L(x.ERROR_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:N||L(x.INVALID_LINK)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(nX,{href:ee,children:L(x.LOGIN_LINK)})})]}):k.managementMode===une.SCIM?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(sY,{children:L(x.SCIM_MANAGED_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:L(x.SCIM_MANAGED_MESSAGE)}),V&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:V})]}),g&&(0,$.jsx)(OD,{variant:`destructive`,className:`mb-group`,children:(0,$.jsx)(AD,{children:g})}),(0,$.jsxs)(`div`,{className:`text-center mt-group space-y-item-sm`,children:[(0,$.jsx)(Y,{variant:X.OUTLINE,onClick:he,disabled:f,className:`w-full`,children:L(f?x.DECLINING_INVITATION:x.DECLINE_INVITATION)}),(0,$.jsx)(nX,{href:ee,children:L(x.LOGIN_LINK)}),(0,$.jsx)(qX,{label:R(Hr.PRIVACY_NOTICE_LINK)})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(sY,{children:L(x.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:L(x.SUB_TITLE)}),k.organizationName&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:k.organizationName}),V&&(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:V})]}),se?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center mb-element`,children:L(x.METHOD_CHOICE_HINT)}),(()=>{if(!ue)return null;let e=oe.find(e=>e.method===ue);if(!e)return null;if(ue===mt.PASSWORD)return(0,$.jsx)(eE,{schema:ie,defaultValues:{firstName:``,lastName:``,password:``,confirmPassword:``},onSubmit:fe,validationMode:Jc.ON_BLUR,disabled:n.isLoading||f,onFormReady:ae,labels:{fields:{firstName:L(x.FIRST_NAME),lastName:L(x.LAST_NAME),password:L(x.PASSWORD),confirmPassword:L(x.CONFIRM_PASSWORD)}},layoutTemplate:()=>(0,$.jsx)(Pbe,{invitationEmail:V,passwordPolicy:re})});if(ue===mt.MAGIC_LINK)return(0,$.jsx)(Ibe,{invitationEmail:V,disabled:n.isLoading||f,onSubmit:me,t:L,tAuth:R});if(ue===mt.PASSKEY)return(0,$.jsx)(Rbe,{invitationEmail:V,disabled:n.isLoading||f,error:b,onSubmit:pe,t:L});let t=bX[ue];if(!t)return null;let r={sessionId:``,email:V??``,methodConfig:e,onSuccess:ge,onError:_e,factorLevel:`first`,isLoading:n.isLoading||f,t:z};return(0,$.jsx)(t,{...r})})(),de.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(mX,{label:R(Hr.OTHER_METHODS_DIVIDER)}),(0,$.jsx)(wX,{methods:de.map(e=>e.method),labelFor:e=>uX(e,{offeredMethod:de.find(t=>t.method===e),continueWithTemplate:R(Hr.CONTINUE_WITH),translateLabel:e=>R(e),resolveSocialProviderLabel:e=>e.displayName??e.providerRef}),onSelect:e=>{I(e),S(null)},disabled:ce||f})]})]}):(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:L(x.NO_METHOD_AVAILABLE_HINT)})}),g&&(0,$.jsx)(OD,{variant:`destructive`,className:`mt-group`,children:(0,$.jsx)(AD,{children:g})}),(0,$.jsxs)(`div`,{className:`text-center mt-group space-y-item-sm`,children:[(0,$.jsx)(Y,{variant:X.OUTLINE,onClick:he,disabled:ce||f,className:`w-full`,children:L(f?x.DECLINING_INVITATION:x.DECLINE_INVITATION)}),(0,$.jsx)(nX,{href:ee,children:L(x.LOGIN_LINK)}),(0,$.jsx)(qX,{label:R(Hr.PRIVACY_NOTICE_LINK)})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(sY,{children:L(x.ERROR_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:L(x.INVALID_LINK)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(nX,{href:ee,children:L(x.LOGIN_LINK)})})]}):null};function sZ({preset:e=H.DEFAULT,...t}){let n=qc(K.PUBLIC_LAYOUTS_USER_INVITATION,`Auth_Invitation`)(e);return(0,$.jsx)(n,{...t})}var zbe=()=>{let[e]=sh(),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)(ZY,{useCardLayout:!0,children:(0,$.jsx)(sZ,{token:t,email:n})})};function Bbe(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)&&Ei(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 Hm.resolveResourceUrl(r,i,a,n.allResourceFieldIdentifiers)?.resolvedUrl??void 0}function Vbe(e){return!e||!Fae(e)||e.includes(`..`)||e.includes(`\\`)||e.includes(`://`)||/[<>"]/.test(e)||e.length>256?za.home:e}var cZ=({token:e,mode:t=`one-off-session`,returnPathFromUrl:n})=>{let{handleOneOffTokenExchange:r,handleAuthCodeExchange:i,clearCrossFrontendHandoffContext:a,auth:o,tokenStorage:s}=hm(),{registry:c}=fm(),{tComponent:l,isReady:u}=q({component:K.PUBLIC_LAYOUTS_ONE_OFF_SESSION}),d=cp(),f=e=>l(K.PUBLIC_LAYOUTS_ONE_OFF_SESSION,e),p=za.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`?Vbe(o.crossFrontendHandoffContext?.returnPath??n):o.oneOffContext?Bbe(o.oneOffContext.tokenType,o.oneOffContext.scopedInitiatorIds,c)??za.home:za.home:za.home,[t,o.oneOffContext,o.accessToken,o.crossFrontendHandoffContext,n,c]);return(0,Q.useEffect)(()=>{g.current||(t===`one-off-session`&&!(s instanceof nm)?(g.current=!0,h(f(Po.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(Po.ERROR_GENERIC)))}).finally(()=>{v(!0)})):(g.current=!0,h(f(Po.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)(Rh,{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)(sY,{children:f(Po.ERROR_TITLE)})]}),(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:m})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(nX,{href:p,children:f(Po.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)(Jy,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:f(Po.VERIFYING)})]}):null};function lZ({preset:e=H.DEFAULT,...t}){let n=qc(K.PUBLIC_LAYOUTS_ONE_OFF_SESSION,`Auth_OneOffSession`)(e);return(0,$.jsx)(n,{...t})}var uZ=()=>{let{token:e}=Rm();return(0,$.jsx)(ZY,{useCardLayout:!0,children:(0,$.jsx)(lZ,{token:e})})},dZ;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.UPLOADING=`uploading`,e.DONE=`done`,e.FAILED=`failed`})(dZ||={});function fZ(e,t){if(e.length===0||t===``)return!0;let n=t.split(`/`)[0];return e.some(e=>e===t||e===`${n}/*`)}function Hbe(e){let t=e,n=t?.status??t?.statusCode??t?.response?.status;return typeof n==`number`?n:void 0}var pZ=({token:e})=>{let{tComponent:t,isReady:n,formatDateTime:r,formatByteSize:i}=q({component:K.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT}),a=cp(),o=(0,Q.useCallback)((e,n)=>t(K.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT,e,n),[t]),[s,c]=(0,Q.useState)(dZ.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:ms.ERROR_NOT_FOUND,cause:void 0}),c(dZ.FAILED),null;try{let t=await vc().readFileUploadGrantStatus(e);return u(t),t}catch(e){let t=Hbe(e)===404?ms.ERROR_NOT_FOUND:ms.ERROR_GENERIC;return f({kind:t,cause:t===ms.ERROR_GENERIC?e:void 0}),c(dZ.FAILED),null}},[e]);(0,Q.useEffect)(()=>{let e=!1;return v().then(t=>{!e&&t&&c(dZ.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:ms.ERROR_TOO_LARGE,cause:void 0}),c(dZ.FAILED)):fZ(l.constraints.allowedMimeTypes,e.type)?(f(null),m(e),c(dZ.READY)):(m(null),f({kind:ms.ERROR_TYPE_NOT_ACCEPTED,cause:void 0}),c(dZ.FAILED)))},[l]),x=(0,Q.useCallback)(async()=>{if(e&&l&&p){c(dZ.UPLOADING),g(0);try{await vc().uploadWithFileUploadGrant(l,e,p,{onUploadProgress:e=>g(e<0?0:e)}),await v()&&c(dZ.DONE)}catch(e){f({kind:ms.ERROR_GENERIC,cause:e}),c(dZ.FAILED)}}},[e,l,p,v]),S=(0,Q.useCallback)(()=>{f(null),m(null),g(0),l?c(dZ.READY):(c(dZ.LOADING),v().then(e=>{e&&c(dZ.READY)}))},[l,v]);if(!n)return null;if(s===dZ.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)(Jy,{size:24,className:`text-primary`})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:o(ms.LOADING)})]});if(s===dZ.FAILED&&d){let e=o(ms.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)(sY,{children:o(ms.ERROR_TITLE)})}),(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsxs)(AD,{children:[o(d.kind,d.kind===ms.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===ms.ERROR_NOT_FOUND?null:(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(Y,{type:`button`,variant:X.OUTLINE,onClick:S,children:o(ms.RETRY)})})]})}if(!l)return null;if(l.state!==we.PENDING){let e=s===dZ.DONE,t=e?ms.SUCCESS_TITLE:l.state===we.REDEEMED?ms.STATE_REDEEMED_TITLE:l.state===we.EXPIRED?ms.STATE_EXPIRED_TITLE:ms.STATE_REVOKED_TITLE,n=e?ms.SUCCESS_MESSAGE:l.state===we.REDEEMED?ms.STATE_REDEEMED:l.state===we.EXPIRED?ms.STATE_EXPIRED:ms.STATE_REVOKED;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`text-center space-y-item-xs mb-group`,children:(0,$.jsx)(sY,{children:o(t)})}),(0,$.jsx)(OD,{variant:e?`success`:`info`,children:(0,$.jsx)(AD,{children:o(n)})}),l.file?(0,$.jsxs)(`dl`,{className:`mt-group text-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:o(ms.FILE_ID)}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`code`,{"data-testid":`upload-grant-file-id`,children:l.file.fileId})})]}):null]})}let C=s===dZ.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)(sY,{children:o(ms.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:o(ms.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(ms.MAX_SIZE)}),(0,$.jsx)(`dd`,{"data-testid":`upload-grant-max-size`,children:y}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:o(ms.ACCEPTED_TYPES)}),(0,$.jsx)(`dd`,{"data-testid":`upload-grant-accepted-types`,children:w.length>0?w.join(`, `):o(ms.ANY_TYPE)}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:o(ms.EXPIRES_AT)}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`time`,{dateTime:l.expiresAt,children:r(l.expiresAt)})})]}),(0,$.jsxs)(`div`,{role:`group`,"aria-label":o(ms.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(ms.DROPZONE_PROMPT)}),(0,$.jsx)(Y,{type:`button`,"data-testid":`upload-grant-choose`,variant:X.OUTLINE,disabled:C,onClick:()=>_.current?.click(),children:o(ms.CHOOSE_FILE)}),(0,$.jsx)(Z,{className:`mt-element text-sm`,"data-testid":`upload-grant-selected-file`,children:p?`${p.name} · ${i(p.size)}`:o(ms.NO_FILE_SELECTED)})]}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(Y,{type:`button`,"data-testid":`upload-grant-submit`,disabled:!p||C,onClick:()=>void x(),children:C?o(ms.UPLOADING,{percent:h}):o(ms.UPLOAD)})})]})};function mZ({preset:e=H.DEFAULT,...t}){let n=qc(K.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT,`Files_UploadGrantDrop`)(e);return(0,$.jsx)(n,{...t})}var hZ=()=>{let{token:e}=Rm();return(0,$.jsx)(ZY,{useCardLayout:!0,children:(0,$.jsx)(mZ,{token:e})})},Ube=()=>{let[e]=sh(),t=e.get(`code`)??void 0,n=e.get(`return`)??void 0;return(0,$.jsx)(ZY,{useCardLayout:!0,children:(0,$.jsx)(lZ,{token:t,mode:`cross-frontend-handoff`,returnPathFromUrl:n})})},Wbe=()=>{let{formState:e}=LC(),{tComponent:t,isReady:n}=q({component:K.PUBLIC_LAYOUTS_USER_PASSWORD_LOST}),r=e=>t(K.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,e);return n?(0,$.jsxs)(Zk,{children:[(0,$.jsx)(JL,{name:`email`}),e.errors.root&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:e.errors.root.message})}),(0,$.jsx)(eO,{label:r(xr.SEND_RESET_PASSWORD_LINK),submittingLabel:r(xr.SENDING),fullWidth:!0})]}):null},Gbe=({resetEmail:e})=>{let t=Gx(),{formState:n}=LC(),{tComponent:r,isReady:i}=q({component:K.PUBLIC_LAYOUTS_USER_PASSWORD_LOST}),a=e=>r(K.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,e),o=t.passwordPolicy??tZ;return i?(0,$.jsxs)(Zk,{children:[(0,$.jsx)(rZ,{email:e}),(0,$.jsx)(JL,{name:`newPassword`}),(0,$.jsx)(JL,{name:`confirmPassword`}),(0,$.jsx)(nZ,{fieldName:`newPassword`,policy:o,t:a}),n.errors.root&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:n.errors.root.message})}),(0,$.jsx)(eO,{label:a(xr.RESET_BUTTON),submittingLabel:a(xr.RESETTING),fullWidth:!0})]}):null},gZ=({resetToken:e,email:t})=>{let{auth:n}=ng(),r=Gx(),i=cp(),{tComponent:a,isReady:o}=q({component:K.PUBLIC_LAYOUTS_USER_PASSWORD_LOST}),s=e=>a(K.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,e),c=za.login,l=(0,Q.useRef)(null),{initAutoClearing:u,injectServerErrors:d,clearServerErrors:p}=YR(l),m=(0,Q.useCallback)(e=>{l.current=e,u(e)},[u]),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),x=(0,Q.useMemo)(()=>r.passwordPolicy??tZ,[r.passwordPolicy]),S=(0,Q.useMemo)(()=>f.refine(e=>e.newPassword===e.confirmPassword,{message:s(xr.PASSWORD_MISMATCH),path:[`confirmPassword`]}),[s]);return n.accessToken?(0,$.jsx)(Rh,{to:za.home,replace:!0}):o?y?(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)(sY,{children:s(xr.RESET_SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(xr.RESET_SUCCESS_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(nX,{href:c,children:s(xr.LOGIN_LINK)})})]}):e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(sY,{children:s(xr.RESET_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(xr.RESET_SUB_TITLE)})]}),(0,$.jsx)(eE,{schema:S,defaultValues:{newPassword:``,confirmPassword:``},onSubmit:async t=>{g(!0),l.current?.clearErrors(`root`),p();let n=Ue.validatePasswordAgainstPolicy(t.newPassword,x);if(!n.valid)l.current?.setError(`root`,{type:`policy`,message:iZ(n.violations,s,x).join(`. `)}),g(!1);else try{await vc().completePasswordReset(e,t.newPassword),b(!0)}catch(e){let t=DM(e);if(t)d(t.validationErrors);else{let t=aZ(e,s,x);l.current?.setError(`root`,{type:`server`,message:t??i(e,s(xr.INVALID_TOKEN))})}}finally{g(!1)}},onFormReady:m,validationMode:Jc.ON_BLUR,disabled:h,labels:{fields:{newPassword:s(xr.NEW_PASSWORD),confirmPassword:s(xr.CONFIRM_PASSWORD)}},layoutTemplate:()=>(0,$.jsx)(Gbe,{resetEmail:t})}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(nX,{href:c,children:s(xr.BACK_TO_LOGIN)})})]}):_?(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)(sY,{children:s(xr.SUCCESS_TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(xr.SUCCESS_MESSAGE)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(nX,{href:c,children:s(xr.BACK_TO_LOGIN)})})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(sY,{children:s(xr.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(xr.SUB_TITLE)})]}),(0,$.jsx)(eE,{schema:Wne,defaultValues:{email:``},onSubmit:async e=>{g(!0),l.current?.clearErrors(`root`),p();try{await vc().requestPasswordReset(e.email),v(!0)}catch(e){let t=DM(e);t?d(t.validationErrors):l.current?.setError(`root`,{type:`server`,message:i(e,s(xr.UNEXPECTED_ERROR))})}finally{g(!1)}},onFormReady:m,validationMode:Jc.ON_BLUR,disabled:h,labels:{fields:{email:s(xr.EMAIL_ADDRESS)}},layoutTemplate:Wbe}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(nX,{href:c,children:s(xr.BACK_TO_LOGIN)})})]}):null};function _Z({preset:e=H.DEFAULT,...t}){let n=qc(K.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,`Auth_PasswordLost`)(e);return(0,$.jsx)(n,{...t})}var Kbe=()=>{let[e]=sh(),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)(ZY,{useCardLayout:!0,children:(0,$.jsx)(_Z,{resetToken:t,email:n})})},qbe=[`response_type`,`client_id`,`redirect_uri`,`code_challenge`,`code_challenge_method`,`scope`,`resource`,`state`,`nonce`],vZ=e=>{let{auth:t}=ng(),{tComponent:n,isReady:r}=q({component:K.PUBLIC_LAYOUTS_OAUTH_CONSENT}),[i]=sh(),[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(K.PUBLIC_LAYOUTS_OAUTH_CONSENT,e,t),h=(0,Q.useRef)(!1),g=(0,Q.useMemo)(()=>{let e=new URLSearchParams;for(let t of qbe){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),vc().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(dc.ERROR_INVALID)))}).catch(()=>{e||(o(`error`),u(dc.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 vc().oauthConsentDecision(s.consent_token,e,e===Ze.APPROVE&&d);window.location.assign(t)}catch{h.current=!1,o(`error`),u(dc.ERROR_DECISION)}}},[s,d]);if(!p){let e=td({pathname:za.oauthConsent,search:`?${i.toString()}`});return(0,$.jsx)(Rh,{to:vi(za.login,e),replace:!0})}return a===`loading`||a===`submitting`||!r?(0,$.jsx)(`div`,{className:`py-region flex justify-center`,children:(0,$.jsx)(Jy,{})}):a===`error`||!s?(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:m(l??dc.ERROR_GENERIC)})}):(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs`,children:[(0,$.jsx)(sY,{children:m(dc.TITLE,{clientName:s.client.name})}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:m(dc.SUB_TITLE)})]}),s.scopes.length>0&&(0,$.jsxs)(`div`,{className:`space-y-element`,children:[(0,$.jsx)(Z,{className:`font-medium`,children:m(dc.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(dc.AGENT_ENDPOINT,{resource:s.resource})}),(0,$.jsxs)(`label`,{className:`flex items-center gap-item-xs cursor-pointer`,children:[(0,$.jsx)(CI,{checked:d,onCheckedChange:e=>f(e===!0)}),(0,$.jsx)(Z,{children:m(dc.REMEMBER)})]}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[(0,$.jsx)(Y,{variant:X.OUTLINE,className:`flex-1`,onClick:()=>_(Ze.DENY),children:m(dc.DENY)}),(0,$.jsx)(Y,{variant:X.DEFAULT,className:`flex-1`,onClick:()=>_(Ze.APPROVE),children:m(dc.APPROVE)})]})]})};function yZ({preset:e=H.DEFAULT,...t}){let n=qc(K.PUBLIC_LAYOUTS_OAUTH_CONSENT,`Auth_OAuthConsent`)(e);return(0,$.jsx)(n,{...t})}var Jbe=()=>(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)(ZY,{useCardLayout:!0,children:(0,$.jsx)(yZ,{})})),bZ;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.LINKING=`linking`,e.LINKED=`linked`,e.ERROR=`error`})(bZ||={});var xZ=K.PUBLIC_LAYOUTS_CHAT_IDENTITY_LINK;function SZ(e){return no.createOperationPathKey({resourceIdentifier:Wo.CHAT_IDENTITY_LINKS,operationIdentifier:e,variantType:oe.API_CALL,isOperationDefault:!0,isBulkOperation:!1})}var CZ=e=>{let{auth:t}=ng(),n=t?.accessToken,{tComponent:r,isReady:i,formatDateTime:a}=q({component:xZ}),o=(e,t)=>r(xZ,e,t),{doOperation:s}=fm(),c=cp(),l=ah(),[u,d]=sh(),[f]=(0,Q.useState)(()=>({organizationId:u.get(ca.ORGANIZATION_ID),token:u.get(ca.TOKEN),host:Pae(u.get(ca.HOST))})),p=Rb(f.host),[m,h]=(0,Q.useState)(bZ.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(ca.TOKEN)&&d({},{replace:!0}),!f.organizationId||!f.token){h(bZ.ERROR),y(null);return}let e=!1;return h(bZ.LOADING),x.current(SZ(ar.PREVIEW_LINK),C()).then(t=>{e||(_(t),h(bZ.READY))}).catch(t=>{e||(y(S.current(t)),h(bZ.ERROR))}),()=>{e=!0}},[w,f,C]);let T=(0,Q.useCallback)(async()=>{if(!b.current){b.current=!0,h(bZ.LINKING);try{await x.current(SZ(ar.COMPLETE_LINK),C()),h(bZ.LINKED)}catch(e){b.current=!1,y(S.current(e)),h(bZ.ERROR)}}},[C]),E=m===bZ.LINKED||m===bZ.READY&&g?.standing===ja.LINKED_TO_YOU,D=p.tell;(0,Q.useEffect)(()=>{E&&D(Ib.SUCCEEDED)},[E,D]);let O=(e,t)=>p.hostServed?(0,$.jsx)(Y,{variant:X.OUTLINE,className:t,onClick:()=>{D(E?Ib.SUCCEEDED:Ib.FAILED,{repeat:!0}).then(e=>{e===0&&l(za.home)})},children:o(Jo.CLOSE_HOST_WINDOW)}):(0,$.jsx)(Y,{variant:X.OUTLINE,className:t,onClick:()=>l(za.home),children:o(e)}),k=O(Jo.BACK_TO_APP);if(!n){let e=td({pathname:pn,search:`?${u.toString()}`});return(0,$.jsx)(Rh,{to:vi(za.login,e),replace:!0})}if(!i||m===bZ.LOADING||m===bZ.LINKING)return(0,$.jsxs)(`div`,{className:`py-region flex flex-col items-center gap-element`,children:[(0,$.jsx)(Jy,{}),i&&(0,$.jsx)(Z,{children:o(m===bZ.LINKING?Jo.LINKING:Jo.LOADING)})]});if(m===bZ.ERROR||!g)return(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsx)(sY,{children:o(Jo.ERROR_TITLE)}),(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:v??o(Jo.ERROR_INCOMPLETE_LINK)})}),k]});if(m===bZ.LINKED)return(0,$.jsxs)(`div`,{className:`space-y-group text-center`,children:[(0,$.jsx)(sY,{children:o(Jo.SUCCESS_TITLE)}),(0,$.jsx)(Z,{children:o(Jo.SUCCESS_MESSAGE)}),k]});if(g.standing===ja.LINKED_TO_YOU)return(0,$.jsxs)(`div`,{className:`space-y-group text-center`,children:[(0,$.jsx)(sY,{children:o(Jo.ALREADY_LINKED_TITLE)}),(0,$.jsx)(Z,{children:o(Jo.ALREADY_LINKED)}),k]});if(g.standing===ja.LINKED_TO_ANOTHER_MEMBER)return(0,$.jsxs)(`div`,{className:`space-y-group`,children:[(0,$.jsx)(sY,{children:o(Jo.LINKED_TO_ANOTHER_TITLE)}),(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:o(Jo.LINKED_TO_ANOTHER)})}),k]});let A=g.chatUserDisplayName&&g.workspaceDisplayName?o(Jo.ACCOUNT_NAMED,{chatUser:g.chatUserDisplayName,workspace:g.workspaceDisplayName}):void 0,j=o(Jo.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)(sY,{children:o(Jo.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:o(Jo.INTRO)})]}),(0,$.jsxs)(`dl`,{className:`space-y-item-xs`,children:[(0,$.jsx)(`dt`,{children:(0,$.jsx)(Z,{className:`font-medium`,children:o(Jo.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)(OD,{variant:`warning`,children:(0,$.jsx)(AD,{children:o(Jo.WARNING_NOT_YOURS)})}),(0,$.jsx)(Z,{className:`text-sm`,children:o(Jo.EXPIRES_AT,{expiresAt:a(g.expiresAt)})}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[O(Jo.CANCEL,`flex-1`),(0,$.jsx)(Y,{variant:X.DEFAULT,className:`flex-1`,onClick:T,children:o(Jo.CONFIRM)})]})]})};function wZ({preset:e=H.DEFAULT,...t}){let n=qc(xZ,`Auth_ChatIdentityLink`)(e);return(0,$.jsx)(n,{...t})}var Ybe=()=>(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)(ZY,{useCardLayout:!0,children:(0,$.jsx)(wZ,{})})),TZ=e=>{let{tComponent:t,isReady:n}=q({component:K.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT}),r=ah(),i=e=>t(K.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)(sY,{children:i(gu.TITLE)}),(0,$.jsx)(Z,{className:`text-muted-foreground max-w-sm mx-auto`,children:i(gu.SUB_TITLE)})]}),(0,$.jsx)(Y,{variant:X.DEFAULT,className:`w-full`,onClick:()=>r(za.login),children:i(gu.RETURN_TO_SIGN_IN)})]}):(0,$.jsx)(`div`,{className:`flex justify-center py-section`,children:(0,$.jsx)(Jy,{})})};function EZ({preset:e=H.DEFAULT,...t}){let n=qc(K.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT,`Auth_OAuthLoggedOut`)(e);return(0,$.jsx)(n,{...t})}var Xbe=()=>(0,$.jsx)(ZY,{useCardLayout:!0,children:(0,$.jsx)(EZ,{})}),DZ;(function(e){e.READY=`ready`,e.SUBMITTING=`submitting`,e.ERROR=`error`})(DZ||={});var OZ=e=>{let{tComponent:t,isReady:n}=q({component:K.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM}),[r]=sh(),[i,a]=(0,Q.useState)(DZ.READY),o=e=>t(K.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(DZ.SUBMITTING);try{let{redirect_to:e}=await vc().oauthEndSessionConfirm(s);window.location.assign(e)}catch{c.current=!1,a(DZ.ERROR)}}},[s]),u=(0,Q.useCallback)(()=>{window.location.assign(za.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)(sY,{children:o(Xu.TITLE)}),(0,$.jsx)(Z,{className:`text-muted-foreground max-w-sm mx-auto`,children:o(Xu.SUB_TITLE)})]}),i===DZ.ERROR&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:o(Xu.ERROR)})}),(0,$.jsxs)(`div`,{className:`flex gap-element`,children:[(0,$.jsx)(Y,{variant:X.OUTLINE,className:`flex-1`,disabled:i===DZ.SUBMITTING,onClick:u,children:o(Xu.CANCEL)}),(0,$.jsx)(Y,{variant:X.DEFAULT,className:`flex-1`,disabled:i===DZ.SUBMITTING,onClick:l,children:o(Xu.CONFIRM)})]})]}):(0,$.jsx)(Rh,{to:za.oauthLoggedOut,replace:!0}):(0,$.jsx)(`div`,{className:`flex justify-center py-section`,children:(0,$.jsx)(Jy,{})})};function kZ({preset:e=H.DEFAULT,...t}){let n=qc(K.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM,`Auth_OAuthLogoutConfirm`)(e);return(0,$.jsx)(n,{...t})}var Zbe=()=>(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)(ZY,{useCardLayout:!0,children:(0,$.jsx)(kZ,{})})),AZ=(e,t)=>e.kind===T.RELEASED?`${String(t)}:${e.release.identity.releaseId}@${String(e.release.identity.releaseVersion)}:${e.content.title}`:`${String(t)}:${e.content.title}`,Qbe=({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:G(`max-h-64 overflow-y-auto rounded-md border border-border bg-muted/30 p-element text-sm`,Dg(e_.FIELD)),children:[(0,$.jsx)(`h2`,{className:`font-medium`,children:e.content.title}),e.kind===T.UNRELEASED_DRAFT&&(0,$.jsx)(Z,{role:`note`,className:`mt-element-sm text-xs font-medium`,children:t(Ar.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===vre.NOT_YET_ESTABLISHED&&(0,$.jsx)(Z,{role:`note`,className:`text-xs`,children:`${t(Ar.TERMS_CLAUSE_NOT_ESTABLISHED)} ${e.missingInformation??``}`.trim()})]},e.clauseRef))]},e.sectionRef))]})},jZ=({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:Dd(e.release.identity.document.documentRef),path:ft(e.release),title:e.document?.content.title??Dd(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:Dd(e.kind===T.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(AZ(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)(tX,{href:t,external:!0,target:`_blank`,rel:`noreferrer`,className:`text-sm`,lang:e.content.locale,children:n(K.PUBLIC_LAYOUTS_USER_REGISTER,Ar.TERMS_OPEN_DOCUMENT,{documentTitle:e.content.title})},t)),f.map(({release:e,path:t,title:r,locale:i})=>(0,$.jsx)(tX,{href:t,external:!0,target:`_blank`,rel:`noreferrer`,className:`text-sm`,lang:i,children:n(K.PUBLIC_LAYOUTS_USER_REGISTER,Ar.TERMS_OPEN_DOCUMENT,{documentTitle:r})},e.identity.releaseId))]});if(!ad(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(Ar.TERMS_ACCEPTANCE_IMPLIED)}),g]});let _=a.every(e=>e.document!==void 0)&&a.length>0,v=ie(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(Ar.TERMS_READ_PROMPT)}),d.map((e,n)=>(0,$.jsx)(Qbe,{document:e,t,paneKey:AZ(e,n),onReachedEnd:u},AZ(e,n)))]}),(0,$.jsxs)(`label`,{className:G(`flex items-start gap-element`,y?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(CI,{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(Ar.TERMS_ACCEPTANCE)})]}),(0,$.jsx)(Z,{"aria-live":`polite`,className:`sr-only`,children:v&&h?t(Ar.TERMS_READ_COMPLETE):``}),g]})},$be=60,exe=[mt.PASSWORD,mt.MAGIC_LINK,mt.PASSKEY],MZ=Q.createContext({requiredReleases:[],acceptanceMode:Ws.EXPLICIT_CHECKBOX,requiredDocuments:[],servedDocuments:[],accepted:!1,setAccepted:()=>{},documentsRead:[],markDocumentRead:()=>{},method:mt.PASSWORD}),NZ=({t:e,tComponent:t})=>{let{method:n,...r}=Q.useContext(MZ);return(0,$.jsx)(jZ,{state:r,t:e,tComponent:t})},txe=()=>{let e=Gx(),{formState:t}=LC(),{tComponent:n,isReady:r}=q({component:K.PUBLIC_LAYOUTS_USER_REGISTER}),i=e=>n(K.PUBLIC_LAYOUTS_USER_REGISTER,e),a=e.passwordPolicy??tZ,{requiredReleases:o,acceptanceMode:s,accepted:c,method:l}=Q.useContext(MZ),u=l===mt.PASSWORD;if(!r)return null;let d=u?Ar.REGISTER_BUTTON:l===mt.PASSKEY?Ar.PASSKEY_SIGNUP_BUTTON:Ar.MAGIC_LINK_SIGNUP_BUTTON,f=u?Ar.REGISTERING:Ar.MAGIC_LINK_SIGNUP_SENDING;return(0,$.jsxs)(Zk,{children:[(0,$.jsx)(JL,{name:`email`}),(0,$.jsx)(JL,{name:`firstName`}),(0,$.jsx)(JL,{name:`lastName`}),(0,$.jsx)(JL,{name:`organizationName`}),(e.registrationConfig.additionalProfileQuestions??[]).map(e=>(0,$.jsx)(JL,{name:e.id},e.id)),(0,$.jsx)(JL,{name:`password`}),(0,$.jsx)(JL,{name:`confirmPassword`}),u&&(0,$.jsx)(nZ,{fieldName:`password`,policy:a,t:i}),t.errors.root&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:t.errors.root.message})}),(0,$.jsx)(NZ,{t:i,tComponent:n}),(0,$.jsx)(eO,{label:i(d),submittingLabel:i(f),fullWidth:!0,disabled:o.length>0&&ad(s)&&!c})]})},PZ=({})=>{let{auth:e,initiateOAuth2Login:t}=ng(),{registerAccount:n}=hm(),r=cp(),{appConfig:i}=Su(),[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??Ws.EXPLICIT_CHECKBOX,p=uu(i.compliance),m=(0,Q.useMemo)(()=>(u===null?Are(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(nt.CONTRACT_ACCEPTED)),[i.compliance?.governedDocumentReleases,p,u]),h=(0,Q.useMemo)(()=>m.map(e=>({release:e,document:is(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:mt.EXTERNAL_OAUTH2}),[m,f,h,g,a,s,l]),v=m.length>0&&ad(f)&&!a,y=(0,Q.useMemo)(()=>m.length===0||ad(f)&&!a?[]:m.map(e=>({releaseId:e.identity.releaseId,releaseVersion:e.identity.releaseVersion})),[m,f,a]),b=(0,Q.useCallback)(e=>{if(!Rr(e)||e.customMessageReference!==Lu.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=Gx(),S=rg(),C=(0,Q.useMemo)(()=>x.registrationConfig.allowedMethods.includes(mt.EXTERNAL_OAUTH2)?gX({publicProviders:x.globalAuth?.socialOAuth2Providers}):[],[x.globalAuth?.socialOAuth2Providers,x.registrationConfig.allowedMethods]),w=(0,Q.useMemo)(()=>rb(C.map(e=>e.displayNameLabelKey)),[C]),T=(0,Q.useMemo)(()=>[K.PUBLIC_LAYOUTS_USER_REGISTER,K.PUBLIC_LAYOUTS_USER_AUTH],[]),{t:E,tComponent:D,isReady:O}=q({component:T,keys:w}),k=e=>D(K.PUBLIC_LAYOUTS_USER_REGISTER,e),A=e=>D(K.PUBLIC_LAYOUTS_USER_AUTH,e),j=(0,Q.useMemo)(()=>B(S.search),[S.search]),M=(0,Q.useMemo)(()=>new URLSearchParams(S.search).get(`email`)?.trim()??``,[S.search]),N=(0,Q.useMemo)(()=>vi(za.login,j),[j]),P=(0,Q.useMemo)(()=>Xt(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]),L=(0,Q.useRef)(null),{initAutoClearing:R,injectServerErrors:z,clearServerErrors:ee}=YR(L),te=(0,Q.useCallback)(e=>{L.current=e,R(e)},[R]),[ne,V]=(0,Q.useState)(!1),[re,ie]=(0,Q.useState)(null),[ae,oe]=(0,Q.useState)(``);oX({mfaRequired:re===Np.MFA_ENROLLMENT_REQUIRED&&e.mfaRequired,mfaSessionId:e.mfaSessionId,usableSecondFactorMethods:e.usableSecondFactorMethods,email:ae,authRedirectTarget:j});let[se,ce]=(0,Q.useState)(`idle`),[le,ue]=(0,Q.useState)(0),[de,fe]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(le<=0)return;let e=setInterval(()=>{ue(t=>t<=1?(clearInterval(e),0):t-1)},1e3);return()=>clearInterval(e)},[le]);let pe=(0,Q.useCallback)(async()=>{if(!(!ae||le>0)){ce(`sending`),fe(null);try{await vc().resendVerificationEmail(ae),ce(`sent`),ue($be)}catch(e){ce(`error`),fe(r(e,k(Ar.UNEXPECTED_ERROR)))}}},[ae,le]),me=(0,Q.useMemo)(()=>x.passwordPolicy??tZ,[x.passwordPolicy]),he=(0,Q.useMemo)(()=>{if(!x.resolvedUserType)return!1;let e=yre(i.organizationTypes,x.resolvedUserType);return e.length===1&&e[0]?.definition.creationPolicy?.orgNameSource===Ee.ASK},[i.organizationTypes,x.resolvedUserType]),ge=(0,Q.useMemo)(()=>x.registrationConfig,[x.registrationConfig]).allowedMethods,_e=(0,Q.useMemo)(()=>exe.filter(e=>ge.includes(e)),[ge]),[ve,ye]=(0,Q.useState)(null),be=ve!==null&&_e.includes(ve)?ve:_e[0]??null,xe=_e.filter(e=>e!==be),Se=be!==null,Ce=Se&&be!==null,we=be===mt.PASSWORD,Te=F&&Se,De=x.registrationConfig.additionalProfileQuestions??[],Oe=x.registrationConfig.profileNamesCollectedAt!==Eu.ONBOARDING,ke=(0,Q.useMemo)(()=>{let e={};for(let t of De){let n=t.type===sd.RATING?Pd():md().min(1);e[t.id]=t.required?n:n.optional()}let t=Hee.extend(e),n=Oe?t:t.omit({firstName:!0,lastName:!0}),r=he?n:n.omit({organizationName:!0});return we?r.refine(e=>!e.password||e.password===e.confirmPassword,{message:k(Ar.PASSWORD_MISMATCH),path:[`confirmPassword`]}):r.omit({password:!0,confirmPassword:!0})},[k,he,we,De,Oe]),Ae=Rp(e,j);if(Ae)return(0,$.jsx)(Rh,{to:Ae,replace:!0});if(!O)return null;if(re===Np.SIGNED_IN)return e.accessToken?(0,$.jsx)(Rh,{to:P,replace:!0}):null;if(re===Np.MFA_ENROLLMENT_REQUIRED)return null;if(re!==null){let e=re===Np.SSO_REDIRECT_REQUIRED,t=e?Ar.SSO_REGISTRATION_TITLE:Ar.SUCCESS_TITLE,n=e?Ar.SSO_REGISTRATION_MESSAGE:re===Np.UNFINISHED?Ar.REGISTRATION_UNFINISHED:re===Np.MAGIC_LINK_SENT?Ar.MAGIC_LINK_SENT_MESSAGE:re===Np.PASSKEY_ENROLLMENT_PENDING?Ar.PASSKEY_ENROLLMENT_PENDING_MESSAGE:Ar.SUCCESS_MESSAGE,r=re===Np.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)(sY,{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(Ar.RESEND_PROMPT),` `,(0,$.jsx)(Y,{variant:X.LINK,className:`p-0 h-auto text-sm`,onClick:pe,disabled:se===`sending`||le>0,children:se===`sending`?k(Ar.RESEND_SENDING):le>0?`${k(Ar.RESEND_COOLDOWN)} (${le}s)`:k(Ar.RESEND_LINK)})]}),se===`sent`&&(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:k(Ar.RESEND_SUCCESS)})}),se===`error`&&de&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:de})})]}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsx)(nX,{href:N,children:k(Ar.SIGNIN_LINK)})})]})}let je=async e=>{V(!0),L.current?.clearErrors(`root`),ee();let t=be??mt.PASSWORD;if(t===mt.PASSWORD&&e.password){let t=Ue.validatePasswordAgainstPolicy(e.password,me);if(!t.valid){L.current?.setError(`root`,{type:`policy`,message:iZ(t.violations,k,me).join(`. `)}),V(!1);return}}try{let r=await n({email:e.email,...Oe?{firstName:e.firstName,lastName:e.lastName}:{},password:t===mt.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}:{}});oe(e.email),ie(r)}catch(e){b(e);let t=DM(e);if(t)z(t.validationErrors);else{let t=aZ(e,k,me);L.current?.setError(`root`,{type:`server`,message:t??r(e,k(Ar.UNEXPECTED_ERROR))})}}finally{V(!1)}};return!F&&!Se?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(sY,{children:k(Ar.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:k(Ar.REGISTRATION_DISABLED)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(nX,{href:N,children:k(Ar.SIGNIN_LINK)})})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`text-center space-y-item-xs mb-group`,children:[(0,$.jsx)(sY,{children:k(Ar.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:k(Ar.SUB_TITLE)})]}),C.length>0&&m.length>0&&!Ce&&(0,$.jsx)(MZ.Provider,{value:_,children:(0,$.jsx)(NZ,{t:k,tComponent:D})}),(0,$.jsx)(yX,{providers:C,onProviderClick:I,isLoading:ne||e.isLoading,disabled:v,continueWithLabel:k(Ar.CONTINUE_WITH),translate:E,dividerLabel:k(Ar.DIVIDER_OR),showDivider:Te}),Se&&be!==null&&(0,$.jsx)(MZ.Provider,{value:{requiredReleases:m,acceptanceMode:f,requiredDocuments:h,servedDocuments:g,accepted:a,setAccepted:o,documentsRead:s,markDocumentRead:l,method:be},children:(0,$.jsx)(eE,{schema:ke,defaultValues:{email:M,...Oe&&{firstName:``,lastName:``},...he&&{organizationName:``},...we&&{password:``,confirmPassword:``}},onSubmit:je,onFormReady:te,validationMode:Jc.ON_BLUR,disabled:ne,layoutTemplate:txe,labels:{fields:{email:k(Ar.EMAIL_ADDRESS),...Oe&&{firstName:k(Ar.FIRST_NAME),lastName:k(Ar.LAST_NAME)},...he&&{organizationName:k(Ar.ORGANIZATION_NAME)},...we&&{password:k(Ar.PASSWORD),confirmPassword:k(Ar.CONFIRM_PASSWORD)}}}},be)}),xe.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(mX,{label:A(Hr.OTHER_METHODS_DIVIDER)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground text-center mb-element`,children:k(Ar.METHOD_CHOICE_HINT)}),(0,$.jsx)(wX,{methods:xe,labelFor:e=>uX(e,{socialProviders:C,continueWithTemplate:A(Hr.CONTINUE_WITH),translateLabel:e=>A(e),resolveSocialProviderLabel:e=>hX({providerRef:e.providerRef,displayName:e.displayName,displayNameLabelKey:e.displayNameLabelKey,brandLabel:_X[e.providerRef]?.label,translate:E})}),onSelect:ye,disabled:ne})]}),(0,$.jsx)(`div`,{className:`text-center mt-group`,children:(0,$.jsxs)(Z,{className:`text-sm`,children:[k(Ar.ALREADY_HAVE_ACCOUNT),` `,(0,$.jsx)(tX,{href:N,children:k(Ar.SIGNIN_LINK)})]})})]})};function nxe({mode:e}){let t=rg(),{tComponent:n,isReady:r}=q({component:K.PUBLIC_LAYOUTS_USER_REGISTER}),i=(0,Q.useMemo)(()=>B(t.search),[t.search]),a=(0,Q.useMemo)(()=>vi(za.login,i),[i]);if(!r)return null;let o=e===We.INVITATION_ONLY?Ar.INVITATION_ONLY:e===We.ADMIN_ONLY?Ar.ADMIN_ONLY:Ar.REGISTRATION_DISABLED,s=e=>n(K.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)(sY,{children:s(Ar.TITLE)}),(0,$.jsx)(Z,{className:`max-w-sm mx-auto`,children:s(o)})]}),(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(nX,{href:a,children:s(Ar.SIGNIN_LINK)})})]})}function FZ({preset:e=H.DEFAULT,...t}){let{auth:n}=ng(),r=Gx(),i=rg(),a=(0,Q.useMemo)(()=>Xt(i.search),[i.search]);if(n.accessToken)return(0,$.jsx)(Rh,{to:a,replace:!0});if(!r.registrationConfig.publicRegistrationAvailable)return(0,$.jsx)(nxe,{mode:r.registrationConfig.mode});let o=qc(K.PUBLIC_LAYOUTS_USER_REGISTER,`Auth_Register`)(e);return(0,$.jsx)(o,{...t})}var rxe=()=>(0,$.jsx)(ZY,{useCardLayout:!0,children:(0,$.jsx)(FZ,{})});function IZ({preset:e=H.DEFAULT,...t}){let n=qc(K.PUBLIC_LAYOUTS_TERMS,`PublicLayout_Terms`)(e);return(0,$.jsx)(n,{...t})}function LZ({preset:e=H.DEFAULT,...t}){let n=qc(K.PUBLIC_LAYOUTS_LEGAL_NOTICE,`PublicLayout_LegalNotice`)(e);return(0,$.jsx)(n,{...t})}function ixe(){let{on:e}=Uo(),{navigate:t}=yS(),{registry:n}=fm(),r=ah();return(0,Q.useEffect)(()=>e(hc.NAVIGATION_REQUEST,e=>{let i;e.operationRef?i=Hm.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 RZ(e){let t=(0,Q.useSyncExternalStore)(Hm.subscribeToTransactionState,Hm.getTransactionEpoch,Hm.getTransactionEpoch),n=(0,Q.useCallback)(()=>void 0,[]);return{retryTick:t,scheduleRetry:n,clearRetry:n}}function zZ(){let e=rg(),t=(0,Q.useContext)(Wse)?.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 BZ(e){let t=zZ();return t.pathname!==e.pathname||t.search!==e.search}function axe(e,t,n){let r=rg(),i=BZ(r),a=Rm(),{registry:o}=fm(),{emit:s}=Uo(),{getZoneState:c,contentAreaWidth:l}=kx(),u=Zp(),d=aS(),{navigationLayout:f,currentBreakpoint:p}=Ng(),m=(0,Q.useMemo)(()=>Hm.buildBrowserUrl(r.pathname,r.search),[r.pathname,r.search]),h=(0,Q.useMemo)(()=>u?.buildContextResourceIdentifiers?.()??{},[u]),g=(0,Q.useMemo)(()=>U.buildContextResourceIdentifiersKey(h),[h]),_=(0,Q.useRef)(null),{retryTick:v,scheduleRetry:y,clearRetry:b}=RZ(m),x=(0,Q.useMemo)(()=>{if(!e||!t)return[];let n=o.resourceConfigurations?.[e];return n?Tl.buildOperationFrontendRoutePaths(n,t,o.allResourceFieldIdentifiers).map(e=>e.url):[]},[e,t,o]);(0,Q.useEffect)(()=>{if(!e||!t)return;if(Fx(`useRouterSync: effect fired`,{resourceType:e,operationId:t.operationIdentifier,locationPathname:r.pathname,lastSyncedPath:_.current,routePatternsCount:x.length}),Hm.isInTransaction()){Fx(`useRouterSync: SKIP — navigation transaction active`,{source:Hm.getTransactionSource()}),y();return}if(b(),i){Fx(`useRouterSync: SKIP — the router is ahead of the committed location`,{committedUrl:m});return}if(_.current===m){Fx(`useRouterSync: SKIP — already synced this path`,{currentBrowserUrl:m});return}if(x.length>0&&!x.some(e=>Hm.matchUrlPattern(e,r.pathname))){Fx(`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?kn.buildParentResourcesRequirementsFromRouteParams(n,e,o):[],S=f?.zones,C=!!S?.secondary,w=!!S?.companion,T=Hm.calculateResourceRelationshipDepth(v),E=T===0&&C&&t!==void 0&&Hm.layoutSplitsOperationFromPrimary(f,t,p),D=Hm.resolveResourceTargetZone(T,{hasSecondary:C,hasCompanion:w,prefersAdjacentZoneForDetail:E}),O=T>=1&&D!==ql.PRIMARY&&zx({content:{contentType:Sa.RESOURCE_OPERATION,resourceContext:kn.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:t,contextResourceIdentifiers:{},parentResourcesRequirements:v})},paneZone:D,layout:f,registry:o,viewport:p,contentAreaWidth:l})?ql.PRIMARY:D,k=Hh({zone:O,layout:f,viewport:p,contentAreaWidth:l})?O:ql.PRIMARY;k!==O&&Fx(`useRouterSync: adjacent zone is collapsed at this viewport — restoring into PRIMARY`,{preferredZone:O,viewport:p,contentAreaWidth:l});let A=Hm.zoneOwnsBrowserUrl(k,m,c);if(Fx(`useRouterSync: checking guards`,{currentBrowserUrl:m,targetZone:k,targetZoneOwnsUrl:A,targetZoneTopUrlPath:Hm.getTopEntry(c(k))?.urlPath}),A){Fx(`useRouterSync: SKIP — target zone already owns current URL`,{targetZone:k}),_.current=m;return}let j=Hm.findStructuralRouteOwner(m,c);if(j&&j.zone!==k){Fx(`useRouterSync: SKIP — another structural zone already shows this destination`,{owningZone:j.zone,targetZone:k,currentBrowserUrl:m}),_.current=m;return}let M=kn.extractResourceIdentifiersFromUrlParams(a,o,n),N=tm.buildResourceOperationContextIdentifiers({currentUserId:u?.currentUserId,currentOrganizationId:u?.currentOrganizationId,currentApplicationId:u?.currentApplicationId,currentAnonymousUserId:u?.currentAnonymousUserId,primaryScope:g,liveAppScopeContextResourceIdentifiers:h,explicitContextResourceIdentifiers:M}),P=kn.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:t,contextResourceIdentifiers:N,parentResourcesRequirements:v}),F={contentType:Sa.RESOURCE_OPERATION,resourceContext:P},I=Hm.generateStackEntryId();Fx(`useRouterSync: EMITTING NAVIGATION_REPLACE (URL_SYNC)`,{resourceType:e,operationId:t.operationIdentifier,currentBrowserUrl:m,mergedContextIdentifiers:N,depth:T,targetZone:k}),T>=1&&Hm.beginTransaction(`url_reverse_cascade`);let L=k!==O,R=qle({content:F,paneZone:O,placedZone:k,layout:f,registry:o,viewport:p,contentAreaWidth:l});if(L&&E&&O===ql.SECONDARY&&Hx({resourceType:e,contextResourceIdentifiers:N,parentResourcesRequirements:v,registry:o,emit:s,getZoneState:c}),s(L?hc.NAVIGATION_PUSH:hc.NAVIGATION_REPLACE,{zone:k,content:F,urlPath:m,stackEntryId:I,initiator:{sourceZone:k},navigationSource:Gt.URL_SYNC,transition:Mo.REPLACE,...L?{collapsedFromZone:O}:{},...R?{persistent:!0}:{}}),E&&k===ql.SECONDARY&&Hx({resourceType:e,contextResourceIdentifiers:N,parentResourcesRequirements:v,registry:o,emit:s,getZoneState:c}),T>=1){let e=ku(N);Wx(F,k,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 VZ(e,t){let n=rg(),r=BZ(n),{emit:i}=Uo(),{getZoneState:a}=kx(),{registry:o}=fm(),{fullCustomViews:s,flowsActorsViews:c}=Ng(),l=(0,Q.useRef)(null),u=Hm.buildBrowserUrl(n.pathname,n.search),{retryTick:d,scheduleRetry:f,clearRetry:p}=RZ(u);(0,Q.useEffect)(()=>{if(!e)return;if(Hm.isInTransaction()){f();return}if(p(),r||l.current===u)return;if(Hm.zoneOwnsBrowserUrl(ql.PRIMARY,u,a)){l.current=u;return}let d,m=t===Sa.COMPOSITE_VIEW?Pp(new URLSearchParams(n.search)):void 0,h=t===Sa.CHART_VIEW?Gp(new URLSearchParams(n.search)):void 0,g=t===Sa.CHART_VIEW?Up(new URLSearchParams(n.search)):void 0,_=t===Sa.EXECUTION_VIEW?lm(new URLSearchParams(n.search)):void 0,v=t===Sa.FULL_CUSTOM_VIEW?s?.find(t=>t.ref===e):void 0,y=t===Sa.FLOWS_ACTORS_VIEW?c?.find(t=>t.ref===e):void 0,b=t===Sa.EXECUTION_VIEW?Dp({viewRef:e,registry:o}):void 0;switch(t){case Sa.COMPOSITE_VIEW:d={contentType:Sa.COMPOSITE_VIEW,viewRef:e,contextResourceIdentifiers:m,linkedConversationId:new URLSearchParams(n.search).get(`conversation`)??void 0};break;case Sa.CHART_VIEW:d={contentType:Sa.CHART_VIEW,viewRef:e,contextResourceIdentifiers:h,urlParamValues:g};break;case Sa.FULL_CUSTOM_VIEW:if(!v)return;d={contentType:Sa.FULL_CUSTOM_VIEW,viewRef:e,fullCustomComponentRef:v.componentRef};break;case Sa.FLOWS_ACTORS_VIEW:if(!y)return;d={contentType:Sa.FLOWS_ACTORS_VIEW,viewRef:e,flowsActorsSystemRef:y.systemRef,linkedConversationId:new URLSearchParams(n.search).get(`conversation`)??void 0};break;case Sa.EXECUTION_VIEW:if(!b||b.isAddressable!==!0)return;d={contentType:Sa.EXECUTION_VIEW,viewRef:e,contextResourceIdentifiers:_};break;default:return}let x=Hm.generateStackEntryId();Fx(`useViewRouterSync: EMITTING NAVIGATION_REPLACE (URL_SYNC)`,{viewRef:e,contentType:t,locationPathname:n.pathname,locationSearch:n.search}),i(hc.NAVIGATION_REPLACE,{zone:ql.PRIMARY,content:d,urlPath:Hm.decomposeHostedPaneBrowserUrl(u).hostUrl,stackEntryId:x,initiator:{sourceZone:ql.PRIMARY},navigationSource:Gt.URL_SYNC,transition:Mo.REPLACE}),l.current=u},[e,t,i,a,s,c,o,u,r,d,f,p])}function oxe(e){let t=rg(),n=BZ(t),{emit:r}=Uo(),{getZoneState:i}=kx(),a=(0,Q.useRef)(null),o=Hm.buildBrowserUrl(t.pathname,t.search),{retryTick:s,scheduleRetry:c,clearRetry:l}=RZ(o);(0,Q.useEffect)(()=>{if(!e)return;if(Hm.isInTransaction()){c();return}if(l(),n||a.current===o)return;if(Hm.zoneOwnsBrowserUrl(ql.PRIMARY,o,i)){a.current=o;return}let t=Hm.generateStackEntryId();r(hc.NAVIGATION_REPLACE,{zone:ql.PRIMARY,content:{contentType:Sa.ENGINE_PAGE,pageRef:e},urlPath:Hm.decomposeHostedPaneBrowserUrl(o).hostUrl,stackEntryId:t,initiator:{sourceZone:ql.PRIMARY},navigationSource:Gt.URL_SYNC,transition:Mo.REPLACE}),a.current=o},[e,r,i,o,n,s,c,l])}function sxe(){let e=zZ(),{emit:t}=Uo(),{getZoneState:n}=kx(),r=(0,Q.useRef)(null),i=Hm.buildBrowserUrl(e.pathname,e.search),{retryTick:a,scheduleRetry:o,clearRetry:s}=RZ(i);(0,Q.useEffect)(()=>{if(Hm.isInTransaction()){o();return}if(s(),r.current===i)return;if(HZ(e.pathname).isSettings){r.current=i;return}let a=Hm.findStructuralStackEntryOwningUrl(i,n);if(a?.isTop){if(a.searchDiffers){let{hostUrl:e,paneUrl:r}=Hm.decomposeHostedPaneBrowserUrl(i),o=r===void 0?[{zone:a.zone,entry:a.entry,urlPath:i}]:[{zone:ql.PRIMARY,entry:Hm.getTopEntry(n(ql.PRIMARY)),urlPath:e},{zone:ql.SECONDARY,entry:a.entry,urlPath:r}];for(let e of o)e.entry&&e.entry.urlPath!==e.urlPath&&(Fx(`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)Fx(`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(ud.some(e=>n(e).stack.length>0)){Fx(`useStructuralZoneBackForwardSync: clearing structural zones for URL rebuild`,{currentUrl:i}),Hm.beginTransaction(`backforward_url_rebuild`);for(let e of ud)t(hc.NAVIGATION_CLEAR_ZONE,{zone:e})}r.current=i}},[i,e.pathname,t,n,a,o,s])}function cxe(){let e=zZ(),{emit:t}=Uo(),{getZoneState:n}=kx(),{registry:r}=fm(),i=Zp(),a=(0,Q.useRef)(null),o=Hm.buildBrowserUrl(e.pathname,e.search),{retryTick:s,scheduleRetry:c,clearRetry:l}=RZ(o),u=(0,Q.useMemo)(()=>i?.buildContextResourceIdentifiers?.()??{},[i]);(0,Q.useEffect)(()=>{if(Hm.isInTransaction()){c();return}if(l(),a.current===o)return;if(HZ(e.pathname).isSettings){a.current=o;return}let{paneUrl:s}=Hm.decomposeHostedPaneBrowserUrl(o),d=n(ql.SECONDARY),f=Hm.getTopEntry(d);if(s===void 0){f?.hostedPane&&(Fx(`useHostedPaneRouteSync: pane left the URL — clearing SECONDARY`,{currentUrl:o}),t(hc.NAVIGATION_CLEAR_ZONE,{zone:ql.SECONDARY})),a.current=o;return}if(f?.hostedPane&&Hm.urlsAddressSameDestination(f.urlPath,s)){a.current=o;return}let p=Hm.getTopEntry(n(ql.PRIMARY));if(Hm.isHeldHostedPane(p)&&Hm.urlsAddressSameDestination(p?.urlPath,s)){a.current=o;return}let m=[...d.stack].reverse().find(e=>e.hostedPane&&Hm.urlsAddressSameDestination(e.urlPath,s));if(m){Fx(`useHostedPaneRouteSync: POP to a buried pane`,{toStackEntryId:m.id,paneUrl:s}),t(hc.NAVIGATION_POP,{zone:ql.SECONDARY,toStackEntryId:m.id}),a.current=o;return}let h=Hm.resolveResourceRouteForUrl(s,r);if(!h){Fx(`useHostedPaneRouteSync: pane URL matches no addressable resource route — ignored`,{paneUrl:s}),a.current=o;return}let g=kn.buildParentResourcesRequirementsFromRouteParams(h.routePathParameters,h.resourceType,r),_=kn.extractResourceIdentifiersFromUrlParams(h.urlParameters,r,h.routePathParameters),v=r.resourceConfigurations?.[h.resourceType]?.resourcePrimaryScope,y=tm.buildResourceOperationContextIdentifiers({currentUserId:i?.currentUserId,currentOrganizationId:i?.currentOrganizationId,currentApplicationId:i?.currentApplicationId,currentAnonymousUserId:i?.currentAnonymousUserId,primaryScope:v,liveAppScopeContextResourceIdentifiers:u,explicitContextResourceIdentifiers:_}),b=kn.createFrontendResourceOperationContextFromOperation({resourceType:h.resourceType,operation:h.operation,contextResourceIdentifiers:y,parentResourcesRequirements:g});Fx(`useHostedPaneRouteSync: EMITTING NAVIGATION_REPLACE (URL_SYNC) for the hosted pane`,{paneUrl:s,resourceType:h.resourceType,operationId:h.operation.operationIdentifier}),t(hc.NAVIGATION_REPLACE,{zone:ql.SECONDARY,content:{contentType:Sa.RESOURCE_OPERATION,resourceContext:b},urlPath:s,stackEntryId:Hm.generateStackEntryId(),initiator:{sourceZone:ql.PRIMARY},navigationSource:Gt.URL_SYNC,transition:Mo.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 HZ(e){if(e===za.settings)return{isSettings:!0};let t=`${za.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 lxe(){let e=zZ(),{emit:t}=Uo(),{state:n}=kx(),{retryTick:r,scheduleRetry:i,clearRetry:a}=RZ(e.pathname),o=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(Hm.isInTransaction()){i();return}a();let{isSettings:r,sectionRef:s,subTabRef:c}=HZ(e.pathname),l=n.overlay,u=l.length>0?l[l.length-1]:void 0,d=!1,f,p;if(u&&u.content.contentType===Sa.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:Gn.OVERLAY,content:{contentType:Sa.SETTINGS_HUB,sectionRef:s,subTabRef:c},urlPath:Hm.buildBrowserUrl(e.pathname,e.search),stackEntryId:Hm.generateStackEntryId(),initiator:{sourceZone:Gn.OVERLAY},navigationSource:Gt.URL_SYNC,transition:Mo.OVERLAY,appearance:Qo.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:Gn.OVERLAY})}else o.current=null},[e.pathname,e.search,t,n.overlay,r,i,a])}var UZ=({viewRef:e,viewDefinition:t,contextResourceIdentifiers:n,navigationZone:r=Gn.PRIMARY})=>{let{fullCustomViews:i}=Ng(),a=Zp(),o=t??(e?i?.find(t=>t.ref===e):void 0);(0,Q.useEffect)(()=>{},[n,o,e]);let s=(0,Q.useMemo)(()=>{let e=tm.buildInitiatorIds({userId:a?.currentUserId,organizationId:a?.currentOrganizationId,applicationId:a?.currentApplicationId,anonymousUserId:a?.currentAnonymousUserId}),t=o?.primaryScope?tm.primaryScopeToContextIdentifiers(e,o.primaryScope):{},r=a?.buildContextResourceIdentifiers()??{},i=tm.filterCustomScopeContextResourceIdentifiers(r);return o?tm.resolveViewContextResourceIdentifiers({surfaceName:`FullCustomView`,surfaceRef:o.ref,primaryScope:o.primaryScope,parentResourcesRequirements:o.parentResourcesRequirements,additionalResourceRequirements:o.additionalResourceRequirements,primaryScopeContext:t,customScopeContext:i,explicitContextResourceIdentifiers:n}):tm.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)(a_,{viewKind:`full-custom`,viewRef:e});let c=Ko.resolve(o.componentRef,H.DEFAULT);return c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(IY,{viewRef:o.ref,contentType:Sa.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)(rl,{componentType:o.componentRef,componentName:o.componentRef})},WZ;(function(e){e.TURN=`turn`,e.TOOL=`tool`,e.REASONING=`reasoning`,e.HOST=`host`})(WZ||={});var GZ;(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`})(GZ||={});function KZ(e,t){return[...e??[],t]}function uxe(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 qZ=new Set([dd.TEXT,dd.MARKDOWN]);function JZ(e){if(e==null)return 1/0;let t=new Date(e).getTime();return Number.isNaN(t)?1/0:t}function dxe(e){if(e.role===Ai.TOOL){let t=mn.safeParse(e.data);return t.success?{kind:WZ.TOOL,key:`tool:${t.data.toolCallId}`,trace:t.data,fromRecordOnly:!0}:null}if(e.role!==Ai.USER&&e.role!==Ai.ASSISTANT)return null;if(e.contentType===dd.REASONING)return{kind:WZ.REASONING,key:`reasoning:${e.id}`,content:e.content};if(e.contentType!==void 0&&!qZ.has(e.contentType))return null;let t=he.safeParse(e.data).data?.sources;return{kind:WZ.TURN,key:`message:${e.id}`,storedMessageId:e.id,role:e.role,content:e.content,markdown:e.role===Ai.ASSISTANT||e.contentType===dd.MARKDOWN,...t&&t.length>0?{sources:t}:{}}}var YZ;(function(e){e.NONE=`none`,e.REASONING=`reasoning`,e.TOOL=`tool`,e.REPLY=`reply`})(YZ||={});function fxe(e,t){let n=new Set(t.map(e=>e.id)),r=new Set(t.flatMap(e=>{let t=e.role===Ai.TOOL?mn.safeParse(e.data):null;return t?.success?[t.data.toolCallId]:[]})),i=e.status===uW.RUNNING||e.status===uW.STARTING,a=new Map,o=new Map,s=new Map,c=YZ.NONE;e.messages.forEach((t,r)=>{let i=t.messageId??`${e.executionId}:${r}`;if(t.type===dd.REASONING){let e=a.get(i)??{id:i,content:``,sources:[]};e.content+=t.content,a.set(i,e),n.has(i)||(c=YZ.REASONING)}else if(t.type===dd.PROGRESS){let e=mn.safeParse(t.data);if(!e.success)return;s.set(e.data.toolCallId,{...s.get(e.data.toolCallId),...e.data}),c=YZ.TOOL}else if(qZ.has(t.type)){let e=o.get(i)??{id:i,content:``,sources:[]};e.content+=t.content,e.sources.push(...he.safeParse(t.data).data?.sources??[]),o.set(i,e),n.has(i)||(c=YZ.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:WZ.REASONING,key:`live-reasoning:${e.id}`,content:e.content,streaming:i&&t===u.length-1&&c===YZ.REASONING}));let p=new Map;for(let e of s.values())r.has(e.toolCallId)?p.set(e.toolCallId,e):f.push({kind:WZ.TOOL,key:`tool:${e.toolCallId}`,trace:e});return d.forEach((e,t)=>f.push({kind:WZ.TURN,key:`live-reply:${e.id}`,role:Ai.ASSISTANT,content:e.content,markdown:!0,...i&&t===d.length-1&&c===YZ.REPLY?{streaming:!0}:{},...e.sources.length>0?{sources:e.sources}:{}})),{entries:f,calls:[...s.values()],recordedCallUpdates:p,activity:c}}function pxe(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if((n.role===Ai.USER||n.role===Ai.ASSISTANT)&&(n.contentType===void 0||qZ.has(n.contentType)))return n.role}}function XZ(e){let t=e.thread?.messages??[],n=[],r=new Map;for(let e of t){let t=dxe(e);if(t){if(t.kind===WZ.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:JZ(e.createdAt),entry:t})}}let i=e.live,a=i?fxe(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 uxe(e.sent,new Set(t.map(e=>e.id))))n.push({at:r.sentAt.getTime(),entry:{kind:WZ.TURN,key:`sent-pending:${r.id}`,role:Ai.USER,content:r.text,markdown:!1,pending:!0}});let o=(e.hostEntries??[]).map((e,t)=>({at:JZ(e.at),index:t,entry:{kind:WZ.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===Do.AWAITING_APPROVAL&&r&&e.thread?.pendingApproval!==void 0)return{entries:s,turnState:GZ.AWAITING_DECISION,activeExecutionId:r,stoppable:!1};let i=e.thread?.failureCode;return n===Do.FAILED&&i!==void 0?{entries:s,turnState:GZ.FAILED,stoppable:!1,recoverable:!1,errorCode:i}:n===Do.FAILED&&pxe(t)===Ai.USER?{entries:s,turnState:GZ.INTERRUPTED,stoppable:!1}:n===Do.CANCELLED?{entries:s,turnState:GZ.STOPPED,stoppable:!1}:{entries:s,turnState:GZ.IDLE,stoppable:!1}}switch(s.push(...a.entries),i.status){case uW.STARTING:case uW.RUNNING:{if(a.activity===YZ.REPLY)return{entries:s,turnState:GZ.ANSWERING,activeExecutionId:i.executionId,stoppable:!0};let e=a.activity===YZ.TOOL?a.calls.at(-1):void 0;return{entries:s,turnState:GZ.WORKING,activeExecutionId:i.executionId,stoppable:!0,...e?.phase===Ste.CALL?{currentCall:e}:{}}}case uW.AWAITING_APPROVAL:return{entries:s,turnState:GZ.AWAITING_DECISION,activeExecutionId:i.executionId,stoppable:!1,...i.errorCode?{errorCode:i.errorCode}:{}};case uW.CANCELLED:return{entries:s,turnState:GZ.STOPPED,stoppable:!1};case uW.ERROR:return{entries:s,turnState:GZ.FAILED,stoppable:!1,recoverable:i.recoverable===!0,...i.errorCode?{errorCode:i.errorCode}:{}};case uW.IDLE:case uW.COMPLETED:return{entries:s,turnState:GZ.IDLE,stoppable:!1}}}function ZZ(e){if(!e.beyondPages?.length)return e.threads;let t=new Set(e.threads.map(e=>e.executionId));return rQ([...e.threads,...e.beyondPages.filter(e=>!t.has(e.executionId))])}function QZ(e){return(e.beyondPages??[]).map(e=>e.executionId)}function $Z(e,t){let n=new Set(t.map(e=>e.executionId)),r=(e??[]).filter(e=>!n.has(e.executionId));return r.length>0?{beyondPages:r}:{}}function eQ(e,t){if(e.threads.some(e=>e.executionId===t.executionId))return{...e,threads:e.threads.map(e=>e.executionId===t.executionId?t:e)};let n=(e.beyondPages??[]).filter(e=>e.executionId!==t.executionId);return{...e,beyondPages:[...n,t]}}function tQ(e,t){let n=e.threads.filter(e=>e.executionId!==t);return{threads:n,hasOlder:e.hasOlder,...$Z(e.beyondPages?.filter(e=>e.executionId!==t),n)}}function nQ(e){return new Date(e.createdAt).getTime()}function rQ(e){return[...e].sort((e,t)=>nQ(t)-nQ(e))}function iQ(e,t){if(!t.hasOlder)return{threads:rQ(t.executions),hasOlder:!1};let n=Math.min(...t.executions.map(nQ)),r=new Set(t.executions.map(e=>e.executionId)),i=e.threads.filter(e=>nQ(e)<n&&!r.has(e.executionId)),a=rQ([...t.executions,...i]);return{threads:a,hasOlder:i.length>0?e.hasOlder:!0,...$Z(e.beyondPages,a)}}function aQ(e,t){let n=new Map(e.threads.map(e=>[e.executionId,e]));for(let e of t.executions)n.set(e.executionId,e);let r=rQ(n.values());return{threads:r,hasOlder:t.hasOlder,...$Z(e.beyondPages,r)}}function oQ(e){let t=e.threads.at(-1);return t?new Date(t.createdAt).toISOString():void 0}async function sQ(e){let t=await e();if(!t)return;let n=iQ({threads:[],hasOlder:!1},t);for(;n.hasOlder;){let t=oQ(n),r=await e(t?{before:t}:void 0);if(!r)return;let i=aQ(n,r);if(i.threads.length===n.threads.length)break;n=i}return n.threads}var cQ=rc(K.LOW_LEVEL_AI_CONVERSATION_THREAD,`AI_ConversationThread`,[`Composer`,`Discussions`]);function lQ({preset:e=H.DEFAULT,...t}){let n=cQ(e);return(0,$.jsx)(n,{...t})}function uQ({preset:e=H.DEFAULT,...t}){let n=cQ(e);return(0,$.jsx)(n.Composer,{...t})}function dQ({preset:e=H.DEFAULT,...t}){let n=cQ(e);return(0,$.jsx)(n.Discussions,{...t})}var fQ=new Map;function pQ(e,t,n,r){return`${e??``}\u0000${t}\u0000${n}\u0000${r}`}function mxe(e){return fQ.get(e)??null}var mQ=new Set;function hxe(e,t){return`${e??``}\u0000${t}`}function gxe(e){return mQ.has(e)}function _xe(e){mQ.add(e)}function vxe(e,t){t?fQ.set(e,t):fQ.delete(e)}var hQ=rc(K.LOW_LEVEL_AI_MESSAGE,`AI_Message`,[`Content`,`Response`,`Actions`,`Action`,`Branch`,`BranchContent`,`BranchSelector`,`BranchPrevious`,`BranchNext`,`BranchPage`,`Attachment`,`Attachments`,`Toolbar`]);function gQ({preset:e=H.DEFAULT,...t}){let n=hQ(e);return(0,$.jsx)(n,{...t})}function _Q({preset:e=H.DEFAULT,...t}){let n=hQ(e);return(0,$.jsx)(n.Content,{...t})}function vQ({preset:e=H.DEFAULT,...t}){let n=hQ(e);return(0,$.jsx)(n.Response,{...t})}function yQ({preset:e=H.DEFAULT,...t}){let n=hQ(e);return(0,$.jsx)(n.Actions,{...t})}function bQ({preset:e=H.DEFAULT,...t}){let n=hQ(e);return(0,$.jsx)(n.Action,{...t})}function yxe({preset:e=H.DEFAULT,...t}){let n=hQ(e);return(0,$.jsx)(n.Branch,{...t})}function bxe({preset:e=H.DEFAULT,...t}){let n=hQ(e);return(0,$.jsx)(n.BranchContent,{...t})}function xxe({preset:e=H.DEFAULT,...t}){let n=hQ(e);return(0,$.jsx)(n.BranchSelector,{...t})}function Sxe({preset:e=H.DEFAULT,...t}){let n=hQ(e);return(0,$.jsx)(n.BranchPrevious,{...t})}function Cxe({preset:e=H.DEFAULT,...t}){let n=hQ(e);return(0,$.jsx)(n.BranchNext,{...t})}function wxe({preset:e=H.DEFAULT,...t}){let n=hQ(e);return(0,$.jsx)(n.BranchPage,{...t})}function Txe({preset:e=H.DEFAULT,...t}){let n=hQ(e);return(0,$.jsx)(n.Attachment,{...t})}function Exe({preset:e=H.DEFAULT,...t}){let n=hQ(e);return(0,$.jsx)(n.Attachments,{...t})}function Dxe({preset:e=H.DEFAULT,...t}){let n=hQ(e);return(0,$.jsx)(n.Toolbar,{...t})}var Oxe=no.createOperationPathKey({resourceIdentifier:Wo.AGENT_BEHAVIOR_REPORTS,operationIdentifier:J.CREATE,variantType:oe.API_CALL,isOperationDefault:!0,isBulkOperation:!1}),xQ;(function(e){e.IDLE=`idle`,e.SENDING=`sending`,e.SENT=`sent`})(xQ||={});function kxe({executionId:e,messageId:t,organizationId:n}){let{tComponent:r,tResourceFieldEnumValue:i}=q({component:K.HIGH_LEVEL_VIEWS_FLOWS_ACTORS,resource:Wo.AGENT_BEHAVIOR_REPORTS}),a=(0,Q.useMemo)(()=>gm(r,K.HIGH_LEVEL_VIEWS_FLOWS_ACTORS),[r]),{doOperation:o}=fm(),s=cp(),{renderIcon:c}=ef(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(void 0),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(xQ.IDLE),[_,v]=(0,Q.useState)(null),y=(0,Q.useRef)(!1),b=(0,Q.useMemo)(()=>Object.values(wi).map(e=>({value:e,label:i(Wo.AGENT_BEHAVIOR_REPORTS,`category`,e,va.shape.category)})),[i]),x=(0,Q.useCallback)(async()=>{if(d&&!y.current){y.current=!0,g(xQ.SENDING),v(null);try{let r=p.trim();await o(Oxe,{contextualParameters:{organizationId:n},requestData:{executionRef:{kind:fs.CONVERSATIONAL_EXECUTION,id:e},turnMessageId:t,category:d,...r?{comment:r}:{}}},{silent:!0}),g(xQ.SENT),u(!1)}catch(e){v(s(e)),g(xQ.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===xQ.SENT,T=a(w?`replyReported`:`reportReply`);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(bQ,{tooltip:T,label:T,disabled:w,onClick:()=>{v(null),u(!0)},"data-agent-reply-report":h,children:c(W.WARNING,{size:tr.SM})}),(0,$.jsx)(qW,{open:l,onOpenChange:e=>{h!==xQ.SENDING&&u(e)},children:(0,$.jsxs)(YW,{className:`sm:max-w-lg`,children:[(0,$.jsxs)(ZW,{children:[(0,$.jsx)($W,{children:a(`reportDialogTitle`)}),(0,$.jsx)(eG,{children:a(`reportDialogDescription`)})]}),(0,$.jsxs)(ax,{className:`gap-field py-field`,children:[(0,$.jsxs)(nx,{children:[(0,$.jsx)(ix,{id:S,children:a(`reportCategoryLabel`)}),(0,$.jsx)(yF,{"aria-labelledby":S,name:`agent-reply-report-category-${t}`,schema:va.shape.category,options:b,value:d,onValueChange:e=>f(e),orientation:Ui.VERTICAL,disabled:h===xQ.SENDING,required:!0})]}),(0,$.jsxs)(nx,{children:[(0,$.jsx)(rx,{htmlFor:`field-${C}`,children:a(`reportCommentLabel`)}),(0,$.jsx)(OI,{name:C,schema:va.shape.comment,value:p,onChange:e=>m((e??``).slice(0,lee)),placeholder:a(`reportCommentPlaceholder`),rows:3,disabled:h===xQ.SENDING})]}),_?(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:_})}):null]}),(0,$.jsxs)(QW,{children:[(0,$.jsx)(Y,{variant:X.OUTLINE,onClick:()=>u(!1),disabled:h===xQ.SENDING,children:a(`reportCancel`)}),(0,$.jsx)(Y,{onClick:()=>{x()},disabled:!d||h===xQ.SENDING,children:a(`reportSend`)})]})]})})]})}function SQ(e,t=40){let n=e.trim().replace(/\s+/g,` `);return n.length>t?`${n.slice(0,t)}…`:n}function Axe(e){return SQ(e.messages.find(e=>e.role===Ai.USER)?.content??``)}function CQ(){let{tComponent:e}=q({component:K.HIGH_LEVEL_VIEWS_FLOWS_ACTORS});return(0,Q.useMemo)(()=>gm(e,K.HIGH_LEVEL_VIEWS_FLOWS_ACTORS),[e])}var jxe=new Set([uW.COMPLETED,uW.CANCELLED,uW.ERROR,uW.AWAITING_APPROVAL]),wQ;(function(e){e.PENDING=`pending`,e.OPENED=`opened`,e.UNAVAILABLE=`unavailable`})(wQ||={});var TQ={threads:[],hasOlder:!1},Mxe=({system:e,contextResourceIdentifiers:t,preset:n,caseRef:r,linkedConversationId:i,onLinkedConversationSettled:a,linkKey:o})=>{let s=CQ(),{startExecution:c,cancelExecution:l,executions:u,fetchConversationHistory:d,fetchConversation:f,deleteConversation:p}=gW(),m=Zp(),h=m?.currentUserId??null,g=Ma(t),_=(0,Q.useRef)(t);_.current=t;let[v,y]=(0,Q.useState)(TQ),b=(0,Q.useRef)(v);b.current=v;let x=(0,Q.useMemo)(()=>ZZ(v),[v]),[S,C]=(0,Q.useState)(!1),w=r?`${r.resourceType}:${r.resourceId}`:``,T=pQ(h,e.ref,g,w),[E,D]=(0,Q.useState)(null),O=(0,Q.useRef)(T);O.current=T;let k=(0,Q.useCallback)(e=>{D(t=>{let n=typeof e==`function`?e(t):e;return vxe(O.current,n),n})},[]),A=(0,Q.useRef)(null),[j,M]=(0,Q.useState)({}),N=(0,Q.useRef)(0),P=(0,Q.useCallback)(async()=>{let t=++N.current,n=await d(e.ref,_.current);if(t!==N.current||n===void 0||(y(e=>iQ(e,n)),!n.hasOlder))return;let r=new Set(n.executions.map(e=>e.executionId));for(let n of QZ(b.current)){if(r.has(n))continue;let i=await f(e.ref,_.current,n);if(t!==N.current)return;i!==void 0&&y(e=>i===null?tQ(e,n):eQ(e,i))}},[e.ref,d,f]),F=(0,Q.useRef)(0),I=(0,Q.useCallback)(async()=>{let t=oQ(v);if(!t||S)return;let n=F.current;C(!0);try{let r=await d(e.ref,_.current,{before:t});if(n!==F.current||r===void 0)return;y(e=>aQ(e,r))}finally{n===F.current&&C(!1)}},[v,S,e.ref,d]),[L,R]=(0,Q.useState)(null),z=(0,Q.useRef)(null),B=i?hxe(o,i):null,ee=(0,Q.useRef)(B);ee.current=B;let te=(0,Q.useRef)(a);te.current=a;let ne=(0,Q.useCallback)(e=>{z.current&&(ee.current&&_xe(ee.current),z.current=null,R(e),te.current?.())},[]),V=(0,Q.useCallback)((e,t)=>{t||k(t=>t===e?null:t),z.current===e&&ne(t?wQ.OPENED:wQ.UNAVAILABLE)},[k,ne]);(0,Q.useEffect)(()=>{let t=A.current;if(!t||v===TQ)return;A.current=null;let n=ZZ(v).some(e=>e.executionId===t)||u.has(t);if(n||!v.hasOlder){V(t,n);return}let r=F.current;f(e.ref,_.current,t).then(e=>{r===F.current&&(e&&y(t=>eQ(t,e)),V(t,!!e))})},[v,u,V,f,e.ref]),(0,Q.useEffect)(()=>{F.current+=1,y(TQ),C(!1);let t=mxe(pQ(h,e.ref,g,w));A.current=t,D(t),M({}),P()},[P,h,g,e.ref,w]),(0,Q.useEffect)(()=>{i&&B&&!gxe(B)&&(z.current=i,A.current=i,R(wQ.PENDING),k(i),P())},[i,B,T,k,P]);let re=E?u.get(E):void 0;(0,Q.useEffect)(()=>{re&&jxe.has(re.status)&&P()},[re?.status,P]);let ie=E?x.find(e=>e.executionId===E):void 0,ae=E?j[E]:void 0,oe=(0,Q.useMemo)(()=>XZ({...ie?{thread:ie}:{},...re?{live:re}:{},...ae?{sent:ae}:{}}),[ie,re,ae]),se=(0,Q.useMemo)(()=>{let e=x.map(e=>({id:e.executionId,title:Axe(e)}));return[...Object.entries(j).filter(([e,t])=>t.length>0&&!x.some(t=>t.executionId===e)).sort(([,e],[,t])=>t[0].sentAt.getTime()-e[0].sentAt.getTime()).map(([e,t])=>({id:e,title:SQ(t[0].text)})),...e]},[x,j]),ce=(0,Q.useCallback)(()=>{ne(null),R(null),k(null)},[k,ne]),le=(0,Q.useCallback)(e=>{ne(null),R(null),k(e),P()},[P,k,ne]),ue=(0,Q.useCallback)(e=>{y(t=>tQ(t,e)),M(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n}),k(t=>t===e?null:t),p(e).catch(()=>{P()})},[p,P,k]),de=(0,Q.useCallback)(t=>{let n=crypto.randomUUID();R(e=>e===wQ.UNAVAILABLE?null:e);let i=c(e.ref,{message:t},E??void 0,_.current,{messageId:n,...r?{caseRef:r}:{}});i&&(M(e=>({...e,[i]:KZ(e[i],{id:n,text:t,sentAt:new Date})})),k(i))},[c,e.ref,E,r,k]),fe=oe.turnState===GZ.WORKING||oe.turnState===GZ.ANSWERING||oe.turnState===GZ.AWAITING_DECISION,pe=oe.stoppable?oe.activeExecutionId:void 0,me=zt(t,m?.currentOrganizationId??void 0),he=ie?E:null,ge=(0,Q.useMemo)(()=>he&&me?({messageId:e})=>(0,$.jsx)(kxe,{executionId:he,messageId:e,organizationId:me},e):void 0,[he,me]);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)(dQ,{preset:n,discussions:se,currentId:E,onNew:ce,onSelect:le,onDelete:ue,...v.hasOlder?{onLoadOlder:()=>{I()},loadingOlder:S}:{}}),(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:oe,...ge?{renderReplyActions:ge}:{},emptyState:{title:e.displayName,description:e.description||s(`emptyStateDescription`)}}),L===wQ.UNAVAILABLE?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:s(`linkedConversationUnavailable`)}):null,(0,$.jsx)(uQ,{preset:n,placeholder:s(`promptPlaceholder`,{assistant:e.displayName}),onSubmit:de,sendDisabled:fe||L===wQ.PENDING,...pe?{onStop:()=>l(pe)}:{}})]})]})})},Nxe=({system:e})=>{let t=CQ(),{executions:n}=gW(),r=(0,Q.useMemo)(()=>Array.from(n.values()).some(t=>t.systemRef===e.ref&&(t.status===uW.RUNNING||t.status===uW.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:G(`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`)})]})},EQ=({viewRef:e,viewDefinition:t,contextResourceIdentifiers:n,caseRef:r,linkedConversationId:i,onLinkedConversationSettled:a,linkKey:o})=>{let{flowsActorsViews:s}=Ng(),c=Zp(),{systems:l,isLoading:u}=gW(),{isReady:d}=q({component:K.HIGH_LEVEL_VIEWS_FLOWS_ACTORS}),f=CQ(),p=t??(e?s?.find(t=>t.ref===e):void 0),m=(0,Q.useContext)(FU),h=i===void 0&&m&&p&&m.systemRef===p.systemRef?m:void 0,g=i??h?.conversationId,_=h?h.onSettled:a,v=h?h.linkKey:o;(0,Q.useEffect)(()=>{},[n,p,e]);let y=(0,Q.useMemo)(()=>{let e=tm.buildInitiatorIds({userId:c?.currentUserId,organizationId:c?.currentOrganizationId,applicationId:c?.currentApplicationId,anonymousUserId:c?.currentAnonymousUserId}),t=p?.primaryScope?tm.primaryScopeToContextIdentifiers(e,p.primaryScope):{},r=c?.buildContextResourceIdentifiers()??{},i=tm.filterCustomScopeContextResourceIdentifiers(r);return p?tm.resolveViewContextResourceIdentifiers({surfaceName:`FlowsActorsView`,surfaceRef:p.ref,primaryScope:p.primaryScope,parentResourcesRequirements:p.parentResourcesRequirements,additionalResourceRequirements:p.additionalResourceRequirements,primaryScopeContext:t,customScopeContext:i,explicitContextResourceIdentifiers:n})??{}:tm.mergeContextResourceIdentifiers(t,i,n)??{}},[n,p,c]),b=(0,Q.useMemo)(()=>{if(p)return l.find(e=>e.ref===p.systemRef)},[p,l]);return p?d?(0,$.jsx)(`div`,{className:`flex h-full min-h-0 flex-col`,children:b?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Nxe,{system:b}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col pt-card-sm`,children:(0,$.jsx)(Mxe,{system:b,contextResourceIdentifiers:y,preset:p.layoutPreset,caseRef:r,linkedConversationId:g,onLinkedConversationSettled:_,linkKey:v})})]}):(0,$.jsx)(`div`,{role:`status`,className:`p-section text-sm text-muted-foreground`,children:f(u?`loading`:`unavailable`)})}):null:(0,$.jsx)(a_,{viewKind:`flows-actors`})};function DQ(e,t,n){return`${e}${e.includes(`?`)?`&`:`?`}${t}=${encodeURIComponent(n)}`}function Pxe(e){let{views:t,resourceConfigurations:n,search:r}=e,i=r.get(Cee),a=r.get(`id`);if(!i||!a)return;let o=qn(r.get(`context`)??void 0),s=nr(o);for(let[e,t]of Object.entries(n??{})){let n=o[e];if(!n)continue;let r=t?.frontendConfiguration?.compositeViews?.find(e=>e.conversationSystemRef===i&&ap(e));if(!r)continue;let c=vp(e,r).insertedViewRef;return DQ(kp(c,{[e]:n,...s.length===1?{[Wo.ORGANIZATIONS]:s[0]}:{}}),ai,a)}let c=t?.find(e=>e.systemRef===i);if(c)return DQ(`/flows-actors/${encodeURIComponent(c.ref)}`,ai,a)}function OQ(){let[e,t]=sh();return{linkedConversationId:e.get(`conversation`)??void 0,dropLinkedConversation:Q.useCallback(()=>{t(e=>{let t=new URLSearchParams(e);return t.delete(ai),t},{replace:!0})},[t])}}var Fxe=()=>{let[e]=sh(),{flowsActorsViews:t}=Ng(),{registry:n}=fm(),r=Zp(),{followRouteOrganization:i}=ng(),{emit:a}=Uo(),{tComponent:o}=q({component:K.HIGH_LEVEL_VIEWS_FLOWS_ACTORS}),s=nr(qn(e.get(`context`)??void 0)),c=s.length===1?s[0]:void 0,l=c!==void 0&&r?.currentOrganizationId!==c,[u,d]=Q.useState(null),f=c!==void 0&&u===c;if(Q.useEffect(()=>{l&&c&&(i(c)?(d(null),a(hc.NAVIGATION_ORGANIZATION_FOLLOWED,{organizationId:c})):d(c))},[l,c,i,a]),s.length>1||f)return(0,$.jsx)(`p`,{role:`status`,className:`p-container text-sm text-muted-foreground`,children:o(K.HIGH_LEVEL_VIEWS_FLOWS_ACTORS,`linkedConversationUnavailable`)});if(l)return null;let p=Pxe({views:t,resourceConfigurations:n?.resourceConfigurations,search:e});return p?(0,$.jsx)(Rh,{replace:!0,to:p}):(0,$.jsx)(a_,{viewKind:`flows-actors`})},Ixe=Q.lazy(()=>i_(()=>import(`./ChartView-Db94VZQx.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));function Lxe(e){let{insertedIdentity:t,contextResourceIdentifiers:n,urlParamValues:r,registry:i}=e;if(t.hostKind!==Bp.RESOURCE||t.viewKind!==bp.CHART_VIEW)return;let a=Mp({viewRef:t.insertedViewRef,registry:i})?.chartView;if(!a||!qp(a))return;let o=n??{};return{routeViewRef:t.insertedViewRef,viewDefinition:a,contextResourceIdentifiers:o,urlParamValues:r,runtimeDescriptor:gp({identity:t,chartView:a,contextResourceIdentifiers:o}),requiredFeatures:a.chartDefinition.requiredFeatures}}function Rxe(e){let{viewRef:t,registry:n,contextResourceIdentifiers:r,urlParamValues:i}=e;if(!t)return;let a=jp(t);if(a)return Lxe({insertedIdentity:a,contextResourceIdentifiers:r,urlParamValues:i,registry:n})}function zxe(e){let t=rg(),n=BZ(t),{emit:r}=Uo(),{getZoneState:i}=kx(),a=Q.useRef(null),o=`${t.pathname}${t.search}`,{retryTick:s,scheduleRetry:c,clearRetry:l}=RZ(o);Q.useEffect(()=>{e&&(Hm.isInTransaction()?c():(l(),n||a.current!==o&&(Hm.zoneOwnsBrowserUrl(ql.PRIMARY,o,i)||r(hc.NAVIGATION_REPLACE,{zone:ql.PRIMARY,content:{contentType:Sa.CHART_VIEW,viewRef:e.routeViewRef,viewDefinition:e.viewDefinition,contextResourceIdentifiers:e.contextResourceIdentifiers,urlParamValues:e.urlParamValues,runtimeDescriptor:e.runtimeDescriptor,requiredFeatures:e.requiredFeatures},urlPath:Hm.decomposeHostedPaneBrowserUrl(o).hostUrl,stackEntryId:Hm.generateStackEntryId(),initiator:{sourceZone:ql.PRIMARY},navigationSource:Gt.URL_SYNC,transition:Mo.REPLACE}),a.current=o)))},[r,i,e,o,n,s,c,l])}var Bxe=new Set(Object.values(J).map(e=>String(e).toLowerCase()));function Vxe(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}`):Bxe.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 Hxe=tl.getLogger(),Uxe=({resourceType:e,operation:t,PageComponent:n,routePathParameters:r})=>{let{registry:i}=fm(),a=Zp(),{navigationLayout:o,currentBreakpoint:s}=Ng(),{contentAreaWidth:c}=kx(),l=Rm(),u=Q.useMemo(()=>Vxe(l,e),[l,e]);axe(u.isValid?e:void 0,u.isValid?t:void 0,r),Q.useEffect(()=>{!u.isValid&&u.message&&Hxe.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(()=>kn.buildParentResourcesRequirementsFromRouteParams(r,e,i),[r,e,i]);if(!u.isValid)return(0,$.jsx)(Hy,{});let f=kn.extractResourceIdentifiersFromUrlParams(l,i,r),p=i.resourceConfigurations?.[e]?.resourcePrimaryScope,m=tm.buildResourceOperationContextIdentifiers({currentUserId:a?.currentUserId,currentOrganizationId:a?.currentOrganizationId,currentApplicationId:a?.currentApplicationId,currentAnonymousUserId:a?.currentAnonymousUserId,primaryScope:p,liveAppScopeContextResourceIdentifiers:a?.buildContextResourceIdentifiers?.(),explicitContextResourceIdentifiers:f}),h=kn.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:t,contextResourceIdentifiers:m,parentResourcesRequirements:d}),g=Hm.calculateResourceRelationshipDepth(d),_=g===0&&!!o?.zones?.secondary&&Hm.layoutSplitsOperationFromPrimary(o,t,s),v=Hm.resolveResourceTargetZone(g,{hasSecondary:!!o?.zones?.secondary,hasCompanion:!!o?.zones?.companion,prefersAdjacentZoneForDetail:_}),y=g>=1&&v!==ql.PRIMARY&&zx({content:{contentType:Sa.RESOURCE_OPERATION,resourceContext:h},paneZone:v,layout:o,registry:i,viewport:s,contentAreaWidth:c})?ql.PRIMARY:v,b=Hh({zone:y,layout:o,viewport:s,contentAreaWidth:c})?y:ql.PRIMARY;return(0,$.jsx)(n,{resourceContext:h,navigationZone:b,navigationInitiator:{sourceZone:b}})};function kQ(e,t){let{compositeViews:n,fullCustomViews:r,flowsActorsViews:i}=Ng(),{registry:a}=fm();return Q.useMemo(()=>{if(e)switch(t){case Sa.COMPOSITE_VIEW:return _p({viewRef:e,compositeViews:n,registry:a})?.requiredFeatures;case Sa.CHART_VIEW:return Mp({viewRef:e,registry:a})?.chartView.chartDefinition.requiredFeatures;case Sa.FULL_CUSTOM_VIEW:return r?.find(t=>t.ref===e)?.requiredFeatures;case Sa.FLOWS_ACTORS_VIEW:return i?.find(t=>t.ref===e)?.requiredFeatures;case Sa.EXECUTION_VIEW:return Dp({viewRef:e,registry:a})?.requiredFeatures;default:return}},[e,t,n,r,i,a])}var AQ=({ViewComponent:e,contentType:t,viewProps:n})=>{let{viewRef:r}=Rm();VZ(r,t);let i=kQ(r,t);return(0,$.jsx)(Vh,{requiredFeatures:i,children:(0,$.jsx)(e,{viewRef:r,...n})})},Wxe=({viewProps:e})=>{let{viewRef:t}=Rm(),n=rg(),{compositeViews:r}=Ng(),{registry:i}=fm(),a=Q.useMemo(()=>Pp(new URLSearchParams(n.search)),[n.search]),o=Q.useMemo(()=>_p({viewRef:t,compositeViews:r,registry:i}),[t,r,i]),s=!!t&&zp(o);VZ(s?t:void 0,Sa.COMPOSITE_VIEW);let c=kQ(s?t:void 0,Sa.COMPOSITE_VIEW);return s?(0,$.jsx)(Vh,{requiredFeatures:c,children:(0,$.jsx)(IU,{viewRef:t,contextResourceIdentifiers:a,...e})}):(0,$.jsx)(a_,{viewKind:`composite`,viewRef:t})},Gxe=({viewProps:e})=>{let{viewRef:t}=Rm(),n=rg(),{registry:r}=fm(),i=Q.useMemo(()=>Dp({viewRef:t,registry:r}),[t,r]),a=Q.useMemo(()=>lm(new URLSearchParams(n.search)),[n.search]),o=!!t&&!!i&&rp(i);VZ(o?t:void 0,Sa.EXECUTION_VIEW);let s=kQ(o?t:void 0,Sa.EXECUTION_VIEW);return o?(0,$.jsx)(Vh,{requiredFeatures:s,children:(0,$.jsx)(LY,{viewRef:t,contextResourceIdentifiers:a,...e})}):(0,$.jsx)(a_,{viewKind:`execution`,viewRef:t})},Kxe=({viewProps:e})=>{let{viewRef:t}=Rm(),n=rg(),{registry:r}=fm(),i=Q.useMemo(()=>Gp(new URLSearchParams(n.search)),[n.search]),a=Q.useMemo(()=>Up(new URLSearchParams(n.search)),[n.search]),o=Q.useMemo(()=>Rxe({viewRef:t,registry:r,contextResourceIdentifiers:i,urlParamValues:a}),[t,r,i,a]);return zxe(o),o?(0,$.jsx)(Vh,{requiredFeatures:o.requiredFeatures,children:(0,$.jsx)(Ixe,{viewRef:o.routeViewRef,viewDefinition:o.viewDefinition,contextResourceIdentifiers:o.contextResourceIdentifiers,urlParamValues:o.urlParamValues,runtimeDescriptor:o.runtimeDescriptor,...e})}):(0,$.jsx)(a_,{viewKind:`chart`,viewRef:t})},jQ=({pageRef:e,PageComponent:t})=>(oxe(e),(0,$.jsx)(t,{})),MQ=()=>(0,$.jsx)(HU,{});function qxe({documentRef:e}){let[t]=sh(),n=ate(t);return(0,$.jsx)(IZ,{documentRef:e,...n?{namedRelease:n}:{}})}var Jxe=()=>{let{registry:e}=fm();ui.isDevelopment();let t=[];return Object.values(e.resourceConfigurations).forEach(n=>{(Array.isArray(n.operations)?n.operations:[]).forEach(r=>{if(!Ei(r.operationFrontendConfig))return;let i=Tl.buildOperationFrontendRoutePaths(n,r,e.allResourceFieldIdentifiers),a=Ms(r),o;switch(a){case`create`:o=rG;break;case`list`:o=YY;break;case`read`:o=SY;break;case`update`:o=DY;break;case`search`:o=TY;break;default:o=GW}i.forEach((e,i)=>{let a=(0,$.jsx)(Vh,{operation:r,children:(0,$.jsx)(Uxe,{resourceType:n.resourceIdentifier,operation:r,PageComponent:o,routePathParameters:e.parameters})}),s=`${n.resourceIdentifier}-${String(r.operationIdentifier)}-${i}`;t.push((0,$.jsx)(Sh,{path:e.url,element:a,errorElement:(0,$.jsx)(Hy,{})},s))})})}),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ixe,{}),(0,$.jsxs)(Rse,{children:[(0,$.jsx)(Sh,{path:za.authCallback,element:(0,$.jsx)(Fye,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.reAuthenticationCallback,element:(0,$.jsx)(Iye,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.magicLinkVerify,element:(0,$.jsx)(Lye,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.mfaChallenge,element:(0,$.jsx)(bbe,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.enrollmentRequired,element:(0,$.jsx)(xbe,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.organizationOnboarding,element:(0,$.jsx)(wbe,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.oneOffSession,element:(0,$.jsx)(uZ,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.fileUploadGrant,element:(0,$.jsx)(hZ,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.authExchange,element:(0,$.jsx)(Ube,{}),errorElement:(0,$.jsx)(Hy,{})}),Object.entries(Oae).map(([e,t])=>(0,$.jsx)(Sh,{path:t,element:(0,$.jsx)(qxe,{documentRef:e}),errorElement:(0,$.jsx)(Hy,{})},e)),(0,$.jsx)(Sh,{path:Iae,element:(0,$.jsx)(LZ,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.login,element:(0,$.jsx)(Abe,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.register,element:(0,$.jsx)(rxe,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.passwordLost,element:(0,$.jsx)(Kbe,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.oauthConsent,element:(0,$.jsx)(Jbe,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.chatIdentityLink,element:(0,$.jsx)(Ybe,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.oauthLoggedOut,element:(0,$.jsx)(Xbe,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.oauthLogoutConfirm,element:(0,$.jsx)(Zbe,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.invitation,element:(0,$.jsx)(zbe,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.confirmEmail,element:(0,$.jsx)(Mbe,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsxs)(Sh,{element:(0,$.jsx)(NH,{}),errorElement:(0,$.jsx)(Hy,{}),children:[(0,$.jsx)(Sh,{path:za.home,element:(0,$.jsx)(jQ,{pageRef:Vl.HOME,PageComponent:HU}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.decisions,element:(0,$.jsx)(jQ,{pageRef:Vl.DECISIONS,PageComponent:VW}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.conversationLink,element:(0,$.jsx)(Fxe,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.settings,element:(0,$.jsx)(MQ,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.settingsSection,element:(0,$.jsx)(MQ,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:za.settingsSectionSubTab,element:(0,$.jsx)(MQ,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:`/composite/:viewRef`,element:(0,$.jsx)(Wxe,{}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:`/custom/:viewRef`,element:(0,$.jsx)(AQ,{ViewComponent:UZ,contentType:Sa.FULL_CUSTOM_VIEW}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:`/flows-actors/:viewRef`,element:(0,$.jsx)(AQ,{ViewComponent:EQ,contentType:Sa.FLOWS_ACTORS_VIEW}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{path:`/execution/:viewRef`,element:(0,$.jsx)(Gxe,{viewProps:{navigationZone:Gn.PRIMARY}}),errorElement:(0,$.jsx)(Hy,{})}),(0,$.jsx)(Sh,{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)(Kxe,{})}),errorElement:(0,$.jsx)(Hy,{})}),t]}),(0,$.jsx)(Sh,{path:`*`,element:(0,$.jsx)(Hy,{})})]})]})},NQ=Vae.EN,PQ={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 Yxe(e){return e.trim().split(`-`)[0]?.toLowerCase()??``}function FQ(e){let t=e.trim().toLowerCase();if(t)return Object.keys(PQ).find(e=>e.toLowerCase()===t)}function IQ(e){let t=PQ[e]??PQ[NQ],n=hne[e]?.direction??wd.LTR;return{...t,languageTag:e,direction:n}}function Xxe(e){for(let t of e){if(typeof t!=`string`)continue;let e=FQ(t);if(e)return IQ(e);let n=FQ(Yxe(t));if(n)return IQ(n)}return IQ(NQ)}function Zxe({onRetry:e}){let t=(0,Q.useMemo)(()=>Xxe(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 Qxe(e){let t=[...eSe(e.appConfig),...nSe(e.resourcesRegistry)],n=mie({definitions:e.featureConfiguration.definitions,usages:t}),r=[...$xe(e.featureConfiguration,e.isComponentRegistered),...n.unknownIssues.map(e=>`${e.surface}: unknown feature reference(s): ${iSe(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 $xe(e,t){let n=[];for(let r of e.definitions??[]){let e=r.unavailability;if(!e||!(e.behavior===js.CUSTOM||Object.values(e.byRole??{}).includes(js.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 eSe(e){return[...LQ(e.compositeViews,e=>`frontend composite view '${e.ref}'`),...LQ(e.fullCustomViews,e=>`frontend full custom view '${e.ref}'`),...LQ(e.flowsActorsViews,e=>`frontend flows/actors view '${e.ref}'`),...LQ(e.onboardingViews,e=>`frontend onboarding view '${e.ref}'`),...tSe(e)]}function tSe(e){return(e.guidanceFlows??[]).flatMap(e=>{let t=cc(e.audience?.requiredFeatures);return t.length===0?[]:[{surface:`frontend guidance flow '${e.ref}' audience`,references:t}]})}function LQ(e,t){return e?e.flatMap((e,n)=>{let r=cc(e.requiredFeatures);return r.length===0?[]:[{surface:t(e,n),references:r}]}):[]}function nSe(e){return Object.entries(e.resourceConfigurations).flatMap(([e,t])=>rSe(e,t))}function rSe(e,t){let n=t.frontendConfiguration;return[...(n?.compositeViews??[]).flatMap(t=>{let n=cc(t.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' composite view '${t.ref}'`,references:n}]}),...(n?.chartViews??[]).flatMap(t=>{let n=cc(t.chartDefinition.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' chart '${t.ref}'`,references:n}]}),...(n?.executionViews??[]).flatMap(t=>{let n=cc(t.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' execution view '${t.ref}'`,references:n}]}),...(n?.guidance??[]).flatMap(t=>{let n=cc(t.audience?.requiredFeatures);return n.length===0?[]:[{surface:`resource '${e}' guidance flow '${t.ref}' audience`,references:n}]})]}function iSe(e){return e.map(e=>`'${e.featureId}' via ${e.slotLabel}`).join(`, `)}var RQ;(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`})(RQ||={});function aSe(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 oSe(e){let t=t=>{e.onDiagnostic?.(t)},n=[];for(let r of e.modules){if(!r.providerCapabilities.includes(Fd.FRONTEND_ERROR_MONITORING))continue;let i=r.metadata.ref,a=e.activations.get(i);a===void 0?t({kind:RQ.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.`}):sce(a.handle)?n.push({providerRef:i,sink:a.handle}):t({kind:RQ.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??Di.on.bind(Di))(hc.ERROR_OCCURED,e=>{if(n.length===0)return;let r=aSe(e.error);for(let{providerRef:e,sink:i}of n)try{i.reportCrash(r)}catch(n){t({kind:RQ.REPORT_FAILED,providerRef:e,message:`Provider "${e}" threw while reporting a crash; the crash itself is unaffected.`,cause:n})}})}function zQ(e){return typeof e==`object`&&!!e}function sSe(e){if(!zQ(e)||!(`cause`in e))return;let t=e.cause;if(t instanceof Error)return t.message;if(typeof t==`string`)return t}function cSe(e,t){let n=e instanceof Error?e:Error(String(e)),r=zQ(n)&&zQ(n.wildoError)?n.wildoError:void 0;return n.initializationDiagnostics={...t,errorName:n.name,errorMessage:n.message,stack:n.stack,causeMessage:sSe(n),wildoError:r?{type:r.type,customMessageReference:r.customMessageReference,context:zQ(r.context)?r.context:void 0}:void 0},n}var BQ=class{services=null;isInitialized=!1;initializationPromise=null;logger=null;logDebug=null;reportNavigationLayoutDiagnostics(e){if(!e)return;let t;try{t=Pne(e)}catch(e){this.logger.warn(`Navigation layout diagnostics could not run`,{error:Qu(e)});return}if(t.length!==0)for(let e of t){let t={path:e.path,code:e.code,remedy:e.remedy};e.severity===_ie.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:Qu(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,l=`startup preparation`,u;this.logger||(this.logger=tl.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{l=`http client initialization`,this.logDebug(`Initializing HTTP client...`);let n=new Ca({baseURL:t.apiBaseUrl});l=`manual backend client setup`,this.logDebug(`Fetching application configuration from backend...`);let i=new Vr({baseURL:t.apiBaseUrl});try{l=`environment configuration loading`,u=ui.loadEnvironmentConfig(),this.logDebug(`Environment configuration loaded`,{frontendServiceName:u.frontendServiceName,apiBaseUrl:u.apiBaseUrl,appName:u.appName})}catch(e){throw this.logger.error(`Failed to load environment configuration`,{error:e.message}),Error(`Environment configuration failed: ${e.message}`)}let d,f;try{l=`backend application configuration fetch`;let t=null;for(let n=1;n<=2;n++)try{let t=ene.parse(await i.getApplicationConfig(u.frontendServiceName));f=Pb({entries:t.frontendProviders,modules:e.frontendProviderModules,onDiagnostic:e=>{this.logger?.warn(`Frontend provider hydration diagnostic`,{kind:e.kind,providerRef:e.providerRef,message:e.message})}}),d=oae.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}Zo(d.compliance.clientInstanceIdScope),this.logDebug(`Application configuration fetched successfully`,{hasAppIdentity:!!d.appIdentity,hasAppPreferences:!!d.appPreferences,hasRuntime:!!d.runtime,endpointsCount:Object.keys(d.runtime?.endPoints||{}).length}),this.logDebug(`Application configuration loaded from backend`,{appName:d.appIdentity?.appName,version:d.appIdentity?.version,hasAuth:!!d.auth,hasSocialOAuth2Providers:!!d.auth?.socialOAuth2Providers&&Object.keys(d.auth.socialOAuth2Providers).length>0,defaultLanguage:d.appPreferences?.languages?.defaultLanguage,enabledLanguages:d.appPreferences?.languages?.enabledLanguages,endpointsList:Object.keys(d.runtime?.endPoints||{}),frontendProvidersCount:f?.listAll().length??0})}catch(e){throw this.logger.error(`Failed to fetch application configuration from backend`,{error:e.message,frontendServiceName:u?.frontendServiceName,apiBaseUrl:t.apiBaseUrl}),Error(`Application configuration fetch failed: ${e.message}`)}l=`frontend configuration validation`;let p={...e.baseFrontendConfig};this.logDebug(`Using app-provided base frontend configuration`),e.frontendConfigOverrides&&(p=ky(p,e.frontendConfigOverrides),this.logDebug(`Applied frontend config overrides`,{sections:Object.keys(e.frontendConfigOverrides)})),p=Cm.parse(p),this.reportNavigationLayoutDiagnostics(p.navigationLayout),this.logDebug(`Frontend configuration resolved`,{frontendServiceName:u.frontendServiceName,finalConfig:{hasNavigationLayout:!!p.navigationLayout,hasAppComponentsConfiguration:!!p.appComponentsConfiguration,hasDesignSystem:!!p.designSystemConfiguration,hasTypography:!!p.designSystemConfiguration?.typography}}),l=`frontend resource registry initialization`,this.logDebug(`Initializing resources repository...`);let m=new AS(n);await m.initializeResources(a,o,s,e.excludedResourceTypes,e.resourceUIBehavior,e.notificationBadgeDefinitions);let h=m.getResourcesRegistry();if(l=`component preset registration`,await c(),ui.isDevelopment()&&(l=`development launcher verification`,Pv(Nv(h,p,e=>Ko.hasComponentType(e),{organizationRoles:d.organizationRoles})),Hv(Vv(wv(p?.settingsHub),Tv(p?.settingsHub),Cv(p?.settingsHub))),e.featureConfiguration)){let t=Qxe({resourcesRegistry:h,appConfig:p,featureConfiguration:e.featureConfiguration,isComponentRegistered:e=>Ko.hasComponentType(e)});t.isValid||this.logger.warn(`Invalid frontend feature references detected:\n${t.warnings.map(e=>` ⚠ ${e}`).join(`
|
|
23
|
+
`)}`)}r.length>0&&(l=`resource preload`,await this.preloadResources(r)),l=`frontend provider SDK activation`;let g=f??Pb(),_=await Tb({surface:ta.SAAS_APP,modules:g.listAll().filter(e=>hb(e).length===0),onDiagnostic:e=>{this.logger?.warn(`Frontend provider SDK activation diagnostic`,{kind:e.kind,providerRef:e.providerRef,message:e.message})}});l=`frontend error-monitoring bridge`,oSe({modules:g.listAll(),activations:_.activations,onDiagnostic:e=>{this.logger?.warn(`Frontend error-monitoring bridge diagnostic`,{kind:e.kind,providerRef:e.providerRef,message:e.message})}});let v=e=>{this.logger?.warn(`Provider component diagnostic`,{kind:e.kind,capability:e.capability,providerRef:e.providerRef,message:e.message})},y=Ole(g.listAll(),{contributedLoaders:Vb(),onDiagnostic:v}),b=Ele({registrations:y,onDiagnostic:v});l=`frontend provider script loading`;let x=kle(g.listAll(),y);x.length>0&&Ob(x,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 S={logger:this.logger,httpClient:n,resourceRepository:m,resourcesRegistry:h,appConfigFromBackend:d,frontendProviderRegistry:g,frontendProviderSdks:_,providerComponentRegistry:b,frontendConfiguration:p};return this.logger.info(`Application initialization completed successfully`),S}catch(e){let n=cSe(e,{phase:l,apiBaseUrl:t.apiBaseUrl,frontendServiceName:u?.frontendServiceName});throw this.logger?this.logger.error(`Application initialization failed`,{error:n.message,stack:n.stack,phase:l,apiBaseUrl:t.apiBaseUrl,frontendServiceName:u?.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})}}}},VQ=typeof globalThis<`u`?globalThis:window;VQ.__START_APPLICATION_FRONTEND_SERVICE__||=new BQ;var HQ=VQ.__START_APPLICATION_FRONTEND_SERVICE__,lSe=qc(K.LOW_LEVEL_CELEBRATION_OVERLAY,`CelebrationOverlay`),UQ=({preset:e=H.DEFAULT})=>{let{celebration:t,dismissCelebration:n}=Fm(),{tComponent:r,isReady:i}=q({component:K.LOW_LEVEL_CELEBRATION_OVERLAY}),a=r(K.LOW_LEVEL_CELEBRATION_OVERLAY,`dismiss`),o=r(K.LOW_LEVEL_CELEBRATION_OVERLAY,`ariaLabel`),s=lSe(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})};UQ.displayName=`AppCelebrationOverlay`;function WQ({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_TOAST,`Toaster`)(e);return(0,$.jsx)(n,{...t})}var GQ=({children:e})=>{let{registry:t}=fm(),{compositeViews:n,fullCustomViews:r,flowsActorsViews:i}=Ng(),a=(0,Q.useMemo)(()=>KQ({registry:t,compositeViews:n,fullCustomViews:r,flowsActorsViews:i}),[t,n,r,i]);return(0,$.jsx)($d,{customRegistry:a,children:e})};function KQ(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=qQ(t);r&&a.set(e,r);let i=n.frontendConfiguration?.compositeViews??[];for(let e of i){let t=qQ(e.icon);t&&s.set(e.ref,t)}let l=n.frontendConfiguration?.executionViews??[];for(let e of l){let t=qQ(e.icon);t&&c.set(`view-execution-${e.ref}`,t)}let u=n.frontendConfiguration?.chartViews??[];for(let e of u){let t=qQ(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=qQ(n);if(!r)continue;let i=`${e}:${String(t.operationIdentifier)}`;o.set(i,r)}}for(let e of n??[]){let t=qQ(e.icon);t&&s.set(e.ref,t)}for(let e of r??[]){let t=qQ(e.icon);t&&c.set(`view-custom-${e.ref}`,t)}for(let e of i??[]){let t=qQ(e.icon);t&&c.set(`view-flows-${e.ref}`,t)}return{resources:a,operationResources:o,compositeView:s,custom:c}}function qQ(e){if(e)return typeof e==`string`?tf.standard.get(e):{icon:e}}var uSe=2e3,JQ=new Map;function YQ(e,t){let n=Ru(t.badgeReference);n&&JQ.set(n,t.badgeCount),e(hc.BADGE_COUNT_CHANGED,t)}function XQ(){JQ.clear()}function ZQ(){let e=Zp(),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)&&XQ()},[t,n]),null}var QQ=()=>{let{on:e}=Uo(),[t,n]=(0,Q.useState)(()=>Object.fromEntries(JQ)),[r,i]=(0,Q.useState)({}),a=(0,Q.useRef)(Object.fromEntries(JQ));return(0,Q.useEffect)(()=>e(hc.BADGE_COUNT_CHANGED,e=>{let t=Ru(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}))},uSe))}),[e]),{getBadgeState:(0,Q.useCallback)(e=>{let n=Fo(e),i=t[n]??0,a=!1;switch(e.display.pulse){case Ds.WHILE_ACTIVE:a=i>0;break;case Ds.ON_INCREASE:a=!!r[n];break;case Ds.NONE:default:a=!1}return{count:i,pulse:a}},[t,r])}},$Q=()=>{let{on:e,isConnected:t}=up(),n=Uo(),{getResourcesRegistry:r}=fm(),i=(0,Q.useMemo)(()=>r(),[r]),a=(0,Q.useMemo)(()=>new DJ(i),[i]);return(0,Q.useEffect)(()=>{if(!t)return;let r=e=>{switch(e){case m.CREATED:return hi.SUCCESS;case m.UPDATED:return hi.INFO;case m.DELETED:return hi.WARNING;default:return hi.INFO}},o=e=>{let t=i.resourceConfigurations[e.resourceType]?.operations??[];if(e.operationPathKey){let n=t.find(t=>{try{return no.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)=>Wv(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=Gv({resourceType:e,registry:i,scopes:d?{contextResourceIdentifiers:u,previousContextResourceIdentifiers:d}:{contextResourceIdentifiers:u}}),p=f.length>0?f:[null],m=kn.buildParentResourcesRequirements(e,u,i);for(let t of p)n.emit(hc.RESOURCE_REFRESH,{resourceType:e,operationIdentifier:String(t?.operationIdentifier??J.LIST),variantType:t?.variantType,isOperationDefault:t?.isOperationDefault??!0,isBulkOperation:t?.isBulkOperation??!1,variantKey:t?.variantKey,contextResourceIdentifiers:u,parentResourcesRequirements:m,operation:t??{operationIdentifier:J.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=io(l?.operations??[],J.READ,{requireAddressable:!0}),_=new Set;for(let t of h){let r={...u,[e]:t},a=U.buildContextualParameters(r,i),o=kn.buildParentResourcesRequirements(e,r,i),s=g.filter(e=>!l||Bh({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:J.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??J.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(ro.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!==hi.ERROR&&c({resourceType:e.resourceType,resourceIds:e.affectedIds,contextResourceIdentifiers:e.contextResourceIdentifiers??{},previousContextResourceIdentifiers:e.previousContextResourceIdentifiers,shouldEmitReadRefresh:e.affectedIds.length>0&&!(e.isBulkOperation??!1)}),a){case hi.SUCCESS:n.emit(hc.NOTIFY_RESOURCE_SUCCESS,i);break;case hi.WARNING:n.emit(hc.NOTIFY_RESOURCE_WARNING,i);break;case hi.ERROR:n.emit(hc.NOTIFY_RESOURCE_ERROR,i);break;case hi.INFO:default:n.emit(hc.NOTIFY_RESOURCE_INFO,i)}}),u=e(ro.RESOURCE_UPDATED,e=>{c({resourceType:e.resourceType,resourceIds:e.deliveryTarget===$c.SCOPE_ROOM_NOTIFICATION?e.affectedIds??[]:[e.resourceId],contextResourceIdentifiers:e.contextResourceIdentifiers??{},previousContextResourceIdentifiers:e.previousContextResourceIdentifiers,shouldEmitReadRefresh:e.deliveryTarget===$c.SCOPE_ROOM_NOTIFICATION?(e.affectedIds?.length??0)>0:!!e.resourceId})}),d=e(ro.RESOURCE_DELETED,e=>{c({resourceType:e.resourceType,resourceIds:[e.resourceId],contextResourceIdentifiers:e.contextResourceIdentifiers??{},previousContextResourceIdentifiers:e.previousContextResourceIdentifiers,shouldEmitReadRefresh:!!e.resourceId,relaysRowDeletion:!0})}),f=e(ro.BADGE_UPDATE,e=>{let t={badgeReference:e.badgeReference,badgeCount:e.badgeCount};YQ(n.emit,t)}),p=e(ro.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}:{}})}),h=e(ro.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)}}),g=e(ro.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)}}),_=e(ro.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)}),v=e(ro.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 hi.INFO:n.emit(hc.NOTIFY_CUSTOM_INFO,t);break;case hi.SUCCESS:n.emit(hc.NOTIFY_CUSTOM_SUCCESS,t);break;case hi.WARNING:n.emit(hc.NOTIFY_CUSTOM_WARNING,t);break;case hi.ERROR:n.emit(hc.NOTIFY_CUSTOM_ERROR,t);break;default:n.emit(hc.NOTIFY_CUSTOM_INFO,t)}}),y=e(ro.ANALYTICS_MOMENT_ACHIEVED,e=>{let t={momentIdentifier:e.momentIdentifier,role:e.role,scope:e.scope,triggerSource:Qa.BACKEND};n.emit(hc.ANALYTICS_MOMENT_ACHIEVED,t)}),b=e(ro.GUIDANCE_STATE_CHANGED,e=>{let t={flowRef:e.flowRef,triggerSource:e.triggerSource,scope:e.scope,renderMode:e.renderMode};switch(e.status){case Ti.IN_PROGRESS:n.emit(hc.GUIDANCE_FLOW_ACTIVATED,t);break;case Ti.COMPLETED:n.emit(hc.GUIDANCE_FLOW_COMPLETED,t);break;case Ti.DISMISSED:n.emit(hc.GUIDANCE_FLOW_DISMISSED,t)}}),x=e(ro.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)}),S=e(ro.PROGRESSION_UPDATED,e=>{let t={scope:e.scope,operationCounts:e.operationCounts,totalPoints:e.totalPoints,updatedAt:e.updatedAt};n.emit(hc.PROGRESSION_UPDATED,t)}),C=e(ro.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(),h(),g(),_(),v(),y(),b(),x(),S(),C()}},[t,e,n,i,a]),null},e$=`wildo:connectivity-status`,dSe=3e3,fSe={connectionReconnectingNotice:`Connection lost — reconnecting…`,connectionLostNotice:`Connection lost. Please check your network and reload the page.`},t$=e=>e===$p.RECONNECTING||e===$p.ERROR,n$=()=>{let{status:e}=up(),{showPersistentToast:t,dismissPersistentToast:n}=Fm(),{tComponent:r,isReady:i}=q({component:K.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(e$)},[]),(0,Q.useEffect)(()=>{let t=()=>{l.current&&=(clearTimeout(l.current),null)},n=()=>{let e=c.current===$p.ERROR,t=e?`connectionLostNotice`:`connectionReconnectingNotice`,n=a.current(K.APPLICATION_LEVEL_STATUS_BAR,t),r=n.startsWith(`components.`)?fSe[t]:n;o.current(e$,e?`error`:`loading`,r),u.current=!0};t$(e)?i&&(u.current?n():l.current||=setTimeout(()=>{l.current=null,n()},dSe)):(t(),u.current&&=(s.current(e$),!1))},[e,i]),(0,Q.useEffect)(()=>()=>{l.current&&=(clearTimeout(l.current),null),u.current&&=(s.current(e$),!1)},[]),null},r$=class{name=_u.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`)}},pSe=50,mSe=1e4,hSe=20,i$=class{name=_u.BACKEND_PROXY;buffer=[];flushInterval=null;httpClient;identity=null;generation=0;constructor(e){this.httpClient=e}async initialize(e){let t=e?.flushIntervalMs??mSe;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>=hSe&&this.flush()}page(e,t){this.track({name:Cl.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 Woe(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,pSe)}}},gSe={[_u.CONSOLE]:()=>new r$,[_u.BACKEND_PROXY]:e=>new i$(e)},a$=class{resolveFromConfig(e,t){return e.map(e=>gSe[e.providerType](t,e.config))}},_Se={current:null};function o$(){return(0,Q.useContext)(s$)||{track:()=>{},page:()=>{},isActive:!1,sessionStartTimestamp:Date.now(),achievedMoments:new Set,markMomentAchieved:()=>!1,_onTrackRef:_Se}}var vSe=({config:e,valueMoments:t,identity:n,progress:r})=>{let{track:i,page:a,isActive:o,sessionStartTimestamp:s,achievedMoments:c,markMomentAchieved:u,_onTrackRef:d}=o$(),{on:f,emit:p}=Uo(),m=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let h=(0,Q.useRef)(r.signals),g=(0,Q.useRef)(r.completed),_=(0,Q.useRef)(r.counts),v=(0,Q.useRef)(r.lastFired),y=(0,Q.useRef)(new Map),b=(0,Q.useRef)(i);(0,Q.useEffect)(()=>{b.current=i},[i]);let x=(0,Q.useRef)(u);(0,Q.useEffect)(()=>{x.current=u},[u]);let S=(0,Q.useMemo)(()=>t??[],[t]),C=(0,Q.useCallback)(e=>JSON.stringify([n.applicationId,e.scope,e.scope===us.ORGANIZATION?n.organizationId:n.userId,e]),[n.applicationId,n.userId,n.organizationId]),w=(0,Q.useCallback)(e=>{if((e.scope===us.ORGANIZATION?!n.organizationId:!n.userId)||e.role!==l.ANTI_PATTERN&&(c.has(e.identifier)||g.current.has(C(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===l.ANTI_PATTERN){let t=e.cooldownMs??3e5,n=v.current.get(C(e));if(n&&Date.now()-n<t)return!1}return!0},[c,n,C]),T=(0,Q.useCallback)((e,t)=>{if(!m.current||!w(e))return;let n=e.identifier,r=C(e);h.current.has(r)||h.current.set(r,new Set);let i=h.current.get(r);if(i.add(t),e.mode!==di.ANY&&i.size!==e.signals.length)return;e.role!==l.ANTI_PATTERN&&g.current.add(r);let a=()=>{if(!m.current)return;let r=e.role===l.ANTI_PATTERN?l.ANTI_PATTERN:Nte;b.current(`${r}.${n}`,{signalIndex:e.mode===di.ANY?t:void 0,signalType:e.mode===di.ANY?e.signals[t].signalType:Gte,elapsedMs:Date.now()-s,role:e.role,scope:e.scope}),e.onAchieved?.frontendEvent&&p(hc.ANALYTICS_MOMENT_ACHIEVED,{momentIdentifier:n,role:e.role,scope:e.scope??us.USER,triggerSource:Qa.FRONTEND})};e.role===l.ANTI_PATTERN?(v.current.set(r,Date.now()),a()):Promise.resolve(x.current(n)).then(e=>{e?a():g.current.delete(r)})},[w,s,p,C]),E=(0,Q.useCallback)((e,t)=>t?e?Object.entries(t).every(([t,n])=>e[t]===n):!1:!0,[]);(0,Q.useEffect)(()=>{if(!o)return;let e=vc();for(let t of S)w(t)&&t.signals.forEach((n,r)=>{if(n.signalType!==Ql.RESOURCE_STATE)return;let i=JSON.stringify(n.filter||{}),a=`${n.resourceType}:${i}`;e.get(`${Ir}/resources/${n.resourceType}`,{params:{limit:1,filter:n.filter}}).then(e=>{if(!m.current)return;let i=e.totalCount??0;y.current.set(a,i),i>=n.threshold&&T(t,r)}).catch(()=>{})})},[o,S]),(0,Q.useEffect)(()=>{if(!o)return;let e=vc(),t=()=>{if(document.visibilityState===`visible`)for(let t of S)w(t)&&t.signals.forEach((n,r)=>{if(n.signalType!==Ql.RESOURCE_STATE)return;let i=JSON.stringify(n.filter||{}),a=`${n.resourceType}:${i}`;e.get(`${Ir}/resources/${n.resourceType}`,{params:{limit:1,filter:n.filter}}).then(e=>{if(!m.current)return;let i=e.totalCount??0;y.current.set(a,i),i>=n.threshold&&T(t,r)}).catch(()=>{})})};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[o,S]);let D=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{if(o)return f(hc.NAVIGATION_ZONE_CHANGED,t=>{let n=window.location.pathname;if(e?.pageViews&&n!==D.current&&(D.current=n,a(n,{contentType:t.currentContent?.contentType,zone:t.zone,stackDepth:t.stackDepth})),t.currentContent){let e=t.currentContent;for(let t of S)t.signals.forEach((n,r)=>{n.signalType===Ql.VIEW_VISIT&&e.contentType===n.contentType&&(!n.viewRef||`viewRef`in e&&e.viewRef===n.viewRef)&&T(t,r)})}})},[o,e?.pageViews,S,f,a,T]),(0,Q.useEffect)(()=>{if(o)return f(hc.NOTIFY_RESOURCE_SUCCESS,t=>{e?.resourceOperations&&i(Cl.RESOURCE_OPERATION,{resourceType:t.resourceType,operation:t.operationIdentifier});let n=t.resultSummary;for(let e of S)e.signals.forEach((r,i)=>{if(r.signalType===Ql.RESOURCE_OPERATION&&t.resourceType===r.resourceType&&t.operationIdentifier===r.operation&&E(n,r.filter)&&m.current&&w(e)){if(r.threshold&&r.threshold>1){let t=JSON.stringify([C(e),i]),n=(_.current.get(t)??0)+1;if(_.current.set(t,n),n<r.threshold)return}T(e,i)}});let r=vc();for(let e of S)for(let n of e.signals){if(n.signalType!==Ql.RESOURCE_STATE||t.resourceType!==n.resourceType)continue;let i=JSON.stringify(n.filter||{}),a=`${n.resourceType}:${i}`;r.get(`${Ir}/resources/${n.resourceType}`,{params:{limit:1,filter:n.filter}}).then(t=>{if(!m.current)return;let r=t.totalCount??0;y.current.set(a,r),r>=n.threshold&&T(e,e.signals.indexOf(n))}).catch(()=>{})}})},[o,e?.resourceOperations,S,f,i,T,E,w,C]),(0,Q.useEffect)(()=>{if(o&&e?.trackErrors)return f(hc.ERROR_OCCURED,e=>{i(Cl.ERROR,{errorType:e.error?.type,errorSeverity:e.error?.severity})})},[o,e?.trackErrors,f,i]),(0,Q.useEffect)(()=>{if(!o||!e?.userLifecycle)return;let t=[f(hc.USER_STATUS_CHANGED,e=>i(Cl.USER_STATUS_CHANGED,{newStatus:e.newStatus,oldStatus:e.oldStatus}))];return()=>t.forEach(e=>e())},[o,e?.userLifecycle,f,i]),(0,Q.useEffect)(()=>{if(!o||!e?.notifications)return;let t=[f(hc.NOTIFY_CUSTOM_INFO,e=>i(Cl.NOTIFICATION,{level:_o.INFO,identifier:e.identifier})),f(hc.NOTIFY_CUSTOM_SUCCESS,e=>i(Cl.NOTIFICATION,{level:_o.SUCCESS,identifier:e.identifier})),f(hc.NOTIFY_CUSTOM_WARNING,e=>i(Cl.NOTIFICATION,{level:_o.WARNING,identifier:e.identifier})),f(hc.NOTIFY_CUSTOM_ERROR,e=>i(Cl.NOTIFICATION,{level:_o.ERROR,identifier:e.identifier}))];return()=>t.forEach(e=>e())},[o,e?.notifications,f,i]),(0,Q.useEffect)(()=>{if(!o||!e?.hotkeys)return;let t=[f(hc.HOTKEY_COMMAND_MENU_OPEN,()=>i(Cl.HOTKEY_USED,{key:zn.COMMAND_MENU})),f(hc.HOTKEY_SIDEBAR_TOGGLE,()=>i(Cl.HOTKEY_USED,{key:zn.SIDEBAR_TOGGLE})),f(hc.HOTKEY_NOTIFICATIONS_OPEN,()=>i(Cl.HOTKEY_USED,{key:zn.NOTIFICATIONS})),f(hc.HOTKEY_QUICK_SWITCHER_OPEN,()=>i(Cl.HOTKEY_USED,{key:zn.QUICK_SWITCHER})),f(hc.HOTKEY_SHORTCUTS_HELP,()=>i(Cl.HOTKEY_USED,{key:zn.SHORTCUTS_HELP}))];return()=>t.forEach(e=>e())},[o,e?.hotkeys,f,i]),(0,Q.useEffect)(()=>{if(!o)return;let e=[f(hc.MILESTONE_ACHIEVED,e=>{i(`milestone_achieved`,{milestoneRef:e.milestoneRef,category:e.category,points:e.points,scope:e.scope})}),f(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,f,i]),(0,Q.useEffect)(()=>{if(o)return d.current=(e,t)=>{for(let n of S)n.signals.forEach((r,i)=>{if(r.signalType===Ql.CUSTOM_EVENT&&r.eventName===e){if(!m.current||!w(n))return;if(r.threshold&&r.threshold>1){let e=JSON.stringify([C(n),i]),t=(_.current.get(e)??0)+1;if(_.current.set(e,t),t<r.threshold)return}T(n,i)}r.signalType===Ql.FEATURE_ACCESS&&e===Cl.FEATURE_ACCESSED&&r.featureId===t?.featureId&&T(n,i)})},()=>{d.current=null}},[o,S,T,w,C,d]),null},s$=(0,Q.createContext)(null),c$=(0,Q.createContext)(null),ySe=new a$,bSe=`signed_in_at`,xSe=1e4,l$=({children:e})=>{let t=(0,Q.useContext)(Vi),{on:n}=Uo(),r=wm(Wo.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]),[u,d]=(0,Q.useState)(null),f=(0,Q.useMemo)(()=>u??[],[u]),p=(0,Q.useRef)(null),m=(0,Q.useCallback)(e=>{let t=p.current;t!==null&&(p.current=null,clearTimeout(t.timer),e&&t.held.forEach(e=>e()))},[]),h=(0,Q.useRef)(null),g=(0,Q.useCallback)(e=>{let t=p.current;t&&clearTimeout(t.timer),p.current={held:t?.held??[],timer:setTimeout(()=>m(!1),xSe),readId:e??h.current}},[m]);(0,Q.useEffect)(()=>n(hc.OWN_PREFERENCES_REREAD_STARTED,({readId:e})=>{h.current=e,queueMicrotask(()=>{h.current===e&&(h.current=null)}),g(e)}),[n,g]),(0,Q.useEffect)(()=>n(hc.OWN_PREFERENCES_REREAD_SETTLED,({readId:e,privacy:t})=>{p.current?.readId===e&&m(t!==null&&kd(Rd(t.consentedPurposes),[Bd.ANALYTICS]))}),[n,m]),(0,Q.useEffect)(()=>()=>m(!1),[m]),(0,Q.useEffect)(()=>n(hc.USER_PREFERENCES_CHANGED,e=>{let t=()=>{D.current&&i.current.forEach(e=>e.discard())};if(e.privacy===null){m(!1),t(),d([]);return}let n=e.privacy?.consentedPurposes;if(n!==void 0){let e=Rd(n);kd(e,[Bd.ANALYTICS])||(m(!1),t()),d(e)}}),[n,m]);let _=(0,Q.useRef)(null),[v,y]=(0,Q.useState)(0),b=(0,Q.useRef)(()=>{});(0,Q.useEffect)(()=>{if(!c?.enabled){o(!1);return}if(!(c.requiresConsent===!1||kd(f,[Bd.ANALYTICS]))){i.current.forEach(e=>e.reset()),o(!1);return}let e=!1,t=vc(),n=[...ySe.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=_.current;t!==null&&n.forEach(e=>e.identify({userId:t})),o(!0),y(e=>e+1)}),()=>{e=!0,n.forEach(e=>e.shutdown().catch(()=>{})),i.current=[]}},[c,f]);let x=_x(),S=(0,Q.useMemo)(()=>c?.enabled?x.filter(e=>e.providerCapabilities.includes(Fd.FRONTEND_PRODUCT_ANALYTICS)).map(e=>e.activation.handle).filter(cce):[],[c?.enabled,x]),C=a||S.length>0,w=c?.autoInstrumentation?.userLifecycle===!0,T=(0,Q.useRef)(w);T.current=w;let E=c?.requiresConsent!==!1,D=(0,Q.useRef)(E);D.current=E;let O=(0,Q.useRef)(null),[k,A]=(0,Q.useState)(0),j=(0,Q.useCallback)(e=>{O.current=e,A(e=>e+1)},[]);(0,Q.useEffect)(()=>n(hc.USER_LOGIN,e=>{_.current=e.userId,i.current.forEach(t=>t.identify({userId:e.userId})),e.establishment===zr.SIGNED_IN&&j({occurredAt:Date.now(),decided:!D.current,owedToBuiltIns:!0,owedToVendorSinks:!0})}),[n,j]),(0,Q.useEffect)(()=>n(hc.USER_PREFERENCES_CHANGED,e=>{let t=O.current;if(t===null||!D.current||!e.privacy)return;let n=e.privacy.consentedPurposes;n!==void 0&&j(kd(Rd(n),[Bd.ANALYTICS])?{...t,decided:!0}:null)}),[n,j]),(0,Q.useEffect)(()=>n(hc.USER_LOGOUT,e=>{e.reason===Or.SIGNED_OUT&&T.current&&b.current(Cl.USER_LOGOUT),j(null),_.current=null,i.current.forEach(e=>e.reset())}),[n,j]);let[M,N]=(0,Q.useState)(null),P=(0,Q.useRef)(null),F=(0,Q.useCallback)(e=>{let t=Symbol();return P.current=t,N(e),()=>{P.current===t&&(P.current=null,N(null))}},[]),I=JSON.stringify(M),L=M?.userId??null;(0,Q.useEffect)(()=>{S.length!==0&&(L===null?S.forEach(e=>e.reset()):S.forEach(e=>e.identify({userId:L})))},[S,L]);let R=(0,Q.useRef)(I);R.current=I;let z=(0,Q.useRef)({signals:new Map,counts:new Map,lastFired:new Map,completed:new Set}),B=M?.userId?`${rr}${JSON.stringify([M.applicationId,us.USER,M.userId])}`:null,ee=M?.organizationId?`${rr}${JSON.stringify([M.applicationId,us.ORGANIZATION,M.organizationId])}`:null,te=JSON.stringify([B,ee]),ne=(0,Q.useCallback)(e=>c?.valueMoments?.find(t=>t.identifier===e)?.scope===us.ORGANIZATION,[c?.valueMoments]),V=(0,Q.useCallback)(e=>c?.valueMoments?.find(t=>t.identifier===e)?.role!==l.ANTI_PATTERN,[c?.valueMoments]),[re,ie]=(0,Q.useState)({key:I,moments:new Set}),ae=(0,Q.useMemo)(()=>re.key===I?re.moments:new Set,[re,I]),oe=(0,Q.useCallback)(e=>{ie(t=>({key:I,moments:typeof e==`function`?e(t.key===I?t.moments:new Set):e}))},[I]),se=(0,Q.useCallback)(e=>{try{B&&localStorage.setItem(B,JSON.stringify([...e].filter(e=>!ne(e)))),ee&&localStorage.setItem(ee,JSON.stringify([...e].filter(ne)))}catch{}},[B,ee,ne]);(0,Q.useEffect)(()=>{if(oe(new Set),c?.enabled&&M&&(M.userId||M.organizationId)){try{let e=new Set;for(let[t,n]of[[B,!1],[ee,!0]]){if(!t)continue;let r=localStorage.getItem(t);if(r)for(let t of JSON.parse(r))V(t)&&ne(t)===n&&e.add(t)}oe(e)}catch{}if(c?.persistence?.backendSync&&r){let e=!1;return vc().getAnalyticsMomentsAchieved().then(t=>{if(e||R.current!==I)return;let n=t;n.moments&&oe(e=>{let t=new Set([...e,...n.moments].filter(V));return se(t),t})}).catch(()=>{}),()=>{e=!0}}}},[c?.enabled,c?.persistence?.backendSync,r,te,I,se,V,ne]),(0,Q.useEffect)(()=>n(hc.ANALYTICS_MOMENT_ACHIEVED,e=>{M&&e.triggerSource!==Qa.FRONTEND&&e.role!==l.ANTI_PATTERN&&V(e.momentIdentifier)&&oe(t=>{let n=new Set(t);return n.add(e.momentIdentifier),se(n),n})}),[n,se,I,V]);let ce=(0,Q.useCallback)(e=>{if(!M||!V(e))return!1;let t=c?.valueMoments?.find(t=>t.identifier===e);if(t?.requires?.some(e=>!ae.has(e))||t?.beforeStage?.some(e=>ae.has(e)))return!1;let n=()=>R.current===I&&(oe(t=>{let n=new Set(t);return n.add(e),se(n),n}),!0);return c?.persistence?.backendSync?vc().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,se,I,V,ae]),le=(0,Q.useRef)(null),ue=(0,Q.useCallback)((e,t)=>{if(!C)return;let n={name:e,properties:t,timestamp:Date.now()};a&&i.current.forEach(e=>e.track(n)),e===Cl.RESOURCE_OPERATION&&t?.resourceType===Wo.USER_SELF_PREFERENCES&&g();let r=()=>S.forEach(n=>n.track({name:e,properties:t}));p.current?p.current.held.push(r):r(),le.current?.(e,t)},[a,C,S,g]);b.current=ue,(0,Q.useEffect)(()=>{let e=O.current;if(e===null||!e.decided||!w)return;let t={name:Cl.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&&S.length>0&&(S.forEach(n=>n.track({name:t.name,properties:{[bSe]:new Date(e.occurredAt).toISOString()}})),r=!1),(n!==e.owedToBuiltIns||r!==e.owedToVendorSinks)&&(O.current=n||r?{...e,owedToBuiltIns:n,owedToVendorSinks:r}:null)},[k,v,a,S,w]);let de=(0,Q.useCallback)((e,t)=>{if(!C)return;a&&i.current.forEach(n=>n.page(e,t));let n=()=>S.forEach(n=>n.page(e,t));p.current?p.current.held.push(n):n()},[a,C,S]),fe=(0,Q.useMemo)(()=>({track:ue,page:de,isActive:C,sessionStartTimestamp:s,achievedMoments:ae,markMomentAchieved:ce,_onTrackRef:le}),[ue,de,C,s,ae,ce]);return(0,$.jsx)(c$.Provider,{value:F,children:(0,$.jsxs)(s$.Provider,{value:fe,children:[C&&M&&c&&(0,$.jsx)(vSe,{identity:M,progress:z.current,config:c.autoInstrumentation,valueMoments:c.valueMoments},`${I}:${JSON.stringify(c.valueMoments)}`),e]})})};function SSe(){let e=bm(),t=(0,Q.useContext)(c$);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 u$=tl.getLogger(),d$=u$.debugByType(`ResourceReadCacheBridge`);u$.setDebugTypeLogging(`ResourceReadCacheBridge`,!1);var f$=`read-cache`,p$=`VITE_RESOURCE_READ_CACHE`,CSe=`off`,wSe=()=>{let{on:e,isConnected:t,connectionCount:n,claimResourceRoom:r,releaseResourceRoom:i}=up(),{getReadCache:a}=fm(),o=a();(0,Q.useEffect)(()=>{let e=ui.readOptionalEnvironmentValue(p$)?.toLowerCase()===CSe;o.setEnabled(!e),e&&u$.info(`Resource read cache disabled by environment`,{flag:p$})},[o]);let s=Zp(),c=s?.currentOrganizationId??null,l=(0,Q.useContext)(Vi)?.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:`${f$}:${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),d$(`scope room confirmed`,{roomName:e})):(d.current.delete(e),d$(`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:`${f$}:${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(ko(e,t.scopeKey,t.scopeId))),requestCoverage:(e,t)=>{for(let n of t){let t=ko(e,n.scopeKey,n.scopeId);d.current.has(t)||(p.current?h.current(t,{...n,resourceType:e}):(f.current.set(t,{...n,resourceType:e}),d$(`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(),d$(`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(),d$(`reconnected; coverage and cache reset`,{connectionCount:n}))},[n,o]),(0,Q.useEffect)(()=>{o.clear(),g(),d$(`organization scope changed; cache cleared`,{currentOrganizationId:c})},[c,o,g]),(0,Q.useEffect)(()=>{if(!t)return;let n=e(ro.RESOURCE_UPDATED,e=>{o.invalidateResourceType(e.resourceType),d$(`invalidated by resource update`,{resourceType:e.resourceType,deliveryTarget:e.deliveryTarget,isScopeRoom:e.deliveryTarget===$c.SCOPE_ROOM_NOTIFICATION})}),r=e(ro.RESOURCE_DELETED,e=>{o.invalidateResourceType(e.resourceType)});return()=>{n(),r()}},[e,t,o]),null},m$;(function(e){e.CTRL=`ctrl`,e.ALT=`alt`,e.SHIFT=`shift`,e.META=`meta`,e.MOD=`mod`})(m$||={});function h$(){return typeof navigator<`u`&&navigator.platform.toLowerCase().includes(`mac`)}var g$=-100,_$={[y.COMPONENT]:2,[y.PAGE]:1,[y.GLOBAL]:0};function v$(e){return e.length===1&&!/[a-z0-9]/i.test(e)}function y$(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(m$.CTRL);break;case`alt`:case`option`:n.push(m$.ALT);break;case`shift`:n.push(m$.SHIFT);break;case`meta`:case`cmd`:case`command`:case`win`:case`windows`:n.push(m$.META);break;case`mod`:n.push(m$.MOD);break;default:r=e}v$(r)&&(n=n.filter(e=>e!==m$.SHIFT));let i=h$(),a=[];return n.includes(m$.MOD)&&a.push(i?`⌘`:`Ctrl`),n.includes(m$.CTRL)&&a.push(i?`⌃`:`Ctrl`),n.includes(m$.ALT)&&a.push(i?`⌥`:`Alt`),n.includes(m$.SHIFT)&&a.push(i?`⇧`:`Shift`),n.includes(m$.META)&&a.push(i?`⌘`:`Win`),a.push(r.toUpperCase()),{modifiers:n,key:r,chord:[...[...n].sort(),r].join(`+`),display:a.join(i?``:`+`)}}function b$(e,t){let n=e.ctrlKey,r=e.altKey,i=e.shiftKey,a=e.metaKey,o=t.modifiers.includes(m$.MOD),s=h$(),c=t.modifiers.includes(m$.CTRL)||o&&!s,l=t.modifiers.includes(m$.ALT),u=t.modifiers.includes(m$.SHIFT),d=t.modifiers.includes(m$.META)||o&&s;return n!==c||r!==l||!v$(t.key)&&i!==u||a!==d?!1:e.key.toLowerCase()===t.key}var x$=(0,Q.createContext)(null);function S$(e,t){return e===t||e===y.GLOBAL||t===y.GLOBAL}var C$=({children:e,initialScope:t=y.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=y$(e.shortcut),n=Array.from(o.current.values()).filter(n=>n.id!==e.id&&n.parsed.chord===t.chord&&S$(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&&S$(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===y.PAGE&&n!==y.PAGE||t.scope===y.COMPONENT&&n!==y.COMPONENT||r&&t.scope!==y.GLOBAL||!b$(e,t.parsed))continue;let i=[t.priority??0,_$[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)(x$.Provider,{value:_,children:e})};function w$(){let e=(0,Q.useContext)(x$);if(!e)throw Error(`useHotkeyRegistry must be used within a HotkeyRegistryProvider`);return e}var T$=0;function TSe(e,t,n={}){let{register:r}=w$(),i=(0,Q.useMemo)(()=>n.id??`hotkey-${++T$}`,[n.id]);return(0,Q.useEffect)(()=>{let a={id:i,shortcut:e,handler:t,description:n.description??e,scope:n.scope??y.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)(()=>y$(e),[e])}function ESe(e){let{register:t}=w$();(0,Q.useEffect)(()=>{let n=[];for(let r of e){let e={id:r.id??`hotkey-batch-${++T$}`,shortcut:r.shortcut,handler:r.handler,description:r.description??r.shortcut,scope:r.scope??y.GLOBAL,enabled:r.enabled!==!1,group:r.group};n.push(t(e))}return()=>{for(let e of n)e()}},[e,t])}function DSe(){let{pause:e,resume:t,isPaused:n}=w$();return{pause:e,resume:t,isPaused:n}}function OSe(){let{activeScope:e,setActiveScope:t}=w$();return{activeScope:e,setActiveScope:t}}function E$(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 kSe(e,t){switch(e){case void 0:return!0;case rn.USER_SELF:return!!t.currentUserId;case rn.ORGANIZATIONS:return!!t.currentOrganizationId;case rn.APPLICATION:return!!t.currentApplicationId;case rn.ANONYMOUS:return!!t.currentAnonymousUserId}}function ASe(e,t){return Im(e,t)}function jSe(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 MSe(e,t){return(e??[]).every(e=>t.includes(e))}function NSe(e,t){return MSe(e.requiredEngineCapabilities,t.enabledEngineCapabilities)&&fS(e.runtimeAvailability,t.runtimeContext)&&ASe(e.requiredRoles,t.runtimeContext.effectiveRoles)&&jSe(e.requiredFeatures,t.enabledFeatures)}function PSe(e,t){if(e.target.kind!==ov.SUB_TABS)return e;let n=e.target.subTabs.filter(e=>fS(e.runtimeAvailability,t.runtimeContext));return n.length===0?null:n.length===e.target.subTabs.length?e:{...e,target:{...e.target,subTabs:n}}}function FSe(e,t){let n=e.categories.filter(e=>kSe(e.scope,t.scopeIds)),r=new Set(n.map(e=>e.ref)),i=e.sections.flatMap(e=>{if(!r.has(e.categoryRef)||!NSe(e,t))return[];let n=PSe(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 ISe=[];function D$(){let e=Ev(),t=Zp(),n=(0,Q.useContext)(hh)?.resolvedFeatures,r=dS(),i=(0,Q.useContext)(Vi),a=i?.appIdentity?.applicationId??t?.currentApplicationId??null,o=i?.appConfig?.enabledEngineCapabilities??ISe;return(0,Q.useMemo)(()=>FSe(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 LSe=Object.values(Eo).map(e=>`${e.i18nKey}.title`);function O$(){let{registry:e}=fm(),{compositeViews:t,fullCustomViews:n,flowsActorsViews:r}=Ng(),i=Zp(),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=>kY(e.translationRef)),r=e?.resourceConfigurations?Object.values(e.resourceConfigurations).flatMap(e=>e.frontendConfiguration?.compositeViews?.map(e=>kY(e.translationRef))??[]):[];return Array.from(new Set([...n,...r]))},[t,e]),s=(0,Q.useMemo)(()=>{let t=[...(n??[]).map(e=>AY({family:ho.FULL_CUSTOM,translationRef:jY(e.ref)})),...(r??[]).map(e=>AY({family:ho.FLOWS_ACTORS,translationRef:jY(e.ref)}))],i=e?.resourceConfigurations?Object.entries(e.resourceConfigurations).flatMap(([e,t])=>[...t.frontendConfiguration?.chartViews?.map(t=>AY({family:ho.CHART,translationRef:MY(e,t.ref)}))??[],...t.frontendConfiguration?.executionViews?.map(t=>AY({family:ho.EXECUTION,translationRef:MY(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}=q({resource:a,keys:[...o,...s,...LSe,Zm]}),h=rS(),{sections:g}=Ev(),_=(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}=D$(),b=(0,Q.useMemo)(()=>rh(g.map(e=>e.ref),y.map(e=>e.ref)),[g,y]),x=(0,Q.useMemo)(()=>(e,t)=>FY({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 RSe={[qa.HOTKEY_SIDEBAR_TOGGLE]:`engine.hotkeys.sidebarToggle`,[qa.HOTKEY_NOTIFICATIONS_OPEN]:`engine.hotkeys.notificationsOpen`,[qa.HOTKEY_QUICK_SWITCHER_OPEN]:`engine.hotkeys.quickSwitcherOpen`,[qa.HOTKEY_SHORTCUTS_HELP]:`engine.hotkeys.shortcutsHelp`},k$=[{event:qa.HOTKEY_SIDEBAR_TOGGLE,shortcut:`Mod+B`,scope:y.GLOBAL,group:_i.NAVIGATION},{event:qa.HOTKEY_QUICK_SWITCHER_OPEN,shortcut:`Mod+P`,scope:y.GLOBAL,group:_i.NAVIGATION},{event:qa.HOTKEY_NOTIFICATIONS_OPEN,shortcut:`Mod+I`,scope:y.GLOBAL,group:_i.NAVIGATION}];function zSe(e){return k$.includes(e)}function BSe(e){switch(e){case qa.HOTKEY_QUICK_SWITCHER_OPEN:return Ol.QUICK_SWITCHER;case qa.HOTKEY_NOTIFICATIONS_OPEN:return Ol.NOTIFICATION_CENTER;default:return}}function A$(){let{register:e}=w$(),{emit:t}=Uo(),n=O$(),{navigate:r}=yS(),{appComponentsConfiguration:i}=Ng(),a=dS(),o=i?.[Ol.HOTKEY],s=typeof o==`object`&&o?o.bindings:void 0,c=(0,Q.useMemo)(()=>Tue(s,a),[s,a]),l=typeof o==`object`&&o?o.emitShortcuts:void 0,u=(0,Q.useMemo)(()=>E$(k$,l),[l]),d=(0,Q.useMemo)(()=>!c||!n?[]:Th(c,n),[c,n]);return(0,Q.useEffect)(()=>{let i=[],a=e=>{let t=e.descriptionLabellingRef??RSe[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??y.GLOBAL,group:n.group,handler:()=>{switch(n.event){case qa.HOTKEY_SIDEBAR_TOGGLE:t(hc.HOTKEY_SIDEBAR_TOGGLE,{});break;case qa.HOTKEY_NOTIFICATIONS_OPEN:t(hc.HOTKEY_NOTIFICATIONS_OPEN,{});break;case qa.HOTKEY_QUICK_SWITCHER_OPEN:t(hc.HOTKEY_QUICK_SWITCHER_OPEN,{});break;case qa.HOTKEY_SHORTCUTS_HELP:t(hc.HOTKEY_SHORTCUTS_HELP,{})}},launcher:BSe(n.event),preventDefault:n.preventDefault!==!1,priority:zSe(n)?g$: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??y.GLOBAL,group:_i.ACTIONS,handler:()=>{Hm.dispatchNavigationForResolvedTarget(r,t,Ol.HOTKEY)},launcher:Ol.HOTKEY,preventDefault:!0}));return()=>{for(let e of i)e()}},[e,t,d,r,u,n]),null}function j$({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_KBD,`Kbd`)(e);return(0,$.jsx)(n,{...t})}j$.displayName=`Kbd`;var M$=[_i.NAVIGATION,_i.ACTIONS,_i.HELP,`other`];function VSe(e,t){switch(e){case _i.NAVIGATION:return t(`navigation`);case _i.ACTIONS:return t(`actions`);case _i.HELP:return t(`help`);default:return t(`other`)}}function N$(e,t){switch(e){case y.GLOBAL:return t(`shortcutsHelpScopeGlobal`);case y.PAGE:return t(`shortcutsHelpScopePage`);case y.COMPONENT:return t(`shortcutsHelpScopeComponent`);default:return t(`shortcutsHelpScopeUnknown`)}}function P$(){let[e,t]=(0,Q.useState)(!1),{on:n}=Uo(),{getHotkeys:r,getConflicts:i,activeScope:a,isPaused:o}=w$(),{t:s,tComponent:c,isReady:l}=q({component:K.APPLICATION_LEVEL_COMMAND_MENU});(0,Q.useEffect)(()=>n(hc.HOTKEY_SHORTCUTS_HELP,()=>{t(e=>!e)}),[n]);let u=(e,t)=>yp({tComponent:c,componentType:K.APPLICATION_LEVEL_COMMAND_MENU,key:e,params:t}),d=(0,Q.useMemo)(()=>e?r().slice().sort((e,t)=>{let n=M$.indexOf(e.group??`other`),r=M$.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 M$.map(t=>({group:t,label:VSe(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=Ap({t:s,key:`engine.hotkeys.shortcutsHelp`});return(0,$.jsx)(qW,{open:e,onOpenChange:t,children:(0,$.jsxs)(YW,{className:`max-w-3xl pt-10`,children:[(0,$.jsx)(ZW,{children:(0,$.jsx)($W,{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`),`: `,N$(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)(Wd,{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:N$(e.scope,u)}),e.launcher&&(0,$.jsx)(`span`,{children:e.launcher}),(0,$.jsx)(`span`,{children:e.id})]})]}),(0,$.jsx)(j$,{children:e.parsed.display})]},e.id))})]},e))})})]})]})})}function HSe(e){return typeof e==`string`?e:no.createOperationPathKey(e)}function USe(e,t){let n=e.resourceConfigurations[t.resourceIdentifier];return n&&n.operations.find(e=>{let n=no.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!==oe.API_CALL||n.isBulkOperation===!0==(t.isBulkOperation===!0)})||null}function WSe({children:e}){let t=fm(),n=Zp(),r=(0,Q.useCallback)(async(e,r,i)=>{if(!n)return t.doOperation(e,r,i);let a=HSe(e),o=null;try{o=no.parseOperationPathKey(a)}catch{o=null}let s=o?USe(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:xse({initiatorInfos:s.initiatorInfos,targetResourceType:s.resourceIdentifier,registry:t.registry,ownContextualParameters:{...Object.fromEntries(Object.entries(c).filter(([e])=>Tse.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=>ise.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)(sm.Provider,{value:a,children:e})}function GSe(){let e=Lh(),{notifyError:t}=Fm(),n=cp(),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 KSe(){let{currentOrganizationId:e}=ng(),{isLoading:t,isFeatureEnabled:n,resolvedForOrganizationId:r}=vh(),{doOperation:i,registry:a}=fm(),{emit:o,on:s}=Uo(),{httpClient:c}=Su(),[l,u]=(0,Q.useState)(0),d=e??null,f=d!==null&&!t&&r===d&&n(Uu.CUSTOM_BRANDING);return(0,Q.useEffect)(()=>s(hc.RESOURCE_OPERATION_EXECUTED,()=>u(e=>e+1),e=>e.resourceType===Wo.ORGANIZATION_PROFILES&&!oa(e.operation??{operationIdentifier:e.operationIdentifier})),[s]),(0,Q.useEffect)(()=>{let e=!1,t=t=>{if(e)return;let n=d===null?void 0:Hu(t?.logo),r=n&&d!==null?`${c.getBaseURL().replace(/\/+$/,``)}${Ir}${St(d,cae.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=Xm(a.resourceConfigurations[Wo.ORGANIZATION_PROFILES]);return!f||d===null||!n?(t(null),()=>{e=!0}):(i(no.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 F$=[{componentType:K.APP_LAYOUTS_MAIN_CONTAINER,preset:H.DEFAULT},{componentType:K.PUBLIC_LAYOUTS_MAIN_CONTAINER,preset:H.DEFAULT}];function qSe({children:e}){let{frontendConfiguration:t,markComponentInitialized:n}=Su(),{on:r}=Uo(),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(Ie.UI),[n]);return(0,$.jsx)(Fg,{frontendConfiguration:t,subscribeToUserPreferences:i,subscribeToOrganizationBranding:a,markInitialized:o,children:e})}function I$(e){return typeof e==`object`&&!!e}function L$(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 JSe(e){return e.split(/[\s_-]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function R$(e){if(typeof e==`string`&&e.trim().length!==0)return JSe(e.trim())}function YSe(e){if(I$(e)&&I$(e.initializationDiagnostics))return e.initializationDiagnostics}function XSe(e,t){if(t&&I$(t.wildoError))return t.wildoError;if(I$(e)&&I$(e.wildoError))return e.wildoError}function ZSe(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 QSe(e,t,n){return t&&typeof t.errorMessage==`string`&&t.errorMessage.trim().length>0?t.errorMessage:n&&I$(n.context)&&typeof n.context.message==`string`?n.context.message:e instanceof Error?e.message:typeof e==`string`?e:L$(e)}function $Se(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 z$(e){let t=[{label:`Application`,value:e.startupAppName}],n=R$(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 eCe(e){return!e||e.length===0?`root`:e.map(e=>typeof e==`string`?e:String(e)).join(` > `)}function tCe(e,t){let n=YSe(e),r=XSe(e,n),i=QSe(e,n,r),a=ZSe(i),o=L$(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=>`${eCe(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:z$({diagnostics:n,wildoError:r,startupAppName:t})}}let s=$Se(r&&I$(r.context)?r.context:void 0),c=R$(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:z$({diagnostics:n,wildoError:r,startupAppName:t})}}function B$(e){return window.location.pathname===`/signing/returned`?(0,$.jsx)($.Fragment,{}):(0,$.jsx)(nCe,{...e})}function nCe({options:e}){let t=(0,Q.useMemo)(()=>one(e.featureConfiguration),[e.featureConfiguration]),n=(0,Q.useMemo)(()=>tl.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)({[Ie.MAIN_CONTEXT]:!1,[Ie.UI]:!1,[Ie.LOADER]:!1,[Ie.ERRORS]:!1,[Ie.ROUTER]:!1,[Ie.I18N]:!1,[Ie.APP_MAIN_CONTAINER]:!1,[Ie.PUBLIC_APP_CONTAINER]:!1}),m=(0,Q.useCallback)(e=>e[Ie.MAIN_CONTEXT]&&e[Ie.UI]&&e[Ie.APP_MAIN_CONTAINER]&&e[Ie.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?tCe(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(Ie.MAIN_CONTEXT),h(Ie.LOADER),h(Ie.ERRORS),h(Ie.ROUTER),h(Ie.APP_MAIN_CONTAINER),h(Ie.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{Zi.initializeGlobalErrorHandlers(),ui.injectEnvironmentVariables(YV(e.env,window.location));let i=ui.loadEnvironmentConfig(),a={apiBaseUrl:e.apiBaseUrl??i.apiBaseUrl};d(a);let o=await HQ.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(),Ko.assertRequiredRegistrations(`SaaS application`,F$)},onInitialized:()=>{r(`Application initialized successfully`)},onError:e=>{n.error(`Application initialization failed`,{error:e.message,details:e}),s(e)}});Ko.assertRequiredRegistrations(`SaaS application`,F$),l(o),h(Ie.MAIN_CONTEXT),h(Ie.LOADER),h(Ie.ERRORS),h(Ie.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 nm:void 0,[]);if(o&&b)return ui.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)(Zxe,{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)(Jy,{size:48})})}let w=(0,$.jsx)(Ry,{children:(0,$.jsx)(Bm,{children:(0,$.jsx)(nb,{children:(0,$.jsx)(op,{children:(0,$.jsxs)(rm,{tokenStorage:C,children:[(0,$.jsx)(Gy,{}),(0,$.jsx)(gH,{children:(0,$.jsxs)(Tm,{children:[(0,$.jsx)(wSe,{}),(0,$.jsx)(ZQ,{}),(0,$.jsx)(SSe,{}),(0,$.jsx)(Vse,{customRoles:e.customRoles,children:(0,$.jsx)(Lm,{children:(0,$.jsx)(Jx,{children:(0,$.jsxs)(xh,{productDefinitions:e.productDefinitions,children:[(0,$.jsx)(GSe,{}),(0,$.jsxs)(Qh,{featureConfiguration:t,children:[(0,$.jsx)(KSe,{}),(0,$.jsx)(WSe,{children:(0,$.jsx)(uU,{children:(0,$.jsx)(hW,{children:(0,$.jsxs)(eh,{children:[(0,$.jsx)(A$,{}),(0,$.jsx)(P$,{}),(0,$.jsx)(Jxe,{})]})})})})]})]})})})})]})})]})})})})});v.current===null&&(v.current=$h([{path:`/*`,element:w,errorElement:(0,$.jsx)(Hy,{})}]));let T=v.current;return(0,$.jsx)(dt,{children:(0,$.jsx)(Em,{children:(0,$.jsx)(Vi.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)(qSe,{children:(0,$.jsx)(Ni,{children:(0,$.jsx)(ou,{children:(0,$.jsx)(Um,{children:(0,$.jsx)(C$,{children:(0,$.jsx)(Xp,{resourcesRepository:c.resourceRepository,children:(0,$.jsx)(yx,{children:(0,$.jsx)(l$,{children:(0,$.jsx)(GQ,{children:(0,$.jsxs)(u_e,{apiBaseUrl:u.apiBaseUrl,children:[(0,$.jsx)($Q,{}),(0,$.jsx)(uye,{}),(0,$.jsx)(n$,{}),(0,$.jsx)(UQ,{}),(0,$.jsx)(WQ,{}),(0,$.jsx)(XV,{router:T})]})})})})})})})})})})})})})}function rCe(e){let t=ym()?.registry,n=rS(),{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||N.includes(e.variantType)).some(e=>Wm({...e,resourceType:r},n)):!1},[t,r,i,a,n])}var iCe=[ql.SECONDARY,ql.COMPANION];function aCe(e){let{zones:t,viewport:n,contentAreaWidth:r,reconcileCollapsedZones:i,navigationState:a}=e;(0,Q.useEffect)(()=>{i(iCe.map(e=>({zone:e,mode:Mh({zoneConfig:t?.[e],viewport:n,contentAreaWidth:r}),contentModel:t?.[e]?.contentModel})))},[t,n,r,i,a])}function V$(e){return e.contentType===Sa.COMPOSITE_VIEW||e.contentType===Sa.CHART_VIEW||e.contentType===Sa.FULL_CUSTOM_VIEW||e.contentType===Sa.FLOWS_ACTORS_VIEW||e.contentType===Sa.EXECUTION_VIEW}function H$(e,t={}){let{keepOperationTitle:n=!1}=t,r=e?.content?.contentType===Sa.RESOURCE_OPERATION?e.content.resourceContext.resourceType:void 0,i=(0,Q.useMemo)(()=>{if(e?.content.contentType!==Sa.COMPOSITE_VIEW)return[];let t=NY(e.content.viewRef);return t?[kY(t)]:[]},[e]),a=(0,Q.useMemo)(()=>{let t=e?.content;if(!t||!V$(t)||t.contentType===Sa.COMPOSITE_VIEW)return[];let n=PY({viewRef:t.viewRef,contentType:t.contentType});return n?[AY(n)]:[]},[e]),o=ym()?.registry.resourceConfigurations[r??``]?.operations,{tResourceOperation:s,tCompositeView:c,tView:l}=q({resource:r,keys:[...i,...a]});return(0,Q.useMemo)(()=>{if(!e)return{title:``};let{content:t}=e;if(t.contentType===Sa.RESOURCE_OPERATION){let{resourceType:e,operationIdentifier:r}=t.resourceContext,i=n?String(r):bo(r,o);return{title:s(e,i,`title`)}}return V$(t)?{title:FY({viewRef:t.viewRef,contentType:t.contentType,tCompositeView:c,tView:l})}:t.contentType===Sa.SETTINGS_HUB?{title:`Settings`}:{title:``}},[e,o,n,c,s,l])}function oCe(){let e=(0,Q.useContext)(xH),t=Zp()?.currentOrganizationId,{getZoneState:n}=kx();return(0,Q.useCallback)(r=>Cse({entryOrganizationId:Yh(r.content),entryOwnsBrowserUrl:Nh(r,n),currentOrganizationId:t,routeDecision:e}),[e,t,n])}var sCe=({wildoError:e})=>{let t=cp();return(0,$.jsx)(`div`,{className:`space-y-element`,children:(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground whitespace-pre-wrap`,children:t(e)})})},U$=rc(K.LOW_LEVEL_RESIZABLE_PANEL_GROUP,`ResizablePanelGroup`,[`Panel`,`Handle`]);function W$({preset:e=H.DEFAULT,...t}){let n=U$(e);return(0,$.jsx)(n,{...t})}function G$({preset:e=H.DEFAULT,...t}){let n=U$(e);return(0,$.jsx)(n.Panel,{...t})}function K$({preset:e=H.DEFAULT,...t}){let n=U$(e);return(0,$.jsx)(n.Handle,{...t})}var q$=rc(K.LOW_LEVEL_SHEET,`Sheet`,[`Trigger`,`Content`,`Close`,`Header`,`Footer`,`Title`,`Description`]);function J$({preset:e=H.DEFAULT,...t}){let n=q$(e);return(0,$.jsx)(n,{...t})}var Y$=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=q$(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});Y$.displayName=`SheetTrigger`;var X$=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=q$(e);return(0,$.jsx)(r.Content,{...t,ref:n})});X$.displayName=`SheetContent`;function cCe({preset:e=H.DEFAULT,...t}){let n=q$(e);return(0,$.jsx)(n.Close,{...t})}function Z$({preset:e=H.DEFAULT,...t}){let n=q$(e);return(0,$.jsx)(n.Header,{...t})}function Q$({preset:e=H.DEFAULT,...t}){let n=q$(e);return(0,$.jsx)(n.Footer,{...t})}var $$=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=q$(e);return(0,$.jsx)(r.Title,{...t,ref:n})});$$.displayName=`SheetTitle`;var e1=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=q$(e);return(0,$.jsx)(r.Description,{...t,ref:n})});e1.displayName=`SheetDescription`;var t1=rc(K.LOW_LEVEL_DRAWER,`Drawer`,[`Trigger`,`Content`,`Close`,`Header`,`Footer`,`Title`,`Description`]);function n1({preset:e=H.DEFAULT,...t}){let n=t1(e);return(0,$.jsx)(n,{...t})}var r1=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=t1(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});r1.displayName=`DrawerTrigger`;var i1=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=t1(e);return(0,$.jsx)(r.Content,{...t,ref:n})});i1.displayName=`DrawerContent`;function a1({preset:e=H.DEFAULT,...t}){let n=t1(e);return(0,$.jsx)(n.Close,{...t})}function o1({preset:e=H.DEFAULT,...t}){let n=t1(e);return(0,$.jsx)(n.Header,{...t})}function s1({preset:e=H.DEFAULT,...t}){let n=t1(e);return(0,$.jsx)(n.Footer,{...t})}var c1=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=t1(e);return(0,$.jsx)(r.Title,{...t,ref:n})});c1.displayName=`DrawerTitle`;var l1=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=t1(e);return(0,$.jsx)(r.Description,{...t,ref:n})});l1.displayName=`DrawerDescription`;function u1({requestedMode:e,isMobileViewport:t,mobileShape:n}){if(e===Fn.DIALOG&&t){if(n===`drawer`)return Fn.DRAWER;if(n===`sheet`)return Fn.SHEET}return e}function d1(){let e=null;return{resolve(t){let n=u1(t);return t.open===!0?(e??=n,e):(e=null,n)},reset(){e=null}}}var f1=({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}=Ng(),E=(0,Q.useRef)(null);E.current===null&&(E.current=d1());let D=T?.(V.OVERLAY,u),O=E.current.resolve({open:S,requestedMode:v,isMobileViewport:w,mobileShape:D?.geometry?.mobileShape}),{tComponent:k,isReady:A}=q({component:[K.LOW_LEVEL_OVERLAY_CONTAINER,K.LOW_LEVEL_DIALOG,K.LOW_LEVEL_SHEET,K.LOW_LEVEL_DRAWER]}),j=(e,t)=>yp({tComponent:k,componentType:K.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`),L=j(`close`),R=_Ce(O,k),z=i||R,B=a||!i,ee=(0,Q.useMemo)(()=>l.closeOnEscape===!1?e=>e.preventDefault():void 0,[l.closeOnEscape]);if(!A)return null;switch(O){case Fn.DIALOG:return(0,$.jsx)(m1,{open:e,onOpenChange:C,trigger:n,title:z,titleVisuallyHidden:B,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:ee,children:s});case Fn.ALERT:return(0,$.jsx)(lCe,{open:e,onOpenChange:C,trigger:n,title:z,titleVisuallyHidden:B,description:o,cancelText:M,confirmText:N,onConfirm:m,onCancel:h,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:ee,children:s});case Fn.SHEET:return(0,$.jsx)(uCe,{open:e,onOpenChange:C,trigger:n,title:z,titleVisuallyHidden:B,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:ee,children:s});case Fn.DRAWER:return(0,$.jsx)(dCe,{open:e,onOpenChange:C,trigger:n,title:z,titleVisuallyHidden:B,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,children:s});case Fn.COMMAND:return(0,$.jsx)(fCe,{open:e,onOpenChange:C,placeholder:P,emptyLabel:F,groupLabel:I,items:_,config:y,surfacePolicyOverride:u,className:d,children:s});case Fn.POPOVER:return(0,$.jsx)(pCe,{open:e,onOpenChange:C,trigger:n,anchor:r,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:ee,children:s});case Fn.LIGHTBOX:return(0,$.jsx)(mCe,{open:e,onOpenChange:C,trigger:n,title:z,titleVisuallyHidden:B,closeLabel:L,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:ee,children:s});case Fn.ACTION_SHEET:return(0,$.jsx)(hCe,{open:e,onOpenChange:C,trigger:n,title:z,cancelText:M,config:y,surfacePolicyOverride:u,className:d,children:s});case Fn.TOAST:return null;default:return(0,$.jsx)(m1,{open:e,onOpenChange:C,trigger:n,title:z,description:o,footer:c,config:y,surfacePolicyOverride:u,className:d,onEscapeKeyDown:ee,children:s})}};function p1(e){return e?{}:{"aria-describedby":void 0}}var m1=({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=gCe(s.size);return(0,$.jsxs)(qW,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(JW,{asChild:!0,children:n}),(0,$.jsxs)(YW,{surfacePolicyOverride:c,className:G(f,l),...p1(a),onEscapeKeyDown:d,children:[i&&!a?r&&(0,$.jsx)($W,{className:`sr-only`,children:r}):(r||a)&&(0,$.jsxs)(ZW,{children:[r&&(0,$.jsx)($W,{className:i?`sr-only`:void 0,children:r}),a&&(0,$.jsx)(eG,{children:a})]}),u,o&&(0,$.jsx)(QW,{children:o})]})]})},lCe=({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)(Iw,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(Lw,{asChild:!0,children:n}),(0,$.jsxs)(Rw,{surfacePolicyOverride:u,className:d,onEscapeKeyDown:p,children:[(0,$.jsxs)(zw,{children:[r&&(0,$.jsx)(Vw,{children:r}),i&&(0,$.jsx)(Hw,{children:i})]}),f,(0,$.jsxs)(Bw,{children:[(0,$.jsx)(Ww,{onClick:c,children:a}),(0,$.jsx)(Uw,{onClick:s,children:o})]})]})]}),uCe=({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??hu.END,p=typeof f==`string`&&!Object.values(hu).includes(f)?f:ju(f,document.documentElement.dir===`rtl`?`rtl`:`ltr`);return(0,$.jsxs)(J$,{open:e,onOpenChange:t,modal:s.modal??!0,children:[n&&(0,$.jsx)(Y$,{asChild:!0,children:n}),(0,$.jsxs)(X$,{surfacePolicyOverride:c,side:p,className:l,...p1(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)(Z$,{children:[r&&(0,$.jsx)($$,{className:i?`sr-only`:void 0,children:r}),a&&(0,$.jsx)(e1,{children:a})]}),u,o&&(0,$.jsx)(Q$,{children:o})]})]})},dCe=({open:e,onOpenChange:t,trigger:n,title:r,titleVisuallyHidden:i,description:a,footer:o,config:s,surfacePolicyOverride:c,className:l,children:u})=>(0,$.jsxs)(n1,{open:e,onOpenChange:t,direction:`bottom`,snapPoints:s.snapPoints,dismissible:s.closeOnEscape!==!1&&s.dismissible,children:[n&&(0,$.jsx)(r1,{asChild:!0,children:n}),(0,$.jsxs)(i1,{surfacePolicyOverride:c,className:l,...p1(a),children:[(r||a)&&(0,$.jsxs)(o1,{children:[r&&(0,$.jsx)(c1,{className:i?`sr-only`:void 0,children:r}),a&&(0,$.jsx)(l1,{children:a})]}),(0,$.jsx)(`div`,{className:`px-container pb-card`,children:u}),o&&(0,$.jsx)(s1,{children:o})]})]}),fCe=({open:e,onOpenChange:t,placeholder:n,emptyLabel:r,groupLabel:i,items:a,surfacePolicyOverride:o,className:s,children:c})=>(0,$.jsxs)(hV,{open:e,onOpenChange:t,surfacePolicyOverride:o,children:[(0,$.jsx)(gV,{placeholder:n}),(0,$.jsxs)(_V,{className:s,children:[(0,$.jsx)(vV,{children:r}),a.length>0&&(0,$.jsx)(yV,{heading:i,children:a.map(e=>(0,$.jsxs)(bV,{onSelect:e.onSelect,children:[(0,$.jsx)(`span`,{children:e.label}),e.shortcut&&(0,$.jsx)(j$,{className:`ms-auto`,children:e.shortcut})]},e.id))}),c]})]}),pCe=({open:e,onOpenChange:t,trigger:n,anchor:r,surfacePolicyOverride:i,className:a,children:o,onEscapeKeyDown:s})=>(0,$.jsxs)(QK,{open:e,onOpenChange:t,children:[r&&(0,$.jsx)(tq,{asChild:!0,children:(0,$.jsx)(`span`,{ref:r})}),n&&(0,$.jsx)($K,{asChild:!0,children:n}),(0,$.jsx)(eq,{surfacePolicyOverride:i,className:a,onEscapeKeyDown:s,children:o})]}),mCe=({open:e,onOpenChange:t,trigger:n,title:r,titleVisuallyHidden:i,closeLabel:a,surfacePolicyOverride:o,className:s,children:c,onEscapeKeyDown:l})=>{let{getRecipe:u}=Ng(),d=u(It.OVERLAY_BACKDROP);return(0,$.jsxs)(qW,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(JW,{asChild:!0,children:n}),(0,$.jsxs)(YW,{surfacePolicyOverride:o,showCloseButton:!1,onEscapeKeyDown:l,...p1(void 0),className:G(`max-w-[90vw] max-h-[90vh] p-0 overflow-hidden`,d.base,s),children:[(0,$.jsxs)(XW,{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)($W,{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)($W,{className:`text-white text-center text-base font-normal tracking-normal leading-normal`,children:r})})]})]})},hCe=({open:e,onOpenChange:t,trigger:n,title:r,cancelText:i,surfacePolicyOverride:a,className:o,children:s})=>(0,$.jsxs)(n1,{open:e,onOpenChange:t,children:[n&&(0,$.jsx)(r1,{asChild:!0,children:n}),(0,$.jsxs)(i1,{surfacePolicyOverride:a,className:o,children:[r&&(0,$.jsx)(o1,{className:`text-center`,children:(0,$.jsx)(c1,{className:`text-sm font-normal text-muted-foreground`,children:r})}),(0,$.jsx)(`div`,{className:`px-card-sm pb-card`,children:s}),(0,$.jsx)(s1,{className:`pt-element border-t`,children:(0,$.jsx)(a1,{asChild:!0,children:(0,$.jsx)(Y,{variant:X.OUTLINE,className:`w-full`,children:i})})})]})]});function gCe(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 _Ce(e,t){switch(e){case Fn.DIALOG:return yp({tComponent:t,componentType:K.LOW_LEVEL_DIALOG,key:`defaultTitle`});case Fn.SHEET:return yp({tComponent:t,componentType:K.LOW_LEVEL_SHEET,key:`defaultTitle`});case Fn.DRAWER:return yp({tComponent:t,componentType:K.LOW_LEVEL_DRAWER,key:`defaultTitle`});default:return``}}f1.displayName=`OverlayContainer`;var vCe=`w-full max-w-md overflow-y-auto`,yCe=`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`,h1=`w-full h-[min(92vh,56rem)] p-0 gap-0 overflow-hidden`,bCe=`${h1} max-w-6xl`,xCe=`${h1} max-w-[min(94vw,88rem)]`;function SCe(e){return e?xCe:bCe}function g1(e){switch(e){case Qo.SHEET:return Fn.SHEET;case Qo.DRAWER:return Fn.DRAWER;case Qo.DIALOG:default:return Fn.DIALOG}}function CCe(e){return e===Fn.SHEET?vCe:yCe}var wCe=[J.LIST,J.SEARCH];function _1(e){return e.kind===ov.SUB_TABS?e.subTabs.map(e=>e.target):[e]}function TCe(e){return e===ci.VERTICAL_TABS}var ECe={[sv.SECURITY]:!1,[sv.APPEARANCE]:!1,[sv.INVITATIONS]:!1,[sv.BILLING]:!0,[sv.CONNECTED_ACCOUNTS]:!1,[sv.ORGANIZATION_CONNECTED_ACCOUNTS]:!1,[sv.APPLICATION_CONNECTED_ACCOUNTS]:!1,[sv.AGENT_WORK_OVERRIDE_RATE]:!1,[sv.AUTONOMOUS_AGENTS]:!1,[sv.AGENT_ACTIVITY]:!1,[sv.APPLICATION_AGENT_ACTIVITY]:!1,[sv.MODEL_COST_BREAKDOWN]:!1,[sv.REPRESENTING_ORGANIZATION_MODEL_COST_BREAKDOWN]:!1,[sv.REPRESENTATIVE_ACTIVITY]:!1,[sv.AGENT_WORK_EVALUATION_EXPORT]:!1};function DCe(e){return e.kind===ov.ENGINE_PANEL?ECe[e.panelRef]:e.kind===ov.RESOURCE_OPERATION&&wCe.includes(String(e.operation))}function OCe(e){return _1(e).some(DCe)}function kCe(e,t,n){if(!t)return!1;let r=e.find(e=>e.ref===t);return r?OCe(r.target)?!0:_1(r.target).some(e=>e.kind===ov.RESOURCE_OPERATION&&TCe(n(e.resourceType))):!1}function v1({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_SEPARATOR,`Separator`)(e);return(0,$.jsx)(n,{...t})}var y1;(function(e){e.ACTIVE=`active`,e.INACTIVE=`inactive`,e.UNAVAILABLE=`unavailable`})(y1||={});var ACe={[y1.ACTIVE]:`success`,[y1.INACTIVE]:`outline`,[y1.UNAVAILABLE]:`secondary`},b1=({icon:e,title:t,description:n,state:r,statusLabel:i,meta:a,action:o,children:s})=>{let{renderIcon:c}=ef(),l=r===y1.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:G(`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:tr.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)(Jd,{variant:ACe[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})]})},jCe=()=>{let{auth:e}=Su(),{auth:t,signOutEverywhere:n}=hm(),{user:r}=ng(),i=Gx(),a=cp(),[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)(()=>rb(u.map(e=>xd(e.providerRef))),[u]),{tComponent:T,t:E,isReady:D,formatDate:O}=q({component:[K.APP_LAYOUTS_SECURITY_SETTINGS,K.PUBLIC_LAYOUTS_USER_REGISTER,K.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED],keys:w}),k=(0,Q.useCallback)((e,t)=>T(K.APP_LAYOUTS_SECURITY_SETTINGS,e,t),[T]),A=(0,Q.useCallback)(e=>T(K.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=vc(),[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(et.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 L=Ue.getEnrollableSecondFactorMethods(),R=o.filter(e=>e.enrolled&&L.includes(e.method)).map(e=>e.method),z=Km.evaluateAccountCompleteness(t.identification?.requiresMFA??!1,t.identification?.secondFactorMethods?.map(e=>e.method)??[],R.length>0?R:t.enrolledSecondFactorMethods,i.userTypeAuth?.mfaPolicy?.acceptableMFAMethods??[]),B=o.some(e=>e.method===mt.PASSWORD&&e.enrolled),ee=o.some(e=>e.method===mt.TOTP&&e.enrolled),te=o.find(e=>e.method===mt.SMS_OTP),ne=te?.enrolled??!1,V=te?.details?.phoneNumber,re=(0,Q.useMemo)(()=>u.map(t=>({...t,providerLabel:ib({providerRef:t.providerRef,displayName:e?.socialOAuth2Providers?.[t.providerRef]?.displayName,translate:E})})),[e?.socialOAuth2Providers,u,E]),ie=(0,Q.useCallback)(async()=>{if(!(c.length>=P)&&typeof window<`u`&&window.PublicKeyCredential){C(!0),h(null);try{let e=vc(),t=await e.passkeyRegisterOptions(),n=await hp({optionsJSON:t});await e.passkeyRegisterVerify({response:n}),_(k(et.SUCCESS)),I()}catch(e){if(ri(e))return;let t=e?.name===`NotAllowedError`?k(et.PASSKEY_CANCELLED):a(e,k(et.ERROR));h(t)}finally{C(!1)}}},[P,c.length,I,k,a]),ae=(0,Q.useCallback)(async e=>{if(F)try{await vc().passkeyRemove(e),_(k(et.SUCCESS)),I()}catch(e){ri(e)||h(a(e,k(et.ERROR)))}},[F,I,k,a]),oe=(0,Q.useCallback)(async()=>{try{await vc().mfaTOTPDisable(),_(k(et.SUCCESS)),y(!1),I()}catch(e){ri(e)||h(a(e,k(et.ERROR)))}},[I,k,a]),se=(0,Q.useCallback)(async e=>{if(F)try{await vc().unlinkIdentityLink(e),_(k(et.SUCCESS)),I()}catch(e){ri(e)||h(a(e,k(et.ERROR)))}},[F,I,k,a]);if(!D)return null;let ce=typeof window<`u`&&!!window.PublicKeyCredential,le=ce?c.length>0?y1.ACTIVE:y1.INACTIVE:y1.UNAVAILABLE,ue=e=>{switch(e){case y1.ACTIVE:return k(et.STATUS_ACTIVE);case y1.UNAVAILABLE:return k(et.STATUS_UNAVAILABLE);case y1.INACTIVE:return k(et.STATUS_NOT_CONFIGURED)}},de=(0,$.jsxs)(b1,{icon:lX[mt.PASSKEY],title:k(et.SECTION_PASSKEYS),description:k(et.PASSKEYS_DESCRIPTION),state:le,statusLabel:ue(le),action:ce&&c.length<P?(0,$.jsx)(Y,{variant:X.OUTLINE,onClick:ie,disabled:S,children:k(S?et.PASSKEY_ADDING:et.PASSKEY_ADD)}):void 0,children:[!ce&&(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:k(et.PASSKEY_UNSUPPORTED)})}),ce&&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(et.PASSKEY_ADDED,{date:O(e.createdAt)})})]}),F&&(0,$.jsx)(Y,{variant:X.OUTLINE,size:df.SM,onClick:()=>ae(e.credentialId),children:k(et.PASSKEY_REMOVE)})]},e.credentialId))})]}),fe=ee?y1.ACTIVE:y1.INACTIVE,pe=(0,$.jsx)(b1,{icon:lX[mt.TOTP],title:k(et.SECTION_TOTP),description:k(et.TOTP_DESCRIPTION),state:fe,statusLabel:ue(fe),action:ee?F?(0,$.jsx)(Y,{variant:X.OUTLINE,onClick:oe,children:k(et.TOTP_DISABLE)}):void 0:v?void 0:(0,$.jsx)(Y,{variant:X.OUTLINE,onClick:()=>y(!0),children:k(et.TOTP_SETUP)}),children:ee?(0,$.jsx)($.Fragment,{children:z.enrolledMethods.length===1&&z.enrolledMethods.includes(mt.TOTP)&&(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:k(et.TOTP_ONLY_MFA_WARNING)})})}):v?(0,$.jsx)(PX,{onComplete:()=>{y(!1),I()},onError:e=>h(e),isLoading:!1,t:e=>T(K.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,e)}):null}),me=ne?y1.ACTIVE:y1.INACTIVE,he=(0,$.jsx)(b1,{icon:lX[mt.SMS_OTP],title:k(et.SECTION_PHONE),description:k(et.PHONE_DESCRIPTION),state:me,statusLabel:ue(me),meta:ne&&V?(0,$.jsx)(Z,{className:`text-sm`,children:V}):void 0,action:ne?(0,$.jsx)(Y,{variant:X.OUTLINE,onClick:()=>x(!0),children:k(et.PHONE_CHANGE)}):b?void 0:(0,$.jsx)(Y,{variant:X.OUTLINE,onClick:()=>x(!0),children:k(et.PHONE_VERIFY)}),children:ne&&!b?null:b?(0,$.jsx)(IX,{onComplete:()=>{x(!1),I()},onError:e=>h(e),isLoading:!1,t:e=>T(K.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(et.PAGE_TITLE)}),m&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:m})}),g&&(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:g})}),f?(0,$.jsx)(Z,{className:`text-muted-foreground`,children:k(et.LOADING)}):(0,$.jsx)(wF,{children:(0,$.jsxs)(jF,{className:`flex flex-col divide-y divide-border p-card`,children:[de,pe,he,(0,$.jsx)(MCe,{hasPassword:B,passwordPolicy:N,userEmail:r?.email,t:k,tPolicy:A,onSuccess:()=>{_(k(et.SUCCESS)),I()},onError:e=>h(e)}),(0,$.jsx)(PCe,{links:re,allowRemoval:F,t:k,onUnlink:se})]})}),!f&&(0,$.jsx)(wF,{children:(0,$.jsx)(jF,{className:`flex flex-col divide-y divide-border p-card`,children:(0,$.jsx)(NCe,{t:k,formatDate:O,onSignOutEverywhere:n,onError:e=>h(a(e))})})})]})},MCe=({hasPassword:e,passwordPolicy:t,userEmail:n,t:r,tPolicy:i,onSuccess:a,onError:o})=>{let s=cp(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),f=Ow({defaultValues:{currentPassword:``,newPassword:``,confirmPassword:``}}),p=Ow({defaultValues:{newPassword:``,confirmPassword:``}}),m=(0,Q.useCallback)(async e=>{if(e.newPassword!==e.confirmPassword)o(r(et.PASSWORD_MISMATCH));else{l(!0);try{await vc().passwordChange(e.currentPassword,e.newPassword),a(),f.reset(),d(!1)}catch(e){ri(e)||o(s(e,r(et.ERROR)))}finally{l(!1)}}},[f,o,a,r,s]),h=(0,Q.useCallback)(async e=>{if(e.newPassword!==e.confirmPassword)o(r(et.PASSWORD_MISMATCH));else{l(!0);try{await vc().passwordSet(e.newPassword),a(),p.reset(),d(!1)}catch(e){ri(e)||o(s(e,r(et.ERROR)))}finally{l(!1)}}},[o,a,p,r,s]),g=e?y1.ACTIVE:y1.INACTIVE;return(0,$.jsx)(b1,{icon:lX[mt.PASSWORD],title:r(et.SECTION_PASSWORD),description:r(et.PASSWORD_DESCRIPTION),state:g,statusLabel:r(e?et.STATUS_ACTIVE:et.STATUS_NOT_CONFIGURED),action:u?(0,$.jsx)(Y,{variant:X.OUTLINE,onClick:()=>{d(!1),f.reset(),p.reset()},children:r(et.CANCEL)}):(0,$.jsx)(Y,{variant:X.OUTLINE,onClick:()=>d(!0),children:r(e?et.PASSWORD_CHANGE:et.PASSWORD_SET)}),children:u?e?(0,$.jsx)(RC,{...f,children:(0,$.jsxs)(`form`,{onSubmit:f.handleSubmit(m),className:`space-y-4`,children:[(0,$.jsx)(rZ,{email:n}),(0,$.jsxs)(nx,{children:[(0,$.jsx)(rx,{children:r(et.PASSWORD_CURRENT)}),(0,$.jsx)(XM,{type:`password`,autoComplete:`current-password`,...f.register(`currentPassword`,{required:!0})})]}),(0,$.jsxs)(nx,{children:[(0,$.jsx)(rx,{children:r(et.PASSWORD_NEW)}),(0,$.jsx)(XM,{type:`password`,autoComplete:`new-password`,...f.register(`newPassword`,{required:!0})}),(0,$.jsx)(nZ,{fieldName:`newPassword`,policy:t,t:i})]}),(0,$.jsxs)(nx,{children:[(0,$.jsx)(rx,{children:r(et.PASSWORD_CONFIRM)}),(0,$.jsx)(XM,{type:`password`,autoComplete:`new-password`,...f.register(`confirmPassword`,{required:!0})})]}),(0,$.jsx)(Y,{type:`submit`,disabled:c,children:r(et.PASSWORD_CHANGE)})]})}):(0,$.jsx)(RC,{...p,children:(0,$.jsxs)(`form`,{onSubmit:p.handleSubmit(h),className:`space-y-4`,children:[(0,$.jsx)(rZ,{email:n}),(0,$.jsxs)(nx,{children:[(0,$.jsx)(rx,{children:r(et.PASSWORD_NEW)}),(0,$.jsx)(XM,{type:`password`,autoComplete:`new-password`,...p.register(`newPassword`,{required:!0})}),(0,$.jsx)(nZ,{fieldName:`newPassword`,policy:t,t:i})]}),(0,$.jsxs)(nx,{children:[(0,$.jsx)(rx,{children:r(et.PASSWORD_CONFIRM)}),(0,$.jsx)(XM,{type:`password`,autoComplete:`new-password`,...p.register(`confirmPassword`,{required:!0})})]}),(0,$.jsx)(Y,{type:`submit`,disabled:c,children:r(et.PASSWORD_SET)})]})}):null})},NCe=({t:e,formatDate:t,onSignOutEverywhere:n,onError:r})=>{let{renderIcon:i}=ef(),{t:a}=q(),[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 vc().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 vc().revokeMySession(e),t()}catch(e){e?.httpStatus===404?t():m.current(e)}finally{p(null)}},[]),g=(e,t)=>{let n=ye(e,t),r=a(n);return r===n?ps(t):r},_=t=>e(et.SESSION_DEVICE,{browser:g(Fc.BROWSER,t.browser??yie.OTHER),operatingSystem:g(Fc.OPERATING_SYSTEM,t.operatingSystem??xne.OTHER)}),v=n=>n.ipAddress?e(et.SESSION_DETAILS,{address:n.ipAddress,lastActive:t(n.lastActiveAt)}):e(et.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(W.LOGOUT,{size:tr.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(et.SECTION_SESSIONS)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:e(et.SIGN_OUT_EVERYWHERE_DESCRIPTION)})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-element-xs`,children:(0,$.jsx)(Y,{variant:X.OUTLINE,size:df.SM,onClick:()=>s(!0),disabled:c,children:e(et.SIGN_OUT_EVERYWHERE)})}),(0,$.jsx)(Iw,{open:o,onOpenChange:e=>{!e&&!c&&s(!1)},children:(0,$.jsxs)(Rw,{children:[(0,$.jsxs)(zw,{children:[(0,$.jsx)(Vw,{children:e(et.SIGN_OUT_EVERYWHERE_CONFIRM_TITLE)}),(0,$.jsx)(Hw,{children:e(et.SIGN_OUT_EVERYWHERE_CONFIRM_DESCRIPTION)})]}),(0,$.jsxs)(Bw,{children:[(0,$.jsx)(Ww,{disabled:c,children:e(et.CANCEL)}),(0,$.jsx)(Uw,{disabled:c,onClick:e=>{e.preventDefault(),y()},children:e(et.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(et.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)(Jd,{variant:`secondary`,children:e(et.SESSION_THIS_DEVICE)})]}),(0,$.jsx)(Z,{className:`truncate text-xs text-muted-foreground`,children:v(t)})]}),!t.isCurrent&&(0,$.jsx)(Y,{variant:X.OUTLINE,size:df.SM,disabled:f===t.sessionId,onClick:()=>{h(t.sessionId)},children:e(et.SESSION_SIGN_OUT)})]},t.sessionId))})]})},PCe=({links:e,allowRemoval:t,t:n,onUnlink:r})=>(0,$.jsx)(b1,{icon:lX[mt.EXTERNAL_OAUTH2],title:n(et.SECTION_IDENTITY_LINKS),description:n(et.IDENTITY_LINKS_DESCRIPTION),state:e.length>0?y1.ACTIVE:y1.INACTIVE,statusLabel:n(e.length>0?et.STATUS_ACTIVE:et.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)(Y,{variant:X.OUTLINE,size:df.SM,onClick:()=>r(e._id),children:n(et.IDENTITY_LINKS_UNLINK)})]},e._id))})});function FCe(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===oe.API_CALL)??null:null}function x1(){let{themePreference:e,setTheme:t}=Ng(),{doOperation:n,registry:r}=fm();return{themePreference:e,selectTheme:(0,Q.useCallback)(e=>{t(e);let i=FCe(r,Wo.USER_SELF_PREFERENCES,J.UPDATE);if(!i)return;let a=no.buildOperationPathKeyFromOperation(i);n(a,{contextualParameters:{},requestData:{ui:{theme:e}}}).catch(()=>{})},[n,r,t])}}var ICe=[as.LIGHT,as.DARK,as.AUTO],LCe={[as.LIGHT]:`themeLight`,[as.DARK]:`themeDark`,[as.AUTO]:`themeSystem`},RCe=[ze.BACKGROUND,ze.FOREGROUND,ze.MUTED,ze.MUTED_FOREGROUND,ze.PRIMARY,ze.BORDER];function S1(e,t,n){let r=r=>{let i=e?.[r]??t?.[r];return i?$n(i,n):`var(--${r})`};return RCe.reduce((e,t)=>({...e,[t]:r(t)}),{})}var C1=({palette:e,className:t})=>(0,$.jsxs)(`div`,{className:G(`flex h-full w-full gap-[3px] p-[5px]`,t),style:{backgroundColor:e[ze.BACKGROUND]},children:[(0,$.jsxs)(`div`,{className:`flex w-1/4 shrink-0 flex-col gap-[3px] rounded-[3px] p-[3px]`,style:{backgroundColor:e[ze.MUTED]},children:[(0,$.jsx)(`div`,{className:`h-[3px] w-full rounded-full`,style:{backgroundColor:e[ze.PRIMARY]}}),(0,$.jsx)(`div`,{className:`h-[3px] w-3/4 rounded-full`,style:{backgroundColor:e[ze.MUTED_FOREGROUND],opacity:.5}}),(0,$.jsx)(`div`,{className:`h-[3px] w-2/3 rounded-full`,style:{backgroundColor:e[ze.MUTED_FOREGROUND],opacity:.5}})]}),(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col gap-[4px] rounded-[3px] border p-[4px]`,style:{backgroundColor:e[ze.MUTED],borderColor:e[ze.BORDER]},children:[(0,$.jsx)(`div`,{className:`h-[4px] w-2/3 rounded-full`,style:{backgroundColor:e[ze.FOREGROUND]}}),(0,$.jsx)(`div`,{className:`h-[3px] w-full rounded-full`,style:{backgroundColor:e[ze.MUTED_FOREGROUND],opacity:.55}}),(0,$.jsx)(`div`,{className:`h-[3px] w-4/5 rounded-full`,style:{backgroundColor:e[ze.MUTED_FOREGROUND],opacity:.55}}),(0,$.jsx)(`div`,{className:`mt-auto h-[6px] w-2/5 rounded-[2px]`,style:{backgroundColor:e[ze.PRIMARY]}})]})]}),zCe=({option:e,light:t,dark:n})=>e===as.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)(C1,{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)(C1,{palette:n})})})]}):(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`h-16 w-full overflow-hidden rounded-md border`,children:(0,$.jsx)(C1,{palette:e===as.DARK?n:t})}),BCe=()=>{let{tComponent:e,isReady:t}=q({component:K.APP_LAYOUTS_APPEARANCE_SETTINGS}),{designSystemConfiguration:n}=Ng(),{themePreference:r,selectTheme:i}=x1(),a=(0,Q.useCallback)(t=>e(K.APP_LAYOUTS_APPEARANCE_SETTINGS,t),[e]),o=(0,Q.useMemo)(()=>S1(n?.tokens,n?.customTokens,C.LIGHT),[n]),s=(0,Q.useMemo)(()=>S1(n?.tokens,n?.customTokens,C.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)(bF,{value:r,onValueChange:e=>i(e),"aria-label":a(`themeHeading`),className:`grid-cols-1 gap-item sm:grid-cols-3`,children:ICe.map(e=>{let t=`appearance-theme-${e}`;return(0,$.jsxs)(TX,{htmlFor:t,className:G(`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)(zCe,{option:e,light:o,dark:s}),(0,$.jsxs)(`div`,{className:`flex items-center gap-element-xs`,children:[(0,$.jsx)(xF,{id:t,value:e}),(0,$.jsx)(`span`,{className:`text-sm font-medium`,children:a(LCe[e])})]})]},e)})})]}):null},VCe=[Bc.ROLES],HCe=md().min(1),UCe=()=>{let{tComponent:e,tRole:t,isReady:n,formatDateTime:r}=q({component:K.APP_LAYOUTS_INVITATIONS_SETTINGS,keys:VCe}),{refreshOrganizations:i}=ng(),a=(0,Q.useCallback)((t,n)=>e(K.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=vc(),[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 vc().acceptMyInvitation(e),await i(),y(a(`acceptSuccess`)),await x()}catch(e){ri(e)||_(a(`errorGeneric`))}finally{h(null)}},[x,i,a]),C=(0,Q.useCallback)(async e=>{h(e),_(null);try{await vc().rejectMyInvitation(e),y(a(`rejectSuccess`)),await x()}catch(e){ri(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){Rr(e)&&await x(),ri(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 vc().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 vc().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)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:g})}),v&&(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:v})}),(f||D)&&(0,$.jsx)(wF,{children:(0,$.jsx)(jF,{className:`p-card`,children:(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(f?`loading`:`empty`)})})}),!f&&o.length>0&&(0,$.jsx)(wF,{children:(0,$.jsx)(jF,{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)(Y,{variant:X.OUTLINE,size:df.SM,disabled:m===e.membershipId,onClick:()=>C(e.membershipId),children:a(`rejectButton`)}),(0,$.jsx)(Y,{size:df.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)(wF,{children:(0,$.jsx)(jF,{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)(TX,{htmlFor:`field-receiving-organization-${e.invitationId}`,children:a(`relationshipReceivingOrganizationLabel`)}),(0,$.jsx)(fF,{name:`receiving-organization-${e.invitationId}`,schema:HCe,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)(Y,{variant:X.OUTLINE,size:df.SM,disabled:o,onClick:()=>E(e),children:a(`relationshipDeclineButton`)}),n.length>0&&(0,$.jsx)(Y,{size:df.SM,disabled:o||!i,onClick:()=>T(e),children:a(`relationshipReceiveButton`)})]})]},e.invitationId)})})})})]})]})};function w1(e){return rb([e?xd(e):void 0])}function T1(e){if(e.providerRef)return ib({providerRef:e.providerRef,translate:e.translate})}function E1({preset:e=H.DEFAULT,...t}){let n=Lh(),r=cp(),i=gh(),a=(0,Q.useMemo)(()=>w1(n?.billingProviderRef),[n?.billingProviderRef]),{tBillingProduct:o,t:s,isReady:c}=q({keys:[`billing_products`,...a]}),l=qc(K.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??T1({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(vo.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(vo.BILLING_ACCOUNT)?()=>{i(()=>n.openCustomerPortal())}:void 0),v=t.unavailable??(!!n?.isEnabled&&(t.status===void 0||t.planName===void 0||t.currentPeriodEnd===void 0)&&[vo.SUBSCRIPTION,vo.PRODUCTS,vo.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 D1({preset:e=H.DEFAULT,...t}){let n=Lh(),r=cp(),i=gh(),a=Q.useMemo(()=>w1(n?.billingProviderRef),[n?.billingProviderRef]),{t:o}=q({keys:a}),s=qc(K.LOW_LEVEL_BILLING_PORTAL_LINK,`BillingPortalLink`)(e),c=t.onOpenPortal??(()=>{n&&i(()=>n.openCustomerPortal())}),l=t.providerName??T1({providerRef:n?.billingProviderRef,translate:o}),u=t.unavailable??(!!n?.isEnabled&&t.onOpenPortal===void 0&&[vo.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 O1;(function(e){e.IDLE=`idle`,e.PREVIEWING=`previewing`,e.READY=`ready`,e.CONFIRMING=`confirming`,e.FAILED=`failed`})(O1||={});function WCe(e){let t=e.currency.toUpperCase(),n=il(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 GCe(e){let[t,n]=(0,Q.useState)({phase:O1.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&&[vo.BILLING_ACCOUNT,vo.SUBSCRIPTION,vo.PRODUCTS,vo.PRICES].every(e.isSliceAvailable);return(0,Q.useEffect)(()=>(r.current+=1,i.current?.abort(),n({phase:O1.IDLE}),()=>{r.current+=1,i.current?.abort()}),[s]),(0,Q.useEffect)(()=>{let e=o.current;a.current||e.phase===O1.READY&&e.hasError||l||(r.current+=1,i.current?.abort(),n({phase:O1.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:O1.PREVIEWING});try{let i=await e.previewPlanChange(t,{signal:u.signal}),a=WCe(i);if(!i.previewToken)throw Error(`The invoice estimate has no confirmation binding.`);if(r.current!==o||c.current!==s)return;n({...d,phase:O1.READY,response:i,preview:a})}catch{if(r.current!==o||u.signal.aborted)return;n({...d,phase:O1.FAILED})}},[e,l,s]),cancel:(0,Q.useCallback)(()=>{a.current||(r.current+=1,i.current?.abort(),n({phase:O1.IDLE}))},[]),confirm:(0,Q.useCallback)(async()=>{let t=o.current;if(!e||!l||a.current||t.phase!==O1.READY||t.scopeIdentity!==c.current)return;a.current=!0;let i=r.current;n({...t,phase:O1.CONFIRMING,hasError:!1});try{await e.confirmPlanChange({...t.target,previewToken:t.response.previewToken}),r.current===i&&n({phase:O1.IDLE})}catch{r.current===i&&n({...t,phase:O1.READY,hasError:!0})}finally{a.current=!1}},[e,l])}}function k1({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_BILLING_PLAN_CHANGE_PREVIEW,`PlanChangePreview`)(e);return(0,$.jsx)(n,{...t})}function A1({preset:e=H.DEFAULT,...t}){let n=Lh(),r=cp(),i=GCe(n),a=(0,Q.useRef)(null),o=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let e=i.state.phase!==O1.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=gh(),{tBillingProduct:c,tBillingFeature:l,tBillingLimit:u,isReady:d}=q({keys:[`billing_products`,`billing_features`,`billing_limits`]}),f=qc(K.LOW_LEVEL_BILLING_PRICING_TABLE,`PricingTable`)(e),p=(0,Q.useMemo)(()=>t.plans?t.plans:n?.products?n.products.filter(e=>e.type===Kl.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&&Ki(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&&[vo.BILLING_ACCOUNT,vo.SUBSCRIPTION,vo.PRODUCTS,vo.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&&[vo.PRODUCTS,vo.PRICES,vo.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===O1.CONFIRMING||!!g,pendingPlanChange:g,onKeepCurrentPlan:y,isKeepingCurrentPlan:t.isKeepingCurrentPlan??_}),i.state.phase!==O1.IDLE&&(0,$.jsx)(k1,{targetPlanName:c(i.state.target.newProductKey,`name`),preview:`preview`in i.state?i.state.preview:null,isLoading:i.state.phase===O1.PREVIEWING,isConfirming:i.state.phase===O1.CONFIRMING,hasError:i.state.phase===O1.FAILED||`hasError`in i.state&&i.state.hasError,onCancel:i.cancel,onConfirm:i.state.phase===O1.READY||i.state.phase===O1.CONFIRMING?()=>{i.confirm()}:void 0,onRetry:i.state.phase===O1.FAILED?()=>{i.state.phase===O1.FAILED&&i.select(i.state.target)}:void 0})]}):null}function j1({preset:e=H.DEFAULT,...t}){let n=Lh(),r=cp(),i=gh(),{tBillingProduct:a,tBillingCreditPool:o,isReady:s}=q({keys:[`billing_products`,`billing_credit_pools`]}),c=qc(K.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||![vo.BILLING_ACCOUNT,vo.PRODUCTS,vo.PRICES,vo.CREDIT_POOLS].every(n.isSliceAvailable))return;let r=n.products.find(t=>t.type===Kl.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(vo.USAGE)),p=t.creditPoolsUnavailable??(!!n?.isEnabled&&t.creditPools===void 0&&!n.isSliceAvailable(vo.CREDIT_POOLS)),m=!!t.onTopUp||!!n&&[vo.BILLING_ACCOUNT,vo.PRODUCTS,vo.PRICES,vo.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 M1({preset:e=H.DEFAULT,...t}){let n=Lh(),r=cp(),i=gh(),a=Q.useMemo(()=>w1(n?.billingProviderRef),[n?.billingProviderRef]),{t:o}=q({keys:a}),s=qc(K.LOW_LEVEL_BILLING_INVOICE_HISTORY,`InvoiceHistory`)(e),c=t.invoices??n?.invoices??[],l=t.onViewAll??(n?.isSliceAvailable(vo.BILLING_ACCOUNT)?()=>{i(()=>n.openCustomerPortal())}:void 0),u=t.providerName??T1({providerRef:n?.billingProviderRef,translate:o}),d=t.unavailable??(!!n?.isEnabled&&t.invoices===void 0&&[vo.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 KCe=()=>{let e=Lh(),{tComponent:t,isReady:n}=q({component:K.APP_LAYOUTS_BILLING_SETTINGS}),r=(0,Q.useCallback)(e=>t(K.APP_LAYOUTS_BILLING_SETTINGS,e),[t]);if(!n)return null;if(!e?.isEnabled)return(0,$.jsxs)(wF,{children:[(0,$.jsx)(EF,{children:(0,$.jsx)(OF,{children:r(`disabledTitle`)})}),(0,$.jsx)(jF,{children:(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:r(`disabledDescription`)})})]});let i=e.isSliceAvailable(vo.BILLING_ACCOUNT),a=[vo.SUBSCRIPTION,vo.PRODUCTS,vo.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)(E1,{}),i&&!a&&(0,$.jsx)(D1,{}),(0,$.jsx)(A1,{}),(0,$.jsx)(j1,{}),(0,$.jsx)(M1,{})]})};function N1({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DESCRIPTION_LIST,`DescriptionList`)(e);return(0,$.jsx)(n,{...t})}function P1({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DESCRIPTION_TERM,`DescriptionTerm`)(e);return(0,$.jsx)(n,{...t})}function F1({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DESCRIPTION_DETAILS,`DescriptionDetails`)(e);return(0,$.jsx)(n,{...t})}function I1(e){switch(e){case Pa.USER:return Wo.USER_PROVIDER_CREDENTIALS;case Pa.ORGANIZATION:return Wo.ORG_PROVIDER_CREDENTIALS;case Pa.APPLICATION:return}}function qCe(e){return I1(e)!==void 0}function JCe(e,t){return e===Pa.APPLICATION?e:t===null?null:`${e}:${t}`}function L1(e){let t=I1(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===oe.API_CALL);if(!r)return;let i={...tm.buildResourceOperationContextIdentifiers({...e.ownerScope===Pa.USER?{currentUserId:e.ownerId}:{currentOrganizationId:e.ownerId},primaryScope:n.resourcePrimaryScope,explicitContextResourceIdentifiers:{}}),[t]:e.credentialId};return{operationPathKey:no.buildOperationPathKeyFromOperation(r),contextualParameters:U.buildContextualParameters(i,e.registry),parentResourcesRequirements:kn.buildParentResourcesRequirements(t,i,e.registry)}}function YCe(e,t){let{registry:n,doOperation:r}=fm(),[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=JCe(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 vc().listLinkedProviderConnections(e===Pa.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===Pa.APPLICATION)try{await vc().disconnectApplicationProviderConnection(i.connectionRef)}finally{m()}else if(t!==null)try{for(let a of i.credentials){let i=L1({registry:n,ownerScope:e,ownerId:t,credentialId:a.credentialId,operation:J.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})}uc({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=L1({registry:n,ownerScope:e,ownerId:t,credentialId:o.credentialId,operation:J.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=L1({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,J.UPDATE,{description:t.trim()===``?null:t.trim()}),[_]),y=(0,Q.useCallback)(e=>_(e,J.DELETE),[_]);return{connections:i,loading:o,failed:c,reload:m,disconnect:h,holdsCredentialResource:qCe(e),setEnabled:g,setCredentialDescription:v,removeCredential:y}}var R1=K.APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS,XCe={[Pa.USER]:Ci.shape.description.unwrap().maxLength??void 0,[Pa.ORGANIZATION]:Fr.shape.description.unwrap().maxLength??void 0},z1=md().min(1),B1=Md(),ZCe=md().min(1),QCe=(e,t)=>e.filter(e=>e.admissibleConnections.some(e=>e.ownerScope===t)),V1=(e,t)=>{let n=new Set(Object.values(da)),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},$Ce=(e,t)=>{let n=V1(e,t);return t===Pa.APPLICATION?n.filter(e=>e===da.SERVICE):n},H1=e=>({ownerScope:e.ownerScope,delegation:e.delegation,...e.ownerScope===Pa.APPLICATION||e.ownerId===null?{}:{ownerId:e.ownerId},...see(e)&&e.signedInUserId!==null?{actingForUserId:e.signedInUserId}:{}}),ewe=(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)}`}),U1;(function(e){e.SUPERSEDED=`SUPERSEDED`,e.DISABLED=`DISABLED`,e.NEEDS_REAUTHORIZATION=`NEEDS_REAUTHORIZATION`,e.WORKING=`WORKING`,e.NOT_YET_USED=`NOT_YET_USED`})(U1||={});var W1;(function(e){e.DISCONNECTED=`DISCONNECTED`,e.FAILED=`FAILED`})(W1||={});var twe=e=>{if(e.supersededByConnectionRef!==void 0)return U1.SUPERSEDED;if(!e.enabled)return U1.DISABLED;switch(e.validationState){case fr.INVALID:return U1.NEEDS_REAUTHORIZATION;case fr.VALID:return U1.WORKING;case fr.UNVALIDATED:return U1.NOT_YET_USED}},nwe={[U1.SUPERSEDED]:`warning`,[U1.DISABLED]:`secondary`,[U1.NEEDS_REAUTHORIZATION]:`destructive`,[U1.WORKING]:`success`,[U1.NOT_YET_USED]:`secondary`},rwe={[U1.SUPERSEDED]:`statusSuperseded`,[U1.DISABLED]:`statusDisabled`,[U1.NEEDS_REAUTHORIZATION]:`statusNeedsReauthorization`,[U1.WORKING]:`statusWorking`,[U1.NOT_YET_USED]:`statusNotYetUsed`},iwe=(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}},awe=(e,t)=>rb([...[...e.flatMap(e=>[e.providerRef,...e.servesRefs??[]]),...t.flatMap(e=>[e.connectionRef,...e.servesRefs,...e.supersededByConnectionRef===void 0?[]:[e.supersededByConnectionRef]])].map(xd),...e.flatMap(e=>(e.credentialFields??[]).flatMap(t=>[yd(e.providerRef,t.slug,bd.LABEL),yd(e.providerRef,t.slug,bd.DESCRIPTION)])),...e.flatMap(e=>(e.connectionParameters??[]).flatMap(t=>[vd(e.providerRef,t,bd.LABEL),vd(e.providerRef,t,bd.DESCRIPTION)])),...t.flatMap(e=>e.credentials.map(e=>yd(e.providerRef,e.secretSlug,bd.LABEL)))]),G1=(e,t,n,r)=>{let i=yd(e,t,n),a=r(i);return a!==i&&a.length>0?a:n===bd.LABEL?t:i},K1=(e,t,n,r)=>{let i=vd(e,t,n),a=r(i);return a!==i&&a.length>0?a:n===bd.LABEL?t:i},owe=(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}))]},swe=()=>{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}},cwe=()=>{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())},lwe=({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?[]:V1(n,r),y=v.length===1?v[0]:v.find(e=>e===u),b=y!==void 0&&Yt({ownerScope:r,delegation:y}),x=r===Pa.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 vc().startProviderConnection(t.offer.providerRef,{target:H1({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),ri(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)(fF,{name:`delegation-${e.connectionRef}`,schema:z1,options:v.map(e=>({value:e,label:s(e===da.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)(SI,{name:`organizationWideUseAcknowledged-${e.connectionRef}`,schema:B1,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)(Y,{size:df.SM,variant:X.DEFAULT,"aria-label":c(`grantMoreAccessAccessibleName`,{provider:o}),disabled:m||i===null||y===void 0||b&&!f,onClick:S,children:s(`grantMoreAccessButton`)})})]}),g&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:s(`errorGeneric`)})})]})},uwe={[gn.MESSAGING_ENDPOINT]:`vendorRegistrationMessagingEndpointLabel`},dwe=new Set([Lu.PROVIDER_VENDOR_REGISTRATION_DEPLOYMENT_INCOMPLETE]),q1=e=>Ot(e)||Rr(e)&&e.customMessageReference!==void 0&&dwe.has(e.customMessageReference);function fwe(e){if(e.encoding===R_.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 pwe=({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=cp(),g=(0,Q.useMemo)(()=>[...new Set((s?.steps??[]).map(t=>gd(e,t.ref)))],[e,s]),{t:_,isReady:v}=q({keys:g}),y=(0,Q.useCallback)(async()=>{o(!0),u(!0),f(null),c(null);try{c(await vc().getProviderVendorRegistration(e,{ownerScope:Pa.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:Rr(d)?h(d,r(q1(d)?`vendorRegistrationRefused`:`vendorRegistrationFailed`)):r(`vendorRegistrationFailed`)}),q1(d)?(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:r(`vendorRegistrationRefusalFinal`)}):(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(Y,{size:df.SM,variant:X.OUTLINE,disabled:l,onClick:()=>{y()},children:r(`vendorRegistrationRetryButton`)})})]}),s!==null&&(0,$.jsxs)($.Fragment,{children:[(s.addresses??[]).length>0&&(0,$.jsx)(N1,{children:(s.addresses??[]).map(e=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(P1,{children:r(uwe[e.kind]??e.kind)}),(0,$.jsx)(F1,{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)(Y,{size:df.SM,variant:X.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:_(gd(e,t.ref),t.params)})},`${n}:${t.ref}`))})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-item-xs`,children:[(0,$.jsx)(Y,{size:df.SM,variant:X.GHOST,onClick:()=>{o(!1),m(null)},children:r(`vendorRegistrationHideButton`)}),s?.file!==void 0&&(0,$.jsx)(Y,{size:df.SM,variant:X.DEFAULT,onClick:()=>My(fwe(s.file),s.file.name),children:i(`vendorRegistrationDownloadButton`,{file:s.file.name})})]})]}):(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(Y,{size:df.SM,variant:X.OUTLINE,"aria-label":i(`vendorRegistrationAccessibleName`,{provider:n}),onClick:()=>{y()},children:r(`vendorRegistrationButton`)})})},mwe=({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=G1(e.providerRef,e.secretSlug,bd.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)(Y,{size:df.SM,variant:X.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)(Y,{size:df.SM,variant:X.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)(XM,{"aria-label":i(`descriptionInputAccessibleName`,{provider:n,slot:y}),type:`text`,maxLength:t,autoFocus:!0,value:u,onChange:e=>d(e.target.value)}),(0,$.jsx)(Y,{size:df.SM,variant:X.DEFAULT,disabled:h,onClick:()=>{_(e.credentialId)},children:r(`saveDescriptionButton`)}),(0,$.jsx)(Y,{size:df.SM,variant:X.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)(Y,{size:df.SM,variant:X.DESTRUCTIVE,disabled:h,"aria-label":i(`removeSlotConfirmAccessibleName`,{provider:n,slot:y}),autoFocus:!0,onClick:()=>{v(e.credentialId)},children:r(`removeSlotConfirmButton`)}),(0,$.jsx)(Y,{size:df.SM,variant:X.OUTLINE,disabled:h,onClick:()=>p(null),children:r(`removeSlotCancelButton`)})]})]},e.credentialId)})})]})},J1=({ownerScope:e=Pa.USER})=>{let{tComponent:t,isReady:n,formatDateTime:r}=q({component:R1}),{user:i,currentOrganizationId:a}=ng(),o=(0,Q.useCallback)(e=>t(R1,e),[t]),s=(0,Q.useCallback)((e,n)=>t(R1,e,n),[t]),c=(0,Q.useId)(),l=e===Pa.USER?i?._id??null:e===Pa.ORGANIZATION?a??null:null,u=e===Pa.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)(``),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)({}),[k,A]=(0,Q.useState)(swe),j=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let{state:e,code:t}=k;if(e===void 0||t===void 0)return;j.current===null&&(cwe(),j.current=vc().completeProviderConnection({state:e,code:t}));let n=!1;return j.current.then(({connected:e})=>{n||A({connected:e})}).catch(()=>{n||A({connectionError:`failed`})}),()=>{n=!0}},[]),(0,Q.useEffect)(()=>{let t=!1;return(async()=>{try{let n=await vc().listConnectableProviders(e===Pa.APPLICATION?{ownerScope:e}:void 0);t||(f(n.providers??[]),v(!1))}catch{t||v(!0)}finally{t||m(!1)}})(),()=>{t=!0}},[e]);let M=(0,Q.useMemo)(()=>QCe(d,e),[d,e]),{connections:N,loading:P,failed:F,reload:I,disconnect:L,holdsCredentialResource:R,setEnabled:z,setCredentialDescription:B,removeCredential:ee}=YCe(e,l),te=cr(),ne=(0,Q.useMemo)(()=>awe(d,N),[d,N]),{t:V}=q({keys:ne}),re=(0,Q.useCallback)(e=>ib({providerRef:e,translate:V}),[V]),[ie,ae]=(0,Q.useState)(null),[oe,se]=(0,Q.useState)(null),[ce,le]=(0,Q.useState)(null),ue=(0,Q.useCallback)(async e=>{se(e.connectionRef),le(null);try{await L(e),le(W1.DISCONNECTED),g(null)}catch(e){ri(e)||le(W1.FAILED)}finally{se(null),ae(null)}},[L]),[de,fe]=(0,Q.useState)(null),pe=(0,Q.useCallback)(async(e,t)=>{fe(e.connectionRef),le(null);try{await z(e,t),g(null)}catch(e){ri(e)||g(o(`errorGeneric`))}finally{fe(null)}},[z,o]),me=(0,Q.useCallback)(async e=>{le(null);try{return await e(),g(null),!0}catch(e){return ri(e)||g(o(`errorGeneric`)),!1}},[o]),he=(0,Q.useCallback)((e,t)=>me(()=>B(e,t)),[me,B]),ge=(0,Q.useCallback)(e=>me(()=>ee(e)),[me,ee]),_e=(0,Q.useMemo)(()=>{if(M.length===0)return`disconnectNotice`;let e=M.filter(e=>e.revocationTellsVendor===!0).length;return e===0?`disconnectNotice`:e===M.length?`disconnectRevokesNotice`:`disconnectMixedNotice`},[M]),ve=(0,Q.useMemo)(()=>d.filter(e=>(e.missingRegistration??[]).length>0).map(e=>({providerRef:e.providerRef,envVarNames:(e.missingRegistration??[]).map(e=>e.envVarName)})),[d]),ye=(0,Q.useMemo)(()=>M.find(e=>e.providerRef===y),[M,y]),be=(0,Q.useCallback)(e=>{b(e),O({}),w(``),E(!1),g(null)},[]),xe=(0,Q.useMemo)(()=>ye===void 0?[]:$Ce(ye,e),[e,ye]),Se=xe.length===1?xe[0]:xe.find(e=>e===C),[Ce,we]=(0,Q.useState)(null),Te=Se!==void 0&&Yt({ownerScope:e,delegation:Se}),Ee=(0,Q.useCallback)(async()=>{if(ye===void 0||!u||Se===void 0)return;S(!0),g(null),we(null);let t=H1({ownerScope:e,ownerId:l,delegation:Se,signedInUserId:i?._id??null});try{if(ye.authMethods?.includes(Qr.OAUTH2_AUTHORIZATION_CODE)??!1){let{authorizeUrl:e}=await vc().startProviderConnection(ye.providerRef,{target:t,connectionParameters:D,...Te?{acknowledgesOrganizationWideUse:T}:{}});window.location.href=e;return}let e=new Set((ye.credentialFields??[]).map(e=>e.slug)),n=Object.fromEntries(Object.entries(D).filter(([t,n])=>e.has(t)&&n.trim()!==``)),r=new Set(ye.connectionParameters??[]),i=Object.fromEntries(Object.entries(D).filter(([e,t])=>r.has(e)&&t.trim()!==``));await vc().storeProviderCredential(ye.providerRef,{target:t,values:n,...Object.keys(i).length===0?{}:{connectionParameters:i},...Te?{acknowledgesOrganizationWideUse:T}:{}}),O({}),we(o(`credentialStoredNotice`)),S(!1),b(``),I()}catch(e){S(!1),ri(e)||g(o(`errorGeneric`))}},[D,Se,Te,T,l,u,e,I,ye,o,i?._id]);if(!n)return null;let De=owe(M,N),Oe=ye?.authMethods?.includes(Qr.OAUTH2_AUTHORIZATION_CODE)??!1,ke=ye?.missingRegistration??[],Ae=ye?.connectionParameters??[],je=ye?.connectionParameterChoices??{},Me=ye?.credentialFields??[],Ne=ye?.scopes??[],Pe=[...Ae,...Oe?[]:Me.filter(e=>e.required).map(e=>e.slug)].some(e=>(D[e]??``).trim()===``);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,children:[k.connected!==void 0&&(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:o(`connectedNotice`)})}),k.connectionError===`declined`&&(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:o(`declinedNotice`)})}),k.connectionError!==void 0&&k.connectionError!==`declined`&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:o(`failedNotice`)})}),Ce&&(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:Ce})}),_&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:o(`catalogueFailed`)})}),h&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:h})}),ce===W1.DISCONNECTED&&(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:o(`disconnectedNotice`)})}),ce===W1.FAILED&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:o(`disconnectFailedNotice`)})}),(0,$.jsxs)(`section`,{"aria-labelledby":c,className:`flex flex-col gap-group`,children:[(0,$.jsx)(cY,{level:3,id:c,children:o(`providersHeading`)}),p||P?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:o(`loading`)}):(0,$.jsxs)($.Fragment,{children:[F&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:o(`connectionsFailed`)})}),De.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:De.map(({connectionRef:t,connection:n,catalogueEntry:a})=>{let c=re(n===void 0?a?.providerRef??t:n.connectionRef),d=n===void 0?void 0:twe(n),f=n===void 0||d===U1.SUPERSEDED?void 0:iwe(n,l===null?void 0:br(te,{ownerScope:e,ownerId:l},n.connectionRef)),p=ie===t,m=oe===t,h=de===t,g=a!==void 0&&ye?.providerRef===a.providerRef,_=a!==void 0&&!(a.authMethods?.includes(Qr.OAUTH2_AUTHORIZATION_CODE)??!1),v=n!==void 0&&_&&d!==U1.SUPERSEDED;return(0,$.jsx)(`li`,{children:(0,$.jsx)(wF,{children:(0,$.jsxs)(jF,{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)(Jd,{variant:`outline`,children:o(`notConnectedBadge`)}):(0,$.jsx)(Jd,{variant:nwe[d],children:o(rwe[d])})]}),n!==void 0&&(0,$.jsxs)(N1,{children:[n.servesRefs.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(P1,{children:o(`servesLabel`)}),(0,$.jsx)(F1,{children:n.servesRefs.map(re).join(`, `)})]}),(n.grantedScopes??[]).length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(P1,{children:o(`grantedScopesLabel`)}),(0,$.jsx)(F1,{children:(n.grantedScopes??[]).join(`, `)})]}),n.connectedAt!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(P1,{children:o(`connectedAtLabel`)}),(0,$.jsx)(F1,{children:r(n.connectedAt)})]}),n.validationError!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(P1,{children:o(`lastRefusalLabel`)}),(0,$.jsx)(F1,{children:n.validationError})]}),n.lastValidatedAt!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(P1,{children:o(`lastValidatedAtLabel`)}),(0,$.jsx)(F1,{children:r(n.lastValidatedAt)})]}),n.lastUsedAt!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(P1,{children:o(`lastUsedAtLabel`)}),(0,$.jsx)(F1,{children:r(n.lastUsedAt)})]}),n.linkedByUserId!==void 0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(P1,{children:o(`linkedByLabel`)}),(0,$.jsx)(F1,{children:n.linkedByUserName??n.linkedByUserId})]})]}),n!==void 0&&d!==U1.SUPERSEDED&&R&&(0,$.jsx)(mwe,{connection:n,descriptionMaxLength:XCe[e],label:c,t:o,tWith:s,translateProvider:V,onSaveDescription:he,onRemove:ge}),e===Pa.ORGANIZATION&&l!==null&&(a?.vendorRegistrationOwnerScopes??[]).includes(Pa.ORGANIZATION)&&(0,$.jsx)(pwe,{providerRef:a.providerRef,organizationId:l,label:c,t:o,tWith:s}),n!==void 0&&d===U1.SUPERSEDED&&n.supersededByConnectionRef!==void 0&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:s(`supersededNotice`,{connection:re(n.supersededByConnectionRef)})}),n!==void 0&&!n.enabled&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`disabledNotice`)}),d===U1.NEEDS_REAUTHORIZATION&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`needsReauthorizationNotice`)}),n!==void 0&&f!==void 0&&(0,$.jsx)(lwe,{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)(Y,{size:df.SM,variant:X.GHOST,disabled:m,onClick:()=>ae(null),children:o(`disconnectCancelButton`)}),(0,$.jsx)(Y,{size:df.SM,variant:X.DESTRUCTIVE,"aria-label":s(`disconnectConfirmAccessibleName`,{provider:c}),disabled:m,onClick:()=>{ue(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)(Y,{size:df.SM,variant:X.DEFAULT,"aria-label":s(`connectAccessibleName`,{provider:c}),onClick:()=>be(a.providerRef),children:o(`connectButton`)}),a!==void 0&&!g&&v&&(0,$.jsx)(Y,{size:df.SM,variant:X.OUTLINE,"aria-label":s(`replaceCredentialAccessibleName`,{provider:c}),onClick:()=>be(a.providerRef),children:o(`replaceCredentialButton`)}),a!==void 0&&!g&&d===U1.NEEDS_REAUTHORIZATION&&!v&&(0,$.jsx)(Y,{size:df.SM,variant:X.OUTLINE,"aria-label":s(`reconnectAccessibleName`,{provider:c}),onClick:()=>be(a.providerRef),children:o(`reconnectButton`)}),n!==void 0&&d!==U1.SUPERSEDED&&R&&(0,$.jsx)(Y,{size:df.SM,variant:X.OUTLINE,"aria-label":s(n.enabled?`disableAccessibleName`:`enableAccessibleName`,{provider:c}),disabled:h||oe!==null,onClick:()=>{pe(n,!n.enabled)},children:o(n.enabled?`disableButton`:`enableButton`)}),n!==void 0&&(0,$.jsx)(Y,{size:df.SM,variant:X.OUTLINE,"aria-label":s(`disconnectAccessibleName`,{provider:c}),disabled:oe!==null,onClick:()=>{ae(t),le(null)},children:o(`disconnectButton`)})]}),g&&ye!==void 0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-group`,children:[(ye.servesRefs??[]).length>1&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[o(`servesLabel`),` `,(ye.servesRefs??[]).map(re).join(`, `)]}),!Oe&&ke.length===0&&(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(`pastedCredentialNotice`)}),xe.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)(fF,{name:`delegation`,schema:z1,options:xe.map(e=>({value:e,label:o(e===da.SERVICE?`delegationServiceOption`:`delegationUserOption`)})),value:C,placeholder:o(`delegationPlaceholder`),onChange:e=>{w(e),E(!1)}})]}),Oe&&Ne.length>0&&(0,$.jsxs)(Z,{className:`text-xs text-muted-foreground`,children:[o(`scopesPrefix`),` `,ewe(Ne,D,o(`scopeChosenBelow`)).join(`, `)]}),(Ae.length>0||!Oe&&Me.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`)})]}),[...Oe||ye===void 0?[]:Me.map(e=>({key:e.slug,label:G1(ye.providerRef,e.slug,bd.LABEL,V),description:G1(ye.providerRef,e.slug,bd.DESCRIPTION,V),choices:void 0,secret:!0})),...ye===void 0?[]:Ae.map(e=>({key:e,label:K1(ye.providerRef,e,bd.LABEL,V),description:K1(ye.providerRef,e,bd.DESCRIPTION,V),choices:je[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)(fF,{name:e.key,schema:ZCe,options:e.choices.values.map(e=>({value:e,label:e})),value:D[e.key]??``,onChange:t=>O(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===gre.ORIGIN?`https://*${t}`:`*${t}`)].join(`, `)]}),(0,$.jsx)(XM,{"aria-label":e.label,type:e.secret?`password`:`text`,value:D[e.key]??``,onChange:t=>O(n=>({...n,[e.key]:t.target.value}))})]})]},e.key)),Te&&(0,$.jsxs)(`div`,{className:`flex items-start gap-item-xs`,children:[(0,$.jsx)(SI,{name:`organizationWideUseAcknowledged`,schema:B1,checked:T,onCheckedChange:E,"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)(Y,{size:df.SM,variant:X.GHOST,disabled:x,onClick:()=>be(``),children:o(`connectCancelButton`)}),(0,$.jsx)(Y,{size:df.SM,variant:X.DEFAULT,disabled:x||!u||ye.notConnectableBecause!==void 0&&ye.notConnectableBecause!==xt.NO_AUTHORIZATION_FLOW||Pe||Se===void 0||Te&&!T,onClick:Ee,children:o(x?`connectingButton`:`connectButton`)})]})]})]})})},t)})})]})]}),ve.length>0&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{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:ve.map(e=>(0,$.jsxs)(`li`,{className:`text-xs`,children:[re(e.providerRef),`: `,e.envVarNames.join(`, `)]},e.providerRef))})]})})}),(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:o(_e)})]})},Y1=K.APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS,X1;(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`})(X1||={});var hwe=[X1.LAST_30_DAYS,X1.LAST_90_DAYS,X1.LAST_365_DAYS],gwe=Object.values(Za);function Z1(e){return`groupBy_${e}`}function Q1(e){return`window_${e}`}function _we(e,t){switch(t){case Za.AGENT:return e.key.agentRef;case Za.TOOL:return e.key.toolName;case Za.CASE:return e.key.caseRef?`${e.key.caseRef.resourceType}:${e.key.caseRef.resourceId}`:void 0;case Za.DECIDER:return e.key.deciderUserId}}function vwe(e,t){return e===null?null:new Intl.NumberFormat(t,{style:`percent`,maximumFractionDigits:1}).format(e)}var ywe=()=>{let{tComponent:e,isReady:t,currentLanguage:n}=q({component:Y1}),{currentOrganizationId:r}=ng(),i=(0,Q.useCallback)(t=>e(Y1,t),[e]),[a,o]=(0,Q.useState)(Za.AGENT),[s,c]=(0,Q.useState)(X1.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),vc().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)(aO,{value:a,onValueChange:e=>o(e),children:(0,$.jsx)(oO,{children:gwe.map(e=>(0,$.jsx)(sO,{value:e,"data-ref":e,children:i(Z1(e))},e))})}),(0,$.jsx)(`div`,{className:`flex gap-element`,role:`group`,"aria-label":i(`windowLabel`),children:hwe.map(e=>(0,$.jsx)(Y,{size:df.SM,variant:e===s?X.DEFAULT:X.OUTLINE,"aria-pressed":e===s,onClick:()=>c(e),children:i(Q1(e))},e))})]}),p&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:p})}),!(p&&h.length===0)&&(0,$.jsx)(wF,{children:(0,$.jsx)(jF,{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)(tJ,{children:[(0,$.jsx)(nJ,{children:(0,$.jsxs)(iJ,{children:[(0,$.jsx)(aJ,{children:i(Z1(a))}),(0,$.jsx)(aJ,{children:i(`columnAccepted`)}),(0,$.jsx)(aJ,{children:i(`columnAcceptedWithModifications`)}),(0,$.jsx)(aJ,{children:i(`columnRejected`)}),(0,$.jsx)(aJ,{children:i(`columnNotDecided`)}),(0,$.jsx)(aJ,{children:i(`columnOverrideRate`)})]})}),(0,$.jsx)(rJ,{children:h.map((e,t)=>{let r=_we(e,a),o=vwe(e.overrideRate,n);return(0,$.jsxs)(iJ,{children:[(0,$.jsx)(oJ,{children:r??i(`unattributed`)}),(0,$.jsx)(oJ,{children:e.accepted}),(0,$.jsx)(oJ,{children:e.acceptedWithModifications}),(0,$.jsx)(oJ,{children:e.rejected}),(0,$.jsx)(oJ,{children:e.notDecided}),(0,$.jsx)(oJ,{children:o??i(`nothingDecided`)})]},r??`unattributed-${t}`)})})]}):(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`noOrganization`)})})})]}):null},$1=K.APP_LAYOUTS_AUTONOMOUS_AGENTS_SETTINGS,e0=Bl(Mt.shape.status),t0=Bl(Mt.shape.autonomousTrigger);function bwe(e){return`reason_${e}`}function xwe(e){return`concurrency_${e}`}function Swe(e){if(e.caseLimit!==void 0&&e.matchedCaseCount!==void 0)return{matched:e.matchedCaseCount,limit:e.caseLimit}}var n0;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(n0||={});var Cwe=()=>{let{tComponent:e,t,isReady:n,formatDateTime:r}=q({component:$1,keys:[`system_enums`]}),{currentOrganizationId:i}=ng(),a=(0,Q.useCallback)((t,n)=>e($1,t,n),[e]),o=(0,Q.useCallback)((e,n)=>{if(!e)return n;let r=ye(e,n),i=t(r);return i===r?n:i},[t]),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(n0.LOADING);if((0,Q.useEffect)(()=>{if(!i)return;let e=!1;return u(n0.LOADING),vc().readAutonomousAgentsOverview(i).then(t=>{e||(c(t),u(n0.READY))}).catch(()=>{e||u(n0.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===n0.FAILED?(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:a(`errorGeneric`)})}):l===n0.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)(wwe,{agent:e,scannedSince:m,tc:a,word:o,formatDateTime:r},e.ref)),p.map(e=>(0,$.jsx)(wF,{"data-autonomous-agent-undeclared":e.autonomousAgentRef,children:(0,$.jsxs)(jF,{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)(i0,{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 r0(e,t){return e?e.organizationRelationshipId===null?t(`partyOwn`):e.representingOrganizationName??t(`partyUnnamedRelationship`):null}function wwe({agent:e,scannedSince:t,tc:n,word:r,formatDateTime:i}){let a=o_(e0??``)?.values;return(0,$.jsx)(wF,{"data-autonomous-agent":e.ref,children:(0,$.jsxs)(jF,{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(xwe(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)(tJ,{children:[(0,$.jsx)(nJ,{children:(0,$.jsxs)(iJ,{children:[(0,$.jsx)(aJ,{children:n(`columnStatus`)}),(0,$.jsx)(aJ,{children:n(`columnParty`)}),(0,$.jsx)(aJ,{children:n(`columnTrigger`)}),(0,$.jsx)(aJ,{children:n(`columnCase`)}),(0,$.jsx)(aJ,{children:n(`columnStarted`)}),(0,$.jsx)(aJ,{children:n(`columnFinished`)})]})}),(0,$.jsx)(rJ,{children:e.recentRuns.map(e=>(0,$.jsxs)(iJ,{"data-autonomous-run":e.executionId,children:[(0,$.jsx)(oJ,{children:(0,$.jsx)(Jd,{variant:a?.[e.status]?.color??`outline`,dot:!0,children:r(e0,e.status)})}),(0,$.jsx)(oJ,{"data-autonomous-party":!0,children:r0(e.party,n)}),(0,$.jsx)(oJ,{children:e.trigger?r(t0,e.trigger):null}),(0,$.jsx)(oJ,{className:`font-mono`,children:e.caseRef?.resourceId??null}),(0,$.jsx)(oJ,{children:i(e.createdAt)}),(0,$.jsx)(oJ,{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)(i0,{refusals:e.recentRefusals,scannedSince:t,tc:n,word:r,formatDateTime:i})]})})}function i0({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)(tJ,{children:[(0,$.jsx)(nJ,{children:(0,$.jsxs)(iJ,{children:[(0,$.jsx)(aJ,{children:n(`columnRefusedAt`)}),(0,$.jsx)(aJ,{children:n(`columnParty`)}),(0,$.jsx)(aJ,{children:n(`columnTrigger`)}),(0,$.jsx)(aJ,{children:n(`columnReason`)})]})}),(0,$.jsx)(rJ,{children:e.map(e=>(0,$.jsxs)(iJ,{"data-autonomous-refusal":e.reason,children:[(0,$.jsx)(oJ,{children:i(e.refusedAt)}),(0,$.jsx)(oJ,{"data-autonomous-party":!0,children:r0(e.party,n)}),(0,$.jsx)(oJ,{children:r(t0,e.trigger)}),(0,$.jsx)(oJ,{children:n(bwe(e.reason),Swe(e))})]},`${e.occurrenceKey}:${e.refusedAt}:${e.party?e.party.organizationRelationshipId??`own`:`unknown`}`))})]})]})}var a0=K.LOW_LEVEL_AI_TASK_DETAIL;function o0(e){switch(e.kind){case $l.TASK:return e.taskId;case $l.PLAN_STEP:return e.planStepId;case $l.PLAN:return e.planId;case $l.ACTOR:return e.actorId;case $l.ACTOR_SYSTEM:return e.actorSystemId;case $l.FLOW:return e.flowId;case $l.FLOW_STEP:return e.stepId}}var s0=({task:e,nameOf:t,className:n,...r})=>{let{tComponent:i,isReady:a,formatDateTime:o}=q({component:a0}),{word:s,isReady:c}=Yf(gf),{word:l,isReady:u}=Yf(kf),d=e.context!==void 0&&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)(wF,{statusEdge:xf(e.status),className:G(`flex flex-col`,n),...r,children:[(0,$.jsxs)(EF,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(Jd,{variant:`outline`,className:`text-2xs`,children:s(e.topic)}),(0,$.jsx)(yf,{status:e.status}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-2xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:i(a0,`actor`)}),(0,$.jsx)(`span`,{className:`font-mono`,children:e.actors.actorRef})]})]}),(0,$.jsx)(OF,{className:`text-sm`,children:e.title}),(0,$.jsx)(AF,{className:`text-xs`,children:e.description})]}),(0,$.jsxs)(jF,{className:`flex flex-col gap-card-sm`,children:[e.input!==void 0&&(0,$.jsx)(c0,{label:i(a0,`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)(c0,{label:i(a0,`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)})}),e.context!==void 0&&(0,$.jsx)(c0,{label:i(a0,`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(a0,`contextEmpty`)})}),f&&(0,$.jsx)(c0,{label:i(a0,`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)??o0(e)})]},n))})}),p&&(0,$.jsx)(c0,{label:i(a0,`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)(Jd,{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)(u0,{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(a0,`started`)}),(0,$.jsx)(`span`,{children:Wf.formatTimestamp(e.startedAt,o)})]}),e.completedAt&&(0,$.jsxs)(`span`,{className:`flex gap-1`,children:[(0,$.jsx)(`span`,{children:i(a0,`completed`)}),(0,$.jsx)(`span`,{children:Wf.formatTimestamp(e.completedAt,o)})]}),e.startedAt&&(0,$.jsx)(`span`,{className:`font-mono`,children:Wf.formatDuration(e.startedAt,e.completedAt)})]})]})]})};function c0({label:e,children:t,defaultOpen:n=!1}){return(0,$.jsxs)(bO,{defaultOpen:n,children:[(0,$.jsx)(xO,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.SM,className:`h-auto justify-start p-0 text-xs font-medium`,children:e})}),(0,$.jsx)(SO,{className:`mt-1`,children:t})]})}var l0=({tasks:e,nameOf:t,className:n,...r})=>{let{tComponent:i,isReady:a}=q({component:a0}),{statusWord:o,isReady:s}=mf(),{word:c,isReady:l}=Yf(gf),[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:G(`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(a0,`filterByStatus`)}),(0,$.jsx)(Y,{type:`button`,variant:u===null?X.SECONDARY:X.GHOST,size:df.SM,className:`h-6 text-2xs`,onClick:()=>d(null),children:i(a0,`filterAll`)}),g.map(e=>(0,$.jsx)(Y,{type:`button`,variant:u===e?X.SECONDARY:X.GHOST,size:df.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(a0,`filterByTopic`)}),(0,$.jsx)(Y,{type:`button`,variant:f===null?X.SECONDARY:X.GHOST,size:df.SM,className:`h-6 text-2xs`,onClick:()=>p(null),children:i(a0,`filterAll`)}),_.map(e=>(0,$.jsx)(Y,{type:`button`,variant:f===e?X.SECONDARY:X.GHOST,size:df.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(a0,`sortBy`)}),(0,$.jsx)(Y,{type:`button`,variant:m===`createdAt`?X.SECONDARY:X.GHOST,size:df.SM,className:`h-6 text-2xs`,onClick:()=>h(`createdAt`),children:i(a0,`sortDate`)}),(0,$.jsx)(Y,{type:`button`,variant:m===`status`?X.SECONDARY:X.GHOST,size:df.SM,className:`h-6 text-2xs`,onClick:()=>h(`status`),children:i(a0,`sortStatus`)})]})]}),(0,$.jsx)(Wd,{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(a0,`noTasks`)}),v.map(e=>(0,$.jsx)(s0,{task:e,...t?{nameOf:t}:{}},e._id))]})})]})},u0=({events:e,className:t,...n})=>{let{tComponent:r,isReady:i,formatTime:a}=q({component:a0}),o=Q.useMemo(()=>[...e].sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime()),[e]);return i?(0,$.jsxs)(`div`,{className:G(`flex flex-col gap-1`,t),...n,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium`,children:r(a0,`timeline`)}),(0,$.jsx)(Wd,{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?Wf.formatDuration(o[t-1].timestamp,e.timestamp):void 0;return(0,$.jsxs)(`li`,{className:`ms-4`,children:[(0,$.jsx)(`div`,{className:G(`absolute -start-1.5 mt-1.5 size-3 rounded-full`,Kf(e.status))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(yf,{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:Wf.formatTimestamp(e.timestamp,a)})]},`${e.status}-${e.timestamp}-${t}`)})})})]}):null},d0=K.APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS,f0;(function(e){e.ORGANIZATION=`organization`,e.APPLICATION=`application`})(f0||={});var p0;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`,e.ACCESS_GRANT_REQUIRED=`access-grant-required`})(p0||={});var Twe=Bl(Tr.shape.decisionOutcome),Ewe=Bl(See.shape.state);function Dwe(e){return`direction_${e}`}function m0(e){return`kind_${e}`}function h0(e){return Rr(e)&&e.customMessageReference===Lu.AUTHORIZATIONS_APPLICATION_ACCESS_GRANT_REQUIRED?p0.ACCESS_GRANT_REQUIRED:p0.FAILED}function Owe(e){return e.statusChanges.map(e=>({status:e.status,timestamp:e.timestamp}))}function kwe(e){let t=e.flowRun?.nodes??[],n=[],r=0;for(let i of t){if(!i.statusAt){r+=1;continue}let t=e.flowNodeNames?.[i.nodeRef];n.push({nodeRef:i.nodeRef,nodeType:i.nodeType,status:i.status,timestamp:i.statusAt,...t?{nodeName:t}:{}})}return{events:n,untimed:r}}function Awe(e){let t=(e.flowRun?.nodes??[]).filter(e=>e.nodeType===Jne.STEP);return{total:t.length,completed:t.filter(e=>e.status===Do.COMPLETED).length,failed:t.filter(e=>e.status===Do.FAILED).length}}function jwe(e){return{title:e.title,description:e.description,topic:e.topic,status:e.status,actors:{actorRef:e.actorRef},input:e.input,...e.output===void 0?{}:{output:e.output},relationships:[],...e.artifacts?{artifacts:e.artifacts}:{},actorStates:[],...e.startedAt?{startedAt:e.startedAt}:{},...e.completedAt?{completedAt:e.completedAt}:{}}}var g0=({scope:e})=>{let{tComponent:t,isReady:n,formatDateTime:r}=q({component:d0,keys:[`system_enums`]}),{currentOrganizationId:i}=ng(),a=(0,Q.useCallback)((e,n)=>t(d0,e,n),[t]),o=e===f0.ORGANIZATION?i:void 0,s=e===f0.ORGANIZATION&&!i,[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(p0.LOADING),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),g=(0,Q.useCallback)(e=>vc().listAgentActivity({...o?{organizationId:o}:{},...e?{after:e}:{}}),[o]);(0,Q.useEffect)(()=>{if(s)return;let e=!1;return d(p0.LOADING),h(null),g(void 0).then(t=>{e||(l({organizationId:o,runs:t.runs,...t.next?{next:t.next}:{}}),d(p0.READY))}).catch(t=>{e||d(h0(t))}),()=>{e=!0}},[g,o,s]);let _=(0,Q.useCallback)(()=>{c?.next&&(p(!0),g(c.next).then(e=>l(t=>t&&t.organizationId===o?{organizationId:o,runs:[...t.runs,...e.runs],...e.next?{next:e.next}:{}}:t)).catch(e=>d(h0(e))).finally(()=>p(!1)))},[c,g,o]);if(!n)return null;let v=c&&c.organizationId===o?c:null,y=e===f0.APPLICATION?`applicationPageTitle`:`pageTitle`,b=e===f0.APPLICATION?`applicationPageDescription`:`pageDescription`;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,"data-agent-activity-scope":e,children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:a(y)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(b)}),s?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`noOrganization`)}):u===p0.ACCESS_GRANT_REQUIRED?(0,$.jsx)(OD,{variant:`warning`,"data-agent-activity-grant-required":!0,children:(0,$.jsx)(AD,{children:a(`errorAccessGrantRequired`)})}):u===p0.FAILED?(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:a(`errorGeneric`)})}):u===p0.LOADING||!v?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`loading`)}):m?(0,$.jsx)(Nwe,{executionId:m,organizationId:o,showOrganization:e===f0.APPLICATION,onBack:()=>h(null),tc:a,formatDateTime:r}):(0,$.jsxs)($.Fragment,{children:[v.runs.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:a(`empty`)}):(0,$.jsx)(Mwe,{runs:v.runs,showOrganization:e===f0.APPLICATION,hasMore:v.next!==void 0,moreLoading:f,onOpen:h,onMore:_,tc:a,formatDateTime:r}),(0,$.jsx)(Pwe,{organizationId:o,showOrganization:e===f0.APPLICATION,tc:a,formatDateTime:r})]})]})};function Mwe({runs:e,showOrganization:t,hasMore:n,moreLoading:r,onOpen:i,onMore:a,tc:o,formatDateTime:s}){return(0,$.jsxs)(`div`,{className:`flex flex-col gap-element`,children:[(0,$.jsxs)(tJ,{children:[(0,$.jsx)(nJ,{children:(0,$.jsxs)(iJ,{children:[(0,$.jsx)(aJ,{children:o(`columnSystem`)}),(0,$.jsx)(aJ,{children:o(`columnKind`)}),(0,$.jsx)(aJ,{children:o(`columnStatus`)}),t?(0,$.jsx)(aJ,{children:o(`columnOrganization`)}):null,(0,$.jsx)(aJ,{children:o(`columnCase`)}),(0,$.jsx)(aJ,{children:o(`columnStarted`)}),(0,$.jsx)(aJ,{children:o(`columnFinished`)}),(0,$.jsx)(aJ,{children:(0,$.jsx)(`span`,{className:`sr-only`,children:o(`columnActions`)})})]})}),(0,$.jsx)(rJ,{children:e.map(e=>(0,$.jsxs)(iJ,{"data-agent-activity-run":e.executionId,children:[(0,$.jsx)(oJ,{className:`font-mono`,children:e.systemRef}),(0,$.jsx)(oJ,{children:o(m0(e.kind))}),(0,$.jsx)(oJ,{children:(0,$.jsx)(yf,{status:e.status})}),t?(0,$.jsx)(oJ,{className:`font-mono`,children:e.organizationId}):null,(0,$.jsx)(oJ,{className:`font-mono`,children:e.caseRef?.resourceId??null}),(0,$.jsx)(oJ,{children:s(e.createdAt)}),(0,$.jsx)(oJ,{children:e.finishedAt?s(e.finishedAt):(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:o(`notFinished`)})}),(0,$.jsx)(oJ,{children:(0,$.jsx)(Y,{type:`button`,variant:X.OUTLINE,size:df.SM,onClick:()=>i(e.executionId),"data-agent-activity-open":e.executionId,children:o(`openRun`)})})]},e.executionId))})]}),n?(0,$.jsx)(`div`,{children:(0,$.jsx)(Y,{type:`button`,variant:X.OUTLINE,size:df.SM,onClick:a,disabled:r,"data-agent-activity-more":!0,children:o(r?`loading`:`loadMore`)})}):null]})}function Nwe({executionId:e,organizationId:t,showOrganization:n,onBack:r,tc:i,formatDateTime:a}){let[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(p0.LOADING),{word:u,isReady:d}=Yf(Twe);(0,Q.useEffect)(()=>{let n=!1;return l(p0.LOADING),vc().readAgentActivityRun({executionId:e,...t?{organizationId:t}:{}}).then(e=>{n||(s(e),l(p0.READY))}).catch(e=>{n||l(h0(e))}),()=>{n=!0}},[e,t]);let f=(0,Q.useMemo)(()=>o?Owe(o):[],[o]),p=(0,Q.useMemo)(()=>o?.flowRun?kwe(o):null,[o]),m=(0,Q.useMemo)(()=>o?.flowRun?Awe(o):null,[o]),h=(0,Q.useMemo)(()=>o?.statusChanges.filter(e=>e.decisionOutcome!==void 0)??[],[o]);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-section`,"data-agent-activity-run-view":e,children:[(0,$.jsx)(`div`,{children:(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.SM,onClick:r,"data-agent-activity-back":!0,children:i(`backToRuns`)})}),c===p0.ACCESS_GRANT_REQUIRED?(0,$.jsx)(OD,{variant:`warning`,children:(0,$.jsx)(AD,{children:i(`errorAccessGrantRequired`)})}):c===p0.FAILED?(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:i(`errorRun`)})}):c===p0.LOADING||!o||!d?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`loading`)}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(wF,{children:(0,$.jsxs)(jF,{className:`flex flex-col gap-section p-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:o.systemRef}),(0,$.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:i(m0(o.kind))}),(0,$.jsx)(yf,{status:o.status})]}),(0,$.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-section gap-y-element text-sm`,children:[n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:i(`columnOrganization`)}),(0,$.jsx)(`dd`,{className:`font-mono`,children:o.organizationId})]}):null,o.caseRef?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:i(`columnCase`)}),(0,$.jsx)(`dd`,{className:`font-mono`,children:o.caseRef.resourceId})]}):null,(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:i(`columnStarted`)}),(0,$.jsx)(`dd`,{children:a(o.createdAt)}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:i(`columnFinished`)}),(0,$.jsx)(`dd`,{children:o.finishedAt?a(o.finishedAt):i(`notFinished`)})]}),f.length>0?(0,$.jsx)(u0,{events:f,"data-agent-activity-history":!0}):null,h.length>0?(0,$.jsxs)(`section`,{className:`flex flex-col gap-element`,"aria-label":i(`decisionsHeading`),children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold`,children:i(`decisionsHeading`)}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-element text-sm`,children:h.map((e,t)=>(0,$.jsx)(`li`,{"data-agent-activity-decision":e.decisionOutcome,children:i(`decisionEnded`,{outcome:u(e.decisionOutcome),at:a(e.timestamp)})},`${e.timestamp}-${t}`))})]}):null]})}),o.flowRun&&p&&m?(0,$.jsxs)(`section`,{className:`flex flex-col gap-element`,"aria-label":i(`flowStepsHeading`),"data-agent-activity-flow":!0,children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold`,children:i(`flowStepsHeading`)}),(0,$.jsx)(Af,{totalSteps:m.total,completedSteps:m.completed,failedSteps:m.failed,status:o.status,startedAt:o.createdAt,...o.finishedAt?{completedAt:o.finishedAt}:{}}),p.events.length>0?(0,$.jsx)(Rf,{events:p.events}):null,p.untimed>0?(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:i(`flowStepsUntimed`,{count:p.untimed})}):null,o.flowRun.failure?(0,$.jsx)(OD,{variant:`destructive`,"data-agent-activity-flow-failure":!0,children:(0,$.jsxs)(AD,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:i(`flowFailureLabel`)}),` `,(0,$.jsx)(`span`,{className:`font-mono text-xs`,children:o.flowRun.failure})]})}):null]}):null,(0,$.jsxs)(`section`,{className:`flex flex-col gap-element`,"aria-label":i(`tasksHeading`),children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold`,children:i(`tasksHeading`)}),o.tasks.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`noTasks`)}):o.tasks.map(e=>(0,$.jsx)(s0,{task:jwe(e),"data-agent-activity-task":e.taskId},e.taskId))]})]})]})}function Pwe({organizationId:e,showOrganization:t,tc:n,formatDateTime:r}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(p0.LOADING),[c,l]=(0,Q.useState)(!1),{word:u,isReady:d}=Yf(Ewe),f=(0,Q.useCallback)(t=>vc().listAgentToAgentTasks({...e?{organizationId:e}:{},...t?{after:t}:{}}),[e]);(0,Q.useEffect)(()=>{let t=!1;return s(p0.LOADING),f(void 0).then(n=>{t||(a({organizationId:e,tasks:n.tasks,...n.next?{next:n.next}:{}}),s(p0.READY))}).catch(e=>{t||s(h0(e))}),()=>{t=!0}},[f,e]);let p=(0,Q.useCallback)(()=>{i?.next&&(l(!0),f(i.next).then(t=>a(n=>n&&n.organizationId===e?{organizationId:e,tasks:[...n.tasks,...t.tasks],...t.next?{next:t.next}:{}}:n)).catch(e=>s(h0(e))).finally(()=>l(!1)))},[i,f,e]),m=i&&i.organizationId===e?i:null;return(0,$.jsxs)(`section`,{className:`flex flex-col gap-element`,"aria-label":n(`agentToAgentHeading`),"data-agent-activity-agent-to-agent":!0,children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold`,children:n(`agentToAgentHeading`)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:n(`agentToAgentDescription`)}),o===p0.ACCESS_GRANT_REQUIRED?(0,$.jsx)(OD,{variant:`warning`,children:(0,$.jsx)(AD,{children:n(`errorAccessGrantRequired`)})}):o===p0.FAILED?(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:n(`agentToAgentError`)})}):o===p0.LOADING||!m||!d?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:n(`loading`)}):m.tasks.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:n(`agentToAgentEmpty`)}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(tJ,{children:[(0,$.jsx)(nJ,{children:(0,$.jsxs)(iJ,{children:[(0,$.jsx)(aJ,{children:n(`columnDirection`)}),(0,$.jsx)(aJ,{children:n(`columnCounterpart`)}),t?(0,$.jsx)(aJ,{children:n(`columnOrganization`)}):null,(0,$.jsx)(aJ,{children:n(`columnTaskState`)}),(0,$.jsx)(aJ,{children:n(`columnTaskStarted`)}),(0,$.jsx)(aJ,{children:n(`columnTaskEnded`)})]})}),(0,$.jsx)(rJ,{children:m.tasks.map(e=>(0,$.jsxs)(iJ,{"data-agent-to-agent-task":e.taskId,"data-agent-to-agent-direction":e.direction,children:[(0,$.jsx)(oJ,{children:n(Dwe(e.direction))}),(0,$.jsx)(oJ,{children:(0,$.jsx)(Fwe,{task:e,tc:n})}),t?(0,$.jsx)(oJ,{className:`font-mono`,children:e.organizationId??(e.source===Dt.RECEIVED_BY_APPLICATION?(0,$.jsx)(`span`,{className:`font-sans`,children:n(`applicationOwnClient`)}):null)}):null,(0,$.jsx)(oJ,{children:e.direction===ni.RECEIVED?(0,$.jsx)(yf,{status:e.status}):e.state?(0,$.jsxs)(`div`,{className:`flex flex-col`,"data-agent-to-agent-state":e.state,children:[(0,$.jsx)(`span`,{children:u(e.state)}),e.stateReportedAt?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`stateReportedAt`,{at:r(e.stateReportedAt)})}):null]}):(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:n(`stateNotReported`)})}),(0,$.jsx)(oJ,{children:r(e.startedAt)}),(0,$.jsx)(oJ,{children:e.endedAt?r(e.endedAt):(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:n(`taskNotEnded`)})})]},`${e.source}:${e.taskId}`))})]}),m.next?(0,$.jsx)(`div`,{children:(0,$.jsx)(Y,{type:`button`,variant:X.OUTLINE,size:df.SM,onClick:p,disabled:c,"data-agent-to-agent-more":!0,children:n(c?`loading`:`loadMoreTasks`)})}):null]})]})}function Fwe({task:e,tc:t}){return e.direction===ni.DELEGATED?(0,$.jsxs)(`div`,{className:`flex flex-col`,children:[(0,$.jsx)(`span`,{children:e.remoteAgentName??(0,$.jsx)(`span`,{className:`font-mono`,children:e.remoteAgentRef})}),e.remoteAgentName?(0,$.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.remoteAgentRef}):null]}):(0,$.jsxs)(`div`,{className:`flex flex-col`,children:[(0,$.jsx)(`span`,{children:e.clientName??(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:t(`unknownClient`)})}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.agentRef?t(`receivedByAgent`,{agent:e.agentRef}):t(`receivedByDefaultAgent`)})]})}function _0(e,t,n){let r=il(t);if(r!==void 0)return n(jl(BigInt(e),r),{style:`currency`,currency:t,minimumFractionDigits:r,maximumFractionDigits:r})}var v0=K.APP_LAYOUTS_MODEL_COST_BREAKDOWN_SETTINGS,y0;(function(e){e.APPLICATION=`application`,e.REPRESENTING_ORGANIZATION=`representing-organization`})(y0||={});var 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 Iwe=[b0.LAST_30_DAYS,b0.LAST_90_DAYS,b0.LAST_365_DAYS],Lwe=Object.values(au),x0;(function(e){e.GENERIC=`generic`,e.ACCESS_GRANT_REQUIRED=`accessGrantRequired`})(x0||={});function Rwe(e){return e===x0.ACCESS_GRANT_REQUIRED?`errorAccessGrantRequired`:`errorGeneric`}function S0(e){return`groupBy_${e}`}function zwe(e){return`window_${e}`}function Bwe(e){return`decisionTime_${e}`}function Vwe(e,t){switch(t){case au.CASE:return e.key.caseRef?`${e.key.caseRef.resourceType} · ${e.key.caseRef.resourceId}`:void 0;case au.ORGANIZATION:return e.key.organizationId;case au.AGENT:return e.key.agentRef;case au.MODEL:return e.key.model?[e.key.provider,e.key.model].filter(Boolean).join(` · `):void 0}}function Hwe(e){if(e.availability===_.JOINED)return{decisions:e.decisionCount??0,minutes:Math.round((e.reviewDurationMs??0)/6e4)}}var C0=({scope:e})=>{let{tComponent:t,isReady:n,formatNumber:r}=q({component:v0}),i=(0,Q.useCallback)((e,n)=>t(v0,e,n),[t]),{currentOrganizationId:a}=ng(),o=e===y0.REPRESENTING_ORGANIZATION?a??void 0:void 0,s=e===y0.REPRESENTING_ORGANIZATION&&!o,[c,l]=(0,Q.useState)(au.CASE),[u,d]=(0,Q.useState)(b0.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),vc().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||(Rr(t)&&t.customMessageReference===Lu.AUTHORIZATIONS_APPLICATION_ACCESS_GRANT_REQUIRED?_(x0.ACCESS_GRANT_REQUIRED):_(x0.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=_0(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===y0.REPRESENTING_ORGANIZATION?`representingPageTitle`:`pageTitle`)}),(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(e===y0.REPRESENTING_ORGANIZATION?`representingPageDescription`:`pageDescription`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-section`,children:[(0,$.jsx)(aO,{value:c,onValueChange:e=>l(e),children:(0,$.jsx)(oO,{children:Lwe.map(e=>(0,$.jsx)(sO,{value:e,"data-ref":e,children:i(S0(e))},e))})}),(0,$.jsx)(`div`,{className:`flex gap-element`,role:`group`,"aria-label":i(`windowLabel`),children:Iwe.map(e=>(0,$.jsx)(Y,{size:df.SM,variant:e===u?X.DEFAULT:X.OUTLINE,"aria-pressed":e===u,onClick:()=>d(e),children:i(zwe(e))},e))})]}),s?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`noOrganization`)}):g?(0,$.jsx)(OD,{variant:g===x0.ACCESS_GRANT_REQUIRED?`default`:`destructive`,children:(0,$.jsx)(AD,{children:i(Rwe(g))})}):(0,$.jsx)(wF,{children:(0,$.jsxs)(jF,{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)(tJ,{children:[(0,$.jsx)(nJ,{children:(0,$.jsxs)(iJ,{children:[(0,$.jsx)(aJ,{children:i(S0(c))}),(0,$.jsx)(aJ,{children:i(`columnCost`)}),(0,$.jsx)(aJ,{children:i(`columnCalls`)}),(0,$.jsx)(aJ,{children:i(`columnUnpriced`)}),(0,$.jsx)(aJ,{children:i(`columnTokens`)}),(0,$.jsx)(aJ,{children:i(`columnClassifierCalls`)}),(0,$.jsx)(aJ,{children:i(`columnDocumentExtractionCalls`)}),(0,$.jsx)(aJ,{children:i(`columnPersonalDataWithheld`)}),c===au.CASE?(0,$.jsx)(aJ,{children:i(`columnDecisionTime`)}):null]})}),(0,$.jsx)(rJ,{children:y.map((e,t)=>{let n=Vwe(e,c);return(0,$.jsxs)(iJ,{"data-model-cost-group":n??`unattributed`,children:[(0,$.jsx)(oJ,{className:n?`font-mono`:`text-muted-foreground`,children:n??i(`unattributed`)}),(0,$.jsx)(oJ,{className:`tabular-nums`,children:x(e)}),(0,$.jsx)(oJ,{className:`tabular-nums`,children:r(e.callCount)}),(0,$.jsx)(oJ,{className:`tabular-nums`,children:r(e.unpricedCallCount)}),(0,$.jsx)(oJ,{className:`tabular-nums`,children:r(S(e))}),(0,$.jsx)(oJ,{className:`tabular-nums`,children:r(e.classifierCallCount)}),(0,$.jsx)(oJ,{className:`tabular-nums`,children:r(e.documentExtractionCallCount)}),(0,$.jsx)(oJ,{className:`tabular-nums`,children:r(e.personalDataFieldsWithheld)}),c===au.CASE?(0,$.jsx)(oJ,{children:e.decisionTime?i(Bwe(e.decisionTime.availability),Hwe(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]})})]})},w0=K.APP_LAYOUTS_REPRESENTATIVE_ACTIVITY_SETTINGS,T0;(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`})(T0||={});var Uwe=[T0.LAST_7_DAYS,T0.LAST_30_DAYS,T0.LAST_365_DAYS];function Wwe(e){return`window_${e}`}function E0(e){return`disclosure_${e}`}function Gwe(e){return`outcome_${e}`}function Kwe(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 qwe=()=>{let{tComponent:e,t,isReady:n,formatDateTime:r}=q({component:w0}),i=(0,Q.useCallback)((t,n)=>e(w0,t,n),[e]),{currentOrganizationId:a}=ng(),o=a??void 0,[s,c]=(0,Q.useState)(T0.LAST_30_DAYS),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!0),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),y=(0,Q.useCallback)(async e=>vc().readRepresentativeActivity(e),[]);(0,Q.useEffect)(()=>{if(!o){m(!1),f(!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 f(!0),m(!1),g(!1),v(null),y(r).then(t=>{e||u({...r,rows:t.rows,nextCursor:t.nextCursor,windowDays:s})}).catch(()=>{e||m(!0)}).finally(()=>{e||f(!1)}),()=>{e=!0}},[o,s,y]);let b=(0,Q.useCallback)(()=>{if(!l?.nextCursor)return;let e=l;f(!0),g(!1),y({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(()=>g(!0)).finally(()=>f(!1))},[l,y]),x=l&&l.windowDays===s&&l.organizationId===o?l:null,S=x?.rows??[];if(!n)return null;let C=e=>{let n=ye(sne.CORE_AUDITABLE_EVENT_TYPE,e),r=t(n);return r===n?ps(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:Uwe.map(e=>(0,$.jsx)(Y,{size:df.SM,variant:e===s?X.DEFAULT:X.OUTLINE,"aria-pressed":e===s,onClick:()=>c(e),children:i(Wwe(e))},e))}),o?p?(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:i(`errorGeneric`)})}):(0,$.jsx)(wF,{children:(0,$.jsxs)(jF,{className:`flex flex-col gap-element p-card`,children:[x===null?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`loading`)}):S.length===0?(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`empty`)}):(0,$.jsxs)(tJ,{children:[(0,$.jsx)(nJ,{children:(0,$.jsxs)(iJ,{children:[(0,$.jsx)(aJ,{children:i(`columnWhen`)}),(0,$.jsx)(aJ,{children:i(`columnOrganization`)}),(0,$.jsx)(aJ,{children:i(`columnPerson`)}),(0,$.jsx)(aJ,{children:i(`columnEvent`)}),(0,$.jsx)(aJ,{children:i(`columnTarget`)}),(0,$.jsx)(aJ,{children:i(`columnOutcome`)}),(0,$.jsx)(aJ,{children:i(`columnDetail`)})]})}),(0,$.jsx)(rJ,{children:S.map(e=>{let t=Kwe(e),n=_===e.eventId;return(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsxs)(iJ,{"data-representative-activity-row":e.eventId,"data-disclosure":e.disclosure,children:[(0,$.jsx)(oJ,{className:`tabular-nums`,children:r(e.createdAt)}),(0,$.jsx)(oJ,{className:e.grantingOrganizationName?void 0:`font-mono`,children:e.grantingOrganizationName??e.grantingOrganizationId}),(0,$.jsx)(oJ,{className:e.userName?void 0:e.userId?`font-mono`:`text-muted-foreground`,children:e.userName??e.userId??e.agentRef??i(`automatedActor`)}),(0,$.jsx)(oJ,{children:C(e.eventType)}),(0,$.jsx)(oJ,{className:`font-mono`,children:t??null}),(0,$.jsx)(oJ,{className:e.outcome===ec.FAILURE?`text-destructive`:void 0,children:i(Gwe(e.outcome))}),(0,$.jsx)(oJ,{children:e.disclosure===ks.FULL?(0,$.jsx)(Y,{size:df.SM,variant:X.OUTLINE,"aria-expanded":n,onClick:()=>v(n?null:e.eventId),children:i(n?`hideDetail`:E0(ks.FULL))}):(0,$.jsx)(Z,{className:`text-xs text-muted-foreground`,children:i(E0(ks.METADATA))})})]}),n&&e.eventData?(0,$.jsx)(iJ,{children:(0,$.jsx)(oJ,{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)})})]}),h?(0,$.jsx)(Z,{className:`text-xs text-destructive`,children:i(`errorLoadMore`)}):null,x?.nextCursor?(0,$.jsx)(`div`,{children:(0,$.jsx)(Y,{size:df.SM,variant:X.OUTLINE,disabled:d,onClick:b,children:i(`loadMore`)})}):null]})}):(0,$.jsx)(Z,{className:`text-sm text-muted-foreground`,children:i(`noOrganization`)})]})},D0=K.APP_LAYOUTS_AGENT_WORK_EVALUATION_EXPORT_SETTINGS,O0=864e5,Jwe=X1.LAST_365_DAYS,Ywe=[X1.LAST_30_DAYS,X1.LAST_90_DAYS,X1.LAST_365_DAYS],Xwe=Vee.shape.destination.maxLength??void 0,Zwe=md().min(1);function Qwe(e,t){return`evaluation-dataset-${e}-${t}.jsonl`}function $we(e,t){let n=e.resourceConfigurations[Wo.EVALUATION_EXPORT_AUTHORIZATIONS],r=n?.operations.find(e=>e.operationIdentifier===J.READ&&e.isOperationDefault===!0&&e.variantType===oe.API_CALL);if(!n||!r)return;let i=tm.buildResourceOperationContextIdentifiers({currentOrganizationId:t,primaryScope:n.resourcePrimaryScope,explicitContextResourceIdentifiers:{}});return{operationPathKey:no.buildOperationPathKeyFromOperation(r),contextualParameters:U.buildContextualParameters(i,e)}}var eTe=()=>{let{tComponent:e,isReady:t}=q({component:D0}),{currentOrganizationId:n}=ng(),{registry:r,doOperation:i}=fm(),a=(0,Q.useCallback)(t=>e(D0,t),[e]),o=(0,Q.useCallback)((t,n)=>e(D0,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)(X1.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=$we(r,n);if(e===void 0)return;let t=!1;return i(e.operationPathKey,{contextualParameters:e.contextualParameters},{silent:!0,riskLevel:od.LOW}).then(e=>{t||T(e?.status===zre.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),vc().summarizeAgentWorkOverrideRate({from:new Date(t.getTime()-Jwe*O0).toISOString(),to:t.toISOString(),groupBy:Za.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 vc().exportEvaluationDataset({organizationId:n,agentRef:f,from:new Date(e.getTime()-m*O0).toISOString(),to:e.toISOString(),destination:g.trim()});My(new Blob([t.jsonl],{type:`application/x-ndjson`}),Qwe(f,t.exportId)),x({exportId:t.exportId,recordCount:t.recordCount})}catch(e){ri(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)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:S})}),E&&(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:a(`authorizationMissingNotice`)})}),b&&(0,$.jsx)(OD,{children:(0,$.jsx)(AD,{children:o(`exportedNotice`,{count:b.recordCount})})}),(0,$.jsx)(wF,{children:(0,$.jsx)(jF,{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)(fF,{name:`agentRef`,schema:Zwe,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:Ywe.map(e=>(0,$.jsx)(Y,{size:df.SM,variant:e===m?X.DEFAULT:X.OUTLINE,"aria-pressed":e===m,onClick:()=>h(e),children:a(Q1(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)(XM,{"aria-label":a(`destinationLabel`),type:`text`,maxLength:Xwe,value:g,onChange:e=>_(e.target.value)})]}),(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(Y,{size:df.SM,variant:X.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},k0=new Set;function A0(e){let{resolvedFeatures:t,resolvedFeaturesResponse:n,featureDefinitions:r,unavailabilityPolicy:i,isLoading:a}=vh(),{permissions:o}=ng(),{track:s,isActive:c}=o$(),l=Lh(),u=Zp(),d=(0,Q.useMemo)(()=>{if(a)return{isAvailable:!0,behavior:js.DISABLE};let s=r.get(e);if(!s){let{behavior:t,debugTrace:n}=Xh({reason:yo.NOT_CONFIGURED,featureDef:void 0,policy:i,userRoles:[],billingEnabled:l?.isEnabled??!1});return{isAvailable:!1,reason:yo.NOT_CONFIGURED,behavior:t,missingFeatures:[e],debugTrace:ui.isDevelopment()?n:void 0}}let c=Oh(o,u?.currentOrganizationId??null);if(s.valueType===vu.BOOLEAN){if(new Set(t.features).has(e))return{isAvailable:!0,behavior:js.DISABLE};let r=yo.FEATURE_NOT_ENABLED,{behavior:a,suggestedProductRef:o,customComponentRef:u,debugTrace:d}=Xh({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:ui.isDevelopment()?d:void 0}}if(s.valueType===vu.LIMIT){let r=t.limits[e];if(r===void 0||r===-1)return{isAvailable:!0,behavior:js.DISABLE};let a=t.currentUsage[e]??0;if(a<r)return{isAvailable:!0,behavior:js.DISABLE};let o=yo.LIMIT_EXCEEDED,{behavior:u,suggestedProductRef:d,customComponentRef:f,debugTrace:p}=Xh({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:ui.isDevelopment()?p:void 0}}return{isAvailable:!0,behavior:js.DISABLE}},[e,a,t,n,r,i,o,u?.currentOrganizationId,l?.isEnabled]);return(0,Q.useEffect)(()=>{if(!c)return;let t=`${e}:${d.isAvailable}`;k0.has(t)||(k0.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 j0({featureId:e,children:t,renderUnavailable:n}){let r=A0(e),i=Ch();return r.isAvailable?(0,$.jsx)($.Fragment,{children:t}):r.behavior===js.HIDE?null:n?(0,$.jsx)($.Fragment,{children:n(r)}):(0,$.jsx)(Ph,{behavior:r.behavior,missingFeatures:r.missingFeatures,limitInfo:r.limitInfo,upgradeOptionsCount:r.upgradeOptions?.length,customComponentRef:r.customComponentRef,onDismiss:void 0,onAction:()=>i(r)})}function tTe(e,t){switch(t.type){case`push`:return[...e,{id:Hm.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 nTe(e){return{navigate:t=>{Hm.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 rTe({rootContext:e}){let t=vS(),[n,r]=(0,Q.useReducer)(tTe,e,e=>[{id:Hm.generateStackEntryId(),context:e}]),i=(0,Q.useRef)(n);i.current=n;let a=(0,Q.useMemo)(()=>nTe({dispatch:r,getDepth:()=>i.current.length,globalController:t}),[t]),o=n[n.length-1];return(0,$.jsx)(_S.Provider,{value:a,children:(0,$.jsx)(OY,{resourceContext:o.context,navigationZone:Gn.OVERLAY,navigationInitiator:{sourceZone:Gn.OVERLAY}},o.id)})}function iTe(e,t,n,r){return t!==rn.APPLICATION||!r||e[Wo.ORGANIZATIONS]!==void 0?e:(n.initiatorInfos??[]).some(e=>e.parameters?.some(e=>e.resourceType===Wo.ORGANIZATIONS))?{...e,[Wo.ORGANIZATIONS]:r}:e}function aTe(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 oTe({message:e}){return(0,$.jsx)(`div`,{className:`p-card text-sm text-muted-foreground`,children:e})}function sTe({resourceType:e,operation:t,operationVariant:n}){let{registry:r}=fm(),i=Zp(),a=(0,Q.useContext)(Vi)?.appIdentity?.applicationId??i?.currentApplicationId??null,o=(0,Q.useMemo)(()=>{let o=r.resourceConfigurations[e];if(!o)return;let s=aTe(o,t,n);if(!s)return;let c=iTe(tm.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=Sx(o,r.allResourceFieldIdentifiers)&&Ao(s)&&c[e]===void 0?c[Wo.USERS]:void 0,u=typeof l==`string`?{...c,[e]:l}:c,d=kn.buildParentResourcesRequirements(e,u,r);return kn.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:s,contextResourceIdentifiers:u,parentResourcesRequirements:d})},[r,e,t,n,i,a]);if(!o)return(0,$.jsx)(oTe,{message:`Settings surface unavailable for ${e} (${t}).`});let s=[e,t,n??``,i?.currentOrganizationId??``,i?.currentUserId??``,a??``].join(`|`);return(0,$.jsx)(rTe,{rootContext:o},s)}function cTe(e){return[...e.categories].sort((e,t)=>(e.order??0)-(t.order??0))}function lTe(e,t){return e.sections.filter(e=>e.categoryRef===t).sort((e,t)=>(e.order??0)-(t.order??0))}function uTe(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 dTe(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 fTe({panelRef:e}){switch(e){case sv.SECURITY:return(0,$.jsx)(jCe,{});case sv.APPEARANCE:return(0,$.jsx)(BCe,{});case sv.INVITATIONS:return(0,$.jsx)(UCe,{});case sv.BILLING:return(0,$.jsx)(KCe,{});case sv.CONNECTED_ACCOUNTS:return(0,$.jsx)(J1,{ownerScope:Pa.USER});case sv.ORGANIZATION_CONNECTED_ACCOUNTS:return(0,$.jsx)(J1,{ownerScope:Pa.ORGANIZATION});case sv.APPLICATION_CONNECTED_ACCOUNTS:return(0,$.jsx)(J1,{ownerScope:Pa.APPLICATION});case sv.AGENT_WORK_OVERRIDE_RATE:return(0,$.jsx)(ywe,{});case sv.AUTONOMOUS_AGENTS:return(0,$.jsx)(Cwe,{});case sv.AGENT_ACTIVITY:return(0,$.jsx)(g0,{scope:f0.ORGANIZATION});case sv.APPLICATION_AGENT_ACTIVITY:return(0,$.jsx)(g0,{scope:f0.APPLICATION});case sv.MODEL_COST_BREAKDOWN:return(0,$.jsx)(C0,{scope:y0.APPLICATION});case sv.REPRESENTING_ORGANIZATION_MODEL_COST_BREAKDOWN:return(0,$.jsx)(C0,{scope:y0.REPRESENTING_ORGANIZATION});case sv.REPRESENTATIVE_ACTIVITY:return(0,$.jsx)(qwe,{});case sv.AGENT_WORK_EVALUATION_EXPORT:return(0,$.jsx)(eTe,{})}}function M0({target:e,resolveSubTabLabel:t,subTabRef:n,onSubTabChange:r}){switch(e.kind){case ov.ENGINE_PANEL:return(0,$.jsx)(fTe,{panelRef:e.panelRef});case ov.CUSTOM_COMPONENT:{let t=Ko.resolve(e.componentRef,H.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)(rl,{componentType:e.componentRef,componentName:e.componentRef})}case ov.RESOURCE_OPERATION:return(0,$.jsx)(sTe,{resourceType:e.resourceType,operation:e.operation,operationVariant:e.operationVariant});case ov.SUB_TABS:return(0,$.jsx)(pTe,{target:e,resolveSubTabLabel:t,subTabRef:n,onSubTabChange:r})}}function pTe({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)(aO,{value:i,onValueChange:e=>r?.(e),children:[(0,$.jsx)(oO,{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)(M0,{target:e.target,resolveSubTabLabel:t})},e.ref))]})}var mTe=`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 hTe({sectionRef:e,subTabRef:t}){let n=D$(),r=(0,Q.useMemo)(()=>cTe(n),[n]),i=(0,Q.useMemo)(()=>dTe(n,e),[n,e]),a=ah(),o=(0,Q.useCallback)(e=>{i&&a(`${za.settings}/${i}/${e}`,{replace:!0})},[i,a]),{UIConfig:s,getRecipe:c}=Ng(),l=c(It.SELECTABLE,kc.FILLED),u=c(It.TYPOGRAPHY,Ea.EYEBROW),d=c(It.TYPOGRAPHY,Ea.LABEL),{renderIcon:f}=ef(),p=s?.currentBreakpoint===Yo.MOBILE,m=p&&!!e,h=(0,Q.useCallback)(()=>{a(za.settings,{replace:!0})},[a]),{tComponent:g,tSettingsHubCategory:_,tSettingsHubGroup:v,tSettingsHubSection:y,isReady:b}=q({component:K.APP_LAYOUTS_SETTINGS_HUB}),x=(0,Q.useCallback)(e=>g(K.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)(Zy,{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)(Y,{variant:X.GHOST,size:df.ICON_SM,"aria-label":x(`backToSections`),onClick:h,children:f(W.BACK,{size:tr.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:G(`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=lTe(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)(v1,{className:`my-item`}),(0,$.jsx)(`div`,{id:a,className:G(`px-card-sm py-card-sm`,u.base),children:_(e.ref,e.label)}),(0,$.jsx)(`div`,{role:`group`,"aria-labelledby":a,children:uTe(e,r).map(t=>(0,$.jsxs)(Q.Fragment,{children:[t.group&&(0,$.jsx)(`div`,{id:`${a}-group-${t.group.ref}`,className:G(`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)(bh,{ref:t?C:void 0,to:`${za.settings}/${e.ref}`,replace:!0,"data-ref":e.ref,"aria-current":t?`page`:void 0,"data-state":t?`active`:`inactive`,className:G(mTe,l.base,l.states.focus,l.states.selected,l.motion.transition),children:[e.icon&&f(e.icon,{size:tr.SM}),y(e.ref,e.label)]},e.ref)})})]},t.group?.ref??`__ungrouped`))})]},e.ref)})}),(0,$.jsx)(`div`,{className:G(`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)(gTe,{featureId:e.entitlementFeatureId,keptConfigurationNotice:x(`entitlementLapsedConfigurationKept`),children:(0,$.jsx)(M0,{target:e.target,resolveSubTabLabel:y,subTabRef:e.ref===i?t:void 0,onSubTabChange:o})}):(0,$.jsx)(M0,{target:e.target,resolveSubTabLabel:y,subTabRef:e.ref===i?t:void 0,onSubTabChange:o})},e.ref))})]})]})})}function gTe({featureId:e,keptConfigurationNotice:t,children:n}){let r=A0(e),i=!r.isAvailable&&r.behavior!==js.HIDE,a=(r.upgradeOptions?.length??0)>0;return i?(0,$.jsxs)(`div`,{className:`space-y-card`,children:[(0,$.jsx)(OD,{variant:`info`,children:(0,$.jsx)(AD,{children:t})}),a&&(0,$.jsx)(j0,{featureId:e,children:null}),n]}):(0,$.jsx)(`div`,{className:`space-y-card`,children:(0,$.jsx)(j0,{featureId:e,children:n})})}function _Te(e){return e.requested===null||e.isMobile?null:e.requested===ql.SECONDARY?e.secondaryShown&&e.secondaryHasContent?ql.SECONDARY:null:e.requested===ql.COMPANION&&e.companionShown&&e.companionHasContent?ql.COMPANION:null}function vTe(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 yTe(e){let{homeCompositeViewRef:t,isAppRootPath:n,primaryStackTop:r}=e;if(n&&t&&!(r&&r.contentType!==Sa.ENGINE_PAGE))return{contentType:Sa.COMPOSITE_VIEW,viewRef:t}}function bTe(e){let{primaryContent:t,compositeViews:n}=e;return t?t.contentType===Sa.COMPOSITE_VIEW?n?.some(e=>e.ref===t.viewRef)??!1:!0:!1}function N0(e){let{primaryContent:t,compositeViews:n,resolveExecutionView:r}=e;if(t){if(t.contentType===Sa.RESOURCE_OPERATION)return t.resourceContext?.operation?.operationFrontendConfig;if(t.contentType===Sa.COMPOSITE_VIEW)return n?.find(e=>e.ref===t.viewRef);if(t.contentType===Sa.EXECUTION_VIEW)return r?.(t.viewRef)}}function P0({zone:e,zones:t,destinationOverride:n}){return e===ql.PRIMARY?mu.COLLAPSE:n??t?.[e]?.onEmpty??mu.COLLAPSE}function F0(e){return e===mu.EMPTY_STATE}function I0(e){return e.hasContent&&!F0(e.behavior)}function xTe(e){return N0(e)?.adjacentZoneOnEmpty}var L0={maxWidth:`content`,fillsHeight:!1};function STe(e){let t=N0(e);return{maxWidth:t?.zoneContentMaxWidth??L0.maxWidth,fillsHeight:t?.zoneContentFillsHeight??L0.fillsHeight}}function R0(e){return{maxWidth:N0({primaryContent:e.zoneContent,compositeViews:e.compositeViews,resolveExecutionView:e.resolveExecutionView})?.zoneContentMaxWidth??L0.maxWidth,fillsHeight:!1}}function CTe(e,t){return e.maxWidth===L0.maxWidth?t:{...t,geometry:{responsiveMaxWidth:e.maxWidth}}}function wTe(e){return e.fillsHeight?`flex h-full min-h-0 flex-col`:void 0}var TTe=Q.lazy(()=>i_(()=>import(`./ChartView-Db94VZQx.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),z0=tl.getLogger(),B0=z0.debugByType(`NavigationContentAreas`);z0.setDebugTypeLogging(`NavigationContentAreas`,!1);var ETe={[Vl.HOME]:HU,[Vl.DECISIONS]:VW},DTe=`no-entry`;function V0(e,t){let n=t||DTe,r=e=>Object.entries(e??{}).map(([e,t])=>`${e}:${t}`).join(`|`);switch(e.contentType){case Sa.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 Sa.COMPOSITE_VIEW:case Sa.CHART_VIEW:case Sa.FULL_CUSTOM_VIEW:case Sa.FLOWS_ACTORS_VIEW:case Sa.EXECUTION_VIEW:return`${e.contentType}-${e.viewRef}-${e.contentType===Sa.CHART_VIEW?e.runtimeDescriptor?.identity.insertedViewRef??``:``}-${r(e.contextResourceIdentifiers)}-${e.contentType===Sa.CHART_VIEW?r(e.urlParamValues):``}-${n}`;case Sa.CUSTOM_COMPONENT:return`${e.contentType}-${e.componentRef}-${r(e.contextResourceIdentifiers)}-${n}`;case Sa.ENGINE_PAGE:return`${e.contentType}-${e.pageRef}-${n}`;case Sa.INLINE_CREATE:return`${e.contentType}-${e.resourceContext.resourceType}-${e.resourceContext.operationIdentifier}-${n}`;case Sa.ERROR_MODAL:return`${e.contentType}-${e.errorType}-${n}`;case Sa.SETTINGS_HUB:return e.contentType;default:return`unknown-${e.contentType}-${n}`}}var OTe=({content:e,entryId:t})=>{let{dropLinkedConversation:n}=OQ();return(0,$.jsx)(EQ,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers,linkedConversationId:e.linkedConversationId,onLinkedConversationSettled:n,linkKey:t})},kTe=({content:e,zone:t,initiator:n,entryId:r})=>{let{dropLinkedConversation:i}=OQ(),a=Q.useMemo(()=>e.linkedConversationId?{conversationId:e.linkedConversationId,onSettled:i,...r?{linkKey:r}:{}}:void 0,[e.linkedConversationId,i,r]);return(0,$.jsx)(IU,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers,navigationZone:t,navigationInitiator:n,linkedConversation:a})},H0=({content:e,zone:t,initiator:n,entryId:r})=>{let{tComponent:i,isReady:a}=q({component:K.HIGH_LEVEL_VIEWS_CHART}),{registry:o}=fm(),s=V0(e,r);if(B0(`Rendering content`,{contentType:e.contentType,zone:t,contentKey:s}),e.contentType===Sa.RESOURCE_OPERATION)return(0,$.jsx)(OY,{resourceContext:e.resourceContext,navigationZone:t,navigationInitiator:n},s);if(e.contentType===Sa.COMPOSITE_VIEW)return e.linkedConversationId?(0,$.jsx)(kTe,{content:e,zone:t,initiator:n,entryId:r},s):(0,$.jsx)(IU,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers,navigationZone:t,navigationInitiator:n},s);if(e.contentType===Sa.CHART_VIEW){if(!a)return null;let t=e.runtimeDescriptor?.chartDefinition.requiredFeatures??e.viewDefinition?.chartDefinition.requiredFeatures??e.requiredFeatures??Mp({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(K.HIGH_LEVEL_VIEWS_CHART,`loading`)})}),children:(0,$.jsx)(Vh,{requiredFeatures:t,children:(0,$.jsx)(TTe,{viewRef:e.viewRef,viewDefinition:e.viewDefinition,contextResourceIdentifiers:e.contextResourceIdentifiers,urlParamValues:e.urlParamValues,runtimeDescriptor:e.runtimeDescriptor})})},s)}if(e.contentType===Sa.FULL_CUSTOM_VIEW)return(0,$.jsx)(UZ,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers,navigationZone:t},s);if(e.contentType===Sa.FLOWS_ACTORS_VIEW)return e.linkedConversationId?(0,$.jsx)(OTe,{content:e,entryId:r},s):(0,$.jsx)(EQ,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers},s);if(e.contentType===Sa.EXECUTION_VIEW)return(0,$.jsx)(LY,{viewRef:e.viewRef,contextResourceIdentifiers:e.contextResourceIdentifiers,navigationZone:t},s);if(e.contentType===Sa.CUSTOM_COMPONENT){let t=Ko.resolve(e.componentRef,H.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)(rl,{componentType:e.componentRef,componentName:e.componentRef})}if(e.contentType===Sa.ENGINE_PAGE){let t=ETe[e.pageRef];return t?(0,$.jsx)(t,{},s):(0,$.jsx)(rl,{componentType:String(e.pageRef),componentName:String(e.pageRef)},s)}if(e.contentType===Sa.SETTINGS_HUB)return(0,$.jsx)(hTe,{sectionRef:e.sectionRef,subTabRef:e.subTabRef},s);if(e.contentType===Sa.INLINE_CREATE){let r={...e.resourceContext,additionalContext:{...e.resourceContext.additionalContext,defaultValuesOverride:e.defaultValues}};return(0,$.jsx)(OY,{resourceContext:r,navigationZone:t,navigationInitiator:n},s)}return e.contentType===Sa.ERROR_MODAL?(0,$.jsx)(sCe,{wildoError:e.wildoError},s):null};function U0(e,t){let n=`${e}-${t.replace(/[^A-Za-z0-9_-]/g,`_`)}`;return{tabId:`nav-zone-tab-${n}`,panelId:`nav-zone-tabpanel-${n}`}}var ATe=({zone:e,entry:t})=>{let{title:n}=H$(t,{keepOperationTitle:!0}),{tabId:r,panelId:i}=U0(e,t.id);return(0,$.jsx)(sO,{value:t.id,id:r,"aria-controls":i,children:n})},jTe=({zone:e,entries:t,activeEntryId:n,onSelect:r})=>(0,$.jsx)(aO,{value:n,onValueChange:t=>r(e,t),"data-zone-tab-bar":e,children:(0,$.jsx)(oO,{children:t.map(t=>(0,$.jsx)(ATe,{zone:e,entry:t},t.id))})}),W0=({zone:e,fallback:t,emptyState:n})=>{let{getTopEntry:r,getZoneState:i,setActiveTab:a}=kx(),{navigationLayout:o}=Ng(),s=oCe(),c=r(e),l=i(e),u=o?.zones?.[e]?.contentModel===Zre.TABBED,d=Uh(l.stack,o?.zones?.[e]?.contentModel,l.activeTabId);B0(`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?(B0(`ZoneContentRenderer → rendering persistent stack`,{zone:e,stackDepth:f.length}),(0,$.jsxs)($.Fragment,{children:[u&&f.length>0&&(0,$.jsx)(jTe,{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}=U0(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)(Jy,{})}):(0,$.jsx)(H0,{content:t.content,zone:t.zone,initiator:t.initiator,entryId:t.id})},V0(t.content,t.id))})]})):t?(B0(`ZoneContentRenderer → rendering fallback (routerChildren / Outlet)`,{zone:e}),(0,$.jsx)($.Fragment,{children:t})):n?(B0(`ZoneContentRenderer → rendering empty state (onEmpty: EMPTY_STATE)`,{zone:e}),(0,$.jsx)($.Fragment,{children:n})):(B0(`ZoneContentRenderer → rendering null (no entry, no fallback)`,{zone:e}),null)};function G0(e){return e===Ui.HORIZONTAL?Ui.VERTICAL:Ui.HORIZONTAL}var MTe=1280,K0=25,q0=K0;function J0(e,t){return Math.round(Math.max(5,Math.min(70,e/t*100)))}function NTe(e){let[t,n]=(0,Q.useState)(MTe);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 Y0(e,t,n){return Math.min(Math.max(e,Math.min(t,n)),n)}function X0(e){if(!e.isResizable)return{minSize:e.defaultSize,maxSize:e.defaultSize};let t=e.maxWidthPx?J0(e.maxWidthPx,e.containerWidth):75,n=e.minWidthPx?J0(e.minWidthPx,e.containerWidth):Math.min(q0,e.defaultSize);return{minSize:Math.min(n,t),maxSize:t}}var Z0=1e-9;function PTe(e,t){let n=e.map(e=>e.defaultSize),r=e.map(e=>e.frozen?1/0:Math.floor(e.maxSize+Z0)),i=e.map((e,t)=>Math.min(Math.ceil((e.frozen?Math.min(q0,e.defaultSize):e.minSize)-Z0),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]-Z0?[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+Z0)),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 Q0;(function(e){e.SINGLE_ZONE=`single-zone`,e.MULTI_ZONE_STATIC=`multi-zone-static`,e.MULTI_ZONE_RESIZABLE=`multi-zone-resizable`})(Q0||={});function $0(e){return!e.hasSecondaryZone&&!e.hasCompanionZone?Q0.SINGLE_ZONE:e.hasSecondaryZone&&e.split?.resizable||e.hasCompanionZone&&e.split?.companion?.resizable?Q0.MULTI_ZONE_RESIZABLE:Q0.MULTI_ZONE_STATIC}function e2(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 t2(e){return{primary:e.showSecondary||e.showCompanion,secondary:e.showSecondary&&e.showCompanion}}function n2(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}=X0({isResizable:r,defaultSize:s,minWidthPx:c,maxWidthPx:n?.maxWidth,containerWidth:i}),d=Y0(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}=X0({isResizable:o,defaultSize:c,minWidthPx:l,maxWidthPx:n?.maxWidth,containerWidth:i}),f=Y0(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&&PTe(c,75),{primaryDefault:100-c.reduce((e,t)=>e+t.defaultSize,0),secondary:o,companion:s}}var FTe={...HE,geometry:{responsiveMaxWidth:`content`},containment:{gap:`none`}};function r2({children:e,geometry:t}){return(0,$.jsx)(hD,{variant:V.SHELL,emitPolicyVars:!0,policyOverride:CTe(t,FTe),className:G(`bg-transparent text-inherit`,wTe(t)),children:e})}var ITe=()=>{let{tComponent:e,isReady:t}=q({component:K.APP_LAYOUTS_MAIN_CONTAINER}),n=t?yp({tComponent:e,componentType:K.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})})},i2=`pointer-events-auto bg-surface-raised/80 backdrop-blur-sm`,a2=({emphasized:e,onToggle:t,floating:n=!0})=>{let{tComponent:r,isReady:i}=q({component:K.APP_LAYOUTS_MAIN_CONTAINER}),{renderIcon:a}=ef(),o=i?yp({tComponent:r,componentType:K.APP_LAYOUTS_MAIN_CONTAINER,key:e?`zoneRestore`:`zoneExpand`}):``;return(0,$.jsx)(Y,{type:`button`,size:df.ICON_SM,variant:X.GHOST,className:n?i2: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?W.MINIMIZE:W.MAXIMIZE,{size:tr.SM})})},o2=({onDismiss:e,floating:t=!0})=>{let{tComponent:n,isReady:r}=q({component:K.APP_LAYOUTS_MAIN_CONTAINER}),{renderIcon:i}=ef(),a=r?yp({tComponent:n,componentType:K.APP_LAYOUTS_MAIN_CONTAINER,key:`zoneDismiss`}):``;return(0,$.jsx)(Y,{type:`button`,size:df.ICON_SM,variant:X.GHOST,className:t?i2:void 0,"aria-label":a||void 0,title:a||void 0,"data-zone-dismiss":`true`,onClick:e,children:i(W.CLOSE,{size:tr.SM})})};function LTe(){let{tComponent:e,isReady:t}=q({component:K.APP_LAYOUTS_MAIN_CONTAINER}),n=(0,Q.useCallback)(n=>t&&yp({tComponent:e,componentType:K.APP_LAYOUTS_MAIN_CONTAINER,key:n})||void 0,[e,t]);return{regionProps:(0,Q.useCallback)(e=>({role:`region`,"aria-label":n(RTe[e])}),[n]),resizeHandleLabel:n(`zoneResizeHandle`)}}var RTe={[ql.PRIMARY]:`zoneRegionPrimary`,[ql.SECONDARY]:`zoneRegionSecondary`,[ql.COMPANION]:`zoneRegionCompanion`},zTe=({emphasized:e,onToggleEmphasis:t,onDismiss:n})=>(0,$.jsxs)(WB,{children:[(0,$.jsx)(a2,{emphasized:e,onToggle:t}),n&&(0,$.jsx)(o2,{onDismiss:n})]}),s2=({zone:e,emphasized:t,onToggleEmphasis:n,onDismiss:r,children:i})=>(0,$.jsxs)(BB,{zone:e,controls:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(a2,{emphasized:t,onToggle:n,floating:!1}),r&&(0,$.jsx)(o2,{onDismiss:r,floating:!1})]}),children:[(0,$.jsx)(zTe,{emphasized:t,onToggleEmphasis:n,onDismiss:r}),i]}),c2=({routerChildren:e})=>{lxe(),sxe(),cxe();let{isZoneVisible:t,getZoneDepth:n,getTopContent:r,setFocusedZone:i,emphasizedZone:a,setEmphasizedZone:o,reconcileCollapsedZones:s,state:c}=kx(),{dismissZone:l}=yS(),{setContentAreaWidth:u}=kx(),{regionProps:d,resizeHandleLabel:f}=LTe(),{navigationLayout:p,UIConfig:m,shellAppearance:h,compositeViews:g,homeDefinition:_}=Ng(),v=rg(),{registry:y}=fm(),b=(0,Q.useCallback)(e=>Dp({viewRef:e,registry:y}),[y]),x=(0,Q.useRef)(null),S=NTe(x);(0,Q.useEffect)(()=>{u(S>0?S:void 0)},[S,u]);let C=m?.currentBreakpoint===Yo.MOBILE,w=p?.zones,T=p?.split,E=h===zc.CONTINUOUS?`bg-transparent text-foreground`:`bg-surface-raised text-surface-raised-foreground`,D=!!w?.secondary,O=!!w?.companion,k=t(ql.SECONDARY)||n(ql.SECONDARY)>0,A=t(ql.COMPANION)||n(ql.COMPANION)>0,j=r(ql.PRIMARY),M=yTe({homeCompositeViewRef:_?.compositeViewReference,isAppRootPath:v.pathname===`/`,primaryStackTop:j})??j,N=(0,Q.useMemo)(()=>xTe({primaryContent:M,compositeViews:g,resolveExecutionView:b}),[M,g,b]),P=(0,Q.useMemo)(()=>STe({primaryContent:M,compositeViews:g,resolveExecutionView:b}),[M,g,b]),F=(0,Q.useMemo)(()=>R0({zoneContent:r(ql.SECONDARY),compositeViews:g,resolveExecutionView:b}),[r,g,b]),I=(0,Q.useMemo)(()=>R0({zoneContent:r(ql.COMPANION),compositeViews:g,resolveExecutionView:b}),[r,g,b]),L=P0({zone:ql.SECONDARY,zones:w,destinationOverride:N}),R=P0({zone:ql.COMPANION,zones:w,destinationOverride:N}),z=(0,$.jsx)(ITe,{}),B=(0,Q.useMemo)(()=>bTe({primaryContent:M,compositeViews:g}),[M,g]),ee=wh({zoneConfig:w?.secondary,viewport:m?.currentBreakpoint,contentAreaWidth:S}),te=wh({zoneConfig:w?.companion,viewport:m?.currentBreakpoint,contentAreaWidth:S});aCe({zones:w,viewport:m?.currentBreakpoint,contentAreaWidth:S,reconcileCollapsedZones:s,navigationState:c});let ne=!ee&&D&&(k||B&&F0(L)),re=!te&&O&&(A||B&&F0(R)),ie=$0({hasSecondaryZone:D,hasCompanionZone:O,split:T}),ae=(0,Q.useCallback)(()=>i(ql.PRIMARY),[i]),oe=(0,Q.useCallback)(()=>i(ql.SECONDARY),[i]),se=(0,Q.useCallback)(()=>i(ql.COMPANION),[i]),ce=_Te({requested:a,isMobile:C,secondaryShown:ne,companionShown:re,secondaryHasContent:k,companionHasContent:A}),le=n(Gn.OVERLAY)>0;(0,Q.useEffect)(()=>{if(ce===null)return;let e=e=>{vTe({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===ql.SECONDARY?null:ql.SECONDARY),[ce,o]),de=(0,Q.useCallback)(()=>o(ce===ql.COMPANION?null:ql.COMPANION),[ce,o]),fe=(0,Q.useCallback)(()=>{o(null),l(ql.SECONDARY)},[l,o]),pe=(0,Q.useCallback)(()=>{o(null),l(ql.COMPANION)},[l,o]),me=I0({hasContent:k,behavior:L}),he=I0({hasContent:A,behavior:R}),ge=ce!==null,_e=ce!==null&&ce!==ql.SECONDARY,ve=ce!==null&&ce!==ql.COMPANION,ye=(0,Q.useMemo)(()=>w?n2(w,T,ne,re,S):null,[w,T,ne,re,S]);if(ie===Q0.SINGLE_ZONE)return(0,$.jsx)(hD,{asChild:!0,emitPolicyVars:!1,variant:V.SHELL,policyOverride:HE,children:(0,$.jsx)(`div`,{ref:x,className:`h-full overflow-auto p-container ${E}`,"data-content-area":`primary`,onPointerDown:ae,onFocus:ae,...d(ql.PRIMARY),children:(0,$.jsx)(r2,{geometry:P,children:(0,$.jsx)(W0,{zone:ql.PRIMARY,fallback:e})})})});if(ie===Q0.MULTI_ZONE_RESIZABLE&&ye){let t=G0(T?.orientation);return(0,$.jsx)(hD,{asChild:!0,emitPolicyVars:!1,variant:V.SHELL,policyOverride:HE,children:(0,$.jsx)(`div`,{ref:x,className:`h-full ${E}`,children:(0,$.jsxs)(W$,{direction:t,autoSaveId:`nav-zones`,className:`h-full`,children:[(0,$.jsx)(G$,{defaultSize:ye.primaryDefault,minSize:K0,id:`nav-primary`,order:1,className:G(`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(ql.PRIMARY),children:(0,$.jsx)(r2,{geometry:P,children:(0,$.jsx)(W0,{zone:ql.PRIMARY,fallback:e})})})}),ne&&ye.secondary&&(0,$.jsxs)($.Fragment,{children:[ce===null&&(0,$.jsx)(K$,{withHandle:!0,disabled:ye.secondary.frozen,"aria-label":f}),(0,$.jsx)(G$,{defaultSize:ye.secondary.defaultSize,minSize:ye.secondary.minSize,maxSize:ye.secondary.maxSize,id:`nav-secondary`,order:2,className:G(`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===ql.SECONDARY||void 0,onPointerDown:oe,onFocus:oe,...d(ql.SECONDARY),children:(0,$.jsx)(s2,{zone:ql.SECONDARY,emphasized:ce===ql.SECONDARY,onToggleEmphasis:ue,onDismiss:me?fe:void 0,children:(0,$.jsx)(r2,{geometry:F,children:(0,$.jsx)(W0,{zone:ql.SECONDARY,emptyState:z})})})})})]}),re&&ye.companion&&(0,$.jsxs)($.Fragment,{children:[ce===null&&(0,$.jsx)(K$,{withHandle:!0,disabled:ye.companion.frozen,"aria-label":f}),(0,$.jsx)(G$,{defaultSize:ye.companion.defaultSize,minSize:ye.companion.minSize,maxSize:ye.companion.maxSize,id:`nav-companion`,order:3,className:G(`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===ql.COMPANION||void 0,onPointerDown:se,onFocus:se,...d(ql.COMPANION),children:(0,$.jsx)(s2,{zone:ql.COMPANION,emphasized:ce===ql.COMPANION,onToggleEmphasis:de,onDismiss:he?pe:void 0,children:(0,$.jsx)(r2,{geometry:I,children:(0,$.jsx)(W0,{zone:ql.COMPANION,emptyState:z})})})})})]})]})})})}let be=G0(T?.orientation)===Ui.VERTICAL,xe=e2({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=t2({showSecondary:ne,showCompanion:re});return(0,$.jsx)(hD,{asChild:!0,emitPolicyVars:!1,variant:V.SHELL,policyOverride:HE,children:(0,$.jsxs)(`div`,{ref:x,className:G(`h-full flex`,be?`flex-col`:`flex-row`,E),children:[(0,$.jsx)(`div`,{className:G(`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(ql.PRIMARY),children:(0,$.jsx)(r2,{geometry:P,children:(0,$.jsx)(W0,{zone:ql.PRIMARY,fallback:e})})}),ne&&(0,$.jsx)(`div`,{className:G(`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===ql.SECONDARY),"data-content-area":`secondary`,"data-zone-hidden":_e||void 0,"data-zone-emphasized":ce===ql.SECONDARY||void 0,onPointerDown:oe,onFocus:oe,...d(ql.SECONDARY),children:(0,$.jsx)(s2,{zone:ql.SECONDARY,emphasized:ce===ql.SECONDARY,onToggleEmphasis:ue,onDismiss:me?fe:void 0,children:(0,$.jsx)(r2,{geometry:F,children:(0,$.jsx)(W0,{zone:ql.SECONDARY,emptyState:z})})})}),re&&(0,$.jsx)(`div`,{className:G(`h-full overflow-auto p-container`,ve&&`hidden`),style:Se(xe.companion,ce===ql.COMPANION),"data-content-area":`companion`,"data-zone-hidden":ve||void 0,"data-zone-emphasized":ce===ql.COMPANION||void 0,onPointerDown:se,onFocus:se,...d(ql.COMPANION),children:(0,$.jsx)(s2,{zone:ql.COMPANION,emphasized:ce===ql.COMPANION,onToggleEmphasis:de,onDismiss:he?pe:void 0,children:(0,$.jsx)(r2,{geometry:I,children:(0,$.jsx)(W0,{zone:ql.COMPANION,emptyState:z})})})})]})})},BTe=()=>{let{state:e,getZoneState:t}=kx(),{closeOverlay:n}=yS(),r=ah(),i=e.overlay,a=i.length>0?i[i.length-1]:void 0,o=i.length>0,s=g1(a?.appearance??Qo.DIALOG),{title:c}=H$(a),l=(0,Q.useCallback)(i=>{if(!i){if(a?.content.contentType===Sa.SETTINGS_HUB){let n=e.zones[ql.PRIMARY]?.stack??[],i=e.zones[ql.SECONDARY]?.stack??[],a=i[i.length-1],o=n[n.length-1]?.urlPath,s=(a?.hostedPane&&o?Hm.resolveBrowserUrlForZoneEntry({zone:ql.SECONDARY,entryUrlPath:a.urlPath,paneContent:a.content,currentBrowserUrl:o,getZoneState:t}):o)??za.home;r(s,{replace:!0})}else n()}},[n,r,a,e.zones,t]),u=D$(),{registry:d}=fm(),f=(0,Q.useCallback)(e=>d.resourceConfigurations[e]?.frontendConfiguration?.layout?.defaultDisplaySectionAppearance,[d]),p=a?.content.contentType===Sa.SETTINGS_HUB?SCe(kCe(u.sections,a.content.sectionRef??u.defaultSectionRef,f)):CCe(s);return(0,$.jsx)(f1,{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:hu.END},className:p,children:a&&(0,$.jsx)(H0,{content:a.content,zone:Gn.OVERLAY,initiator:a.initiator,entryId:a.id})})},l2=()=>(0,$.jsx)(BTe,{});function u2(e){return typeof e==`object`&&!!e&&`placement`in e&&`collapsible`in e}function d2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f2(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e,n=t.position===void 0||t.position===Cs.START||t.position===Cs.END,r=t.items===void 0||Array.isArray(t.items);return n&&r}var p2;(function(e){e.ENUM=`enum`,e.RESOURCE_REFERENCE=`resource_reference`,e.RAW=`raw`})(p2||={});var m2;(function(e){e.STATIC=`static`,e.LINK=`link`,e.BUTTON=`button`})(m2||={});var h2;(function(e){e.BUTTON=`button`,e.TOGGLE=`toggle`,e.SLIDER=`slider`,e.SELECT=`select`})(h2||={});var g2;(function(e){e.COMMANDS=`commands`,e.RECORDS=`records`})(g2||={});function _2(e){switch(e){case Ol.COMMAND_MENU:return K.APPLICATION_LEVEL_COMMAND_MENU;case Ol.QUICK_ACTION_BUTTON:return K.APPLICATION_LEVEL_QUICK_ACTION_BUTTON;case Ol.NOTIFICATION_CENTER:return K.APPLICATION_LEVEL_NOTIFICATION_CENTER;case Ol.USER_DROPDOWN:return K.APPLICATION_LEVEL_USER_DROPDOWN;case Ol.CONTROL_PANEL:return K.APPLICATION_LEVEL_CONTROL_PANEL;case Ol.QUICK_SWITCHER:return K.APPLICATION_LEVEL_QUICK_SWITCHER;case Ol.NAVIGATION_CONTROL:return K.APPLICATION_LEVEL_NAVIGATION_BACK;case Ol.UTILITY_PANEL:return K.APPLICATION_LEVEL_UTILITY_PANEL;default:return null}}function v2(e,t){if(e.startsWith(`data:`)||e.startsWith(`blob:`))return!0;try{return new URL(e,t).origin===t}catch{return!1}}function y2(e){let{httpClient:t}=Su(),n=e!==void 0&&v2(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 b2(e={}){let{composition:t=Ra.SYMBOL,purpose:n=Ree.PRIMARY,theme:r,includeOrganizationBrand:i=!0}=e,{appConfig:a}=Su(),{isDark:o,shellIdentity:c,organizationLogoUrl:l,organizationProductName:u}=Ng(),d=c?c.brandAssets:a.brandAssets,f=c?c.name:a.appIdentity?zu(a.appIdentity):``,p=(0,Q.useMemo)(()=>{if(d?.length)return nu(d,{composition:t,theme:r??(o?s.DARK:s.LIGHT),purpose:n})},[d,t,n,r,o]),m=i&&!c,h=y2(m?l:void 0),g=m&&u||f;return m&&l?{name:g,logoUrl:h,logoComposition:void 0,markIsSingleColourOnDarkUi:!1}:{name:g,logoUrl:p?.url,logoComposition:p?.composition,markIsSingleColourOnDarkUi:p?.theme===s.MONOCHROME&&o}}function x2(e){let t=e?.logoUrl,n=e?.name??``,[r,i]=(0,Q.useState)(void 0);r!==void 0&&r!==t&&i(void 0);let a=r!==void 0&&r===t,o=(0,Q.useCallback)(()=>i(t),[t]),s=!!t&&!a,c=s&&e?.logoComposition!==void 0&&e.logoComposition!==Ra.SYMBOL;return{name:n,logoUrl:s?t:void 0,hasMark:s,markCarriesName:c,drawMarkLight:s&&e?.markIsSingleColourOnDarkUi===!0,isEmpty:!s&&n.length===0,onMarkError:o}}function S2(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===Ol.NAVIGATION_CONTROL&&!nc(a?.backAffordanceOwner))continue;let l=_2(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 C2(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)=>S2(i,r(i),t,n,a).some(t=>t.component===e);return!!t?.[Ol.MENUBAR]&&i(Ol.MENUBAR,Cs.START)||!!t?.[Ol.SIDEBAR]&&i(Ol.SIDEBAR,No.TOP)}var w2=new Set;function T2(e){let t=typeof e==`string`?e:d2(e)?e.placement:void 0;if(t===void 0)return No.BOTTOM;if(al(t))return t;let n=String(t);return w2.has(n)||(w2.add(n),tl.getLogger().warn(`[app-shell] the status bar is configured at '${n}', which no shell layout places (only '${No.TOP}' and '${No.BOTTOM}'); it is shown at '${No.BOTTOM}'.`)),No.BOTTOM}function E2(){let{UIConfig:e,navigationLayout:t,appComponentsConfiguration:n}=Ng(),{markComponentInitialized:r}=Su(),i=!!(t&&n);return(0,Q.useEffect)(()=>{i&&r(Ie.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:Cs.START,statusBarPlacement:No.BOTTOM,utilityPanelPlacement:Cs.END,isLayoutReady:!1};let r=n[Ol.SIDEBAR],a=n[Ol.STATUS_BAR],o=n[Ol.UTILITY_PANEL],s=u2(r)?r.placement:Cs.START;return{hasMenubar:!!n[Ol.MENUBAR],hasSidebar:!!r,hasStatusBar:!!a,hasToolbar:!!n[Ol.TOOLBAR],hasActivityBar:!!n[Ol.ACTIVITY_BAR],hasQuickActionButton:!!n[Ol.QUICK_ACTION_BUTTON],hasUtilityPanel:!!o,quickActionButtonHostedInChrome:C2(Ol.QUICK_ACTION_BUTTON,n,e?.currentBreakpoint),utilityPanelHostedInChrome:C2(Ol.UTILITY_PANEL,n,e?.currentBreakpoint),sidebarPlacement:s,statusBarPlacement:T2(a),utilityPanelPlacement:f2(o)?o.position??Cs.END:Cs.END,isLayoutReady:!0}},[i,t,n,e?.currentBreakpoint])}function VTe(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 D2(e=!1,t){let{markComponentInitialized:n,frontendConfiguration:r}=Su();(0,Q.useEffect)(()=>{n(Ie.PUBLIC_APP_CONTAINER)},[n]);let i=b2({includeOrganizationBrand:!1}),{shellIdentity:a}=Ng(),o=e&&!a?t:void 0,s=y2(o?.logoUrl||void 0),c=y2(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===im.BRAND_HEADER?l:void 0;return VTe(c),{useCardLayout:e,isReady:!0,brandHeader:u,brandAccentColor:u?o?.primaryColor:void 0}}var HTe=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function O2(e){return!e||typeof document>`u`?null:document.getElementById(e)}var k2=(0,Q.createContext)(null);function A2(){return(0,Q.useContext)(k2)??void 0}function j2(e,t){let n=A2(),{getSurfacePolicy:r}=Ng(),i=r?.(e,t)?.stacking?.portalTarget,a=typeof i==`string`&&i!==`inline`&&i!==`app-portal`&&i!==`reset`?i:null,[o,s]=(0,Q.useState)(()=>O2(a));return HTe(()=>{if(!a||typeof document>`u`){s(null);return}let e=O2(a);if(s(e),e||typeof MutationObserver>`u`)return;let t=new MutationObserver(()=>{let e=O2(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 M2(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 N2(e,t){let{getSurfacePolicy:n}=Ng(),r=n?.(e,t)?.stacking?.stackingTier;return M2(r)}function P2({preset:e=H.DEFAULT,...t}){let n=qc(K.APPLICATION_LEVEL_ACTIVITY_BAR,`ApplicationLevel_ActivityBar`)(e);return(0,$.jsx)(n,{...t})}function F2({preset:e=H.DEFAULT,...t}){let n=qc(K.APPLICATION_LEVEL_MENUBAR,`ApplicationLevel_MenuBar`)(e);return(0,$.jsx)(n,{...t})}function I2({preset:e=H.DEFAULT,...t}){let n=qc(K.APPLICATION_LEVEL_QUICK_ACTION_BUTTON,`ApplicationLevel_QuickActionButton`)(e);return(0,$.jsx)(n,{...t})}function L2({preset:e=H.DEFAULT,...t}){let n=qc(K.APPLICATION_LEVEL_SIDEBAR,`ApplicationLevel_Sidebar`)(e);return(0,$.jsx)(n,{...t})}function R2({preset:e=H.DEFAULT,...t}){let n=qc(K.APPLICATION_LEVEL_STATUS_BAR,`ApplicationLevel_StatusBar`)(e);return(0,$.jsx)(n,{...t})}function z2({preset:e=H.DEFAULT,...t}){let n=qc(K.APPLICATION_LEVEL_TOOLBAR,`ApplicationLevel_Toolbar`)(e);return(0,$.jsx)(n,{...t})}function B2({preset:e=H.DEFAULT,...t}){let n=qc(K.APPLICATION_LEVEL_UTILITY_PANEL,`ApplicationLevel_UtilityPanel`)(e);return(0,$.jsx)(n,{...t})}var V2=(0,Q.createContext)({getHostedComponentProps:()=>({})});function H2(){return(0,Q.useContext)(V2)}function U2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function UTe(e){return U2(e)}var WTe=new Set([Ol.COMMAND_MENU,Ol.NOTIFICATION_CENTER,Ol.QUICK_SWITCHER]);function W2({children:e}){let{appComponentsConfiguration:t,UIConfig:n,navigationLayout:r}=Ng(),i=n?.currentBreakpoint,{on:a,emit:o}=Uo(),{register:s}=w$(),{t:c}=q(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(0),h=t?.[Ol.MENUBAR],g=t?.[Ol.SIDEBAR],_=(0,Q.useMemo)(()=>{let e=t,n=U2(h)?S2(Ol.MENUBAR,h.hostedComponents,e,i,Cs.START,r):[],a=U2(g)?S2(Ol.SIDEBAR,g.hostedComponents,e,i,No.TOP,r):[];return[...n,...a]},[t,h,g,i,r]),v=(0,Q.useMemo)(()=>new Set(_.map(e=>e.component)),[_]),b=(0,Q.useMemo)(()=>{let e=new Map;for(let t of _)WTe.has(t.component)&&(e.has(t.component)||e.set(t.component,t.instanceId));return e},[_]),x=e=>v.has(e),S=t?.[Ol.COMMAND_MENU],C=UTe(S)?S.openShortcut:void 0;(0,Q.useEffect)(()=>{if(x(Ol.COMMAND_MENU))return a(hc.HOTKEY_COMMAND_MENU_OPEN,()=>{u(e=>!e)})},[a,v]),(0,Q.useEffect)(()=>{if(x(Ol.NOTIFICATION_CENTER))return a(hc.HOTKEY_NOTIFICATIONS_OPEN,()=>{f(e=>!e)})},[a,v]),(0,Q.useEffect)(()=>{if(x(Ol.QUICK_SWITCHER))return a(hc.HOTKEY_QUICK_SWITCHER_OPEN,()=>{m(e=>e+1)})},[a,v]),(0,Q.useEffect)(()=>{if(x(Ol.COMMAND_MENU)&&C&&S!==!1)return s({id:`shell-hosted-command-menu-open-shortcut`,shortcut:C,description:c(`engine.hotkeys.commandMenuOpen`),scope:y.GLOBAL,group:_i.NAVIGATION,launcher:Ol.COMMAND_MENU,preventDefault:!0,handler:()=>{o(hc.HOTKEY_COMMAND_MENU_OPEN,{})}})},[S,C,o,s,c,v]);let w=(0,Q.useMemo)(()=>({getHostedComponentProps:(e,t)=>{let n=b.get(e)===t;switch(e){case Ol.COMMAND_MENU:return{listenForHotkeys:!1,isOpen:l,onOpenChange:u,renderDialog:n};case Ol.NOTIFICATION_CENTER:return{listenForHotkeys:!1,...n?{isOpen:d,onOpenChange:f}:{}};case Ol.QUICK_SWITCHER:return{focusTrigger:n?p:0};default:return{}}}}),[b,l,d,p]);return(0,$.jsx)(V2.Provider,{value:w,children:e})}var G2=({element:e,flowRef:t,state:n,onComplete:r,onDismiss:i,t:a,children:o})=>{let{tComponent:s,isReady:c}=q({component:K.GUIDANCE_CHECKLIST}),{renderIcon:l}=ef(),{flowStates:u}=dU(),[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===Ti.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(K.GUIDANCE_CHECKLIST,`headerTitle`),C=s(K.GUIDANCE_CHECKLIST,`progress`,{completed:h,total:g}),w=d?s(K.GUIDANCE_CHECKLIST,`expand`):s(K.GUIDANCE_CHECKLIST,`collapse`),T=s(K.GUIDANCE_CHECKLIST,`dismiss`);return(0,$.jsxs)(wF,{className:`w-80 max-w-[calc(100vw-3rem)] overflow-hidden`,role:`region`,"aria-label":S||b,children:[(0,$.jsxs)(EF,{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)(Y,{variant:X.GHOST,size:df.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)(Y,{variant:X.GHOST,size:df.ICON_SM,onClick:y,"aria-label":T,children:l(W.CLOSE,{size:tr.SM})})]}),p.showProgress&&(0,$.jsxs)(`div`,{className:`px-4 pb-2 flex items-center gap-2.5`,children:[(0,$.jsx)(h_,{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)(jF,{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})]})]})},K2=({element:e,flowRef:t,state:n,onComplete:r,onAction:i,t:a})=>{let{tComponent:o,isReady:s}=q({component:K.GUIDANCE_CHECKLIST_ITEM}),c=e,l=n?.status===Ti.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)(SI,{name:`__display`,schema:Md(),checked:l,onCheckedChange:u,disabled:l,"aria-label":l?o(K.GUIDANCE_CHECKLIST_ITEM,`completed`):o(K.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)(Y,{variant:X.OUTLINE,size:df.SM,onClick:d,className:`shrink-0`,children:p})]})},q2=({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}=q({component:K.GUIDANCE_TOUR,keys:o}),{getRecipe:u}=Ng(),{renderIcon:d}=ef(),f=A2(),p=e,m=u(It.SURFACE,V.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]),qE(b,!0),!l)return null;let k=s(K.GUIDANCE_TOUR,`next`),A=s(K.GUIDANCE_TOUR,`previous`),j=s(K.GUIDANCE_TOUR,`skip`),M=s(K.GUIDANCE_TOUR,`finish`),N=s(K.GUIDANCE_TOUR,`close`),P=s(K.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 L=GTe(S.placement??Oa.BOTTOM,v),R=f??document.body;return SN.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)(hD,{asChild:!0,emitPolicyVars:!1,variant:V.OVERLAY,children:(0,$.jsxs)(`div`,{ref:b,style:L,role:`dialog`,"aria-modal":`true`,tabIndex:-1,"aria-label":F,className:G(`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)(Y,{variant:X.GHOST,size:df.ICON_SM,onClick:O,"aria-label":N,className:`absolute top-2 end-2 z-[calc(var(--z-guidance)+2)]`,children:d(W.CLOSE,{size:tr.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)(Y,{variant:X.GHOST,size:df.SM,onClick:O,children:j}),!T&&(0,$.jsx)(Y,{variant:X.OUTLINE,size:df.SM,onClick:D,children:A}),(0,$.jsx)(Y,{size:df.SM,onClick:E,children:w?M:k})]})]})]})})]}),R)};function GTe(e,t){if(!t)return{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`};switch(e){case Oa.TOP:return{position:`fixed`,bottom:window.innerHeight-t.top+12,left:t.left+t.width/2,transform:`translateX(-50%)`};case Oa.BOTTOM:return{position:`fixed`,top:t.bottom+12,left:t.left+t.width/2,transform:`translateX(-50%)`};case Oa.LEFT:return{position:`fixed`,top:t.top+t.height/2,right:window.innerWidth-t.left+12,transform:`translateY(-50%)`};case Oa.RIGHT:return{position:`fixed`,top:t.top+t.height/2,left:t.right+12,transform:`translateY(-50%)`};case Oa.CENTER:default:return{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`}}}var J2=({element:e,flowRef:t,state:n,onComplete:r,onDismiss:i,t:a})=>{let{tComponent:o,isReady:s}=q({component:K.GUIDANCE_TOOLTIP}),{getRecipe:c}=Ng(),l=A2(),u=e,[d,f]=(0,Q.useState)(null),p=(0,Q.useRef)(!1),m=(0,Q.useRef)(null),h=c(It.SURFACE,V.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!==Ti.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(K.GUIDANCE_TOOLTIP,`dismiss`),S=o(K.GUIDANCE_TOOLTIP,`gotIt`),C=KTe(u.placement??Oa.BOTTOM,d);return SN.createPortal((0,$.jsx)(hD,{asChild:!0,emitPolicyVars:!1,variant:V.RAISED,children:(0,$.jsxs)(`div`,{style:C,role:`dialog`,"aria-label":y||b||void 0,"data-guidance-tooltip":u.ref,className:G(`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)(Y,{variant:X.GHOST,size:df.SM,onClick:g,children:x}),(0,$.jsx)(Y,{size:df.SM,onClick:_,children:S})]})]})}),v)};function KTe(e,t){switch(e){case Oa.TOP:return{position:`fixed`,bottom:window.innerHeight-t.top+10,left:t.left+t.width/2,transform:`translateX(-50%)`};case Oa.BOTTOM:return{position:`fixed`,top:t.bottom+10,left:t.left+t.width/2,transform:`translateX(-50%)`};case Oa.LEFT:return{position:`fixed`,top:t.top+t.height/2,right:window.innerWidth-t.left+10,transform:`translateY(-50%)`};case Oa.RIGHT:return{position:`fixed`,top:t.top+t.height/2,left:t.right+10,transform:`translateY(-50%)`};case Oa.CENTER:default:return{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`}}}var Y2=({element:e,t,onAction:n,onDismiss:r,onComplete:i})=>{let{tComponent:a,isReady:o}=q({component:K.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(K.GUIDANCE_MODAL,`defaultTitle`);return(0,$.jsx)(qW,{open:!0,onOpenChange:m,children:(0,$.jsxs)(YW,{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)(ZW,{children:[(0,$.jsx)($W,{className:h?void 0:`sr-only`,children:y}),g&&(0,$.jsx)(eG,{children:g})]}):(0,$.jsx)($W,{className:`sr-only`,children:y}),_&&(0,$.jsx)(`div`,{className:`text-sm text-foreground/80 leading-relaxed`,children:_}),(0,$.jsxs)(QW,{children:[l&&(0,$.jsx)(Y,{variant:X.OUTLINE,size:df.SM,onClick:p,children:a(K.GUIDANCE_MODAL,`dismiss`)}),v&&(0,$.jsx)(Y,{size:df.SM,onClick:f,children:v})]})]})})},qTe={[an.INFO]:`info`,[an.SUCCESS]:`success`,[an.WARNING]:`warning`,[an.ERROR]:`destructive`},X2=({element:e,t,onAction:n,onDismiss:r})=>{let{tComponent:i,isReady:a}=q({component:K.GUIDANCE_BANNER}),{renderIcon:o}=ef(),s=e,c=s.variant??an.INFO,l=s.position??Ct.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===Ct.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)(OD,{variant:qTe[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)(kD,{children:p}),m&&(0,$.jsx)(AD,{children:m})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[h&&d&&(0,$.jsx)(Y,{size:df.SM,onClick:()=>n(d),children:h}),u&&(0,$.jsx)(Y,{variant:X.GHOST,size:df.ICON_SM,onClick:f,"aria-label":i(K.GUIDANCE_BANNER,`ariaClose`),title:i(K.GUIDANCE_BANNER,`dismiss`),children:o(W.CLOSE,{size:tr.SM})})]})]})})},JTe={[an.INFO]:`info`,[an.SUCCESS]:`success`,[an.WARNING]:`warning`,[an.ERROR]:`destructive`},Z2=({element:e,t,onAction:n,onDismiss:r})=>{let{tComponent:i,isReady:a}=q({component:K.GUIDANCE_ANNOUNCEMENT}),{renderIcon:o}=ef(),s=(0,Q.useCallback)(()=>{r(e.ref)},[r,e.ref]);if(!a)return null;let c=e,l=c.variant??an.INFO,u=c.dismissible??!0,d=t(`title`),f=t(`content`),p=t(`actionLabel`),m=c.actionRef,h=c.icon;return(0,$.jsxs)(OD,{variant:JTe[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)(kD,{children:d}),f&&(0,$.jsx)(AD,{children:f}),p&&m&&(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(Y,{size:df.SM,onClick:()=>n(m),children:p})})]}),u&&(0,$.jsx)(Y,{variant:X.GHOST,size:df.ICON_SM,onClick:s,"aria-label":i(K.GUIDANCE_ANNOUNCEMENT,`dismiss`),className:`absolute top-2 end-2`,children:o(W.CLOSE,{size:tr.SM})})]})},YTe={[ei.DEFAULT]:Il.NEUTRAL,[ei.PRIMARY]:Il.INFO,[ei.SECONDARY]:Il.NEUTRAL,[ei.SUCCESS]:Il.SUCCESS,[ei.WARNING]:Il.WARNING,[ei.ERROR]:Il.ERROR},Q2=({element:e,t})=>{let n=e,r=n.variant??ei.DEFAULT,i=n.unlocked??!1,a=t(`title`),o=t(`content`),s=n.icon;return(0,$.jsxs)(Jd,{variant:Bg(YTe[r]),className:i?``:`opacity-[var(--opacity-disabled)]`,children:[s&&(0,$.jsx)(`span`,{className:`text-xs leading-none`,"aria-hidden":`true`,children:s}),a||o]})},$2=({element:e,t,onAction:n,onDismiss:r})=>{let{tComponent:i,isReady:a}=q({component:K.GUIDANCE_CARD}),{renderIcon:o}=ef(),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)(wF,{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)(EF,{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)(jF,{children:(0,$.jsx)(`div`,{className:`text-sm text-foreground/80 leading-relaxed`,children:h})}),g&&l&&(0,$.jsx)(DF,{children:(0,$.jsx)(Y,{size:df.SM,onClick:()=>n(l),children:g})}),c&&(0,$.jsx)(Y,{variant:X.GHOST,size:df.ICON_SM,onClick:f,"aria-label":i(K.GUIDANCE_CARD,`dismiss`),className:`absolute top-2 end-2`,children:o(W.CLOSE,{size:tr.SM})})]})},XTe=md(),e4=({element:e,flowRef:t,t:n,onComplete:r})=>{let i=Q.useMemo(()=>t?[`guidance.${t}`]:[],[t]),{tComponent:a,tGuidanceSurveyQuestion:o,isReady:s}=q({component:K.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 sd.TEXT:return(0,$.jsx)(XM,{value:t??``,onChange:t=>T(e.id,t.target.value)});case sd.TEXTAREA:return(0,$.jsx)(kI,{value:t??``,onChange:t=>T(e.id,t.target.value),rows:3});case sd.RADIO:case sd.SINGLE_CHOICE:{let n=(e.options??[]).map(t=>({value:t.ref,label:w(e,t.ref)}));return(0,$.jsx)(yF,{schema:XTe,name:`survey-${e.id}`,value:t??``,onValueChange:t=>T(e.id,t),options:n,orientation:Ui.VERTICAL})}case sd.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)(SI,{name:`__display`,schema:Md(),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 sd.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)(Y,{variant:X.GHOST,size:df.ICON,onClick:()=>T(e.id,t),"aria-label":a(K.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)(wF,{className:`pointer-events-auto`,children:[(j||M)&&(0,$.jsxs)(EF,{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)(jF,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(h_,{value:N,className:`flex-1`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:a(K.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(K.GUIDANCE_SURVEY,`required`)})]}),A(y,p[y.id]),h[y.id]&&(0,$.jsx)(`span`,{className:`text-xs text-destructive`,children:a(K.GUIDANCE_SURVEY,`required`)})]}),_&&(0,$.jsx)(OD,{variant:`destructive`,role:`alert`,children:(0,$.jsx)(AD,{children:a(K.GUIDANCE_SURVEY,`submissionFailed`)})})]}),(0,$.jsxs)(DF,{className:`flex justify-between items-center`,children:[(0,$.jsx)(`div`,{children:!x&&(0,$.jsx)(Y,{variant:X.OUTLINE,size:df.SM,onClick:O,children:a(K.GUIDANCE_SURVEY,`previous`)})}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[u&&(0,$.jsx)(Y,{variant:X.GHOST,size:df.SM,onClick:k,children:a(K.GUIDANCE_SURVEY,`skip`)}),(0,$.jsx)(Y,{size:df.SM,onClick:D,children:b?a(K.GUIDANCE_SURVEY,`submit`):a(K.GUIDANCE_SURVEY,`next`)})]})]})]})},t4=()=>null,ZTe={[pr.CHECKLIST]:G2,[pr.CHECKLIST_ITEM]:K2,[pr.TOUR]:q2,[pr.TOOLTIP]:J2,[pr.MODAL]:Y2,[pr.BANNER]:X2,[pr.ANNOUNCEMENT]:Z2,[pr.BADGE]:Q2,[pr.CARD]:$2,[pr.SURVEY]:e4},n4={[pr.CHECKLIST]:K.GUIDANCE_CHECKLIST,[pr.CHECKLIST_ITEM]:K.GUIDANCE_CHECKLIST_ITEM,[pr.TOUR]:K.GUIDANCE_TOUR,[pr.TOOLTIP]:K.GUIDANCE_TOOLTIP,[pr.MODAL]:K.GUIDANCE_MODAL,[pr.BANNER]:K.GUIDANCE_BANNER,[pr.ANNOUNCEMENT]:K.GUIDANCE_ANNOUNCEMENT,[pr.BADGE]:K.GUIDANCE_BADGE,[pr.CARD]:K.GUIDANCE_CARD,[pr.SURVEY]:K.GUIDANCE_SURVEY};function r4(e,t){return t?.[e]||Ko.resolve(n4[e],H.DEFAULT)||ZTe[e]}var i4=class extends Q.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){tl.getLogger().error(`GuidanceRenderer: element "${this.props.elementRef}" threw an error`,e)}render(){return this.state.hasError?null:this.props.children}};function a4(e){return`targetSelector`in e&&typeof e.targetSelector==`string`?e.targetSelector:e.targetField?`[data-guidance-field="${e.targetField}"]`:null}function o4(e){try{return!!document.querySelector(e)}catch{return s4.has(e)||(s4.add(e),tl.getLogger().warn(`GuidanceRenderer: "${e}" is not a valid CSS selector, so the element targeting it can never be shown.`)),!1}}var s4=new Set;function QTe(e,t){if(typeof document>`u`)return!1;if(t.type===pr.TOOLTIP){let e=t.targetSelector;return typeof e==`string`&&o4(e)}if(t.type===pr.TOUR){let e=t.steps;return Array.isArray(e)&&e.length>0}if(e.renderMode===_l.INLINE){let e=a4(t);return e===null||o4(e)}return!0}function $Te(e,t){let n=e=>{let n=t[e.type];return!!n&&n!==t4};return e.renderMode===_l.CHECKLIST?e.elements.filter(e=>e.type===pr.CHECKLIST&&n(e)).length===0?[]:e.elements.filter(e=>(e.type===pr.CHECKLIST||e.type===pr.CHECKLIST_ITEM)&&n(e)):e.elements.filter(t=>n(t)&&QTe(e,t))}var eEe=({targetSelector:e,children:t})=>{let n=typeof document<`u`&&o4(e)?document.querySelector(e):null;return n?SN.createPortal((0,$.jsx)(`div`,{className:`absolute z-[calc(var(--z-guidance)-2)]`,children:t}),n):null},c4=({customRenderers:e})=>{let{activeFlows:t,flowStates:n,completeElement:r,dismissFlow:i,recordFlowPresented:a,reportFlowNotPresentable:o}=dU(),s=(0,Q.useMemo)(()=>t.map(e=>`guidance.${e.ref}`),[t]),{makeTrGuidanceElement:c,tGuidanceElement:l,isReady:u}=q({keys:s}),{emit:d}=Uo(),f=A2(),p=Ko.getRegistrationCount(),m=(0,Q.useRef)(null),h=(0,Q.useMemo)(()=>{let t={};for(let n of Object.values(pr)){let r=r4(n,e);r&&(t[n]=r)}let n=t,r=m.current;return r&&Object.values(pr).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:ki}})},[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===_l.CHECKLIST){let e=a.elements.filter(e=>e.type===pr.CHECKLIST),n=a.elements.filter(e=>e.type===pr.CHECKLIST_ITEM);for(let r of e){let e=h[pr.CHECKLIST];if(!e||e===t4)continue;let o=t?.elements?.[r.ref],s=c(a.ref,r.ref,Wc(r)),l=h[pr.CHECKLIST_ITEM],u=l&&l!==t4?n.map(e=>{let n=t?.elements?.[e.ref],r=c(a.ref,e.ref,Wc(e));return(0,$.jsx)(i4,{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)(i4,{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===t4)continue;let o=t?.elements?.[n.ref],s=c(a.ref,n.ref,Wc(n)),l=(0,$.jsx)(i4,{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 _l.OVERLAY:e.push(l);break;case _l.INLINE:{let e=a4(n);e?r.push((0,$.jsx)(eEe,{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=$Te(e,h);if(o(e.ref,t.length===0),t.length===0)continue;let n=t.flatMap(t=>Wc(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),tl.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&&SN.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&&SN.createPortal((0,$.jsx)(`div`,{"data-guidance-layer":`checklist`,className:`${T} bottom-6 end-6 z-[calc(var(--z-guidance)-1)]`,children:C}),w)]})},l4=(0,Q.createContext)(null),u4=(0,Q.createContext)(null),d4=(0,Q.createContext)(null);function f4(e){let t=(0,Q.useContext)(l4);if(!t)throw Error(`${e} must be rendered inside <AppShellProviders>, which supplies the layout it places regions from.`);return t}function p4(e){let[t,n]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{e&&n(!0)},[e]),t}function m4(){return(0,$.jsx)(hD,{asChild:!0,emitPolicyVars:!1,variant:V.SHELL,policyOverride:HE,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)(Jy,{size:32,className:`text-primary mx-auto mb-field`,"aria-hidden":`true`})})})})}function h4({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)(l4.Provider,{value:e,children:(0,$.jsx)(u4.Provider,{value:o,children:(0,$.jsx)(d4.Provider,{value:s,children:(0,$.jsx)(k2.Provider,{value:i??n,children:(0,$.jsx)(W2,{children:t})})})})})}function g4(){let e=(0,Q.useContext)(d4);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 _4(e){let t=f4(`AppShellRegionOutlet`),{region:n,placement:r}=e,i=e=>r===void 0||r===e?e:null;switch(n){case Yu.ACTIVITY_BAR:return t.hasActivityBar?(0,$.jsx)(P2,{}):null;case Yu.MENUBAR:return t.hasMenubar?(0,$.jsx)(F2,{}):null;case Yu.TOOLBAR:return t.hasToolbar?(0,$.jsx)(z2,{}):null;case Yu.SIDEBAR:{let e=i(t.sidebarPlacement);return t.hasSidebar&&e?(0,$.jsx)(L2,{placement:e}):null}case Yu.UTILITY_PANEL:{let e=i(t.utilityPanelPlacement);return t.hasUtilityPanel&&e&&!t.utilityPanelHostedInChrome?(0,$.jsx)(B2,{position:e}):null}case Yu.STATUS_BAR:{let e=i(t.statusBarPlacement);return t.hasStatusBar&&e?(0,$.jsx)(R2,{placement:e}):null}default:throw Error(`AppShellRegionOutlet has no rendering for region "${String(n)}".`)}}function v4({className:e,children:t}){let n=f4(`AppShellContentOutlet`),r=(0,Q.useContext)(u4);return(0,$.jsxs)(`main`,{ref:r??void 0,"data-component-area":Yu.CONTENT,className:e,children:[(0,$.jsx)(c2,{routerChildren:t}),n.hasQuickActionButton&&!n.quickActionButtonHostedInChrome&&(0,$.jsx)(I2,{placement:`floating`})]})}function y4(){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l2,{}),(0,$.jsx)(c4,{})]})}var b4;(function(e){e.INHERIT=`inherit`,e.COMPOSED=`composed`})(b4||={});var x4;(function(e){e.SHELL=`shell`,e.LAYOUT_2D=`layout-2d`,e.LAYOUT_3D=`layout-3d`})(x4||={});var S4=Symbol.for(`@wildo-ai/saas-frontend-lib/shell-layout-main-container`);function C4(e){return typeof e==`function`&&e[S4]===!0}function w4(e,t){switch(t.placement.kind){case b4.INHERIT:return e;case b4.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 T4(e,t,n,r,i){return Object.assign(e,{...i??{},[S4]:!0,captured:t,layout:n,layoutFamily:r})}function E4(e,t,n=x4.SHELL){let r=w4(e,t);function i(e){return(0,$.jsx)(r,{...e})}return T4(i,e,t,n)}function D4(e,t={}){let n=t.callerName??`registerShellLayout()`,r=!1;return{componentRef:K.APP_LAYOUTS_MAIN_CONTAINER,preset:H.DEFAULT,get isConfigurable(){return r},loadComponent:async()=>{let i=Ko.resolve(K.APP_LAYOUTS_MAIN_CONTAINER,H.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??x4.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(C4(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=Ko.getMetadata(K.APP_LAYOUTS_MAIN_CONTAINER,H.DEFAULT)?.isConfigurable??!1;let s=C4(i)?i.captured:i,c=t.createContainer?t.createContainer(s,e):E4(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 O4;(function(e){e.APPEARED=`appeared`,e.CHANGED=`changed`})(O4||={});var k4;(function(e){e.REST=`rest`,e.BEHIND=`behind`,e.DISCARDED=`discarded`})(k4||={});var A4;(function(e){e.PANE_SWAP=`pane-swap`,e.COLUMN_RESIZE=`column-resize`})(A4||={});var j4;(function(e){e.STYLESHEET=`stylesheet`,e.FROM_PRESSED_ELEMENT=`from-pressed-element`})(j4||={});var M4;(function(e){e.INSTANT=`instant`,e.GROW=`grow`})(M4||={});var N4;(function(e){e.STYLESHEET=`stylesheet`,e.FROM_PRESSED_ELEMENT=`from-pressed-element`})(N4||={});var P4=.55,F4=`data-shell-proxy`,I4=`data-shell-object`,L4=`data-shell-ghost-layer`,R4=`data-shell-ghost`,z4=[`id`,`data-content-area`,`data-panel-id`,`data-zone-hidden`,`data-zone-emphasized`,`data-component-area`,I4,`data-navigation-back`,`data-operation-id`,`data-nav-item-id`,`data-ref`],B4;(function(e){e.DISCARDED=`discarded`,e.BEHIND=`behind`})(B4||={});var V4;(function(e){e.BACK=`back`,e.FRONT=`front`})(V4||={});function H4(e){return`[data-component-area="${e}"]`}var U4=H4(Yu.CONTENT),W4=`${U4} [data-content-area]:not([data-panel-id] *), ${U4} [data-panel-id^="nav-"]`;function G4(e){return`${U4} [data-content-area="${e}"]:not([data-panel-id] *), ${U4} [data-panel-id="nav-${e}"]`}function K4(e){if(e instanceof HTMLElement)return e.dataset.contentArea??e.dataset.panelId?.replace(/^nav-/,``)}var q4=new Set([ql.SECONDARY,ql.COMPANION]);function J4(e){let t=K4(e);return t!==void 0&&q4.has(t)}function Y4(e){return q4.has(e)}var X4;(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`})(X4||={});var Z4={[X4.DROPDOWN_MENU]:`--radix-dropdown-menu-content-transform-origin`,[X4.DROPDOWN_MENU_SUB]:`--radix-dropdown-menu-content-transform-origin`,[X4.CONTEXT_MENU]:`--radix-context-menu-content-transform-origin`,[X4.CONTEXT_MENU_SUB]:`--radix-context-menu-content-transform-origin`,[X4.POPOVER]:`--radix-popover-content-transform-origin`,[X4.HOVER_CARD]:`--radix-hover-card-content-transform-origin`,[X4.TOOLTIP]:`--radix-tooltip-content-transform-origin`,[X4.SELECT]:`--radix-select-content-transform-origin`,[X4.MENUBAR]:`--radix-menubar-content-transform-origin`,[X4.MENUBAR_SUB]:`--radix-menubar-content-transform-origin`},tEe=[X4.DIALOG,X4.ALERT_DIALOG],Q4=[X4.DIALOG,X4.ALERT_DIALOG,X4.SHEET,X4.DRAWER],$4=[`open`,`delayed-open`,`instant-open`];function nEe(){return`:has([data-shell-overlay-layer] :is(${Q4.map(e=>`[data-slot="${e}"]`).join(`, `)})[data-state="open"])`}var e3=new Map;function t3(e,t,n=document){let r=e3.get(e)??{sheet:null,users:0};if(e3.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();e3.delete(e)}}var rEe=24,iEe=220,aEe=.5,n3=24,oEe=28,sEe=1500,r3=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function cEe(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[...z4,`data-slot`,`data-state`])e.removeAttribute(t);for(let e of t.querySelectorAll(`iframe, video, audio`))e.remove();return t}function i3(e,t){if(!(e instanceof HTMLElement))return!1;let n=e.offsetHeight;return n>=rEe&&n<=iEe&&e.offsetWidth>=t*aEe}function a3(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 lEe(e,t){return(e.parentElement?[...e.parentElement.children]:[]).some(n=>n!==e&&i3(n,t)&&a3(n,e))}function o3(e){let t=e.closest(W4);if(!t)return null;let n=t.clientWidth;for(let r=e;r&&r!==t;r=r.parentElement)if(i3(r,n)&&lEe(r,n))return r;return null}var uEe=`button, a, [role="button"], [role="menuitem"], [role="option"]`;function s3(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=o3(e),r=e.closest(uEe)??e;t.current={row:n?{...r3(n.getBoundingClientRect()),picture:cEe(n),element:n}:null,control:r3(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 c3(e,t,n,r,i){let a=Math.round(r.durationMs*P4);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(F4,``),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:P4},{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 l3(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 u3(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 d3(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=>i3(e,t)),i=[];for(let t of e){let e=i.find(e=>a3(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 f3(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 d3(e).slice(0,n3))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,n3)*oEe,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()},sEe);return()=>{clearTimeout(s),cancelAnimationFrame(a),o.disconnect()}}function p3(e,t,n){(0,Q.useEffect)(()=>{let r=e.current?.querySelector(`[data-shell-overlay-layer]`),i=e.current;if(!i||!r||t.dialogArrival!==N4.FROM_PRESSED_ELEMENT||t.durationMs===0)return;let a=new WeakSet,o=Q4.filter(e=>e!==X4.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&&c3(i,r,r3(e.getBoundingClientRect()),t,e)}});return s.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-state`]}),()=>s.disconnect()},[e,t,n])}var m3=`shell-pane-arrival`,h3=`data-shell-view-transition`,dEe=`
|
|
25
|
+
html[${h3}]::view-transition-old(root),
|
|
26
|
+
html[${h3}]::view-transition-new(root) { animation: none; }
|
|
27
|
+
::view-transition-group(${m3}) {
|
|
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(${m3}),
|
|
32
|
+
::view-transition-new(${m3}) { height: 100%; object-fit: none; object-position: left top; }
|
|
33
|
+
html:dir(rtl)::view-transition-old(${m3}),
|
|
34
|
+
html:dir(rtl)::view-transition-new(${m3}) { object-position: right top; }
|
|
35
|
+
::view-transition-old(${m3}) { animation: shell-vt-out calc(var(--shell-vt-duration, 320ms) * 0.6) ease-out both; }
|
|
36
|
+
::view-transition-new(${m3}) { 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
|
+
`,fEe=tl.getLogger(),g3=null;function pEe(e=document){return typeof e.startViewTransition==`function`}function _3(e,t){for(let n of e.querySelectorAll(G4(t)))if(!n.hasAttribute(`data-zone-hidden`)&&n.offsetWidth>0)return n;return null}function mEe(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||!Y4(r)||_3(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={};g3=c;let l=null,u=()=>{o.style.removeProperty(`view-transition-name`),l?.style.removeProperty(`view-transition-name`),g3===c&&(g3=null,s.removeAttribute(h3),s.style.removeProperty(`--shell-vt-duration`),s.style.removeProperty(`--shell-vt-ease`))};s.setAttribute(h3,``),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`,m3);try{a.call(t,()=>{o.style.removeProperty(`view-transition-name`);try{(0,SN.flushSync)(n)}catch(e){fEe.error(`A navigation commit failed inside the view-transition arrival`,{error:e,zone:r});return}let e=_3(i,r);if(e){for(let e of i.querySelectorAll(G4(r)))for(let t of e.getAnimations?.()??[])`animationName`in t&&t.finish();e.style.setProperty(`view-transition-name`,m3),l=e}}).finished.then(u,u)}catch{u(),n()}}}var hEe=`[${I4}], ${W4}`,v3=new WeakMap;function y3(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 b3(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(hEe));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=y3(r,t);n.current?.(r,e,t),r.offsetWidth>0&&r.offsetHeight>0&&v3.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 x3(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(`${H4(Yu.CONTENT)} :is([data-content-area], [data-panel-id^="nav-"])`),n=t?K4(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 gEe=new Set(ud);function S3(e,t){let n=Object.keys(e.state.zones).filter(e=>gEe.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===``?O4.APPEARED:O4.CHANGED)}},[i])}function C3(e){e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`inert`,``);for(let t of[e,...e.querySelectorAll(`*`)])for(let e of z4)t.removeAttribute(e);for(let t of e.querySelectorAll(`iframe, video, audio`))t.remove()}function w3(e,t){for(let[n,r]of Object.entries(t))e.style.setProperty(n,r)}function T3(e){requestAnimationFrame(()=>requestAnimationFrame(e))}function E3(e,t){(0,Q.useLayoutEffect)(()=>{let n=e.current;if(!n)return;let r=n.querySelector(`[${L4}="${V4.BACK}"]`),i=n.querySelector(`[${L4}="${V4.FRONT}"]`);if(!r||!i)return;let a=new Map,o=t.durationMs,s=(e,r)=>{let i=document.createElement(`div`);return i.setAttribute(R4,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`}),w3(i,t.ghostPose(k4.REST,{rect:r,stage:n})),i},c=e=>{let r=v3.get(e);if(!r||o===0||e.isConnected)return;let a=s(B4.DISCARDED,r);C3(e),a.appendChild(e),i.appendChild(a),T3(()=>{w3(a,t.ghostPose(k4.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(W4)].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=v3.get(r);s&&w3(i,t.ghostPose(k4.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=v3.get(i);if(!e)continue;let c=s(B4.BEHIND,e),l=i.cloneNode(!0);C3(l),l.classList.remove(`hidden`),l.style.width=`100%`,l.style.height=`100%`,c.appendChild(l),a.set(i,c),o===0?(w3(c,t.ghostPose(k4.BEHIND,{rect:e,stage:n})),r.appendChild(c)):(c.style.opacity=`0`,r.appendChild(c),T3(()=>{w3(c,t.ghostPose(k4.BEHIND,{rect:e,stage:n})),c.style.opacity=`1`}))}},u=e=>e.matches(W4)?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===M4.GROW){let e=r.target instanceof Element?u(r.target):null,i=e?v3.get(e):void 0;e&&i&&(r.target.hasAttribute(`data-zone-emphasized`)?l3(e,i,n,t):u3(e,i,n,t))}else if(r.type===`childList`)for(let e of r.removedNodes)e instanceof HTMLElement&&v3.has(e)&&J4(e)&&c(e);l()}),f=n.querySelector(H4(Yu.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(G4(n));i&&typeof i.animate==`function`&&i.animate([t.dipPeak(A4.PANE_SWAP,{stage:r})],{duration:t.durationMs,easing:t.easing})}},[e,t]),{dip:e=>n.current(e)}}var _Ee=24;function D3(e,t){(0,Q.useEffect)(()=>{let n=e.current;if(!n||t.durationMs===0||typeof ResizeObserver>`u`)return;let r=[...n.querySelectorAll(`[${I4}]`)].filter(e=>e.querySelector(`:scope > ${H4(Yu.SIDEBAR)}, :scope > ${H4(Yu.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)<=_Ee)continue;i.set(e,o);let c=performance.now();c-(a.get(e)??0)<t.durationMs||(a.set(e,c),e.animate([t.dipPeak(A4.COLUMN_RESIZE,{stage:n})],{duration:t.durationMs,easing:t.easing}))}});for(let e of r)o.observe(e);return()=>o.disconnect()},[e,t])}function O3(e,{axis:t,navigation:n,onObjectMeasured:r}){b3(e,r);let{dip:i}=E3(e,t),a=x3(e,n.focusedZone);D3(e,t);let o=s3(t.paneArrival===j4.FROM_PRESSED_ELEMENT||t.dialogArrival===N4.FROM_PRESSED_ELEMENT);p3(e,t,o),(0,Q.useEffect)(()=>{if(t.paneArrival!==j4.FROM_PRESSED_ELEMENT||!t.paneArrivalByViewTransition||t.durationMs===0||!pEe())return;let n=t3(`shell-view-transition`,dEe),r=Bse(mEe({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()},[]),S3(n,(n,r)=>{r===O4.CHANGED&&i(n),a.bringForward(n);let c=e.current,l=c?.querySelector(G4(n));if(c&&l&&t.durationMs!==0){if(r===O4.APPEARED&&t.paneArrival===j4.FROM_PRESSED_ELEMENT&&J4(l)){let e=o.takeRow(800);e&&c3(c,e,l.getBoundingClientRect(),t,l)}t.cascadesRows&&(s.current.get(n)?.(),s.current.set(n,f3(l,t)))}}),{frontZone:a.zone}}var k3=tl.getLogger(),vEe=k3.debugByType(`ComponentRegistryLoaderService`);k3.setDebugTypeLogging(`ComponentRegistryLoaderService`,!1);function yEe(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||H.DEFAULT;Ko.isRegistered(r,n,e.category)||(Ko.register(r,n,e.component,{isConfigurable:e.isConfigurable!==!1,category:e.category}),t++)})})}),t>0&&vEe(`✅ Custom components loaded: ${t} components registered`)}function bEe(){let e=Ko.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:Ko.getRegistrationCount(),byCategory:t}}async function xEe(e){for(let t of e){let e=await t.loadComponent();Ko.register(t.componentRef,t.preset??H.DEFAULT,e,{isConfigurable:t.isConfigurable??!1})}}var A3=(0,Q.forwardRef)(({name:e,value:t,onChange:n,onBlur:r,schema:i,disabled:a,readOnly:o,className:s,placeholder:c,controlSize:l=Nf.MD,targetResourceType:u,optionDisplayMode:d,onClear:f,leadingAdornment:p,quickCreateSourceFieldName:m,onQuickCreateCreated:h},g)=>{let _=MD(),{tComponent:v,isReady:y}=q({component:[K.RESOURCES_FIELDS_RESOURCE_REFERENCE,K.RESOURCES_LAYOUTS_LIST]}),{renderIcon:b}=ef(),x=l===Nf.SM?`sm`:`md`,S=l===Nf.SM?df.XS:df.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}=fV({schema:i,name:e,value:t,targetResourceType:u}),{registry:F}=fm(),I=d??Lee(i)?.edit?.optionDisplayMode??Fi,L=k?F.resourceConfigurations[k]:void 0,R=L?.mainSchema,z=P?yp({tComponent:v,componentType:K.RESOURCES_FIELDS_RESOURCE_REFERENCE,key:`fetchErrorEmptyMessage`,params:{message:P.message}}):M,B=Rz({sourceResourceType:jT()?.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)}}),ee=(0,Q.useCallback)(e=>{n(e||void 0)},[n]),te=(0,Q.useCallback)(e=>{n(e.length>0?e:void 0)},[n]),ne=(0,Q.useCallback)(e=>T?`...`:O(e.value),[T,O]),V=(0,Q.useCallback)(e=>k&&R&&e.data&&typeof e.data==`object`?(0,$.jsx)(lG,{resourceType:k,schema:U.resolveRowSchema(L,e.data)??R,data:e.data,primaryLabel:e.label,contextResourceIdentifiers:_?.contextResourceIdentifiers}):e.label,[k,L,R,_?.contextResourceIdentifiers]),re=I===ma.SUMMARY?V:void 0;return k?y?A?(0,$.jsxs)(`div`,{className:G(`flex items-start gap-element`,s),children:[(0,$.jsx)(lx,{ref:g,name:e,schema:i,options:C,value:j,onChange:te,renderOption:re,onBlur:r,disabled:a||o,className:`flex-1`,placeholder:c||N,emptyMessage:z,onSearchChange:D,onOpenChange:E,isLoading:w,shouldFilter:!1,size:x,renderSelectedValue:ne}),B.canQuickCreate&&(0,$.jsx)(Y,{type:`button`,size:S,variant:X.OUTLINE,className:`shrink-0`,onClick:B.launchQuickCreate,disabled:a||o||B.isLaunching,"aria-label":v(K.RESOURCES_LAYOUTS_LIST,`create`),children:B.isLaunching?b(W.LOADER_2,{size:tr.SM,className:`animate-spin motion-reduce:animate-none`}):b(W.PLUS,{size:tr.SM})})]}):(0,$.jsxs)(`div`,{className:G(`flex items-start gap-element`,s),children:[(0,$.jsx)(cx,{ref:g,name:e,schema:i,options:C,value:j[0]??``,onChange:ee,renderOption:re,onBlur:r,disabled:a||o,className:`flex-1`,placeholder:c||N,emptyMessage:z,onSearchChange:D,onOpenChange:E,isLoading:w,shouldFilter:!1,size:x,renderSelectedValue:ne,onClear:f,leadingAdornment:p}),B.canQuickCreate&&(0,$.jsx)(Y,{type:`button`,size:S,variant:X.OUTLINE,className:`shrink-0`,onClick:B.launchQuickCreate,disabled:a||o||B.isLaunching,"aria-label":v(K.RESOURCES_LAYOUTS_LIST,`create`),children:B.isLaunching?b(W.LOADER_2,{size:tr.SM,className:`animate-spin motion-reduce:animate-none`}):b(W.PLUS,{size:tr.SM})})]}):null:(0,$.jsx)(`div`,{className:G(`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]})})});A3.displayName=`ResourceFieldEditPreset_ResourceReference_Default`;var SEe=A3;function CEe(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 j3=G(`block rounded-md text-inherit no-underline transition-colors hover:bg-muted/40`,Dg(e_.OFFSET));function M3({label:e}){return(0,$.jsx)(Z,{as:`span`,variant:en.INHERIT,children:e})}var wEe=({fieldName:e,value:t,resourceType:n,data:r,displayParams:i,labelFallback:a,schema:o,className:s})=>{let{registry:c,doOperation:l}=fm(),{emit:u}=Uo(),d=oj(),f=MD(),p=Tj({explicitResourceType:n,schema:o,fieldName:e,registry:c})||U.resolveResourceTypeForForeignKey(e,o,c),{t:m,tComponent:h,formatDate:g,formatDateTime:_,isReady:v}=q({component:K.RESOURCES_FIELDS_RESOURCE_REFERENCE,resource:p}),y=cp(),b=(0,Q.useMemo)(()=>d?.contextualParameters&&Object.keys(d.contextualParameters).length>0?d.contextualParameters:f?.contextResourceIdentifiers?U.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??Nu,E=d?.parentReferenceConfig,{hidesWholeReference:D,visibleIds:O}=Q.useMemo(()=>ij({parentReferenceConfig:E,referencedResourceType:p,referencedIds:jw(t)}),[E,p,t]),k=!!(E&&p&&E.parentResourceType===p&&E.displayMode!==iu.NONE),A=(0,Q.useMemo)(()=>{if(!k||!E)return T;switch(E.displayMode){case iu.CONTEXT:case iu.BREADCRUMB:return T;case iu.BADGE:case iu.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===iu.CONTEXT||E?.displayMode===iu.BREADCRUMB)return!0}return i?.linkable??!0},[k,E,i?.linkable]),M=d?.navigationZone??f?.navigationZone,N=(0,Q.useContext)(_S),P=(0,Q.useCallback)(e=>{N?N.navigate(e):u(hc.NAVIGATION_REQUEST,{content:e.content,initiator:e.initiator,urlPath:e.urlPath})},[u,N]),F=Q.useMemo(()=>{if(!r||typeof r!=`object`||!p||Array.isArray(t))return null;let e=CEe({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:U.computeFrontendResourceLabel({resourceType:p,registry:c,currentObject:r,t:m,formatDate:g,formatDateTime:_})},[r,p,t,c,m,g,_]),I=(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]),L=(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?kn.buildParentResourcesRequirements(n,t,c):[];return{refResourceConfig:e,ownFieldIdentifier:c.allResourceFieldIdentifiers?.[p],currentParentRequirements:r}},[p,c,d?.contextResourceIdentifiers,d?.resourceType,f?.contextResourceIdentifiers,f?.resourceType]),R=d?.resourceType?{resourceType:d.resourceType,id:d.resourceId}:f?{resourceType:f.resourceType,id:f.resourceId}:void 0,z=R?.resourceType,B=R?.id,ee=(0,Q.useCallback)(e=>zm({hostIdentifiers:I,hostContextualParameters:b,hostParentRequirements:L?.currentParentRequirements,hostRecord:{resourceType:z,id:B},targetResourceType:p??``,targetId:e,registry:c}),[I,b,L?.currentParentRequirements,z,B,p,c]),te=iS(th(z,B==null?void 0:String(B),I)),ne=Zp()?.currentUserId??null,V=(0,Q.useCallback)((e,t,n)=>{let r=p===Wo.USERS||p===Wo.USER_SELF,i=n[Fe[Wo.USERS]],a=r?t:typeof i==`string`?i:null;return(e.operations??[]).filter(t=>ch({...t,resourcePrimaryScope:t.resourcePrimaryScope??e.resourcePrimaryScope},{subjectUserId:a,viewerUserId:ne},te))},[p,te,ne]),re=(0,Q.useCallback)(e=>{if(!L||!p)return null;let{refResourceConfig:t,ownFieldIdentifier:n}=L,r=ee(e),i={...r.identifiers,[p]:e},a={...r.contextualParameters,...n?{[n]:e}:{}},o=fh({resourceConfig:t,operations:V(t,e,a),coreOperation:J.READ,registry:c,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:i,contextualParameters:a});if(!o)return null;let s=Tl.buildOperationFrontendRoutePaths(t,o,c.allResourceFieldIdentifiers);if(s.length===0)return null;try{let t=kn.selectMatchingRoutePath(s,i,p,n,r.parentRequirements,c.allResourceFieldIdentifiers);if(!t?.url)return null;let a=kn.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=Hm.resolveUrlPath(t.url,l);if(u&&!Hm.hasUnresolvedPlaceholders(u))return{url:u,parentResourcesRequirements:a,readOp:o}}catch{}return null},[L,c,p,ee,V]),ie=(0,Q.useCallback)(e=>{if(!L||!p)return null;let{refResourceConfig:t,ownFieldIdentifier:n}=L,r=ee(e),i={...r.identifiers,[p]:e},a={...r.contextualParameters,...n?{[n]:e}:{}},o=fh({resourceConfig:t,operations:V(t,e,a),coreOperation:J.READ,registry:c,hasResourceId:!0,requireFrontendAddressable:!1,contextResourceIdentifiers:i,contextualParameters:a});return!o||o.operationFrontendConfig?.surface!==Si.EMBEDDED?null:{readOp:o}},[L,c,p,ee,V]),ae=(0,Q.useCallback)(e=>{let t=re(e);if(t)return{readOp:t.readOp,parentResourcesRequirements:t.parentResourcesRequirements};if(!L||!p)return null;let{refResourceConfig:n,ownFieldIdentifier:r}=L,i=ee(e),a={...i.contextualParameters,...r?{[r]:e}:{}},o=fh({resourceConfig:n,operations:n.operations??[],coreOperation:J.READ,registry:c,hasResourceId:!0,requireFrontendAddressable:!1,contextResourceIdentifiers:{...i.identifiers,[p]:e},contextualParameters:a});if(!o)return null;let s=U.selectOperationUrlInitiatorInfo({initiatorInfos:o.initiatorInfos??[],contextualParameters:a,targetResourceType:p,targetDefaultFieldIdentifier:r??``});return s?{readOp:o,parentResourcesRequirements:kn.buildParentResourcesRequirementsFromRouteParams(s.parameters,p,c)}:null},[re,L,p,ee,c]),oe=(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=ae(e),{record:n,label:r}=await Nw({resourceType:p,id:e,registry:c,doOperation:l,...t?{readOperation:t.readOp,parentResourcesRequirements:t.parentResourcesRequirements}:{},contextualParameters:ee(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,_,ee,y,ae]);(0,Q.useEffect)(()=>{p&&O.length!==0&&A!==ma.ID&&(F&&O.length===1&&!C.current.has(O[0])?w(O[0],{id:O[0],label:F,data:r,error:null,isLoading:!1}):O.forEach(e=>{e&&!C.current.has(e)&&oe(e)}))},[p,O,A,oe,w,F]);let se=(0,Q.useCallback)((e,t)=>{if(!j||!p)return t;let n=A===ma.SUMMARY,r=re(e),i=!!((M||N)&&r?.readOp&&r?.url),a=t=>{if(!i||!r||t.button!==0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)return;let n={...ee(e).identifiers,[p]:e},a=kn.createFrontendResourceOperationContextFromOperation({resourceType:p,operation:r.readOp,contextResourceIdentifiers:n,parentResourcesRequirements:r.parentResourcesRequirements});t.preventDefault(),P({content:{contentType:Sa.RESOURCE_OPERATION,resourceContext:a},initiator:{sourceZone:M??Gn.PRIMARY},urlPath:r.url})};if(k&&E?.onNavigateToParent)return r?.url?(0,$.jsx)(bh,{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)(bh,{to:r.url,className:n?j3:`text-primary hover:underline`,onClick:a,children:t});let o=ie(e);return o?(0,$.jsx)(`button`,{type:`button`,className:n?G(j3,`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=ee(e),r=kn.createFrontendResourceOperationContextFromOperation({resourceType:p,operation:o.readOp,contextResourceIdentifiers:{...n.identifiers,[p]:e},parentResourcesRequirements:n.parentRequirements});P({content:{contentType:Sa.RESOURCE_OPERATION,resourceContext:r},initiator:{sourceZone:M??Gn.PRIMARY}})},children:t}):t},[P,N,A,L,j,k,M,E,re,ie,p,ee]),ce=(0,Q.useCallback)(e=>{if(A===ma.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)(pm,{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(K.RESOURCES_FIELDS_RESOURCE_REFERENCE,`recordUnavailable`)});let n=!!p&&!!U.frontendResourceLabelDefinitionOf(c.resourceConfigurations?.[p]),r=(t.data&&p&&n?U.computeFrontendResourceLabel({resourceType:p,registry:c,currentObject:t.data,t:m,formatDate:g,formatDateTime:_}):null)||t.label||a||e;if(A===iu.BADGE){let t=j&&E?.onNavigateToParent?()=>E.onNavigateToParent(e):void 0;return(0,$.jsx)(Jd,{variant:`secondary`,className:t?`cursor-pointer hover:opacity-[var(--opacity-hover)]`:void 0,onClick:t,children:r})}if(A===iu.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=U.resolveRowSchema(n,t.data);if(i){let n=(0,$.jsx)(lG,{resourceType:p,schema:i,data:t.data,primaryLabel:r,contextResourceIdentifiers:ee(e).identifiers});return j?se(e,n):n}}return se(e,(0,$.jsx)(M3,{label:r}))}return ma.LABEL,se(e,(0,$.jsx)(M3,{label:r}))},[A,x,p,k,E,se,c,j,m,h,g,_,a]);return D?null:O.length===0?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):!p&&A!==ma.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:ce(O[0])}):(0,$.jsx)(`ul`,{className:G(`list-disc ps-4 space-y-item-xs`,s),children:O.map(e=>(0,$.jsx)(`li`,{children:ce(e)},e))})};function TEe(e,t){let n=g1(e),r={size:Vf.LG,closeOnEscape:!0,closeOnOutsideClick:t?.closeOnOutsideClick??!0,modal:t?.modal??!0,showBackdrop:t?.showBackdrop??!0};return n===Fn.SHEET?{mode:n,side:hu.END,...r}:{mode:n,...r}}var EEe=()=>{let{state:e}=kx(),{closeOverlay:t}=yS(),n=e.overlay,r=n.length>0?n[n.length-1]:void 0,i=n.length>0,{title:a,description:o}=H$(r),s=(0,Q.useMemo)(()=>TEe(r?.appearance,r?.overlayBehavior),[r?.appearance,r?.overlayBehavior]),c=(0,Q.useCallback)(e=>{e||t()},[t]);return(0,$.jsx)(f1,{open:i,onOpenChange:c,title:a||void 0,description:o,config:s,children:r&&(0,$.jsx)(H0,{content:r.content,zone:Gn.OVERLAY,initiator:r.initiator,entryId:r.id})})},N3=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>(0,$.jsx)(EEe,{});function DEe({preset:e=H.DEFAULT,...t}){let n=qc(K.RESOURCES_LAYOUTS_CONTAINER_DIALOGS,`ResourceLayout_ContainerDialogs`)(e);return(0,$.jsx)(n,{...t})}var P3=({resourceContext:e,onFiltersChange:t})=>{let{registry:n}=fm(),{resourceType:r}=e,[i,a]=(0,Q.useState)({}),o=(0,Q.useMemo)(()=>n.resourceConfigurations[r],[n,r]),s=(0,Q.useMemo)(()=>PG.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)(qK,{resourceType:r,filterFields:s,currentFilters:i,onFiltersChange:c})};function OEe({preset:e=H.DEFAULT,...t}){let n=qc(K.RESOURCES_LAYOUTS_FILTERS,`ResourceLayout_Filters`)(e);return(0,$.jsx)(n,{...t})}var kEe=e=>(0,$.jsx)(JY,{...e,defaultViewMode:vs.TABLE}),F3=e=>(0,$.jsx)(bY,{...e,showCharts:!1}),I3=(0,Q.memo)(({resourceContext:e,item:t,onNavigate:n,className:r})=>{let{resourceType:i}=e,{registry:a}=fm(),{t:o,formatDate:s,formatDateTime:c,isReady:l}=q({component:K.RESOURCES_LAYOUTS_READ_SUMMARY,resource:i}),u=(0,Q.useMemo)(()=>[`resources.${i}`,`components.${K.RESOURCES_LAYOUTS_READ_SUMMARY}`],[i]),d=a.resourceConfigurations[i],f=(0,Q.useMemo)(()=>U.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)(()=>U.resolveRowSchema(d,t),[d,t]),m=d?.frontendConfiguration?.layout?.summary;return l?(0,$.jsx)(Zy,{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)(lG,{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)(lG,{resourceType:i,schema:p,data:t,contextResourceIdentifiers:e.contextResourceIdentifiers})]})})}):null});function AEe({preset:e,...t}){let n=t.resourceContext.operation.operationFrontendConfig?.displayPresetOverride?.resourceLayoutPresetKey,r=e??n??rd.DEFAULT,i=qc(K.RESOURCES_LAYOUTS_READ_SUMMARY,`ResourceLayout_ReadSummary`)(r);return(0,$.jsx)(i,{...t})}var jEe=({resourceContext:e,item:t,summaryFields:n,fieldLabelsMap:r,onItemClick:i,operationsSlot:a,isSelected:o,className:s})=>{let{resourceType:c}=e,{registry:l}=fm(),{t:u,formatDate:d,formatDateTime:f,tResourceFieldEnumValue:p}=q({resource:c}),{tComponent:m}=q({component:K.LOW_LEVEL_FORM_FIELD}),h=l.resourceConfigurations[c],g=(0,Q.useMemo)(()=>U.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=U.resolveRowSchema(h,t);return e?_r.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?Dg(e_.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)(oJ,{className:`px-card py-element text-sm align-middle`,truncate:!0,"aria-label":r[n],children:i==null?(0,$.jsx)(Aj,{noValueLabel:m(K.LOW_LEVEL_FORM_FIELD,`noValue`),typography:Mj(_?.[n]?Zl(_[n]):void 0)}):(0,$.jsx)(DG,{fieldName:n,value:i,fieldSchema:_?.[n],fieldLabel:void 0,resourceType:c,record:t,collectionContextResourceIdentifiers:e.contextResourceIdentifiers,tResourceFieldEnumValue:p})},n)}),a&&(0,$.jsx)(oJ,{className:`px-card py-element text-sm align-middle text-end`,onClick:e=>e.stopPropagation(),children:a})]})},MEe=({resourceContext:e,navigationZone:t,navigationInitiator:n})=>(0,$.jsx)(wY,{resourceContext:e,navigationZone:t,navigationInitiator:n}),L3=({children:e=null})=>(0,$.jsx)(ZY,{children:`PublicLayoutPreset_StaticContentContainer_Default`});function NEe({preset:e=H.DEFAULT,...t}){let n=qc(K.PUBLIC_LAYOUTS_STATIC_CONTENT_CONTAINER,`PublicLayout_StaticContentContainer`)(e);return(0,$.jsx)(n,{...t})}var PEe=Q.lazy(()=>i_(()=>import(`./ChartView-Db94VZQx.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),FEe=Q.lazy(()=>i_(()=>import(`./ChartWidget-YVF2hpZO.js`).then(e=>e.n),__vite__mapDeps([10,1,2,3,9,4,5,6,11,12])));function IEe(){Ko.register(K.HIGH_LEVEL_VIEWS_CHART_ECHARTS,H.DEFAULT,PEe,{isConfigurable:!1}),Ko.register(K.HIGH_LEVEL_VIEWS_CHART_WIDGET,H.DEFAULT,FEe,{isConfigurable:!1}),Ko.register(K.APP_LAYOUTS_ERROR_BOUNDARY,H.DEFAULT,Fy,{isConfigurable:!0}),Ko.register(K.APP_LAYOUTS_HOME,H.DEFAULT,VU,{isConfigurable:!0}),Ko.register(K.APP_LAYOUTS_ROUTER_ERROR_BOUNDARY,H.DEFAULT,zy,{isConfigurable:!0}),Ko.register(K.PUBLIC_LAYOUTS_STATIC_CONTENT_CONTAINER,H.DEFAULT,L3,{isConfigurable:!0}),Ko.register(K.PUBLIC_LAYOUTS_USER_AUTH,H.DEFAULT,XX,{isConfigurable:!0}),Ko.register(K.PUBLIC_LAYOUTS_USER_CONFIRM_EMAIL,H.DEFAULT,$X,{isConfigurable:!0}),Ko.register(K.PUBLIC_LAYOUTS_USER_INVITATION,H.DEFAULT,oZ,{isConfigurable:!0}),Ko.register(K.PUBLIC_LAYOUTS_USER_PASSWORD_LOST,H.DEFAULT,gZ,{isConfigurable:!0}),Ko.register(K.PUBLIC_LAYOUTS_USER_REGISTER,H.DEFAULT,PZ,{isConfigurable:!0}),Ko.register(K.PUBLIC_LAYOUTS_ONE_OFF_SESSION,H.DEFAULT,cZ,{isConfigurable:!0}),Ko.register(K.PUBLIC_LAYOUTS_FILE_UPLOAD_GRANT,H.DEFAULT,pZ,{isConfigurable:!0}),Ko.register(K.PUBLIC_LAYOUTS_AUTH_CALLBACK,H.DEFAULT,rX,{isConfigurable:!0}),Ko.register(K.PUBLIC_LAYOUTS_MAGIC_LINK_VERIFY,H.DEFAULT,sX,{isConfigurable:!0}),Ko.register(K.PUBLIC_LAYOUTS_ENROLLMENT_REQUIRED,H.DEFAULT,BX,{isConfigurable:!0}),Ko.register(K.PUBLIC_LAYOUTS_ORGANIZATION_ONBOARDING,H.DEFAULT,GX,{isConfigurable:!0}),Ko.register(K.PUBLIC_LAYOUTS_MFA_CHALLENGE,H.DEFAULT,LX,{isConfigurable:!0}),Ko.register(K.PUBLIC_LAYOUTS_OAUTH_CONSENT,H.DEFAULT,vZ,{isConfigurable:!0}),Ko.register(K.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT,H.DEFAULT,TZ,{isConfigurable:!0}),Ko.register(K.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM,H.DEFAULT,OZ,{isConfigurable:!0}),Ko.register(K.PUBLIC_LAYOUTS_CHAT_IDENTITY_LINK,H.DEFAULT,CZ,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_BREADCRUMB,H.DEFAULT,wB,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_CONTAINER_DIALOGS,H.DEFAULT,N3,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_CONTAINER_NESTED,H.DEFAULT,nY,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_CREATE,H.DEFAULT,nG,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_ACTION,H.DEFAULT,WW,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_FILTERS,H.DEFAULT,P3,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_HEADER,H.DEFAULT,$B,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_LIST,lr.DEFAULT,JY,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_LIST,lr.TABLE,kEe,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_OPERATIONS_BULK,H.DEFAULT,bJ,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_OPERATIONS_ITEMS,H.DEFAULT,iY,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_RECORD_SHARING,H.DEFAULT,gY,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_DANGER_ZONE,H.DEFAULT,lY,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_PAGINATION,H.DEFAULT,YG,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_READ,yi.DEFAULT,bY,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_READ,yi.EXPANDABLE,F3,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_READ_SUMMARY,rd.DEFAULT,I3,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_READ_SUMMARY,rd.TABLE_ROW,jEe,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_SEARCH,te.DEFAULT,wY,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_SEARCH,te.TABLE,MEe,{isConfigurable:!0}),Ko.register(K.RESOURCES_LAYOUTS_UPDATE,H.DEFAULT,EY,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_BIGDECIMAL,H.DEFAULT,cL,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_BOOLEAN,H.DEFAULT,TI,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_DATE,H.DEFAULT,QM,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_DATETIME,H.DEFAULT,tN,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_ENUM,H.DEFAULT,eI,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_FILE,H.DEFAULT,zL,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_MONEY,H.DEFAULT,GI,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_DURATION,H.DEFAULT,qI,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_PHONE,H.DEFAULT,eL,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_ADDRESS,H.DEFAULT,aL,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_NUMBER,H.DEFAULT,HI,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_RANGE_BIGDECIMAL,H.DEFAULT,dL,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_RANGE_DATE,H.DEFAULT,lN,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_RANGE_DATETIME,H.DEFAULT,fN,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_RANGE_MONEY,H.DEFAULT,pL,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_RANGE_NUMBER,H.DEFAULT,oN,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_RANGE_TIME,H.DEFAULT,hN,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_STRING,H.DEFAULT,BI,{isConfigurable:!0}),Ko.register(K.LOW_LEVEL_FORM_FIELD_TIME,H.DEFAULT,iN,{isConfigurable:!0}),Ko.register(K.RESOURCES_FIELDS_RESOURCE_REFERENCE,H.DEFAULT,A3,{isConfigurable:!0,category:pa.EDIT}),Ko.register(K.RESOURCES_FIELDS_RESOURCE_REFERENCE,yn.SEARCH,SEe,{isConfigurable:!0,category:pa.EDIT}),Ko.register(K.RESOURCES_FIELDS_RESOURCE_REFERENCE,H.DEFAULT,wEe,{isConfigurable:!0,category:pa.DISPLAY})}var LEe=tl.getLogger(),R3=new Set([K.LOW_LEVEL_CONTENT_SECTION_CONTAINER,K.LOW_LEVEL_OVERLAY_CONTAINER,K.LOW_LEVEL_AI_FLOW_NODE,K.LOW_LEVEL_AI_FLOW_EXECUTION,K.LOW_LEVEL_AI_SYSTEM_CATALOG,K.LOW_LEVEL_AI_ACTOR,K.LOW_LEVEL_AI_EXECUTION_PLAN,K.LOW_LEVEL_AI_TASK_DETAIL,K.LOW_LEVEL_AI_TASK_MEMORY,K.LOW_LEVEL_AI_EXECUTION_USAGE,K.LOW_LEVEL_AI_GRAPH_VIEWER,K.LOW_LEVEL_AI_APPROVAL,K.LOW_LEVEL_AI_DECISION,K.LOW_LEVEL_AI_EXECUTION_STREAM,K.LOW_LEVEL_AI_ARTIFACT_BROWSER,K.LOW_LEVEL_AI_AGENT_CONFIG,K.GUIDANCE_CHECKLIST,K.GUIDANCE_CHECKLIST_ITEM,K.GUIDANCE_TOUR,K.GUIDANCE_TOOLTIP,K.GUIDANCE_MODAL,K.GUIDANCE_BANNER,K.GUIDANCE_ANNOUNCEMENT,K.GUIDANCE_BADGE,K.GUIDANCE_CARD,K.GUIDANCE_SURVEY,K.GUIDANCE_ONBOARDING_VIEW,K.PROGRESSION_MILESTONE_TRACKER,K.PROGRESSION_ACHIEVEMENT_BADGE,K.LIFECYCLE_HOME_ACTIVATION_PROGRESS,K.LIFECYCLE_HOME_WELCOME_BACK,K.LIFECYCLE_HOME_DASHBOARD,K.HIGH_LEVEL_VIEWS_COMPOSITE,K.HIGH_LEVEL_VIEWS_CHART,K.HIGH_LEVEL_VIEWS_FULL_CUSTOM,K.HIGH_LEVEL_VIEWS_FLOWS_ACTORS,K.HIGH_LEVEL_VIEWS_EXECUTION,K.HIGH_LEVEL_VIEWS_NOT_FOUND,K.HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR,K.APP_LAYOUTS_TEST_COMPONENT,K.APP_LAYOUTS_SECURITY_SETTINGS,K.APP_LAYOUTS_SETTINGS_HUB,K.APP_LAYOUTS_APPEARANCE_SETTINGS,K.APP_LAYOUTS_INVITATIONS_SETTINGS,K.APP_LAYOUTS_BILLING_SETTINGS,K.APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS,K.APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS,K.APP_LAYOUTS_AUTONOMOUS_AGENTS_SETTINGS,K.APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS,K.APP_LAYOUTS_MODEL_COST_BREAKDOWN_SETTINGS,K.APP_LAYOUTS_REPRESENTATIVE_ACTIVITY_SETTINGS,K.APP_LAYOUTS_AGENT_WORK_EVALUATION_EXPORT_SETTINGS,K.APP_LAYOUTS_SURFACE_ERROR_BOUNDARY,K.LOW_LEVEL_FORM_FIELD_FOREIGN_KEY,K.LOW_LEVEL_DISPLAY_FIELD_FOREIGN_KEY]);function z3(){let e=Object.values(K),t=[],n=0;for(let r of e)R3.has(r)||(Ko.hasComponentType(r)?n+=1:t.push(r));return{totalEnumValues:e.length,registeredCount:n,denyListedCount:R3.size,missing:t}}function REe(e){let t=z3();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 LEe.warn(`component-registry.completeness-check.failed`,{message:n,missing:t.missing}),t}function zEe(e){return Pu(e)}var B3;(function(e){e.HEX=`hex`,e.RGB=`rgb`,e.HSL=`hsl`})(B3||={});var BEe=/^#([0-9a-f]{6})$/i,VEe=/^#([0-9a-f]{3})$/i,HEe=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*[\d.]+\s*)?\)$/i,UEe=/^hsla?\(\s*(\d{1,3}(?:\.\d+)?)\s*,\s*(\d{1,3}(?:\.\d+)?)%\s*,\s*(\d{1,3}(?:\.\d+)?)%\s*(?:,\s*[\d.]+\s*)?\)$/i;function V3(e,t,n){return Math.min(n,Math.max(t,e))}function H3(e){let t=e.trim();if(t.length===0)return null;let n=BEe.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=VEe.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=HEe.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=UEe.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:q3(e,t,n)}return null}function U3(e){let t=W3(e);return t===null?null:H3(t)}function W3(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 G3({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 K3({h:e,s:t,v:n}){let r=(e%360+360)%360,i=V3(t,0,100)/100,a=V3(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 q3(e,t,n){let r=(e%360+360)%360,i=V3(t,0,100)/100,a=V3(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 J3({r:e,g:t,b:n}){let r=e=>V3(Math.round(e),0,255).toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`}function Y3(e,t){if(t===B3.RGB)return`rgb(${Math.round(e.r)}, ${Math.round(e.g)}, ${Math.round(e.b)})`;if(t===B3.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 J3(e)}function WEe(e,t){return Y3(K3(e),t)}function X3({r:e,g:t,b:n}){let r=e=>{let t=V3(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 GEe=()=>{let e=(0,Q.useContext)(hH);if(!e)throw Error(`useStepUpAuth must be used within a StepUpAuthProvider`);return e},Z3=class extends Error{code;httpStatus;constructor(e,t,n){super(t),this.name=`CrossFrontendHandoffClientError`,this.code=e,this.httpStatus=n}};async function Q3(e,t){let n;try{n=await vc().crossFrontendHandoff(e,t)}catch(e){throw qEe(e)}if(!n||typeof n.handoffUrl!=`string`||typeof n.expiresAt!=`string`)throw new Z3(`malformed_response`,`Cross-frontend handoff response missing required fields`,null);return{handoffUrl:n.handoffUrl,expiresAt:n.expiresAt}}var KEe=new Set(Object.values(Rae));function qEe(e){if(e instanceof Z3)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 Z3(`network`,t?.message??`Cross-frontend handoff request failed (no response)`,null);if(n===401)return new Z3(`unauthenticated`,`Cross-frontend handoff requires an authenticated session`,401);let r=t?.response?.data?.error?.details?.code??t?.context?.code;return typeof r==`string`&&KEe.has(r)?new Z3(r,t?.message??`Cross-frontend handoff failed (HTTP ${n})`,n):new Z3(`malformed_response`,t?.message??`Cross-frontend handoff failed (HTTP ${n})`,n)}function JEe(){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 Q3(e,n);return!o.current&&i===s.current&&(r(a),t(`success`)),a}catch(e){let n=e instanceof Z3?e:new Z3(`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 $3(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 e6(e,t,n,r=!1){let i=e.filter(e=>$3(e,t,n));return r&&i.length===0&&e.length>0&&(e.some(e=>e.contentKind===xc.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 t6(e,t,n){return{appScopeValues:e,activeMode:t,availableModes:n}}function n6(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=$3(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 YEe(e){return A0(e)}function XEe({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_FEATURE_UNAVAILABLE_DIALOG,`FeatureUnavailableDialog`)(e);return(0,$.jsx)(n,{...t})}function ZEe({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_FEATURE_LOCK_BADGE,`FeatureLockBadge`)(e);return(0,$.jsx)(n,{...t})}function r6({featureId:e,showLabel:t=!0,size:n=`sm`,preset:r=H.DEFAULT}){let{getLimit:i,getCurrentUsage:a}=vh(),{t:o}=q(),s=i(e),c=a(e)??0;if(s===void 0||s===-1)return null;let l=ye(Zee.LIMIT,e),u=o(l),d=u===l?e:u,f=qc(K.LOW_LEVEL_FEATURE_LIMIT_INDICATOR,`FeatureLimitIndicator`)(r);return(0,$.jsx)(f,{usage:c,limit:s,label:d,showLabel:t,size:n})}var i6=sl.BILLING,a6={kind:_s.SETTINGS_SECTION,sectionRef:i6,category:Ac.BILLING,searchKeywords:[`billing`,`subscription`,`plan`,`payment`,`invoice`,`upgrade`],runtimeAvailability:{requiredCapabilities:[`billingEnabled`]}};function o6(e){let t=ym(),n=rS(),r=(0,Q.useContext)(ih)?.user?._id,i=e!==void 0&&e===r;return(0,Q.useMemo)(()=>t?rre(t.getAvailableResourceTypes().flatMap(e=>{let n=t.getResourceConfiguration(e);return n?[{resourceIdentifier:e,operations:n.operations??[]}]:[]}),i?{initiatorMayPerform:e=>Wm({resourceType:e.resourceIdentifier,roles:e.roles,operationIdentifier:e.operationIdentifier,resourceOperationLike:e.resourceOperationLike},n)}:{}):[],[t,n,i])}function s6(e){for(let t of e)for(let e of t)if(e.userNotifications?.some(e=>e.channel===Ks.SMS))return!0;return!1}function c6(e){let t=ym(),n=(0,Q.useContext)(ih)?.user?._id,r=e!==void 0&&e===n,i=(0,Q.useMemo)(()=>t?s6(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 vc().getMyMethods().then(t=>{e||o((t.methods??[]).some(e=>e.method===mt.SMS_OTP&&e.enrolled))}).catch(()=>{e||o(!1)}),()=>{e=!0}},[i,r]),i&&r&&a}var QEe=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=up(),[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(ro.RESOURCE_UPDATED,e=>{if(e.resourceType===t){if(n){if(e.resourceId!==n||e.deliveryTarget!==$c.RESOURCE_ROOM_SYNC&&e.deliveryTarget!==$c.RESOURCE_ROOM_NOTIFICATION)return}else if(e.deliveryTarget!==$c.SCOPE_ROOM_NOTIFICATION)return;s?.(e)}}),r=f.on(ro.RESOURCE_DELETED,e=>{e.resourceType===t&&n&&e.resourceId===n&&c?.(e)}),i=f.on(ro.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(ro.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(ro.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}},l6=`this-session`;function u6(e,t){let{emit:n}=Uo(),{registry:r}=fm(),i=(0,Q.useRef)(!1),a=r.notificationBadgeDefinitions.find(t=>Fo(t)===e),o=a?.source.kind===$te.FRONTEND_PRODUCED;(0,Q.useEffect)(()=>{if(!o){!i.current&&ui.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=ete(e);r&&YQ(n,{badgeReference:aae(r.scope,l6,r.identifier),badgeCount:Math.max(0,Math.trunc(t))})},[e,t,o,a,n])}function $Ee({milestoneRef:e,className:t}){let n=pU(),{tComponent:r,isReady:i}=q({component:K.PROGRESSION_ACHIEVEMENT_BADGE}),{renderIcon:a}=ef(),o=(0,Q.useMemo)(()=>(e,t)=>r(K.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(W.CHECK,{size:tr.XS,className:`text-success`}):a(W.LOCK,{size:tr.XS});return(0,$.jsxs)(Jd,{variant:s?`default`:`outline`,className:G(`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 d6=K.LOW_LEVEL_AI_ACTOR;function f6(e){return`role_${e}`}function p6(e){return`mode_${e}`}function m6(e){return`modeDesc_${e}`}var eDe={[u.COORDINATOR]:W.USERS,[u.TASK_PLANNER]:W.BOOK,[u.OPERATOR]:W.WRENCH,[u.ANALYZER]:W.SEARCH,[u.REVIEWER]:W.CHECK_CIRCLE,[u.HUMAN_IN_THE_LOOP]:W.LOCK,[u.FLOW_EXECUTION]:W.ARROW_RIGHT},tDe={[fi.AGENTIC]:W.BRAIN,[fi.FLOW_EXECUTION]:W.ARROW_RIGHT,[fi.HUMAN_INTERACTION]:W.USERS,[fi.PROGRAMMATIC]:W.SETTINGS},nDe={[u.COORDINATOR]:`default`,[u.TASK_PLANNER]:`default`,[u.OPERATOR]:`secondary`,[u.ANALYZER]:`secondary`,[u.REVIEWER]:`outline`,[u.HUMAN_IN_THE_LOOP]:`destructive`,[u.FLOW_EXECUTION]:`outline`},h6=e=>Object.values(u).includes(e),rDe=e=>Object.values(fi).includes(e),g6;(function(e){e.IDLE=`idle`,e.EXECUTING=`executing`,e.AWAITING_APPROVAL=`awaiting_approval`,e.COMPLETED=`completed`})(g6||={});var iDe={[g6.IDLE]:Il.NEUTRAL,[g6.EXECUTING]:Il.INFO,[g6.AWAITING_APPROVAL]:Il.WARNING,[g6.COMPLETED]:Il.SUCCESS};function aDe(e){return G(qd[iDe[e]],e===g6.EXECUTING&&`motion-safe:animate-pulse`)}function _6(e){return`status_${e}`}var oDe=({systemName:e,actors:t,systemRef:n,executions:r,className:i,children:a,...o})=>{let{tComponent:s,isReady:c}=q({component:d6}),l=_W(),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:G(`flex flex-col gap-card`,i),"aria-label":s(d6,`loading`),...o,children:[(0,$.jsx)(pm,{className:`h-6 w-48`}),(0,$.jsxs)(`div`,{className:`grid gap-card sm:grid-cols-2 lg:grid-cols-3`,children:[(0,$.jsx)(pm,{className:`h-40`}),(0,$.jsx)(pm,{className:`h-40`}),(0,$.jsx)(pm,{className:`h-40`})]})]}):u&&u.length===0?(0,$.jsx)(`div`,{className:G(`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(d6,`noActors`)})}):(0,$.jsxs)(`div`,{className:G(`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(d6,`teamTitle`,{name:e})}),u&&(0,$.jsx)(Z,{as:`span`,size:ha.XS,variant:en.MUTED,children:s(d6,`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)(Jd,{variant:`outline`,className:`text-2xs`,children:s(d6,`roleCount`,{role:h6(e)?s(d6,f6(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)(v6,{actor:e,status:sDe(e,zne(u)?.ref,n,d)},e.ref)):a})]}):null};function sDe(e,t,n,r){if(!r||!n||e.ref!==t)return g6.IDLE;let i=!1;for(let e of r.values())if(e.systemRef===n){if(e.status===uW.RUNNING||e.status===uW.STARTING)return g6.EXECUTING;if(e.status===uW.AWAITING_APPROVAL)return g6.AWAITING_APPROVAL;e.status===uW.COMPLETED&&(i=!0)}return i?g6.COMPLETED:g6.IDLE}var v6=({actor:e,actorRef:t,displayName:n,roleCategory:r,executionMode:i,description:a,agentRef:o,flowRef:s,status:c=g6.IDLE,currentTask:l,onAgentClick:u,onFlowClick:d,className:f,...p})=>{let{tComponent:m,isReady:h}=q({component:d6}),{renderIcon:g}=ef();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(d6,_6(c));return(0,$.jsxs)(wF,{className:G(`flex flex-col`,f),...p,children:[(0,$.jsxs)(EF,{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)(y6,{role:y}),(0,$.jsx)(b6,{mode:b})]}),(0,$.jsxs)(XA,{children:[(0,$.jsx)(ZA,{asChild:!0,children:(0,$.jsx)(`span`,{role:`img`,"aria-label":w,className:G(`inline-block size-2.5 shrink-0 rounded-full`,aDe(c))})}),(0,$.jsx)(QA,{side:hu.TOP,className:`text-xs`,children:w})]})]}),(0,$.jsx)(OF,{className:`text-sm`,children:v}),(0,$.jsx)(AF,{className:`text-xs`,children:_})]}),(0,$.jsxs)(jF,{className:`flex flex-col gap-element`,children:[x&&(0,$.jsx)(Z,{size:ha.XS,variant:en.MUTED,"aria-label":m(d6,`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(d6,`currentTask`),children:[g(W.LOADER_2,{size:tr.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(d6,`linkedAgent`)}: ${S}`,children:[g(W.BRAIN,{size:tr.SM,className:`shrink-0`}),(0,$.jsxs)(`span`,{className:`font-medium`,children:[m(d6,`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(d6,`linkedFlow`)}: ${C}`,children:[g(W.ARROW_RIGHT,{size:tr.SM,className:`shrink-0`}),(0,$.jsxs)(`span`,{className:`font-medium`,children:[m(d6,`linkedFlow`),`:`]}),(0,$.jsx)(`span`,{className:`truncate`,children:C})]})]})]})]})},y6=({role:e,className:t})=>{let{tComponent:n,isReady:r}=q({component:d6}),{renderIcon:i}=ef();if(!r)return null;let a=h6(e),o=a?eDe[e]:void 0,s=a?n(d6,f6(e)):e;return(0,$.jsxs)(Jd,{variant:a?nDe[e]:`secondary`,className:G(`text-2xs gap-1`,t),children:[o&&i(o,{size:tr.XS}),s]})},b6=({mode:e,className:t})=>{let{tComponent:n,isReady:r}=q({component:d6}),{renderIcon:i}=ef();if(!r)return null;let a=rDe(e),o=a?tDe[e]:void 0,s=a?n(d6,p6(e)):e,c=a?n(d6,m6(e)):void 0,l=(0,$.jsxs)(Jd,{variant:`outline`,className:G(`text-2xs gap-1`,t),children:[o&&i(o,{size:tr.XS}),s]});return c?(0,$.jsxs)(XA,{children:[(0,$.jsx)(ZA,{asChild:!0,children:l}),(0,$.jsx)(QA,{side:hu.TOP,className:`text-xs`,children:c})]}):l},cDe=Q.lazy(()=>i_(()=>import(`./flows-actors-graph-runtime-D-xOavtY.js`).then(e=>({default:e.AI_FlowExecutionCanvas})),__vite__mapDeps([13,14,1,3,11,4,5,2,6,7,12,15,16]))),lDe=Q.lazy(()=>i_(()=>import(`./flows-actors-graph-runtime-D-xOavtY.js`).then(e=>({default:e.AI_FlowExecutionSummary})),__vite__mapDeps([13,14,1,3,11,4,5,2,6,7,12,15,16]))),uDe=Q.lazy(()=>i_(()=>import(`./flows-actors-graph-runtime-D-xOavtY.js`).then(e=>({default:e.AI_FlowExecutionTimeline})),__vite__mapDeps([13,14,1,3,11,4,5,2,6,7,12,15,16]))),dDe=Q.lazy(()=>i_(()=>import(`./flows-actors-graph-runtime-D-xOavtY.js`).then(e=>({default:e.AI_FlowExecutionTimelineItem})),__vite__mapDeps([13,14,1,3,11,4,5,2,6,7,12,15,16]))),fDe=Q.lazy(()=>i_(()=>import(`./flows-actors-graph-runtime-D-xOavtY.js`).then(e=>({default:e.AI_GraphViewer})),__vite__mapDeps([13,14,1,3,11,4,5,2,6,7,12,15,16]))),x6=e=>(0,$.jsx)(CJ,{doorName:`AI_GraphViewer`,fallback:(0,$.jsx)(wJ,{className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(pm,{"aria-hidden":`true`,className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(fDe,{...e})})}),pDe=e=>(0,$.jsx)(CJ,{doorName:`AI_FlowExecutionCanvas`,fallback:(0,$.jsx)(wJ,{className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(pm,{"aria-hidden":`true`,className:`h-80 w-full rounded-md`}),children:(0,$.jsx)(cDe,{...e})})}),mDe=e=>(0,$.jsx)(CJ,{doorName:`AI_FlowExecutionSummary`,fallback:(0,$.jsx)(wJ,{className:`h-14 w-full rounded-lg`}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(pm,{"aria-hidden":`true`,className:`h-14 w-full rounded-lg`}),children:(0,$.jsx)(lDe,{...e})})}),S6=e=>(0,$.jsx)(CJ,{doorName:`AI_FlowExecutionTimeline`,fallback:(0,$.jsx)(wJ,{className:`h-40 w-full rounded-md`}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(pm,{"aria-hidden":`true`,className:`h-40 w-full rounded-md`}),children:(0,$.jsx)(uDe,{...e})})}),hDe=e=>(0,$.jsx)(CJ,{doorName:`AI_FlowExecutionTimelineItem`,fallback:(0,$.jsx)(`li`,{"aria-hidden":`true`,className:`ms-4`,children:(0,$.jsx)(wJ,{className:`h-8 w-full`})}),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`li`,{"aria-hidden":`true`,className:`ms-4`,children:(0,$.jsx)(pm,{className:`h-8 w-full`})}),children:(0,$.jsx)(dDe,{...e})})}),C6=K.LOW_LEVEL_AI_SYSTEM_CATALOG,gDe=[`all`,`draft`,`active`,`inactive`,`deprecated`,`archived`];function _De(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 vDe=({className:e,defaultKindFilter:t=`all`,defaultStatusFilter:n=`all`,defaultViewMode:r=`grid`,onSelectSystem:i,onLaunch:a,...o})=>{let{tComponent:s,isReady:c}=q({component:C6}),{systems:l,isLoading:u,error:d,refreshSystems:f}=gW(),[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&&!_De(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)(E6,{system:w,onBack:E,onLaunch:a,className:e,...o}):c?d?(0,$.jsxs)(`div`,{className:G(`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:en.DESTRUCTIVE,children:s(C6,`errorState`)}),(0,$.jsx)(Y,{type:`button`,variant:X.SECONDARY,size:df.SM,onClick:()=>void f(),children:s(C6,`retry`)})]}):(0,$.jsxs)(`div`,{className:G(`flex flex-col gap-card`,e),...o,children:[(0,$.jsx)(yDe,{searchQuery:p,onSearchChange:m,kindFilter:h,onKindFilterChange:g,statusFilter:_,onStatusFilterChange:v,viewMode:y,onViewModeChange:b,systemCount:C.length,totalCount:l.length}),u?(0,$.jsx)(bDe,{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:en.MUTED,children:l.length===0?s(C6,`emptyState`):s(C6,`emptyFilteredState`)})}):y===`grid`?(0,$.jsx)(`div`,{className:`grid gap-card sm:grid-cols-2 lg:grid-cols-3`,children:C.map(e=>(0,$.jsx)(w6,{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)(T6,{system:e,onLaunch:a,onClick:()=>T(e.ref)},e.ref))})]}):null},yDe=({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}=q({component:C6});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)(XM,{type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:u(C6,`searchPlaceholder`),className:`min-w-[180px] max-w-xs flex-1`}),(0,$.jsx)(aO,{value:n,onValueChange:e=>r(e),children:(0,$.jsxs)(oO,{children:[(0,$.jsx)(sO,{value:`all`,children:u(C6,`allKinds`)}),(0,$.jsx)(sO,{value:`flow`,children:u(C6,`kindFlow`)}),(0,$.jsx)(sO,{value:`actor`,children:u(C6,`kindActor`)})]})}),(0,$.jsx)(fF,{name:`statusFilter`,schema:md(),options:gDe.map(e=>({value:e,label:u(C6,`status_${e}`)})),value:i,onChange:e=>a(e),placeholder:u(C6,`filterByStatus`),size:Nf.SM})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-element`,children:[(0,$.jsx)(Z,{as:`span`,size:ha.XS,variant:en.MUTED,children:u(C6,`systemCount`,{count:c,total:l})}),(0,$.jsx)(aO,{value:o,onValueChange:e=>s(e),children:(0,$.jsxs)(oO,{children:[(0,$.jsx)(sO,{value:`grid`,children:u(C6,`gridView`)}),(0,$.jsx)(sO,{value:`list`,children:u(C6,`listView`)})]})})]})]}):null},bDe=({viewMode:e})=>e===`list`?(0,$.jsx)(`div`,{className:`flex flex-col gap-element`,children:Array.from({length:4},(e,t)=>(0,$.jsx)(pm,{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)(pm,{className:`h-52 w-full rounded-lg`},t))}),w6=({system:e,onLaunch:t,className:n,...r})=>{let{tComponent:i,isReady:a}=q({component:C6}),o=e.status===`active`,s=e.frontendRelevantConfig;return a?(0,$.jsxs)(wF,{role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.currentTarget.click())},className:G(`flex cursor-pointer flex-col transition-shadow hover:shadow-[var(--shadow-md)]`,Dg(e_.OFFSET),!o&&`opacity-[var(--opacity-muted)]`,n),...r,children:[(0,$.jsxs)(EF,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(O6,{kind:e.kind}),(0,$.jsx)(k6,{status:e.status}),s.riskLevel!==`low`&&(0,$.jsx)(A6,{level:s.riskLevel})]}),(0,$.jsx)(OF,{className:`text-sm`,children:e.displayName}),(0,$.jsx)(AF,{className:`line-clamp-2 text-xs`,children:e.description})]}),(0,$.jsxs)(jF,{className:`flex flex-col gap-element`,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-element`,children:(0,$.jsx)(Jd,{variant:`outline`,className:`text-2xs`,children:i(C6,`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)(Jd,{variant:`outline`,className:`text-2xs`,children:e.category}),e.tags?.map(e=>(0,$.jsx)(Jd,{variant:`secondary`,className:`text-2xs`,children:e},e))]})]}),t&&(0,$.jsx)(DF,{className:`mt-auto`,children:(0,$.jsx)(Y,{type:`button`,variant:o?X.DEFAULT:X.SECONDARY,disabled:!o,onClick:n=>{n.stopPropagation(),t(e.ref)},className:`w-full`,children:i(C6,`launch`)})})]}):null},T6=({system:e,onLaunch:t,className:n,...r})=>{let{tComponent:i,isReady:a}=q({component:C6}),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:G(`flex cursor-pointer items-center gap-card rounded-lg border bg-card p-card-sm transition-shadow hover:shadow-[var(--shadow-md)]`,Dg(e_.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)(O6,{kind:e.kind}),(0,$.jsx)(k6,{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)(A6,{level:s.riskLevel})})]}),t&&(0,$.jsx)(Y,{type:`button`,variant:o?X.DEFAULT:X.SECONDARY,disabled:!o,size:df.SM,onClick:n=>{n.stopPropagation(),t(e.ref)},children:i(C6,`launch`)})]}):null},E6=({system:e,onBack:t,onLaunch:n,className:r,...i})=>{let{tComponent:a,isReady:o}=q({component:C6}),s=_W(),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:G(`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)(Y,{type:`button`,variant:X.GHOST,size:df.SM,onClick:t,className:`self-start`,children:a(C6,`backToCatalog`)}),(0,$.jsx)(`h2`,{className:`text-lg font-semibold`,children:e.displayName}),(0,$.jsx)(Z,{variant:en.MUTED,children:e.description}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-element`,children:[(0,$.jsx)(O6,{kind:e.kind}),(0,$.jsx)(k6,{status:e.status}),c.riskLevel!==`low`&&(0,$.jsx)(A6,{level:c.riskLevel})]})]}),n&&(0,$.jsx)(Y,{type:`button`,variant:l?X.DEFAULT:X.SECONDARY,disabled:!l,onClick:()=>n(e.ref),children:a(C6,`launch`)})]}),(0,$.jsxs)(aO,{defaultValue:`config`,children:[(0,$.jsxs)(oO,{children:[(0,$.jsx)(sO,{value:`config`,children:a(C6,`detailConfig`)}),e.kind===`flow`&&(0,$.jsx)(sO,{value:`preview`,children:a(C6,`flowPreview`)}),e.kind===`actor`&&(0,$.jsx)(sO,{value:`preview`,children:a(C6,`actorTeamPreview`)}),(0,$.jsx)(sO,{value:`executions`,children:a(C6,`executionHistory`)})]}),(0,$.jsx)(cO,{value:`config`,children:(0,$.jsxs)(`div`,{className:`grid gap-card sm:grid-cols-2`,children:[(0,$.jsxs)(wF,{children:[(0,$.jsx)(EF,{children:(0,$.jsx)(OF,{className:`text-sm`,children:a(C6,`detailConfig`)})}),(0,$.jsxs)(jF,{className:`flex flex-col gap-element text-sm`,children:[(0,$.jsx)(D6,{label:a(C6,`scope`),value:a(C6,`scope_${c.primaryScope}`)}),(0,$.jsx)(D6,{label:a(C6,`riskLevel`),value:(0,$.jsx)(A6,{level:c.riskLevel})})]})]}),(0,$.jsxs)(wF,{children:[(0,$.jsx)(EF,{children:(0,$.jsx)(OF,{className:`text-sm`,children:a(C6,`detailMetadata`)})}),(0,$.jsxs)(jF,{className:`flex flex-col gap-element text-sm`,children:[(0,$.jsx)(D6,{label:a(C6,`detailRef`),value:e.ref}),(0,$.jsx)(D6,{label:a(C6,`detailKind`),value:e.kind}),(0,$.jsx)(D6,{label:a(C6,`detailStatus`),value:e.status}),e.category&&(0,$.jsx)(D6,{label:a(C6,`detailCategory`),value:e.category}),e.tags&&e.tags.length>0&&(0,$.jsx)(D6,{label:a(C6,`detailTags`),value:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-element`,children:e.tags.map(e=>(0,$.jsx)(Jd,{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)(D6,{label:e,value:t},e))})]})]})]})}),(0,$.jsx)(cO,{value:`preview`,children:(0,$.jsx)(wF,{children:(0,$.jsx)(jF,{className:`p-card`,children:(0,$.jsx)(Z,{variant:en.MUTED,children:e.kind===`flow`?a(C6,`flowPreviewPlaceholder`):a(C6,`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:en.MUTED,children:a(C6,`noExecutions`)})}):(0,$.jsx)(Wd,{className:`max-h-96`,children:(0,$.jsx)(`div`,{className:`flex flex-col gap-element`,children:u.map(e=>(0,$.jsx)(SDe,{execution:e},e.executionId))})})})]})]}):null},D6=({label:e,value:t})=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-card`,children:[(0,$.jsx)(Z,{as:`span`,size:ha.XS,variant:en.MUTED,className:`font-medium`,children:e}),(0,$.jsx)(Z,{as:`span`,size:ha.XS,className:`text-end`,children:t})]}),xDe={[uW.IDLE]:`outline`,[uW.STARTING]:`secondary`,[uW.RUNNING]:`default`,[uW.AWAITING_APPROVAL]:`secondary`,[uW.COMPLETED]:`default`,[uW.CANCELLED]:`outline`,[uW.ERROR]:`destructive`},SDe=({execution:e})=>{let{tComponent:t,isReady:n}=q({component:C6});return n?(0,$.jsxs)(`div`,{className:`flex items-center gap-card rounded-lg border bg-card p-card-sm`,children:[(0,$.jsx)(Jd,{variant:xDe[e.status]??`secondary`,className:`text-2xs`,children:t(C6,`execStatus_${e.status}`)}),(0,$.jsx)(Z,{as:`span`,size:ha.XS,variant:en.MUTED,className:`flex-1 truncate`,children:e.executionId})]}):null},O6=({kind:e,className:t})=>{let{tComponent:n,isReady:r}=q({component:C6});return r?(0,$.jsx)(Jd,{variant:e===`flow`?`default`:`secondary`,className:G(`text-2xs`,t),children:e===`flow`?n(C6,`kindFlow`):n(C6,`kindActor`)}):null},CDe={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)]`}},k6=({status:e,className:t})=>{let{tComponent:n,isReady:r}=q({component:C6}),i=CDe[e]??{variant:`secondary`};return r?(0,$.jsx)(Jd,{variant:i.variant,className:G(`text-2xs`,i.extraClass,t),children:n(C6,`status_${e}`)}):null},wDe={low:{variant:`outline`},medium:{variant:`secondary`,extraClass:`text-warning-subtle-foreground`},high:{variant:`destructive`},critical:{variant:`destructive`,extraClass:`animate-pulse`}},A6=({level:e,className:t})=>{let{tComponent:n,isReady:r}=q({component:C6}),i=wDe[e]??{variant:`outline`};return r?(0,$.jsx)(Jd,{variant:i.variant,className:G(`text-2xs`,i.extraClass,t),children:n(C6,`riskLevel_${e}`)}):null},j6=K.LOW_LEVEL_AI_EXECUTION_PLAN,TDe=[Do.COMPLETED,Do.PROCESSING,Do.AWAITING_APPROVAL,Do.FAILED],M6=({plan:e,className:t,...n})=>{let{tComponent:r,isReady:i}=q({component:j6}),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:G(`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(j6,`title`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.goalDescription})]}),(0,$.jsx)(yf,{status:e.status})]}),(0,$.jsx)(P6,{total:e.planSteps.length,statusCounts:o}),(0,$.jsx)(Wd,{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)(N6,{step:e,index:t,resolvedStatus:n?.status??e.status,statusChanges:n?.statusChanges,nameOfStep:s},e._id)})})})]}):null},N6=({step:e,index:t,resolvedStatus:n,statusChanges:r,nameOfStep:i,className:a,...o})=>{let{tComponent:s,isReady:c,formatTime:l,formatList:u}=q({component:j6}),{statusWord:d,isReady:f}=mf(),{word:p,isReady:m}=Yf(gf),{renderIcon:h}=ef(),g=Q.useMemo(()=>tee(e),[e]),[_,v]=Q.useState(!1),y=g.length>0||r&&r.length>0;return!c||!f||!m?null:(0,$.jsxs)(`li`,{className:G(`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:G(`size-2.5 shrink-0 rounded-full`,Kf(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)(Jd,{variant:`outline`,className:`text-2xs`,children:p(e.topic)}),(0,$.jsx)(yf,{status:n})]}),e.description&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description}),y&&(0,$.jsxs)(bO,{open:_,onOpenChange:v,children:[(0,$.jsx)(xO,{asChild:!0,children:(0,$.jsxs)(Y,{type:`button`,variant:X.LINK,size:df.SM,className:`h-auto p-0 text-2xs`,children:[h(_?W.CHEVRON_DOWN:W.CHEVRON_RIGHT,{size:tr.XS}),s(j6,`stepDetails`)]})}),(0,$.jsxs)(SO,{className:`mt-1 flex flex-col gap-1`,children:[g.length>0&&(0,$.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:s(j6,`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:G(`size-1.5 rounded-full`,Kf(e.status))}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:d(e.status)}),(0,$.jsx)(`time`,{className:`text-muted-foreground`,dateTime:e.timestamp,children:Wf.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(j6,`stepCreatedAt`,{time:Wf.formatTimestamp(e.createdAt,l)})})})]})]})]})]})},P6=({total:e,statusCounts:t,className:n,...r})=>{let{tComponent:i,isReady:a}=q({component:j6}),{statusWord:o,isReady:s}=mf(),c=t[Do.COMPLETED]??0,l=e>0?Math.round(c/e*100):0,u=TDe.flatMap(n=>{let r=t[n]??0;return r>0&&e>0?[{status:n,width:r/e*100}]:[]}),d=Object.values(Do).flatMap(e=>{let n=t[e]??0;return e!==Do.COMPLETED&&n>0?[{status:e,count:n}]:[]});return!a||!s?null:(0,$.jsxs)(`div`,{className:G(`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(j6,`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:G(`h-full motion-safe:transition-all`,Kf(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:G(`inline-block size-1.5 rounded-full`,Kf(e))}),i(j6,`progressLegendEntry`,{status:o(e),count:t})]},e))})]})},F6=K.LOW_LEVEL_AI_TASK_MEMORY,EDe={short_term:`⚡`,long_term:`📦`,working:`🔧`},DDe=({memory:e,className:t,...n})=>{let{tComponent:r,isReady:i}=q({component:F6}),a=e.shortTerm.entries.length+e.longTerm.entries.length+e.working.entries.length;return i?(0,$.jsxs)(`div`,{className:G(`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(F6,`title`)}),(0,$.jsx)(Jd,{variant:`secondary`,className:`text-2xs`,children:a})]}),(0,$.jsx)(I6,{scope:`short_term`,label:r(F6,`shortTerm`),store:e.shortTerm,defaultOpen:!0}),(0,$.jsx)(I6,{scope:`long_term`,label:r(F6,`longTerm`),store:e.longTerm}),(0,$.jsx)(I6,{scope:`working`,label:r(F6,`working`),store:e.working})]}):null},I6=({scope:e,label:t,store:n,defaultOpen:r=!1,className:i,...a})=>{let{tComponent:o,isReady:s}=q({component:F6}),c=EDe[e]??`📋`;return s?(0,$.jsxs)(bO,{defaultOpen:r,className:G(`rounded-md border`,i),...a,children:[(0,$.jsx)(xO,{asChild:!0,children:(0,$.jsxs)(Y,{type:`button`,variant:X.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)(Jd,{variant:`secondary`,className:`text-2xs`,children:n.entries.length})]})}),(0,$.jsx)(SO,{children:(0,$.jsx)(Wd,{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)(L6,{entry:e},e.key)),n.entries.length===0&&(0,$.jsx)(`span`,{className:`text-2xs text-muted-foreground italic`,children:o(F6,`scopeEmpty`)})]})})})]}):null},L6=({entry:e,className:t,...n})=>{let{tComponent:r,isReady:i,formatDateTime:a}=q({component:F6}),o=e.expiresAt?new Date(e.expiresAt).getTime()<Date.now():!1;return i?(0,$.jsxs)(`div`,{className:G(`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)(Jd,{variant:`outline`,className:`text-2xs`,children:e.type}),o&&(0,$.jsx)(Jd,{variant:`destructive`,className:`text-2xs`,children:r(F6,`expired`)}),e.expiresAt&&!o&&(0,$.jsxs)(`span`,{className:`text-2xs text-muted-foreground`,children:[r(F6,`expires`),`: `,(0,$.jsx)(`time`,{dateTime:e.expiresAt,children:Wf.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(F6,`metadata`),`:`]}),Object.entries(e.metadata).map(([e,t])=>(0,$.jsxs)(Jd,{variant:`outline`,className:`text-2xs`,children:[e,`: `,String(t)]},e))]}),(0,$.jsx)(`time`,{className:`text-2xs text-muted-foreground/60`,dateTime:e.timestamp,children:Wf.formatTimestamp(e.timestamp,a)})]}):null},R6=new WeakMap;function ODe(e){let{doOperation:t,operationPathKey:n,contextualParameters:r,executionId:i}=e,a=R6.get(t);a||(a=new Map,R6.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),kDe(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 kDe(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 ADe=Object.freeze({});function z6(e,t){return U.buildConfigurationError(Lu.CONFIGURATION,{message:e,component:`useEmbeddedResourceContext`,...t})}function B6(e){return typeof e.operationIdentifier==`string`}function jDe(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 z6(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?Nm({operation:s,resourceType:t,resourceConfig:e}):!1;if(e&&c&&s.isBulkOperation!==!0&&!Bh({resourceConfig:e,operation:s,registry:r,hasResourceId:kn.getResourceId(i[t]).length>0,contextResourceIdentifiers:i,contextualParameters:U.buildContextualParameters(i,r)}))throw z6(`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 V6(e){return e.hostResourceType!==void 0&&e.target.resourceType===e.hostResourceType&&!e.target.resourceId&&!Ao(e.operation)&&kn.selfReferenceForeignKeysOf(e.hostResourceType,e.registry).length>0}function H6(){let e=AU(),{registry:t}=fm(),n=e?.hostResourceType,r=e?.contextResourceIdentifiers??ADe,i=(0,Q.useMemo)(()=>{if(!n)return;let e=t.resourceConfigurations[n];if(!e)throw z6(`Composite resource runtime cannot resolve host resource "${n}" from the registry.`,{hostResourceType:n});return e},[n,t.resourceConfigurations]),a=(0,Q.useMemo)(()=>n?kn.buildParentResourcesRequirements(n,r,t):[],[r,n,t]),o=(0,Q.useMemo)(()=>{if(i)return fh({resourceConfig:i,operations:i.operations??[],coreOperation:J.READ,registry:t,hasResourceId:n?kn.getResourceId(r[n]).length>0:!1,requireFrontendAddressable:!0,contextResourceIdentifiers:r,contextualParameters:U.buildContextualParameters(r,t)})??i.operations?.[0]},[r,i,n,t]),s=(0,Q.useCallback)(e=>{let a=e.resourceType??n;if(!a)throw z6(`Composite resource runtime is only available inside resource-scoped composite views.`,{target:e});let o=a===n?i:t.resourceConfigurations[a];if(B6(e))return jDe(o,a,e,t,r);let s=e.operationLike===J.READ||e.operationLike===J.UPDATE||e.operationLike===J.DELETE,c=e.requireAddressable||s?o?fh({resourceConfig:o,operations:o.operations??[],coreOperation:e.operationLike,registry:t,hasResourceId:kn.getResourceId(r[a]).length>0,allowBulk:e.allowBulk,requireFrontendAddressable:!0,contextResourceIdentifiers:r,contextualParameters:U.buildContextualParameters(r,t)}):void 0:Gl(o?.operations??[],e.operationLike,{requireAddressable:e.requireAddressable,allowBulk:e.allowBulk});if(!c)throw z6(`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 z6(`Composite resource runtime is only available inside resource-scoped composite views.`,{target:e});let l=e.resourceType??n,u=s({resourceType:l,...B6(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=V6({target:e,hostResourceType:n,operation:u,registry:t});if(l===n&&!d){let i=kn.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=kn.buildParentResourcesRequirements(n,a,t,e.relationshipFieldOverrides),s=kn.createFrontendResourceOperationContextFromOperation({resourceType:n,operation:u,contextResourceIdentifiers:a,additionalContext:e.additionalContext,parentResourcesRequirements:o});return c&&e.pinnedFilters&&Object.keys(e.pinnedFilters).length>0?UG({childContext:s,hostResourceType:n,hostResourceId:void 0,hostRelationships:void 0,selectedForeignKey:void 0,callerPinnedFilters:e.pinnedFilters,registry:t}):s}if(!o)throw z6(`Composite resource runtime cannot derive related resource operations from host "${n}" because no host operation is configured.`,{hostResourceType:n,targetResourceType:l});let f=kn.createFrontendResourceOperationContextFromOperation({resourceType:n,operation:o,contextResourceIdentifiers:r,parentResourcesRequirements:a}),p=kn.deriveChildResourceContext(f,{resourceType:l,operationIdentifier:String(u.operationIdentifier),operation:u,resourceId:e.resourceId,relationshipFieldOverrides:e.relationshipFieldOverrides,additionalContext:e.additionalContext},t);return c?UG({childContext:p,hostResourceType:n,hostResourceId:kn.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=>U.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:kn.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 U6(){let e=H6();if(!e)throw z6(`useEmbeddedResourceContext() must be used within a resource-scoped CompositeView.`);return e}var W6=K.LOW_LEVEL_AI_EXECUTION_USAGE,G6;(function(e){e.LOADING=`loading`,e.READY=`ready`,e.FAILED=`failed`})(G6||={});function K6(e,t){return e.disclosure===la.TOKENS_AND_COST?e.costs.flatMap(e=>{let n=_0(e.costMinor,e.currency,t);return n===void 0?[]:[{currency:e.currency,amount:n}]}):[]}function q6(e){return(t,n)=>e(W6,t,n)}function J6({readState:e,usage:t,className:n}){let{formatNumber:r,...i}=q({component:W6}),a=q6(i.tComponent);if(e===G6.LOADING)return null;if(e===G6.FAILED||!t)return(0,$.jsx)(`p`,{role:`status`,className:G(`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:G(`text-sm text-muted-foreground`,n),"data-execution-usage":`empty`,children:a(`noCalls`)});let o=K6(t,r),s=t.disclosure===la.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:G(`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 Y6({className:e}){let t=H6(),{registry:n,doOperation:r}=fm(),i=(0,Q.useMemo)(()=>{if(!t?.hostResourceId)return;let e={resourceType:t.hostResourceType,resourceId:t.hostResourceId,operationIdentifier:An.USAGE,isOperationDefault:!0};if(!t.canBuildOperationContext(e))return;let r=t.buildOperationContext(e);return{operationPathKey:no.createOperationPathKeyFromOperation(r.operation),contextualParameters:U.buildContextualParameters(r.contextResourceIdentifiers,n),parentResourcesRequirements:r.parentResourcesRequirements}},[t,n]),[a,o]=(0,Q.useState)({state:G6.LOADING});return(0,Q.useEffect)(()=>{if(!i)return;let e=!0;return o({state:G6.LOADING}),r(i.operationPathKey,{contextualParameters:i.contextualParameters,parentResourcesRequirements:i.parentResourcesRequirements}).then(t=>{e&&o({state:G6.READY,usage:t})}).catch(()=>{e&&o({state:G6.FAILED})}),()=>{e=!1}},[i,r]),i?(0,$.jsx)(J6,{readState:a.state,...a.usage?{usage:a.usage}:{},...e?{className:e}:{}}):null}function X6({readState:e,usage:t,className:n}){let{formatNumber:r,...i}=q({component:W6}),a=q6(i.tComponent);if(e===G6.LOADING)return null;let o=(e,t)=>(0,$.jsx)(`span`,{className:G(`text-xs text-muted-foreground tabular-nums`,n),"data-execution-usage-summary":t,children:e});return e===G6.FAILED||!t?o(a(`readFailed`),G6.FAILED):t.callCount===0&&t.classifierCallCount===0&&t.documentExtractionCallCount===0?o(a(`noCalls`),`empty`):o([a(`summaryTokens`,{tokens:r(t.totalTokens)}),...K6(t,r).map(e=>e.amount)].join(` · `),e)}function Z6({className:e}){let t=bR()?.resourceType,n=tk()?.data,r=oj().contextualParameters,{registry:i,doOperation:a}=fm(),o=typeof n?.executionId==`string`&&n.executionId!==``?n.executionId:void 0,s=(0,Q.useMemo)(()=>[...qt.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===An.USAGES&&e.isOperationDefault):void 0;return e?no.createOperationPathKeyFromOperation(e):void 0},[i,t]),[u,d]=(0,Q.useState)({state:G6.LOADING});return(0,Q.useEffect)(()=>{if(!o||!l||!s||typeof c!=`string`||c===``)return;let e=!0;return d({state:G6.LOADING}),ODe({doOperation:a,operationPathKey:l,contextualParameters:{[s]:c},executionId:o}).then(t=>{e&&d(t?{state:G6.READY,usage:t}:{state:G6.FAILED})}).catch(()=>{e&&d({state:G6.FAILED})}),()=>{e=!1}},[a,o,l,s,c]),!o||!l||typeof c!=`string`||c===``?null:(0,$.jsx)(X6,{readState:u.state,...u.usage?{usage:u.usage}:{},...e?{className:e}:{}})}function Q6(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===_e.CHOICE?i[a.key]=Object.fromEntries((a.request.options??[]).map(e=>[e,Ite(a.request,e)])):a.request.kind===_e.CONFIRM&&(i[a.key]={...t});let a=e.layout.kind===mo.SECTIONS?e.layout.sections:e.layout.kind===mo.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 $6=Q.createContext(null);function e8(){let e=Q.useContext($6),{control:t}=LC(),n=NC({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 MDe(){let e=Q.useContext($6);if(!e)return null;let{layout:t,fields:n}=e.compiled;if(t.kind===mo.FLAT)return(0,$.jsxs)(Zk,{autoInjectSubmitButton:!1,children:[n.map(e=>(0,$.jsx)(JL,{name:e.key},e.key)),(0,$.jsx)(e8,{})]});let r=t.kind===mo.SECTIONS?t.appearance:ci.STEPPER,i=t.kind===mo.SECTIONS?t.sections:t.steps;return(0,$.jsxs)(Zk,{autoInjectSubmitButton:!1,children:[i.map(e=>(0,$.jsx)(Wk,{name:e.name,appearance:r,children:e.keys.map(e=>(0,$.jsx)(JL,{name:e},e))},e.name)),(0,$.jsx)(e8,{})]})}var NDe=()=>void 0;function t8(e){let t=JSON.stringify(e);return Q.useMemo(()=>e,[t])}function n8({fields:e,form:t,confirmWords:n,disabled:r,onReady:i,onCompleteChange:a,className:o}){let s=t8(e),c=t8(t),l=t8(n),u=Q.useMemo(()=>Ro({fields:[...s],form:c}),[s,c]),d=Q.useMemo(()=>Q6(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:Bu(n[e.key])}))}})},[u,i]);return(0,$.jsx)(`div`,{className:o,"data-human-decision-form":``,children:(0,$.jsx)($6.Provider,{value:p,children:(0,$.jsx)(eE,{schema:u.schema,onSubmit:NDe,labels:d,disabled:r,layoutTemplate:MDe,onFormReady:m})})})}var r8=rc(K.LOW_LEVEL_AI_ARTIFACT_LIST,`AI_ArtifactList`,[`Item`,`Origin`,`TextContent`,`FileContent`,`StructuredContent`]);function i8({preset:e=H.DEFAULT,...t}){let n=r8(e);return(0,$.jsx)(n,{...t})}function a8({preset:e=H.DEFAULT,...t}){let n=r8(e);return(0,$.jsx)(n.Item,{...t})}function PDe({preset:e=H.DEFAULT,...t}){let n=r8(e);return(0,$.jsx)(n.Origin,{...t})}function FDe({preset:e=H.DEFAULT,...t}){let n=r8(e);return(0,$.jsx)(n.TextContent,{...t})}function IDe({preset:e=H.DEFAULT,...t}){let n=r8(e);return(0,$.jsx)(n.FileContent,{...t})}function LDe({preset:e=H.DEFAULT,...t}){let n=r8(e);return(0,$.jsx)(n.StructuredContent,{...t})}var RDe={[Zc.TEXT]:`TEXT`,[Zc.FILE]:`FILE`,[Zc.RAW_DATA]:`RAW_DATA`,[Zc.STRUCTURED]:`STRUCTURED`};function o8(e){let t=e.content;return{ref:e.ref,name:e.name,type:RDe[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 zDe({artifacts:e,...t}){let n=Q.useMemo(()=>e.map(o8),[e]);return(0,$.jsx)(i8,{items:n,...t})}function BDe({artifact:e,...t}){let n=Q.useMemo(()=>o8(e),[e]);return(0,$.jsx)(a8,{item:n,...t})}function s8({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_AGENT_LIST,`AI_AgentList`)(e);return(0,$.jsx)(n,{...t})}function c8({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_AGENT_CARD,`AI_AgentCard`)(e);return(0,$.jsx)(n,{...t})}function VDe({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_AGENT_PROMPT_SPEC,`AI_AgentPromptSpec`)(e);return(0,$.jsx)(n,{...t})}function HDe({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_AGENT_CAPABILITIES,`AI_AgentCapabilities`)(e);return(0,$.jsx)(n,{...t})}var UDe={[Ba.ACTIVE]:`ACTIVE`,[Ba.INACTIVE]:`INACTIVE`,[Ba.DEPRECATED]:`DEPRECATED`},WDe={[$a.GENERATION]:`GENERATION`,[$a.ANALYSIS]:`ANALYSIS`,[$a.TRANSFORMATION]:`TRANSFORMATION`,[$a.DECISION]:`DECISION`,[$a.CHAT]:`CHAT`,[$a.CUSTOM]:`CUSTOM`},GDe={[Bn.SECURITY]:`SECURITY`,[Bn.SAFETY]:`SAFETY`,[Bn.PRIVACY]:`PRIVACY`,[Bn.SCOPE]:`SCOPE`,[Bn.COMPLIANCE]:`COMPLIANCE`};function l8(e){let t=e.promptSpec;return{ref:e.ref,displayName:e.displayName,status:UDe[e.status]??`INACTIVE`,promptSpec:{role:t.role,persona:t.persona,skillType:WDe[t.skillType]??`CUSTOM`,constraints:t.constraints?.map(e=>({id:e.id,text:e.text,type:GDe[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 KDe({agents:e,...t}){let n=Q.useMemo(()=>e.map(l8),[e]);return(0,$.jsx)(s8,{agents:n,...t})}function qDe({agent:e,...t}){let n=Q.useMemo(()=>l8(e),[e]);return(0,$.jsx)(c8,{agent:n,...t})}var u8=Q.forwardRef(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_ACTION_BUTTON,`ActionButton`)(e);return(0,$.jsx)(r,{...t,ref:n})});u8.displayName=`ActionButton`;function d8({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_BUTTON_GROUP,`ButtonGroup`)(e);return(0,$.jsx)(n,{...t})}function f8({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_BUTTON_GROUP_TEXT,`ButtonGroupText`)(e);return(0,$.jsx)(n,{...t})}function JDe({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_BUTTON_GROUP_SEPARATOR,`ButtonGroupSeparator`)(e);return(0,$.jsx)(n,{...t})}function p8({as:e=`span`,children:t,className:n,textClassName:r,maxWidth:i=`100%`,tooltipSide:a=hu.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:G(`block truncate text-start`,r),style:{maxWidth:i},...c,children:t});return u||s?(0,$.jsxs)(XA,{delayDuration:o,children:[(0,$.jsx)(ZA,{asChild:!0,children:(0,$.jsx)(f,{className:G(`inline-block w-full`,n),children:m})}),(0,$.jsx)(QA,{side:a,children:t})]}):(0,$.jsx)(f,{className:G(`inline-block w-full`,n),children:m})}var m8=rc(K.LOW_LEVEL_AVATAR,`Avatar`,[`Image`,`Fallback`]);function h8({preset:e=H.DEFAULT,...t}){let n=m8(e);return(0,$.jsx)(n,{...t})}function g8({preset:e=H.DEFAULT,...t}){let n=m8(e);return(0,$.jsx)(n.Image,{...t})}function _8({preset:e=H.DEFAULT,...t}){let n=m8(e);return(0,$.jsx)(n.Fallback,{...t})}function v8({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_NOTIFICATION_INDICATOR,`NotificationIndicator`)(e);return(0,$.jsx)(n,{...t})}v8.displayName=`NotificationIndicator`;function y8({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_IDENTIFIER,`Identifier`)(e);return(0,$.jsx)(n,{...t})}y8.displayName=`Identifier`;function b8({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DURATION,`Duration`)(e);return(0,$.jsx)(n,{...t})}b8.displayName=`Duration`;function x8({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{My(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 Xr.NONE:return;case Xr.OVERLAY:i?.();return;case Xr.DOWNLOAD:c();return;case Xr.NEW_TAB:t.url&&window.open(t.url,`_blank`,`noopener,noreferrer`);return;case Xr.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!==Xr.NONE&&(e.policy===Xr.OVERLAY?i:e.policy===Xr.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:Xr.NONE},[l,e.policy,s,t.url,o,i])}function S8({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_FILE_IMAGE,`DisplayFieldFileImage`)(e);return(0,$.jsx)(n,{...t})}function C8({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_FILE_VIDEO,`DisplayFieldFileVideo`)(e);return(0,$.jsx)(n,{...t})}function w8({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_FILE_AUDIO,`DisplayFieldFileAudio`)(e);return(0,$.jsx)(n,{...t})}function T8({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_FILE_DOCUMENT,`DisplayFieldFileDocument`)(e);return(0,$.jsx)(n,{...t})}function E8({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DISPLAY_FIELD_FILE_GALLERY,`DisplayFieldFileGallery`)(e);return(0,$.jsx)(n,{...t})}var YDe=qc(K.APPLICATION_LEVEL_NOTIFICATION_CENTER,`NotificationCenter`),D8=({preset:e=H.DEFAULT})=>{let{notifications:t,removeNotification:n,clearAll:r}=Fm(),{tComponent:i,isReady:a}=q({component:K.APPLICATION_LEVEL_NOTIFICATION_CENTER}),o=(0,Q.useMemo)(()=>gm(i,K.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=YDe(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};D8.displayName=`AppNotificationCenter`;var O8=({preset:e})=>{let{notifications:t}=Fm(),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:To(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)(D8,{preset:e})})]})};O8.displayName=`AppLayout_NotificationCenter`;function k8({name:e,renderItem:t,sectionAppearance:n,objectItemLayout:r,className:i}){return(0,$.jsx)(JL,{name:e,renderField:t,sectionAppearance:n,objectItemLayout:r,className:i})}k8.displayName=`FormFieldArray`,yk(k8,gk.FIELD_SLOT);function A8({name:e,renderItem:t,sectionAppearance:n=ci.GHOST,objectItemLayout:r,className:i,hideLabel:a,labelPlacement:o,hideDescription:s,labelStyle:c}){return(0,$.jsx)(_R,{name:e,renderField:t,sectionAppearance:n,objectItemLayout:r,labelStyle:c,className:i,hideLabel:a,labelPlacement:o,hideDescription:s})}A8.displayName=`DisplayFieldArray`;var XDe=kl(K.LOW_LEVEL_CALENDAR,`Calendar`),ZDe=kl(K.LOW_LEVEL_CALENDAR_DAY_BUTTON,`CalendarDayButton`),j8=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=XDe(e);return(0,$.jsx)(r,{...t,ref:n})});j8.displayName=`Calendar`;var M8=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=ZDe(e);return(0,$.jsx)(r,{...t,ref:n})});M8.displayName=`CalendarDayButton`;function N8({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_INLINE_EDIT_TEXT,`InlineEditText`)(e);return(0,$.jsx)(n,{...t})}N8.displayName=`InlineEditText`;var P8=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_FILE_UPLOAD,`FileUpload`)(e);return(0,$.jsx)(r,{...t,ref:n})});P8.displayName=`FileUpload`;var F8;(function(e){e.DEFAULT=`default`,e.OUTLINE=`outline`})(F8||={});var I8=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=kl(K.LOW_LEVEL_TOGGLE,`Toggle`)(e);return(0,$.jsx)(r,{...t,ref:n})});I8.displayName=`Toggle`;function QDe({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_FORM,`FormRoot`)(e);return(0,$.jsx)(n,{...t})}function $De({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_FORM_ITEM,`FormItem`)(e);return(0,$.jsx)(n,{...t})}function eOe({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_FORM_LABEL,`FormLabel`)(e);return(0,$.jsx)(n,{...t})}function tOe({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_FORM_CONTROL,`FormControl`)(e);return(0,$.jsx)(n,{...t})}function nOe({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_FORM_DESCRIPTION,`FormDescription`)(e);return(0,$.jsx)(n,{...t})}function rOe({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_FORM_MESSAGE,`FormMessage`)(e);return(0,$.jsx)(n,{...t})}function iOe({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_FORM_FIELD,`FormFieldPrimitive`)(e);return(0,$.jsx)(n,{...t})}var L8=Q.createContext({}),R8=Q.createContext({}),z8=()=>{let e=Q.useContext(L8),t=Q.useContext(R8),{getFieldState:n}=LC(),r=OC({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 aOe({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_ASPECT_RATIO,`AspectRatio`)(e);return(0,$.jsx)(n,{...t})}var B8=rc(K.LOW_LEVEL_CAROUSEL,`Carousel`,[`Content`,`Item`,`Previous`,`Next`]);function V8({preset:e=H.DEFAULT,...t}){let n=B8(e);return(0,$.jsx)(n,{...t})}function H8({preset:e=H.DEFAULT,...t}){let n=B8(e);return(0,$.jsx)(n.Content,{...t})}function U8({preset:e=H.DEFAULT,...t}){let n=B8(e);return(0,$.jsx)(n.Item,{...t})}function oOe({preset:e=H.DEFAULT,...t}){let n=B8(e);return(0,$.jsx)(n.Previous,{...t})}function sOe({preset:e=H.DEFAULT,...t}){let n=B8(e);return(0,$.jsx)(n.Next,{...t})}function cOe({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_DIVIDER,`Divider`)(e);return(0,$.jsx)(n,{...t})}function W8({notificationBadgeRef:e,label:t,className:n}){let{registry:r}=fm(),{getBadgeState:i}=QQ(),a=e?r.notificationBadgeDefinitions.find(t=>Fo(t)===e):void 0;if(!a)return null;let{count:o,pulse:s}=i(a),c=t?.trim()?t:ps(Fo(a));return(0,$.jsx)(v8,{mode:a.display.mode,tone:a.display.tone,count:o,pulse:s,label:c,className:n})}W8.displayName=`NavigationItemBadge`;var G8=rc(K.LOW_LEVEL_MENU_BAR,`Menubar`,[`Menu`,`Trigger`,`Content`,`Group`,`Item`,`CheckboxItem`,`RadioGroup`,`RadioItem`,`Label`,`Separator`,`Shortcut`,`Sub`,`SubTrigger`,`SubContent`]);function lOe({preset:e=H.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n,{...t})}function uOe({preset:e=H.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.Menu,{...t})}var K8=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=G8(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});K8.displayName=`MenubarTrigger`;var q8=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=G8(e);return(0,$.jsx)(r.Content,{...t,ref:n})});q8.displayName=`MenubarContent`;function dOe({preset:e=H.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.Group,{...t})}function fOe({preset:e=H.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.Item,{...t})}function pOe({preset:e=H.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.CheckboxItem,{...t})}function mOe({preset:e=H.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.RadioGroup,{...t})}function hOe({preset:e=H.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.RadioItem,{...t})}function gOe({preset:e=H.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.Label,{...t})}function _Oe({preset:e=H.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.Separator,{...t})}function vOe({preset:e=H.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.Shortcut,{...t})}function yOe({preset:e=H.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.Sub,{...t})}function bOe({preset:e=H.DEFAULT,...t}){let n=G8(e);return(0,$.jsx)(n.SubTrigger,{...t})}var J8=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=G8(e);return(0,$.jsx)(r.SubContent,{...t,ref:n})});J8.displayName=`MenubarSubContent`;var Y8=rc(K.LOW_LEVEL_NAVBAR,`NavigationMenu`,[`List`,`Item`,`Content`,`Trigger`,`Link`,`Indicator`,`Viewport`]);function xOe({preset:e=H.DEFAULT,...t}){let n=Y8(e);return(0,$.jsx)(n,{...t})}function SOe({preset:e=H.DEFAULT,...t}){let n=Y8(e);return(0,$.jsx)(n.List,{...t})}function COe({preset:e=H.DEFAULT,...t}){let n=Y8(e);return(0,$.jsx)(n.Item,{...t})}function wOe({preset:e=H.DEFAULT,...t}){let n=Y8(e);return(0,$.jsx)(n.Content,{...t})}function TOe({preset:e=H.DEFAULT,...t}){let n=Y8(e);return(0,$.jsx)(n.Trigger,{...t})}function EOe({preset:e=H.DEFAULT,...t}){let n=Y8(e);return(0,$.jsx)(n.Link,{...t})}function DOe({preset:e=H.DEFAULT,...t}){let n=Y8(e);return(0,$.jsx)(n.Indicator,{...t})}function OOe({preset:e=H.DEFAULT,...t}){let n=Y8(e);return(0,$.jsx)(n.Viewport,{...t})}var X8;(function(e){e.SIDEBAR=`sidebar`,e.FLOATING=`floating`,e.INSET=`inset`})(X8||={});var Z8;(function(e){e.OFFCANVAS=`offcanvas`,e.ICON=`icon`,e.NONE=`none`})(Z8||={});var Q8;(function(e){e.DEFAULT=`default`,e.OUTLINE=`outline`})(Q8||={});var $8=rc(K.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 kOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n,{...t})}function AOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Content,{...t})}function jOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Footer,{...t})}function MOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Group,{...t})}function NOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.GroupAction,{...t})}function POe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.GroupContent,{...t})}function FOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.GroupLabel,{...t})}function IOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Header,{...t})}function LOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Input,{...t})}function ROe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Inset,{...t})}function zOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Menu,{...t})}function BOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.MenuAction,{...t})}function VOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.MenuBadge,{...t})}function HOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.MenuButton,{...t})}function UOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.MenuItem,{...t})}function WOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.MenuSkeleton,{...t})}function GOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.MenuSub,{...t})}function KOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.MenuSubButton,{...t})}function qOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.MenuSubItem,{...t})}function JOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Provider,{...t})}function YOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Rail,{...t})}function XOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Separator,{...t})}function ZOe({preset:e=H.DEFAULT,...t}){let n=$8(e);return(0,$.jsx)(n.Trigger,{...t})}var e5=rc(K.LOW_LEVEL_CONTEXT_MENU,`ContextMenu`,[`Trigger`,`Content`,`Group`,`Item`,`CheckboxItem`,`RadioGroup`,`RadioItem`,`Label`,`Separator`,`Shortcut`,`Sub`,`SubTrigger`,`SubContent`]);function QOe({preset:e=H.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n,{...t})}function $Oe({preset:e=H.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Trigger,{...t})}var t5=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=e5(e);return(0,$.jsx)(r.Content,{...t,ref:n})});t5.displayName=`ContextMenuContent`;function eke({preset:e=H.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Group,{...t})}function tke({preset:e=H.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Item,{...t})}function nke({preset:e=H.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.CheckboxItem,{...t})}function rke({preset:e=H.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.RadioGroup,{...t})}function ike({preset:e=H.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.RadioItem,{...t})}function ake({preset:e=H.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Label,{...t})}function oke({preset:e=H.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Separator,{...t})}function ske({preset:e=H.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Shortcut,{...t})}function cke({preset:e=H.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.Sub,{...t})}function lke({preset:e=H.DEFAULT,...t}){let n=e5(e);return(0,$.jsx)(n.SubTrigger,{...t})}var n5=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=e5(e);return(0,$.jsx)(r.SubContent,{...t,ref:n})});n5.displayName=`ContextMenuSubContent`;var r5=rc(K.LOW_LEVEL_DROPDOWN_MENU,`DropdownMenu`,[`Trigger`,`Content`,`Group`,`Item`,`CheckboxItem`,`RadioGroup`,`RadioItem`,`Label`,`Separator`,`Shortcut`,`Sub`,`SubTrigger`,`SubContent`]);function i5({preset:e=H.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n,{...t})}var a5=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=r5(e);return(0,$.jsx)(r.Trigger,{...t,ref:n})});a5.displayName=`DropdownMenuTrigger`;var o5=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=r5(e);return(0,$.jsx)(r.Content,{...t,ref:n})});o5.displayName=`DropdownMenuContent`;function uke({preset:e=H.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.Group,{...t})}function s5({preset:e=H.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.Item,{...t})}function dke({preset:e=H.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.CheckboxItem,{...t})}function fke({preset:e=H.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.RadioGroup,{...t})}function pke({preset:e=H.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.RadioItem,{...t})}function c5({preset:e=H.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.Label,{...t})}function l5({preset:e=H.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.Separator,{...t})}function mke({preset:e=H.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.Shortcut,{...t})}function u5({preset:e=H.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.Sub,{...t})}function d5({preset:e=H.DEFAULT,...t}){let n=r5(e);return(0,$.jsx)(n.SubTrigger,{...t})}var f5=(0,Q.forwardRef)(({preset:e=H.DEFAULT,...t},n)=>{let r=r5(e);return(0,$.jsx)(r.SubContent,{...t,ref:n})});f5.displayName=`DropdownMenuSubContent`;var p5=rc(K.LOW_LEVEL_HOVER_CARD,`HoverCard`,[`Trigger`,`Content`]);function m5({preset:e=H.DEFAULT,...t}){let n=p5(e);return(0,$.jsx)(n,{...t})}function h5({preset:e=H.DEFAULT,...t}){let n=p5(e);return(0,$.jsx)(n.Trigger,{...t})}function g5({preset:e=H.DEFAULT,...t}){let n=p5(e);return(0,$.jsx)(n.Content,{...t})}var _5=rc(K.LOW_LEVEL_PAGINATION,`Pagination`,[`Content`,`Item`,`Link`,`Previous`,`Next`,`Ellipsis`]);function hke({preset:e=H.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n,{...t})}function gke({preset:e=H.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Content,{...t})}function _ke({preset:e=H.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Item,{...t})}function vke({preset:e=H.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Link,{...t})}function yke({preset:e=H.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Previous,{...t})}function bke({preset:e=H.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Next,{...t})}function xke({preset:e=H.DEFAULT,...t}){let n=_5(e);return(0,$.jsx)(n.Ellipsis,{...t})}var v5=rc(K.LOW_LEVEL_STACKED_LAYOUT,`StackedLayout`,[`Header`,`Title`,`Subtitle`,`Actions`,`Toolbar`,`Body`,`Aside`,`Content`,`Section`]);function Ske({preset:e=H.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n,{...t})}function Cke({preset:e=H.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Header,{...t})}function wke({preset:e=H.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Title,{...t})}function Tke({preset:e=H.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Subtitle,{...t})}function Eke({preset:e=H.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Actions,{...t})}function Dke({preset:e=H.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Toolbar,{...t})}function Oke({preset:e=H.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Body,{...t})}function kke({preset:e=H.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Aside,{...t})}function Ake({preset:e=H.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Content,{...t})}function jke({preset:e=H.DEFAULT,...t}){let n=v5(e);return(0,$.jsx)(n.Section,{...t})}var y5=rc(K.LOW_LEVEL_AI_ARTIFACT,`AI_Artifact`,[`Header`,`Close`,`Content`,`Title`,`Description`,`Actions`,`Action`]);function Mke({preset:e=H.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n,{...t})}function Nke({preset:e=H.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Header,{...t})}function Pke({preset:e=H.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Close,{...t})}function Fke({preset:e=H.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Content,{...t})}function Ike({preset:e=H.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Title,{...t})}function Lke({preset:e=H.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Description,{...t})}function Rke({preset:e=H.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Actions,{...t})}function zke({preset:e=H.DEFAULT,...t}){let n=y5(e);return(0,$.jsx)(n.Action,{...t})}function b5({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_CODE_BLOCK,`AI_CodeBlock`)(e);return(0,$.jsx)(n,{...t})}function x5({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_DIFF_BLOCK,`AI_DiffBlock`)(e);return(0,$.jsx)(n,{...t})}var S5;(function(e){e.CONTEXT=`context`,e.ADDED=`added`,e.REMOVED=`removed`,e.NOTE=`note`})(S5||={});var Bke=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,Vke=/^diff --git (?:a\/)?(\S+) (?:b\/)?(\S+)$/,Hke=/^--- (?:a\/)?(.*)$/,Uke=/^\+\+\+ (?:b\/)?(.*)$/,Wke=/^Binary files .* differ$/,Gke=`/dev/null`;function C5(e){if(e===void 0)return;let t=e.trim();return t===Gke||t===``?void 0:t}function w5(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=Vke.exec(e);if(t){l(),r.oldPath=C5(t[1]),r.newPath=C5(t[2]);continue}let n=i===null?Hke.exec(e):null;if(n){(!r||r.pathHeaderSeen||r.hunks.length>0)&&l(),r.pathHeaderSeen=!0,r.oldPath=C5(n[1]);continue}let c=i===null?Uke.exec(e):null;if(c){r||l(),r.newPath=C5(c[1]);continue}if(Wke.test(e)){r||l(),r.isBinary=!0;continue}let u=Bke.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:S5.ADDED,text:f,newNumber:o}),o+=1,r.added+=1;break;case`-`:i.lines.push({kind:S5.REMOVED,text:f,oldNumber:a}),a+=1,r.removed+=1;break;case`\\`:i.lines.push({kind:S5.NOTE,text:f.trim()});break;default:i.lines.push({kind:S5.CONTEXT,text:d===` `?f:e,oldNumber:a,newNumber:o}),a+=1,o+=1}}return c(),n}function T5(e){return e.hunks.reduce((e,t)=>e+t.lines.length+1,0)}function Kke({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_IMAGE,`AI_Image`)(e);return(0,$.jsx)(n,{...t})}var E5=rc(K.LOW_LEVEL_AI_WEB_PREVIEW,`AI_WebPreview`,[`Navigation`,`NavigationButton`,`Url`,`Body`,`Console`]);function qke({preset:e=H.DEFAULT,...t}){let n=E5(e);return(0,$.jsx)(n,{...t})}function Jke({preset:e=H.DEFAULT,...t}){let n=E5(e);return(0,$.jsx)(n.Navigation,{...t})}function Yke({preset:e=H.DEFAULT,...t}){let n=E5(e);return(0,$.jsx)(n.NavigationButton,{...t})}function Xke({preset:e=H.DEFAULT,...t}){let n=E5(e);return(0,$.jsx)(n.Url,{...t})}function Zke({preset:e=H.DEFAULT,...t}){let n=E5(e);return(0,$.jsx)(n.Body,{...t})}function Qke({preset:e=H.DEFAULT,...t}){let n=E5(e);return(0,$.jsx)(n.Console,{...t})}var D5=rc(K.LOW_LEVEL_AI_CONVERSATION,`AI_Conversation`,[`Content`,`EmptyState`,`ScrollButton`]);function O5({preset:e=H.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n,{...t})}function k5({preset:e=H.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n.Content,{...t})}function A5({preset:e=H.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n.EmptyState,{...t})}function j5({preset:e=H.DEFAULT,...t}){let n=D5(e);return(0,$.jsx)(n.ScrollButton,{...t})}var M5=rc(K.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 N5({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n,{...t})}function $ke({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Provider,{...t})}function eAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Attachment,{...t})}function tAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Attachments,{...t})}function nAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Body,{...t})}function P5({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Textarea,{...t})}function rAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Header,{...t})}function F5({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Footer,{...t})}function iAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Tools,{...t})}function aAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Button,{...t})}function I5({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Submit,{...t})}function oAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.ActionMenu,{...t})}function sAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.ActionMenuTrigger,{...t})}function cAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.ActionMenuContent,{...t})}function lAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.ActionMenuItem,{...t})}function uAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.ActionAddAttachments,{...t})}function dAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.SpeechButton,{...t})}function fAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Select,{...t})}function pAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.SelectTrigger,{...t})}function mAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.SelectContent,{...t})}function hAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.SelectItem,{...t})}function gAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.SelectValue,{...t})}function _Ae({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Command,{...t})}function vAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.CommandInput,{...t})}function yAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.CommandList,{...t})}function bAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.CommandEmpty,{...t})}function xAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.CommandGroup,{...t})}function SAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.CommandItem,{...t})}function CAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.CommandSeparator,{...t})}function wAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.HoverCard,{...t})}function TAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.HoverCardTrigger,{...t})}function EAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.HoverCardContent,{...t})}function DAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.TabsList,{...t})}function OAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.Tab,{...t})}function kAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.TabLabel,{...t})}function AAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.TabBody,{...t})}function jAe({preset:e=H.DEFAULT,...t}){let n=M5(e);return(0,$.jsx)(n.TabItem,{...t})}var L5=rc(K.LOW_LEVEL_AI_SOURCES,`AI_Sources`,[`Trigger`,`Content`,`Source`]);function R5({preset:e=H.DEFAULT,...t}){let n=L5(e);return(0,$.jsx)(n,{...t})}function z5({preset:e=H.DEFAULT,...t}){let n=L5(e);return(0,$.jsx)(n.Trigger,{...t})}function B5({preset:e=H.DEFAULT,...t}){let n=L5(e);return(0,$.jsx)(n.Content,{...t})}function V5({preset:e=H.DEFAULT,...t}){let n=L5(e);return(0,$.jsx)(n.Source,{...t})}function H5({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_SUGGESTIONS,`AI_Suggestions`)(e);return(0,$.jsx)(n,{...t})}function U5({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_SUGGESTION,`AI_Suggestion`)(e);return(0,$.jsx)(n,{...t})}function MAe({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_CONFIRMATION,`AI_Confirmation`)(e);return(0,$.jsx)(n,{...t})}var W5=rc(K.LOW_LEVEL_AI_QUEUE,`AI_Queue`,[`List`,`Item`,`ItemIndicator`,`ItemContent`,`ItemDescription`,`ItemActions`,`ItemAction`,`ItemAttachment`,`ItemImage`,`ItemFile`,`Section`,`SectionTrigger`,`SectionLabel`,`SectionContent`,`TodoItem`,`MessageItem`]);function NAe({preset:e=H.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n,{...t})}function PAe({preset:e=H.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.List,{...t})}function FAe({preset:e=H.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.Item,{...t})}function IAe({preset:e=H.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.ItemIndicator,{...t})}function LAe({preset:e=H.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.ItemContent,{...t})}function RAe({preset:e=H.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.ItemDescription,{...t})}function zAe({preset:e=H.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.ItemActions,{...t})}function BAe({preset:e=H.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.ItemAction,{...t})}function VAe({preset:e=H.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.ItemAttachment,{...t})}function HAe({preset:e=H.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.ItemImage,{...t})}function UAe({preset:e=H.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.ItemFile,{...t})}function WAe({preset:e=H.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.Section,{...t})}function GAe({preset:e=H.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.SectionTrigger,{...t})}function KAe({preset:e=H.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.SectionLabel,{...t})}function qAe({preset:e=H.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.SectionContent,{...t})}function JAe({preset:e=H.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.TodoItem,{...t})}function YAe({preset:e=H.DEFAULT,...t}){let n=W5(e);return(0,$.jsx)(n.MessageItem,{...t})}var G5=rc(K.LOW_LEVEL_AI_TASK,`AI_Task`,[`Trigger`,`Content`,`Item`,`ItemFile`]);function XAe({preset:e=H.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n,{...t})}function ZAe({preset:e=H.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.Trigger,{...t})}function QAe({preset:e=H.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.Content,{...t})}function $Ae({preset:e=H.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.Item,{...t})}function K5({preset:e=H.DEFAULT,...t}){let n=G5(e);return(0,$.jsx)(n.ItemFile,{...t})}var q5=rc(K.LOW_LEVEL_AI_TOOL,`AI_Tool`,[`Header`,`Content`,`Input`,`Output`]);function J5({preset:e=H.DEFAULT,...t}){let n=q5(e);return(0,$.jsx)(n,{...t})}function Y5({preset:e=H.DEFAULT,...t}){let n=q5(e);return(0,$.jsx)(n.Header,{...t})}function X5({preset:e=H.DEFAULT,...t}){let n=q5(e);return(0,$.jsx)(n.Content,{...t})}function Z5({preset:e=H.DEFAULT,...t}){let n=q5(e);return(0,$.jsx)(n.Input,{...t})}function Q5({preset:e=H.DEFAULT,...t}){let n=q5(e);return(0,$.jsx)(n.Output,{...t})}function eje({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_EXECUTION_STREAM,`AI_ExecutionStream`)(e);return(0,$.jsx)(n,{...t})}function tje({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_CONNECTION,`AI_Connection`)(e);return(0,$.jsx)(n,{...t})}function nje({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_EDGE,`AI_Edge`)(e);return(0,$.jsx)(n,{...t})}function $5({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_PANEL,`AI_Panel`)(e);return(0,$.jsx)(n,{...t})}function rje({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_TOOLBAR,`AI_Toolbar`)(e);return(0,$.jsx)(n,{...t})}function ije({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_CONTEXT,`AI_Context`)(e);return(0,$.jsx)(n,{...t})}function aje({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_MODEL_SELECTOR,`AI_ModelSelector`)(e);return(0,$.jsx)(n,{...t})}function oje({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_OPEN_IN_CHAT,`AI_OpenInChat`)(e);return(0,$.jsx)(n,{...t})}function sje({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_LOADER,`AI_Loader`)(e);return(0,$.jsx)(n,{...t})}function e7({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_SHIMMER,`AI_Shimmer`)(e);return(0,$.jsx)(n,{...t})}var t7=rc(K.LOW_LEVEL_AI_CHAIN_OF_THOUGHT,`AI_ChainOfThought`,[`Header`,`Step`,`SearchResults`,`SearchResult`,`Content`,`Image`]);function n7({preset:e=H.DEFAULT,...t}){let n=t7(e);return(0,$.jsx)(n,{...t})}function r7({preset:e=H.DEFAULT,...t}){let n=t7(e);return(0,$.jsx)(n.Header,{...t})}function i7({preset:e=H.DEFAULT,...t}){let n=t7(e);return(0,$.jsx)(n.Step,{...t})}function cje({preset:e=H.DEFAULT,...t}){let n=t7(e);return(0,$.jsx)(n.SearchResults,{...t})}function lje({preset:e=H.DEFAULT,...t}){let n=t7(e);return(0,$.jsx)(n.SearchResult,{...t})}function a7({preset:e=H.DEFAULT,...t}){let n=t7(e);return(0,$.jsx)(n.Content,{...t})}function uje({preset:e=H.DEFAULT,...t}){let n=t7(e);return(0,$.jsx)(n.Image,{...t})}function dje({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_CHECKPOINT,`AI_Checkpoint`)(e);return(0,$.jsx)(n,{...t})}function fje({preset:e=H.DEFAULT,...t}){let n=qc(K.LOW_LEVEL_AI_INLINE_CITATION,`AI_InlineCitation`)(e);return(0,$.jsx)(n,{...t})}var o7=rc(K.LOW_LEVEL_AI_PLAN,`AI_Plan`,[`Header`,`Trigger`,`Content`,`Title`,`Description`,`Action`,`Footer`]);function pje({preset:e=H.DEFAULT,...t}){let n=o7(e);return(0,$.jsx)(n,{...t})}function mje({preset:e=H.DEFAULT,...t}){let n=o7(e);return(0,$.jsx)(n.Header,{...t})}function hje({preset:e=H.DEFAULT,...t}){let n=o7(e);return(0,$.jsx)(n.Trigger,{...t})}function gje({preset:e=H.DEFAULT,...t}){let n=o7(e);return(0,$.jsx)(n.Content,{...t})}function _je({preset:e=H.DEFAULT,...t}){let n=o7(e);return(0,$.jsx)(n.Title,{...t})}function vje({preset:e=H.DEFAULT,...t}){let n=o7(e);return(0,$.jsx)(n.Description,{...t})}function yje({preset:e=H.DEFAULT,...t}){let n=o7(e);return(0,$.jsx)(n.Action,{...t})}function bje({preset:e=H.DEFAULT,...t}){let n=o7(e);return(0,$.jsx)(n.Footer,{...t})}var s7=rc(K.LOW_LEVEL_AI_REASONING,`AI_Reasoning`,[`Trigger`,`Content`]);function c7({preset:e=H.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n,{...t})}function l7({preset:e=H.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Trigger,{...t})}function u7({preset:e=H.DEFAULT,...t}){let n=s7(e);return(0,$.jsx)(n.Content,{...t})}function d7(){let e=ah(),t=rg(),n=Eo[Vl.HOME].route,{navigate:r}=yS(),{isNavigationItemActive:i}=kx(),{emit:a}=Uo();return{isNavigationItemActive:i,handleNavigationClick:(0,Q.useCallback)((e,t)=>{Hm.dispatchNavigationForItem(r,e,t)},[r]),handleHomeClick:(0,Q.useCallback)(()=>{kh({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 xje(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Sje(e){switch(e){case pi.VERTICAL_RAIL:return{direction:Ta.VERTICAL,borderSide:hu.END,tooltipSide:hu.END,orientation:Ta.VERTICAL};case pi.HORIZONTAL_BAR:return{direction:Ta.HORIZONTAL,borderSide:hu.BOTTOM,tooltipSide:hu.TOP,orientation:Ta.HORIZONTAL};case pi.BOTTOM_TAB_BAR:return{direction:Ta.HORIZONTAL,borderSide:hu.TOP,tooltipSide:hu.TOP,orientation:Ta.HORIZONTAL};default:return{direction:Ta.VERTICAL,borderSide:hu.END,tooltipSide:hu.END,orientation:Ta.VERTICAL}}}function f7(){let{UIConfig:e,appComponentsConfiguration:t}=Ng(),n=Yx(),r=t?.[Ol.ACTIVITY_BAR],i=e?.currentBreakpoint===Yo.MOBILE,a=(0,Q.useMemo)(()=>xje(r)?i?r.mobileRendering??pi.BOTTOM_TAB_BAR:r.desktopRendering??pi.VERTICAL_RAIL:i?pi.BOTTOM_TAB_BAR:pi.VERTICAL_RAIL,[r,i]),o=(0,Q.useMemo)(()=>Sje(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 p7=`engine:primary`;function m7(){return{requiredCapabilities:[Fv.ANSWERER]}}function h7(e,t){return(e??[]).some(e=>e.kind===_s.ENGINE_PAGE&&e.pageRef===t||h7(e.children,t))}function Cje(e,t){if(!t||(e??[]).some(e=>e.contentKind===xc.NAVIGATION_LIST&&h7(e.children,Vl.DECISIONS)))return e;let n={kind:_s.ENGINE_PAGE,pageRef:Vl.DECISIONS,runtimeAvailability:m7()},r=(e??[]).findIndex(e=>e.contentKind===xc.NAVIGATION_LIST&&e.isPrimary===!0);return r===-1?[{contentKind:xc.NAVIGATION_LIST,ref:p7,isPrimary:!0,children:[n]},...e??[]]:(e??[]).map((e,t)=>{if(t!==r)return e;let i=e;return{...i,children:[n,...i.children]}})}function wje(e,t){return!t||(e??[]).some(e=>e.kind===_s.ENGINE_PAGE&&e.pageRef===Vl.DECISIONS)?e:[...e??[],{kind:_s.ENGINE_PAGE,pageRef:Vl.DECISIONS,runtimeAvailability:m7()}]}function g7(){return{kind:_s.RESOURCE_OPERATION,resourceType:Wo.ORGANIZATION_REPRESENTATIONS,operation:J.LIST,runtimeAvailability:{requiredCapabilities:[cv.REPRESENTS]}}}function _7(e){return(e??[]).some(e=>e.kind===_s.RESOURCE_OPERATION&&e.resourceType===Wo.ORGANIZATION_REPRESENTATIONS&&e.operation===J.LIST||_7(e.children))}function Tje(e,t){if(t?.includes(om.CLIENTS)||(e??[]).some(e=>e.contentKind===xc.NAVIGATION_LIST&&_7(e.children)))return e;let n=g7(),r=(e??[]).findIndex(e=>e.contentKind===xc.NAVIGATION_LIST&&e.isPrimary===!0);return r===-1?[{contentKind:xc.NAVIGATION_LIST,ref:p7,isPrimary:!0,children:[n]},...e??[]]:(e??[]).map((e,t)=>{if(t!==r)return e;let i=e,a=i.children.findIndex(e=>e.kind!==_s.ENGINE_PAGE||e.pageRef!==Vl.DECISIONS),o=a===-1?i.children.length:a;return{...i,children:[...i.children.slice(0,o),n,...i.children.slice(o)]}})}function Eje(e,t){return t?.includes(om.CLIENTS)||(e??[]).some(e=>e.kind===_s.RESOURCE_OPERATION&&e.resourceType===Wo.ORGANIZATION_REPRESENTATIONS&&e.operation===J.LIST)?e:[...e??[],g7()]}var v7=tl.getLogger(),y7=v7.debugByType(`SidebarBehavior`);v7.setDebugTypeLogging(`SidebarBehavior`,!1);var b7=[Yo.MOBILE,Yo.VERT_TABLET,Yo.DESKTOP];function x7(e,t){return b7.indexOf(e)<=b7.indexOf(t)}function S7(e,t){if(e===!1||!t)return!1;let n=u2(e)?e:void 0;return(n?.policy??rt.BURGER)===rt.BURGER&&x7(t,n?.responsiveBreakpoint??Yo.MOBILE)}function C7(){let{UIConfig:e,appComponentsConfiguration:t}=Ng(),n=t?.[Ol.SIDEBAR];return n!==!1&&n!==void 0&&S7(n,e?.currentBreakpoint)}function Dje(){let e=$s(xs.SIDEBAR_COLLAPSED);return e===null?null:e===`true`}function w7(e={}){let{placement:t=Cs.START,isCollapsed:n,onToggleCollapse:r}=e,i=d7(),{isNavigationItemActive:a}=i,o=O$(),s=Zp(),c=dS(),{UIConfig:l,appComponentsConfiguration:u,sidebarCompactLabelMode:d,navigationLayout:f,suppressedEngineNavigationEntries:p}=Ng(),{navigate:m,navigateToResource:h}=yS(),{registry:g}=fm(),_=u?.[Ol.SIDEBAR],v=_!==!1,y=l?.currentBreakpoint,{on:b}=Uo(),x=Su().appConfig.decisionInbox,S=u2(_)?_.contentSections:void 0,C=(0,Q.useMemo)(()=>v?Tje(Cje(S,x),p):S,[v,S,x,p]),w=u2(_)?_.defaultSection:void 0,T=(u2(_)?_.homeDisplayMode:void 0)??Se.NAVIGATION_ITEM,E=b2({theme:u2(_)?_.brandMarkTheme:void 0}),D=T===Se.BRAND_HEADER?E:void 0,O=(0,Q.useMemo)(()=>{let e=u2(_)?_.hostedComponents:void 0;return S2(Ol.SIDEBAR,e,u,y,No.TOP,f)},[_,u,y,f]),k=c.activeMode,A=c.availableModes,j=c.allScopeValues,M=(0,Q.useMemo)(()=>{if(!C)return;let e=t6(j,k,A);return bue(e6(C,k,e,ui.isDevelopment()),c)},[C,k,A,j,c]);(0,Q.useEffect)(()=>{if(!ui.isDevelopment()||!C||!window.__WILDO_DEBUG_SIDEBAR__)return;let e=t6(j,k,A);n6(C,k,e)},[C,k,A,j]);let N=(0,Q.useRef)(Dje()),P=u2(_)?_.defaultCollapsed:void 0,[F,I]=(0,Q.useState)(N.current),L=F??P??!1,R=(0,Q.useCallback)(e=>{I(e),So(xs.SIDEBAR_COLLAPSED,String(e))},[]),z=n===void 0?L:n,B=v&&S7(_,y),[ee,te]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{B||te(!1)},[B]);let[ne,V]=(0,Q.useState)(()=>{try{let e=localStorage.getItem(xs.SIDEBAR_SECTION_COLLAPSED);return e?JSON.parse(e):{}}catch{return{}}}),[re,ie]=(0,Q.useState)({}),[ae,oe]=(0,Q.useState)(null),[se,ce]=(0,Q.useState)(``),[le,ue]=(0,Q.useState)(()=>{try{let e=$s(xs.SIDEBAR_FAVORITES),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}});(0,Q.useEffect)(()=>{So(xs.SIDEBAR_FAVORITES,JSON.stringify(le))},[le]),(0,Q.useEffect)(()=>{try{localStorage.setItem(xs.SIDEBAR_SECTION_COLLAPSED,JSON.stringify(ne))}catch{}},[ne]);let de=(0,Q.useMemo)(()=>{let e=y===Yo.MOBILE,t=u2(_)?_:void 0,n=d===Bs.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]),fe=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let e=u2(_)?_:void 0;if(e?.policy!==rt.DRAWER||!y)return;let t=e.responsiveBreakpoint??Yo.MOBILE,r=x7(y,t),i=fe.current;fe.current=r,i===!0&&!r&&n===void 0&&R(!1)},[y,_,n,R]);let pe=(0,Q.useMemo)(()=>!M||!o?[]:Vm(M,o),[M,o]),me=(0,Q.useMemo)(()=>{let e=pe.map((e,t)=>Oje(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===xc.NAVIGATION_LIST&&t.section.behavior!==Wr.FAVORITES&&(n(t.items),n(t.moreMenuItems));let r=e.map(e=>{if(e.contentKind!==xc.NAVIGATION_LIST||e.section.behavior!==Wr.FAVORITES)return e;let n=le.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!==xc.NAVIGATION_LIST||e.items.length>0||e.moreMenuItems.length>0||e.section.inlineCreate!==pc.NONE),i=e=>e.section.isPrimary?0:e.section.behavior===Wr.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)},[pe,le]),he=(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 me)t(e.items),t(e.moreMenuItems);return e},[me]),ge=(0,Q.useMemo)(()=>Hm.getMostSpecificActiveRoute(he.map(e=>e.urlPath),a),[he,a]),_e=(0,Q.useMemo)(()=>{if(ge)return he.find(e=>e.urlPath===ge)?.id},[he,ge]),ve=(0,Q.useCallback)(e=>!!_e&&e.id===_e,[_e]),ye=!B&&z,be=(0,Q.useMemo)(()=>({isCollapsible:!u2(_)||_.collapsible!==!1,responsivePolicy:u2(_)?_.policy:rt.BURGER,currentWidth:ye?de.collapsedWidth:de.width}),[_,ye,de]),xe=(0,Q.useCallback)(()=>{B?te(e=>!e):r?r():R(!z)},[B,z,r,R]),Ce=(0,Q.useCallback)(()=>{te(!1)},[]),we=(0,Q.useRef)(xe);we.current=xe,(0,Q.useEffect)(()=>{if(v)return b(hc.HOTKEY_SIDEBAR_TOGGLE,()=>{we.current()})},[b,v]);let Te=(0,Q.useCallback)((e,t)=>{V(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=>{ie(t=>({...t,[e]:!t[e]}))},[]),Oe=(0,Q.useCallback)(e=>{y7(`handleNavigationClick`,{itemId:e.id,itemLabel:e.label,urlPath:e.urlPath}),i.handleNavigationClick(e,Ol.SIDEBAR),B&&te(!1)},[i.handleNavigationClick,B]),ke=(0,Q.useCallback)(()=>{y7(`handleHomeClick: START`),i.handleHomeClick(),B&&te(!1),y7(`handleHomeClick: DONE`)},[i.handleHomeClick,B]),Ae=(0,Q.useCallback)(e=>{oe(e),ce(``)},[]),je=(0,Q.useCallback)(()=>{oe(null),ce(``)},[]),Me=(0,Q.useCallback)((e,t)=>{if(!t)return;let n=(u2(_)?_.contentSections:void 0)?.find(t=>t.ref===e),r=n?.contentKind===xc.NAVIGATION_LIST&&n.inlineCreate===pc.DIALOG;if(!r&&!se.trim())return;let i=(n?.contentKind===xc.NAVIGATION_LIST?n.inlineCreateField:void 0)??`title`,a=g.resourceConfigurations[t],o=a?.operations?.find(e=>String(e.operationIdentifier)===J.CREATE);if(!a||!o)return;let c=kn.createFrontendResourceOperationContextFromOperation({resourceType:t,operation:o,contextResourceIdentifiers:s?.buildContextResourceIdentifiers()??{},...r?{}:{additionalContext:{defaultValuesOverride:{[i]:se.trim()}}}});r?h(c,Hm.createAppLevelInitiator(Ol.SIDEBAR),void 0,Mo.OVERLAY):(m({content:{contentType:Sa.RESOURCE_OPERATION,resourceContext:c},initiator:Hm.createAppLevelInitiator(Ol.SIDEBAR)}),je())},[se,m,h,je,_,g,s]),Ne=(0,Q.useCallback)(e=>re[e]??!1,[re]),Pe=(0,Q.useCallback)(e=>le.includes(e.favoriteId??e.id),[le]),Fe=(0,Q.useCallback)(e=>{let t=e.favoriteId??e.id;ue(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},[]),Ie=(0,Q.useMemo)(()=>(M??[]).some(e=>e.contentKind===xc.NAVIGATION_LIST&&e.behavior===Wr.FAVORITES),[M]);return{groupedSections:me,hostedComponents:O,isCollapsed:ye,isHomeActive:i.isHomeActive,dimensions:de,sidebarConfig:be,isNavigationLoading:!o,hasItems:me.length>0||T===Se.NAVIGATION_ITEM,placement:t,isMobileDrawerMode:B,isMobileDrawerOpen:ee,closeMobileDrawer:Ce,homeDisplayMode:T,brandHeader:D,isNavigationItemActive:ve,isSectionCollapsed:Ee,isItemCollapsed:Ne,handleNavigationClick:Oe,handleHomeClick:ke,handleToggleCollapse:xe,handleSetSectionCollapsed:Te,handleToggleItemCollapse:De,isItemFavorite:Pe,handleToggleItemFavorite:Fe,hasFavoritesSection:Ie,inlineCreate:{activeSection:ae,value:se,start:Ae,cancel:je,submit:Me,setValue:ce}}}function Oje(e,t){let n={ref:e.ref,label:e.label,showLabel:e.showLabel!==!1,collapsible:e.collapsible??!1,defaultCollapsed:e.defaultCollapsed??!1,behavior:Wr.STATIC,inlineCreate:pc.NONE,nested:!1,maxNestingDepth:1};switch(e.contentKind){case xc.NAVIGATION_LIST:{let t={...n,behavior:e.behavior??Wr.STATIC,inlineCreate:e.inlineCreate??pc.NONE,inlineCreateResourceType:e.inlineCreateResourceType,nested:e.nested??!0,maxNestingDepth:e.maxNestingDepth??1,isPrimary:e.isPrimary??!1,...e.isPrimary?{showLabel:!1,collapsible:!1}:{}},r=T7(e.items.map(e=>E7(e)).filter(e=>e!==null),t.nested??!0,t.maxNestingDepth??1);return{section:t,items:r.filter(e=>e.displayPolicy!==Yc.SECTION_MORE_MENU),moreMenuItems:r.filter(e=>e.displayPolicy===Yc.SECTION_MORE_MENU),contentKind:xc.NAVIGATION_LIST}}case xc.RESOURCE_BROWSER:return{section:n,items:[],moreMenuItems:[],contentKind:xc.RESOURCE_BROWSER,resourceType:e.resourceType,operation:e.operation,operationVariant:e.operationVariant,navigateOperation:e.navigateOperation,navigateOperationVariant:e.navigateOperationVariant,instanceFilter:e.instanceFilter,onInstanceClick:e.onInstanceClick};case xc.GUIDANCE_WIDGET:return{section:n,items:[],moreMenuItems:[],contentKind:xc.GUIDANCE_WIDGET,guidanceRef:e.guidanceRef};case xc.CUSTOM_COMPONENT:return{section:n,items:[],moreMenuItems:[],contentKind:xc.CUSTOM_COMPONENT,componentRef:e.componentRef}}}function T7(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 kje(e,t){v7.warn(`Navigation item "${e.id}" ${t} — dropped from the sidebar`,{itemId:e.id,ref:e.ref,contentType:e.contentType})}function E7(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(E7).filter(e=>e!==null)};return e.operation&&e.resourceContext?(ui.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:sa.RESOURCE,resourceType:e.resourceType??``,operationIdentifier:e.operationIdentifier??``,operation:e.operation,resourceContext:e.resourceContext}):e.contentType===Sa.ENGINE_PAGE?e.pageRef?{...t,itemType:sa.ENGINE_PAGE,pageRef:e.pageRef}:(kje(e,"declares contentType ENGINE_PAGE with no `pageRef`"),null):e.contentType===Sa.SETTINGS_HUB?{...t,itemType:sa.SETTINGS_HUB,sectionRef:e.sectionRef}:e.componentRef?{...t,itemType:sa.CUSTOM_COMPONENT,componentRef:e.componentRef,contextResourceIdentifiers:e.contextResourceIdentifiers}:{...t,itemType:sa.VIEW,viewRef:e.viewRef??e.ref,contentType:e.contentType??Sa.COMPOSITE_VIEW,contextResourceIdentifiers:e.contextResourceIdentifiers,flowsActorsSystemRef:e.flowsActorsSystemRef,fullCustomComponentRef:e.fullCustomComponentRef,requiredFeatures:e.requiredFeatures}}function D7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function O7(e={}){let{mode:t}=e,{UIConfig:n,appComponentsConfiguration:r,navigationLayout:i,homeDefinition:a}=Ng(),o=O$(),{navigate:s}=yS(),c=dS(),{isNavigationItemActive:l,isHomeActive:u,handleHomeClick:d}=d7(),f=a?.compositeViewReference,p=r?.[Ol.MENUBAR],m=n?.currentBreakpoint,h=b2({theme:D7(p)?p.brandMarkTheme:void 0}),g=D7(p)&&p.brandHeader===!0?h:void 0,_=(0,Q.useMemo)(()=>D7(p)?S2(Ol.MENUBAR,p.hostedComponents,r,m,Cs.START,i):[],[r,p,m,i]),v=(0,Q.useMemo)(()=>D7(p)?Eue(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=Ym(void 0,v,o),t=Hm.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:()=>{Hm.dispatchNavigationForResolvedTarget(s,e,Ol.MENUBAR)}}))},[v,o,s,l,u,f]),menubarConfig:(0,Q.useMemo)(()=>{let e=t||(D7(p)?p.displayPolicy??`FIXED`:typeof p==`string`?p:`FIXED`),n=e===`OVERLAY`;return{mode:e,isOverlay:n,showMobileLayout:m===Yo.MOBILE&&n}},[p,t,m]),mapToFrontendComponentType:_2}}function k7(e,t){if(!e)return;let n=e.resourceConfigurations[t.resourceType];if(!n?.mainSchema)return;let r=U.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 A7(e={}){let t=Zp(),{on:n}=Uo(),{registry:r}=fm(),[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=Ow({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?Zl(a)===jr.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}=q({component:K.APPLICATION_LEVEL_QUICK_SWITCHER,resource:f}),m=(0,Q.useMemo)(()=>u.map(e=>e.fieldIdentifier),[u]),h=NC({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?Zl(a)===jr.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:gr.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 ui.isDevelopment()&&console.warn(`[QuickSwitcher] No schema found for scope field "${t}" — field will not render.`),[];let{schema:r,isPrimaryKeyFallback:i}=n,a=Zl(r)===jr.ARRAY,o=a?pu(r)??r:r,c=Zl(o),l=xe(o)||i?p2.RESOURCE_REFERENCE:c===jr.ENUM?p2.ENUM:p2.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??Fi,presentation:e.presentation??Jp.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===Ol.SIDEBAR?`vertical`:`horizontal`,[e.containerType]),focusTrigger:o}}function j7(e=No.BOTTOM){let{UIConfig:t,appComponentsConfiguration:n,shellAppearance:r}=Ng(),{tComponent:i}=q({component:K.APPLICATION_LEVEL_STATUS_BAR}),{status:a}=up(),{notifications:o}=Fm(),s=n?.[Ol.STATUS_BAR],c=t?.currentBreakpoint,l=d2(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 Ml.LINK:return{id:e.id,label:e.label,iconReference:e.icon,valueText:t,interaction:{type:m2.LINK,href:e.href}};case Ml.BUTTON:return{id:e.id,label:e.label,iconReference:e.icon,valueText:t,interaction:{type:m2.BUTTON,onClick:e.onClick}};case Ml.TEXT:default:return{id:e.id,label:e.label,iconReference:e.icon,valueText:t,interaction:{type:m2.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===Yo.MOBILE;return{height:l?.height??(e?28:32)}},[c,l]),v=(0,Q.useMemo)(()=>{let t=e===No.TOP,n=e===No.BOTTOM,i=c===Yo.MOBILE,a=r===zc.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===Yo.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)(()=>To(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(K.APPLICATION_LEVEL_STATUS_BAR,`notificationCount`,{count:S}),[S,i]),connectionStatusLabel:(0,Q.useMemo)(()=>{switch(a){case $p.CONNECTED:return i(K.APPLICATION_LEVEL_STATUS_BAR,`connected`);case $p.CONNECTING:case $p.RECONNECTING:return i(K.APPLICATION_LEVEL_STATUS_BAR,`reconnecting`);case $p.DISCONNECTED:case $p.ERROR:default:return i(K.APPLICATION_LEVEL_STATUS_BAR,`disconnected`)}},[a,i]),statusItems:h,dimensions:_,statusBarConfig:v,authoredAppearance:g,currentBreakpoint:c}}function Aje(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function M7(){let{UIConfig:e,appComponentsConfiguration:t}=Ng(),n=O$(),{navigate:r}=yS(),i=dS(),a=t?.[Ol.TOOLBAR],o=e?.currentBreakpoint,s=o===Yo.MOBILE,c=Aje(a)?a:void 0,l=(0,Q.useMemo)(()=>Cue(c?.tools,i),[c?.tools,i]),u=(0,Q.useMemo)(()=>!l?.length||!n?[]:Gm(l,n),[l,n]),d=(0,Q.useMemo)(()=>u.map(e=>({id:e.id,label:e.label,iconReference:e.iconReference,iconOnly:e.iconOnly,onClick:()=>Hm.dispatchNavigationForResolvedTarget(r,e,Ol.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 N7(e){return Ko.isRegistered(e,H.DEFAULT)}function P7(e,t,n=N7){return e.map(e=>{if(e.kind===_s.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:_s.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:_s.CUSTOM_COMPONENT,componentRef:e.componentRef,resolvedComponentRef:r?e.componentRef:null,icon:e.icon,label:e.label}})}function F7(e){if(e)return ud.map(t=>`${t}:${e.zones[t].stack.map(e=>e.id).join(`,`)}#${e.zones[t].activeTabId??``}`).join(`|`)}function I7(e=Cs.END,t){let{UIConfig:n,appComponentsConfiguration:r,flowsActorsViews:i}=Ng(),[a,o]=(0,Q.useState)(!1),s=F7((0,Q.useContext)(mh)?.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?.[Ol.UTILITY_PANEL],d=f2(u)?u:void 0,f=(0,Q.useMemo)(()=>P7(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===_s.VIEW?jY(m.viewRef):void 0,g=(0,Q.useMemo)(()=>h?[AY({family:ho.FLOWS_ACTORS,translationRef:h})]:[],[h]),{tComponent:_,tView:v,isReady:y}=q({component:K.APPLICATION_LEVEL_UTILITY_PANEL,keys:g}),b=h?v(ho.FLOWS_ACTORS,h,`title`):m?.kind===_s.CUSTOM_COMPONENT?m.label:yp({tComponent:_,componentType:K.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 jje(e,t){let n=Number(e);return Number.isFinite(n)?n:t}function L7(e=Cs.END,t=[]){let{UIConfig:n,appComponentsConfiguration:r}=Ng(),i=O$(),{navigate:a}=yS(),{tComponent:o}=q({component:K.APPLICATION_LEVEL_CONTROL_PANEL}),s=dS(),[c,l]=(0,Q.useState)(!1),u=n?.currentBreakpoint,d=r?.[Ol.CONTROL_PANEL],f=typeof d==`object`&&d?d.items:void 0,p=(0,Q.useMemo)(()=>wue(f,s),[f,s]),m=(0,Q.useMemo)(()=>!p||!i?[]:Pm(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 h2.BUTTON:return{id:e.id,label:e.label,type:h2.BUTTON,disabled:t,onTrigger:()=>e.onChange?.(!0)};case h2.TOGGLE:{let n=e.value===!0;return{id:e.id,label:e.label,type:h2.TOGGLE,disabled:t,value:n,onToggle:()=>e.onChange?.(!n)}}case h2.SELECT:return{id:e.id,label:e.label,type:h2.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 h2.SLIDER:{let n=e.min??0,r=e.max??100,i=e.step??1,a=jje(e.value,n);return{id:e.id,label:e.label,type:h2.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(K.APPLICATION_LEVEL_CONTROL_PANEL,`actions`):o(K.APPLICATION_LEVEL_CONTROL_PANEL,e),items:t})),[h,o]),controls:g,handleItemClick:(0,Q.useCallback)(e=>{l(!1),Hm.dispatchNavigationForResolvedTarget(a,e,Ol.CONTROL_PANEL)},[a]),sheetSide:(0,Q.useMemo)(()=>{let t=e;return t===Cs.START?hu.START:t===Cs.END?hu.END:t===No.TOP?hu.TOP:t===No.BOTTOM?hu.BOTTOM:hu.END},[e]),isNavigationLoading:!i,navigationItemCount:m.length,currentBreakpoint:u}}function R7(e,t,n,r){let i=K.APPLICATION_LEVEL_NOTIFICATION_CENTER,a=e(i,t,r);return a===`components.${i}.${t}`?n??a:a}function Mje(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?R7(n,`timeJustNow`):a<60?R7(n,`timeMinutesAgo`,void 0,{count:a}):o<24?R7(n,`timeHoursAgo`,void 0,{count:o}):s<7?R7(n,`timeDaysAgo`,void 0,{count:s}):r(e)}function Nje(e){switch(e){case`success`:return W.CHECK_CIRCLE;case`warning`:return W.WARNING;case`error`:return W.X_CIRCLE;default:return W.INFO}}function z7(e,t,n={}){let{notifications:r,clearAll:i,removeNotification:a}=Fm(),{on:o}=Uo(),{tComponent:s,formatDate:c}=q({component:K.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=R7(s,`resourceNotificationTitle`,e.resourceContext.resourceType,{resourceType:e.resourceContext.resourceType}),n||=R7(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(K.APPLICATION_LEVEL_NOTIFICATION_CENTER,`title`),{id:e.id,type:e.type,source:e.source,timestamp:e.timestamp,displayTitle:t,displayMessage:n,relativeTimeLabel:Mje(e.timestamp,d,s,c),iconReference:Nje(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 Pje=[Ac.NAVIGATION,Ac.ACTIONS],B7=0,Fje=1e3,Ije=300,Lje=2,Rje=5,V7=tl.getLogger(),zje={[J.CREATE]:`keywordsCreate`,[J.CREATE_MANY]:`keywordsCreate`,[J.LIST]:`keywordsList`,[J.SEARCH]:`keywordsSearch`,[J.READ]:`keywordsRead`,[J.UPDATE]:`keywordsUpdate`,[J.UPDATE_MANY]:`keywordsUpdate`,[J.DELETE]:`keywordsDelete`,[J.DELETE_MANY]:`keywordsDelete`};function H7(e,t){let n=K.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 Bje(e,t){if(!t)return[];let n=vl(t),r=n?zje[n]:void 0;return r?H7(e,r):[]}function U7(e,t,n){return Mee(n)?t(K.APPLICATION_LEVEL_COMMAND_MENU,n):e(`${Bc.COMMAND_CATEGORIES}.${n}.label`)}function W7(e,t,n){return n.category===void 0?e(`${Bc.RESOURCES}.${n.resourceType}.header.title`):U7(e,t,n.category)}function Vje(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function G7(e,t,n={}){let r=O$(),{navigate:i,navigateToResource:a}=yS(),{registry:o,doOperation:s}=fm(),c=Zp(),{appComponentsConfiguration:l,suppressedEngineNavigationEntries:u}=Ng(),{on:d,emit:f}=Uo(),{register:p}=w$(),{t:m,tComponent:h,formatDate:g,formatDateTime:_}=q({component:K.APPLICATION_LEVEL_COMMAND_MENU}),v=l?.[Ol.COMMAND_MENU],b=Vje(v)?v:void 0,x=b?.openShortcut,S=b?.showRecent!==!1,C=b?.maxRecentItems??5,w=b?.showShortcuts!==!1,T=b?.defaultCategory??Ac.NAVIGATION,E=b?.categoryOrder??Pje,D=b?.policy===vm.OMNIBOX,O=b?.searchResources,k=b?.dialogWidth,A=dS(),M=(0,Q.useContext)(Vi)?.appConfig?.decisionInbox,N=(0,Q.useMemo)(()=>xue(Eje(wje(b?.commands,M),u),A),[b?.commands,M,u,A]),[P,F]=(0,Q.useState)(!1),[I,L]=(0,Q.useState)(``),[R,z]=(0,Q.useState)([]),B=e!==void 0&&t!==void 0,ee=B?e:P,te=(0,Q.useRef)(ee);te.current=ee;let ne=n.listenForHotkeys!==!1,V=(0,Q.useCallback)(e=>{B&&t?t(e):F(e),e||L(``)},[B,t]);(0,Q.useEffect)(()=>{if(ne)return d(hc.HOTKEY_COMMAND_MENU_OPEN,()=>{V(!te.current)})},[d,V,ne]),(0,Q.useEffect)(()=>{if(ne&&x&&v!==!1)return p({id:`app-command-menu-open-shortcut`,shortcut:x,description:m(`engine.hotkeys.commandMenuOpen`),scope:y.GLOBAL,group:_i.NAVIGATION,launcher:Ol.COMMAND_MENU,preventDefault:!0,handler:()=>{f(hc.HOTKEY_COMMAND_MENU_OPEN,{})}})},[x,v,p,f,m,ne]);let re=(0,Q.useMemo)(()=>!N||!r?[]:Dh(N,r),[N,r]),ie=(0,Q.useMemo)(()=>re.filter(e=>{let t=e.displayPolicy;return t===void 0||t===ao.ALWAYS?!0:t===ao.NEVER?!1:t===ao.RECENT?!0:t===ao.CONTEXTUAL?(ui.isDevelopment()&&console.warn(`[CommandMenu] CONTEXTUAL displayPolicy requires a contextual source and is excluded from the global app-level menu for "${e.id}"`),!1):(ui.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??T,keywords:[...Bje(h,e.operation),...e.searchKeywords??[]],displayPolicy:e.displayPolicy,onExecute:()=>{V(!1),z(t=>[e.id,...t.filter(t=>t!==e.id)].slice(0,C)),e.urlPath&&Hm.dispatchNavigationForResolvedTarget(i,e,Ol.COMMAND_MENU)}})),[re,V,i,C,T,h]),ae=(0,Q.useMemo)(()=>{let e=new Map;for(let t of ie){if(t.displayPolicy===ao.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 E){let r=e.get(n);r&&(t.push({category:n,label:U7(m,h,n),items:r}),e.delete(n))}for(let[n,r]of e.entries())t.push({category:n,label:U7(m,h,n),items:r});return t},[ie,E,m,h]),oe=(0,Q.useMemo)(()=>{if(R.length===0)return[];let e=new Map(ie.map(e=>[e.id,e]));return R.map(t=>e.get(t)).filter(Boolean)},[ie,R]),[se,ce]=(0,Q.useState)([]),[le,ue]=(0,Q.useState)(!1),de=(0,Q.useRef)(s);de.current=s;let fe=(0,Q.useRef)(o);fe.current=o;let pe=(0,Q.useRef)(c);pe.current=c;let me=(0,Q.useRef)(a);me.current=a;let he=(0,Q.useRef)(V);he.current=V;let ge=(0,Q.useRef)(m);ge.current=m;let _e=(0,Q.useRef)(g);_e.current=g;let ve=(0,Q.useRef)(_);ve.current=_;let ye=(0,Q.useRef)(h);ye.current=h;let be=(0,Q.useRef)(O);be.current=O;let xe=(0,Q.useRef)(null),Se=(0,Q.useCallback)(e=>{let t=pe.current,n=tm.buildInitiatorIds({userId:t?.currentUserId,organizationId:t?.currentOrganizationId,applicationId:t?.currentApplicationId,anonymousUserId:t?.currentAnonymousUserId});return{...tm.primaryScopeToContextIdentifiers(n,e),...t?.buildContextResourceIdentifiers()??{}}},[]),Ce=(0,Q.useCallback)((e,t)=>{let n=fe.current,r=n.resourceConfigurations[e];if(!r)return;let i=Gl(r.operations??[],J.READ);if(!i){V7.warn(`[CommandMenu] Omnibox result has no addressable READ operation`,{resourceType:e,recordId:t});return}let a=K7({scopeIdentifiers:Se(r.resourcePrimaryScope),resourceType:e,recordId:t,registry:n}),o=kn.buildParentResourcesRequirements(e,a,n),s=kn.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:i,contextResourceIdentifiers:a,parentResourcesRequirements:o});he.current(!1),me.current(s,Hm.createAppLevelInitiator(Ol.COMMAND_MENU))},[Se]),we=(0,Q.useMemo)(()=>JSON.stringify(O??[]),[O]),Te=D&&!!O&&O.length>0;(0,Q.useEffect)(()=>{if(xe.current&&=(clearTimeout(xe.current),null),!ee||!Te||I.trim().length<Lje){ce([]),ue(!1);return}let e=!1,t=I.trim();ue(!0);let n=async()=>{let n=fe.current,r=be.current??[],i=await Promise.all(r.map(async e=>{let r=n.resourceConfigurations[e.resourceType];if(!r)return V7.warn(`[CommandMenu] Omnibox searchResource not in registry — skipped`,{resourceType:e.resourceType}),null;let i;try{i=U.buildForeignKeySearchOperationPath(e.resourceType,n)}catch{return V7.warn(`[CommandMenu] Omnibox resource has no searchable SEARCH/LIST operation — skipped`,{resourceType:e.resourceType}),null}let a=U.buildForeignKeySearchParams(t,e.maxResults??Rje,{resourceType:e.resourceType,registry:n}),o;try{o=await de.current(i,{contextualParameters:Se(r.resourcePrimaryScope),queryParameters:a.queryParameters,dataMode:a.dataMode})}catch(t){return V7.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=U.getResourceFieldIdentifierForType(e.resourceType,n),l=e.category??e.resourceType,u=e.resultDisplay===ma.LABEL||e.resultDisplay===ma.ID?ma.LABEL:ma.SUMMARY,d=[t,...H7(ye.current,`keywordsSearch`),...e.searchKeywords??[]],f=s.flatMap(t=>{let r=U.getResourceObjectId(t,c);if(!r)return[];let i=U.computeFrontendResourceLabel({resourceType:e.resourceType,registry:n,currentObject:t,t:ge.current,formatDate:_e.current,formatDateTime:ve.current})??r;return[{id:`omnibox:${e.resourceType}:${r}`,resourceType:e.resourceType,record:t,label:i,keywords:d,onExecute:()=>Ce(e.resourceType,r)}]});return f.length===0?null:{category:l,label:W7(ge.current,ye.current,e),displayMode:u,items:f}}));e||(ce(i.filter(e=>e!==null)),ue(!1))};return xe.current=setTimeout(()=>{n()},Ije),()=>{e=!0,xe.current&&=(clearTimeout(xe.current),null)}},[ee,I,Te,we,Se,Ce]);let Ee=(0,Q.useMemo)(()=>{let e=new Map;return(O??[]).forEach((t,n)=>{let r=t.category??t.resourceType;e.set(r,t.order??B7+n)}),e},[O]),De=(0,Q.useMemo)(()=>{let e=new Map;for(let t of O??[])e.set(t.category??t.resourceType,t);return e},[O]),Oe=(0,Q.useMemo)(()=>se.map(e=>{let t=De.get(e.category);return t?{...e,label:W7(m,h,t)}:e}),[se,De,m,h]);return{isOpen:ee,handleOpenChange:V,searchQuery:I,setSearchQuery:L,commandItems:ie,groupedItems:ae,recentItems:oe,searchResultGroups:Oe,orderedGroups:(0,Q.useMemo)(()=>{let e=[];return Oe.forEach((t,n)=>{e.push({kind:g2.RECORDS,order:Ee.get(t.category)??B7+n,group:t})}),ae.forEach((t,n)=>{e.push({kind:g2.COMMANDS,order:Fje+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)},[Oe,ae,Ee]),isSearching:le,isNavigationLoading:!r,showRecent:S,showShortcuts:w,openShortcut:x,authoredDialogWidth:k}}function K7(e){return{...zm({hostIdentifiers:e.scopeIdentifiers,hostContextualParameters:{},targetResourceType:e.resourceType,targetId:e.recordId,registry:e.registry}).identifiers,[e.resourceType]:e.recordId}}function Hje(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q7(){let{UIConfig:e,appComponentsConfiguration:t}=Ng(),n=O$(),{navigate:r}=yS(),i=dS(),a=t?.[Ol.QUICK_ACTION_BUTTON],o=Hje(a)?a:void 0,s=(0,Q.useMemo)(()=>Sue(o?.actions,i),[o?.actions,i]),c=(0,Q.useMemo)(()=>!s?.length||!n?[]:$m(s,n),[s,n]),l=(0,Q.useMemo)(()=>c.map(e=>({id:e.id,label:e.label,iconReference:e.iconReference,displayPolicy:e.displayPolicy,onClick:()=>Hm.dispatchNavigationForResolvedTarget(r,e,Ol.QUICK_ACTION_BUTTON)})),[c,r]),{primaryAction:u,menuActions:d}=(0,Q.useMemo)(()=>({primaryAction:l.find(e=>e.displayPolicy===cs.PRIMARY)??null,menuActions:l.filter(e=>e.displayPolicy!==cs.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 Uje(e){let{registry:t,doOperation:n}=fm(),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?.[Wo.ORGANIZATIONS]?.operations.find(e=>e.operationIdentifier===J.SEARCH&&e.variantType===oe.API_CALL&&e.variantKey===Ke.MINE);return e?no.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=U.buildForeignKeySearchParams(h,20,{resourceType:Wo.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;tl.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 Wje(e){let{httpClient:t}=Su(),[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 J7=Object.freeze([]);function Gje(e){return typeof e==`object`&&!!e}var Y7=[sp.USER_INFO,sp.ORG_SWITCHER,sp.SETTINGS,sp.LOGOUT];function X7(e,t){let{appComponentsConfiguration:n}=Ng(),{user:r,organizations:i,getCurrentOrganization:a,setCurrentOrganization:o,logout:s,isAuthenticated:c,permissions:l}=ng(),{registry:u}=fm(),d=O$(),f=ah(),p=dS(),[m,h]=(0,Q.useState)(!1),g=n?.[Ol.USER_DROPDOWN],_=(0,Q.useMemo)(()=>{let e=Gje(g)?g:void 0;if(e)return{avatarDisplay:e.avatarDisplay??Ip.AVATAR_ONLY,sections:e.sections??Y7,showOrgSwitcher:e.showOrgSwitcher??!0,showLogout:e.showLogout??!0,settingsEntries:e.settingsEntries??J7}},[g]),v=a(),y=_?.sections??Y7,b=_?.avatarDisplay??Ip.AVATAR_ONLY,x=_?.showOrgSwitcher!==!1,S=_?.showLogout!==!1,C=_?.settingsEntries??J7;p.activeMode,p.availableModes,p.allScopeValues;let w=(0,Q.useMemo)(()=>e===Ol.MENUBAR?t===Cs.END?{align:ia.END,side:hu.BOTTOM}:{align:ia.START,side:hu.BOTTOM}:e===Ol.SIDEBAR?t===No.BOTTOM?{align:ia.END,side:hu.END}:{align:ia.START,side:hu.END}:{align:ia.END,side:hu.BOTTOM},[e,t]),T=(0,Q.useMemo)(()=>d?C.flatMap(e=>{let t=qm({kind:_s.SETTINGS_SECTION,sectionRef:e},d);return t?[t]:[]}):[],[d,C]),E=(0,Q.useMemo)(()=>d?qm({kind:_s.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 Xse(l?.accessProfile).filter(t=>!e.has(t)).length},[i,l?.accessProfile]),j=Uje(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||za.settings)},[f]),F=D?.avatar,I=Wje((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?.[Wo.USER_SELF_PROFILES],a=U.resolveSingleResourceReadOperation(Wo.USER_SELF_PROFILES,u);if(!i||!a)return null;let o={[Wo.USER_SELF]:e},s=KV({registry:u,resourceConfig:i,operation:a,resourceType:Wo.USER_SELF_PROFILES,fieldName:`avatar`,recordId:t,contextResourceIdentifiers:o,contextualParameters:U.buildContextualParameters(o,u),apiBaseUrl:ui.getApiUrl()});return s?JV(`${s}/${encodeURIComponent(n)}`):null},[u,r,D,F?.fileId]))??void 0,L=r?.email??``,R=(0,Q.useMemo)(()=>{let e=new Map;for(let t of r?.organizationMembers??[]){if(!Rre(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:L,avatarUrl:I,currentOrganization:v?{_id:v._id,name:v.name}:void 0,organizations:(i??[]).map(e=>{let t=R.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 Kje({preset:e=H.DEFAULT,...t}){let n=qc(K.APPLICATION_LEVEL_COMMAND_MENU,`ApplicationLevel_CommandMenu`)(e);return(0,$.jsx)(n,{...t})}function qje({preset:e=H.DEFAULT,...t}){let n=qc(K.APPLICATION_LEVEL_CONTROL_PANEL,`ApplicationLevel_ControlPanel`)(e);return(0,$.jsx)(n,{...t})}function Jje({preset:e=H.DEFAULT,...t}){let n=qc(K.APPLICATION_LEVEL_USER_DROPDOWN,`ApplicationLevel_MenuUserOrg`)(e);return(0,$.jsx)(n,{...t})}function Yje(e){return e.tResourceEmptyState(e.resourceType,`title`)||e.tComponent(K.RESOURCES_LAYOUTS_LIST,`noItems`)}var Z7=tl.getLogger(),Q7=Z7.debugByType(`sidebar-resource-browser`);Z7.setDebugTypeLogging(`sidebar-resource-browser`,!1);var Xje=[K.APPLICATION_LEVEL_SIDEBAR,K.RESOURCES_LAYOUTS_LIST],$7=({resourceType:e,operation:t,operationVariant:n,navigateOperation:r,navigateOperationVariant:i,instanceFilter:a,onInstanceClick:o,isCollapsed:s=!1})=>{let{registry:c,doOperation:l}=fm(),{navigateToResource:u}=yS(),d=Zp(),{tResourceHeader:f,tResourceEmptyState:p,t:m,tComponent:h,formatDate:g,formatDateTime:_}=q({resource:e,component:Xje}),v=cp(),{renderIcon:y}=ef(),[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 uh(k,t??J.LIST,n)},[k,t,n]),j=(0,Q.useMemo)(()=>{if(k)return r?uh(k,r,i):t&&t!==J.LIST?uh(k,t,n):uh(k,J.READ)??A},[k,r,i,t,n,A]),M=(0,Q.useMemo)(()=>{if(!k)return{};let e=tm.buildInitiatorIds({userId:d?.currentUserId,organizationId:d?.currentOrganizationId,applicationId:d?.currentApplicationId,anonymousUserId:d?.currentAnonymousUserId});return{...tm.primaryScopeToContextIdentifiers(e,k.resourcePrimaryScope),...d?.buildContextResourceIdentifiers()??{}}},[k,d?.currentUserId,d?.currentOrganizationId,d?.currentApplicationId,d?.currentAnonymousUserId,d]),N=(0,Q.useMemo)(()=>A?no.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??J.LIST}" on resource "${e}".`;T(null),Z7.warn(r,{resourceType:e,operationIdentifier:t??J.LIST,operationVariant:n})}else k||Z7.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{Q7(`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),Q7(`Fetched instances`,{count:n.length})}catch(t){if(r)return;T(v(t)),Z7.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)(()=>Kp({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=kn.buildParentResourcesRequirements(e,t,c),i=kn.createFrontendResourceOperationContextFromOperation({resourceType:e,operation:j,contextResourceIdentifiers:t,parentResourcesRequirements:r});u(i,Hm.createAppLevelInitiator(Ol.SIDEBAR))}else Z7.warn(`SidebarResourceBrowser navigation skipped: no navigation operation resolved`,{resourceType:e,fetchOperationIdentifier:A?.operationIdentifier,navigationOperationIdentifier:r??J.READ,navigationOperationVariant:i,instanceId:n})},[e,o,k,j,r,i,M,c,u,A]),L=(0,Q.useCallback)(t=>U.computeFrontendResourceLabel({resourceType:e,registry:c,currentObject:t,t:m,formatDate:g,formatDateTime:_})??String(t._id??``),[e,c,m,g,_]),R=(0,Q.useMemo)(()=>y({category:nn.RESOURCES,resourceType:e},{size:tr.SM}),[y,e]),z=(0,Q.useMemo)(()=>A?[og({resourceType:e,operation:A.operationIdentifier})]:[],[e,A]),B=(0,Q.useMemo)(()=>[`resources.${e}`],[e]),ee=(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(K.APPLICATION_LEVEL_SIDEBAR,`resourceBrowserUnavailable`)});let te=E||w?(0,$.jsx)(`div`,{className:`px-card-sm py-item-xs text-xs text-destructive`,children:E?h(K.APPLICATION_LEVEL_SIDEBAR,`resourceBrowserUnavailable`):w}):P.length===0?(0,$.jsx)(`div`,{className:`px-card-sm py-item-xs text-xs text-muted-foreground`,children:Yje({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:R}),(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=L(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:G(`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`,Dg(e_.INSET)),children:[(0,$.jsx)(`span`,{className:`flex-shrink-0`,children:R}),(0,$.jsx)(`span`,{className:`truncate flex-1`,children:n})]},String(r))})});return(0,$.jsx)(Zy,{i18nKeys:B,loadingScopes:z,readiness:[{id:`sidebar-resource-browser-data`,isReady:!S||w!==null}],renderLoading:ee,children:te})};function Zje({preset:e=H.DEFAULT,...t}){let n=qc(K.APPLICATION_LEVEL_NOTIFICATION_CENTER,`ApplicationLevel_NotificationCenter`)(e);return(0,$.jsx)(n,{...t})}function Qje({preset:e=H.DEFAULT,...t}){let n=qc(K.APPLICATION_LEVEL_QUICK_SWITCHER,`ApplicationLevel_QuickSwitcher`)(e);return(0,$.jsx)(n,{...t})}var e9;(function(e){e.OPENING=`opening`,e.SIGNING=`signing`,e.NOTHING=`nothing`,e.FAILED=`failed`})(e9||={});var $je=no.createOperationPathKey({resourceIdentifier:Wo.SIGNATURE_REQUEST_SIGNERS,operationIdentifier:Kie.OPEN_SIGNING_SESSION,variantType:oe.API_CALL,isOperationDefault:!0,isBulkOperation:!1});function eMe(e){try{return e?.contentWindow?.location.pathname===Te}catch{return!1}}function tMe({linkedResourceType:e,linkedResourceId:t,title:n,onSigningReturned:r,className:i}){let{doOperation:a}=fm(),o=cp(),[s,c]=(0,Q.useState)(e9.OPENING),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(a);m.current=a;let h=(0,Q.useRef)(o);h.current=o;let g=(0,Q.useRef)(r);g.current=r,(0,Q.useEffect)(()=>{let n=!1;return c(e9.OPENING),m.current($je,{contextualParameters:{},requestData:{linkedResourceType:e,linkedResourceId:t,returnUrl:`${window.location.origin}${Te}`}},{silent:!0}).then(e=>{n||(u(e.url),c(e9.SIGNING))}).catch(e=>{n||(Rr(e)&&(e.errorType===Mc.NOT_FOUND||e.errorType===Mc.CONFLICT)?c(e9.NOTHING):(f(h.current(e)),c(e9.FAILED)))}),()=>{n=!0}},[e,t]);let _=(0,Q.useCallback)(()=>{eMe(p.current)&&(c(e9.NOTHING),u(null),g.current?.())},[]);return s===e9.NOTHING?null:s===e9.OPENING?(0,$.jsx)(Jy,{}):s===e9.FAILED?(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:d})}):(0,$.jsx)(`iframe`,{ref:p,src:l??void 0,title:n,onLoad:_,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox`,referrerPolicy:`strict-origin`,className:G(`h-[80vh] w-full rounded-md border-0`,i)})}var t9=({resourceContext:e})=>{let{registry:t,doOperation:n}=fm(),{resourceContext:r,navigationZone:i,navigationInitiator:a,resourceType:o,contextualParameters:s,reportError:c,navigateToPreferredRead:l,goBackWithinZone:u}=eC(),{closeOverlay:d}=yS(),{makeTrComponent:f,isReady:p}=q({component:K.RESOURCES_LAYOUTS_CREATE}),m=f(K.RESOURCES_LAYOUTS_CREATE),h=cp(),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=no.createOperationPathKey({resourceIdentifier:o,operationIdentifier:Fs.DISCOVER_ENDPOINTS,variantType:oe.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:fae.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===Gn.OVERLAY?d():u();return}let n=Lz({result:e,resourceType:o,registry:t});n&&l({contextResourceIdentifiers:kn.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)(vD,{voice:void 0,children:(0,$.jsxs)(`div`,{className:`space-y-section`,children:[(0,$.jsx)(eV,{resourceContext:r,navigationZone:i,navigationInitiator:a}),(0,$.jsxs)(bT,{className:`max-w-2xl`,children:[(0,$.jsx)(ST,{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)(YM,{name:`saml-metadata-url`,schema:md(),type:`url`,placeholder:m(`saml.metadataUrlPlaceholder`),value:_,onChange:e=>v(String(e)),className:`flex-1`}),(0,$.jsx)(Y,{type:`button`,variant:X.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)(cB,{resourceContext:r,navigationZone:i,onSuccess:E,onError:D,onCancel:i===Gn.OVERLAY?()=>d():void 0,showErrorSummary:!0,className:`max-w-2xl`,defaultValuesOverride:C})]})})};function nMe({resourceContext:e}){let{resourceType:t,contextResourceIdentifiers:n}=e,{registry:r,doOperation:i}=fm(),{makeTrComponent:a,isReady:o}=q({component:K.RESOURCES_LAYOUTS_READ}),s=a(K.RESOURCES_LAYOUTS_READ),c=cp(),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),p=n,m=p.organizations?kn.getResourceId(p.organizations):void 0,h=p.applications?kn.getResourceId(p.applications):void 0,g=m==null?Dc.APPLICATION:Dc.ORGANIZATION,_=String(m??h??``),v=(0,Q.useMemo)(()=>_?`${ui.getApiUrl()}/auth/saml/metadata/${g}/${_}`:null,[g,_]),y=(0,Q.useCallback)(async()=>{f(!0),u(null);try{let a=no.createOperationPathKey({resourceIdentifier:t,operationIdentifier:Fs.TEST_CONNECTION,variantType:oe.API_CALL,isOperationDefault:!0,isBulkOperation:!1}),o=U.buildContextualParameters(n,r),s=p[t]?kn.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)(ST,{children:s(`saml.samlTools`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-field`,children:[v&&(0,$.jsx)(Y,{variant:X.OUTLINE,asChild:!0,children:(0,$.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,children:x})}),(0,$.jsx)(Y,{type:`button`,variant:X.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)(ST,{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 n9=e=>(0,$.jsx)(bY,{...e,showCharts:!1,children:(0,$.jsx)(nMe,{resourceContext:e.resourceContext})});function r9(e,t){return U.buildConfigurationError(Lu.CONFIGURATION,{message:e,component:`useCompositeResourceOperationContextBuilder`,...t})}function rMe(e){return`operationIdentifier`in e}function iMe(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 r9(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 aMe(e,t,n,r,i){if(!e)throw r9(`Composite resource-operation builder cannot resolve resource "${t}" from the registry.`,{resourceType:t});if(rMe(n)){let a=iMe(e,t,n);if(Nm({operation:a,resourceType:t,resourceConfig:e})&&a.isBulkOperation!==!0&&!Bh({resourceConfig:e,operation:a,registry:r,hasResourceId:kn.getResourceId(i[t]).length>0,contextResourceIdentifiers:i,contextualParameters:U.buildContextualParameters(i,r)}))throw r9(`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===J.READ||a===J.UPDATE||a===J.DELETE,s=n.requireAddressable||o?fh({resourceConfig:e,operations:e.operations??[],coreOperation:a,registry:r,hasResourceId:kn.getResourceId(i[t]).length>0,allowBulk:n.allowBulk,requireFrontendAddressable:!0,contextResourceIdentifiers:i,contextualParameters:U.buildContextualParameters(i,r)}):Gl(e.operations??[],a,{requireAddressable:n.requireAddressable,allowBulk:n.allowBulk});if(!s)throw r9(`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 i9(){let{registry:e}=fm(),t=PU(),n=Zp();return{buildResourceOperationContext:(0,Q.useCallback)(r=>{let i=e.resourceConfigurations[r.resourceType],a=r.contextResourceIdentifiers??t?.contextResourceIdentifiers,o=a?U.flattenContextIdentifiers(a):void 0,s=tm.mergeContextResourceIdentifiers(void 0,n?.buildContextResourceIdentifiers()??{},o)??{},c=r.resourceId?{...zm({hostIdentifiers:r.contextResourceIdentifiers?n?.buildContextResourceIdentifiers()??{}:s,hostContextualParameters:{},hostRecord:{resourceType:r.resourceType,id:r.contextResourceIdentifiers?``:kn.getResourceId(o?.[r.resourceType])},targetResourceType:r.resourceType,targetId:r.resourceId,registry:e}).identifiers,...r.contextResourceIdentifiers?o:{},[r.resourceType]:r.resourceId}:s,l=aMe(i,r.resourceType,r,e,c),u=kn.buildParentResourcesRequirements(r.resourceType,c,e,r.relationshipFieldOverrides);return kn.createFrontendResourceOperationContextFromOperation({resourceType:r.resourceType,operation:l,contextResourceIdentifiers:c,additionalContext:r.additionalContext,parentResourcesRequirements:u})},[n,t?.contextResourceIdentifiers,e])}}function a9({childContext:e,inlineLimit:t,showViewAllLink:n,childResourceType:r,onViewAll:i}){let{registry:a,doOperation:o}=fm(),{t:s,formatDate:c,formatDateTime:l,tComponent:u,isReady:d}=q({component:K.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)(()=>U.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=U.buildContextualParameters(e.contextResourceIdentifiers,a),o=e.operation&&vl(e.operation)===J.LIST?e.operation:n?Gl((n.operations??[]).filter(t=>ZJ(t,e,i)),J.LIST):void 0,s=e.pinnedFilters;if(s&&o&&o!==e.operation&&tl.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=no.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)(Jy,{size:20,className:`text-muted-foreground`})});if(v)return(0,$.jsx)(`p`,{className:`text-sm text-destructive`,children:u(K.RESOURCES_LAYOUTS_CONTAINER_NESTED,`previewLoadFailed`)});if(!d)return null;if(x===0){if(!n)return null;let e=yp({tComponent:u,componentType:K.RESOURCES_LAYOUTS_CONTAINER_NESTED,key:`viewAll`});return(0,$.jsx)(Y,{variant:X.LINK,size:df.SM,className:`px-0`,onClick:i,children:e})}if(f.length===0){let e=yp({tComponent:u,componentType:K.RESOURCES_LAYOUTS_CONTAINER_NESTED,key:`emptyState`});return(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e})}let w=m>x,T=yp({tComponent:u,componentType:K.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=U.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)(Y,{variant:X.LINK,size:df.SM,className:`px-0`,onClick:i,children:T})]})}function oMe({resourceType:e,limit:t,showViewAllLink:n=!0,viaForeignKey:r,className:i}){qJ(e);let{buildOperationContext:a}=U6(),{navigationZone:o}=kU(),{navigate:s}=yS(),c=(0,Q.useMemo)(()=>a({resourceType:e,operationLike:J.LIST,relationshipFieldOverrides:r}),[a,e,JSON.stringify(r??null)]);return(0,$.jsx)(`div`,{className:i,children:(0,$.jsx)(a9,{childContext:c,inlineLimit:t,showViewAllLink:n&&!(c.pinnedFilters&&Object.keys(c.pinnedFilters).length>0),childResourceType:e,onViewAll:()=>s({content:{contentType:Sa.RESOURCE_OPERATION,resourceContext:c},initiator:{sourceZone:o}})})})}var o9=({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}=dU(),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}=q({component:K.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:Ti.IN_PROGRESS,elements:{},triggerCount:1}),A=T.length;(0,Q.useEffect)(()=>{D(0),k({status:Ti.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===Ti.COMPLETED).length:0,[j]),P=(0,Q.useCallback)((e,t,n)=>{let r=t===Ti.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===Ti.COMPLETED?t:n.completedAt,dismissedAt:e===Ti.DISMISSED?t:n.dismissedAt}))},[]),I=(0,Q.useCallback)(async(e,t)=>{P(e,Ti.COMPLETED,t),_&&c(g,e,t),r?.(e,Ti.COMPLETED),E<A-1?D(e=>e+1):(F(Ti.COMPLETED),_&&l(g))},[c,l,E,_,g,r,P,F,A]),L=(0,Q.useCallback)(e=>{P(e,Ti.DISMISSED),r?.(e,Ti.DISMISSED),w.allowDismiss&&(F(Ti.DISMISSED),_&&u(g))},[u,_,g,w.allowDismiss,r,P,F]),R=(0,Q.useCallback)(e=>{let t=T[E];i?.(t?.ref??``,e)},[i,T,E]),z=(0,Q.useCallback)(()=>{if(E<A-1){D(e=>e+1);return}let e=T[E];e?I(e.ref):(F(Ti.COMPLETED),_&&l(g))},[E,A,T,I,l,_,g,F]),B=(0,Q.useCallback)(()=>{E>0&&D(e=>e-1)},[E]),ee=(0,Q.useCallback)(()=>{F(Ti.SKIPPED),_&&d(g)},[_,g,F,d]);if(!C||_&&p)return null;if(T.length===0)return(0,$.jsx)(`div`,{className:G(`p-container-xl text-center text-muted-foreground`,n),children:S(K.GUIDANCE_ONBOARDING_VIEW,`empty`)});if(Bt(j?.status))return null;let te=T[E];if(!te)return null;let ne=r4(te.type),V=M(te.ref),re=x(y,te.ref,Wc(te));return(0,$.jsxs)(`div`,{className:G(`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(K.GUIDANCE_ONBOARDING_VIEW,`stepOf`,{current:E+1,total:A})}),(0,$.jsxs)(`span`,{className:`text-xs`,children:[N,`/`,A]})]}),(0,$.jsx)(h_,{value:A>0?(E+1)/A*100:0,className:`h-1`,"aria-label":S(K.GUIDANCE_ONBOARDING_VIEW,`stepOf`,{current:E+1,total:A}),"aria-valuenow":E+1,"aria-valuemin":1,"aria-valuemax":A})]}),ne&&(0,$.jsx)(ne,{element:te,flowRef:v,state:V,onComplete:I,onDismiss:L,onAction:R,t:re}),A>1&&(0,$.jsxs)(`div`,{className:`flex justify-between items-center pt-item`,children:[(0,$.jsx)(`div`,{children:E>0&&(0,$.jsx)(Y,{variant:X.OUTLINE,size:df.SM,onClick:B,children:S(K.GUIDANCE_ONBOARDING_VIEW,`back`)})}),(0,$.jsxs)(`div`,{className:`flex gap-item items-center`,children:[w.allowSkip&&(0,$.jsx)(Y,{variant:X.GHOST,size:df.SM,onClick:ee,children:S(K.GUIDANCE_ONBOARDING_VIEW,`skip`)}),(0,$.jsx)(Y,{variant:X.DEFAULT,size:df.SM,onClick:z,children:E===A-1?S(K.GUIDANCE_ONBOARDING_VIEW,`complete`):S(K.GUIDANCE_ONBOARDING_VIEW,`next`)})]})]}),A===1&&(0,$.jsxs)(`div`,{className:`flex justify-end gap-item items-center`,children:[w.allowDismiss&&(0,$.jsx)(Y,{variant:X.GHOST,size:df.SM,onClick:()=>L(te.ref),children:S(K.GUIDANCE_ONBOARDING_VIEW,`dismiss`)}),(0,$.jsx)(Y,{variant:X.DEFAULT,size:df.SM,onClick:z,children:S(K.GUIDANCE_ONBOARDING_VIEW,`complete`)})]})]})},s9=Object.freeze({});function sMe(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 c9(e){let{registry:t,doOperation:n}=fm(),[r,i]=(0,Q.useState)(s9),{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=kn.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)(()=>U.buildContextResourceIdentifiersKey(c),[c]),p=(0,Q.useRef)(null),m=ZB({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(s9);return}let e=U.buildContextualParameters(c,t),r=fh({resourceConfig:s,operations:s.operations??[],coreOperation:J.READ,registry:t,hasResourceId:!0,requireFrontendAddressable:!0,contextResourceIdentifiers:c,contextualParameters:e});if(!r){i(s9);return}let m=no.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(s9);return}p.current=typeof t._id==`string`?t._id:null;let n=sMe(t,u);i(e=>Object.keys(n).length===0?s9:Object.keys(n).length===Object.keys(e).length&&Object.entries(n).every(([t,n])=>e[t]===n)?e:n)}).catch(()=>{!v&&!_&&i(s9)}),()=>{v=!0}},[d,f,o,a,m?.at]),r}function l9(e,t){return Object.keys(t).length===0?e:{...t,...e}}function u9(e){let{registry:t}=fm(),n=t.resourceConfigurations[e.resourceType]?.frontendConfiguration?.chartViews?.find(t=>t.ref===e.viewRef);if(!n)throw p9(`Composite chart runtime cannot resolve chart view "${e.viewRef}" on resource "${e.resourceType}".`,{resourceType:e.resourceType,viewRef:e.viewRef});let r=xp(e.resourceType,{ref:e.viewRef});return(0,$.jsx)(`div`,{className:e.className,children:(0,$.jsx)(Vh,{requiredFeatures:n.chartDefinition.requiredFeatures,children:(0,$.jsx)(TJ,{viewRef:r.insertedViewRef,viewDefinition:n,runtimeDescriptor:gp({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=kU();return(0,$.jsx)(u9,{resourceType:e,viewRef:t,contextResourceIdentifiers:{...s.contextResourceIdentifiers??{},...n??{}},inputs:r,urlParamValues:i,className:a,height:o})}function cMe({document:e,viewRef:t,guidanceFlowRef:n,className:r}){return(0,$.jsx)(`div`,{className:r,children:(0,$.jsx)(o9,{document:e,viewRef:t,guidanceFlowRef:n})})}function lMe({viewRef:e,className:t}){let n=AU(),r=n?.hostResourceType?n.contextResourceIdentifiers?.[n.hostResourceType]??`no-row`:`no-host`;return(0,$.jsx)(`div`,{className:t,children:(0,$.jsx)(UJ,{descentKey:`composite:${e}::${r}`,children:(0,$.jsx)(IU,{viewRef:e})})})}function f9(e,t,n,r){return(0,$.jsx)(`div`,{className:r,children:(0,$.jsx)(UJ,{descentKey:`execution:${e}::${Object.values(n??{}).join(`,`)||`no-row`}`,children:(0,$.jsx)(LY,{viewRef:e,navigationZone:t,contextResourceIdentifiers:n})})})}function uMe({viewRef:e,contextResourceIdentifiers:t,className:n}){let r=kU();return f9(e,r.navigationZone,{...r.contextResourceIdentifiers??{},...t??{}},n)}function p9(e,t){return U.buildConfigurationError(Lu.CONFIGURATION,{message:e,component:`ResourceEmbeds`,...t})}function m9(e){let t=U.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:${U.buildContextResourceIdentifiersKey(n)}`}function h9(e,t,n,r){return(0,$.jsx)(`div`,{className:r,children:(0,$.jsx)(UJ,{descentKey:m9(e),children:(0,$.jsx)(Vk.Provider,{value:!0,children:(0,$.jsx)(OY,{resourceContext:e,navigationZone:t,navigationInitiator:n})})})})}function g9({resourceContext:e,className:t}){let{navigationZone:n,navigationInitiator:r}=kU();return h9(e,n,r,t)}function dMe({className:e,...t}){let{navigationZone:n,navigationInitiator:r}=kU(),i=U6();return h9((0,Q.useMemo)(()=>i.buildOperationContext(t),[i,JSON.stringify(t)]),n,r,e)}function _9({className:e,...t}){qJ(t.resourceType);let{navigationZone:n,navigationInitiator:r}=kU(),i=U6(),{registry:a}=fm(),o=(0,Q.useMemo)(()=>{if(!t.resourceType)throw p9(`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&&!V6({target:t,hostResourceType:e,operation:o.operation,registry:a});if(!t.resourceType||s||!r?.resourceRelationships)return;let c=t.relationshipFieldOverrides?.[e],l=wt(r.resourceRelationships).map(t=>_j({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 h9(o,n,(0,Q.useMemo)(()=>s?{...r??{sourceZone:n},sourceRelationship:s}:r,[r,n,s]),e)}function v9({resourceType:e,viaForeignKey:t,className:n}){return(0,$.jsx)(_9,{resourceType:e,operationLike:J.LIST,relationshipFieldOverrides:t,className:n})}function fMe({className:e}){let{navigationZone:t,navigationInitiator:n}=kU(),r=U6(),{hostResourceType:i,hostResourceId:a}=r;return h9((0,Q.useMemo)(()=>{if(!a)throw p9(`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:Wo.CONVERSATION_THREADS,operationLike:J.LIST,requireAddressable:!1,pinnedFilters:{[Dl.RESOURCE_TYPE]:i,[Dl.RESOURCE_ID]:a}})},[r,i,a]),t,n,e)}var pMe={[Wo.USER_FLOW_ACTOR_EXECUTIONS]:Wo.USER_AGENT_WORK_DECISIONS,[Wo.ORGANIZATION_FLOW_ACTOR_EXECUTIONS]:Wo.ORGANIZATION_AGENT_WORK_DECISIONS,[Wo.APPLICATION_FLOW_ACTOR_EXECUTIONS]:Wo.APPLICATION_AGENT_WORK_DECISIONS};function y9({executionId:e,className:t}){let{navigationZone:n,navigationInitiator:r}=kU(),i=U6(),{hostResourceType:a}=i;return h9((0,Q.useMemo)(()=>{let t=pMe[a];if(!t)throw p9(`EmbedExecutionDecisions() lists the decisions of a conversational RUN: place it on a flowActorExecutions READ surface.`,{hostResourceType:a});return i.buildOperationContext({resourceType:t,operationLike:J.LIST,requireAddressable:!1,pinnedFilters:{[On.KIND]:fs.CONVERSATIONAL_EXECUTION,[On.ID]:e}})},[i,a,e]),n,r,t)}var b9=new Set;function mMe(e,t,n){let r=`${e}::${t}`;b9.has(r)||(b9.add(r),tl.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 x9(e,t){let n=U6(),r=rS(),i=t?JSON.stringify(t):``;return(0,Q.useMemo)(()=>{if(t===null)return!1;let a;try{a=n.buildOperationContext({resourceType:e,operationLike:J.LIST,requireAddressable:!1,pinnedFilters:t?JSON.parse(i):void 0})}catch(t){return mMe(n.hostResourceType,e,JG(t)),!1}let o=a.operation;return Wm({...o,resourceType:e},r)},[n,e,r,i,t===null])}function S9(e){let t=U6(),{hostResourceType:n}=t,{embedName:r,resourceType:i,pinnedFilters:a}=e,o=x9(i,a),s=JSON.stringify(a);return(0,Q.useMemo)(()=>{if(n!==Wo.ORGANIZATION_REPRESENTATIONS)throw p9(`${r}() lists what belongs to one client relationship: place it on an organizationRepresentations READ surface.`,{hostResourceType:n});return o?t.buildOperationContext({resourceType:i,operationLike:J.LIST,requireAddressable:!1,pinnedFilters:JSON.parse(s)}):null},[t,n,o,r,i,s])}function C9({organizationRepresentationId:e,className:t}){let{navigationZone:n,navigationInitiator:r}=kU(),i=S9({embedName:`EmbedRepresentationTeam`,resourceType:Wo.REPRESENTATIVE_ASSIGNMENTS,pinnedFilters:{[Bee]:e}});return i?h9(i,n,r,t):null}function w9({organizationRelationshipId:e,className:t}){let{navigationZone:n,navigationInitiator:r}=kU(),i=S9({embedName:`EmbedRepresentationMailboxes`,resourceType:Wo.RELATIONSHIP_MAILBOXES,pinnedFilters:{[jt]:e}});return i?h9(i,n,r,t):null}function hMe({resourceType:e,viaForeignKey:t,className:n}){return(0,$.jsx)(_9,{resourceType:e,operationLike:J.SEARCH,relationshipFieldOverrides:t,className:n})}function gMe({viewRef:e,inputs:t,urlParamValues:n,className:r,...i}){let a=U6(),o=a.buildOperationContext({...i,operationLike:J.READ}),s=c9(a);return(0,$.jsx)(u9,{resourceType:a.hostResourceType,viewRef:e,contextResourceIdentifiers:l9(U.flattenContextIdentifiers(o.contextResourceIdentifiers),s),inputs:t,urlParamValues:n,className:r})}function _Me({resourceType:e,viewRef:t,inputs:n,urlParamValues:r,className:i,...a}){if(!e)throw p9(`EmbedRelatedChart() requires a target resourceType.`,{target:a});let o=U6().deriveRelatedScopeIdentifiers({...a,resourceType:e,operationLike:J.LIST});return(0,$.jsx)(u9,{resourceType:e,viewRef:t,contextResourceIdentifiers:o,inputs:n,urlParamValues:r,className:i})}function vMe({viewRef:e,className:t,...n}){let{navigationZone:r}=kU(),i=U6(),a=i.buildOperationContext({...n,operationLike:J.READ}),o=c9(i);return f9(dp(i.hostResourceType,{ref:e}).insertedViewRef,r,l9(U.flattenContextIdentifiers(a.contextResourceIdentifiers),o),t)}function yMe({resourceType:e,viewRef:t,className:n,...r}){let{navigationZone:i}=kU(),a=U6();if(!e)throw p9(`EmbedRelatedExecution() requires a target resourceType.`,{target:{resourceType:e,viewRef:t,...r}});let o=a.buildOperationContext({...r,resourceType:e,operationLike:J.READ});return f9(dp(e,{ref:t}).insertedViewRef,i,U.flattenContextIdentifiers(o.contextResourceIdentifiers),n)}function bMe(e){if(!e.hostRelationships)return!1;let t=wt(e.hostRelationships).filter(t=>(t.resourceType1===e.hostResourceType?t.resourceType2:t.resourceType1)===e.targetResourceType);return t.length>0&&t.every(t=>!wo.isRelationshipActiveForParent(t,e.hostRecord,{onMissingParentResource:`exclude`,onConditionError:`exclude`}))}var T9=new Set;function xMe(e,t,n){let r=`${e}::${t}`;T9.has(r)||(T9.add(r),tl.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 E9({targets:e,config:t,className:n}){YJ();let r=(0,Q.useMemo)(()=>e.map(e=>typeof e==`string`?{resourceType:e}:e),[e]),i=H6(),a=i?.hostResourceType??``,o=i?.hostResourceConfig?.resourceRelationships,s=tk(),c=s?.data,{tResourceHeader:l,isReady:u}=q({component:K.RESOURCES_LAYOUTS_CONTAINER_NESTED}),d=(0,Q.useMemo)(()=>r.filter(e=>{if(!i)return!0;if(s&&bMe({hostResourceType:a,hostRelationships:o,targetResourceType:e.resourceType,hostRecord:c}))return!1;try{return i.buildOperationContext({resourceType:e.resourceType,operationLike:e.operationLike??J.LIST,relationshipFieldOverrides:e.viaForeignKey}),!0}catch(t){return xMe(a,e.resourceType,JG(t)),!1}}),[r,i,a,o,s,c]),f=(0,Q.useMemo)(()=>d.map(e=>({id:e.resourceType,title:Kp({tResourceHeader:l,resourceType:e.resourceType,key:`title`}),content:(0,$.jsx)(Vk.Provider,{value:!0,children:(0,$.jsx)(_9,{resourceType:e.resourceType,operationLike:e.operationLike??J.LIST,relationshipFieldOverrides:e.viaForeignKey})})})),[d,l]);if(f.length===0)return null;let p=d.some(e=>{let t=e.operationLike??J.LIST;return t===J.LIST||t===J.SEARCH}),m=u?(0,$.jsx)(VO,{sections:f,config:t,className:n}):null;return p?(0,$.jsx)(`div`,{[lA]:!0,children:m}):m}function D9({className:e,children:t}){return(0,$.jsx)(`div`,{className:G(`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 O9({name:e,className:t,children:n}){let[r]=(0,Q.useState)(()=>new Set),i=ZD(),a=(0,Q.useContext)(XD),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)(kM.Provider,{value:l,children:(0,$.jsxs)(`div`,{className:G(`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 SMe=tl.getLogger(),CMe=new Set;function wMe(e,t){return e.size===t.size&&[...e].every(e=>t.has(e))}var TMe=new Set([`checkbox`,`radio`,`button`,`submit`,`reset`,`file`,`image`,`range`,`color`,`hidden`]),EMe=600;function k9(e,t=[]){return Q.Children.forEach(e,e=>{if(!Q.isValidElement(e))return;if(e.type===Q.Fragment){k9(e.props.children,t);return}if(e.type!==O9)return;let n=e.props.name;t.some(e=>e.name===n)?SMe.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 DMe({className:e,initialStep:t=0,validateOnStepChange:n=!0,onStepChange:r,submitButton:i,children:a}){efe();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)(CMe),g=LC(),_=jT(),v=rE(),y=v?.claimFooter,b=(0,Q.useContext)(JR),x=b?.claim;(0,Q.useLayoutEffect)(()=>x?.(),[x]),(0,Q.useLayoutEffect)(()=>y?.(),[y]);let{tComponent:S,isReady:C}=q({component:K.LOW_LEVEL_FORM_MESSAGE}),w=(0,Q.useMemo)(()=>k9(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(K.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=>_C(e,t)!==void 0)&&t.add(r)}),h(e=>wMe(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=zD(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 L(E,e)||N(e)},L=async(e,t)=>{if(!n||!g)return!0;let r=w.slice(e,t).flatMap(e=>Array.from(c.current.get(e.name)??[]));return ZO(g,r)},R=async()=>{if(n&&g){let e=w[E]?.name,t=e?c.current.get(e):void 0;if(!await ZO(g,t?Array.from(t):[]))return}E<T-1&&N(E+1)},z=E===0,B=E===T-1,ee=e=>{if(e.key!==`Enter`||B||e.defaultPrevented||e.nativeEvent.isComposing)return;let t=e.target;t instanceof HTMLInputElement&&!TMe.has(t.type)&&(e.preventDefault(),R())},te=e=>{e.detail>1&&Date.now()-d.current<EMe&&(e.preventDefault(),e.stopPropagation())};if(!C)return null;let ne=S(K.LOW_LEVEL_FORM_MESSAGE,`wizardPrevious`),V=S(K.LOW_LEVEL_FORM_MESSAGE,`wizardNext`),re=i??v?.submitButton??(0,$.jsx)(Y,{type:`submit`,disabled:_?.disabled,children:S(K.LOW_LEVEL_FORM_MESSAGE,`wizardSubmit`)},`submit`),ie=_?.isExisting===!0;return(0,$.jsx)(YD.Provider,{value:k,children:(0,$.jsxs)(`div`,{className:e,"data-guidance-wizard":``,onKeyDown:ee,children:[(0,$.jsx)(`div`,{ref:l,children:(0,$.jsx)(wO,{currentStep:E,totalSteps:T,orientation:Ui.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)(TO,{step:t,role:`listitem`,"aria-current":t===E?`step`:void 0,children:[(0,$.jsx)(EO,{step:t,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`flex flex-col items-center text-center`,children:(0,$.jsx)(OO,{step:t,children:(0,$.jsx)(`span`,{id:`wizard-tab-${e.name}`,children:A(e.name,t)})})})]}),t<T-1&&(0,$.jsx)(DO,{step:t,"aria-hidden":`true`})]},e.name))})}),w.map((e,t)=>{let n=_?.wizardStepDescriptions?.[e.name];return(0,$.jsxs)(`div`,{hidden:t!==E,...BD(P,e.name),children:[n?(0,$.jsx)(`p`,{className:`mb-field text-sm text-muted-foreground`,children:n}):null,(0,$.jsx)(Ry,{children:(0,$.jsx)(XD.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:te,children:[(0,$.jsx)(Y,{type:`button`,variant:X.OUTLINE,onClick:F,disabled:z||_?.disabled,children:ne}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-element`,children:[v?.cancelButton,v?.draftSaveButton,(B||ie)&&(0,$.jsx)(Q.Fragment,{children:re},`submit`),!B&&(0,$.jsx)(Y,{type:`button`,variant:ie?X.OUTLINE:void 0,onClick:R,disabled:_?.disabled,children:V},`next`)]})]})]})})}function A9({name:e,className:t,children:n}){let r=jT(),i=tk(),{getRecipe:a}=Ng(),o=r?.groupLabels?.[e]??i?.groupLabels?.[e];return(0,$.jsxs)(`div`,{className:t,"data-guidance-group":e,children:[o&&(0,$.jsx)(`h3`,{className:G(`col-span-full mb-element`,a(It.TYPOGRAPHY,Ea.EYEBROW).base),children:o}),n]})}A9.displayName=`Group`;function j9({className:e,children:t}){return e?(0,$.jsx)(`div`,{className:e,children:t}):(0,$.jsx)($.Fragment,{children:t})}function M9({name:e,className:t,addLabel:n,removeLabel:r,minItems:i,maxItems:a,children:o}){let s=wD(e),{control:c}=LC(),{fields:l,append:u,remove:d}=Dw({control:c,name:s});uk(s),AM(s);let{tComponent:f,isReady:p}=q({component:K.LOW_LEVEL_FORM_MESSAGE});if(!p)return null;let m=OMe(o),h=a===void 0||l.length<a,g=i===void 0||l.length>i,_=n??f(K.LOW_LEVEL_FORM_MESSAGE,`arrayAddItem`),v=f(K.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)(SD,{pathPrefix:`${s}[${t}]`,children:m?Q.cloneElement(m):null}),g&&(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,onClick:()=>d(t),className:`mt-1`,children:r??f(K.LOW_LEVEL_FORM_MESSAGE,`arrayRemoveItem`,{label:`${v} ${t+1}`})})]},e.id)),h&&(0,$.jsx)(Y,{type:`button`,variant:X.OUTLINE,onClick:()=>u({}),className:`mt-2`,children:_})]})}function OMe(e){let t=null;return Q.Children.forEach(e,e=>{!t&&Q.isValidElement(e)&&e.type===j9&&(t=e)}),t}Ok(M9);function kMe({className:e}){return(0,$.jsx)(`hr`,{className:e})}function AMe(e){let{resourceType:t,viewRef:n,contextResourceIdentifiers:r,inputs:i,urlParamValues:a,localErrorOnly:o=!1}=e,{registry:s}=fm(),{resolvedRegionalPreferences:c}=q(),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)(()=>gp({identity:xp(t,{ref:n}),chartView:l,contextResourceIdentifiers:r??{}}),[t,n,l,r]),d=g_({surfaceDefinition:l,runtimeDescriptor:u,explicitContextResourceIdentifiers:r,explicitInputs:i,urlParamValues:a});return d_(d?.chartDefinition,d?.executionChartRef,d?.resolvedInputs,d?.contextResourceIdentifiers,a,o,c.timezone)}function jMe(e,t){let n=(Array.isArray(e?.operations)?e.operations:[]).find(e=>String(e.operationIdentifier)===J.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 MMe(e,t){let n=e.accessProfile,r=lt(n?.organizationOwnRows,t),i=Qi(n?.organizationAssignedRows,t);if(!r&&!i)return e.organizationRoles;let a=t=>xo(t,e.roleTables.orgRolesConfig);return e.organizationRoles.filter(e=>Yie({role:e,ownRowsDeclaration:r,assignedRowsDeclaration:i,roleHierarchyOf:a}))}function N9(e,t,n){return[e.dataQuery.mainResourceType,...(e.dataQuery.joins??[]).map(e=>e.resourceType)].every(r=>{let i=jMe(t.resourceConfigurations[r],e.accessControl?.roles);return!i||i.length===0?!1:Im(i,{...n,organizationRoles:MMe(n,r)})})}function P9(e){return e.rows??gl.ONE}function NMe(e,t){if(e.height!==void 0)return t===P9(e)?e.height:t===gl.TWO?e.height*2+32:Math.max(1,Math.round((e.height-32)/2))}function F9(e,t,n){let r=NMe(e,n),{height:i,...a}=e;return{...a,span:t,rows:n,...r===void 0?{}:{height:r}}}function I9(e,t){if(!t)return e.map(e=>({tile:e,declared:e,hidden:!1}));let n=new Map(e.map(e=>[Js(e),e])),r=new Set,i=[];for(let e of t){let t=Js(e),a=n.get(t);a&&!r.has(t)&&(r.add(t),i.push({tile:F9(a,e.span,e.rows),declared:a,hidden:e.hidden}))}for(let t of e)r.has(Js(t))||i.push({tile:t,declared:t,hidden:!1});return i}function PMe(e,t){return I9(e,t).filter(e=>!e.hidden).map(e=>e.tile)}function L9(e){return e.map(({tile:e,hidden:t})=>({resourceType:e.resourceType,chartViewRef:e.chartViewRef,span:e.span??Uc.ONE,rows:P9(e),hidden:t}))}function R9(e,t){let n=e?IMe:FMe;return t===gl.TWO&&!e?n*2+32:n}var FMe=280,IMe=64,LMe=tl.getLogger(),z9=Wo.ORGANIZATION_DASHBOARD_LAYOUTS,B9;(function(e){e.LOADING=`loading`,e.SETTLED=`settled`})(B9||={});var V9=new Map;function H9(e){V9.get(e)?.forEach(e=>e())}function U9(e,t){return e?.find(e=>e.operationIdentifier===t&&e.isOperationDefault===!0&&e.isBulkOperation!==!0&&e.variantType===oe.API_CALL)}function W9(e){return t=>{throw H9(e),t}}function RMe(e){if(Array.isArray(e))return e;let t=e?.data;return Array.isArray(t)?t:[]}function zMe(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e.data,n=t&&typeof t==`object`&&!Array.isArray(t)?t:e;return typeof n._id==`string`&&Array.isArray(n.tiles)?n:void 0}function G9(e,t){let{registry:n,doOperation:r}=fm(),i=Zp()?.currentOrganizationId??null,a=n.resourceConfigurations[z9],o=a?.operations,s=n.resourceConfigurations[Wo.ORGANIZATIONS]?.resourceFieldIdentifier??`organizationId`,c=a?.resourceFieldIdentifier,l=(0,Q.useMemo)(()=>({list:U9(o,J.LIST),create:U9(o,J.CREATE),update:U9(o,J.UPDATE),remove:U9(o,J.DELETE)}),[o]),u=e=>!!e&&Wm({...e,resourceType:z9},t),d=!!e&&i!==null&&u(l.list),f=d&&u(l.create)&&u(l.update)&&u(l.remove),p=d?`${i}|${e}`:null,[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(0),v=(0,Q.useRef)(r);v.current=r,(0,Q.useEffect)(()=>{if(!p)return;let e=()=>_(e=>e+1),t=V9.get(p)??new Set;return t.add(e),V9.set(p,t),()=>{t.delete(e),t.size===0&&V9.delete(p)}},[p]),(0,Q.useEffect)(()=>{if(!p||!l.list||i===null||!e)return;let t=!1,n=e=>{t||h({key:p,stored:e})};return v.current(no.buildOperationPathKeyFromOperation(l.list),{contextualParameters:{[s]:i},queryParameters:{dashboardRef:e,page:1,limit:1}},{silent:!0}).then(t=>n(RMe(t).find(t=>t.dashboardRef===e))).catch(t=>{LMe.warn(`Could not read the organization's dashboard layout; showing the declared one`,{layoutRef:e,organizationId:i,error:t}),n(void 0)}),()=>{t=!0}},[p,l.list,i,e,s,g]);let y=p&&m?.key===p?m.stored:void 0;return{readState:!p||m?.key===p?B9.SETTLED:B9.LOADING,stored:y,canEdit:f,save:(0,Q.useCallback)(async t=>{if(!p||i===null||!e||!l.create||!l.update||!c)return;let n={[s]:i},r=zMe(await(y?v.current(no.buildOperationPathKeyFromOperation(l.update),{contextualParameters:{...n,[c]:y._id},requestData:{tiles:t}}):v.current(no.buildOperationPathKeyFromOperation(l.create),{contextualParameters:n,requestData:{dashboardRef:e,tiles:t}})).catch(W9(p)));r&&h({key:p,stored:r}),H9(p)},[p,i,e,l.create,l.update,c,s,y]),reset:(0,Q.useCallback)(async()=>{p&&i!==null&&l.remove&&c&&y&&(await v.current(no.buildOperationPathKeyFromOperation(l.remove),{contextualParameters:{[s]:i,[c]:y._id}}).catch(W9(p)),h({key:p,stored:void 0}),H9(p))},[p,i,l.remove,c,s,y])}}var K9=K.HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR,q9=zd(Uc),J9=zd(gl),BMe=Object.values(Uc),VMe=Object.values(gl);function HMe(e){return`${e.resourceType}:${e.chartViewRef}`}function Y9(e,t,n){let r=t+n;if(r<0||r>=e.length)return[...e];let i=[...e],[a]=i.splice(t,1);return i.splice(r,0,a),i}function X9({tiles:e,layout:t,onDone:n}){let{tComponent:r,tView:i,isReady:a}=q({component:K9}),{renderIcon:o}=ef(),s=(0,Q.useCallback)((e,t)=>r(K9,e,t),[r]),[c,l]=(0,Q.useState)(()=>I9(e,t.stored?.tiles)),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),m=(0,Q.useCallback)((e,t)=>{l(n=>n.map((n,r)=>r===e?t(n):n))},[]),h=(0,Q.useCallback)(async e=>{d(!0),p(!1);try{await e(),n()}catch{p(!0)}finally{d(!1)}},[n]),g=(0,Q.useMemo)(()=>BMe.map(e=>({value:e,label:s(`span_${e}`)})),[s]),_=(0,Q.useMemo)(()=>VMe.map(e=>({value:e,label:s(`rows_${e}`)})),[s]);return a?(0,$.jsxs)(`div`,{className:`flex flex-col gap-group`,"data-chart-dashboard-layout-editor":!0,children:[(0,$.jsx)(`ol`,{className:`flex flex-col gap-element`,children:c.map((e,t)=>{let n=HMe(e.tile),r=i(ho.CHART,`resources.${e.tile.resourceType}.${e.tile.chartViewRef}`,`title`)||n,a=e.tile.span??Uc.ONE,d=e.tile.rows??gl.ONE;return(0,$.jsxs)(`li`,{className:`flex flex-wrap items-center gap-item`,"data-chart-dashboard-layout-tile":n,"data-hidden":e.hidden?``:void 0,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col`,children:[(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.ICON_SM,"aria-label":s(`moveUp`),disabled:u||t===0,onClick:()=>l(e=>Y9(e,t,-1)),children:o(W.CHEVRON_UP,{size:tr.XS})}),(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.ICON_SM,"aria-label":s(`moveDown`),disabled:u||t===c.length-1,onClick:()=>l(e=>Y9(e,t,1)),children:o(W.CHEVRON_DOWN,{size:tr.XS})})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(Z,{as:`div`,typography:Ea.BODY,children:r}),(0,$.jsx)(Z,{as:`div`,typography:Ea.DESCRIPTION,children:s(`tilePosition`,{position:t+1,count:c.length})})]}),(0,$.jsx)(yI,{name:`${n}:shown`,schema:Md(),"aria-label":s(`shownLabel`),checked:!e.hidden,disabled:u,onCheckedChange:e=>m(t,t=>({...t,hidden:!e}))}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{as:`div`,typography:Ea.DESCRIPTION,children:s(`widthLabel`)}),(0,$.jsx)(fF,{name:`${n}:span`,schema:q9,options:g,value:a,disabled:u,onChange:e=>m(t,t=>({...t,tile:F9(t.declared,q9.parse(e),d)}))})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-item-xs`,children:[(0,$.jsx)(Z,{as:`div`,typography:Ea.DESCRIPTION,children:s(`heightLabel`)}),(0,$.jsx)(fF,{name:`${n}:rows`,schema:J9,options:_,value:d,disabled:u,onChange:e=>m(t,t=>({...t,tile:F9(t.declared,a,J9.parse(e))}))})]})]},n)})}),f&&(0,$.jsx)(OD,{variant:`destructive`,children:(0,$.jsx)(AD,{children:s(`saveFailed`)})}),(0,$.jsxs)(QW,{children:[t.stored&&(0,$.jsx)(Y,{type:`button`,variant:X.OUTLINE,disabled:u,onClick:()=>void h(t.reset),"data-chart-dashboard-layout-reset":!0,children:s(`resetButton`)}),(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,disabled:u,onClick:n,children:s(`cancelButton`)}),(0,$.jsx)(Y,{type:`button`,variant:X.DEFAULT,loading:u,disabled:u,onClick:()=>void h(()=>t.save(L9(c))),"data-chart-dashboard-layout-save":!0,children:s(`saveButton`)})]})]}):null}function Z9({tiles:e,layout:t}){let{tComponent:n,isReady:r}=q({component:K9}),[i,a]=(0,Q.useState)(!1),o=(0,Q.useCallback)(()=>a(!1),[]);return r?(0,$.jsxs)(`div`,{className:`flex justify-end`,"data-chart-dashboard-layout-control":!0,children:[(0,$.jsx)(Y,{type:`button`,variant:X.GHOST,size:df.SM,onClick:()=>a(!0),"data-chart-dashboard-layout-open":!0,children:n(K9,`customizeButton`)}),(0,$.jsx)(qW,{open:i,onOpenChange:a,children:(0,$.jsxs)(YW,{children:[(0,$.jsxs)(ZW,{children:[(0,$.jsx)($W,{children:n(K9,`title`)}),(0,$.jsx)(eG,{children:n(K9,`description`)})]}),i&&(0,$.jsx)(X9,{tiles:e,layout:t,onDone:o})]})})]}):null}var Q9;(function(e){e.TWO=`two`,e.THREE=`three`,e.FOUR=`four`})(Q9||={});function $9({tiles:e,columns:t=Q9.FOUR,layoutRef:n,className:r}){let{registry:i}=fm(),a=rS(),o=G9(n,a),s=(0,Q.useMemo)(()=>I9(e,o.stored?.tiles).filter(e=>!e.hidden).map(e=>e.tile),[e,o.stored]),c=(0,Q.useMemo)(()=>s.flatMap(e=>{let t=i.resourceConfigurations[e.resourceType]?.frontendConfiguration?.chartViews?.find(t=>t.ref===e.chartViewRef);return t!==void 0&&!N9(t.chartDefinition,i,a)?[]:[{tile:e,isFigure:t?.chartDefinition.chartType===pae.KPI}]}),[s,i,a]);if(o.readState===B9.LOADING||c.length===0&&!o.canEdit)return null;let l=UMe[t];return(0,$.jsxs)(`div`,{className:G(`@container flex w-full flex-col gap-element`,r),"data-chart-dashboard":!0,children:[o.canEdit&&(0,$.jsx)(Z9,{tiles:e,layout:o}),c.length>0&&(0,$.jsx)(`div`,{className:G(`grid grid-cols-1 gap-group`,l.columns),children:c.map(({tile:e,isFigure:t})=>(0,$.jsx)(GMe,{tile:e,isFigure:t,grid:l},`${e.resourceType}:${e.chartViewRef}`))})]})}var UMe={[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 WMe(e,t){let n=e.span??Uc.ONE;return G(n===Uc.TWO&&t.spanTwo,n===Uc.FULL&&`col-span-full`,e.rows===gl.TWO&&t.rowsTwo)}function GMe({tile:e,isFigure:t,grid:n}){let{tView:r}=q(),i=r(ho.CHART,`resources.${e.resourceType}.${e.chartViewRef}`,`title`);return(0,$.jsxs)(`section`,{className:G(`flex min-w-0 flex-col gap-element`,WMe(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:Ea.EYEBROW,children:i}),(0,$.jsx)(d9,{resourceType:e.resourceType,viewRef:e.chartViewRef,height:e.height??R9(t,e.rows)})]})}function KMe(e){let{tiles:t,columns:n,layoutRef:r,...i}=e;function a(){return(0,$.jsx)(UU,{children:(0,$.jsx)($9,{tiles:t,columns:n,layoutRef:r})})}return Sp(a,i)}function qMe(e,t=em.APPLICATION){return lp.parse({ref:e,scope:t,options:{showProgress:!0,allowDismiss:!0,persistState:!0},elements:[]})}function JMe(e,t){return{...e,elements:[...e.elements,t]}}function YMe(e,t){return{...e,elements:e.elements.filter(e=>e.ref!==t)}}function XMe(e,t,n){return{...e,elements:e.elements.map(e=>e.ref===t?{...e,status:n}:e)}}function ZMe(e){if(e.elements.length===0)return 0;let t=e.elements.filter(e=>e.status===Ti.COMPLETED).length;return Math.round(t/e.elements.length*100)}function QMe(e){return e.elements.every(e=>e.status===Ti.COMPLETED)}function $Me(e,t){return e.elements.filter(e=>e.type===t)}function eNe(e){return JSON.stringify(e,null,2)}function tNe(e){let t=JSON.parse(e);return lp.parse(t)}var nNe=t({ACTOR_TASK_TOPICS_VOCABULARY:()=>gf,AI_ActorCard:()=>v6,AI_ActorExecutionModeBadge:()=>b6,AI_ActorRoleBadge:()=>y6,AI_ActorTeam:()=>oDe,AI_AgentCapabilities:()=>HDe,AI_AgentCard:()=>c8,AI_AgentList:()=>s8,AI_AgentPromptSpec:()=>VDe,AI_ApprovalQueue:()=>XU,AI_ApprovalRequest:()=>YU,AI_Artifact:()=>Mke,AI_ArtifactAction:()=>zke,AI_ArtifactActions:()=>Rke,AI_ArtifactClose:()=>Pke,AI_ArtifactContent:()=>Fke,AI_ArtifactDescription:()=>Lke,AI_ArtifactFileContent:()=>IDe,AI_ArtifactHeader:()=>Nke,AI_ArtifactItem:()=>a8,AI_ArtifactList:()=>i8,AI_ArtifactOrigin:()=>PDe,AI_ArtifactStructuredContent:()=>LDe,AI_ArtifactTextContent:()=>FDe,AI_ArtifactTitle:()=>Ike,AI_Canvas:()=>Jf,AI_ChainOfThought:()=>n7,AI_ChainOfThoughtContent:()=>a7,AI_ChainOfThoughtHeader:()=>r7,AI_ChainOfThoughtImage:()=>uje,AI_ChainOfThoughtSearchResult:()=>lje,AI_ChainOfThoughtSearchResults:()=>cje,AI_ChainOfThoughtStep:()=>i7,AI_Checkpoint:()=>dje,AI_CodeBlock:()=>b5,AI_Confirmation:()=>MAe,AI_Connection:()=>tje,AI_Context:()=>ije,AI_Controls:()=>pf,AI_Conversation:()=>O5,AI_ConversationContent:()=>k5,AI_ConversationEmptyState:()=>A5,AI_ConversationScrollButton:()=>j5,AI_ConversationThread:()=>lQ,AI_ConversationThreadComposer:()=>uQ,AI_ConversationThreadDiscussions:()=>dQ,AI_DecisionRequest:()=>ZU,AI_DiffBlock:()=>x5,AI_Edge:()=>nje,AI_ExecutionPlan:()=>M6,AI_ExecutionPlanProgress:()=>P6,AI_ExecutionPlanStep:()=>N6,AI_ExecutionStream:()=>eje,AI_ExecutionUsage:()=>J6,AI_ExecutionUsageSummary:()=>X6,AI_FlowExecutionCanvas:()=>pDe,AI_FlowExecutionSummary:()=>mDe,AI_FlowExecutionTimeline:()=>S6,AI_FlowExecutionTimelineItem:()=>hDe,AI_FlowNodeStatusBadge:()=>yf,AI_FlowNodeStepBadge:()=>Ff,AI_GraphViewer:()=>x6,AI_HumanInputRequest:()=>QU,AI_Image:()=>Kke,AI_InlineCitation:()=>fje,AI_Loader:()=>sje,AI_Message:()=>gQ,AI_MessageAction:()=>bQ,AI_MessageActions:()=>yQ,AI_MessageAttachment:()=>Txe,AI_MessageAttachments:()=>Exe,AI_MessageBranch:()=>yxe,AI_MessageBranchContent:()=>bxe,AI_MessageBranchNext:()=>Cxe,AI_MessageBranchPage:()=>wxe,AI_MessageBranchPrevious:()=>Sxe,AI_MessageBranchSelector:()=>xxe,AI_MessageContent:()=>_Q,AI_MessageResponse:()=>vQ,AI_MessageToolbar:()=>Dxe,AI_ModelSelector:()=>aje,AI_Node:()=>lf,AI_OpenInChat:()=>oje,AI_Panel:()=>$5,AI_Plan:()=>pje,AI_PlanAction:()=>yje,AI_PlanContent:()=>gje,AI_PlanDescription:()=>vje,AI_PlanFooter:()=>bje,AI_PlanHeader:()=>mje,AI_PlanTitle:()=>_je,AI_PlanTrigger:()=>hje,AI_PromptInput:()=>N5,AI_PromptInputActionAddAttachments:()=>uAe,AI_PromptInputActionMenu:()=>oAe,AI_PromptInputActionMenuContent:()=>cAe,AI_PromptInputActionMenuItem:()=>lAe,AI_PromptInputActionMenuTrigger:()=>sAe,AI_PromptInputAttachment:()=>eAe,AI_PromptInputAttachments:()=>tAe,AI_PromptInputBody:()=>nAe,AI_PromptInputButton:()=>aAe,AI_PromptInputCommand:()=>_Ae,AI_PromptInputCommandEmpty:()=>bAe,AI_PromptInputCommandGroup:()=>xAe,AI_PromptInputCommandInput:()=>vAe,AI_PromptInputCommandItem:()=>SAe,AI_PromptInputCommandList:()=>yAe,AI_PromptInputCommandSeparator:()=>CAe,AI_PromptInputFooter:()=>F5,AI_PromptInputHeader:()=>rAe,AI_PromptInputHoverCard:()=>wAe,AI_PromptInputHoverCardContent:()=>EAe,AI_PromptInputHoverCardTrigger:()=>TAe,AI_PromptInputProvider:()=>$ke,AI_PromptInputSelect:()=>fAe,AI_PromptInputSelectContent:()=>mAe,AI_PromptInputSelectItem:()=>hAe,AI_PromptInputSelectTrigger:()=>pAe,AI_PromptInputSelectValue:()=>gAe,AI_PromptInputSpeechButton:()=>dAe,AI_PromptInputSubmit:()=>I5,AI_PromptInputTab:()=>OAe,AI_PromptInputTabBody:()=>AAe,AI_PromptInputTabItem:()=>jAe,AI_PromptInputTabLabel:()=>kAe,AI_PromptInputTabsList:()=>DAe,AI_PromptInputTextarea:()=>P5,AI_PromptInputTools:()=>iAe,AI_Queue:()=>NAe,AI_QueueItem:()=>FAe,AI_QueueItemAction:()=>BAe,AI_QueueItemActions:()=>zAe,AI_QueueItemAttachment:()=>VAe,AI_QueueItemContent:()=>LAe,AI_QueueItemDescription:()=>RAe,AI_QueueItemFile:()=>UAe,AI_QueueItemImage:()=>HAe,AI_QueueItemIndicator:()=>IAe,AI_QueueList:()=>PAe,AI_QueueMessageItem:()=>YAe,AI_QueueSection:()=>WAe,AI_QueueSectionContent:()=>qAe,AI_QueueSectionLabel:()=>KAe,AI_QueueSectionTrigger:()=>GAe,AI_QueueTodoItem:()=>JAe,AI_Reasoning:()=>c7,AI_ReasoningContent:()=>u7,AI_ReasoningTrigger:()=>l7,AI_RiskLevelBadge:()=>A6,AI_Shimmer:()=>e7,AI_Source:()=>V5,AI_Sources:()=>R5,AI_SourcesContent:()=>B5,AI_SourcesTrigger:()=>z5,AI_Suggestion:()=>U5,AI_Suggestions:()=>H5,AI_SystemCard:()=>w6,AI_SystemCardCompact:()=>T6,AI_SystemCatalog:()=>vDe,AI_SystemDetail:()=>E6,AI_SystemKindBadge:()=>O6,AI_SystemStatusBadge:()=>k6,AI_Task:()=>XAe,AI_TaskContent:()=>QAe,AI_TaskDetail:()=>s0,AI_TaskItem:()=>$Ae,AI_TaskItemFile:()=>K5,AI_TaskList:()=>l0,AI_TaskMemory:()=>DDe,AI_TaskMemoryEntryItem:()=>L6,AI_TaskMemoryScope:()=>I6,AI_TaskTimeline:()=>u0,AI_TaskTrigger:()=>ZAe,AI_Tool:()=>J5,AI_ToolContent:()=>X5,AI_ToolHeader:()=>Y5,AI_ToolInput:()=>Z5,AI_ToolOutput:()=>Q5,AI_Toolbar:()=>rje,AI_WebPreview:()=>qke,AI_WebPreviewBody:()=>Zke,AI_WebPreviewConsole:()=>Qke,AI_WebPreviewNavigation:()=>Jke,AI_WebPreviewNavigationButton:()=>Yke,AI_WebPreviewUrl:()=>Xke,APP_LEVEL_NAVIGATION_SOURCE:()=>ki,APP_SCOPE_FIELD_DEFAULT_POSITION:()=>999,ARRAY_ROW_TEMPLATE_GUTTER_CLASS:()=>`w-7`,Accordion:()=>uO,AccordionContent:()=>pO,AccordionItem:()=>dO,AccordionTrigger:()=>fO,ActionBar:()=>WS,ActionBarPopoverChrome:()=>VS,ActionButton:()=>u8,ActionPlacement:()=>ol,ActionVisibility:()=>Ul,ActivityBarRendering:()=>pi,ActivityBarRenderingSchema:()=>d,ActorActivity:()=>g6,Alert:()=>OD,AlertDescription:()=>AD,AlertDialog:()=>Iw,AlertDialogAction:()=>Uw,AlertDialogCancel:()=>Ww,AlertDialogContent:()=>Rw,AlertDialogDescription:()=>Hw,AlertDialogFooter:()=>Bw,AlertDialogHeader:()=>zw,AlertDialogTitle:()=>Vw,AlertDialogTrigger:()=>Lw,AlertTitle:()=>kD,AnalyticsContext:()=>s$,AnalyticsContextProvider:()=>l$,AnalyticsIdentityPublisherContext:()=>c$,AnalyticsProviderRegistry:()=>a$,AnonymousSessionProvider:()=>op,AnonymousSessionStatus:()=>hse,ApiNotReadyError:()=>gie,ApiReadinessChecker:()=>ore,AppCelebrationOverlay:()=>UQ,AppConfiguration_Frontend_Schema:()=>Cm,AppLayoutPreset_ErrorBoundary_Default:()=>Fy,AppLayoutPreset_Home_Default:()=>VU,AppLayoutPreset_RouterErrorBoundary_Default:()=>zy,AppLayout_AuthenticatedRoute:()=>NH,AppLayout_ConsentGate:()=>DH,AppLayout_DocumentAcceptanceGate:()=>AH,AppLayout_ErrorBoundary:()=>Iy,AppLayout_Home:()=>HU,AppLayout_MainContainer:()=>wH,AppLayout_NotificationCenter:()=>O8,AppLayout_RouterErrorBoundary:()=>By,AppLevelComponentConfigurationSchema:()=>rse,AppLoadingGate:()=>nb,AppLoadingIdentifier:()=>Tie,AppModeDefinitionSchema:()=>Lne,AppModeProvider:()=>Jx,AppNotificationCenter:()=>D8,AppScopeContext:()=>Qoe,AppScopeProvider:()=>Tm,AppScopeSessionMode:()=>Iee,AppShellContentOutlet:()=>v4,AppShellLoadingState:()=>m4,AppShellOverlayPortalLayer:()=>g4,AppShellOverlaysOutlet:()=>y4,AppShellProviders:()=>h4,AppShellRegionOutlet:()=>_4,ApplicationContext:()=>Vi,ApplicationLevelComponentType:()=>Ol,ApplicationLevel_ActivityBar:()=>P2,ApplicationLevel_CommandMenu:()=>Kje,ApplicationLevel_ControlPanel:()=>qje,ApplicationLevel_MenuBar:()=>F2,ApplicationLevel_MenuUserOrg:()=>Jje,ApplicationLevel_NavigationBack:()=>pB,ApplicationLevel_NotificationCenter:()=>Zje,ApplicationLevel_QuickActionButton:()=>I2,ApplicationLevel_QuickSwitcher:()=>Qje,ApplicationLevel_Sidebar:()=>L2,ApplicationLevel_StatusBar:()=>R2,ApplicationLevel_Toolbar:()=>z2,ApplicationLevel_UtilityPanel:()=>B2,ApplicationMainProvider:()=>B$,ApprovalSeal:()=>Yj,ApprovalSealCheckState:()=>Jj,ApprovalSealReadState:()=>qj,ArrayAutosavesContext:()=>oI,ArrayField:()=>M9,ArrayItemTemplate:()=>j9,AspectRatio:()=>aOe,AuthPage_OneOffSession:()=>uZ,AuthSessionContext:()=>ese,AuthSessionProvider:()=>rm,AuthSessionUtils:()=>Km,Auth_AuthCallback:()=>iX,Auth_ChatIdentityLink:()=>wZ,Auth_ConfirmEmail:()=>eZ,Auth_EnrollmentRequired:()=>VX,Auth_Invitation:()=>sZ,Auth_MagicLinkVerify:()=>cX,Auth_Main:()=>ZX,Auth_MfaChallenge:()=>RX,Auth_OAuthConsent:()=>yZ,Auth_OAuthLoggedOut:()=>EZ,Auth_OAuthLogoutConfirm:()=>kZ,Auth_OneOffSession:()=>lZ,Auth_OrganizationOnboarding:()=>KX,Auth_PasswordLost:()=>_Z,Auth_Register:()=>FZ,AutomatedArrayField:()=>mI,AutomatedForm:()=>eE,AutomatedLayoutFrontendUtils:()=>_r,AutomatedLayoutTemplateKind:()=>wT,AutomaticDisplayer:()=>AB,AutosaveFieldState:()=>Yw,AutosaveIndicator:()=>zM,AutosaveProvider:()=>CE,AutosaveTrigger:()=>Ts,Avatar:()=>h8,AvatarFallback:()=>_8,AvatarImage:()=>g8,BADGE_DISPLAY_CAP:()=>99,BADGE_VARIANT_INDICATOR:()=>Zg,BILLING_COMMAND_MENU_ITEM:()=>a6,BILLING_SETTINGS_SECTION_REF:()=>i6,BackendProxyAnalyticsProvider:()=>i$,Badge:()=>Jd,BillingContext:()=>Ah,BillingPortalLink:()=>D1,BillingProvider:()=>xh,Breadcrumb:()=>hB,BreadcrumbEllipsis:()=>xB,BreadcrumbItem:()=>_B,BreadcrumbLink:()=>vB,BreadcrumbList:()=>gB,BreadcrumbPage:()=>yB,BreadcrumbSeparator:()=>bB,Button:()=>Y,ButtonGroup:()=>d8,ButtonGroupSeparator:()=>JDe,ButtonGroupText:()=>f8,ButtonLabelOverflow:()=>_f,ButtonVariants_Variant:()=>X,CATEGORY_LOADING_DEFAULTS:()=>eb,CHART_DASHBOARD_ROW_GAP_PX:()=>32,CHART_ROUTE_CONTEXT_QUERY_PARAM_PREFIX:()=>noe,CHART_ROUTE_PATH_PREFIX:()=>Ooe,COLLECTION_SURFACE_ATTRIBUTE:()=>lA,COMMON_ENUM_DISPLAY_CONFIG:()=>__,COMPOSITE_ROUTE_CONTEXT_QUERY_PARAM_PREFIX:()=>voe,Calendar:()=>j8,CalendarDayButton:()=>M8,Card:()=>wF,CardAction:()=>kF,CardActionPlacementSchema:()=>vne,CardContent:()=>jF,CardDescription:()=>AF,CardFooter:()=>DF,CardHeader:()=>EF,CardLayoutStyle:()=>Nc,CardListbox:()=>TF,CardStatusEdge:()=>SF,CardTitle:()=>OF,Carousel:()=>V8,CarouselContent:()=>H8,CarouselItem:()=>U8,CarouselNext:()=>sOe,CarouselPrevious:()=>oOe,ChartDashboard:()=>$9,ChartDashboardColumns:()=>Q9,ChartDashboardLayoutControl:()=>Z9,ChartDashboardLayoutEditor:()=>X9,ChartDashboardLayoutReadState:()=>B9,ChartEmptyState:()=>v_,ChartErrorState:()=>m_,ChartLoadingSkeleton:()=>Sm,ChartView:()=>TJ,ChartWidget:()=>qh,ChatSignInCompletionOutcome:()=>Ib,Checkbox:()=>SI,CheckboxRoot:()=>CI,ChipsInput:()=>aI,Code:()=>s_,Collapsible:()=>bO,CollapsibleContent:()=>SO,CollapsibleTrigger:()=>xO,CollectionBoardConfigSchema:()=>Mie,CollectionCalendarConfigSchema:()=>One,CollectionDisplayMode:()=>vs,CollectionFilterPanelVisibility:()=>hl,CollectionFilterPresetContextValue:()=>Hc,CollectionFilterPresetRelativeMonthRange:()=>qs,CollectionFilterPresetRelativeRange:()=>As,CollectionFilterPresetSchema:()=>tne,CollectionFilterPresetValueSchema:()=>Vie,CollectionTimelineConfigSchema:()=>sae,CollectionToolbarPresence:()=>zo,ColorInput:()=>jI,ColorNotation:()=>B3,Combobox:()=>cx,ComboboxMultiple:()=>lx,Command:()=>mV,CommandBarPolicy:()=>vm,CommandDialog:()=>hV,CommandEmpty:()=>vV,CommandGroup:()=>yV,CommandInput:()=>gV,CommandItem:()=>bV,CommandList:()=>_V,CommandMenuCommandSchema:()=>wie,CommandMenuDisplayPolicy:()=>ao,CommandMenuPaletteGroupKind:()=>g2,CommandMenuSearchResourceSchema:()=>Lre,CommandSeparator:()=>SV,CommandShortcut:()=>xV,ComponentNotInjected:()=>rl,ComponentRegistryKeyBuilder:()=>vie,ComponentRegistryService:()=>Ko,ComponentsViewportProvider:()=>Kg,ComposedChildrenRegistryProvider:()=>GJ,CompositeLayout:()=>UU,CompositeView:()=>IU,CompositeViewDefinitionBaseSchema:()=>Zoe,CompositeViewDefinitionSchema:()=>np,CompositeViewProvider:()=>MU,CompositeView_BaseFieldsSchema:()=>Joe,ConnectionStatusNotifier:()=>n$,ConsentBasedProviderActivationsContext:()=>vx,ConsentBasedProviderSdksProvider:()=>yx,ConsentGateStatus:()=>Hb,ConsoleAnalyticsProvider:()=>r$,ContentAreaRenderBranch:()=>Q0,ContentSection:()=>bT,ContentSectionContainer:()=>VO,ContentSectionGroup:()=>xT,ContentSectionLegend:()=>ST,ContextLoadingIdentifier:()=>Qc,ContextMenu:()=>QOe,ContextMenuCheckboxItem:()=>nke,ContextMenuContent:()=>t5,ContextMenuGroup:()=>eke,ContextMenuItem:()=>tke,ContextMenuLabel:()=>ake,ContextMenuRadioGroup:()=>rke,ContextMenuRadioItem:()=>ike,ContextMenuSeparator:()=>oke,ContextMenuShortcut:()=>ske,ContextMenuSub:()=>cke,ContextMenuSubContent:()=>n5,ContextMenuSubTrigger:()=>lke,ContextMenuTrigger:()=>$Oe,ControlPanelControlType:()=>h2,ControlPanelItemSchema:()=>fie,ConversationThreadEntryKind:()=>WZ,ConversationTurnState:()=>GZ,CoreIconRegistry:()=>tf,CrossFrontendHandoffClientError:()=>Z3,CustomComponentItemRefSchema:()=>nre,DEFAULT_ACTION_DISCLOSURE:()=>Vu,DEFAULT_BUTTON_COMPONENT_REQUIREMENT:()=>jf,DEFAULT_CHART_STYLE_PRESET:()=>pg,DEFAULT_ICON_CONFIG:()=>qae,DEFAULT_INSERTED_VIEW_LAUNCHER:()=>uoe,DEFAULT_MATERIAL_RUNTIME_POLICY:()=>Ug,DEFAULT_MAX_EMBEDDED_RESOURCE_DEPTH:()=>3,DEFAULT_SUMMARY_CHROME_MODE:()=>oG,DEFAULT_VALIDATION_MODE:()=>CT,DUPLICATE_KEY_ERROR_TYPE:()=>tT,DangerZone:()=>oY,DatePicker:()=>ZM,DateRangePicker:()=>cN,DateTimePicker:()=>eN,DateTimeRangePicker:()=>dN,DecisionApprovalSeal:()=>$j,DecisionInboxCapability:()=>Fv,DefaultHotkeyHandler:()=>A$,DescriptionDetails:()=>F1,DescriptionList:()=>N1,DescriptionTerm:()=>P1,DeviceInfoSchema:()=>zce,DeviceType:()=>Ay,Dialog:()=>qW,DialogClose:()=>XW,DialogContent:()=>YW,DialogDescription:()=>eG,DialogFooter:()=>QW,DialogHeader:()=>ZW,DialogTitle:()=>$W,DialogTrigger:()=>JW,DiffLineKind:()=>S5,DirectoryProvisioningCapability:()=>pv,DisabledActionHandling:()=>Li,DiscriminatorSwitch:()=>OR,DisplayChromeContext:()=>nk,DisplayChromeProvider:()=>rk,DisplayContextKind:()=>kA,DisplayContextKindProvider:()=>jA,DisplayDiscriminatorSwitch:()=>kR,DisplayField:()=>_R,DisplayFieldAddress:()=>Vj,DisplayFieldArray:()=>A8,DisplayFieldBigDecimal:()=>Hj,DisplayFieldBoolean:()=>Nj,DisplayFieldChrome:()=>rj,DisplayFieldCode:()=>Uj,DisplayFieldDate:()=>rM,DisplayFieldDateTime:()=>iM,DisplayFieldDuration:()=>zj,DisplayFieldEditable:()=>eR,DisplayFieldEnum:()=>Lj,DisplayFieldErrorBoundary:()=>vR,DisplayFieldFile:()=>eM,DisplayFieldFileAudio:()=>w8,DisplayFieldFileDocument:()=>T8,DisplayFieldFileGallery:()=>E8,DisplayFieldFileImage:()=>S8,DisplayFieldFileVideo:()=>C8,DisplayFieldJson:()=>Gj,DisplayFieldMoney:()=>Rj,DisplayFieldNumber:()=>Ij,DisplayFieldPhone:()=>Bj,DisplayFieldRangeBigDecimal:()=>tM,DisplayFieldRangeDate:()=>sM,DisplayFieldRangeDateTime:()=>cM,DisplayFieldRangeMoney:()=>nM,DisplayFieldRangeNumber:()=>oM,DisplayFieldRangeTime:()=>lM,DisplayFieldReadOnly:()=>_M,DisplayFieldString:()=>Fj,DisplayFieldTime:()=>aM,DisplayLayout:()=>uA,DisplayTemplateProvider:()=>$O,DisplayValueDispatcher:()=>gM,Divider:()=>cOe,DocumentAcceptanceGateStatus:()=>OH,Drawer:()=>n1,DrawerClose:()=>a1,DrawerContent:()=>i1,DrawerDescription:()=>l1,DrawerFooter:()=>s1,DrawerHeader:()=>o1,DrawerTitle:()=>c1,DrawerTrigger:()=>r1,DropdownMenu:()=>i5,DropdownMenuCheckboxItem:()=>dke,DropdownMenuContent:()=>o5,DropdownMenuGroup:()=>uke,DropdownMenuItem:()=>s5,DropdownMenuLabel:()=>c5,DropdownMenuRadioGroup:()=>fke,DropdownMenuRadioItem:()=>pke,DropdownMenuSeparator:()=>l5,DropdownMenuShortcut:()=>mke,DropdownMenuSub:()=>u5,DropdownMenuSubContent:()=>f5,DropdownMenuSubTrigger:()=>d5,DropdownMenuTrigger:()=>a5,Duration:()=>b8,EMPTY_AUTH_STATE:()=>fse,ENGINE_DEFAULT_HOTKEY_EMIT_SHORTCUTS:()=>k$,ENGINE_PAGE_METADATA:()=>Eo,ENGINE_SETTINGS_DESTINATIONS:()=>bv,ERROR_DEDUPLICATION_WINDOW_MS:()=>Dee,ERROR_MAX_DUPLICATES:()=>3,EXECUTION_ROUTE_CONTEXT_QUERY_PARAM_PREFIX:()=>ose,EmbedChart:()=>d9,EmbedComposite:()=>lMe,EmbedExecution:()=>uMe,EmbedExecutionDecisions:()=>y9,EmbedHostChart:()=>gMe,EmbedHostExecution:()=>vMe,EmbedHostResourceOperation:()=>dMe,EmbedLinkedConversations:()=>fMe,EmbedOnboarding:()=>cMe,EmbedRelatedChart:()=>_Me,EmbedRelatedExecution:()=>yMe,EmbedRelatedResourceList:()=>v9,EmbedRelatedResourceOperation:()=>_9,EmbedRelatedResourceSearch:()=>hMe,EmbedRepresentationMailboxes:()=>w9,EmbedRepresentationTeam:()=>C9,EmbedResourceOperation:()=>g9,EmbedResourceOwnedChartView:()=>kye,EmbedResourceOwnedCompositeView:()=>BY,EmbedResourceOwnedExecutionView:()=>Aye,EmbeddedResourceDescentBoundary:()=>UJ,EmbeddedResourceHostProvider:()=>OU,EmbeddedSigningFrame:()=>tMe,EmphasisedActionLabelsProvider:()=>KS,EmptyState:()=>dm,EmptyValueMark:()=>Aj,EngineNavigationEntry:()=>om,EnginePageItemRefSchema:()=>Gre,EnginePageRef:()=>Vl,EnginePageRefSchema:()=>_ne,EnvVariableLoaderFrontendService:()=>lo,EphemeralSessionTokenStorage:()=>nm,ErrorBoundary:()=>Ry,ErrorBuilderFrontend:()=>Ae,ErrorContext:()=>$ie,ErrorDisplay:()=>Py,ErrorManagementService:()=>Zi,ErrorPageActionSchema:()=>Foe,ErrorPageActionType:()=>mm,ErrorPageConfigDefinitionSchema:()=>lse,ErrorPageConfigSchema:()=>zoe,ErrorPageFeatureGuideItemSchema:()=>$oe,ErrorPageLeadMagnetType:()=>dse,ErrorPageSupportAccessSchema:()=>Voe,ErrorPageSupportType:()=>Uoe,ErrorProvider:()=>Ni,EventBusContext:()=>ea,EventBusProvider:()=>dt,ExecutionAnchorSource:()=>Jv,ExecutionConcreteOperationIdentitySchema:()=>nse,ExecutionDirtyMarkerScope:()=>Zv,ExecutionDirtyMarkerScopeContext:()=>Sy,ExecutionDirtyMarkerScopeProvider:()=>Cy,ExecutionFailedActionScope:()=>ty,ExecutionNavigationHandlingMode:()=>am,ExecutionNavigationPolicyDefinitionSchema:()=>Koe,ExecutionNavigationPolicyExceptionRuleSchema:()=>Poe,ExecutionParticipationDefinitionSchema:()=>mse,ExecutionParticipationPrefetchIntent:()=>Yv,ExecutionParticipationSource:()=>jm,ExecutionRuntimeContext:()=>ry,ExecutionRuntimeProvider:()=>ay,ExecutionSurfaceInOperationSchema:()=>Roe,ExecutionUsageReadState:()=>G6,ExecutionView:()=>LY,ExecutionViewAnchorBindingSource:()=>km,ExecutionViewAnchorDefinitionSchema:()=>Soe,ExecutionViewDefinitionSchema:()=>roe,FILE_VALIDATION_ERROR_TYPE:()=>nI,FLOWS_ACTORS_RELATION_VOCABULARY:()=>kf,FLOWS_ACTORS_STATUS_VOCABULARY:()=>Cf,FLOW_STEP_CATEGORY_ICONS:()=>Zd,FLOW_TRIGGER_TYPE_LABEL_KEYS:()=>Gae,FOCUS_INDICATOR_CLASSES:()=>dg,FORM_ERROR_SUMMARY_ATTRIBUTE:()=>HD,FORM_LEVEL_ERROR_PATH:()=>eT,FRONTEND_DECLARED_SCHEMA_KEY:()=>Oe,FRONTEND_PRODUCED_BADGE_SCOPE_ID:()=>l6,FRONTEND_SCHEMA_KEY:()=>Du,FeatureGate:()=>j0,FeatureLimitIndicator:()=>r6,FeatureLockBadge:()=>ZEe,FeatureRouteGuard:()=>Vh,FeatureUnavailableDialog:()=>XEe,FeatureUnavailablePrompt:()=>Ph,FeaturesContext:()=>hh,FeaturesProvider:()=>Qh,Field:()=>nx,FieldContent:()=>ax,FieldControlAriaProvider:()=>IM,FieldDescription:()=>ox,FieldError:()=>sx,FieldLabel:()=>rx,FieldScopeProvider:()=>SD,FieldSeparator:()=>Ple,FieldTiles:()=>yA,FieldTitle:()=>ix,FieldValueMembersChromeBoundary:()=>ak,FieldVariants_Orientation:()=>tx,FileApprovalSeal:()=>Qj,FileUpload:()=>P8,FilesPage_UploadGrant:()=>hZ,Files_UploadGrantDrop:()=>mZ,FlowStepCategory:()=>qf,FlowsActorsContext:()=>mW,FlowsActorsExecutionStatus:()=>uW,FlowsActorsProvider:()=>hW,FlowsActorsUIUtils:()=>Wf,FlowsActorsView:()=>EQ,FlowsActorsViewDefinitionSchema:()=>aoe,FlowsActors_AgentCard:()=>qDe,FlowsActors_AgentList:()=>KDe,FlowsActors_ApprovalQueue:()=>BW,FlowsActors_ApprovalRequest:()=>AW,FlowsActors_ArtifactItem:()=>BDe,FlowsActors_ArtifactList:()=>zDe,FlowsActors_ExecutionUsage:()=>Y6,FlowsActors_ExecutionUsageSummary:()=>Z6,FocusIndicatorShape:()=>e_,Form:()=>DT,FormChromeContext:()=>Gw,FormChromeProvider:()=>Kw,FormContextUtils:()=>ND,FormControl:()=>tOe,FormDescription:()=>nOe,FormErrorSummary:()=>JD,FormErrorSummarySlot:()=>QD,FormField:()=>JL,FormFieldAddress:()=>oL,FormFieldAddress_Preset_Default:()=>aL,FormFieldArray:()=>k8,FormFieldBigDecimal:()=>lL,FormFieldBigDecimal_Preset_Default:()=>cL,FormFieldBoolean:()=>EI,FormFieldBoolean_Preset_Default:()=>TI,FormFieldCheckboxGroup:()=>$F,FormFieldChrome:()=>UM,FormFieldCode:()=>uL,FormFieldComposite:()=>vN,FormFieldContext:()=>L8,FormFieldDate:()=>$M,FormFieldDateTime:()=>nN,FormFieldDateTime_Preset_Default:()=>tN,FormFieldDate_Preset_Default:()=>QM,FormFieldDuration:()=>JI,FormFieldDuration_Preset_Default:()=>qI,FormFieldEnum:()=>tI,FormFieldEnum_Preset_Default:()=>eI,FormFieldFile:()=>BL,FormFieldFile_Preset_Default:()=>zL,FormFieldLegendVoice:()=>yD,FormFieldMoney:()=>KI,FormFieldMoney_Preset_Default:()=>GI,FormFieldNumber:()=>UI,FormFieldNumber_Preset_Default:()=>HI,FormFieldPhone:()=>tL,FormFieldPhone_Preset_Default:()=>eL,FormFieldPrimitive:()=>iOe,FormFieldRangeBigDecimal:()=>fL,FormFieldRangeBigDecimal_Preset_Default:()=>dL,FormFieldRangeDate:()=>uN,FormFieldRangeDateTime:()=>pN,FormFieldRangeDateTime_Preset_Default:()=>fN,FormFieldRangeDate_Preset_Default:()=>lN,FormFieldRangeMoney:()=>mL,FormFieldRangeMoney_Preset_Default:()=>pL,FormFieldRangeNumber:()=>sN,FormFieldRangeNumber_Preset_Default:()=>oN,FormFieldRangeTime:()=>gN,FormFieldRangeTime_Preset_Default:()=>hN,FormFieldString:()=>VI,FormFieldString_Preset_Default:()=>BI,FormFieldTime:()=>aN,FormFieldTime_Preset_Default:()=>iN,FormItem:()=>$De,FormItemContext:()=>R8,FormLabel:()=>eOe,FormLayout:()=>Zk,FormMessage:()=>rOe,FormRoot:()=>QDe,FormSchemaContext:()=>Xw,FormSchemaKind:()=>Jw,FormSchemaProvider:()=>Zw,FormTemplateProvider:()=>kT,FrontEndEvent_BasicUser_Schema:()=>vae,FrontendEventBadgeCountChangedSchema:()=>ue,FrontendEventBulkJobProgressSchema:()=>bte,FrontendEventCategory:()=>ln,FrontendEventCategoryMap:()=>fte,FrontendEventCustomSchema:()=>kte,FrontendEventErrorOccuredSchema:()=>Ut,FrontendEventLoadingResourceSchema:()=>ree,FrontendEventNoDataSchema:()=>sie,FrontendEventNotifyCustomSchema:()=>Un,FrontendEventOrgBillingStatusChangedSchema:()=>Vte,FrontendEventOrgStatusChangedSchema:()=>Ua,FrontendEventOrganizationBrandingChangedSchema:()=>qte,FrontendEventOwnPreferencesRereadSettledSchema:()=>Wee,FrontendEventOwnPreferencesRereadStartedSchema:()=>p,FrontendEventResourceCustomSchema:()=>Une,FrontendEventResourceEditingSchema:()=>Oie,FrontendEventResourceOperationSchema:()=>Bre,FrontendEventSchemas:()=>hie,FrontendEventUserLoginSchema:()=>are,FrontendEventUserLogoutSchema:()=>cne,FrontendEventUserPreferencesChangedSchema:()=>Xre,FrontendEventUserStatusChangedSchema:()=>bie,FrontendEvent_AnalyticsMomentAchievedSchema:()=>Sne,FrontendEvent_AppScopeChangedSchema:()=>Dre,FrontendEvent_GuidanceElementSchema:()=>Pie,FrontendEvent_GuidanceFlowSchema:()=>jne,FrontendEvent_HotkeyCommandMenuOpenSchema:()=>Xne,FrontendEvent_HotkeyNotificationsOpenSchema:()=>nie,FrontendEvent_HotkeyQuickSwitcherOpenSchema:()=>Pre,FrontendEvent_HotkeyShortcutsHelpSchema:()=>Qs,FrontendEvent_HotkeySidebarToggleSchema:()=>Ps,FrontendEvent_LifecycleStageChangedSchema:()=>nne,FrontendEvent_MilestoneAchievedSchema:()=>Uie,FrontendEvent_NavigationClearZoneSchema:()=>dae,FrontendEvent_NavigationCloseSchema:()=>Ho,FrontendEvent_NavigationOrganizationFollowedSchema:()=>Gu,FrontendEvent_NavigationPopSchema:()=>tte,FrontendEvent_NavigationPushSchema:()=>je,FrontendEvent_NavigationReplaceSchema:()=>Xie,FrontendEvent_NavigationRequestSchema:()=>$i,FrontendEvent_NavigationUrlPathUpdatedSchema:()=>ut,FrontendEvent_NavigationZoneChangedSchema:()=>Ye,FrontendEvent_PrimaryScopeChangedSchema:()=>Aee,FrontendEvent_ProgressionUpdatedSchema:()=>Cre,FrontendEvent_ResourceCollectionFiltersChangedSchema:()=>P,FrontendEvents:()=>hc,FrontendInsertedViewHostKind:()=>Bp,FrontendInsertedViewIdentitySchema:()=>ooe,FrontendInsertedViewKind:()=>bp,FrontendResourceOperationAddressingMode:()=>jse,FrontendResourceOperationContextSchema:()=>Yi,FrontendResourceOperationPathSchema:()=>c,FrontendResourcePathSchema:()=>Hne,FrontendResource_ParentResourceRequirementSchema:()=>Die,FrontendView_DefinitionSchema:()=>ep,FrontendView_ScopeMode:()=>em,FullCustomView:()=>UZ,FullCustomViewDefinitionSchema:()=>woe,GENERIC_ERROR_WORDING_BY_ERROR_TYPE:()=>_oe,GRAPH_VIEW_ADMITS_PORT:()=>nf,GRAPH_VIEW_GATE_PORT:()=>sf,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:()=>n4,GUIDANCE_FALLBACK:()=>JH,GenericErrorWording:()=>Xoe,GlobalErrorHandler:()=>Gy,GoogleFontPresets:()=>fg,GovernedDocumentAcceptanceControl:()=>jZ,GraphCanvasInteraction:()=>Xd,GraphHandleRole:()=>Gf,GraphLegendMark:()=>Wae,GraphNodeSide:()=>Xf,GraphViewEdgeKind:()=>vf,GraphViewLayoutDirection:()=>If,GraphViewNodeKind:()=>Uf,GraphViewerPresentation:()=>Sf,Group:()=>A9,GroupedSectionBody:()=>Gk,GuidanceAnnouncement:()=>Z2,GuidanceBadge:()=>Q2,GuidanceBanner:()=>X2,GuidanceCard:()=>$2,GuidanceChecklist:()=>G2,GuidanceChecklistItem:()=>K2,GuidanceContext:()=>VH,GuidanceContextProvider:()=>uU,GuidanceModal:()=>Y2,GuidanceRenderer:()=>c4,GuidanceSurvey:()=>e4,GuidanceTooltip:()=>J2,GuidanceTour:()=>q2,HOTKEY_DEFAULT_PRIORITY:()=>0,HOTKEY_FRAMEWORK_DEFAULT_PRIORITY:()=>g$,HOTKEY_SCOPE_SPECIFICITY:()=>_$,HTTP_ERROR_BEHAVIOR_MATRIX:()=>Je,HeaderIconPlacement:()=>ot,Heading:()=>sY,HomeDefinitionSchema:()=>ase,HostFormActionsFooter:()=>iE,HostedComponentInteractionsProvider:()=>W2,HostedTriggerAppearance:()=>Tre,HotkeyBindingSchema:()=>kie,HotkeyDispatchableEvent:()=>qa,HotkeyEmitShortcutSchema:()=>Xte,HotkeyGroup:()=>_i,HotkeyRegistryContext:()=>x$,HotkeyRegistryProvider:()=>C$,HotkeyScope:()=>y,HotkeyShortcutsHelpDialog:()=>P$,HoverCard:()=>m5,HoverCardContent:()=>g5,HoverCardTrigger:()=>h5,HumanDecisionForm:()=>n8,I18nContext:()=>Oc,I18nProvider:()=>ou,ICON_SIZE_MAP:()=>ga,INDICATOR_BADGE_VARIANT:()=>Gg,IconCategory:()=>nn,IconCategorySchema:()=>ste,IconPropsSchema:()=>Tte,IconRegistryBridge:()=>GQ,IconRegistryContext:()=>Jae,IconRegistryProvider:()=>$d,IconRequestSchema:()=>Rt,IconSize:()=>tr,IconSizeSchema:()=>oie,Identifier:()=>y8,ImageCrop:()=>bL,InMemoryFrontendProviderRegistryFrontendService:()=>Nb,InitializationStatusSchema:()=>$e,InlineEditMutationError:()=>sj,InlineEditState:()=>TT,InlineEditText:()=>N8,Input:()=>YM,InputGroup:()=>YI,InputGroupAddon:()=>XI,InputGroupButton:()=>ZI,InputGroupInput:()=>QI,InputGroupText:()=>whe,InputGroupTextarea:()=>$I,InputOTP:()=>FI,InputOTPGroup:()=>II,InputOTPSeparator:()=>ghe,InputOTPSlot:()=>LI,InputRoot:()=>XM,InsertedChartDeclarationSchema:()=>coe,InsertedViewInputBindingSchema:()=>sse,InsertedViewInputBindingSource:()=>doe,InsertedViewLauncherConfigSchema:()=>hoe,InsertedViewLauncherPlacement:()=>Fp,InsertedViewRenderSlot:()=>VY,InvoiceHistory:()=>M1,Kbd:()=>j$,LIFECYCLE_DEFAULTS:()=>qH,LOCAL_STORAGE_KEYS:()=>xs,Label:()=>TX,LauncherItemRefSchema:()=>Ene,LauncherItemTargetKind:()=>_s,LauncherItemTargetKindSchema:()=>tie,LauncherRuntimeAvailabilityConfigSchema:()=>jre,LauncherVerificationErrorCode:()=>Ov,LauncherVerificationSeverity:()=>Dv,LayoutDivider:()=>kMe,LazyDoorErrorBoundary:()=>CJ,LazyDoorUnavailableFrame:()=>wJ,Link:()=>tX,LinkVariants_Underline:()=>$Y,LinkVariants_Variant:()=>QY,LinkVariants_Weight:()=>eX,LoadingBarrier:()=>rle,LoadingContext:()=>Qm,LoadingGate:()=>Zy,LoadingOverlay:()=>Yy,LoadingPhase:()=>Pl,LoadingProvider:()=>Bm,LoadingSpinner:()=>Jy,LoadingTier:()=>oc,LoadingTreatment:()=>Oo,LoggerFrontendService:()=>tl,MOBILE_DETAIL_MAX_PRIMARY_ACTIONS:()=>1,MOBILE_SUMMARY_MAX_PRIMARY_ACTIONS:()=>0,MainContextInitComponents:()=>Ie,MarkdownEditor:()=>AI,MaterialRefractiveBudgetManager:()=>Qg,MaterialRuntimeGroup:()=>Ig,MaterialRuntimePolicyProvider:()=>Lg,MenuBarDisplayPolicy:()=>tse,Menubar:()=>lOe,MenubarCheckboxItem:()=>pOe,MenubarContent:()=>q8,MenubarGroup:()=>dOe,MenubarHostedComponentSchema:()=>Gs,MenubarItem:()=>fOe,MenubarLabel:()=>gOe,MenubarLauncherItemSchema:()=>$ne,MenubarMenu:()=>uOe,MenubarRadioGroup:()=>mOe,MenubarRadioItem:()=>hOe,MenubarSeparator:()=>_Oe,MenubarShortcut:()=>vOe,MenubarSub:()=>yOe,MenubarSubContent:()=>J8,MenubarSubTrigger:()=>bOe,MenubarTrigger:()=>K8,MilestoneStatus:()=>hU,MissingRMMRuntimeError:()=>ir,ModifierKey:()=>m$,NAVIGATION_STRUCTURAL_ZONES:()=>ud,NON_CANONICAL_SHELL_SURFACE_POLICY_OVERRIDE:()=>HE,NOTIFICATION_DISPLAY_POLICY:()=>Ase,NOTIFICATION_SOURCE_OVERRIDES:()=>zh,NavigationBackHost:()=>dB,NavigationContentAreas:()=>c2,NavigationContentRenderer:()=>H0,NavigationContentSchema:()=>pe,NavigationContentType:()=>Sa,NavigationContext:()=>mh,NavigationInitiatorContextSchema:()=>dn,NavigationItemBadge:()=>W8,NavigationItemType:()=>sa,NavigationMenu:()=>xOe,NavigationMenuContent:()=>wOe,NavigationMenuIndicator:()=>DOe,NavigationMenuItem:()=>COe,NavigationMenuLink:()=>EOe,NavigationMenuList:()=>SOe,NavigationMenuTrigger:()=>TOe,NavigationMenuViewport:()=>OOe,NavigationOperationOverrideSchema:()=>bre,NavigationOverlays:()=>l2,NavigationPlacementAdjustment:()=>Aa,NavigationProvider:()=>eh,NavigationSource:()=>Gt,NavigationStackEntrySchema:()=>iee,NavigationTransitionSource:()=>lie,NavigationUtils:()=>Hm,NavigationZone:()=>Gn,NavigationZoneSchema:()=>Hte,NetworkOfflineError:()=>Xn,NetworkOfflineReason:()=>iie,NotificationBadgeMemoryBoundary:()=>ZQ,NotificationContext:()=>lh,NotificationIndicator:()=>v8,NotificationProvider:()=>Um,ObjectScope:()=>DR,OfflineReplayPolicy:()=>Nn,OnboardingView:()=>o9,OnboardingViewDefinitionSchema:()=>lp,OperationsConfirmCritical:()=>kw,OverlayContainer:()=>f1,PRIMARY_SCOPE_FIELDS:()=>At,PROFESSIONAL_QUALIFICATIONS_DECLARED_CAPABILITY:()=>yv,PROGRESSION_DEFAULTS:()=>KH,PROVIDER_ADDRESS_LOOKUP_DEBOUNCE_MS:()=>300,PROVIDER_ADDRESS_LOOKUP_MINIMUM_QUERY_LENGTH:()=>3,Pagination:()=>hke,PaginationContent:()=>gke,PaginationEllipsis:()=>xke,PaginationItem:()=>_ke,PaginationLink:()=>vke,PaginationNext:()=>bke,PaginationPrevious:()=>yke,PasskeyAutofillExpiredError:()=>Am,PasskeyAutofillSupersededError:()=>Ioe,PasskeySignInMediation:()=>Om,PasswordInput:()=>NI,PendingDecisionsReadState:()=>rW,PersistentSessionTokenStorage:()=>Noe,PlanChangePreview:()=>k1,Popover:()=>QK,PopoverAnchor:()=>tq,PopoverContent:()=>eq,PopoverTrigger:()=>$K,PortalContainerContext:()=>k2,PricingTable:()=>A1,Progress:()=>h_,ProgressionAchievementBadge:()=>$Ee,ProgressionMilestoneTracker:()=>EU,ProviderAddressLookupAttribution:()=>dx,ProviderAddressLookupCombobox:()=>px,ProviderAddressLookupHost:()=>gx,ProviderAddressLookupNotice:()=>hx,ProviderAddressLookupPlaceWithoutAddressError:()=>ux,ProviderAddressLookupRejectionKind:()=>Zb,ProviderFilePickerHost:()=>ex,ProviderFileSelectionRejectionKind:()=>Yb,PublicLayoutPreset_AuthCallback_Default:()=>rX,PublicLayoutPreset_ChatIdentityLink_Default:()=>CZ,PublicLayoutPreset_EnrollmentRequired_Default:()=>BX,PublicLayoutPreset_FileUploadGrant_Default:()=>pZ,PublicLayoutPreset_MagicLinkVerify_Default:()=>sX,PublicLayoutPreset_MfaChallenge_Default:()=>LX,PublicLayoutPreset_OAuthConsent_Default:()=>vZ,PublicLayoutPreset_OAuthLoggedOut_Default:()=>TZ,PublicLayoutPreset_OAuthLogoutConfirm_Default:()=>OZ,PublicLayoutPreset_OneOffSession_Default:()=>cZ,PublicLayoutPreset_OrganizationOnboarding_Default:()=>GX,PublicLayoutPreset_StaticContentContainer_Default:()=>L3,PublicLayoutPreset_UserAuth_Default:()=>XX,PublicLayoutPreset_UserConfirmEmail_Default:()=>$X,PublicLayoutPreset_UserInvitation_Default:()=>oZ,PublicLayoutPreset_UserPasswordLost_Default:()=>gZ,PublicLayoutPreset_UserRegister_Default:()=>PZ,PublicLayout_LegalNotice:()=>LZ,PublicLayout_MainContainer:()=>ZY,PublicLayout_StaticContentContainer:()=>NEe,PublicLayout_Terms:()=>IZ,PublicShellIdentityMode:()=>im,QuickActionButtonPlacement:()=>Qte,QuickActionButtonPlacementSchema:()=>Bie,QuickActionDisplayPolicy:()=>cs,QuickActionItemSchema:()=>iae,QuickActionPlacement:()=>Goe,QuickSwitcherFieldControlKind:()=>p2,QuickSwitcherFieldPresentation:()=>Jp,QuickSwitcherPlacement:()=>pse,QuickSwitcherScopeFieldSchema:()=>vse,READ_RETRY_FIRST_DELAY_MS:()=>IJ,READ_RETRY_MAX_DELAY_MS:()=>LJ,REGIONAL_PREFERENCE_FRAMEWORK_FLOOR:()=>Qne,RETRYABLE_CLIENT_ERROR_STATUSES:()=>mc,REVEAL_FIELD_EVENT:()=>PD,RUNTIME_SCOPED_STORAGE_KEYS:()=>rie,RadioGroup:()=>yF,RadioGroupItem:()=>xF,RadioGroupRoot:()=>bF,RangeSlider:()=>qM,RecordApprovalSeal:()=>Nfe,RecordFactRole:()=>SA,RecordKeepingFacts:()=>xA,RecordState:()=>bA,RegionalReaderStanding:()=>Zte,RegionalReaderStandingPublisherContext:()=>Tne,RegistrationOutcome:()=>Np,RelatedResourcePreview:()=>oMe,RelatedResourcePreviewSurface:()=>a9,RelatedResourceSections:()=>E9,RelationshipShapeCapability:()=>dv,RelationshipSideCapability:()=>cv,ResizableHandle:()=>K$,ResizablePanel:()=>G$,ResizablePanelGroup:()=>W$,ResolvedInsertedChartDescriptorSchema:()=>Doe,ResolvedInsertedViewDescriptorSchema:()=>joe,ResourceAutomatedForm:()=>cB,ResourceAutomaticDisplayer:()=>zJ,ResourceCollectionQuickFilterTabs:()=>XK,ResourceDisplayContext:()=>aj,ResourceEmptyState:()=>eK,ResourceFieldDisplay_ResourceReference:()=>Pj,ResourceFieldEdit_ResourceReference:()=>hI,ResourceFormActionsProvider:()=>nE,ResourceFrontend_EmptyStateSecondaryActionType:()=>A,ResourceFrontend_GuidanceFlowTriggerType:()=>dre,ResourceHeaderContextProvider:()=>MB,ResourceHeaderLeading:()=>RB,ResourceHeaderTitle:()=>LB,ResourceHeaderTitleHeading:()=>PB,ResourceHeaderTitlePlaceholder:()=>FB,ResourceLayoutInlineEditDefault:()=>wr,ResourceLayoutPreset_Action_Default:()=>WW,ResourceLayoutPreset_Breadcrumb_Default:()=>wB,ResourceLayoutPreset_ContainerDialogs_Default:()=>N3,ResourceLayoutPreset_ContainerNested_Default:()=>nY,ResourceLayoutPreset_Create_Default:()=>nG,ResourceLayoutPreset_Create_SamlWizard:()=>t9,ResourceLayoutPreset_DangerZone_Default:()=>lY,ResourceLayoutPreset_Filters_Default:()=>P3,ResourceLayoutPreset_Header_Default:()=>$B,ResourceLayoutPreset_List_Default:()=>JY,ResourceLayoutPreset_OperationsBulk_Default:()=>bJ,ResourceLayoutPreset_OperationsItems_Default:()=>iY,ResourceLayoutPreset_Pagination_Default:()=>YG,ResourceLayoutPreset_ReadSummary_Default:()=>I3,ResourceLayoutPreset_Read_Default:()=>bY,ResourceLayoutPreset_Read_Expandable:()=>F3,ResourceLayoutPreset_Read_SsoSaml:()=>n9,ResourceLayoutPreset_RecordSharing_Default:()=>gY,ResourceLayoutPreset_Search_Default:()=>wY,ResourceLayoutPreset_Update_Default:()=>EY,ResourceLayout_Action:()=>GW,ResourceLayout_Breadcrumb:()=>EB,ResourceLayout_ContainerDialogs:()=>DEe,ResourceLayout_ContainerNested:()=>rY,ResourceLayout_Create:()=>rG,ResourceLayout_DangerZone:()=>uY,ResourceLayout_Filters:()=>OEe,ResourceLayout_Header:()=>eV,ResourceLayout_InsertedViews:()=>UY,ResourceLayout_List:()=>YY,ResourceLayout_OperationBulk:()=>xJ,ResourceLayout_OperationsItems:()=>aY,ResourceLayout_Pagination:()=>XG,ResourceLayout_Read:()=>SY,ResourceLayout_ReadSummary:()=>AEe,ResourceLayout_RecordSharing:()=>_Y,ResourceLayout_Search:()=>TY,ResourceLayout_Update:()=>DY,ResourceOperationActionPresentation:()=>Lr,ResourceOperationActionScope:()=>ti,ResourceOperationFrontendConfigSchema:()=>Tt,ResourceOperationItemRefSchema:()=>pne,ResourceRegistryContext:()=>sm,ResourceRegistryProvider:()=>Xp,ResourceSummaryDisplayer:()=>lG,ResourceViewItemRefSchema:()=>Iu,ResourcesRepositoryFrontendService:()=>AS,RouterErrorBoundary:()=>Hy,SCAFFOLD_SETTINGS_HUB_CONFIG:()=>ece,SCAFFOLD_SETTINGS_RAIL_GROUPS:()=>xv,SCOPE_PARAM_PREFIX:()=>Dn,SERVER_ERROR_TYPE:()=>Qw,SESSION_STORAGE_KEYS:()=>Fre,SETTINGS_HUB_TITLE_LABEL_KEY:()=>Zm,SHELL_ANCHORED_POPUP_ORIGINS:()=>Z4,SHELL_CENTRED_POPUP_SLOTS:()=>tEe,SHELL_GHOST_ATTRIBUTE:()=>R4,SHELL_GHOST_LAYER_ATTRIBUTE:()=>L4,SHELL_MODAL_POPUP_SLOTS:()=>Q4,SHELL_OBJECT_ATTRIBUTE:()=>I4,SHELL_PANE_SELECTOR:()=>W4,SHELL_PICTURE_STRIPPED_ATTRIBUTES:()=>z4,SHELL_POPUP_OPEN_STATES:()=>$4,SHELL_PRESS_ORIGIN_MAX_AGE_MS:()=>800,SHELL_PROXY_ATTRIBUTE:()=>F4,SHELL_PROXY_FLIGHT_SHARE:()=>P4,STATUS_BAR_PLACEMENTS:()=>Cie,SameSite:()=>jy,ScopeChangeInitiator:()=>gr,ScopeUtilsService:()=>tm,ScopedNavigationControllerContext:()=>_S,ScrollArea:()=>Wd,ScrollAreaType:()=>eoe,ScrollBar:()=>Df,Section:()=>Wk,SectionLegendVoiceHost:()=>vD,SectionSaveButton:()=>qk,SectionStageBindingError:()=>jO,SectionStageState:()=>AO,Select:()=>fF,SelectContent:()=>hF,SelectGroup:()=>Ame,SelectItem:()=>_F,SelectLabel:()=>jme,SelectMultiple:()=>MF,SelectPosition:()=>uF,SelectRoot:()=>pF,SelectScrollDownButton:()=>Pme,SelectScrollUpButton:()=>Nme,SelectSeparator:()=>Mme,SelectTrigger:()=>mF,SelectValue:()=>gF,Separator:()=>v1,SessionEndReason:()=>Or,SessionEstablishment:()=>zr,SettingsHubVerificationErrorCode:()=>zv,SettingsHubVerificationSeverity:()=>Rv,SettingsPanelRef:()=>sv,SettingsSectionItemRefSchema:()=>$ee,SettingsSectionTargetKind:()=>ov,Sheet:()=>J$,SheetClose:()=>cCe,SheetContent:()=>X$,SheetDescription:()=>e1,SheetFooter:()=>Q$,SheetHeader:()=>Z$,SheetTitle:()=>$$,SheetTrigger:()=>Y$,ShellDialogArrival:()=>N4,ShellGhostKind:()=>B4,ShellGhostLayer:()=>V4,ShellGhostPose:()=>k4,ShellIdentitySchema:()=>Loe,ShellLayoutFamily:()=>x4,ShellLayoutPlacementKind:()=>b4,ShellMotionDip:()=>A4,ShellPaneArrival:()=>j4,ShellPaneResize:()=>M4,ShellPlaceChange:()=>O4,ShellPopupSlot:()=>X4,Sidebar:()=>kOe,SidebarCollapsible:()=>Z8,SidebarContent:()=>AOe,SidebarFooter:()=>jOe,SidebarGroup:()=>MOe,SidebarGroupAction:()=>NOe,SidebarGroupContent:()=>POe,SidebarGroupLabel:()=>FOe,SidebarHeader:()=>IOe,SidebarHomeDisplayMode:()=>Se,SidebarHostedComponentSchema:()=>Gie,SidebarInput:()=>LOe,SidebarInset:()=>ROe,SidebarItemDisplayPolicy:()=>Yc,SidebarItemSchema:()=>Gi,SidebarMenu:()=>zOe,SidebarMenuAction:()=>BOe,SidebarMenuBadge:()=>VOe,SidebarMenuButton:()=>HOe,SidebarMenuButtonVariant:()=>Q8,SidebarMenuItem:()=>UOe,SidebarMenuSkeleton:()=>WOe,SidebarMenuSub:()=>GOe,SidebarMenuSubButton:()=>KOe,SidebarMenuSubItem:()=>qOe,SidebarProvider:()=>JOe,SidebarRail:()=>YOe,SidebarResourceBrowser:()=>$7,SidebarResponsivePolicy:()=>rt,SidebarResponsivePolicySchema:()=>Ve,SidebarSectionBehavior:()=>Wr,SidebarSectionContentKind:()=>xc,SidebarSectionContentKindSchema:()=>E,SidebarSectionInlineCreate:()=>pc,SidebarSectionSchema:()=>pee,SidebarSection_CustomComponentSchema:()=>Nr,SidebarSection_GuidanceWidgetSchema:()=>Nee,SidebarSection_NavigationListSchema:()=>yt,SidebarSection_ResourceBrowserSchema:()=>Sn,SidebarSeparator:()=>XOe,SidebarTrigger:()=>ZOe,SidebarVariant:()=>X8,Skeleton:()=>pm,Slider:()=>GM,SliderRoot:()=>KM,StackedActions:()=>Eke,StackedAside:()=>kke,StackedBody:()=>Oke,StackedContent:()=>Ake,StackedHeader:()=>Cke,StackedLayout:()=>Ske,StackedSection:()=>jke,StackedSubtitle:()=>Tke,StackedTitle:()=>wke,StackedToolbar:()=>Dke,StandardIconReference:()=>W,StandardIconReferenceSchema:()=>Ya,StartApplicationFrontendService:()=>BQ,StatusBarDisplayInteractionType:()=>m2,StatusBarItemSchema:()=>_se,StatusBarItemType:()=>Ml,StatusBarPlacementSchema:()=>tre,StepUpAuthContext:()=>hH,StepUpAuthProvider:()=>gH,StepUpRefusalOrigin:()=>na,Stepper:()=>wO,StepperDescription:()=>kO,StepperIndicator:()=>EO,StepperItem:()=>TO,StepperSeparator:()=>DO,StepperTitle:()=>OO,Strong:()=>c_,Subheading:()=>cY,SubmitButton:()=>eO,SubscriptionStatus:()=>E1,SummaryFlow:()=>wR,SummaryHeader:()=>D9,SummaryLayout:()=>ER,SummaryMeta:()=>uG,SummaryTitle:()=>SR,SummaryTitlePlacement:()=>CR,SummaryTitleScale:()=>xR,Surface:()=>hD,SurfaceAction:()=>mD,SurfaceBody:()=>fD,SurfaceErrorBoundary:()=>RE,SurfaceFooter:()=>pD,SurfaceHeader:()=>dD,SurfacePolicyContext:()=>Xe,SurveyBindingWriteOutcome:()=>rU,Switch:()=>yI,SwitchRoot:()=>bI,TONE_DOT_CLASS:()=>Ud,TONE_INK:()=>Ef,TONE_MARKER_COLOUR:()=>$ae,TONE_MARKER_FILL:()=>qd,Table:()=>tJ,TableBody:()=>rJ,TableCaption:()=>pve,TableCell:()=>oJ,TableFooter:()=>fve,TableHead:()=>aJ,TableHeader:()=>nJ,TableRow:()=>iJ,Tabs:()=>aO,TabsActivationMode:()=>tO,TabsContent:()=>cO,TabsLevel:()=>nO,TabsLevelContext:()=>rO,TabsList:()=>oO,TabsTrigger:()=>sO,Text:()=>Z,TextDirection:()=>wd,TextLink:()=>p_,TextSize:()=>ha,TextVariant:()=>en,Textarea:()=>OI,TextareaRoot:()=>kI,TimePicker:()=>rN,TimeRangePicker:()=>mN,Timeline:()=>Gd,TimelineActions:()=>Yae,TimelineBody:()=>Kd,TimelineEntry:()=>Yd,TimelineMarker:()=>Qf,TimelineTime:()=>Uae,Toaster:()=>WQ,Toggle:()=>I8,ToggleGroup:()=>_O,ToggleGroupAppearance:()=>hO,ToggleGroupBoolean:()=>wI,ToggleGroupItem:()=>vO,ToggleGroupType:()=>mO,ToggleVariants_Variant:()=>F8,ToolbarItemRefSchema:()=>cee,ToolbarItemSchema:()=>xi,Tooltip:()=>XA,TooltipContent:()=>QA,TooltipProvider:()=>$A,TooltipTrigger:()=>ZA,TruncatedText:()=>p8,TypographyScope:()=>u_,UIContext:()=>Xg,UIProvider:()=>Fg,UNIQUE_ERROR_TYPE:()=>$w,UpdateLikeMutationFallbackMode:()=>wl,UsageDashboard:()=>j1,UserDropdownAvatarDisplay:()=>Ip,UserDropdownSection:()=>sp,UserOrgsContext:()=>ih,UserOrgsProvider:()=>Lm,UtilityPanelItemSchema:()=>gae,ValidationMode:()=>Jc,ViewItemRefSchema:()=>ae,ViewLayout_Header:()=>IY,ViewNotFound:()=>a_,WINDOW_EVENTS_SLUGS:()=>ve,WebSocketContext:()=>um,WebSocketEventBridge:()=>$Q,WebSocketProvider:()=>Em,WebSocketResourceValidationService:()=>DJ,WebSocketStatus:()=>$p,WildoBackendHttpClient:()=>Ca,WildoBackendHttpClient_ManualCalls:()=>Vr,WildoBackendHttpClient_Resources:()=>Dx,WizardLayout:()=>DMe,WizardStep:()=>O9,ZoneContentRenderer:()=>W0,_clearContributedProviderComponentLoaders:()=>jle,actionBarItemCannotRun:()=>HS,actorActivityLabelKey:()=>_6,actorModeDescriptionKey:()=>m6,actorModeLabelKey:()=>p6,actorRoleLabelKey:()=>f6,actorSystemExecutionGraph:()=>Mf,addElement:()=>JMe,allocateActionBarSlots:()=>US,allowsDirectOperationFallback:()=>Vn,appendFileServeVariant:()=>qV,appendNavChildrenToSidebarSection:()=>Y_,applyChartColorPalette:()=>Cg,applyCustomTokens:()=>Hg,applyDesignSystemConfiguration:()=>lg,applyDesignTokens:()=>Vg,applyFrontendConfigOverrides:()=>ky,applyTypographyConfiguration:()=>xg,arrangeChartDashboardTiles:()=>I9,assertExecutionDirtyMarkerShape:()=>Qv,assertExecutionEmbeddableContent:()=>ey,assertExecutionFailedActionShape:()=>ny,assertExecutionLocalPanePayloadIsNotEmbeddableContent:()=>$v,assertExecutionPendingPrefetchShape:()=>Xv,assertExecutionRuntimeContext:()=>iy,assertRegistryCompleteness:()=>REe,assertSectionStageBinding:()=>MO,attachBackendErrorEnvelope:()=>Er,authFactorLevelForUiLevel:()=>xoe,backendNotificationDestination:()=>Pse,backendNotificationI18nParams:()=>Ise,badgeVariantIndicator:()=>Yg,brandShellLayoutMainContainer:()=>T4,buildAppLoadingScope:()=>Dse,buildApplicationCompositeViewDefinitions:()=>Cp,buildApplicationCompositeViewTranslationRef:()=>Ep,buildApplicationViewTranslationRef:()=>use,buildAuthoredIconRegistry:()=>KQ,buildChartRouteUrlPath:()=>Vp,buildCompositeRouteUrlPath:()=>kp,buildContextLoadingScope:()=>Mse,buildExecutionConcreteOperationIdentity:()=>gse,buildExecutionDirtyMarker:()=>Rce,buildExecutionFailedAction:()=>ly,buildExecutionRouteUrlPath:()=>Lp,buildFileServeThumbnailUrl:()=>JV,buildFrontendInsertedViewRef:()=>Aoe,buildFrontendModuleAppComponentsConfiguration:()=>av,buildFrontendModuleAppScope:()=>rv,buildFrontendModuleConfigOverrides:()=>Oy,buildFrontendModuleRegistry:()=>nv,buildFrontendModuleSidebarSections:()=>iv,buildLoadingScopeKey:()=>nh,buildOmniboxRecordContextIdentifiers:()=>K7,buildResolvedInsertedChartDescriptor:()=>gp,buildResourceCompositeViewTranslationRef:()=>pp,buildResourceFileServeBaseUrl:()=>KV,buildResourceInsertedChartIdentity:()=>xp,buildResourceInsertedCompositeIdentity:()=>vp,buildResourceInsertedExecutionIdentity:()=>dp,buildResourceLoadingScope:()=>og,buildScopeConditionParams:()=>t6,buildSummaryRecordIdentifiers:()=>sG,calculateGlassBezelResponse:()=>qg,calculateGlassBoundaryCoverage:()=>Wg,calculateGlassEdgeResponse:()=>zg,calculateGlassRefractionProfile:()=>Rg,calculateRoundedRectangleOutwardNormal:()=>Mg,canExportWithinAllowedMimeTypes:()=>AL,cardsAfterWithdrawal:()=>tW,cascadeShellRows:()=>f3,choreographyGraph:()=>Bf,clampCropOffset:()=>wL,clampStaticSidePanels:()=>e2,classifyRecordFact:()=>DA,classifyRegistrationOutcome:()=>yse,clearAllProviderScopeReauthorizationOffers:()=>b,clearAppliedDesignTokens:()=>Sg,clearProviderScopeReauthorizationOffer:()=>uc,clickDownloadLink:()=>Ny,cn:()=>G,collectBillingProviderLabelKeys:()=>w1,collectErroredFieldPaths:()=>UD,collectExecutionViewSurfaceRefsByOperation:()=>ioe,collectFrontendChartRegistrationRefs:()=>cse,collectFrontendChartRegistrationRefsFromUIBehavior:()=>foe,collectFrontendProviderDisplayLabelKeys:()=>rb,collectOperationLikeViewRefs:()=>yoe,collectResourceLabelFieldEntries:()=>fl,combineModuleSidebarSections:()=>G_,composeConsentDecision:()=>Wb,composeUiBehaviorPresentation:()=>TS,computeCoverScale:()=>CL,computeCropSourceRect:()=>TL,computePanelSizes:()=>n2,computeRegistryCompleteness:()=>z3,computeSurfacePolicyContextValue:()=>Kr,configureClientInstanceIdPolicy:()=>Zo,consentWithdrawalCost:()=>Gb,contributeProviderComponentLoaders:()=>Bb,conversationThreadModel:()=>XZ,conversationsHeldBeyondPages:()=>QZ,countDiffLines:()=>T5,createComponentResolver:()=>qc,createComponentResolverWithRef:()=>kl,createCompoundComponentResolver:()=>rc,createCompoundPreset:()=>rne,createDesignSystemConfigurationFromSourceConfig:()=>zEe,createEmojiIcon:()=>Qae,createEmptyOnboardingView:()=>qMe,createFrontendInsertedViewIdentity:()=>Moe,createFrontendProviderRegistryFrontendService:()=>Pb,createOpenSessionOverlayModeResolver:()=>d1,createPolymorphicFrontendPreset:()=>wn,createShellLayoutMainContainer:()=>E4,darkModeUtils:()=>wg,debugSectionVisibility:()=>n6,decisionQuestionOf:()=>LW,decisionStepUpRequestOfRefusal:()=>Ft,defaultChartDashboardTileHeight:()=>R9,defaultOfflineReplayPolicyForMethod:()=>Lte,defaultTheme:()=>Eg,defineChartDashboardView:()=>KMe,defineCompositeView:()=>Sp,deriveBreadcrumbAncestors:()=>CB,deriveConsentGateState:()=>Ub,deriveDecisionInboxCapabilities:()=>Lv,deriveDirectoryProvisioningCapabilities:()=>hv,deriveRegionalReaderStanding:()=>Rie,deriveRelationshipShapeCapabilities:()=>fv,deriveRelationshipSideCapabilities:()=>uv,describeDecisionHolder:()=>jW,describeDecisionRequester:()=>NW,describePauseState:()=>DW,describeReasonCodeOptions:()=>EW,deserializeOnboardingView:()=>tNe,determineValidationMode:()=>_L,documentReadKey:()=>AZ,embeddedResourceDescentKey:()=>m9,emptyValueTypographyFor:()=>Mj,envLoader:()=>ui,errorManagement:()=>ct,evaluateGlassSurfaceHeight:()=>$g,executionPlanGraph:()=>Tf,exportCroppedImageFile:()=>ML,extractChartRouteContextResourceIdentifiers:()=>Gp,extractChartRouteUrlParamValues:()=>Up,extractCompositeRouteContextResourceIdentifiers:()=>Pp,extractEphemeralFields:()=>BS,extractErrorInfo:()=>j,extractExecutionRouteContextResourceIdentifiers:()=>lm,extractPrimaryFontFamily:()=>mg,extractSchemaFieldList:()=>jR,fieldRevealPanelAttributes:()=>BD,fieldsHoldingTheRecordName:()=>OA,fileTypeIsAccepted:()=>fZ,filterVisibleSections:()=>e6,findDuplicateAppScopeResourceTypes:()=>Dm,findProviderScopeReauthorizationOffer:()=>br,findUnknownDestinationRefs:()=>Tv,flowGraph:()=>ff,flowGraphInputOf:()=>Pf,flowGraphNodeId:()=>Hf,flowNodeStatusIndicator:()=>xf,flowStepCategory:()=>Qd,flowTriggerTypeVisual:()=>Kae,flowsActorsStatusColour:()=>uf,flowsActorsStatusDotClass:()=>Kf,flowsActorsStatusIsMoving:()=>Zf,flyShellProxy:()=>c3,focusIndicatorClasses:()=>Dg,fontConfigToGoogleFontConfig:()=>_g,forgetNotificationBadgeCounts:()=>XQ,formatBadgeCount:()=>To,formatHsvAsCssColor:()=>WEe,formatRgbAsCssColor:()=>Y3,generateChartConfig:()=>bg,generateDefaultDisplayTemplate:()=>BR,generateDefaultFormTemplate:()=>FR,generateDefaultSummaryTemplate:()=>KR,generateGoogleFontsUrl:()=>Tg,generateTokensCSS:()=>r_,getChartColorPaletteFromCSS:()=>ug,getChartColors:()=>kg,getClientInstanceId:()=>Ore,getClientInstanceIdScope:()=>Fie,getCommonEnumDisplayConfig:()=>o_,getCompletionPercentage:()=>ZMe,getContentKey:()=>V0,getElementsByType:()=>$Me,getFieldError:()=>iI,getIconAnimation:()=>Lf,getLoadingStats:()=>bEe,getLocalStorageItem:()=>$s,getManualCallsHttpClient:()=>vc,getNotificationDisplayBehavior:()=>Ose,getProviderScopeReauthorizationOffers:()=>yee,getReadinessChecker:()=>lne,getTailwindColor:()=>gg,getZodErrorCode:()=>Ihe,getZodErrorParams:()=>vL,graphViewParentOf:()=>Xae,graphViewerEdgeLabelKey:()=>bf,growShellPane:()=>l3,hasValidAnimationSource:()=>Zae,heldConversations:()=>ZZ,hslToRgb:()=>q3,hsvToRgb:()=>K3,humanDecisionFormLabels:()=>Q6,humanDecisionQuestionOf:()=>IW,indicatorBadgeVariant:()=>Bg,installShellLayoutStylesheet:()=>t3,isApiNotReadyError:()=>cl,isBackendRefusal:()=>Rr,isBackendRefusalShownToUser:()=>ri,isCollectionScopedOperation:()=>uee,isCroppableRasterImageFile:()=>xL,isCustomComponentNavigationItem:()=>Fte,isDirectlyDisplayableImageUrl:()=>v2,isEmphasisButtonVariant:()=>zf,isEnginePageNavigationItem:()=>Jte,isErrorMarkedByHttpClient:()=>cy,isFinalBackendRefusal:()=>Ot,isFrontendOperationAddressableForCurrentContext:()=>Bh,isGlyphKey:()=>v$,isGoogleFont:()=>Og,isHostedInShellChrome:()=>C2,isNamelessDisplayContent:()=>TA,isNetworkOfflineRejection:()=>Ia,isOnboardingComplete:()=>QMe,isOperationAddressable:()=>Ei,isOperationHeadless:()=>cd,isRecordSharingOffered:()=>hY,isRequiredFieldError:()=>rI,isResourceNavigationItem:()=>Gee,isResourceReachable:()=>Hoe,isSectionVisible:()=>$3,isSelfReferencingRelatedCollectionTarget:()=>V6,isSettingsHubNavigationItem:()=>h,isShellLayoutMainContainer:()=>C4,isShellSidePane:()=>J4,isShellSideZone:()=>Y4,isSidebarConfigObject:()=>u2,isSpentOrganizationOnboardingSession:()=>ip,isStandaloneRoutableCompositeView:()=>bse,isStandaloneRoutableExecutionView:()=>rp,isStandaloneRoutableInsertedChartView:()=>qp,isStandaloneRoutableInsertedCompositeView:()=>ap,isStandaloneRoutableResolvedCompositeView:()=>zp,isStatusBarConfigObject:()=>d2,isStatusBarPlacement:()=>al,isUnrevokedScimTokenProbeNeeded:()=>mv,isUtilityPanelComponentRegistered:()=>N7,isUtilityPanelConfigObject:()=>f2,isViewNavigationItem:()=>Bne,launcherItemRefKey:()=>J_,layoutGraphView:()=>af,listContributedProviderComponentLoaders:()=>Vb,loadCroppableImage:()=>SL,loadCustomComponents:()=>yEe,loadFontsFromTypography:()=>Ag,loadGoogleFonts:()=>hg,makeComponentLabelResolver:()=>gm,makeShellPicture:()=>C3,mapApplicationLevelToFrontendComponentType:()=>_2,matchesExecutionConcreteOperationIdentity:()=>Yoe,matchesShortcut:()=>b$,mergeAppModes:()=>U_,mergeAppScope:()=>H_,mergeCommandMenuCommandLists:()=>X_,mergeDesignSystemConfiguration:()=>yg,mergeFrontendComponentRegistrations:()=>tv,mergeFrontendDomainModules:()=>Zse,mergeFullCustomViewsByRef:()=>Q_,mergeHotkeyEmitShortcuts:()=>E$,mergeMenubarLauncherItems:()=>Z_,mergeQuickSwitcherFields:()=>q_,mergeSidebarSections:()=>W_,mergeSurfacePolicy:()=>wc,noticeOfOutcome:()=>CW,obtainStepUpToken:()=>_H,offsetWithin:()=>y3,olderHistoryCursor:()=>oQ,onboardingObligationsFromSessionState:()=>WX,operationTargetsCurrentResource:()=>kse,optionalMaxInlineSizeStyle:()=>$E,organizationOnboardingNavigationTarget:()=>Rp,parkedOrganizationOnboardingSessionId:()=>soe,parseChartColorPalette:()=>Jg,parseCssColorToRgb:()=>H3,parseFrontendInsertedViewRef:()=>jp,parseShortcut:()=>y$,parseUnifiedDiff:()=>w5,pickInlineFieldWriteOperation:()=>ph,pickPreferredOperationForCoreSemanticAddressability:()=>fh,playbookCatalogGraph:()=>hf,playbookCatalogNodeId:()=>Of,polymorphicResourceUIBehavior:()=>ce,polymorphicResourceUIBehaviorFrom:()=>yte,providerScopeReauthorizationOfferKey:()=>jee,pruneDirtyMarkersForPaneTransition:()=>Dy,pruneDirtyMarkersForScopeChange:()=>Ey,pruneFailedActionsForPaneTransition:()=>sy,pruneFailedActionsForPrefetchSettlement:()=>uy,pruneFailedActionsForScopeChange:()=>oy,publishNotificationBadgeCount:()=>YQ,readAllConversationHistory:()=>sQ,readBrowserRegionalEvidence:()=>nae,readComputedCssColorViaDom:()=>W3,readDisplayableErrorFacts:()=>tp,readProviderScopeReauthorizationOffer:()=>ht,receiveProviderAddressLookupSelection:()=>Qb,receiveProviderFileSelections:()=>Xb,recordProviderScopeReauthorizationOffer:()=>vn,registerCommonEnum:()=>f_,registerFrameworkLayouts:()=>IEe,registerFrontendComponentRegistrations:()=>xEe,registerIconAnimation:()=>of,registerIconAnimations:()=>rf,registerShellLayout:()=>D4,registerStandardIcon:()=>cf,registerStandardIcons:()=>toe,registryDeclaresSmsNotification:()=>s6,relationshipTargetRef:()=>o0,relativeLuminance:()=>X3,removeElement:()=>YMe,removeLocalStorageItem:()=>Is,replaceFileExtension:()=>jL,reportLauncherVerificationResults:()=>Pv,reportSettingsHubVerificationResults:()=>Hv,requestCrossFrontendHandoff:()=>Q3,requestFieldReveal:()=>LD,resetClientInstanceIdPolicy:()=>Mne,resizeChartDashboardTile:()=>F9,resolveActionDisclosure:()=>sn,resolveActionSurfaceOrganizationId:()=>UV,resolveApplicationLevelNavigationBackZone:()=>fB,resolveAuthoredOperationUnavailableReason:()=>cm,resolveAutomaticRelationshipDisplayShaping:()=>bj,resolveBillingProviderDisplayName:()=>T1,resolveCommandMenuCommands:()=>Dh,resolveComponentLabel:()=>yp,resolveCompositeViewDefinition:()=>_p,resolveCompositeViewPrimaryScope:()=>Eoe,resolveContentAreaRenderBranch:()=>$0,resolveContextualDisplayParams:()=>PA,resolveControlPanelItems:()=>Pm,resolveCssColorViaDom:()=>U3,resolveCurrentSectionStage:()=>NO,resolveDrawnActionVariant:()=>wf,resolveEffectiveChromeMode:()=>VM,resolveEffectiveDisplayChromeMode:()=>tj,resolveEnumDisplayConfig:()=>y_,resolveErrorReferenceLabel:()=>goe,resolveExecutionNavigationHandlingMode:()=>wp,resolveExecutionViewDefinition:()=>Dp,resolveFieldAutosaveTrigger:()=>wE,resolveFieldControlVariant:()=>jg,resolveFrontendProviderDisplayLabel:()=>ib,resolveFrontendResourceOperationAddressability:()=>Lse,resolveGuidanceElementRenderer:()=>r4,resolveHostedComponents:()=>S2,resolveHotkeyBindings:()=>Th,resolveInsertedChartView:()=>Mp,resolveInsertedViewLauncherConfig:()=>Mm,resolveItemRef:()=>qm,resolveLoadingPolicy:()=>ile,resolveMenubarContent:()=>Ym,resolveMilestoneLabel:()=>Ese,resolveOperationFeatureAvailability:()=>Wh,resolveOperationIdempotencyHeaders:()=>wx,resolveOperationRefusalLabel:()=>Tp,resolveOperationRequestTimeout:()=>Cx,resolveOptionalComponentLabel:()=>Wp,resolveOptionalResourceHeaderDescription:()=>Hp,resolveQuickActions:()=>$m,resolveQuickSwitcherFieldSchema:()=>k7,resolveRecordOrganizationId:()=>th,resolveRefusalCodeLabel:()=>Op,resolveRegionalFormatting:()=>dne,resolveRelationshipInlineEditSurface:()=>hj,resolveRelationshipNavigationSurface:()=>yj,resolveRelationshipNestedReadSurface:()=>_j,resolveRelationshipQuickCreateCreateOperation:()=>uj,resolveRelationshipReadSurface:()=>mj,resolveRelationshipSurfaceRuntime:()=>xj,resolveRelationshipWriteSurface:()=>pj,resolveResourceHeaderLabel:()=>Kp,resolveResourceLabelEnumSchema:()=>Rc,resolveResourceLabelSystemEnumName:()=>zs,resolveSearchGroupLabel:()=>W7,resolveSectionStageStates:()=>PO,resolveSettingsDestinationCatalog:()=>Cv,resolveSettingsHubConfig:()=>wv,resolveShellLayoutPlacement:()=>w4,resolveSidebarMobileDrawerMode:()=>S7,resolveSidebarSections:()=>Vm,resolveStatusBarPlacement:()=>T2,resolveSurfaceAutoFieldDensity:()=>UL,resolveSurfaceAutoLabelPlacement:()=>HL,resolveSurfaceFormChromeMode:()=>VL,resolveSurfaceOverlayMode:()=>u1,resolveSurfacePolicyStackingClass:()=>M2,resolveToolbarTools:()=>Gm,resolveTranslationKey:()=>Ap,resolveUpdateLikeMutationFallbackMode:()=>eo,resolveUserFacingErrorMessage:()=>fp,resolveUtilityPanelItems:()=>P7,resolveVisibleEntryIndex:()=>Uh,resourceExecutionView:()=>boe,resourceHasFieldWriteRoute:()=>Va,resourceUIBehavior:()=>ute,resourceUIBehaviorFrom:()=>Ete,responsiveMaxWidthToCssValue:()=>QE,rgbToHex:()=>J3,rgbToHsv:()=>G3,sampleGlassRefractionProfile:()=>n_,saveBlobAsFile:()=>My,scrollAndFocusFirstErroredField:()=>WD,sectionHeadingClassName:()=>bD,selectMaterialCapabilityTier:()=>Pg,serializeOnboardingView:()=>eNe,serializeSurfaceOperation:()=>mp,setLocalStorageItem:()=>So,settingsHubSectionLabelKey:()=>Nse,settingsSectionVisibilityOf:()=>rh,shapeSectionNesting:()=>T7,sharedErrorBuilder:()=>Ou,shellModalOpenClause:()=>nEe,shellPaneRows:()=>d3,shellPaneSelectorForZone:()=>G4,shellPaneZone:()=>K4,shellRegionSelector:()=>H4,shellRowBox:()=>o3,shellStageRects:()=>v3,shouldRequireCurrentContextAddressabilityForOperation:()=>Nm,slideShellPaneHome:()=>u3,splitDividerOrientationToPanelGroupDirection:()=>G0,startApplicationService:()=>HQ,staticZoneDividers:()=>t2,storedLayoutTilesOf:()=>L9,tellChatSignInCompletionSinks:()=>Lb,toDateOrUndefined:()=>ii,toast:()=>dh,turnStatusFromServer:()=>fW,unresolvedLabel:()=>ps,updateElementStatus:()=>XMe,useActionOperationSurface:()=>QS,useActivityBarBehavior:()=>f7,useAnalytics:()=>o$,useAnonymousSession:()=>Coe,useAppLoading:()=>Ky,useAppMode:()=>nue,useAppModeSafe:()=>Yx,useAppScope:()=>bm,useAppScopeInternal:()=>Boe,useAppScopeSafe:()=>Zp,useAppShellFirstReady:()=>p4,useAppShellLayout:()=>E2,useApplication:()=>Su,useArrayItemAutosaveField:()=>sI,useAuthSession:()=>hm,useBarrierParticipant:()=>nle,useBilling:()=>Kse,useBillingAction:()=>Ch,useBillingSafe:()=>Lh,useBrandIdentity:()=>b2,useBrandPresentation:()=>x2,useChartDashboardLayout:()=>G9,useChartData:()=>d_,useChatSignInCompletion:()=>Rb,useClaimChildComposition:()=>YJ,useCommandMenuBehavior:()=>G7,useComponentLoading:()=>qy,useComposedChildren:()=>gye,useCompositeResourceOperationContextBuilder:()=>i9,useCompositeViewContext:()=>NU,useConsentBasedProviderActivations:()=>_x,useConsentGateBehavior:()=>EH,useContextualDisplayParams:()=>NA,useControlPanelBehavior:()=>L7,useCreateOperationSurface:()=>que,useCrossFrontendHandoff:()=>JEe,useDisplayChromeContext:()=>ik,useDisplayContextKind:()=>MA,useDisplayTemplateContext:()=>ek,useDisplayableImageUrl:()=>y2,useDocumentAcceptanceGateBehavior:()=>kH,useEmbeddedResourceContext:()=>U6,useEmbeddedResourceDescent:()=>VJ,useEmbeddedResourceHostContext:()=>kU,useEmitLoadingScope:()=>Jm,useEmphasisedActionLabels:()=>qS,useError:()=>$f,useEventBus:()=>Uo,useEventEmit:()=>Ku,useEventSubscription:()=>nte,useExecution:()=>jce,useExecutionDirtyBridge:()=>wy,useExecutionDirtyMarkerScope:()=>Mce,useExecutionParticipationDataPrefetch:()=>Lce,useExecutionParticipationPrefetch:()=>Ty,useFeatureAvailability:()=>A0,useFeatureGate:()=>YEe,useFeatures:()=>vh,useFieldControlAria:()=>LM,useFieldControlLabelId:()=>RM,useFieldRevealRequests:()=>zD,useFieldScope:()=>CD,useFileActivation:()=>x8,useFlowsActors:()=>gW,useFlowsActorsSafe:()=>_W,useFlowsActorsStatusWord:()=>mf,useFormChromeContext:()=>qw,useFormField:()=>z8,useFormSchemaContext:()=>jD,useFormTemplateContext:()=>AT,useGlobalNavigationController:()=>vS,useGrantedConsentPurposes:()=>Kb,useGuidance:()=>dU,useHostedComponentInteractions:()=>H2,useHostlessResourceNavigation:()=>bS,useHotkey:()=>TSe,useHotkeyPause:()=>DSe,useHotkeyRegistry:()=>w$,useHotkeyScope:()=>OSe,useHotkeys:()=>ESe,useI18n:()=>q,useIconRegistry:()=>ef,useIsInFramedAncestor:()=>F,useKeepsHiddenPanelsMounted:()=>VD,useLauncherResolutionContext:()=>O$,useLifecycle:()=>fU,useListOperationSurface:()=>Kue,useLoading:()=>Qce,useMaterialRuntime:()=>t_,useMenuBarBehavior:()=>O7,useMenuUserOrgBehavior:()=>X7,useMfaContinuationNavigation:()=>oX,useNavigationBehaviors:()=>d7,useNavigationController:()=>yS,useNavigationState:()=>kx,useNotification:()=>Fm,useNotificationBadges:()=>QQ,useNotificationCenterBehavior:()=>z7,useNotificationPreferenceKinds:()=>o6,useOperationEnabled:()=>FS,useOperationFeatureAvailability:()=>Hse,useOperationsEnabled:()=>LS,useOptionalAutosave:()=>SE,useOptionalCompositeResourceContext:()=>H6,useOptionalCompositeViewContext:()=>PU,useOptionalDisplayTemplateContext:()=>tk,useOptionalEmbeddedResourceHostContext:()=>AU,useOptionalFormSchemaContext:()=>MD,useOptionalFormTemplateContext:()=>jT,useOptionalResourceFormActions:()=>rE,useOptionalResourceHeaderContext:()=>NB,useOverlayTitle:()=>H$,usePendingDecisions:()=>iW,usePortalContainer:()=>A2,useProgression:()=>pU,useProviderComponent:()=>Jb,useProviderComponentChoices:()=>qb,useProviderScopeReauthorizationOffers:()=>cr,usePublicShellLayout:()=>D2,usePublishNotificationBadgeCount:()=>u6,useQuickActionButtonBehavior:()=>q7,useQuickSwitcherBehavior:()=>A7,useReadOperationSurface:()=>Gue,useReadPageRecord:()=>yY,useRegisterComposedChild:()=>qJ,useReportAutomaticComposition:()=>XJ,useResolvedAuthConfig:()=>Gx,useResolvedFieldName:()=>wD,useResourceChartData:()=>AMe,useResourceDisplayContext:()=>oj,useResourceEmptyStateOffersPrimaryAction:()=>ZG,useResourceOperationActions:()=>WV,useResourceOperationSurface:()=>YS,useResourceReachability:()=>wm,useResourceRegistry:()=>fm,useResourceRegistrySafe:()=>ym,useResourceRoom:()=>QEe,useResourceSearch:()=>fV,useResourceSelection:()=>GV,useSearchOperationSurface:()=>ZS,useSectionLegendVoice:()=>_D,useServerErrorInjection:()=>YR,useSettingsHubConfig:()=>Ev,useShellColumnMotion:()=>D3,useShellDialogArrival:()=>p3,useShellFrontPane:()=>x3,useShellMotion:()=>O3,useShellPaneMotion:()=>E3,useShellPlaceChanges:()=>S3,useShellPressOrigin:()=>s3,useShellStageMeasurement:()=>b3,useSidebarBehavior:()=>w7,useSidebarMobileDrawerMode:()=>C7,useSmsConsentOffered:()=>c6,useStatusBarBehavior:()=>j7,useStepUpAuth:()=>GEe,useSurfaceBodyScrollLock:()=>KE,useSurfaceFocusTrap:()=>qE,useSurfacePolicy:()=>gc,useSurfacePolicyPortalTarget:()=>j2,useSurfacePolicyStackingClass:()=>N2,useSurfaceVariant:()=>_ee,useTemplateOwnsChildComposition:()=>JJ,useThemePreferenceControl:()=>x1,useToolbarBehavior:()=>M7,useTypographyScope:()=>l_,useUI:()=>Ng,useUpdateOperationSurface:()=>Jue,useUserFacingErrorMessage:()=>cp,useUserOrgs:()=>ng,useUtilityPanelBehavior:()=>I7,useViewerMayListRelatedResource:()=>x9,useViewerMayPerformResourceOperation:()=>rCe,useVocabularyWord:()=>Yf,useWebSocket:()=>up,utilityPanelWorkspaceSignature:()=>F7,variant:()=>Vt,verifyLauncherContent:()=>Nv,verifySettingsHubContent:()=>Vv,viewerBelongsToOrganization:()=>sg,viewerHoldsOneOfRoles:()=>Im,viewerIsKnownOutsideOrganization:()=>Fse,viewerMayHaveDecisionsWaiting:()=>Iv,viewerMayPerformOperation:()=>Wm,viewerMayReadChart:()=>N9,viewerReachesUserSubject:()=>ch,visibleChartDashboardTiles:()=>PMe,waitForFontsLoaded:()=>vg,whenRendered:()=>RD,wildoErrorIsShownToUser:()=>Tn,withConversationReadById:()=>eQ,withErrorBoundary:()=>Vce,withFocusedDecisionFirst:()=>zW,withNewestHistoryPage:()=>iQ,withOlderHistoryPage:()=>aQ,withPendingSend:()=>KZ,withoutConversation:()=>tQ,withoutHiddenParentReference:()=>ij,wrapWithAutosaveIndicator:()=>BM,zoneMutationTargetIndex:()=>Yse,zoneTabDomIds:()=>U0});export{O5 as $,SO as $a,tI as $i,l0 as $n,px as $o,lG as $r,u6 as $t,l7 as A,XM as Aa,CR as Ai,b4 as An,AT as Ao,jZ as Ar,j8 as At,Z5 as B,oj as Ba,_L as Bi,p4 as Bn,zw as Bo,sY as Br,h8 as Bt,A7 as C,hF as Ca,LB as Ci,k4 as Cn,hD as Co,lQ as Cr,H8 as Ct,f7 as D,mF as Da,DR as Di,X4 as Dn,jde as Do,GZ as Dr,z8 as Dt,C7 as E,pF as Ea,kR as Ei,M4 as En,PE as Eo,WZ as Er,R8 as Et,e7 as F,Jj as Fa,wL as Fi,m4 as Fn,Uw as Fo,eX as Fr,C8 as Ft,V5 as G,NA as Ga,QI as Gi,E2 as Gn,NC as Go,oJ as Gr,f8 as Gt,K5 as H,QA as Ha,YI as Hi,j2 as Hn,Lw as Ho,wJ as Hr,g8 as Ht,$5 as I,qj as Ia,CL as Ii,g4 as In,Ww as Io,ZY as Ir,S8 as It,z5 as J,Wk as Ja,SI as Ji,h2 as Jn,US as Jo,iJ as Jr,Y6 as Jt,R5 as K,uA as Ka,$I as Ki,x2 as Kn,VS as Ko,aJ as Kr,u8 as Kt,J5 as L,Pj as La,TL as Li,y4 as Ln,Rw as Lo,IY as Lr,x8 as Lt,a7 as M,UM as Ma,xR as Mi,D4 as Mn,Zw as Mo,tX as Mr,E8 as Mt,r7 as N,LM as Na,_R as Ni,w4 as Nn,Yw as No,$Y as Nr,T8 as Nt,c7 as O,gF as Oa,wR as Oi,H4 as On,AE as Oo,XZ as Or,I8 as Ot,i7 as P,RM as Pa,JL as Pi,v4 as Pn,Iw as Po,QY as Pr,w8 as Pt,P5 as Q,bO as Qa,sI as Qi,A0 as Qn,kx as Qo,uG as Qr,x6 as Qt,X5 as R,Aj as Ra,ML as Ri,h4 as Rn,Hw as Ro,bY as Rr,b8 as Rt,j7 as S,fF as Sa,RB as Si,V4 as Sn,_D as So,vQ as Sr,V8 as St,w7 as T,uF as Ta,fB as Ti,j4 as Tn,FE as To,sQ as Tr,L8 as Tt,U5 as U,$A as Ua,XI as Ui,N2 as Un,FC as Uo,tJ as Ur,p8 as Ut,Q5 as V,XA as Va,vL as Vi,H2 as Vn,Vw as Vo,CJ as Vr,_8 as Vt,H5 as W,ZA as Wa,ZI as Wi,D2 as Wn,RC as Wo,rJ as Wr,d8 as Wt,F5 as X,ek as Xa,yI as Xi,m2 as Xn,bS as Xo,eq as Xr,M6 as Xt,N5 as Y,$O as Ya,CI as Yi,p2 as Yn,qS as Yo,QK as Yr,Z6 as Yt,I5 as Z,tk as Za,hI as Zi,j0 as Zn,yS as Zo,$K as Zr,S6 as Zt,G7 as _,DF as _a,gV as _i,I4 as _n,VD as _o,j$ as _r,f5 as _t,v9 as a,RF as aa,$W as ai,Y3 as an,uO as ao,d1 as ar,Py as as,w5 as at,I7 as b,SF as ba,SV as bi,P4 as bn,kD as bo,yQ as br,Q8 as bt,C9 as c,FF as ca,gW as ci,X3 as cn,fO as co,l1 as cr,Oy as cs,m5 as ct,i9 as d,NF as da,UU as di,G3 as dn,nO as do,X$ as dr,dv as ds,i5 as dt,KF as ea,qW as ei,c6 as en,xO as eo,u0 as er,tx as es,k5 as et,n9 as f,MF as fa,JV as fi,O3 as fn,rO as fo,e1 as fr,cv as fs,o5 as ft,q7 as g,AF as ga,yV as gi,Q4 as gn,zD as go,B$ as gr,u5 as gt,X7 as h,jF as ha,vV as hi,L4 as hn,BD as ho,Y$ as hr,b_ as hs,l5 as ht,y9 as i,zF as ia,ZW as ii,B3 as in,mO as io,v1 as ir,Jy as is,T5 as it,n7 as j,KM as ja,SR as ji,T4 as jn,jT as jo,TX as jr,A8 as jt,u7 as k,YM as ka,ER as ki,x4 as kn,jE as ko,KZ as kr,F8 as kt,g9 as l,PF as la,_W as li,U3 as ln,aO as lo,c1 as lr,wv as ls,g5 as lt,$7 as m,kF as ma,hV as mi,Z4 as mn,sO as mo,$$ as mr,X_ as ms,c5 as mt,D9 as n,VF as na,eG as ni,a6 as nn,hO as no,N1 as nr,Bb as ns,j5 as nt,_9 as o,LF as oa,JW as oi,K3 as on,pO as oo,n1 as or,Ny as os,x5 as ot,t9 as p,wF as pa,mV as pi,t3 as pn,oO as po,Z$ as pr,nv as ps,s5 as pt,B5 as q,Zk as qa,kI as qi,g2 as qn,HS as qo,nJ as qr,n8 as qt,E9 as r,Wme as ra,QW as ri,r6 as rn,vO as ro,P1 as rr,Yy as rs,S5 as rt,w9 as s,IF as sa,AW as si,H3 as sn,dO as so,i1 as sr,My as ss,b5 as st,nNe as t,JF as ta,YW as ti,o6 as tn,_O as to,F1 as tr,Hb as ts,A5 as tt,x9 as u,Ime as ua,uW as ui,J3 as un,cO as uo,J$ as ur,pv as us,h5 as ut,z7 as v,EF as va,bV as vi,W4 as vn,OD as vo,EQ as vr,d5 as vt,O7 as w,_F as wa,AB as wi,A4 as wn,HE as wo,uQ as wr,U8 as wt,M7 as x,OF as xa,xV as xi,N4 as xn,bD as xo,_Q as xr,W8 as xt,L7 as y,TF as ya,_V as yi,$4 as yn,AD as yo,gQ as yr,a5 as yt,Y5 as z,aj as za,SL as zi,_4 as zn,Bw as zo,yY as zr,y8 as zt};
|