@nextclaw/ui 0.18.4 → 0.19.0

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.
Files changed (125) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/assets/api-Cyxp93Fn.js +13 -0
  3. package/dist/assets/appearance-settings-page-DsMl931U.js +1 -0
  4. package/dist/assets/{book-open-BOJLGVsx.js → book-open-Cl5CzL0g.js} +1 -1
  5. package/dist/assets/{channels-list-page-DKrUSeNz.js → channels-list-page-D_B7JGoZ.js} +2 -2
  6. package/dist/assets/chat-page-D3ZeULTv.js +1 -0
  7. package/dist/assets/config-split-page-C-YVl2mf.js +1 -0
  8. package/dist/assets/{confirm-dialog-Bsg9A62_.js → confirm-dialog-Bz3ieDQ5.js} +2 -2
  9. package/dist/assets/desktop-update-config-DO051-QG.js +1 -0
  10. package/dist/assets/{dist-IBUY9_9h.js → dist-CDPl8mm7.js} +1 -1
  11. package/dist/assets/{dist-DyUY9uQ0.js → dist-HFDWY6-K.js} +1 -1
  12. package/dist/assets/doc-browser-CWhs0JQN.js +1 -0
  13. package/dist/assets/doc-browser-D6H_nPzO.js +1 -0
  14. package/dist/assets/{doc-browser-context-BM6Af8gN.js → doc-browser-context-BKwz_j44.js} +1 -1
  15. package/dist/assets/form-actions-BUZOCfPR.js +1 -0
  16. package/dist/assets/index-DR3GLGme.css +1 -0
  17. package/dist/assets/index-j6DBnvlr.js +109 -0
  18. package/dist/assets/loader-circle-s65a4ZzL.js +1 -0
  19. package/dist/assets/mcp-marketplace-page-BJvzGt7h.js +9 -0
  20. package/dist/assets/mcp-marketplace-page-EpFHeJzw.js +1 -0
  21. package/dist/assets/model-config-page-CBoh0DVh.js +1 -0
  22. package/dist/assets/{navigation-link-DtPZZ_Q_.js → navigation-link-CDMYpkVv.js} +2 -2
  23. package/dist/assets/plus-XDIkqpkt.js +1 -0
  24. package/dist/assets/{provider-scoped-model-input-BFzyywsF.js → provider-scoped-model-input-C2iUtZi7.js} +1 -1
  25. package/dist/assets/providers-config-page-DX1pISTo.js +1 -0
  26. package/dist/assets/react-B7Paq2b3.js +8 -0
  27. package/dist/assets/{refresh-cw-BQHORcAs.js → refresh-cw-XrnNVwuQ.js} +1 -1
  28. package/dist/assets/remote-D_7_OGoj.js +1 -0
  29. package/dist/assets/rotate-cw-BhIWpLaU.js +1 -0
  30. package/dist/assets/runtime-config-page-BVO9B8Ns.js +1 -0
  31. package/dist/assets/{save-BgiS2u-T.js → save-_nSNAYQu.js} +1 -1
  32. package/dist/assets/{search-B6mO7mmo.js → search-0OTHFRMx.js} +1 -1
  33. package/dist/assets/{search-config-page-ydeDD1OQ.js → search-config-page-BwyeUjKt.js} +1 -1
  34. package/dist/assets/secrets-config-page-2O-TzroJ.js +3 -0
  35. package/dist/assets/security-config-BgIIrg1s.js +1 -0
  36. package/dist/assets/{select-DToos7Rq.js → select-BZHvnwQB.js} +2 -2
  37. package/dist/assets/{settings-2-ZAWXrq81.js → settings-2-CM_PvDNk.js} +1 -1
  38. package/dist/assets/skeleton-Bv4MMbH7.js +1 -0
  39. package/dist/assets/{tag-chip-urB3N-kk.js → tag-chip-Ce53PMTL.js} +1 -1
  40. package/dist/assets/x-CCjWN5ys.js +1 -0
  41. package/dist/index.html +20 -20
  42. package/package.json +6 -6
  43. package/src/app/components/layout/sidebar-items.tsx +49 -15
  44. package/src/app/configs/__tests__/app-navigation.config.test.ts +21 -0
  45. package/src/app/configs/app-navigation.config.ts +10 -1
  46. package/src/app/index.tsx +4 -0
  47. package/src/features/chat/components/conversation/chat-conversation-content.tsx +7 -0
  48. package/src/features/chat/components/layout/chat-page-shell.tsx +4 -1
  49. package/src/features/chat/components/layout/chat-sidebar-desktop-layout.tsx +26 -22
  50. package/src/features/chat/features/conversation/components/session-conversation-area.tsx +2 -0
  51. package/src/features/chat/features/input/input-surface-plugins/__tests__/context-reference-plugin.test.ts +1 -0
  52. package/src/features/chat/features/input/input-surface-plugins/__tests__/slash-command-plugin.test.ts +1 -0
  53. package/src/features/chat/features/message/components/chat-inline-panel-app-card.tsx +1 -3
  54. package/src/features/chat/features/message/components/chat-message-list.container.tsx +15 -1
  55. package/src/features/chat/features/message/components/chat-tool-call-stress-harness.tsx +178 -0
  56. package/src/features/chat/features/message/utils/__tests__/chat-message-process-summary.utils.test.ts +21 -0
  57. package/src/features/chat/features/message/utils/__tests__/chat-tool-call-stress-fixture.utils.test.ts +56 -0
  58. package/src/features/chat/features/message/utils/chat-message-core.utils.ts +1 -1
  59. package/src/features/chat/features/message/utils/chat-message-part.utils.ts +3 -10
  60. package/src/features/chat/features/message/utils/chat-message-process-summary.utils.ts +29 -1
  61. package/src/features/chat/features/message/utils/chat-message-texts.utils.ts +3 -0
  62. package/src/features/chat/features/message/utils/chat-message-tool-card.utils.ts +3 -28
  63. package/src/features/chat/features/message/utils/chat-tool-call-stress-fixture.utils.ts +122 -0
  64. package/src/features/chat/features/ncp/hooks/__tests__/use-ncp-session-conversation.test.tsx +69 -0
  65. package/src/features/chat/features/ncp/hooks/use-ncp-session-conversation.ts +29 -0
  66. package/src/features/chat/features/ncp/hooks/use-ncp-session-message-history.ts +106 -1
  67. package/src/features/chat/features/session/utils/ncp-session-adapter.utils.ts +2 -12
  68. package/src/features/chat/managers/__tests__/chat-ui.manager.test.ts +4 -2
  69. package/src/features/panel-apps/components/__tests__/panel-app-list-item.test.tsx +44 -1
  70. package/src/features/panel-apps/components/__tests__/panel-app-main-sidebar-nav.test.tsx +82 -0
  71. package/src/features/panel-apps/components/__tests__/panel-app-toolbar.test.tsx +13 -6
  72. package/src/features/panel-apps/components/__tests__/panel-apps-list.test.tsx +7 -1
  73. package/src/features/panel-apps/components/panel-app-icon.tsx +48 -0
  74. package/src/features/panel-apps/components/panel-app-list-item.tsx +19 -28
  75. package/src/features/panel-apps/components/panel-app-main-sidebar-nav.tsx +72 -0
  76. package/src/features/panel-apps/components/panel-app-toolbar.tsx +81 -20
  77. package/src/features/panel-apps/components/panel-apps-list.tsx +13 -26
  78. package/src/features/panel-apps/hooks/__tests__/use-panel-apps.test.tsx +105 -0
  79. package/src/features/panel-apps/hooks/use-panel-app-client-grant.ts +50 -0
  80. package/src/features/panel-apps/hooks/use-panel-app-main-runtime.ts +66 -0
  81. package/src/features/panel-apps/hooks/use-panel-apps.ts +102 -13
  82. package/src/features/panel-apps/index.ts +2 -0
  83. package/src/features/panel-apps/managers/__tests__/panel-app-bridge.manager.test.ts +1 -14
  84. package/src/features/panel-apps/managers/panel-app-bridge.manager.ts +9 -5
  85. package/src/features/panel-apps/pages/__tests__/panel-app-main-page.test.tsx +183 -0
  86. package/src/features/panel-apps/pages/panel-app-main-page.tsx +125 -0
  87. package/src/features/panel-apps/utils/__tests__/panel-app-view.utils.test.ts +2 -1
  88. package/src/features/panel-apps/utils/panel-app-doc-browser.utils.tsx +5 -4
  89. package/src/features/right-panel-resources/configs/right-panel-resource-routes.config.ts +12 -25
  90. package/src/features/right-panel-resources/index.ts +1 -0
  91. package/src/features/right-panel-resources/utils/__tests__/right-panel-resource-uri.utils.test.ts +9 -0
  92. package/src/features/right-panel-resources/utils/right-panel-resource-uri.utils.ts +29 -0
  93. package/src/main.tsx +24 -11
  94. package/src/shared/components/doc-browser/__tests__/doc-browser.test.tsx +76 -0
  95. package/src/shared/lib/api/ncp-session.types.ts +1 -0
  96. package/src/shared/lib/api/types.ts +3 -0
  97. package/src/shared/lib/api/utils/ncp-session.utils.ts +24 -1
  98. package/src/shared/lib/i18n/locales/en-US/chat.json +4 -0
  99. package/src/shared/lib/i18n/locales/en-US/doc-browser.json +10 -0
  100. package/src/shared/lib/i18n/locales/zh-CN/chat.json +4 -0
  101. package/src/shared/lib/i18n/locales/zh-CN/doc-browser.json +10 -0
  102. package/dist/assets/api-BSsQ0I4l.js +0 -13
  103. package/dist/assets/appearance-settings-page-CEPxG1w0.js +0 -1
  104. package/dist/assets/chat-page-sGhIjLSr.js +0 -1
  105. package/dist/assets/config-split-page-aUTKtWJu.js +0 -1
  106. package/dist/assets/desktop-update-config-VgvIATTT.js +0 -1
  107. package/dist/assets/doc-browser-D0arfzHY.js +0 -1
  108. package/dist/assets/doc-browser-D73yN8ts.js +0 -1
  109. package/dist/assets/form-actions-Cpd7glh8.js +0 -1
  110. package/dist/assets/index-Bsoscjk7.css +0 -1
  111. package/dist/assets/index-CtPLj_hk.js +0 -109
  112. package/dist/assets/loader-circle-C1fL3kBZ.js +0 -1
  113. package/dist/assets/mcp-marketplace-page-D8V0GU4Y.js +0 -9
  114. package/dist/assets/mcp-marketplace-page-q6T-vKoH.js +0 -1
  115. package/dist/assets/model-config-page-DQ-iQFSO.js +0 -1
  116. package/dist/assets/plus-B9V7Z_Eu.js +0 -1
  117. package/dist/assets/providers-config-page-DUYwVuYe.js +0 -1
  118. package/dist/assets/react-D-jOo51s.js +0 -8
  119. package/dist/assets/remote-CNFQ6bFY.js +0 -1
  120. package/dist/assets/rotate-cw-DuCF-3PX.js +0 -1
  121. package/dist/assets/runtime-config-page-CaWoWoQk.js +0 -1
  122. package/dist/assets/secrets-config-page-BZYqw8BF.js +0 -3
  123. package/dist/assets/security-config-Ds_2SXBh.js +0 -1
  124. package/dist/assets/skeleton-Bs2eO2CA.js +0 -1
  125. package/dist/assets/x-BkjTUiww.js +0 -1
@@ -1,8 +1,8 @@
1
- import{i as e,t}from"./chunk-DseTPa7n.js";import{I as n,P as r,V as i,i as a,o,r as s,z as c}from"./react-D-jOo51s.js";import{n as l,t as u}from"./navigation-link-DtPZZ_Q_.js";import{Ct as d,Dt as f,Nt as p,Qt as m,St as h,cn as g,ln as _,nn as v,rn as y,tn as b,un as x,xn as S,xt as C}from"./api-BSsQ0I4l.js";import{c as w}from"./dist-DyUY9uQ0.js";import{C as T,a as E,i as D,n as O,r as k,t as ee}from"./select-DToos7Rq.js";import{t as te}from"./search-B6mO7mmo.js";import{t as ne}from"./book-open-BOJLGVsx.js";import{t as A}from"./loader-circle-C1fL3kBZ.js";import{t as re}from"./x-BkjTUiww.js";import{t as ie}from"./tag-chip-urB3N-kk.js";import{C as ae,Gt as oe,J as j,Pt as M,Rt as se,Ut as ce,Vt as le,X as ue,Y as de,Z as N,_ as P,g as fe,it as F,j as pe,rt as I,v as L,y as R}from"./index-CtPLj_hk.js";import{t as me}from"./form-actions-Cpd7glh8.js";import{t as z}from"./config-hints-BcfVUMij.js";import{a as he,c as B,i as ge,l as _e,n as ve,o as V,r as ye,s as be,t as xe}from"./config-split-page-aUTKtWJu.js";var Se=w(`Hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Ce=w(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),H=w(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),U=w(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),we=w(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),W=e(i(),1),G=c();function Te({value:e,onChange:t,className:r,placeholder:i=``}){let[o,s]=(0,W.useState)(``),c=n=>{n.key===`Enter`&&o.trim()?(n.preventDefault(),t([...e,o.trim()]),s(``)):n.key===`Backspace`&&!o&&e.length>0&&t(e.slice(0,-1))},l=n=>{t(e.filter((e,t)=>t!==n))};return(0,G.jsxs)(`div`,{className:n(`flex min-h-[42px] flex-wrap gap-2 rounded-xl border border-gray-200/80 bg-white p-2`,r),children:[e.map((e,t)=>(0,G.jsxs)(ie,{tone:`info`,className:`gap-1 px-2 py-1 text-sm`,children:[e,(0,G.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`transition-colors hover:text-rose-200`,children:(0,G.jsx)(re,{className:`h-3 w-3`})})]},t)),(0,G.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),onKeyDown:c,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:i||a(`enterTag`)})]})}function Ee(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,G.jsx)(ce,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,G.jsx)(oe,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,G.jsx)(Ce,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,G.jsx)(Se,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,G.jsx)(we,{className:`h-3.5 w-3.5 text-gray-500`}):(0,G.jsx)(se,{className:`h-3.5 w-3.5 text-gray-500`})}function De({channelName:e,fields:t,formData:n,jsonDrafts:r,setJsonDrafts:i,updateField:o,uiHints:s}){return(0,G.jsx)(G.Fragment,{children:t.map(t=>{let c=z(`channels.${e}.${t.name}`,s),l=c?.label??t.label,u=c?.placeholder;return(0,G.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,G.jsxs)(b,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[Ee(t.name),l]}),t.type===`boolean`&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,G.jsx)(`span`,{className:`text-sm text-gray-500`,children:n[t.name]?a(`enabled`):a(`disabled`)}),(0,G.jsx)(p,{id:t.name,checked:n[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,G.jsx)(v,{id:t.name,type:t.type,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u,className:`rounded-xl`}),t.type===`password`&&(0,G.jsx)(v,{id:t.name,type:`password`,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u??a(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,G.jsx)(v,{id:t.name,type:`number`,value:n[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:u,className:`rounded-xl`}),t.type===`tags`&&(0,G.jsx)(Te,{value:n[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,G.jsxs)(ee,{value:n[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,G.jsx)(D,{className:`rounded-xl`,children:(0,G.jsx)(E,{})}),(0,G.jsx)(O,{children:(t.options??[]).map(e=>(0,G.jsx)(k,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,G.jsx)(`textarea`,{id:t.name,value:r[t.name]??`{}`,onChange:e=>i(n=>({...n,[t.name]:e.target.value})),className:`min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`})]},t.name)})})}var Oe=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),K=t((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)}})),q=t((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}}})),ke=t(((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})),Ae=t(((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})),je=t((e=>{var t=K().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}})),Me=t((e=>{var t=K().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Ne=t((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}})),Pe=t((e=>{var t=q(),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}}})),Fe=t((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]]}})),Ie=t((e=>{var t=Fe();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}})),Le=t(((e,t)=>{var n=Ie();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})),Re=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),ze=t((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
1
+ import{i as e,t}from"./chunk-DseTPa7n.js";import{B as n,F as r,H as i,L as a,a as o,r as s,s as c}from"./react-B7Paq2b3.js";import{n as l,t as u}from"./navigation-link-CDMYpkVv.js";import{$t as d,Ct as f,Ot as p,Pt as m,Sn as h,St as g,dn as _,in as v,ln as y,nn as b,rn as x,un as S,wt as C}from"./api-Cyxp93Fn.js";import{c as w}from"./dist-HFDWY6-K.js";import{C as T,a as E,i as D,n as O,r as k,t as ee}from"./select-BZHvnwQB.js";import{t as te}from"./search-0OTHFRMx.js";import{t as ne}from"./book-open-Cl5CzL0g.js";import{t as A}from"./loader-circle-s65a4ZzL.js";import{t as re}from"./x-CCjWN5ys.js";import{t as ie}from"./tag-chip-Ce53PMTL.js";import{C as ae,Ft as j,Ht as oe,Kt as se,Q as M,Wt as ce,X as le,Y as ue,Z as N,_ as P,at as F,g as de,it as I,j as fe,v as L,y as R,zt as pe}from"./index-j6DBnvlr.js";import{t as me}from"./form-actions-BUZOCfPR.js";import{t as z}from"./config-hints-BcfVUMij.js";import{a as he,c as B,i as ge,l as _e,n as ve,o as V,r as ye,s as be,t as xe}from"./config-split-page-C-YVl2mf.js";var Se=w(`Hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Ce=w(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),H=w(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),U=w(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),we=w(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),W=e(i(),1),G=n();function Te({value:e,onChange:t,className:n,placeholder:r=``}){let[i,s]=(0,W.useState)(``),c=n=>{n.key===`Enter`&&i.trim()?(n.preventDefault(),t([...e,i.trim()]),s(``)):n.key===`Backspace`&&!i&&e.length>0&&t(e.slice(0,-1))},l=n=>{t(e.filter((e,t)=>t!==n))};return(0,G.jsxs)(`div`,{className:a(`flex min-h-[42px] flex-wrap gap-2 rounded-xl border border-gray-200/80 bg-white p-2`,n),children:[e.map((e,t)=>(0,G.jsxs)(ie,{tone:`info`,className:`gap-1 px-2 py-1 text-sm`,children:[e,(0,G.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`transition-colors hover:text-rose-200`,children:(0,G.jsx)(re,{className:`h-3 w-3`})})]},t)),(0,G.jsx)(`input`,{type:`text`,value:i,onChange:e=>s(e.target.value),onKeyDown:c,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:r||o(`enterTag`)})]})}function Ee(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,G.jsx)(ce,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,G.jsx)(se,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,G.jsx)(Ce,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,G.jsx)(Se,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,G.jsx)(we,{className:`h-3.5 w-3.5 text-gray-500`}):(0,G.jsx)(pe,{className:`h-3.5 w-3.5 text-gray-500`})}function De({channelName:e,fields:t,formData:n,jsonDrafts:r,setJsonDrafts:i,updateField:a,uiHints:s}){return(0,G.jsx)(G.Fragment,{children:t.map(t=>{let c=z(`channels.${e}.${t.name}`,s),l=c?.label??t.label,u=c?.placeholder;return(0,G.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,G.jsxs)(b,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[Ee(t.name),l]}),t.type===`boolean`&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,G.jsx)(`span`,{className:`text-sm text-gray-500`,children:n[t.name]?o(`enabled`):o(`disabled`)}),(0,G.jsx)(m,{id:t.name,checked:n[t.name]||!1,onCheckedChange:e=>a(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,G.jsx)(x,{id:t.name,type:t.type,value:n[t.name]||``,onChange:e=>a(t.name,e.target.value),placeholder:u,className:`rounded-xl`}),t.type===`password`&&(0,G.jsx)(x,{id:t.name,type:`password`,value:n[t.name]||``,onChange:e=>a(t.name,e.target.value),placeholder:u??o(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,G.jsx)(x,{id:t.name,type:`number`,value:n[t.name]||0,onChange:e=>a(t.name,parseInt(e.target.value,10)||0),placeholder:u,className:`rounded-xl`}),t.type===`tags`&&(0,G.jsx)(Te,{value:n[t.name]||[],onChange:e=>a(t.name,e)}),t.type===`select`&&(0,G.jsxs)(ee,{value:n[t.name]||``,onValueChange:e=>a(t.name,e),children:[(0,G.jsx)(D,{className:`rounded-xl`,children:(0,G.jsx)(E,{})}),(0,G.jsx)(O,{children:(t.options??[]).map(e=>(0,G.jsx)(k,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,G.jsx)(`textarea`,{id:t.name,value:r[t.name]??`{}`,onChange:e=>i(n=>({...n,[t.name]:e.target.value})),className:`min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`})]},t.name)})})}var Oe=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),K=t((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)}})),q=t((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}}})),ke=t(((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})),Ae=t(((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})),je=t((e=>{var t=K().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}})),Me=t((e=>{var t=K().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Ne=t((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}})),Pe=t((e=>{var t=q(),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}}})),Fe=t((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]]}})),Ie=t((e=>{var t=Fe();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}})),Le=t(((e,t)=>{var n=Ie();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})),Re=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),ze=t((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
2
2
  ]))+`;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(`^`+t+`$`),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)}})),J=t((e=>{var t=Re(),n=ze();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}}})),Be=t((e=>{var t=K(),n=Pe(),r=q(),i=J(),a=Re(),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}})),Ve=t((e=>{var t=K(),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}})),He=t(((e,t)=>{var n=J();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})),Ue=t(((e,t)=>{var n=J(),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;for(t=0;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})),We=t(((e,t)=>{var n=J();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=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})),Ge=t(((e,t)=>{var n=J(),r=K();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;for(t=0;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]+`
