import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{$P as t,Uh as n,aC as r}from"./lucide-C4oWPzu4.js";import{p as i}from"./utils-Bs-0X7qI.js";import{r as a}from"./bundle-mjs-C4g7ASB5.js";import"./react-dom-DA2kpOcl.js";import{n as o}from"./dist-Cw-z5Xb0.js";import"./useMutation-YNiikd7W.js";import"./label-D4DLXoEs.js";import{t as s}from"./button-B-NlEi4h.js";import{t as c}from"./chunk-LFPYN7LY-Bb6SdmrV.js";import"./textarea-BJ2TI6HZ.js";import{t as l}from"./input-DcxjhZaU.js";import"./status-codes.constant-BV2w9Io6.js";import{a as u,f as d,i as f,n as p,o as m,r as h,t as g}from"./form-CVrsvflM.js";import{n as _,t as v}from"./console-BA0IzvI-.js";import{t as y}from"./permission-guard-C-WT75tf.js";var b=i(),x=e(t(),1),S=a(),C={appid:``};function w(){let e=(0,b.c)(34),{data:t,isLoading:r}=_(),i=t,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={onSuccess:D,onError:E},e[0]=a):a=e[0];let o=v(a),c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c={defaultValues:C},e[1]=c):c=e[1];let l=d(c),u;e[2]!==i||e[3]!==l?(u=()=>{i?.statistics!=null&&l.reset({appid:i.statistics.appid??``})},e[2]=i,e[3]=l,e[4]=u):u=e[4];let p=i?.statistics,m;e[5]!==l||e[6]!==p?(m=[p,l],e[5]=l,e[6]=p,e[7]=m):m=e[7],(0,x.useEffect)(u,m);let h;e[8]===o?h=e[9]:(h=e=>{o.mutate({statistics:{appid:e.appid}})},e[8]=o,e[9]=h);let w=h;if(r){let t;return e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,S.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,S.jsx)(n,{className:`text-muted-foreground size-8 animate-spin`})}),e[10]=t):t=e[10],t}let O;e[11]!==l||e[12]!==w?(O=l.handleSubmit(w),e[11]=l,e[12]=w,e[13]=O):O=e[13];let k;e[14]===l.control?k=e[15]:(k=(0,S.jsx)(f,{control:l.control,name:`appid`,render:T}),e[14]=l.control,e[15]=k);let A;e[16]===o.isPending?A=e[17]:(A=o.isPending&&(0,S.jsx)(n,{className:`mr-2 size-4 animate-spin`}),e[16]=o.isPending,e[17]=A);let j;e[18]!==o.isPending||e[19]!==A?(j=(0,S.jsxs)(s,{type:`submit`,disabled:o.isPending,children:[A,`保存设置`]}),e[18]=o.isPending,e[19]=A,e[20]=j):j=e[20];let M;e[21]!==i||e[22]!==l?(M=(0,S.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>i?.statistics!=null&&l.reset({appid:i.statistics.appid??``}),children:`重置设置`}),e[21]=i,e[22]=l,e[23]=M):M=e[23];let N;e[24]!==M||e[25]!==j?(N=(0,S.jsx)(`div`,{className:`flex gap-2`,children:(0,S.jsxs)(y,{permissions:`system-website:setConfig`,children:[j,M]})}),e[24]=M,e[25]=j,e[26]=N):N=e[26];let P;e[27]!==N||e[28]!==O||e[29]!==k?(P=(0,S.jsxs)(`form`,{onSubmit:O,className:`space-y-6`,children:[k,N]}),e[27]=N,e[28]=O,e[29]=k,e[30]=P):P=e[30];let F;return e[31]!==l||e[32]!==P?(F=(0,S.jsx)(g,{...l,children:P}),e[31]=l,e[32]=P,e[33]=F):F=e[33],F}function T(e){let{field:t}=e;return(0,S.jsxs)(u,{children:[(0,S.jsx)(m,{children:`AppID`}),(0,S.jsx)(p,{children:(0,S.jsx)(l,{placeholder:`请输入统计应用ID`,...t})}),(0,S.jsxs)(h,{children:[`开通地址:`,` `,(0,S.jsx)(s,{variant:`link`,asChild:!0,className:`h-fit p-0`,children:(0,S.jsxs)(c,{to:`https://clarity.microsoft.com/`,target:`_blank`,rel:`noopener noreferrer`,children:[`Microsoft Clarity`,(0,S.jsx)(r,{className:`size-4`})]})})]})]})}function E(e){console.log(`保存失败: ${e.message}`)}function D(){return o.success(`保存成功`)}export{w as default};