nextclaw 0.21.9 → 0.21.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +16 -16
- package/ui-dist/assets/{api-DPcvCLfa.js → api-BP_8IaxB.js} +7 -7
- package/ui-dist/assets/channels-list-page-DEh5Jjqx.js +8 -0
- package/ui-dist/assets/chat-page-BRB0N5WW.js +105 -0
- package/ui-dist/assets/config-split-page-CRhlZ_pH.js +1 -0
- package/ui-dist/assets/{confirm-dialog-CWh5FfK2.js → confirm-dialog-DsivFJ4r.js} +2 -2
- package/ui-dist/assets/{desktop-update-config-DsRhBizi.js → desktop-update-config-B0w9p2ep.js} +1 -1
- package/ui-dist/assets/{dist-DPrgcEC0.js → dist-CikkhOlq.js} +1 -1
- package/ui-dist/assets/{dist-DsE4OsSS.js → dist-PVA_xL1D.js} +1 -1
- package/ui-dist/assets/doc-browser-BoNJ7-tE.js +1 -0
- package/ui-dist/assets/doc-browser-CdJ_d4ik.js +1 -0
- package/ui-dist/assets/doc-browser-context-MTw4EvKd.js +1 -0
- package/ui-dist/assets/{ellipsis-B81FStLm.js → ellipsis-y6vDtq4M.js} +1 -1
- package/ui-dist/assets/{external-link-C_dmG-WJ.js → external-link-DVJIQf_G.js} +1 -1
- package/ui-dist/assets/index-BiE-K8-q.css +1 -0
- package/ui-dist/assets/index-D9BAE_L_.js +105 -0
- package/ui-dist/assets/mcp-marketplace-page-B1SZNY5m.js +40 -0
- package/ui-dist/assets/mcp-marketplace-page-Cq_Tw42T.js +1 -0
- package/ui-dist/assets/middleware-CkFT3R4v.js +1 -0
- package/ui-dist/assets/model-config-page-DotaTUHb.js +1 -0
- package/ui-dist/assets/plus-BbZqquJe.js +1 -0
- package/ui-dist/assets/provider-scoped-model-input-DsFRuWJH.js +1 -0
- package/ui-dist/assets/providers-config-page-DW4tQSLN.js +1 -0
- package/ui-dist/assets/{react-sZz5HSCm.js → react-VNqT5Zp7.js} +1 -1
- package/ui-dist/assets/remote-B8TiUfwW.js +1 -0
- package/ui-dist/assets/rotate-cw-DjHDTkCv.js +1 -0
- package/ui-dist/assets/runtime-config-page-S6ErRHR8.js +1 -0
- package/ui-dist/assets/{save-MzjoiHri.js → save-BOJ477H-.js} +1 -1
- package/ui-dist/assets/{search-B29dE4GN.js → search-BEti5beA.js} +1 -1
- package/ui-dist/assets/{search-config-page-Dl5sZzob.js → search-config-page-DGj5am03.js} +1 -1
- package/ui-dist/assets/{secrets-config-page-C_l-IFCK.js → secrets-config-page--IzrIOid.js} +2 -2
- package/ui-dist/assets/{select-BKmh05hd.js → select-hoj8dK4K.js} +2 -2
- package/ui-dist/assets/{tag-chip-BS_7Ueom.js → tag-chip-T8-h-die.js} +1 -1
- package/ui-dist/assets/use-config-CjRV2hwL.js +1 -0
- package/ui-dist/assets/x-D9PXs_xP.js +1 -0
- package/ui-dist/index.html +70 -19
- package/ui-dist/assets/channels-list-page-D6jtziu4.js +0 -8
- package/ui-dist/assets/chat-page-BBnNJoKG.js +0 -105
- package/ui-dist/assets/config-split-page-BCJhqdK9.js +0 -1
- package/ui-dist/assets/doc-browser-C8xOF_9F.js +0 -1
- package/ui-dist/assets/doc-browser-DgQedeAn.js +0 -1
- package/ui-dist/assets/doc-browser-context-B46tQGmO.js +0 -1
- package/ui-dist/assets/index-7o1WdUbU.js +0 -103
- package/ui-dist/assets/index-DQWmEWzk.css +0 -1
- package/ui-dist/assets/mcp-marketplace-page-CWZN7ohK.js +0 -1
- package/ui-dist/assets/mcp-marketplace-page-Dzull_4-.js +0 -40
- package/ui-dist/assets/model-config-page-Cv0O3BIj.js +0 -1
- package/ui-dist/assets/plus-Bnt56oqG.js +0 -1
- package/ui-dist/assets/provider-scoped-model-input-Duuh7i3h.js +0 -1
- package/ui-dist/assets/providers-config-page-CPDz0Lxc.js +0 -1
- package/ui-dist/assets/remote-B0LMs8u7.js +0 -1
- package/ui-dist/assets/rotate-cw-BfyG_KEF.js +0 -1
- package/ui-dist/assets/runtime-config-page-q0fvv8ME.js +0 -1
- package/ui-dist/assets/use-config-DZkBWIdL.js +0 -1
- package/ui-dist/assets/x-CW2KO-Hz.js +0 -1
- /package/ui-dist/assets/{config-hints-CTqBnCDp.js → config-hints-BkYBc7z0.js} +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{a as e,g as t,h as n,n as r,p as i,r as a,u as o,v as s}from"./react-VNqT5Zp7.js";import{Bt as c,Gt as l,Kt as u,Lt as d,Rt as f,Vt as p,_t as m,at as h,dt as g,in as _,jt as v,ot as y,qt as b,st as x,zt as S}from"./api-BP_8IaxB.js";import{c as C}from"./dist-PVA_xL1D.js";import{C as w,a as T,i as E,n as D,r as O,t as k}from"./select-hoj8dK4K.js";import{t as ee}from"./search-BEti5beA.js";import{t as A}from"./external-link-DVJIQf_G.js";import{t as te}from"./x-D9PXs_xP.js";import{C as ne,Dt as re,R as ie,S as ae,_t as oe,at as se,bt as ce,d as le,dt as ue,ht as de,vt as fe,w as j,x as M,z as N}from"./index-D9BAE_L_.js";import{n as P,o as pe,p as me,r as F,t as I}from"./use-config-CjRV2hwL.js";import{t as he}from"./tag-chip-T8-h-die.js";import{t as L}from"./config-hints-BkYBc7z0.js";import{a as R,c as z,i as ge,n as _e,o as B,r as ve,s as ye,t as be}from"./config-split-page-CRhlZ_pH.js";var xe=C(`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`}]]),Se=C(`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`}]]),V=C(`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`}]]),Ce=C(`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=C(`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`}]]),H=s(n(),1),U=i();function Te({value:e,onChange:t,className:n,placeholder:r=``}){let[i,s]=(0,H.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,U.jsxs)(`div`,{className:o(`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,U.jsxs)(he,{tone:`info`,className:`gap-1 px-2 py-1 text-sm`,children:[e,(0,U.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`transition-colors hover:text-rose-200`,children:(0,U.jsx)(te,{className:`h-3 w-3`})})]},t)),(0,U.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||a(`enterTag`)})]})}function Ee(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,U.jsx)(fe,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,U.jsx)(ce,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,U.jsx)(Se,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,U.jsx)(xe,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,U.jsx)(we,{className:`h-3.5 w-3.5 text-gray-500`}):(0,U.jsx)(ue,{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,U.jsx)(U.Fragment,{children:t.map(t=>{let l=L(`channels.${e}.${t.name}`,s),u=l?.label??t.label,d=l?.placeholder;return(0,U.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,U.jsxs)(S,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[Ee(t.name),u]}),t.type===`boolean`&&(0,U.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,U.jsx)(`span`,{className:`text-sm text-gray-500`,children:n[t.name]?a(`enabled`):a(`disabled`)}),(0,U.jsx)(m,{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,U.jsx)(c,{id:t.name,type:t.type,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:d,className:`rounded-xl`}),t.type===`password`&&(0,U.jsx)(c,{id:t.name,type:`password`,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:d??a(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,U.jsx)(c,{id:t.name,type:`number`,value:n[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:d,className:`rounded-xl`}),t.type===`tags`&&(0,U.jsx)(Te,{value:n[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,U.jsxs)(k,{value:n[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,U.jsx)(E,{className:`rounded-xl`,children:(0,U.jsx)(T,{})}),(0,U.jsx)(D,{children:(t.options??[]).map(e=>(0,U.jsx)(O,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,U.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}})),W=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)}})),G=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=W().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=W().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}})),K=t((e=>{var t=G(),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}}})),Pe=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]]}})),Fe=t((e=>{var t=Pe();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}})),Ie=t(((e,t)=>{var n=Fe();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})),Le=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),Re=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
|
+
]))+`;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)}})),q=t((e=>{var t=Le(),n=Re();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}}})),ze=t((e=>{var t=W(),n=K(),r=G(),i=q(),a=Le(),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}})),Be=t((e=>{var t=W(),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}})),Ve=t(((e,t)=>{var n=q();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})),He=t(((e,t)=>{var n=q(),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})),Ue=t(((e,t)=>{var n=q();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})),We=t(((e,t)=>{var n=q(),r=W();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
|
+
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),Ge=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)})),Ke=t((e=>{var t=q(),n=Ve(),r=He(),i=Ue(),a=We(),o=Re(),s=W(),c=Ge();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
|
+
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()))}})),qe=t((e=>{var t=W(),n=G(),r=ke(),i=Ae(),a=je(),o=Me(),s=Ne(),c=K(),l=Ie(),u=ze(),d=Be(),f=q(),p=Ke();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
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
6
|
+
Minimum version required to store current data is: `+c+`.
|
|
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)}})),Je=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}}})),Ye=t((e=>{var t=Je();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)}})),Xe=t((e=>{var t=Je();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}})),Ze=t((e=>{var t=Oe(),n=qe(),r=Ye(),i=Xe();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 Qe(){return u({mutationFn:({channel:e,data:t})=>x(e,t)})}function $e(){return u({mutationFn:({channel:e,data:t})=>y(e,t)})}function et(){return u({mutationFn:({channel:e,data:t})=>h(e,t)})}var tt={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 nt(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 rt(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 it(e,t){return(typeof e.domain==`string`?e.domain.trim():``)||(typeof t.domain==`string`?t.domain.trim():``)||void 0}function at(e,t){return it(e,t)===`lark`?`lark`:`feishu`}function ot(e){return e===`lark`?`https://open.larksuite.com/app`:`https://open.feishu.cn/app`}function st(e,t){return b({queryKey:[`channel-qr`,e,t],enabled:!!t,queryFn:()=>(0,Ze.toDataURL)(t,{errorCorrectionLevel:`M`,margin:1,width:480})}).data??null}function ct({activeSession:e,baseUrl:t,channelEnabled:n,copy:r,connectButtonLabel:i,connectedAccountIds:s,disabled:c,domain:l,handleStartAuth:u,hasConnectedAccount:d,primaryAccountId:f,statusLabel:m}){return(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.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,U.jsx)(Ce,{className:`h-3.5 w-3.5`}),a(r.title)]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:a(r.description)}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:a(r.hint)})]}),(0,U.jsxs)(`div`,{className:o(`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,U.jsx)(oe,{className:`h-3.5 w-3.5 animate-spin`}):(0,U.jsx)(V,{className:`h-3.5 w-3.5`}),m]}),(0,U.jsxs)(`div`,{className:`space-y-1 text-sm text-gray-600`,children:[(0,U.jsx)(`p`,{children:a(n||!d?r.capabilityHint:r.disabledHint)}),f?(0,U.jsxs)(`p`,{children:[a(`weixinAuthPrimaryAccount`),`: `,(0,U.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:f})]}):null,s.length>1?(0,U.jsxs)(`p`,{children:[a(`weixinAuthConnectedAccounts`),`: `,(0,U.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:s.join(`, `)})]}):null,t?(0,U.jsxs)(`p`,{children:[a(`weixinAuthBaseUrl`),`: `,(0,U.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:t})]}):null,l&&r.domainLabel?(0,U.jsxs)(`p`,{children:[a(r.domainLabel),`: `,(0,U.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:l})]}):null]}),(0,U.jsx)(p,{type:`button`,onClick:()=>void u(),disabled:c,className:`rounded-xl`,children:i})]})}function lt({activeSession:e,authMessage:t,copy:n,qrDataUrl:i}){return(0,U.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,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-gray-100 bg-white p-3`,children:i?(0,U.jsx)(`img`,{src:i,alt:a(n.qrAlt),className:`mx-auto aspect-square w-full max-w-[240px] object-contain`}):(0,U.jsx)(`div`,{className:`flex aspect-square w-full items-center justify-center rounded-xl bg-gray-50 text-gray-500`,children:(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,U.jsx)(oe,{className:`h-5 w-5 animate-spin`}),(0,U.jsx)(`p`,{className:`text-xs`,children:a(`weixinAuthStarting`)})]})})}),(0,U.jsxs)(`div`,{className:`space-y-1 text-xs text-gray-500`,children:[(0,U.jsx)(`p`,{children:t||e.note||a(n.scanPrompt)}),(0,U.jsxs)(`p`,{children:[a(`weixinAuthExpiresAt`),`: `,r(e.expiresAt)]})]}),(0,U.jsxs)(`a`,{href:e.qrCodeUrl,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-primary transition-colors hover:text-primary-hover`,children:[(0,U.jsx)(A,{className:`h-3.5 w-3.5`}),a(`weixinAuthOpenQr`)]})]}):(0,U.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,U.jsx)(Ce,{className:`h-9 w-9 text-gray-300`}),(0,U.jsx)(`p`,{className:`mt-3 text-sm font-medium text-gray-700`,children:a(n.readyTitle)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:a(n.readyDescription)})]})})}function ut({channelConfig:e,channelEnabled:t,channelName:n,disabled:r,formData:i}){let o=_(),s=Qe(),c=$e(),[u,d]=(0,H.useState)(null),[f,p]=(0,H.useState)(null),[m,h]=(0,H.useState)(!1),g=(0,H.useMemo)(()=>nt(e),[e]),v=g[0],y=rt(i,e),b=n===`feishu`?it(i,e):void 0,x=g.length>0,S=x&&!m?null:u,C=st(n,S?.qrCodeUrl),w=tt[n];(0,H.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(p(i),i.status===`authorized`){await o.invalidateQueries({queryKey:[`config`]}),await o.invalidateQueries({queryKey:[`config-meta`]}),l.success(i.message||a(`weixinAuthAuthorized`)),d(null);return}if(i.status===`expired`||i.status===`error`){l.error(i.message||a(`weixinAuthRetryRequired`)),d(null);return}t=setTimeout(r,i.nextPollMs??S.intervalMs)}catch(t){e||(l.error(`${a(`error`)}: ${t instanceof Error?t.message:String(t)}`),d(null))}};return t=setTimeout(r,S.intervalMs),()=>{e=!0,t&&clearTimeout(t)}},[n,S,c,o]);let T=async()=>{try{let e=await s.mutateAsync({channel:n,data:{baseUrl:y,domain:b,accountId:typeof i.defaultAccountId==`string`&&i.defaultAccountId.trim()?i.defaultAccountId.trim():void 0}});h(x),d(e),p({channel:n,status:`pending`,message:e.note,nextPollMs:e.intervalMs})}catch(e){l.error(`${a(`error`)}: ${e instanceof Error?e.message:String(e)}`)}},E=S?f?.status===`scanned`?a(`weixinAuthScanned`):a(`weixinAuthWaiting`):a(x?t?`weixinAuthAuthorized`:`weixinAuthConnectedDisabled`:`weixinAuthNotConnected`),D=s.isPending?a(`weixinAuthStarting`):a(S?`weixinAuthWaiting`:x?`weixinAuthReconnect`:w.connect),O=x?a(`weixinAuthAuthorized`):f?.message;return(0,U.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,U.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,U.jsx)(ct,{activeSession:S,baseUrl:y,channelEnabled:t,copy:w,connectButtonLabel:D,connectedAccountIds:g,disabled:r||s.isPending||!!S,domain:b,handleStartAuth:T,hasConnectedAccount:x,primaryAccountId:v,statusLabel:E}),(0,U.jsx)(lt,{activeSession:S,authMessage:O,copy:w,qrDataUrl:C})]})})}function dt({channelConfig:e,disabled:t,formData:n}){let r=_(),i=et(),[o,s]=(0,H.useState)(()=>at(n,e)),[u,d]=(0,H.useState)(``),[f,m]=(0,H.useState)(``),h=ot(o),g=!!(u.trim()&&f.trim())&&!t&&!i.isPending,v=async()=>{try{let e=await i.mutateAsync({channel:`feishu`,data:{domain:o,fields:{appId:u.trim(),appSecret:f.trim()}}});await r.invalidateQueries({queryKey:[`config`]}),await r.invalidateQueries({queryKey:[`config-meta`]}),l.success(e.message||a(`feishuExistingAgentConnectSuccess`)),m(``)}catch(e){l.error(`${a(`error`)}: ${e instanceof Error?e.message:String(e)}`)}};return(0,U.jsx)(`section`,{className:`rounded-2xl border border-primary/20 bg-white p-5`,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,U.jsxs)(`div`,{className:`max-w-xl space-y-3`,children:[(0,U.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,U.jsx)(V,{className:`h-3.5 w-3.5`}),a(`feishuExistingAgentTitle`)]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:a(`feishuExistingAgentDescription`)}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:a(`feishuExistingAgentHint`)})]}),(0,U.jsxs)(`a`,{href:h,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-sm text-primary transition-colors hover:text-primary-hover`,children:[(0,U.jsx)(A,{className:`h-4 w-4`}),a(o===`lark`?`feishuExistingAgentOpenLarkList`:`feishuExistingAgentOpenFeishuList`)]})]}),(0,U.jsxs)(`div`,{className:`w-full max-w-sm space-y-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(S,{htmlFor:`feishu-existing-platform`,children:a(`feishuPlatform`)}),(0,U.jsxs)(k,{value:o,onValueChange:e=>s(e===`lark`?`lark`:`feishu`),children:[(0,U.jsx)(E,{id:`feishu-existing-platform`,className:`rounded-xl`,children:(0,U.jsx)(T,{})}),(0,U.jsxs)(D,{children:[(0,U.jsx)(O,{value:`feishu`,children:`Feishu`}),(0,U.jsx)(O,{value:`lark`,children:`Lark`})]})]})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(S,{htmlFor:`feishu-existing-app-id`,children:`App ID`}),(0,U.jsx)(c,{id:`feishu-existing-app-id`,value:u,onChange:e=>d(e.target.value),className:`rounded-xl`})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(S,{htmlFor:`feishu-existing-app-secret`,children:`App Secret`}),(0,U.jsx)(c,{id:`feishu-existing-app-secret`,type:`password`,value:f,onChange:e=>m(e.target.value),className:`rounded-xl`})]}),(0,U.jsx)(p,{type:`button`,onClick:()=>void v(),disabled:!g,className:`w-full rounded-xl`,children:i.isPending?a(`feishuExistingAgentConnecting`):a(`feishuExistingAgentConnect`)})]})]})})}function ft(e){let[t,n]=(0,H.useState)(`create`);return(0,U.jsxs)(M,{value:t,onValueChange:e=>n(e===`existing`?`existing`:`create`),children:[(0,U.jsxs)(ne,{children:[(0,U.jsx)(j,{value:`create`,children:a(`feishuAuthCreateNew`)}),(0,U.jsx)(j,{value:`existing`,children:a(`feishuAuthConnectExisting`)})]}),(0,U.jsx)(ae,{value:`create`,className:`mt-4`,children:(0,U.jsx)(ut,{...e,channelName:`feishu`})}),(0,U.jsx)(ae,{value:`existing`,className:`mt-4`,children:(0,U.jsx)(dt,{...e})})]})}var pt=[{value:`pairing`,label:`pairing`},{value:`allowlist`,label:`allowlist`},{value:`open`,label:`open`},{value:`disabled`,label:`disabled`}],J=[{value:`open`,label:`open`},{value:`allowlist`,label:`allowlist`},{value:`disabled`,label:`disabled`}],mt=[{value:`feishu`,label:`feishu`},{value:`lark`,label:`lark`}],ht=[{value:`off`,label:`off`},{value:`partial`,label:`partial`},{value:`block`,label:`block`},{value:`progress`,label:`progress`}];function gt(){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:mt},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)},{name:`groupPolicy`,type:`select`,label:a(`groupPolicy`),options:J},{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 _t(){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:pt},{name:`groupPolicy`,type:`select`,label:a(`groupPolicy`),options:J},{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:ht},{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:pt},{name:`groupPolicy`,type:`select`,label:a(`groupPolicy`),options:J},{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:gt(),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 vt(t){let n=e();return t.tutorialUrls?.[n]||t.tutorialUrls?.default||t.tutorialUrl}var yt=[],bt=[{type:`fields`,section:`all`}],Y=new Set,X=new Map,Z=null;function Q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $(e,t){let n={...e};for(let[e,r]of Object.entries(t))n[e]=Q(n[e])&&Q(r)?$(n[e],r):r;return n}function xt(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 St(e,t){return t===`all`?e:e.filter(e=>t===`primary`?e.section===`primary`:e.section!==`primary`)}function Ct(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 wt(){Z||=g.eventBus.on(v.channelConfigApplyStatus,e=>{X.set(e.channel,e.status===`started`?{status:`applying`}:e.status===`succeeded`?{status:`applied`}:{status:`failed`,message:e.message}),Y.forEach(e=>e())})}function Tt(e){return Y.add(e),wt(),()=>{Y.delete(e),!Y.size&&Z&&(Z(),Z=null,X.clear())}}function Et(e){return(0,H.useSyncExternalStore)(Tt,()=>e?X.get(e)??null:null,()=>null)}function Dt(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 Ot({channelApplyStatus:e,channelLabel:t,channelName:n,enabled:r,tutorialUrl:i}){return(0,U.jsx)(z,{className:`px-6 py-5`,children:(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(ie,{name:n,src:N(n),className:o(`h-9 w-9 rounded-lg border`,r?`border-primary/30 bg-white`:`border-gray-200/70 bg-white`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,U.jsx)(`span`,{className:`text-sm font-semibold uppercase text-gray-500`,children:n[0]})}),(0,U.jsx)(`h3`,{className:`truncate text-lg font-semibold text-gray-900 capitalize`,children:t})]}),(0,U.jsx)(`p`,{className:`mt-2 text-sm text-gray-500`,children:a(`channelsFormDescription`)}),e?(0,U.jsx)(`p`,{className:o(`mt-2 text-xs font-medium`,e.className),children:e.label}):null,i?(0,U.jsxs)(`a`,{href:i,className:`mt-2 inline-flex items-center gap-1.5 text-xs text-primary transition-colors hover:text-primary-hover`,children:[(0,U.jsx)(re,{className:`h-3.5 w-3.5`}),a(`channelsGuideTitle`)]}):null]}),(0,U.jsx)(se,{status:r?`active`:`inactive`,label:a(r?`statusActive`:`statusInactive`)})]})})}function kt({channelConfig:e,channelName:t,disabled:n,enabled:r,fields:i,formData:a,jsonDrafts:o,layoutBlocks:s,setJsonDrafts:c,uiHints:l,updateField:u}){return(0,U.jsx)(U.Fragment,{children:s.map((s,d)=>{if(s.type===`fields`){let e=St(i,s.section);if(e.length===0)return null;let n=(0,U.jsx)(De,{channelName:t,fields:e,formData:a,jsonDrafts:o,setJsonDrafts:c,updateField:u,uiHints:l});return s.collapsible?(0,U.jsxs)(`details`,{className:`group rounded-2xl border border-gray-200/80 bg-white`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-5 py-4 text-sm font-medium text-gray-900`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{children:s.collapsible.title}),s.collapsible.description?(0,U.jsx)(`p`,{className:`mt-1 text-xs font-normal text-gray-500`,children:s.collapsible.description}):null]}),(0,U.jsx)(w,{className:`h-4 w-4 text-gray-400 transition-transform group-open:rotate-180`})]}),(0,U.jsx)(`div`,{className:`space-y-6 border-t border-gray-100 px-5 py-5`,children:n})]},`${s.type}-${s.section}-${d}`):(0,U.jsx)(`div`,{children:n},`${s.type}-${s.section}-${d}`)}return s.sectionId===`feishu-auth`?(0,U.jsx)(ft,{channelConfig:e,formData:a,channelEnabled:r,disabled:n},`${s.type}-${s.sectionId}-${d}`):s.sectionId===`weixin-auth`?(0,U.jsx)(ut,{channelConfig:e,formData:a,channelName:`weixin`,channelEnabled:r,disabled:n},`${s.type}-${s.sectionId}-${d}`):null})})}function At({actions:e,channelConfig:t,channelLabel:n,channelName:r,fields:i,layoutBlocks:o,tutorialUrl:s,uiHints:c}){let u=me(),d=pe(),[f,m]=(0,H.useState)(()=>({...t})),[h,g]=(0,H.useState)(()=>Ct(t,i)),[_,v]=(0,H.useState)(null),y=Dt(Et(r)),b=typeof f.enabled==`boolean`?f.enabled:!!t.enabled,x=u.isPending||!!_,S=(e,t)=>m(n=>({...n,[e]:t})),C=e=>{e.preventDefault();let t={...f};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]=(h[e.name]??``).trim()?JSON.parse(h[e.name]):{}}catch{l.error(`${a(`invalidJson`)}: ${e.name}`);return}}u.mutate({channel:r,data:t})},w=e=>{if(!Q(e?.channels)||!Q(e.channels[r]))return;let t=e.channels[r];m(e=>$(e,t)),g(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=>{v(e.id);try{let t=`channels.${r}`,n={...f};e.saveBeforeRun&&(n={...n,...e.savePatch??{}},m(n),await u.mutateAsync({channel:r,data:n}));let i=await d.mutateAsync({actionId:e.id,data:{scope:t,draftConfig:xt(t,n)}});w(i.patch),i.ok?l.success(i.message||a(`success`)):l.error(i.message||a(`error`))}catch(e){l.error(`${a(`error`)}: ${e instanceof Error?e.message:String(e)}`)}finally{v(null)}};return(0,U.jsxs)(R,{children:[(0,U.jsx)(Ot,{channelName:r,channelLabel:n,enabled:b,tutorialUrl:s,channelApplyStatus:y}),(0,U.jsxs)(`form`,{onSubmit:C,className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(B,{className:`space-y-6 px-6 py-5`,children:(0,U.jsx)(kt,{channelConfig:t,channelName:r,enabled:b,fields:i,formData:f,jsonDrafts:h,layoutBlocks:o,setJsonDrafts:g,uiHints:c,updateField:S,disabled:x})}),(0,U.jsxs)(ye,{className:`flex flex-wrap items-center justify-between gap-3 px-6 py-4`,children:[(0,U.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e.filter(e=>e.trigger===`manual`).map(e=>(0,U.jsx)(p,{type:`button`,onClick:()=>void T(e),disabled:x,variant:`secondary`,children:_===e.id?a(`connecting`):e.title},e.id))}),(0,U.jsx)(p,{type:`submit`,disabled:x,children:u.isPending?a(`saving`):a(`save`)})]})]})]})}function jt({channelName:e}){let{data:t}=I(),{data:n}=P(),{data:r}=F(),i=e?t?.channels[e]??null:null,o=n?.channels.find(t=>t.name===e),s=(0,H.useMemo)(()=>_t()[e||``],[e]);if(!e||!o||!i)return(0,U.jsx)(_e,{children:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-base font-semibold text-gray-900`,children:a(`channelsSelectTitle`)}),(0,U.jsx)(`p`,{className:`mt-2 text-sm text-gray-500`,children:a(`channelsSelectDescription`)})]})});let c=s?.fields??yt,l=s?.layout??bt,u=r?.uiHints,d=L(`channels.${e}`,u)?.label??e,f=vt(o),p=JSON.stringify({channelName:e,channelConfig:i,jsonFields:c.filter(e=>e.type===`json`).map(e=>e.name)});return(0,U.jsx)(At,{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 Mt={telegram:`channelDescTelegram`,slack:`channelDescSlack`,email:`channelDescEmail`,webhook:`channelDescWebhook`,discord:`channelDescDiscord`,feishu:`channelDescFeishu`,weixin:`channelDescWeixin`},Nt=[`weixin`,`feishu`,`discord`,`qq`];function Pt(e){let t=new Map(Nt.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 Ft(){let{isMobile:e}=le(),{data:t}=I(),{data:n}=P(),{data:r}=F(),[i,s]=(0,H.useState)(`enabled`),[l,u]=(0,H.useState)(null),[p,m]=(0,H.useState)(``),h=(0,H.useMemo)(()=>Pt(n?.channels??[]),[n?.channels]),g=t?.channels,_=(0,H.useMemo)(()=>{let e=p.trim().toLowerCase();return h.filter(e=>i!==`enabled`||!!g?.[e.name]?.enabled).filter(t=>e?(t.displayName||t.name).toLowerCase().includes(e)||t.name.toLowerCase().includes(e):!0)},[i,g,h,p]),v=l&&_.some(e=>e.name===l)?l:e?null:_[0]?.name??null;return!t||!n?(0,U.jsx)(`div`,{className:`p-8 text-gray-400`,children:a(`channelsLoading`)}):(0,U.jsxs)(f,{className:`pb-0 xl:flex xl:h-full xl:min-h-0 xl:flex-col`,children:[(0,U.jsx)(d,{title:a(`channelsPageTitle`),description:a(`channelsPageDescription`)}),(0,U.jsxs)(ge,{className:`xl:min-h-0`,mobileView:e?v?`detail`:`list`:void 0,onMobileBack:()=>u(null),mobileListLabel:a(`channelsPageTitle`),children:[(0,U.jsxs)(R,{children:[(0,U.jsx)(z,{className:`px-4 pt-4`,children:(0,U.jsx)(M,{value:i,onValueChange:s,children:(0,U.jsxs)(ne,{className:`mb-0 h-auto gap-3 border-b-0 bg-transparent p-0`,children:[(0,U.jsxs)(j,{value:`enabled`,className:`gap-1.5 px-0 pb-3`,children:[a(`channelsTabEnabled`),(0,U.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:h.filter(e=>g?.[e.name]?.enabled).length})]}),(0,U.jsxs)(j,{value:`all`,className:`gap-1.5 px-0 pb-3`,children:[a(`channelsTabAll`),(0,U.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:h.length})]})]})})}),(0,U.jsx)(`div`,{className:`border-b border-gray-100 px-4 py-3`,children:(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(ee,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,U.jsx)(c,{value:p,onChange:e=>m(e.target.value),placeholder:a(`channelsFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,U.jsxs)(B,{className:`space-y-2 p-3`,children:[_.map(e=>{let n=!!t.channels[e.name]?.enabled,i=vt(e),s=L(`channels.${e.name}`,r?.uiHints)?.help||a(Mt[e.name]||`channelDescriptionDefault`);return(0,U.jsx)(be,{onClick:()=>u(e.name),active:v===e.name,children:(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,U.jsx)(ie,{name:e.name,src:N(e.name),className:o(`h-10 w-10 rounded-lg border`,n?`border-primary/30 bg-white`:`border-gray-200/70 bg-white`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,U.jsx)(`span`,{className:`text-sm font-semibold uppercase text-gray-500`,children:e.name[0]})}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.displayName||e.name}),(0,U.jsx)(`p`,{className:`line-clamp-1 text-[11px] text-gray-500`,children:s})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i?(0,U.jsx)(`a`,{href:i,onClick:e=>e.stopPropagation(),className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-gray-300 transition-colors hover:bg-gray-100/70 hover:text-gray-500`,title:a(`channelsGuideTitle`),children:(0,U.jsx)(A,{className:`h-3.5 w-3.5`})}):null,(0,U.jsx)(se,{status:n?`active`:`inactive`,label:a(n?`statusActive`:`statusInactive`),className:`min-w-[56px] justify-center`})]})]})},e.name)}),_.length===0?(0,U.jsx)(ve,{icon:de,title:a(`channelsNoMatch`)}):null]})]}),(0,U.jsx)(jt,{channelName:v??void 0})]})]})}export{Ft as ChannelsList};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import{h as e,p as t,r as n,u as r,v as i}from"./react-VNqT5Zp7.js";import{$t as a,A as o,Bt as s,Gt as c,Kt as l,M as u,Mt as d,N as f,Nt as p,P as m,Qt as h,Rt as g,Vt as _,Xt as v,Yt as y,Zt as b,cn as x,dn as S,dt as C,en as w,fn as T,in as E,j as D,jt as O,k as ee,ln as k,nn as te,pn as ne,qt as re,tn as ie,un as ae}from"./api-BP_8IaxB.js";import{a as oe,c as se,i as A,l as ce,n as le,o as ue,r as j,s as M}from"./mcp-marketplace-page-B1SZNY5m.js";import{c as N}from"./dist-PVA_xL1D.js";import{a as de,i as fe,n as pe,r as me,t as he}from"./select-hoj8dK4K.js";import{a as ge,i as _e,n as ve,o as ye,r as be,s as xe}from"./confirm-dialog-DsivFJ4r.js";import{n as Se}from"./search-BEti5beA.js";import{a as P,c as F,o as I,s as Ce}from"./doc-browser-CdJ_d4ik.js";import{t as we}from"./provider-scoped-model-input-DsFRuWJH.js";import{t as Te}from"./ellipsis-y6vDtq4M.js";import{t as Ee}from"./external-link-DVJIQf_G.js";import{t as De}from"./plus-BbZqquJe.js";import{n as Oe}from"./doc-browser-context-MTw4EvKd.js";import{A as ke,At as Ae,B as je,C as Me,Ct as Ne,E as Pe,Et as Fe,F as L,G as Ie,H as Le,I as Re,L as ze,M as Be,N as R,O as Ve,Ot as He,P as Ue,T as We,Tt as z,V as B,W as Ge,a as Ke,b as qe,d as Je,ft as Ye,gt as Xe,i as Ze,j as Qe,k as $e,kt as V,lt as H,mt as et,n as tt,o as nt,ot as rt,p as it,q as at,r as ot,st,t as ct,u as lt,ut,w as dt,wt as ft,x as pt,yt as mt}from"./index-D9BAE_L_.js";import{l as ht,t as gt,u as _t}from"./use-config-CjRV2hwL.js";import{t as vt}from"./tag-chip-T8-h-die.js";function yt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function bt(e,t,n){let r=e.slice(0);return r[t]=n,r}var xt=class extends ne{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,k.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!T(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(yt(e,n).forEach(e=>{e.destroy()}),yt(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=S(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new x(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=bt(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&k.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},U=i(e(),1);function St({queries:e,...t},n){let r=E(n),i=te(),o=ie(),s=U.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);s.forEach(e=>{y(e),h(e,o,r.getQueryCache().get(e.queryHash))}),w(o);let[c]=U.useState(()=>new xt(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&t.subscribed!==!1;U.useSyncExternalStore(U.useCallback(e=>f?c.subscribe(k.batchCalls(e)):ae,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),U.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>b(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&b(n,e)?v(n,new x(r,n),o):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&a({result:e,errorResetBoundary:o,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m?.error)throw m.error;return u(d())}var Ct=N(`BriefcaseBusiness`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`,key:`1ksdt3`}],[`path`,{d:`M22 13a18.15 18.15 0 0 1-20 0`,key:`12hx5q`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),wt=N(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),Tt=N(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Et=N(`Earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Dt=N(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),Ot=N(`PenLine`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),kt=N(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),W=t(),At=U.forwardRef(({className:e,...t},n)=>(0,W.jsx)(`textarea`,{className:r(`flex min-h-28 w-full rounded-xl border border-border bg-card px-3.5 py-2.5 text-sm text-foreground placeholder:text-muted-foreground/55 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/50 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));At.displayName=`Textarea`;function jt(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``}}function Mt(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=R(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 Nt({value:e,disabled:t=!1,runtimeOptions:r,defaultRuntime:i,onChange:a}){let o=e.trim()?R(e):``,s=Mt({runtimeOptions:r,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?n(`agentsRuntimeUnavailableHelp`):``);return(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(he,{value:o||i,onValueChange:e=>a(e===i?``:e),disabled:t,children:[(0,W.jsx)(fe,{"aria-label":n(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,W.jsx)(de,{placeholder:n(`agentsRuntimeSelectPlaceholder`)})}),(0,W.jsx)(pe,{className:`rounded-xl`,children:s.map(e=>(0,W.jsx)(me,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,W.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function Pt({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,W.jsx)(ve,{open:e!==null,onOpenChange:a,children:e?(0,W.jsx)(Ft,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function Ft(e){let{agent:t,pending:r,providerCatalog:i,runtimeOptions:a,defaultRuntime:o,onOpenChange:c,onSubmit:l}=e,[u,d]=(0,U.useState)(jt(t));return(0,W.jsxs)(be,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,W.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,W.jsxs)(ye,{className:`text-left`,children:[(0,W.jsx)(xe,{children:n(`agentsEditDialogTitle`)}),(0,W.jsx)(_e,{children:n(`agentsEditDialogDescription`)})]})}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(rt,{tone:`warning`,title:n(`agentsEditHomeReadonly`),description:n(`agentsEditHomeReadonlyHint`),children:(0,W.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,W.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,W.jsx)(s,{value:u.displayName,onChange:e=>d(t=>({...t,displayName:e.target.value})),placeholder:n(`agentsFormNamePlaceholder`)}),(0,W.jsx)(At,{value:u.description,onChange:e=>d(t=>({...t,description:e.target.value})),placeholder:n(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,W.jsx)(s,{value:u.avatar,onChange:e=>d(t=>({...t,avatar:e.target.value})),placeholder:n(`agentsFormAvatarPlaceholder`)}),(0,W.jsx)(we,{value:u.model,onChange:e=>d(t=>({...t,model:e})),providerCatalog:i,disabled:r,className:`md:col-span-2`}),(0,W.jsx)(Nt,{value:u.runtime,onChange:e=>d(t=>({...t,runtime:e})),runtimeOptions:a,defaultRuntime:o,disabled:r})]})]})}),(0,W.jsxs)(ge,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,W.jsx)(_,{type:`button`,variant:`ghost`,onClick:()=>c(!1),disabled:r,children:n(`cancel`)}),(0,W.jsxs)(_,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>l(t.id,u),disabled:r,children:[(0,W.jsx)(et,{className:`mr-2 h-4 w-4`}),n(`agentsEditSaveAction`)]})]})]})}var It=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function Lt(e){let{agentCount:t,onCreate:r}=e;return(0,W.jsxs)(`section`,{className:`flex flex-col gap-3 border-b border-gray-200 pb-4 sm:flex-row sm:items-end sm:justify-between`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`h1`,{className:`text-xl font-semibold text-gray-950`,children:n(`agentsHeroEyebrow`)}),(0,W.jsx)(`span`,{className:`rounded-full border border-gray-200 bg-white px-2 py-0.5 text-xs font-medium text-gray-500`,children:t})]}),(0,W.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-gray-500`,children:n(`agentsHeroDescription`)})]}),(0,W.jsxs)(_,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:r,children:[(0,W.jsx)(De,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}function Rt(e){let{icon:t,label:n,disabled:i=!1,destructive:a=!1,onClick:o}=e;return(0,W.jsxs)(`button`,{type:`button`,className:r(`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-gray-700 hover:bg-gray-100`),onClick:o,disabled:i,children:[(0,W.jsx)(t,{className:`h-4 w-4 shrink-0`}),(0,W.jsx)(`span`,{children:n})]})}function zt(e){let{agent:t,runtimeOptions:r,defaultRuntimeLabel:i,updatePending:a,deletePending:o,onStartChat:s,onEdit:c,onDelete:l}=e,u=t.runtime?.trim()||t.engine?.trim()||``,f=u?r.find(e=>e.value===R(u))?.label??L(u):i;return(0,W.jsx)(d,{className:`group overflow-hidden border border-gray-200 bg-white shadow-none transition-colors duration-200 hover:border-gray-300`,children:(0,W.jsxs)(p,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,W.jsx)(Qe,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-950`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,W.jsxs)(vt,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,W.jsx)(ut,{className:`h-3 w-3`}),n(`agentsCardBuiltInTag`)]}):null]}),(0,W.jsxs)(`div`,{className:`truncate text-xs text-gray-400`,children:[`@`,t.id]})]})]}),(0,W.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,W.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":n(`agentsCardStartChat`),title:n(`agentsCardStartChat`),onClick:s,children:(0,W.jsx)(Xe,{className:`h-4 w-4`})}),(0,W.jsxs)(Le,{children:[(0,W.jsx)(Ie,{asChild:!0,children:(0,W.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":n(`chatSessionMoreActions`),title:n(`chatSessionMoreActions`),children:(0,W.jsx)(Te,{className:`h-4 w-4`})})}),(0,W.jsxs)(Ge,{align:`end`,className:`w-44 p-1.5`,children:[(0,W.jsx)(Rt,{icon:et,label:n(`agentsEditAction`),onClick:c,disabled:a}),t.builtIn?null:(0,W.jsx)(Rt,{icon:st,label:n(`agentsRemoveAction`),onClick:l,disabled:o,destructive:!0})]})]})]}),(0,W.jsx)(`p`,{className:`line-clamp-2 min-h-10 text-sm leading-5 text-gray-600`,children:t.description?.trim()||(t.builtIn?n(`agentsCardBuiltInSummary`):n(`agentsCardCustomSummary`))}),(0,W.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-gray-100 pt-2 text-xs text-gray-500`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(H,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,W.jsx)(`span`,{className:`truncate`,children:f})]}),(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(mt,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,W.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function Bt(){let e=B(),t=ct(),r=V(),i=Ve(),a=gt(),o=_t(),s=ht(),c=tt(),l=ke(),u=$e(),[f,m]=(0,U.useState)(null),h=(0,U.useMemo)(()=>i.data?.agents??[],[i.data?.agents]),v=(0,U.useMemo)(()=>[...h].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[h]),y=(0,U.useMemo)(()=>it({config:a.data,providersView:o.data,templatesView:s.data,onlyConfigured:!0}),[a.data,o.data,s.data]),b=(0,U.useMemo)(()=>Be(c.data?.options??[]),[c.data?.options]),x=(0,U.useMemo)(()=>R(c.data?.defaultType??`native`),[c.data?.defaultType]),S=(0,U.useMemo)(()=>b.find(e=>e.value===x)?.label??L(x),[x,b]),C=e=>{m(e)},w=async(e,t)=>{await l.mutateAsync({agentId:e,data:{displayName:t.displayName,description:t.description,avatar:t.avatar,model:t.model,...t.runtime.trim()?{runtime:t.runtime.trim()}:{runtime:``}}}),m(null)},T=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,Ue(t,x))},E=()=>{r(`/chat`),t.chatDraftIntentManager.requestDraft(It)};return(0,W.jsxs)(g,{className:`space-y-5`,children:[(0,W.jsx)(Lt,{agentCount:h.length,onCreate:E}),(0,W.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:i.isLoading?(0,W.jsx)(d,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,W.jsx)(p,{className:`py-14 text-center text-sm text-gray-500`,children:n(`agentsLoading`)})}):v.length===0?(0,W.jsx)(d,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-[#d9dce3] bg-[linear-gradient(135deg,#fff7ea_0%,#f4fbff_100%)]`,children:(0,W.jsxs)(p,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,W.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-white/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,W.jsx)(Fe,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,W.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:n(`agentsEmpty`)}),(0,W.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:n(`agentsEmptyDescription`)}),(0,W.jsxs)(_,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:E,children:[(0,W.jsx)(De,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}):v.map(e=>(0,W.jsx)(zt,{agent:e,runtimeOptions:b,defaultRuntimeLabel:S,updatePending:l.isPending,deletePending:u.isPending,onStartChat:()=>T(e),onEdit:()=>C(e),onDelete:()=>u.mutate({agentId:e.id})},e.id))}),(0,W.jsx)(Pt,{agent:f,pending:l.isPending,providerCatalog:y,runtimeOptions:b,defaultRuntime:x,onOpenChange:e=>{!e&&!l.isPending&&m(null)},onSubmit:w})]})}function G(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function Vt(e){let{request:t,result:n}=e,r=new Date().toISOString();return n.type===`skill`?{type:`skill`,spec:n.spec,id:t.skill??n.spec,label:t.skill??n.name??n.spec,source:`workspace`,installPath:t.installPath,installedAt:r}:{type:n.type,spec:n.spec,id:n.name??n.spec,label:n.name??n.spec,source:`marketplace`,origin:`marketplace`,enabled:t.enabled??!0,runtimeStatus:t.enabled===!1?`disabled`:`ready`,installedAt:r}}function K(e,t){let{id:n,spec:r}=t;return!!(r&&e.spec===r||n&&e.id===n)}function Ht(e,t){return t??{type:e,total:0,specs:[],records:[]}}function Ut(e){let{result:t,view:n}=e,r=Ht(t.type,n),i=Vt(e),a=r.records.findIndex(e=>K(e,{id:i.id,spec:i.spec})),o=[...r.records];return a>=0?o[a]={...o[a],...i}:o.unshift(i),{...r,type:t.type,records:o,specs:G(o),total:o.length}}function Wt(e){let{request:t,result:n,view:r}=e,i=Ht(n.type,r);if(n.action===`uninstall`||n.action===`remove`){let e=i.records.filter(e=>!K(e,{id:n.id,spec:t.spec}));return{...i,records:e,specs:G(e),total:e.length}}let a=i.records.map(e=>K(e,{id:n.id,spec:t.spec})?n.action===`disable`?{...e,enabled:!1,runtimeStatus:`disabled`}:n.action===`update`?{...e,installedAt:new Date().toISOString(),origin:e.origin??`marketplace`}:{...e,enabled:!0,runtimeStatus:`ready`}:e);return{...i,records:a,specs:G(a),total:a.length}}function Gt(e){let t=ce({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>o({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,placeholderData:(t,n)=>{let r=n?.queryKey?.[1];if(!(!r||typeof r!=`object`||!r))return(`type`in r?r.type:void 0)===e.type&&Kt(r,e)?t:void 0},staleTime:15e3}),n=(0,U.useMemo)(()=>se(t.data),[t.data]);return{...t,data:n}}function Kt(e,t){return e.tag===t.tag&&e.scene===t.scene&&e.pageSize===t.pageSize}function qt(e=!0){return re({queryKey:[`marketplace-skill-scenes`],queryFn:u,enabled:e,staleTime:6e4})}function Jt(e,t=!0){let n=St({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>o({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,U.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function Yt(e){return re({queryKey:[`marketplace-installed`,e],queryFn:()=>ee(e),staleTime:1e4})}function Xt(){let e=E();return l({mutationFn:e=>f(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>Ut({view:e,request:r,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),c.success(t.message||n(`marketplaceInstallSuccessSkill`))},onError:e=>{c.error(e.message||n(`marketplaceInstallFailed`))}})}function Zt(){let e=E();return l({mutationFn:e=>m(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>Wt({view:e,request:r,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let i=t.action===`enable`?n(`marketplaceEnableSuccess`):t.action===`disable`?n(`marketplaceDisableSuccess`):t.action===`update`?n(`marketplaceUpdateSuccess`):n(`marketplaceUninstallSuccess`);c.success(t.message||i)},onError:e=>{c.error(e.message||n(`marketplaceOperationFailed`))}})}var Qt=[`bg-amber-600`,`bg-orange-500`,`bg-yellow-600`,`bg-emerald-600`,`bg-teal-600`,`bg-cyan-600`,`bg-stone-600`,`bg-rose-500`,`bg-violet-500`];function $t(e){let{name:t,fallback:n,className:i}=e,a=t||n,o=a.substring(0,2).toUpperCase();return(0,W.jsx)(`div`,{className:r(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,en(a),i),children:o})}function en(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Qt[Math.abs(t)%Qt.length]}function tn({title:e,spec:t}){return(0,W.jsxs)(Ce,{delayDuration:400,children:[(0,W.jsxs)(P,{children:[(0,W.jsx)(F,{asChild:!0,children:(0,W.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-950`,children:e})}),(0,W.jsx)(I,{className:`max-w-[300px] text-xs`,children:e})]}),(0,W.jsx)(`div`,{className:`mb-2 mt-1 flex min-w-0 items-center gap-1.5`,children:t?(0,W.jsxs)(P,{children:[(0,W.jsx)(F,{asChild:!0,children:(0,W.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono leading-tight text-gray-400`,children:t})}),(0,W.jsx)(I,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null})]})}function nn(e){let{item:t,record:i,state:a,onInstall:o,onManage:s}=e,{isInstalling:c,canUpdate:l,canUninstall:u,busyAction:d}=a,f=!!d;return t&&!i||i&&(l||u)?(0,W.jsxs)(`div`,{className:r(`flex shrink-0 items-center justify-end gap-1.5 opacity-100 transition-opacity duration-150`,`md:pointer-events-none md:opacity-0`,`md:group-hover:pointer-events-auto md:group-hover:opacity-100`,`md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100`),children:[t&&!i&&(0,W.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),o(t)},disabled:c,className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md bg-primary px-2 text-[11px] font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50`,children:[(0,W.jsx)(Ne,{className:`h-3 w-3`}),n(c?`marketplaceInstalling`:`marketplaceInstall`)]}),i&&l&&(0,W.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`update`,i)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-blue-200/80 bg-white px-2 text-[11px] font-medium text-blue-600 transition-colors hover:border-blue-300 hover:bg-blue-50 disabled:opacity-50`,children:[(0,W.jsx)(Ye,{className:`h-3 w-3`}),n(d===`update`?`marketplaceUpdating`:`marketplaceUpdate`)]}),i&&u&&(0,W.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`uninstall`,i)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-gray-200/80 bg-white px-2 text-[11px] font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50`,children:[(0,W.jsx)(st,{className:`h-3 w-3`}),n(d===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]}):null}function rn(e){let{record:t,disabled:n}=e;return t?(0,W.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-end`,children:(0,W.jsx)(an,{disabled:n})}):null}function an(e){let{disabled:t}=e,i=n(t?`marketplaceDisabledStatus`:`marketplaceInstalledStatus`);return(0,W.jsx)(Ce,{delayDuration:300,children:(0,W.jsxs)(P,{children:[(0,W.jsx)(F,{asChild:!0,children:(0,W.jsx)(`span`,{"aria-label":i,className:r(`inline-flex h-5 w-5 items-center justify-center`,t?`text-gray-400`:`text-emerald-700`),children:t?(0,W.jsx)(z,{className:`h-4 w-4 opacity-40`}):(0,W.jsx)(z,{className:`h-4 w-4`})})}),(0,W.jsx)(I,{className:`text-xs`,children:i})]})})}function on(e){let{item:t,record:r,installState:i,manageState:a,onOpen:o,onInstall:s,onManage:c}=e,{language:l}=qe(),u=j(l),d=t?.name??r?.label??r?.id??r?.spec??n(`marketplaceUnknownItem`),f=A(t?.summaryI18n,t?.summary,u)||(r?n(`marketplaceInstalledLocalSummary`):``),p=t?.install.spec??r?.spec??``,m=t?.tags??[],h=r?.id||r?.spec,g=h?a.actionsByTarget.get(h):void 0,_=r?.type===`skill`&&r.source===`workspace`,v=r?.type===`skill`&&r.origin===`marketplace`,y=r?r.enabled===!1||r.runtimeStatus===`disabled`:!1,b=t?.install.spec,x=typeof b==`string`&&i.installingSpecs.has(b);return(0,W.jsxs)(`article`,{onClick:o,className:`group flex h-full min-h-[156px] cursor-pointer flex-col rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,W.jsx)($t,{name:d,fallback:p||n(`marketplaceTypeSkill`),className:`h-9 w-9 rounded-lg text-xs`}),(0,W.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,W.jsx)(tn,{title:d,spec:p})}),(0,W.jsx)(rn,{record:r,disabled:y})]}),(0,W.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-1 flex-col`,children:[(0,W.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500`,children:f}),(0,W.jsxs)(`div`,{className:`mt-auto flex min-w-0 items-end justify-between gap-2 pt-2`,children:[(0,W.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,W.jsx)(sn,{tags:m})}),(0,W.jsx)(nn,{item:t,record:r,state:{isInstalling:x,canUpdate:v,canUninstall:_,busyAction:g},onInstall:s,onManage:c})]})]})]})}function sn({tags:e}){let t=e.filter(cn).slice(0,3);return t.length===0?null:(0,W.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1.5 overflow-hidden`,children:t.map(e=>(0,W.jsx)(`span`,{className:`max-w-[104px] truncate rounded-md bg-gray-100 px-2 py-0.5 text-[11px] font-medium leading-5 text-gray-500`,children:e},e))})}function cn(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function ln({model:e,showTitle:t,operationState:n,scroll:i,actions:a}){let{scope:o,entries:s,header:c,status:l,emptyLabel:u,errorLabel:d}=e,{showSkeleton:f,isRefreshing:p,error:m}=l,{hasMore:h,loadingMore:g,sentinelRef:_}=i,{installState:v,manageState:y}=n,{onOpen:b,onInstall:x,onManage:S}=a;return(0,W.jsxs)(`section`,{className:r(`flex min-h-full flex-col`,t&&`gap-3`),children:[t&&(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,W.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:c.title}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-gray-500`,children:[p&&(0,W.jsx)(`span`,{className:`font-medium text-primary`,children:c.refreshingLabel}),(0,W.jsx)(`span`,{children:c.summary})]})]}),m&&(0,W.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[d,`: `,m.message]}),p&&(0,W.jsx)(`div`,{"data-testid":`marketplace-list-refreshing`,className:`h-0.5 overflow-hidden rounded-full bg-primary/10`,children:(0,W.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-primary`})}),(0,W.jsxs)(`div`,{"data-testid":f?`marketplace-list-skeleton`:void 0,className:r(`grid grid-cols-1 gap-2.5 md:grid-cols-2 xl:grid-cols-3`,f&&`min-h-0 flex-1 auto-rows-[156px] content-start`),children:[f&&(0,W.jsx)(M,{count:36}),!f&&!m&&s.map(e=>(0,W.jsx)(on,{item:e.item,record:e.record,installState:v,manageState:y,onOpen:()=>b(e.item,e.record),onInstall:x,onManage:S},e.key))]}),!f&&!m&&s.length===0&&(0,W.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:u}),o===`all`&&!f&&!m&&(0,W.jsx)(ue,{hasMore:h,loading:g,sentinelRef:_})]})}function un(e){let{entry:t,language:i,localeFallbacks:a,installState:o,layout:s=`rail`,onOpen:c,onInstall:l}=e,{item:u,record:d}=t,f=A(u.summaryI18n,u.summary,a),p=u.install.spec,m=o.installingSpecs.has(p),h=!!d;return(0,W.jsxs)(`article`,{onClick:()=>c(t),className:r(`group flex min-h-[166px] cursor-pointer flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,s===`rail`?`w-[260px] shrink-0`:`w-full min-w-0`),children:[(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,W.jsx)($t,{name:u.name,fallback:u.install.spec}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,W.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:u.name}),(0,W.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:dn(u)})]})]}),(0,W.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:f}),(0,W.jsx)(fn,{tags:u.tags})]}),(0,W.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:mn(u.updatedAt)}),h?(0,W.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,W.jsx)(z,{className:`h-3.5 w-3.5`}),hn({zh:`已安装`,en:`Installed`},i)]}):(0,W.jsxs)(`button`,{type:`button`,disabled:m,onClick:e=>{e.stopPropagation(),l(u)},className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2 text-[11px] font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 disabled:opacity-50`,children:[(0,W.jsx)(Ne,{className:`h-3.5 w-3.5`}),n(m?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function dn(e){return e.slug||e.install.spec}function fn({tags:e}){let t=e.filter(pn).slice(0,2);return t.length===0?null:(0,W.jsx)(`div`,{className:`mt-auto truncate pt-2 text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function pn(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function mn(e){return e.slice(0,10)||e}function hn(e,t){return t.startsWith(`zh`)?e.zh:e.en}var gn=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:kt,tone:`dark`,span:`md:col-span-2`},{scene:`office-collaboration`,title:{zh:`办公协作`,en:`Office Work`},summary:{zh:`连接文档、日历、会议、邮件和团队通信。`,en:`Connect docs, calendars, meetings, mail, and teams.`},icon:Ct,tone:`green`,span:`md:col-span-2`},{scene:`writing-content`,title:{zh:`写作与内容`,en:`Writing`},summary:{zh:`把调研、写作、润色和发布组织成连续工作流。`,en:`Turn research, writing, polishing, and publishing into one flow.`},icon:Ot,tone:`amber`,span:`md:col-span-2`},{scene:`browser-automation`,title:{zh:`浏览器自动化`,en:`Browser`},summary:{zh:`操作网页、捕获动态内容并验证真实用户路径。`,en:`Operate pages, capture dynamic content, and verify user paths.`},icon:Et,tone:`blue`,span:`md:col-span-2`},{scene:`local-environment`,title:{zh:`本地环境`,en:`Local`},summary:{zh:`管理终端、文件、运行时和本地服务。`,en:`Manage shells, files, runtimes, and local services.`},icon:ft,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:Dt,tone:`sky`,span:`md:col-span-1`},{scene:`nextclaw-official`,title:{zh:`NextClaw 官方`,en:`NextClaw Official`},summary:{zh:`优先查看由 NextClaw 维护的原生能力。`,en:`Browse native capabilities maintained by NextClaw.`},icon:H,tone:`teal`,span:`md:col-span-2`}],_n={icon:H,tone:`dark`,span:`md:col-span-2`},vn={dark:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-stone-600 bg-stone-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},blue:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-cyan-600 bg-cyan-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},green:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-emerald-600 bg-emerald-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},amber:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-amber-600 bg-amber-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},violet:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-violet-500 bg-violet-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},sky:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-sky-500 bg-sky-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},teal:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-teal-600 bg-teal-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`}},yn=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`;function bn(e){let{entries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=j(a),d=[...t].sort((e,t)=>Tn(e.item,t.item)).slice(0,6);return(0,W.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,W.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,W.jsx)(wn,{icon:Tt,title:q({zh:`场景`,en:`Scenes`},a),description:q({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,W.jsx)(`div`,{"data-testid":`marketplace-scenes-skeleton`,className:`grid auto-rows-[104px] grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:(0,W.jsx)(M,{count:gn.length})}):(0,W.jsx)(`div`,{className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:n.map(e=>(0,W.jsx)(xn,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||d.length>0)&&(0,W.jsx)(Cn,{icon:wt,title:q({zh:`最近更新`,en:`Recently updated`},a),description:q({zh:`看看生态最近在补齐哪些能力。`,en:`See what the ecosystem has been improving lately.`},a),entries:d,language:a,localeFallbacks:u,isLoading:i,installState:o,onOpen:s,onInstall:c})]})}function xn(e){let{scene:t,language:n,onSelect:i}=e,a=J(t.scene),o=a.icon,s=vn[a.tone];return(0,W.jsx)(`button`,{type:`button`,onClick:()=>i(t.scene),className:r(`group flex min-h-[74px] flex-col justify-center rounded-lg border px-3 py-2.5 text-left shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/70`,s.card),children:(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`span`,{className:r(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,s.icon),children:(0,W.jsx)(o,{className:`h-3.5 w-3.5`})}),(0,W.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:En(t,a,n)}),typeof t.count==`number`&&(0,W.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:On(t.count,n)})]}),(0,W.jsx)(`p`,{className:r(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,s.text),children:Dn(t,a,n)})]})})}function Sn(e){let{scene:t,entries:n,isLoading:i,language:a,localeFallbacks:o,installState:s,onBack:c,onOpen:l,onInstall:u}=e,d=J(t.scene),f=d.icon,p=vn[d.tone];return(0,W.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,W.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:c,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":q({zh:`返回`,en:`Back`},a),children:(0,W.jsx)(Se,{className:`h-4 w-4`})}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`span`,{className:r(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,W.jsx)(f,{className:`h-4 w-4`})}),(0,W.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:En(t,d,a)}),(0,W.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:q(i?{zh:`加载中`,en:`Loading`}:{zh:`${n.length} 个技能`,en:`${n.length} skills`},a)})]}),(0,W.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,W.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:Dn(t,d,a)})})]})]}),i?(0,W.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:r(yn,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,W.jsx)(M,{count:24})}):n.length>0?(0,W.jsx)(`div`,{className:yn,children:n.map(e=>(0,W.jsx)(un,{entry:e,language:a,localeFallbacks:o,installState:s,layout:`grid`,onOpen:l,onInstall:u},e.item.id))}):(0,W.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:q({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},a)})]})}function Cn(e){let{icon:t,title:n,description:r,entries:i,language:a,localeFallbacks:o,isLoading:s,installState:c,onOpen:l,onInstall:u}=e;return(0,W.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,W.jsx)(wn,{icon:t,title:n,description:r}),s?(0,W.jsx)(`div`,{"data-testid":`marketplace-recent-skeleton`,className:`-mx-1 grid auto-rows-[166px] grid-cols-[repeat(4,260px)] gap-2.5 overflow-hidden px-1 pb-1.5`,children:(0,W.jsx)(M,{count:4})}):(0,W.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,W.jsx)(un,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function wn({icon:e,title:t,description:n}){return(0,W.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,W.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,W.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function Tn(e,t){let n=Date.parse(e.updatedAt),r=Date.parse(t.updatedAt);return Number.isNaN(n)||Number.isNaN(r)?t.updatedAt.localeCompare(e.updatedAt):r-n}function q(e,t){return t.startsWith(`zh`)?e.zh:e.en}function J(e){return gn.find(t=>t.scene===e)??{scene:e,..._n}}function En(e,t,n){return t.title?q(t.title,n):e.title}function Dn(e,t,n){return t.summary?q(t.summary,n):e.description??e.scene}function On(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}function kn({label:e,className:t,onClick:n}){return(0,W.jsxs)(`button`,{type:`button`,className:r(`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-1.5 text-[13px] font-medium text-primary transition-colors hover:text-primary-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,t),onClick:n,children:[(0,W.jsx)(Ee,{className:`h-3.5 w-3.5`}),e]})}var An=`https://skillhub.cn/`;function jn(){return(0,W.jsx)(kn,{label:n(`marketplaceExternalSkillSourceTitle`),onClick:()=>void at.openExternalUrl(An)})}function Y(e){return(e??``).trim().toLowerCase()}function X(e,t){let n=Y(t);return n.length>0?`${e}:${n}`:``}function Mn(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=X(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function Nn(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=X(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function Pn(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=X(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function Fn(e,t){return t.get(X(e.type,e.spec))||t.get(X(e.type,e.id))||t.get(X(e.type,e.label))}function In(e,t,n,r){let i=Y(n);if(!i)return!0;let a=A(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>Y(e)).filter(Boolean).some(e=>e.includes(i))}function Ln(e){let{items:t,installedRecordLookup:n,scene:r,forcedType:i,typeFilter:a,scope:o,searchText:s,query:c,showListSkeleton:l,hasCatalogError:u}=e,d=qt(a===`skill`),f=(0,U.useMemo)(()=>d.data?.scenes??[],[d.data?.scenes]),p=Jt(f,a===`skill`),m=(0,U.useMemo)(()=>f.map(e=>({...e,count:typeof e.count==`number`?e.count:p.get(e.scene)})),[p,f]),h=(0,U.useMemo)(()=>t.map(e=>({item:e,record:Pn(e,n)})),[t,n]),g=(0,U.useMemo)(()=>{let e=r?.trim();if(e)return m.find(t=>t.scene===e)??{scene:e,title:e}},[r,m]),_=a===`skill`&&!!r?.trim(),v=a===`skill`&&o===`all`&&!s.trim()&&!c&&!_,y=l||t.length>=4,b=v&&!u&&y&&m.length===0&&d.isLoading;return{entries:h,scenes:m,selectedScene:g,sceneEntries:h,isSceneRoute:_,isScenesLoading:b,showShelves:v&&!u&&y&&(l||m.length>0||b),backPath:i?`/skills`:`/marketplace/skills`,pathPrefix:i?`/skills/scenes`:`/marketplace/skills/scenes`}}function Rn(){let e=Xt(),t=Zt(),{confirm:r,ConfirmDialog:i}=ze(),[a,o]=(0,U.useState)(new Set),[s,c]=(0,U.useState)(new Map);return{installState:{installingSpecs:a},manageState:{actionsByTarget:s},handleInstall:async t=>{let n=t.install.spec;if(!a.has(n)){o(e=>new Set(e).add(n));try{await e.mutateAsync({type:t.type,spec:n,kind:t.install.kind,skill:t.slug,installPath:`skills/${t.slug}`})}catch{}finally{o(e=>{let t=new Set(e);return t.delete(n),t})}}},handleManage:async(e,i)=>{let a=e===`update`?i.catalogSlug||i.id||i.spec:i.id||i.spec;if(!(!a||s.has(a))&&!(e===`uninstall`&&!await r({title:`${n(`marketplaceUninstallTitle`)} ${a}?`,description:n(`marketplaceUninstallDescription`),confirmLabel:n(`marketplaceUninstall`),variant:`destructive`}))){c(t=>new Map(t).set(a,e));try{await t.mutateAsync({type:i.type,action:e,id:a,spec:i.spec})}finally{c(e=>{let t=new Map(e);return t.delete(a),t})}}},ConfirmDialog:i}}function Z(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function zn(e){let t=e.replace(/\r\n/g,`
|
|
2
|
+
`).split(`
|
|
3
|
+
`);if(t[0]?.trim()!==`---`)return e;let n=t.findIndex((e,t)=>t>0&&e.trim()===`---`);return n>0?t.slice(n+1).join(`
|
|
4
|
+
`).trim():e}function Q(e){return Z(e).replace(/`([^`]+)`/g,`<code>$1</code>`).replace(/\*\*([^*]+)\*\*/g,`<strong>$1</strong>`).replace(/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g,`<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>`)}function Bn(e){return/^(#{1,4})\s+/.test(e)||/^([-*])\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)}function Vn(e,t,n){let r=[],i=t+1;for(;i<e.length&&!e[i]?.trim().startsWith("```");)r.push(e[i]??``),i+=1;return{html:`<div class="code-block">${n[1]?`<span class="code-language">${Z(n[1])}</span>`:``}<pre><code>${Z(r.join(`
|
|
5
|
+
`))}</code></pre></div>`,nextIndex:i+1}}function Hn(e,t){let n=Math.min(4,e[1]?.length??2);return{html:`<h${n}>${Q(e[2]??``)}</h${n}>`,nextIndex:t+1}}function Un(e,t,n){let r=[],i=t,a=n?/^\d+\.\s+/:/^[-*]\s+/;for(;i<e.length&&a.test(e[i]?.trim()??``);)r.push(`<li>${Q((e[i]??``).trim().replace(a,``))}</li>`),i+=1;return{html:n?`<ol>${r.join(``)}</ol>`:`<ul>${r.join(``)}</ul>`,nextIndex:i}}function Wn(e,t){let n=[],r=t;for(;r<e.length&&/^>\s?/.test(e[r]?.trim()??``);)n.push((e[r]??``).trim().replace(/^>\s?/,``)),r+=1;return{html:`<blockquote>${Q(n.join(` `))}</blockquote>`,nextIndex:r}}function Gn(e,t){let n=[],r=t;for(;r<e.length;){let t=e[r]?.trim()??``;if(!t||Bn(t))break;n.push(t),r+=1}return{html:`<p>${Q(n.join(` `))}</p>`,nextIndex:r}}function Kn(e,t){let n=e[t]?.trim()??``,r=n.match(/^```(\S*)/);if(r)return Vn(e,t,r);let i=n.match(/^(#{1,4})\s+(.+)$/);return i?Hn(i,t):/^[-*]\s+/.test(n)?Un(e,t,!1):/^\d+\.\s+/.test(n)?Un(e,t,!0):/^>\s?/.test(n)?Wn(e,t):Gn(e,t)}function qn(e){let t=zn(e).replace(/\r\n/g,`
|
|
6
|
+
`).split(`
|
|
7
|
+
`),n=[],r=0;for(;r<t.length;){if(!(t[r]??``).trim()){r+=1;continue}let e=Kn(t,r);n.push(e.html),r=e.nextIndex}return n.join(``)}function Jn(e){return Array.isArray(e)?e.map(e=>Jn(e)).join(`, `):e&&typeof e==`object`?JSON.stringify(e):String(e??``)}function Yn(e){try{let t=JSON.parse(e);return!t||typeof t!=`object`||Array.isArray(t)?[]:Object.entries(t).map(([e,t])=>({key:e,value:Jn(t)})).filter(e=>e.value.trim().length>0)}catch{return[]}}function Xn(e){return e.replace(/\r\n/g,`
|
|
8
|
+
`).split(`
|
|
9
|
+
`).map(e=>e.match(/^([A-Za-z0-9_.-]+):\s*(.+)$/)).filter(e=>!!e).map(e=>({key:e[1]??``,value:e[2]?.replace(/^["']|["']$/g,``)??``})).filter(e=>e.key&&e.value.trim().length>0)}function Zn(e){let t=Yn(e),n=t.length>0?t:Xn(e);return n.length===0?`<pre class="code">${Z(e)}</pre>`:`<dl class="metadata-list">${n.map(e=>`<div><dt>${Z(e.key)}</dt><dd>${Z(e.value)}</dd></div>`).join(``)}</dl>`}function $(e){let{title:t,typeLabel:n,spec:r,summary:i,description:a,metadataRaw:o,contentRaw:s,sourceUrl:c,sourceLabel:l,tags:u,author:d,loading:f}=e,p=o?.trim()||`-`,m=s?.trim()||`-`,h=i?.trim(),g=a?.trim(),_=!!g&&g!==h,v=Zn(p),y=qn(m),b=`<!doctype html>
|
|
10
|
+
<html>
|
|
11
|
+
<head>
|
|
12
|
+
<meta charset="utf-8" />
|
|
13
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
14
|
+
<title>${Z(t)}</title>
|
|
15
|
+
<style>
|
|
16
|
+
:root { color-scheme: light; }
|
|
17
|
+
body { margin: 0; background: #f9f8f5; color: #2f2212; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
|
|
18
|
+
.wrap { max-width: 940px; margin: 0 auto; padding: 24px 20px 36px; }
|
|
19
|
+
.hero { border: 1px solid #f0e2c8; border-radius: 14px; background: linear-gradient(180deg, #fff9f1 0%, #ffffff 28%); padding: 18px; box-shadow: 0 1px 3px rgba(30, 20, 10, 0.05); }
|
|
20
|
+
.hero h1 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: 0; }
|
|
21
|
+
.meta { margin-top: 7px; color: #78644d; font-size: 12px; overflow-wrap: anywhere; word-break: break-word; }
|
|
22
|
+
.summary { margin: 12px 0 0; font-size: 13px; line-height: 1.65; color: #5f5142; }
|
|
23
|
+
.grid { display: grid; grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
|
|
24
|
+
.card { border: 1px solid #eee3d1; background: #fffdf9; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 2px rgba(30, 20, 10, 0.035); }
|
|
25
|
+
.card h2 { margin: 0; padding: 11px 13px; font-size: 12px; font-weight: 650; color: #3f472f; border-bottom: 1px solid #f1e7d4; background: #fffaf2; }
|
|
26
|
+
.card .body { padding: 12px 13px; font-size: 12px; color: #4e463d; line-height: 1.65; }
|
|
27
|
+
.code { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; line-height: 1.55; margin: 0; }
|
|
28
|
+
.metadata-list { margin: 0; }
|
|
29
|
+
.metadata-list div { display: grid; grid-template-columns: minmax(72px, 0.36fr) minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid #f2eadc; }
|
|
30
|
+
.metadata-list div:last-child { border-bottom: 0; }
|
|
31
|
+
.metadata-list dt { color: #7a5a24; font-weight: 650; overflow-wrap: anywhere; }
|
|
32
|
+
.metadata-list dd { margin: 0; color: #4e463d; overflow-wrap: anywhere; }
|
|
33
|
+
.markdown { font-size: 13px; line-height: 1.68; }
|
|
34
|
+
.markdown > *:first-child { margin-top: 0; }
|
|
35
|
+
.markdown > *:last-child { margin-bottom: 0; }
|
|
36
|
+
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { margin: 18px 0 8px; color: #2f2212; line-height: 1.25; letter-spacing: 0; }
|
|
37
|
+
.markdown h1 { font-size: 20px; }
|
|
38
|
+
.markdown h2 { font-size: 17px; }
|
|
39
|
+
.markdown h3 { font-size: 15px; }
|
|
40
|
+
.markdown h4 { font-size: 13px; }
|
|
41
|
+
.markdown p { margin: 10px 0; }
|
|
42
|
+
.markdown ul, .markdown ol { margin: 10px 0; padding-left: 20px; }
|
|
43
|
+
.markdown li { margin: 5px 0; }
|
|
44
|
+
.markdown blockquote { margin: 12px 0; padding: 8px 12px; border-left: 3px solid #d9b56f; border-radius: 8px; background: #fff7ea; color: #6d5841; }
|
|
45
|
+
.markdown code { border: 1px solid #eadcc6; border-radius: 5px; background: #fff7ea; padding: 1px 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: #6b4b16; }
|
|
46
|
+
.markdown a { color: #5f6b45; text-decoration: none; font-weight: 600; }
|
|
47
|
+
.markdown a:hover { text-decoration: underline; }
|
|
48
|
+
.code-block { position: relative; margin: 12px 0; overflow: hidden; border: 1px solid #eadcc6; border-radius: 10px; background: #2f2a24; }
|
|
49
|
+
.code-block pre { margin: 0; overflow-x: auto; padding: 13px; }
|
|
50
|
+
.code-block code { border: 0; border-radius: 0; background: transparent; padding: 0; color: #f7efe3; }
|
|
51
|
+
.code-language { position: absolute; right: 10px; top: 8px; color: #d8c3a0; font-size: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
|
|
52
|
+
.tags { margin-top: 10px; }
|
|
53
|
+
.tag { display: inline-block; margin: 0 6px 6px 0; padding: 4px 8px; border: 1px solid #ecd9b5; border-radius: 999px; background: #fff7ea; color: #7a5a24; font-size: 11px; }
|
|
54
|
+
.source { color: #5f6b45; text-decoration: none; overflow-wrap: anywhere; word-break: break-all; }
|
|
55
|
+
.source:hover { text-decoration: underline; }
|
|
56
|
+
.skeleton { display: block; border-radius: 8px; background: linear-gradient(90deg, #f0e6d6 0%, #fffaf2 42%, #f0e6d6 78%); background-size: 220% 100%; animation: shimmer 1.35s ease-in-out infinite; }
|
|
57
|
+
.detail-skeleton .hero { padding: 18px; }
|
|
58
|
+
.sk-title { width: 52%; height: 24px; }
|
|
59
|
+
.sk-meta { width: 78%; height: 12px; margin-top: 12px; }
|
|
60
|
+
.sk-line { height: 12px; margin-top: 12px; }
|
|
61
|
+
.sk-line.short { width: 62%; }
|
|
62
|
+
.sk-line.mid { width: 82%; }
|
|
63
|
+
.sk-body { height: 220px; margin: 13px; }
|
|
64
|
+
@keyframes shimmer { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
|
|
65
|
+
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
|
|
66
|
+
</style>
|
|
67
|
+
</head>
|
|
68
|
+
<body>
|
|
69
|
+
<main class="wrap${f?` detail-skeleton`:``}"${f?` aria-busy="true"`:``}>
|
|
70
|
+
${f?`
|
|
71
|
+
<section class="hero">
|
|
72
|
+
<span class="skeleton sk-title"></span>
|
|
73
|
+
<span class="skeleton sk-meta"></span>
|
|
74
|
+
<span class="skeleton sk-line mid"></span>
|
|
75
|
+
<span class="skeleton sk-line"></span>
|
|
76
|
+
<span class="skeleton sk-line short"></span>
|
|
77
|
+
</section>
|
|
78
|
+
<section class="grid">
|
|
79
|
+
<article class="card"><span class="skeleton sk-body"></span></article>
|
|
80
|
+
<article class="card"><span class="skeleton sk-body"></span></article>
|
|
81
|
+
</section>
|
|
82
|
+
`:`
|
|
83
|
+
<section class="hero">
|
|
84
|
+
<h1>${Z(t)}</h1>
|
|
85
|
+
<div class="meta">${Z(n)} · ${Z(r)}${d?` · ${Z(d)}`:``}</div>
|
|
86
|
+
${h?`<p class="summary">${Z(h)}</p>`:``}
|
|
87
|
+
${_?`<p class="summary">${Z(g)}</p>`:``}
|
|
88
|
+
${u&&u.length>0?`<div class="tags">${u.map(e=>`<span class="tag">${Z(e)}</span>`).join(``)}</div>`:``}
|
|
89
|
+
${c?`<p class="meta" style="margin-top:12px;">${Z(l??`Source`)}: <a class="source" href="${Z(c)}" target="_blank" rel="noopener noreferrer">${Z(c)}</a></p>`:``}
|
|
90
|
+
</section>
|
|
91
|
+
|
|
92
|
+
<section class="grid">
|
|
93
|
+
<article class="card">
|
|
94
|
+
<h2>Metadata</h2>
|
|
95
|
+
<div class="body">${v}</div>
|
|
96
|
+
</article>
|
|
97
|
+
<article class="card">
|
|
98
|
+
<h2>Content</h2>
|
|
99
|
+
<div class="body markdown">${y}</div>
|
|
100
|
+
</article>
|
|
101
|
+
</section>
|
|
102
|
+
`}
|
|
103
|
+
</main>
|
|
104
|
+
</body>
|
|
105
|
+
</html>`;return`data:text/html;charset=utf-8,${encodeURIComponent(b)}`}function Qn(e){let t=Oe(),r=(0,U.useRef)({byKey:new Map,seq:0});return{openItemDetail:async(i,a)=>{let o=i?.name??a?.label??a?.id??a?.spec??n(`marketplaceUnknownItem`),s=i?`marketplace:${i.type}:${i.slug}`:`marketplace:${a?.type??`unknown`}:${a?.id??a?.spec??o}`,c={title:o,kind:`content`,dedupeKey:s},l={...c,activate:!1},u=n(`marketplaceTypeSkill`);if(!i){t.open($({title:o,typeLabel:u,spec:a?.spec??`-`,summary:n(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(a??{},null,2),contentRaw:`-`}),c);return}let d=r.current.seq+1;r.current.seq=d,r.current.byKey.set(s,d);let f=A(i.summaryI18n,i.summary,e);t.open($({title:o,typeLabel:u,spec:i.install.spec,loading:!0}),c);try{let e=await D(i.slug);if(r.current.byKey.get(s)!==d)return;t.open($({title:o,typeLabel:u,spec:i.install.spec,summary:f,metadataRaw:e.metadataRaw,contentRaw:e.bodyRaw||e.raw,sourceUrl:e.sourceUrl,sourceLabel:`Source (${e.source})`,tags:i.tags,author:i.author}),l)}catch(e){if(r.current.byKey.get(s)!==d)return;t.open($({title:o,typeLabel:u,spec:i.install.spec,summary:f,metadataRaw:JSON.stringify({error:e instanceof Error?e.message:String(e)},null,2),contentRaw:n(`marketplaceOperationFailed`)}),l)}}}}function $n(e){let{scope:t,typeFilter:r,query:i,localeFallbacks:a,catalogView:o,installedView:s,isCatalogLoading:c,isCatalogFetching:l,isCatalogFetchingNextPage:u,catalogError:d,isInstalledLoading:f,installedError:p}=e,m=(0,U.useMemo)(()=>s?.records??[],[s?.records]),h=(0,U.useMemo)(()=>o?.items??[],[o?.items]),g=(0,U.useMemo)(()=>Mn(h),[h]),_=(0,U.useMemo)(()=>Nn(m),[m]),v=(0,U.useMemo)(()=>m.filter(e=>e.type===r).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:Fn(e,g)})).filter(e=>In(e.record,e.item,i,a)).sort((e,t)=>er(e.record,t.record)),[m,r,g,i,a]),y=(0,U.useMemo)(()=>t===`installed`?v:h.map(e=>({key:e.id,item:e,record:Pn(e,_)})),[h,v,_,t]),b=t===`all`&&c&&!o||t===`installed`&&f&&!s,x=t===`all`&&!b&&!!o&&l&&!u,S=t===`installed`?f&&!s?n(`loading`):`${v.length} ${n(`marketplaceInstalledSkillsCountSuffix`)}`:o?`${h.length} / ${o.total}`:n(`loading`),C=t===`all`&&d?d:t===`installed`&&p?p:void 0,w={scope:t,entries:y,header:{title:n(t===`installed`?`marketplaceSectionInstalledSkills`:`marketplaceAllSkills`),summary:S,refreshingLabel:n(`marketplaceRefreshingResults`)},status:{showSkeleton:b,isRefreshing:x,error:C},emptyLabel:n(t===`installed`?`marketplaceNoInstalledSkills`:`marketplaceNoSkills`),errorLabel:n(t===`installed`?`marketplaceErrorLoadingInstalledSkills`:`marketplaceErrorLoadingSkillsData`)};return{allItems:h,installedRecordLookup:_,installedTotal:s?.total??0,itemListView:w,showListSkeleton:b,isRefreshingList:x}}function er(e,t){let n=Date.parse(e.installedAt??``),r=Date.parse(t.installedAt??``);return Number.isNaN(n)||Number.isNaN(r)||n===r?e.spec.localeCompare(t.spec):r-n}var tr=20;function nr({forcedType:e}={}){let t=V(),r=Ae(),{language:i}=qe(),a=`skill`,o=(0,U.useMemo)(()=>j(i),[i]),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(``),[d,f]=(0,U.useState)(`all`),[p,m]=(0,U.useState)(`relevance`),{installState:h,manageState:_,handleInstall:v,handleManage:y,ConfirmDialog:b}=Rn(),{openItemDetail:x}=Qn(o);(0,U.useEffect)(()=>{let e=setTimeout(()=>{u(s.trim())},250);return()=>clearTimeout(e)},[s]);let S=Yt(a),C=a===`skill`?r.scene?.trim():void 0,w=Gt({q:C?void 0:l||void 0,scene:C,type:a,sort:p,pageSize:tr}),{containerRef:T,sentinelRef:E}=le({disabled:d!==`all`||w.isError||!w.hasNextPage||w.isFetchingNextPage,onLoadMore:()=>w.fetchNextPage(),watchValue:`${a}:${d}:${l}:${C??``}:${p}:${w.data?.loadedItems??0}:${w.data?.loadedPages??0}`});(0,U.useEffect)(()=>{let e=T.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[T,l,C,d,p,a]);let D=$n({scope:d,typeFilter:a,query:l,localeFallbacks:o,catalogView:w.data,installedView:S.data,isCatalogLoading:w.isLoading,isCatalogFetching:w.isFetching,isCatalogFetchingNextPage:w.isFetchingNextPage,catalogError:w.isError?w.error:void 0,isInstalledLoading:S.isLoading,installedError:S.isError?S.error:void 0}),O=Ln({items:D.allItems,installedRecordLookup:D.installedRecordLookup,scene:C,forcedType:e,typeFilter:a,scope:d,searchText:s,query:l,showListSkeleton:D.showListSkeleton,hasCatalogError:w.isError});return(0,W.jsxs)(g,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!O.isSceneRoute&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3 border-b border-gray-200/60`,children:[(0,W.jsx)(pt,{value:d,onValueChange:e=>f(e),children:(0,W.jsxs)(Me,{className:`mb-0 h-auto flex-1 justify-start gap-6 rounded-none border-b-0 bg-transparent p-0 text-gray-500`,children:[(0,W.jsx)(dt,{value:`all`,className:`rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:n(`marketplaceTabMarketplaceSkills`)}),(0,W.jsxs)(dt,{value:`installed`,className:`gap-1.5 rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:[n(`marketplaceTabInstalledSkills`),(0,W.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:D.installedTotal})]})]})}),(0,W.jsx)(jn,{})]}),(0,W.jsx)(oe,{scope:d,searchText:s,isRefreshing:D.isRefreshingList,searchPlaceholder:n(`marketplaceSearchPlaceholderSkills`),sort:p,onSearchTextChange:c,onSortChange:m})]}),(0,W.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,W.jsxs)(`div`,{ref:T,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":D.showListSkeleton||w.isFetchingNextPage,children:[O.isSceneRoute&&O.selectedScene&&(0,W.jsx)(Sn,{scene:O.selectedScene,entries:O.sceneEntries,isLoading:D.showListSkeleton,language:i,localeFallbacks:o,installState:h,onBack:()=>t(O.backPath),onOpen:e=>void x(e.item,e.record),onInstall:v}),O.isSceneRoute&&!D.showListSkeleton&&(0,W.jsx)(ue,{hasMore:!!w.hasNextPage,loading:w.isFetchingNextPage,sentinelRef:E}),O.showShelves&&(0,W.jsx)(bn,{entries:O.entries,scenes:O.scenes,isScenesLoading:O.isScenesLoading,isItemsLoading:D.showListSkeleton,language:i,installState:h,onOpen:e=>void x(e.item,e.record),onInstall:v,onOpenScene:e=>t(`${O.pathPrefix}/${e}`)}),!O.isSceneRoute&&(0,W.jsx)(ln,{model:D.itemListView,showTitle:O.showShelves||!D.showListSkeleton,operationState:{installState:h,manageState:_},scroll:{hasMore:!!w.hasNextPage,loadingMore:w.isFetchingNextPage,sentinelRef:E},actions:{onOpen:(e,t)=>void x(e,t),onInstall:v,onManage:y}})]})}),(0,W.jsx)(b,{})]})}function rr(e){let{view:t,routeSessionKey:n,syncRouteSessionSelection:r}=e;(0,U.useEffect)(()=>{r({isChatView:t===`chat`,routeSessionKey:n})},[n,r,t])}function ir({view:e,confirmDialog:t}){let{isMobile:n}=Je();return(0,W.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,W.jsx)(Ke,{}),e===`chat`?n?(0,W.jsx)(nt,{}):(0,W.jsx)(lt,{}):(0,W.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-background`,children:e===`cron`?(0,W.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,W.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,W.jsx)(Re,{})})}):e===`agents`?(0,W.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,W.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1180px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,W.jsx)(Bt,{})})}):(0,W.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,W.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-[min(1120px,100%)] flex-col px-4 py-4 sm:px-6 sm:py-5`,children:(0,W.jsx)(nr,{forcedType:`skills`})})})}),t]})}function ar(e){let t=B(),n=gt(),r=_t(),i=ht(),a=Pe({limit:200}),o=tt(),s=e.sessionKey?.trim()||`draft-session`,c=We({sessionId:s});(0,U.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 or(){let e=B();(0,U.useEffect)(()=>C.eventBus.on(O.uiShowContent,t=>{e.chatThreadManager.handleUiShowContentEvent(t)}),[e])}function sr(){let{sessionId:e}=Ae(),t=(0,U.useMemo)(()=>Ze(e),[e]);return{routeSessionKey:t,sessionKey:t??void 0}}function cr(){let e=B(),{confirm:t,ConfirmDialog:n}=ze(),r=He(),i=V();return(0,U.useEffect)(()=>{e.chatUiManager.syncState({pathname:r.pathname}),e.chatUiManager.bindActions({navigate:i,confirm:t})},[t,r.pathname,i,e]),(0,W.jsx)(n,{})}function lr({view:e}){let t=ct(),[n]=(0,U.useState)(()=>new ot(t));return(0,W.jsx)(je,{presenter:n,children:(0,W.jsx)(ur,{view:e})})}function ur({view:e}){let t=B(),n=cr(),{routeSessionKey:r,sessionKey:i}=sr();return ar({sessionKey:i??null}),rr({view:e,routeSessionKey:r,syncRouteSessionSelection:t.chatSessionListManager.syncRouteSessionSelection}),or(),(0,W.jsx)(ir,{view:e,confirmDialog:n})}function dr({view:e}){return(0,W.jsx)(lr,{view:e})}export{dr as ChatPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as e,p as t,r as n,u as r,v as i}from"./react-VNqT5Zp7.js";import{n as a}from"./search-BEti5beA.js";var o=i(e(),1),s=t(),c=`min-w-0 overflow-hidden rounded-2xl border border-border bg-card text-card-foreground shadow-card xl:h-[calc(100vh-180px)] xl:max-h-[860px]`;function l({className:e,...t}){return(0,s.jsx)(`section`,{className:r(c,`flex flex-col`,e),...t})}function u({className:e,children:t,mobileView:i,onMobileBack:c,mobileListLabel:l,...u}){let[d,f,...p]=o.Children.toArray(t);return i&&d&&f?(0,s.jsx)(`div`,{className:r(`grid min-h-0 grid-cols-1 gap-4`,e),...u,children:i===`detail`?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`div`,{className:`shrink-0`,children:(0,s.jsxs)(`button`,{type:`button`,onClick:c,className:`inline-flex items-center gap-2 rounded-full border border-border bg-card px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground`,children:[(0,s.jsx)(a,{className:`h-4 w-4`}),(0,s.jsx)(`span`,{children:l??n(`backToMain`)})]})}),f,p]}):(0,s.jsxs)(s.Fragment,{children:[d,p]})}):(0,s.jsx)(`div`,{className:r(`grid min-h-0 grid-cols-1 gap-5 xl:flex-1 xl:grid-cols-[340px_minmax(0,1fr)]`,e),...u,children:t})}function d({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 f({className:e,...t}){return(0,s.jsx)(`div`,{className:r(`shrink-0 border-b border-border/70`,e),...t})}function p({className:e,scrollOnDesktop:t=!0,...n}){return(0,s.jsx)(`div`,{className:r(`min-h-0 flex-1`,t&&`overflow-visible xl:overflow-y-auto xl:overscroll-contain`,e),...n})}function m({className:e,...t}){return(0,s.jsx)(`div`,{className:r(`shrink-0 border-t border-border/70`,e),...t})}function h({active:e=!1,className:t,type:n=`button`,...i}){return(0,s.jsx)(`button`,{type:n,className:r(`w-full rounded-xl border p-2.5 text-left transition-all`,e?`border-primary/35 bg-primary-50/45 text-foreground shadow-sm`:`border-border bg-card text-muted-foreground hover:border-primary/35 hover:bg-accent/70 hover:text-accent-foreground`,t),...i})}function g({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 border border-dashed border-border bg-muted/60 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{l as a,f as c,u as i,d as n,p as o,g as r,m as s,h as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{h as e,p as t,r as n,u as r,v as i}from"./react-
|
|
1
|
+
import{h as e,p as t,r as n,u as r,v as i}from"./react-VNqT5Zp7.js";import{Vt as a}from"./api-BP_8IaxB.js";import{b as o,f as s,g as c,h as l,l as u,p as d,u as f,v as ee,x as p,y as te}from"./dist-PVA_xL1D.js";import{D as m,E as ne,O as re,T as h}from"./select-hoj8dK4K.js";import{t as g}from"./dist-CikkhOlq.js";import{t as ie}from"./x-D9PXs_xP.js";var _=i(e(),1),v=t(),y=`Dialog`,[b,ae]=te(y),[oe,x]=b(y),S=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=_.useRef(null),u=_.useRef(null),[d,f]=l({prop:r,defaultProp:i??!1,onChange:a,caller:y});return(0,v.jsx)(oe,{scope:t,triggerRef:s,contentRef:u,contentId:c(),titleId:c(),descriptionId:c(),open:d,onOpenChange:f,onOpenToggle:_.useCallback(()=>f(e=>!e),[f]),modal:o,children:n})};S.displayName=y;var C=`DialogTrigger`,se=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=x(C,n),a=o(t,i.triggerRef);return(0,v.jsx)(s.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":B(i.open),...r,ref:a,onClick:p(e.onClick,i.onOpenToggle)})});se.displayName=C;var w=`DialogPortal`,[ce,T]=b(w,{forceMount:void 0}),E=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=x(w,t);return(0,v.jsx)(ce,{scope:t,forceMount:n,children:_.Children.map(r,e=>(0,v.jsx)(g,{present:n||a.open,children:(0,v.jsx)(u,{asChild:!0,container:i,children:e})}))})};E.displayName=w;var D=`DialogOverlay`,O=_.forwardRef((e,t)=>{let n=T(D,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=x(D,e.__scopeDialog);return a.modal?(0,v.jsx)(g,{present:r||a.open,children:(0,v.jsx)(k,{...i,ref:t})}):null});O.displayName=D;var le=d(`DialogOverlay.RemoveScroll`),k=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=x(D,n);return(0,v.jsx)(ne,{as:le,allowPinchZoom:!0,shards:[i.contentRef],children:(0,v.jsx)(s.div,{"data-state":B(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),A=`DialogContent`,j=_.forwardRef((e,t)=>{let n=T(A,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=x(A,e.__scopeDialog);return(0,v.jsx)(g,{present:r||a.open,children:a.modal?(0,v.jsx)(ue,{...i,ref:t}):(0,v.jsx)(M,{...i,ref:t})})});j.displayName=A;var ue=_.forwardRef((e,t)=>{let n=x(A,e.__scopeDialog),r=_.useRef(null),i=o(t,n.contentRef,r);return _.useEffect(()=>{let e=r.current;if(e)return h(e)},[]),(0,v.jsx)(N,{...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())})}),M=_.forwardRef((e,t)=>{let n=x(A,e.__scopeDialog),r=_.useRef(!1),i=_.useRef(!1);return(0,v.jsx)(N,{...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()}})}),N=_.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...s}=e,c=x(A,n),l=_.useRef(null),u=o(t,l);return m(),(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(re,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,v.jsx)(f,{role:`dialog`,id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":B(c.open),...s,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(fe,{titleId:c.titleId}),(0,v.jsx)(me,{contentRef:l,descriptionId:c.descriptionId})]})]})}),P=`DialogTitle`,F=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=x(P,n);return(0,v.jsx)(s.h2,{id:i.titleId,...r,ref:t})});F.displayName=P;var I=`DialogDescription`,L=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=x(I,n);return(0,v.jsx)(s.p,{id:i.descriptionId,...r,ref:t})});L.displayName=I;var R=`DialogClose`,z=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=x(R,n);return(0,v.jsx)(s.button,{type:`button`,...r,ref:t,onClick:p(e.onClick,()=>i.onOpenChange(!1))})});z.displayName=R;function B(e){return e?`open`:`closed`}var V=`DialogTitleWarning`,[de,H]=ee(V,{contentName:A,titleName:P,docsSlug:`dialog`}),fe=({titleId:e})=>{let t=H(V),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 _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},pe=`DialogDescriptionWarning`,me=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${H(pe).contentName}}.`;return _.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},he=S,ge=E,U=O,W=j,G=F,K=L,_e=z,q=he,ve=ge,J=_.forwardRef(({className:e,...t},n)=>(0,v.jsx)(U,{ref:n,className:r(`fixed inset-0 z-50 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=U.displayName;var Y=_.forwardRef(({className:e,children:t,...n},i)=>(0,v.jsxs)(ve,{children:[(0,v.jsx)(J,{}),(0,v.jsxs)(W,{ref:i,className:r(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-
|
|
5
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},pe=`DialogDescriptionWarning`,me=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${H(pe).contentName}}.`;return _.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},he=S,ge=E,U=O,W=j,G=F,K=L,_e=z,q=he,ve=ge,J=_.forwardRef(({className:e,...t},n)=>(0,v.jsx)(U,{ref:n,className:r(`fixed inset-0 z-50 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=U.displayName;var Y=_.forwardRef(({className:e,children:t,...n},i)=>(0,v.jsxs)(ve,{children:[(0,v.jsx)(J,{}),(0,v.jsxs)(W,{ref:i,className:r(`fixed left-[50%] top-[50%] z-50 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,v.jsxs)(_e,{className:`absolute right-4 top-4 rounded-lg p-1 opacity-70 ring-offset-background transition-all duration-fast hover:bg-accent hover:text-accent-foreground hover:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:pointer-events-none`,children:[(0,v.jsx)(ie,{className:`h-4 w-4 text-muted-foreground`}),(0,v.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Y.displayName=W.displayName;var X=({className:e,...t})=>(0,v.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,v.jsx)(`div`,{className:r(`flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-3`,e),...t});Z.displayName=`DialogFooter`;var Q=_.forwardRef(({className:e,...t},n)=>(0,v.jsx)(G,{ref:n,className:r(`text-lg font-semibold leading-tight tracking-tight text-foreground`,e),...t}));Q.displayName=G.displayName;var $=_.forwardRef(({className:e,...t},n)=>(0,v.jsx)(K,{ref:n,className:r(`text-sm text-muted-foreground leading-relaxed`,e),...t}));$.displayName=K.displayName;var ye=({open:e,onOpenChange:t,title:r,description:i,confirmLabel:o=n(`confirm`),cancelLabel:s=n(`cancel`),variant:c=`default`,onConfirm:l,onCancel:u})=>(0,v.jsx)(q,{open:e,onOpenChange:t,children:(0,v.jsxs)(Y,{className:`[&>:last-child]:hidden`,onCloseAutoFocus:e=>e.preventDefault(),children:[(0,v.jsxs)(X,{children:[(0,v.jsx)(Q,{children:r}),i?(0,v.jsx)($,{children:i}):null]}),(0,v.jsxs)(Z,{className:`gap-2 sm:gap-0`,children:[(0,v.jsx)(a,{type:`button`,variant:`outline`,onClick:()=>{u(),t(!1)},children:s}),(0,v.jsx)(a,{type:`button`,variant:c===`destructive`?`destructive`:`default`,onClick:()=>{l(),t(!1)},children:o})]})]})});export{Z as a,$ as i,q as n,X as o,Y as r,Q as s,ye as t};
|
package/ui-dist/assets/{desktop-update-config-DsRhBizi.js → desktop-update-config-B0w9p2ep.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,p as t,r as n,u as r}from"./react-
|
|
1
|
+
import{n as e,p as t,r as n,u as r}from"./react-VNqT5Zp7.js";import{Ft as i,It as a,Lt as o,Mt as s,Nt as c,Pt as l,Rt as u,Vt as d,_t as f,vt as p,yt as m,zt as h}from"./api-BP_8IaxB.js";import{a as g,i as _,n as v,r as y,t as b}from"./select-hoj8dK4K.js";import{t as x}from"./external-link-DVJIQf_G.js";import{t as S}from"./rotate-cw-DjHDTkCv.js";import{Ct as C,ft as w,q as T}from"./index-D9BAE_L_.js";var E=t(),D={checking:`desktopUpdatesStatusChecking`,"update-available":`desktopUpdatesStatusAvailable`,downloading:`desktopUpdatesStatusDownloading`,downloaded:`desktopUpdatesStatusDownloaded`,"up-to-date":`desktopUpdatesStatusUpToDate`,blocked:`desktopUpdatesStatusBlocked`,failed:`desktopUpdatesStatusFailed`};function O({status:e}){return(0,E.jsx)(`span`,{className:r(`inline-flex rounded-full px-3 py-1 text-xs font-medium ring-1`,R(e)),children:L(e)})}function k({label:e,value:t}){return(0,E.jsxs)(`div`,{className:`rounded-xl border border-gray-200 bg-gray-50/60 p-4`,children:[(0,E.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-gray-500`,children:e}),(0,E.jsx)(`p`,{className:`mt-2 text-base font-semibold text-gray-900`,children:t})]})}function A({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=P(e.progress?.downloadedBytes??0,e.progress?.totalBytes??null);return(0,E.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,E.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:r}),(0,E.jsx)(`p`,{className:`text-xs font-medium text-amber-700`,children:i})]}),(0,E.jsx)(`div`,{className:`mt-3 h-2 overflow-hidden rounded-full bg-amber-100`,children:(0,E.jsx)(`div`,{className:`h-full rounded-full bg-amber-500 transition-[width]`,style:{width:`${t??0}%`}})})]})}function j({label:e,help:t,checked:n,disabled:r,onCheckedChange:i}){return(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-4 rounded-xl border border-gray-200 p-4`,children:[(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(h,{children:e}),(0,E.jsx)(`p`,{className:`text-sm text-gray-500`,children:t})]}),(0,E.jsx)(f,{checked:n,disabled:r,onCheckedChange:i})]})}function M(e){return e?.trim()||`-`}function N(t){return t?e(t):`-`}function P(e,t){let n=F(e);return t&&t>0?`${n} / ${F(t)}`:n}function F(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 I(e){return n(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}function L(e){return n(D[e]??`desktopUpdatesStatusIdle`)}function R(e){return e===`downloaded`?`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 z(){return(0,E.jsxs)(u,{className:`space-y-6`,children:[(0,E.jsx)(o,{title:n(`runtimeUpdatesPageTitle`),description:n(`runtimeUpdatesPageDescription`)}),(0,E.jsxs)(s,{children:[(0,E.jsxs)(i,{children:[(0,E.jsx)(a,{children:n(`runtimeUpdatesUnavailableTitle`)}),(0,E.jsx)(l,{children:n(`runtimeUpdatesUnavailableDescription`)})]}),(0,E.jsx)(c,{children:(0,E.jsx)(`p`,{className:`text-sm text-gray-500`,children:n(`runtimeUpdatesUnavailableHint`)})})]})]})}function B(){let{supported:e,initialized:t,busyAction:f,snapshot:D}=m();if(!t)return(0,E.jsx)(`div`,{className:`p-8 text-gray-400`,children:n(`loading`)});if(!e||!D)return(0,E.jsx)(z,{});let P=f===`checking`,F=f===`downloading`,L=f===`applying`,R=f===`saving-preferences`,B=f===`switching-channel`,V=D.status===`update-available`&&!F&&!L,H=D.status===`downloaded`&&!L,U=[[n(`runtimeUpdatesHostVersion`),M(D.hostVersion)],[n(`desktopUpdatesCurrentBundleVersion`),M(D.currentVersion)],[n(`desktopUpdatesAvailableVersion`),M(D.availableVersion)],[n(`desktopUpdatesLastCheckedAt`),N(D.lastCheckedAt)],[n(`desktopUpdatesCurrentChannel`),I(D.channel)]];return(0,E.jsxs)(u,{className:`space-y-6`,children:[(0,E.jsx)(o,{title:n(`runtimeUpdatesPageTitle`),description:n(`runtimeUpdatesPageDescription`),actions:(0,E.jsxs)(d,{variant:`outline`,onClick:()=>void p.checkForUpdates(),disabled:P||F||L,children:[(0,E.jsx)(w,{className:r(`mr-2 h-4 w-4`,P&&`animate-spin`)}),n(`desktopUpdatesCheckNow`)]})}),(0,E.jsxs)(s,{children:[(0,E.jsxs)(i,{children:[(0,E.jsx)(a,{children:n(`desktopUpdatesOverviewTitle`)}),(0,E.jsx)(l,{children:n(`desktopUpdatesOverviewDescription`)})]}),(0,E.jsxs)(c,{className:`space-y-5`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,E.jsx)(`span`,{className:`text-sm font-medium text-gray-700`,children:n(`desktopUpdatesStatusLabel`)}),(0,E.jsx)(O,{status:D.status})]}),(0,E.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-5`,children:U.map(([e,t])=>(0,E.jsx)(k,{label:e,value:t},e))}),D.channel===`beta`?(0,E.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,E.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:n(`desktopUpdatesBetaBadgeTitle`)}),(0,E.jsx)(`p`,{className:`mt-1 text-sm text-amber-700`,children:n(`desktopUpdatesBetaBadgeDescription`)})]}):null,D.downloadedVersion?(0,E.jsxs)(`div`,{className:`rounded-2xl border border-emerald-200 bg-emerald-50/70 p-4`,children:[(0,E.jsx)(`p`,{className:`text-sm font-semibold text-emerald-800`,children:n(`desktopUpdatesDownloadedBannerTitle`)}),(0,E.jsx)(`p`,{className:`mt-1 text-sm text-emerald-700`,children:n(`runtimeUpdatesDownloadedBannerDescription`).replace(`{version}`,D.downloadedVersion)})]}):null,(0,E.jsx)(A,{snapshot:D}),D.status===`blocked`?(0,E.jsxs)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4`,children:[(0,E.jsx)(`p`,{className:`text-sm font-semibold text-red-800`,children:n(`desktopUpdatesBlockedTitle`)}),(0,E.jsx)(`p`,{className:`mt-1 text-sm text-red-700`,children:D.errorMessage??n(`desktopUpdatesBlockedDescription`)}),D.recoveryCommand?(0,E.jsx)(`code`,{className:`mt-3 block rounded-lg bg-white/70 px-3 py-2 text-xs text-red-800`,children:D.recoveryCommand}):null]}):null,D.errorMessage&&D.status!==`blocked`?(0,E.jsx)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4 text-sm text-red-700`,children:D.errorMessage}):null]})]}),(0,E.jsxs)(s,{children:[(0,E.jsxs)(i,{children:[(0,E.jsx)(a,{children:n(`desktopUpdatesPreferencesTitle`)}),(0,E.jsx)(l,{children:n(`desktopUpdatesPreferencesDescription`)})]}),(0,E.jsxs)(c,{className:`space-y-5`,children:[(0,E.jsx)(`div`,{className:`rounded-xl border border-gray-200 p-4`,children:(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(h,{children:n(`desktopUpdatesReleaseChannel`)}),(0,E.jsx)(`p`,{className:`text-sm text-gray-500`,children:n(`desktopUpdatesReleaseChannelHelp`)})]}),(0,E.jsxs)(b,{value:D.channel,disabled:B||P||F||L,onValueChange:e=>void p.updateChannel(e),children:[(0,E.jsx)(_,{className:`w-full max-w-sm`,children:(0,E.jsx)(g,{placeholder:n(`desktopUpdatesReleaseChannel`)})}),(0,E.jsxs)(v,{children:[(0,E.jsx)(y,{value:`stable`,children:n(`desktopUpdatesChannelStable`)}),(0,E.jsx)(y,{value:`beta`,children:n(`desktopUpdatesChannelBeta`)})]})]}),(0,E.jsx)(`p`,{className:`text-sm text-gray-500`,children:n(`desktopUpdatesReleaseChannelDowngradeHint`)})]})}),(0,E.jsx)(j,{label:n(`desktopUpdatesAutomaticChecks`),help:n(`desktopUpdatesAutomaticChecksHelp`),checked:D.preferences.automaticChecks,disabled:R||B,onCheckedChange:e=>void p.updatePreferences({automaticChecks:e})}),(0,E.jsx)(j,{label:n(`desktopUpdatesAutoDownload`),help:n(`desktopUpdatesAutoDownloadHelp`),checked:D.preferences.autoDownload,disabled:R||B,onCheckedChange:e=>void p.updatePreferences({autoDownload:e})})]})]}),(0,E.jsxs)(s,{children:[(0,E.jsxs)(i,{children:[(0,E.jsx)(a,{children:n(`desktopUpdatesActionsTitle`)}),(0,E.jsx)(l,{children:n(`runtimeUpdatesActionsDescription`)})]}),(0,E.jsxs)(c,{className:`flex flex-wrap items-center gap-3`,children:[(0,E.jsxs)(d,{variant:`outline`,onClick:()=>void p.checkForUpdates(),disabled:P||F||L,children:[(0,E.jsx)(w,{className:r(`mr-2 h-4 w-4`,P&&`animate-spin`)}),n(`desktopUpdatesCheckNow`)]}),(0,E.jsxs)(d,{onClick:()=>void p.downloadUpdate(),disabled:!V,children:[(0,E.jsx)(C,{className:r(`mr-2 h-4 w-4`,F&&`animate-bounce`)}),n(`desktopUpdatesDownloadNow`)]}),(0,E.jsxs)(d,{variant:`secondary`,onClick:()=>void p.applyDownloadedUpdate(),disabled:!H,children:[(0,E.jsx)(S,{className:r(`mr-2 h-4 w-4`,L&&`animate-spin`)}),n(`runtimeUpdatesApplyNow`)]}),D.releaseNotesUrl?(0,E.jsxs)(d,{variant:`ghost`,onClick:()=>void T.openExternalUrl(D.releaseNotesUrl??``),children:[(0,E.jsx)(x,{className:`mr-2 h-4 w-4`}),n(`desktopUpdatesReleaseNotes`)]}):null]})]})]})}export{B as DesktopUpdateConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e,v as t}from"./react-
|
|
1
|
+
import{h as e,v as t}from"./react-VNqT5Zp7.js";import{_ as n,b as r}from"./dist-PVA_xL1D.js";var i=t(e(),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};
|