3
3
  Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),Ke=t(((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)})),qe=t((e=>{var t=J(),n=He(),r=Ue(),i=We(),a=Ge(),o=ze(),s=K(),c=Ke();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)+`.
4
4
  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()))}})),Je=t((e=>{var t=K(),n=q(),r=ke(),i=Ae(),a=je(),o=Me(),s=Ne(),c=Pe(),l=Le(),u=Be(),d=Ve(),f=J(),p=qe();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(`
5
5
  The chosen QR Code version cannot contain this amount of data.
6
6
  Minimum version required to store current data is: `+c+`.
7
7
  `);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)}})),Ye=t((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||={};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]?1:0]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),Xe=t((e=>{var t=Ye();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)}})),Ze=t((e=>{var t=Ye();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>
8
- `;return typeof a==`function`&&a(null,p),p}})),Qe=t((e=>{var t=Oe(),n=Je(),r=Xe(),i=Ze();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)})}))();function $e(){return _({mutationFn:({channel:e,data:t})=>d(e,t)})}function et(){return _({mutationFn:({channel:e,data:t})=>h(e,t)})}function tt(){return _({mutationFn:({channel:e,data:t})=>C(e,t)})}var nt={weixin:{title:`weixinAuthTitle`,description:`weixinAuthDescription`,hint:`weixinAuthHint`,capabilityHint:`weixinAuthCapabilityHint`,disabledHint:`weixinAuthDisabledHint`,connect:`weixinAuthConnect`,qrAlt:`weixinAuthQrAlt`,scanPrompt:`weixinAuthScanPrompt`,readyTitle:`weixinAuthReadyTitle`,readyDescription:`weixinAuthReadyDescription`,advancedTitle:`weixinAuthAdvancedTitle`,advancedDescription:`weixinAuthAdvancedDescription`},feishu:{title:`feishuAuthTitle`,description:`feishuAuthDescription`,hint:`feishuAuthHint`,capabilityHint:`feishuAuthCapabilityHint`,disabledHint:`feishuAuthDisabledHint`,connect:`feishuAuthConnect`,qrAlt:`feishuAuthQrAlt`,scanPrompt:`feishuAuthScanPrompt`,readyTitle:`feishuAuthReadyTitle`,readyDescription:`feishuAuthReadyDescription`,advancedTitle:`feishuAuthAdvancedTitle`,advancedDescription:`feishuAuthAdvancedDescription`,domainLabel:`feishuAuthDomain`}};function rt(e){let{accounts:t}=e,n=new Set;if(typeof e.defaultAccountId==`string`&&e.defaultAccountId.trim()&&n.add(e.defaultAccountId.trim()),t&&typeof t==`object`&&!Array.isArray(t))for(let e of Object.keys(t)){let t=e.trim();t&&n.add(t)}return[...n]}function it(e,t){if(typeof e.baseUrl==`string`&&e.baseUrl.trim())return e.baseUrl.trim();if(typeof t.baseUrl==`string`&&t.baseUrl.trim())return t.baseUrl.trim()}function at(e,t){return(typeof e.domain==`string`?e.domain.trim():``)||(typeof t.domain==`string`?t.domain.trim():``)||void 0}function ot(e,t){return at(e,t)===`lark`?`lark`:`feishu`}function st(e){return e===`lark`?`https://open.larksuite.com/app`:`https://open.feishu.cn/app`}function ct(e,t){return x({queryKey:[`channel-qr`,e,t],enabled:!!t,queryFn:()=>(0,Qe.toDataURL)(t,{errorCorrectionLevel:`M`,margin:1,width:480})}).data??null}function lt({activeSession:e,baseUrl:t,channelEnabled:r,copy:i,connectButtonLabel:o,connectedAccountIds:s,disabled:c,domain:l,handleStartAuth:u,hasConnectedAccount:d,primaryAccountId:f,statusLabel:p}){return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full bg-white/90 px-3 py-1 text-xs font-medium text-primary shadow-sm`,children:[(0,G.jsx)(U,{className:`h-3.5 w-3.5`}),a(i.title)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:a(i.description)}),(0,G.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:a(i.hint)})]}),(0,G.jsxs)(`div`,{className:n(`inline-flex w-fit items-center gap-2 rounded-full px-3 py-1 text-xs font-medium`,e?`bg-amber-50 text-amber-700`:d?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-600`),children:[e?(0,G.jsx)(A,{className:`h-3.5 w-3.5 animate-spin`}):(0,G.jsx)(H,{className:`h-3.5 w-3.5`}),p]}),(0,G.jsxs)(`div`,{className:`space-y-1 text-sm text-gray-600`,children:[(0,G.jsx)(`p`,{children:a(r||!d?i.capabilityHint:i.disabledHint)}),f?(0,G.jsxs)(`p`,{children:[a(`weixinAuthPrimaryAccount`),`: `,(0,G.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:f})]}):null,s.length>1?(0,G.jsxs)(`p`,{children:[a(`weixinAuthConnectedAccounts`),`: `,(0,G.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:s.join(`, `)})]}):null,t?(0,G.jsxs)(`p`,{children:[a(`weixinAuthBaseUrl`),`: `,(0,G.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:t})]}):null,l&&i.domainLabel?(0,G.jsxs)(`p`,{children:[a(i.domainLabel),`: `,(0,G.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:l})]}):null]}),(0,G.jsx)(y,{type:`button`,onClick:()=>void u(),disabled:c,className:`rounded-xl`,children:o})]})}function ut({activeSession:e,authMessage:t,copy:n,qrDataUrl:r}){return(0,G.jsx)(`div`,{className:`w-full max-w-sm rounded-2xl border border-dashed border-primary/25 bg-white/85 p-4 shadow-sm`,children:e?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-gray-100 bg-white p-3`,children:r?(0,G.jsx)(`img`,{src:r,alt:a(n.qrAlt),className:`mx-auto aspect-square w-full max-w-[240px] object-contain`}):(0,G.jsx)(`div`,{className:`flex aspect-square w-full items-center justify-center rounded-xl bg-gray-50 text-gray-500`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,G.jsx)(A,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`p`,{className:`text-xs`,children:a(`weixinAuthStarting`)})]})})}),(0,G.jsxs)(`div`,{className:`space-y-1 text-xs text-gray-500`,children:[(0,G.jsx)(`p`,{children:t||e.note||a(n.scanPrompt)}),(0,G.jsxs)(`p`,{children:[a(`weixinAuthExpiresAt`),`: `,s(e.expiresAt)]})]}),(0,G.jsx)(u,{href:e.qrCodeUrl,external:!0,size:`xs`,children:a(`weixinAuthOpenQr`)})]}):(0,G.jsxs)(`div`,{className:`flex min-h-[280px] flex-col items-center justify-center rounded-2xl bg-gray-50/80 px-6 text-center`,children:[(0,G.jsx)(U,{className:`h-9 w-9 text-gray-300`}),(0,G.jsx)(`p`,{className:`mt-3 text-sm font-medium text-gray-700`,children:a(n.readyTitle)}),(0,G.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:a(n.readyDescription)})]})})}function dt({channelConfig:e,channelEnabled:t,channelName:n,disabled:r,formData:i}){let o=S(),s=$e(),c=et(),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(null),[p,m]=(0,W.useState)(!1),h=(0,W.useMemo)(()=>rt(e),[e]),_=h[0],v=it(i,e),y=n===`feishu`?at(i,e):void 0,b=h.length>0,x=b&&!p?null:l,C=ct(n,x?.qrCodeUrl),w=nt[n];(0,W.useEffect)(()=>{if(!x)return;let e=!1,t=null,r=async()=>{try{let i=await c.mutateAsync({channel:n,data:{sessionId:x.sessionId}});if(e)return;if(f(i),i.status===`authorized`){await o.invalidateQueries({queryKey:[`config`]}),await o.invalidateQueries({queryKey:[`config-meta`]}),g.success(i.message||a(`weixinAuthAuthorized`)),u(null);return}if(i.status===`expired`||i.status===`error`){g.error(i.message||a(`weixinAuthRetryRequired`)),u(null);return}t=setTimeout(r,i.nextPollMs??x.intervalMs)}catch(t){e||(g.error(`${a(`error`)}: ${t instanceof Error?t.message:String(t)}`),u(null))}};return t=setTimeout(r,x.intervalMs),()=>{e=!0,t&&clearTimeout(t)}},[n,x,c,o]);let T=async()=>{try{let e=await s.mutateAsync({channel:n,data:{baseUrl:v,domain:y,accountId:typeof i.defaultAccountId==`string`&&i.defaultAccountId.trim()?i.defaultAccountId.trim():void 0}});m(b),u(e),f({channel:n,status:`pending`,message:e.note,nextPollMs:e.intervalMs})}catch(e){g.error(`${a(`error`)}: ${e instanceof Error?e.message:String(e)}`)}},E=x?d?.status===`scanned`?a(`weixinAuthScanned`):a(`weixinAuthWaiting`):a(b?t?`weixinAuthAuthorized`:`weixinAuthConnectedDisabled`:`weixinAuthNotConnected`),D=s.isPending?a(`weixinAuthStarting`):a(x?`weixinAuthWaiting`:b?`weixinAuthReconnect`:w.connect),O=b?a(`weixinAuthAuthorized`):d?.message;return(0,G.jsx)(`section`,{className:`rounded-2xl border border-primary/20 bg-gradient-to-br from-primary-50/70 via-white to-emerald-50/60 p-5`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,G.jsx)(lt,{activeSession:x,baseUrl:v,channelEnabled:t,copy:w,connectButtonLabel:D,connectedAccountIds:h,disabled:r||s.isPending||!!x,domain:y,handleStartAuth:T,hasConnectedAccount:b,primaryAccountId:_,statusLabel:E}),(0,G.jsx)(ut,{activeSession:x,authMessage:O,copy:w,qrDataUrl:C})]})})}function ft({channelConfig:e,disabled:t,formData:n}){let r=S(),i=tt(),[o,s]=(0,W.useState)(()=>ot(n,e)),[c,l]=(0,W.useState)(``),[d,f]=(0,W.useState)(``),p=st(o),m=!!(c.trim()&&d.trim())&&!t&&!i.isPending,h=async()=>{try{let e=await i.mutateAsync({channel:`feishu`,data:{domain:o,fields:{appId:c.trim(),appSecret:d.trim()}}});await r.invalidateQueries({queryKey:[`config`]}),await r.invalidateQueries({queryKey:[`config-meta`]}),g.success(e.message||a(`feishuExistingAgentConnectSuccess`)),f(``)}catch(e){g.error(`${a(`error`)}: ${e instanceof Error?e.message:String(e)}`)}};return(0,G.jsx)(`section`,{className:`rounded-2xl border border-primary/20 bg-white p-5`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,G.jsxs)(`div`,{className:`max-w-xl space-y-3`,children:[(0,G.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full bg-gray-100 px-3 py-1 text-xs font-medium text-gray-700`,children:[(0,G.jsx)(H,{className:`h-3.5 w-3.5`}),a(`feishuExistingAgentTitle`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:a(`feishuExistingAgentDescription`)}),(0,G.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:a(`feishuExistingAgentHint`)})]}),(0,G.jsx)(u,{href:p,external:!0,children:a(o===`lark`?`feishuExistingAgentOpenLarkList`:`feishuExistingAgentOpenFeishuList`)})]}),(0,G.jsxs)(`div`,{className:`w-full max-w-sm space-y-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(b,{htmlFor:`feishu-existing-platform`,children:a(`feishuPlatform`)}),(0,G.jsxs)(ee,{value:o,onValueChange:e=>s(e===`lark`?`lark`:`feishu`),children:[(0,G.jsx)(D,{id:`feishu-existing-platform`,className:`rounded-xl`,children:(0,G.jsx)(E,{})}),(0,G.jsxs)(O,{children:[(0,G.jsx)(k,{value:`feishu`,children:`Feishu`}),(0,G.jsx)(k,{value:`lark`,children:`Lark`})]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(b,{htmlFor:`feishu-existing-app-id`,children:`App ID`}),(0,G.jsx)(v,{id:`feishu-existing-app-id`,value:c,onChange:e=>l(e.target.value),className:`rounded-xl`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(b,{htmlFor:`feishu-existing-app-secret`,children:`App Secret`}),(0,G.jsx)(v,{id:`feishu-existing-app-secret`,type:`password`,value:d,onChange:e=>f(e.target.value),className:`rounded-xl`})]}),(0,G.jsx)(y,{type:`button`,onClick:()=>void h(),disabled:!m,className:`w-full rounded-xl`,children:i.isPending?a(`feishuExistingAgentConnecting`):a(`feishuExistingAgentConnect`)})]})]})})}function pt(e){let[t,n]=(0,W.useState)(`create`);return(0,G.jsxs)(j,{value:t,onValueChange:e=>n(e===`existing`?`existing`:`create`),children:[(0,G.jsxs)(ue,{children:[(0,G.jsx)(N,{value:`create`,children:a(`feishuAuthCreateNew`)}),(0,G.jsx)(N,{value:`existing`,children:a(`feishuAuthConnectExisting`)})]}),(0,G.jsx)(de,{value:`create`,className:`mt-4`,children:(0,G.jsx)(dt,{...e,channelName:`feishu`})}),(0,G.jsx)(de,{value:`existing`,className:`mt-4`,children:(0,G.jsx)(ft,{...e})})]})}var mt=[{value:`pairing`,label:`pairing`},{value:`allowlist`,label:`allowlist`},{value:`open`,label:`open`},{value:`disabled`,label:`disabled`}],Y=[{value:`open`,label:`open`},{value:`allowlist`,label:`allowlist`},{value:`disabled`,label:`disabled`}],ht=[{value:`feishu`,label:`feishu`},{value:`lark`,label:`lark`}],gt=[{value:`off`,label:`off`},{value:`partial`,label:`partial`},{value:`block`,label:`block`},{value:`progress`,label:`progress`}];function _t(){return{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`),section:`primary`},{name:`defaultAccountId`,type:`text`,label:a(`defaultAccountId`)},{name:`domain`,type:`select`,label:a(`feishuAuthDomain`),options:ht},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)},{name:`groupPolicy`,type:`select`,label:a(`groupPolicy`),options:Y},{name:`requireMention`,type:`boolean`,label:a(`requireMention`)},{name:`accounts`,type:`json`,label:a(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`feishu-auth`},{type:`fields`,section:`advanced`,collapsible:{title:a(`feishuAuthAdvancedTitle`),description:a(`feishuAuthAdvancedDescription`)}}]}}function vt(){return{telegram:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`token`,type:`password`,label:a(`botToken`)},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)},{name:`proxy`,type:`text`,label:a(`proxy`)},{name:`accountId`,type:`text`,label:a(`accountId`)},{name:`dmPolicy`,type:`select`,label:a(`dmPolicy`),options:mt},{name:`groupPolicy`,type:`select`,label:a(`groupPolicy`),options:Y},{name:`groupAllowFrom`,type:`tags`,label:a(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:a(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:a(`mentionPatterns`)},{name:`groups`,type:`json`,label:a(`groupRulesJson`)}]},discord:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`token`,type:`password`,label:a(`botToken`)},{name:`allowBots`,type:`boolean`,label:a(`allowBotMessages`)},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)},{name:`gatewayUrl`,type:`text`,label:a(`gatewayUrl`)},{name:`intents`,type:`number`,label:a(`intents`)},{name:`proxy`,type:`text`,label:a(`proxy`)},{name:`mediaMaxMb`,type:`number`,label:a(`attachmentMaxSizeMb`)},{name:`streaming`,type:`select`,label:a(`streamingMode`),options:gt},{name:`draftChunk`,type:`json`,label:a(`draftChunkingJson`)},{name:`textChunkLimit`,type:`number`,label:a(`textChunkLimit`)},{name:`accountId`,type:`text`,label:a(`accountId`)},{name:`dmPolicy`,type:`select`,label:a(`dmPolicy`),options:mt},{name:`groupPolicy`,type:`select`,label:a(`groupPolicy`),options:Y},{name:`groupAllowFrom`,type:`tags`,label:a(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:a(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:a(`mentionPatterns`)},{name:`groups`,type:`json`,label:a(`groupRulesJson`)}]},whatsapp:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`bridgeUrl`,type:`text`,label:a(`bridgeUrl`)},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)}]},feishu:_t(),dingtalk:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`clientId`,type:`text`,label:a(`clientId`)},{name:`clientSecret`,type:`password`,label:a(`clientSecret`)},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)}]},wecom:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`corpId`,type:`text`,label:a(`corpId`)},{name:`agentId`,type:`text`,label:a(`agentId`)},{name:`secret`,type:`password`,label:a(`secret`)},{name:`token`,type:`password`,label:a(`token`)},{name:`callbackPort`,type:`number`,label:a(`callbackPort`)},{name:`callbackPath`,type:`text`,label:a(`callbackPath`)},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)}]},weixin:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`),section:`primary`},{name:`defaultAccountId`,type:`text`,label:a(`defaultAccountId`)},{name:`baseUrl`,type:`text`,label:a(`baseUrl`)},{name:`pollTimeoutMs`,type:`number`,label:a(`pollTimeoutMs`)},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)},{name:`accounts`,type:`json`,label:a(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`weixin-auth`},{type:`fields`,section:`advanced`,collapsible:{title:a(`weixinAuthAdvancedTitle`),description:a(`weixinAuthAdvancedDescription`)}}]},slack:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`mode`,type:`text`,label:a(`mode`)},{name:`webhookPath`,type:`text`,label:a(`webhookPath`)},{name:`allowBots`,type:`boolean`,label:a(`allowBotMessages`)},{name:`botToken`,type:`password`,label:a(`botToken`)},{name:`appToken`,type:`password`,label:a(`appToken`)}]},email:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`consentGranted`,type:`boolean`,label:a(`consentGranted`)},{name:`imapHost`,type:`text`,label:a(`imapHost`)},{name:`imapPort`,type:`number`,label:a(`imapPort`)},{name:`imapUsername`,type:`text`,label:a(`imapUsername`)},{name:`imapPassword`,type:`password`,label:a(`imapPassword`)},{name:`fromAddress`,type:`email`,label:a(`fromAddress`)}]},qq:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`appId`,type:`text`,label:a(`appId`)},{name:`secret`,type:`password`,label:a(`appSecret`)},{name:`markdownSupport`,type:`boolean`,label:a(`markdownSupport`)},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)}]}}}function yt(e){let t=o();return e.tutorialUrls?.[t]||e.tutorialUrls?.default||e.tutorialUrl}var bt=[],xt=[{type:`fields`,section:`all`}],X=new Set,Z=new Map,Q=null;function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function St(e,t){let n={...e};for(let[e,r]of Object.entries(t))n[e]=$(n[e])&&$(r)?St(n[e],r):r;return n}function Ct(e,t){let n={},r=n,i=e.split(`.`);for(let e=0;e<i.length-1;e+=1)r[i[e]]={},r=r[i[e]];return r[i[i.length-1]]=t,n}function wt(e,t){return t===`all`?e:e.filter(e=>t===`primary`?e.section===`primary`:e.section!==`primary`)}function Tt(e,t){let n={};return t.filter(e=>e.type===`json`).forEach(t=>{n[t.name]=JSON.stringify(e[t.name]??{},null,2)}),n}function Et(){Q||=f.eventBus.on(r.channelConfigApplyStatus,e=>{Z.set(e.channel,e.status===`started`?{status:`applying`}:e.status===`succeeded`?{status:`applied`}:{status:`failed`,message:e.message}),X.forEach(e=>e())})}function Dt(e){return X.add(e),Et(),()=>{X.delete(e),!X.size&&Q&&(Q(),Q=null,Z.clear())}}function Ot(e){return(0,W.useSyncExternalStore)(Dt,()=>e?Z.get(e)??null:null,()=>null)}function kt(e){return e?e.status===`applying`?{className:`text-amber-600`,label:a(`channelConfigApplying`)}:e.status===`applied`?{className:`text-emerald-600`,label:a(`channelConfigApplied`)}:{className:`text-red-600`,label:`${a(`channelConfigApplyFailed`)}${e.message?`: ${e.message}`:``}`}:null}function At({channelApplyStatus:e,channelLabel:t,channelName:r,enabled:i,tutorialUrl:o}){return(0,G.jsx)(B,{className:`px-5 py-4`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(I,{name:r,src:F(r),className:n(`h-9 w-9 rounded-lg bg-background/80`,i&&`ring-1 ring-primary/20`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,G.jsx)(`span`,{className:`text-sm font-semibold uppercase text-muted-foreground`,children:r[0]})}),(0,G.jsx)(`h3`,{className:`truncate text-lg font-semibold text-foreground capitalize`,children:t})]}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:a(`channelsFormDescription`)}),e?(0,G.jsx)(`p`,{className:n(`mt-2 text-xs font-medium`,e.className),children:e.label}):null,o?(0,G.jsx)(u,{href:o,external:!0,icon:ne,size:`xs`,className:`mt-2`,children:a(`channelsGuideTitle`)}):null]}),(0,G.jsx)(M,{status:i?`active`:`inactive`,label:a(i?`statusActive`:`statusInactive`)})]})})}function jt({channelConfig:e,channelName:t,disabled:n,enabled:r,fields:i,formData:a,jsonDrafts:o,layoutBlocks:s,setJsonDrafts:c,uiHints:l,updateField:u}){return(0,G.jsx)(G.Fragment,{children:s.map((s,d)=>{if(s.type===`fields`){let e=wt(i,s.section);if(e.length===0)return null;let n=(0,G.jsx)(De,{channelName:t,fields:e,formData:a,jsonDrafts:o,setJsonDrafts:c,updateField:u,uiHints:l});return s.collapsible?(0,G.jsxs)(`details`,{className:`group rounded-xl bg-muted/35`,children:[(0,G.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-medium text-foreground`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{children:s.collapsible.title}),s.collapsible.description?(0,G.jsx)(`p`,{className:`mt-1 text-xs font-normal text-muted-foreground`,children:s.collapsible.description}):null]}),(0,G.jsx)(T,{className:`h-4 w-4 text-muted-foreground transition-transform group-open:rotate-180`})]}),(0,G.jsx)(`div`,{className:`space-y-5 border-t border-border/45 px-4 py-4`,children:n})]},`${s.type}-${s.section}-${d}`):(0,G.jsx)(`div`,{children:n},`${s.type}-${s.section}-${d}`)}return s.sectionId===`feishu-auth`?(0,G.jsx)(pt,{channelConfig:e,formData:a,channelEnabled:r,disabled:n},`${s.type}-${s.sectionId}-${d}`):s.sectionId===`weixin-auth`?(0,G.jsx)(dt,{channelConfig:e,formData:a,channelName:`weixin`,channelEnabled:r,disabled:n},`${s.type}-${s.sectionId}-${d}`):null})})}function Mt({actions:e,channelConfig:t,channelLabel:n,channelName:r,fields:i,layoutBlocks:o,tutorialUrl:s,uiHints:c}){let l=pe(),u=ae(),[d,f]=(0,W.useState)(()=>({...t})),[p,m]=(0,W.useState)(()=>Tt(t,i)),[h,_]=(0,W.useState)(null),v=kt(Ot(r)),b=typeof d.enabled==`boolean`?d.enabled:!!t.enabled,x=l.isPending||!!h,S=(e,t)=>f(n=>({...n,[e]:t})),C=e=>{e.preventDefault();let t={...d};for(let e of i){if(e.type===`password`){let n=t[e.name];(typeof n!=`string`||n.length===0)&&delete t[e.name]}if(e.type===`json`)try{t[e.name]=(p[e.name]??``).trim()?JSON.parse(p[e.name]):{}}catch{g.error(`${a(`invalidJson`)}: ${e.name}`);return}}l.mutate({channel:r,data:t})},w=e=>{if(!$(e?.channels)||!$(e.channels[r]))return;let t=e.channels[r];f(e=>St(e,t)),m(e=>{let n={...e},r=!1;for(let e of i)e.type!==`json`||!Object.prototype.hasOwnProperty.call(t,e.name)||(n[e.name]=JSON.stringify(t[e.name]??{},null,2),r=!0);return r?n:e})},T=async e=>{_(e.id);try{let t=`channels.${r}`,n={...d};e.saveBeforeRun&&(n={...n,...e.savePatch??{}},f(n),await l.mutateAsync({channel:r,data:n}));let i=await u.mutateAsync({actionId:e.id,data:{scope:t,draftConfig:Ct(t,n)}});w(i.patch),i.ok?g.success(i.message||a(`success`)):g.error(i.message||a(`error`))}catch(e){g.error(`${a(`error`)}: ${e instanceof Error?e.message:String(e)}`)}finally{_(null)}};return(0,G.jsxs)(ve,{children:[(0,G.jsx)(At,{channelName:r,channelLabel:n,enabled:b,tutorialUrl:s,channelApplyStatus:v}),(0,G.jsxs)(`form`,{onSubmit:C,className:`flex min-h-0 flex-1 flex-col`,children:[(0,G.jsx)(V,{className:`space-y-5 px-5 py-4`,children:(0,G.jsx)(jt,{channelConfig:t,channelName:r,enabled:b,fields:i,formData:d,jsonDrafts:p,layoutBlocks:o,setJsonDrafts:m,uiHints:c,updateField:S,disabled:x})}),(0,G.jsx)(be,{children:(0,G.jsxs)(me,{align:`between`,children:[(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e.filter(e=>e.trigger===`manual`).map(e=>(0,G.jsx)(y,{type:`button`,size:`sm`,onClick:()=>void T(e),disabled:x,variant:`secondary`,children:h===e.id?a(`connecting`):e.title},e.id))}),(0,G.jsx)(y,{type:`submit`,size:`sm`,disabled:x,children:l.isPending?a(`saving`):a(`save`)})]})})]})]})}function Nt({channelName:e}){let{data:t}=P(),{data:n}=L(),{data:r}=R(),i=e?t?.channels[e]??null:null,o=n?.channels.find(t=>t.name===e),s=(0,W.useMemo)(()=>vt()[e||``],[e]);if(!e||!o||!i)return(0,G.jsx)(ye,{children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:a(`channelsSelectTitle`)}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:a(`channelsSelectDescription`)})]})});let c=s?.fields??bt,l=s?.layout??xt,u=r?.uiHints,d=z(`channels.${e}`,u)?.label??e,f=yt(o),p=JSON.stringify({channelName:e,channelConfig:i,jsonFields:c.filter(e=>e.type===`json`).map(e=>e.name)});return(0,G.jsx)(Mt,{actions:r?.actions?.filter(t=>t.scope===`channels.${e}`)??[],channelConfig:i,channelLabel:d,channelName:e,fields:c,layoutBlocks:l,tutorialUrl:f,uiHints:u},p)}var Pt={telegram:`channelDescTelegram`,slack:`channelDescSlack`,email:`channelDescEmail`,webhook:`channelDescWebhook`,discord:`channelDescDiscord`,feishu:`channelDescFeishu`,weixin:`channelDescWeixin`},Ft=[`weixin`,`feishu`,`discord`,`qq`];function It(e){let t=new Map(Ft.map((e,t)=>[e,t]));return e.map((e,t)=>({channel:e,index:t})).sort((e,n)=>{let r=t.get(e.channel.name)??1/0,i=t.get(n.channel.name)??1/0;return r===i?e.index-n.index:r-i}).map(({channel:e})=>e)}function Lt(){let{isMobile:e}=fe(),{data:t}=P(),{data:r}=L(),{data:i}=R(),[o,s]=(0,W.useState)(`enabled`),[c,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(``),p=(0,W.useMemo)(()=>It(r?.channels??[]),[r?.channels]),h=t?.channels,g=(0,W.useMemo)(()=>{let e=d.trim().toLowerCase();return p.filter(e=>o!==`enabled`||!!h?.[e.name]?.enabled).filter(t=>e?(t.displayName||t.name).toLowerCase().includes(e)||t.name.toLowerCase().includes(e):!0)},[o,h,p,d]),_=c&&g.some(e=>e.name===c)?c:e?null:g[0]?.name??null;return!t||!r?(0,G.jsx)(m,{title:a(`channelsPageTitle`),description:a(`channelsPageDescription`),layout:`split`,children:(0,G.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:a(`channelsLoading`)})}):(0,G.jsx)(m,{title:a(`channelsPageTitle`),description:a(`channelsPageDescription`),layout:`split`,children:(0,G.jsxs)(he,{className:`md:min-h-0`,compactView:c?`detail`:`list`,onMobileBack:()=>u(null),mobileListLabel:a(`channelsPageTitle`),children:[(0,G.jsxs)(_e,{children:[(0,G.jsx)(B,{className:`px-4 pt-4`,children:(0,G.jsx)(j,{value:o,onValueChange:s,children:(0,G.jsxs)(ue,{className:`mb-0 h-auto gap-3 border-b-0 bg-transparent p-0`,children:[(0,G.jsxs)(N,{value:`enabled`,className:`gap-1.5 px-0 pb-3`,children:[a(`channelsTabEnabled`),(0,G.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:p.filter(e=>h?.[e.name]?.enabled).length})]}),(0,G.jsxs)(N,{value:`all`,className:`gap-1.5 px-0 pb-3`,children:[a(`channelsTabAll`),(0,G.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:p.length})]})]})})}),(0,G.jsx)(`div`,{className:`border-b border-border/55 px-4 py-3`,children:(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(te,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/70`}),(0,G.jsx)(v,{value:d,onChange:e=>f(e.target.value),placeholder:a(`channelsFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,G.jsxs)(V,{className:`space-y-2 p-3`,children:[g.map(e=>{let r=!!t.channels[e.name]?.enabled,o=yt(e),s=z(`channels.${e.name}`,i?.uiHints)?.help||a(Pt[e.name]||`channelDescriptionDefault`);return(0,G.jsx)(xe,{onClick:()=>u(e.name),active:_===e.name,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,G.jsx)(I,{name:e.name,src:F(e.name),className:n(`h-10 w-10 rounded-lg bg-background/80`,r&&`ring-1 ring-primary/20`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,G.jsx)(`span`,{className:`text-sm font-semibold uppercase text-muted-foreground`,children:e.name[0]})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground`,children:e.displayName||e.name}),(0,G.jsx)(`p`,{className:`line-clamp-1 text-[11px] text-muted-foreground`,children:s})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o?(0,G.jsx)(`a`,{href:o,onClick:e=>e.stopPropagation(),className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground/45 transition-colors hover:bg-muted hover:text-foreground`,title:a(`channelsGuideTitle`),children:(0,G.jsx)(l,{className:`h-3.5 w-3.5`})}):null,(0,G.jsx)(M,{status:r?`active`:`inactive`,label:a(r?`statusActive`:`statusInactive`),className:`min-w-[56px] justify-center`})]})]})},e.name)}),g.length===0?(0,G.jsx)(ge,{icon:le,title:a(`channelsNoMatch`)}):null]})]}),(0,G.jsx)(Nt,{channelName:_??void 0})]})})}export{Lt as ChannelsList};
8
+ `;return typeof a==`function`&&a(null,p),p}})),Qe=t((e=>{var t=Oe(),n=Je(),r=Xe(),i=Ze();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)})}))();function $e(){return S({mutationFn:({channel:e,data:t})=>C(e,t)})}function et(){return S({mutationFn:({channel:e,data:t})=>f(e,t)})}function tt(){return S({mutationFn:({channel:e,data:t})=>g(e,t)})}var nt={weixin:{title:`weixinAuthTitle`,description:`weixinAuthDescription`,hint:`weixinAuthHint`,capabilityHint:`weixinAuthCapabilityHint`,disabledHint:`weixinAuthDisabledHint`,connect:`weixinAuthConnect`,qrAlt:`weixinAuthQrAlt`,scanPrompt:`weixinAuthScanPrompt`,readyTitle:`weixinAuthReadyTitle`,readyDescription:`weixinAuthReadyDescription`,advancedTitle:`weixinAuthAdvancedTitle`,advancedDescription:`weixinAuthAdvancedDescription`},feishu:{title:`feishuAuthTitle`,description:`feishuAuthDescription`,hint:`feishuAuthHint`,capabilityHint:`feishuAuthCapabilityHint`,disabledHint:`feishuAuthDisabledHint`,connect:`feishuAuthConnect`,qrAlt:`feishuAuthQrAlt`,scanPrompt:`feishuAuthScanPrompt`,readyTitle:`feishuAuthReadyTitle`,readyDescription:`feishuAuthReadyDescription`,advancedTitle:`feishuAuthAdvancedTitle`,advancedDescription:`feishuAuthAdvancedDescription`,domainLabel:`feishuAuthDomain`}};function rt(e){let{accounts:t}=e,n=new Set;if(typeof e.defaultAccountId==`string`&&e.defaultAccountId.trim()&&n.add(e.defaultAccountId.trim()),t&&typeof t==`object`&&!Array.isArray(t))for(let e of Object.keys(t)){let t=e.trim();t&&n.add(t)}return[...n]}function it(e,t){if(typeof e.baseUrl==`string`&&e.baseUrl.trim())return e.baseUrl.trim();if(typeof t.baseUrl==`string`&&t.baseUrl.trim())return t.baseUrl.trim()}function at(e,t){return(typeof e.domain==`string`?e.domain.trim():``)||(typeof t.domain==`string`?t.domain.trim():``)||void 0}function ot(e,t){return at(e,t)===`lark`?`lark`:`feishu`}function st(e){return e===`lark`?`https://open.larksuite.com/app`:`https://open.feishu.cn/app`}function ct(e,t){return _({queryKey:[`channel-qr`,e,t],enabled:!!t,queryFn:()=>(0,Qe.toDataURL)(t,{errorCorrectionLevel:`M`,margin:1,width:480})}).data??null}function lt({activeSession:e,baseUrl:t,channelEnabled:n,copy:r,connectButtonLabel:i,connectedAccountIds:s,disabled:c,domain:l,handleStartAuth:u,hasConnectedAccount:d,primaryAccountId:f,statusLabel:p}){return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full bg-white/90 px-3 py-1 text-xs font-medium text-primary shadow-sm`,children:[(0,G.jsx)(U,{className:`h-3.5 w-3.5`}),o(r.title)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:o(r.description)}),(0,G.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:o(r.hint)})]}),(0,G.jsxs)(`div`,{className:a(`inline-flex w-fit items-center gap-2 rounded-full px-3 py-1 text-xs font-medium`,e?`bg-amber-50 text-amber-700`:d?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-600`),children:[e?(0,G.jsx)(A,{className:`h-3.5 w-3.5 animate-spin`}):(0,G.jsx)(H,{className:`h-3.5 w-3.5`}),p]}),(0,G.jsxs)(`div`,{className:`space-y-1 text-sm text-gray-600`,children:[(0,G.jsx)(`p`,{children:o(n||!d?r.capabilityHint:r.disabledHint)}),f?(0,G.jsxs)(`p`,{children:[o(`weixinAuthPrimaryAccount`),`: `,(0,G.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:f})]}):null,s.length>1?(0,G.jsxs)(`p`,{children:[o(`weixinAuthConnectedAccounts`),`: `,(0,G.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:s.join(`, `)})]}):null,t?(0,G.jsxs)(`p`,{children:[o(`weixinAuthBaseUrl`),`: `,(0,G.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:t})]}):null,l&&r.domainLabel?(0,G.jsxs)(`p`,{children:[o(r.domainLabel),`: `,(0,G.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:l})]}):null]}),(0,G.jsx)(v,{type:`button`,onClick:()=>void u(),disabled:c,className:`rounded-xl`,children:i})]})}function ut({activeSession:e,authMessage:t,copy:n,qrDataUrl:r}){return(0,G.jsx)(`div`,{className:`w-full max-w-sm rounded-2xl border border-dashed border-primary/25 bg-white/85 p-4 shadow-sm`,children:e?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-gray-100 bg-white p-3`,children:r?(0,G.jsx)(`img`,{src:r,alt:o(n.qrAlt),className:`mx-auto aspect-square w-full max-w-[240px] object-contain`}):(0,G.jsx)(`div`,{className:`flex aspect-square w-full items-center justify-center rounded-xl bg-gray-50 text-gray-500`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,G.jsx)(A,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`p`,{className:`text-xs`,children:o(`weixinAuthStarting`)})]})})}),(0,G.jsxs)(`div`,{className:`space-y-1 text-xs text-gray-500`,children:[(0,G.jsx)(`p`,{children:t||e.note||o(n.scanPrompt)}),(0,G.jsxs)(`p`,{children:[o(`weixinAuthExpiresAt`),`: `,s(e.expiresAt)]})]}),(0,G.jsx)(u,{href:e.qrCodeUrl,external:!0,size:`xs`,children:o(`weixinAuthOpenQr`)})]}):(0,G.jsxs)(`div`,{className:`flex min-h-[280px] flex-col items-center justify-center rounded-2xl bg-gray-50/80 px-6 text-center`,children:[(0,G.jsx)(U,{className:`h-9 w-9 text-gray-300`}),(0,G.jsx)(`p`,{className:`mt-3 text-sm font-medium text-gray-700`,children:o(n.readyTitle)}),(0,G.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:o(n.readyDescription)})]})})}function dt({channelConfig:e,channelEnabled:t,channelName:n,disabled:r,formData:i}){let a=h(),s=$e(),c=et(),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(null),[p,m]=(0,W.useState)(!1),g=(0,W.useMemo)(()=>rt(e),[e]),_=g[0],v=it(i,e),b=n===`feishu`?at(i,e):void 0,x=g.length>0,S=x&&!p?null:l,C=ct(n,S?.qrCodeUrl),w=nt[n];(0,W.useEffect)(()=>{if(!S)return;let e=!1,t=null,r=async()=>{try{let i=await c.mutateAsync({channel:n,data:{sessionId:S.sessionId}});if(e)return;if(f(i),i.status===`authorized`){await a.invalidateQueries({queryKey:[`config`]}),await a.invalidateQueries({queryKey:[`config-meta`]}),y.success(i.message||o(`weixinAuthAuthorized`)),u(null);return}if(i.status===`expired`||i.status===`error`){y.error(i.message||o(`weixinAuthRetryRequired`)),u(null);return}t=setTimeout(r,i.nextPollMs??S.intervalMs)}catch(t){e||(y.error(`${o(`error`)}: ${t instanceof Error?t.message:String(t)}`),u(null))}};return t=setTimeout(r,S.intervalMs),()=>{e=!0,t&&clearTimeout(t)}},[n,S,c,a]);let T=async()=>{try{let e=await s.mutateAsync({channel:n,data:{baseUrl:v,domain:b,accountId:typeof i.defaultAccountId==`string`&&i.defaultAccountId.trim()?i.defaultAccountId.trim():void 0}});m(x),u(e),f({channel:n,status:`pending`,message:e.note,nextPollMs:e.intervalMs})}catch(e){y.error(`${o(`error`)}: ${e instanceof Error?e.message:String(e)}`)}},E=S?d?.status===`scanned`?o(`weixinAuthScanned`):o(`weixinAuthWaiting`):o(x?t?`weixinAuthAuthorized`:`weixinAuthConnectedDisabled`:`weixinAuthNotConnected`),D=s.isPending?o(`weixinAuthStarting`):o(S?`weixinAuthWaiting`:x?`weixinAuthReconnect`:w.connect),O=x?o(`weixinAuthAuthorized`):d?.message;return(0,G.jsx)(`section`,{className:`rounded-2xl border border-primary/20 bg-gradient-to-br from-primary-50/70 via-white to-emerald-50/60 p-5`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,G.jsx)(lt,{activeSession:S,baseUrl:v,channelEnabled:t,copy:w,connectButtonLabel:D,connectedAccountIds:g,disabled:r||s.isPending||!!S,domain:b,handleStartAuth:T,hasConnectedAccount:x,primaryAccountId:_,statusLabel:E}),(0,G.jsx)(ut,{activeSession:S,authMessage:O,copy:w,qrDataUrl:C})]})})}function ft({channelConfig:e,disabled:t,formData:n}){let r=h(),i=tt(),[a,s]=(0,W.useState)(()=>ot(n,e)),[c,l]=(0,W.useState)(``),[d,f]=(0,W.useState)(``),p=st(a),m=!!(c.trim()&&d.trim())&&!t&&!i.isPending,g=async()=>{try{let e=await i.mutateAsync({channel:`feishu`,data:{domain:a,fields:{appId:c.trim(),appSecret:d.trim()}}});await r.invalidateQueries({queryKey:[`config`]}),await r.invalidateQueries({queryKey:[`config-meta`]}),y.success(e.message||o(`feishuExistingAgentConnectSuccess`)),f(``)}catch(e){y.error(`${o(`error`)}: ${e instanceof Error?e.message:String(e)}`)}};return(0,G.jsx)(`section`,{className:`rounded-2xl border border-primary/20 bg-white p-5`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,G.jsxs)(`div`,{className:`max-w-xl space-y-3`,children:[(0,G.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full bg-gray-100 px-3 py-1 text-xs font-medium text-gray-700`,children:[(0,G.jsx)(H,{className:`h-3.5 w-3.5`}),o(`feishuExistingAgentTitle`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:o(`feishuExistingAgentDescription`)}),(0,G.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:o(`feishuExistingAgentHint`)})]}),(0,G.jsx)(u,{href:p,external:!0,children:o(a===`lark`?`feishuExistingAgentOpenLarkList`:`feishuExistingAgentOpenFeishuList`)})]}),(0,G.jsxs)(`div`,{className:`w-full max-w-sm space-y-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(b,{htmlFor:`feishu-existing-platform`,children:o(`feishuPlatform`)}),(0,G.jsxs)(ee,{value:a,onValueChange:e=>s(e===`lark`?`lark`:`feishu`),children:[(0,G.jsx)(D,{id:`feishu-existing-platform`,className:`rounded-xl`,children:(0,G.jsx)(E,{})}),(0,G.jsxs)(O,{children:[(0,G.jsx)(k,{value:`feishu`,children:`Feishu`}),(0,G.jsx)(k,{value:`lark`,children:`Lark`})]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(b,{htmlFor:`feishu-existing-app-id`,children:`App ID`}),(0,G.jsx)(x,{id:`feishu-existing-app-id`,value:c,onChange:e=>l(e.target.value),className:`rounded-xl`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(b,{htmlFor:`feishu-existing-app-secret`,children:`App Secret`}),(0,G.jsx)(x,{id:`feishu-existing-app-secret`,type:`password`,value:d,onChange:e=>f(e.target.value),className:`rounded-xl`})]}),(0,G.jsx)(v,{type:`button`,onClick:()=>void g(),disabled:!m,className:`w-full rounded-xl`,children:i.isPending?o(`feishuExistingAgentConnecting`):o(`feishuExistingAgentConnect`)})]})]})})}function pt(e){let[t,n]=(0,W.useState)(`create`);return(0,G.jsxs)(ue,{value:t,onValueChange:e=>n(e===`existing`?`existing`:`create`),children:[(0,G.jsxs)(N,{children:[(0,G.jsx)(M,{value:`create`,children:o(`feishuAuthCreateNew`)}),(0,G.jsx)(M,{value:`existing`,children:o(`feishuAuthConnectExisting`)})]}),(0,G.jsx)(le,{value:`create`,className:`mt-4`,children:(0,G.jsx)(dt,{...e,channelName:`feishu`})}),(0,G.jsx)(le,{value:`existing`,className:`mt-4`,children:(0,G.jsx)(ft,{...e})})]})}var mt=[{value:`pairing`,label:`pairing`},{value:`allowlist`,label:`allowlist`},{value:`open`,label:`open`},{value:`disabled`,label:`disabled`}],Y=[{value:`open`,label:`open`},{value:`allowlist`,label:`allowlist`},{value:`disabled`,label:`disabled`}],ht=[{value:`feishu`,label:`feishu`},{value:`lark`,label:`lark`}],gt=[{value:`off`,label:`off`},{value:`partial`,label:`partial`},{value:`block`,label:`block`},{value:`progress`,label:`progress`}];function _t(){return{fields:[{name:`enabled`,type:`boolean`,label:o(`enabled`),section:`primary`},{name:`defaultAccountId`,type:`text`,label:o(`defaultAccountId`)},{name:`domain`,type:`select`,label:o(`feishuAuthDomain`),options:ht},{name:`allowFrom`,type:`tags`,label:o(`allowFrom`)},{name:`groupPolicy`,type:`select`,label:o(`groupPolicy`),options:Y},{name:`requireMention`,type:`boolean`,label:o(`requireMention`)},{name:`accounts`,type:`json`,label:o(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`feishu-auth`},{type:`fields`,section:`advanced`,collapsible:{title:o(`feishuAuthAdvancedTitle`),description:o(`feishuAuthAdvancedDescription`)}}]}}function vt(){return{telegram:{fields:[{name:`enabled`,type:`boolean`,label:o(`enabled`)},{name:`token`,type:`password`,label:o(`botToken`)},{name:`allowFrom`,type:`tags`,label:o(`allowFrom`)},{name:`proxy`,type:`text`,label:o(`proxy`)},{name:`accountId`,type:`text`,label:o(`accountId`)},{name:`dmPolicy`,type:`select`,label:o(`dmPolicy`),options:mt},{name:`groupPolicy`,type:`select`,label:o(`groupPolicy`),options:Y},{name:`groupAllowFrom`,type:`tags`,label:o(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:o(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:o(`mentionPatterns`)},{name:`groups`,type:`json`,label:o(`groupRulesJson`)}]},discord:{fields:[{name:`enabled`,type:`boolean`,label:o(`enabled`)},{name:`token`,type:`password`,label:o(`botToken`)},{name:`allowBots`,type:`boolean`,label:o(`allowBotMessages`)},{name:`allowFrom`,type:`tags`,label:o(`allowFrom`)},{name:`gatewayUrl`,type:`text`,label:o(`gatewayUrl`)},{name:`intents`,type:`number`,label:o(`intents`)},{name:`proxy`,type:`text`,label:o(`proxy`)},{name:`mediaMaxMb`,type:`number`,label:o(`attachmentMaxSizeMb`)},{name:`streaming`,type:`select`,label:o(`streamingMode`),options:gt},{name:`draftChunk`,type:`json`,label:o(`draftChunkingJson`)},{name:`textChunkLimit`,type:`number`,label:o(`textChunkLimit`)},{name:`accountId`,type:`text`,label:o(`accountId`)},{name:`dmPolicy`,type:`select`,label:o(`dmPolicy`),options:mt},{name:`groupPolicy`,type:`select`,label:o(`groupPolicy`),options:Y},{name:`groupAllowFrom`,type:`tags`,label:o(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:o(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:o(`mentionPatterns`)},{name:`groups`,type:`json`,label:o(`groupRulesJson`)}]},whatsapp:{fields:[{name:`enabled`,type:`boolean`,label:o(`enabled`)},{name:`bridgeUrl`,type:`text`,label:o(`bridgeUrl`)},{name:`allowFrom`,type:`tags`,label:o(`allowFrom`)}]},feishu:_t(),dingtalk:{fields:[{name:`enabled`,type:`boolean`,label:o(`enabled`)},{name:`clientId`,type:`text`,label:o(`clientId`)},{name:`clientSecret`,type:`password`,label:o(`clientSecret`)},{name:`allowFrom`,type:`tags`,label:o(`allowFrom`)}]},wecom:{fields:[{name:`enabled`,type:`boolean`,label:o(`enabled`)},{name:`corpId`,type:`text`,label:o(`corpId`)},{name:`agentId`,type:`text`,label:o(`agentId`)},{name:`secret`,type:`password`,label:o(`secret`)},{name:`token`,type:`password`,label:o(`token`)},{name:`callbackPort`,type:`number`,label:o(`callbackPort`)},{name:`callbackPath`,type:`text`,label:o(`callbackPath`)},{name:`allowFrom`,type:`tags`,label:o(`allowFrom`)}]},weixin:{fields:[{name:`enabled`,type:`boolean`,label:o(`enabled`),section:`primary`},{name:`defaultAccountId`,type:`text`,label:o(`defaultAccountId`)},{name:`baseUrl`,type:`text`,label:o(`baseUrl`)},{name:`pollTimeoutMs`,type:`number`,label:o(`pollTimeoutMs`)},{name:`allowFrom`,type:`tags`,label:o(`allowFrom`)},{name:`accounts`,type:`json`,label:o(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`weixin-auth`},{type:`fields`,section:`advanced`,collapsible:{title:o(`weixinAuthAdvancedTitle`),description:o(`weixinAuthAdvancedDescription`)}}]},slack:{fields:[{name:`enabled`,type:`boolean`,label:o(`enabled`)},{name:`mode`,type:`text`,label:o(`mode`)},{name:`webhookPath`,type:`text`,label:o(`webhookPath`)},{name:`allowBots`,type:`boolean`,label:o(`allowBotMessages`)},{name:`botToken`,type:`password`,label:o(`botToken`)},{name:`appToken`,type:`password`,label:o(`appToken`)}]},email:{fields:[{name:`enabled`,type:`boolean`,label:o(`enabled`)},{name:`consentGranted`,type:`boolean`,label:o(`consentGranted`)},{name:`imapHost`,type:`text`,label:o(`imapHost`)},{name:`imapPort`,type:`number`,label:o(`imapPort`)},{name:`imapUsername`,type:`text`,label:o(`imapUsername`)},{name:`imapPassword`,type:`password`,label:o(`imapPassword`)},{name:`fromAddress`,type:`email`,label:o(`fromAddress`)}]},qq:{fields:[{name:`enabled`,type:`boolean`,label:o(`enabled`)},{name:`appId`,type:`text`,label:o(`appId`)},{name:`secret`,type:`password`,label:o(`appSecret`)},{name:`markdownSupport`,type:`boolean`,label:o(`markdownSupport`)},{name:`allowFrom`,type:`tags`,label:o(`allowFrom`)}]}}}function yt(e){let t=c();return e.tutorialUrls?.[t]||e.tutorialUrls?.default||e.tutorialUrl}var bt=[],xt=[{type:`fields`,section:`all`}],X=new Set,Z=new Map,Q=null;function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function St(e,t){let n={...e};for(let[e,r]of Object.entries(t))n[e]=$(n[e])&&$(r)?St(n[e],r):r;return n}function Ct(e,t){let n={},r=n,i=e.split(`.`);for(let e=0;e<i.length-1;e+=1)r[i[e]]={},r=r[i[e]];return r[i[i.length-1]]=t,n}function wt(e,t){return t===`all`?e:e.filter(e=>t===`primary`?e.section===`primary`:e.section!==`primary`)}function Tt(e,t){let n={};return t.filter(e=>e.type===`json`).forEach(t=>{n[t.name]=JSON.stringify(e[t.name]??{},null,2)}),n}function Et(){Q||=p.eventBus.on(r.channelConfigApplyStatus,e=>{Z.set(e.channel,e.status===`started`?{status:`applying`}:e.status===`succeeded`?{status:`applied`}:{status:`failed`,message:e.message}),X.forEach(e=>e())})}function Dt(e){return X.add(e),Et(),()=>{X.delete(e),!X.size&&Q&&(Q(),Q=null,Z.clear())}}function Ot(e){return(0,W.useSyncExternalStore)(Dt,()=>e?Z.get(e)??null:null,()=>null)}function kt(e){return e?e.status===`applying`?{className:`text-amber-600`,label:o(`channelConfigApplying`)}:e.status===`applied`?{className:`text-emerald-600`,label:o(`channelConfigApplied`)}:{className:`text-red-600`,label:`${o(`channelConfigApplyFailed`)}${e.message?`: ${e.message}`:``}`}:null}function At({channelApplyStatus:e,channelLabel:t,channelName:n,enabled:r,tutorialUrl:i}){return(0,G.jsx)(B,{className:`px-5 py-4`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(I,{name:n,src:F(n),className:a(`h-9 w-9 rounded-lg bg-background/80`,r&&`ring-1 ring-primary/20`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,G.jsx)(`span`,{className:`text-sm font-semibold uppercase text-muted-foreground`,children:n[0]})}),(0,G.jsx)(`h3`,{className:`truncate text-lg font-semibold text-foreground capitalize`,children:t})]}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:o(`channelsFormDescription`)}),e?(0,G.jsx)(`p`,{className:a(`mt-2 text-xs font-medium`,e.className),children:e.label}):null,i?(0,G.jsx)(u,{href:i,external:!0,icon:ne,size:`xs`,className:`mt-2`,children:o(`channelsGuideTitle`)}):null]}),(0,G.jsx)(j,{status:r?`active`:`inactive`,label:o(r?`statusActive`:`statusInactive`)})]})})}function jt({channelConfig:e,channelName:t,disabled:n,enabled:r,fields:i,formData:a,jsonDrafts:o,layoutBlocks:s,setJsonDrafts:c,uiHints:l,updateField:u}){return(0,G.jsx)(G.Fragment,{children:s.map((s,d)=>{if(s.type===`fields`){let e=wt(i,s.section);if(e.length===0)return null;let n=(0,G.jsx)(De,{channelName:t,fields:e,formData:a,jsonDrafts:o,setJsonDrafts:c,updateField:u,uiHints:l});return s.collapsible?(0,G.jsxs)(`details`,{className:`group rounded-xl bg-muted/35`,children:[(0,G.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-medium text-foreground`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{children:s.collapsible.title}),s.collapsible.description?(0,G.jsx)(`p`,{className:`mt-1 text-xs font-normal text-muted-foreground`,children:s.collapsible.description}):null]}),(0,G.jsx)(T,{className:`h-4 w-4 text-muted-foreground transition-transform group-open:rotate-180`})]}),(0,G.jsx)(`div`,{className:`space-y-5 border-t border-border/45 px-4 py-4`,children:n})]},`${s.type}-${s.section}-${d}`):(0,G.jsx)(`div`,{children:n},`${s.type}-${s.section}-${d}`)}return s.sectionId===`feishu-auth`?(0,G.jsx)(pt,{channelConfig:e,formData:a,channelEnabled:r,disabled:n},`${s.type}-${s.sectionId}-${d}`):s.sectionId===`weixin-auth`?(0,G.jsx)(dt,{channelConfig:e,formData:a,channelName:`weixin`,channelEnabled:r,disabled:n},`${s.type}-${s.sectionId}-${d}`):null})})}function Mt({actions:e,channelConfig:t,channelLabel:n,channelName:r,fields:i,layoutBlocks:a,tutorialUrl:s,uiHints:c}){let l=fe(),u=ae(),[d,f]=(0,W.useState)(()=>({...t})),[p,m]=(0,W.useState)(()=>Tt(t,i)),[h,g]=(0,W.useState)(null),_=kt(Ot(r)),b=typeof d.enabled==`boolean`?d.enabled:!!t.enabled,x=l.isPending||!!h,S=(e,t)=>f(n=>({...n,[e]:t})),C=e=>{e.preventDefault();let t={...d};for(let e of i){if(e.type===`password`){let n=t[e.name];(typeof n!=`string`||n.length===0)&&delete t[e.name]}if(e.type===`json`)try{t[e.name]=(p[e.name]??``).trim()?JSON.parse(p[e.name]):{}}catch{y.error(`${o(`invalidJson`)}: ${e.name}`);return}}l.mutate({channel:r,data:t})},w=e=>{if(!$(e?.channels)||!$(e.channels[r]))return;let t=e.channels[r];f(e=>St(e,t)),m(e=>{let n={...e},r=!1;for(let e of i)e.type!==`json`||!Object.prototype.hasOwnProperty.call(t,e.name)||(n[e.name]=JSON.stringify(t[e.name]??{},null,2),r=!0);return r?n:e})},T=async e=>{g(e.id);try{let t=`channels.${r}`,n={...d};e.saveBeforeRun&&(n={...n,...e.savePatch??{}},f(n),await l.mutateAsync({channel:r,data:n}));let i=await u.mutateAsync({actionId:e.id,data:{scope:t,draftConfig:Ct(t,n)}});w(i.patch),i.ok?y.success(i.message||o(`success`)):y.error(i.message||o(`error`))}catch(e){y.error(`${o(`error`)}: ${e instanceof Error?e.message:String(e)}`)}finally{g(null)}};return(0,G.jsxs)(ve,{children:[(0,G.jsx)(At,{channelName:r,channelLabel:n,enabled:b,tutorialUrl:s,channelApplyStatus:_}),(0,G.jsxs)(`form`,{onSubmit:C,className:`flex min-h-0 flex-1 flex-col`,children:[(0,G.jsx)(V,{className:`space-y-5 px-5 py-4`,children:(0,G.jsx)(jt,{channelConfig:t,channelName:r,enabled:b,fields:i,formData:d,jsonDrafts:p,layoutBlocks:a,setJsonDrafts:m,uiHints:c,updateField:S,disabled:x})}),(0,G.jsx)(be,{children:(0,G.jsxs)(me,{align:`between`,children:[(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e.filter(e=>e.trigger===`manual`).map(e=>(0,G.jsx)(v,{type:`button`,size:`sm`,onClick:()=>void T(e),disabled:x,variant:`secondary`,children:h===e.id?o(`connecting`):e.title},e.id))}),(0,G.jsx)(v,{type:`submit`,size:`sm`,disabled:x,children:l.isPending?o(`saving`):o(`save`)})]})})]})]})}function Nt({channelName:e}){let{data:t}=P(),{data:n}=L(),{data:r}=R(),i=e?t?.channels[e]??null:null,a=n?.channels.find(t=>t.name===e),s=(0,W.useMemo)(()=>vt()[e||``],[e]);if(!e||!a||!i)return(0,G.jsx)(ye,{children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:o(`channelsSelectTitle`)}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:o(`channelsSelectDescription`)})]})});let c=s?.fields??bt,l=s?.layout??xt,u=r?.uiHints,d=z(`channels.${e}`,u)?.label??e,f=yt(a),p=JSON.stringify({channelName:e,channelConfig:i,jsonFields:c.filter(e=>e.type===`json`).map(e=>e.name)});return(0,G.jsx)(Mt,{actions:r?.actions?.filter(t=>t.scope===`channels.${e}`)??[],channelConfig:i,channelLabel:d,channelName:e,fields:c,layoutBlocks:l,tutorialUrl:f,uiHints:u},p)}var Pt={telegram:`channelDescTelegram`,slack:`channelDescSlack`,email:`channelDescEmail`,webhook:`channelDescWebhook`,discord:`channelDescDiscord`,feishu:`channelDescFeishu`,weixin:`channelDescWeixin`},Ft=[`weixin`,`feishu`,`discord`,`qq`];function It(e){let t=new Map(Ft.map((e,t)=>[e,t]));return e.map((e,t)=>({channel:e,index:t})).sort((e,n)=>{let r=t.get(e.channel.name)??1/0,i=t.get(n.channel.name)??1/0;return r===i?e.index-n.index:r-i}).map(({channel:e})=>e)}function Lt(){let{isMobile:e}=de(),{data:t}=P(),{data:n}=L(),{data:r}=R(),[i,s]=(0,W.useState)(`enabled`),[c,u]=(0,W.useState)(null),[f,p]=(0,W.useState)(``),m=(0,W.useMemo)(()=>It(n?.channels??[]),[n?.channels]),h=t?.channels,g=(0,W.useMemo)(()=>{let e=f.trim().toLowerCase();return m.filter(e=>i!==`enabled`||!!h?.[e.name]?.enabled).filter(t=>e?(t.displayName||t.name).toLowerCase().includes(e)||t.name.toLowerCase().includes(e):!0)},[i,h,m,f]),_=c&&g.some(e=>e.name===c)?c:e?null:g[0]?.name??null;return!t||!n?(0,G.jsx)(d,{title:o(`channelsPageTitle`),description:o(`channelsPageDescription`),layout:`split`,children:(0,G.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:o(`channelsLoading`)})}):(0,G.jsx)(d,{title:o(`channelsPageTitle`),description:o(`channelsPageDescription`),layout:`split`,children:(0,G.jsxs)(he,{className:`md:min-h-0`,compactView:c?`detail`:`list`,onMobileBack:()=>u(null),mobileListLabel:o(`channelsPageTitle`),children:[(0,G.jsxs)(_e,{children:[(0,G.jsx)(B,{className:`px-4 pt-4`,children:(0,G.jsx)(ue,{value:i,onValueChange:s,children:(0,G.jsxs)(N,{className:`mb-0 h-auto gap-3 border-b-0 bg-transparent p-0`,children:[(0,G.jsxs)(M,{value:`enabled`,className:`gap-1.5 px-0 pb-3`,children:[o(`channelsTabEnabled`),(0,G.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:m.filter(e=>h?.[e.name]?.enabled).length})]}),(0,G.jsxs)(M,{value:`all`,className:`gap-1.5 px-0 pb-3`,children:[o(`channelsTabAll`),(0,G.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:m.length})]})]})})}),(0,G.jsx)(`div`,{className:`border-b border-border/55 px-4 py-3`,children:(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(te,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/70`}),(0,G.jsx)(x,{value:f,onChange:e=>p(e.target.value),placeholder:o(`channelsFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,G.jsxs)(V,{className:`space-y-2 p-3`,children:[g.map(e=>{let n=!!t.channels[e.name]?.enabled,i=yt(e),s=z(`channels.${e.name}`,r?.uiHints)?.help||o(Pt[e.name]||`channelDescriptionDefault`);return(0,G.jsx)(xe,{onClick:()=>u(e.name),active:_===e.name,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,G.jsx)(I,{name:e.name,src:F(e.name),className:a(`h-10 w-10 rounded-lg bg-background/80`,n&&`ring-1 ring-primary/20`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,G.jsx)(`span`,{className:`text-sm font-semibold uppercase text-muted-foreground`,children:e.name[0]})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground`,children:e.displayName||e.name}),(0,G.jsx)(`p`,{className:`line-clamp-1 text-[11px] text-muted-foreground`,children:s})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i?(0,G.jsx)(`a`,{href:i,onClick:e=>e.stopPropagation(),className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground/45 transition-colors hover:bg-muted hover:text-foreground`,title:o(`channelsGuideTitle`),children:(0,G.jsx)(l,{className:`h-3.5 w-3.5`})}):null,(0,G.jsx)(j,{status:n?`active`:`inactive`,label:o(n?`statusActive`:`statusInactive`),className:`min-w-[56px] justify-center`})]})]})},e.name)}),g.length===0?(0,G.jsx)(ge,{icon:oe,title:o(`channelsNoMatch`)}):null]})]}),(0,G.jsx)(Nt,{channelName:_??void 0})]})})}export{Lt as ChannelsList};
@@ -0,0 +1 @@
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{B as t,F as n,H as r,L as i,a}from"./react-B7Paq2b3.js";import{d as o,f as s,u as c}from"./navigation-link-CDMYpkVv.js";import{Ot as l,en as u,in as d,ln as f,rn as p,tn as m}from"./api-Cyxp93Fn.js";import{g as h,h as g}from"./mcp-marketplace-page-BJvzGt7h.js";import{c as _}from"./dist-HFDWY6-K.js";import{C as v,a as y,i as b,n as x,r as S,t as ee}from"./select-BZHvnwQB.js";import{a as C,c as w,i as T,n as E,o as D,r as O,s as k}from"./confirm-dialog-Bz3ieDQ5.js";import{t as te}from"./provider-scoped-model-input-C2iUtZi7.js";import{t as A}from"./plus-XDIkqpkt.js";import{t as ne}from"./settings-2-CM_PvDNk.js";import{t as re}from"./tag-chip-Ce53PMTL.js";import{$ as ie,D as j,Gt as ae,It as oe,J as se,Jt as ce,O as M,R as le,Rt as ue,Ut as de,Vt as N,Xt as fe,Zt as P,_ as F,_t as pe,a as me,bt as I,ct as he,dt as ge,et as _e,ft as ve,g as ye,gt as be,h as xe,i as Se,lt as L,m as Ce,mt as we,nt as R,o as Te,ot as Ee,pt as z,q as De,qt as Oe,r as B,rt as ke,s as Ae,st as V,t as H,tt as je,u as Me,ut as Ne,yt as U}from"./index-j6DBnvlr.js";var Pe=_(`Gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),W=e(r(),1),G=t(),K=new Intl.NumberFormat;function Fe({agent:e,defaults:t,runtimeOptions:n,defaultRuntime:r,defaultRuntimeLabel:i,onOpenChange:o,onEdit:s}){if(!e)return null;let c=q(e.model,t?.model),l=Ie({agent:e,defaults:t,runtimeOptions:n,defaultRuntime:r,defaultRuntimeLabel:i}),u=J(e.contextTokens,t?.contextTokens??2e5),f=J(e.reservedContextTokens,t?.reservedContextTokens),p=J(e.maxToolIterations,t?.maxToolIterations??1e3),m=q(e.thinkingDefault,t?.thinkingDefault??`off`),h=Re(e.runtimeConfig??e.engineConfig,t?.engineConfig),g=Re(e.models,t?.models);return(0,G.jsx)(E,{open:e!==null,onOpenChange:o,children:(0,G.jsxs)(O,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-popover p-0 sm:max-h-[720px] sm:max-w-2xl`,children:[(0,G.jsx)(`div`,{className:`shrink-0 px-5 pb-3 pt-5`,children:(0,G.jsx)(D,{className:`text-left`,children:(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,G.jsx)(R,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-10 w-10 shrink-0`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(k,{className:`truncate text-base`,children:e.displayName?.trim()||e.id}),(0,G.jsxs)(T,{className:`truncate text-xs`,children:[`@`,e.id]})]})]})})}),(0,G.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-contain px-5 py-3`,children:[(0,G.jsxs)(Y,{icon:P,title:a(`agentsDetailsIdentitySection`),children:[(0,G.jsx)(X,{label:a(`agentsDetailsFieldDisplayName`),value:e.displayName?.trim()||e.id}),(0,G.jsx)(X,{label:a(`agentsDetailsFieldId`),value:e.id,mono:!0}),(0,G.jsx)(X,{label:a(`agentsDetailsFieldDescription`),value:e.description?.trim()||a(`agentsDetailsEmptyValue`),wide:!0}),(0,G.jsx)(X,{label:a(`agentsDetailsFieldWorkspace`),value:e.workspace??a(`agentsDetailsUnsetValue`),mono:!0,wide:!0})]}),(0,G.jsxs)(Y,{icon:w,title:a(`agentsDetailsRuntimeSection`),children:[(0,G.jsx)(X,{label:a(`agentsDetailsFieldModel`),value:c.value,source:c.source}),(0,G.jsx)(X,{label:a(`agentsDetailsFieldRuntime`),value:l.value,source:l.source}),(0,G.jsx)(X,{label:a(`agentsDetailsFieldRuntimeConfig`),value:h.value,source:h.source,mono:!0,prewrap:!0})]}),(0,G.jsxs)(Y,{icon:Pe,title:a(`agentsDetailsContextSection`),children:[(0,G.jsx)(X,{label:a(`agentsDetailsFieldContextTokens`),value:u.value,source:u.source}),(0,G.jsx)(X,{label:a(`agentsDetailsFieldReservedContextTokens`),value:f.value,source:f.source}),(0,G.jsx)(X,{label:a(`agentsDetailsFieldMaxToolIterations`),value:p.value,source:p.source})]}),(0,G.jsxs)(Y,{icon:fe,title:a(`agentsDetailsBehaviorSection`),children:[(0,G.jsx)(X,{label:a(`agentsDetailsFieldThinkingDefault`),value:m.value,source:m.source}),(0,G.jsx)(X,{label:a(`agentsDetailsFieldModelOverrides`),value:g.value,source:g.source,mono:!0,prewrap:!0}),(0,G.jsx)(X,{label:a(`agentsDetailsFieldAvatar`),value:e.avatar??a(`agentsDetailsUnsetValue`),mono:!0})]})]}),(0,G.jsxs)(C,{className:`shrink-0 px-5 pb-4 pt-2`,children:[(0,G.jsx)(d,{type:`button`,variant:`ghost`,onClick:()=>o(!1),children:a(`cancel`)}),(0,G.jsxs)(d,{type:`button`,variant:`primary`,className:`px-4`,onClick:()=>s(e),children:[(0,G.jsx)(N,{className:`mr-2 h-4 w-4`}),a(`agentsDetailsEditAction`)]})]})]})})}function q(e,t){let n=e?.trim();return n?{value:n,source:`override`}:{value:t?.trim()||a(`agentsDetailsUnsetValue`),source:`default`}}function J(e,t){return typeof e==`number`?{value:K.format(e),source:`override`}:{value:typeof t==`number`?K.format(t):a(`agentsDetailsUnsetValue`),source:`default`}}function Ie(e){let{agent:t,defaults:n,runtimeOptions:r,defaultRuntime:i,defaultRuntimeLabel:a}=e,o=t.runtime?.trim()||t.engine?.trim();if(o)return{value:Le(o,r,a),source:`override`};let s=n?.engine?.trim()||i;return{value:s?Le(s,r,a):a,source:`default`}}function Le(e,t,n){let r=V(e);return r?t.find(e=>e.value===r)?.label??L(r):n}function Re(e,t){return ze(e)?{value:JSON.stringify(e,null,2),source:`override`}:{value:ze(t)?JSON.stringify(t,null,2):a(`agentsDetailsUnsetValue`),source:`default`}}function ze(e){return!!(e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length>0)}function Y(e){let{icon:t,title:n,children:r}=e;return(0,G.jsxs)(`section`,{className:`space-y-2 border-t border-border/60 pt-3 first:border-t-0 first:pt-0`,children:[(0,G.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold leading-5 text-foreground`,children:[(0,G.jsx)(t,{className:`h-3.5 w-3.5 text-muted-foreground`}),n]}),(0,G.jsx)(`dl`,{className:`grid min-w-0 gap-x-6 gap-y-2.5 pl-5 sm:grid-cols-2`,children:r})]})}function X(e){let{label:t,value:n,source:r,mono:a=!1,prewrap:o=!1,wide:s=!1}=e,c=o&&n.trim().startsWith(`{`),l=a&&(!o||c);return(0,G.jsxs)(`div`,{className:i(`grid min-w-0 grid-cols-[10rem_minmax(0,1fr)] items-baseline gap-x-2`,(s||c)&&`sm:col-span-2`),children:[(0,G.jsx)(`dt`,{className:`flex min-w-0 items-baseline leading-5`,children:(0,G.jsx)(`span`,{className:`whitespace-nowrap text-xs font-medium text-muted-foreground`,children:t})}),(0,G.jsxs)(`dd`,{className:i(`min-w-0 break-words text-xs leading-5 text-foreground`,c?`max-h-28 overflow-auto whitespace-pre-wrap rounded bg-muted/50 px-2 py-1.5 text-left`:``),children:[(0,G.jsx)(`span`,{className:l?`font-mono`:void 0,children:n}),r?(0,G.jsx)(Be,{source:r}):null]})]})}function Be({source:e}){return(0,G.jsxs)(`span`,{className:i(`ml-1 whitespace-nowrap text-xs font-normal leading-5`,e===`override`?`text-blue-500`:`text-muted-foreground`),children:[`(`,a(e===`override`?`agentsDetailsAgentOverride`:`agentsDetailsInheritedDefault`),`)`]})}function Ve({form:e,disabled:t=!1,onChange:n}){return(0,G.jsxs)(`details`,{className:`group rounded-2xl border border-border bg-card`,children:[(0,G.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-semibold text-foreground [&::-webkit-details-marker]:hidden`,children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(ne,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`truncate`,children:a(`agentsAdvancedConfigToggle`)})]}),(0,G.jsx)(v,{className:`h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180`})]}),(0,G.jsxs)(`div`,{className:`space-y-4 border-t border-border/60 px-4 py-4`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:a(`agentsAdvancedConfigDescription`)}),(0,G.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:(0,G.jsx)(He,{label:a(`agentsAdvancedContextTokensLabel`),value:e.contextTokens,min:1e3,step:1e3,disabled:t,onChange:e=>n({contextTokens:e})})})]})]})}function He(e){let{label:t,value:n,min:r,step:i,disabled:o,onChange:s}=e;return(0,G.jsxs)(`label`,{className:`space-y-2 text-sm font-medium text-foreground`,children:[(0,G.jsx)(`span`,{children:t}),(0,G.jsx)(p,{type:`number`,min:r,step:i,value:n,disabled:o,placeholder:a(`agentsAdvancedInheritPlaceholder`),"aria-label":t,onChange:e=>s(e.target.value)})]})}function Ue(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``,contextTokens:We(e.contextTokens)}}function We(e){return typeof e==`number`?String(e):``}var Z=W.forwardRef(({className:e,...t},n)=>(0,G.jsx)(`textarea`,{className:i(`flex min-h-28 w-full rounded-xl border border-border/75 bg-card px-3.5 py-2.5 text-sm text-foreground placeholder:text-muted-foreground/55 placeholder:font-normal transition-colors focus:outline-none focus:ring-0 disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));Z.displayName=`Textarea`;function Ge(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=V(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:L(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function Ke({value:e,disabled:t=!1,runtimeOptions:n,defaultRuntime:r,onChange:i}){let o=e.trim()?V(e):``,s=Ge({runtimeOptions:n,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?a(`agentsRuntimeUnavailableHelp`):``);return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(ee,{value:o||r,onValueChange:e=>i(e===r?``:e),disabled:t,children:[(0,G.jsx)(b,{"aria-label":a(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,G.jsx)(y,{placeholder:a(`agentsRuntimeSelectPlaceholder`)})}),(0,G.jsx)(x,{className:`rounded-xl`,children:s.map(e=>(0,G.jsx)(S,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l}):null]})}function qe({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,G.jsx)(E,{open:e!==null,onOpenChange:a,children:e?(0,G.jsx)(Je,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function Je(e){let{agent:t,pending:n,providerCatalog:r,runtimeOptions:i,defaultRuntime:o,onOpenChange:s,onSubmit:c}=e,[l,u]=(0,W.useState)(Ue(t));return(0,G.jsxs)(O,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-popover p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,G.jsx)(`div`,{className:`shrink-0 border-b border-border px-6 py-6`,children:(0,G.jsxs)(D,{className:`text-left`,children:[(0,G.jsx)(k,{children:a(`agentsEditDialogTitle`)}),(0,G.jsx)(T,{children:a(`agentsEditDialogDescription`)})]})}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(h,{tone:`warning`,title:a(`agentsEditHomeReadonly`),description:a(`agentsEditHomeReadonlyHint`),children:(0,G.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,G.jsx)(p,{value:l.displayName,onChange:e=>u(t=>({...t,displayName:e.target.value})),placeholder:a(`agentsFormNamePlaceholder`)}),(0,G.jsx)(Z,{value:l.description,onChange:e=>u(t=>({...t,description:e.target.value})),placeholder:a(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,G.jsx)(p,{value:l.avatar,onChange:e=>u(t=>({...t,avatar:e.target.value})),placeholder:a(`agentsFormAvatarPlaceholder`)}),(0,G.jsx)(te,{value:l.model,onChange:e=>u(t=>({...t,model:e})),providerCatalog:r,disabled:n,className:`md:col-span-2`}),(0,G.jsx)(Ke,{value:l.runtime,onChange:e=>u(t=>({...t,runtime:e})),runtimeOptions:i,defaultRuntime:o,disabled:n})]}),(0,G.jsx)(Ve,{form:l,disabled:n,onChange:e=>u(t=>({...t,...e}))})]})}),(0,G.jsxs)(C,{className:`shrink-0 border-t border-border px-6 py-5`,children:[(0,G.jsx)(d,{type:`button`,variant:`ghost`,onClick:()=>s(!1),disabled:n,children:a(`cancel`)}),(0,G.jsxs)(d,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>c(t.id,l),disabled:n,children:[(0,G.jsx)(N,{className:`mr-2 h-4 w-4`}),a(`agentsEditSaveAction`)]})]})]})}var Ye=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function Xe(e){let t=e.trim();if(!t)return null;let n=Number(t);if(!Number.isFinite(n))throw Error(a(`agentsAdvancedInvalidNumberError`));return Math.trunc(n)}function Ze(e){return{displayName:e.displayName,description:e.description,avatar:e.avatar,model:e.model,...e.runtime.trim()?{runtime:e.runtime.trim()}:{runtime:``},contextTokens:Xe(e.contextTokens)}}function Q(e){let{icon:t,label:n,disabled:r=!1,destructive:a=!1,onClick:o}=e;return(0,G.jsxs)(`button`,{type:`button`,className:i(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,a?`text-destructive hover:bg-destructive/10`:`text-foreground hover:bg-muted`),onClick:o,disabled:r,children:[(0,G.jsx)(t,{className:`h-4 w-4 shrink-0`}),(0,G.jsx)(`span`,{children:n})]})}function Qe(e){let{agent:t,runtimeOptions:n,defaultRuntimeLabel:r,updatePending:i,deletePending:o,onStartChat:s,onView:c,onEdit:l,onDelete:u}=e,f=t.runtime?.trim()||t.engine?.trim()||``,p=f?n.find(e=>e.value===V(f))?.label??L(f):r;return(0,G.jsx)(U,{className:`group overflow-hidden border border-border bg-card shadow-none transition-colors duration-200 hover:border-border/80`,children:(0,G.jsxs)(I,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,G.jsx)(R,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`truncate text-sm font-semibold text-foreground`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,G.jsxs)(re,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,G.jsx)(ue,{className:`h-3 w-3`}),a(`agentsCardBuiltInTag`)]}):null]}),(0,G.jsxs)(`div`,{className:`truncate text-xs text-muted-foreground`,children:[`@`,t.id]})]})]}),(0,G.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 flex items-center gap-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,children:[(0,G.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-muted-foreground hover:text-foreground`,"aria-label":a(`agentsCardStartChat`),title:a(`agentsCardStartChat`),onClick:s,children:(0,G.jsx)(de,{className:`h-4 w-4`})}),(0,G.jsxs)(we,{children:[(0,G.jsx)(pe,{asChild:!0,children:(0,G.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-muted-foreground hover:text-foreground`,"aria-label":a(`chatSessionMoreActions`),title:a(`chatSessionMoreActions`),children:(0,G.jsx)(ce,{className:`h-4 w-4`})})}),(0,G.jsxs)(be,{align:`end`,className:`w-44 p-1.5`,children:[(0,G.jsx)(Q,{icon:Oe,label:a(`agentsViewDetailsAction`),onClick:c}),(0,G.jsx)(Q,{icon:N,label:a(`agentsEditAction`),onClick:l,disabled:i}),t.builtIn?null:(0,G.jsx)(Q,{icon:oe,label:a(`agentsRemoveAction`),onClick:u,disabled:o,destructive:!0})]})]})]}),(0,G.jsx)(`p`,{className:`line-clamp-2 min-h-10 text-sm leading-5 text-muted-foreground`,children:t.description?.trim()||(t.builtIn?a(`agentsCardBuiltInSummary`):a(`agentsCardCustomSummary`))}),(0,G.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-border/60 pt-2 text-xs text-muted-foreground`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(w,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/60`}),(0,G.jsx)(`span`,{className:`truncate`,children:p})]}),(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(ae,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/60`}),(0,G.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function $e(){let e=z(),t=ie(),n=F(),r=M(),i=j(),o=B(),s=je(),c=_e(),[l,p]=(0,W.useState)(null),[h,g]=(0,W.useState)(null),_=(0,W.useMemo)(()=>t.data?.agents??[],[t.data?.agents]),v=(0,W.useMemo)(()=>[..._].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[_]),y=(0,W.useMemo)(()=>le({config:n.data,providersView:r.data,templatesView:i.data,onlyConfigured:!0}),[n.data,r.data,i.data]),b=(0,W.useMemo)(()=>Ee(o.data?.options??[]),[o.data?.options]),x=(0,W.useMemo)(()=>V(o.data?.defaultType??`native`),[o.data?.defaultType]),S=(0,W.useMemo)(()=>b.find(e=>e.value===x)?.label??L(x),[x,b]),ee=n.data?.agents.defaults,C=e=>{p(e)},w=e=>{g(e)},T=async(e,t)=>{let n;try{n=Ze(t)}catch(e){f.error(e instanceof Error?e.message:a(`agentsAdvancedParseFailed`));return}await s.mutateAsync({agentId:e,data:n}),g(null)},E=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,he(t,x))},D=()=>{e.chatSessionListManager.startAgentDraftChat(`main`,x,Ye)};return(0,G.jsxs)(m,{className:`space-y-6`,children:[(0,G.jsx)(u,{headingLevel:1,title:a(`agentsHeroEyebrow`),description:a(`agentsHeroDescription`),actions:(0,G.jsxs)(d,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:D,children:[(0,G.jsx)(A,{className:`mr-2 h-4 w-4`}),a(`agentsCreateButton`)]})}),(0,G.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:t.isLoading?(0,G.jsx)(U,{className:`md:col-span-2 xl:col-span-3 border-dashed border-border bg-card/70`,children:(0,G.jsx)(I,{className:`py-14 text-center text-sm text-muted-foreground`,children:a(`agentsLoading`)})}):v.length===0?(0,G.jsx)(U,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-border bg-gradient-subtle`,children:(0,G.jsxs)(I,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,G.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-card/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,G.jsx)(P,{className:`h-8 w-8 text-warning`})}),(0,G.jsx)(`div`,{className:`text-lg font-semibold text-foreground`,children:a(`agentsEmpty`)}),(0,G.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-muted-foreground`,children:a(`agentsEmptyDescription`)}),(0,G.jsxs)(d,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:D,children:[(0,G.jsx)(A,{className:`mr-2 h-4 w-4`}),a(`agentsCreateButton`)]})]})}):v.map(e=>(0,G.jsx)(Qe,{agent:e,runtimeOptions:b,defaultRuntimeLabel:S,updatePending:s.isPending,deletePending:c.isPending,onStartChat:()=>E(e),onView:()=>C(e),onEdit:()=>w(e),onDelete:()=>c.mutate({agentId:e.id})},e.id))}),(0,G.jsx)(Fe,{agent:l,defaults:ee,runtimeOptions:b,defaultRuntime:x,defaultRuntimeLabel:S,onOpenChange:e=>{e||p(null)},onEdit:e=>{p(null),g(e)}}),(0,G.jsx)(qe,{agent:h,pending:s.isPending,providerCatalog:y,runtimeOptions:b,defaultRuntime:x,onOpenChange:e=>{!e&&!s.isPending&&g(null)},onSubmit:T})]})}var $=`max-w-[min(1180px,100%)]`;function et(e){let{routeSessionKey:t,syncRouteSessionSelection:n}=e;(0,W.useLayoutEffect)(()=>{n(t)},[t,n])}function tt({view:e,confirmDialog:t}){let{isMobile:n}=ye();return(0,G.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,G.jsx)(Te,{}),e===`chat`?n?(0,G.jsx)(Ae,{}):(0,G.jsx)(Ce,{}):(0,G.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-background`,children:e===`inbox`?(0,G.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full flex-col py-4 sm:px-6 sm:py-5 ${$}`,children:(0,G.jsx)(Me,{})}):e===`panel-app`?(0,G.jsx)(De,{}):e===`cron`?(0,G.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,G.jsx)(`div`,{className:`mx-auto w-full px-4 py-4 sm:px-6 sm:py-5 ${$}`,children:(0,G.jsx)(xe,{})})}):e===`agents`?(0,G.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,G.jsx)(`div`,{className:`mx-auto w-full px-4 py-4 sm:px-6 sm:py-5 ${$}`,children:(0,G.jsx)($e,{})})}):(0,G.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,G.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full flex-col px-4 py-4 sm:px-6 sm:py-5 ${$}`,children:(0,G.jsx)(se,{forcedType:`skills`})})})}),t]})}function nt(e){let t=z(),n=F(),r=M(),i=j(),a=ge({limit:200}),o=B(),s=e.sessionKey?.trim()||`draft-session`,c=Ne({sessionId:s});(0,W.useEffect)(()=>{t.chatQueryManager.syncSnapshot({configQuery:n,providersQuery:r,providerTemplatesQuery:i,sessionsQuery:a,sessionTypesQuery:o,sessionSkillsSessionId:s,sessionSkillsQuery:c})},[n,t.chatQueryManager,r,s,c,a,o,i])}function rt(){let e=z();(0,W.useEffect)(()=>l.eventBus.on(n.uiShowContent,t=>{e.chatThreadManager.handleUiShowContentEvent(t)}),[e])}function it(){let{sessionId:e}=s(),t=(0,W.useMemo)(()=>me(e),[e]);return{routeSessionKey:t,sessionKey:t??void 0}}function at(){let e=z(),{confirm:t,ConfirmDialog:n}=g(),r=c(),i=o();return(0,W.useEffect)(()=>{e.chatUiManager.syncState({pathname:r.pathname}),e.chatUiManager.bindActions({navigate:i,confirm:t})},[t,r.pathname,i,e]),(0,G.jsx)(n,{})}function ot({view:e}){let t=H();return(0,G.jsx)(ve,{presenter:(0,W.useMemo)(()=>new Se(t),[t]),children:(0,G.jsx)(st,{view:e})})}function st({view:e}){let t=H(),n=z(),r=at(),{routeSessionKey:i,sessionKey:a}=it(),o=ke(e=>{let{snapshot:t}=e;return t.workspacePanelParentKey!==(a??null)||t.activeWorkspacePanelKind!==`child-session`?null:t.activeChildSessionKey?.trim()||null});return(0,W.useEffect)(()=>(t.chatCompletionNotificationManager.syncVisibleSessions([a,o]),()=>{t.chatCompletionNotificationManager.syncVisibleSessions([])}),[t.chatCompletionNotificationManager,a,o]),nt({sessionKey:a??null}),et({routeSessionKey:i,syncRouteSessionSelection:n.chatSessionListManager.syncRouteSessionSelection}),rt(),(0,G.jsx)(tt,{view:e,confirmDialog:r})}function ct({view:e}){return(0,G.jsx)(ot,{view:e})}export{ct as ChatPage};
@@ -0,0 +1 @@
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{B as t,H as n,L as r,a as i}from"./react-B7Paq2b3.js";import{n as a}from"./search-0OTHFRMx.js";var o=e(n(),1),s=t(),c=`min-w-0 overflow-hidden bg-card/70 text-card-foreground md:h-[calc(100vh-180px)] md:max-h-[860px]`,l=`min-h-0 overflow-hidden rounded-2xl bg-muted/30 ring-1 ring-border/45`,u=640;function d({className:e,children:t,compactView:n,onMobileBack:c,mobileListLabel:d,...f}){let p=(0,o.useRef)(null),[m,h]=(0,o.useState)(!1),[g,_,...v]=o.Children.toArray(t);(0,o.useEffect)(()=>{let e=p.current;if(!e||!n||typeof ResizeObserver>`u`)return;let t=()=>h(e.clientWidth>0&&e.clientWidth<u),r=new ResizeObserver(t);return r.observe(e),t(),()=>r.disconnect()},[n]);let y=!!(m&&n&&g&&_);return(0,s.jsx)(`div`,{ref:p,className:r(`min-h-0 md:flex-1`,e),...f,children:y?(0,s.jsxs)(`div`,{className:`space-y-3`,children:[n===`detail`?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(`button`,{type:`button`,onClick:c,className:`inline-flex items-center gap-2 rounded-lg px-2 py-1.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40`,children:[(0,s.jsx)(a,{className:`h-4 w-4`}),(0,s.jsx)(`span`,{children:d??i(`backToMain`)})]}),(0,s.jsx)(`div`,{className:l,children:_})]}):(0,s.jsx)(`div`,{className:l,children:g}),v]}):(0,s.jsx)(`div`,{className:r(l,`grid grid-cols-1 md:grid-cols-[minmax(240px,30%)_minmax(0,1fr)]`),children:t})})}function f({className:e,...t}){return(0,s.jsx)(`section`,{className:r(c,`flex flex-col md:border-r md:border-border/55`,e),...t})}function p({className:e,...t}){return(0,s.jsx)(`section`,{className:r(c,`flex flex-col`,e),...t})}function m({className:e,...t}){return(0,s.jsx)(`section`,{className:r(c,`flex items-center justify-center px-6 py-12 text-center`,e),...t})}function h({className:e,...t}){return(0,s.jsx)(`div`,{className:r(`shrink-0 border-b border-border/70`,e),...t})}function g({className:e,scrollOnDesktop:t=!0,...n}){return(0,s.jsx)(`div`,{className:r(`min-h-0 flex-1`,t&&`overflow-visible md:overflow-y-auto md:overscroll-contain`,e),...n})}function _({className:e,...t}){return(0,s.jsx)(`div`,{className:r(`shrink-0 border-t border-border/70 px-4 py-2.5`,e),...t})}function v({active:e=!1,className:t,type:n=`button`,...i}){return(0,s.jsx)(`button`,{type:n,className:r(`w-full rounded-xl p-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40`,e?`bg-background/95 text-foreground shadow-sm`:`bg-transparent text-muted-foreground hover:bg-background/65 hover:text-foreground`,t),...i})}function y({icon:e,title:t,description:n,className:i,...a}){return(0,s.jsxs)(`div`,{className:r(`flex min-h-[220px] flex-col items-center justify-center rounded-xl bg-background/55 px-4 py-10 text-center`,i),...a,children:[(0,s.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-card`,children:(0,s.jsx)(e,{className:`h-5 w-5 text-muted-foreground/45`})}),(0,s.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:t}),n?(0,s.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:n}):null]})}export{d as a,h as c,y as i,f as l,p as n,g as o,m as r,_ as s,v as t};
@@ -1,5 +1,5 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{I as t,V as n,i as r,z as i}from"./react-D-jOo51s.js";import{rn as a}from"./api-BSsQ0I4l.js";import{b as o,c as s,f as c,g as l,h as u,l as d,p as f,u as ee,v as te,x as p,y as ne}from"./dist-DyUY9uQ0.js";import{D as re,E as ie,O as ae,T as oe}from"./select-DToos7Rq.js";import{t as m}from"./dist-IBUY9_9h.js";import{t as se}from"./x-BkjTUiww.js";var h=e(n(),1),g=i(),_=`Dialog`,[v,ce]=ne(_),[le,y]=v(_),b=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=h.useRef(null),c=h.useRef(null),[d,f]=u({prop:r,defaultProp:i??!1,onChange:a,caller:_});return(0,g.jsx)(le,{scope:t,triggerRef:s,contentRef:c,contentId:l(),titleId:l(),descriptionId:l(),open:d,onOpenChange:f,onOpenToggle:h.useCallback(()=>f(e=>!e),[f]),modal:o,children:n})};b.displayName=_;var x=`DialogTrigger`,S=h.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=y(x,n),a=o(t,i.triggerRef);return(0,g.jsx)(c.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":L(i.open),...r,ref:a,onClick:p(e.onClick,i.onOpenToggle)})});S.displayName=x;var C=`DialogPortal`,[ue,w]=v(C,{forceMount:void 0}),T=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=y(C,t);return(0,g.jsx)(ue,{scope:t,forceMount:n,children:h.Children.map(r,e=>(0,g.jsx)(m,{present:n||a.open,children:(0,g.jsx)(d,{asChild:!0,container:i,children:e})}))})};T.displayName=C;var E=`DialogOverlay`,D=h.forwardRef((e,t)=>{let n=w(E,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=y(E,e.__scopeDialog);return a.modal?(0,g.jsx)(m,{present:r||a.open,children:(0,g.jsx)(fe,{...i,ref:t})}):null});D.displayName=E;var de=f(`DialogOverlay.RemoveScroll`),fe=h.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=y(E,n);return(0,g.jsx)(ie,{as:de,allowPinchZoom:!0,shards:[i.contentRef],children:(0,g.jsx)(c.div,{"data-state":L(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),O=`DialogContent`,k=h.forwardRef((e,t)=>{let n=w(O,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=y(O,e.__scopeDialog);return(0,g.jsx)(m,{present:r||a.open,children:a.modal?(0,g.jsx)(pe,{...i,ref:t}):(0,g.jsx)(me,{...i,ref:t})})});k.displayName=O;var pe=h.forwardRef((e,t)=>{let n=y(O,e.__scopeDialog),r=h.useRef(null),i=o(t,n.contentRef,r);return h.useEffect(()=>{let e=r.current;if(e)return oe(e)},[]),(0,g.jsx)(A,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:p(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:p(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:p(e.onFocusOutside,e=>e.preventDefault())})}),me=h.forwardRef((e,t)=>{let n=y(O,e.__scopeDialog),r=h.useRef(!1),i=h.useRef(!1);return(0,g.jsx)(A,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),A=h.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...s}=e,c=y(O,n),l=h.useRef(null),u=o(t,l);return re(),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(ae,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,g.jsx)(ee,{role:`dialog`,id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":L(c.open),...s,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(ge,{titleId:c.titleId}),(0,g.jsx)(ve,{contentRef:l,descriptionId:c.descriptionId})]})]})}),j=`DialogTitle`,M=h.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=y(j,n);return(0,g.jsx)(c.h2,{id:i.titleId,...r,ref:t})});M.displayName=j;var N=`DialogDescription`,P=h.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=y(N,n);return(0,g.jsx)(c.p,{id:i.descriptionId,...r,ref:t})});P.displayName=N;var F=`DialogClose`,I=h.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=y(F,n);return(0,g.jsx)(c.button,{type:`button`,...r,ref:t,onClick:p(e.onClick,()=>i.onOpenChange(!1))})});I.displayName=F;function L(e){return e?`open`:`closed`}var R=`DialogTitleWarning`,[he,z]=te(R,{contentName:O,titleName:j,docsSlug:`dialog`}),ge=({titleId:e})=>{let t=z(R),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{B as t,H as n,L as r,a as i}from"./react-B7Paq2b3.js";import{in as a}from"./api-Cyxp93Fn.js";import{b as o,c as s,f as c,g as l,h as u,l as d,p as f,u as ee,v as te,x as p,y as ne}from"./dist-HFDWY6-K.js";import{D as re,E as ie,O as ae,T as oe}from"./select-BZHvnwQB.js";import{t as m}from"./dist-CDPl8mm7.js";import{t as se}from"./x-CCjWN5ys.js";var h=e(n(),1),g=t(),_=`Dialog`,[v,ce]=ne(_),[le,y]=v(_),b=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=h.useRef(null),c=h.useRef(null),[d,f]=u({prop:r,defaultProp:i??!1,onChange:a,caller:_});return(0,g.jsx)(le,{scope:t,triggerRef:s,contentRef:c,contentId:l(),titleId:l(),descriptionId:l(),open:d,onOpenChange:f,onOpenToggle:h.useCallback(()=>f(e=>!e),[f]),modal:o,children:n})};b.displayName=_;var x=`DialogTrigger`,S=h.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=y(x,n),a=o(t,i.triggerRef);return(0,g.jsx)(c.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":L(i.open),...r,ref:a,onClick:p(e.onClick,i.onOpenToggle)})});S.displayName=x;var C=`DialogPortal`,[ue,w]=v(C,{forceMount:void 0}),T=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=y(C,t);return(0,g.jsx)(ue,{scope:t,forceMount:n,children:h.Children.map(r,e=>(0,g.jsx)(m,{present:n||a.open,children:(0,g.jsx)(d,{asChild:!0,container:i,children:e})}))})};T.displayName=C;var E=`DialogOverlay`,D=h.forwardRef((e,t)=>{let n=w(E,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=y(E,e.__scopeDialog);return a.modal?(0,g.jsx)(m,{present:r||a.open,children:(0,g.jsx)(fe,{...i,ref:t})}):null});D.displayName=E;var de=f(`DialogOverlay.RemoveScroll`),fe=h.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=y(E,n);return(0,g.jsx)(ie,{as:de,allowPinchZoom:!0,shards:[i.contentRef],children:(0,g.jsx)(c.div,{"data-state":L(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),O=`DialogContent`,k=h.forwardRef((e,t)=>{let n=w(O,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=y(O,e.__scopeDialog);return(0,g.jsx)(m,{present:r||a.open,children:a.modal?(0,g.jsx)(pe,{...i,ref:t}):(0,g.jsx)(me,{...i,ref:t})})});k.displayName=O;var pe=h.forwardRef((e,t)=>{let n=y(O,e.__scopeDialog),r=h.useRef(null),i=o(t,n.contentRef,r);return h.useEffect(()=>{let e=r.current;if(e)return oe(e)},[]),(0,g.jsx)(A,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:p(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:p(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:p(e.onFocusOutside,e=>e.preventDefault())})}),me=h.forwardRef((e,t)=>{let n=y(O,e.__scopeDialog),r=h.useRef(!1),i=h.useRef(!1);return(0,g.jsx)(A,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),A=h.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...s}=e,c=y(O,n),l=h.useRef(null),u=o(t,l);return re(),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(ae,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,g.jsx)(ee,{role:`dialog`,id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":L(c.open),...s,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(ge,{titleId:c.titleId}),(0,g.jsx)(ve,{contentRef:l,descriptionId:c.descriptionId})]})]})}),j=`DialogTitle`,M=h.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=y(j,n);return(0,g.jsx)(c.h2,{id:i.titleId,...r,ref:t})});M.displayName=j;var N=`DialogDescription`,P=h.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=y(N,n);return(0,g.jsx)(c.p,{id:i.descriptionId,...r,ref:t})});P.displayName=N;var F=`DialogClose`,I=h.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=y(F,n);return(0,g.jsx)(c.button,{type:`button`,...r,ref:t,onClick:p(e.onClick,()=>i.onOpenChange(!1))})});I.displayName=F;function L(e){return e?`open`:`closed`}var R=`DialogTitleWarning`,[he,z]=te(R,{contentName:O,titleName:j,docsSlug:`dialog`}),ge=({titleId:e})=>{let t=z(R),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
2
2
 
3
3
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
4
4
 
5
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return h.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},_e=`DialogDescriptionWarning`,ve=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${z(_e).contentName}}.`;return h.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},B=b,ye=S,V=T,H=D,U=k,W=M,G=P,K=I,be=s(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),xe=s(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),q=B,Se=V,J=h.forwardRef(({className:e,...n},r)=>(0,g.jsx)(H,{ref:r,className:t(`fixed inset-0 z-[var(--z-modal-backdrop,10000)] bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...n}));J.displayName=H.displayName;var Y=h.forwardRef(({className:e,children:n,...r},i)=>(0,g.jsxs)(Se,{children:[(0,g.jsx)(J,{}),(0,g.jsxs)(U,{ref:i,className:t(`fixed left-[50%] top-[50%] z-[var(--z-modal,10050)] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border border-border bg-popover p-6 text-popover-foreground shadow-xl duration-base data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]`,e),...r,children:[n,(0,g.jsxs)(K,{className:`absolute right-4 top-4 rounded-lg p-1 opacity-70 transition-all duration-fast hover:bg-[var(--interaction-hover)] hover:text-accent-foreground hover:opacity-100 focus:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:pointer-events-none`,children:[(0,g.jsx)(se,{className:`h-4 w-4 text-muted-foreground`}),(0,g.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Y.displayName=U.displayName;var X=({className:e,...n})=>(0,g.jsx)(`div`,{className:t(`flex flex-col space-y-2 text-center sm:text-left`,e),...n});X.displayName=`DialogHeader`;var Z=({className:e,...n})=>(0,g.jsx)(`div`,{className:t(`flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-3`,e),...n});Z.displayName=`DialogFooter`;var Q=h.forwardRef(({className:e,...n},r)=>(0,g.jsx)(W,{ref:r,className:t(`text-lg font-semibold leading-tight tracking-tight text-foreground`,e),...n}));Q.displayName=W.displayName;var $=h.forwardRef(({className:e,...n},r)=>(0,g.jsx)(G,{ref:r,className:t(`text-sm text-muted-foreground leading-relaxed`,e),...n}));$.displayName=G.displayName;var Ce=({open:e,onOpenChange:t,title:n,description:i,confirmLabel:o=r(`confirm`),cancelLabel:s=r(`cancel`),variant:c=`default`,onConfirm:l,onCancel:u})=>(0,g.jsx)(q,{open:e,onOpenChange:t,children:(0,g.jsxs)(Y,{className:`[&>:last-child]:hidden`,onCloseAutoFocus:e=>e.preventDefault(),children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Q,{children:n}),i?(0,g.jsx)($,{children:i}):null]}),(0,g.jsxs)(Z,{className:`gap-2 sm:gap-0`,children:[(0,g.jsx)(a,{type:`button`,variant:`outline`,onClick:()=>{u(),t(!1)},children:s}),(0,g.jsx)(a,{type:`button`,variant:c===`destructive`?`destructive`:`default`,onClick:()=>{l(),t(!1)},children:o})]})]})});export{ye as _,Z as a,xe as c,U as d,G as f,W as g,B as h,$ as i,be as l,V as m,q as n,X as o,H as p,Y as r,Q as s,Ce as t,K as u};
5
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return h.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},_e=`DialogDescriptionWarning`,ve=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${z(_e).contentName}}.`;return h.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},B=b,ye=S,V=T,H=D,U=k,W=M,G=P,K=I,be=s(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),xe=s(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),q=B,Se=V,J=h.forwardRef(({className:e,...t},n)=>(0,g.jsx)(H,{ref:n,className:r(`fixed inset-0 z-[var(--z-modal-backdrop,10000)] bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));J.displayName=H.displayName;var Y=h.forwardRef(({className:e,children:t,...n},i)=>(0,g.jsxs)(Se,{children:[(0,g.jsx)(J,{}),(0,g.jsxs)(U,{ref:i,className:r(`fixed left-[50%] top-[50%] z-[var(--z-modal,10050)] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl border border-border bg-popover p-6 text-popover-foreground shadow-xl duration-base data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]`,e),...n,children:[t,(0,g.jsxs)(K,{className:`absolute right-4 top-4 rounded-lg p-1 opacity-70 transition-all duration-fast hover:bg-[var(--interaction-hover)] hover:text-accent-foreground hover:opacity-100 focus:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:pointer-events-none`,children:[(0,g.jsx)(se,{className:`h-4 w-4 text-muted-foreground`}),(0,g.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Y.displayName=U.displayName;var X=({className:e,...t})=>(0,g.jsx)(`div`,{className:r(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});X.displayName=`DialogHeader`;var Z=({className:e,...t})=>(0,g.jsx)(`div`,{className:r(`flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-3`,e),...t});Z.displayName=`DialogFooter`;var Q=h.forwardRef(({className:e,...t},n)=>(0,g.jsx)(W,{ref:n,className:r(`text-lg font-semibold leading-tight tracking-tight text-foreground`,e),...t}));Q.displayName=W.displayName;var $=h.forwardRef(({className:e,...t},n)=>(0,g.jsx)(G,{ref:n,className:r(`text-sm text-muted-foreground leading-relaxed`,e),...t}));$.displayName=G.displayName;var Ce=({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o=i(`confirm`),cancelLabel:s=i(`cancel`),variant:c=`default`,onConfirm:l,onCancel:u})=>(0,g.jsx)(q,{open:e,onOpenChange:t,children:(0,g.jsxs)(Y,{className:`[&>:last-child]:hidden`,onCloseAutoFocus:e=>e.preventDefault(),children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Q,{children:n}),r?(0,g.jsx)($,{children:r}):null]}),(0,g.jsxs)(Z,{className:`gap-2 sm:gap-0`,children:[(0,g.jsx)(a,{type:`button`,variant:`outline`,onClick:()=>{u(),t(!1)},children:s}),(0,g.jsx)(a,{type:`button`,variant:c===`destructive`?`destructive`:`default`,onClick:()=>{l(),t(!1)},children:o})]})]})});export{ye as _,Z as a,xe as c,U as d,G as f,W as g,B as h,$ as i,be as l,V as m,q as n,X as o,H as p,Y as r,Q as s,Ce as t,K as u};
@@ -0,0 +1 @@
1
+ import{B as e,L as t,a as n,r,s as i}from"./react-B7Paq2b3.js";import{t as a}from"./navigation-link-CDMYpkVv.js";import{$t as o,Bt as s,It as c,Lt as l,Qt as u,Rt as d,Vt as f,Xt as p,Zt as m,dn as h,in as g}from"./api-Cyxp93Fn.js";import{a as _,i as v,n as y,r as b,t as x}from"./select-BZHvnwQB.js";import{t as S}from"./refresh-cw-XrnNVwuQ.js";import{t as C}from"./rotate-cw-BhIWpLaU.js";import{Ct as w,St as T,bt as E,xt as D,yt as O}from"./index-j6DBnvlr.js";var k=e(),A={checking:`desktopUpdatesStatusChecking`,"update-available":`desktopUpdatesStatusAvailable`,downloading:`desktopUpdatesStatusDownloading`,downloaded:`desktopUpdatesStatusDownloaded`,applying:`desktopUpdatesStatusApplying`,"restart-required":`desktopUpdatesStatusRestartRequired`,"up-to-date":`desktopUpdatesStatusUpToDate`,blocked:`desktopUpdatesStatusBlocked`,failed:`desktopUpdatesStatusFailed`},j={feature:`desktopUpdatesReleaseNotesFeature`,enhancement:`desktopUpdatesReleaseNotesEnhancement`,fix:`desktopUpdatesReleaseNotesFix`,compatibility:`desktopUpdatesReleaseNotesCompatibility`};function M({snapshot:e}){return(0,k.jsx)(`span`,{className:t(`inline-flex rounded-full px-3 py-1 text-xs font-medium ring-1`,V(e.status)),children:B(e)})}function N({label:e,value:t}){return(0,k.jsxs)(`div`,{className:`rounded-lg bg-background/70 p-3`,children:[(0,k.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-[0.08em] text-muted-foreground`,children:e}),(0,k.jsx)(`p`,{className:`mt-1 text-sm font-semibold text-foreground`,children:t})]})}function P({snapshot:e}){if(e.status!==`downloading`)return null;let t=e.progress?.percent,r=t==null?n(`desktopUpdatesDownloadProgressUnknown`):n(`desktopUpdatesDownloadProgressPercent`).replace(`{percent}`,String(t)),i=L(e.progress?.downloadedBytes??0,e.progress?.totalBytes??null);return(0,k.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,k.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:r}),(0,k.jsx)(`p`,{className:`text-xs font-medium text-amber-700`,children:i})]}),(0,k.jsx)(`div`,{className:`mt-3 h-2 overflow-hidden rounded-full bg-amber-100`,children:(0,k.jsx)(`div`,{className:`h-full rounded-full bg-amber-500 transition-[width]`,style:{width:`${t??0}%`}})})]})}function F(e){return e?.trim()||`-`}function I(e){return e?r(e):`-`}function L(e,t){let n=R(e);return t&&t>0?`${n} / ${R(t)}`:n}function R(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10||r===0?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function z(e){return n(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}function B(e){return e.status===`failed`&&e.failureStage?n(`desktopUpdatesFailureStage.${e.failureStage}`):n(A[e.status]??`desktopUpdatesStatusIdle`)}function V(e){return e===`downloaded`||e===`restart-required`?`bg-emerald-50 text-emerald-700 ring-emerald-100`:e===`update-available`||e===`downloading`||e===`checking`?`bg-amber-50 text-amber-700 ring-amber-100`:e===`failed`||e===`blocked`?`bg-red-50 text-red-700 ring-red-100`:`bg-gray-100 text-gray-700 ring-gray-200`}function H(){return i()===`zh`?`zh-CN`:`en-US`}function U(e,t){return l(e.title,t)??n(j[e.kind]??`desktopUpdatesReleaseNotesEnhancement`)}function W({snapshot:e}){let t=d(e),r=H(),i=h({queryKey:[`runtime-release-notes`,t],queryFn:async()=>await c(t??``),enabled:!!t,retry:!1,staleTime:300*1e3}),o=i.data,s=l(o?.title,r)??n(`desktopUpdatesReleaseNotesPreviewTitle`),u=l(o?.summary,r)??n(`desktopUpdatesReleaseNotesPreviewDescription`);return e.releaseNotesUrl?(0,k.jsxs)(O,{children:[(0,k.jsx)(T,{children:(0,k.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,k.jsxs)(`div`,{className:`space-y-1`,children:[(0,k.jsx)(w,{children:s}),(0,k.jsx)(D,{children:u})]}),(0,k.jsx)(a,{href:e.releaseNotesUrl,external:!0,children:n(`desktopUpdatesReleaseNotes`)})]})}),(0,k.jsxs)(E,{className:`space-y-4`,children:[i.isLoading?(0,k.jsx)(`p`,{className:`text-sm text-gray-500`,children:n(`desktopUpdatesReleaseNotesPreviewLoading`)}):null,!t||i.isError?(0,k.jsx)(`p`,{className:`text-sm text-gray-500`,children:n(`desktopUpdatesReleaseNotesPreviewUnavailable`)}):null,o?(0,k.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:o.sections.map(e=>(0,k.jsxs)(`div`,{className:`rounded-xl border border-gray-200 bg-gray-50/60 p-4`,children:[(0,k.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:U(e,r)}),(0,k.jsx)(`ul`,{className:`mt-3 space-y-3`,children:e.items.map((t,n)=>{let i=l(t.title,r),a=l(t.body,r);return(0,k.jsxs)(`li`,{className:`space-y-1`,children:[i?(0,k.jsx)(`p`,{className:`text-sm font-medium text-gray-800`,children:i}):null,a?(0,k.jsx)(`p`,{className:`text-sm leading-5 text-gray-600`,children:a}):null]},`${i??e.kind}-${n}`)})})]},e.kind))}):null]})]}):null}function G(){return(0,k.jsx)(o,{title:n(`runtimeUpdatesPageTitle`),description:n(`runtimeUpdatesPageDescription`),children:(0,k.jsx)(u,{title:n(`runtimeUpdatesUnavailableTitle`),description:n(`runtimeUpdatesUnavailableDescription`),children:(0,k.jsx)(m,{children:(0,k.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:n(`runtimeUpdatesUnavailableHint`)})})})})}function K(){let{supported:e,initialized:r,busyAction:i,snapshot:a}=f();if(!r)return(0,k.jsx)(o,{title:n(`runtimeUpdatesPageTitle`),description:n(`runtimeUpdatesPageDescription`),children:(0,k.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:n(`loading`)})});if(!e||!a)return(0,k.jsx)(G,{});let c=i===`checking`,l=i===`downloading`,d=i===`applying`,h=i===`updating`,w=i===`switching-channel`,T=(a.status===`update-available`||a.status===`downloaded`)&&!l&&!d&&!h,E=[[n(`runtimeUpdatesHostVersion`),F(a.hostVersion)],[n(`desktopUpdatesCurrentBundleVersion`),F(a.currentVersion)],[n(`desktopUpdatesAvailableVersion`),F(a.availableVersion)],[n(`desktopUpdatesLastCheckedAt`),I(a.lastCheckedAt)],[n(`desktopUpdatesCurrentChannel`),z(a.channel)]];return(0,k.jsxs)(o,{title:n(`runtimeUpdatesPageTitle`),description:n(`runtimeUpdatesPageDescription`),actions:(0,k.jsxs)(g,{variant:`outline`,onClick:()=>void s.checkForUpdates(),disabled:c||l||d||h,children:[(0,k.jsx)(S,{className:t(`mr-2 h-4 w-4`,c&&`animate-spin`)}),n(`desktopUpdatesCheckNow`)]}),children:[(0,k.jsx)(u,{title:n(`desktopUpdatesOverviewTitle`),description:n(`desktopUpdatesOverviewDescription`),children:(0,k.jsx)(m,{children:(0,k.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:n(`desktopUpdatesStatusLabel`)}),(0,k.jsx)(M,{snapshot:a})]}),(0,k.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-5`,children:E.map(([e,t])=>(0,k.jsx)(N,{label:e,value:t},e))}),a.channel===`beta`?(0,k.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,k.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:n(`desktopUpdatesBetaBadgeTitle`)}),(0,k.jsx)(`p`,{className:`mt-1 text-sm text-amber-700`,children:n(`desktopUpdatesBetaBadgeDescription`)})]}):null,a.downloadedVersion?(0,k.jsxs)(`div`,{className:`rounded-2xl border border-emerald-200 bg-emerald-50/70 p-4`,children:[(0,k.jsx)(`p`,{className:`text-sm font-semibold text-emerald-800`,children:n(`desktopUpdatesDownloadedBannerTitle`)}),(0,k.jsx)(`p`,{className:`mt-1 text-sm text-emerald-700`,children:n(`runtimeUpdatesDownloadedBannerDescription`).replace(`{version}`,a.downloadedVersion)})]}):null,(0,k.jsx)(P,{snapshot:a}),a.status===`blocked`?(0,k.jsxs)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4`,children:[(0,k.jsx)(`p`,{className:`text-sm font-semibold text-red-800`,children:n(`desktopUpdatesBlockedTitle`)}),(0,k.jsx)(`p`,{className:`mt-1 text-sm text-red-700`,children:a.errorMessage??n(`desktopUpdatesBlockedDescription`)}),a.recoveryCommand?(0,k.jsx)(`code`,{className:`mt-3 block rounded-lg bg-white/70 px-3 py-2 text-xs text-red-800`,children:a.recoveryCommand}):null]}):null,a.errorMessage&&a.status!==`blocked`?(0,k.jsx)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4 text-sm text-red-700`,children:a.errorMessage}):null]})})}),(0,k.jsx)(W,{snapshot:a}),(0,k.jsx)(u,{title:n(`desktopUpdatesChannelSettingsTitle`),description:n(`desktopUpdatesChannelSettingsDescription`),children:(0,k.jsx)(m,{children:(0,k.jsx)(p,{title:n(`desktopUpdatesReleaseChannel`),description:n(`desktopUpdatesReleaseChannelHelp`),layout:`stacked`,children:(0,k.jsxs)(`div`,{className:`space-y-2`,children:[(0,k.jsxs)(x,{value:a.channel,disabled:w||c||l||d||h,onValueChange:e=>void s.updateChannel(e),children:[(0,k.jsx)(v,{className:`w-full max-w-sm`,children:(0,k.jsx)(_,{placeholder:n(`desktopUpdatesReleaseChannel`)})}),(0,k.jsxs)(y,{children:[(0,k.jsx)(b,{value:`stable`,children:n(`desktopUpdatesChannelStable`)}),(0,k.jsx)(b,{value:`beta`,children:n(`desktopUpdatesChannelBeta`)})]})]}),(0,k.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`desktopUpdatesReleaseChannelDowngradeHint`)})]})})})}),(0,k.jsx)(u,{title:n(`desktopUpdatesActionsTitle`),description:n(`runtimeUpdatesActionsDescription`),children:(0,k.jsx)(m,{children:(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 p-4`,children:[(0,k.jsxs)(g,{variant:`outline`,onClick:()=>void s.checkForUpdates(),disabled:c||l||d||h,children:[(0,k.jsx)(S,{className:t(`mr-2 h-4 w-4`,c&&`animate-spin`)}),n(`desktopUpdatesCheckNow`)]}),(0,k.jsxs)(g,{onClick:()=>void s.updateNow(),disabled:!T,children:[(0,k.jsx)(C,{className:t(`mr-2 h-4 w-4`,h&&`animate-spin`)}),n(`runtimeUpdatesApplyNow`)]})]})})})]})}export{K as DesktopUpdateConfig};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{V as t}from"./react-D-jOo51s.js";import{_ as n,b as r}from"./dist-DyUY9uQ0.js";var i=e(t(),1);function a(e,t){return i.useReducer((e,n)=>t[e][n]??e,e)}var o=e=>{let{present:t,children:n}=e,a=s(t),o=typeof n==`function`?n({present:a.isPresent}):i.Children.only(n),c=r(a.ref,l(o));return typeof n==`function`||a.isPresent?i.cloneElement(o,{ref:c}):null};o.displayName=`Presence`;function s(e){let[t,r]=i.useState(),o=i.useRef(null),s=i.useRef(e),l=i.useRef(`none`),[u,d]=a(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return i.useEffect(()=>{let e=c(o.current);l.current=u===`mounted`?e:`none`},[u]),n(()=>{let t=o.current,n=s.current;if(n!==e){let r=l.current,i=c(t);e?d(`MOUNT`):i===`none`||t?.display===`none`?d(`UNMOUNT`):d(n&&r!==i?`ANIMATION_OUT`:`UNMOUNT`),s.current=e}},[e,d]),n(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,r=r=>{let i=c(o.current).includes(CSS.escape(r.animationName));if(r.target===t&&i&&(d(`ANIMATION_END`),!s.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},i=e=>{e.target===t&&(l.current=c(o.current))};return t.addEventListener(`animationstart`,i),t.addEventListener(`animationcancel`,r),t.addEventListener(`animationend`,r),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,i),t.removeEventListener(`animationcancel`,r),t.removeEventListener(`animationend`,r)}}else d(`ANIMATION_END`)},[t,d]),{isPresent:[`mounted`,`unmountSuspended`].includes(u),ref:i.useCallback(e=>{o.current=e?getComputedStyle(e):null,r(e)},[])}}function c(e){return e?.animationName||`none`}function l(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)}export{o as t};
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{H as t}from"./react-B7Paq2b3.js";import{_ as n,b as r}from"./dist-HFDWY6-K.js";var i=e(t(),1);function a(e,t){return i.useReducer((e,n)=>t[e][n]??e,e)}var o=e=>{let{present:t,children:n}=e,a=s(t),o=typeof n==`function`?n({present:a.isPresent}):i.Children.only(n),c=r(a.ref,l(o));return typeof n==`function`||a.isPresent?i.cloneElement(o,{ref:c}):null};o.displayName=`Presence`;function s(e){let[t,r]=i.useState(),o=i.useRef(null),s=i.useRef(e),l=i.useRef(`none`),[u,d]=a(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return i.useEffect(()=>{let e=c(o.current);l.current=u===`mounted`?e:`none`},[u]),n(()=>{let t=o.current,n=s.current;if(n!==e){let r=l.current,i=c(t);e?d(`MOUNT`):i===`none`||t?.display===`none`?d(`UNMOUNT`):d(n&&r!==i?`ANIMATION_OUT`:`UNMOUNT`),s.current=e}},[e,d]),n(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,r=r=>{let i=c(o.current).includes(CSS.escape(r.animationName));if(r.target===t&&i&&(d(`ANIMATION_END`),!s.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},i=e=>{e.target===t&&(l.current=c(o.current))};return t.addEventListener(`animationstart`,i),t.addEventListener(`animationcancel`,r),t.addEventListener(`animationend`,r),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,i),t.removeEventListener(`animationcancel`,r),t.removeEventListener(`animationend`,r)}}else d(`ANIMATION_END`)},[t,d]),{isPresent:[`mounted`,`unmountSuspended`].includes(u),ref:i.useCallback(e=>{o.current=e?getComputedStyle(e):null,r(e)},[])}}function c(e){return e?.animationName||`none`}function l(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)}export{o as t};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{B as t,V as n,z as r}from"./react-D-jOo51s.js";typeof window<`u`&&window.document&&window.document.createElement;function i(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var a=e(n(),1);function o(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function s(...e){return t=>{let n=!1,r=e.map(e=>{let r=o(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():o(e[t],null)}}}}function c(...e){return a.useCallback(s(...e),e)}var l=r();function u(e,t){let n=a.createContext(t),r=e=>{let{children:t,...r}=e,i=a.useMemo(()=>r,Object.values(r));return(0,l.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=a.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function d(e,t=[]){let n=[];function r(t,r){let i=a.createContext(r),o=n.length;n=[...n,r];let s=t=>{let{scope:n,children:r,...s}=t,c=n?.[e]?.[o]||i,u=a.useMemo(()=>s,Object.values(s));return(0,l.jsx)(c.Provider,{value:u,children:r})};s.displayName=t+`Provider`;function c(n,s){let c=s?.[e]?.[o]||i,l=a.useContext(c);if(l)return l;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[s,c]}let i=()=>{let t=n.map(e=>a.createContext(e));return function(n){let r=n?.[e]||t;return a.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,f(i,...t)]}function f(...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 a.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var p=globalThis?.document?a.useLayoutEffect:()=>{},m=a.useId||(()=>void 0),h=0;function g(e){let[t,n]=a.useState(m());return p(()=>{e||n(e=>e??String(h++))},[e]),e||(t?`radix-${t}`:``)}var _=a.useInsertionEffect||p;function v({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,o,s]=y({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:i;{let t=a.useRef(e!==void 0);a.useEffect(()=>{let e=t.current;e!==c&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${c?`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=c},[c,r])}return[l,a.useCallback(t=>{if(c){let n=b(t)?t(e):t;n!==e&&s.current?.(n)}else o(t)},[c,e,o,s])]}function y({defaultProp:e,onChange:t}){let[n,r]=a.useState(e),i=a.useRef(n),o=a.useRef(t);return _(()=>{o.current=t},[t]),a.useEffect(()=>{i.current!==n&&(o.current?.(n),i.current=n)},[n,i]),[n,r,o]}function b(e){return typeof e==`function`}function x(e){let t=S(e),n=a.forwardRef((e,n)=>{let{children:r,...i}=e,o=a.Children.toArray(r),s=o.find(T);if(s){let e=s.props.children,r=o.map(t=>t===s?a.Children.count(e)>1?a.Children.only(null):a.isValidElement(e)?e.props.children:null:t);return(0,l.jsx)(t,{...i,ref:n,children:a.isValidElement(e)?a.cloneElement(e,void 0,r):null})}return(0,l.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function S(e){let t=a.forwardRef((e,t)=>{let{children:n,...r}=e;if(a.isValidElement(n)){let e=D(n),i=E(r,n.props);return n.type!==a.Fragment&&(i.ref=t?s(t,e):e),a.cloneElement(n,i)}return a.Children.count(n)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var C=Symbol(`radix.slottable`);function w(e){let t=({children:e})=>(0,l.jsx)(l.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=C,t}function T(e){return a.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===C}function E(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 D(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 O=e(t(),1),k=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=x(`Primitive.${t}`),r=a.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,l.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function A(e,t){e&&O.flushSync(()=>e.dispatchEvent(t))}function j(e){let t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>(...e)=>t.current?.(...e),[])}function M(e,t=globalThis?.document){let n=j(e);a.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var N=`DismissableLayer`,P=`dismissableLayer.update`,F=`dismissableLayer.pointerDownOutside`,ee=`dismissableLayer.focusOutside`,te,ne=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),I=a.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:u,onDismiss:d,...f}=e,p=a.useContext(ne),[m,h]=a.useState(null),g=m?.ownerDocument??globalThis?.document,[,_]=a.useState({}),v=c(t,e=>h(e)),y=Array.from(p.layers),[b]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),x=y.indexOf(b),S=m?y.indexOf(m):-1,C=p.layersWithOutsidePointerEventsDisabled.size>0,w=S>=x,T=ie(e=>{let t=e.target,n=[...p.branches].some(e=>e.contains(t));!w||n||(o?.(e),u?.(e),e.defaultPrevented||d?.())},g),E=ae(e=>{let t=e.target;[...p.branches].some(e=>e.contains(t))||(s?.(e),u?.(e),e.defaultPrevented||d?.())},g);return M(e=>{S===p.layers.size-1&&(r?.(e),!e.defaultPrevented&&d&&(e.preventDefault(),d()))},g),a.useEffect(()=>{if(m)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(te=g.body.style.pointerEvents,g.body.style.pointerEvents=`none`),p.layersWithOutsidePointerEventsDisabled.add(m)),p.layers.add(m),oe(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=te)}},[m,g,n,p]),a.useEffect(()=>()=>{m&&(p.layers.delete(m),p.layersWithOutsidePointerEventsDisabled.delete(m),oe())},[m,p]),a.useEffect(()=>{let e=()=>_({});return document.addEventListener(P,e),()=>document.removeEventListener(P,e)},[]),(0,l.jsx)(k.div,{...f,ref:v,style:{pointerEvents:C?w?`auto`:`none`:void 0,...e.style},onFocusCapture:i(e.onFocusCapture,E.onFocusCapture),onBlurCapture:i(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:i(e.onPointerDownCapture,T.onPointerDownCapture)})});I.displayName=N;var L=`DismissableLayerBranch`,re=a.forwardRef((e,t)=>{let n=a.useContext(ne),r=a.useRef(null),i=c(t,r);return a.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,l.jsx)(k.div,{...e,ref:i})});re.displayName=L;function ie(e,t=globalThis?.document){let n=j(e),r=a.useRef(!1),i=a.useRef(()=>{});return a.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){se(F,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function ae(e,t=globalThis?.document){let n=j(e),r=a.useRef(!1);return a.useEffect(()=>{let e=e=>{e.target&&!r.current&&se(ee,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function oe(){let e=new CustomEvent(P);document.dispatchEvent(e)}function se(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?A(i,a):i.dispatchEvent(a)}var ce=`Portal`,le=a.forwardRef((e,t)=>{let{container:n,...r}=e,[i,o]=a.useState(!1);p(()=>o(!0),[]);let s=n||i&&globalThis?.document?.body;return s?O.createPortal((0,l.jsx)(k.div,{...r,ref:t}),s):null});le.displayName=ce;var ue=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),de=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),fe={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},pe=(0,a.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:o,iconNode:s,...c},l)=>(0,a.createElement)(`svg`,{ref:l,...fe,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:de(`lucide`,i),...c},[...s.map(([e,t])=>(0,a.createElement)(e,t)),...Array.isArray(o)?o:[o]])),me=(e,t)=>{let n=(0,a.forwardRef)(({className:n,...r},i)=>(0,a.createElement)(pe,{ref:i,iconNode:t,className:de(`lucide-${ue(e)}`,n),...r}));return n.displayName=`${e}`,n},he=[`top`,`right`,`bottom`,`left`],R=Math.min,z=Math.max,ge=Math.round,_e=Math.floor,B=e=>({x:e,y:e}),ve={left:`right`,right:`left`,bottom:`top`,top:`bottom`},ye={start:`end`,end:`start`};function be(e,t,n){return z(e,R(t,n))}function V(e,t){return typeof e==`function`?e(t):e}function H(e){return e.split(`-`)[0]}function U(e){return e.split(`-`)[1]}function xe(e){return e===`x`?`y`:`x`}function Se(e){return e===`y`?`height`:`width`}var Ce=new Set([`top`,`bottom`]);function W(e){return Ce.has(H(e))?`y`:`x`}function we(e){return xe(W(e))}function Te(e,t,n){n===void 0&&(n=!1);let r=U(e),i=we(e),a=Se(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Pe(o)),[o,Pe(o)]}function Ee(e){let t=Pe(e);return[De(e),t,De(t)]}function De(e){return e.replace(/start|end/g,e=>ye[e])}var Oe=[`left`,`right`],ke=[`right`,`left`],Ae=[`top`,`bottom`],je=[`bottom`,`top`];function Me(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ke:Oe:t?Oe:ke;case`left`:case`right`:return t?Ae:je;default:return[]}}function Ne(e,t,n,r){let i=U(e),a=Me(H(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(De)))),a}function Pe(e){return e.replace(/left|right|bottom|top/g,e=>ve[e])}function Fe(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ie(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Fe(e)}function Le(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Re(e,t,n){let{reference:r,floating:i}=e,a=W(t),o=we(t),s=Se(o),c=H(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(U(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function ze(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=V(t,e),p=Ie(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Le(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Le(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Be=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Re(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:{...o,detectOverflow:o.detectOverflow??ze},elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=Re(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},Ve=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=V(e,t)||{};if(l==null)return{};let d=Ie(u),f={x:n,y:r},p=we(i),m=Se(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=R(d[_],T),D=R(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=be(O,A,k),M=!c.arrow&&U(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),He=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=V(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=H(r),_=W(o),v=H(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Pe(o)]:Ee(o)),x=p!==`none`;!d&&x&&b.push(...Ne(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Te(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==W(t))||T.every(e=>W(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=W(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ue(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function We(e){return he.some(t=>e[t]>=0)}var Ge=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=V(e,t);switch(i){case`referenceHidden`:{let e=Ue(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:We(e)}}}case`escaped`:{let e=Ue(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:We(e)}}}default:return{}}}}},Ke=new Set([`left`,`top`]);async function qe(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=H(n),s=U(n),c=W(n)===`y`,l=Ke.has(o)?-1:1,u=a&&c?-1:1,d=V(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Je=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await qe(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ye=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=V(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=W(H(i)),p=xe(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=be(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=be(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Xe=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=V(e,t),u={x:n,y:r},d=W(i),f=xe(d),p=u[f],m=u[d],h=V(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ke.has(H(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Ze=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=V(e,t),u=await o.detectOverflow(t,l),d=H(i),f=U(i),p=W(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=R(h-u[g],v),x=R(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=z(u.left,0),t=z(u.right,0),n=z(u.top,0),r=z(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:z(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:z(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Qe(){return typeof window<`u`}function G(e){return $e(e)?(e.nodeName||``).toLowerCase():`#document`}function K(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function q(e){return(($e(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function $e(e){return Qe()?e instanceof Node||e instanceof K(e).Node:!1}function J(e){return Qe()?e instanceof Element||e instanceof K(e).Element:!1}function Y(e){return Qe()?e instanceof HTMLElement||e instanceof K(e).HTMLElement:!1}function et(e){return!Qe()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof K(e).ShadowRoot}var tt=new Set([`inline`,`contents`]);function nt(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Z(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!tt.has(i)}var rt=new Set([`table`,`td`,`th`]);function it(e){return rt.has(G(e))}var at=[`:popover-open`,`:modal`];function ot(e){return at.some(t=>{try{return e.matches(t)}catch{return!1}})}var st=[`transform`,`translate`,`scale`,`rotate`,`perspective`],ct=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],lt=[`paint`,`layout`,`strict`,`content`];function ut(e){let t=ft(),n=J(e)?Z(e):e;return st.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||ct.some(e=>(n.willChange||``).includes(e))||lt.some(e=>(n.contain||``).includes(e))}function dt(e){let t=Q(e);for(;Y(t)&&!X(t);){if(ut(t))return t;if(ot(t))return null;t=Q(t)}return null}function ft(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var pt=new Set([`html`,`body`,`#document`]);function X(e){return pt.has(G(e))}function Z(e){return K(e).getComputedStyle(e)}function mt(e){return J(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Q(e){if(G(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||et(e)&&e.host||q(e);return et(t)?t.host:t}function ht(e){let t=Q(e);return X(t)?e.ownerDocument?e.ownerDocument.body:e.body:Y(t)&&nt(t)?t:ht(t)}function gt(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=ht(e),i=r===e.ownerDocument?.body,a=K(r);if(i){let e=_t(a);return t.concat(a,a.visualViewport||[],nt(r)?r:[],e&&n?gt(e):[])}return t.concat(r,gt(r,[],n))}function _t(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vt(e){let t=Z(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Y(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ge(n)!==a||ge(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function yt(e){return J(e)?e:e.contextElement}function bt(e){let t=yt(e);if(!Y(t))return B(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=vt(t),o=(a?ge(n.width):n.width)/r,s=(a?ge(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var xt=B(0);function St(e){let t=K(e);return!ft()||!t.visualViewport?xt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ct(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==K(e)?!1:t}function $(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=yt(e),o=B(1);t&&(r?J(r)&&(o=bt(r)):o=bt(e));let s=Ct(a,n,r)?St(a):B(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=K(a),t=r&&J(r)?K(r):r,n=e,i=_t(n);for(;i&&r&&t!==n;){let e=bt(i),t=i.getBoundingClientRect(),r=Z(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=K(i),i=_t(n)}}return Le({width:u,height:d,x:c,y:l})}function wt(e,t){let n=mt(e).scrollLeft;return t?t.left+n:$(q(e)).left+n}function Tt(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-wt(e,n),y:n.top+t.scrollTop}}function Et(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=q(r),s=t?ot(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=B(1),u=B(0),d=Y(r);if((d||!d&&!a)&&((G(r)!==`body`||nt(o))&&(c=mt(r)),Y(r))){let e=$(r);l=bt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Tt(o,c):B(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Dt(e){return Array.from(e.getClientRects())}function Ot(e){let t=q(e),n=mt(e),r=e.ownerDocument.body,i=z(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=z(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+wt(e),s=-n.scrollTop;return Z(r).direction===`rtl`&&(o+=z(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var kt=25;function At(e,t){let n=K(e),r=q(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=ft();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=wt(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=kt&&(a-=o)}else l<=kt&&(a+=l);return{width:a,height:o,x:s,y:c}}var jt=new Set([`absolute`,`fixed`]);function Mt(e,t){let n=$(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Y(e)?bt(e):B(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Nt(e,t,n){let r;if(t===`viewport`)r=At(e,n);else if(t===`document`)r=Ot(q(e));else if(J(t))r=Mt(t,n);else{let n=St(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Le(r)}function Pt(e,t){let n=Q(e);return n===t||!J(n)||X(n)?!1:Z(n).position===`fixed`||Pt(n,t)}function Ft(e,t){let n=t.get(e);if(n)return n;let r=gt(e,[],!1).filter(e=>J(e)&&G(e)!==`body`),i=null,a=Z(e).position===`fixed`,o=a?Q(e):e;for(;J(o)&&!X(o);){let t=Z(o),n=ut(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&jt.has(i.position)||nt(o)&&!n&&Pt(e,o))?r=r.filter(e=>e!==o):i=t,o=Q(o)}return t.set(e,r),r}function It(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ot(t)?[]:Ft(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Nt(t,n,i);return e.top=z(r.top,e.top),e.right=R(r.right,e.right),e.bottom=R(r.bottom,e.bottom),e.left=z(r.left,e.left),e},Nt(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function Lt(e){let{width:t,height:n}=vt(e);return{width:t,height:n}}function Rt(e,t,n){let r=Y(t),i=q(t),a=n===`fixed`,o=$(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=B(0);function l(){c.x=wt(i)}if(r||!r&&!a)if((G(t)!==`body`||nt(i))&&(s=mt(t)),r){let e=$(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Tt(i,s):B(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function zt(e){return Z(e).position===`static`}function Bt(e,t){if(!Y(e)||Z(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return q(e)===n&&(n=n.ownerDocument.body),n}function Vt(e,t){let n=K(e);if(ot(e))return n;if(!Y(e)){let t=Q(e);for(;t&&!X(t);){if(J(t)&&!zt(t))return t;t=Q(t)}return n}let r=Bt(e,t);for(;r&&it(r)&&zt(r);)r=Bt(r,t);return r&&X(r)&&zt(r)&&!ut(r)?n:r||dt(e)||n}var Ht=async function(e){let t=this.getOffsetParent||Vt,n=this.getDimensions,r=await n(e.floating);return{reference:Rt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ut(e){return Z(e).direction===`rtl`}var Wt={convertOffsetParentRelativeRectToViewportRelativeRect:Et,getDocumentElement:q,getClippingRect:It,getOffsetParent:Vt,getElementRects:Ht,getClientRects:Dt,getDimensions:Lt,getScale:bt,isElement:J,isRTL:Ut};function Gt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Kt(e,t){let n=null,r,i=q(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=_e(d),h=_e(i.clientWidth-(u+f)),g=_e(i.clientHeight-(d+p)),_=_e(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:z(0,R(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Gt(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function qt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=yt(e),u=i||a?[...l?gt(l):[],...gt(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Kt(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?$(e):null;c&&g();function g(){let t=$(e);h&&!Gt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Jt=Je,Yt=Ye,Xt=He,Zt=Ze,Qt=Ge,$t=Ve,en=Xe,tn=(e,t,n)=>{let r=new Map,i={platform:Wt,...n},a={...i.platform,_c:r};return Be(e,t,{...i,platform:a})},nn=typeof document<`u`?a.useLayoutEffect:function(){};function rn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!rn(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!rn(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function an(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function on(e,t){let n=an(e);return Math.round(t*n)/n}function sn(e){let t=a.useRef(e);return nn(()=>{t.current=e}),t}function cn(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:c=!0,whileElementsMounted:l,open:u}=e,[d,f]=a.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=a.useState(r);rn(p,r)||m(r);let[h,g]=a.useState(null),[_,v]=a.useState(null),y=a.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=a.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=o||h,S=s||_,C=a.useRef(null),w=a.useRef(null),T=a.useRef(d),E=l!=null,D=sn(l),k=sn(i),A=sn(u),j=a.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:p};k.current&&(e.platform=k.current),tn(C.current,w.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!rn(T.current,t)&&(T.current=t,O.flushSync(()=>{f(t)}))})},[p,t,n,k,A]);nn(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[u]);let M=a.useRef(!1);nn(()=>(M.current=!0,()=>{M.current=!1}),[]),nn(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,j);j()}},[x,S,j,D,E]);let N=a.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),P=a.useMemo(()=>({reference:x,floating:S}),[x,S]),F=a.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=on(P.floating,d.x),r=on(P.floating,d.y);return c?{...e,transform:`translate(`+t+`px, `+r+`px)`,...an(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,c,P.floating,d.x,d.y]);return a.useMemo(()=>({...d,update:j,refs:N,elements:P,floatingStyles:F}),[d,j,N,P,F])}var ln=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:$t({element:r.current,padding:i}).fn(n):r?$t({element:r,padding:i}).fn(n):{}}}},un=(e,t)=>({...Jt(e),options:[e,t]}),dn=(e,t)=>({...Yt(e),options:[e,t]}),fn=(e,t)=>({...en(e),options:[e,t]}),pn=(e,t)=>({...Xt(e),options:[e,t]}),mn=(e,t)=>({...Zt(e),options:[e,t]}),hn=(e,t)=>({...Qt(e),options:[e,t]}),gn=(e,t)=>({...ln(e),options:[e,t]}),_n=`Arrow`,vn=a.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,l.jsx)(k.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,l.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});vn.displayName=_n;var yn=vn;function bn(e){let[t,n]=a.useState(void 0);return p(()=>{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)}else n(void 0)},[e]),t}var xn=`Popper`,[Sn,Cn]=d(xn),[wn,Tn]=Sn(xn),En=e=>{let{__scopePopper:t,children:n}=e,[r,i]=a.useState(null);return(0,l.jsx)(wn,{scope:t,anchor:r,onAnchorChange:i,children:n})};En.displayName=xn;var Dn=`PopperAnchor`,On=a.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,o=Tn(Dn,n),s=a.useRef(null),u=c(t,s),d=a.useRef(null);return a.useEffect(()=>{let e=d.current;d.current=r?.current||s.current,e!==d.current&&o.onAnchorChange(d.current)}),r?null:(0,l.jsx)(k.div,{...i,ref:u})});On.displayName=Dn;var kn=`PopperContent`,[An,jn]=Sn(kn),Mn=a.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:o=`center`,alignOffset:s=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:m=0,sticky:h=`partial`,hideWhenDetached:g=!1,updatePositionStrategy:_=`optimized`,onPlaced:v,...y}=e,b=Tn(kn,n),[x,S]=a.useState(null),C=c(t,e=>S(e)),[w,T]=a.useState(null),E=bn(w),D=E?.width??0,O=E?.height??0,A=r+(o===`center`?``:`-`+o),M=typeof m==`number`?m:{top:0,right:0,bottom:0,left:0,...m},N=Array.isArray(f)?f:[f],P=N.length>0,F={padding:M,boundary:N.filter(In),altBoundary:P},{refs:ee,floatingStyles:te,placement:ne,isPositioned:I,middlewareData:L}=cn({strategy:`fixed`,placement:A,whileElementsMounted:(...e)=>qt(...e,{animationFrame:_===`always`}),elements:{reference:b.anchor},middleware:[un({mainAxis:i+O,alignmentAxis:s}),d&&dn({mainAxis:!0,crossAxis:!1,limiter:h===`partial`?fn():void 0,...F}),d&&pn({...F}),mn({...F,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),w&&gn({element:w,padding:u}),Ln({arrowWidth:D,arrowHeight:O}),g&&hn({strategy:`referenceHidden`,...F})]}),[re,ie]=Rn(ne),ae=j(v);p(()=>{I&&ae?.()},[I,ae]);let oe=L.arrow?.x,se=L.arrow?.y,ce=L.arrow?.centerOffset!==0,[le,ue]=a.useState();return p(()=>{x&&ue(window.getComputedStyle(x).zIndex)},[x]),(0,l.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:I?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:le,"--radix-popper-transform-origin":[L.transformOrigin?.x,L.transformOrigin?.y].join(` `),...L.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,l.jsx)(An,{scope:n,placedSide:re,onArrowChange:T,arrowX:oe,arrowY:se,shouldHideArrow:ce,children:(0,l.jsx)(k.div,{"data-side":re,"data-align":ie,...y,ref:C,style:{...y.style,animation:I?void 0:`none`}})})})});Mn.displayName=kn;var Nn=`PopperArrow`,Pn={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Fn=a.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=jn(Nn,n),a=Pn[i.placedSide];return(0,l.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,l.jsx)(yn,{...r,ref:t,style:{...r.style,display:`block`}})})});Fn.displayName=Nn;function In(e){return e!==null}var Ln=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Rn(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Rn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var zn=En,Bn=On,Vn=Mn,Hn=Fn,Un=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Wn=`VisuallyHidden`,Gn=a.forwardRef((e,t)=>(0,l.jsx)(k.span,{...e,ref:t,style:{...Un,...e.style}}));Gn.displayName=Wn;var Kn=Gn;export{p as _,Vn as a,c as b,me as c,j as d,k as f,g,v as h,Hn as i,le as l,w as m,Un as n,zn as o,x as p,Bn as r,Cn as s,Kn as t,I as u,u as v,i as x,d as y};
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{B as t,H as n,V as r}from"./react-B7Paq2b3.js";typeof window<`u`&&window.document&&window.document.createElement;function i(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var a=e(n(),1);function o(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function s(...e){return t=>{let n=!1,r=e.map(e=>{let r=o(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():o(e[t],null)}}}}function c(...e){return a.useCallback(s(...e),e)}var l=t();function u(e,t){let n=a.createContext(t),r=e=>{let{children:t,...r}=e,i=a.useMemo(()=>r,Object.values(r));return(0,l.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=a.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function d(e,t=[]){let n=[];function r(t,r){let i=a.createContext(r),o=n.length;n=[...n,r];let s=t=>{let{scope:n,children:r,...s}=t,c=n?.[e]?.[o]||i,u=a.useMemo(()=>s,Object.values(s));return(0,l.jsx)(c.Provider,{value:u,children:r})};s.displayName=t+`Provider`;function c(n,s){let c=s?.[e]?.[o]||i,l=a.useContext(c);if(l)return l;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[s,c]}let i=()=>{let t=n.map(e=>a.createContext(e));return function(n){let r=n?.[e]||t;return a.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,f(i,...t)]}function f(...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 a.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var p=globalThis?.document?a.useLayoutEffect:()=>{},m=a.useId||(()=>void 0),h=0;function g(e){let[t,n]=a.useState(m());return p(()=>{e||n(e=>e??String(h++))},[e]),e||(t?`radix-${t}`:``)}var _=a.useInsertionEffect||p;function v({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,o,s]=y({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:i;{let t=a.useRef(e!==void 0);a.useEffect(()=>{let e=t.current;e!==c&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${c?`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=c},[c,r])}return[l,a.useCallback(t=>{if(c){let n=b(t)?t(e):t;n!==e&&s.current?.(n)}else o(t)},[c,e,o,s])]}function y({defaultProp:e,onChange:t}){let[n,r]=a.useState(e),i=a.useRef(n),o=a.useRef(t);return _(()=>{o.current=t},[t]),a.useEffect(()=>{i.current!==n&&(o.current?.(n),i.current=n)},[n,i]),[n,r,o]}function b(e){return typeof e==`function`}function x(e){let t=S(e),n=a.forwardRef((e,n)=>{let{children:r,...i}=e,o=a.Children.toArray(r),s=o.find(T);if(s){let e=s.props.children,r=o.map(t=>t===s?a.Children.count(e)>1?a.Children.only(null):a.isValidElement(e)?e.props.children:null:t);return(0,l.jsx)(t,{...i,ref:n,children:a.isValidElement(e)?a.cloneElement(e,void 0,r):null})}return(0,l.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function S(e){let t=a.forwardRef((e,t)=>{let{children:n,...r}=e;if(a.isValidElement(n)){let e=D(n),i=E(r,n.props);return n.type!==a.Fragment&&(i.ref=t?s(t,e):e),a.cloneElement(n,i)}return a.Children.count(n)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var C=Symbol(`radix.slottable`);function w(e){let t=({children:e})=>(0,l.jsx)(l.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=C,t}function T(e){return a.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===C}function E(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 D(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 O=e(r(),1),k=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=x(`Primitive.${t}`),r=a.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,l.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function A(e,t){e&&O.flushSync(()=>e.dispatchEvent(t))}function j(e){let t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>(...e)=>t.current?.(...e),[])}function M(e,t=globalThis?.document){let n=j(e);a.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var N=`DismissableLayer`,P=`dismissableLayer.update`,F=`dismissableLayer.pointerDownOutside`,ee=`dismissableLayer.focusOutside`,te,ne=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),I=a.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:u,onDismiss:d,...f}=e,p=a.useContext(ne),[m,h]=a.useState(null),g=m?.ownerDocument??globalThis?.document,[,_]=a.useState({}),v=c(t,e=>h(e)),y=Array.from(p.layers),[b]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),x=y.indexOf(b),S=m?y.indexOf(m):-1,C=p.layersWithOutsidePointerEventsDisabled.size>0,w=S>=x,T=ie(e=>{let t=e.target,n=[...p.branches].some(e=>e.contains(t));!w||n||(o?.(e),u?.(e),e.defaultPrevented||d?.())},g),E=ae(e=>{let t=e.target;[...p.branches].some(e=>e.contains(t))||(s?.(e),u?.(e),e.defaultPrevented||d?.())},g);return M(e=>{S===p.layers.size-1&&(r?.(e),!e.defaultPrevented&&d&&(e.preventDefault(),d()))},g),a.useEffect(()=>{if(m)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(te=g.body.style.pointerEvents,g.body.style.pointerEvents=`none`),p.layersWithOutsidePointerEventsDisabled.add(m)),p.layers.add(m),oe(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=te)}},[m,g,n,p]),a.useEffect(()=>()=>{m&&(p.layers.delete(m),p.layersWithOutsidePointerEventsDisabled.delete(m),oe())},[m,p]),a.useEffect(()=>{let e=()=>_({});return document.addEventListener(P,e),()=>document.removeEventListener(P,e)},[]),(0,l.jsx)(k.div,{...f,ref:v,style:{pointerEvents:C?w?`auto`:`none`:void 0,...e.style},onFocusCapture:i(e.onFocusCapture,E.onFocusCapture),onBlurCapture:i(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:i(e.onPointerDownCapture,T.onPointerDownCapture)})});I.displayName=N;var L=`DismissableLayerBranch`,re=a.forwardRef((e,t)=>{let n=a.useContext(ne),r=a.useRef(null),i=c(t,r);return a.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,l.jsx)(k.div,{...e,ref:i})});re.displayName=L;function ie(e,t=globalThis?.document){let n=j(e),r=a.useRef(!1),i=a.useRef(()=>{});return a.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){se(F,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function ae(e,t=globalThis?.document){let n=j(e),r=a.useRef(!1);return a.useEffect(()=>{let e=e=>{e.target&&!r.current&&se(ee,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function oe(){let e=new CustomEvent(P);document.dispatchEvent(e)}function se(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?A(i,a):i.dispatchEvent(a)}var ce=`Portal`,le=a.forwardRef((e,t)=>{let{container:n,...r}=e,[i,o]=a.useState(!1);p(()=>o(!0),[]);let s=n||i&&globalThis?.document?.body;return s?O.createPortal((0,l.jsx)(k.div,{...r,ref:t}),s):null});le.displayName=ce;var ue=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),de=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),fe={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},pe=(0,a.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:o,iconNode:s,...c},l)=>(0,a.createElement)(`svg`,{ref:l,...fe,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:de(`lucide`,i),...c},[...s.map(([e,t])=>(0,a.createElement)(e,t)),...Array.isArray(o)?o:[o]])),me=(e,t)=>{let n=(0,a.forwardRef)(({className:n,...r},i)=>(0,a.createElement)(pe,{ref:i,iconNode:t,className:de(`lucide-${ue(e)}`,n),...r}));return n.displayName=`${e}`,n},he=[`top`,`right`,`bottom`,`left`],R=Math.min,z=Math.max,ge=Math.round,_e=Math.floor,B=e=>({x:e,y:e}),ve={left:`right`,right:`left`,bottom:`top`,top:`bottom`},ye={start:`end`,end:`start`};function be(e,t,n){return z(e,R(t,n))}function V(e,t){return typeof e==`function`?e(t):e}function H(e){return e.split(`-`)[0]}function U(e){return e.split(`-`)[1]}function xe(e){return e===`x`?`y`:`x`}function Se(e){return e===`y`?`height`:`width`}var Ce=new Set([`top`,`bottom`]);function W(e){return Ce.has(H(e))?`y`:`x`}function we(e){return xe(W(e))}function Te(e,t,n){n===void 0&&(n=!1);let r=U(e),i=we(e),a=Se(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Pe(o)),[o,Pe(o)]}function Ee(e){let t=Pe(e);return[De(e),t,De(t)]}function De(e){return e.replace(/start|end/g,e=>ye[e])}var Oe=[`left`,`right`],ke=[`right`,`left`],Ae=[`top`,`bottom`],je=[`bottom`,`top`];function Me(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ke:Oe:t?Oe:ke;case`left`:case`right`:return t?Ae:je;default:return[]}}function Ne(e,t,n,r){let i=U(e),a=Me(H(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(De)))),a}function Pe(e){return e.replace(/left|right|bottom|top/g,e=>ve[e])}function Fe(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ie(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Fe(e)}function Le(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Re(e,t,n){let{reference:r,floating:i}=e,a=W(t),o=we(t),s=Se(o),c=H(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(U(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function ze(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=V(t,e),p=Ie(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Le(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Le(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Be=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Re(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:{...o,detectOverflow:o.detectOverflow??ze},elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=Re(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},Ve=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=V(e,t)||{};if(l==null)return{};let d=Ie(u),f={x:n,y:r},p=we(i),m=Se(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=R(d[_],T),D=R(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=be(O,A,k),M=!c.arrow&&U(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),He=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=V(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=H(r),_=W(o),v=H(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Pe(o)]:Ee(o)),x=p!==`none`;!d&&x&&b.push(...Ne(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Te(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==W(t))||T.every(e=>W(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=W(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ue(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function We(e){return he.some(t=>e[t]>=0)}var Ge=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=V(e,t);switch(i){case`referenceHidden`:{let e=Ue(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:We(e)}}}case`escaped`:{let e=Ue(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:We(e)}}}default:return{}}}}},Ke=new Set([`left`,`top`]);async function qe(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=H(n),s=U(n),c=W(n)===`y`,l=Ke.has(o)?-1:1,u=a&&c?-1:1,d=V(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Je=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await qe(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ye=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=V(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=W(H(i)),p=xe(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=be(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=be(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Xe=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=V(e,t),u={x:n,y:r},d=W(i),f=xe(d),p=u[f],m=u[d],h=V(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ke.has(H(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Ze=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=V(e,t),u=await o.detectOverflow(t,l),d=H(i),f=U(i),p=W(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=R(h-u[g],v),x=R(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=z(u.left,0),t=z(u.right,0),n=z(u.top,0),r=z(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:z(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:z(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Qe(){return typeof window<`u`}function G(e){return $e(e)?(e.nodeName||``).toLowerCase():`#document`}function K(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function q(e){return(($e(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function $e(e){return Qe()?e instanceof Node||e instanceof K(e).Node:!1}function J(e){return Qe()?e instanceof Element||e instanceof K(e).Element:!1}function Y(e){return Qe()?e instanceof HTMLElement||e instanceof K(e).HTMLElement:!1}function et(e){return!Qe()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof K(e).ShadowRoot}var tt=new Set([`inline`,`contents`]);function nt(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Z(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!tt.has(i)}var rt=new Set([`table`,`td`,`th`]);function it(e){return rt.has(G(e))}var at=[`:popover-open`,`:modal`];function ot(e){return at.some(t=>{try{return e.matches(t)}catch{return!1}})}var st=[`transform`,`translate`,`scale`,`rotate`,`perspective`],ct=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],lt=[`paint`,`layout`,`strict`,`content`];function ut(e){let t=ft(),n=J(e)?Z(e):e;return st.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||ct.some(e=>(n.willChange||``).includes(e))||lt.some(e=>(n.contain||``).includes(e))}function dt(e){let t=Q(e);for(;Y(t)&&!X(t);){if(ut(t))return t;if(ot(t))return null;t=Q(t)}return null}function ft(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var pt=new Set([`html`,`body`,`#document`]);function X(e){return pt.has(G(e))}function Z(e){return K(e).getComputedStyle(e)}function mt(e){return J(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Q(e){if(G(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||et(e)&&e.host||q(e);return et(t)?t.host:t}function ht(e){let t=Q(e);return X(t)?e.ownerDocument?e.ownerDocument.body:e.body:Y(t)&&nt(t)?t:ht(t)}function gt(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=ht(e),i=r===e.ownerDocument?.body,a=K(r);if(i){let e=_t(a);return t.concat(a,a.visualViewport||[],nt(r)?r:[],e&&n?gt(e):[])}return t.concat(r,gt(r,[],n))}function _t(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vt(e){let t=Z(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Y(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ge(n)!==a||ge(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function yt(e){return J(e)?e:e.contextElement}function bt(e){let t=yt(e);if(!Y(t))return B(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=vt(t),o=(a?ge(n.width):n.width)/r,s=(a?ge(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var xt=B(0);function St(e){let t=K(e);return!ft()||!t.visualViewport?xt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ct(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==K(e)?!1:t}function $(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=yt(e),o=B(1);t&&(r?J(r)&&(o=bt(r)):o=bt(e));let s=Ct(a,n,r)?St(a):B(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=K(a),t=r&&J(r)?K(r):r,n=e,i=_t(n);for(;i&&r&&t!==n;){let e=bt(i),t=i.getBoundingClientRect(),r=Z(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=K(i),i=_t(n)}}return Le({width:u,height:d,x:c,y:l})}function wt(e,t){let n=mt(e).scrollLeft;return t?t.left+n:$(q(e)).left+n}function Tt(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-wt(e,n),y:n.top+t.scrollTop}}function Et(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=q(r),s=t?ot(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=B(1),u=B(0),d=Y(r);if((d||!d&&!a)&&((G(r)!==`body`||nt(o))&&(c=mt(r)),Y(r))){let e=$(r);l=bt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Tt(o,c):B(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Dt(e){return Array.from(e.getClientRects())}function Ot(e){let t=q(e),n=mt(e),r=e.ownerDocument.body,i=z(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=z(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+wt(e),s=-n.scrollTop;return Z(r).direction===`rtl`&&(o+=z(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var kt=25;function At(e,t){let n=K(e),r=q(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=ft();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=wt(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=kt&&(a-=o)}else l<=kt&&(a+=l);return{width:a,height:o,x:s,y:c}}var jt=new Set([`absolute`,`fixed`]);function Mt(e,t){let n=$(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Y(e)?bt(e):B(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Nt(e,t,n){let r;if(t===`viewport`)r=At(e,n);else if(t===`document`)r=Ot(q(e));else if(J(t))r=Mt(t,n);else{let n=St(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Le(r)}function Pt(e,t){let n=Q(e);return n===t||!J(n)||X(n)?!1:Z(n).position===`fixed`||Pt(n,t)}function Ft(e,t){let n=t.get(e);if(n)return n;let r=gt(e,[],!1).filter(e=>J(e)&&G(e)!==`body`),i=null,a=Z(e).position===`fixed`,o=a?Q(e):e;for(;J(o)&&!X(o);){let t=Z(o),n=ut(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&jt.has(i.position)||nt(o)&&!n&&Pt(e,o))?r=r.filter(e=>e!==o):i=t,o=Q(o)}return t.set(e,r),r}function It(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ot(t)?[]:Ft(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Nt(t,n,i);return e.top=z(r.top,e.top),e.right=R(r.right,e.right),e.bottom=R(r.bottom,e.bottom),e.left=z(r.left,e.left),e},Nt(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function Lt(e){let{width:t,height:n}=vt(e);return{width:t,height:n}}function Rt(e,t,n){let r=Y(t),i=q(t),a=n===`fixed`,o=$(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=B(0);function l(){c.x=wt(i)}if(r||!r&&!a)if((G(t)!==`body`||nt(i))&&(s=mt(t)),r){let e=$(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Tt(i,s):B(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function zt(e){return Z(e).position===`static`}function Bt(e,t){if(!Y(e)||Z(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return q(e)===n&&(n=n.ownerDocument.body),n}function Vt(e,t){let n=K(e);if(ot(e))return n;if(!Y(e)){let t=Q(e);for(;t&&!X(t);){if(J(t)&&!zt(t))return t;t=Q(t)}return n}let r=Bt(e,t);for(;r&&it(r)&&zt(r);)r=Bt(r,t);return r&&X(r)&&zt(r)&&!ut(r)?n:r||dt(e)||n}var Ht=async function(e){let t=this.getOffsetParent||Vt,n=this.getDimensions,r=await n(e.floating);return{reference:Rt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ut(e){return Z(e).direction===`rtl`}var Wt={convertOffsetParentRelativeRectToViewportRelativeRect:Et,getDocumentElement:q,getClippingRect:It,getOffsetParent:Vt,getElementRects:Ht,getClientRects:Dt,getDimensions:Lt,getScale:bt,isElement:J,isRTL:Ut};function Gt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Kt(e,t){let n=null,r,i=q(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=_e(d),h=_e(i.clientWidth-(u+f)),g=_e(i.clientHeight-(d+p)),_=_e(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:z(0,R(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Gt(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function qt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=yt(e),u=i||a?[...l?gt(l):[],...gt(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Kt(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?$(e):null;c&&g();function g(){let t=$(e);h&&!Gt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Jt=Je,Yt=Ye,Xt=He,Zt=Ze,Qt=Ge,$t=Ve,en=Xe,tn=(e,t,n)=>{let r=new Map,i={platform:Wt,...n},a={...i.platform,_c:r};return Be(e,t,{...i,platform:a})},nn=typeof document<`u`?a.useLayoutEffect:function(){};function rn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!rn(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!rn(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function an(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function on(e,t){let n=an(e);return Math.round(t*n)/n}function sn(e){let t=a.useRef(e);return nn(()=>{t.current=e}),t}function cn(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:c=!0,whileElementsMounted:l,open:u}=e,[d,f]=a.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=a.useState(r);rn(p,r)||m(r);let[h,g]=a.useState(null),[_,v]=a.useState(null),y=a.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=a.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=o||h,S=s||_,C=a.useRef(null),w=a.useRef(null),T=a.useRef(d),E=l!=null,D=sn(l),k=sn(i),A=sn(u),j=a.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:p};k.current&&(e.platform=k.current),tn(C.current,w.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!rn(T.current,t)&&(T.current=t,O.flushSync(()=>{f(t)}))})},[p,t,n,k,A]);nn(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[u]);let M=a.useRef(!1);nn(()=>(M.current=!0,()=>{M.current=!1}),[]),nn(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,j);j()}},[x,S,j,D,E]);let N=a.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),P=a.useMemo(()=>({reference:x,floating:S}),[x,S]),F=a.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=on(P.floating,d.x),r=on(P.floating,d.y);return c?{...e,transform:`translate(`+t+`px, `+r+`px)`,...an(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,c,P.floating,d.x,d.y]);return a.useMemo(()=>({...d,update:j,refs:N,elements:P,floatingStyles:F}),[d,j,N,P,F])}var ln=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:$t({element:r.current,padding:i}).fn(n):r?$t({element:r,padding:i}).fn(n):{}}}},un=(e,t)=>({...Jt(e),options:[e,t]}),dn=(e,t)=>({...Yt(e),options:[e,t]}),fn=(e,t)=>({...en(e),options:[e,t]}),pn=(e,t)=>({...Xt(e),options:[e,t]}),mn=(e,t)=>({...Zt(e),options:[e,t]}),hn=(e,t)=>({...Qt(e),options:[e,t]}),gn=(e,t)=>({...ln(e),options:[e,t]}),_n=`Arrow`,vn=a.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,l.jsx)(k.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,l.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});vn.displayName=_n;var yn=vn;function bn(e){let[t,n]=a.useState(void 0);return p(()=>{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)}else n(void 0)},[e]),t}var xn=`Popper`,[Sn,Cn]=d(xn),[wn,Tn]=Sn(xn),En=e=>{let{__scopePopper:t,children:n}=e,[r,i]=a.useState(null);return(0,l.jsx)(wn,{scope:t,anchor:r,onAnchorChange:i,children:n})};En.displayName=xn;var Dn=`PopperAnchor`,On=a.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,o=Tn(Dn,n),s=a.useRef(null),u=c(t,s),d=a.useRef(null);return a.useEffect(()=>{let e=d.current;d.current=r?.current||s.current,e!==d.current&&o.onAnchorChange(d.current)}),r?null:(0,l.jsx)(k.div,{...i,ref:u})});On.displayName=Dn;var kn=`PopperContent`,[An,jn]=Sn(kn),Mn=a.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:o=`center`,alignOffset:s=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:m=0,sticky:h=`partial`,hideWhenDetached:g=!1,updatePositionStrategy:_=`optimized`,onPlaced:v,...y}=e,b=Tn(kn,n),[x,S]=a.useState(null),C=c(t,e=>S(e)),[w,T]=a.useState(null),E=bn(w),D=E?.width??0,O=E?.height??0,A=r+(o===`center`?``:`-`+o),M=typeof m==`number`?m:{top:0,right:0,bottom:0,left:0,...m},N=Array.isArray(f)?f:[f],P=N.length>0,F={padding:M,boundary:N.filter(In),altBoundary:P},{refs:ee,floatingStyles:te,placement:ne,isPositioned:I,middlewareData:L}=cn({strategy:`fixed`,placement:A,whileElementsMounted:(...e)=>qt(...e,{animationFrame:_===`always`}),elements:{reference:b.anchor},middleware:[un({mainAxis:i+O,alignmentAxis:s}),d&&dn({mainAxis:!0,crossAxis:!1,limiter:h===`partial`?fn():void 0,...F}),d&&pn({...F}),mn({...F,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),w&&gn({element:w,padding:u}),Ln({arrowWidth:D,arrowHeight:O}),g&&hn({strategy:`referenceHidden`,...F})]}),[re,ie]=Rn(ne),ae=j(v);p(()=>{I&&ae?.()},[I,ae]);let oe=L.arrow?.x,se=L.arrow?.y,ce=L.arrow?.centerOffset!==0,[le,ue]=a.useState();return p(()=>{x&&ue(window.getComputedStyle(x).zIndex)},[x]),(0,l.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:I?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:le,"--radix-popper-transform-origin":[L.transformOrigin?.x,L.transformOrigin?.y].join(` `),...L.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,l.jsx)(An,{scope:n,placedSide:re,onArrowChange:T,arrowX:oe,arrowY:se,shouldHideArrow:ce,children:(0,l.jsx)(k.div,{"data-side":re,"data-align":ie,...y,ref:C,style:{...y.style,animation:I?void 0:`none`}})})})});Mn.displayName=kn;var Nn=`PopperArrow`,Pn={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Fn=a.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=jn(Nn,n),a=Pn[i.placedSide];return(0,l.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,l.jsx)(yn,{...r,ref:t,style:{...r.style,display:`block`}})})});Fn.displayName=Nn;function In(e){return e!==null}var Ln=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Rn(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Rn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var zn=En,Bn=On,Vn=Mn,Hn=Fn,Un=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Wn=`VisuallyHidden`,Gn=a.forwardRef((e,t)=>(0,l.jsx)(k.span,{...e,ref:t,style:{...Un,...e.style}}));Gn.displayName=Wn;var Kn=Gn;export{p as _,Vn as a,c as b,me as c,j as d,k as f,g,v as h,Hn as i,le as l,w as m,Un as n,zn as o,x as p,Bn as r,Cn as s,Kn as t,I as u,u as v,i as x,d as y};
@@ -0,0 +1 @@
1
+ import{t as e}from"./doc-browser-D6H_nPzO.js";export{e as DocBrowser};