@baishuyun/ai-design 1.0.9 → 1.0.10

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.
@@ -157,7 +157,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
157
157
  `})]})},Ka=({size:e=30,className:t})=>i.jsx("div",{className:t,style:{backgroundImage:`${G2}`,backgroundRepeat:"no-repeat",backgroundSize:"cover",width:e,height:e,aspectRatio:"1/1"}}),Hb=({name:e,icon:t,variant:n="default"})=>{const r=n==="default"?20:24;if(!e)return null;const o={default:"text-[#999] text-[14px] font-[400]",active:"text-[#0265FF] text-[14px] font-[700]"},a=typeof t=="string"&&/^https?:\/\//.test(t)?i.jsx("img",{src:t,alt:"",className:"rounded-full",width:r,height:r}):t||i.jsx(Ka,{size:r});return i.jsxs("div",{className:"flex items-center gap-1.5",children:[a,i.jsx("div",{className:o[n],children:e})]})},Vb=({label:e,children:t,className:n})=>i.jsxs("div",{className:F("flex gap-2 items-start w-full",n),children:[i.jsx("div",{className:"w-[100px] shrink-0 text-[#666] text-sm leading-normal truncate",children:e}),i.jsx("div",{className:"flex-1 min-w-0 text-sm leading-normal whitespace-pre-wrap break-words",children:t!=null?t:i.jsx("span",{className:"text-[#666]",children:"无"})})]}),Rb=({children:e})=>i.jsx("div",{className:"flex flex-col gap-[10px] w-full",children:e}),Bb=({title:e,desc:t,index:n,icon:r,onClick:o,iconCode:s})=>i.jsxs("div",{className:F("bs-card group flex flex-col cursor-pointer p-2.5 gap-2.5 rounded-lg max-w-[350px] border border-[#e0e0e0] bg-white",{transCls:Q}),onClick:()=>{o==null||o(e,s)},children:[i.jsxs("div",{className:"px-2.5 flex items-center gap-1.5 rounded-[4px] h-[34px] bg-white",children:[n===void 0?null:i.jsx("div",{children:n}),r===void 0?null:i.jsx("div",{className:"text-[#0265FF]",children:r}),i.jsx("div",{className:"truncate !text-[#12111] group-hover:text-[#0265FF]",children:e})]}),i.jsx("div",{className:"text-[#666] leading-5 text-[12px]",children:t})]}),p0=({icon:e,iconBgColor:t,title:n,description:r,height:o,selected:s,badge:a,onClick:l})=>i.jsx("div",{className:F("flex flex-col p-[10px] rounded-[4px] cursor-pointer","border",{"bg-[#EFF0F6] border-[#EFF0F6]":s,"bg-white border-[#E0E0E0]":!s},Q),style:{height:o},onClick:l,children:i.jsxs("div",{className:"flex items-start gap-[12px] w-full",children:[i.jsx("div",{className:"shrink-0 size-[42px] rounded-[23px] flex items-center justify-center p-[7px]",style:{backgroundColor:t},children:i.jsx("div",{className:"size-[28px] flex items-center justify-center",children:e})}),i.jsxs("div",{className:"flex flex-col gap-[6px] min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center justify-between w-full",children:[i.jsx("p",{className:"text-[14px] font-bold text-[#030303] truncate",children:n}),a&&i.jsx("span",{className:"shrink-0 bg-[#4ACCC1] text-white text-[12px] leading-[normal] px-[6px] h-[20px] rounded-[4px] flex items-center justify-center ml-[8px]",children:a})]}),i.jsx("p",{className:"text-[12px] text-[#999] w-full",children:r})]})]})}),h0=({agent:e,className:t})=>i.jsxs("div",{className:F("bg-[#e5e6eb] content-stretch flex gap-[4px] items-center px-[6px] rounded-[100px] w-fit h-[26px]",t),children:[i.jsx("div",{className:"relative rounded-[3.5px] shrink-0 size-[14px]",children:i.jsx("img",{alt:"",className:"absolute inset-0 max-w-none object-cover pointer-events-none rounded-[3.5px] size-full",src:e.icon})}),i.jsx("p",{className:"leading-[normal] shrink-0 text-[#030303] text-[12px] whitespace-nowrap",children:e.name})]}),Qa=[{triggerType:"universal",title:"通用型",description:"开箱即用,无需触发即可直接使用",icon:i.jsx(oa,{fill:"#4ACCC1"}),minIcon:i.jsx(oa,{fill:"#4ACCC1",size:12}),iconBgColor:"rgba(74, 204, 193, 0.1)",badge:"通用"},{triggerType:"form_field",title:"表单字段触发",description:"表单中数据发生变化时,触发自动化操作",icon:i.jsx(Ji,{}),minIcon:i.jsx(Ji,{size:12}),iconBgColor:"rgba(77, 96, 159, 0.1)"},{triggerType:"form_action",title:"表单动作触发",description:"表单中数据发生变化时,触发自动化操作",icon:i.jsx("div",{className:"text-[#0265FF]",children:i.jsx(L3,{})}),minIcon:i.jsx(S3,{size:12}),iconBgColor:"rgba(2, 101, 255, 0.1)"},{triggerType:"form_flow_node",title:"表单流程节点触发",description:"表单中数据发生变化时,触发自动化操作",icon:i.jsx("div",{className:"text-[#FF9921]",children:i.jsx(sa,{})}),minIcon:i.jsx(sa,{size:12}),iconBgColor:"rgba(255, 153, 33, 0.1)"},{triggerType:"scheduler",title:"计划任务触发",description:"表单中数据发生变化时,触发自动化操作",icon:i.jsx("div",{className:"text-[#F06648]",children:i.jsx(ia,{})}),minIcon:i.jsx(ia,{size:12}),iconBgColor:"rgba(240, 102, 72, 0.1)"}],zb=({triggerType:e})=>{const t=Qa.find(o=>o.triggerType===e);if(!t)return null;const{minIcon:n,iconBgColor:r}=t;return i.jsx("div",{className:"shrink-0 rounded-full flex items-center justify-center p-[7px]",style:{backgroundColor:r,width:18,height:18},children:i.jsx("div",{className:"flex items-center justify-center",children:n})})},Zb=({value:e,onChange:t,configList:n=Qa})=>i.jsx("div",{className:"grid grid-cols-3 gap-5",children:n.map(r=>i.jsx(p0,{icon:r.icon,iconBgColor:r.iconBgColor,title:r.title,description:r.description,badge:r.badge,selected:e===r.triggerType,onClick:()=>t==null?void 0:t(r.triggerType)},r.triggerType))});var fs="Collapsible",[Wb]=zt(fs),[$b,Ja]=Wb(fs),m0=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:a,...l}=e,[c,u]=l1({prop:r,defaultProp:o!=null?o:!1,onChange:a,caller:fs});return i.jsx($b,{scope:n,disabled:s,contentId:a1(),open:c,onOpenToggle:k.useCallback(()=>u(d=>!d),[u]),children:i.jsx(Le.div,{"data-state":tl(c),"data-disabled":s?"":void 0,...l,ref:t})})});m0.displayName=fs;var C0="CollapsibleTrigger",x0=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Ja(C0,n);return i.jsx(Le.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":tl(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:ve(e.onClick,o.onOpenToggle)})});x0.displayName=C0;var el="CollapsibleContent",g0=k.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Ja(el,e.__scopeCollapsible);return i.jsx(Qt,{present:n||o.open,children:({present:s})=>i.jsx(Ub,{...r,ref:t,present:s})})});g0.displayName=el;var Ub=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,a=Ja(el,n),[l,c]=k.useState(r),u=k.useRef(null),d=Oe(t,u),f=k.useRef(0),p=f.current,h=k.useRef(0),m=h.current,x=a.open||l,y=k.useRef(x),g=k.useRef(void 0);return k.useEffect(()=>{const b=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(b)},[]),wt(()=>{const b=u.current;if(b){g.current=g.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const w=b.getBoundingClientRect();f.current=w.height,h.current=w.width,y.current||(b.style.transitionDuration=g.current.transitionDuration,b.style.animationName=g.current.animationName),c(r)}},[a.open,r]),i.jsx(Le.div,{"data-state":tl(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!x,...s,ref:d,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:x&&o})});function tl(e){return e?"open":"closed"}var qb=m0,ps="Checkbox",[Yb]=zt(ps),[Gb,nl]=Yb(ps);function Xb(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:s,form:a,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[p,h]=l1({prop:n,defaultProp:o!=null?o:!1,onChange:c,caller:ps}),[m,x]=k.useState(null),[y,g]=k.useState(null),b=k.useRef(!1),w=m?!!a||!!m.closest("form"):!0,v={checked:p,disabled:s,setChecked:h,control:m,setControl:x,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:b,required:u,defaultChecked:rn(o)?!1:o,isFormControl:w,bubbleInput:y,setBubbleInput:g};return i.jsx(Gb,{scope:t,...v,children:Kb(f)?f(v):r})}var y0="CheckboxTrigger",b0=k.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:s,value:a,disabled:l,checked:c,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:p,isFormControl:h,bubbleInput:m}=nl(y0,e),x=Oe(o,d),y=k.useRef(c);return k.useEffect(()=>{const g=s==null?void 0:s.form;if(g){const b=()=>f(y.current);return g.addEventListener("reset",b),()=>g.removeEventListener("reset",b)}},[s,f]),i.jsx(Le.button,{type:"button",role:"checkbox","aria-checked":rn(c)?"mixed":c,"aria-required":u,"data-state":L0(c),"data-disabled":l?"":void 0,disabled:l,value:a,...r,ref:x,onKeyDown:ve(t,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:ve(n,g=>{f(b=>rn(b)?!0:!b),m&&h&&(p.current=g.isPropagationStopped(),p.current||g.stopPropagation())})})});b0.displayName=y0;var w0=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:s,required:a,disabled:l,value:c,onCheckedChange:u,form:d,...f}=e;return i.jsx(Xb,{__scopeCheckbox:n,checked:o,defaultChecked:s,disabled:l,required:a,onCheckedChange:u,name:r,form:d,value:c,internal_do_not_use_render:({isFormControl:p})=>i.jsxs(i.Fragment,{children:[i.jsx(b0,{...f,ref:t,__scopeCheckbox:n}),p&&i.jsx(S0,{__scopeCheckbox:n})]})})});w0.displayName=ps;var v0="CheckboxIndicator",k0=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,s=nl(v0,n);return i.jsx(Qt,{present:r||rn(s.checked)||s.checked===!0,children:i.jsx(Le.span,{"data-state":L0(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});k0.displayName=v0;var j0="CheckboxBubbleInput",S0=k.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:s,defaultChecked:a,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:p,setBubbleInput:h}=nl(j0,e),m=Oe(n,h),x=es(s),y=Zo(r);k.useEffect(()=>{const b=p;if(!b)return;const w=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(w,"checked").set,j=!o.current;if(x!==s&&S){const M=new Event("click",{bubbles:j});b.indeterminate=rn(s),S.call(b,rn(s)?!1:s),b.dispatchEvent(M)}},[p,x,s,o]);const g=k.useRef(rn(s)?!1:s);return i.jsx(Le.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a!=null?a:g.current,required:l,disabled:c,name:u,value:d,form:f,...t,tabIndex:-1,ref:m,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});S0.displayName=j0;function Kb(e){return typeof e=="function"}function rn(e){return e==="indeterminate"}function L0(e){return rn(e)?"indeterminate":e?"checked":"unchecked"}var rl="rovingFocusGroup.onEntryFocus",Qb={bubbles:!1,cancelable:!0},Wr="RovingFocusGroup",[ol,M0,Jb]=K3(Wr),[ew,hs]=zt(Wr,[Jb]),[tw,nw]=ew(Wr),E0=k.forwardRef((e,t)=>i.jsx(ol.Provider,{scope:e.__scopeRovingFocusGroup,children:i.jsx(ol.Slot,{scope:e.__scopeRovingFocusGroup,children:i.jsx(rw,{...e,ref:t})})}));E0.displayName=Wr;var rw=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,p=k.useRef(null),h=Oe(t,p),m=Jo(s),[x,y]=l1({prop:a,defaultProp:l!=null?l:null,onChange:c,caller:Wr}),[g,b]=k.useState(!1),w=q1(u),v=M0(n),S=k.useRef(!1),[j,M]=k.useState(0);return k.useEffect(()=>{const L=p.current;if(L)return L.addEventListener(rl,w),()=>L.removeEventListener(rl,w)},[w]),i.jsx(tw,{scope:n,orientation:r,dir:m,loop:o,currentTabStopId:x,onItemFocus:k.useCallback(L=>y(L),[y]),onItemShiftTab:k.useCallback(()=>b(!0),[]),onFocusableItemAdd:k.useCallback(()=>M(L=>L+1),[]),onFocusableItemRemove:k.useCallback(()=>M(L=>L-1),[]),children:i.jsx(Le.div,{tabIndex:g||j===0?-1:0,"data-orientation":r,...f,ref:h,style:{outline:"none",...e.style},onMouseDown:ve(e.onMouseDown,()=>{S.current=!0}),onFocus:ve(e.onFocus,L=>{const T=!S.current;if(L.target===L.currentTarget&&T&&!g){const _=new CustomEvent(rl,Qb);if(L.currentTarget.dispatchEvent(_),!_.defaultPrevented){const B=v().filter(V=>V.focusable),R=B.find(V=>V.active),D=B.find(V=>V.id===x),O=[R,D,...B].filter(Boolean).map(V=>V.ref.current);T0(O,d)}}S.current=!1}),onBlur:ve(e.onBlur,()=>b(!1))})})}),N0="RovingFocusGroupItem",F0=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:a,...l}=e,c=a1(),u=s||c,d=nw(N0,n),f=d.currentTabStopId===u,p=M0(n),{onFocusableItemAdd:h,onFocusableItemRemove:m,currentTabStopId:x}=d;return k.useEffect(()=>{if(r)return h(),()=>m()},[r,h,m]),i.jsx(ol.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:i.jsx(Le.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:ve(e.onMouseDown,y=>{r?d.onItemFocus(u):y.preventDefault()}),onFocus:ve(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:ve(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){d.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const g=iw(y,d.orientation,d.dir);if(g!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let w=p().filter(v=>v.focusable).map(v=>v.ref.current);if(g==="last")w.reverse();else if(g==="prev"||g==="next"){g==="prev"&&w.reverse();const v=w.indexOf(y.currentTarget);w=d.loop?aw(w,v+1):w.slice(v+1)}setTimeout(()=>T0(w))}}),children:typeof a=="function"?a({isCurrentTabStop:f,hasTabStop:x!=null}):a})})});F0.displayName=N0;var ow={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function sw(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function iw(e,t,n){const r=sw(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ow[r]}function T0(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function aw(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var _0=E0,D0=F0,sl="Radio",[lw,A0]=zt(sl),[cw,uw]=lw(sl),O0=k.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:o=!1,required:s,disabled:a,value:l="on",onCheck:c,form:u,...d}=e,[f,p]=k.useState(null),h=Oe(t,y=>p(y)),m=k.useRef(!1),x=f?u||!!f.closest("form"):!0;return i.jsxs(cw,{scope:n,checked:o,disabled:a,children:[i.jsx(Le.button,{type:"button",role:"radio","aria-checked":o,"data-state":V0(o),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:h,onClick:ve(e.onClick,y=>{o||c==null||c(),x&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})}),x&&i.jsx(H0,{control:f,bubbles:!m.current,name:r,value:l,checked:o,required:s,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});O0.displayName=sl;var P0="RadioIndicator",I0=k.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...o}=e,s=uw(P0,n);return i.jsx(Qt,{present:r||s.checked,children:i.jsx(Le.span,{"data-state":V0(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:t})})});I0.displayName=P0;var dw="RadioBubbleInput",H0=k.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...o},s)=>{const a=k.useRef(null),l=Oe(a,s),c=es(n),u=Zo(t);return k.useEffect(()=>{const d=a.current;if(!d)return;const f=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==n&&h){const m=new Event("click",{bubbles:r});h.call(d,n),d.dispatchEvent(m)}},[c,n,r]),i.jsx(Le.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:l,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});H0.displayName=dw;function V0(e){return e?"checked":"unchecked"}var fw=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ms="RadioGroup",[pw]=zt(ms,[hs,A0]),R0=hs(),B0=A0(),[hw,mw]=pw(ms),z0=k.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:o,value:s,required:a=!1,disabled:l=!1,orientation:c,dir:u,loop:d=!0,onValueChange:f,...p}=e,h=R0(n),m=Jo(u),[x,y]=l1({prop:s,defaultProp:o!=null?o:null,onChange:f,caller:ms});return i.jsx(hw,{scope:n,name:r,required:a,disabled:l,value:x,onValueChange:y,children:i.jsx(_0,{asChild:!0,...h,orientation:c,dir:m,loop:d,children:i.jsx(Le.div,{role:"radiogroup","aria-required":a,"aria-orientation":c,"data-disabled":l?"":void 0,dir:m,...p,ref:t})})})});z0.displayName=ms;var Z0="RadioGroupItem",W0=k.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...o}=e,s=mw(Z0,n),a=s.disabled||r,l=R0(n),c=B0(n),u=k.useRef(null),d=Oe(t,u),f=s.value===o.value,p=k.useRef(!1);return k.useEffect(()=>{const h=x=>{fw.includes(x.key)&&(p.current=!0)},m=()=>p.current=!1;return document.addEventListener("keydown",h),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",m)}},[]),i.jsx(D0,{asChild:!0,...l,focusable:!a,active:f,children:i.jsx(O0,{disabled:a,required:s.required,checked:f,...c,...o,name:s.name,ref:d,onCheck:()=>s.onValueChange(o.value),onKeyDown:ve(h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:ve(o.onFocus,()=>{var h;p.current&&((h=u.current)==null||h.click())})})})});W0.displayName=Z0;var Cw="RadioGroupIndicator",xw=k.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,o=B0(n);return i.jsx(I0,{...o,...r,ref:t})});xw.displayName=Cw;var gw=z0,yw=W0,Cs="Switch",[bw]=zt(Cs),[ww,vw]=bw(Cs),$0=k.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:s,required:a,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=e,[p,h]=k.useState(null),m=Oe(t,w=>h(w)),x=k.useRef(!1),y=p?d||!!p.closest("form"):!0,[g,b]=l1({prop:o,defaultProp:s!=null?s:!1,onChange:u,caller:Cs});return i.jsxs(ww,{scope:n,checked:g,disabled:l,children:[i.jsx(Le.button,{type:"button",role:"switch","aria-checked":g,"aria-required":a,"data-state":G0(g),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:m,onClick:ve(e.onClick,w=>{b(v=>!v),y&&(x.current=w.isPropagationStopped(),x.current||w.stopPropagation())})}),y&&i.jsx(Y0,{control:p,bubbles:!x.current,name:r,value:c,checked:g,required:a,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});$0.displayName=Cs;var U0="SwitchThumb",q0=k.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=vw(U0,n);return i.jsx(Le.span,{"data-state":G0(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});q0.displayName=U0;var kw="SwitchBubbleInput",Y0=k.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...o},s)=>{const a=k.useRef(null),l=Oe(a,s),c=es(n),u=Zo(t);return k.useEffect(()=>{const d=a.current;if(!d)return;const f=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==n&&h){const m=new Event("click",{bubbles:r});h.call(d,n),d.dispatchEvent(m)}},[c,n,r]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:l,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Y0.displayName=kw;function G0(e){return e?"checked":"unchecked"}var jw=$0,Sw=q0,xs="Tabs",[Lw]=zt(xs,[hs]),X0=hs(),[Mw,il]=Lw(xs),K0=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:a="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=Jo(l),[f,p]=l1({prop:r,onChange:o,defaultProp:s!=null?s:"",caller:xs});return i.jsx(Mw,{scope:n,baseId:a1(),value:f,onValueChange:p,orientation:a,dir:d,activationMode:c,children:i.jsx(Le.div,{dir:d,"data-orientation":a,...u,ref:t})})});K0.displayName=xs;var Q0="TabsList",J0=k.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=il(Q0,n),a=X0(n);return i.jsx(_0,{asChild:!0,...a,orientation:s.orientation,dir:s.dir,loop:r,children:i.jsx(Le.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});J0.displayName=Q0;var e6="TabsTrigger",t6=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,a=il(e6,n),l=X0(n),c=o6(a.baseId,r),u=s6(a.baseId,r),d=r===a.value;return i.jsx(D0,{asChild:!0,...l,focusable:!o,active:d,children:i.jsx(Le.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:ve(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?a.onValueChange(r):f.preventDefault()}),onKeyDown:ve(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&a.onValueChange(r)}),onFocus:ve(e.onFocus,()=>{const f=a.activationMode!=="manual";!d&&!o&&f&&a.onValueChange(r)})})})});t6.displayName=e6;var n6="TabsContent",r6=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...a}=e,l=il(n6,n),c=o6(l.baseId,r),u=s6(l.baseId,r),d=r===l.value,f=k.useRef(d);return k.useEffect(()=>{const p=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(p)},[]),i.jsx(Qt,{present:o||d,children:({present:p})=>i.jsx(Le.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!p,id:u,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:p&&s})})});r6.displayName=n6;function o6(e,t){return`${e}-trigger-${t}`}function s6(e,t){return`${e}-content-${t}`}var Ew=K0,i6=J0,a6=t6,l6=r6;function Nw({className:e,size:t="default",...n}){return i.jsx(jw,{"data-slot":"switch","data-size":t,className:F("peer group/switch inline-flex shrink-0 items-center rounded-full transition-colors outline-none focus-visible:ring-[3px] focus-visible:ring-[#4ACC8C]/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[20px] data-[size=default]:w-[40px] data-[size=sm]:h-[14px] data-[size=sm]:w-[28px] data-[state=checked]:bg-[#4ACC8C] data-[state=unchecked]:bg-[#ccc]",e),...n,children:i.jsx(Sw,{"data-slot":"switch-thumb",className:F("pointer-events-none block rounded-full bg-white transition-transform group-data-[size=default]/switch:size-[16px] group-data-[size=sm]/switch:size-[10px] data-[state=checked]:translate-x-[22px] data-[state=unchecked]:translate-x-[2px]")})})}const Fw={submit:"提交数据",edit:"编辑数据",delete:"删除数据",init:"表单初始化",edit_init:"表单编辑初始化"},Tw={flow_end:"流程结束",flow_node:"流程节点"};function _w(e){var t,n;switch(e.triggerType){case"form_action":{const r=((t=e.formActionTriggerType)==null?void 0:t.map(o=>Fw[o]||o).join("/"))||"";return r?`${e.formId}
158
158
  ${r}`:e.formId}case"form_flow_node":{const r=((n=e.flowNodeTriggerType)==null?void 0:n.map(o=>Tw[o]||o).join("/"))||"";return r?`${e.formId}
159
159
  ${r}`:e.formId}case"form_field":return e.triggerFieldWidgetName?`${e.formId} / ${e.triggerFieldWidgetName}`:e.formId;case"universal":return"开箱即用,无需触发";case"scheduler":return"按计划时间触发";default:return""}}function Dw(e,t){if(!(!e&&!t))return{id:"",name:e||"",icon:t||""}}const c6=({helper:e,agentName:t,agentIcon:n,className:r,onEnabledChange:o,onViewLogs:s,onEdit:a,onCopy:l,onDelete:c})=>{const u=_w(e),d=Dw(t,n);return i.jsxs("div",{className:F("bg-white border border-[#e0e0e0] border-solid content-stretch flex flex-col items-start rounded-[10px] w-full group min-w-[335px]",r),children:[i.jsxs("div",{className:"grid-rows-[max-content] inline-grid leading-[0] place-items-start shrink-0 w-full",children:[i.jsxs("div",{className:"col-1 content-stretch flex h-[42px] items-center justify-between ml-0 mt-0 px-[12px] row-1 w-full",children:[i.jsxs("div",{className:"content-stretch flex gap-[6px] items-center shrink-0 min-w-0",children:[i.jsx(zb,{triggerType:e.triggerType,size:18}),i.jsx("p",{className:"leading-[normal] shrink-0 text-[#030303] text-[14px] truncate",children:e.helperName})]}),i.jsxs("div",{className:"content-stretch flex gap-[10px] items-center opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:[a&&i.jsx(Jt,{icon:i.jsx(jr,{}),rounded:!0,onClick:a}),l&&i.jsx(Jt,{icon:i.jsx(b3,{}),rounded:!0,onClick:l}),c&&i.jsx(Jt,{icon:i.jsx(Yo,{}),rounded:!0,onClick:c})]})]}),i.jsx("div",{className:"col-1 h-0 ml-0 mt-[42px] row-1 w-full border-b border-[#e0e0e0]"})]}),i.jsxs("div",{className:"content-stretch flex flex-col h-[172px] items-start justify-between p-[12px] shrink-0 w-full",children:[i.jsxs("div",{className:"content-stretch flex flex-col gap-[6px] items-start shrink-0 text-[14px] w-full",children:[i.jsx("p",{className:"min-w-full shrink-0 text-[#666] w-[min-content]",children:"触发:"}),u.split(`
