nextclaw 0.21.6 → 0.21.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/app/index.js +174 -5
- package/dist/cli/app/index.js.map +1 -1
- package/package.json +16 -16
- package/resources/USAGE.md +2 -0
- package/ui-dist/assets/{api-DmxQnm30.js → api-B50yVdT8.js} +7 -7
- package/ui-dist/assets/app-presenter-provider-BI-ewLbO.js +3 -0
- package/ui-dist/assets/arrow-left-BOCJyLbQ.js +1 -0
- package/ui-dist/assets/book-open-Bd2Xbrrc.js +1 -0
- package/ui-dist/assets/channels-list-page-moJkpxtU.js +8 -0
- package/ui-dist/assets/chat-page-CO27cl4v.js +105 -0
- package/ui-dist/assets/config-split-page-CsQ2rIdq.js +1 -0
- package/ui-dist/assets/{confirm-dialog-BWRNsRgb.js → confirm-dialog-DRSelLdI.js} +2 -2
- package/ui-dist/assets/desktop-update-config-qa-SynOc.js +1 -0
- package/ui-dist/assets/{dist-DzM2ZEVN.js → dist-D19wiQwB.js} +1 -1
- package/ui-dist/assets/{dist-CyWdaJvr.js → dist-NZRV-BxD.js} +1 -1
- package/ui-dist/assets/doc-browser-2ddUJCA0.js +1 -0
- package/ui-dist/assets/doc-browser-BjHUczQb.js +1 -0
- package/ui-dist/assets/doc-browser-context-C8KPbj-p.js +1 -0
- package/ui-dist/assets/{ellipsis-BDgTYNDX.js → ellipsis-BYy8TP0A.js} +1 -1
- package/ui-dist/assets/{es2015-WqekV0OK.js → es2015-BUIIKCNh.js} +1 -1
- package/ui-dist/assets/{external-link-BLjo8z2a.js → external-link-528k6MDD.js} +1 -1
- package/ui-dist/assets/host-capabilities-9bB_998Z.js +1 -0
- package/ui-dist/assets/index-CMNrRhnG.js +101 -0
- package/ui-dist/assets/index-UTmTW1eU.css +1 -0
- package/ui-dist/assets/{key-round-Du8x3sWa.js → key-round-D3vD9dj7.js} +1 -1
- package/ui-dist/assets/loader-circle-DV9TSRns.js +1 -0
- package/ui-dist/assets/mcp-marketplace-page-CS5Lh3oA.js +1 -0
- package/ui-dist/assets/mcp-marketplace-page-DEOMcWb0.js +40 -0
- package/ui-dist/assets/model-config-page-BSc4o7pb.js +1 -0
- package/ui-dist/assets/{notice-card-3a7FmAz-.js → notice-card-qqlbsOoR.js} +1 -1
- package/ui-dist/assets/plus-Bf9qhPDO.js +1 -0
- package/ui-dist/assets/{popover-BlJLguiZ.js → popover-BnmPOXe3.js} +1 -1
- package/ui-dist/assets/provider-scoped-model-input-Ca56s475.js +1 -0
- package/ui-dist/assets/providers-config-page-D8Kf4U3u.js +1 -0
- package/ui-dist/assets/{react-BVjl1ZaK.js → react-Dsotw5vM.js} +1 -1
- package/ui-dist/assets/{refresh-cw-DFR87zei.js → refresh-cw-Bmx4wc9P.js} +1 -1
- package/ui-dist/assets/remote-DNMEy_c4.js +1 -0
- package/ui-dist/assets/rotate-cw-CL0sVBel.js +1 -0
- package/ui-dist/assets/runtime-config-page-CUFtKr0U.js +1 -0
- package/ui-dist/assets/{save-BDmIlHvN.js → save-CHDnDTok.js} +1 -1
- package/ui-dist/assets/search-D7L-TCH-.js +1 -0
- package/ui-dist/assets/search-config-page-CA3RVAef.js +1 -0
- package/ui-dist/assets/secrets-config-page-95yaH1fa.js +3 -0
- package/ui-dist/assets/{status-dot-SVPjIyG5.js → status-dot-Dm4h-bjn.js} +1 -1
- package/ui-dist/assets/tabs-CJvw5Lqp.js +1 -0
- package/ui-dist/assets/{tag-chip-Cdwb3JSH.js → tag-chip-Cr8GwpRE.js} +1 -1
- package/ui-dist/assets/{tooltip-CKGxLGnG.js → tooltip-Bxzi6aDL.js} +1 -1
- package/ui-dist/assets/{trash-2-yLA8BEcE.js → trash-2-CSfX-BvU.js} +1 -1
- package/ui-dist/assets/use-config-TzwzTgg0.js +1 -0
- package/ui-dist/assets/x-fkIWvi07.js +1 -0
- package/ui-dist/index.html +27 -25
- package/ui-dist/assets/app-presenter-provider-CDSjiqfE.js +0 -3
- package/ui-dist/assets/arrow-left-Dd45Mvr1.js +0 -1
- package/ui-dist/assets/channels-list-page-D-WYFmcG.js +0 -8
- package/ui-dist/assets/chat-page-D1X8YNTC.js +0 -105
- package/ui-dist/assets/config-split-page-CdJEkWxv.js +0 -1
- package/ui-dist/assets/desktop-update-config-DOi5R1fX.js +0 -1
- package/ui-dist/assets/doc-browser-D5FJcAyz.js +0 -1
- package/ui-dist/assets/doc-browser-DewXa6oX.js +0 -1
- package/ui-dist/assets/doc-browser-context-CpL2m4Sp.js +0 -1
- package/ui-dist/assets/index-Q891JiF_.css +0 -1
- package/ui-dist/assets/index-ZDJP_uJc.js +0 -101
- package/ui-dist/assets/loader-circle-Dz4FssYC.js +0 -1
- package/ui-dist/assets/mcp-marketplace-page-LmMhKH5a.js +0 -1
- package/ui-dist/assets/mcp-marketplace-page-RqISBSqO.js +0 -40
- package/ui-dist/assets/model-config-JUsW1Khb.js +0 -1
- package/ui-dist/assets/play-BziM-Y34.js +0 -1
- package/ui-dist/assets/plus-DrpyArC8.js +0 -1
- package/ui-dist/assets/provider-models-C_yOh6DE.js +0 -1
- package/ui-dist/assets/provider-scoped-model-input-IMD4W0jD.js +0 -1
- package/ui-dist/assets/providers-list-BsDpxNzy.js +0 -1
- package/ui-dist/assets/remote-DjhVMpVd.js +0 -1
- package/ui-dist/assets/rotate-cw-DMBnsYKm.js +0 -1
- package/ui-dist/assets/runtime-config-page-DzbTVebD.js +0 -1
- package/ui-dist/assets/search-CjHGYvTI.js +0 -1
- package/ui-dist/assets/search-config-CJ6OPxAf.js +0 -1
- package/ui-dist/assets/secrets-config-CYOHWL7P.js +0 -3
- package/ui-dist/assets/tabs-Czd2mj6z.js +0 -1
- package/ui-dist/assets/tabs-custom-Ix4nkp2h.js +0 -1
- package/ui-dist/assets/x-dpDISboO.js +0 -1
- /package/ui-dist/assets/{config-hints-Ceiol9x4.js → config-hints-Cl2XAhzV.js} +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e,h as t,n,o as r,p as i,r as a,t as o,u as s,v as c}from"./react-Dsotw5vM.js";import{At as l,Ft as u,Ht as d,It as f,Lt as p,Mt as m,Nt as h,Ot as g,Pt as _,Ut as v,Vt as y,a as b,c as ee,ct as x,en as S,i as te,jt as ne,kt as re,l as ie,o as ae,pt as oe,r as se,s as ce,u as le,wt as C,zt as ue}from"./api-B50yVdT8.js";import{c as w}from"./dist-NZRV-BxD.js";import{a as de,i as fe,n as pe,o as me,r as he,s as ge,t as _e}from"./confirm-dialog-DRSelLdI.js";import{t as ve}from"./arrow-left-BOCJyLbQ.js";import{t as ye}from"./book-open-Bd2Xbrrc.js";import{i as be,n as xe,r as Se,t as Ce,u as we}from"./tooltip-Bxzi6aDL.js";import{t as Te}from"./key-round-D3vD9dj7.js";import{t as Ee}from"./loader-circle-DV9TSRns.js";import{t as De}from"./plus-Bf9qhPDO.js";import{t as Oe}from"./refresh-cw-Bmx4wc9P.js";import{t as ke}from"./trash-2-CSfX-BvU.js";import{t as Ae}from"./x-fkIWvi07.js";import{t as T}from"./notice-card-qqlbsOoR.js";import{t as je}from"./status-dot-Dm4h-bjn.js";import{t as Me}from"./host-capabilities-9bB_998Z.js";import{n as Ne,r as Pe,t as Fe}from"./popover-BnmPOXe3.js";import{i as E,r as Ie,t as Le}from"./tabs-CJvw5Lqp.js";import{a as D,c as Re,f as O,g as ze,h as k,i as Be,l as Ve,m as He,n as Ue,o as We,p as Ge,r as Ke,s as qe,u as Je}from"./doc-browser-context-C8KPbj-p.js";var Ye=`modulepreload`,Xe=function(e){return`/`+e},Ze={},Qe=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Xe(t,n),t in Ze)return;Ze[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Ye,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},A=c(t(),1),$e=`popstate`;function et(e={}){let{initialEntries:t=[`/`],initialIndex:n,v5Compat:r=!1}=e,i;i=t.map((e,t)=>u(e,typeof e==`string`?null:e.state,t===0?`default`:void 0));let a=c(n??i.length-1),o=`POP`,s=null;function c(e){return Math.min(Math.max(e,0),i.length-1)}function l(){return i[a]}function u(e,t=null,n){let r=it(i?l().pathname:`/`,e,t,n);return M(r.pathname.charAt(0)===`/`,`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),r}function d(e){return typeof e==`string`?e:N(e)}return{get index(){return a},get action(){return o},get location(){return l()},createHref:d,createURL(e){return new URL(d(e),`http://localhost`)},encodeLocation(e){let t=typeof e==`string`?P(e):e;return{pathname:t.pathname||``,search:t.search||``,hash:t.hash||``}},push(e,t){o=`PUSH`;let n=u(e,t);a+=1,i.splice(a,i.length,n),r&&s&&s({action:o,location:n,delta:1})},replace(e,t){o=`REPLACE`;let n=u(e,t);i[a]=n,r&&s&&s({action:o,location:n,delta:0})},go(e){o=`POP`;let t=c(a+e),n=i[t];a=t,s&&s({action:o,location:n,delta:e})},listen(e){return s=e,()=>{s=null}}}}function tt(e={}){function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return it(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){return typeof t==`string`?t:N(t)}return at(t,n,null,e)}function j(e,t){if(e===!1||e==null)throw Error(t)}function M(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function nt(){return Math.random().toString(36).substring(2,10)}function rt(e,t){return{usr:e.state,key:e.key,idx:t}}function it(e,t,n=null,r){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?P(t):t,state:n,key:t&&t.key||r||nt()}}function N({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function P(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function at(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=it(h.location,e,t);n&&n(r,e),l=u()+1;let d=rt(r,l),f=h.createHref(r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=it(h.location,e,t);n&&n(r,e),l=u();let i=rt(r,l),d=h.createHref(r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return ot(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener($e,d),c=e,()=>{i.removeEventListener($e,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function ot(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),j(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:N(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function st(e,t,n=`/`){return ct(e,t,n,!1)}function ct(e,t,n,r){let i=F((typeof t==`string`?P(t):t).pathname||`/`,n);if(i==null)return null;let a=ut(e);ft(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=Tt(i);o=St(a[e],t,r)}return o}function lt(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function ut(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;j(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=I([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(j(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),ut(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:bt(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of dt(e.path))a(e,t,!0,n)}),t}function dt(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=dt(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ft(e){e.sort((e,t)=>e.score===t.score?xt(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var pt=/^:[\w-]+$/,mt=3,ht=2,gt=1,_t=10,vt=-2,yt=e=>e===`*`;function bt(e,t){let n=e.split(`/`),r=n.length;return n.some(yt)&&(r+=vt),t&&(r+=ht),n.filter(e=>!yt(e)).reduce((e,t)=>e+(pt.test(t)?mt:t===``?gt:_t),r)}function xt(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function St(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=Ct({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=Ct({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:I([a,u.pathname]),pathnameBase:Nt(I([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=I([a,u.pathnameBase]))}return o}function Ct(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=wt(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function wt(e,t=!1,n=!0){M(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`)).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Tt(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return M(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function F(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var Et=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Dt(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?P(e):e,a;return n?(n=n.replace(/\/\/+/g,`/`),a=n.startsWith(`/`)?Ot(n.substring(1),`/`):Ot(n,t)):a=t,{pathname:a,search:Pt(r),hash:Ft(i)}}function Ot(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function kt(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function At(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function jt(e){let t=At(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Mt(e,t,n,r=!1){let i;typeof e==`string`?i=P(e):(i={...e},j(!i.pathname||!i.pathname.includes(`?`),kt(`?`,`pathname`,`search`,i)),j(!i.pathname||!i.pathname.includes(`#`),kt(`#`,`pathname`,`hash`,i)),j(!i.search||!i.search.includes(`#`),kt(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Dt(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var I=e=>e.join(`/`).replace(/\/\/+/g,`/`),Nt=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),Pt=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Ft=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,It=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Lt(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Rt(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}var zt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Bt(e,t){let n=e;if(typeof n!=`string`||!Et.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(zt)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=F(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{M(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Vt=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Vt);var Ht=[`GET`,...Vt];new Set(Ht);var L=A.createContext(null);L.displayName=`DataRouter`;var Ut=A.createContext(null);Ut.displayName=`DataRouterState`;var Wt=A.createContext(!1),Gt=A.createContext({isTransitioning:!1});Gt.displayName=`ViewTransition`;var Kt=A.createContext(new Map);Kt.displayName=`Fetchers`;var qt=A.createContext(null);qt.displayName=`Await`;var R=A.createContext(null);R.displayName=`Navigation`;var Jt=A.createContext(null);Jt.displayName=`Location`;var z=A.createContext({outlet:null,matches:[],isDataRoute:!1});z.displayName=`Route`;var Yt=A.createContext(null);Yt.displayName=`RouteError`;var Xt=`REACT_ROUTER_ERROR`,Zt=`REDIRECT`,Qt=`ROUTE_ERROR_RESPONSE`;function $t(e){if(e.startsWith(`${Xt}:${Zt}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function en(e){if(e.startsWith(`${Xt}:${Qt}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new It(t.status,t.statusText,t.data)}catch{}}function tn(e,{relative:t}={}){j(B(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=A.useContext(R),{hash:i,pathname:a,search:o}=cn(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:I([n,a])),r.createHref({pathname:s,search:o,hash:i})}function B(){return A.useContext(Jt)!=null}function V(){return j(B(),`useLocation() may be used only in the context of a <Router> component.`),A.useContext(Jt).location}var nn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function rn(e){A.useContext(R).static||A.useLayoutEffect(e)}function an(){let{isDataRoute:e}=A.useContext(z);return e?Dn():on()}function on(){j(B(),`useNavigate() may be used only in the context of a <Router> component.`);let e=A.useContext(L),{basename:t,navigator:n}=A.useContext(R),{matches:r}=A.useContext(z),{pathname:i}=V(),a=JSON.stringify(jt(r)),o=A.useRef(!1);return rn(()=>{o.current=!0}),A.useCallback((r,s={})=>{if(M(o.current,nn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Mt(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:I([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}A.createContext(null);function sn(){let{matches:e}=A.useContext(z),t=e[e.length-1];return t?t.params:{}}function cn(e,{relative:t}={}){let{matches:n}=A.useContext(z),{pathname:r}=V(),i=JSON.stringify(jt(n));return A.useMemo(()=>Mt(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function ln(e,t){return un(e,t)}function un(e,t,n,r,i){j(B(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:a}=A.useContext(R),{matches:o}=A.useContext(z),s=o[o.length-1],c=s?s.params:{},l=s?s.pathname:`/`,u=s?s.pathnameBase:`/`,d=s&&s.route;{let e=d&&d.path||``;kn(l,!d||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
2
|
+
|
|
3
|
+
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let f=V(),p;if(t){let e=typeof t==`string`?P(t):t;j(u===`/`||e.pathname?.startsWith(u),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${e.pathname}" was given in the \`location\` prop.`),p=e}else p=f;let m=p.pathname||`/`,h=m;if(u!==`/`){let e=u.replace(/^\//,``).split(`/`);h=`/`+m.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let g=st(e,{pathname:h});M(d||g!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),M(g==null||g[g.length-1].route.element!==void 0||g[g.length-1].route.Component!==void 0||g[g.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let _=_n(g&&g.map(e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:I([u,a.encodeLocation?a.encodeLocation(e.pathname.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?u:I([u,a.encodeLocation?a.encodeLocation(e.pathnameBase.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),o,n,r,i);return t&&_?A.createElement(Jt.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,...p},navigationType:`POP`}},_):_}function dn(){let e=En(),t=Lt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=A.createElement(A.Fragment,null,A.createElement(`p`,null,`💿 Hey developer 👋`),A.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,A.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,A.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),A.createElement(A.Fragment,null,A.createElement(`h2`,null,`Unexpected Application Error!`),A.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?A.createElement(`pre`,{style:i},n):null,o)}var fn=A.createElement(dn,null),pn=class extends A.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=en(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:A.createElement(z.Provider,{value:this.props.routeContext},A.createElement(Yt.Provider,{value:e,children:this.props.component}));return this.context?A.createElement(hn,{error:e},t):t}};pn.contextType=Wt;var mn=new WeakMap;function hn({children:e,error:t}){let{basename:n}=A.useContext(R);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=$t(t.digest);if(e){let r=mn.get(t);if(r)throw r;let i=Bt(e.location,n);if(zt&&!mn.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw mn.set(t,n),n}return A.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function gn({routeContext:e,match:t,children:n}){let r=A.useContext(L);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),A.createElement(z.Provider,{value:e},n)}function _n(e,t=[],n=null,r=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);j(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:r}=n,i=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||r[t.route.id]===void 0);if(t.route.lazy||i){s=!0,a=c>=0?a.slice(0,c+1):[a[0]];break}}}let l=n&&r?(e,t)=>{r(e,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:Rt(n.matches),errorInfo:t})}:void 0;return a.reduceRight((e,r,i)=>{let u,d=!1,f=null,p=null;n&&(u=o&&r.route.id?o[r.route.id]:void 0,f=r.route.errorElement||fn,s&&(c<0&&i===0?(kn(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):c===i&&(d=!0,p=r.route.hydrateFallbackElement||null)));let m=t.concat(a.slice(0,i+1)),h=()=>{let t;return t=u?f:d?p:r.route.Component?A.createElement(r.route.Component,null):r.route.element?r.route.element:e,A.createElement(gn,{match:r,routeContext:{outlet:e,matches:m,isDataRoute:n!=null},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||i===0)?A.createElement(pn,{location:n.location,revalidation:n.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function vn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function yn(e){let t=A.useContext(L);return j(t,vn(e)),t}function bn(e){let t=A.useContext(Ut);return j(t,vn(e)),t}function xn(e){let t=A.useContext(z);return j(t,vn(e)),t}function Sn(e){let t=xn(e),n=t.matches[t.matches.length-1];return j(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Cn(){return Sn(`useRouteId`)}function wn(){return bn(`useNavigation`).navigation}function Tn(){let{matches:e,loaderData:t}=bn(`useMatches`);return A.useMemo(()=>e.map(e=>lt(e,t)),[e,t])}function En(){let e=A.useContext(Yt),t=bn(`useRouteError`),n=Sn(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Dn(){let{router:e}=yn(`useNavigate`),t=Sn(`useNavigate`),n=A.useRef(!1);return rn(()=>{n.current=!0}),A.useCallback(async(r,i={})=>{M(n.current,nn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var On={};function kn(e,t,n){!t&&!On[e]&&(On[e]=!0,M(!1,n))}A.useOptimistic,A.memo(An);function An({routes:e,future:t,state:n,onError:r}){return un(e,void 0,n,r,t)}function jn({basename:e,children:t,initialEntries:n,initialIndex:r,unstable_useTransitions:i}){let a=A.useRef();a.current??=et({initialEntries:n,initialIndex:r,v5Compat:!0});let o=a.current,[s,c]=A.useState({action:o.action,location:o.location}),l=A.useCallback(e=>{i===!1?c(e):A.startTransition(()=>c(e))},[i]);return A.useLayoutEffect(()=>o.listen(l),[o,l]),A.createElement(Pn,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:o,unstable_useTransitions:i})}function Mn({to:e,replace:t,state:n,relative:r}){j(B(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=A.useContext(R);M(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=A.useContext(z),{pathname:o}=V(),s=an(),c=Mt(e,jt(a),o,r===`path`),l=JSON.stringify(c);return A.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Nn(e){j(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Pn({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){j(!B(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=A.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=P(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`}=n,m=A.useMemo(()=>{let e=F(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p},navigationType:r}},[s,l,u,d,f,p,r]);return M(m!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),m==null?null:A.createElement(R.Provider,{value:c},A.createElement(Jt.Provider,{children:t,value:m}))}function Fn({children:e,location:t}){return ln(In(e),t)}A.Component;function In(e,t=[]){let n=[];return A.Children.forEach(e,(e,r)=>{if(!A.isValidElement(e))return;let i=[...t,r];if(e.type===A.Fragment){n.push.apply(n,In(e.props.children,i));return}j(e.type===Nn,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),j(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=In(e.props.children,i)),n.push(a)}),n}var Ln=`get`,Rn=`application/x-www-form-urlencoded`;function zn(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Bn(e){return zn(e)&&e.tagName.toLowerCase()===`button`}function Vn(e){return zn(e)&&e.tagName.toLowerCase()===`form`}function Hn(e){return zn(e)&&e.tagName.toLowerCase()===`input`}function Un(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Wn(e,t){return e.button===0&&(!t||t===`_self`)&&!Un(e)}var Gn=null;function Kn(){if(Gn===null)try{new FormData(document.createElement(`form`),0),Gn=!1}catch{Gn=!0}return Gn}var qn=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Jn(e){return e!=null&&!qn.has(e)?(M(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Rn}"`),null):e}function Yn(e,t){let n,r,i,a,o;if(Vn(e)){let o=e.getAttribute(`action`);r=o?F(o,t):null,n=e.getAttribute(`method`)||Ln,i=Jn(e.getAttribute(`enctype`))||Rn,a=new FormData(e)}else if(Bn(e)||Hn(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?F(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Ln,i=Jn(e.getAttribute(`formenctype`))||Jn(o.getAttribute(`enctype`))||Rn,a=new FormData(o,e),!Kn()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(zn(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Ln,r=null,i=Rn,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Xn={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Zn=/[&><\u2028\u2029]/g;function Qn(e){return e.replace(Zn,e=>Xn[e])}function $n(e,t){if(e===!1||e==null)throw Error(t)}function er(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&F(i.pathname,t)===`/`?i.pathname=`${t.replace(/\/$/,``)}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,``)}.${r}`,i}async function tr(e,t){if(e.id in t)return t[e.id];try{let n=await Qe(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function nr(e){return e!=null&&typeof e.page==`string`}function rr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function ir(e,t,n){return lr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await tr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(rr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function ar(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function or(e,t,{includeHydrateFallback:n}={}){return sr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function sr(e){return[...new Set(e)]}function cr(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function lr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!nr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(cr(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function ur(){let e=A.useContext(L);return $n(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function dr(){let e=A.useContext(Ut);return $n(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var fr=A.createContext(void 0);fr.displayName=`FrameworkContext`;function pr(){let e=A.useContext(fr);return $n(e,`You must render this element inside a <HydratedRouter> element`),e}function mr(e,t){let n=A.useContext(fr),[r,i]=A.useState(!1),[a,o]=A.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=A.useRef(null);A.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),A.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:hr(s,p),onBlur:hr(c,m),onMouseEnter:hr(l,p),onMouseLeave:hr(u,m),onTouchStart:hr(d,p)}]:[a,f,{}]:[!1,f,{}]}function hr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function gr({page:e,...t}){let{router:n}=ur(),r=A.useMemo(()=>st(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?A.createElement(vr,{page:e,matches:r,...t}):null}function _r(e){let{manifest:t,routeModules:n}=pr(),[r,i]=A.useState([]);return A.useEffect(()=>{let r=!1;return ir(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function vr({page:e,matches:t,...n}){let r=V(),{future:i,manifest:a,routeModules:o}=pr(),{basename:s}=ur(),{loaderData:c,matches:l}=dr(),u=A.useMemo(()=>ar(e,t,l,a,r,`data`),[e,t,l,a,r]),d=A.useMemo(()=>ar(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=A.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=er(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=A.useMemo(()=>or(d,a),[d,a]),m=_r(d);return A.createElement(A.Fragment,null,f.map(e=>A.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>A.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>A.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function yr(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}A.Component;var br=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{br&&(window.__reactRouterVersion=`7.13.0`)}catch{}function xr({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=A.useRef();i.current??=tt({window:r,v5Compat:!0});let a=i.current,[o,s]=A.useState({action:a.action,location:a.location}),c=A.useCallback(e=>{n===!1?s(e):A.startTransition(()=>s(e))},[n]);return A.useLayoutEffect(()=>a.listen(c),[a,c]),A.createElement(Pn,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}function Sr({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=A.useState({action:n.action,location:n.location}),o=A.useCallback(e=>{r===!1?a(e):A.startTransition(()=>a(e))},[r]);return A.useLayoutEffect(()=>n.listen(o),[n,o]),A.createElement(Pn,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}Sr.displayName=`unstable_HistoryRouter`;var Cr=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,wr=A.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,state:o,target:s,to:c,preventScrollReset:l,viewTransition:u,unstable_defaultShouldRevalidate:d,...f},p){let{basename:m,unstable_useTransitions:h}=A.useContext(R),g=typeof c==`string`&&Cr.test(c),_=Bt(c,m);c=_.to;let v=tn(c,{relative:r}),[y,b,ee]=mr(n,f),x=jr(c,{replace:a,state:o,target:s,preventScrollReset:l,relative:r,viewTransition:u,unstable_defaultShouldRevalidate:d,unstable_useTransitions:h});function S(t){e&&e(t),t.defaultPrevented||x(t)}let te=A.createElement(`a`,{...f,...ee,href:_.absoluteURL||v,onClick:_.isExternal||i?e:S,ref:yr(p,b),target:s,"data-discover":!g&&t===`render`?`true`:void 0});return y&&!g?A.createElement(A.Fragment,null,te,A.createElement(gr,{page:v})):te});wr.displayName=`Link`;var Tr=A.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=cn(a,{relative:c.relative}),d=V(),f=A.useContext(Ut),{navigator:p,basename:m}=A.useContext(R),h=f!=null&&Vr(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=F(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,ee=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),x={isActive:b,isPending:ee,isTransitioning:h},S=b?e:void 0,te;te=typeof n==`function`?n(x):[n,b?`active`:null,ee?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let ne=typeof i==`function`?i(x):i;return A.createElement(wr,{...c,"aria-current":S,className:te,ref:l,style:ne,to:a,viewTransition:o},typeof s==`function`?s(x):s)});Tr.displayName=`NavLink`;var Er=A.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Ln,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=A.useContext(R),g=Pr(),_=Fr(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&Cr.test(s);return A.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?A.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});Er.displayName=`Form`;function Dr({getKey:e,storageKey:t,...n}){let r=A.useContext(fr),{basename:i}=A.useContext(R),a=V(),o=Tn();zr({getKey:e,storageKey:t});let s=A.useMemo(()=>{if(!r||!e)return null;let t=Rr(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return A.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Qn(JSON.stringify(t||Ir))}, ${Qn(JSON.stringify(s))})`}})}Dr.displayName=`ScrollRestoration`;function Or(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function kr(e){let t=A.useContext(L);return j(t,Or(e)),t}function Ar(e){let t=A.useContext(Ut);return j(t,Or(e)),t}function jr(e,{target:t,replace:n,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:s,unstable_useTransitions:c}={}){let l=an(),u=V(),d=cn(e,{relative:a});return A.useCallback(f=>{if(Wn(f,t)){f.preventDefault();let t=n===void 0?N(u)===N(d):n,p=()=>l(e,{replace:t,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:s});c?A.startTransition(()=>p()):p()}},[u,l,d,n,r,t,e,i,a,o,s,c])}var Mr=0,Nr=()=>`__${String(++Mr)}__`;function Pr(){let{router:e}=kr(`useSubmit`),{basename:t}=A.useContext(R),n=Cn(),r=e.fetch,i=e.navigate;return A.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Yn(e,t);a.navigate===!1?await r(a.fetcherKey||Nr(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Fr(e,{relative:t}={}){let{basename:n}=A.useContext(R),r=A.useContext(z);j(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...cn(e||`.`,{relative:t})},o=V();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:I([n,a.pathname])),N(a)}var Ir=`react-router-scroll-positions`,Lr={};function Rr(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:F(e.pathname,n)||e.pathname},t)),i??=e.key,i}function zr({getKey:e,storageKey:t}={}){let{router:n}=kr(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Ar(`useScrollRestoration`),{basename:a}=A.useContext(R),o=V(),s=Tn(),c=wn();A.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Br(A.useCallback(()=>{if(c.state===`idle`){let t=Rr(o,s,a,e);Lr[t]=window.scrollY}try{sessionStorage.setItem(t||Ir,JSON.stringify(Lr))}catch(e){M(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(A.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Ir);e&&(Lr=JSON.parse(e))}catch{}},[t]),A.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Lr,()=>window.scrollY,e?(t,n)=>Rr(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),A.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{M(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Br(e,t){let{capture:n}=t||{};A.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Vr(e,{relative:t}={}){let n=A.useContext(Gt);j(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=kr(`useViewTransitionState`),i=cn(e,{relative:t});if(!n.isTransitioning)return!1;let a=F(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=F(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ct(i.pathname,o)!=null||Ct(i.pathname,a)!=null}var Hr=w(`AppWindow`,[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]),Ur=w(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),Wr=w(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Gr=w(`CircleDashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),Kr=w(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),qr=w(`CirclePause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),Jr=w(`EllipsisVertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Yr=w(`Grid3x3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),Xr=w(`Laptop`,[[`path`,{d:`M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16`,key:`tarvll`}]]),Zr=w(`LogOut`,[[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}],[`polyline`,{points:`16 17 21 12 16 7`,key:`1gabdz`}],[`line`,{x1:`21`,x2:`9`,y1:`12`,y2:`12`,key:`1uyos4`}]]),Qr=w(`Radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]),$r=w(`RefreshCcw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),ei=w(`Server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),ti=w(`ShieldAlert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),ni=w(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ri=w(`SquareArrowOutUpRight`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),ii=w(`Star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),ai=w(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),oi=w(`Unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),si=w(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]);function ci(){return v({queryKey:ui,queryFn:b,staleTime:5e3,refetchOnWindowFocus:!0})}var H=i();function U(e){let{label:t,muted:n,value:r}=e;return(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,H.jsx)(`span`,{className:`text-gray-500`,children:t}),(0,H.jsx)(`span`,{className:n?`text-right text-gray-500`:`text-right text-gray-900`,children:r==null||r===``?`-`:String(r)})]})}function li(){let e=us(),t=ci(),r=t.data,i=K(e=>e.actionLabel),o=(0,A.useMemo)(()=>xi(r),[r]),s=!!i,c=r?.runtime?.deviceName?.trim()||r?.settings.deviceName?.trim()||a(`remoteDeviceNameAuto`),u=!!(r?.account.loggedIn&&hi(r)),{hero:d,issueHint:f}=o;return(0,A.useEffect)(()=>{e.remoteAccessManager.syncStatus(r)},[e,r]),t.isLoading&&!r?(0,H.jsx)(`div`,{className:`p-8 text-gray-400`,children:a(`remoteLoading`)}):(0,H.jsxs)(_,{className:`space-y-6`,children:[(0,H.jsx)(h,{title:a(`remotePageTitle`),description:a(`remotePageDescription`)}),(0,H.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,H.jsxs)(g,{children:[(0,H.jsxs)(ne,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,H.jsx)(m,{children:d.title}),(0,H.jsx)(je,{status:d.badgeStatus,label:d.badgeLabel})]}),(0,H.jsx)(l,{children:d.description})]}),(0,H.jsxs)(re,{className:`space-y-5`,children:[(0,H.jsxs)(T,{tone:`neutral`,children:[(0,H.jsx)(U,{label:a(`remoteSignedInAccount`),value:r?.account.email}),(0,H.jsx)(U,{label:a(`remoteDeviceName`),value:c}),(0,H.jsx)(U,{label:a(`remoteConnectionStatus`),value:d.badgeLabel}),(0,H.jsx)(U,{label:a(`remoteLastConnectedAt`),value:r?.runtime?.lastConnectedAt?n(r.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[o.primaryAction?(0,H.jsxs)(p,{onClick:()=>{if(o.primaryAction?.kind===`reauthorize`){e.remoteAccessManager.reauthorizeRemoteAccess(r);return}if(o.primaryAction?.kind===`repair`){e.remoteAccessManager.repairRemoteAccess(r);return}e.remoteAccessManager.enableRemoteAccess(r)},disabled:s,children:[o.primaryAction.showRefreshIcon?(0,H.jsx)($r,{className:`mr-2 h-4 w-4`}):null,i||o.primaryAction.label]}):null,(0,H.jsxs)(p,{variant:`outline`,onClick:()=>void e.accountManager.openNextClawWeb(),disabled:s||!u,children:[(0,H.jsx)(ri,{className:`mr-2 h-4 w-4`}),a(`remoteOpenDeviceList`)]}),r?.settings.enabled?(0,H.jsx)(p,{variant:`outline`,onClick:()=>void e.remoteAccessManager.disableRemoteAccess(r),disabled:s,children:a(`remoteDisable`)}):null]}),o.shouldShowIssueHint&&f?(0,H.jsx)(T,{tone:`warning`,title:f.title,description:f.body}):null,(0,H.jsx)(`p`,{className:`text-xs text-gray-500`,children:a(`remoteOpenWebHint`)})]})]}),(0,H.jsxs)(g,{children:[(0,H.jsxs)(ne,{children:[(0,H.jsxs)(m,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Xr,{className:`h-4 w-4 text-primary`}),a(`remoteDeviceSectionTitle`)]}),(0,H.jsx)(l,{children:a(`remoteDeviceSectionDescription`)})]}),(0,H.jsxs)(re,{className:`space-y-5`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(je,{status:r?.account.loggedIn?`ready`:`inactive`,label:r?.account.loggedIn?a(`remoteAccountConnected`):a(`remoteAccountNotConnected`)}),(0,H.jsx)(je,{status:r?.settings.enabled?`active`:`inactive`,label:r?.settings.enabled?a(`remoteEnabled`):a(`remoteStateDisabled`)}),(0,H.jsx)(je,{status:r?.service.running?`active`:`inactive`,label:r?.service.running?a(`remoteServiceRunning`):a(`remoteServiceStopped`)})]}),(0,H.jsxs)(T,{tone:`neutral`,children:[(0,H.jsx)(U,{label:a(`remoteDeviceName`),value:c}),(0,H.jsx)(U,{label:a(`remoteConnectionStatus`),value:d.badgeLabel}),(0,H.jsx)(U,{label:a(`remoteLastConnectedAt`),value:r?.runtime?.lastConnectedAt?n(r.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,H.jsx)(T,{tone:`neutral`,borderStyle:`dashed`,description:r?.account.loggedIn?a(`remoteOpenWebHint`):a(`remoteStatusNeedsSignInDescription`),className:`text-sm`})]})]})]})]})}var ui=[`remote-status`],di=`https://platform.nextclaw.io`,fi=`https://nextclaw-platform-console.pages.dev`,W=async()=>await ue.fetchQuery({queryKey:ui,queryFn:b,staleTime:5e3}),G=async()=>(await ue.invalidateQueries({queryKey:ui}),await W()),pi=(e,t)=>t?.trim()||e?.settings.platformApiBase?.trim()||e?.account.apiBase?.trim()||void 0;function mi(e){let t=e?.trim();if(!t)return;let n;try{n=new URL(t)}catch{return}if(n.hostname===`platform.nextclaw.io`||n.hostname===`nextclaw-platform-console.pages.dev`)return n.origin;if(n.hostname===`ai-gateway-api.nextclaw.io`)return di;if(n.hostname.includes(`nextclaw-provider-gateway-api`)&&n.hostname.endsWith(`.workers.dev`))return fi}var hi=e=>mi(e?.account.apiBase)||mi(e?.settings.platformApiBase)||mi(e?.platformBase)||mi(e?.account.platformBase)||void 0,K=o(e=>({enabled:!1,deviceName:``,platformApiBase:``,advancedOpen:!1,draftTouched:!1,actionLabel:null,doctor:null,setEnabled:t=>e({enabled:t,draftTouched:!0}),setDeviceName:t=>e({deviceName:t,draftTouched:!0}),setPlatformApiBase:t=>e({platformApiBase:t,draftTouched:!0}),setAdvancedOpen:t=>e({advancedOpen:t}),hydrateDraft:({enabled:t,deviceName:n,platformApiBase:r})=>e({enabled:t,deviceName:n,platformApiBase:r,draftTouched:!1}),beginAction:t=>e({actionLabel:t}),finishAction:()=>e({actionLabel:null}),setDoctor:t=>e({doctor:t})})),gi=class{constructor(e){this.params=e,this.syncStatus=e=>{if(!e)return;let t=K.getState();t.draftTouched||t.actionLabel||this.hydrateDraftFromStatus(e)},this.setEnabled=e=>{K.getState().setEnabled(e)},this.setDeviceName=e=>{K.getState().setDeviceName(e)},this.setPlatformApiBase=e=>{K.getState().setPlatformApiBase(e)},this.setAdvancedOpen=e=>{K.getState().setAdvancedOpen(e)},this.enableRemoteAccess=async e=>{let t=e??await G(),n=K.getState(),r=await this.ensureRemoteAccount(t,n.platformApiBase);await this.applyEnabledState(!0,r)},this.disableRemoteAccess=async e=>{let t=e??await G();await this.applyEnabledState(!1,t)},this.repairRemoteAccess=async e=>{let t=e??await G(),n=(await this.ensureRemoteAccount(t)).service.running?`restart`:`start`;await this.runManagedAction({actionLabel:a(n===`restart`?`remoteActionRestarting`:`remoteActionStarting`),job:async()=>{await se(n);let e=await G();this.hydrateDraftFromStatus(e)},successMessage:a(`remoteServiceRecovered`)})},this.reauthorizeRemoteAccess=async e=>{let t=e??await G(),n=await this.params.accountManager.startBrowserSignInAndWait({status:t,apiBase:K.getState().platformApiBase});await this.repairRemoteAccess(n)},this.saveAdvancedSettings=async e=>{let t=e??await G(),n=K.getState();await this.runManagedAction({actionLabel:a(`remoteActionSavingAdvanced`),job:async()=>{await le({enabled:n.enabled,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let e=await G();this.hydrateDraftFromStatus(e)},successMessage:t.settings.enabled===n.enabled?a(`remoteSettingsSaved`):a(`remoteAdvancedSaved`)})},this.runDoctor=async()=>{await this.runManagedAction({actionLabel:a(`remoteDoctorRunning`),job:async()=>{let e=await te();K.getState().setDoctor(e)},successMessage:a(`remoteDoctorCompleted`)})},this.startService=async()=>{await this.runServiceAction(`start`,a(`remoteActionStarting`))},this.restartService=async()=>{await this.runServiceAction(`restart`,a(`remoteActionRestarting`))},this.stopService=async()=>{await this.runServiceAction(`stop`,a(`remoteActionStopping`))},this.applyEnabledState=async(e,t)=>{let n=K.getState();await this.runManagedAction({actionLabel:a(e?`remoteActionEnabling`:`remoteActionDisabling`),job:async()=>{await le({enabled:e,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let r=await G();this.hydrateDraftFromStatus(r),e?await se(r.service.running?`restart`:`start`):t.service.running&&await se(`restart`);let i=await G();this.hydrateDraftFromStatus(i)},successMessage:a(e?`remoteEnabledReady`:`remoteDisabledDone`)})},this.ensureRemoteAccount=async(e,t)=>e.account.loggedIn?e:await this.params.accountManager.ensureSignedIn({apiBase:t,status:e}),this.runServiceAction=async(e,t)=>{await this.runManagedAction({actionLabel:t,job:async()=>{let t=await se(e),n=await G();this.hydrateDraftFromStatus(n),y.success(t.message)}})},this.hydrateDraftFromStatus=e=>{K.getState().hydrateDraft({enabled:e.settings.enabled,deviceName:e.settings.deviceName,platformApiBase:e.settings.platformApiBase})},this.runManagedAction=async e=>{let{actionLabel:t,job:n,successMessage:r}=e;K.getState().beginAction(t);try{await n(),r&&y.success(r)}catch(e){let t=e instanceof Error?e.message:a(`error`);throw y.error(t),e}finally{K.getState().finishAction()}}}},_i=[/invalid or expired token/i,/missing bearer token/i,/token expired/i,/token is invalid/i,/run "nextclaw login"/i,/browser sign-in again/i];function vi(e){return e?.runtime?.lastError?.trim()||``}function yi(e){let t=a(`remoteStatusIssueDetailGeneric`),n=vi(e);return n?`${t} (${n})`:t}function bi(e){if(!e?.settings.enabled)return!1;let t=vi(e);return _i.some(e=>e.test(t))}function xi(e){return bi(e)?{hero:{badgeStatus:`warning`,badgeLabel:a(`remoteStateReauthorizationRequired`),title:a(`remoteStatusReauthorizationTitle`),description:a(`remoteStatusReauthorizationDescription`)},primaryAction:{kind:`reauthorize`,label:a(`remoteReauthorizeNow`),showRefreshIcon:!1},issueHint:{title:a(`remoteStatusRecoveryTitle`),body:a(`remoteStatusReauthorizationHint`)},shouldShowIssueHint:!0,requiresReauthorization:!0}:e?.account.loggedIn?e.settings.enabled?e.service.running?e.runtime?.state===`connected`?{hero:{badgeStatus:`ready`,badgeLabel:a(`statusReady`),title:a(`remoteStatusReadyTitle`),description:a(`remoteStatusReadyDescription`)},primaryAction:{kind:`repair`,label:a(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:e.runtime?.state===`connecting`?{hero:{badgeStatus:`active`,badgeLabel:a(`connecting`),title:a(`remoteStatusConnectingTitle`),description:a(`remoteStatusConnectingDescription`)},primaryAction:{kind:`repair`,label:a(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:a(`remoteStateDisconnected`),title:a(`remoteStatusIssueTitle`),description:a(`remoteStatusIssueDescription`)},primaryAction:{kind:`repair`,label:a(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:a(`remoteStatusRecoveryTitle`),body:yi(e)},shouldShowIssueHint:!!(e.settings.enabled&&e.account.loggedIn),requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:a(`remoteServiceStopped`),title:a(`remoteStatusNeedsServiceTitle`),description:a(`remoteStatusNeedsServiceDescription`)},primaryAction:{kind:`repair`,label:a(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:a(`remoteStatusRecoveryTitle`),body:a(`remoteStatusIssueDetailServiceStopped`)},shouldShowIssueHint:!0,requiresReauthorization:!1}:{hero:{badgeStatus:`inactive`,badgeLabel:a(`statusInactive`),title:a(`remoteStatusNeedsEnable`),description:a(`remoteStatusNeedsEnableDescription`)},primaryAction:{kind:`enable`,label:a(`remoteEnableNow`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`setup`,badgeLabel:a(`statusSetup`),title:a(`remoteStatusNeedsSignIn`),description:a(`remoteStatusNeedsSignInDescription`)},primaryAction:{kind:`sign-in-enable`,label:a(`remoteSignInAndEnable`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}}var q=o(e=>({panelOpen:!1,authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500,openPanel:()=>e({panelOpen:!0}),closePanel:()=>e({panelOpen:!1}),beginBrowserAuth:({sessionId:t,verificationUri:n,expiresAt:r,intervalMs:i,statusMessage:a})=>e({panelOpen:!0,authSessionId:t,authVerificationUri:n,authExpiresAt:r,authPollIntervalMs:i,authStatusMessage:a}),updateBrowserAuth:({statusMessage:t,intervalMs:n})=>e(e=>({authStatusMessage:t??e.authStatusMessage,authPollIntervalMs:n??e.authPollIntervalMs})),clearBrowserAuth:()=>e({authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500}),setAuthStatusMessage:t=>e({authStatusMessage:t})}));function Si({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,H.jsx)(`span`,{className:`text-gray-500`,children:e}),(0,H.jsx)(`span`,{className:`text-right text-gray-900`,children:t?.trim()||`-`})]})}function Ci(e){let{email:t,username:n,role:r,canSubmitUsername:i,savingUsername:o,usernameDraft:s,onUsernameDraftChange:c,onSubmitUsername:l,onOpenDeviceList:d,onLogout:m}=e;return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(T,{tone:`success`,title:a(`accountPanelSignedInTitle`),description:a(`accountPanelSignedInDescription`)}),(0,H.jsxs)(T,{tone:`neutral`,children:[(0,H.jsx)(Si,{label:a(`remoteAccountEmail`),value:t}),(0,H.jsx)(Si,{label:a(`remoteAccountUsername`),value:n}),(0,H.jsx)(Si,{label:a(`remoteAccountRole`),value:r})]}),n?(0,H.jsx)(`p`,{className:`text-xs text-gray-500`,children:a(`remoteAccountUsernameLockedHelp`)}):(0,H.jsxs)(T,{tone:`warning`,title:a(`remoteAccountUsernameRequiredTitle`),description:a(`remoteAccountUsernameRequiredDescription`),children:[(0,H.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,H.jsx)(u,{htmlFor:`account-panel-username`,children:a(`remoteAccountUsername`)}),(0,H.jsx)(f,{id:`account-panel-username`,value:s,onChange:e=>c(e.target.value),placeholder:a(`remoteAccountUsernamePlaceholder`),autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1})]}),(0,H.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-3`,children:(0,H.jsx)(p,{disabled:!i,onClick:()=>void l(),children:a(o?`remoteAccountUsernameSaving`:`remoteAccountUsernameSave`)})})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,H.jsxs)(p,{onClick:()=>void d(),children:[(0,H.jsx)(ri,{className:`mr-2 h-4 w-4`}),a(`remoteOpenDeviceList`)]}),(0,H.jsxs)(p,{variant:`outline`,onClick:()=>void m(),children:[(0,H.jsx)(Zr,{className:`mr-2 h-4 w-4`}),a(`remoteLogout`)]})]})]})}function wi(e){let{authSessionId:t,authExpiresAt:r,authStatusMessage:i,authVerificationUri:o,onStartBrowserSignIn:s,onResumeBrowserSignIn:c}=e;return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(T,{tone:`neutral`,title:a(`accountPanelSignedOutTitle`),description:a(`accountPanelSignedOutDescription`),children:t?(0,H.jsxs)(`div`,{className:`mt-3 border-t border-white/80 pt-3`,children:[(0,H.jsx)(Si,{label:a(`remoteBrowserAuthSession`),value:t}),(0,H.jsx)(Si,{label:a(`remoteBrowserAuthExpiresAt`),value:r?n(r):`-`})]}):null}),i?(0,H.jsx)(`p`,{className:`text-sm text-gray-600`,children:i}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,H.jsx)(p,{onClick:()=>void s(),children:a(t?`remoteBrowserAuthActionRetry`:`remoteBrowserAuthAction`)}),o?(0,H.jsx)(p,{variant:`outline`,onClick:()=>void c(),children:a(`remoteBrowserAuthResume`)}):null]})]})}function Ti(){let e=us(),t=ci(),n=q(e=>e.panelOpen),r=q(e=>e.authSessionId),i=q(e=>e.authVerificationUri),o=q(e=>e.authExpiresAt),s=q(e=>e.authStatusMessage),c=t.data,[l,u]=(0,A.useState)(``),[d,f]=(0,A.useState)(!1);(0,A.useEffect)(()=>{e.accountManager.syncRemoteStatus(c)},[e,c]);let p=!d&&l.trim().length>0&&!c?.account.username;return(0,H.jsx)(pe,{open:n,onOpenChange:t=>t?e.accountManager.openAccountPanel():e.accountManager.closeAccountPanel(),children:(0,H.jsxs)(he,{className:`max-w-xl`,children:[(0,H.jsxs)(me,{children:[(0,H.jsxs)(ge,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Te,{className:`h-5 w-5 text-primary`}),a(`accountPanelTitle`)]}),(0,H.jsx)(fe,{children:a(`accountPanelDescription`)})]}),c?.account.loggedIn?(0,H.jsx)(Ci,{email:c.account.email,username:c.account.username,role:c.account.role,canSubmitUsername:p,savingUsername:d,usernameDraft:l,onUsernameDraftChange:u,onSubmitUsername:async()=>{f(!0);try{await e.accountManager.updateUsername(l)}finally{f(!1)}},onOpenDeviceList:()=>e.accountManager.openNextClawWeb(`/account`),onLogout:()=>e.accountManager.logout()}):(0,H.jsx)(wi,{authSessionId:r,authExpiresAt:o,authStatusMessage:s,authVerificationUri:i,onStartBrowserSignIn:()=>e.accountManager.startBrowserSignIn(),onResumeBrowserSignIn:()=>e.accountManager.resumeBrowserSignIn()})]})})}function Ei({username:e}){let t=oe(),[n,r]=(0,A.useState)(e??``),[i,o]=(0,A.useState)(``),s=n.trim().length>0&&i.length>0&&!t.isPending;return(0,H.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-secondary px-6 py-10`,children:(0,H.jsxs)(g,{hover:!1,className:`w-full max-w-md shadow-card-hover`,children:[(0,H.jsxs)(ne,{children:[(0,H.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.24em] text-gray-500`,children:a(`authBrand`)}),(0,H.jsx)(m,{className:`text-2xl`,children:a(`authLoginTitle`)}),(0,H.jsx)(l,{children:a(`authLoginDescription`)})]}),(0,H.jsx)(re,{children:(0,H.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e?.preventDefault(),s&&t.mutate({username:n.trim(),password:i})},children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:a(`authUsername`)}),(0,H.jsx)(f,{value:n,onChange:e=>r(e.target.value),placeholder:a(`authUsernamePlaceholder`),autoFocus:!0})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:a(`authPassword`)}),(0,H.jsx)(f,{type:`password`,value:i,onChange:e=>o(e.target.value),placeholder:a(`authPasswordPlaceholder`)})]}),(0,H.jsx)(p,{type:`submit`,className:`w-full`,disabled:!s,children:t.isPending?a(`authLoggingIn`):a(`authLoginAction`)})]})})]})})}var Di=class{constructor(){this.authPollTimerId=null,this.browserSignInCompletion=null,this.openAccountPanel=()=>{q.getState().openPanel()},this.closeAccountPanel=()=>{q.getState().closePanel()},this.syncRemoteStatus=e=>{e?.account.loggedIn&&(this.clearPollTimer(),this.resolveBrowserSignIn(e),q.getState().clearBrowserAuth())},this.ensureSignedIn=async e=>{let t=e?.status??await W();return t.account.loggedIn?t:(this.openAccountPanel(),await this.startBrowserSignInAndWait({apiBase:e?.apiBase,status:t}))},this.startBrowserSignInAndWait=async e=>{let t=this.createBrowserSignInCompletion();return await this.startBrowserSignIn(e),await t},this.startBrowserSignIn=async e=>{try{let t=e?.apiBase,n=await ee({apiBase:pi(e?.status??await W(),t)});q.getState().beginBrowserAuth({sessionId:n.sessionId,verificationUri:n.verificationUri,expiresAt:n.expiresAt,intervalMs:n.intervalMs,statusMessage:a(`remoteBrowserAuthWaiting`)}),(await Me.openExternalUrl(n.verificationUri)).opened||q.getState().setAuthStatusMessage(a(`remoteBrowserAuthPopupBlocked`)),this.scheduleBrowserAuthPoll()}catch(e){let t=e instanceof Error?e.message:a(`remoteBrowserAuthStartFailed`);this.rejectBrowserSignIn(e),y.error(`${a(`remoteBrowserAuthStartFailed`)}: ${t}`)}},this.resumeBrowserSignIn=async()=>{let e=q.getState().authVerificationUri;e&&await Me.openExternalUrl(e)},this.logout=async()=>{try{await ae(),this.rejectBrowserSignIn(Error(`Signed out before browser sign-in completed.`)),q.getState().clearBrowserAuth(),await G(),y.success(a(`remoteLogoutSuccess`))}catch(e){let t=e instanceof Error?e.message:a(`remoteLogoutFailed`);y.error(`${a(`remoteLogoutFailed`)}: ${t}`)}},this.updateUsername=async e=>{try{await ie({username:e.trim()}),await G(),y.success(a(`remoteAccountUsernameSetSuccess`))}catch(e){let t=e instanceof Error?e.message:a(`remoteAccountUsernameSetFailed`);y.error(`${a(`remoteAccountUsernameSetFailed`)}: ${t}`)}},this.openNextClawWeb=async(e=`/`)=>{let t=hi(await W());if(!t){y.error(a(`remoteOpenWebUnavailable`));return}let n=new URL(e,`${t.replace(/\/+$/,``)}/`).toString();await Me.openExternalUrl(n)},this.scheduleBrowserAuthPoll=()=>{this.clearPollTimer();let{authSessionId:e,authPollIntervalMs:t}=q.getState();e&&(this.authPollTimerId=window.setTimeout(async()=>{await this.pollBrowserSignIn()},t))},this.pollBrowserSignIn=async()=>{let e=q.getState();if(e.authSessionId)try{let t=await W(),n=await ce({sessionId:e.authSessionId,apiBase:pi(t)});if(n.status===`pending`){q.getState().updateBrowserAuth({statusMessage:a(`remoteBrowserAuthWaiting`),intervalMs:n.nextPollMs??1500}),this.scheduleBrowserAuthPoll();return}if(n.status===`expired`){this.clearPollTimer(),this.rejectBrowserSignIn(Error(n.message||a(`remoteBrowserAuthExpired`))),q.getState().clearBrowserAuth(),y.error(n.message||a(`remoteBrowserAuthExpired`));return}q.getState().setAuthStatusMessage(a(`remoteBrowserAuthCompleted`));let r=await G();this.clearPollTimer(),this.resolveBrowserSignIn(r),q.getState().clearBrowserAuth(),y.success(a(`remoteLoginSuccess`))}catch(e){this.clearPollTimer(),this.rejectBrowserSignIn(e),q.getState().clearBrowserAuth();let t=e instanceof Error?e.message:a(`remoteBrowserAuthPollFailed`);y.error(`${a(`remoteBrowserAuthPollFailed`)}: ${t}`)}},this.clearPollTimer=()=>{this.authPollTimerId!==null&&(window.clearTimeout(this.authPollTimerId),this.authPollTimerId=null)},this.createBrowserSignInCompletion=()=>(this.rejectBrowserSignIn(Error(`Browser sign-in was replaced by a newer request.`)),new Promise((e,t)=>{this.browserSignInCompletion={resolve:e,reject:t}})),this.resolveBrowserSignIn=e=>{let t=this.browserSignInCompletion;t&&(this.browserSignInCompletion=null,t.resolve(e))},this.rejectBrowserSignIn=e=>{let t=this.browserSignInCompletion;t&&(this.browserSignInCompletion=null,t.reject(e instanceof Error?e:Error(String(e))))},this.getBrowserAuthSummary=()=>{let e=q.getState();return{sessionId:e.authSessionId,expiresAt:e.authExpiresAt?n(e.authExpiresAt):`-`}}}};function Oi({deletePending:e,entry:t,favoritePending:n,onDelete:r,onOpen:i,onToggleFavorite:o}){let[s,c]=(0,A.useState)(!1),[l,u]=(0,A.useState)(!1),d=t.favorite?a(`panelAppsUnfavorite`):a(`panelAppsFavorite`),f=t.lastOpenedAt?`${a(`panelAppsLastOpened`)} ${Ai(t.lastOpenedAt)}`:`${a(`panelAppsUpdated`)} ${Ai(t.updatedAt)}`,p=e=>{e.stopPropagation(),o()},m=()=>{c(!1),u(!0)};return(0,H.jsxs)(`div`,{className:`group w-full min-w-0 rounded-lg border border-gray-200 bg-white px-2.5 py-2.5 transition-colors hover:border-amber-200 hover:bg-amber-50/50`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:i,className:`min-w-0 flex-1 text-left`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-amber-50 text-base text-amber-700`,children:(0,H.jsx)(ji,{icon:t.icon,title:t.title})}),(0,H.jsx)(`span`,{className:`block min-w-0 flex-1 truncate text-sm font-medium text-gray-900`,children:t.title})]}),t.description?(0,H.jsx)(`span`,{className:`mt-1.5 block truncate text-xs leading-5 text-gray-600`,children:t.description}):null,(0,H.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] leading-4 text-gray-400`,children:f})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:p,disabled:n,className:`rounded-md p-1.5 text-gray-400 transition-colors hover:bg-white hover:text-amber-500 disabled:opacity-50`,title:d,"aria-label":d,children:(0,H.jsx)(ii,{className:t.favorite?`h-4 w-4 fill-amber-400 text-amber-500`:`h-4 w-4`})}),(0,H.jsxs)(Fe,{open:s,onOpenChange:c,children:[(0,H.jsx)(Pe,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-gray-400 transition-colors hover:bg-white hover:text-gray-700`,"aria-label":a(`panelAppsMoreActions`),disabled:e,children:(0,H.jsx)(Jr,{className:`h-4 w-4`})})}),(0,H.jsx)(Ne,{align:`end`,className:`w-48 rounded-xl p-1.5`,children:(0,H.jsx)(ki,{destructive:!0,disabled:e,icon:ke,label:a(`panelAppsDelete`),onClick:m})})]})]})]}),(0,H.jsx)(_e,{open:l,onOpenChange:u,title:a(`panelAppsDeleteConfirmTitle`),description:`${a(`panelAppsDeleteConfirmDescription`)} ${t.fileName}`,confirmLabel:a(`delete`),variant:`destructive`,onConfirm:r,onCancel:()=>void 0})]})}function ki({destructive:e=!1,disabled:t=!1,icon:n,label:r,onClick:i}){return(0,H.jsxs)(`button`,{type:`button`,className:s(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e?`text-destructive hover:bg-destructive/10`:`text-gray-700 hover:bg-gray-100`),disabled:t,onClick:i,children:[(0,H.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,H.jsx)(`span`,{children:r})]})}function Ai(t){let n=new Date(t);if(Number.isNaN(n.getTime()))return t;let i=r(e()),a=new Date;return n.toDateString()===a.toDateString()?new Intl.DateTimeFormat(i,{hour:`2-digit`,minute:`2-digit`}).format(n):n.getFullYear()===a.getFullYear()?new Intl.DateTimeFormat(i,{month:`numeric`,day:`numeric`}).format(n):new Intl.DateTimeFormat(i,{year:`2-digit`,month:`numeric`,day:`numeric`}).format(n)}function ji({icon:e,title:t}){return e?Mi(e)?(0,H.jsx)(`img`,{src:e,alt:``,"aria-hidden":`true`,className:`h-5 w-5 rounded-sm object-contain`,title:t}):(0,H.jsx)(`span`,{className:`max-w-6 truncate text-center leading-none`,children:e}):(0,H.jsx)(Hr,{className:`h-4 w-4`})}function Mi(e){return e.startsWith(`data:image/`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`/`)}var Ni=[`panel-apps`];function Pi(){return v({queryKey:Ni,queryFn:()=>x.panelApps.listPanelApps(),staleTime:0})}function Fi(){let e=S();return d({mutationFn:({id:e,preferences:t})=>x.panelApps.updatePanelAppPreferences(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:Ni})}})}function Ii(){let e=S();return d({mutationFn:e=>x.panelApps.recordPanelAppOpened(e),onSuccess:()=>{e.invalidateQueries({queryKey:Ni})}})}function Li(){let e=S();return d({mutationFn:e=>x.panelApps.grantClient(e),onSuccess:()=>{e.invalidateQueries({queryKey:Ni})}})}function Ri(){let e=S();return d({mutationFn:e=>x.panelApps.deletePanelApp(e),onSuccess:()=>{e.invalidateQueries({queryKey:Ni})}})}function zi(e,t){return t===`favorites`?Bi(e.filter(e=>e.favorite),`smart`):Bi(t===`recent-open`?e.filter(e=>e.lastOpenedAt):e,t)}function Bi(e,t){return[...e].sort((e,n)=>Vi(e,n,t))}function Vi(e,t,n){return n===`recent-open`?Gi(e.lastOpenedAt,t.lastOpenedAt)||Hi(e,t):n===`updated`?Gi(e.updatedAt,t.updatedAt)||Hi(e,t):n===`name`?Hi(e,t):Ui(e,t)||Number(t.favorite)-Number(e.favorite)||Hi(e,t)}function Hi(e,t){return e.title.localeCompare(t.title)}function Ui(e,t){return Wi(t)-Wi(e)}function Wi(e){return Math.max(new Date(e.lastOpenedAt??0).getTime(),new Date(e.createdAt).getTime(),new Date(e.updatedAt).getTime())}function Gi(e,t){return new Date(t??0).getTime()-new Date(e??0).getTime()}function Ki({headerContent:e,onOpenPanelApp:t}){let n=Pi(),r=Ri(),i=Fi(),o=Ii(),s=Li(),c=us(),[l,u]=(0,A.useState)(`smart`),d=(0,A.useMemo)(()=>zi(n.data?.entries??[],l),[n.data?.entries,l]),f=async e=>{if(await p(e))try{t(await o.mutateAsync(e.id))}catch{t(e)}},p=async e=>!e.clientDeclared||e.clientGranted?!0:await c.serviceActionAuthorizationManager.requestAuthorization({panelAppId:e.appId,actions:[{actionId:`nextclaw.client`,actionTitle:a(`panelAppsClientGrantTitle`),actionDescription:a(`panelAppsClientGrantDescription`),risk:`dangerous`}]})?(await s.mutateAsync(e.appId),!0):!1,m=e=>{i.mutate({id:e.id,preferences:{favorite:!e.favorite}})},h=e=>{r.mutate(e.id)};return n.isLoading?(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-gray-500`,children:a(`panelAppsLoading`)}):n.isError?(0,H.jsx)(`div`,{className:`p-4 text-sm text-rose-600`,children:n.error instanceof Error?n.error.message:a(`panelAppsLoadFailed`)}):(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-white`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-gray-100 px-4 py-3`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[e??(0,H.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-900`,children:a(`panelAppsTitle`)}),n.data?.panelsPath?(0,H.jsx)(Se,{delayDuration:250,children:(0,H.jsxs)(Ce,{children:[(0,H.jsx)(be,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:`rounded p-0.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-700`,"aria-label":a(`panelAppsTitle`),children:(0,H.jsx)(Kr,{className:`h-3.5 w-3.5`})})}),(0,H.jsx)(xe,{side:`bottom`,className:`max-w-[320px] break-all font-mono text-xs`,children:n.data.panelsPath})]})}):null]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void n.refetch(),className:`rounded-md p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-800`,title:a(`panelAppsRefresh`),"aria-label":a(`panelAppsRefresh`),children:(0,H.jsx)(Oe,{className:`h-3.5 w-3.5`})})]}),(0,H.jsx)(`div`,{className:`border-b border-gray-100 px-3 py-2`,children:(0,H.jsx)(Le,{value:l,onValueChange:e=>u(e),children:(0,H.jsxs)(Ie,{className:`grid h-auto w-full grid-cols-5 rounded-lg bg-gray-100/70 p-0.5`,children:[(0,H.jsx)(E,{value:`smart`,className:`px-2 py-1 text-xs`,children:a(`panelAppsSortSmart`)}),(0,H.jsx)(E,{value:`favorites`,className:`px-2 py-1 text-xs`,children:a(`panelAppsFavorites`)}),(0,H.jsx)(E,{value:`recent-open`,className:`px-2 py-1 text-xs`,children:a(`panelAppsSortRecentOpen`)}),(0,H.jsx)(E,{value:`updated`,className:`px-2 py-1 text-xs`,children:a(`panelAppsSortUpdated`)}),(0,H.jsx)(E,{value:`name`,className:`px-2 py-1 text-xs`,children:a(`panelAppsSortName`)})]})})}),d.length===0?(0,H.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center text-sm text-gray-500`,children:a(`panelAppsEmpty`)}):(0,H.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-3`,children:(0,H.jsx)(`div`,{className:`space-y-1.5`,children:d.map(e=>(0,H.jsx)(Oi,{entry:e,deletePending:r.isPending,favoritePending:i.isPending,onDelete:()=>h(e),onOpen:()=>void f(e),onToggleFavorite:()=>m(e)},e.id))})})]})}var qi=class{constructor(e){this.authorizationManager=e,this.handleIframeMessage=({event:e,iframe:t,iframeInstanceId:n,tab:r})=>{this.isBridgeRequest(e.data)&&(!t?.contentWindow||e.source!==t.contentWindow||this.handleBridgeRequest({event:e,iframe:t,iframeInstanceId:n,tab:r},e.data))},this.handleBridgeRequest=async(e,t)=>{try{let n=this.getBridgeContext(t),r=await this.dispatchRequest(n,t);this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!0,data:r})}catch(n){this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!1,error:this.toBridgeError(n)})}},this.dispatchRequest=async(e,t)=>{switch(t.method){case`list`:return await x.serviceApps.listServiceActions({bridgeSessionToken:e.token});case`requestGrant`:return await this.confirmAndGrant(e,this.requireActionId(t));case`revokeGrant`:return await x.serviceApps.revokeServiceAction(this.requireActionId(t),{bridgeSessionToken:e.token});case`invoke`:return await this.invokeWithAuthorization(e,t);case`agent.send`:return await this.sendAgentMessageWithAuthorization(e,t);case`agent.generateObject`:return await this.generateAgentObjectWithAuthorization(e,t);default:throw Error(`Unsupported panel bridge method: ${String(t.method)}`)}},this.invokeWithAuthorization=async(e,t)=>{let n=this.requireActionId(t);try{return await x.serviceApps.invokeServiceAction(n,this.readOptionalRecord(t.payload?.input),{bridgeSessionToken:e.token})}catch(r){if(!(r instanceof C)||r.code!==`AUTHORIZATION_REQUIRED`)throw r;return await this.confirmAndGrant(e,n,this.readOptionalRecord(t.payload?.input)),await x.serviceApps.invokeServiceAction(n,this.readOptionalRecord(t.payload?.input),{bridgeSessionToken:e.token})}},this.sendAgentMessageWithAuthorization=async(e,t)=>{try{return await x.panelApps.sendAgentMessage(this.readAgentSendRequest(t),{bridgeSessionToken:e.token})}catch(n){if(!(n instanceof C)||n.code!==`AUTHORIZATION_REQUIRED`)throw n;return await this.confirmAndGrantAgentCapability(e,`agent:send`),await x.panelApps.sendAgentMessage(this.readAgentSendRequest(t),{bridgeSessionToken:e.token})}},this.generateAgentObjectWithAuthorization=async(e,t)=>{try{return await x.panelApps.generateAgentObject(this.readGenerateObjectRequest(t),{bridgeSessionToken:e.token})}catch(n){if(!(n instanceof C)||n.code!==`AUTHORIZATION_REQUIRED`)throw n;return await this.confirmAndGrantAgentCapability(e,`agent:generateObject`),await x.panelApps.generateAgentObject(this.readGenerateObjectRequest(t),{bridgeSessionToken:e.token})}},this.confirmAndGrantAgentCapability=async(e,t)=>{if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:[{actionId:t,actionTitle:t===`agent:send`?`Send agent message`:`Generate object`,actionDescription:t===`agent:send`?`Send a message to a NextClaw Agent session.`:`Send context to a NextClaw Agent session and receive a structured object.`,risk:`write`}]}))throw new C({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${t}.`});return await x.panelApps.grantAgentCapability(t,{bridgeSessionToken:e.token})},this.confirmAndGrant=async(e,t,n)=>{let r=await this.listGrantCandidateActions(e,t);if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:r.map(e=>({actionId:e.id,actionTitle:e.title,actionDescription:e.description,risk:e.risk})),inputPreview:this.createInputPreview(n)}))throw new C({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${t}.`});let i=await x.serviceApps.grantServiceActions(r.map(e=>e.id),{bridgeSessionToken:e.token}),a=i.grants.find(e=>e.actionId===t)??i.grants[0];if(!a)throw Error(`No permission grant returned for ${t}.`);return a},this.listGrantCandidateActions=async(e,t)=>{let n=await x.serviceApps.listServiceActions({bridgeSessionToken:e.token}),r=n.actions.find(e=>e.id===t);if(r&&r.grantState!==`not-granted`)return[r];let i=n.actions.filter(e=>e.grantState===`not-granted`),a=[...i.filter(e=>e.id===t),...i.filter(e=>e.id!==t)];return a.length>0?a:[{appId:r?.appId??t.split(`.`)[0]??t,description:r?.description,id:t,name:r?.name??t,risk:r?.risk??`dangerous`,title:r?.title}]},this.createInputPreview=e=>{if(!(!e||Object.keys(e).length===0))try{let t=JSON.stringify(e,null,2);return t.length>500?`${t.slice(0,500)}...`:t}catch{return`[unserializable input]`}},this.getBridgeContext=e=>({appId:e.appId,token:e.runtimeToken}),this.requireActionId=e=>{let t=e.payload?.actionId?.trim();if(!t)throw Error(`Panel bridge actionId is required.`);return t},this.readOptionalRecord=e=>{if(e!==void 0)return this.requireRecord(e,`input`)},this.readAgentSendRequest=e=>({payload:this.requireRecord(e.payload?.request,`agent.send request`)}),this.readGenerateObjectRequest=e=>({input:this.requireRecord(e.payload?.input,`generateObject input`)}),this.requireRecord=(e,t)=>{if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`${t} is required.`);return e},this.postResponse=(e,t)=>{e.iframe?.contentWindow?.postMessage(t,`*`)},this.toBridgeError=e=>e instanceof C?{code:e.code,message:e.message,details:e.details}:{message:e instanceof Error?e.message:String(e)},this.isBridgeRequest=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`nextclaw:panel-app-service-actions:request`&&typeof t.requestId==`string`&&typeof t.runtimeToken==`string`&&typeof t.appId==`string`&&(t.method===`invoke`||t.method===`agent.send`||t.method===`agent.generateObject`||t.method===`list`||t.method===`requestGrant`||t.method===`revokeGrant`)}}};function Ji(){return`service-action-auth-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}var Yi=o((e,t)=>({pending:null,requestAuthorization:async n=>await new Promise(r=>{t().pending?.resolve(!1),e({pending:{id:Ji(),...n,resolve:r}})}),resolveAuthorization:n=>{let{pending:r}=t();r&&(r.resolve(n),e({pending:null}))}}));function Xi(){let e=Yi(e=>e.pending),t=Yi(e=>e.resolveAuthorization);return(0,H.jsx)(pe,{open:!!e,onOpenChange:e=>{e||t(!1)},children:(0,H.jsxs)(he,{className:`[&>:last-child]:hidden`,children:[(0,H.jsxs)(me,{children:[(0,H.jsxs)(ge,{className:`flex items-center gap-2`,children:[(0,H.jsx)(ti,{className:`h-4 w-4 text-amber-600`}),a(`serviceActionAuthorizationTitle`)]}),(0,H.jsx)(fe,{children:a(`serviceActionAuthorizationDescription`)})]}),e?(0,H.jsxs)(`div`,{className:`space-y-3 rounded-md border border-gray-100 bg-gray-50 p-3 text-sm`,children:[(0,H.jsx)(Qi,{label:a(`serviceActionAuthorizationSource`),value:e.panelAppId}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`div`,{className:`text-xs font-medium text-gray-500`,children:a(`serviceActionAuthorizationActions`)}),(0,H.jsx)(`div`,{className:`max-h-64 space-y-2 overflow-auto`,children:e.actions.map(e=>(0,H.jsx)(Zi,{action:e},e.actionId))})]}),e.inputPreview?(0,H.jsx)(Qi,{label:a(`serviceActionAuthorizationInput`),value:e.inputPreview}):null]}):null,(0,H.jsxs)(de,{className:`gap-2 sm:gap-0`,children:[(0,H.jsx)(p,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:a(`serviceActionAuthorizationReject`)}),(0,H.jsx)(p,{type:`button`,onClick:()=>t(!0),children:a(`serviceActionAuthorizationAllow`)})]})]})})}function Zi({action:e}){return(0,H.jsxs)(`div`,{className:`space-y-1 rounded border border-gray-200 bg-white px-3 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsx)(`div`,{className:`min-w-0 break-words text-xs font-medium text-gray-900`,children:e.actionTitle??e.actionId}),(0,H.jsx)(`div`,{className:`shrink-0 rounded bg-amber-50 px-1.5 py-0.5 text-[11px] font-medium text-amber-700`,children:e.risk??`dangerous`})]}),(0,H.jsx)(`div`,{className:`break-words text-[11px] text-gray-500`,children:e.actionId}),e.actionDescription?(0,H.jsx)(`div`,{className:`break-words text-xs text-gray-600`,children:e.actionDescription}):null]})}function Qi({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-3`,children:[(0,H.jsx)(`div`,{className:`text-xs font-medium text-gray-500`,children:e}),(0,H.jsx)(`div`,{className:`min-w-0 break-words text-xs text-gray-900`,children:t})]})}var $i=class{constructor(){this.requestAuthorization=async e=>await Yi.getState().requestAuthorization(e)}},ea=[`service-apps`],ta=[`service-actions`],na=[`service-action-grants`];function ra(){return v({queryKey:ea,queryFn:()=>x.serviceApps.listServiceApps()})}function ia(){return v({queryKey:ta,queryFn:()=>x.serviceApps.listServiceActions()})}function aa(){return v({queryKey:na,queryFn:()=>x.serviceApps.listServiceActionGrants()})}function oa(){let e=S();return d({mutationFn:e=>x.serviceApps.restartServiceApp(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:ea}),e.invalidateQueries({queryKey:ta})])}})}function sa(){let e=S();return d({mutationFn:e=>x.serviceApps.deleteServiceApp(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:ea}),e.invalidateQueries({queryKey:ta}),e.invalidateQueries({queryKey:na})])}})}function ca(){let e=S();return d({mutationFn:e=>x.serviceApps.discoverServiceAppActions(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:ea})}})}function la(){let e=S();return d({mutationFn:e=>x.serviceApps.revokeServiceActionGrant(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:ta}),e.invalidateQueries({queryKey:na})])}})}function ua({headerContent:e}){let t=ra(),n=ia(),r=aa(),i=sa(),o=oa(),s=ca(),c=la(),[l,u]=(0,A.useState)({}),d=()=>{t.refetch(),n.refetch(),r.refetch()};if(t.isLoading||n.isLoading||r.isLoading)return(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-gray-500`,children:a(`serviceAppsLoading`)});if(t.isError||n.isError||r.isError){let e=t.error??n.error??r.error;return(0,H.jsx)(`div`,{className:`p-4 text-sm text-rose-600`,children:e instanceof Error?e.message:a(`serviceAppsLoadFailed`)})}let f=t.data?.entries??[],p=n.data?.actions??[],m=r.data?.grants??[],h=e=>{s.mutateAsync(e).then(t=>{u(n=>({...n,[e]:t.actions}))})};return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-white`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-gray-100 px-4 py-3`,children:[(0,H.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:e??(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ei,{className:`h-4 w-4 text-primary`}),(0,H.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-900`,children:a(`serviceAppsTitle`)})]})}),(0,H.jsx)(Se,{delayDuration:250,children:(0,H.jsx)(ma,{icon:Oe,label:a(`serviceAppsRefresh`),onClick:d})})]}),f.length===0?(0,H.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center text-sm text-gray-500`,children:a(`serviceAppsEmpty`)}):(0,H.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-3`,children:(0,H.jsx)(`div`,{className:`space-y-3`,children:f.map(e=>(0,H.jsx)(da,{app:e,actions:l[e.id]??p.filter(t=>t.appId===e.id),grants:m,deletePending:i.isPending,isDiscovering:s.isPending,onDiscover:h,onDelete:e=>void i.mutate(e),onRestart:e=>void o.mutate(e),onRevoke:e=>void c.mutate({actionId:e.actionId,caller:e.caller})},e.id))})})]})}function da({app:e,actions:t,grants:n,deletePending:r,isDiscovering:i,onDiscover:o,onDelete:s,onRestart:c,onRevoke:l}){let[u,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(!1),m=e.status!==`starting`&&e.status!==`stopped`,h=e.status===`running`||e.status===`failed`,g=()=>{d(!1),p(!0)};return(0,H.jsx)(Se,{delayDuration:250,children:(0,H.jsxs)(`section`,{className:`rounded-lg border border-gray-200 bg-white p-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.title}),(0,H.jsx)(fa,{status:e.status})]}),e.description?(0,H.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-gray-500`,children:e.description}):null,e.lastError?(0,H.jsx)(`div`,{className:`mt-2 rounded bg-rose-50 px-2 py-1 text-xs text-rose-700`,children:e.lastError}):null]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,H.jsx)(ma,{disabled:i||!m,icon:Qr,label:a(`serviceAppsDiscoverActions`),tooltip:a(`serviceAppsDiscoverActionsHint`),onClick:()=>o(e.id)}),(0,H.jsx)(ma,{disabled:!h,icon:oi,label:a(`serviceAppsDisconnectRuntime`),tooltip:a(`serviceAppsDisconnectRuntimeHint`),onClick:()=>c(e.id)}),(0,H.jsxs)(Fe,{open:u,onOpenChange:d,children:[(0,H.jsxs)(Ce,{children:[(0,H.jsx)(be,{asChild:!0,children:(0,H.jsx)(Pe,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-800 disabled:opacity-50`,"aria-label":a(`serviceAppsMoreActions`),disabled:r,children:(0,H.jsx)(Jr,{className:`h-3.5 w-3.5`})})})}),(0,H.jsx)(xe,{side:`bottom`,className:`text-xs`,children:a(`serviceAppsMoreActions`)})]}),(0,H.jsx)(Ne,{align:`end`,className:`w-48 rounded-xl p-1.5`,children:(0,H.jsx)(ha,{destructive:!0,disabled:r,icon:ke,label:a(`serviceAppsDelete`),onClick:g})})]})]})]}),(0,H.jsx)(ga,{app:e}),(0,H.jsx)(`div`,{className:`mt-3 space-y-1`,children:t.map(e=>(0,H.jsx)(va,{action:e,grants:n.filter(t=>t.actionId===e.id),onRevoke:l},e.id))}),(0,H.jsx)(_e,{open:f,onOpenChange:p,title:a(`serviceAppsDeleteConfirmTitle`),description:`${a(`serviceAppsDeleteConfirmDescription`)} ${e.title}`,confirmLabel:a(`delete`),variant:`destructive`,onConfirm:()=>s(e.id),onCancel:()=>void 0})]})})}function fa({status:e}){let t=pa(e),n=t.icon;return(0,H.jsxs)(Ce,{children:[(0,H.jsx)(be,{asChild:!0,children:(0,H.jsxs)(`span`,{className:s(`inline-flex shrink-0 items-center gap-1 rounded px-1.5 py-0.5 text-[11px] font-medium`,t.className),"aria-label":t.label,children:[(0,H.jsx)(n,{className:s(`h-3 w-3`,t.iconClassName)}),(0,H.jsx)(`span`,{children:t.label})]})}),(0,H.jsx)(xe,{side:`bottom`,className:`text-xs`,children:t.tooltip})]})}function pa(e){switch(e){case`running`:return{className:`bg-emerald-50 text-emerald-700`,icon:Wr,label:a(`serviceAppsStatus_running`),tooltip:a(`serviceAppsStatusHint_running`)};case`starting`:return{className:`bg-blue-50 text-blue-700`,icon:Ee,iconClassName:`animate-spin`,label:a(`serviceAppsStatus_starting`),tooltip:a(`serviceAppsStatusHint_starting`)};case`failed`:return{className:`bg-rose-50 text-rose-700`,icon:ai,label:a(`serviceAppsStatus_failed`),tooltip:a(`serviceAppsStatusHint_failed`)};case`stopped`:return{className:`bg-gray-100 text-gray-600`,icon:qr,label:a(`serviceAppsStatus_stopped`),tooltip:a(`serviceAppsStatusHint_stopped`)};default:return{className:`bg-slate-100 text-slate-600`,icon:Gr,label:a(`serviceAppsStatus_idle`),tooltip:a(`serviceAppsStatusHint_idle`)}}}function ma({disabled:e=!1,icon:t,label:n,tooltip:r=n,onClick:i}){return(0,H.jsxs)(Ce,{children:[(0,H.jsx)(be,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,onClick:i,disabled:e,className:`rounded-md p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-800 disabled:cursor-not-allowed disabled:text-gray-300 disabled:opacity-60 disabled:hover:bg-transparent`,"aria-label":n,children:(0,H.jsx)(t,{className:`h-3.5 w-3.5`})})}),(0,H.jsx)(xe,{side:`bottom`,className:`max-w-56 text-xs`,children:r})]})}function ha({destructive:e=!1,disabled:t=!1,icon:n,label:r,onClick:i}){return(0,H.jsxs)(`button`,{type:`button`,className:s(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e?`text-destructive hover:bg-destructive/10`:`text-gray-700 hover:bg-gray-100`),disabled:t,onClick:i,children:[(0,H.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,H.jsx)(`span`,{children:r})]})}function ga({app:e}){let t=[e.command,...e.args??[]].filter(e=>!!e?.trim()).join(` `),n=[{label:a(`serviceAppsCommand`),value:t},{label:a(`serviceAppsCwd`),value:e.cwd},{label:a(`serviceAppsManifest`),value:e.manifestPath},{label:a(`serviceAppsLastStarted`),value:e.lastStartedAt},{label:a(`serviceAppsLastReady`),value:e.lastReadyAt},{label:a(`serviceAppsLastFailed`),value:e.lastFailedAt}].filter(e=>e.value);return n.length===0?null:(0,H.jsx)(`dl`,{className:`mt-3 grid grid-cols-[4.5rem_minmax(0,1fr)] gap-x-2 gap-y-1 border-t border-gray-100 pt-2 text-[11px]`,children:n.map(e=>(0,H.jsx)(_a,{label:e.label,value:e.value},e.label))})}function _a({label:e,value:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`text-gray-400`,children:e}),(0,H.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-gray-500`,title:t,children:t})]})}function va({action:e,grants:t,onRevoke:n}){return(0,H.jsxs)(`div`,{className:`rounded bg-gray-50 px-2 py-1.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(si,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`truncate text-xs font-medium text-gray-800`,children:e.title??e.name}),e.description?(0,H.jsx)(`div`,{className:`truncate text-[11px] text-gray-500`,children:e.description}):null]})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.runtimeState?(0,H.jsx)(`span`,{className:`rounded bg-white px-1.5 py-0.5 text-[11px] text-gray-600`,children:a(`serviceAppsRuntimeState_${e.runtimeState}`)}):null,(0,H.jsx)(`span`,{className:`rounded bg-white px-1.5 py-0.5 text-[11px] text-gray-600`,children:e.risk})]})]}),t.map(e=>(0,H.jsxs)(`div`,{className:`mt-1 flex items-center justify-between gap-2 pl-5`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11px] text-gray-500`,children:[(0,H.jsx)(ni,{className:`h-3 w-3 shrink-0 text-emerald-500`}),(0,H.jsxs)(`span`,{className:`truncate`,children:[a(`serviceAppsGrantedTo`),` `,e.caller.appId]})]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:`rounded-md p-1 text-gray-400 transition-colors hover:bg-white hover:text-rose-600`,title:a(`serviceAppsRevokeGrant`),"aria-label":a(`serviceAppsRevokeGrant`),children:(0,H.jsx)(ke,{className:`h-3 w-3`})})]},`${e.caller.surface}:${e.caller.appId}:${e.actionId}`))]})}function ya({activeTab:e,onActiveTabChange:t,onOpenPanelApp:n}){let r=(0,H.jsx)(Le,{value:e,onValueChange:e=>t(e),children:(0,H.jsxs)(Ie,{className:`grid h-auto w-[min(340px,100%)] grid-cols-2 rounded-lg bg-gray-100/70 p-0.5`,children:[(0,H.jsxs)(E,{value:`panel-apps`,className:`gap-1.5 px-2 py-1.5 text-xs`,children:[(0,H.jsx)(Hr,{className:`h-3.5 w-3.5`}),a(`panelAppsTitle`)]}),(0,H.jsxs)(E,{value:`service-apps`,className:`gap-1.5 px-2 py-1.5 text-xs`,children:[(0,H.jsx)(ei,{className:`h-3.5 w-3.5`}),a(`serviceAppsTitle`)]})]})});return(0,H.jsx)(`div`,{className:`h-full min-h-0 bg-white`,children:e===`panel-apps`?(0,H.jsx)(Ki,{headerContent:r,onOpenPanelApp:n}):(0,H.jsx)(ua,{headerContent:r})})}function ba({appTitle:e,onOpenApps:t,onRefresh:n}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3.5 py-2 bg-white border-b border-gray-100 shrink-0`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:t,className:`inline-flex shrink-0 items-center rounded-md p-1.5 text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,title:a(`appsTitle`),"aria-label":a(`appsTitle`),children:(0,H.jsx)(ve,{className:`h-3.5 w-3.5`})}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium text-gray-600`,title:e,children:e}),(0,H.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-md p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-800`,title:a(`panelAppsRefreshCurrent`),"aria-label":a(`panelAppsRefreshCurrent`),children:(0,H.jsx)(Oe,{className:`h-3.5 w-3.5`})})]})}function xa(e){return e.split(`/`).map(e=>e.trim()).filter(e=>e.length>0)}function J(e){let t=e.trim();try{let e=new URL(t);return{authority:e.hostname,pathSegments:xa(e.pathname),pathname:e.pathname,raw:t,scheme:e.protocol.replace(/:$/,``).toLowerCase(),searchParams:e.searchParams}}catch{return{authority:``,pathSegments:xa(t),pathname:t,raw:t,scheme:``,searchParams:new URLSearchParams}}}var Sa=class{constructor(e,t){this.routeDefinitions=e,this.options=t,this.resolve=e=>{let t=J(e);return this.findDefinition(t).resolve(t)},this.normalize=e=>this.options.getNormalizedUri(this.resolve(e)),this.areEquivalent=(e,t)=>this.findDefinition(J(e)).areEquivalent?.(e,t)??this.normalize(e)===this.normalize(t),this.findDefinition=e=>{let t=this.routeDefinitions.find(t=>t.match(e));if(!t)throw Error(`Unsupported resource URI: ${e.raw}`);return t}}},Ca=`home`,wa=`nextclaw://new-tab`,Ta=`apps`,Y=`nextclaw://apps`,Ea=`${Y}?tab=service-apps`,Da=`panel-app`,Oa=`panel-apps`;function ka(e){return e===`panel-apps`||e===`service-apps`}function Aa(e=Oa){return e===Oa?Y:Ea}function ja(e){try{let t=new URL(e).searchParams.get(`tab`);return ka(t)?t:Oa}catch{return Oa}}function Ma(e){return Aa(ja(e))}function Na(e){return`nextclaw://panel-app/${encodeURIComponent(e)}`}function Pa(e){return e.startsWith(`data:image/`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`/`)}function Fa(e){let t=e.icon?.trim();if(t)return Pa(t)?{type:`url`,url:t}:{type:`text`,value:t}}function Ia(e){return{dedupeKey:`panel-app:${e.id}`,dockIcon:Fa(e),historyPolicy:`managed`,kind:Da,resourceUri:Na(e.id),title:e.title,url:e.contentPath}}function La(e,t){return e===t||e.startsWith(`${t}?`)||e.startsWith(`${t}/`)}function Ra(e){let t=e.pathSegments.join(`/`);return ze(t?`/${t}`:`/`,`docs`)}function za(e){let t=e.filter(e=>e.trim().length>0).map(e=>encodeURIComponent(decodeURIComponent(e))).join(`/`);return t?`nextclaw://docs/${t}`:`nextclaw://docs`}function Ba(e){let t=k(e),n=t.startsWith(`/`)?t:(()=>{try{return new URL(e).pathname}catch{return``}})();return n?za(n.split(`/`)):`nextclaw://docs`}function X(e){if(e.scheme===`nextclaw`&&e.authority===`panel-app`)return e.pathSegments[0]??``;let[t,n,r,i]=e.pathSegments;return t===`api`&&n===`panel-apps`&&r!==void 0&&r.length>0&&i===`content`?r:``}function Va(e){return X(e).length>0}function Ha(e){let t=X(e);return t?`/api/panel-apps/${encodeURIComponent(decodeURIComponent(t))}/content`:`nextclaw://panel-app`}function Ua(e){let t=X(e);return t?`nextclaw://panel-app/${encodeURIComponent(decodeURIComponent(t))}`:`nextclaw://panel-app`}function Wa(e,t){let n=J(e),r=J(t),i=X(n),a=X(r);return i.length>0&&a.length>0?decodeURIComponent(i)===decodeURIComponent(a):e===t}var Z=[{defaultUrl:()=>wa,id:`home`,kind:Ca,match:e=>e.raw===wa,resolve:()=>({historyPolicy:`managed`,kind:Ca,resourceUri:wa,title:a(`docBrowserHomeTitle`),url:wa}),areEquivalent:(e,t)=>e===t},{defaultUrl:O,id:`docs-url`,kind:`docs`,match:e=>He(e.raw),resolve:e=>{let t=ze(e.raw,`docs`);return{historyPolicy:`managed`,kind:`docs`,resourceUri:Ba(t),title:a(`docBrowserHelp`),url:t}},areEquivalent:(e,t)=>k(e)===k(t)},{defaultUrl:O,id:`nextclaw-docs`,kind:`docs`,match:e=>e.scheme===`nextclaw`&&e.authority===`docs`,resolve:e=>{let t=Ra(e);return{historyPolicy:`managed`,kind:`docs`,resourceUri:za(e.pathSegments),title:a(`docBrowserHelp`),url:t}},areEquivalent:(e,t)=>k(e)===k(t)},{defaultUrl:()=>Y,id:`apps`,kind:Ta,match:e=>La(e.raw,Y),resolve:e=>{let t=Ma(e.raw);return{dedupeKey:`apps`,historyPolicy:`managed`,kind:Ta,resourceUri:t,title:a(t===`nextclaw://apps`?`appsTitle`:`serviceAppsTitle`),url:t}},areEquivalent:(e,t)=>Ma(e)===Ma(t)},{defaultUrl:()=>`nextclaw://panel-app`,id:`panel-app`,kind:Da,match:e=>e.scheme===`nextclaw`&&e.authority===`panel-app`||Va(e),resolve:e=>{let t=Ha(e),n=X(e);return{dedupeKey:n?`panel-app:${decodeURIComponent(n)}`:void 0,historyPolicy:`managed`,kind:Da,resourceUri:Ua(e),title:a(`panelAppsTitle`),url:t}},areEquivalent:Wa},{defaultUrl:()=>`about:blank`,id:`content`,kind:`content`,match:()=>!0,resolve:e=>({historyPolicy:`managed`,kind:`content`,resourceUri:e.raw||`about:blank`,title:Ge(e.raw,`content`,`Detail`),url:e.raw||`about:blank`}),areEquivalent:(e,t)=>e===t}],Ga=Z.map(e=>({areEquivalent:e.areEquivalent,id:e.id,match:e.match,resolve:e.resolve}));function Ka(){return[{id:`apps`,label:a(`appsTitle`),target:{type:`right-panel-resource`,uri:Y}},{id:`service-apps`,label:a(`serviceAppsTitle`),target:{type:`right-panel-resource`,uri:Ea}},{id:`docs`,label:a(`docBrowserHelp`),target:{options:{newTab:!0},type:`right-panel-resource`,uri:O()}},{id:`skill-marketplace`,label:a(`marketplaceSkillsPageTitle`),target:{path:`/marketplace/skills`,type:`app-route`}}]}var qa={apps:{accentClassName:`bg-emerald-50 text-emerald-700`,hoverAccentClassName:`group-hover:bg-emerald-100`,icon:(0,H.jsx)(we,{className:`h-5 w-5`})},"service-apps":{accentClassName:`bg-sky-50 text-sky-700`,hoverAccentClassName:`group-hover:bg-sky-100`,icon:(0,H.jsx)(Yr,{className:`h-5 w-5`})},docs:{accentClassName:`bg-amber-50 text-amber-700`,hoverAccentClassName:`group-hover:bg-amber-100`,icon:(0,H.jsx)(ye,{className:`h-5 w-5`})},"skill-marketplace":{accentClassName:`bg-rose-50 text-rose-700`,hoverAccentClassName:`group-hover:bg-rose-100`,icon:(0,H.jsx)(Ur,{className:`h-5 w-5`})}};function Ja(e){return qa[e.id]??{accentClassName:`bg-gray-50 text-gray-700`,hoverAccentClassName:`group-hover:bg-gray-100`,icon:(0,H.jsx)(we,{className:`h-5 w-5`})}}function Ya({open:e}){let t=an(),n=Ka(),r=n=>{if(n.type===`app-route`){t(n.path);return}e(n.uri,n.options)};return(0,H.jsx)(`div`,{className:`h-full overflow-auto bg-background px-4 py-5`,children:(0,H.jsx)(`div`,{className:`mx-auto w-full max-w-[520px]`,children:(0,H.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(76px,1fr))] gap-x-2 gap-y-4`,children:n.map(e=>{let t=Ja(e);return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>r(e.target),className:`group flex min-h-[68px] flex-col items-center gap-1.5 rounded-md px-1.5 py-1.5 text-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,H.jsx)(`span`,{className:s(`flex h-10 w-10 shrink-0 items-center justify-center rounded-md transition-colors`,t.accentClassName,t.hoverAccentClassName),children:t.icon}),(0,H.jsx)(`span`,{className:`line-clamp-2 min-w-0 max-w-full text-xs font-medium leading-snug text-gray-700 transition-colors group-hover:text-gray-900`,children:e.label})]},e.id)})})})})}function Xa(e){return e&&He(e)?`docs`:`content`}var Za=class{constructor(){this.resourceUriResolver=new Sa(Ga,{getNormalizedUri:e=>e.resourceUri??e.url}),this.resolve=e=>this.resourceUriResolver.resolve(e),this.normalize=e=>this.resourceUriResolver.normalize(e),this.areEquivalent=(e,t)=>this.resourceUriResolver.areEquivalent(e,t),this.resolveOpenTarget=e=>{let{activeTab:t,kind:n,url:r}=e,i=this.resolveRouteDefinition(r,n,t),a=r?.trim()||(!n&&t&&t.kind!==`docs`?t.currentUrl:i.defaultUrl());return i.resolve(J(a))},this.areUrlsEquivalent=(e,t,n,r)=>n===r?this.resolveRouteDefinition(e,n).areEquivalent?.(e,t)??this.areEquivalent(e,t):!1,this.usesManagedHistory=e=>this.resolveRouteDefinition(e.currentUrl,e.kind).resolve(J(e.currentUrl)).historyPolicy===`managed`,this.resolveRouteDefinition=(e,t,n)=>{let r=t??(e?void 0:n?.kind),i=r?Z.find(e=>e.kind===r):void 0;if(i)return i;let a=e?J(e):null,o=a?Z.find(e=>e.match(a)):void 0;if(o)return o;let s=t??n?.kind??Xa(e);return Z.find(e=>e.kind===s)??Z[Z.length-1]}}},Qa=Ta,$a=Da,eo=`panel-apps`,to=[`allow-scripts`,`allow-forms`,`allow-modals`,`allow-popups`,`allow-popups-to-escape-sandbox`,`allow-downloads`,`allow-pointer-lock`,`allow-presentation`].join(` `);function no(e){return e===`panel-apps`||e===`service-apps`}function ro(e=eo){return e===eo?Y:Ea}function io(e){try{let t=new URL(e).searchParams.get(`tab`);return no(t)?t:eo}catch{return eo}}function ao(e){e.open(ro(),{kind:Qa,title:a(`appsTitle`),dedupeKey:`apps`})}var oo={[Ca]:{getTitle:()=>a(`docBrowserHomeTitle`),renderContent:({open:e})=>(0,H.jsx)(Ya,{open:e})},[Qa]:{getTitle:()=>a(`appsTitle`),renderIcon:()=>(0,H.jsx)(we,{className:`w-4 h-4 text-primary shrink-0`}),renderContent:({currentUrl:e,open:t,openTarget:n})=>(0,H.jsx)(ya,{activeTab:io(e),onActiveTabChange:e=>t(ro(e),{activate:!1,kind:Qa,title:a(`appsTitle`),dedupeKey:`apps`}),onOpenPanelApp:e=>n(Ia(e))})},[$a]:{getIframeSandbox:()=>to,getTitle:e=>e.title||a(`panelAppsTitle`),onIframeMessage:e=>ss().panelAppBridgeManager.handleIframeMessage(e),renderIcon:()=>(0,H.jsx)(Hr,{className:`w-4 h-4 text-primary shrink-0`}),renderToolbar:({open:e,refreshIframe:t,tab:n})=>(0,H.jsx)(ba,{appTitle:n.title||a(`panelAppsTitle`),onOpenApps:()=>ao({open:e}),onRefresh:t})}},so=`nextclaw://docs`;function co(){return[{builtIn:!0,icon:{type:`builtin`,name:`apps`},id:`apps`,label:a(`appsTitle`),removable:!1,target:{type:`right-panel-resource`,uri:Y}},{builtIn:!0,icon:{type:`builtin`,name:`service-apps`},id:`service-apps`,label:a(`serviceAppsTitle`),removable:!1,target:{type:`right-panel-resource`,uri:Ea}},{builtIn:!0,icon:{type:`builtin`,name:`docs`},id:`docs`,label:a(`docBrowserHelp`),removable:!1,target:{type:`right-panel-resource`,uri:so}},{builtIn:!0,icon:{type:`builtin`,name:`new-tab`},id:`new-tab`,label:a(`docBrowserHomeTitle`),removable:!1,target:{type:`right-panel-resource`,uri:wa}}]}var lo=[`apps`,`docs`,`new-tab`,`panel-app`,`service-apps`];function uo(e){return!!e&&typeof e==`object`}function fo(e){return lo.includes(e)}function po(e){return!uo(e)||typeof e.type!=`string`?null:e.type===`builtin`&&fo(e.name)?{type:`builtin`,name:e.name}:e.type===`url`&&typeof e.url==`string`&&e.url.trim().length>0?{type:`url`,url:e.url.trim()}:e.type===`text`&&typeof e.value==`string`&&e.value.trim().length>0?{type:`text`,value:e.value.trim()}:null}function mo(e){if(!uo(e)||typeof e.id!=`string`||e.id.trim().length===0||typeof e.label!=`string`||e.label.trim().length===0||typeof e.createdAt!=`string`||e.createdAt.trim().length===0||!uo(e.target)||e.target.type!==`right-panel-resource`||typeof e.target.uri!=`string`||e.target.uri.trim().length===0)return null;let t=po(e.icon);return t?{createdAt:e.createdAt,icon:t,id:e.id.trim(),label:e.label.trim(),target:{type:`right-panel-resource`,uri:e.target.uri.trim()}}:null}function ho(e){if(!Array.isArray(e))return[];let t=new Map;return e.forEach(e=>{let n=mo(e);n&&t.set(n.id,n)}),Array.from(t.values())}function go(e,t){return{createdAt:t,icon:e.icon,id:e.id,label:e.label,target:e.target}}function _o(e){return{builtIn:!1,icon:e.icon,id:e.id,label:e.label,removable:!0,target:e.target}}function vo(e,t){let n=new Set(e.map(e=>e.id)),r=new Set(e.map(e=>e.target.uri)),i=t.filter(e=>!n.has(e.id)&&!r.has(e.target.uri)).map(_o);return[...e,...i]}var yo=`nextclaw.side-dock.state`,bo=1;function xo(e){return!!e&&typeof e==`object`}var So=o()(Re(e=>({pinnedItems:[],setPinnedItems:t=>e({pinnedItems:ho(t)})}),{name:yo,version:bo,storage:qe(()=>window.localStorage),partialize:e=>({pinnedItems:e.pinnedItems}),merge:(e,t)=>{let n=xo(e)?ho(e.pinnedItems):[];return{...t,pinnedItems:n}}})),Co={apps:we,docs:ye,"new-tab":De,"panel-app":Hr,"service-apps":Hr},wo=/^\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?(?:\u200D\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?)*$/u;function To(e){return wo.test(e.trim())}function Eo({icon:e}){if(e.type===`url`)return(0,H.jsx)(`img`,{src:e.url,alt:``,className:`h-5 w-5 rounded object-cover`});if(e.type===`text`)return To(e.value)?(0,H.jsx)(`span`,{className:`flex h-7 w-7 items-center justify-center text-[20px] leading-none`,"aria-hidden":`true`,children:e.value}):(0,H.jsx)(`span`,{className:`max-w-7 truncate text-center text-[13px] font-semibold leading-none`,"aria-hidden":`true`,children:e.value});let t=Co[e.name];return(0,H.jsx)(t,{className:`h-5 w-5`,"aria-hidden":`true`})}function Do({active:e,item:t,onOpen:n,onUnpin:r}){let{label:i}=t;return(0,H.jsxs)(Ce,{children:[(0,H.jsxs)(`div`,{className:`group relative`,children:[(0,H.jsx)(be,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,"aria-label":i,title:i,"data-side-dock-item-id":t.id,onClick:()=>n(t),className:s(`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors`,`hover:bg-primary/10 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,e?`bg-primary/10 text-primary`:`bg-transparent`),children:(0,H.jsx)(Eo,{icon:t.icon})})}),t.removable?(0,H.jsx)(`button`,{type:`button`,"aria-label":a(`sideDockUnpinItem`),title:a(`sideDockUnpinItem`),onClick:e=>{e.stopPropagation(),r(t)},className:`absolute -right-1 -top-1 hidden h-4 w-4 items-center justify-center rounded-full bg-background text-muted-foreground shadow-sm ring-1 ring-border/70 transition-colors hover:bg-muted hover:text-foreground group-hover:flex focus-visible:flex focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,H.jsx)(Ae,{className:`h-3 w-3`,"aria-hidden":`true`})}):null]}),(0,H.jsx)(xe,{side:`left`,children:i})]})}function Oo(e){return e?.trim()??``}function ko(e,t,n,r=!1){if(!t||!n)return!1;let i=Oo(e.target.uri),a=Oo(n.resourceUri);return a&&a===i||Oo(n.currentUrl)===i?!0:r?!1:e.id===`docs`&&n.kind===`docs`}function Ao(e,t){if(!t)return!1;let n=Oo(t.resourceUri),r=Oo(t.currentUrl);return e.some(e=>{let t=Oo(e.target.uri);return t===n||t===r})}function jo({manager:e}){let t=So(e=>e.pinnedItems),{currentTab:n,isOpen:r}=Ue(),i=vo(co(),t),a=Ao(i,n);return(0,H.jsx)(Se,{delayDuration:250,children:(0,H.jsx)(`aside`,{"data-testid":`side-dock`,className:`z-30 flex h-full w-14 shrink-0 flex-col items-center gap-1 border-l border-border/60 bg-background/95 px-2 py-3`,children:i.map(t=>(0,H.jsx)(Do,{active:ko(t,r,n,a),item:t,onOpen:e.openItem,onUnpin:t=>e.unpinItem(t.id)},t.id))})})}var Mo=`pinned`,No=new Set([`apps`,`docs`,`new-tab`,`panel-app`,`service-apps`]);function Q(e){return e.trim()}function Po(e){let t=0;return Array.from(Q(e)).forEach(e=>{t=t*31+e.charCodeAt(0)>>>0}),`${Mo}-${Q(e).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()||`resource`}-${t.toString(36)}`}function Fo(e){return e?.type===`builtin`&&No.has(e.name)?{type:`builtin`,name:e.name}:e?.type===`url`&&e.url.trim().length>0?{type:`url`,url:e.url.trim()}:e?.type===`text`&&e.value.trim().length>0?{type:`text`,value:e.value.trim()}:null}function Io(e){return e.kind===`docs`?`docs`:e.kind===`home`?`new-tab`:e.kind===`apps`?e.resourceUri?.includes(`service-apps`)?`service-apps`:`apps`:e.kind===`panel-app`?`panel-app`:`apps`}var Lo=class{constructor(e){this.docBrowserManager=e,this.getItems=()=>vo(co(),So.getState().pinnedItems),this.openItem=e=>{e.target.type===`right-panel-resource`&&this.docBrowserManager.open(e.target.uri,{dockIcon:e.icon,title:e.label})},this.getDockState=e=>{let t=this.getTabResourceUri(e);if(!t)return{canDock:!1,isDocked:!1,removable:!1};let n=this.findItemByUri(t);return{canDock:!0,isDocked:!!n,removable:n?.removable===!0}},this.pinTab=(e,t=new Date().toISOString())=>{let n=this.getTabResourceUri(e);!e||!n||this.findItemByUri(n)||this.pinItem({builtIn:!1,icon:Fo(e.dockIcon)??{type:`builtin`,name:Io(e)},id:Po(n),label:e.title.trim()||n,removable:!0,target:{type:`right-panel-resource`,uri:n}},t)},this.unpinTab=e=>{let t=this.getTabResourceUri(e),n=t?this.findItemByUri(t):void 0;n?.removable&&this.unpinItem(n.id)},this.pinItem=(e,t=new Date().toISOString())=>{if(!e.removable)return;let n=Q(e.target.uri);this.setPinnedItems(r=>r.some(t=>t.id===e.id||Q(t.target.uri)===n)?r:[...r,go({...e,target:{...e.target,uri:n}},t)])},this.unpinItem=e=>{this.setPinnedItems(t=>t.filter(t=>t.id!==e))},this.reorderPinnedItems=e=>{this.setPinnedItems(t=>{let n=new Map(t.map(e=>[e.id,e])),r=e.map(e=>n.get(e)).filter(e=>e!==void 0),i=new Set(r.map(e=>e.id)),a=t.filter(e=>!i.has(e.id));return[...r,...a]})},this.setPinnedItems=e=>{let{pinnedItems:t,setPinnedItems:n}=So.getState();n(e(t))},this.getTabResourceUri=e=>{let t=e?.resourceUri??e?.currentUrl,n=t?Q(t):``;return n.length>0?n:null},this.findItemByUri=e=>{let t=Q(e);return this.getItems().find(e=>Q(e.target.uri)===t)}}},Ro=class{constructor(){this.resolveOpenTarget=e=>{let{activeTab:t,kind:n,url:r}=e,i=n??(r?void 0:t?.kind)??(r&&He(r)?`docs`:`home`),o=r?.trim()||(!n&&t&&t.kind!==`docs`?t.currentUrl:i===`home`?`nextclaw://new-tab`:i===`docs`?O():`about:blank`),s=i===`docs`?ze(o,`docs`):o;return{historyPolicy:`managed`,kind:i,title:i===`home`?a(`docBrowserHomeTitle`):Ge(s,i,i===`docs`?a(`docBrowserHelp`):`Detail`),url:s}},this.areUrlsEquivalent=(e,t,n,r)=>n===r?n===`docs`?k(e)===k(t):e===t:!1,this.usesManagedHistory=e=>e.currentUrl!==Ve}};function zo(e){return e.index>0&&e.entries.length>0}function Bo(e){return e.index>=0&&e.index<e.entries.length-1}function Vo(e,t,n=Object.is){let r=Wo(e),i=e.entries[r];if(i&&n(i,t))return{entries:e.entries,index:r};let a=[...e.entries.slice(0,r+1),t];return{entries:a,index:a.length-1}}function Ho(e,t){let n=Wo(e),r=t===`back`?n-1:n+1,i=e.entries[r];return i?{history:{entries:e.entries,index:r},entry:i}:null}function Uo(e,t,n){let r=Wo(e),i=e.entries.filter(t);if(i.length===0)return n===void 0?{entries:[],index:0}:{entries:[n],index:0};let a=e.entries.slice(0,r+1).filter(t);return{entries:i,index:Math.min(Math.max(0,a.length-1),i.length-1)}}function Wo(e){return e.entries.length===0?0:Number.isInteger(e.index)?Math.min(Math.max(0,e.index),e.entries.length-1):e.entries.length-1}var Go=new Ro;function Ko(e,t,n){return{...e,tabs:e.tabs.map(e=>e.id===t?n(e):e)}}function qo(e,t){return Ko(e,e.activeTabId,t)}function Jo(e,t){let n=[...e.history.slice(0,e.historyIndex+1),t];return{history:n,historyIndex:n.length-1}}function Yo(e,t,n){let r=t.resourceUri??t.url,i=n.resourceUri??n.url;return t.tabId===n.tabId&&t.kind===n.kind&&e.areUrlsEquivalent(r,i,t.kind,n.kind)}function Xo(e,t){return{kind:t.kind,resourceUri:t.resourceUri??t.url,tabId:e,url:t.url}}function $(e,t,n){let r=Vo({entries:t.activeHistory,index:t.activeHistoryIndex},n,(t,n)=>Yo(e,t,n));return{...t,activeHistory:[...r.entries],activeHistoryIndex:r.index}}function Zo(e,t,n){for(let r=t.history.length-1;r>=0;--r)if(e.areUrlsEquivalent(t.history[r],n,t.kind,t.kind))return r;return-1}function Qo(e,t,n){let r=t.tabs.find(e=>e.id===n.tabId);if(!r)return t;let i=n.resourceUri??n.url,a=e.resolveOpenTarget({activeTab:r,kind:n.kind,url:i}),o=Zo(e,r,a.url),s=n.resourceUri!==void 0&&n.resourceUri===r.resourceUri;return Ko({...t,activeTabId:r.id,isOpen:!0},r.id,e=>({...e,currentUrl:a.url,dedupeKey:a.dedupeKey,dockIcon:a.dockIcon??e.dockIcon,historyIndex:o>=0?o:e.historyIndex,kind:a.kind,resourceUri:a.resourceUri??a.url,title:s?e.title:a.title}))}function $o(e,t,n,r,i){let a={...t,title:r?.title||n.title||t.title,kind:n.kind,resourceUri:n.resourceUri??n.url,dockIcon:r?.dockIcon??n.dockIcon,dedupeKey:i};return e.areUrlsEquivalent(t.currentUrl,n.url,t.kind,n.kind)?a:{...a,currentUrl:n.url,...Jo(t,n.url),navVersion:t.navVersion+1}}function es(e,t){return!e.isOpen&&e.tabs.length===1&&t?.kind===`home`&&t.currentUrl===`nextclaw://new-tab`}function ts(e,t,n,r){let{activate:i,dedupeKey:a,newTab:o,title:s}=r??{},c=a?.trim()||n.dedupeKey,l=t.tabs.find(e=>e.id===t.activeTabId)??t.tabs[0],u=c?t.tabs.find(e=>e.dedupeKey===c):void 0;if(u){let a=Ko(t,u.id,t=>$o(e,t,n,r,c)),o=i!==!1,s=o?u.id:t.activeTabId,l={...a,activeTabId:s,isOpen:!0};return o||u.id===t.activeTabId?$(e,l,Xo(u.id,n)):l}if(o||c||!l||l.kind!==n.kind){let i=We(n.url,n.kind,s??n.title,c,n.resourceUri??n.url,r?.dockIcon??n.dockIcon);return es(t,l)?{...t,isOpen:!0,tabs:[i],activeTabId:i.id,activeHistory:[D(i)],activeHistoryIndex:0}:$(e,{...t,isOpen:!0,tabs:[...t.tabs,i],activeTabId:i.id},D(i))}return $(e,{...qo(t,t=>$o(e,t,n,r,c)),isOpen:!0},Xo(t.activeTabId,n))}function ns(e,t,n,r){let i=t.tabs.find(e=>e.id===t.activeTabId)??t.tabs[0];return ts(e,t,e.resolveOpenTarget({activeTab:i,kind:r?.kind,url:n}),r)}var rs=class{constructor(e=Go){this.routeResolver=e,this.setSnapshot=e=>{Ke.getState().setSnapshot(e)},this.open=(e,t)=>{this.setSnapshot(n=>ns(this.routeResolver,n,e,t))},this.openTarget=(e,t)=>{this.setSnapshot(n=>ts(this.routeResolver,n,e,{...t,dedupeKey:t?.dedupeKey??e.dedupeKey,kind:t?.kind??e.kind,title:t?.title??e.title}))},this.openNewTab=()=>{this.open(void 0,{kind:Je,newTab:!0})},this.close=()=>{this.setSnapshot(e=>({...e,isOpen:!1}))},this.toggleMode=()=>{this.setSnapshot(e=>({...e,mode:e.mode===`floating`?`docked`:`floating`}))},this.navigate=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=We(O(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id,isOpen:!0}}let n=qo(t,t=>{if(!this.routeResolver.usesManagedHistory(t))return t;let n=this.routeResolver.resolveOpenTarget({activeTab:t,url:e});return this.routeResolver.areUrlsEquivalent(t.currentUrl,n.url,t.kind,n.kind)?t:{...t,currentUrl:n.url,dedupeKey:n.dedupeKey,dockIcon:n.dockIcon,...Jo(t,n.url),kind:n.kind,navVersion:t.navVersion+1,resourceUri:n.resourceUri??n.url,title:n.title}}),r=n.tabs.find(e=>e.id===n.activeTabId);return r?$(this.routeResolver,n,D(r)):n})},this.syncUrl=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=We(O(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id}}let n=qo(t,t=>{if(!this.routeResolver.usesManagedHistory(t))return t;let n=this.routeResolver.resolveOpenTarget({activeTab:t,kind:t.kind,url:e});return this.routeResolver.areUrlsEquivalent(t.currentUrl,n.url,t.kind,n.kind)?t:{...t,currentUrl:n.url,dedupeKey:n.dedupeKey,dockIcon:n.dockIcon,...Jo(t,n.url),kind:n.kind,resourceUri:n.resourceUri??n.url,title:n.title}}),r=n.tabs.find(e=>e.id===n.activeTabId);return r?$(this.routeResolver,n,D(r)):n})},this.goBack=()=>{this.setSnapshot(e=>{let t=Ho({entries:e.activeHistory,index:e.activeHistoryIndex},`back`);return t?Qo(this.routeResolver,{...e,activeHistory:[...t.history.entries],activeHistoryIndex:t.history.index},t.entry):e})},this.goForward=()=>{this.setSnapshot(e=>{let t=Ho({entries:e.activeHistory,index:e.activeHistoryIndex},`forward`);return t?Qo(this.routeResolver,{...e,activeHistory:[...t.history.entries],activeHistoryIndex:t.history.index},t.entry):e})},this.closeTab=e=>{this.setSnapshot(t=>{if(t.tabs.length<=1)return{...Be(),isOpen:!1};let n=t.tabs.findIndex(t=>t.id===e);if(n<0)return t;let r=t.tabs.filter(t=>t.id!==e),i=t.activeTabId===e?r[Math.max(0,n-1)]?.id??r[0].id:t.activeTabId,a={...t,tabs:r,activeTabId:i},o=r.find(e=>e.id===i)??r[0],s=Uo({entries:a.activeHistory,index:a.activeHistoryIndex},t=>t.tabId!==e,D(o)),c={...a,activeHistory:[...s.entries],activeHistoryIndex:s.index};return t.activeTabId===e?$(this.routeResolver,c,D(o)):c})},this.setActiveTab=e=>{this.setSnapshot(t=>{if(!t.tabs.some(t=>t.id===e))return t;let n=t.tabs.find(t=>t.id===e);return n?$(this.routeResolver,{...t,activeTabId:e,isOpen:!0},D(n)):t})}}},is=class{constructor(){this.accountManager=new Di,this.rightPanelResourceRouteResolver=new Za,this.docBrowserManager=new rs(this.rightPanelResourceRouteResolver),this.sideDockManager=new Lo(this.docBrowserManager),this.serviceActionAuthorizationManager=new $i,this.panelAppBridgeManager=new qi(this.serviceActionAuthorizationManager),this.remoteAccessManager=new gi({accountManager:this.accountManager})}},as=null;function os(){return as??=new is,as}function ss(){return os()}var cs=(0,A.createContext)(null);function ls({children:e}){let t=(0,A.useMemo)(()=>os(),[]);return(0,H.jsx)(cs.Provider,{value:t,children:e})}function us(){let e=(0,A.useContext)(cs);if(!e)throw Error(`useAppPresenter must be used inside AppPresenterProvider`);return e}export{ai as A,Mn as B,W as C,li as D,hi as E,Ur as F,sn as G,Fn as H,xr as I,Qe as K,wr as L,$r as M,Jr as N,ci as O,Wr as P,jn as R,ui as S,pi as T,V as U,Nn as V,an as W,Ti as _,Bo as a,gi as b,Ho as c,oo as d,ao as f,Ei as g,Xi as h,zo as i,ni as j,si as k,jo as l,Ia as m,us as n,Uo as o,Na as p,ss as r,Vo as s,ls as t,So as u,xi as v,G as w,K as x,bi as y,Tr as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"./dist-NZRV-BxD.js";var t=e(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"./dist-NZRV-BxD.js";var t=e(`BookOpen`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]);export{t};
|
|
@@ -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-Dsotw5vM.js";import{Dt as c,Ft as l,Ht as u,It as d,Lt as f,Nt as p,Pt as m,Ut as h,Vt as g,ct as _,en as v,it as y,mt as b,nt as x,rt as S}from"./api-B50yVdT8.js";import{c as C}from"./dist-NZRV-BxD.js";import{t as w}from"./book-open-Bd2Xbrrc.js";import{t as T}from"./external-link-528k6MDD.js";import{t as E}from"./key-round-D3vD9dj7.js";import{t as D}from"./loader-circle-DV9TSRns.js";import{t as ee}from"./search-D7L-TCH-.js";import{t as te}from"./x-fkIWvi07.js";import{t as O}from"./status-dot-Dm4h-bjn.js";import{i as k,n as ne,r as re,t as ie}from"./tabs-CJvw5Lqp.js";import{$ as ae,B as oe,H as se,K as ce,U as le,V as A,X as ue,h as j,m as M,nt as de,st as fe,z as N}from"./index-CMNrRhnG.js";import{n as P,o as pe,p as me,r as F,t as I}from"./use-config-TzwzTgg0.js";import{t as he}from"./tag-chip-Cr8GwpRE.js";import{t as L}from"./config-hints-Cl2XAhzV.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-CsQ2rIdq.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`}]]),H=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`}]]),Ce=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`}]]),U=s(n(),1),W=i();function we({value:e,onChange:t,className:n,placeholder:r=``}){let[i,s]=(0,U.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,W.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,W.jsxs)(he,{tone:`info`,className:`gap-1 px-2 py-1 text-sm`,children:[e,(0,W.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`transition-colors hover:text-rose-200`,children:(0,W.jsx)(te,{className:`h-3 w-3`})})]},t)),(0,W.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 Te(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,W.jsx)(E,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,W.jsx)(de,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,W.jsx)(Se,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,W.jsx)(xe,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,W.jsx)(Ce,{className:`h-3.5 w-3.5 text-gray-500`}):(0,W.jsx)(ue,{className:`h-3.5 w-3.5 text-gray-500`})}function Ee({channelName:e,fields:t,formData:n,jsonDrafts:r,setJsonDrafts:i,updateField:o,uiHints:s}){return(0,W.jsx)(W.Fragment,{children:t.map(t=>{let c=L(`channels.${e}.${t.name}`,s),u=c?.label??t.label,f=c?.placeholder;return(0,W.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,W.jsxs)(l,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[Te(t.name),u]}),t.type===`boolean`&&(0,W.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,W.jsx)(`span`,{className:`text-sm text-gray-500`,children:n[t.name]?a(`enabled`):a(`disabled`)}),(0,W.jsx)(b,{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,W.jsx)(d,{id:t.name,type:t.type,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:f,className:`rounded-xl`}),t.type===`password`&&(0,W.jsx)(d,{id:t.name,type:`password`,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:f??a(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,W.jsx)(d,{id:t.name,type:`number`,value:n[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:f,className:`rounded-xl`}),t.type===`tags`&&(0,W.jsx)(we,{value:n[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,W.jsxs)(N,{value:n[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,W.jsx)(se,{className:`rounded-xl`,children:(0,W.jsx)(le,{})}),(0,W.jsx)(oe,{children:(t.options??[]).map(e=>(0,W.jsx)(A,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,W.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 De=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),G=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)}})),K=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}}})),Oe=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})),ke=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})),Ae=t((e=>{var t=G().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}})),je=t((e=>{var t=G().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Me=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}})),q=t((e=>{var t=K(),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}}})),Ne=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]]}})),Pe=t((e=>{var t=Ne();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}})),Fe=t(((e,t)=>{var n=Pe();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})),Ie=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),Le=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)}})),J=t((e=>{var t=Ie(),n=Le();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}}})),Re=t((e=>{var t=G(),n=q(),r=K(),i=J(),a=Ie(),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}})),ze=t((e=>{var t=G(),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}})),Be=t(((e,t)=>{var n=J();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),Ve=t(((e,t)=>{var n=J(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),He=t(((e,t)=>{var n=J();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),Ue=t(((e,t)=>{var n=J(),r=G();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})),We=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)})),Ge=t((e=>{var t=J(),n=Be(),r=Ve(),i=He(),a=Ue(),o=Le(),s=G(),c=We();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()))}})),Ke=t((e=>{var t=G(),n=K(),r=Oe(),i=ke(),a=Ae(),o=je(),s=Me(),c=q(),l=Fe(),u=Re(),d=ze(),f=J(),p=Ge();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)}})),qe=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}}})),Je=t((e=>{var t=qe();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)}})),Ye=t((e=>{var t=qe();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}})),Xe=t((e=>{var t=De(),n=Ke(),r=Je(),i=Ye();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 Ze(){return u({mutationFn:({channel:e,data:t})=>y(e,t)})}function Qe(){return u({mutationFn:({channel:e,data:t})=>S(e,t)})}function $e(){return u({mutationFn:({channel:e,data:t})=>x(e,t)})}var et={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 tt(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 nt(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 rt(e,t){return(typeof e.domain==`string`?e.domain.trim():``)||(typeof t.domain==`string`?t.domain.trim():``)||void 0}function it(e,t){return rt(e,t)===`lark`?`lark`:`feishu`}function at(e){return e===`lark`?`https://open.larksuite.com/app`:`https://open.feishu.cn/app`}function ot(e,t){return h({queryKey:[`channel-qr`,e,t],enabled:!!t,queryFn:()=>(0,Xe.toDataURL)(t,{errorCorrectionLevel:`M`,margin:1,width:480})}).data??null}function st({activeSession:e,baseUrl:t,channelEnabled:n,copy:r,connectButtonLabel:i,connectedAccountIds:s,disabled:c,domain:l,handleStartAuth:u,hasConnectedAccount:d,primaryAccountId:p,statusLabel:m}){return(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.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,W.jsx)(H,{className:`h-3.5 w-3.5`}),a(r.title)]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:a(r.description)}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:a(r.hint)})]}),(0,W.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,W.jsx)(D,{className:`h-3.5 w-3.5 animate-spin`}):(0,W.jsx)(V,{className:`h-3.5 w-3.5`}),m]}),(0,W.jsxs)(`div`,{className:`space-y-1 text-sm text-gray-600`,children:[(0,W.jsx)(`p`,{children:a(n||!d?r.capabilityHint:r.disabledHint)}),p?(0,W.jsxs)(`p`,{children:[a(`weixinAuthPrimaryAccount`),`: `,(0,W.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:p})]}):null,s.length>1?(0,W.jsxs)(`p`,{children:[a(`weixinAuthConnectedAccounts`),`: `,(0,W.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:s.join(`, `)})]}):null,t?(0,W.jsxs)(`p`,{children:[a(`weixinAuthBaseUrl`),`: `,(0,W.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:t})]}):null,l&&r.domainLabel?(0,W.jsxs)(`p`,{children:[a(r.domainLabel),`: `,(0,W.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:l})]}):null]}),(0,W.jsx)(f,{type:`button`,onClick:()=>void u(),disabled:c,className:`rounded-xl`,children:i})]})}function ct({activeSession:e,authMessage:t,copy:n,qrDataUrl:i}){return(0,W.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,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-gray-100 bg-white p-3`,children:i?(0,W.jsx)(`img`,{src:i,alt:a(n.qrAlt),className:`mx-auto aspect-square w-full max-w-[240px] object-contain`}):(0,W.jsx)(`div`,{className:`flex aspect-square w-full items-center justify-center rounded-xl bg-gray-50 text-gray-500`,children:(0,W.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,W.jsx)(D,{className:`h-5 w-5 animate-spin`}),(0,W.jsx)(`p`,{className:`text-xs`,children:a(`weixinAuthStarting`)})]})})}),(0,W.jsxs)(`div`,{className:`space-y-1 text-xs text-gray-500`,children:[(0,W.jsx)(`p`,{children:t||e.note||a(n.scanPrompt)}),(0,W.jsxs)(`p`,{children:[a(`weixinAuthExpiresAt`),`: `,r(e.expiresAt)]})]}),(0,W.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,W.jsx)(T,{className:`h-3.5 w-3.5`}),a(`weixinAuthOpenQr`)]})]}):(0,W.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,W.jsx)(H,{className:`h-9 w-9 text-gray-300`}),(0,W.jsx)(`p`,{className:`mt-3 text-sm font-medium text-gray-700`,children:a(n.readyTitle)}),(0,W.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:a(n.readyDescription)})]})})}function lt({channelConfig:e,channelEnabled:t,channelName:n,disabled:r,formData:i}){let o=v(),s=Ze(),c=Qe(),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(!1),h=(0,U.useMemo)(()=>tt(e),[e]),_=h[0],y=nt(i,e),b=n===`feishu`?rt(i,e):void 0,x=h.length>0,S=x&&!p?null:l,C=ot(n,S?.qrCodeUrl),w=et[n];(0,U.useEffect)(()=>{if(!S)return;let e=!1,t=null,r=async()=>{try{let i=await c.mutateAsync({channel:n,data:{sessionId:S.sessionId}});if(e)return;if(f(i),i.status===`authorized`){await o.invalidateQueries({queryKey:[`config`]}),await o.invalidateQueries({queryKey:[`config-meta`]}),g.success(i.message||a(`weixinAuthAuthorized`)),u(null);return}if(i.status===`expired`||i.status===`error`){g.error(i.message||a(`weixinAuthRetryRequired`)),u(null);return}t=setTimeout(r,i.nextPollMs??S.intervalMs)}catch(t){e||(g.error(`${a(`error`)}: ${t instanceof Error?t.message:String(t)}`),u(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}});m(x),u(e),f({channel:n,status:`pending`,message:e.note,nextPollMs:e.intervalMs})}catch(e){g.error(`${a(`error`)}: ${e instanceof Error?e.message:String(e)}`)}},E=S?d?.status===`scanned`?a(`weixinAuthScanned`):a(`weixinAuthWaiting`):a(x?t?`weixinAuthAuthorized`:`weixinAuthConnectedDisabled`:`weixinAuthNotConnected`),D=s.isPending?a(`weixinAuthStarting`):a(S?`weixinAuthWaiting`:x?`weixinAuthReconnect`:w.connect),ee=x?a(`weixinAuthAuthorized`):d?.message;return(0,W.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,W.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,W.jsx)(st,{activeSession:S,baseUrl:y,channelEnabled:t,copy:w,connectButtonLabel:D,connectedAccountIds:h,disabled:r||s.isPending||!!S,domain:b,handleStartAuth:T,hasConnectedAccount:x,primaryAccountId:_,statusLabel:E}),(0,W.jsx)(ct,{activeSession:S,authMessage:ee,copy:w,qrDataUrl:C})]})})}function ut({channelConfig:e,disabled:t,formData:n}){let r=v(),i=$e(),[o,s]=(0,U.useState)(()=>it(n,e)),[c,u]=(0,U.useState)(``),[p,m]=(0,U.useState)(``),h=at(o),_=!!(c.trim()&&p.trim())&&!t&&!i.isPending,y=async()=>{try{let e=await i.mutateAsync({channel:`feishu`,data:{domain:o,fields:{appId:c.trim(),appSecret:p.trim()}}});await r.invalidateQueries({queryKey:[`config`]}),await r.invalidateQueries({queryKey:[`config-meta`]}),g.success(e.message||a(`feishuExistingAgentConnectSuccess`)),m(``)}catch(e){g.error(`${a(`error`)}: ${e instanceof Error?e.message:String(e)}`)}};return(0,W.jsx)(`section`,{className:`rounded-2xl border border-primary/20 bg-white p-5`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,W.jsxs)(`div`,{className:`max-w-xl space-y-3`,children:[(0,W.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,W.jsx)(V,{className:`h-3.5 w-3.5`}),a(`feishuExistingAgentTitle`)]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:a(`feishuExistingAgentDescription`)}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:a(`feishuExistingAgentHint`)})]}),(0,W.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,W.jsx)(T,{className:`h-4 w-4`}),a(o===`lark`?`feishuExistingAgentOpenLarkList`:`feishuExistingAgentOpenFeishuList`)]})]}),(0,W.jsxs)(`div`,{className:`w-full max-w-sm space-y-4`,children:[(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(l,{htmlFor:`feishu-existing-platform`,children:a(`feishuPlatform`)}),(0,W.jsxs)(N,{value:o,onValueChange:e=>s(e===`lark`?`lark`:`feishu`),children:[(0,W.jsx)(se,{id:`feishu-existing-platform`,className:`rounded-xl`,children:(0,W.jsx)(le,{})}),(0,W.jsxs)(oe,{children:[(0,W.jsx)(A,{value:`feishu`,children:`Feishu`}),(0,W.jsx)(A,{value:`lark`,children:`Lark`})]})]})]}),(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(l,{htmlFor:`feishu-existing-app-id`,children:`App ID`}),(0,W.jsx)(d,{id:`feishu-existing-app-id`,value:c,onChange:e=>u(e.target.value),className:`rounded-xl`})]}),(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(l,{htmlFor:`feishu-existing-app-secret`,children:`App Secret`}),(0,W.jsx)(d,{id:`feishu-existing-app-secret`,type:`password`,value:p,onChange:e=>m(e.target.value),className:`rounded-xl`})]}),(0,W.jsx)(f,{type:`button`,onClick:()=>void y(),disabled:!_,className:`w-full rounded-xl`,children:i.isPending?a(`feishuExistingAgentConnecting`):a(`feishuExistingAgentConnect`)})]})]})})}function dt(e){let[t,n]=(0,U.useState)(`create`);return(0,W.jsxs)(ie,{value:t,onValueChange:e=>n(e===`existing`?`existing`:`create`),children:[(0,W.jsxs)(re,{children:[(0,W.jsx)(k,{value:`create`,children:a(`feishuAuthCreateNew`)}),(0,W.jsx)(k,{value:`existing`,children:a(`feishuAuthConnectExisting`)})]}),(0,W.jsx)(ne,{value:`create`,className:`mt-4`,children:(0,W.jsx)(lt,{...e,channelName:`feishu`})}),(0,W.jsx)(ne,{value:`existing`,className:`mt-4`,children:(0,W.jsx)(ut,{...e})})]})}var ft=[{value:`pairing`,label:`pairing`},{value:`allowlist`,label:`allowlist`},{value:`open`,label:`open`},{value:`disabled`,label:`disabled`}],Y=[{value:`open`,label:`open`},{value:`allowlist`,label:`allowlist`},{value:`disabled`,label:`disabled`}],pt=[{value:`feishu`,label:`feishu`},{value:`lark`,label:`lark`}],mt=[{value:`off`,label:`off`},{value:`partial`,label:`partial`},{value:`block`,label:`block`},{value:`progress`,label:`progress`}];function ht(){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:pt},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)},{name:`groupPolicy`,type:`select`,label:a(`groupPolicy`),options:Y},{name:`requireMention`,type:`boolean`,label:a(`requireMention`)},{name:`accounts`,type:`json`,label:a(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`feishu-auth`},{type:`fields`,section:`advanced`,collapsible:{title:a(`feishuAuthAdvancedTitle`),description:a(`feishuAuthAdvancedDescription`)}}]}}function gt(){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:ft},{name:`groupPolicy`,type:`select`,label:a(`groupPolicy`),options:Y},{name:`groupAllowFrom`,type:`tags`,label:a(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:a(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:a(`mentionPatterns`)},{name:`groups`,type:`json`,label:a(`groupRulesJson`)}]},discord:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`token`,type:`password`,label:a(`botToken`)},{name:`allowBots`,type:`boolean`,label:a(`allowBotMessages`)},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)},{name:`gatewayUrl`,type:`text`,label:a(`gatewayUrl`)},{name:`intents`,type:`number`,label:a(`intents`)},{name:`proxy`,type:`text`,label:a(`proxy`)},{name:`mediaMaxMb`,type:`number`,label:a(`attachmentMaxSizeMb`)},{name:`streaming`,type:`select`,label:a(`streamingMode`),options:mt},{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:ft},{name:`groupPolicy`,type:`select`,label:a(`groupPolicy`),options:Y},{name:`groupAllowFrom`,type:`tags`,label:a(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:a(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:a(`mentionPatterns`)},{name:`groups`,type:`json`,label:a(`groupRulesJson`)}]},whatsapp:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`bridgeUrl`,type:`text`,label:a(`bridgeUrl`)},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)}]},feishu:ht(),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 _t(t){let n=e();return t.tutorialUrls?.[n]||t.tutorialUrls?.default||t.tutorialUrl}var vt=[],yt=[{type:`fields`,section:`all`}],X=new Set,Z=new Map,Q=null;function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function bt(e,t){let n={...e};for(let[e,r]of Object.entries(t))n[e]=$(n[e])&&$(r)?bt(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(){Q||=_.eventBus.on(c.channelConfigApplyStatus,e=>{Z.set(e.channel,e.status===`started`?{status:`applying`}:e.status===`succeeded`?{status:`applied`}:{status:`failed`,message:e.message}),X.forEach(e=>e())})}function Tt(e){return X.add(e),wt(),()=>{X.delete(e),!X.size&&Q&&(Q(),Q=null,Z.clear())}}function Et(e){return(0,U.useSyncExternalStore)(Tt,()=>e?Z.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,W.jsx)(z,{className:`px-6 py-5`,children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(M,{name:n,src:j(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,W.jsx)(`span`,{className:`text-sm font-semibold uppercase text-gray-500`,children:n[0]})}),(0,W.jsx)(`h3`,{className:`truncate text-lg font-semibold text-gray-900 capitalize`,children:t})]}),(0,W.jsx)(`p`,{className:`mt-2 text-sm text-gray-500`,children:a(`channelsFormDescription`)}),e?(0,W.jsx)(`p`,{className:o(`mt-2 text-xs font-medium`,e.className),children:e.label}):null,i?(0,W.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,W.jsx)(w,{className:`h-3.5 w-3.5`}),a(`channelsGuideTitle`)]}):null]}),(0,W.jsx)(O,{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,W.jsx)(W.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,W.jsx)(Ee,{channelName:t,fields:e,formData:a,jsonDrafts:o,setJsonDrafts:c,updateField:u,uiHints:l});return s.collapsible?(0,W.jsxs)(`details`,{className:`group rounded-2xl border border-gray-200/80 bg-white`,children:[(0,W.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,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{children:s.collapsible.title}),s.collapsible.description?(0,W.jsx)(`p`,{className:`mt-1 text-xs font-normal text-gray-500`,children:s.collapsible.description}):null]}),(0,W.jsx)(fe,{className:`h-4 w-4 text-gray-400 transition-transform group-open:rotate-180`})]}),(0,W.jsx)(`div`,{className:`space-y-6 border-t border-gray-100 px-5 py-5`,children:n})]},`${s.type}-${s.section}-${d}`):(0,W.jsx)(`div`,{children:n},`${s.type}-${s.section}-${d}`)}return s.sectionId===`feishu-auth`?(0,W.jsx)(dt,{channelConfig:e,formData:a,channelEnabled:r,disabled:n},`${s.type}-${s.sectionId}-${d}`):s.sectionId===`weixin-auth`?(0,W.jsx)(lt,{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 l=me(),u=pe(),[d,p]=(0,U.useState)(()=>({...t})),[m,h]=(0,U.useState)(()=>Ct(t,i)),[_,v]=(0,U.useState)(null),y=Dt(Et(r)),b=typeof d.enabled==`boolean`?d.enabled:!!t.enabled,x=l.isPending||!!_,S=(e,t)=>p(n=>({...n,[e]:t})),C=e=>{e.preventDefault();let t={...d};for(let e of i){if(e.type===`password`){let n=t[e.name];(typeof n!=`string`||n.length===0)&&delete t[e.name]}if(e.type===`json`)try{t[e.name]=(m[e.name]??``).trim()?JSON.parse(m[e.name]):{}}catch{g.error(`${a(`invalidJson`)}: ${e.name}`);return}}l.mutate({channel:r,data:t})},w=e=>{if(!$(e?.channels)||!$(e.channels[r]))return;let t=e.channels[r];p(e=>bt(e,t)),h(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={...d};e.saveBeforeRun&&(n={...n,...e.savePatch??{}},p(n),await l.mutateAsync({channel:r,data:n}));let i=await u.mutateAsync({actionId:e.id,data:{scope:t,draftConfig:xt(t,n)}});w(i.patch),i.ok?g.success(i.message||a(`success`)):g.error(i.message||a(`error`))}catch(e){g.error(`${a(`error`)}: ${e instanceof Error?e.message:String(e)}`)}finally{v(null)}};return(0,W.jsxs)(R,{children:[(0,W.jsx)(Ot,{channelName:r,channelLabel:n,enabled:b,tutorialUrl:s,channelApplyStatus:y}),(0,W.jsxs)(`form`,{onSubmit:C,className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.jsx)(B,{className:`space-y-6 px-6 py-5`,children:(0,W.jsx)(kt,{channelConfig:t,channelName:r,enabled:b,fields:i,formData:d,jsonDrafts:m,layoutBlocks:o,setJsonDrafts:h,uiHints:c,updateField:S,disabled:x})}),(0,W.jsxs)(ye,{className:`flex flex-wrap items-center justify-between gap-3 px-6 py-4`,children:[(0,W.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e.filter(e=>e.trigger===`manual`).map(e=>(0,W.jsx)(f,{type:`button`,onClick:()=>void T(e),disabled:x,variant:`secondary`,children:_===e.id?a(`connecting`):e.title},e.id))}),(0,W.jsx)(f,{type:`submit`,disabled:x,children:l.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,U.useMemo)(()=>gt()[e||``],[e]);if(!e||!o||!i)return(0,W.jsx)(_e,{children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{className:`text-base font-semibold text-gray-900`,children:a(`channelsSelectTitle`)}),(0,W.jsx)(`p`,{className:`mt-2 text-sm text-gray-500`,children:a(`channelsSelectDescription`)})]})});let c=s?.fields??vt,l=s?.layout??yt,u=r?.uiHints,d=L(`channels.${e}`,u)?.label??e,f=_t(o),p=JSON.stringify({channelName:e,channelConfig:i,jsonFields:c.filter(e=>e.type===`json`).map(e=>e.name)});return(0,W.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}=ce(),{data:t}=I(),{data:n}=P(),{data:r}=F(),[i,s]=(0,U.useState)(`enabled`),[c,l]=(0,U.useState)(null),[u,f]=(0,U.useState)(``),h=(0,U.useMemo)(()=>Pt(n?.channels??[]),[n?.channels]),g=t?.channels,_=(0,U.useMemo)(()=>{let e=u.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,u]),v=c&&_.some(e=>e.name===c)?c:e?null:_[0]?.name??null;return!t||!n?(0,W.jsx)(`div`,{className:`p-8 text-gray-400`,children:a(`channelsLoading`)}):(0,W.jsxs)(m,{className:`pb-0 xl:flex xl:h-full xl:min-h-0 xl:flex-col`,children:[(0,W.jsx)(p,{title:a(`channelsPageTitle`),description:a(`channelsPageDescription`)}),(0,W.jsxs)(ge,{className:`xl:min-h-0`,mobileView:e?v?`detail`:`list`:void 0,onMobileBack:()=>l(null),mobileListLabel:a(`channelsPageTitle`),children:[(0,W.jsxs)(R,{children:[(0,W.jsx)(z,{className:`px-4 pt-4`,children:(0,W.jsx)(ie,{value:i,onValueChange:s,children:(0,W.jsxs)(re,{className:`mb-0 h-auto gap-3 border-b-0 bg-transparent p-0`,children:[(0,W.jsxs)(k,{value:`enabled`,className:`gap-1.5 px-0 pb-3`,children:[a(`channelsTabEnabled`),(0,W.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:h.filter(e=>g?.[e.name]?.enabled).length})]}),(0,W.jsxs)(k,{value:`all`,className:`gap-1.5 px-0 pb-3`,children:[a(`channelsTabAll`),(0,W.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:h.length})]})]})})}),(0,W.jsx)(`div`,{className:`border-b border-gray-100 px-4 py-3`,children:(0,W.jsxs)(`div`,{className:`relative`,children:[(0,W.jsx)(ee,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,W.jsx)(d,{value:u,onChange:e=>f(e.target.value),placeholder:a(`channelsFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,W.jsxs)(B,{className:`space-y-2 p-3`,children:[_.map(e=>{let n=!!t.channels[e.name]?.enabled,i=_t(e),s=L(`channels.${e.name}`,r?.uiHints)?.help||a(Mt[e.name]||`channelDescriptionDefault`);return(0,W.jsx)(be,{onClick:()=>l(e.name),active:v===e.name,children:(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,W.jsx)(M,{name:e.name,src:j(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,W.jsx)(`span`,{className:`text-sm font-semibold uppercase text-gray-500`,children:e.name[0]})}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.displayName||e.name}),(0,W.jsx)(`p`,{className:`line-clamp-1 text-[11px] text-gray-500`,children:s})]})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i?(0,W.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,W.jsx)(T,{className:`h-3.5 w-3.5`})}):null,(0,W.jsx)(O,{status:n?`active`:`inactive`,label:a(n?`statusActive`:`statusInactive`),className:`min-w-[56px] justify-center`})]})]})},e.name)}),_.length===0?(0,W.jsx)(ve,{icon:ae,title:a(`channelsNoMatch`)}):null]})]}),(0,W.jsx)(jt,{channelName:v??void 0})]})]})}export{Ft as ChannelsList};
|