160
- `).map((f,p)=>i.jsx("p",{className:"shrink-0 text-[#030303] whitespace-nowrap overflow-hidden text-ellipsis max-w-full",children:f},p))]}),d&&i.jsx(h0,{agent:d})]}),i.jsxs("div",{className:"grid-rows-[max-content] inline-grid leading-[0] place-items-start shrink-0 w-full",children:[i.jsx("div",{className:"col-1 h-0 ml-0 mt-0 row-1 w-full border-t border-[#e0e0e0]"}),i.jsxs("div",{className:"col-1 content-stretch flex h-[42px] items-center justify-between ml-0 mt-0 px-[12px] row-1 w-full",children:[i.jsx(Nw,{checked:e.enabled,onCheckedChange:o}),s&&i.jsx("button",{className:"leading-[normal] shrink-0 text-[#0265ff] text-[12px] whitespace-nowrap hover:underline",onClick:s,children:"查看执行日志"})]})]})]})},Aw=({items:e,className:t,getAgentName:n,getAgentIcon:r,onEnabledChange:o,onViewLogs:s,onEdit:a,onCopy:l,onDelete:c})=>i.jsx("div",{className:F("content-start flex flex-wrap gap-[20px] items-start",t),children:e.map(u=>i.jsx(c6,{helper:u,agentName:n==null?void 0:n(u.agentId),agentIcon:r==null?void 0:r(u.agentId),className:"w-[335px] shrink-0",onEnabledChange:o?d=>o(u.id,d):void 0,onViewLogs:s?()=>s(u.id):void 0,onEdit:a?()=>a(u.id):void 0,onCopy:l?()=>l(u.id):void 0,onDelete:c?()=>c(u.id):void 0},u.id))}),Ow=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"shrink-0",children:i.jsx("path",{d:"M8 3.333v9.334M3.333 8h9.334",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})}),Pw=({description:e,detailAddress:t,btnLabel:n="新建智能体助手",onCreateClick:r,className:o})=>i.jsxs("div",{className:F("content-stretch flex flex-col items-center justify-center py-[40px] px-[20px] w-full",o),children:[i.jsx(h3,{}),i.jsxs("div",{className:"mt-[16px] text-center text-[#999] text-[14px] leading-[normal]",children:[i.jsx("p",{className:"mb-0",children:e}),i.jsxs("p",{children:["您暂时还没有添加智能体助手。",i.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-[#0265ff] underline [text-decoration-skip-ink:none] decoration-solid",children:"了解详情"})]})]}),i.jsxs("button",{onClick:r,className:"mt-[12px] bg-[#0265ff] content-stretch flex gap-[6px] items-center pl-[16px] pr-[20px] py-[7px] rounded-[4px] cursor-pointer border-none",children:[i.jsx(Ow,{}),i.jsx("span",{className:"text-[14px] text-white whitespace-nowrap leading-[normal]",children:n})]})]}),Iw=({agent:e,className:t,onSelect:n,onLogClick:r})=>i.jsx("div",{className:F("bg-white border border-[#e0e0e0] border-solid content-stretch flex flex-col items-start p-[16px] rounded-[10px] w-full drop-shadow-[0px_0px_5px_rgba(0,0,0,0.04)] hover:drop-shadow-[0px_0px_8px_rgba(0,0,0,0.1)]",Q,t),onClick:n,children:i.jsxs("div",{className:"content-stretch flex flex-col gap-[12px] items-start w-full",children:[i.jsxs("div",{className:"content-stretch flex items-center justify-between w-full",children:[i.jsxs("div",{className:"content-stretch flex gap-[10px] items-center min-w-0",children:[i.jsx("img",{alt:e.name,className:"rounded-[10px] shrink-0 size-[40px] object-cover",src:e.icon}),i.jsx("p",{className:"font-bold leading-[normal] overflow-hidden shrink-0 text-[#030303] text-[18px] text-ellipsis whitespace-nowrap",children:e.name}),e.installCount!=null&&e.installCount>0&&i.jsx("div",{className:"bg-[#f5f7fa] content-stretch flex h-[26px] items-center justify-center px-[6px] py-[10px] rounded-[100px] shrink-0",children:i.jsxs("p",{className:"leading-[normal] shrink-0 text-[#4d609f] text-[12px] whitespace-nowrap",children:["安装次数:",e.installCount.toLocaleString()]})})]}),i.jsxs("div",{className:"content-stretch flex gap-[10px] items-center shrink-0",children:[e.version&&i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:"leading-[normal] shrink-0 text-[#999] text-[12px] whitespace-nowrap",children:["版本:",e.version]}),i.jsx("div",{className:"h-[14px] shrink-0 w-[1px] bg-[#e0e0e0]"})]}),e.lastUpdated&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"leading-[normal] shrink-0 text-[#999] text-[12px] whitespace-nowrap",children:e.lastUpdated}),i.jsx("div",{className:"h-[14px] shrink-0 w-[1px] bg-[#e0e0e0]"})]}),i.jsx("button",{className:"leading-[normal] shrink-0 text-[#0265ff] text-[14px] whitespace-nowrap hover:text-[rgba(2,101,255,0.8)] cursor-pointer bg-transparent border-none p-0",onClick:r,children:"更新日志"}),i.jsx("button",{className:"bg-[#eff0f6] content-stretch flex flex-col h-[30px] items-center justify-center px-[16px] py-[7px] rounded-[4px] shrink-0 cursor-pointer border-none hover:bg-[#f0f6ff] group/select",onClick:n,children:i.jsx("span",{className:"leading-[normal] shrink-0 text-[#030303] text-[14px] whitespace-nowrap group-hover/select:text-[#0265ff]",children:"选择"})})]})]}),e.description&&i.jsx("p",{className:"leading-[normal] shrink-0 text-[#666] text-[14px] w-full line-clamp-2",children:e.description})]})}),Hw=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:i.jsx("path",{d:"M6.5 8.5C7.05228 8.5 7.5 8.94772 7.5 9.5V14C7.5 14.5177 7.10667 14.9438 6.60254 14.9951L6.5 15H2L1.89746 14.9951C1.42703 14.9472 1.05278 14.573 1.00488 14.1025L1 14V9.5C1 8.94772 1.44772 8.5 2 8.5H6.5ZM14 8.5C14.5523 8.5 15 8.94772 15 9.5V14C15 14.5177 14.6067 14.9438 14.1025 14.9951L14 15H9.5L9.39746 14.9951C8.92703 14.9472 8.55278 14.573 8.50488 14.1025L8.5 14V9.5C8.5 8.94772 8.94772 8.5 9.5 8.5H14ZM9.5 14H14V9.5H9.5V14ZM2 14H6.5V9.5H2V14ZM6.5 1C7.05228 1 7.5 1.44772 7.5 2V6.5C7.5 7.01768 7.10667 7.44379 6.60254 7.49512L6.5 7.5H2L1.89746 7.49512C1.42703 7.44722 1.05278 7.07297 1.00488 6.60254L1 6.5V2C1 1.44772 1.44772 1 2 1H6.5ZM14 1C14.5523 1 15 1.44772 15 2V6.5C15 7.01768 14.6067 7.44379 14.1025 7.49512L14 7.5H9.5L9.39746 7.49512C8.92703 7.44722 8.55278 7.07297 8.50488 6.60254L8.5 6.5V2C8.5 1.44772 8.94772 1 9.5 1H14ZM2 6.5H6.5V2H2V6.5ZM9.5 6.5H14V2H9.5V6.5Z",fill:"#666666"})}),Vw=[{id:"all-agent",label:"全部"},{id:"system-agent",label:"系统智能体",icon:i.jsx(Hw,{})},{id:"custom-agent",label:"自定义智能体",icon:i.jsx(jr,{})}],Rw=({value:e,onChange:t,className:n})=>i.jsx("div",{className:F("flex flex-col",n),children:Vw.map(r=>{const o=e===r.id;return i.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(r.id),className:F("flex items-center gap-[6px] w-full h-[34px] px-[10px] rounded-[4px] text-left",o?"bg-[#EFF0F6]":"hover:bg-[#EFF0F6]",Q),children:[r.icon&&i.jsx("span",{className:"shrink-0 size-[16px] flex items-center justify-center text-[#666666]",children:r.icon}),i.jsx("span",{className:F("text-[14px] text-[#030303] leading-[normal] whitespace-nowrap",o?"font-bold":"font-normal"),children:r.label})]},r.id)})}),Bw=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:i.jsx("path",{d:"M13.9004 15H2.65039C2.25257 15 1.87104 14.842 1.58973 14.5607C1.30843 14.2794 1.15039 13.8978 1.15039 13.5V4.5C1.15039 4.10218 1.30843 3.72064 1.58973 3.43934C1.87104 3.15804 2.25257 3 2.65039 3H7.15039L8.65039 4.5H13.9004C14.0974 4.5 14.2924 4.5388 14.4744 4.61418C14.6564 4.68956 14.8218 4.80005 14.9611 4.93934C15.1003 5.07863 15.2108 5.24399 15.2862 5.42597C15.3616 5.60796 15.4004 5.80302 15.4004 6H2.65039V13.5L4.25539 7.5H16.0754C16.1927 7.49595 16.3093 7.51947 16.4158 7.56867C16.5223 7.61788 16.6158 7.69139 16.6888 7.78331C16.7617 7.87523 16.8121 7.98298 16.8358 8.0979C16.8595 8.21282 16.856 8.33171 16.8254 8.445L15.3704 13.875C15.2865 14.1999 15.0961 14.4873 14.8296 14.6913C14.5631 14.8952 14.2359 15.0039 13.9004 15Z",fill:"#6F81BD"})}),u6={0:"pl-[10px]",1:"pl-[32px]",2:"pl-[54px]",3:"pl-[76px]"};function d6(e){var t;return(t=u6[Math.min(e,3)])!=null?t:u6[3]}function zw(e,t){const n=t.toLowerCase().trim(),r=new Map;for(const u of e){const d=u.parent||"0";r.has(d)||r.set(d,[]),r.get(d).push(u)}const o=new Set(e.map(u=>u.id)),s=new Set(r.keys()),a=Array.from(s).filter(u=>u==="0"||!o.has(u));function l(u,d){var h,m,x,y,g;const f=r.get(u)||[],p=[];for(const b of f){const w=b.itemType==="group",v=l(b.id,d+1),S=!n||((h=b==null?void 0:b.name)==null?void 0:h.toLowerCase().includes(n));w?(S||v.length>0)&&p.push({id:b.id,name:b.name,icon:(m=b.icon)!=null?m:0,type:(x=b.type)!=null?x:"group",itemType:"group",children:v,depth:d,form:b}):S&&p.push({id:b.id,name:b.name,icon:(y=b.icon)!=null?y:0,type:(g=b.type)!=null?g:"form",itemType:"form",children:[],depth:d,form:b})}return p}const c=[];for(const u of a)c.push(...l(u,0));return c}function f6(e){const n=e>=25?"-new":"";return`node-icon icon-bsy-form${n} icon${n}-bsy-form-${e}`}function Zw({item:e,depth:t,isSelected:n,onClick:r}){return i.jsx("div",{className:F("flex items-center justify-between h-[34px] px-[10px] cursor-pointer rounded-[4px] shrink-0",d6(t),n?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]",Q),onClick:r,children:i.jsxs("span",{className:"flex items-center gap-[6px] min-w-0 flex-1",children:[i.jsx("i",{className:f6(e.icon),style:{fontSize:16,lineHeight:1}}),i.jsx("span",{className:"text-[14px] leading-[normal] truncate",children:e.name})]})})}function p6({item:e,selectedFormId:t,onSelect:n}){const[r,o]=C.useState(!0);return e.itemType==="group"?i.jsxs("div",{children:[i.jsxs("div",{className:F("flex items-center gap-[6px] h-[34px] px-[10px] cursor-pointer rounded-[4px]",d6(e.depth),"hover:bg-[#EFF0F6]",Q),onClick:()=>o(!r),children:[i.jsx("span",{className:F("shrink-0 flex items-center justify-center w-[16px] h-[16px] text-[#666666]",Q,r&&"rotate-90"),children:i.jsx(K1,{className:"-rotate-90",size:16})}),i.jsx(Bw,{}),i.jsx("span",{className:"text-[14px] text-[#030303] truncate",children:e.name})]}),r&&e.children.map(s=>i.jsx(p6,{item:s,selectedFormId:t,onSelect:n},s.id))]}):i.jsx(Zw,{item:e,depth:e.depth,isSelected:t===e.id,onClick:()=>{e.form&&n({form:e.form})}})}function Ww({searchQuery:e,onSearchChange:t,tree:n,selectedFormId:r,onSelect:o,hasSearch:s}){return i.jsxs("div",{className:F("bg-white rounded-[10px] shadow-[0px_0px_5px_rgba(0,0,0,0.04)] p-[4px]","flex flex-col gap-[4px]"),children:[i.jsxs("div",{className:"flex items-center gap-[6px] border border-[#E0E0E0] rounded-[4px] h-[30px] px-[10px] py-[5px]",children:[i.jsx(R1,{}),i.jsx("input",{type:"text",value:e,onChange:a=>t(a.target.value),placeholder:"输入表单名称来搜索",className:"flex-1 outline-none text-[14px] placeholder:text-[#999999] bg-transparent min-w-0 text-[#030303]"})]}),i.jsx("div",{className:"flex flex-col gap-0 max-h-[400px] overflow-y-auto",children:n.length>0?n.map(a=>i.jsx(p6,{item:a,selectedFormId:r,onSelect:o},a.id)):s?i.jsx("div",{className:"text-[12px] text-[#999999] py-[8px] text-center",children:"无匹配结果"}):i.jsx("div",{className:"text-[12px] text-[#999999] py-[8px] text-center",children:"暂无表单"})})]})}const al=C.forwardRef(({items:e,value:t,defaultValue:n,onChange:r,placeholder:o="请选择表单",disabled:s=!1,className:a},l)=>{var D;const[c,u]=C.useState(!1),[d,f]=C.useState(""),[p,h]=C.useState(n),m=C.useRef(null),x=C.useRef(null),[y,g]=C.useState({}),[b,w]=C.useState(null),v=t!=null?t:p,S=C.useMemo(()=>zw(e,d),[e,d]),j=C.useMemo(()=>{var Z;return v&&(Z=e.find(O=>O.id===v&&O.itemType!=="group"))!=null?Z:null},[e,v]),M=d.trim().length>0,L=C.useCallback(()=>{if(!m.current)return;const Z=m.current.getBoundingClientRect();g({position:"fixed",top:Z.bottom+4,left:Z.left,minWidth:Math.max(Z.width,240),zIndex:9999,pointerEvents:"auto"})},[]),T=C.useCallback(Z=>{if(m.current=Z,!Z){w(null);return}const O=Z.getRootNode();if(O instanceof ShadowRoot){const V=O.querySelector("[data-bs-form-select-portal]");if(V){w(V);return}const $=O.getElementById("ai-office-container")||O,W=document.createElement("div");W.setAttribute("data-bs-form-select-portal","true"),$.appendChild(W),w(W);return}w(null)},[]),_=C.useCallback(()=>{u(!1),f("")},[]),B=C.useCallback(()=>{s||(c?_():(u(!0),L()))},[s,c,_,L]),R=C.useCallback(Z=>{h(Z.form.id),r==null||r(Z),_()},[r,_]);return C.useEffect(()=>{var $;if(!c)return;const Z=($=m.current)==null?void 0:$.getRootNode(),O=Z!=null?Z:document,V=W=>{const K=W.target;x.current&&x.current.contains(K)||m.current&&m.current.contains(K)||_()};return O.addEventListener("mousedown",V),()=>{O.removeEventListener("mousedown",V)}},[c,_]),C.useEffect(()=>{if(!c)return;const Z=()=>{L()};return window.addEventListener("resize",Z),()=>window.removeEventListener("resize",Z)},[c,L]),C.useLayoutEffect(()=>{if(!c)return;let Z;const O=()=>{L(),Z=requestAnimationFrame(O)};return Z=requestAnimationFrame(O),()=>cancelAnimationFrame(Z)},[c,L]),C.useEffect(()=>{var $;if(!c)return;const Z=W=>{W.key==="Escape"&&_()},O=($=m.current)==null?void 0:$.getRootNode(),V=O!=null?O:document;return V.addEventListener("keydown",Z),()=>V.removeEventListener("keydown",Z)},[c,_]),C.useEffect(()=>{if(!c)return;const Z=x.current;if(!Z)return;const O=V=>V.stopPropagation();return Z.addEventListener("mousedown",O),Z.addEventListener("pointerdown",O),Z.addEventListener("wheel",O),()=>{Z.removeEventListener("mousedown",O),Z.removeEventListener("pointerdown",O),Z.removeEventListener("wheel",O)}},[c]),i.jsxs("div",{ref:l,className:F("relative inline-flex min-w-0 w-full",a),children:[i.jsxs("div",{ref:T,className:F("flex items-center gap-[10px] px-[10px] py-[7px] rounded-[4px] cursor-pointer select-none w-full","bg-white border",c?"border-[#0265FF]":"border-[#E0E0E0] hover:border-[#0265FF]",Q,s&&"opacity-50 cursor-not-allowed"),onClick:B,children:[i.jsx("span",{className:"flex items-center gap-[6px] min-w-0 flex-1",children:j?i.jsxs(i.Fragment,{children:[i.jsx("i",{className:f6((D=j.icon)!=null?D:0),style:{fontSize:16,lineHeight:1}}),i.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal] truncate",children:j.name})]}):i.jsx("span",{className:"text-[14px] text-[#999999] leading-[normal] truncate",children:o})}),i.jsx("span",{className:F("shrink-0 flex items-center justify-center w-[16px] h-[16px] text-[#666666]",Q,c&&"rotate-180"),children:i.jsx(K1,{size:16})})]}),c&&i1.createPortal(i.jsx("div",{ref:x,style:y,children:i.jsx(Ww,{searchQuery:d,onSearchChange:f,tree:S,selectedFormId:v,onSelect:R,hasSearch:M})}),b||document.body)]})});al.displayName="FormSelect";const $w=()=>i.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("rect",{x:"0.5",y:"0.5",width:"7",height:"7",rx:"1",fill:"#0265ff"})}),_1=k.forwardRef(({className:e,children:t,id:n,readonly:r,disabled:o,intermediate:s,...a},l)=>{const c=k.useId(),u=n!=null?n:c;return i.jsxs("label",{htmlFor:u,className:F("inline-flex items-center gap-[6px] select-none text-[#121111] text-[14px]",o?"cursor-not-allowed":"cursor-pointer",{"pointer-events-none":r}),children:[i.jsx(w0,{ref:l,id:u,disabled:o,className:F("inline-flex shrink-0 items-center justify-center","w-[16px] h-[16px] rounded-[2px] box-border border","transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#0265FF] focus-visible:ring-offset-1","border-[#E0E0E0] bg-white","hover:border-[#0265FF]","data-[state=checked]:bg-[#0265FF] data-[state=checked]:border-[#0265FF]","disabled:cursor-not-allowed disabled:bg-[#F0F0F0] disabled:border-[#C2C2C2]","disabled:data-[state=checked]:bg-[#C2C2C2] disabled:data-[state=checked]:border-[#C2C2C2]",s&&"bg-white border-[#0265FF] text-[#0265FF]",e,{"opacity-50":r}),...a,children:i.jsx(k0,{className:"text-white",forceMount:s||void 0,children:s?i.jsx($w,{}):i.jsx(na,{})})}),t!=null&&i.jsx("span",{className:F("text-sm leading-none",o&&"text-[#C2C2C2]"),children:t})]})});_1.displayName="SquareChecker";const Pt={eq:"等于",neq:"不等于",gt:"大于",lt:"小于",gte:"大于等于",lte:"小于等于",contains:"包含",not_contains:"不包含",in:"等于任意",nin:"不等于任意",all:"包含所有",empty:"为空",not_empty:"不为空",range:"范围"},Uw={text:["eq","neq","in","nin","contains","not_contains","empty","not_empty"],password:["eq","neq","contains","not_contains","empty","not_empty"],radiogroup:["eq","neq","in","nin","empty","not_empty"],radio:["eq","neq","empty","not_empty"],combo:["eq","neq","in","nin","empty","not_empty"],sn:["eq","neq","in","nin","contains","not_contains","empty","not_empty"],textarea:["contains","not_contains","empty","not_empty"],number:["eq","neq","gt","gte","lt","lte","range","empty","not_empty"],datetime:["eq","neq","gte","lte","range","empty","not_empty"],checkboxgroup:["in","all","eq","empty","not_empty"],combocheck:["in","all","eq","empty","not_empty"],user:["eq","neq","in","nin","empty","not_empty"],dept:["eq","neq","in","nin","empty","not_empty"],usergroup:["in","all","eq","empty","not_empty"],deptgroup:["in","all","eq","empty","not_empty"],address:["in","nin","empty","not_empty"],location:["in","nin","empty","not_empty"],upload:["empty","not_empty"],image:["empty","not_empty"],signature:["empty","not_empty"],flowState:["eq","neq","empty"],flowstate:["eq","neq","empty"],linkdata:["eq","neq","in","nin","empty","not_empty"],linkquery:["eq","neq","in","nin","empty","not_empty"],dataload:["eq","neq","in","nin","empty","not_empty"],formula:["eq","neq","empty","not_empty"],separator:[],button:[],subform:[],unknown:[]},qw={text:"eq",password:"eq",radiogroup:"eq",radio:"eq",combo:"eq",sn:"eq",textarea:"contains",number:"range",datetime:"range",checkboxgroup:"all",combocheck:"all",user:"eq",dept:"eq",usergroup:"all",deptgroup:"all",address:"all",location:"all",upload:"not_empty",image:"not_empty",signature:"not_empty",flowState:"eq",flowstate:"eq",linkdata:"eq",linkquery:"eq",dataload:"eq",formula:"eq"};function Yw(e){var t;return e?(t=Uw[e])!=null?t:[]:[]}function h6(e){var t;return e&&(t=qw[e])!=null?t:"eq"}function Gw(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Xw={eq:"eq",neq:"ne",gt:"gt",gte:"gte",lt:"lt",lte:"lte",contains:"like",not_contains:"unlike",in:"in",nin:"nin",all:"all",empty:"empty",not_empty:"not_empty",range:"range"},Kw={eq:"eq",ne:"neq",gt:"gt",gte:"gte",lt:"lt",lte:"lte",like:"contains",unlike:"not_contains",in:"in",nin:"nin",all:"all",empty:"empty",not_empty:"not_empty",range:"range"};function m6(e){const t=e.quantifier==="any"?"or":"and",n=e.items.map(r=>{var o,s,a,l;const c=(o=Xw[r.operator])!=null?o:"eq";let u;return r.operator==="range"&&Gw(r.value)?u=[r.value.min,r.value.max]:Array.isArray(r.value)?u=r.value:u=[r.value],{field:(a=(s=r.field.widget)==null?void 0:s.widgetName)!=null?a:"",method:c,value:u,type:(l=r.field.widget)==null?void 0:l.type}});return JSON.stringify({rel:t,cond:n})}function Qw(e){const t=JSON.parse(e),n=t.rel==="or"?"any":"all",r=t.cond.map((o,s)=>{var a,l;const c=(a=Kw[o.method])!=null?a:"eq";let u=o.value;return c==="range"?u={min:o.value[0],max:o.value[1]}:["eq","neq","contains","not_contains","gt","gte","lt","lte"].includes(c)&&(u=o.value[0]),{id:`${o.field}_${s}`,field:{label:o.field,widget:{widgetName:o.field,type:(l=o.type)!=null?l:"unknown",value:void 0}},operator:c,value:u}});return{targetName:"",quantifier:n,items:r}}const Jw={projectdevelopment:"e914",resourcelibrary:"e915",Plugin2:"e90e",Plugin:"e90f",JSON:"e910",Dropdown:"e911",Batchprocessing:"e912","Image-text":"e916",Newaddition:"e917",reportforms:"e918",AddFola:"e919",delete:"e91a",AddImage:"e91b",Send:"e91c",text:"e91d",image:"e91e",Star1:"e91f",Ellipse:"e920","Ellipse-Copy":"e921",Shape:"e922","Shape-Copy":"e923","right-line":"e924","right-arrow":"e925","double-right-arrow":"e926",ellipse:"e927",Rectangle:"e928","Rectangle-Copy":"e929","Rectangle-Copy-2":"e92a",CombinedShape:"e92b",Line:"e92c",time:"e92d",calendar:"e92e",richsinglelinetext:"e92f",singlelinetext:"e930",multilinetext:"e931",number:"e932",RichText:"e933",image1:"e934",Attachment:"e935",Phone:"e936",Email:"e937",date:"e938","Multiple-choice":"e939",Checkbox:"e93a","Drop-down":"e93b",positioning:"e93c",Description:"e93d",AutoNumber:"e93e",Address:"e93f",Staff:"e940",Department:"e941",Switch:"e942",Slider:"e943",Currentdate:"e944",Grade:"e945",Barcode:"e946",Subtable:"e947",associatedtable:"e948",Associatedapplication:"e949",Referencefield:"e94a",Uppercasing:"e94b",nodata:"e94c","X-mark":"e94d",Copy:"e94e",Correct:"e94f",Save:"e950",Printer:"e951",search:"e952",filter:"e953",Export:"e954",Import:"e955",Customprint:"e956",refresh:"e957",Helpcenter:"e958",Tutorial:"e959",Release:"e95a",more:"e95b",Setup:"e95c",sort:"e95d",Back:"e95e",show:"e95f",hide:"e960",Preview:"e961",Click:"e962",Allcheck:"e963",Cancelcheck:"e964",Likespot:"e965",Favoritespot:"e966",Followspot:"e967",Commentspot:"e968",At:"e969",Pin:"e96a",edit:"e96b",Top:"e96c",Movein:"e96d",Moveout:"e96e",Forward:"e96f",Revoke:"e970",Return:"e971",Link:"e972",Unlink:"e973",Download:"e974",Upload:"e975",Download2:"e976",Upload2:"e977",Comment:"e978",Remind:"e979",Notice:"e97a",Permission:"e97b",SMS:"e97c",QRcode:"e97d",Website:"e97e",Monitoring:"e97f",Api:"e980",Webhook:"e981",Synchronous:"e982",Automation:"e983",Trigger:"e984",Condition:"e985",Success:"e986",Failure:"e987",countdown:"e988",Waiting:"e989",Flow:"e98a",Connection:"e98b",Dashboard:"e98c",chart:"e98d",Piechart:"e98e",BarChart:"e98f",DoubleBarChart:"e991",StackedBarChart:"e992",PercentageStackedBarChart:"e993",LineChart:"e994",areachart:"e990",combinationchart:"e995",Scatterplot:"e996",FunnelChart:"e997",wordcloud:"e998",RadarChart:"e999",PivotTable:"e99a",NumberChart:"e99b",map:"e99c",Timeline:"e99d",Album:"e99e",Kanban:"e99f",Ganttchart:"e9a0",Circle:"e9a8",linesurface:"e9a1",IconStyle:"e9a2",Backgroundcolor:"e9a3",DeleteDe:"e9a4",AlignLeft:"e9a5",AlignCenter:"e9a6",AlignRight:"e9a7",Column:"e9a9",Component:"e9aa",Customcomponent:"e9ab",Title:"e9ac",RichText1:"e9ad",Carousel:"e9ae",PageTab:"e9af",Buriedpoint:"e9b0",Container:"e9b1",QuickStart:"e9b2",Group:"e9b3",Ungroup:"e9b4",Front:"e9b5",Back1:"e9b6",Lock:"e9b7",Unlock:"e9b8",Association:"e9b9",CancelAssociation:"e9ba",Quotation:"e9bb",ViewSet:"e9bc",AutoScale:"e9bd",waterfall:"e9be",watermark:"e9bf",history:"e9c0",Setting:"e9c1",Draftbox:"e9c2",SQL:"e9c3",Workflow:"e9c4",Workflow2:"e9c5",Addone:"e9c6",Formula:"e9c7",Dictionary:"e9c8",statistical:"e9c9",Recycle:"e9ca",Mistake:"e9cb",Tag:"e9cc",Pendingapproval:"e9cd",MyApplication:"e9ce",ApplicationApproval:"e9cf",Initiatedbyme:"e9d0",Copiedtome:"e9d1",Approvalnode:"e9d2",Fillnode:"e9d3",cc:"e9d4",Image1:"e9d5",Open:"e9d6",Color:"e9d7",Right:"e9d8",Backward:"e9d9",dataanalysis:"e9da",Filter2:"e9db",Freefilter:"e9dc",Conditionfilter:"e9dd",Quickfilter:"e9de",Export1:"e9df",Attachmentpreview:"e9e0",BulkEdit:"e9e1",Calculationrows:"e9e2",SingleSelect:"e9e3",dataview:"e9e4",Dataid:"e9e5",Divide:"e9e6",Progress:"e9e7",Star:"e9e8",Contacts:"e9e9",Activity:"e9ea",Minus:"e9eb",Plussign:"e9ec","Plussign-Copy":"e9ed",Increased:"e9ee",Decline:"e9ef",indeterminate:"e9f0",Decline1:"e9f1",personal:"e9f2",Warning:"e9f3",Warning2:"e9f4",Prompt:"e9f5",info:"e9f6",Cancel:"e9f7",question1:"e9f8",Question:"e9f9",exclamation:"e9fa",Warning1:"e9fb",True:"e9fc",Suspended:"e9fd",Suspended1:"e9fe",Suspended2:"e9ff",Error:"ea00",CombinedShape2:"ea01",Delete1:"ea02",Circle1:"ea03",Decline2:"ea04",Decline3:"ea05",add:"ea06",Addto:"ea07",Reduce:"ea08",Subtract:"ea09",Addition:"ea0a",Multiplication:"ea0b",Division:"ea0c",Bracket:"ea0d",Reduce1:"ea0e",Search:"ea0f",Favorites:"ea10",Annotation:"ea11",Application:"ea12",Application2:"ea13",Applicationsview:"ea14",Publish:"ea15",Deploy:"ea16",Sidetoplowerside:"ea17",Narrow:"ea18",Backtothenavigation:"ea19",Forwardtothenavigation:"ea1a",Return1:"ea1b",Transfer:"ea1c",Log:"ea1d",table:"ea1e",Form:"ea1f",Openfield:"ea20",Closefield:"ea21",Receive:"ea22",Fill:"ea23",Fill1:"ea24",fillet:"ea25",rightangle:"ea26",round:"ea27",Send1:"ea28",Map:"ea29",Upward:"ea2a",Move:"ea2b",Downward:"ea2c",drag:"ea2d",TextIcon:"ea2e",Narrow1:"ea2f",Enlarge:"ea30",Enlarge2:"ea31",Cancel1:"ea32",Retract:"ea33",Expand:"ea34",Retract1:"ea35",Expand1:"ea36",Retract2:"ea37",Expand2:"ea38",Switch1:"ea39",Fullscreen:"ea3a",Offscreen:"ea3b",Notvisible:"ea3c",Visible:"ea3d",Adjust:"ea3e",PC:"ea3f",Mobile:"ea40",Pad:"ea41",Scanthecode:"ea42",Scan:"ea43",Screenshot:"ea44",Rotation:"ea45",voice:"ea46",Video:"ea47",Location:"ea48",Clock:"ea49",Print:"ea4a",Member:"ea4b",WorkWeChat:"ea4c",DingTalk:"ea4d",EnterpriseWeChat2:"ea4e",Groupmanagement:"ea4f",Feishu:"ea50",Stationletter:"ea51",Email1:"ea52",WeChat:"ea53",ServiceAccount:"ea54",Subscribed:"ea55",Dingtalk:"ea56",Information:"ea57",Assistant:"ea58",ai:"ea59",Inquireabout:"ea5a",IFrame:"ea5b",Integratio:"ea5c",close:"ea5d",Close:"ea5e",Addgroup:"ea5f",deletegroup:"ea60",Relateddata:"ea61",Enlarge1:"ea62",Narrow2:"ea63","map-search":"ea64",Corner:"ea65",text1:"ea66",Onlinemap:"ea67",Maptile:"ea68",Dataexport:"ea69",Word:"ea6a",Excel:"ea6b",PPT:"ea6c",PDF:"ea6d",Video1:"ea6e",Audio:"ea6f",Txt:"ea70",Zip:"ea71",file:"ea72",richtext:"ea73",Onlinemap1:"ea74",Maptile1:"ea75",Ai2:"ea76",Guide:"ea77",Button:"ea78",Menus:"ea79","richtext-Copy":"ea7a","richtext-Copy-2":"ea7b","richtext-Copy-3":"ea7c","richtext-Copy-4":"ea7d",Split:"ea7e",AI:"ea7f",Form1:"ea80",Fields:"ea81",Project:"ea82",More1:"ea83",Notstarted:"ea84",Inprocess:"ea85",Completed:"ea86",Completed1:"ea87",More2:"ea88",AIoffice:"ea89",statistics:"ea8a",Expand3:"ea8b",list:"ea8c","list-Copy":"ea8d",Grid:"ea8e",Calendar:"ea8f",Schedule:"ea90",tableview:"ea91",Gallery:"ea92",Copy1:"ea93",Mailbox:"ea94",Automation1:"ea95",Avatar:"ea96"};function ev(e){const t=Jw[e];return t?`&#x${t};`:void 0}function tv(e){const n=e>=25?"-new":"";return`node-icon icon-bsy-form${n} icon${n}-bsy-form-${e}`}const nv=({name:e})=>i.jsx("div",{className:"imgbg-bsy-app imgbg-bsy-app-"+e}),ll=({code:e,name:t,className:n,style:r,color:o})=>{if(!e&&!t)return null;if(e)return i.jsx("i",{className:`sdk-icon ${n||""}`,style:{...r,color:o},dangerouslySetInnerHTML:{__html:e}});const s=e||ev((t==null?void 0:t.toString())||"");return s?i.jsx("i",{className:`sdk-icon ${n||""}`,style:{...r,color:o},dangerouslySetInnerHTML:{__html:s}}):i.jsx("i",{className:tv(t),style:{fontSize:16,lineHeight:1}})};function rv(e){return e.map(t=>({id:t._id,label:t.name,type:"group",children:t.apps.map(n=>{var r;return{id:n._id,label:n.appname,type:"app",color:String(((r=n.style)==null?void 0:r.color)||"#666666"),data:n}})}))}const C6=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:i.jsx("path",{d:"M13.9004 15H2.65039C2.25257 15 1.87104 14.842 1.58973 14.5607C1.30843 14.2794 1.15039 13.8978 1.15039 13.5V4.5C1.15039 4.10218 1.30843 3.72064 1.58973 3.43934C1.87104 3.15804 2.25257 3 2.65039 3H7.15039L8.65039 4.5H13.9004C14.0974 4.5 14.2924 4.5388 14.4744 4.61418C14.6564 4.68956 14.8218 4.80005 14.9611 4.93934C15.1003 5.07863 15.2108 5.24399 15.2862 5.42597C15.3616 5.60796 15.4004 5.80302 15.4004 6H2.65039V13.5L4.25539 7.5H16.0754C16.1927 7.49595 16.3093 7.51947 16.4158 7.56867C16.5223 7.61788 16.6158 7.69139 16.6888 7.78331C16.7617 7.87523 16.8121 7.98298 16.8358 8.0979C16.8595 8.21282 16.856 8.33171 16.8254 8.445L15.3704 13.875C15.2865 14.1999 15.0961 14.4873 14.8296 14.6913C14.5631 14.8952 14.2359 15.0039 13.9004 15Z",fill:"#6F81BD"})}),ov=({expanded:e})=>i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",className:F("shrink-0",Q),style:{transform:e?"rotate(0deg)":"rotate(-90deg)"},children:i.jsx("path",{d:"M6 8L9 11L12 8",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),sv=()=>i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:i.jsx("path",{d:"M3 3L9 9M9 3L3 9",stroke:"#999999",strokeWidth:"1.2",strokeLinecap:"round"})}),iv=()=>i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:[i.jsx("circle",{cx:"2",cy:"6",r:"1",fill:"#999999"}),i.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"#999999"}),i.jsx("circle",{cx:"10",cy:"6",r:"1",fill:"#999999"})]}),x6=({open:e})=>i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:F("shrink-0",Q),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:i.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),gs="__all__";function av(e){const t=new Map,n=r=>{for(const o of r)t.set(o.id,o),o.children&&n(o.children)};return n(e),t}const lv=({nodes:e,mode:t="single",popoverContentOnly:n,showAll:r=!1,value:o,defaultValue:s,onChange:a,placeholder:l="请选择",searchPlaceholder:c="输入应用名称来搜索",disabled:u=!1,maxVisibleChips:d=4,className:f})=>{const[p,h]=C.useState(!1),[m,x]=C.useState(""),[y,g]=C.useState(s!=null?s:t==="multiple"?[]:""),[b,w]=C.useState(null),[v,S]=C.useState(0),j=C.useRef(null),[M,L]=C.useState(()=>{const U=new Set,te=(le,re)=>{for(const Ce of le)Ce.children&&Ce.children.length>0&&re<2&&(U.add(Ce.id),te(Ce.children,re+1))};return te(e,0),U}),T=o!==void 0?o:y,_=C.useMemo(()=>av(e),[e]),B=C.useMemo(()=>t==="multiple"?new Set(Array.isArray(T)?T:[]):new Set(typeof T=="string"&&T?[T]:[]),[T,t]),R=C.useMemo(()=>(Array.isArray(T)?T:T?[T]:[]).map(te=>{var le,re;return(re=(le=_.get(te))==null?void 0:le.label)!=null?re:te}),[T,_]),D=t==="single"&&R.length===1?R[0]===gs?"全部应用":R[0]:null,Z=C.useMemo(()=>{if(!m.trim())return e;const U=m.toLowerCase(),te=le=>{var Ce;const re=[];for(const ge of le){const He=(Ce=ge==null?void 0:ge.label)==null?void 0:Ce.toLowerCase().includes(U),ie=ge.children?te(ge.children):[];(He||ie.length>0)&&re.push({...ge,children:ie.length>0?ie:ge.children})}return re};return te(e)},[e,m]),O=C.useCallback(U=>{if(j.current=U,U&&S(U.offsetWidth),!U){w(null);return}const te=U.getRootNode();if(te instanceof ShadowRoot){const le=te.querySelector("[data-bs-app-select-portal]");if(le){w(le);return}const re=document.createElement("div");re.setAttribute("data-bs-app-select-portal","true"),te.appendChild(re),w(re)}else w(null)},[]),V=C.useCallback(U=>{o===void 0&&g(U),a==null||a(U)},[o,a]),$=C.useCallback(U=>{L(te=>{const le=new Set(te);return le.has(U)?le.delete(U):le.add(U),le})},[]),W=C.useCallback((U,te)=>{if(te.type==="group"||te.children&&te.children.length>0){$(U);return}if(t==="single")V(U),h(!1);else{const le=Array.isArray(T)?[...T]:[],re=le.indexOf(U);re>=0?le.splice(re,1):le.push(U),V(le)}},[t,T,V,$]),K=C.useCallback((U,te)=>{te.stopPropagation(),t==="multiple"&&Array.isArray(T)&&V(T.filter(le=>le!==U))},[t,T,V]),N=C.useCallback(U=>{u||(h(U),U&&j.current&&S(j.current.offsetWidth),U||x(""))},[u]),Y=t==="multiple"?R:[],ce=Y.slice(0,d),A=Y.length-ce.length,ue=C.useCallback((U,te)=>{var He;const le=U.children&&U.children.length>0,re=M.has(U.id),Ce=B.has(U.id),ge=te*22+10;return i.jsxs("div",{children:[i.jsxs("button",{type:"button",onClick:()=>W(U.id,U),className:F("flex items-center gap-[6px] w-full h-[34px] rounded-[4px] text-left","pr-[10px]",Q,Ce?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]"),style:{paddingLeft:`${ge}px`,paddingTop:"10px",paddingBottom:"10px"},children:[le&&i.jsx(ov,{expanded:re}),U.type==="group"&&!le&&i.jsx(C6,{}),U.type==="group"&&le&&i.jsx(C6,{}),U.type==="app"&&i.jsx(nv,{name:(He=U.data)==null?void 0:He.style.icon}),i.jsx("span",{className:"text-[14px] truncate leading-[normal] flex-1 min-w-0",children:U.label}),t==="multiple"&&!le&&U.type!=="group"&&i.jsx("span",{onClick:ie=>ie.stopPropagation(),className:"grid place-items-center",children:i.jsx(_1,{checked:Ce,onCheckedChange:()=>W(U.id,U),className:"shrink-0"})})]}),le&&re&&i.jsx("div",{children:U.children.map(ie=>ue(ie,te+1))})]},U.id)},[M,B,t,W]),Ee=t==="multiple"&&Y.length>0,ke=i.jsxs("div",{className:"flex flex-col gap-[4px]",children:[i.jsxs("div",{className:"flex items-center gap-[6px] border border-[#E0E0E0] rounded-[4px] h-[30px] px-[10px] py-[5px]",children:[i.jsx(R1,{}),i.jsx("input",{type:"text",value:m,onChange:U=>x(U.target.value),placeholder:c,className:"flex-1 outline-none text-[14px] placeholder:text-[#999999] bg-transparent min-w-0 text-[#030303]"})]}),r&&t==="single"&&!m.trim()&&i.jsx("button",{type:"button",onClick:()=>{V(gs),h(!1)},className:F("flex items-center w-full h-[34px] rounded-[4px] text-left","px-[10px]",Q,B.has(gs)?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]"),children:i.jsx("span",{className:"text-[14px] leading-[normal]",children:"全部应用"})}),i.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:Z.length>0?Z.map(U=>ue(U,0)):i.jsx("div",{className:"flex items-center justify-center h-[60px] text-[12px] text-[#999999]",children:m.trim()?"未找到相关应用":"暂无应用"})})]});return n?ke:i.jsx("div",{className:F("relative",f),children:i.jsxs(St,{open:p,onOpenChange:N,children:[i.jsx(Lt,{asChild:!0,children:i.jsx("button",{ref:O,type:"button",disabled:u,className:F("flex items-center justify-between w-full h-[34px] gap-2.5","bg-white border border-[#E0E0E0] rounded-[4px]","py-[7px]",Ee?"pl-[4px] pr-[10px]":"px-[10px]","text-left cursor-pointer","hover:border-[#0265FF]",u&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",p&&"border-[#0265FF]",Q),children:Ee?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center gap-[4px] min-w-0 flex-1 overflow-x-auto scrollbar-hide",children:[ce.map((U,te)=>i.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0 max-w-[160px]",onClick:le=>{le.stopPropagation();const re=Array.isArray(T)?T:[];re[te]&&K(re[te],le)},children:[i.jsx("span",{className:"text-[14px] text-[#030303] truncate leading-[normal]",children:U}),i.jsx("span",{className:"cursor-pointer flex items-center shrink-0 hover:bg-[#EFF0F6]",children:i.jsx(sv,{})})]},te)),A>0&&i.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0",children:[i.jsxs("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:["+",A]}),i.jsx(iv,{})]})]}),i.jsx(x6,{open:p})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:F("text-[14px] leading-[normal] truncate",D?"text-[#030303]":"text-[#999999]"),children:D!=null?D:l}),i.jsx(x6,{open:p})]})})}),i.jsx(vt,{align:"start",sideOffset:4,portalContainer:b,className:"!border-0 rounded-[10px] shadow-[0px_0px_5px_rgba(0,0,0,0.04)] p-[4px]",style:{minWidth:v||void 0},children:ke})]})})},cl=({defaultChecked:e=!1,checked:t,onCheckedChange:n,title:r,description:o,disabled:s=!1,className:a})=>{const[l,c]=C.useState(!!e),u=t!==void 0,d=u?!!t:l,f=C.useRef(d);f.current=d;const p=h=>{if(h.target!==h.currentTarget||s)return;const m=!f.current;u||c(m),n==null||n(m)};return i.jsxs("div",{role:"button",tabIndex:s?-1:0,"aria-checked":d,"aria-disabled":s,onClick:p,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),p(h))},className:F("flex flex-col gap-[6px] p-[10px] rounded-[4px] cursor-pointer select-none bg-white","border",d?"border-[#0265FF]":"border-[#E0E0E0]",s&&"cursor-not-allowed opacity-50",a),children:[i.jsxs("div",{className:"inline-flex items-center gap-[6px] pointer-events-none",children:[i.jsx(_1,{checked:d,disabled:s}),i.jsx("span",{className:"text-[#121111] text-[14px]",children:r})]}),o!=null&&i.jsx("p",{className:"text-[#666] text-[12px] pl-[22px] pointer-events-none",children:o})]})},cv=[{type:"submit",title:"表单提交数据"},{type:"edit",title:"表单编辑数据"},{type:"delete",title:"表单删除数据"},{type:"init",title:"表单初始化"},{type:"edit_init",title:"表单编辑初始化"}],uv=({multiple:e=!1,value:t,onChange:n})=>{const r=e?Array.isArray(t)?t:[]:null;return i.jsx("div",{className:"flex gap-[20px]",children:cv.map(o=>{const s=e?r.includes(o.type):t===o.type;return i.jsx(cl,{className:"flex-[1_0_0] min-w-px",title:o.title,checked:s,onCheckedChange:a=>{if(e){const l=a?[...r,o.type]:r.filter(c=>c!==o.type);n==null||n(l)}else a&&(n==null||n(o.type))}},o.type)})})},dv=[{type:"flow_end",title:"流程结束"},{type:"flow_node",title:"流程节点"}],fv=({multiple:e=!1,value:t,onChange:n})=>{const r=e?Array.isArray(t)?t:[]:null;return i.jsx("div",{className:"flex gap-[20px]",children:dv.map(o=>{const s=e?r.includes(o.type):t===o.type;return i.jsx(cl,{className:"flex-[1_0_0] min-w-px max-w-[216px]",title:o.title,checked:s,onCheckedChange:a=>{if(e){const l=a?[...r,o.type]:r.filter(c=>c!==o.type);n==null||n(l)}else a&&(n==null||n(o.type))}},o.type)})})},pv=[{value:"custom",label:"自定义时间"},{value:"date_field",label:"根据表单日期时间字段"}],g6=({value:e,onChange:t,placeholder:n="请选择时间来源类型",disabled:r=!1,className:o})=>i.jsxs(B1,{value:e,onValueChange:s=>t==null?void 0:t(s),disabled:r,children:[i.jsx(L1,{className:o,children:i.jsx(z1,{placeholder:n})}),i.jsx(M1,{children:pv.map(s=>i.jsx(E1,{value:s.value,children:s.label},s.value))})]}),ul=1e3,dl=2999,fl=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],hv=["一","二","三","四","五","六","日"];function mv(e,t){const o=(new Date(e,t,1).getDay()-1+7)%7;return new Date(e,t,1-o)}function y6(e,t){return new Date(e,t+1,0).getDate()}function b6(e,t,n){const r=e.h*36e5+e.m*6e4+e.s*1e3+e.ms,o=t.h*36e5+t.m*6e4+t.s*1e3+t.ms,s=n.h*36e5+n.m*6e4+n.s*1e3+n.ms;return r>=o&&r<=s}function Qn(e,t,n,r,o="day"){if(o==="year"){const l=e.getFullYear();return l>=t.getFullYear()&&l<=n.getFullYear()}if(o==="month"){const l=e.getFullYear(),c=e.getMonth(),u=t.getFullYear(),d=t.getMonth(),f=n.getFullYear(),p=n.getMonth();return!(l<u||l>f||l===u&&c<d||l===f&&c>p)}e.setHours(0,0,0,0);const s=new Date(t);s.setHours(0,0,0,0);const a=new Date(n);return a.setHours(0,0,0,0),!(e<s||e>a||r&&r.length>0&&!r.includes(e.getDay()))}function Cv(e,t,n){const r=e.getTime(),o=t.getTime(),s=n.getTime();return r<o?new Date(t):r>s?new Date(n):new Date(e)}function w6(e,t,n){if(n==="year")return e.getFullYear()>t.getFullYear();const r=e.getFullYear(),o=e.getMonth(),s=t.getFullYear(),a=t.getMonth();return r>s||r===s&&o>a}function v6(e,t,n){if(n==="year")return e.getFullYear()<t.getFullYear();const r=e.getFullYear(),o=e.getMonth(),s=t.getFullYear(),a=t.getMonth();return r<s||r===s&&o<a}function xv(e,t){const n=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0"),s=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0");return t==="yyyy-MM-dd"?`${n}-${r}-${o}`:t==="yyyy-MM-dd HH:mm:ss"?`${n}-${r}-${o} ${s}:${a}:${l}`:t==="yyyy-MM-dd HH:mm"?`${n}-${r}-${o} ${s}:${a}`:t==="HH:mm:ss"?`${s}:${a}:${l}`:t==="HH:mm"?`${s}:${a}`:t==="yyyy-MM"?`${n}-${r}`:t==="yyyy"?`${n}`:`${n}-${r}-${o}`}const bn="text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px]",$r='text-[#999] relative pointer-events-none before:absolute before:left-0 before:right-0 before:top-1 before:h-[28px] before:bg-[#f3f3f3] before:opacity-60 before:content-[""]';function gv({year:e,month:t,day:n,format:r,minDate:o,maxDate:s,week:a,onYearReduce:l,onYearAdd:c,onMonthReduce:u,onMonthAdd:d,onMonthMenu:f,onYearMenu:p,onChangeDay:h}){const m=r.includes("dd"),x=C.useMemo(()=>{const y=mv(e,t),g=new Date,b=`${g.getFullYear()}-${g.getMonth()}-${g.getDate()}`,w=[],v=new Date(y);for(let S=0;S<6;S++){const j=[];for(let M=0;M<7;M++){const L=v.getDate(),T=v.getMonth(),_=v.getFullYear();let B=Qn(new Date(_,T,L,0,0,0,0),o,s,a,"day")?"":"disabled";B||(t!==T?B="oday":(B="day",(M===5||M===6)&&(B+=" weekend"),`${_}-${T}-${L}`===b&&(B+=" today"),n===L&&t===T&&(B+=" selected"))),j.push({day:L,month:T,year:_,css:B,key:`d${_}-${T}-${L}`}),v.setDate(v.getDate()+1)}w.push(j)}for(;w.length>4&&w[w.length-1].every(S=>S.month!==t);)w.pop();return w},[e,t,n,o,s,a]);return m?i.jsxs(i.Fragment,{children:[i.jsxs("thead",{children:[i.jsxs("tr",{children:[i.jsx("td",{className:F(bn,"btn prevm hover:text-[#0265ff]",!w6(new Date(e,t,1),o,"year")&&"disabled "+$r),colSpan:1,onClick:l,children:i.jsx(CC,{size:14})}),i.jsx("td",{className:F(bn,"btn prevm hover:text-[#0265ff]",!w6(new Date(e,t,1),o,"month")&&"disabled "+$r),colSpan:1,onClick:u,children:i.jsx(Ko,{size:14})}),i.jsxs("td",{className:F(bn,"title font-bold p-0.5"),colSpan:3,children:[i.jsx("span",{className:"title-month mr-1.5 hover:text-[#0265ff] cursor-pointer",onClick:f,children:fl[t]}),i.jsx("span",{children:", "}),i.jsx("span",{className:"title-year hover:text-[#0265ff] cursor-pointer",onClick:p,children:e})]}),i.jsx("td",{className:F(bn,"btn nextm hover:text-[#0265ff]",!v6(new Date(e,t,1),s,"month")&&"disabled "+$r),colSpan:1,onClick:d,children:i.jsx(Qo,{size:14})}),i.jsx("td",{className:F(bn,"btn nextm hover:text-[#0265ff]",!v6(new Date(e,t,1),s,"year")&&"disabled "+$r),colSpan:1,onClick:c,children:i.jsx(xC,{size:14})})]}),i.jsx("tr",{children:hv.map((y,g)=>i.jsx("td",{className:F(bn,"day name week font-bold hover:bg-transparent hover:p-0 hover:border-none",(g===5||g===6)&&"text-[#e34d59]"),children:y},y))})]}),i.jsx("tbody",{children:x.slice(0,6).map((y,g)=>i.jsx("tr",{children:y.map(b=>{const w=b.css.includes("disabled"),v=b.css.includes("oday"),S=b.css.includes("today"),j=b.css.includes("selected"),M=b.css.includes("weekend");return i.jsx("td",{className:F(bn,w&&$r,v&&"text-[#e0e0e0] hover:bg-[rgba(2,101,255,0.08)]",!w&&!v&&"hover:bg-[rgba(2,101,255,0.08)]",S&&"font-bold text-[#0265ff]",M&&"text-[#e34d59]",j&&"font-bold p-[1px] text-white border border-[#0265ff] bg-[#0265ff] hover:border-[#0265ff] hover:bg-[#0265ff]"),onClick:()=>h(b.day,b.month,b.year,b.css),children:i.jsx("div",{className:"day-wrapper",children:i.jsx("div",{className:"day-item",children:b.day})})},b.key)})},g))})]}):null}const Ur="text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px]",yv='text-[#999] relative pointer-events-none before:absolute before:left-0 before:right-0 before:top-[20px] before:h-[28px] before:bg-[#f3f3f3] before:opacity-60 before:content-[""]';function bv({year:e,month:t,showYear:n,position:r,minDate:o,maxDate:s,week:a,onYearReduce:l,onYearAdd:c,onYearMenu:u,onMountOk:d}){const f=p=>Qn(p,o,s,a,"month");return i.jsxs("table",{cellSpacing:0,cellPadding:0,className:"mt bg-white rounded-[4px]",style:{position:r},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{className:F(Ur,"btn prevy hover:text-[#0265ff]"),colSpan:1,onClick:l,children:i.jsx(Ko,{size:14})}),i.jsx("td",{className:F(Ur,"year title font-bold p-0.5"),colSpan:1,children:i.jsx("span",{className:"title-year hover:text-[#0265ff] cursor-pointer",onClick:u,children:e})}),i.jsx("td",{className:F(Ur,"btn nexty hover:text-[#0265ff]"),colSpan:1,onClick:c,children:i.jsx(Qo,{size:14})})]})}),i.jsx("tbody",{children:[0,1,2,3].map(p=>i.jsx("tr",{children:[0,1,2].map(h=>{const m=p*3+h;if(m>11)return i.jsx("td",{className:Ur},m);const x=f(new Date(e,m,1)),y=t===m&&!n,g=!x;return i.jsx("td",{className:F(Ur,"month w-[58px] h-[38px] hover:bg-[rgba(2,101,255,0.08)]",y&&"font-bold p-[1px] text-white border border-[#0265ff] bg-[#0265ff] hover:border-[#0265ff] hover:bg-[#0265ff]",g&&yv),onClick:()=>{g||d(m)},children:fl[m]},m)})},p))})]})}const ys="text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px]",wv='text-[#999] relative pointer-events-none before:absolute before:left-0 before:right-0 before:top-[14px] before:h-[28px] before:bg-[#f3f3f3] before:opacity-60 before:content-[""]';function k6({year:e,position:t,showYearLabel:n,minDate:r,maxDate:o,week:s,onYearFReduce:a,onYearFAdd:l,onSelectYear:c}){const u=e-9,d=e+10,f=C.useMemo(()=>{const p=[];for(let h=0;h<5;h++){const m=[];for(let x=0;x<4;x++){const y=u+h*4+x,g=Qn(new Date(y,0,1),r,o,s,"year");m.push({year:y,isSelected:e===y,isDisabled:!g})}p.push(m)}return p},[u,e,r,o,s]);return i.jsxs("table",{cellSpacing:0,cellPadding:0,className:"yt bg-white rounded-[4px] w-full h-full",style:{position:t},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{className:F(ys,"btn prevy hover:text-[#0265ff] grid place-content-center"),colSpan:1,onClick:a,children:i.jsx(Ko,{size:14})}),i.jsx("td",{className:F(ys,"year title font-bold p-0.5"),colSpan:2,children:n?`${u}年 - ${d}年`:`${u} - ${d}`}),i.jsx("td",{className:F(ys,"btn nexty hover:text-[#0265ff] grid place-content-center"),colSpan:1,onClick:l,children:i.jsx(Qo,{size:14})})]})}),i.jsx("tbody",{children:f.map((p,h)=>i.jsx("tr",{children:p.map(m=>i.jsx("td",{className:F(ys,"year",m.isSelected&&"font-bold p-[1px] text-white border border-[#0265ff] bg-[#0265ff] hover:border-[#0265ff] hover:bg-[#0265ff]",m.isDisabled&&wv),onClick:()=>{m.isDisabled||c(m.year)},children:m.year},m.year))},h))})]})}const vv="h-[32px] leading-[32px] text-center cursor-pointer rounded-[4px] hover:bg-[rgba(2,101,255,0.08)]";function kv({hours:e,minutes:t,seconds:n,year:r,month:o,day:s,format:a,minDate:l,maxDate:c,startTime:u,endTime:d,onHoursChange:f,onMinutesChange:p,onSecondsChange:h}){const m=a.includes("mm"),x=a.includes("ss"),y=g=>{const b=g==="hours"?24:60,w={hours:"时",minutes:"分",seconds:"秒"},v=g==="hours"?e:g==="minutes"?t:n,S=g==="hours"?f:g==="minutes"?p:h;return i.jsxs("div",{className:F("col flex-1 border-l border-[#e0e0e0]",g),children:[i.jsx("div",{className:"label h-[32px] leading-[32px] text-center",children:w[g]}),i.jsx("div",{className:"col-list h-[200px] overflow-auto",children:Array.from({length:b},(j,M)=>{const L=v===M;let T=!1;const _=l.getFullYear()===r&&l.getMonth()===o&&l.getDate()===s,B=c.getFullYear()===r&&c.getMonth()===o&&c.getDate()===s;return _&&(T=!b6({h:g==="hours"?M:e,m:g==="minutes"?M:t,s:g==="seconds"?M:n,ms:0},u,{h:23,m:59,s:59,ms:999})),B&&!T&&(T=!b6({h:g==="hours"?M:e,m:g==="minutes"?M:t,s:g==="seconds"?M:n,ms:0},{h:0,m:0,s:0,ms:0},d)),i.jsx("div",{className:F(vv,L&&!T&&"select bg-[rgba(2,101,255,0.2)]",T&&"text-[#999] pointer-events-none opacity-80"),onClick:()=>{T||S(M)},children:M>9?M:`0${M}`},M)})})]})};return i.jsxs("div",{className:"time-range w-[180px]",children:[i.jsxs("div",{className:"time-input flex h-[40px] border-l border-[#e0e0e0]",children:[i.jsx("input",{type:"number",value:e,className:"h-[24px] w-[38px] my-[10px] mx-[10px] mt-[10px] text-center pl-[5px] flex-1",onChange:g=>{const b=Math.min(23,Math.max(0,parseInt(g.target.value)||0));f(b)}}),m&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"leading-[40px]",children:":"}),i.jsx("input",{type:"number",value:t,className:"h-[24px] w-[38px] my-[10px] mx-[10px] mt-[10px] text-center pl-[5px] flex-1",onChange:g=>{const b=Math.min(59,Math.max(0,parseInt(g.target.value)||0));p(b)}})]}),x&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"leading-[40px]",children:":"}),i.jsx("input",{type:"number",value:n,className:"h-[24px] w-[38px] my-[10px] mx-[10px] mt-[10px] text-center pl-[5px] flex-1",onChange:g=>{const b=Math.min(59,Math.max(0,parseInt(g.target.value)||0));h(b)}})]})]}),i.jsxs("div",{className:"time-select-range flex border-t border-[#e0e0e0]",style:{height:"calc(100% - 40px)"},children:[y("hours"),m&&y("minutes"),x&&y("seconds")]})]})}function jv({hasTime:e,hasDay:t,todayCls:n,onToday:r,onOk:o}){return!e&&!t?null:i.jsx("div",{className:"footer h-[40px] leading-[40px] text-center border-t border-[#e0e0e0]",children:i.jsxs("div",{className:"hms px-[10px]",children:[i.jsx("div",{className:F("btn cursor-pointer px-[5px] mx-[5px]",e?"current-time float-left text-[#0265ff] ml-0 pl-0 text-center":"today float-left text-[#0265ff] ml-0 pl-0 text-center",n==="disabled"&&"text-[#999] pointer-events-none opacity-80"),onClick:r,children:e?"当前时间":"今天"}),e&&i.jsx("div",{className:"btn ok mr-0 text-white bg-[#0265ff] rounded-[4px] h-[24px] leading-[24px] mt-[8px] float-right cursor-pointer px-[5px] hover:opacity-80",onClick:o,children:"确定"})]})})}function j6({value:e,onChange:t,format:n="yyyy-MM-dd",minDate:r,maxDate:o,week:s,className:a}){const l=e?new Date(e):new Date,[c,u]=C.useState(l.getFullYear()),[d,f]=C.useState(l.getMonth()),[p,h]=C.useState(l.getDate()),[m,x]=C.useState(l.getHours()),[y,g]=C.useState(l.getMinutes()),[b,w]=C.useState(l.getSeconds()),[v,S]=C.useState(!1),[j,M]=C.useState(!1),[L,T]=C.useState(n.includes("HH")),_=C.useMemo(()=>r!=null?r:new Date(ul,0,1,0,0,0,0),[r]),B=C.useMemo(()=>o!=null?o:new Date(dl,11,31,23,59,59,999),[o]),R=C.useMemo(()=>s?s.map(de=>parseInt(String(de))):[],[s]),D=C.useMemo(()=>n==="yyyy-MM-dd HH:mm:ss"?{h:_.getHours(),m:_.getMinutes(),s:_.getSeconds(),ms:_.getMilliseconds()}:{h:0,m:0,s:0,ms:0},[n,_]),Z=C.useMemo(()=>n==="yyyy-MM-dd HH:mm:ss"?{h:B.getHours(),m:B.getMinutes(),s:B.getSeconds(),ms:B.getMilliseconds()}:{h:23,m:59,s:59,ms:999},[n,B]);C.useEffect(()=>{e&&(u(e.getFullYear()),f(e.getMonth()),h(e.getDate()),x(e.getHours()),g(e.getMinutes()),w(e.getSeconds()))},[e]),C.useEffect(()=>{if(!e&&Qn(new Date,_,B,R,"day")){const de=Cv(new Date,_,B);u(de.getFullYear()),f(de.getMonth()),h(de.getDate())}},[]);const O=C.useCallback((de,Fe)=>t==null?void 0:t(de,Fe),[t]),V=C.useCallback((de,Fe="day")=>Qn(de,_,B,R,Fe),[_,B,R]),$=C.useCallback(de=>{const Fe=new Date(c,d,p,m,y,b);O(V(Fe)?Fe:null,de)},[c,d,p,m,y,b,V,O]),W=C.useCallback(()=>{let de=c,Fe=d,Ye=p;d===0?(Fe=11,de=c-1):Fe=d-1;const I=y6(de,Fe);Ye>I&&(Ye=I),u(de),f(Fe),h(Ye)},[c,d,p]),K=C.useCallback(()=>{let de=c,Fe=d,Ye=p;d===11?(Fe=0,de=c+1):Fe=d+1;const I=y6(de,Fe);Ye>I&&(Ye=I),u(de),f(Fe),h(Ye)},[c,d,p]),N=C.useCallback(()=>{c>ul&&u(de=>de-1)},[c]),Y=C.useCallback(()=>{c<dl&&u(de=>de+1)},[c]),ce=C.useCallback(()=>{c>ul&&u(de=>de-20)},[c]),A=C.useCallback(()=>{c<dl&&u(de=>de+20)},[c]),ue=C.useCallback(de=>{if(u(de),M(!1),n==="yyyy-MM"&&(h(1),x(0),g(0),w(0),S(!1)),n==="yyyy"){const Fe=new Date(de,0,1,0,0,0);O(V(Fe,"year")?Fe:null,!0)}T(n.includes("HH"))},[n,V,O]),Ee=C.useCallback(de=>{if(f(de),S(!1),M(!1),n==="yyyy-MM"){h(1),x(0),g(0),w(0);const Fe=new Date(c,de,1,0,0,0);O(V(Fe,"month")?Fe:null,!0)}T(n.includes("HH"))},[n,c,V,O]),ke=C.useCallback((de,Fe,Ye,I)=>{if(!I.includes("disabled")&&(u(Ye),f(Fe),h(de),!["HH:mm:ss","yyyy-MM-dd HH:mm:ss","yyyy-MM-dd HH:mm","HH:mm"].includes(n))){const E=new Date(Ye,Fe,de,0,0,0);O(V(E)?E:null,!0)}},[n,V,O]),U=C.useCallback(()=>{const de=new Date;if(u(de.getFullYear()),f(de.getMonth()),h(de.getDate()),x(de.getHours()),g(de.getMinutes()),w(de.getSeconds()),!["HH:mm:ss","yyyy-MM-dd HH:mm:ss","yyyy-MM-dd HH:mm","HH:mm"].includes(n)){const Fe=new Date(de.getFullYear(),de.getMonth(),de.getDate(),0,0,0);O(V(Fe)?Fe:null,!0)}},[n,V,O]),te=C.useCallback(()=>$(!0),[$]),le=C.useCallback(de=>Qn(de!=null?de:new Date,_,B,R,"day")?"":"disabled",[_,B,R]),re=C.useCallback(de=>x(de),[]),Ce=C.useCallback(de=>g(de),[]),ge=C.useCallback(de=>w(de),[]),He=n.includes("yyyy"),ie=n.includes("HH"),Ve=n.includes("dd"),Ze=n==="yyyy-MM",nt=n==="yyyy",Rt=le(),bt=C.useCallback(()=>{S(!0),M(!1),T(!1)},[]),at=C.useCallback(()=>{M(!0),T(!1)},[]),jt=Ve?"min-h-[270px]":Ze?"min-h-[180px]":"min-h-[270px]";return i.jsxs("div",{className:F("relative inline-block text-sm text-[#333] bg-white rounded-[4px] leading-none border-none",n,a),children:[i.jsxs("div",{className:"flex",children:[He&&i.jsxs("div",{className:F("data-range",jt),style:{minWidth:nt?220:270},children:[!nt&&i.jsxs("div",{className:"relative",children:[i.jsxs("table",{cellSpacing:0,cellPadding:0,className:"dt p-[3px] rounded-[4px]",style:{width:Ze?"100%":270},children:[Ze&&!j&&i.jsxs(i.Fragment,{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{className:"text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px] btn prevy hover:text-[#0265ff] grid place-content-center",colSpan:1,onClick:N,children:i.jsx(Ko,{size:14,className:"inline"})}),i.jsx("td",{className:"text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px] year title font-bold",colSpan:1,children:i.jsx("span",{className:"title-year hover:text-[#0265ff] cursor-pointer",onClick:at,children:c})}),i.jsx("td",{className:"text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px] btn nexty hover:text-[#0265ff] grid place-content-center",colSpan:1,onClick:Y,children:i.jsx(Qo,{size:14,className:"inline"})})]})}),i.jsx("tbody",{children:[0,1,2].map(de=>i.jsx("tr",{children:[0,1,2].map(Fe=>{const Ye=de*3+Fe,I=V(new Date(c,Ye,1),"month"),E=d===Ye,H=!I;return i.jsx("td",{className:F("text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px] month hover:bg-[rgba(2,101,255,0.08)]",E&&"font-bold p-[1px] text-white border border-[#0265ff] bg-[#0265ff] hover:border-[#0265ff] hover:bg-[#0265ff]",H&&'text-[#999] relative pointer-events-none before:absolute before:left-0 before:right-0 before:top-[14px] before:h-[28px] before:bg-[#f3f3f3] before:opacity-60 before:content-[""]'),onClick:()=>{H||Ee(Ye)},children:fl[Ye]},Ye)})},de))})]}),Ve&&i.jsx(gv,{year:c,month:d,day:p,format:n,minDate:_,maxDate:B,week:R,onYearReduce:N,onYearAdd:Y,onMonthReduce:W,onMonthAdd:K,onMonthMenu:bt,onYearMenu:at,onChangeDay:ke})]}),Ve&&!Ze&&v&&!j&&i.jsx("div",{className:"absolute inset-0 z-[1]",children:i.jsx(bv,{year:c,month:d,showYear:j,position:"absolute",minDate:_,maxDate:B,week:R,onYearReduce:N,onYearAdd:Y,onYearMenu:at,onMountOk:Ee})}),!nt&&j&&i.jsx("div",{className:F(Ze?"relative":"absolute inset-0 z-[1]"),children:i.jsx(k6,{year:c,position:Ze?"relative":"absolute",showYearLabel:Ze,minDate:_,maxDate:B,week:R,onYearFReduce:ce,onYearFAdd:A,onSelectYear:ue})})]}),nt&&i.jsx(k6,{year:c,position:"relative",showYearLabel:!0,minDate:_,maxDate:B,week:R,onYearFReduce:ce,onYearFAdd:A,onSelectYear:ue})]}),L&&ie&&i.jsx(kv,{hours:m,minutes:y,seconds:b,year:c,month:d,day:p,format:n,minDate:_,maxDate:B,startTime:D,endTime:Z,onHoursChange:re,onMinutesChange:Ce,onSecondsChange:ge})]}),i.jsx(jv,{hasTime:ie,hasDay:Ve,todayCls:Rt,onToday:U,onOk:te})]})}const Jn=e=>{const[t,n]=C.useState(null),r=C.useCallback(o=>{if(!o){n(null);return}const s=o.getRootNode();if(s instanceof ShadowRoot){const a=s.querySelector(`[${e}]`);if(a){n(a);return}const l=document.createElement("div");l.setAttribute(e,"true"),s.appendChild(l),n(l)}else n(null)},[]);return{portalContainer:t,setTriggerRef:r}};function on({value:e,onChange:t,format:n="yyyy-MM-dd",minDate:r,maxDate:o,week:s,placeholder:a,disabled:l,className:c}){const[u,d]=C.useState(!1),f=C.useCallback((y,g)=>{t==null||t(y),g&&d(!1)},[t]),p=e?xv(e,n):"",h=a!=null?a:Sv(n),{portalContainer:m,setTriggerRef:x}=Jn("data-bs-date-input-portal");return i.jsxs(St,{open:u,onOpenChange:d,children:[i.jsx(Lt,{asChild:!0,disabled:l,children:i.jsxs("div",{className:F("flex items-center h-[34px] rounded-[4px] bg-white border border-[#e0e0e0] pl-[2px] pr-[10px] py-[2px] cursor-pointer","hover:border-[#0265FF]",u&&"border-[#0265FF]",l&&"opacity-50 cursor-not-allowed",c),ref:x,children:[i.jsx("div",{className:"flex-1 flex items-center justify-center h-[30px] px-[10px] py-[7px] rounded-[4px] min-w-0",children:i.jsx("span",{className:F("flex-1 text-[14px] leading-[normal] truncate",e?"text-[#030303]":"text-[#999999]"),children:p||h})}),i.jsx(Qs,{className:"shrink-0 size-[16px] text-[#999999]"})]})}),i.jsx(vt,{className:"w-auto p-0",align:"start",portalContainer:m,children:i.jsx(j6,{value:e,onChange:f,format:n,minDate:r,maxDate:o,week:s})})]})}function Sv(e){switch(e){case"yyyy-MM-dd":return"请选择日期";case"yyyy-MM-dd HH:mm:ss":return"请选择日期时间";case"yyyy-MM-dd HH:mm":return"请选择日期时间";case"HH:mm:ss":return"请选择时间";case"HH:mm":return"请选择时间";case"yyyy-MM":return"请选择月份";case"yyyy":return"请选择年份";default:return"请选择日期"}}const Lv=({expanded:e})=>i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:F("shrink-0",Q),style:{transform:e?"rotate(0deg)":"rotate(-90deg)"},children:i.jsx("path",{d:"M5 7L8 10L11 7",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),Mv=({open:e})=>i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:F("shrink-0",Q),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:i.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),qr={},Ev=["text","textarea","password","radio","radiogroup","combo","combocheck","checkboxgroup","address","location","button","separator","user","usergroup","dept","deptgroup","sn","formula","flowState","flowstate","subform","unknown"],Nv=["number"],Fv=["datetime"],Tv=["upload","image","linkdata","linkquery","dataload","signature"];for(const e of Ev)qr[e]={label:"文本",bgColor:"#F0F6FF",textColor:"#0265FF"};for(const e of Nv)qr[e]={label:"数字",bgColor:"#FDF4D9",textColor:"#F4B700"};for(const e of Fv)qr[e]={label:"日期",bgColor:"#EEDEFE",textColor:"#8E24F9"};for(const e of Tv)qr[e]={label:"附件",bgColor:"#DDF6DD",textColor:"#1EC31E"};function _v({style:e}){return i.jsx("span",{className:"text-[12px] rounded-[100px] h-[20px] px-[6px] flex items-center justify-center shrink-0 leading-[normal]",style:{backgroundColor:e.bgColor,color:e.textColor},children:e.label})}function pl(e,t){var n;return((n=e.widget)==null?void 0:n.widgetName)||String(t)}function S6(e,t,n){var r;return((r=t.widget)==null?void 0:r.widgetName)||`${e}-${n}`}function Dv(e,t){var o,s,a,l;const n=t.toLowerCase().trim(),r=[];for(let c=0;c<e.length;c++){const u=e[c],d=u.label,f=(o=u.widget)==null?void 0:o.items,p=f&&f.length>0&&((s=u.widget)==null?void 0:s.type)==="subform",h=pl(u,c),m=[];if(p)for(let g=0;g<f.length;g++){const b=f[g];m.push({key:S6(h,b,g),label:b.label,field:u,fieldType:(a=b.widget)==null?void 0:a.type,depth:1,children:[],isExpandable:!1})}const x=!n||d.toLowerCase().includes(n),y=m.some(g=>{var b;return(b=g==null?void 0:g.label)==null?void 0:b.toLowerCase().includes(n)});(x||y)&&r.push({key:h,label:d,field:u,fieldType:(l=u.widget)==null?void 0:l.type,depth:0,children:m,isExpandable:p})}return r}const bs=({fields:e,selectedKey:t,onSelect:n,searchPlaceholder:r="搜索",showTypeBadge:o=!1,width:s,className:a})=>{const[l,c]=C.useState(""),[u,d]=C.useState(()=>{var y,g;const x=new Set;for(let b=0;b<e.length;b++)(g=(y=e[b].widget)==null?void 0:y.items)!=null&&g.length&&x.add(pl(e[b],b));return x}),f=C.useMemo(()=>Dv(e,l),[e,l]),p=C.useCallback(x=>{d(y=>{const g=new Set(y);return g.has(x)?g.delete(x):g.add(x),g})},[]),h=C.useCallback(x=>{x.field&&n(x.field,x.key)},[n]),m=C.useCallback(x=>{const y=u.has(x.key),g=t!=null&&x.key===t,b=x.depth*22+10,w=x.fieldType&&o?qr[x.fieldType]:void 0,v=()=>{h(x)},S=j=>{j.stopPropagation(),p(x.key)};return i.jsxs("div",{children:[i.jsxs("button",{type:"button",onClick:v,className:F("flex items-center justify-between w-full h-[34px] rounded-[4px] text-left","pr-[10px]",Q,g?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]"),style:{paddingLeft:`${b}px`,paddingTop:7,paddingBottom:7},children:[i.jsxs("div",{className:"flex items-center gap-[8px] min-w-0 flex-1",children:[x.isExpandable?i.jsx("span",{onClick:S,className:"flex items-center cursor-pointer",children:i.jsx(Lv,{expanded:y})}):x.depth>0?i.jsx("span",{className:"w-[16px] h-[16px] shrink-0"}):null,i.jsx("span",{className:"text-[14px] truncate leading-[normal]",children:x.label})]}),w&&i.jsx(_v,{style:w})]}),x.isExpandable&&y&&i.jsx("div",{children:x.children.map(j=>m(j))})]},x.key)},[u,t,o,h,p]);return i.jsxs("div",{className:F("bg-white drop-shadow-[0px_0px_8px_rgba(0,0,0,0.1)] rounded-[4px] p-[4px]","flex flex-col gap-[4px]",a),style:s?{width:s}:void 0,children:[i.jsxs("div",{className:"flex items-center gap-[6px] border border-[#E0E0E0] rounded-[4px] h-[34px] px-[10px] py-[7px] shrink-0",children:[i.jsx(R1,{}),i.jsx("input",{type:"text",value:l,onChange:x=>c(x.target.value),placeholder:r,className:"flex-1 outline-none text-[14px] placeholder:text-[#999999] bg-transparent min-w-0 text-[#030303]"})]}),i.jsx("div",{className:"max-h-[400px] overflow-y-auto flex flex-col",children:f.length>0?f.map(x=>m(x)):i.jsx("div",{className:"flex items-center justify-center h-[60px] text-[12px] text-[#999999]",children:l.trim()?"未找到相关字段":"暂无字段"})})]})};function Av(e){var n;const t=new Map;for(let r=0;r<e.length;r++){const o=e[r],s=pl(o,r);t.set(s,o.label);const a=(n=o.widget)==null?void 0:n.items;if(a)for(let l=0;l<a.length;l++){const c=S6(s,a[l],l);t.set(c,a[l].label)}}return t}function Ov(e,t){var n;return t&&(n=Av(e).get(t))!=null?n:null}const hl=({fields:e,value:t,defaultValue:n,onChange:r,placeholder:o="请选择字段",searchPlaceholder:s="输入字段名称来搜索",disabled:a=!1,showTypeBadge:l=!0,className:c})=>{const[u,d]=C.useState(!1),[f,p]=C.useState(n),[h,m]=C.useState(null),[x,y]=C.useState(0),g=C.useRef(null),b=t!==void 0?t:f,w=C.useMemo(()=>Ov(e,b),[e,b]),v=C.useCallback((M,L)=>{t===void 0&&p(L),r==null||r(M,L),d(!1)},[t,r]),S=C.useCallback(M=>{a||(d(M),M&&g.current&&y(g.current.offsetWidth))},[a]),j=C.useCallback(M=>{if(g.current=M,M&&y(M.offsetWidth),!M){m(null);return}const L=M.getRootNode();if(L instanceof ShadowRoot){const T=L.querySelector("[data-bs-field-select-portal]");if(T){m(T);return}const _=document.createElement("div");_.setAttribute("data-bs-field-select-portal","true"),L.appendChild(_),m(_)}else m(null)},[]);return i.jsx("div",{className:F("relative",c),children:i.jsxs(St,{open:u,onOpenChange:S,children:[i.jsx(Lt,{asChild:!0,children:i.jsxs("button",{ref:j,type:"button",disabled:a,className:F("flex items-center justify-between w-full h-[34px]","bg-white border rounded-[4px]","px-[10px] py-[7px]","text-left cursor-pointer","hover:border-[#0265FF]",a&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",u?"border-[#0265FF]":"border-[#E0E0E0]",Q),children:[i.jsx("span",{className:F("text-[14px] leading-[normal] truncate",w?"text-[#030303]":"text-[#999999]"),children:w!=null?w:o}),i.jsx(Mv,{open:u})]})}),i.jsx(vt,{align:"start",sideOffset:4,portalContainer:h,className:"!border-0 !p-0",style:{minWidth:x||void 0},children:i.jsx(bs,{fields:e,selectedKey:b,onSelect:v,searchPlaceholder:s,showTypeBadge:l})})]})})},L6=[{value:"before",label:"之前"},{value:"after",label:"之后"},{value:"day",label:"当天"},{value:"time",label:"当时"}];function Pv(e){return e==="date"?L6.filter(t=>t.value!=="time"):L6.filter(t=>t.value!=="day")}const Iv=({value:e,onChange:t,dateFieldType:n,placeholder:r="请选择偏移类型",disabled:o=!1,className:s})=>{const a=Pv(n);return i.jsxs(B1,{value:e,onValueChange:l=>t==null?void 0:t(l),disabled:o,children:[i.jsx(L1,{className:s,children:i.jsx(z1,{placeholder:r})}),i.jsx(M1,{children:a.map(l=>i.jsx(E1,{value:l.value,children:l.label},l.value))})]})},Hv=[{value:"minute",label:"分钟"},{value:"hour",label:"小时"},{value:"day",label:"天"}],Vv=({value:e,onChange:t,placeholder:n="请选择偏移单位",disabled:r=!1,className:o})=>i.jsxs(B1,{value:e,onValueChange:s=>t==null?void 0:t(s),disabled:r,children:[i.jsx(L1,{className:o,children:i.jsx(z1,{placeholder:n})}),i.jsx(M1,{children:Hv.map(s=>i.jsx(E1,{value:s.value,children:s.label},s.value))})]}),sn=1440,M6=F("h-[34px] px-[10px] py-[7px] rounded-[4px] bg-white border border-[#e0e0e0]","text-[14px] text-[#030303] placeholder:text-[#999999]","focus:outline-none focus:border-[#0265FF]","disabled:bg-[#EFF0F6] disabled:cursor-not-allowed","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none");function Rv(e){return e==="date"?{dateFieldType:"date",offsetType:"day",offsetValue:0,offsetUnit:"minute"}:{dateFieldType:"datetime",offsetType:"time",offsetValue:0,offsetUnit:"minute"}}function E6(e,t){return t==="date"&&e==="time"?"day":t==="datetime"&&e==="day"?"time":e}function Bv(e){const t=Math.max(0,Math.floor(e))%sn,n=new Date(2024,0,1);return n.setHours(Math.floor(t/60),t%60,0,0),n}function zv(e){return e.getHours()*60+e.getMinutes()}function N6({value:e,onChange:t,dateFieldType:n,disabled:r=!1,className:o}){const s=e!==void 0,[a,l]=C.useState(()=>e!=null?e:Rv(n)),c=C.useRef(e);C.useEffect(()=>{e!==void 0&&l(e),c.current=e},[e]);const u=e!=null?e:a,d=C.useCallback(T=>{s||l(T),t==null||t(T)},[s,t]),f=E6(u.offsetType,n),p=n==="date"&&(f==="before"||f==="after"),h=n==="datetime"&&(f==="before"||f==="after"),m=n==="date",x=n==="datetime"&&(f==="before"||f==="after"),y=n==="date"?p?u.offsetValue%sn:u.offsetValue:0,g=Bv(y),b=p?Math.max(0,Math.floor(u.offsetValue/sn)):1,w=h?u.offsetValue:0,v=C.useCallback(T=>{const _=E6(T,n),B=u.offsetValue%sn;d(n==="date"?_==="day"?{dateFieldType:"date",offsetType:"day",offsetValue:B,offsetUnit:"minute"}:{dateFieldType:"date",offsetType:_,offsetValue:B,offsetUnit:"minute"}:_==="time"?{dateFieldType:"datetime",offsetType:"time",offsetValue:0,offsetUnit:"minute"}:{dateFieldType:"datetime",offsetType:_,offsetValue:u.offsetValue,offsetUnit:u.offsetUnit})},[n,u.offsetValue,u.offsetUnit,d]),S=C.useCallback(T=>{if(!T)return;const _=zv(T);if(n==="date")if(f==="day")d({dateFieldType:"date",offsetType:"day",offsetValue:_,offsetUnit:"minute"});else{const B=Math.max(0,Math.floor(u.offsetValue/sn));d({dateFieldType:"date",offsetType:f,offsetValue:B*sn+_,offsetUnit:"minute"})}},[n,f,u.offsetValue,d]),j=C.useCallback(T=>{const _=parseInt(T.target.value,10),B=isNaN(_)?0:Math.max(0,_),R=u.offsetValue%sn;d({dateFieldType:"date",offsetType:f,offsetValue:B*sn+R,offsetUnit:"minute"})},[f,u.offsetValue,d]),M=C.useCallback(T=>{const _=parseInt(T.target.value,10),B=isNaN(_)?0:Math.max(0,_);d({dateFieldType:"datetime",offsetType:f,offsetValue:B,offsetUnit:u.offsetUnit})},[f,u.offsetUnit,d]),L=C.useCallback(T=>{d({dateFieldType:"datetime",offsetType:f,offsetValue:u.offsetValue,offsetUnit:T})},[f,u.offsetValue,d]);return i.jsxs("div",{className:F("flex items-center gap-[10px]",o),children:[i.jsx(Iv,{value:f,onChange:v,dateFieldType:n,disabled:r}),p&&i.jsx("input",{type:"number",value:b,onChange:j,disabled:r,min:0,step:1,className:F(M6,"w-[60px]")}),p&&i.jsx("span",{className:"text-[14px] text-[#030303] shrink-0",children:"天"}),h&&i.jsx("input",{type:"number",value:w,onChange:M,disabled:r,min:0,step:1,className:F(M6,"w-[80px]")}),x&&i.jsx(Vv,{value:u.offsetUnit,onChange:L,disabled:r}),m&&i.jsx(on,{value:g,onChange:S,format:"HH:mm",disabled:r})]})}function Zv(e){return typeof e=="object"&&e!==null&&"formId"in e}function ml(e,t){var n,r,o,s;return{dateFieldType:"datetime",offsetType:"time",offsetValue:0,offsetUnit:"minute",...t,...e,formId:(r=(n=e.formId)!=null?n:t==null?void 0:t.formId)!=null?r:"",fieldId:(s=(o=e.fieldId)!=null?o:t==null?void 0:t.fieldId)!=null?s:""}}function Wv(e){if(typeof e=="string"||typeof e=="number"){const t=new Date(e);return isNaN(t.getTime())?void 0:t}}function $v({value:e,onChange:t,forms:n=[],fields:r=[],dateFormat:o="yyyy-MM-dd",disabled:s=!1,className:a}){const l=e==null?void 0:e.type,c=Zv(e==null?void 0:e.customTriggerTimePayload)?e.customTriggerTimePayload:void 0,u=C.useCallback(m=>{t==null||t({type:m})},[t]),d=C.useCallback(m=>{t==null||t({type:"custom",customTriggerTimePayload:m?m.toISOString():void 0})},[t]),f=C.useCallback(m=>{const x=ml({formId:m.form.id},c);t==null||t({type:"date_field",customTriggerTimePayload:x})},[t,c]),p=C.useCallback((m,x)=>{const y=ml({fieldId:x},c);t==null||t({type:"date_field",customTriggerTimePayload:y})},[t,c]),h=C.useCallback(m=>{const x=ml({dateFieldType:m.dateFieldType,offsetType:m.offsetType,offsetValue:m.offsetValue,offsetUnit:m.offsetUnit},c);t==null||t({type:"date_field",customTriggerTimePayload:x})},[t,c]);return i.jsxs("div",{className:F("flex flex-col gap-[10px]",a),children:[i.jsxs("div",{className:"flex gap-[22px] items-start w-full",children:[i.jsx(g6,{className:"flex-1 min-w-0",value:l,onChange:u,disabled:s}),l==="custom"&&i.jsx(on,{className:"flex-1 min-w-0",value:Wv(e==null?void 0:e.customTriggerTimePayload),onChange:d,format:o,disabled:s}),l==="date_field"&&i.jsx(al,{className:"flex-1 min-w-0",items:n,value:c==null?void 0:c.formId,onChange:f,disabled:s})]}),l==="date_field"&&i.jsxs("div",{className:"flex items-start gap-[10px] w-full",children:[i.jsx(hl,{className:"w-[300px]",fields:r,value:c==null?void 0:c.fieldId,onChange:p,disabled:s}),c&&i.jsx(N6,{value:{dateFieldType:c.dateFieldType,offsetType:c.offsetType,offsetValue:c.offsetValue,offsetUnit:c.offsetUnit},onChange:h,dateFieldType:c.dateFieldType,disabled:s})]})]})}const F6=[{value:"none",label:"不重复触发"},{value:"daily",label:"每天触发一次"},{value:"weekly",label:"每周触发一次"},{value:"everyTwoWeeks",label:"每两周触发一次"},{value:"monthly",label:"每月触发一次"},{value:"yearly",label:"每年触发一次"},{value:"custom",label:"自定义重复"}],T6=({value:e,onChange:t,placeholder:n="请选择重复类型",disabled:r=!1,className:o})=>i.jsxs(B1,{value:e,onValueChange:s=>t==null?void 0:t(s),disabled:r,children:[i.jsx(L1,{className:o,children:i.jsx(z1,{placeholder:n})}),i.jsx(M1,{children:F6.map(s=>i.jsx(E1,{value:s.value,children:s.label},s.value))})]}),Yr=({className:e})=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",className:e,children:i.jsx("path",{d:"M7 0C7.91925 -1.93718e-08 8.8295 0.18106 9.67878 0.532843C10.5281 0.884626 11.2997 1.40024 11.9497 2.05025C12.5998 2.70026 13.1154 3.47194 13.4672 4.32122C13.8189 5.17049 14 6.08075 14 7C14 7.91925 13.8189 8.8295 13.4672 9.67878C13.1154 10.5281 12.5998 11.2997 11.9497 11.9497C11.2997 12.5998 10.5281 13.1154 9.67878 13.4672C8.8295 13.8189 7.91925 14 7 14C3.13372 14 1.39103e-08 10.8658 0 7C0 3.13372 3.13372 1.39103e-08 7 0ZM10.1495 3.85C10.0301 3.7308 9.86825 3.66386 9.69953 3.66386C9.53081 3.66386 9.36898 3.7308 9.24956 3.85L7 6.10058L4.74993 3.85C4.6295 3.73566 4.46918 3.67288 4.30313 3.67503C4.13708 3.67718 3.97844 3.7441 3.86102 3.86153C3.7436 3.97895 3.67668 4.13759 3.67452 4.30364C3.67237 4.46968 3.73515 4.63001 3.84949 4.75044L6.10109 7L3.85 9.24956C3.73566 9.36999 3.67288 9.53031 3.67503 9.69636C3.67718 9.86241 3.7441 10.021 3.86153 10.1385C3.97895 10.2559 4.13759 10.3228 4.30364 10.325C4.46969 10.3271 4.63001 10.2643 4.75044 10.15L7 7.8984L9.24956 10.1495C9.37027 10.2621 9.52995 10.3234 9.69497 10.3205C9.85999 10.3177 10.0175 10.2509 10.1342 10.1342C10.2509 10.0175 10.3178 9.86008 10.3208 9.69507C10.3237 9.53005 10.2625 9.37033 10.15 9.24956L7.8984 7L10.1495 4.74993C10.2688 4.63049 10.3359 4.46856 10.3359 4.29971C10.3359 4.13086 10.2688 3.96892 10.1495 3.84949V3.85Z",fill:"#666666"})}),er=[{value:"mon",label:"星期一"},{value:"tue",label:"星期二"},{value:"wed",label:"星期三"},{value:"thu",label:"星期四"},{value:"fri",label:"星期五"},{value:"sat",label:"星期六"},{value:"sun",label:"星期日"}],Uv=()=>i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:i.jsx("path",{d:"M3 3L9 9M9 3L3 9",stroke:"#999999",strokeWidth:"1.2",strokeLinecap:"round"})}),_6=({open:e})=>i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:F("shrink-0",Q),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:i.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),D6=({value:e=[],onChange:t,placeholder:n="请选择工作日",disabled:r=!1,className:o})=>{const[s,a]=C.useState(!1),[l,c]=C.useState(!1),u=e.length===er.length,d=e.length>0&&e.length<er.length,{portalContainer:f,setTriggerRef:p}=Jn("data-bs-weekdays-select-portal"),h=C.useCallback(v=>{const S=e.includes(v)?e.filter(j=>j!==v):[...e,v];t==null||t(S)},[e,t]),m=C.useCallback(()=>{u?t==null||t([]):t==null||t(er.map(v=>v.value))},[u,t]),x=C.useCallback(v=>{v.stopPropagation(),t==null||t([])},[t]),y=C.useCallback((v,S)=>{S.stopPropagation(),t==null||t(e.filter(j=>j!==v))},[e,t]),g=C.useCallback(v=>{r||a(v)},[r]),b=e.length>0,w=b&&l;return i.jsx("div",{className:F("relative",o),children:i.jsxs(St,{open:s,onOpenChange:g,children:[i.jsx(Lt,{asChild:!0,children:i.jsx("button",{type:"button",disabled:r,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),ref:p,className:F("flex items-center justify-between w-full h-[34px] gap-2.5","bg-white border border-[#E0E0E0] rounded-[4px]","py-[7px]",b?"pl-[4px] pr-[10px]":"px-[10px]","text-left cursor-pointer","hover:border-[#0265FF]",r&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",s&&"border-[#0265FF]",Q),children:b?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex items-center gap-[4px] min-w-0 flex-1 overflow-x-auto scrollbar-hide",children:e.map(v=>{const S=er.find(j=>j.value===v);return i.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0",children:[i.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:S==null?void 0:S.label}),i.jsx("span",{className:"cursor-pointer flex items-center shrink-0",onClick:j=>y(v,j),children:i.jsx(Uv,{})})]},v)})}),w?i.jsx("span",{className:"cursor-pointer flex items-center shrink-0",onClick:x,children:i.jsx(Yr,{})}):i.jsx(_6,{open:s})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-[14px] text-[#999999] leading-[normal] truncate",children:n}),i.jsx(_6,{open:s})]})})}),i.jsx(vt,{align:"start",sideOffset:4,className:"!border-0 rounded-[8px] shadow-[0px_6px_16px_rgba(0,0,0,0.06)] p-[4px]",portalContainer:f,children:i.jsxs("div",{className:"flex flex-col",children:[i.jsxs("button",{type:"button",onClick:m,className:F("flex items-center gap-[6px] h-[34px] px-[10px] py-[7px] rounded-[4px] text-left","hover:bg-[#EFF0F6]",Q),children:[i.jsx(_1,{checked:u,intermediate:d,onCheckedChange:m,className:"shrink-0"}),i.jsx("span",{className:"text-[14px] font-bold text-[#0265FF] leading-[normal]",children:"全选"})]}),er.map(v=>{const S=e.includes(v.value);return i.jsxs("button",{type:"button",onClick:()=>h(v.value),className:F("flex items-center gap-[6px] h-[34px] px-[10px] py-[7px] rounded-[4px] text-left","hover:bg-[#EFF0F6]",Q),children:[i.jsx(_1,{checked:S,onCheckedChange:()=>h(v.value),className:"shrink-0"}),i.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:v.label})]},v.value)})]})})]})})},qv=Ew,A6=k.forwardRef(({className:e,...t},n)=>i.jsx(i6,{ref:n,className:F("inline-flex items-center w-full gap-[2px] p-[2px] bg-[#EFF0F6] rounded-[4px]",e),...t}));A6.displayName=i6.displayName;const Cl=k.forwardRef(({className:e,...t},n)=>i.jsx(a6,{ref:n,className:F("inline-flex items-center justify-center w-full h-[30px]","px-[10px] py-[7px] rounded-[4px]","text-[14px] text-[#121111] leading-normal","bg-transparent border border-solid border-[#EFF0F6]","transition-all duration-200 ease-out","outline-none cursor-pointer","hover:text-[#121111] hover:border-[#E0E0E0] hover:bg-white","data-[state=active]:text-[#0265FF] data-[state=active]:border-[#E0E0E0] data-[state=active]:bg-white","focus-visible:ring-2 focus-visible:ring-[#0265FF] focus-visible:ring-offset-1",e),...t}));Cl.displayName=a6.displayName;const xl=k.forwardRef(({className:e,...t},n)=>i.jsx(l6,{ref:n,className:F("mt-2 outline-none","data-[state=inactive]:hidden",e),...t}));xl.displayName=l6.displayName;const ws=[{value:1,label:"1"},{value:2,label:"2"},{value:3,label:"3"},{value:4,label:"4"},{value:5,label:"5"},{value:6,label:"6"},{value:7,label:"7"},{value:8,label:"8"},{value:9,label:"9"},{value:10,label:"10"},{value:11,label:"11"},{value:12,label:"12"},{value:13,label:"13"},{value:14,label:"14"},{value:15,label:"15"},{value:16,label:"16"},{value:17,label:"17"},{value:18,label:"18"},{value:19,label:"19"},{value:20,label:"20"},{value:21,label:"21"},{value:22,label:"22"},{value:23,label:"23"},{value:24,label:"24"},{value:25,label:"25"},{value:26,label:"26"},{value:27,label:"27"},{value:28,label:"28"},{value:29,label:"29"},{value:30,label:"30"},{value:31,label:"31"}],Yv={label:"最后一个自然日"},O6=7,Gv=()=>i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:i.jsx("path",{d:"M3 3L9 9M9 3L3 9",stroke:"#999999",strokeWidth:"1.2",strokeLinecap:"round"})}),P6=({open:e})=>i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:F("shrink-0",Q),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:i.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),I6=({value:e=[],onChange:t,placeholder:n="请选择日期",disabled:r=!1,className:o})=>{const[s,a]=C.useState(!1),[l,c]=C.useState(!1),[u,d]=C.useState(e),{portalContainer:f,setTriggerRef:p}=Jn("data-bs-weekdays-select-portal"),h=s?u:e,m=C.useMemo(()=>h.filter(D=>D!=="last"),[h]),x=C.useMemo(()=>h.includes("last"),[h]),y=m.length===31,g=C.useCallback(D=>{d(Z=>Z.includes(D)?Z.filter(O=>O!==D):[...Z,D])},[]),b=C.useCallback(()=>{d(D=>{if(D.filter($=>$!=="last").length===31)return D.filter($=>$==="last");const O=ws.map($=>$.value),V=D.includes("last")?["last"]:[];return[...O,...V]})},[]),w=C.useCallback(()=>{const D=new Date().getDate();d(Z=>Z.includes(D)?Z:[...Z,D])},[]),v=C.useCallback(()=>{d(D=>D.includes("last")?D.filter(Z=>Z!=="last"):[...D,"last"])},[]),S=C.useCallback(()=>{t==null||t(u),a(!1)},[u,t]),j=C.useCallback(D=>{r||(D&&d([...e]),a(D))},[r,e]),M=C.useCallback(D=>{D.stopPropagation(),t==null||t([])},[t]),L=C.useCallback((D,Z)=>{Z.stopPropagation(),t==null||t(e.filter(O=>O!==D))},[e,t]),T=e.length>0,_=T&&l,B=C.useCallback(D=>D==="last"?"最后一天":`${D}日`,[]),R=C.useMemo(()=>{const D=[];for(let Z=0;Z<ws.length;Z+=O6)D.push(ws.slice(Z,Z+O6));return D},[]);return i.jsx("div",{className:F("relative",o),children:i.jsxs(St,{open:s,onOpenChange:j,children:[i.jsx(Lt,{asChild:!0,children:i.jsx("button",{type:"button",ref:p,disabled:r,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),className:F("flex items-center justify-between w-full h-[34px] gap-2.5","bg-white border border-[#E0E0E0] rounded-[4px]","py-[7px]",T?"pl-[4px] pr-[10px]":"px-[10px]","text-left cursor-pointer","hover:border-[#0265FF]",r&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",s&&"border-[#0265FF]",Q),children:T?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex items-center gap-[4px] min-w-0 flex-1 overflow-x-auto scrollbar-hide",children:e.map(D=>i.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0",children:[i.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:B(D)}),i.jsx("span",{className:"cursor-pointer flex items-center shrink-0",onClick:Z=>L(D,Z),children:i.jsx(Gv,{})})]},D))}),_?i.jsx("span",{className:"cursor-pointer flex items-center shrink-0",onClick:M,children:i.jsx(Yr,{})}):i.jsx(P6,{open:s})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-[14px] text-[#999999] leading-[normal] truncate",children:n}),i.jsx(P6,{open:s})]})})}),i.jsx(vt,{align:"start",sideOffset:4,portalContainer:f,className:"!border-0 rounded-[8px] shadow-[0px_6px_16px_rgba(0,0,0,0.06)] p-0",style:{width:"310px"},children:i.jsxs(qv,{defaultValue:"specific",children:[i.jsx("div",{className:"px-[4px] pt-[4px] flex justify-center",children:i.jsxs(A6,{children:[i.jsx(Cl,{value:"specific",children:"指定日期"}),i.jsx(Cl,{value:"relative",children:"相对日期"})]})}),i.jsxs(xl,{value:"specific",className:"mt-0",children:[i.jsxs("div",{className:"px-[8px] pt-[8px] pb-[4px]",children:[i.jsxs("button",{type:"button",onClick:b,className:F("flex items-center gap-[6px] w-full h-[34px] px-[10px] py-[7px] rounded-[4px] text-left mb-[4px]","hover:bg-[#EFF0F6]",Q),children:[i.jsx(_1,{checked:y,intermediate:m.length>0&&!y,onCheckedChange:b,className:"shrink-0"}),i.jsx("span",{className:"text-[14px] font-bold text-[#0265FF] leading-[normal]",children:"全选"})]}),i.jsx("div",{className:"flex flex-col gap-[2px]",children:R.map((D,Z)=>i.jsx("div",{className:"flex gap-[4px]",children:D.map(O=>{const V=m.includes(O.value);return i.jsx("button",{type:"button",onClick:()=>g(O.value),className:F("flex items-center justify-center w-[36px] h-[30px] rounded-[4px]","text-[14px] leading-[normal]","transition-all duration-200 ease-out",V?"bg-[#0265FF] text-white":"text-[#030303] hover:bg-[#EFF0F6]"),children:O.label},O.value)})},Z))})]}),i.jsxs("div",{className:"flex items-center justify-between px-[12px] py-[8px] border-t border-[#E0E0E0] mt-[4px]",children:[i.jsx("button",{type:"button",onClick:w,className:F("h-[28px] px-[12px] rounded-[4px] text-[14px]","text-[#0265FF] hover:bg-[#EFF0F6]",Q),children:"今天"}),i.jsx("button",{type:"button",onClick:S,className:F("h-[28px] px-[16px] rounded-[4px] text-[14px]","bg-[#0265FF] text-white hover:bg-[#0255DD]",Q),children:"确认"})]})]}),i.jsxs(xl,{value:"relative",className:"mt-0",children:[i.jsx("div",{className:"px-[8px] pt-[8px] pb-[4px]",children:i.jsxs("button",{type:"button",onClick:v,className:F("flex items-center gap-[6px] w-full h-[34px] px-[10px] py-[7px] rounded-[4px] text-left","hover:bg-[#EFF0F6]",Q),children:[i.jsx(_1,{checked:x,onCheckedChange:v,className:"shrink-0"}),i.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:Yv.label})]})}),i.jsx("div",{className:"flex items-center justify-center px-[12px] py-[8px] border-t border-[#E0E0E0] mt-[4px]",children:i.jsx("button",{type:"button",onClick:S,className:F("h-[28px] px-[16px] rounded-[4px] text-[14px]","bg-[#0265FF] text-white hover:bg-[#0255DD]",Q),children:"确认"})})]})]})})]})})},H6=[{value:"week",label:"按周重复"},{value:"month",label:"按月重复"}],V6=({value:e,onChange:t,placeholder:n="请选择重复方式",disabled:r=!1,className:o})=>i.jsxs(B1,{value:e,onValueChange:s=>t==null?void 0:t(s),disabled:r,children:[i.jsx(L1,{className:o,children:i.jsx(z1,{placeholder:n})}),i.jsx(M1,{children:H6.map(s=>i.jsx(E1,{value:s.value,children:s.label},s.value))})]}),Xv=F("h-[34px] px-[10px] py-[7px] rounded-[4px] bg-white border border-[#e0e0e0]","text-[14px] text-[#030303] placeholder:text-[#999999]","focus:outline-none focus:border-[#0265FF]","disabled:bg-[#EFF0F6] disabled:cursor-not-allowed","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none","w-[60px]");function Kv(){return{repeatBy:"week",interval:1,repeatDetailDates:[]}}function Qv({value:e,onChange:t,disabled:n=!1,className:r}){var m,x,y;const o=e==null?void 0:e.type,s=e==null?void 0:e.customRepeatPreference,a=s==null?void 0:s.repeatBy,l=C.useCallback(g=>{g==="custom"?t==null||t({type:"custom",customRepeatPreference:s!=null?s:Kv()}):t==null||t({type:g})},[t,s]),c=C.useCallback(g=>{s&&(t==null||t({type:"custom",customRepeatPreference:{...s,repeatBy:g,repeatDetailDates:[]}}))},[t,s]),u=C.useCallback(g=>{if(!s)return;const b=parseInt(g.target.value,10),w=isNaN(b)?1:Math.max(1,b);t==null||t({type:"custom",customRepeatPreference:{...s,interval:w}})},[t,s]),d=C.useCallback(g=>{s&&(t==null||t({type:"custom",customRepeatPreference:{...s,repeatDetailDates:g}}))},[t,s]),f=C.useCallback(g=>{s&&(t==null||t({type:"custom",customRepeatPreference:{...s,repeatDetailDates:g}}))},[t,s]),p=(m=s==null?void 0:s.repeatDetailDates)!=null?m:[],h=(x=s==null?void 0:s.repeatDetailDates)!=null?x:[];return i.jsxs("div",{className:F("flex flex-col gap-[10px]",r),children:[i.jsx(T6,{value:o,onChange:l,disabled:n}),o==="custom"&&i.jsxs("div",{className:"flex items-start gap-[10px] w-full",children:[i.jsx(V6,{className:"w-[200px] shrink-0",value:a,onChange:c,disabled:n}),i.jsx("span",{className:"text-[14px] text-[#030303] leading-[34px] shrink-0",children:"每"}),i.jsx("input",{type:"number",value:(y=s==null?void 0:s.interval)!=null?y:1,onChange:u,disabled:n,min:1,step:1,className:Xv}),i.jsx("span",{className:"text-[14px] text-[#030303] leading-[34px] shrink-0",children:a==="month"?"月":"周"}),a==="week"&&i.jsx(D6,{className:"flex-1 min-w-0",value:p,onChange:d,disabled:n}),a==="month"&&i.jsx(I6,{className:"flex-1 min-w-0",value:h,onChange:f,disabled:n})]})]})}const R6=({flipped:e})=>i.jsx("svg",{width:"40",height:"4",viewBox:"0 0 40 4",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",flexShrink:0},children:e?i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"2",cy:"2",r:"2",fill:"#D9D9D9"}),i.jsx("path",{d:"M10 2H40",stroke:"#E0E0E0"})]}):i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M0 2H30",stroke:"#E0E0E0"}),i.jsx("circle",{cx:"38",cy:"2",r:"2",fill:"#D9D9D9"})]})}),Jv=({children:e,className:t})=>i.jsxs("div",{className:F("flex items-center justify-center gap-[10px]",t),children:[i.jsx(R6,{}),e!=null&&i.jsx("span",{className:"text-[#999] text-[14px] whitespace-nowrap leading-[normal] shrink-0",children:e}),i.jsx(R6,{flipped:!0})]}),B6=[{value:"eq",label:Pt.eq},{value:"neq",label:Pt.neq},{value:"gt",label:Pt.gt},{value:"lt",label:Pt.lt},{value:"gte",label:Pt.gte},{value:"lte",label:Pt.lte},{value:"contains",label:Pt.contains},{value:"not_contains",label:Pt.not_contains},{value:"in",label:Pt.in},{value:"nin",label:Pt.nin},{value:"all",label:Pt.all},{value:"empty",label:Pt.empty},{value:"not_empty",label:Pt.not_empty},{value:"range",label:Pt.range}],z6=({value:e,defaultValue:t="eq",onChange:n,operators:r,borderless:o=!1,disabled:s=!1,className:a})=>{var b,w;const[l,c]=C.useState(!1),[u,d]=C.useState(t),[f,p]=C.useState(null),h=C.useMemo(()=>{if(!r||r.length===0)return B6;const v=new Set(r);return B6.filter(S=>v.has(S.value))},[r]),m=(()=>{const v=e!==void 0?e:u;return h.length>0&&!h.find(S=>S.value===v)?h[0].value:v})(),x=(w=(b=h.find(v=>v.value===m))==null?void 0:b.label)!=null?w:"",y=C.useCallback(v=>{e===void 0&&d(v),n==null||n(v),c(!1)},[e,n]),g=C.useCallback(v=>{if(!v){p(null);return}const S=v.getRootNode();if(S instanceof ShadowRoot){const j=S.querySelector("[data-bs-relational-operator-select-portal]");if(j){p(j);return}const M=document.createElement("div");M.setAttribute("data-bs-relational-operator-select-portal","true"),S.appendChild(M),p(M)}else p(null)},[]);return i.jsx("div",{className:F("relative inline-flex",a),children:i.jsxs(St,{open:l,onOpenChange:c,children:[i.jsx(Lt,{asChild:!0,children:i.jsxs("button",{ref:g,type:"button",disabled:s,className:F("flex items-center justify-between gap-[10px]","min-w-[82px] px-[10px] w-full","text-left cursor-pointer",o?"h-[34px] bg-transparent":F("h-[31px] bg-white border rounded-[4px]",l?"border-[#0265FF]":"border-[#E0E0E0] hover:border-[#0265FF]"),s&&"opacity-50 cursor-not-allowed",!s&&!o&&"hover:border-[#0265FF]",Q),children:[i.jsx("span",{className:"text-[14px] leading-[normal] text-[#030303] truncate",children:x}),i.jsx("span",{className:F("shrink-0 flex items-center justify-center w-[16px] h-[16px] text-[#666666]",Q,l&&"rotate-180"),children:i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:i.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}),i.jsx(vt,{align:"start",sideOffset:4,portalContainer:f,className:"!border-0 rounded-[10px] shadow-[0px_0px_5px_rgba(0,0,0,0.04)] p-[4px] min-w-[82px]",children:i.jsx("div",{className:"flex flex-col gap-0 max-h-[320px] overflow-y-auto",children:h.map(v=>i.jsx("button",{type:"button",onClick:()=>y(v.value),className:F("h-[34px] px-[10px] rounded-[4px] text-left text-[14px] leading-[normal] whitespace-nowrap shrink-0",m===v.value?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]",Q),children:v.label},v.value))})})]})})},ek=({avatar:e,width:t,onDockClick:n,onCloseClick:r,draggable:o,isDragging:s,isDocked:a,onDragStart:l})=>i.jsxs("div",{className:F("flex items-center justify-between","px-4","h-[52px] min-w-[200px]",{"w-full":!t,[`w-[${t}px]`]:t,"cursor-grab":o&&!s,"cursor-grabbing":s}),style:{backgroundImage:K2,backgroundSize:"cover",backgroundRepeat:"no-repeat"},onMouseDown:o?l:void 0,children:[e,i.jsxs("div",{className:"actions flex items-center gap-2.5 text-[#666]",children:[i.jsx(Jt,{onMouseDown:c=>{c.stopPropagation()},tooltip:a?"悬浮":"右侧打开",icon:a?i.jsx(u3,{}):i.jsx(c3,{}),onClick:n}),i.jsx(Jt,{icon:i.jsx(Qi,{}),onClick:r})]})]}),Z6=({defaultChecked:e=!1,checked:t,onCheckedChange:n,children:r,disabled:o=!1,className:s})=>{const[a,l]=C.useState(e),c=t!==void 0,u=c?t:a,d=()=>{if(o)return;const f=!u;c||l(f),n==null||n(f)};return i.jsxs("button",{type:"button",role:"checkbox","aria-checked":u,disabled:o,onClick:d,className:F("inline-flex items-center gap-[6px] cursor-pointer select-none","text-[#121111] text-[14px]",o&&"cursor-not-allowed opacity-50",s),children:[i.jsx("span",{className:F("inline-flex items-center justify-center w-4 h-4 rounded-full transition-colors duration-200 box-border border",u?"bg-[#2E60FF] border-transparent":"bg-white border-[#e0e0e0]"),children:u&&i.jsx("span",{className:"text-white",children:i.jsx(na,{})})}),r&&i.jsx("span",{className:"text-sm",children:r})]})},tk=({defaultChecked:e=!1,checked:t,onCheckedChange:n,title:r,description:o,disabled:s=!1,className:a})=>{const[l,c]=C.useState(e),u=t!==void 0,d=u?t:l,f=()=>{if(s)return;const p=!d;u||c(p),n==null||n(p)};return i.jsxs("button",{type:"button",role:"checkbox","aria-checked":d,disabled:s,onClick:f,className:F("flex flex-col gap-[6px] p-[10px] rounded-[4px] cursor-pointer select-none","border border-[#e0e0e0]",s&&"cursor-not-allowed opacity-50",a),children:[i.jsxs("div",{className:"inline-flex items-center gap-[6px]",children:[i.jsx(Z6,{checked:d,onCheckedChange:p=>{d||f()},disabled:s}),i.jsx("span",{className:"text-[#030303] text-[14px]",children:r})]}),i.jsx("p",{className:"text-[#666] text-[12px] pl-[22px]",children:o})]})},gl=({title:e,content:t,icon:n,disableExpand:r,children:o,defaultOpen:s})=>{const[a,l]=C.useState(s);return i.jsxs("div",{className:"bg-[#fafafa] border border-[#e0e0e0] border-solid flex flex-col gap-2.5 p-2.5 rounded-lg w-full",children:[i.jsxs("div",{className:F("flex items-center justify-between w-full",{"cursor-pointer":!r}),onClick:()=>{r||l(!a)},children:[i.jsxs("div",{className:"flex gap-2.5 items-center",children:[i.jsx("div",{className:"w-4 h-4 shrink-0 flex items-center",children:n||i.jsx(f3,{})}),i.jsx("p",{className:"text-[#666] text-[14px] leading-normal",children:e})]}),i.jsx("button",{onClick:()=>{r||l(!a)},className:F("flex items-center justify-center w-5 h-5 rounded-[4px] cursor-pointer hover:bg-[#EFF0F6]",Q,{"pointer-events-none opacity-0":r}),children:i.jsx(Go,{isOpen:a})})]}),a&&!r&&i.jsx("div",{className:"text-[#121111] text-[14px] word-wrap",children:t||o})]})};function W6({open:e,onOpenChange:t,title:n,description:r,linkText:o="留在此页",onLinkClick:s,cancelText:a="不保存",onCancel:l,confirmText:c="保存并继续",onConfirm:u,container:d,showLink:f=!0,showCancel:p=!0}){const h={borderRadius:4,padding:"6px 20px"};return i.jsx(Q4,{open:e,onOpenChange:t,children:i.jsxs(yi,{container:d,className:F("w-[480px] max-w-[480px] p-0 gap-0 rounded-[10px] border-none","shadow-[0px_0px_10px_0px_rgba(0,0,0,0.04)]","[&>button]:hidden"),children:[i.jsxs(bi,{className:"flex flex-row items-start gap-[10px] p-9 pb-0",children:[i.jsx("div",{className:"size-[30px] shrink-0 text-[#0265FF]",children:i.jsx(C3,{})}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx(vi,{className:"text-[16px] font-[700] text-[#030303] leading-normal",children:n}),r&&i.jsx(ki,{className:"text-[14px] text-[#666] leading-normal",children:r})]})]}),i.jsxs(wi,{className:"flex flex-row items-center !justify-between p-9 pt-6",children:[f?i.jsx("button",{type:"button",className:"text-[14px] text-[#0265ff] hover:text-[#0265ff]/80 bg-transparent border-none cursor-pointer",onClick:s||(()=>{console.log("Link clicked"),t==null||t(!1)}),children:o}):i.jsx("div",{}),i.jsxs("div",{className:"flex items-center gap-3",children:[p&&i.jsx(us,{className:"hover:text-[#121111]",onClick:l,children:a}),i.jsx("button",{type:"button",onClick:u,style:h,className:F("text-[14px] text-white bg-[#0265ff]","hover:bg-[#0265ff]/80 cursor-pointer border-none"),children:c})]})]})]})})}function nk(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r.isSubForm){const o=[];let s=n+1;for(;s<e.length&&e[s].isFieldInSubForm&&e[s].parentFormName===r.fieldName;)o.push(e[s]),s++;t.push({kind:"subform",parent:r,children:o}),n=s}else t.push({kind:"field",field:r}),n++}return t}const t1="flex items-center px-1.5 py-2.5 text-xs leading-normal";function $6({field:e,isSubFormChild:t=!1}){return i.jsxs("div",{className:"flex items-center w-full",children:[i.jsxs("div",{className:F(t1,"w-20 shrink-0 min-h-[34px]"),children:[t&&i.jsx("span",{className:"inline-flex items-center justify-center shrink-0 w-5 h-5 opacity-0",children:i.jsx(Go,{})}),i.jsx("span",{children:e.fieldName})]}),i.jsx("div",{className:F(t1,"w-[72px] shrink-0 min-h-[34px]"),children:e.type}),i.jsx("div",{className:F(t1,"w-9 shrink-0 min-h-[34px]"),children:e.required?"是":"否"}),i.jsx("div",{className:F(t1,"flex-1 min-w-0 min-h-[34px]"),children:i.jsx("span",{className:"break-words min-w-0",children:e.description})})]})}function rk({parent:e,children:t}){const[n,r]=C.useState(!0),o=C.useCallback(()=>r(s=>!s),[]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center w-full",children:[i.jsxs("div",{className:F(t1,"w-20 shrink-0 min-h-[34px]"),children:[i.jsx("button",{type:"button",onClick:o,className:"inline-flex items-center justify-center shrink-0 w-5 h-5 rounded cursor-pointer text-[#666] relative -left-[2px]",children:i.jsx(Go,{isOpen:n})}),i.jsx("span",{children:e.fieldName})]}),i.jsx("div",{className:F(t1,"w-[72px] shrink-0 min-h-[34px] "),children:e.type}),i.jsx("div",{className:F(t1,"w-9 shrink-0 min-h-[34px]"),children:e.required?"是":"否"}),i.jsx("div",{className:F(t1,"flex-1 min-w-0 min-h-[34px]"),children:i.jsx("span",{className:"break-words min-w-0",children:e.description})})]}),n&&t.map((s,a)=>i.jsx($6,{field:s,isSubFormChild:!0},a))]})}function ok({fields:e}){const t=C.useMemo(()=>nk(e),[e]);return i.jsxs("div",{className:"flex flex-col items-start w-full bg-white rounded-[10px] overflow-hidden text-black my-[10px] border border-[#E0E0E0]",children:[i.jsxs("div",{className:"flex items-center w-full shrink-0 bg-[#E5E6EB] rounded-t-[10px] border-b border-[#E0E0E0]",children:[i.jsx("div",{className:F(t1,"w-20 shrink-0 h-[34px] font-bold"),children:"名称"}),i.jsx("div",{className:F(t1,"w-[72px] shrink-0 h-[34px] font-bold"),children:"类型"}),i.jsx("div",{className:F(t1,"w-9 shrink-0 h-[34px] font-bold justify-center"),children:"必填"}),i.jsx("div",{className:F(t1,"flex-1 min-w-0 h-[34px] font-bold"),children:"说明"})]}),i.jsx("div",{className:"flex flex-col items-start w-full",children:t.map((n,r)=>n.kind==="field"?i.jsx($6,{field:n.field},r):i.jsx(rk,{parent:n.parent,children:n.children},r))})]})}const sk=()=>i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex gap-[2px] flex-shrink-0 relative -left-[4px] top-[3px]",children:[i.jsx("div",{className:"w-[2px] h-[2px] rounded-full bg-[#0265FF] flex-shrink-0",style:{animation:"pulse 1.4s ease-in-out infinite",animationDelay:"0s",marginRight:"2px"}}),i.jsx("div",{className:"w-[2px] h-[2px] rounded-full bg-[#0265FF] flex-shrink-0",style:{animation:"pulse 1.4s ease-in-out infinite",animationDelay:"0.2s",marginRight:"2px"}}),i.jsx("div",{className:"w-[2px] h-[2px] rounded-full bg-[#0265FF] flex-shrink-0",style:{animation:"pulse 1.4s ease-in-out infinite",animationDelay:"0.4s"}})]}),i.jsx("style",{children:`
160
+ `).map((f,p)=>i.jsx("p",{className:"shrink-0 text-[#030303] whitespace-nowrap overflow-hidden text-ellipsis max-w-full",children:f},p))]}),d&&i.jsx(h0,{agent:d})]}),i.jsxs("div",{className:"grid-rows-[max-content] inline-grid leading-[0] place-items-start shrink-0 w-full",children:[i.jsx("div",{className:"col-1 h-0 ml-0 mt-0 row-1 w-full border-t border-[#e0e0e0]"}),i.jsxs("div",{className:"col-1 content-stretch flex h-[42px] items-center justify-between ml-0 mt-0 px-[12px] row-1 w-full",children:[i.jsx(Nw,{checked:e.enabled,onCheckedChange:o}),s&&i.jsx("button",{className:"leading-[normal] shrink-0 text-[#0265ff] text-[12px] whitespace-nowrap hover:underline",onClick:s,children:"查看执行日志"})]})]})]})},Aw=({items:e,className:t,getAgentName:n,getAgentIcon:r,onEnabledChange:o,onViewLogs:s,onEdit:a,onCopy:l,onDelete:c})=>i.jsx("div",{className:F("content-start flex flex-wrap gap-[20px] items-start",t),children:e.map(u=>i.jsx(c6,{helper:u,agentName:n==null?void 0:n(u.agentId),agentIcon:r==null?void 0:r(u.agentId),className:"w-[335px] shrink-0",onEnabledChange:o?d=>o(u.id,d):void 0,onViewLogs:s?()=>s(u.id):void 0,onEdit:a?()=>a(u.id):void 0,onCopy:l?()=>l(u.id):void 0,onDelete:c?()=>c(u.id):void 0},u.id))}),Ow=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"shrink-0",children:i.jsx("path",{d:"M8 3.333v9.334M3.333 8h9.334",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})}),Pw=({description:e,detailAddress:t,btnLabel:n="新建智能体助手",onCreateClick:r,className:o})=>i.jsxs("div",{className:F("content-stretch flex flex-col items-center justify-center py-[40px] px-[20px] w-full",o),children:[i.jsx(h3,{}),i.jsxs("div",{className:"mt-[16px] text-center text-[#999] text-[14px] leading-[normal]",children:[i.jsx("p",{className:"mb-0",children:e}),i.jsxs("p",{children:["您暂时还没有添加智能体助手。",i.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-[#0265ff] underline [text-decoration-skip-ink:none] decoration-solid",children:"了解详情"})]})]}),i.jsxs("button",{onClick:r,className:"mt-[12px] bg-[#0265ff] content-stretch flex gap-[6px] items-center pl-[16px] pr-[20px] py-[7px] rounded-[4px] cursor-pointer border-none",children:[i.jsx(Ow,{}),i.jsx("span",{className:"text-[14px] text-white whitespace-nowrap leading-[normal]",children:n})]})]}),Iw=({agent:e,className:t,onSelect:n,onLogClick:r})=>i.jsx("div",{className:F("bg-white border border-[#e0e0e0] border-solid content-stretch flex flex-col items-start p-[16px] rounded-[10px] w-full drop-shadow-[0px_0px_5px_rgba(0,0,0,0.04)] hover:drop-shadow-[0px_0px_8px_rgba(0,0,0,0.1)]",Q,t),onClick:n,children:i.jsxs("div",{className:"content-stretch flex flex-col gap-[12px] items-start w-full",children:[i.jsxs("div",{className:"content-stretch flex items-center justify-between w-full",children:[i.jsxs("div",{className:"content-stretch flex gap-[10px] items-center min-w-0",children:[i.jsx("img",{alt:e.name,className:"rounded-[10px] shrink-0 size-[40px] object-cover",src:e.icon}),i.jsx("p",{className:"font-bold leading-[normal] overflow-hidden shrink-0 text-[#030303] text-[18px] text-ellipsis whitespace-nowrap",children:e.name}),e.installCount!=null&&e.installCount>0&&i.jsx("div",{className:"bg-[#f5f7fa] content-stretch flex h-[26px] items-center justify-center px-[6px] py-[10px] rounded-[100px] shrink-0",children:i.jsxs("p",{className:"leading-[normal] shrink-0 text-[#4d609f] text-[12px] whitespace-nowrap",children:["安装次数:",e.installCount.toLocaleString()]})})]}),i.jsxs("div",{className:"content-stretch flex gap-[10px] items-center shrink-0",children:[e.version&&i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:"leading-[normal] shrink-0 text-[#999] text-[12px] whitespace-nowrap",children:["版本:",e.version]}),i.jsx("div",{className:"h-[14px] shrink-0 w-[1px] bg-[#e0e0e0]"})]}),e.lastUpdated&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"leading-[normal] shrink-0 text-[#999] text-[12px] whitespace-nowrap",children:e.lastUpdated}),i.jsx("div",{className:"h-[14px] shrink-0 w-[1px] bg-[#e0e0e0]"})]}),i.jsx("button",{className:"leading-[normal] shrink-0 text-[#0265ff] text-[14px] whitespace-nowrap hover:text-[rgba(2,101,255,0.8)] cursor-pointer bg-transparent border-none p-0",onClick:r,children:"更新日志"}),i.jsx("button",{className:"bg-[#eff0f6] content-stretch flex flex-col h-[30px] items-center justify-center px-[16px] py-[7px] rounded-[4px] shrink-0 cursor-pointer border-none hover:bg-[#f0f6ff] group/select",onClick:n,children:i.jsx("span",{className:"leading-[normal] shrink-0 text-[#030303] text-[14px] whitespace-nowrap group-hover/select:text-[#0265ff]",children:"选择"})})]})]}),e.description&&i.jsx("p",{className:"leading-[normal] shrink-0 text-[#666] text-[14px] w-full line-clamp-2",children:e.description})]})}),Hw=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:i.jsx("path",{d:"M6.5 8.5C7.05228 8.5 7.5 8.94772 7.5 9.5V14C7.5 14.5177 7.10667 14.9438 6.60254 14.9951L6.5 15H2L1.89746 14.9951C1.42703 14.9472 1.05278 14.573 1.00488 14.1025L1 14V9.5C1 8.94772 1.44772 8.5 2 8.5H6.5ZM14 8.5C14.5523 8.5 15 8.94772 15 9.5V14C15 14.5177 14.6067 14.9438 14.1025 14.9951L14 15H9.5L9.39746 14.9951C8.92703 14.9472 8.55278 14.573 8.50488 14.1025L8.5 14V9.5C8.5 8.94772 8.94772 8.5 9.5 8.5H14ZM9.5 14H14V9.5H9.5V14ZM2 14H6.5V9.5H2V14ZM6.5 1C7.05228 1 7.5 1.44772 7.5 2V6.5C7.5 7.01768 7.10667 7.44379 6.60254 7.49512L6.5 7.5H2L1.89746 7.49512C1.42703 7.44722 1.05278 7.07297 1.00488 6.60254L1 6.5V2C1 1.44772 1.44772 1 2 1H6.5ZM14 1C14.5523 1 15 1.44772 15 2V6.5C15 7.01768 14.6067 7.44379 14.1025 7.49512L14 7.5H9.5L9.39746 7.49512C8.92703 7.44722 8.55278 7.07297 8.50488 6.60254L8.5 6.5V2C8.5 1.44772 8.94772 1 9.5 1H14ZM2 6.5H6.5V2H2V6.5ZM9.5 6.5H14V2H9.5V6.5Z",fill:"#666666"})}),Vw=[{id:"all-agent",label:"全部"},{id:"system-agent",label:"系统智能体",icon:i.jsx(Hw,{})},{id:"custom-agent",label:"自定义智能体",icon:i.jsx(jr,{})}],Rw=({value:e,onChange:t,className:n})=>i.jsx("div",{className:F("flex flex-col",n),children:Vw.map(r=>{const o=e===r.id;return i.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(r.id),className:F("flex items-center gap-[6px] w-full h-[34px] px-[10px] rounded-[4px] text-left",o?"bg-[#EFF0F6]":"hover:bg-[#EFF0F6]",Q),children:[r.icon&&i.jsx("span",{className:"shrink-0 size-[16px] flex items-center justify-center text-[#666666]",children:r.icon}),i.jsx("span",{className:F("text-[14px] text-[#030303] leading-[normal] whitespace-nowrap",o?"font-bold":"font-normal"),children:r.label})]},r.id)})}),Bw=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:i.jsx("path",{d:"M13.9004 15H2.65039C2.25257 15 1.87104 14.842 1.58973 14.5607C1.30843 14.2794 1.15039 13.8978 1.15039 13.5V4.5C1.15039 4.10218 1.30843 3.72064 1.58973 3.43934C1.87104 3.15804 2.25257 3 2.65039 3H7.15039L8.65039 4.5H13.9004C14.0974 4.5 14.2924 4.5388 14.4744 4.61418C14.6564 4.68956 14.8218 4.80005 14.9611 4.93934C15.1003 5.07863 15.2108 5.24399 15.2862 5.42597C15.3616 5.60796 15.4004 5.80302 15.4004 6H2.65039V13.5L4.25539 7.5H16.0754C16.1927 7.49595 16.3093 7.51947 16.4158 7.56867C16.5223 7.61788 16.6158 7.69139 16.6888 7.78331C16.7617 7.87523 16.8121 7.98298 16.8358 8.0979C16.8595 8.21282 16.856 8.33171 16.8254 8.445L15.3704 13.875C15.2865 14.1999 15.0961 14.4873 14.8296 14.6913C14.5631 14.8952 14.2359 15.0039 13.9004 15Z",fill:"#6F81BD"})}),u6={0:"pl-[10px]",1:"pl-[32px]",2:"pl-[54px]",3:"pl-[76px]"};function d6(e){var t;return(t=u6[Math.min(e,3)])!=null?t:u6[3]}function zw(e,t){const n=t.toLowerCase().trim(),r=new Map;for(const u of e){const d=u.parent||"0";r.has(d)||r.set(d,[]),r.get(d).push(u)}const o=new Set(e.map(u=>u.id)),s=new Set(r.keys()),a=Array.from(s).filter(u=>u==="0"||!o.has(u));function l(u,d){var h,m,x,y,g;const f=r.get(u)||[],p=[];for(const b of f){const w=b.itemType==="group",v=l(b.id,d+1),S=!n||((h=b==null?void 0:b.name)==null?void 0:h.toLowerCase().includes(n));w?(S||v.length>0)&&p.push({id:b.id,name:b.name,icon:(m=b.icon)!=null?m:0,type:(x=b.type)!=null?x:"group",itemType:"group",children:v,depth:d,form:b}):S&&p.push({id:b.id,name:b.name,icon:(y=b.icon)!=null?y:0,type:(g=b.type)!=null?g:"form",itemType:"form",children:[],depth:d,form:b})}return p}const c=[];for(const u of a)c.push(...l(u,0));return c}function f6(e){const n=e>=25?"-new":"";return`node-icon icon-bsy-form${n} icon${n}-bsy-form-${e}`}function Zw({item:e,depth:t,isSelected:n,onClick:r}){return i.jsx("div",{className:F("flex items-center justify-between h-[34px] px-[10px] cursor-pointer rounded-[4px] shrink-0",d6(t),n?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]",Q),onClick:r,children:i.jsxs("span",{className:"flex items-center gap-[6px] min-w-0 flex-1",children:[i.jsx("i",{className:f6(e.icon),style:{fontSize:16,lineHeight:1}}),i.jsx("span",{className:"text-[14px] leading-[normal] truncate",children:e.name})]})})}function p6({item:e,selectedFormId:t,onSelect:n}){const[r,o]=C.useState(!0);return e.itemType==="group"?i.jsxs("div",{children:[i.jsxs("div",{className:F("flex items-center gap-[6px] h-[34px] px-[10px] cursor-pointer rounded-[4px]",d6(e.depth),"hover:bg-[#EFF0F6]",Q),onClick:()=>o(!r),children:[i.jsx("span",{className:F("shrink-0 flex items-center justify-center w-[16px] h-[16px] text-[#666666]",Q,r&&"rotate-90"),children:i.jsx(K1,{className:"-rotate-90",size:16})}),i.jsx(Bw,{}),i.jsx("span",{className:"text-[14px] text-[#030303] truncate",children:e.name})]}),r&&e.children.map(s=>i.jsx(p6,{item:s,selectedFormId:t,onSelect:n},s.id))]}):i.jsx(Zw,{item:e,depth:e.depth,isSelected:t===e.id,onClick:()=>{e.form&&n({form:e.form})}})}function Ww({searchQuery:e,onSearchChange:t,tree:n,selectedFormId:r,onSelect:o,hasSearch:s}){return i.jsxs("div",{className:F("bg-white rounded-[10px] shadow-[0px_0px_5px_rgba(0,0,0,0.04)] p-[4px]","flex flex-col gap-[4px]"),children:[i.jsxs("div",{className:"flex items-center gap-[6px] border border-[#E0E0E0] rounded-[4px] h-[30px] px-[10px] py-[5px]",children:[i.jsx(R1,{}),i.jsx("input",{type:"text",value:e,onChange:a=>t(a.target.value),placeholder:"输入表单名称来搜索",className:"flex-1 outline-none text-[14px] placeholder:text-[#999999] bg-transparent min-w-0 text-[#030303]"})]}),i.jsx("div",{className:"flex flex-col gap-0 max-h-[400px] overflow-y-auto",children:n.length>0?n.map(a=>i.jsx(p6,{item:a,selectedFormId:r,onSelect:o},a.id)):s?i.jsx("div",{className:"text-[12px] text-[#999999] py-[8px] text-center",children:"无匹配结果"}):i.jsx("div",{className:"text-[12px] text-[#999999] py-[8px] text-center",children:"暂无表单"})})]})}const al=C.forwardRef(({items:e,value:t,defaultValue:n,onChange:r,placeholder:o="请选择表单",disabled:s=!1,className:a},l)=>{var D;const[c,u]=C.useState(!1),[d,f]=C.useState(""),[p,h]=C.useState(n),m=C.useRef(null),x=C.useRef(null),[y,g]=C.useState({}),[b,w]=C.useState(null),v=t!=null?t:p,S=C.useMemo(()=>zw(e,d),[e,d]),j=C.useMemo(()=>{var Z;return v&&(Z=e.find(O=>O.id===v&&O.itemType!=="group"))!=null?Z:null},[e,v]),M=d.trim().length>0,L=C.useCallback(()=>{if(!m.current)return;const Z=m.current.getBoundingClientRect();g({position:"fixed",top:Z.bottom+4,left:Z.left,minWidth:Math.max(Z.width,240),zIndex:9999,pointerEvents:"auto"})},[]),T=C.useCallback(Z=>{if(m.current=Z,!Z){w(null);return}const O=Z.getRootNode();if(O instanceof ShadowRoot){const V=O.querySelector("[data-bs-form-select-portal]");if(V){w(V);return}const $=O.getElementById("ai-office-container")||O,W=document.createElement("div");W.setAttribute("data-bs-form-select-portal","true"),$.appendChild(W),w(W);return}w(null)},[]),_=C.useCallback(()=>{u(!1),f("")},[]),B=C.useCallback(()=>{s||(c?_():(u(!0),L()))},[s,c,_,L]),R=C.useCallback(Z=>{h(Z.form.id),r==null||r(Z),_()},[r,_]);return C.useEffect(()=>{var $;if(!c)return;const Z=($=m.current)==null?void 0:$.getRootNode(),O=Z!=null?Z:document,V=W=>{const K=W.target;x.current&&x.current.contains(K)||m.current&&m.current.contains(K)||_()};return O.addEventListener("mousedown",V),()=>{O.removeEventListener("mousedown",V)}},[c,_]),C.useEffect(()=>{if(!c)return;const Z=()=>{L()};return window.addEventListener("resize",Z),()=>window.removeEventListener("resize",Z)},[c,L]),C.useLayoutEffect(()=>{if(!c)return;let Z;const O=()=>{L(),Z=requestAnimationFrame(O)};return Z=requestAnimationFrame(O),()=>cancelAnimationFrame(Z)},[c,L]),C.useEffect(()=>{var $;if(!c)return;const Z=W=>{W.key==="Escape"&&_()},O=($=m.current)==null?void 0:$.getRootNode(),V=O!=null?O:document;return V.addEventListener("keydown",Z),()=>V.removeEventListener("keydown",Z)},[c,_]),C.useEffect(()=>{if(!c)return;const Z=x.current;if(!Z)return;const O=V=>V.stopPropagation();return Z.addEventListener("mousedown",O),Z.addEventListener("pointerdown",O),Z.addEventListener("wheel",O),()=>{Z.removeEventListener("mousedown",O),Z.removeEventListener("pointerdown",O),Z.removeEventListener("wheel",O)}},[c]),i.jsxs("div",{ref:l,className:F("relative inline-flex min-w-0 w-full",a),children:[i.jsxs("div",{ref:T,className:F("flex items-center gap-[10px] px-[10px] py-[7px] rounded-[4px] cursor-pointer select-none w-full","bg-white border",c?"border-[#0265FF]":"border-[#E0E0E0] hover:border-[#0265FF]",Q,s&&"opacity-50 cursor-not-allowed"),onClick:B,children:[i.jsx("span",{className:"flex items-center gap-[6px] min-w-0 flex-1",children:j?i.jsxs(i.Fragment,{children:[i.jsx("i",{className:f6((D=j.icon)!=null?D:0),style:{fontSize:16,lineHeight:1}}),i.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal] truncate",children:j.name})]}):i.jsx("span",{className:"text-[14px] text-[#999999] leading-[normal] truncate",children:o})}),i.jsx("span",{className:F("shrink-0 flex items-center justify-center w-[16px] h-[16px] text-[#666666]",Q,c&&"rotate-180"),children:i.jsx(K1,{size:16})})]}),c&&i1.createPortal(i.jsx("div",{ref:x,style:y,children:i.jsx(Ww,{searchQuery:d,onSearchChange:f,tree:S,selectedFormId:v,onSelect:R,hasSearch:M})}),b||document.body)]})});al.displayName="FormSelect";const $w=()=>i.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("rect",{x:"0.5",y:"0.5",width:"7",height:"7",rx:"1",fill:"#0265ff"})}),_1=k.forwardRef(({className:e,children:t,id:n,readonly:r,disabled:o,intermediate:s,...a},l)=>{const c=k.useId(),u=n!=null?n:c;return i.jsxs("label",{htmlFor:u,className:F("inline-flex items-center gap-[6px] select-none text-[#121111] text-[14px]",o?"cursor-not-allowed":"cursor-pointer",{"pointer-events-none":r}),children:[i.jsx(w0,{ref:l,id:u,disabled:o,className:F("inline-flex shrink-0 items-center justify-center","w-[16px] h-[16px] rounded-[2px] box-border border","transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#0265FF] focus-visible:ring-offset-1","border-[#E0E0E0] bg-white","hover:border-[#0265FF]","data-[state=checked]:bg-[#0265FF] data-[state=checked]:border-[#0265FF]","disabled:cursor-not-allowed disabled:bg-[#F0F0F0] disabled:border-[#C2C2C2]","disabled:data-[state=checked]:bg-[#C2C2C2] disabled:data-[state=checked]:border-[#C2C2C2]",s&&"bg-white border-[#0265FF] text-[#0265FF]",e,{"opacity-50":r}),...a,children:i.jsx(k0,{className:"text-white",forceMount:s||void 0,children:s?i.jsx($w,{}):i.jsx(na,{})})}),t!=null&&i.jsx("span",{className:F("text-sm leading-none",o&&"text-[#C2C2C2]"),children:t})]})});_1.displayName="SquareChecker";const Pt={eq:"等于",neq:"不等于",gt:"大于",lt:"小于",gte:"大于等于",lte:"小于等于",contains:"包含",not_contains:"不包含",in:"等于任意",nin:"不等于任意",all:"包含所有",empty:"为空",not_empty:"不为空",range:"范围"},Uw={text:["eq","neq","in","nin","contains","not_contains","empty","not_empty"],password:["eq","neq","contains","not_contains","empty","not_empty"],radiogroup:["eq","neq","in","nin","empty","not_empty"],radio:["eq","neq","empty","not_empty"],combo:["eq","neq","in","nin","empty","not_empty"],sn:["eq","neq","in","nin","contains","not_contains","empty","not_empty"],textarea:["contains","not_contains","empty","not_empty"],number:["eq","neq","gt","gte","lt","lte","range","empty","not_empty"],datetime:["eq","neq","gte","lte","range","empty","not_empty"],checkboxgroup:["in","all","eq","empty","not_empty"],combocheck:["in","all","eq","empty","not_empty"],user:["eq","neq","in","nin","empty","not_empty"],dept:["eq","neq","in","nin","empty","not_empty"],usergroup:["in","all","eq","empty","not_empty"],deptgroup:["in","all","eq","empty","not_empty"],address:["in","nin","empty","not_empty"],location:["in","nin","empty","not_empty"],upload:["empty","not_empty"],image:["empty","not_empty"],signature:["empty","not_empty"],flowState:["eq","neq","empty"],flowstate:["eq","neq","empty"],linkdata:["eq","neq","in","nin","empty","not_empty"],linkquery:["eq","neq","in","nin","empty","not_empty"],dataload:["eq","neq","in","nin","empty","not_empty"],formula:["eq","neq","empty","not_empty"],separator:[],button:[],subform:[],unknown:[]},qw={text:"eq",password:"eq",radiogroup:"eq",radio:"eq",combo:"eq",sn:"eq",textarea:"contains",number:"range",datetime:"range",checkboxgroup:"all",combocheck:"all",user:"eq",dept:"eq",usergroup:"all",deptgroup:"all",address:"all",location:"all",upload:"not_empty",image:"not_empty",signature:"not_empty",flowState:"eq",flowstate:"eq",linkdata:"eq",linkquery:"eq",dataload:"eq",formula:"eq"};function Yw(e){var t;return e?(t=Uw[e])!=null?t:[]:[]}function h6(e){var t;return e&&(t=qw[e])!=null?t:"eq"}function Gw(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Xw={eq:"eq",neq:"ne",gt:"gt",gte:"gte",lt:"lt",lte:"lte",contains:"like",not_contains:"unlike",in:"in",nin:"nin",all:"all",empty:"empty",not_empty:"not_empty",range:"range"},Kw={eq:"eq",ne:"neq",gt:"gt",gte:"gte",lt:"lt",lte:"lte",like:"contains",unlike:"not_contains",in:"in",nin:"nin",all:"all",empty:"empty",not_empty:"not_empty",range:"range"};function m6(e){const t=e.quantifier==="any"?"or":"and",n=e.items.map(r=>{var o,s,a,l,c,u;const d=(o=Xw[r.operator])!=null?o:"eq";let f;return r.operator==="range"&&Gw(r.value)?f=[r.value.min,r.value.max]:Array.isArray(r.value)?f=r.value:f=[r.value],{field:(l=(a=(s=r.field)==null?void 0:s.widget)==null?void 0:a.widgetName)!=null?l:"",method:d,value:f,type:(u=(c=r.field)==null?void 0:c.widget)==null?void 0:u.type}});return JSON.stringify({rel:t,cond:n})}function Qw(e){const t=JSON.parse(e),n=t.rel==="or"?"any":"all",r=t.cond.map((o,s)=>{var a,l;const c=(a=Kw[o.method])!=null?a:"eq";let u=o.value;return c==="range"?u={min:o.value[0],max:o.value[1]}:["eq","neq","contains","not_contains","gt","gte","lt","lte"].includes(c)&&(u=o.value[0]),{id:`${o.field}_${s}`,field:{label:o.field,widget:{widgetName:o.field,type:(l=o.type)!=null?l:"unknown",value:void 0}},operator:c,value:u}});return{targetName:"",quantifier:n,items:r}}const Jw={projectdevelopment:"e914",resourcelibrary:"e915",Plugin2:"e90e",Plugin:"e90f",JSON:"e910",Dropdown:"e911",Batchprocessing:"e912","Image-text":"e916",Newaddition:"e917",reportforms:"e918",AddFola:"e919",delete:"e91a",AddImage:"e91b",Send:"e91c",text:"e91d",image:"e91e",Star1:"e91f",Ellipse:"e920","Ellipse-Copy":"e921",Shape:"e922","Shape-Copy":"e923","right-line":"e924","right-arrow":"e925","double-right-arrow":"e926",ellipse:"e927",Rectangle:"e928","Rectangle-Copy":"e929","Rectangle-Copy-2":"e92a",CombinedShape:"e92b",Line:"e92c",time:"e92d",calendar:"e92e",richsinglelinetext:"e92f",singlelinetext:"e930",multilinetext:"e931",number:"e932",RichText:"e933",image1:"e934",Attachment:"e935",Phone:"e936",Email:"e937",date:"e938","Multiple-choice":"e939",Checkbox:"e93a","Drop-down":"e93b",positioning:"e93c",Description:"e93d",AutoNumber:"e93e",Address:"e93f",Staff:"e940",Department:"e941",Switch:"e942",Slider:"e943",Currentdate:"e944",Grade:"e945",Barcode:"e946",Subtable:"e947",associatedtable:"e948",Associatedapplication:"e949",Referencefield:"e94a",Uppercasing:"e94b",nodata:"e94c","X-mark":"e94d",Copy:"e94e",Correct:"e94f",Save:"e950",Printer:"e951",search:"e952",filter:"e953",Export:"e954",Import:"e955",Customprint:"e956",refresh:"e957",Helpcenter:"e958",Tutorial:"e959",Release:"e95a",more:"e95b",Setup:"e95c",sort:"e95d",Back:"e95e",show:"e95f",hide:"e960",Preview:"e961",Click:"e962",Allcheck:"e963",Cancelcheck:"e964",Likespot:"e965",Favoritespot:"e966",Followspot:"e967",Commentspot:"e968",At:"e969",Pin:"e96a",edit:"e96b",Top:"e96c",Movein:"e96d",Moveout:"e96e",Forward:"e96f",Revoke:"e970",Return:"e971",Link:"e972",Unlink:"e973",Download:"e974",Upload:"e975",Download2:"e976",Upload2:"e977",Comment:"e978",Remind:"e979",Notice:"e97a",Permission:"e97b",SMS:"e97c",QRcode:"e97d",Website:"e97e",Monitoring:"e97f",Api:"e980",Webhook:"e981",Synchronous:"e982",Automation:"e983",Trigger:"e984",Condition:"e985",Success:"e986",Failure:"e987",countdown:"e988",Waiting:"e989",Flow:"e98a",Connection:"e98b",Dashboard:"e98c",chart:"e98d",Piechart:"e98e",BarChart:"e98f",DoubleBarChart:"e991",StackedBarChart:"e992",PercentageStackedBarChart:"e993",LineChart:"e994",areachart:"e990",combinationchart:"e995",Scatterplot:"e996",FunnelChart:"e997",wordcloud:"e998",RadarChart:"e999",PivotTable:"e99a",NumberChart:"e99b",map:"e99c",Timeline:"e99d",Album:"e99e",Kanban:"e99f",Ganttchart:"e9a0",Circle:"e9a8",linesurface:"e9a1",IconStyle:"e9a2",Backgroundcolor:"e9a3",DeleteDe:"e9a4",AlignLeft:"e9a5",AlignCenter:"e9a6",AlignRight:"e9a7",Column:"e9a9",Component:"e9aa",Customcomponent:"e9ab",Title:"e9ac",RichText1:"e9ad",Carousel:"e9ae",PageTab:"e9af",Buriedpoint:"e9b0",Container:"e9b1",QuickStart:"e9b2",Group:"e9b3",Ungroup:"e9b4",Front:"e9b5",Back1:"e9b6",Lock:"e9b7",Unlock:"e9b8",Association:"e9b9",CancelAssociation:"e9ba",Quotation:"e9bb",ViewSet:"e9bc",AutoScale:"e9bd",waterfall:"e9be",watermark:"e9bf",history:"e9c0",Setting:"e9c1",Draftbox:"e9c2",SQL:"e9c3",Workflow:"e9c4",Workflow2:"e9c5",Addone:"e9c6",Formula:"e9c7",Dictionary:"e9c8",statistical:"e9c9",Recycle:"e9ca",Mistake:"e9cb",Tag:"e9cc",Pendingapproval:"e9cd",MyApplication:"e9ce",ApplicationApproval:"e9cf",Initiatedbyme:"e9d0",Copiedtome:"e9d1",Approvalnode:"e9d2",Fillnode:"e9d3",cc:"e9d4",Image1:"e9d5",Open:"e9d6",Color:"e9d7",Right:"e9d8",Backward:"e9d9",dataanalysis:"e9da",Filter2:"e9db",Freefilter:"e9dc",Conditionfilter:"e9dd",Quickfilter:"e9de",Export1:"e9df",Attachmentpreview:"e9e0",BulkEdit:"e9e1",Calculationrows:"e9e2",SingleSelect:"e9e3",dataview:"e9e4",Dataid:"e9e5",Divide:"e9e6",Progress:"e9e7",Star:"e9e8",Contacts:"e9e9",Activity:"e9ea",Minus:"e9eb",Plussign:"e9ec","Plussign-Copy":"e9ed",Increased:"e9ee",Decline:"e9ef",indeterminate:"e9f0",Decline1:"e9f1",personal:"e9f2",Warning:"e9f3",Warning2:"e9f4",Prompt:"e9f5",info:"e9f6",Cancel:"e9f7",question1:"e9f8",Question:"e9f9",exclamation:"e9fa",Warning1:"e9fb",True:"e9fc",Suspended:"e9fd",Suspended1:"e9fe",Suspended2:"e9ff",Error:"ea00",CombinedShape2:"ea01",Delete1:"ea02",Circle1:"ea03",Decline2:"ea04",Decline3:"ea05",add:"ea06",Addto:"ea07",Reduce:"ea08",Subtract:"ea09",Addition:"ea0a",Multiplication:"ea0b",Division:"ea0c",Bracket:"ea0d",Reduce1:"ea0e",Search:"ea0f",Favorites:"ea10",Annotation:"ea11",Application:"ea12",Application2:"ea13",Applicationsview:"ea14",Publish:"ea15",Deploy:"ea16",Sidetoplowerside:"ea17",Narrow:"ea18",Backtothenavigation:"ea19",Forwardtothenavigation:"ea1a",Return1:"ea1b",Transfer:"ea1c",Log:"ea1d",table:"ea1e",Form:"ea1f",Openfield:"ea20",Closefield:"ea21",Receive:"ea22",Fill:"ea23",Fill1:"ea24",fillet:"ea25",rightangle:"ea26",round:"ea27",Send1:"ea28",Map:"ea29",Upward:"ea2a",Move:"ea2b",Downward:"ea2c",drag:"ea2d",TextIcon:"ea2e",Narrow1:"ea2f",Enlarge:"ea30",Enlarge2:"ea31",Cancel1:"ea32",Retract:"ea33",Expand:"ea34",Retract1:"ea35",Expand1:"ea36",Retract2:"ea37",Expand2:"ea38",Switch1:"ea39",Fullscreen:"ea3a",Offscreen:"ea3b",Notvisible:"ea3c",Visible:"ea3d",Adjust:"ea3e",PC:"ea3f",Mobile:"ea40",Pad:"ea41",Scanthecode:"ea42",Scan:"ea43",Screenshot:"ea44",Rotation:"ea45",voice:"ea46",Video:"ea47",Location:"ea48",Clock:"ea49",Print:"ea4a",Member:"ea4b",WorkWeChat:"ea4c",DingTalk:"ea4d",EnterpriseWeChat2:"ea4e",Groupmanagement:"ea4f",Feishu:"ea50",Stationletter:"ea51",Email1:"ea52",WeChat:"ea53",ServiceAccount:"ea54",Subscribed:"ea55",Dingtalk:"ea56",Information:"ea57",Assistant:"ea58",ai:"ea59",Inquireabout:"ea5a",IFrame:"ea5b",Integratio:"ea5c",close:"ea5d",Close:"ea5e",Addgroup:"ea5f",deletegroup:"ea60",Relateddata:"ea61",Enlarge1:"ea62",Narrow2:"ea63","map-search":"ea64",Corner:"ea65",text1:"ea66",Onlinemap:"ea67",Maptile:"ea68",Dataexport:"ea69",Word:"ea6a",Excel:"ea6b",PPT:"ea6c",PDF:"ea6d",Video1:"ea6e",Audio:"ea6f",Txt:"ea70",Zip:"ea71",file:"ea72",richtext:"ea73",Onlinemap1:"ea74",Maptile1:"ea75",Ai2:"ea76",Guide:"ea77",Button:"ea78",Menus:"ea79","richtext-Copy":"ea7a","richtext-Copy-2":"ea7b","richtext-Copy-3":"ea7c","richtext-Copy-4":"ea7d",Split:"ea7e",AI:"ea7f",Form1:"ea80",Fields:"ea81",Project:"ea82",More1:"ea83",Notstarted:"ea84",Inprocess:"ea85",Completed:"ea86",Completed1:"ea87",More2:"ea88",AIoffice:"ea89",statistics:"ea8a",Expand3:"ea8b",list:"ea8c","list-Copy":"ea8d",Grid:"ea8e",Calendar:"ea8f",Schedule:"ea90",tableview:"ea91",Gallery:"ea92",Copy1:"ea93",Mailbox:"ea94",Automation1:"ea95",Avatar:"ea96"};function ev(e){const t=Jw[e];return t?`&#x${t};`:void 0}function tv(e){const n=e>=25?"-new":"";return`node-icon icon-bsy-form${n} icon${n}-bsy-form-${e}`}const nv=({name:e})=>i.jsx("div",{className:"imgbg-bsy-app imgbg-bsy-app-"+e}),ll=({code:e,name:t,className:n,style:r,color:o})=>{if(!e&&!t)return null;if(e)return i.jsx("i",{className:`sdk-icon ${n||""}`,style:{...r,color:o},dangerouslySetInnerHTML:{__html:e}});const s=e||ev((t==null?void 0:t.toString())||"");return s?i.jsx("i",{className:`sdk-icon ${n||""}`,style:{...r,color:o},dangerouslySetInnerHTML:{__html:s}}):i.jsx("i",{className:tv(t),style:{fontSize:16,lineHeight:1}})};function rv(e){return e.map(t=>({id:t._id,label:t.name,type:"group",children:t.apps.map(n=>{var r;return{id:n._id,label:n.appname,type:"app",color:String(((r=n.style)==null?void 0:r.color)||"#666666"),data:n}})}))}const C6=()=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:i.jsx("path",{d:"M13.9004 15H2.65039C2.25257 15 1.87104 14.842 1.58973 14.5607C1.30843 14.2794 1.15039 13.8978 1.15039 13.5V4.5C1.15039 4.10218 1.30843 3.72064 1.58973 3.43934C1.87104 3.15804 2.25257 3 2.65039 3H7.15039L8.65039 4.5H13.9004C14.0974 4.5 14.2924 4.5388 14.4744 4.61418C14.6564 4.68956 14.8218 4.80005 14.9611 4.93934C15.1003 5.07863 15.2108 5.24399 15.2862 5.42597C15.3616 5.60796 15.4004 5.80302 15.4004 6H2.65039V13.5L4.25539 7.5H16.0754C16.1927 7.49595 16.3093 7.51947 16.4158 7.56867C16.5223 7.61788 16.6158 7.69139 16.6888 7.78331C16.7617 7.87523 16.8121 7.98298 16.8358 8.0979C16.8595 8.21282 16.856 8.33171 16.8254 8.445L15.3704 13.875C15.2865 14.1999 15.0961 14.4873 14.8296 14.6913C14.5631 14.8952 14.2359 15.0039 13.9004 15Z",fill:"#6F81BD"})}),ov=({expanded:e})=>i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",className:F("shrink-0",Q),style:{transform:e?"rotate(0deg)":"rotate(-90deg)"},children:i.jsx("path",{d:"M6 8L9 11L12 8",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),sv=()=>i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:i.jsx("path",{d:"M3 3L9 9M9 3L3 9",stroke:"#999999",strokeWidth:"1.2",strokeLinecap:"round"})}),iv=()=>i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:[i.jsx("circle",{cx:"2",cy:"6",r:"1",fill:"#999999"}),i.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"#999999"}),i.jsx("circle",{cx:"10",cy:"6",r:"1",fill:"#999999"})]}),x6=({open:e})=>i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:F("shrink-0",Q),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:i.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),gs="__all__";function av(e){const t=new Map,n=r=>{for(const o of r)t.set(o.id,o),o.children&&n(o.children)};return n(e),t}const lv=({nodes:e,mode:t="single",popoverContentOnly:n,showAll:r=!1,value:o,defaultValue:s,onChange:a,placeholder:l="请选择",searchPlaceholder:c="输入应用名称来搜索",disabled:u=!1,maxVisibleChips:d=4,className:f})=>{const[p,h]=C.useState(!1),[m,x]=C.useState(""),[y,g]=C.useState(s!=null?s:t==="multiple"?[]:""),[b,w]=C.useState(null),[v,S]=C.useState(0),j=C.useRef(null),[M,L]=C.useState(()=>{const U=new Set,te=(le,re)=>{for(const Ce of le)Ce.children&&Ce.children.length>0&&re<2&&(U.add(Ce.id),te(Ce.children,re+1))};return te(e,0),U}),T=o!==void 0?o:y,_=C.useMemo(()=>av(e),[e]),B=C.useMemo(()=>t==="multiple"?new Set(Array.isArray(T)?T:[]):new Set(typeof T=="string"&&T?[T]:[]),[T,t]),R=C.useMemo(()=>(Array.isArray(T)?T:T?[T]:[]).map(te=>{var le,re;return(re=(le=_.get(te))==null?void 0:le.label)!=null?re:te}),[T,_]),D=t==="single"&&R.length===1?R[0]===gs?"全部应用":R[0]:null,Z=C.useMemo(()=>{if(!m.trim())return e;const U=m.toLowerCase(),te=le=>{var Ce;const re=[];for(const ge of le){const He=(Ce=ge==null?void 0:ge.label)==null?void 0:Ce.toLowerCase().includes(U),ie=ge.children?te(ge.children):[];(He||ie.length>0)&&re.push({...ge,children:ie.length>0?ie:ge.children})}return re};return te(e)},[e,m]),O=C.useCallback(U=>{if(j.current=U,U&&S(U.offsetWidth),!U){w(null);return}const te=U.getRootNode();if(te instanceof ShadowRoot){const le=te.querySelector("[data-bs-app-select-portal]");if(le){w(le);return}const re=document.createElement("div");re.setAttribute("data-bs-app-select-portal","true"),te.appendChild(re),w(re)}else w(null)},[]),V=C.useCallback(U=>{o===void 0&&g(U),a==null||a(U)},[o,a]),$=C.useCallback(U=>{L(te=>{const le=new Set(te);return le.has(U)?le.delete(U):le.add(U),le})},[]),W=C.useCallback((U,te)=>{if(te.type==="group"||te.children&&te.children.length>0){$(U);return}if(t==="single")V(U),h(!1);else{const le=Array.isArray(T)?[...T]:[],re=le.indexOf(U);re>=0?le.splice(re,1):le.push(U),V(le)}},[t,T,V,$]),K=C.useCallback((U,te)=>{te.stopPropagation(),t==="multiple"&&Array.isArray(T)&&V(T.filter(le=>le!==U))},[t,T,V]),N=C.useCallback(U=>{u||(h(U),U&&j.current&&S(j.current.offsetWidth),U||x(""))},[u]),Y=t==="multiple"?R:[],ce=Y.slice(0,d),A=Y.length-ce.length,ue=C.useCallback((U,te)=>{var He;const le=U.children&&U.children.length>0,re=M.has(U.id),Ce=B.has(U.id),ge=te*22+10;return i.jsxs("div",{children:[i.jsxs("button",{type:"button",onClick:()=>W(U.id,U),className:F("flex items-center gap-[6px] w-full h-[34px] rounded-[4px] text-left","pr-[10px]",Q,Ce?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]"),style:{paddingLeft:`${ge}px`,paddingTop:"10px",paddingBottom:"10px"},children:[le&&i.jsx(ov,{expanded:re}),U.type==="group"&&!le&&i.jsx(C6,{}),U.type==="group"&&le&&i.jsx(C6,{}),U.type==="app"&&i.jsx(nv,{name:(He=U.data)==null?void 0:He.style.icon}),i.jsx("span",{className:"text-[14px] truncate leading-[normal] flex-1 min-w-0",children:U.label}),t==="multiple"&&!le&&U.type!=="group"&&i.jsx("span",{onClick:ie=>ie.stopPropagation(),className:"grid place-items-center",children:i.jsx(_1,{checked:Ce,onCheckedChange:()=>W(U.id,U),className:"shrink-0"})})]}),le&&re&&i.jsx("div",{children:U.children.map(ie=>ue(ie,te+1))})]},U.id)},[M,B,t,W]),Ee=t==="multiple"&&Y.length>0,ke=i.jsxs("div",{className:"flex flex-col gap-[4px]",children:[i.jsxs("div",{className:"flex items-center gap-[6px] border border-[#E0E0E0] rounded-[4px] h-[30px] px-[10px] py-[5px]",children:[i.jsx(R1,{}),i.jsx("input",{type:"text",value:m,onChange:U=>x(U.target.value),placeholder:c,className:"flex-1 outline-none text-[14px] placeholder:text-[#999999] bg-transparent min-w-0 text-[#030303]"})]}),r&&t==="single"&&!m.trim()&&i.jsx("button",{type:"button",onClick:()=>{V(gs),h(!1)},className:F("flex items-center w-full h-[34px] rounded-[4px] text-left","px-[10px]",Q,B.has(gs)?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]"),children:i.jsx("span",{className:"text-[14px] leading-[normal]",children:"全部应用"})}),i.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:Z.length>0?Z.map(U=>ue(U,0)):i.jsx("div",{className:"flex items-center justify-center h-[60px] text-[12px] text-[#999999]",children:m.trim()?"未找到相关应用":"暂无应用"})})]});return n?ke:i.jsx("div",{className:F("relative",f),children:i.jsxs(St,{open:p,onOpenChange:N,children:[i.jsx(Lt,{asChild:!0,children:i.jsx("button",{ref:O,type:"button",disabled:u,className:F("flex items-center justify-between w-full h-[34px] gap-2.5","bg-white border border-[#E0E0E0] rounded-[4px]","py-[7px]",Ee?"pl-[4px] pr-[10px]":"px-[10px]","text-left cursor-pointer","hover:border-[#0265FF]",u&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",p&&"border-[#0265FF]",Q),children:Ee?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center gap-[4px] min-w-0 flex-1 overflow-x-auto scrollbar-hide",children:[ce.map((U,te)=>i.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0 max-w-[160px]",onClick:le=>{le.stopPropagation();const re=Array.isArray(T)?T:[];re[te]&&K(re[te],le)},children:[i.jsx("span",{className:"text-[14px] text-[#030303] truncate leading-[normal]",children:U}),i.jsx("span",{className:"cursor-pointer flex items-center shrink-0 hover:bg-[#EFF0F6]",children:i.jsx(sv,{})})]},te)),A>0&&i.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0",children:[i.jsxs("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:["+",A]}),i.jsx(iv,{})]})]}),i.jsx(x6,{open:p})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:F("text-[14px] leading-[normal] truncate",D?"text-[#030303]":"text-[#999999]"),children:D!=null?D:l}),i.jsx(x6,{open:p})]})})}),i.jsx(vt,{align:"start",sideOffset:4,portalContainer:b,className:"!border-0 rounded-[10px] shadow-[0px_0px_5px_rgba(0,0,0,0.04)] p-[4px]",style:{minWidth:v||void 0},children:ke})]})})},cl=({defaultChecked:e=!1,checked:t,onCheckedChange:n,title:r,description:o,disabled:s=!1,className:a})=>{const[l,c]=C.useState(!!e),u=t!==void 0,d=u?!!t:l,f=C.useRef(d);f.current=d;const p=h=>{if(h.target!==h.currentTarget||s)return;const m=!f.current;u||c(m),n==null||n(m)};return i.jsxs("div",{role:"button",tabIndex:s?-1:0,"aria-checked":d,"aria-disabled":s,onClick:p,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),p(h))},className:F("flex flex-col gap-[6px] p-[10px] rounded-[4px] cursor-pointer select-none bg-white","border",d?"border-[#0265FF]":"border-[#E0E0E0]",s&&"cursor-not-allowed opacity-50",a),children:[i.jsxs("div",{className:"inline-flex items-center gap-[6px] pointer-events-none",children:[i.jsx(_1,{checked:d,disabled:s}),i.jsx("span",{className:"text-[#121111] text-[14px]",children:r})]}),o!=null&&i.jsx("p",{className:"text-[#666] text-[12px] pl-[22px] pointer-events-none",children:o})]})},cv=[{type:"submit",title:"表单提交数据"},{type:"edit",title:"表单编辑数据"},{type:"delete",title:"表单删除数据"},{type:"init",title:"表单初始化"},{type:"edit_init",title:"表单编辑初始化"}],uv=({multiple:e=!1,value:t,onChange:n})=>{const r=e?Array.isArray(t)?t:[]:null;return i.jsx("div",{className:"flex gap-[20px]",children:cv.map(o=>{const s=e?r.includes(o.type):t===o.type;return i.jsx(cl,{className:"flex-[1_0_0] min-w-px",title:o.title,checked:s,onCheckedChange:a=>{if(e){const l=a?[...r,o.type]:r.filter(c=>c!==o.type);n==null||n(l)}else a&&(n==null||n(o.type))}},o.type)})})},dv=[{type:"flow_end",title:"流程结束"},{type:"flow_node",title:"流程节点"}],fv=({multiple:e=!1,value:t,onChange:n})=>{const r=e?Array.isArray(t)?t:[]:null;return i.jsx("div",{className:"flex gap-[20px]",children:dv.map(o=>{const s=e?r.includes(o.type):t===o.type;return i.jsx(cl,{className:"flex-[1_0_0] min-w-px max-w-[216px]",title:o.title,checked:s,onCheckedChange:a=>{if(e){const l=a?[...r,o.type]:r.filter(c=>c!==o.type);n==null||n(l)}else a&&(n==null||n(o.type))}},o.type)})})},pv=[{value:"custom",label:"自定义时间"},{value:"date_field",label:"根据表单日期时间字段"}],g6=({value:e,onChange:t,placeholder:n="请选择时间来源类型",disabled:r=!1,className:o})=>i.jsxs(B1,{value:e,onValueChange:s=>t==null?void 0:t(s),disabled:r,children:[i.jsx(L1,{className:o,children:i.jsx(z1,{placeholder:n})}),i.jsx(M1,{children:pv.map(s=>i.jsx(E1,{value:s.value,children:s.label},s.value))})]}),ul=1e3,dl=2999,fl=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],hv=["一","二","三","四","五","六","日"];function mv(e,t){const o=(new Date(e,t,1).getDay()-1+7)%7;return new Date(e,t,1-o)}function y6(e,t){return new Date(e,t+1,0).getDate()}function b6(e,t,n){const r=e.h*36e5+e.m*6e4+e.s*1e3+e.ms,o=t.h*36e5+t.m*6e4+t.s*1e3+t.ms,s=n.h*36e5+n.m*6e4+n.s*1e3+n.ms;return r>=o&&r<=s}function Qn(e,t,n,r,o="day"){if(o==="year"){const l=e.getFullYear();return l>=t.getFullYear()&&l<=n.getFullYear()}if(o==="month"){const l=e.getFullYear(),c=e.getMonth(),u=t.getFullYear(),d=t.getMonth(),f=n.getFullYear(),p=n.getMonth();return!(l<u||l>f||l===u&&c<d||l===f&&c>p)}e.setHours(0,0,0,0);const s=new Date(t);s.setHours(0,0,0,0);const a=new Date(n);return a.setHours(0,0,0,0),!(e<s||e>a||r&&r.length>0&&!r.includes(e.getDay()))}function Cv(e,t,n){const r=e.getTime(),o=t.getTime(),s=n.getTime();return r<o?new Date(t):r>s?new Date(n):new Date(e)}function w6(e,t,n){if(n==="year")return e.getFullYear()>t.getFullYear();const r=e.getFullYear(),o=e.getMonth(),s=t.getFullYear(),a=t.getMonth();return r>s||r===s&&o>a}function v6(e,t,n){if(n==="year")return e.getFullYear()<t.getFullYear();const r=e.getFullYear(),o=e.getMonth(),s=t.getFullYear(),a=t.getMonth();return r<s||r===s&&o<a}function xv(e,t){const n=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0"),s=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0");return t==="yyyy-MM-dd"?`${n}-${r}-${o}`:t==="yyyy-MM-dd HH:mm:ss"?`${n}-${r}-${o} ${s}:${a}:${l}`:t==="yyyy-MM-dd HH:mm"?`${n}-${r}-${o} ${s}:${a}`:t==="HH:mm:ss"?`${s}:${a}:${l}`:t==="HH:mm"?`${s}:${a}`:t==="yyyy-MM"?`${n}-${r}`:t==="yyyy"?`${n}`:`${n}-${r}-${o}`}const bn="text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px]",$r='text-[#999] relative pointer-events-none before:absolute before:left-0 before:right-0 before:top-1 before:h-[28px] before:bg-[#f3f3f3] before:opacity-60 before:content-[""]';function gv({year:e,month:t,day:n,format:r,minDate:o,maxDate:s,week:a,onYearReduce:l,onYearAdd:c,onMonthReduce:u,onMonthAdd:d,onMonthMenu:f,onYearMenu:p,onChangeDay:h}){const m=r.includes("dd"),x=C.useMemo(()=>{const y=mv(e,t),g=new Date,b=`${g.getFullYear()}-${g.getMonth()}-${g.getDate()}`,w=[],v=new Date(y);for(let S=0;S<6;S++){const j=[];for(let M=0;M<7;M++){const L=v.getDate(),T=v.getMonth(),_=v.getFullYear();let B=Qn(new Date(_,T,L,0,0,0,0),o,s,a,"day")?"":"disabled";B||(t!==T?B="oday":(B="day",(M===5||M===6)&&(B+=" weekend"),`${_}-${T}-${L}`===b&&(B+=" today"),n===L&&t===T&&(B+=" selected"))),j.push({day:L,month:T,year:_,css:B,key:`d${_}-${T}-${L}`}),v.setDate(v.getDate()+1)}w.push(j)}for(;w.length>4&&w[w.length-1].every(S=>S.month!==t);)w.pop();return w},[e,t,n,o,s,a]);return m?i.jsxs(i.Fragment,{children:[i.jsxs("thead",{children:[i.jsxs("tr",{children:[i.jsx("td",{className:F(bn,"btn prevm hover:text-[#0265ff]",!w6(new Date(e,t,1),o,"year")&&"disabled "+$r),colSpan:1,onClick:l,children:i.jsx(CC,{size:14})}),i.jsx("td",{className:F(bn,"btn prevm hover:text-[#0265ff]",!w6(new Date(e,t,1),o,"month")&&"disabled "+$r),colSpan:1,onClick:u,children:i.jsx(Ko,{size:14})}),i.jsxs("td",{className:F(bn,"title font-bold p-0.5"),colSpan:3,children:[i.jsx("span",{className:"title-month mr-1.5 hover:text-[#0265ff] cursor-pointer",onClick:f,children:fl[t]}),i.jsx("span",{children:", "}),i.jsx("span",{className:"title-year hover:text-[#0265ff] cursor-pointer",onClick:p,children:e})]}),i.jsx("td",{className:F(bn,"btn nextm hover:text-[#0265ff]",!v6(new Date(e,t,1),s,"month")&&"disabled "+$r),colSpan:1,onClick:d,children:i.jsx(Qo,{size:14})}),i.jsx("td",{className:F(bn,"btn nextm hover:text-[#0265ff]",!v6(new Date(e,t,1),s,"year")&&"disabled "+$r),colSpan:1,onClick:c,children:i.jsx(xC,{size:14})})]}),i.jsx("tr",{children:hv.map((y,g)=>i.jsx("td",{className:F(bn,"day name week font-bold hover:bg-transparent hover:p-0 hover:border-none",(g===5||g===6)&&"text-[#e34d59]"),children:y},y))})]}),i.jsx("tbody",{children:x.slice(0,6).map((y,g)=>i.jsx("tr",{children:y.map(b=>{const w=b.css.includes("disabled"),v=b.css.includes("oday"),S=b.css.includes("today"),j=b.css.includes("selected"),M=b.css.includes("weekend");return i.jsx("td",{className:F(bn,w&&$r,v&&"text-[#e0e0e0] hover:bg-[rgba(2,101,255,0.08)]",!w&&!v&&"hover:bg-[rgba(2,101,255,0.08)]",S&&"font-bold text-[#0265ff]",M&&"text-[#e34d59]",j&&"font-bold p-[1px] text-white border border-[#0265ff] bg-[#0265ff] hover:border-[#0265ff] hover:bg-[#0265ff]"),onClick:()=>h(b.day,b.month,b.year,b.css),children:i.jsx("div",{className:"day-wrapper",children:i.jsx("div",{className:"day-item",children:b.day})})},b.key)})},g))})]}):null}const Ur="text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px]",yv='text-[#999] relative pointer-events-none before:absolute before:left-0 before:right-0 before:top-[20px] before:h-[28px] before:bg-[#f3f3f3] before:opacity-60 before:content-[""]';function bv({year:e,month:t,showYear:n,position:r,minDate:o,maxDate:s,week:a,onYearReduce:l,onYearAdd:c,onYearMenu:u,onMountOk:d}){const f=p=>Qn(p,o,s,a,"month");return i.jsxs("table",{cellSpacing:0,cellPadding:0,className:"mt bg-white rounded-[4px]",style:{position:r},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{className:F(Ur,"btn prevy hover:text-[#0265ff]"),colSpan:1,onClick:l,children:i.jsx(Ko,{size:14})}),i.jsx("td",{className:F(Ur,"year title font-bold p-0.5"),colSpan:1,children:i.jsx("span",{className:"title-year hover:text-[#0265ff] cursor-pointer",onClick:u,children:e})}),i.jsx("td",{className:F(Ur,"btn nexty hover:text-[#0265ff]"),colSpan:1,onClick:c,children:i.jsx(Qo,{size:14})})]})}),i.jsx("tbody",{children:[0,1,2,3].map(p=>i.jsx("tr",{children:[0,1,2].map(h=>{const m=p*3+h;if(m>11)return i.jsx("td",{className:Ur},m);const x=f(new Date(e,m,1)),y=t===m&&!n,g=!x;return i.jsx("td",{className:F(Ur,"month w-[58px] h-[38px] hover:bg-[rgba(2,101,255,0.08)]",y&&"font-bold p-[1px] text-white border border-[#0265ff] bg-[#0265ff] hover:border-[#0265ff] hover:bg-[#0265ff]",g&&yv),onClick:()=>{g||d(m)},children:fl[m]},m)})},p))})]})}const ys="text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px]",wv='text-[#999] relative pointer-events-none before:absolute before:left-0 before:right-0 before:top-[14px] before:h-[28px] before:bg-[#f3f3f3] before:opacity-60 before:content-[""]';function k6({year:e,position:t,showYearLabel:n,minDate:r,maxDate:o,week:s,onYearFReduce:a,onYearFAdd:l,onSelectYear:c}){const u=e-9,d=e+10,f=C.useMemo(()=>{const p=[];for(let h=0;h<5;h++){const m=[];for(let x=0;x<4;x++){const y=u+h*4+x,g=Qn(new Date(y,0,1),r,o,s,"year");m.push({year:y,isSelected:e===y,isDisabled:!g})}p.push(m)}return p},[u,e,r,o,s]);return i.jsxs("table",{cellSpacing:0,cellPadding:0,className:"yt bg-white rounded-[4px] w-full h-full",style:{position:t},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{className:F(ys,"btn prevy hover:text-[#0265ff] grid place-content-center"),colSpan:1,onClick:a,children:i.jsx(Ko,{size:14})}),i.jsx("td",{className:F(ys,"year title font-bold p-0.5"),colSpan:2,children:n?`${u}年 - ${d}年`:`${u} - ${d}`}),i.jsx("td",{className:F(ys,"btn nexty hover:text-[#0265ff] grid place-content-center"),colSpan:1,onClick:l,children:i.jsx(Qo,{size:14})})]})}),i.jsx("tbody",{children:f.map((p,h)=>i.jsx("tr",{children:p.map(m=>i.jsx("td",{className:F(ys,"year",m.isSelected&&"font-bold p-[1px] text-white border border-[#0265ff] bg-[#0265ff] hover:border-[#0265ff] hover:bg-[#0265ff]",m.isDisabled&&wv),onClick:()=>{m.isDisabled||c(m.year)},children:m.year},m.year))},h))})]})}const vv="h-[32px] leading-[32px] text-center cursor-pointer rounded-[4px] hover:bg-[rgba(2,101,255,0.08)]";function kv({hours:e,minutes:t,seconds:n,year:r,month:o,day:s,format:a,minDate:l,maxDate:c,startTime:u,endTime:d,onHoursChange:f,onMinutesChange:p,onSecondsChange:h}){const m=a.includes("mm"),x=a.includes("ss"),y=g=>{const b=g==="hours"?24:60,w={hours:"时",minutes:"分",seconds:"秒"},v=g==="hours"?e:g==="minutes"?t:n,S=g==="hours"?f:g==="minutes"?p:h;return i.jsxs("div",{className:F("col flex-1 border-l border-[#e0e0e0]",g),children:[i.jsx("div",{className:"label h-[32px] leading-[32px] text-center",children:w[g]}),i.jsx("div",{className:"col-list h-[200px] overflow-auto",children:Array.from({length:b},(j,M)=>{const L=v===M;let T=!1;const _=l.getFullYear()===r&&l.getMonth()===o&&l.getDate()===s,B=c.getFullYear()===r&&c.getMonth()===o&&c.getDate()===s;return _&&(T=!b6({h:g==="hours"?M:e,m:g==="minutes"?M:t,s:g==="seconds"?M:n,ms:0},u,{h:23,m:59,s:59,ms:999})),B&&!T&&(T=!b6({h:g==="hours"?M:e,m:g==="minutes"?M:t,s:g==="seconds"?M:n,ms:0},{h:0,m:0,s:0,ms:0},d)),i.jsx("div",{className:F(vv,L&&!T&&"select bg-[rgba(2,101,255,0.2)]",T&&"text-[#999] pointer-events-none opacity-80"),onClick:()=>{T||S(M)},children:M>9?M:`0${M}`},M)})})]})};return i.jsxs("div",{className:"time-range w-[180px]",children:[i.jsxs("div",{className:"time-input flex h-[40px] border-l border-[#e0e0e0]",children:[i.jsx("input",{type:"number",value:e,className:"h-[24px] w-[38px] my-[10px] mx-[10px] mt-[10px] text-center pl-[5px] flex-1",onChange:g=>{const b=Math.min(23,Math.max(0,parseInt(g.target.value)||0));f(b)}}),m&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"leading-[40px]",children:":"}),i.jsx("input",{type:"number",value:t,className:"h-[24px] w-[38px] my-[10px] mx-[10px] mt-[10px] text-center pl-[5px] flex-1",onChange:g=>{const b=Math.min(59,Math.max(0,parseInt(g.target.value)||0));p(b)}})]}),x&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"leading-[40px]",children:":"}),i.jsx("input",{type:"number",value:n,className:"h-[24px] w-[38px] my-[10px] mx-[10px] mt-[10px] text-center pl-[5px] flex-1",onChange:g=>{const b=Math.min(59,Math.max(0,parseInt(g.target.value)||0));h(b)}})]})]}),i.jsxs("div",{className:"time-select-range flex border-t border-[#e0e0e0]",style:{height:"calc(100% - 40px)"},children:[y("hours"),m&&y("minutes"),x&&y("seconds")]})]})}function jv({hasTime:e,hasDay:t,todayCls:n,onToday:r,onOk:o}){return!e&&!t?null:i.jsx("div",{className:"footer h-[40px] leading-[40px] text-center border-t border-[#e0e0e0]",children:i.jsxs("div",{className:"hms px-[10px]",children:[i.jsx("div",{className:F("btn cursor-pointer px-[5px] mx-[5px]",e?"current-time float-left text-[#0265ff] ml-0 pl-0 text-center":"today float-left text-[#0265ff] ml-0 pl-0 text-center",n==="disabled"&&"text-[#999] pointer-events-none opacity-80"),onClick:r,children:e?"当前时间":"今天"}),e&&i.jsx("div",{className:"btn ok mr-0 text-white bg-[#0265ff] rounded-[4px] h-[24px] leading-[24px] mt-[8px] float-right cursor-pointer px-[5px] hover:opacity-80",onClick:o,children:"确定"})]})})}function j6({value:e,onChange:t,format:n="yyyy-MM-dd",minDate:r,maxDate:o,week:s,className:a}){const l=e?new Date(e):new Date,[c,u]=C.useState(l.getFullYear()),[d,f]=C.useState(l.getMonth()),[p,h]=C.useState(l.getDate()),[m,x]=C.useState(l.getHours()),[y,g]=C.useState(l.getMinutes()),[b,w]=C.useState(l.getSeconds()),[v,S]=C.useState(!1),[j,M]=C.useState(!1),[L,T]=C.useState(n.includes("HH")),_=C.useMemo(()=>r!=null?r:new Date(ul,0,1,0,0,0,0),[r]),B=C.useMemo(()=>o!=null?o:new Date(dl,11,31,23,59,59,999),[o]),R=C.useMemo(()=>s?s.map(de=>parseInt(String(de))):[],[s]),D=C.useMemo(()=>n==="yyyy-MM-dd HH:mm:ss"?{h:_.getHours(),m:_.getMinutes(),s:_.getSeconds(),ms:_.getMilliseconds()}:{h:0,m:0,s:0,ms:0},[n,_]),Z=C.useMemo(()=>n==="yyyy-MM-dd HH:mm:ss"?{h:B.getHours(),m:B.getMinutes(),s:B.getSeconds(),ms:B.getMilliseconds()}:{h:23,m:59,s:59,ms:999},[n,B]);C.useEffect(()=>{e&&(u(e.getFullYear()),f(e.getMonth()),h(e.getDate()),x(e.getHours()),g(e.getMinutes()),w(e.getSeconds()))},[e]),C.useEffect(()=>{if(!e&&Qn(new Date,_,B,R,"day")){const de=Cv(new Date,_,B);u(de.getFullYear()),f(de.getMonth()),h(de.getDate())}},[]);const O=C.useCallback((de,Fe)=>t==null?void 0:t(de,Fe),[t]),V=C.useCallback((de,Fe="day")=>Qn(de,_,B,R,Fe),[_,B,R]),$=C.useCallback(de=>{const Fe=new Date(c,d,p,m,y,b);O(V(Fe)?Fe:null,de)},[c,d,p,m,y,b,V,O]),W=C.useCallback(()=>{let de=c,Fe=d,Ye=p;d===0?(Fe=11,de=c-1):Fe=d-1;const I=y6(de,Fe);Ye>I&&(Ye=I),u(de),f(Fe),h(Ye)},[c,d,p]),K=C.useCallback(()=>{let de=c,Fe=d,Ye=p;d===11?(Fe=0,de=c+1):Fe=d+1;const I=y6(de,Fe);Ye>I&&(Ye=I),u(de),f(Fe),h(Ye)},[c,d,p]),N=C.useCallback(()=>{c>ul&&u(de=>de-1)},[c]),Y=C.useCallback(()=>{c<dl&&u(de=>de+1)},[c]),ce=C.useCallback(()=>{c>ul&&u(de=>de-20)},[c]),A=C.useCallback(()=>{c<dl&&u(de=>de+20)},[c]),ue=C.useCallback(de=>{if(u(de),M(!1),n==="yyyy-MM"&&(h(1),x(0),g(0),w(0),S(!1)),n==="yyyy"){const Fe=new Date(de,0,1,0,0,0);O(V(Fe,"year")?Fe:null,!0)}T(n.includes("HH"))},[n,V,O]),Ee=C.useCallback(de=>{if(f(de),S(!1),M(!1),n==="yyyy-MM"){h(1),x(0),g(0),w(0);const Fe=new Date(c,de,1,0,0,0);O(V(Fe,"month")?Fe:null,!0)}T(n.includes("HH"))},[n,c,V,O]),ke=C.useCallback((de,Fe,Ye,I)=>{if(!I.includes("disabled")&&(u(Ye),f(Fe),h(de),!["HH:mm:ss","yyyy-MM-dd HH:mm:ss","yyyy-MM-dd HH:mm","HH:mm"].includes(n))){const E=new Date(Ye,Fe,de,0,0,0);O(V(E)?E:null,!0)}},[n,V,O]),U=C.useCallback(()=>{const de=new Date;if(u(de.getFullYear()),f(de.getMonth()),h(de.getDate()),x(de.getHours()),g(de.getMinutes()),w(de.getSeconds()),!["HH:mm:ss","yyyy-MM-dd HH:mm:ss","yyyy-MM-dd HH:mm","HH:mm"].includes(n)){const Fe=new Date(de.getFullYear(),de.getMonth(),de.getDate(),0,0,0);O(V(Fe)?Fe:null,!0)}},[n,V,O]),te=C.useCallback(()=>$(!0),[$]),le=C.useCallback(de=>Qn(de!=null?de:new Date,_,B,R,"day")?"":"disabled",[_,B,R]),re=C.useCallback(de=>x(de),[]),Ce=C.useCallback(de=>g(de),[]),ge=C.useCallback(de=>w(de),[]),He=n.includes("yyyy"),ie=n.includes("HH"),Ve=n.includes("dd"),Ze=n==="yyyy-MM",nt=n==="yyyy",Rt=le(),bt=C.useCallback(()=>{S(!0),M(!1),T(!1)},[]),at=C.useCallback(()=>{M(!0),T(!1)},[]),jt=Ve?"min-h-[270px]":Ze?"min-h-[180px]":"min-h-[270px]";return i.jsxs("div",{className:F("relative inline-block text-sm text-[#333] bg-white rounded-[4px] leading-none border-none",n,a),children:[i.jsxs("div",{className:"flex",children:[He&&i.jsxs("div",{className:F("data-range",jt),style:{minWidth:nt?220:270},children:[!nt&&i.jsxs("div",{className:"relative",children:[i.jsxs("table",{cellSpacing:0,cellPadding:0,className:"dt p-[3px] rounded-[4px]",style:{width:Ze?"100%":270},children:[Ze&&!j&&i.jsxs(i.Fragment,{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{className:"text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px] btn prevy hover:text-[#0265ff] grid place-content-center",colSpan:1,onClick:N,children:i.jsx(Ko,{size:14,className:"inline"})}),i.jsx("td",{className:"text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px] year title font-bold",colSpan:1,children:i.jsx("span",{className:"title-year hover:text-[#0265ff] cursor-pointer",onClick:at,children:c})}),i.jsx("td",{className:"text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px] btn nexty hover:text-[#0265ff] grid place-content-center",colSpan:1,onClick:Y,children:i.jsx(Qo,{size:14,className:"inline"})})]})}),i.jsx("tbody",{children:[0,1,2].map(de=>i.jsx("tr",{children:[0,1,2].map(Fe=>{const Ye=de*3+Fe,I=V(new Date(c,Ye,1),"month"),E=d===Ye,H=!I;return i.jsx("td",{className:F("text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px] month hover:bg-[rgba(2,101,255,0.08)]",E&&"font-bold p-[1px] text-white border border-[#0265ff] bg-[#0265ff] hover:border-[#0265ff] hover:bg-[#0265ff]",H&&'text-[#999] relative pointer-events-none before:absolute before:left-0 before:right-0 before:top-[14px] before:h-[28px] before:bg-[#f3f3f3] before:opacity-60 before:content-[""]'),onClick:()=>{H||Ee(Ye)},children:fl[Ye]},Ye)})},de))})]}),Ve&&i.jsx(gv,{year:c,month:d,day:p,format:n,minDate:_,maxDate:B,week:R,onYearReduce:N,onYearAdd:Y,onMonthReduce:W,onMonthAdd:K,onMonthMenu:bt,onYearMenu:at,onChangeDay:ke})]}),Ve&&!Ze&&v&&!j&&i.jsx("div",{className:"absolute inset-0 z-[1]",children:i.jsx(bv,{year:c,month:d,showYear:j,position:"absolute",minDate:_,maxDate:B,week:R,onYearReduce:N,onYearAdd:Y,onYearMenu:at,onMountOk:Ee})}),!nt&&j&&i.jsx("div",{className:F(Ze?"relative":"absolute inset-0 z-[1]"),children:i.jsx(k6,{year:c,position:Ze?"relative":"absolute",showYearLabel:Ze,minDate:_,maxDate:B,week:R,onYearFReduce:ce,onYearFAdd:A,onSelectYear:ue})})]}),nt&&i.jsx(k6,{year:c,position:"relative",showYearLabel:!0,minDate:_,maxDate:B,week:R,onYearFReduce:ce,onYearFAdd:A,onSelectYear:ue})]}),L&&ie&&i.jsx(kv,{hours:m,minutes:y,seconds:b,year:c,month:d,day:p,format:n,minDate:_,maxDate:B,startTime:D,endTime:Z,onHoursChange:re,onMinutesChange:Ce,onSecondsChange:ge})]}),i.jsx(jv,{hasTime:ie,hasDay:Ve,todayCls:Rt,onToday:U,onOk:te})]})}const Jn=e=>{const[t,n]=C.useState(null),r=C.useCallback(o=>{if(!o){n(null);return}const s=o.getRootNode();if(s instanceof ShadowRoot){const a=s.querySelector(`[${e}]`);if(a){n(a);return}const l=document.createElement("div");l.setAttribute(e,"true"),s.appendChild(l),n(l)}else n(null)},[]);return{portalContainer:t,setTriggerRef:r}};function on({value:e,onChange:t,format:n="yyyy-MM-dd",minDate:r,maxDate:o,week:s,placeholder:a,disabled:l,className:c}){const[u,d]=C.useState(!1),f=C.useCallback((y,g)=>{t==null||t(y),g&&d(!1)},[t]),p=e?xv(e,n):"",h=a!=null?a:Sv(n),{portalContainer:m,setTriggerRef:x}=Jn("data-bs-date-input-portal");return i.jsxs(St,{open:u,onOpenChange:d,children:[i.jsx(Lt,{asChild:!0,disabled:l,children:i.jsxs("div",{className:F("flex items-center h-[34px] rounded-[4px] bg-white border border-[#e0e0e0] pl-[2px] pr-[10px] py-[2px] cursor-pointer","hover:border-[#0265FF]",u&&"border-[#0265FF]",l&&"opacity-50 cursor-not-allowed",c),ref:x,children:[i.jsx("div",{className:"flex-1 flex items-center justify-center h-[30px] px-[10px] py-[7px] rounded-[4px] min-w-0",children:i.jsx("span",{className:F("flex-1 text-[14px] leading-[normal] truncate",e?"text-[#030303]":"text-[#999999]"),children:p||h})}),i.jsx(Qs,{className:"shrink-0 size-[16px] text-[#999999]"})]})}),i.jsx(vt,{className:"w-auto p-0",align:"start",portalContainer:m,children:i.jsx(j6,{value:e,onChange:f,format:n,minDate:r,maxDate:o,week:s})})]})}function Sv(e){switch(e){case"yyyy-MM-dd":return"请选择日期";case"yyyy-MM-dd HH:mm:ss":return"请选择日期时间";case"yyyy-MM-dd HH:mm":return"请选择日期时间";case"HH:mm:ss":return"请选择时间";case"HH:mm":return"请选择时间";case"yyyy-MM":return"请选择月份";case"yyyy":return"请选择年份";default:return"请选择日期"}}const Lv=({expanded:e})=>i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:F("shrink-0",Q),style:{transform:e?"rotate(0deg)":"rotate(-90deg)"},children:i.jsx("path",{d:"M5 7L8 10L11 7",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),Mv=({open:e})=>i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:F("shrink-0",Q),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:i.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),qr={},Ev=["text","textarea","password","radio","radiogroup","combo","combocheck","checkboxgroup","address","location","button","separator","user","usergroup","dept","deptgroup","sn","formula","flowState","flowstate","subform","unknown"],Nv=["number"],Fv=["datetime"],Tv=["upload","image","linkdata","linkquery","dataload","signature"];for(const e of Ev)qr[e]={label:"文本",bgColor:"#F0F6FF",textColor:"#0265FF"};for(const e of Nv)qr[e]={label:"数字",bgColor:"#FDF4D9",textColor:"#F4B700"};for(const e of Fv)qr[e]={label:"日期",bgColor:"#EEDEFE",textColor:"#8E24F9"};for(const e of Tv)qr[e]={label:"附件",bgColor:"#DDF6DD",textColor:"#1EC31E"};function _v({style:e}){return i.jsx("span",{className:"text-[12px] rounded-[100px] h-[20px] px-[6px] flex items-center justify-center shrink-0 leading-[normal]",style:{backgroundColor:e.bgColor,color:e.textColor},children:e.label})}function pl(e,t){var n;return((n=e.widget)==null?void 0:n.widgetName)||String(t)}function S6(e,t,n){var r;return((r=t.widget)==null?void 0:r.widgetName)||`${e}-${n}`}function Dv(e,t){var o,s,a,l;const n=t.toLowerCase().trim(),r=[];for(let c=0;c<e.length;c++){const u=e[c],d=u.label,f=(o=u.widget)==null?void 0:o.items,p=f&&f.length>0&&((s=u.widget)==null?void 0:s.type)==="subform",h=pl(u,c),m=[];if(p)for(let g=0;g<f.length;g++){const b=f[g];m.push({key:S6(h,b,g),label:b.label,field:u,fieldType:(a=b.widget)==null?void 0:a.type,depth:1,children:[],isExpandable:!1})}const x=!n||d.toLowerCase().includes(n),y=m.some(g=>{var b;return(b=g==null?void 0:g.label)==null?void 0:b.toLowerCase().includes(n)});(x||y)&&r.push({key:h,label:d,field:u,fieldType:(l=u.widget)==null?void 0:l.type,depth:0,children:m,isExpandable:p})}return r}const bs=({fields:e,selectedKey:t,onSelect:n,searchPlaceholder:r="搜索",showTypeBadge:o=!1,width:s,className:a})=>{const[l,c]=C.useState(""),[u,d]=C.useState(()=>{var y,g;const x=new Set;for(let b=0;b<e.length;b++)(g=(y=e[b].widget)==null?void 0:y.items)!=null&&g.length&&x.add(pl(e[b],b));return x}),f=C.useMemo(()=>Dv(e,l),[e,l]),p=C.useCallback(x=>{d(y=>{const g=new Set(y);return g.has(x)?g.delete(x):g.add(x),g})},[]),h=C.useCallback(x=>{x.field&&n(x.field,x.key)},[n]),m=C.useCallback(x=>{const y=u.has(x.key),g=t!=null&&x.key===t,b=x.depth*22+10,w=x.fieldType&&o?qr[x.fieldType]:void 0,v=()=>{h(x)},S=j=>{j.stopPropagation(),p(x.key)};return i.jsxs("div",{children:[i.jsxs("button",{type:"button",onClick:v,className:F("flex items-center justify-between w-full h-[34px] rounded-[4px] text-left","pr-[10px]",Q,g?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]"),style:{paddingLeft:`${b}px`,paddingTop:7,paddingBottom:7},children:[i.jsxs("div",{className:"flex items-center gap-[8px] min-w-0 flex-1",children:[x.isExpandable?i.jsx("span",{onClick:S,className:"flex items-center cursor-pointer",children:i.jsx(Lv,{expanded:y})}):x.depth>0?i.jsx("span",{className:"w-[16px] h-[16px] shrink-0"}):null,i.jsx("span",{className:"text-[14px] truncate leading-[normal]",children:x.label})]}),w&&i.jsx(_v,{style:w})]}),x.isExpandable&&y&&i.jsx("div",{children:x.children.map(j=>m(j))})]},x.key)},[u,t,o,h,p]);return i.jsxs("div",{className:F("bg-white drop-shadow-[0px_0px_8px_rgba(0,0,0,0.1)] rounded-[4px] p-[4px]","flex flex-col gap-[4px]",a),style:s?{width:s}:void 0,children:[i.jsxs("div",{className:"flex items-center gap-[6px] border border-[#E0E0E0] rounded-[4px] h-[34px] px-[10px] py-[7px] shrink-0",children:[i.jsx(R1,{}),i.jsx("input",{type:"text",value:l,onChange:x=>c(x.target.value),placeholder:r,className:"flex-1 outline-none text-[14px] placeholder:text-[#999999] bg-transparent min-w-0 text-[#030303]"})]}),i.jsx("div",{className:"max-h-[400px] overflow-y-auto flex flex-col",children:f.length>0?f.map(x=>m(x)):i.jsx("div",{className:"flex items-center justify-center h-[60px] text-[12px] text-[#999999]",children:l.trim()?"未找到相关字段":"暂无字段"})})]})};function Av(e){var n;const t=new Map;for(let r=0;r<e.length;r++){const o=e[r],s=pl(o,r);t.set(s,o.label);const a=(n=o.widget)==null?void 0:n.items;if(a)for(let l=0;l<a.length;l++){const c=S6(s,a[l],l);t.set(c,a[l].label)}}return t}function Ov(e,t){var n;return t&&(n=Av(e).get(t))!=null?n:null}const hl=({fields:e,value:t,defaultValue:n,onChange:r,placeholder:o="请选择字段",searchPlaceholder:s="输入字段名称来搜索",disabled:a=!1,showTypeBadge:l=!0,className:c})=>{const[u,d]=C.useState(!1),[f,p]=C.useState(n),[h,m]=C.useState(null),[x,y]=C.useState(0),g=C.useRef(null),b=t!==void 0?t:f,w=C.useMemo(()=>Ov(e,b),[e,b]),v=C.useCallback((M,L)=>{t===void 0&&p(L),r==null||r(M,L),d(!1)},[t,r]),S=C.useCallback(M=>{a||(d(M),M&&g.current&&y(g.current.offsetWidth))},[a]),j=C.useCallback(M=>{if(g.current=M,M&&y(M.offsetWidth),!M){m(null);return}const L=M.getRootNode();if(L instanceof ShadowRoot){const T=L.querySelector("[data-bs-field-select-portal]");if(T){m(T);return}const _=document.createElement("div");_.setAttribute("data-bs-field-select-portal","true"),L.appendChild(_),m(_)}else m(null)},[]);return i.jsx("div",{className:F("relative",c),children:i.jsxs(St,{open:u,onOpenChange:S,children:[i.jsx(Lt,{asChild:!0,children:i.jsxs("button",{ref:j,type:"button",disabled:a,className:F("flex items-center justify-between w-full h-[34px]","bg-white border rounded-[4px]","px-[10px] py-[7px]","text-left cursor-pointer","hover:border-[#0265FF]",a&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",u?"border-[#0265FF]":"border-[#E0E0E0]",Q),children:[i.jsx("span",{className:F("text-[14px] leading-[normal] truncate",w?"text-[#030303]":"text-[#999999]"),children:w!=null?w:o}),i.jsx(Mv,{open:u})]})}),i.jsx(vt,{align:"start",sideOffset:4,portalContainer:h,className:"!border-0 !p-0",style:{minWidth:x||void 0},children:i.jsx(bs,{fields:e,selectedKey:b,onSelect:v,searchPlaceholder:s,showTypeBadge:l})})]})})},L6=[{value:"before",label:"之前"},{value:"after",label:"之后"},{value:"day",label:"当天"},{value:"time",label:"当时"}];function Pv(e){return e==="date"?L6.filter(t=>t.value!=="time"):L6.filter(t=>t.value!=="day")}const Iv=({value:e,onChange:t,dateFieldType:n,placeholder:r="请选择偏移类型",disabled:o=!1,className:s})=>{const a=Pv(n);return i.jsxs(B1,{value:e,onValueChange:l=>t==null?void 0:t(l),disabled:o,children:[i.jsx(L1,{className:s,children:i.jsx(z1,{placeholder:r})}),i.jsx(M1,{children:a.map(l=>i.jsx(E1,{value:l.value,children:l.label},l.value))})]})},Hv=[{value:"minute",label:"分钟"},{value:"hour",label:"小时"},{value:"day",label:"天"}],Vv=({value:e,onChange:t,placeholder:n="请选择偏移单位",disabled:r=!1,className:o})=>i.jsxs(B1,{value:e,onValueChange:s=>t==null?void 0:t(s),disabled:r,children:[i.jsx(L1,{className:o,children:i.jsx(z1,{placeholder:n})}),i.jsx(M1,{children:Hv.map(s=>i.jsx(E1,{value:s.value,children:s.label},s.value))})]}),sn=1440,M6=F("h-[34px] px-[10px] py-[7px] rounded-[4px] bg-white border border-[#e0e0e0]","text-[14px] text-[#030303] placeholder:text-[#999999]","focus:outline-none focus:border-[#0265FF]","disabled:bg-[#EFF0F6] disabled:cursor-not-allowed","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none");function Rv(e){return e==="date"?{dateFieldType:"date",offsetType:"day",offsetValue:0,offsetUnit:"minute"}:{dateFieldType:"datetime",offsetType:"time",offsetValue:0,offsetUnit:"minute"}}function E6(e,t){return t==="date"&&e==="time"?"day":t==="datetime"&&e==="day"?"time":e}function Bv(e){const t=Math.max(0,Math.floor(e))%sn,n=new Date(2024,0,1);return n.setHours(Math.floor(t/60),t%60,0,0),n}function zv(e){return e.getHours()*60+e.getMinutes()}function N6({value:e,onChange:t,dateFieldType:n,disabled:r=!1,className:o}){const s=e!==void 0,[a,l]=C.useState(()=>e!=null?e:Rv(n)),c=C.useRef(e);C.useEffect(()=>{e!==void 0&&l(e),c.current=e},[e]);const u=e!=null?e:a,d=C.useCallback(T=>{s||l(T),t==null||t(T)},[s,t]),f=E6(u.offsetType,n),p=n==="date"&&(f==="before"||f==="after"),h=n==="datetime"&&(f==="before"||f==="after"),m=n==="date",x=n==="datetime"&&(f==="before"||f==="after"),y=n==="date"?p?u.offsetValue%sn:u.offsetValue:0,g=Bv(y),b=p?Math.max(0,Math.floor(u.offsetValue/sn)):1,w=h?u.offsetValue:0,v=C.useCallback(T=>{const _=E6(T,n),B=u.offsetValue%sn;d(n==="date"?_==="day"?{dateFieldType:"date",offsetType:"day",offsetValue:B,offsetUnit:"minute"}:{dateFieldType:"date",offsetType:_,offsetValue:B,offsetUnit:"minute"}:_==="time"?{dateFieldType:"datetime",offsetType:"time",offsetValue:0,offsetUnit:"minute"}:{dateFieldType:"datetime",offsetType:_,offsetValue:u.offsetValue,offsetUnit:u.offsetUnit})},[n,u.offsetValue,u.offsetUnit,d]),S=C.useCallback(T=>{if(!T)return;const _=zv(T);if(n==="date")if(f==="day")d({dateFieldType:"date",offsetType:"day",offsetValue:_,offsetUnit:"minute"});else{const B=Math.max(0,Math.floor(u.offsetValue/sn));d({dateFieldType:"date",offsetType:f,offsetValue:B*sn+_,offsetUnit:"minute"})}},[n,f,u.offsetValue,d]),j=C.useCallback(T=>{const _=parseInt(T.target.value,10),B=isNaN(_)?0:Math.max(0,_),R=u.offsetValue%sn;d({dateFieldType:"date",offsetType:f,offsetValue:B*sn+R,offsetUnit:"minute"})},[f,u.offsetValue,d]),M=C.useCallback(T=>{const _=parseInt(T.target.value,10),B=isNaN(_)?0:Math.max(0,_);d({dateFieldType:"datetime",offsetType:f,offsetValue:B,offsetUnit:u.offsetUnit})},[f,u.offsetUnit,d]),L=C.useCallback(T=>{d({dateFieldType:"datetime",offsetType:f,offsetValue:u.offsetValue,offsetUnit:T})},[f,u.offsetValue,d]);return i.jsxs("div",{className:F("flex items-center gap-[10px]",o),children:[i.jsx(Iv,{value:f,onChange:v,dateFieldType:n,disabled:r}),p&&i.jsx("input",{type:"number",value:b,onChange:j,disabled:r,min:0,step:1,className:F(M6,"w-[60px]")}),p&&i.jsx("span",{className:"text-[14px] text-[#030303] shrink-0",children:"天"}),h&&i.jsx("input",{type:"number",value:w,onChange:M,disabled:r,min:0,step:1,className:F(M6,"w-[80px]")}),x&&i.jsx(Vv,{value:u.offsetUnit,onChange:L,disabled:r}),m&&i.jsx(on,{value:g,onChange:S,format:"HH:mm",disabled:r})]})}function Zv(e){return typeof e=="object"&&e!==null&&"formId"in e}function ml(e,t){var n,r,o,s;return{dateFieldType:"datetime",offsetType:"time",offsetValue:0,offsetUnit:"minute",...t,...e,formId:(r=(n=e.formId)!=null?n:t==null?void 0:t.formId)!=null?r:"",fieldId:(s=(o=e.fieldId)!=null?o:t==null?void 0:t.fieldId)!=null?s:""}}function Wv(e){if(typeof e=="string"||typeof e=="number"){const t=new Date(e);return isNaN(t.getTime())?void 0:t}}function $v({value:e,onChange:t,forms:n=[],fields:r=[],dateFormat:o="yyyy-MM-dd",disabled:s=!1,className:a}){const l=e==null?void 0:e.type,c=Zv(e==null?void 0:e.customTriggerTimePayload)?e.customTriggerTimePayload:void 0,u=C.useCallback(m=>{t==null||t({type:m})},[t]),d=C.useCallback(m=>{t==null||t({type:"custom",customTriggerTimePayload:m?m.toISOString():void 0})},[t]),f=C.useCallback(m=>{const x=ml({formId:m.form.id},c);t==null||t({type:"date_field",customTriggerTimePayload:x})},[t,c]),p=C.useCallback((m,x)=>{const y=ml({fieldId:x},c);t==null||t({type:"date_field",customTriggerTimePayload:y})},[t,c]),h=C.useCallback(m=>{const x=ml({dateFieldType:m.dateFieldType,offsetType:m.offsetType,offsetValue:m.offsetValue,offsetUnit:m.offsetUnit},c);t==null||t({type:"date_field",customTriggerTimePayload:x})},[t,c]);return i.jsxs("div",{className:F("flex flex-col gap-[10px]",a),children:[i.jsxs("div",{className:"flex gap-[22px] items-start w-full",children:[i.jsx(g6,{className:"flex-1 min-w-0",value:l,onChange:u,disabled:s}),l==="custom"&&i.jsx(on,{className:"flex-1 min-w-0",value:Wv(e==null?void 0:e.customTriggerTimePayload),onChange:d,format:o,disabled:s}),l==="date_field"&&i.jsx(al,{className:"flex-1 min-w-0",items:n,value:c==null?void 0:c.formId,onChange:f,disabled:s})]}),l==="date_field"&&i.jsxs("div",{className:"flex items-start gap-[10px] w-full",children:[i.jsx(hl,{className:"w-[300px]",fields:r,value:c==null?void 0:c.fieldId,onChange:p,disabled:s}),c&&i.jsx(N6,{value:{dateFieldType:c.dateFieldType,offsetType:c.offsetType,offsetValue:c.offsetValue,offsetUnit:c.offsetUnit},onChange:h,dateFieldType:c.dateFieldType,disabled:s})]})]})}const F6=[{value:"none",label:"不重复触发"},{value:"daily",label:"每天触发一次"},{value:"weekly",label:"每周触发一次"},{value:"everyTwoWeeks",label:"每两周触发一次"},{value:"monthly",label:"每月触发一次"},{value:"yearly",label:"每年触发一次"},{value:"custom",label:"自定义重复"}],T6=({value:e,onChange:t,placeholder:n="请选择重复类型",disabled:r=!1,className:o})=>i.jsxs(B1,{value:e,onValueChange:s=>t==null?void 0:t(s),disabled:r,children:[i.jsx(L1,{className:o,children:i.jsx(z1,{placeholder:n})}),i.jsx(M1,{children:F6.map(s=>i.jsx(E1,{value:s.value,children:s.label},s.value))})]}),Yr=({className:e})=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",className:e,children:i.jsx("path",{d:"M7 0C7.91925 -1.93718e-08 8.8295 0.18106 9.67878 0.532843C10.5281 0.884626 11.2997 1.40024 11.9497 2.05025C12.5998 2.70026 13.1154 3.47194 13.4672 4.32122C13.8189 5.17049 14 6.08075 14 7C14 7.91925 13.8189 8.8295 13.4672 9.67878C13.1154 10.5281 12.5998 11.2997 11.9497 11.9497C11.2997 12.5998 10.5281 13.1154 9.67878 13.4672C8.8295 13.8189 7.91925 14 7 14C3.13372 14 1.39103e-08 10.8658 0 7C0 3.13372 3.13372 1.39103e-08 7 0ZM10.1495 3.85C10.0301 3.7308 9.86825 3.66386 9.69953 3.66386C9.53081 3.66386 9.36898 3.7308 9.24956 3.85L7 6.10058L4.74993 3.85C4.6295 3.73566 4.46918 3.67288 4.30313 3.67503C4.13708 3.67718 3.97844 3.7441 3.86102 3.86153C3.7436 3.97895 3.67668 4.13759 3.67452 4.30364C3.67237 4.46968 3.73515 4.63001 3.84949 4.75044L6.10109 7L3.85 9.24956C3.73566 9.36999 3.67288 9.53031 3.67503 9.69636C3.67718 9.86241 3.7441 10.021 3.86153 10.1385C3.97895 10.2559 4.13759 10.3228 4.30364 10.325C4.46969 10.3271 4.63001 10.2643 4.75044 10.15L7 7.8984L9.24956 10.1495C9.37027 10.2621 9.52995 10.3234 9.69497 10.3205C9.85999 10.3177 10.0175 10.2509 10.1342 10.1342C10.2509 10.0175 10.3178 9.86008 10.3208 9.69507C10.3237 9.53005 10.2625 9.37033 10.15 9.24956L7.8984 7L10.1495 4.74993C10.2688 4.63049 10.3359 4.46856 10.3359 4.29971C10.3359 4.13086 10.2688 3.96892 10.1495 3.84949V3.85Z",fill:"#666666"})}),er=[{value:"mon",label:"星期一"},{value:"tue",label:"星期二"},{value:"wed",label:"星期三"},{value:"thu",label:"星期四"},{value:"fri",label:"星期五"},{value:"sat",label:"星期六"},{value:"sun",label:"星期日"}],Uv=()=>i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:i.jsx("path",{d:"M3 3L9 9M9 3L3 9",stroke:"#999999",strokeWidth:"1.2",strokeLinecap:"round"})}),_6=({open:e})=>i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:F("shrink-0",Q),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:i.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),D6=({value:e=[],onChange:t,placeholder:n="请选择工作日",disabled:r=!1,className:o})=>{const[s,a]=C.useState(!1),[l,c]=C.useState(!1),u=e.length===er.length,d=e.length>0&&e.length<er.length,{portalContainer:f,setTriggerRef:p}=Jn("data-bs-weekdays-select-portal"),h=C.useCallback(v=>{const S=e.includes(v)?e.filter(j=>j!==v):[...e,v];t==null||t(S)},[e,t]),m=C.useCallback(()=>{u?t==null||t([]):t==null||t(er.map(v=>v.value))},[u,t]),x=C.useCallback(v=>{v.stopPropagation(),t==null||t([])},[t]),y=C.useCallback((v,S)=>{S.stopPropagation(),t==null||t(e.filter(j=>j!==v))},[e,t]),g=C.useCallback(v=>{r||a(v)},[r]),b=e.length>0,w=b&&l;return i.jsx("div",{className:F("relative",o),children:i.jsxs(St,{open:s,onOpenChange:g,children:[i.jsx(Lt,{asChild:!0,children:i.jsx("button",{type:"button",disabled:r,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),ref:p,className:F("flex items-center justify-between w-full h-[34px] gap-2.5","bg-white border border-[#E0E0E0] rounded-[4px]","py-[7px]",b?"pl-[4px] pr-[10px]":"px-[10px]","text-left cursor-pointer","hover:border-[#0265FF]",r&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",s&&"border-[#0265FF]",Q),children:b?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex items-center gap-[4px] min-w-0 flex-1 overflow-x-auto scrollbar-hide",children:e.map(v=>{const S=er.find(j=>j.value===v);return i.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0",children:[i.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:S==null?void 0:S.label}),i.jsx("span",{className:"cursor-pointer flex items-center shrink-0",onClick:j=>y(v,j),children:i.jsx(Uv,{})})]},v)})}),w?i.jsx("span",{className:"cursor-pointer flex items-center shrink-0",onClick:x,children:i.jsx(Yr,{})}):i.jsx(_6,{open:s})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-[14px] text-[#999999] leading-[normal] truncate",children:n}),i.jsx(_6,{open:s})]})})}),i.jsx(vt,{align:"start",sideOffset:4,className:"!border-0 rounded-[8px] shadow-[0px_6px_16px_rgba(0,0,0,0.06)] p-[4px]",portalContainer:f,children:i.jsxs("div",{className:"flex flex-col",children:[i.jsxs("button",{type:"button",onClick:m,className:F("flex items-center gap-[6px] h-[34px] px-[10px] py-[7px] rounded-[4px] text-left","hover:bg-[#EFF0F6]",Q),children:[i.jsx(_1,{checked:u,intermediate:d,onCheckedChange:m,className:"shrink-0"}),i.jsx("span",{className:"text-[14px] font-bold text-[#0265FF] leading-[normal]",children:"全选"})]}),er.map(v=>{const S=e.includes(v.value);return i.jsxs("button",{type:"button",onClick:()=>h(v.value),className:F("flex items-center gap-[6px] h-[34px] px-[10px] py-[7px] rounded-[4px] text-left","hover:bg-[#EFF0F6]",Q),children:[i.jsx(_1,{checked:S,onCheckedChange:()=>h(v.value),className:"shrink-0"}),i.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:v.label})]},v.value)})]})})]})})},qv=Ew,A6=k.forwardRef(({className:e,...t},n)=>i.jsx(i6,{ref:n,className:F("inline-flex items-center w-full gap-[2px] p-[2px] bg-[#EFF0F6] rounded-[4px]",e),...t}));A6.displayName=i6.displayName;const Cl=k.forwardRef(({className:e,...t},n)=>i.jsx(a6,{ref:n,className:F("inline-flex items-center justify-center w-full h-[30px]","px-[10px] py-[7px] rounded-[4px]","text-[14px] text-[#121111] leading-normal","bg-transparent border border-solid border-[#EFF0F6]","transition-all duration-200 ease-out","outline-none cursor-pointer","hover:text-[#121111] hover:border-[#E0E0E0] hover:bg-white","data-[state=active]:text-[#0265FF] data-[state=active]:border-[#E0E0E0] data-[state=active]:bg-white","focus-visible:ring-2 focus-visible:ring-[#0265FF] focus-visible:ring-offset-1",e),...t}));Cl.displayName=a6.displayName;const xl=k.forwardRef(({className:e,...t},n)=>i.jsx(l6,{ref:n,className:F("mt-2 outline-none","data-[state=inactive]:hidden",e),...t}));xl.displayName=l6.displayName;const ws=[{value:1,label:"1"},{value:2,label:"2"},{value:3,label:"3"},{value:4,label:"4"},{value:5,label:"5"},{value:6,label:"6"},{value:7,label:"7"},{value:8,label:"8"},{value:9,label:"9"},{value:10,label:"10"},{value:11,label:"11"},{value:12,label:"12"},{value:13,label:"13"},{value:14,label:"14"},{value:15,label:"15"},{value:16,label:"16"},{value:17,label:"17"},{value:18,label:"18"},{value:19,label:"19"},{value:20,label:"20"},{value:21,label:"21"},{value:22,label:"22"},{value:23,label:"23"},{value:24,label:"24"},{value:25,label:"25"},{value:26,label:"26"},{value:27,label:"27"},{value:28,label:"28"},{value:29,label:"29"},{value:30,label:"30"},{value:31,label:"31"}],Yv={label:"最后一个自然日"},O6=7,Gv=()=>i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:i.jsx("path",{d:"M3 3L9 9M9 3L3 9",stroke:"#999999",strokeWidth:"1.2",strokeLinecap:"round"})}),P6=({open:e})=>i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:F("shrink-0",Q),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:i.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),I6=({value:e=[],onChange:t,placeholder:n="请选择日期",disabled:r=!1,className:o})=>{const[s,a]=C.useState(!1),[l,c]=C.useState(!1),[u,d]=C.useState(e),{portalContainer:f,setTriggerRef:p}=Jn("data-bs-weekdays-select-portal"),h=s?u:e,m=C.useMemo(()=>h.filter(D=>D!=="last"),[h]),x=C.useMemo(()=>h.includes("last"),[h]),y=m.length===31,g=C.useCallback(D=>{d(Z=>Z.includes(D)?Z.filter(O=>O!==D):[...Z,D])},[]),b=C.useCallback(()=>{d(D=>{if(D.filter($=>$!=="last").length===31)return D.filter($=>$==="last");const O=ws.map($=>$.value),V=D.includes("last")?["last"]:[];return[...O,...V]})},[]),w=C.useCallback(()=>{const D=new Date().getDate();d(Z=>Z.includes(D)?Z:[...Z,D])},[]),v=C.useCallback(()=>{d(D=>D.includes("last")?D.filter(Z=>Z!=="last"):[...D,"last"])},[]),S=C.useCallback(()=>{t==null||t(u),a(!1)},[u,t]),j=C.useCallback(D=>{r||(D&&d([...e]),a(D))},[r,e]),M=C.useCallback(D=>{D.stopPropagation(),t==null||t([])},[t]),L=C.useCallback((D,Z)=>{Z.stopPropagation(),t==null||t(e.filter(O=>O!==D))},[e,t]),T=e.length>0,_=T&&l,B=C.useCallback(D=>D==="last"?"最后一天":`${D}日`,[]),R=C.useMemo(()=>{const D=[];for(let Z=0;Z<ws.length;Z+=O6)D.push(ws.slice(Z,Z+O6));return D},[]);return i.jsx("div",{className:F("relative",o),children:i.jsxs(St,{open:s,onOpenChange:j,children:[i.jsx(Lt,{asChild:!0,children:i.jsx("button",{type:"button",ref:p,disabled:r,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),className:F("flex items-center justify-between w-full h-[34px] gap-2.5","bg-white border border-[#E0E0E0] rounded-[4px]","py-[7px]",T?"pl-[4px] pr-[10px]":"px-[10px]","text-left cursor-pointer","hover:border-[#0265FF]",r&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",s&&"border-[#0265FF]",Q),children:T?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex items-center gap-[4px] min-w-0 flex-1 overflow-x-auto scrollbar-hide",children:e.map(D=>i.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0",children:[i.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:B(D)}),i.jsx("span",{className:"cursor-pointer flex items-center shrink-0",onClick:Z=>L(D,Z),children:i.jsx(Gv,{})})]},D))}),_?i.jsx("span",{className:"cursor-pointer flex items-center shrink-0",onClick:M,children:i.jsx(Yr,{})}):i.jsx(P6,{open:s})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-[14px] text-[#999999] leading-[normal] truncate",children:n}),i.jsx(P6,{open:s})]})})}),i.jsx(vt,{align:"start",sideOffset:4,portalContainer:f,className:"!border-0 rounded-[8px] shadow-[0px_6px_16px_rgba(0,0,0,0.06)] p-0",style:{width:"310px"},children:i.jsxs(qv,{defaultValue:"specific",children:[i.jsx("div",{className:"px-[4px] pt-[4px] flex justify-center",children:i.jsxs(A6,{children:[i.jsx(Cl,{value:"specific",children:"指定日期"}),i.jsx(Cl,{value:"relative",children:"相对日期"})]})}),i.jsxs(xl,{value:"specific",className:"mt-0",children:[i.jsxs("div",{className:"px-[8px] pt-[8px] pb-[4px]",children:[i.jsxs("button",{type:"button",onClick:b,className:F("flex items-center gap-[6px] w-full h-[34px] px-[10px] py-[7px] rounded-[4px] text-left mb-[4px]","hover:bg-[#EFF0F6]",Q),children:[i.jsx(_1,{checked:y,intermediate:m.length>0&&!y,onCheckedChange:b,className:"shrink-0"}),i.jsx("span",{className:"text-[14px] font-bold text-[#0265FF] leading-[normal]",children:"全选"})]}),i.jsx("div",{className:"flex flex-col gap-[2px]",children:R.map((D,Z)=>i.jsx("div",{className:"flex gap-[4px]",children:D.map(O=>{const V=m.includes(O.value);return i.jsx("button",{type:"button",onClick:()=>g(O.value),className:F("flex items-center justify-center w-[36px] h-[30px] rounded-[4px]","text-[14px] leading-[normal]","transition-all duration-200 ease-out",V?"bg-[#0265FF] text-white":"text-[#030303] hover:bg-[#EFF0F6]"),children:O.label},O.value)})},Z))})]}),i.jsxs("div",{className:"flex items-center justify-between px-[12px] py-[8px] border-t border-[#E0E0E0] mt-[4px]",children:[i.jsx("button",{type:"button",onClick:w,className:F("h-[28px] px-[12px] rounded-[4px] text-[14px]","text-[#0265FF] hover:bg-[#EFF0F6]",Q),children:"今天"}),i.jsx("button",{type:"button",onClick:S,className:F("h-[28px] px-[16px] rounded-[4px] text-[14px]","bg-[#0265FF] text-white hover:bg-[#0255DD]",Q),children:"确认"})]})]}),i.jsxs(xl,{value:"relative",className:"mt-0",children:[i.jsx("div",{className:"px-[8px] pt-[8px] pb-[4px]",children:i.jsxs("button",{type:"button",onClick:v,className:F("flex items-center gap-[6px] w-full h-[34px] px-[10px] py-[7px] rounded-[4px] text-left","hover:bg-[#EFF0F6]",Q),children:[i.jsx(_1,{checked:x,onCheckedChange:v,className:"shrink-0"}),i.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:Yv.label})]})}),i.jsx("div",{className:"flex items-center justify-center px-[12px] py-[8px] border-t border-[#E0E0E0] mt-[4px]",children:i.jsx("button",{type:"button",onClick:S,className:F("h-[28px] px-[16px] rounded-[4px] text-[14px]","bg-[#0265FF] text-white hover:bg-[#0255DD]",Q),children:"确认"})})]})]})})]})})},H6=[{value:"week",label:"按周重复"},{value:"month",label:"按月重复"}],V6=({value:e,onChange:t,placeholder:n="请选择重复方式",disabled:r=!1,className:o})=>i.jsxs(B1,{value:e,onValueChange:s=>t==null?void 0:t(s),disabled:r,children:[i.jsx(L1,{className:o,children:i.jsx(z1,{placeholder:n})}),i.jsx(M1,{children:H6.map(s=>i.jsx(E1,{value:s.value,children:s.label},s.value))})]}),Xv=F("h-[34px] px-[10px] py-[7px] rounded-[4px] bg-white border border-[#e0e0e0]","text-[14px] text-[#030303] placeholder:text-[#999999]","focus:outline-none focus:border-[#0265FF]","disabled:bg-[#EFF0F6] disabled:cursor-not-allowed","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none","w-[60px]");function Kv(){return{repeatBy:"week",interval:1,repeatDetailDates:[]}}function Qv({value:e,onChange:t,disabled:n=!1,className:r}){var m,x,y;const o=e==null?void 0:e.type,s=e==null?void 0:e.customRepeatPreference,a=s==null?void 0:s.repeatBy,l=C.useCallback(g=>{g==="custom"?t==null||t({type:"custom",customRepeatPreference:s!=null?s:Kv()}):t==null||t({type:g})},[t,s]),c=C.useCallback(g=>{s&&(t==null||t({type:"custom",customRepeatPreference:{...s,repeatBy:g,repeatDetailDates:[]}}))},[t,s]),u=C.useCallback(g=>{if(!s)return;const b=parseInt(g.target.value,10),w=isNaN(b)?1:Math.max(1,b);t==null||t({type:"custom",customRepeatPreference:{...s,interval:w}})},[t,s]),d=C.useCallback(g=>{s&&(t==null||t({type:"custom",customRepeatPreference:{...s,repeatDetailDates:g}}))},[t,s]),f=C.useCallback(g=>{s&&(t==null||t({type:"custom",customRepeatPreference:{...s,repeatDetailDates:g}}))},[t,s]),p=(m=s==null?void 0:s.repeatDetailDates)!=null?m:[],h=(x=s==null?void 0:s.repeatDetailDates)!=null?x:[];return i.jsxs("div",{className:F("flex flex-col gap-[10px]",r),children:[i.jsx(T6,{value:o,onChange:l,disabled:n}),o==="custom"&&i.jsxs("div",{className:"flex items-start gap-[10px] w-full",children:[i.jsx(V6,{className:"w-[200px] shrink-0",value:a,onChange:c,disabled:n}),i.jsx("span",{className:"text-[14px] text-[#030303] leading-[34px] shrink-0",children:"每"}),i.jsx("input",{type:"number",value:(y=s==null?void 0:s.interval)!=null?y:1,onChange:u,disabled:n,min:1,step:1,className:Xv}),i.jsx("span",{className:"text-[14px] text-[#030303] leading-[34px] shrink-0",children:a==="month"?"月":"周"}),a==="week"&&i.jsx(D6,{className:"flex-1 min-w-0",value:p,onChange:d,disabled:n}),a==="month"&&i.jsx(I6,{className:"flex-1 min-w-0",value:h,onChange:f,disabled:n})]})]})}const R6=({flipped:e})=>i.jsx("svg",{width:"40",height:"4",viewBox:"0 0 40 4",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",flexShrink:0},children:e?i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"2",cy:"2",r:"2",fill:"#D9D9D9"}),i.jsx("path",{d:"M10 2H40",stroke:"#E0E0E0"})]}):i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M0 2H30",stroke:"#E0E0E0"}),i.jsx("circle",{cx:"38",cy:"2",r:"2",fill:"#D9D9D9"})]})}),Jv=({children:e,className:t})=>i.jsxs("div",{className:F("flex items-center justify-center gap-[10px]",t),children:[i.jsx(R6,{}),e!=null&&i.jsx("span",{className:"text-[#999] text-[14px] whitespace-nowrap leading-[normal] shrink-0",children:e}),i.jsx(R6,{flipped:!0})]}),B6=[{value:"eq",label:Pt.eq},{value:"neq",label:Pt.neq},{value:"gt",label:Pt.gt},{value:"lt",label:Pt.lt},{value:"gte",label:Pt.gte},{value:"lte",label:Pt.lte},{value:"contains",label:Pt.contains},{value:"not_contains",label:Pt.not_contains},{value:"in",label:Pt.in},{value:"nin",label:Pt.nin},{value:"all",label:Pt.all},{value:"empty",label:Pt.empty},{value:"not_empty",label:Pt.not_empty},{value:"range",label:Pt.range}],z6=({value:e,defaultValue:t="eq",onChange:n,operators:r,borderless:o=!1,disabled:s=!1,className:a})=>{var b,w;const[l,c]=C.useState(!1),[u,d]=C.useState(t),[f,p]=C.useState(null),h=C.useMemo(()=>{if(!r||r.length===0)return B6;const v=new Set(r);return B6.filter(S=>v.has(S.value))},[r]),m=(()=>{const v=e!==void 0?e:u;return h.length>0&&!h.find(S=>S.value===v)?h[0].value:v})(),x=(w=(b=h.find(v=>v.value===m))==null?void 0:b.label)!=null?w:"",y=C.useCallback(v=>{e===void 0&&d(v),n==null||n(v),c(!1)},[e,n]),g=C.useCallback(v=>{if(!v){p(null);return}const S=v.getRootNode();if(S instanceof ShadowRoot){const j=S.querySelector("[data-bs-relational-operator-select-portal]");if(j){p(j);return}const M=document.createElement("div");M.setAttribute("data-bs-relational-operator-select-portal","true"),S.appendChild(M),p(M)}else p(null)},[]);return i.jsx("div",{className:F("relative inline-flex",a),children:i.jsxs(St,{open:l,onOpenChange:c,children:[i.jsx(Lt,{asChild:!0,children:i.jsxs("button",{ref:g,type:"button",disabled:s,className:F("flex items-center justify-between gap-[10px]","min-w-[82px] px-[10px] w-full","text-left cursor-pointer",o?"h-[34px] bg-transparent":F("h-[31px] bg-white border rounded-[4px]",l?"border-[#0265FF]":"border-[#E0E0E0] hover:border-[#0265FF]"),s&&"opacity-50 cursor-not-allowed",!s&&!o&&"hover:border-[#0265FF]",Q),children:[i.jsx("span",{className:"text-[14px] leading-[normal] text-[#030303] truncate",children:x}),i.jsx("span",{className:F("shrink-0 flex items-center justify-center w-[16px] h-[16px] text-[#666666]",Q,l&&"rotate-180"),children:i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:i.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}),i.jsx(vt,{align:"start",sideOffset:4,portalContainer:f,className:"!border-0 rounded-[10px] shadow-[0px_0px_5px_rgba(0,0,0,0.04)] p-[4px] min-w-[82px]",children:i.jsx("div",{className:"flex flex-col gap-0 max-h-[320px] overflow-y-auto",children:h.map(v=>i.jsx("button",{type:"button",onClick:()=>y(v.value),className:F("h-[34px] px-[10px] rounded-[4px] text-left text-[14px] leading-[normal] whitespace-nowrap shrink-0",m===v.value?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]",Q),children:v.label},v.value))})})]})})},ek=({avatar:e,width:t,onDockClick:n,onCloseClick:r,draggable:o,isDragging:s,isDocked:a,onDragStart:l})=>i.jsxs("div",{className:F("flex items-center justify-between","px-4","h-[52px] min-w-[200px]",{"w-full":!t,[`w-[${t}px]`]:t,"cursor-grab":o&&!s,"cursor-grabbing":s}),style:{backgroundImage:K2,backgroundSize:"cover",backgroundRepeat:"no-repeat"},onMouseDown:o?l:void 0,children:[e,i.jsxs("div",{className:"actions flex items-center gap-2.5 text-[#666]",children:[i.jsx(Jt,{onMouseDown:c=>{c.stopPropagation()},tooltip:a?"悬浮":"右侧打开",icon:a?i.jsx(u3,{}):i.jsx(c3,{}),onClick:n}),i.jsx(Jt,{icon:i.jsx(Qi,{}),onClick:r})]})]}),Z6=({defaultChecked:e=!1,checked:t,onCheckedChange:n,children:r,disabled:o=!1,className:s})=>{const[a,l]=C.useState(e),c=t!==void 0,u=c?t:a,d=()=>{if(o)return;const f=!u;c||l(f),n==null||n(f)};return i.jsxs("button",{type:"button",role:"checkbox","aria-checked":u,disabled:o,onClick:d,className:F("inline-flex items-center gap-[6px] cursor-pointer select-none","text-[#121111] text-[14px]",o&&"cursor-not-allowed opacity-50",s),children:[i.jsx("span",{className:F("inline-flex items-center justify-center w-4 h-4 rounded-full transition-colors duration-200 box-border border",u?"bg-[#2E60FF] border-transparent":"bg-white border-[#e0e0e0]"),children:u&&i.jsx("span",{className:"text-white",children:i.jsx(na,{})})}),r&&i.jsx("span",{className:"text-sm",children:r})]})},tk=({defaultChecked:e=!1,checked:t,onCheckedChange:n,title:r,description:o,disabled:s=!1,className:a})=>{const[l,c]=C.useState(e),u=t!==void 0,d=u?t:l,f=()=>{if(s)return;const p=!d;u||c(p),n==null||n(p)};return i.jsxs("button",{type:"button",role:"checkbox","aria-checked":d,disabled:s,onClick:f,className:F("flex flex-col gap-[6px] p-[10px] rounded-[4px] cursor-pointer select-none","border border-[#e0e0e0]",s&&"cursor-not-allowed opacity-50",a),children:[i.jsxs("div",{className:"inline-flex items-center gap-[6px]",children:[i.jsx(Z6,{checked:d,onCheckedChange:p=>{d||f()},disabled:s}),i.jsx("span",{className:"text-[#030303] text-[14px]",children:r})]}),i.jsx("p",{className:"text-[#666] text-[12px] pl-[22px]",children:o})]})},gl=({title:e,content:t,icon:n,disableExpand:r,children:o,defaultOpen:s})=>{const[a,l]=C.useState(s);return i.jsxs("div",{className:"bg-[#fafafa] border border-[#e0e0e0] border-solid flex flex-col gap-2.5 p-2.5 rounded-lg w-full",children:[i.jsxs("div",{className:F("flex items-center justify-between w-full",{"cursor-pointer":!r}),onClick:()=>{r||l(!a)},children:[i.jsxs("div",{className:"flex gap-2.5 items-center",children:[i.jsx("div",{className:"w-4 h-4 shrink-0 flex items-center",children:n||i.jsx(f3,{})}),i.jsx("p",{className:"text-[#666] text-[14px] leading-normal",children:e})]}),i.jsx("button",{onClick:()=>{r||l(!a)},className:F("flex items-center justify-center w-5 h-5 rounded-[4px] cursor-pointer hover:bg-[#EFF0F6]",Q,{"pointer-events-none opacity-0":r}),children:i.jsx(Go,{isOpen:a})})]}),a&&!r&&i.jsx("div",{className:"text-[#121111] text-[14px] word-wrap",children:t||o})]})};function W6({open:e,onOpenChange:t,title:n,description:r,linkText:o="留在此页",onLinkClick:s,cancelText:a="不保存",onCancel:l,confirmText:c="保存并继续",onConfirm:u,container:d,showLink:f=!0,showCancel:p=!0}){const h={borderRadius:4,padding:"6px 20px"};return i.jsx(Q4,{open:e,onOpenChange:t,children:i.jsxs(yi,{container:d,className:F("w-[480px] max-w-[480px] p-0 gap-0 rounded-[10px] border-none","shadow-[0px_0px_10px_0px_rgba(0,0,0,0.04)]","[&>button]:hidden"),children:[i.jsxs(bi,{className:"flex flex-row items-start gap-[10px] p-9 pb-0",children:[i.jsx("div",{className:"size-[30px] shrink-0 text-[#0265FF]",children:i.jsx(C3,{})}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx(vi,{className:"text-[16px] font-[700] text-[#030303] leading-normal",children:n}),r&&i.jsx(ki,{className:"text-[14px] text-[#666] leading-normal",children:r})]})]}),i.jsxs(wi,{className:"flex flex-row items-center !justify-between p-9 pt-6",children:[f?i.jsx("button",{type:"button",className:"text-[14px] text-[#0265ff] hover:text-[#0265ff]/80 bg-transparent border-none cursor-pointer",onClick:s||(()=>{console.log("Link clicked"),t==null||t(!1)}),children:o}):i.jsx("div",{}),i.jsxs("div",{className:"flex items-center gap-3",children:[p&&i.jsx(us,{className:"hover:text-[#121111]",onClick:l,children:a}),i.jsx("button",{type:"button",onClick:u,style:h,className:F("text-[14px] text-white bg-[#0265ff]","hover:bg-[#0265ff]/80 cursor-pointer border-none"),children:c})]})]})]})})}function nk(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r.isSubForm){const o=[];let s=n+1;for(;s<e.length&&e[s].isFieldInSubForm&&e[s].parentFormName===r.fieldName;)o.push(e[s]),s++;t.push({kind:"subform",parent:r,children:o}),n=s}else t.push({kind:"field",field:r}),n++}return t}const t1="flex items-center px-1.5 py-2.5 text-xs leading-normal";function $6({field:e,isSubFormChild:t=!1}){return i.jsxs("div",{className:"flex items-center w-full",children:[i.jsxs("div",{className:F(t1,"w-20 shrink-0 min-h-[34px]"),children:[t&&i.jsx("span",{className:"inline-flex items-center justify-center shrink-0 w-5 h-5 opacity-0",children:i.jsx(Go,{})}),i.jsx("span",{children:e.fieldName})]}),i.jsx("div",{className:F(t1,"w-[72px] shrink-0 min-h-[34px]"),children:e.type}),i.jsx("div",{className:F(t1,"w-9 shrink-0 min-h-[34px]"),children:e.required?"是":"否"}),i.jsx("div",{className:F(t1,"flex-1 min-w-0 min-h-[34px]"),children:i.jsx("span",{className:"break-words min-w-0",children:e.description})})]})}function rk({parent:e,children:t}){const[n,r]=C.useState(!0),o=C.useCallback(()=>r(s=>!s),[]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center w-full",children:[i.jsxs("div",{className:F(t1,"w-20 shrink-0 min-h-[34px]"),children:[i.jsx("button",{type:"button",onClick:o,className:"inline-flex items-center justify-center shrink-0 w-5 h-5 rounded cursor-pointer text-[#666] relative -left-[2px]",children:i.jsx(Go,{isOpen:n})}),i.jsx("span",{children:e.fieldName})]}),i.jsx("div",{className:F(t1,"w-[72px] shrink-0 min-h-[34px] "),children:e.type}),i.jsx("div",{className:F(t1,"w-9 shrink-0 min-h-[34px]"),children:e.required?"是":"否"}),i.jsx("div",{className:F(t1,"flex-1 min-w-0 min-h-[34px]"),children:i.jsx("span",{className:"break-words min-w-0",children:e.description})})]}),n&&t.map((s,a)=>i.jsx($6,{field:s,isSubFormChild:!0},a))]})}function ok({fields:e}){const t=C.useMemo(()=>nk(e),[e]);return i.jsxs("div",{className:"flex flex-col items-start w-full bg-white rounded-[10px] overflow-hidden text-black my-[10px] border border-[#E0E0E0]",children:[i.jsxs("div",{className:"flex items-center w-full shrink-0 bg-[#E5E6EB] rounded-t-[10px] border-b border-[#E0E0E0]",children:[i.jsx("div",{className:F(t1,"w-20 shrink-0 h-[34px] font-bold"),children:"名称"}),i.jsx("div",{className:F(t1,"w-[72px] shrink-0 h-[34px] font-bold"),children:"类型"}),i.jsx("div",{className:F(t1,"w-9 shrink-0 h-[34px] font-bold justify-center"),children:"必填"}),i.jsx("div",{className:F(t1,"flex-1 min-w-0 h-[34px] font-bold"),children:"说明"})]}),i.jsx("div",{className:"flex flex-col items-start w-full",children:t.map((n,r)=>n.kind==="field"?i.jsx($6,{field:n.field},r):i.jsx(rk,{parent:n.parent,children:n.children},r))})]})}const sk=()=>i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex gap-[2px] flex-shrink-0 relative -left-[4px] top-[3px]",children:[i.jsx("div",{className:"w-[2px] h-[2px] rounded-full bg-[#0265FF] flex-shrink-0",style:{animation:"pulse 1.4s ease-in-out infinite",animationDelay:"0s",marginRight:"2px"}}),i.jsx("div",{className:"w-[2px] h-[2px] rounded-full bg-[#0265FF] flex-shrink-0",style:{animation:"pulse 1.4s ease-in-out infinite",animationDelay:"0.2s",marginRight:"2px"}}),i.jsx("div",{className:"w-[2px] h-[2px] rounded-full bg-[#0265FF] flex-shrink-0",style:{animation:"pulse 1.4s ease-in-out infinite",animationDelay:"0.4s"}})]}),i.jsx("style",{children:`
161
161
  @keyframes pulse {
162
162
  0%, 60%, 100% {
163
163
  opacity: 0.3;