@svar-ui/react-core 2.5.1 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),n=require("react"),I=require("@svar-ui/lib-react"),H=require("@svar-ui/lib-dom"),He=require("react-dom"),ie=require("@svar-ui/core-locales"),ee=n.createContext(""),Re=n.createContext({}),J=n.createContext(null),te=n.createContext(null),Ae=Object.freeze(Object.defineProperty({__proto__:null,fieldId:te,helpers:Re,i18n:J,theme:ee},Symbol.toStringTag,{value:"Module"}));function U(e){const r=n.useContext(te),[s]=n.useState(()=>e||r||H.uid());return s}function Be({value:e="",id:r,placeholder:s="",title:c="",disabled:l=!1,error:x=!1,readonly:i=!1,onChange:a}){const o=U(r),[u,d]=I.useWritableProp(e),f=n.useCallback(m=>{const w=m.target.value;d(w),a&&a({value:w,input:!0})},[a]),v=n.useCallback(m=>{const w=m.target.value;d(w),a&&a({value:w})},[a]),j=n.useRef(null);return n.useEffect(()=>{const m=v,w=j.current;return w.addEventListener("change",m),()=>{w&&w.removeEventListener("change",m)}},[v]),t.jsx("textarea",{className:`wx-3yFVAC wx-textarea ${x?"wx-error":""}`,id:o,disabled:l,placeholder:s,readOnly:i,title:c,value:u,onInput:f,ref:j})}function Q({type:e="",css:r="",icon:s="",disabled:c=!1,title:l="",text:x="",children:i,onClick:a}){const o=n.useMemo(()=>{let d=e?e.split(" ").filter(f=>f!=="").map(f=>"wx-"+f).join(" "):"";return r+(r?" ":"")+d},[e,r]),u=d=>{a&&a(d)};return t.jsxs("button",{title:l,className:`wx-2ZWgb4 wx-button ${o} ${s&&!i?"wx-icon":""}`,disabled:c,onClick:u,children:[s&&t.jsx("i",{className:"wx-2ZWgb4 "+s}),i||x||" "]})}function xe({id:e,label:r="",inputValue:s="",value:c=!1,onChange:l,disabled:x=!1,style:i}){const a=U(e),[o,u]=I.useWritableProp(c),d=({target:f})=>{const v=f.checked;u(v),l&&l({value:v,inputValue:s})};return t.jsxs("div",{style:i,className:"wx-2IvefP wx-checkbox",children:[t.jsx("input",{type:"checkbox",id:a,disabled:x,className:"wx-2IvefP wx-check",checked:o,value:s,onChange:d}),t.jsxs("label",{htmlFor:a,className:"wx-2IvefP wx-label",children:[t.jsx("span",{className:"wx-2IvefP wx-before"}),r&&t.jsx("span",{className:"wx-2IvefP wx-after",children:r})]})]})}function Oe({options:e=[],value:r=[],type:s="",onChange:c}){const l=n.useCallback(x=>{let i;x.value?i=[...r,x.inputValue]:i=r.filter(a=>a!==x.inputValue),c&&c({value:i})},[r,c]);return t.jsx(te.Provider,{value:null,children:t.jsx("div",{className:`wx-q8xwRD wx-checkboxgroup ${s&&`wx-${s}`}`,children:e.map(x=>t.jsx("div",{className:"wx-q8xwRD wx-item",children:t.jsx(xe,{label:x.label,inputValue:x.id,value:r.includes(x.id),onChange:l})},x.id))})})}function Me({theme:e="",target:r,children:s}){const c=n.useRef(null),l=n.useRef(null),[x,i]=n.useState(null);c.current||(c.current=document.createElement("div"));const a=n.useContext(ee);return n.useEffect(()=>{i(r||Ye(l.current)||H.env.getTopNode(l.current))},[l.current]),t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:l,style:{display:"none"}}),l.current&&x?He.createPortal(t.jsx("div",{className:`wx-3ZWsT0 wx-${e||a}-theme`,children:s}),x):null]})}function Ye(e){const r=H.env.getTopNode(e);for(;e&&e!==r&&!e.getAttribute("data-wx-portal-root");)e=e.parentNode;return e}function Se({left:e=0,top:r=0,at:s="bottom",parent:c=null,width:l="auto",css:x="",onCancel:i,children:a,trackScroll:o=!1}){const[u,d]=n.useState(0),[f,v]=n.useState(0),[j,m]=n.useState("auto"),[w,h]=n.useState(!1),p=n.useRef(null),g=n.useRef(null),y=n.useRef(i);n.useEffect(()=>{y.current=i},[i]);function C(k){return c&&(l+"").indexOf("%")>-1?l.replace(/(\d+)%/,(S,M)=>(M=M*c.offsetWidth/100+"px",l.replace(S,M))):l&&l!=="auto"?l:k}const N=n.useCallback(()=>{if(!p.current)return;const k=H.calculatePosition(p.current,c,s,e,r);k&&(d(k.x),v(k.y),m(C(k.width)))},[p,c,s,e,r,l]);return n.useLayoutEffect(()=>{const k=S=>{y.current&&S.target!==g.current&&p.current&&!p.current.contains(S.target)&&y.current(S)};return requestAnimationFrame(()=>{N(),h(!0),o&&p.current&&(g.current=H.getAbsParent(p.current),g.current&&g.current.addEventListener("scroll",k,!0))}),()=>{o&&g.current&&g.current.removeEventListener("scroll",k,!0)}},[]),n.useLayoutEffect(()=>{N()},[c,s,e,r]),n.useEffect(()=>{const k=S=>{y.current&&y.current(S)};if(p.current)return H.clickOutside(p.current,k).destroy},[]),t.jsx("div",{ref:p,className:["wx-37M6Fj","wx-popup",x].filter(Boolean).join(" "),style:{position:"absolute",visibility:w?"visible":"hidden",top:f+"px",left:u+"px",width:j},children:a})}function Je({position:e="bottom",align:r="start",autoFit:s=!0,onCancel:c=null,width:l="100%",css:x="",children:i}){const a=n.useRef(null),[o,u]=n.useState(e),[d,f]=n.useState(r),v=n.useRef(c);return n.useEffect(()=>{v.current=c},[c]),n.useEffect(()=>{if(s){const j=a.current;if(j){const m=j.getBoundingClientRect(),w=document.body.getBoundingClientRect();m.right>=w.right&&f("end"),m.bottom>=w.bottom&&u("top")}}},[]),n.useEffect(()=>{if(a.current){const j=m=>{v.current&&v.current(m)};return H.clickOutside(a.current,j).destroy}},[]),t.jsx("div",{ref:a,className:["wx-dropdown",`wx-${o}-${d}`,x||"","wx-aaaVytZW"].filter(Boolean).join(" "),style:{width:l},children:i})}function K({position:e="bottom",align:r="start",autoFit:s=!0,inline:c=!1,onCancel:l,width:x="100%",children:i,...a}){const[o,u]=n.useState(void 0),d=n.useRef(null),f=n.useMemo(()=>`${e}-${r}`,[e,r]);return n.useLayoutEffect(()=>{d.current&&u(d.current.parentNode)},[]),t.jsxs(t.Fragment,{children:[o&&(c?t.jsx(Je,{onCancel:l,position:e,align:r,autoFit:s,width:x,...a,children:i}):t.jsx(Me,{children:t.jsx(Se,{parent:o,at:f,onCancel:l,width:x,...a,children:i})})),t.jsx("span",{ref:d,className:"wx-portal-node wx-32GZ52"})]})}const Ge=["#00a037","#37a9ef","#f5a623","#ff4c3b","#a0a0a0","#000000","#ffffff"];function Ue({colors:e=Ge,value:r="",onChange:s,id:c,clear:l=!1,placeholder:x="",title:i="",disabled:a=!1,error:o=!1,dropdown:u={}}){const d=U(c),[f,v]=n.useState(r),[j,m]=n.useState(!1),w=n.useCallback((g,y)=>{g.stopPropagation(),v(y),m(!1),s&&s({value:y})},[s]),h=n.useCallback(g=>{g.stopPropagation(),v(""),s&&s({value:""})},[s]),p=n.useCallback(()=>{if(a)return!1;m(!0)},[a]);return t.jsxs("div",{className:"wx-121TgJ wx-colorselect",onClick:p,children:[t.jsx("input",{className:"wx-121TgJ wx-input"+(o?" wx-error":"")+(j?" wx-focus":""),title:i,value:f,readOnly:!0,id:d,placeholder:x,disabled:a}),l&&f&&!a&&t.jsx("i",{className:"wx-121TgJ wx-clear wxi-close",onClick:h}),f?t.jsx("div",{className:"wx-121TgJ wx-color wx-selected",style:{backgroundColor:f||"#00a037"}}):t.jsx("div",{className:"wx-121TgJ wx-empty wx-selected"}),j&&t.jsx(K,{onCancel:()=>m(!1),...u,children:t.jsxs("div",{className:"wx-121TgJ wx-colors",children:[t.jsx("div",{className:"wx-121TgJ wx-empty",onClick:g=>w(g,"")}),e.map((g,y)=>t.jsx("div",{className:"wx-121TgJ wx-color",style:{backgroundColor:g},onClick:C=>w(C,g)},y))]})})]})}function we(e,r){const s=e.firstChild,{moveBlockSlider:c,moveLineSlider:l}=r||{};function x(o){i(o),s.focus(),window.addEventListener("mousemove",i),window.addEventListener("mouseup",a)}function i(o){let u,d,f,v;const j=e.getBoundingClientRect();u=j.left,d=j.top,f=o.clientX-u,v=o.clientY-d,c&&r.moveBlockSlider(f,v),l&&r.moveLineSlider(f)}function a(){s.blur(),window.removeEventListener("mousemove",i),window.removeEventListener("mouseup",a)}return e.addEventListener("mousedown",x),{destroy(){e.removeEventListener("mousedown",x)}}}const X={_toHex:["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"],toHex(e,r){e=parseInt(e,10);let s="";for(;e>0;)s=this._toHex[e%16]+s,e=Math.floor(e/16);for(;s.length<r;)s=`0${s}`;return s},rgbToHex(e){let r=[];return typeof e=="string"?e.replace(/[\d+.]+/g,s=>r.push(parseFloat(s))):Array.isArray(e)&&(r=e),r[3]===0?"":r.slice(0,3).map(s=>this.toHex(Math.floor(s),2)).join("")},hexToDec(e){return parseInt(e,16)},hexToRgb(e){e=e.charAt(0)==="#"?e.slice(1):e;const r=e.match(/.{1,2}/g);let[s,c,l]=r;return s=this.hexToDec(s),c=this.hexToDec(c),l=this.hexToDec(l),[s,c,l]},hsvToRgb(e,r,s){let c,l,x,i,a,o,u,d;switch(c=Math.floor(e/60)%6,l=e/60-c,x=s*(1-r),i=s*(1-l*r),a=s*(1-(1-l)*r),o=0,u=0,d=0,c){case 0:o=s,u=a,d=x;break;case 1:o=i,u=s,d=x;break;case 2:o=x,u=s,d=a;break;case 3:o=x,u=i,d=s;break;case 4:o=a,u=x,d=s;break;case 5:o=s,u=x,d=i;break}return o=Math.floor(o*255),u=Math.floor(u*255),d=Math.floor(d*255),[o,u,d]},rgbToHsv(e,r,s){let c,l,x;e/=255,r/=255,s/=255;let i=Math.min(e,r,s),a=Math.max(e,r,s);return l=0,c=a===0?0:1-i/a,x=a,a===i?l=0:a===e&&r>=s?l=60*(r-s)/(a-i)+0:a===e&&r<s?l=60*(r-s)/(a-i)+360:a===r?l=60*(s-e)/(a-i)+120:a===s&&(l=60*(e-r)/(a-i)+240),[l,c,x]},hexToHvs(e){const r=this.hexToRgb(e);return this.rgbToHsv(...r)},hvsToHex(e,r,s){const c=this.hsvToRgb(e,r,s);return"#"+this.rgbToHex(c).toUpperCase()}},_e=e=>/^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(e);function me(e){return e?(e=e.toString(16),e.charAt(0)==="#"&&(e=e.slice(1)),_e(e)?(e.length===3&&(e=e.slice(0,3).split("").reduce((r,s)=>r+s+s,"")),`#${e.toUpperCase()}`):null):null}function _(){return H.locale(ie.en)}const pe="Block",he="Line";function De({value:e="#65D3B3",button:r=!1,onChange:s}){const c=(n.useContext(J)||_()).getGroup("core"),l=n.useRef(null),x=n.useRef(null),[i,a]=n.useState(),[o,u]=n.useState(),[d,f]=n.useState(),[v,j]=n.useState(),[m,w]=I.useWritableProp(e),[h,p]=n.useState(e),g=n.useRef(null),y=n.useRef(null),C=n.useMemo(()=>me(m)||"#65D3B3",[m]),N=n.useMemo(()=>X.hvsToHex(d||0,1,1),[d]),k=n.useCallback((T,$)=>{const{width:V,height:L}=l.current.getBoundingClientRect();$<0?$=0:$>L&&($=L),T<0?T=0:T>V&&(T=V),a($),u(T);let O,W;const D=V/100,B=L/100;O=Math.ceil(T/D)/100,W=Math.ceil(Math.abs($/B-100))/100;const Y=X.hvsToHex(d,O,W);w(Y),p(Y),s&&s({value:Y,input:!0})},[C,d,s]),S=n.useCallback(T=>{const $=x.current.getBoundingClientRect().width;T<0?T=0:T>$&&(T=$);const V=Math.round(T*359/$),L=Math.max(Math.min(V,359),0);f(L),j(T);let O,W;[,O,W]=X.hexToHvs(C);const D=X.hvsToHex(L,O,W);w(D),p(D),s&&s({value:D,input:!0})},[C,s]);g.current=k,y.current=S;const M=n.useCallback(T=>{const[$,V,L]=X.hexToHvs(T||C);if(f($),l.current){const{width:O,height:W}=l.current.getBoundingClientRect();x.current&&j($*x.current.getBoundingClientRect().width/359),u(V*O),a(Math.abs(W*(L-1)))}},[C]),R=n.useCallback(({target:T})=>{const $=me(T.value);p(T.value),$&&(w($),s&&s({value:$,input:!0}),M($))},[s,M]),P=n.useCallback(T=>{T.stopPropagation(),s&&s({value:C})},[C,s]),A=n.useCallback(T=>{const $=T.target,V=$.getAttribute("data-slider")===pe,L=$.getAttribute("data-slider")===he;let O=window.getComputedStyle($),W=parseFloat(O.left),D=parseFloat(O.top);const B=T.code;if(V){switch(B){case"ArrowLeft":{W--;break}case"ArrowRight":{W++;break}case"ArrowDown":{D++;break}case"ArrowUp":{D--;break}default:return}k(W,D)}if(L){if(B==="ArrowLeft"||B==="ArrowDown")W--;else if(B==="ArrowRight"||B==="ArrowUp")W++;else return;S(W)}T.preventDefault()},[k,S]);n.useEffect(()=>{const T=[];return l.current&&T.push(we(l.current,{moveBlockSlider:($,V)=>{g.current?.($,V)}}).destroy),x.current&&T.push(we(x.current,{moveLineSlider:$=>{y.current?.($)}}).destroy),requestAnimationFrame(()=>M()),()=>{T.forEach($=>$())}},[]);const F="wx-1yoKzq";return t.jsxs("div",{className:F+" wx-colorboard",children:[t.jsx("div",{className:F+" wx-color-block",style:{background:N},ref:l,children:t.jsx("div",{className:F+" wx-color-block-slider wx-slider",style:{background:C,top:i+"px",left:o+"px"},tabIndex:0,"data-slider":pe,onKeyDown:A})}),t.jsx("div",{className:F+" wx-color-line",ref:x,children:t.jsx("div",{className:F+" wx-color-line-slider wx-slider",style:{background:N,left:v+"px"},tabIndex:0,"data-slider":he,onKeyDown:A})}),t.jsxs("div",{className:F+" wx-color-controls",children:[t.jsx("div",{className:F+" wx-color",style:{background:C}}),t.jsx("input",{type:"text",className:F+" wx-text",value:h,onChange:R})]}),r&&t.jsx(Q,{onClick:P,type:"secondary",children:c("select")})]})}function qe({value:e="",id:r,placeholder:s="",title:c="",disabled:l=!1,error:x=!1,clear:i=!1,onChange:a,dropdown:o={}}){const u=U(r);let[d,f]=I.useWritableProp(e);const[v,j]=n.useState(!1);function m(){if(l)return!1;j(!0)}function w(p){if(p.input)return;j(!1);const g=p.value;f(g),a&&a({value:g})}function h(p){p.stopPropagation(),f(""),a&&a({value:""})}return t.jsxs("div",{className:"wx-mmT8WH wx-colorpicker",onClick:m,children:[t.jsx("input",{className:"wx-mmT8WH wx-input"+(x?" wx-error":"")+(v?" wx-focus":""),title:c,value:d,readOnly:!0,id:u,placeholder:s,disabled:l}),t.jsx("div",{className:"wx-mmT8WH wx-color",style:{background:d}}),i&&!l&&d&&t.jsx("i",{className:"wx-mmT8WH wxi-close",onClick:h}),v&&t.jsx(K,{onCancel:()=>j(!1),...o,children:t.jsx(De,{value:d,button:"true",onChange:w})})]})}function Qe(){let e=null,r=!1,s=!1,c,l,x,i;const a=(j,m,w,h,p)=>{c=j,l=m,x=w,i=h,s=p},o=j=>{e=j,r=e!==null,x(e)},u=(j,m)=>{if(!s&&j!==null&&c){const w=c.querySelectorAll(".wx-list > .wx-item")[j];w&&(w.scrollIntoView({block:"nearest"}),m&&m.preventDefault())}},d=(j,m)=>{const w=j===null?null:Math.max(0,Math.min(e+j,l.length-1));w!==e&&(o(w),c?u(w,m):requestAnimationFrame(()=>u(w,m)))};return{move:j=>{const m=H.locateID(j),w=l.findIndex(h=>h.id===m);w!==e&&o(w)},keydown:(j,m)=>{switch(j.code){case"Enter":r?i():o(0);break;case"Space":r||o(0);break;case"Escape":x(e=null);break;case"Tab":x(e=null);break;case"ArrowDown":d(r?1:m||0,j);break;case"ArrowUp":d(r?-1:m||0,j);break}},init:a,navigate:d}}const ve=10,Ke=n.memo(function({data:r,checkboxes:s,children:c,value:l}){return t.jsxs(t.Fragment,{children:[s&&t.jsx(xe,{id:r.id,style:{marginRight:"8px",pointerEvents:"none"},value:l&&l.includes(r.id)}),c?I.snippet(c,{option:r}):r.label]})});function je({visibleItems:e,visibleRange:r,navIndex:s,checkboxes:c,children:l,value:x,measureRefCallback:i}){return e.map((a,o)=>{const u=r.start+o;return t.jsx("div",{ref:o===0?i:void 0,className:`wx-233fr7 wx-item ${u===s?"wx-focus":""}`,"data-id":a.id,children:t.jsx(Ke,{data:a,checkboxes:c,children:l,value:x})},a.id)})}function re({items:e=[],children:r,onSelect:s,onReady:c,virtualized:l=!1,checkboxes:x,multiselect:i,value:a,...o}){const u=n.useRef(),d=n.useRef(!1),f=n.useRef(Qe()),[v,j]=n.useState(null),m=n.useRef(v),[w,h]=n.useState(0),[p,g]=n.useState(24),y=n.useRef(!1),C=(n.useContext(J)||_()).getGroup("core"),N=n.useRef(e);n.useEffect(()=>{N.current=e},[e]);const k=n.useRef(a);n.useEffect(()=>{k.current=a},[a]);const S=n.useRef(0);n.useEffect(()=>{S.current=p},[p]);const M=n.useCallback(b=>{b&&b.stopPropagation();const E=N.current,G=k.current,z=m.current;let q;const Z=E[z]?.id;i?G&&G.includes(Z)?q=G.filter(ae=>ae!==Z):q=[...G||[],Z]:q=Z,s&&s({id:q})},[i,s]),R=n.useRef(M);n.useEffect(()=>{R.current=M},[M]);const P=n.useCallback(b=>{if(u.current){let E=b*S.current-u.current.clientHeight+S.current;h(E),u.current.scrollTop=E}},[S.current]),A=n.useCallback(b=>{u.current=b,l&&(b&&!d.current&&m.current!==null&&requestAnimationFrame(()=>{u.current&&(P(m.current),d.current=!0)}),b||(d.current=!1))},[P]),F=n.useCallback(b=>{if(!b||y.current)return;const E=b.getBoundingClientRect().height;E&&(g(E),S.current=E,y.current=!0)},[]);n.useEffect(()=>{f.current.init(u.current,e,b=>{j(b),m.current=b},b=>R.current(b),l)},[e,u.current,l]),n.useEffect(()=>{const b=(G,z)=>{f.current.navigate(G,z),P(m.current)},E=(G,z)=>{const q=m.current,Z=N.current;if(q!==0&&q!==Z.length-1&&(G.key==="ArrowDown"||G.key==="ArrowUp")&&G.preventDefault(),f.current.keydown(G,z),u.current){const ae=u.current.scrollTop<=m.current*S.current,We=u.current.scrollTop+u.current.clientHeight>=m.current*S.current+S.current;ae?We||P(m.current):(u.current.scrollTop=m.current*S.current,h(u.current.scrollTop))}};c&&c({navigate:l?b:f.current.navigate,keydown:l?E:f.current.keydown,move:f.current.move})},[]);const T=n.useRef(0),$=n.useRef(e);$.current!==e&&($.current=e,T.current+=1);const V=n.useCallback(()=>{f.current.navigate(null)},[f]),L=n.useCallback(b=>{l&&h(b.target.scrollTop)},[l]),O=n.useMemo(()=>Math.ceil((u.current?.clientHeight||0)/p),[p,w]),W=n.useMemo(()=>{if(!l)return{start:0,end:e.length};if(!e.length)return{start:0,end:0};const b=Math.floor(w/p),E=b+O;return{start:Math.max(0,b-ve),end:Math.min(e.length,E+ve)}},[l,e,w,p,O]),D=n.useMemo(()=>{if(!l)return e;const{start:b,end:E}=W;return e.slice(b,E).map(G=>({...G}))},[l,e,W]),B=W.start*p,Y=e.length*p;return n.useEffect(()=>{v===null&&(d.current=!1)},[v]),v===null?null:t.jsx(K,{onCancel:V,...o,children:t.jsx("div",{className:"wx-233fr7 wx-list",ref:A,onClick:M,onMouseMove:f.current.move,onScroll:L,children:e.length?l?t.jsx("div",{className:"wx-233fr7 wx-list-wrapper",style:{height:`${Y}px`},children:t.jsx("div",{className:"wx-233fr7 wx-list-content",style:{transform:`translateY(${B}px)`},children:t.jsx(je,{visibleRange:W,visibleItems:D,navIndex:v,measureRefCallback:F,checkboxes:x,children:r,value:a})})}):t.jsx(je,{visibleRange:W,visibleItems:D,navIndex:v,measureRefCallback:F,checkboxes:x,children:r,value:a}):t.jsx("div",{className:"wx-233fr7 wx-no-data",children:C("No data")})})},T.current)}function Ze({value:e="",id:r,options:s=[],textOptions:c=null,textField:l="label",placeholder:x="",title:i="",disabled:a=!1,error:o=!1,clear:u=!1,children:d,onChange:f,dropdown:v={}}){const j=U(r),m=n.useRef(null),w=n.useRef(null),[h,p]=I.useWritableProp(e),[g,y]=n.useState(!1),[C,N]=n.useState(""),k=n.useRef(null),S=n.useRef(!1),M=n.useMemo(()=>{if(g)return C;if(h||h===0){const D=(c||s).find(B=>B.id===h);if(D)return D[l]}return""},[g,C,h,c,s,l]),R=n.useMemo(()=>!M||!g?s:s.filter(D=>D[l].toLowerCase().includes(M.toLowerCase())),[M,g,s,l]),P=n.useCallback(()=>R.findIndex(D=>D.id===h),[R,h]),A=n.useCallback(D=>{m.current=D.navigate,w.current=D.keydown},[]),F=n.useCallback((D,B)=>{if(D||D===0){let Y=s.find(b=>b.id===D);if(y(!1),B&&m.current(null),Y&&h!==Y.id){const b=Y.id;p(b),f&&f({value:b})}}!S.current&&B&&k.current.focus()},[s,h,f]),T=n.useCallback(({id:D})=>{F(D,!0)},[F]),$=n.useCallback(D=>{D&&D.stopPropagation(),p(""),y(!1),f&&f({value:""})},[f]),V=n.useCallback(D=>{if(!s.length)return;if(D===""&&u){$();return}let B=s.find(b=>b[l]===D);B||(B=s.find(b=>b[l].toLowerCase().includes(D.toLowerCase())));const Y=B?B.id:h||s[0].id;F(Y,!1)},[s,l,u,h,F,$]),L=n.useCallback(()=>{N(k.current.value),y(!0),R.length&&m.current(0)},[R.length,m]),O=n.useCallback(()=>{S.current=!0},[]),W=n.useCallback(()=>{S.current=!1,setTimeout(()=>{S.current||V(M)},200)},[V,M]);return t.jsxs("div",{className:"wx-1j11Jk wx-combo",onClick:()=>m.current(P()),onKeyDown:D=>w.current(D,P()),title:i,children:[t.jsx("input",{className:"wx-1j11Jk wx-input "+(o?"wx-error":""),id:j,ref:k,value:M,disabled:a,placeholder:x,onFocus:O,onBlur:W,onInput:L}),u&&!a&&h?t.jsx("i",{className:"wx-1j11Jk wx-icon wxi-close",onClick:$}):t.jsx("i",{className:"wx-1j11Jk wx-icon wxi-angle-down"}),!a&&t.jsx(re,{items:R,onReady:A,onSelect:T,...v,children:({option:D})=>t.jsx(t.Fragment,{children:d?d({option:D}):D[l]})})]})}function le({value:e="",id:r,readonly:s=!1,focus:c=!1,select:l=!1,type:x="text",placeholder:i="",disabled:a=!1,error:o=!1,inputStyle:u={},title:d="",css:f="",icon:v="",clear:j=!1,onChange:m}){const w=U(r),[h,p]=I.useWritableProp(e),g=n.useRef(null),y=n.useMemo(()=>v&&f.indexOf("wx-icon-left")===-1?"wx-icon-right "+f:f,[v,f]),C=n.useMemo(()=>v&&f.indexOf("wx-icon-left")!==-1,[v,f]);n.useEffect(()=>{const R=setTimeout(()=>{c&&g.current&&g.current.focus(),l&&g.current&&g.current.select()},1);return()=>clearTimeout(R)},[c,l]);const N=n.useCallback(R=>{const P=R.target.value;p(P),m&&m({value:P,input:!0})},[m]),k=n.useCallback(R=>m&&m({value:R.target.value}),[m]);function S(R){R.stopPropagation(),p(""),m&&m({value:""})}let M=x;return x!=="password"&&x!=="number"&&(M="text"),n.useEffect(()=>{const R=k,P=g.current;return P.addEventListener("change",R),()=>{P&&P.removeEventListener("change",R)}},[k]),t.jsxs("div",{className:`wx-hQ64J4 wx-text ${y} ${o?"wx-error":""} ${a?"wx-disabled":""} ${j?"wx-clear":""}`,children:[t.jsx("input",{className:"wx-hQ64J4 wx-input",ref:g,id:w,readOnly:s,disabled:a,placeholder:i,type:M,style:u,title:d,value:h,onInput:N}),j&&!a&&h?t.jsxs(t.Fragment,{children:[t.jsx("i",{className:"wx-hQ64J4 wx-icon wxi-close",onClick:S}),C&&t.jsx("i",{className:`wx-hQ64J4 wx-icon ${v}`})]}):v?t.jsx("i",{className:`wx-hQ64J4 wx-icon ${v}`}):null]})}function ze({date:e,type:r,part:s,onShift:c}){const{calendar:l,formats:x}=n.useContext(J).getRaw(),i=e.getFullYear(),a=n.useMemo(()=>{switch(r){case"month":return H.dateToString(x.monthYearFormat,l)(e);case"year":return H.dateToString(x.yearFormat,l)(e);case"duodecade":{const{start:u,end:d}=H.getDuodecade(i),f=H.dateToString(x.yearFormat,l);return`${f(new Date(u,0,1))} - ${f(new Date(d,11,31))}`}default:return""}},[e,r,i,l,x]);function o(){c&&c({diff:0,type:r})}return t.jsxs("div",{className:"wx-8HQVQV wx-header",children:[s!=="right"?t.jsx("i",{className:"wx-8HQVQV wx-pager wxi-angle-left",onClick:()=>c&&c({diff:-1,type:r})}):t.jsx("span",{className:"wx-8HQVQV wx-spacer"}),t.jsx("span",{className:"wx-8HQVQV wx-label",onClick:o,children:a}),s!=="left"?t.jsx("i",{className:"wx-8HQVQV wx-pager wxi-angle-right",onClick:()=>c&&c({diff:1,type:r})}):t.jsx("span",{className:"wx-8HQVQV wx-spacer"})]})}function de({onClick:e,children:r}){return t.jsx("button",{className:"wx-3s8W4d wx-button",onClick:e,children:r})}function Ve({value:e,current:r,part:s="",markers:c=null,onCancel:l,onChange:x}){const i=(n.useContext(J)||_()).getRaw().calendar,a=(i.weekStart||7)%7,o=i.dayShort.slice(a).concat(i.dayShort.slice(0,a)),u=(C,N,k)=>new Date(C.getFullYear(),C.getMonth()+(N||0),C.getDate()+(k||0));let d=s!=="normal";function f(C){const N=C.getDay();return N===0||N===6}function v(){const C=u(r,0,1-r.getDate());return C.setDate(C.getDate()-(C.getDay()-(a-7))%7),C}function j(){const C=u(r,1,-r.getDate());return C.setDate(C.getDate()+(6-C.getDay()+a)%7),C}const m=n.useRef(0);function w(C,N){N.timeStamp!==m.current&&(m.current=N.timeStamp,N.stopPropagation(),x&&x(new Date(C)),l&&l())}const h=n.useMemo(()=>s=="normal"?[e?u(e).valueOf():0]:e?[e.start?u(e.start).valueOf():0,e.end?u(e.end).valueOf():0]:[0,0],[s,e]),p=n.useMemo(()=>{const C=v(),N=j(),k=r.getMonth();let S=[];for(let M=C;M<=N;M.setDate(M.getDate()+1)){const R={day:M.getDate(),in:M.getMonth()===k,date:M.valueOf()};let P="";if(P+=R.in?"":" wx-inactive",P+=h.indexOf(R.date)>-1?" wx-selected":"",d){const A=R.date==h[0],F=R.date==h[1];A&&!F?P+=" wx-left":F&&!A&&(P+=" wx-right"),R.date>h[0]&&R.date<h[1]&&(P+=" wx-inrange")}if(P+=f(M)?" wx-weekend":"",c){const A=c(M);A&&(P+=" "+A)}S.push({...R,css:P})}return S},[r,h,d,c]),g=n.useRef(null);let y=n.useRef({});return y.current.click=w,n.useEffect(()=>{H.delegateClick(g.current,y.current)},[]),t.jsxs("div",{children:[t.jsx("div",{className:"wx-398RBS wx-weekdays",children:o.map(C=>t.jsx("div",{className:"wx-398RBS wx-weekday",children:C},C))}),t.jsx("div",{className:"wx-398RBS wx-days",ref:g,children:p.map(C=>t.jsx("div",{className:`wx-398RBS wx-day ${C.css} ${C.in?"":"wx-out"}`,"data-id":C.date,children:C.day},C.date))})]})}function Xe({value:e,current:r,part:s,onCancel:c,onChange:l,onShift:x}){const i=n.useRef(new Date),[a,o]=I.useWritableProp(e||i.current),[u,d]=I.useWritableProp(r||i.current),f=n.useContext(J).getRaw().calendar,v=f.monthShort||[],j=n.useMemo(()=>u.getMonth(),[u]),m=n.useCallback((p,g)=>{if(p!=null){g.stopPropagation();const y=new Date(u);y.setMonth(p),d(y),x&&x({current:y})}s==="normal"&&o(new Date(u)),c&&c()},[u,s,x,c]),w=n.useCallback(()=>{const p=new Date(Te(a,s)||u);p.setMonth(u.getMonth()),p.setFullYear(u.getFullYear()),l&&l(p)},[a,u,s,l]),h=n.useCallback(p=>{const g=p.target.closest("[data-id]");if(g){const y=parseInt(g.getAttribute("data-id"),10);m(y,p)}},[m]);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"wx-34U8T8 wx-months",onClick:h,children:v.map((p,g)=>t.jsx("div",{className:"wx-34U8T8 wx-month"+(j===g?" wx-current":""),"data-id":g,children:p},g))}),t.jsx("div",{className:"wx-34U8T8 wx-buttons",children:t.jsx(de,{onClick:w,children:f.done})})]})}const ce="wx-1XEF33",et=({value:e,current:r,onCancel:s,onChange:c,onShift:l,part:x})=>{const i=n.useContext(J).getRaw().calendar,[a,o]=I.useWritableProp(r),[u,d]=I.useWritableProp(e),f=n.useMemo(()=>a.getFullYear(),[a]),v=n.useMemo(()=>{const{start:p,end:g}=H.getDuodecade(f),y=[];for(let C=p;C<=g;++C)y.push(C);return y},[f]),j={click:m};function m(p,g){if(p){g.stopPropagation();const y=new Date(a);y.setFullYear(p),o(y),l&&l({current:y})}x==="normal"&&d(new Date(a)),s&&s()}function w(){const p=new Date(Te(u,x)||a);p.setFullYear(a.getFullYear()),c&&c(p)}const h=n.useRef(null);return n.useEffect(()=>{h.current&&H.delegateClick(h.current,j)},[]),t.jsxs(t.Fragment,{children:[t.jsx("div",{className:ce+" wx-years",ref:h,children:v.map((p,g)=>t.jsx("div",{className:ce+` wx-year ${f==p?"wx-current":""} ${g===0?"wx-prev-decade":""} ${g===11?"wx-next-decade":""}`,"data-id":p,children:p},g))}),t.jsx("div",{className:ce+" wx-buttons",children:t.jsx(de,{onClick:w,children:i.done})})]})},ge={month:{component:Ve,next:nt,prev:tt},year:{component:Xe,next:rt,prev:st},duodecade:{component:et,next:at,prev:lt}};function tt(e){return e=new Date(e),e.setMonth(e.getMonth()-1),e}function nt(e){return e=new Date(e),e.setMonth(e.getMonth()+1),e}function st(e){return e=new Date(e),e.setFullYear(e.getFullYear()-1),e}function rt(e){return e=new Date(e),e.setFullYear(e.getFullYear()+1),e}function lt(e){return e=new Date(e),e.setFullYear(e.getFullYear()-10),e}function at(e){return e=new Date(e),e.setFullYear(e.getFullYear()+10),e}function Te(e,r){let s;if(r==="normal")s=e;else{const{start:c,end:l}=e;r==="left"?s=c:r=="right"?s=l:s=c&&l}return s}const ct=["clear","today"];function ot(e){if(e==="done")return-1;if(e==="clear")return null;if(e==="today")return new Date}function ne({value:e,current:r,onCurrentChange:s,part:c="normal",markers:l=null,buttons:x,onShift:i,onChange:a}){const o=n.useContext(J).getGroup("calendar"),[u,d]=n.useState("month"),f=Array.isArray(x)?x:x?ct:[],v=(p,g)=>{p.preventDefault(),a&&a({value:g})},j=()=>{u==="duodecade"?d("year"):u==="year"&&d("month")},m=p=>{const{diff:g,current:y}=p;if(g===0){u==="month"?d("year"):u==="year"&&d("duodecade");return}if(g){const C=ge[u];s(g>0?C.next(r):C.prev(r))}else y&&s(y);i&&i()},w=p=>{d("month"),a&&a({select:!0,value:p})},h=n.useMemo(()=>ge[u].component,[u]);return t.jsx("div",{className:`wx-2Gr4AS wx-calendar ${c!=="normal"&&c!=="both"?"wx-part":""}`,children:t.jsxs("div",{className:"wx-2Gr4AS wx-wrap",children:[t.jsx(ze,{date:r,part:c,type:u,onShift:m}),t.jsxs("div",{children:[t.jsx(h,{value:e,current:r,onCurrentChange:s,part:c,markers:l,onCancel:j,onChange:w,onShift:m}),u==="month"&&f.length>0&&t.jsx("div",{className:"wx-2Gr4AS wx-buttons",children:f.map(p=>t.jsx("div",{className:"wx-2Gr4AS wx-button-item",children:t.jsx(de,{onClick:g=>v(g,ot(p)),children:o(p)})},p))})]})]})})}function se(e){let{words:r=null,optional:s=!1,children:c}=e,l=n.useContext(J);const x=n.useMemo(()=>{let i=l;return(!i||!i.extend)&&(i=H.locale(ie.en)),r!==null&&(i=i.extend(r,s)),i},[r,s,l]);return t.jsx(J.Provider,{value:x,children:c})}function ke(e,r,s,c){if(!e||c){const l=r?new Date(r):new Date;l.setDate(1),s(l)}else if(e.getDate()!==1){const l=new Date(e);l.setDate(1),s(l)}}const ut=["clear","today"];function Pe({value:e,current:r,markers:s=null,buttons:c=ut,onChange:l}){const[x,i]=I.useWritableProp(e),[a,o]=I.useWritableProp(r);n.useEffect(()=>{ke(a,x,o,!1)},[x,a]);const u=n.useCallback(f=>{const v=f.value;v?(i(new Date(v)),ke(a,new Date(v),o,!0)):i(null),l&&l({value:v?new Date(v):null})},[l,a]),d=n.useCallback(f=>{o(f)},[o]);return a?t.jsx(se,{children:t.jsx(ne,{value:x,current:a,markers:s,buttons:c,onChange:u,onCurrentChange:d})}):null}function fe(e){return e||(e={}),e.width||(e.width="unset"),e}const it=["clear","today"];function xt({value:e,id:r,disabled:s=!1,error:c=!1,placeholder:l="",format:x="",buttons:i=it,css:a="",title:o="",editable:u=!1,clear:d=!1,onChange:f,dropdown:v={}}){const{calendar:j,formats:m}=(n.useContext(J)||_()).getRaw(),w=x||m?.dateFormat;let h=typeof w=="function"?w:H.dateToString(w,j);const[p,g]=n.useState(e),[y,C]=n.useState(!1);n.useEffect(()=>{g(e)},[e]);function N(){C(!1)}function k(R){const P=R===p||R&&p&&R.valueOf()===p.valueOf()||!R&&!p;g(R),P||f&&f({value:R}),setTimeout(N,1)}const S=n.useMemo(()=>p?h(p):"",[p,h]);function M({value:R,input:P}){if(!u&&!d||P)return;let A=typeof u=="function"?u(R):R?new Date(R):null;A=isNaN(A)?p||null:A||null,k(A)}return n.useEffect(()=>{const R=N;return window.addEventListener("scroll",R),()=>window.removeEventListener("scroll",R)},[]),t.jsxs("div",{className:"wx-1lKOFG wx-datepicker",onClick:()=>C(!0),children:[t.jsx(le,{css:a,title:o,value:S,id:r,readonly:!u,disabled:s,error:c,placeholder:l,onInput:N,onChange:M,icon:"wxi-calendar",inputStyle:{cursor:"pointer",width:"100%",paddingRight:"calc(var(--wx-input-icon-size) + var(--wx-input-icon-indent) * 2)"},clear:d}),y&&!s&&t.jsx(K,{onCancel:N,...fe(v),children:t.jsx(Pe,{buttons:i,value:p,onChange:R=>k(R.value)})})]})}const dt=["clear","today"],Fe=({start:e,end:r,current:s,months:c=2,markers:l=null,buttons:x=dt,onChange:i})=>{const[a,o]=I.useWritableProp(e),[u,d]=I.useWritableProp(r),[f,v]=n.useState(),[j,m]=n.useState(),w=n.useCallback((N,k,S)=>{const M=new Date(N);return M.setMonth(M.getMonth()+k),S&&M.valueOf()===S.valueOf()?S:M},[]),h=n.useCallback(N=>{v(()=>{const k=new Date(N);return k.setDate(1),m(w(k,1)),k})},[w]),p=n.useCallback(N=>{m(()=>{const k=new Date(N);return k.setDate(1),v(w(k,-1)),k})},[w]);n.useEffect(()=>{const N=a;f||h(N?new Date(N):s||new Date)},[a,s,f,h]);const g=n.useCallback(N=>{const k=N.value;let S=a,M=u;const R=k===-1;return R||(N.select?!a||u?(o(S=k),d(M=null)):a>k?(d(M=a),o(S=k)):d(M=k):k?(o(S=new Date(k)),d(M=new Date(k))):(o(S=null),d(M=null))),(R||!x.includes("done"))&&i&&i({start:S,end:M}),[S,M]},[a,u,x,i]),y=n.useCallback(N=>{const[k]=g(N);k&&h(new Date(k))},[h,a,u]),C=n.useCallback(N=>{const[,k]=g(N);k&&p(new Date(k))},[p,a,u]);return!f||!j?null:c===1?t.jsx(se,{children:t.jsx(ne,{value:{start:a,end:u},current:f,markers:l,buttons:x,part:"both",onChange:y,onCurrentChange:h})}):t.jsx(se,{children:t.jsxs("div",{className:"wx-p2jCaW wx-rangecalendar",children:[t.jsx("div",{className:"wx-p2jCaW wx-half",children:t.jsx(ne,{value:{start:a,end:u},current:f,markers:l,buttons:!1,part:"left",onChange:y,onCurrentChange:h})}),t.jsx("div",{className:"wx-p2jCaW wx-half",children:t.jsx(ne,{value:{start:a,end:u},current:j,markers:l,buttons:x,part:"right",onChange:C,onCurrentChange:p})})]})})},ft=["clear","today"],wt=({value:e,onChange:r,id:s,disabled:c=!1,error:l=!1,placeholder:x="",css:i="",title:a="",format:o="",months:u=2,buttons:d=ft,editable:f=!1,clear:v=!1,dropdown:j})=>{const[m,w]=I.useWritableProp(e),{calendar:h,formats:p}=(n.useContext(J)||_()).getRaw(),g=o||p?.dateFormat,y=typeof g=="function"?g:H.dateToString(g,h),[C,N]=n.useState(!1),k=n.useCallback(()=>{N(!1)},[]),S=n.useMemo(()=>m?m.start?y(m.start)+(m.end?` - ${y(m.end)}`:""):y(m):"",[m,y]),M=n.useMemo(()=>m&&m.start||null,[m]),R=n.useMemo(()=>m&&m.end||null,[m]),P=n.useCallback(F=>{const T=F.start||F.end?{start:F.start,end:F.end}:null;w&&w(T),(F.start&&F.end||!F.start&&!F.end)&&(r&&r({value:T}),setTimeout(k,1))},[r,k,w]),A=n.useCallback(F=>{if(!f&&!v)return;const{value:T,input:$}=F;if($)return;const[V,L]=T.split(" -").map((O,W)=>{const D=O.trim();let B=typeof f=="function"?f(D):D?new Date(D):null,Y=W===0?M:R;return isNaN(B)?Y||null:B||null});P({start:V,end:L})},[f,v,M,R,P]);return n.useEffect(()=>{const F=()=>{k()};return window.addEventListener("scroll",F),()=>{window.removeEventListener("scroll",F)}},[k]),t.jsxs("div",{className:`wx-1b0WDQ wx-daterangepicker ${c?"wx-disabled":""} ${l?"wx-error":""}`,onClick:()=>N(!0),children:[t.jsx(le,{css:i,title:a,value:S,id:s,readonly:!f,disabled:c,placeholder:x,error:l,onChange:A,icon:"wxi-calendar",inputStyle:{cursor:"pointer",width:"100%",paddingRight:"calc(var(--wx-input-icon-size) + var(--wx-input-icon-indent) * 2)"},clear:v}),C&&!c&&t.jsx(K,{onCancel:k,...fe(j),children:t.jsx(Fe,{onCancel:k,buttons:d,start:M,end:R,months:u,onChange:P})})]})};function mt({hotkey:e=null,toggleButton:r,children:s}){const c=n.useRef(null),[l,x]=n.useState(!1),i=n.useMemo(()=>`wxi-${l?"collapse":"expand"}`,[l]),a=n.useRef(null);return a.current=()=>{const o=c.current;!l&&o?o.requestFullscreen():l&&document.exitFullscreen(),x(u=>!u)},I.useHotkeys({[e]:()=>a.current()},c),n.useEffect(()=>{const o=()=>{x(document.fullscreenElement===c.current)};return document.addEventListener("fullscreenchange",o),()=>{document.removeEventListener("fullscreenchange",o)}},[]),t.jsxs("div",{className:"wx-13aa5W wx-fullscreen",ref:c,tabIndex:-1,children:[s,r?r(a.current,l):t.jsx(Q,{css:"wx-13aa5W wx-fullscreen-button",onClick:a.current,children:t.jsx("i",{className:`wx-13aa5W ${i} wx-fullscreen-icon`,children:" "})})]})}function pt({css:e="",title:r="",children:s,onClick:c}){return s?t.jsx("i",{title:r,role:"img",className:`wx-mdnST1 wx-icon ${e}`,onClick:c,children:s}):t.jsx("i",{title:r,className:`wx-mdnST1 wx-icon ${e}`,onClick:c})}const ht=[];function vt({id:e,value:r=ht,options:s=[],textOptions:c=null,textField:l="label",placeholder:x="",title:i="",disabled:a=!1,error:o=!1,checkboxes:u=!1,onChange:d,children:f,dropdown:v={}}){const j=U(e),m=n.useRef(null),w=n.useRef(null),[h,p]=I.useWritableProp(r),[g,y]=n.useState(""),[C,N]=n.useState(!1),k=n.useRef(null),S=n.useMemo(()=>h?(c||s).filter(V=>h.includes(V.id)):[],[h,c,s]),M=n.useMemo(()=>{const V=s;return g?V.filter(L=>L[l].toLowerCase().includes(g.toLowerCase())):V},[g,s,l]),R=n.useCallback(V=>{m.current=V.navigate,w.current=V.keydown},[]),P=n.useCallback(()=>{M.length?m.current(0):m.current(null)},[M]),A=n.useCallback(V=>{const{id:L}=V;L&&(p(L),d&&d({value:L}),k.current.focus())},[d]),F=n.useCallback((V,L)=>{L&&L.stopPropagation();const O=h.filter(W=>W!==V);p(O),d&&d({value:O})},[h,d]),T=n.useCallback(()=>h&&h.length?M.findIndex(V=>V.id===h[0]):0,[h,M]),$=n.useCallback(()=>{a||(k.current.focus(),m.current(T()))},[a,T]);return t.jsxs("div",{title:i,className:`wx-12Wj21 wx-multicombo ${o?"wx-error":""} ${a?"wx-disabled":""} ${S.length?"wx-not-empty":""} ${C&&!a?"wx-focus":""}`,onClick:$,onKeyDown:V=>w.current(V,T()),children:[t.jsxs("div",{className:"wx-12Wj21 wx-wrapper",children:[t.jsx("div",{className:"wx-12Wj21 wx-tags",children:S.map(V=>t.jsxs("div",{className:"wx-12Wj21 wx-tag",children:[f?I.snippet(f,{option:V}):V[l],!a&&t.jsx("i",{className:"wx-12Wj21 wx-icon wxi-close",onClick:L=>F(V.id,L)})]},V.id))}),t.jsxs("div",{className:"wx-12Wj21 wx-select",children:[t.jsx("input",{className:"wx-12Wj21 wx-input",id:j,type:"text",value:g,onChange:V=>y(V.target.value),onInput:P,placeholder:x,disabled:a,onFocus:()=>N(!0),onBlur:()=>N(!1),ref:k}),t.jsx("i",{className:"wx-12Wj21 wx-icon wxi-angle-down"})]})]}),!a&&t.jsx(re,{items:M,multiselect:!0,onReady:R,onSelect:A,checkboxes:u,value:h,...v,children:({option:V})=>t.jsx(t.Fragment,{children:f?I.snippet(f,{option:V}):V[l]})})]})}const jt=({total:e=0,pageSize:r=20,value:s=1,onChange:c})=>{const[l,x]=I.useWritableProp(r),[i,a]=I.useWritableProp(s),o=(n.useContext(J)||_()).getGroup("core"),u=Math.ceil(e/l),d=(i-1)*l,f=Math.min(i*l,e),v=(w,h)=>{Number.isNaN(w)||(h||a(w),w=Math.max(1,Math.min(w,u)),h&&a(w),w!==i&&setTimeout(()=>{c&&c({value:w,from:(w-1)*l,to:Math.min(w*l,e),pageSize:l})}))};function j(w){switch(w){case"first":v(1);break;case"prev":v(i-1);break;case"next":v(i+1);break;case"last":v(u);break}}const m=w=>{const h=w.target.value*1;Number.isNaN(h)||(x(h),c&&c({value:i,from:d,to:f,pageSize:h}))};return t.jsxs("div",{className:"wx-35Np0p wx-pager",children:[t.jsxs("div",{className:"wx-35Np0p wx-left",children:[t.jsxs("span",{children:[o("Rows per page"),": "]}),t.jsx("input",{type:"number",min:1,className:"wx-35Np0p wx-input",value:l,onChange:m})]}),t.jsxs("div",{className:"wx-35Np0p wx-center",children:[t.jsx("i",{className:"wx-35Np0p wx-icon wxi-angle-dbl-left"+(i===1?" wx-disabled":""),onClick:()=>j("first")}),t.jsx("i",{className:"wx-35Np0p wx-icon wxi-angle-left"+(i===1?" wx-disabled":""),onClick:()=>j("prev")}),t.jsx("input",{type:"text",value:i,className:"wx-35Np0p wx-input",onChange:w=>v(w.target.value*1),onBlur:w=>v(w.target.value*1,!0)}),t.jsx("i",{className:"wx-35Np0p wx-icon wxi-angle-right"+(i===u?" wx-disabled":""),onClick:()=>j("next")}),t.jsx("i",{className:"wx-35Np0p wx-icon wxi-angle-dbl-right"+(i===u?" wx-disabled":""),onClick:()=>j("last")})]}),t.jsxs("div",{className:"wx-35Np0p wx-right",children:[o("Total pages"),": ",u]})]})};function $e({id:e,label:r="",value:s,name:c="",inputValue:l="",disabled:x=!1,onChange:i}){const a=n.useId(),o=U(e)||a,[u,d]=n.useState(!1),f=s!==void 0,v=f?s:u;function j(m){const w=m.target.checked;f||d(w),w&&i&&i({value:!0,inputValue:l})}return t.jsxs("div",{className:"wx-3lDF1s wx-radio",children:[t.jsx("input",{type:"radio",className:"wx-3lDF1s wx-input",id:o,disabled:x,name:c,value:l,checked:v,onChange:j}),t.jsxs("label",{htmlFor:o,className:"wx-3lDF1s wx-label",children:[t.jsx("span",{className:"wx-3lDF1s wx-circle"}),r&&t.jsx("span",{className:"wx-3lDF1s wx-radio-text",children:r})]})]})}function gt({options:e=[{}],value:r="",onChange:s,type:c=""}){const l=H.uid(),[x,i]=n.useState(r);n.useEffect(()=>{i(r)},[r]);function a(o){const u=o.inputValue;i(u),s&&s({value:u})}return t.jsx(te.Provider,{value:null,children:t.jsx("div",{className:`wx-38w70j wx-radiogroup ${c&&`wx-${c}`}`,children:e.map(o=>t.jsx("div",{className:"wx-38w70j wx-item",children:t.jsx($e,{label:o.label,inputValue:o.id,value:x===o.id,name:l,onChange:a})},o.id))})})}function kt({value:e="",options:r=[],textOptions:s=null,placeholder:c="",disabled:l=!1,error:x=!1,title:i="",textField:a="label",clear:o=!1,children:u,onChange:d,dropdown:f={}}){const v=n.useRef(null),j=n.useRef(null);let[m,w]=I.useWritableProp(e);function h(N){v.current=N.navigate,j.current=N.keydown}const p=n.useMemo(()=>m||m===0?(s||r).find(N=>N.id===m):null,[m,s,r]),g=n.useCallback(({id:N})=>{(N||N===0)&&(w(N),v.current(null),d&&d({value:N}))},[w,d]),y=n.useCallback(N=>{N.stopPropagation(),w(""),d&&d({value:""})},[w,d]),C=n.useCallback(()=>r.findIndex(N=>N.id===m),[r,m]);return t.jsxs("div",{className:`wx-2YgblL wx-richselect ${x?"wx-2YgblL wx-error":""} ${l?"wx-2YgblL wx-disabled":""} ${u?"":"wx-2YgblL wx-nowrap"}`,title:i,onClick:()=>v.current(C()),onKeyDown:N=>j.current(N,C()),tabIndex:0,children:[t.jsx("div",{className:"wx-2YgblL wx-label",children:p?u?u(p):p[a]:c?t.jsx("span",{className:"wx-2YgblL wx-placeholder",children:c}):" "}),o&&!l&&m?t.jsx("i",{className:"wx-2YgblL wx-icon wxi-close",onClick:y}):t.jsx("i",{className:"wx-2YgblL wx-icon wxi-angle-down"}),!l&&t.jsx(re,{items:r,onReady:h,onSelect:g,...f,children:({option:N})=>u?u(N):N[a]})]})}const bt=({options:e=[],value:r="",css:s="",children:c,onChange:l})=>{const[x,i]=n.useState(r),a=o=>{i(o),l&&l({value:o})};return n.useEffect(()=>{i(r)},[r]),t.jsx("div",{className:`wx-0hMO7P wx-segmented ${s}`,children:e.map(o=>t.jsx("button",{className:`wx-0hMO7P wx-segment ${o.css} ${o.id===x?"wx-selected":""}`,title:o.title,onClick:()=>a(o.id),children:c?I.snippet(c,{option:o}):t.jsxs(t.Fragment,{children:[o.icon&&t.jsx("i",{className:`wx-0hMO7P wx-icon ${o.icon} ${o.label?"":"wx-only"}`}),o.label&&t.jsx("span",{className:"wx-0hMO7P wx-label",children:o.label})]})},o.id))})};function Nt({value:e,options:r=[],placeholder:s="",title:c="",disabled:l=!1,error:x=!1,textField:i="label",clear:a=!1,id:o,onChange:u}){const d=U(o),[f,v]=n.useState(e||""),j=n.useCallback(w=>{const h=w.target.value;v(h),u&&u({value:h})},[u]),m=n.useCallback(()=>{v(""),u&&u({value:""})},[u]);return t.jsxs("div",{className:"wx-2yx1Fo wx-select-box",children:[t.jsxs("select",{id:d,value:f,disabled:l,className:`wx-2yx1Fo wx-select ${x?"wx-2yx1Fo wx-error":""}`,title:c,onChange:j,children:[t.jsx("option",{value:"",children:s}),r.map(w=>t.jsx("option",{value:w.id,children:w[i]},w.id))]}),a&&!l&&f?t.jsx("i",{className:"wx-2yx1Fo wx-icon wxi-close",onClick:m}):t.jsx("i",{className:"wx-2yx1Fo wx-icon wxi-angle-down"})]})}function oe({id:e,label:r="",css:s="",min:c=0,max:l=100,value:x=0,step:i=1,title:a="",disabled:o=!1,onChange:u,width:d=""}){const f=U(e),[v,j]=I.useWritableProp(x),m=n.useRef({value:v,input:v}),w=n.useMemo(()=>(v-c)/(l-c)*100+"%",[v,c,l]),h=n.useMemo(()=>o?"":`linear-gradient(90deg, var(--wx-slider-primary) 0% ${w}, var(--wx-slider-background) ${w} 100%)`,[o,w]);function p({target:N}){const k=N.value*1;j(k),u&&u({value:k,previous:m.current.input,input:!0}),m.current.input=k}function g({target:N}){const k=N.value*1;j(k),u&&u({value:k,previous:m.current.value}),m.current.value=k}n.useEffect(()=>{j(x)},[x]);const y=n.useRef(null);n.useEffect(()=>{if(y.current)return y.current.addEventListener("change",g),()=>{y.current&&y.current.removeEventListener("change",g)}},[y,g]);const C={...d&&{width:d}};return t.jsxs("div",{className:`wx-2EDJ8G wx-slider ${s}`,style:C,title:a,children:[r&&t.jsx("label",{className:"wx-2EDJ8G wx-label",htmlFor:f,children:r}),t.jsx("div",{className:"wx-2EDJ8G wx-inner",children:t.jsx("input",{id:f,className:"wx-2EDJ8G wx-input",type:"range",min:c,max:l,step:i,disabled:o,value:v,onInput:p,style:{background:h},ref:y})})]})}function Ct({id:e,value:r=!1,disabled:s=!1,onChange:c}){const l=U(e),[x,i]=I.useWritableProp(r),a=n.useCallback(o=>{const u=o.target.checked;i(u),c&&c({value:u})},[c]);return t.jsxs("label",{className:"wx-2dAR5c wx-switch",children:[t.jsx("input",{className:"wx-2dAR5c wx-input",type:"checkbox",checked:x,onChange:a,disabled:s,id:l}),t.jsx("span",{className:"wx-2dAR5c wx-box"})]})}const yt=({options:e=[],value:r="",type:s="top",css:c="",onChange:l})=>{const[x,i]=I.useWritableProp(r),a=o=>{i(o),l&&l({value:o})};return t.jsx("div",{className:`wx-138fWJ wx-tabs wx-${s} ${c}`,children:e.map(o=>t.jsxs("button",{className:`wx-138fWJ wx-tab ${o.css} ${o.id===x?"wx-active":""}`,title:o.title,onClick:()=>a(o.id),children:[o.icon&&t.jsx("i",{className:`wx-138fWJ wx-icon ${o.icon} ${o.label?"":"wx-only"}`}),o.label&&t.jsx("span",{className:"wx-138fWJ wx-label",children:o.label})]},o.id))})},Rt=({id:e,value:r=0,step:s=1,min:c=0,max:l=1/0,error:x=!1,disabled:i=!1,readonly:a=!1,onChange:o})=>{const u=U(e),[d,f]=I.useWritableProp(r),v=n.useCallback(()=>{if(a||d<=c)return;const h=d-s;f(h),o&&o({value:h})},[d,a,c,s,o]),j=n.useCallback(()=>{if(a||d>=l)return;const h=d+s;f(h),o&&o({value:h})},[d,a,l,s,o]),m=n.useCallback(()=>{if(!a){const h=Math.round(Math.min(l,Math.max(d,c))/s)*s,p=isNaN(h)?Math.max(c,0):h;f(p),o&&o({value:p})}},[a,d,l,c,s,o]),w=n.useCallback(h=>{const p=h.target.value*1;f(p),o&&o({value:p,input:!0})},[o]);return t.jsxs("div",{className:`wx-22t21n wx-counter ${i?"wx-disabled":""} ${a?"wx-readonly":""} ${x?"wx-error":""}`,children:[t.jsx("button",{"aria-label":"-",className:"wx-22t21n wx-btn wx-btn-dec",disabled:i,onClick:v,children:t.jsx("svg",{className:"wx-22t21n wx-dec",width:"12",height:"2",viewBox:"0 0 12 2",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M11.2501 1.74994H0.750092V0.249939H11.2501V1.74994Z"})})}),t.jsx("input",{id:u,type:"text",className:"wx-22t21n wx-input",disabled:i,readOnly:a,required:!0,value:d,onBlur:m,onInput:w}),t.jsx("button",{"aria-label":"-",className:"wx-22t21n wx-btn wx-btn-inc",disabled:i,onClick:j,children:t.jsx("svg",{className:"wx-22t21n wx-inc",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:`M11.2501
2
- 6.74994H6.75009V11.2499H5.25009V6.74994H0.750092V5.24994H5.25009V0.749939H6.75009V5.24994H11.2501V6.74994Z`})})})]})};function Mt({notice:e={}}){function r(){e.remove&&e.remove()}return t.jsxs("div",{className:`wx-11sNg5 wx-notice wx-${e.type?e.type:""}`,role:"status","aria-live":"polite",children:[t.jsx("div",{className:"wx-11sNg5 wx-text",children:e.text}),t.jsx("div",{className:"wx-11sNg5 wx-button",children:t.jsx("i",{className:"wx-11sNg5 wxi-close",onClick:r})})]})}function St({data:e=[]}){return t.jsx("div",{className:"wx-3nwoO9 wx-notices",children:e.map(r=>t.jsx(Mt,{notice:r},r.id))})}function Ie({title:e="",buttons:r=["cancel","ok"],header:s,children:c,footer:l,onConfirm:x,onCancel:i}){const a=(n.useContext(J)||_()).getGroup("core"),o=n.useRef(null);n.useEffect(()=>{o.current?.focus()},[]);function u(f){switch(f.code){case"Enter":{const v=f.target.tagName;if(v==="TEXTAREA"||v==="BUTTON")return;x&&x({event:f});break}case"Escape":i&&i({event:f});break}}function d(f,v){const j={event:f,button:v};v==="cancel"?i&&i(j):x&&x(j)}return t.jsx("div",{className:"wx-1FxkZa wx-modal",ref:o,tabIndex:0,onKeyDown:u,children:t.jsxs("div",{className:"wx-1FxkZa wx-window",children:[s||(e?t.jsx("div",{className:"wx-1FxkZa wx-header",children:e}):null),t.jsx("div",{children:c}),l||r&&t.jsx("div",{className:"wx-1FxkZa wx-buttons",children:r.map(f=>t.jsx("div",{className:"wx-1FxkZa wx-button",children:t.jsx(Q,{type:`block ${f==="ok"?"primary":"secondary"}`,onClick:v=>d(v,f),children:a(f)})},f))})]})})}function Dt({children:e},r){const[s,c]=n.useState(null),[l,x]=n.useState([]);return n.useImperativeHandle(r,()=>({showModal:i=>{const a={...i};return c(a),new Promise((o,u)=>{a.resolve=d=>{c(null),o(d)},a.reject=d=>{c(null),u(d)}})},showNotice:i=>{i={...i},i.id=i.id||H.uid(),i.remove=()=>x(a=>a.filter(o=>o.id!==i.id)),i.expire!=-1&&setTimeout(i.remove,i.expire||5100),x(a=>[...a,i])}}),[]),t.jsxs(t.Fragment,{children:[e,s&&t.jsx(Ie,{title:s.title,buttons:s.buttons,onConfirm:s.resolve,onCancel:s.reject,children:s.message}),t.jsx(St,{data:l})]})}const Vt=n.forwardRef(Dt);function Tt(e){let{children:r}=e,s=n.useRef();const c=n.useMemo(()=>({showNotice:l=>s.current.showNotice(l),showModal:l=>s.current.showModal(l)}),[]);return t.jsx(Re.Provider,{value:c,children:t.jsx(Vt,{ref:s,children:r})})}function ue({label:e="",position:r="",error:s=!1,type:c="",required:l=!1,id:x,children:i,width:a=""}){const o=n.useMemo(()=>x===void 0?H.uid():x,[x]),u={...a&&{width:a}};return t.jsx(te.Provider,{value:o,children:t.jsxs("div",{style:u,className:`wx-2oVUvC wx-field wx-${r} ${s?"wx-error":""} ${l?"wx-required":""}`.trim(),children:[e&&(o?t.jsx("label",{className:"wx-2oVUvC wx-label",htmlFor:o,children:e}):t.jsx("div",{className:"wx-2oVUvC wx-label",children:e})),t.jsx("div",{className:`wx-2oVUvC wx-field-control wx-${c}`,children:i})]})})}const Ee=({value:e=!1,type:r="",icon:s="",disabled:c=!1,iconActive:l="",onClick:x,title:i="",css:a="",text:o="",textActive:u="",children:d,active:f,onChange:v})=>{const[j,m]=I.useWritableProp(e),w=n.useMemo(()=>(j?"pressed":"")+(r?" "+r:""),[j,r]),h=n.useCallback(p=>{let g=!j;x&&x(p),p.defaultPrevented||(m(g),v&&v({value:g}))},[j,x,v]);return j&&f?t.jsx(Q,{title:i,text:j&&u||o,css:a,type:w,icon:j&&l||s,onClick:h,disabled:c,children:I.snippet(f,{value:j})}):d?t.jsx(Q,{title:i,text:j&&u||o,css:a,type:w,icon:j&&l||s,onClick:h,disabled:c,children:d}):t.jsx(Q,{title:i,text:j&&u||o,css:a,type:w,icon:j&&l||s,onClick:h,disabled:c})},be=new Date(0,0,0,0,0);function Pt({value:e=be,id:r,title:s="",css:c="",disabled:l=!1,error:x=!1,format:i="",onChange:a,dropdown:o}){let[u,d]=I.useWritableProp(e);const{calendar:f,formats:v}=(n.useContext(J)||_()).getRaw(),j=f.clockFormat==12,m=23,w=59,h=n.useMemo(()=>{const b=i||v?.timeFormat;return typeof b=="function"?b:H.dateToString(b,f)},[i,v,f]),p=n.useMemo(()=>h(new Date(0,0,0,1)).indexOf("01")!=-1,[h]),g=(b,E)=>(b<10&&E?`0${b}`:`${b}`).slice(-2),y=b=>g(b,!0),C=b=>`${b}`.replace(/[^\d]/g,"")||0,N=b=>j&&(b=b%12,b===0)?"12":g(b,p),k=n.useCallback((b,E)=>(b=C(b),Math.min(b,E)),[]),[S,M]=n.useState(null),R=u||be,P=k(R.getHours(),m),A=k(R.getMinutes(),w),F=P>12,T=N(P),$=y(A),V=n.useMemo(()=>h(new Date(0,0,0,P,A)),[P,A,h]),L=n.useCallback(()=>{M(!0)},[]),O=n.useCallback(()=>{const b=new Date(R);b.setHours(b.getHours()+(F?-12:12)),d(b),a&&a({value:b})},[R,F,a]),W=n.useCallback(({value:b})=>{if(R.getHours()===b)return;const E=new Date(R);E.setHours(b),d(E),a&&a({value:E})},[R,a]),D=n.useCallback(({value:b})=>{if(R.getMinutes()===b)return;const E=new Date(R);E.setMinutes(b),d(E),a&&a({value:E})},[R,a]),B=n.useCallback(b=>(b=k(b,m),j&&(b=b*1,b===12&&(b=0),F&&(b+=12)),b),[k,j,F]),Y=n.useCallback(()=>{M(null)},[]);return t.jsxs("div",{className:`wx-7f497i wx-timepicker ${x?"wx-7f497i wx-error":""} ${l?"wx-7f497i wx-disabled":""}`,onClick:l?void 0:L,style:{cursor:l?"default":"pointer"},children:[t.jsx(le,{id:r,css:c,title:s,value:V,readonly:!0,disabled:l,error:x,icon:"wxi-clock",inputStyle:{cursor:"pointer",width:"100%",paddingRight:"calc(var(--wx-input-icon-size) + var(--wx-input-icon-indent) * 2)"}}),S&&!l&&t.jsx(K,{onCancel:Y,...fe(o),children:t.jsxs("div",{className:"wx-7f497i wx-wrapper",children:[t.jsxs("div",{className:"wx-7f497i wx-timer",children:[t.jsx("input",{className:"wx-7f497i wx-digit",value:T,onChange:b=>{const E=B(b.target.value);W({value:E})}}),t.jsx("div",{className:"wx-7f497i wx-separator",children:":"}),t.jsx("input",{className:"wx-7f497i wx-digit",value:$,onChange:b=>{const E=k(b.target.value,w);D({value:E})}}),j&&t.jsx(Ee,{value:F,onClick:O,active:()=>t.jsx("span",{children:"pm"}),children:t.jsx("span",{children:"am"})})]}),t.jsx(ue,{width:"unset",children:t.jsx(oe,{label:f.hours,value:P,width:"unset",onChange:W,max:m})}),t.jsx(ue,{width:"unset",children:t.jsx(oe,{label:f.minutes,value:A,width:"unset",onChange:D,max:w})})]})})]})}function Ft({children:e}){return t.jsx("div",{className:"wx-KgpO9N wx-modal",children:t.jsx("div",{className:"wx-KgpO9N wx-window",children:e})})}function $t({position:e="right",children:r,onCancel:s}){const c=n.useRef(null);return n.useEffect(()=>H.clickOutside(c.current,s).destroy,[]),t.jsx("div",{ref:c,className:`wx-2L733M wx-sidearea wx-pos-${e}`,children:r})}const Ne="#dfe2e6",Ce="#2c2f3c",It=.75;function ye(e){if(e=e?.trim()||"",!e)return"";const r=e.split(/\s+/);return(r[0][0]+(r[1]?.[0]||"")).toUpperCase().slice(0,2)}function Et(e){let r=e.replace("#","");if(r.length===3&&(r=r[0]+r[0]+r[1]+r[1]+r[2]+r[2]),r.length!==6)return Ce;const s=parseInt(r.slice(0,2),16)/255,c=parseInt(r.slice(2,4),16)/255,l=parseInt(r.slice(4,6),16)/255;return .299*s+.587*c+.114*l>.5?Ce:"#ffffff"}function Lt(e){const{value:r,size:s=32,limit:c}=e,l=n.useRef(null),[x,i]=n.useState(null),a=n.useMemo(()=>r?Array.isArray(r)?r:[r]:[],[r]),o=n.useMemo(()=>{if(x==null||x<=0)return null;const w=1+(x/s-1)/It;return Math.max(1,Math.floor(w))},[x,s]),u=n.useMemo(()=>{const w=c!=null?Math.min(a.length,c):a.length;return o!=null?Math.min(w,o):w},[a,c,o]),d=n.useMemo(()=>a.slice(0,u),[a,u]),f=n.useMemo(()=>Math.max(0,a.length-u),[a,u]);n.useEffect(()=>{const w=l.current;if(!w)return;const h=new ResizeObserver(p=>{const g=p[0];g&&i(g.contentRect.width)});return h.observe(w),()=>h.disconnect()},[]);const v=Math.round(s*.4),j={width:s+"px",height:s+"px",minWidth:s+"px",minHeight:s+"px",fontSize:v+"px"};function m(w,h){const p=h===0?"0":`${s*-.25}px`,g=w.avatar?"transparent":w.color||Ne,y=w.avatar?"transparent":Et(w.color||Ne);return{marginLeft:p,backgroundColor:g,color:y}}return t.jsx("div",{className:"wx-avatar-root wx-aadkRiRf",ref:l,children:d.length>0&&t.jsx("div",{className:"wx-avatar-stack wx-aadkRiRf",children:d.map((w,h)=>t.jsxs("div",{className:["wx-avatar","wx-avatar-item",h===d.length-1&&f>0?"wx-avatar-overflow":"","wx-aadkRiRf"].filter(Boolean).join(" "),style:{...j,...m(w,h)},children:[w.avatar?t.jsx("img",{src:w.avatar,alt:"",loading:"lazy"}):ye(w.name)?t.jsx("span",{className:"wx-aadkRiRf",children:ye(w.name)}):null,h===d.length-1&&f>0&&t.jsxs("span",{className:"wx-avatar-overflow-badge wx-aadkRiRf",children:["+",f]})]},w.id))})})}function Wt(){return t.jsx(t.Fragment,{})}function Ht(e){const{fonts:r=!0,children:s}=e;return t.jsx(ee.Provider,{value:"material",children:t.jsxs(t.Fragment,{children:[s&&t.jsx("div",{className:"wx-theme wx-material-theme",children:s}),r&&t.jsxs(t.Fragment,{children:[t.jsx("link",{rel:"preconnect",href:"https://cdn.svar.dev",crossOrigin:"true"}),t.jsx(Wt,{}),t.jsx("link",{rel:"stylesheet",href:"https://cdn.svar.dev/fonts/wxi/wx-icons.css"})]})]})})}function Le(){return t.jsx(t.Fragment,{})}function At(e){const{fonts:r=!0,children:s}=e;return t.jsx(ee.Provider,{value:"willow",children:t.jsxs(t.Fragment,{children:[s&&s&&t.jsx("div",{className:"wx-theme wx-willow-theme",children:s}),r&&t.jsxs(t.Fragment,{children:[t.jsx("link",{rel:"preconnect",href:"https://cdn.svar.dev",crossOrigin:"true"}),t.jsx(Le,{}),t.jsx("link",{rel:"stylesheet",href:"https://cdn.svar.dev/fonts/wxi/wx-icons.css"})]})]})})}function Bt(e){const{fonts:r=!0,children:s}=e;return t.jsx(ee.Provider,{value:"willow-dark",children:t.jsxs(t.Fragment,{children:[s&&s&&t.jsx("div",{className:"wx-theme wx-willow-dark-theme",children:s}),r&&t.jsxs(t.Fragment,{children:[t.jsx("link",{rel:"preconnect",href:"https://cdn.svar.dev",crossOrigin:"true"}),t.jsx(Le,{}),t.jsx("link",{rel:"stylesheet",href:"https://cdn.svar.dev/fonts/wxi/wx-icons.css"})]})]})})}function Ot(e){const r=H.uid();e.setAttribute("data-wx-portal-root",r)}H.setEnv(H.env);Object.defineProperty(exports,"locale",{enumerable:!0,get:()=>H.locale});Object.defineProperty(exports,"en",{enumerable:!0,get:()=>ie.en});exports.Avatar=Lt;exports.Button=Q;exports.Calendar=Pe;exports.Checkbox=xe;exports.CheckboxGroup=Oe;exports.ColorBoard=De;exports.ColorPicker=qe;exports.ColorSelect=Ue;exports.Combo=Ze;exports.Counter=Rt;exports.DatePicker=xt;exports.DateRangePicker=wt;exports.Dropdown=K;exports.Field=ue;exports.Fullscreen=mt;exports.Globals=Tt;exports.Icon=pt;exports.Locale=se;exports.Material=Ht;exports.Modal=Ie;exports.ModalArea=Ft;exports.Month=Ve;exports.MultiCombo=vt;exports.Pager=jt;exports.Popup=Se;exports.Portal=Me;exports.RadioButton=$e;exports.RadioButtonGroup=gt;exports.RangeCalendar=Fe;exports.RichSelect=kt;exports.Segmented=bt;exports.Select=Nt;exports.SideArea=$t;exports.Slider=oe;exports.SuggestDropdown=re;exports.Switch=Ct;exports.Tabs=yt;exports.Text=le;exports.TextArea=Be;exports.TimePicker=Pt;exports.TwoState=Ee;exports.Willow=At;exports.WillowDark=Bt;exports.context=Ae;exports.popupContainer=Ot;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),n=require("react"),H=require("@svar-ui/lib-react"),O=require("@svar-ui/lib-dom"),Be=require("react-dom"),xe=require("@svar-ui/core-locales"),ee=n.createContext(""),De=n.createContext({}),U=n.createContext(null),te=n.createContext(null),Oe=Object.freeze(Object.defineProperty({__proto__:null,fieldId:te,helpers:De,i18n:U,theme:ee},Symbol.toStringTag,{value:"Module"}));function q(e){const s=n.useContext(te),[r]=n.useState(()=>e||s||O.uid());return r}function Ye({value:e="",id:s,placeholder:r="",title:c="",tooltip:l,disabled:i=!1,error:u=!1,readonly:o=!1,css:a="",onChange:x}){const f=q(s),[v,d]=H.useWritableProp(e),h=n.useCallback(m=>{const w=m.target.value;d(w),x&&x({value:w,input:!0})},[x]),g=n.useCallback(m=>{const w=m.target.value;d(w),x&&x({value:w})},[x]),k=n.useRef(null);return n.useEffect(()=>{const m=g,w=k.current;return w.addEventListener("change",m),()=>{w&&w.removeEventListener("change",m)}},[g]),t.jsx("textarea",{className:`wx-3yFVAC wx-textarea ${a} ${u?"wx-error":""}`,id:f,disabled:i,placeholder:r,readOnly:o,title:c,value:v,onInput:h,ref:k,"data-tooltip-text":l})}function z({type:e="",css:s="",icon:r="",disabled:c=!1,title:l="",tooltip:i,text:u="",children:o,onClick:a}){const x=n.useMemo(()=>{let v=e?e.split(" ").filter(d=>d!=="").map(d=>"wx-"+d).join(" "):"";return s+(s?" ":"")+v},[e,s]),f=v=>{a&&a(v)};return t.jsxs("button",{title:l,className:`wx-2ZWgb4 wx-button ${x} ${r&&!o?"wx-icon":""}`,disabled:c,onClick:f,"data-tooltip-text":i,children:[r&&t.jsx("i",{className:"wx-2ZWgb4 "+r}),o||u||" "]})}function fe({id:e,label:s="",inputValue:r="",value:c=!1,onChange:l,disabled:i=!1,css:u=""}){const o=q(e),[a,x]=H.useWritableProp(c),f=({target:v})=>{const d=v.checked;x(d),l&&l({value:d,inputValue:r})};return t.jsxs("div",{className:`wx-2IvefP wx-checkbox ${u}`,children:[t.jsx("input",{type:"checkbox",id:o,disabled:i,className:"wx-2IvefP wx-check",checked:a,value:r,onChange:f}),t.jsxs("label",{htmlFor:o,className:"wx-2IvefP wx-label",children:[t.jsx("span",{className:"wx-2IvefP wx-before"}),s&&t.jsx("span",{className:"wx-2IvefP wx-after",children:s})]})]})}function Je({options:e=[],value:s=[],type:r="",css:c="",onChange:l}){const i=n.useCallback(u=>{let o;u.value?o=[...s,u.inputValue]:o=s.filter(a=>a!==u.inputValue),l&&l({value:o})},[s,l]);return t.jsx(te.Provider,{value:null,children:t.jsx("div",{className:`wx-q8xwRD wx-checkboxgroup ${r&&`wx-${r}`} ${c}`,children:e.map(u=>t.jsx("div",{className:"wx-q8xwRD wx-item",children:t.jsx(fe,{label:u.label,inputValue:u.id,value:s.includes(u.id),onChange:i})},u.id))})})}function de({theme:e="",target:s,children:r}){const c=n.useRef(null),l=n.useRef(null),[i,u]=n.useState(null);c.current||(c.current=document.createElement("div"));const o=n.useContext(ee);return n.useEffect(()=>{u(s||Ge(l.current)||O.env.getTopNode(l.current))},[l.current]),t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:l,style:{display:"none"}}),l.current&&i?Be.createPortal(t.jsx("div",{className:`wx-3ZWsT0 wx-${e||o}-theme`,children:r}),i):null]})}function Ge(e){const s=O.env.getTopNode(e);for(;e&&e!==s&&!e.getAttribute("data-wx-portal-root");)e=e.parentNode;return e}function Te({left:e=0,top:s=0,at:r="bottom",parent:c=null,width:l="auto",css:i="",onCancel:u,children:o,trackScroll:a=!1}){const[x,f]=n.useState(0),[v,d]=n.useState(0),[h,g]=n.useState("auto"),[k,m]=n.useState(!1),w=n.useRef(null),p=n.useRef(null),b=n.useRef(u);n.useEffect(()=>{b.current=u},[u]);function R(C){return c&&(l+"").indexOf("%")>-1?l.replace(/(\d+)%/,(j,E)=>(E=E*c.offsetWidth/100+"px",l.replace(j,E))):l&&l!=="auto"?l:C}const N=n.useCallback(()=>{if(!w.current)return;const C=O.calculatePosition(w.current,c,r,e,s);C&&(f(C.x),d(C.y),g(R(C.width)))},[w,c,r,e,s,l]);return n.useLayoutEffect(()=>{const C=E=>{b.current&&E.target!==p.current&&w.current&&!w.current.contains(E.target)&&b.current(E)};let j;return requestAnimationFrame(()=>{N(),m(!0),a&&w.current&&(p.current=O.getAbsParent(w.current),p.current&&p.current.addEventListener("scroll",C,!0)),c&&(j=new ResizeObserver(N),j.observe(c))}),()=>{a&&p.current&&p.current.removeEventListener("scroll",C,!0),j?.disconnect()}},[]),n.useLayoutEffect(()=>{N()},[c,r,e,s]),n.useEffect(()=>{const C=j=>{b.current&&b.current(j)};if(w.current)return O.clickOutside(w.current,{callback:C,parent:()=>c}).destroy},[c]),t.jsx("div",{ref:w,className:["wx-37M6Fj","wx-popup",i].filter(Boolean).join(" "),style:{position:"absolute",visibility:k?"visible":"hidden",top:v+"px",left:x+"px",width:h},children:o})}function _e({position:e="bottom",align:s="start",autoFit:r=!0,onCancel:c=null,width:l="100%",css:i="",children:u}){const o=n.useRef(null),[a,x]=n.useState(e),[f,v]=n.useState(s),d=n.useRef(c);return n.useEffect(()=>{d.current=c},[c]),n.useEffect(()=>{if(r){const h=o.current;if(h){const g=h.getBoundingClientRect(),k=document.body.getBoundingClientRect();g.right>=k.right&&v("end"),g.bottom>=k.bottom&&x("top")}}},[]),n.useEffect(()=>{if(o.current){const h=g=>{d.current&&d.current(g)};return O.clickOutside(o.current,h).destroy}},[]),t.jsx("div",{ref:o,className:["wx-dropdown",`wx-${a}-${f}`,i||"","wx-aaaVytZW"].filter(Boolean).join(" "),style:{width:l},children:u})}function K({position:e="bottom",align:s="start",autoFit:r=!0,inline:c=!1,onCancel:l,width:i="100%",children:u,...o}){const[a,x]=n.useState(void 0),f=n.useRef(null),v=n.useMemo(()=>`${e}-${s}`,[e,s]);return n.useLayoutEffect(()=>{f.current&&x(f.current.parentNode)},[]),t.jsxs(t.Fragment,{children:[a&&(c?t.jsx(_e,{onCancel:l,position:e,align:s,autoFit:r,width:i,...o,children:u}):t.jsx(de,{children:t.jsx(Te,{parent:a,at:v,onCancel:l,width:i,...o,children:u})})),t.jsx("span",{ref:f,className:"wx-portal-node wx-32GZ52"})]})}const Ue=["#00a037","#37a9ef","#f5a623","#ff4c3b","#a0a0a0","#000000","#ffffff"];function Ze({colors:e=Ue,value:s="",onChange:r,id:c,clear:l=!1,placeholder:i="",title:u="",tooltip:o,disabled:a=!1,error:x=!1,css:f="",dropdown:v={}}){const d=q(c),[h,g]=n.useState(s),[k,m]=n.useState(!1),w=n.useCallback((R,N)=>{R.stopPropagation(),g(N),m(!1),r&&r({value:N})},[r]),p=n.useCallback(R=>{R.stopPropagation(),g(""),r&&r({value:""})},[r]),b=n.useCallback(()=>{if(a)return!1;m(!0)},[a]);return t.jsxs("div",{className:"wx-121TgJ wx-colorselect "+f,onClick:b,"data-tooltip-text":o,children:[t.jsx("input",{className:"wx-121TgJ wx-input"+(x?" wx-error":"")+(k?" wx-focus":""),title:u,value:h,readOnly:!0,id:d,placeholder:i,disabled:a}),l&&h&&!a&&t.jsx("i",{className:"wx-121TgJ wx-clear wxi-close",onClick:p}),h?t.jsx("div",{className:"wx-121TgJ wx-color wx-selected",style:{backgroundColor:h||"#00a037"}}):t.jsx("div",{className:"wx-121TgJ wx-empty wx-selected"}),k&&t.jsx(K,{onCancel:()=>m(!1),...v,children:t.jsxs("div",{className:"wx-121TgJ wx-colors",children:[t.jsx("div",{className:"wx-121TgJ wx-empty",onClick:R=>w(R,"")}),e.map((R,N)=>t.jsx("div",{className:"wx-121TgJ wx-color",style:{backgroundColor:R},onClick:C=>w(C,R)},N))]})})]})}function pe(e,s){const r=e.firstChild,{moveBlockSlider:c,moveLineSlider:l}=s||{};function i(a){u(a),r.focus(),window.addEventListener("mousemove",u),window.addEventListener("mouseup",o)}function u(a){let x,f,v,d;const h=e.getBoundingClientRect();x=h.left,f=h.top,v=a.clientX-x,d=a.clientY-f,c&&s.moveBlockSlider(v,d),l&&s.moveLineSlider(v)}function o(){r.blur(),window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",o)}return e.addEventListener("mousedown",i),{destroy(){e.removeEventListener("mousedown",i)}}}const X={_toHex:["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"],toHex(e,s){e=parseInt(e,10);let r="";for(;e>0;)r=this._toHex[e%16]+r,e=Math.floor(e/16);for(;r.length<s;)r=`0${r}`;return r},rgbToHex(e){let s=[];return typeof e=="string"?e.replace(/[\d+.]+/g,r=>s.push(parseFloat(r))):Array.isArray(e)&&(s=e),s[3]===0?"":s.slice(0,3).map(r=>this.toHex(Math.floor(r),2)).join("")},hexToDec(e){return parseInt(e,16)},hexToRgb(e){e=e.charAt(0)==="#"?e.slice(1):e;const s=e.match(/.{1,2}/g);let[r,c,l]=s;return r=this.hexToDec(r),c=this.hexToDec(c),l=this.hexToDec(l),[r,c,l]},hsvToRgb(e,s,r){let c,l,i,u,o,a,x,f;switch(c=Math.floor(e/60)%6,l=e/60-c,i=r*(1-s),u=r*(1-l*s),o=r*(1-(1-l)*s),a=0,x=0,f=0,c){case 0:a=r,x=o,f=i;break;case 1:a=u,x=r,f=i;break;case 2:a=i,x=r,f=o;break;case 3:a=i,x=u,f=r;break;case 4:a=o,x=i,f=r;break;case 5:a=r,x=i,f=u;break}return a=Math.floor(a*255),x=Math.floor(x*255),f=Math.floor(f*255),[a,x,f]},rgbToHsv(e,s,r){let c,l,i;e/=255,s/=255,r/=255;let u=Math.min(e,s,r),o=Math.max(e,s,r);return l=0,c=o===0?0:1-u/o,i=o,o===u?l=0:o===e&&s>=r?l=60*(s-r)/(o-u)+0:o===e&&s<r?l=60*(s-r)/(o-u)+360:o===s?l=60*(r-e)/(o-u)+120:o===r&&(l=60*(e-s)/(o-u)+240),[l,c,i]},hexToHvs(e){const s=this.hexToRgb(e);return this.rgbToHsv(...s)},hvsToHex(e,s,r){const c=this.hsvToRgb(e,s,r);return"#"+this.rgbToHex(c).toUpperCase()}},qe=e=>/^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(e);function he(e){return e?(e=e.toString(16),e.charAt(0)==="#"&&(e=e.slice(1)),qe(e)?(e.length===3&&(e=e.slice(0,3).split("").reduce((s,r)=>s+r+r,"")),`#${e.toUpperCase()}`):null):null}function Q(){return O.locale(xe.en)}const ve="Block",ge="Line";function $e({value:e="#65D3B3",button:s=!1,css:r="",onChange:c}){const l=(n.useContext(U)||Q()).getGroup("core"),i=n.useRef(null),u=n.useRef(null),[o,a]=n.useState(),[x,f]=n.useState(),[v,d]=n.useState(),[h,g]=n.useState(),[k,m]=H.useWritableProp(e),[w,p]=n.useState(e),b=n.useRef(null),R=n.useRef(null),N=n.useMemo(()=>he(k)||"#65D3B3",[k]),C=n.useMemo(()=>X.hvsToHex(v||0,1,1),[v]),j=n.useCallback((V,I)=>{const{width:Y,height:J}=i.current.getBoundingClientRect();I<0?I=0:I>J&&(I=J),V<0?V=0:V>Y&&(V=Y),a(I),f(V);let P,W;const T=Y/100,M=J/100;P=Math.ceil(V/T)/100,W=Math.ceil(Math.abs(I/M-100))/100;const D=X.hvsToHex(v,P,W);m(D),p(D),c&&c({value:D,input:!0})},[N,v,c]),E=n.useCallback(V=>{const I=u.current.getBoundingClientRect().width;V<0?V=0:V>I&&(V=I);const Y=Math.round(V*359/I),J=Math.max(Math.min(Y,359),0);d(J),g(V);let P,W;[,P,W]=X.hexToHvs(N);const T=X.hvsToHex(J,P,W);m(T),p(T),c&&c({value:T,input:!0})},[N,c]);b.current=j,R.current=E;const $=n.useCallback(V=>{const[I,Y,J]=X.hexToHvs(V||N);if(d(I),i.current){const{width:P,height:W}=i.current.getBoundingClientRect();u.current&&g(I*u.current.getBoundingClientRect().width/359),f(Y*P),a(Math.abs(W*(J-1)))}},[N]),S=n.useCallback(({target:V})=>{const I=he(V.value);p(V.value),I&&(m(I),c&&c({value:I,input:!0}),$(I))},[c,$]),A=n.useCallback(V=>{V.stopPropagation(),c&&c({value:N})},[N,c]),B=n.useCallback(V=>{const I=V.target,Y=I.getAttribute("data-slider")===ve,J=I.getAttribute("data-slider")===ge;let P=window.getComputedStyle(I),W=parseFloat(P.left),T=parseFloat(P.top);const M=V.code;if(Y){switch(M){case"ArrowLeft":{W--;break}case"ArrowRight":{W++;break}case"ArrowDown":{T++;break}case"ArrowUp":{T--;break}default:return}j(W,T)}if(J){if(M==="ArrowLeft"||M==="ArrowDown")W--;else if(M==="ArrowRight"||M==="ArrowUp")W++;else return;E(W)}V.preventDefault()},[j,E]);n.useEffect(()=>{const V=[];return i.current&&V.push(pe(i.current,{moveBlockSlider:(I,Y)=>{b.current?.(I,Y)}}).destroy),u.current&&V.push(pe(u.current,{moveLineSlider:I=>{R.current?.(I)}}).destroy),requestAnimationFrame(()=>$()),()=>{V.forEach(I=>I())}},[]);const L="wx-1yoKzq";return t.jsxs("div",{className:L+" wx-colorboard "+r,children:[t.jsx("div",{className:L+" wx-color-block",style:{background:C},ref:i,children:t.jsx("div",{className:L+" wx-color-block-slider wx-slider",style:{background:N,top:o+"px",left:x+"px"},tabIndex:0,"data-slider":ve,onKeyDown:B})}),t.jsx("div",{className:L+" wx-color-line",ref:u,children:t.jsx("div",{className:L+" wx-color-line-slider wx-slider",style:{background:C,left:h+"px"},tabIndex:0,"data-slider":ge,onKeyDown:B})}),t.jsxs("div",{className:L+" wx-color-controls",children:[t.jsx("div",{className:L+" wx-color",style:{background:N}}),t.jsx("input",{type:"text",className:L+" wx-text",value:w,onChange:S})]}),s&&t.jsx(z,{onClick:A,type:"secondary",children:l("select")})]})}function Qe({value:e="",id:s,placeholder:r="",title:c="",tooltip:l,disabled:i=!1,error:u=!1,clear:o=!1,css:a="",onChange:x,dropdown:f={}}){const v=q(s);let[d,h]=H.useWritableProp(e);const[g,k]=n.useState(!1);function m(){if(i)return!1;k(!0)}function w(b){if(b.input)return;k(!1);const R=b.value;h(R),x&&x({value:R})}function p(b){b.stopPropagation(),h(""),x&&x({value:""})}return t.jsxs("div",{className:"wx-mmT8WH wx-colorpicker "+a,onClick:m,"data-tooltip-text":l,children:[t.jsx("input",{className:"wx-mmT8WH wx-input"+(u?" wx-error":"")+(g?" wx-focus":""),title:c,value:d,readOnly:!0,id:v,placeholder:r,disabled:i}),t.jsx("div",{className:"wx-mmT8WH wx-color",style:{background:d}}),o&&!i&&d&&t.jsx("i",{className:"wx-mmT8WH wxi-close",onClick:p}),g&&t.jsx(K,{onCancel:()=>k(!1),...f,children:t.jsx($e,{value:d,button:"true",onChange:w})})]})}function ze(){let e=null,s=!1,r=!1,c,l,i,u;const o=(h,g,k,m,w)=>{c=h,l=g,i=k,u=m,r=w},a=h=>{e=h,s=e!==null,i(e)},x=(h,g)=>{if(!r&&h!==null&&c){const k=c.querySelectorAll(".wx-list > .wx-item")[h];k&&(k.scrollIntoView({block:"nearest"}),g&&g.preventDefault())}},f=(h,g)=>{const k=h===null?null:Math.max(0,Math.min(e+h,l.length-1));k!==e&&(a(k),c?x(k,g):requestAnimationFrame(()=>x(k,g)))};return{move:h=>{const g=O.locateID(h),k=l.findIndex(m=>m.id===g);k!==e&&a(k)},keydown:(h,g)=>{switch(h.code){case"Enter":s?u():a(0);break;case"Space":s||a(0);break;case"Escape":i(e=null);break;case"Tab":i(e=null);break;case"ArrowDown":f(s?1:g||0,h);break;case"ArrowUp":f(s?-1:g||0,h);break}},init:o,navigate:f}}const je=10,Ke=n.memo(function({data:s,checkboxes:r,itemTemplate:c,value:l}){return t.jsxs(t.Fragment,{children:[r&&t.jsx(fe,{id:s.id,css:"wx-list-checkbox",value:l&&l.includes(s.id)}),c?H.snippet(c,{option:s}):s.label]})});function be({visibleItems:e,visibleRange:s,navIndex:r,checkboxes:c,itemTemplate:l,value:i,measureRefCallback:u}){return e.map((o,a)=>{const x=s.start+a;return t.jsx("div",{ref:a===0?u:void 0,className:`wx-233fr7 wx-item ${x===r?"wx-focus":""}`,"data-id":o.id,children:t.jsx(Ke,{data:o,checkboxes:c,itemTemplate:l,value:i})},o.id)})}function re({items:e=[],children:s,onSelect:r,onReady:c,virtualized:l=!1,checkboxes:i,multiselect:u,value:o,...a}){const x=n.useRef(),f=n.useRef(!1),v=n.useRef(ze()),[d,h]=n.useState(null),g=n.useRef(d),[k,m]=n.useState(0),[w,p]=n.useState(24),b=n.useRef(!1),R=(n.useContext(U)||Q()).getGroup("core"),N=n.useRef(e);n.useEffect(()=>{N.current=e},[e]);const C=n.useRef(o);n.useEffect(()=>{C.current=o},[o]);const j=n.useRef(0);n.useEffect(()=>{j.current=w},[w]);const E=n.useCallback(D=>{D&&D.stopPropagation();const y=N.current,F=C.current,Z=g.current;let G;const _=y[Z]?.id;u?F&&F.includes(_)?G=F.filter(ae=>ae!==_):G=[...F||[],_]:G=_,r&&r({id:G})},[u,r]),$=n.useRef(E);n.useEffect(()=>{$.current=E},[E]);const S=n.useCallback(D=>{if(x.current){let y=D*j.current-x.current.clientHeight+j.current;m(y),x.current.scrollTop=y}},[j.current]),A=n.useCallback(D=>{x.current=D,l&&(D&&!f.current&&g.current!==null&&requestAnimationFrame(()=>{x.current&&(S(g.current),f.current=!0)}),D||(f.current=!1))},[S]),B=n.useCallback(D=>{if(!D||b.current)return;const y=D.getBoundingClientRect().height;y&&(p(y),j.current=y,b.current=!0)},[]);n.useEffect(()=>{v.current.init(x.current,e,D=>{h(D),g.current=D},D=>$.current(D),l)},[e,x.current,l]),n.useEffect(()=>{const D=(F,Z)=>{v.current.navigate(F,Z),S(g.current)},y=(F,Z)=>{const G=g.current,_=N.current;if(G!==0&&G!==_.length-1&&(F.key==="ArrowDown"||F.key==="ArrowUp")&&F.preventDefault(),v.current.keydown(F,Z),x.current){const ae=x.current.scrollTop<=g.current*j.current,He=x.current.scrollTop+x.current.clientHeight>=g.current*j.current+j.current;ae?He||S(g.current):(x.current.scrollTop=g.current*j.current,m(x.current.scrollTop))}};c&&c({navigate:l?D:v.current.navigate,keydown:l?y:v.current.keydown,move:v.current.move})},[]);const L=n.useRef(0),V=n.useRef(e);V.current!==e&&(V.current=e,L.current+=1);const I=n.useCallback(()=>{v.current.navigate(null)},[v]),Y=n.useCallback(D=>{l&&m(D.target.scrollTop)},[l]),J=n.useMemo(()=>Math.ceil((x.current?.clientHeight||0)/w),[w,k]),P=n.useMemo(()=>{if(!l)return{start:0,end:e.length};if(!e.length)return{start:0,end:0};const D=Math.floor(k/w),y=D+J;return{start:Math.max(0,D-je),end:Math.min(e.length,y+je)}},[l,e,k,w,J]),W=n.useMemo(()=>{if(!l)return e;const{start:D,end:y}=P;return e.slice(D,y).map(F=>({...F}))},[l,e,P]),T=P.start*w,M=e.length*w;return n.useEffect(()=>{l&&m(0)},[e,l]),n.useEffect(()=>{d===null&&(f.current=!1)},[d]),d===null?null:t.jsx(K,{onCancel:I,...a,children:t.jsx("div",{className:"wx-233fr7 wx-list",ref:A,onClick:E,onMouseMove:v.current.move,onScroll:Y,children:e.length?l?t.jsx("div",{className:"wx-233fr7 wx-list-wrapper",style:{height:`${M}px`},children:t.jsx("div",{className:"wx-233fr7 wx-list-content",style:{transform:`translateY(${T}px)`},children:t.jsx(be,{visibleRange:P,visibleItems:W,navIndex:d,measureRefCallback:B,checkboxes:i,itemTemplate:s,value:o})})}):t.jsx(be,{visibleRange:P,visibleItems:W,navIndex:d,measureRefCallback:B,checkboxes:i,itemTemplate:s,value:o}):t.jsx("div",{className:"wx-233fr7 wx-no-data",children:R("No data")})})},L.current)}function Xe({value:e="",id:s,options:r=[],textOptions:c=null,textField:l="label",placeholder:i="",title:u="",tooltip:o,disabled:a=!1,error:x=!1,clear:f=!1,css:v="",children:d,onChange:h,dropdown:g={}}){const k=q(s),m=n.useRef(null),w=n.useRef(null),[p,b]=H.useWritableProp(e),[R,N]=n.useState(!1),[C,j]=n.useState(""),E=n.useRef(null),$=n.useRef(!1),S=n.useMemo(()=>{if(R)return C;if(p||p===0){const M=(c||r).find(D=>D.id===p);if(M)return M[l]}return""},[R,C,p,c,r,l]),A=n.useMemo(()=>!S||!R?r:r.filter(M=>M[l].toLowerCase().includes(S.toLowerCase())),[S,R,r,l]),B=n.useCallback(()=>A.findIndex(M=>M.id===p),[A,p]),L=n.useCallback(M=>{m.current=M.navigate,w.current=M.keydown},[]),V=n.useCallback((M,D)=>{if(M||M===0){let y=r.find(F=>F.id===M);if(N(!1),D&&m.current(null),y&&p!==y.id){const F=y.id;b(F),h&&h({value:F})}}!$.current&&D&&E.current.focus()},[r,p,h]),I=n.useCallback(({id:M})=>{V(M,!0)},[V]),Y=n.useCallback(M=>{M&&M.stopPropagation(),b(""),N(!1),h&&h({value:""})},[h]),J=n.useCallback(M=>{if(!r.length)return;if(M===""&&f){Y();return}let D=r.find(F=>F[l]===M);D||(D=r.find(F=>F[l].toLowerCase().includes(M.toLowerCase())));const y=D?D.id:p||r[0].id;V(y,!1)},[r,l,f,p,V,Y]),P=n.useCallback(()=>{j(E.current.value),N(!0),A.length&&m.current(0)},[A.length,m]),W=n.useCallback(()=>{$.current=!0},[]),T=n.useCallback(()=>{$.current=!1,setTimeout(()=>{$.current||J(S)},200)},[J,S]);return t.jsxs("div",{className:"wx-1j11Jk wx-combo "+v,onClick:()=>m.current(B()),onKeyDown:M=>w.current(M,B()),title:u,"data-tooltip-text":o,children:[t.jsx("input",{className:"wx-1j11Jk wx-input "+(x?"wx-error":""),id:k,ref:E,value:S,disabled:a,placeholder:i,onFocus:W,onBlur:T,onInput:P}),f&&!a&&p?t.jsx("i",{className:"wx-1j11Jk wx-icon wxi-close",onClick:Y}):t.jsx("i",{className:"wx-1j11Jk wx-icon wxi-angle-down"}),!a&&t.jsx(re,{items:A,onReady:L,onSelect:I,...g,children:({option:M})=>t.jsx(t.Fragment,{children:d?d({option:M}):M[l]})})]})}function le({value:e="",id:s,readonly:r=!1,focus:c=!1,select:l=!1,type:i="text",placeholder:u="",disabled:o=!1,error:a=!1,title:x="",tooltip:f,css:v="",icon:d="",clear:h=!1,onChange:g}){const k=q(s),[m,w]=H.useWritableProp(e),p=n.useRef(null),b=n.useMemo(()=>d&&v.indexOf("wx-icon-left")===-1?"wx-icon-right "+v:v,[d,v]),R=n.useMemo(()=>d&&v.indexOf("wx-icon-left")!==-1,[d,v]);n.useEffect(()=>{const $=setTimeout(()=>{c&&p.current&&p.current.focus(),l&&p.current&&p.current.select()},1);return()=>clearTimeout($)},[c,l]);const N=n.useCallback($=>{const S=$.target.value;w(S),g&&g({value:S,input:!0})},[g]),C=n.useCallback($=>g&&g({value:$.target.value}),[g]);function j($){$.stopPropagation(),w(""),g&&g({value:""})}let E=i;return i!=="password"&&i!=="number"&&(E="text"),n.useEffect(()=>{const $=C,S=p.current;return S.addEventListener("change",$),()=>{S&&S.removeEventListener("change",$)}},[C]),t.jsxs("div",{className:`wx-hQ64J4 wx-text ${b} ${a?"wx-error":""} ${o?"wx-disabled":""} ${h?"wx-clear":""}`,"data-tooltip-text":f,children:[t.jsx("input",{className:"wx-hQ64J4 wx-input",ref:p,id:k,readOnly:r,disabled:o,placeholder:u,type:E,title:x,value:m,onInput:N}),h&&!o&&m?t.jsxs(t.Fragment,{children:[t.jsx("i",{className:"wx-hQ64J4 wx-icon wxi-close",onClick:j}),R&&t.jsx("i",{className:`wx-hQ64J4 wx-icon ${d}`})]}):d?t.jsx("i",{className:`wx-hQ64J4 wx-icon ${d}`}):null]})}function et({date:e,type:s,part:r,onShift:c}){const{calendar:l,formats:i}=n.useContext(U).getRaw(),u=e.getFullYear(),o=n.useMemo(()=>{switch(s){case"month":return O.dateToString(i.monthYearFormat,l)(e);case"year":return O.dateToString(i.yearFormat,l)(e);case"duodecade":{const{start:x,end:f}=O.getDuodecade(u),v=O.dateToString(i.yearFormat,l);return`${v(new Date(x,0,1))} - ${v(new Date(f,11,31))}`}default:return""}},[e,s,u,l,i]);function a(){c&&c({diff:0,type:s})}return t.jsxs("div",{className:"wx-8HQVQV wx-header",children:[r!=="right"?t.jsx("i",{className:"wx-8HQVQV wx-pager wxi-angle-left",onClick:()=>c&&c({diff:-1,type:s})}):t.jsx("span",{className:"wx-8HQVQV wx-spacer"}),t.jsx("span",{className:"wx-8HQVQV wx-label",onClick:a,children:o}),r!=="left"?t.jsx("i",{className:"wx-8HQVQV wx-pager wxi-angle-right",onClick:()=>c&&c({diff:1,type:s})}):t.jsx("span",{className:"wx-8HQVQV wx-spacer"})]})}function we({onClick:e,children:s}){return t.jsx("button",{className:"wx-3s8W4d wx-button",onClick:e,children:s})}function Ve({value:e,current:s,part:r="",markers:c=null,css:l="",onCancel:i,onChange:u}){const o=(n.useContext(U)||Q()).getRaw().calendar,a=(o.weekStart||7)%7,x=o.dayShort.slice(a).concat(o.dayShort.slice(0,a)),f=(N,C,j)=>new Date(N.getFullYear(),N.getMonth()+(C||0),N.getDate()+(j||0));let v=r!=="normal";function d(N){const C=N.getDay();return C===0||C===6}function h(){const N=f(s,0,1-s.getDate());return N.setDate(N.getDate()-(N.getDay()-(a-7))%7),N}function g(){const N=f(s,1,-s.getDate());return N.setDate(N.getDate()+(6-N.getDay()+a)%7),N}const k=n.useRef(0);function m(N,C){C.timeStamp!==k.current&&(k.current=C.timeStamp,C.stopPropagation(),u&&u(new Date(N)),i&&i())}const w=n.useMemo(()=>r=="normal"?[e?f(e).valueOf():0]:e?[e.start?f(e.start).valueOf():0,e.end?f(e.end).valueOf():0]:[0,0],[r,e]),p=n.useMemo(()=>{const N=h(),C=g(),j=s.getMonth();let E=[];for(let $=N;$<=C;$.setDate($.getDate()+1)){const S={day:$.getDate(),in:$.getMonth()===j,date:$.valueOf()};let A="";if(A+=S.in?"":" wx-inactive",A+=w.indexOf(S.date)>-1?" wx-selected":"",v){const B=S.date==w[0],L=S.date==w[1];B&&!L?A+=" wx-left":L&&!B&&(A+=" wx-right"),S.date>w[0]&&S.date<w[1]&&(A+=" wx-inrange")}if(A+=d($)?" wx-weekend":"",c){const B=c($);B&&(A+=" "+B)}E.push({...S,css:A})}return E},[s,w,v,c]),b=n.useRef(null);let R=n.useRef({});return R.current.click=m,n.useEffect(()=>{O.delegateClick(b.current,R.current)},[]),t.jsxs("div",{className:`wx-398RBS wx-month ${l}`,children:[t.jsx("div",{className:"wx-398RBS wx-weekdays",children:x.map(N=>t.jsx("div",{className:"wx-398RBS wx-weekday",children:N},N))}),t.jsx("div",{className:"wx-398RBS wx-days",ref:b,children:p.map(N=>t.jsx("div",{className:`wx-398RBS wx-day ${N.css} ${N.in?"":"wx-out"}`,"data-id":N.date,children:N.day},N.date))})]})}function tt({value:e,current:s,part:r,onCancel:c,onChange:l,onShift:i}){const u=n.useRef(new Date),[o,a]=H.useWritableProp(e||u.current),[x,f]=H.useWritableProp(s||u.current),v=n.useContext(U).getRaw().calendar,d=v.monthShort||[],h=n.useMemo(()=>x.getMonth(),[x]),g=n.useCallback((w,p)=>{if(w!=null){p.stopPropagation();const b=new Date(x);b.setMonth(w),f(b),i&&i({current:b})}r==="normal"&&a(new Date(x)),c&&c()},[x,r,i,c]),k=n.useCallback(()=>{const w=new Date(Pe(o,r)||x);w.setMonth(x.getMonth()),w.setFullYear(x.getFullYear()),l&&l(w)},[o,x,r,l]),m=n.useCallback(w=>{const p=w.target.closest("[data-id]");if(p){const b=parseInt(p.getAttribute("data-id"),10);g(b,w)}},[g]);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"wx-34U8T8 wx-months",onClick:m,children:d.map((w,p)=>t.jsx("div",{className:"wx-34U8T8 wx-month"+(h===p?" wx-current":""),"data-id":p,children:w},p))}),t.jsx("div",{className:"wx-34U8T8 wx-buttons",children:t.jsx(we,{onClick:k,children:v.done})})]})}const ce="wx-1XEF33",nt=({value:e,current:s,onCancel:r,onChange:c,onShift:l,part:i})=>{const u=n.useContext(U).getRaw().calendar,[o,a]=H.useWritableProp(s),[x,f]=H.useWritableProp(e),v=n.useMemo(()=>o.getFullYear(),[o]),d=n.useMemo(()=>{const{start:w,end:p}=O.getDuodecade(v),b=[];for(let R=w;R<=p;++R)b.push(R);return b},[v]),h={click:g};function g(w,p){if(w){p.stopPropagation();const b=new Date(o);b.setFullYear(w),a(b),l&&l({current:b})}i==="normal"&&f(new Date(o)),r&&r()}function k(){const w=new Date(Pe(x,i)||o);w.setFullYear(o.getFullYear()),c&&c(w)}const m=n.useRef(null);return n.useEffect(()=>{m.current&&O.delegateClick(m.current,h)},[]),t.jsxs(t.Fragment,{children:[t.jsx("div",{className:ce+" wx-years",ref:m,children:d.map((w,p)=>t.jsx("div",{className:ce+` wx-year ${v==w?"wx-current":""} ${p===0?"wx-prev-decade":""} ${p===11?"wx-next-decade":""}`,"data-id":w,children:w},p))}),t.jsx("div",{className:ce+" wx-buttons",children:t.jsx(we,{onClick:k,children:u.done})})]})},ke={month:{component:Ve,next:rt,prev:st},year:{component:tt,next:at,prev:lt},duodecade:{component:nt,next:ot,prev:ct}};function st(e){return e=new Date(e),e.setMonth(e.getMonth()-1),e}function rt(e){return e=new Date(e),e.setMonth(e.getMonth()+1),e}function lt(e){return e=new Date(e),e.setFullYear(e.getFullYear()-1),e}function at(e){return e=new Date(e),e.setFullYear(e.getFullYear()+1),e}function ct(e){return e=new Date(e),e.setFullYear(e.getFullYear()-10),e}function ot(e){return e=new Date(e),e.setFullYear(e.getFullYear()+10),e}function Pe(e,s){let r;if(s==="normal")r=e;else{const{start:c,end:l}=e;s==="left"?r=c:s=="right"?r=l:r=c&&l}return r}const ut=["clear","today"];function it(e){if(e==="done")return-1;if(e==="clear")return null;if(e==="today")return new Date}function ne({value:e,current:s,onCurrentChange:r,part:c="normal",markers:l=null,buttons:i,css:u="",onShift:o,onChange:a}){const x=n.useContext(U).getGroup("calendar"),[f,v]=n.useState("month"),d=Array.isArray(i)?i:i?ut:[],h=(p,b)=>{p.preventDefault(),a&&a({value:b})},g=()=>{f==="duodecade"?v("year"):f==="year"&&v("month")},k=p=>{const{diff:b,current:R}=p;if(b===0){f==="month"?v("year"):f==="year"&&v("duodecade");return}if(b){const N=ke[f];r(b>0?N.next(s):N.prev(s))}else R&&r(R);o&&o()},m=p=>{v("month"),a&&a({select:!0,value:p})},w=n.useMemo(()=>ke[f].component,[f]);return t.jsx("div",{className:`wx-2Gr4AS wx-calendar ${c!=="normal"&&c!=="both"?"wx-part":""} ${u}`,children:t.jsxs("div",{className:"wx-2Gr4AS wx-wrap",children:[t.jsx(et,{date:s,part:c,type:f,onShift:k}),t.jsxs("div",{children:[t.jsx(w,{value:e,current:s,onCurrentChange:r,part:c,markers:l,onCancel:g,onChange:m,onShift:k}),f==="month"&&d.length>0&&t.jsx("div",{className:"wx-2Gr4AS wx-buttons",children:d.map(p=>t.jsx("div",{className:"wx-2Gr4AS wx-button-item",children:t.jsx(we,{onClick:b=>h(b,it(p)),children:x(p)})},p))})]})]})})}function se(e){let{words:s=null,optional:r=!1,children:c}=e,l=n.useContext(U);const i=n.useMemo(()=>{let u=l;return(!u||!u.extend)&&(u=O.locale(xe.en)),s!==null&&(u=u.extend(s,r)),u},[s,r,l]);return t.jsx(U.Provider,{value:i,children:c})}function Ne(e,s,r,c){if(!e||c){const l=s?new Date(s):new Date;l.setDate(1),r(l)}else if(e.getDate()!==1){const l=new Date(e);l.setDate(1),r(l)}}const xt=["clear","today"];function Ee({value:e,current:s,markers:r=null,buttons:c=xt,css:l="",onChange:i}){const[u,o]=H.useWritableProp(e),[a,x]=H.useWritableProp(s);n.useEffect(()=>{Ne(a,u,x,!1)},[u,a]);const f=n.useCallback(d=>{const h=d.value;h?(o(new Date(h)),Ne(a,new Date(h),x,!0)):o(null),i&&i({value:h?new Date(h):null})},[i,a]),v=n.useCallback(d=>{x(d)},[x]);return a?t.jsx(se,{children:t.jsx(ne,{value:u,current:a,markers:r,buttons:c,css:l,onChange:f,onCurrentChange:v})}):null}function me(e){return e||(e={}),e.width||(e.width="unset"),e}const ft=["clear","today"];function dt({value:e,id:s,disabled:r=!1,error:c=!1,placeholder:l="",format:i="",buttons:u=ft,css:o="",title:a="",tooltip:x,editable:f=!1,clear:v=!1,onChange:d,dropdown:h={}}){const{calendar:g,formats:k}=(n.useContext(U)||Q()).getRaw(),m=i||k?.dateFormat;let w=typeof m=="function"?m:O.dateToString(m,g);const[p,b]=n.useState(e),[R,N]=n.useState(!1);n.useEffect(()=>{b(e)},[e]);function C(){N(!1)}function j(S){const A=S===p||S&&p&&S.valueOf()===p.valueOf()||!S&&!p;b(S),A||d&&d({value:S}),setTimeout(C,1)}const E=n.useMemo(()=>p?w(p):"",[p,w]);function $({value:S,input:A}){if(!f&&!v||A)return;let B=typeof f=="function"?f(S):S?new Date(S):null;B=isNaN(B)?p||null:B||null,j(B)}return n.useEffect(()=>{const S=C;return window.addEventListener("scroll",S),()=>window.removeEventListener("scroll",S)},[]),t.jsxs("div",{className:"wx-1lKOFG wx-datepicker",onClick:()=>N(!0),children:[t.jsx(le,{css:`wx-date-input ${o}`,title:a,tooltip:x,value:E,id:s,readonly:!f,disabled:r,error:c,placeholder:l,onInput:C,onChange:$,icon:"wxi-calendar",clear:v}),R&&!r&&t.jsx(K,{onCancel:C,...me(h),children:t.jsx(Ee,{buttons:u,value:p,onChange:S=>j(S.value)})})]})}const wt=["clear","today"],Fe=({start:e,end:s,current:r,months:c=2,markers:l=null,buttons:i=wt,css:u="",onChange:o})=>{const[a,x]=H.useWritableProp(e),[f,v]=H.useWritableProp(s),[d,h]=n.useState(),[g,k]=n.useState(),m=n.useCallback((C,j,E)=>{const $=new Date(C);return $.setMonth($.getMonth()+j),E&&$.valueOf()===E.valueOf()?E:$},[]),w=n.useCallback(C=>{h(()=>{const j=new Date(C);return j.setDate(1),k(m(j,1)),j})},[m]),p=n.useCallback(C=>{k(()=>{const j=new Date(C);return j.setDate(1),h(m(j,-1)),j})},[m]);n.useEffect(()=>{const C=a;d||w(C?new Date(C):r||new Date)},[a,r,d,w]);const b=n.useCallback(C=>{const j=C.value;let E=a,$=f;const S=j===-1;return S||(C.select?!a||f?(x(E=j),v($=null)):a>j?(v($=a),x(E=j)):v($=j):j?(x(E=new Date(j)),v($=new Date(j))):(x(E=null),v($=null))),(S||!i.includes("done"))&&o&&o({start:E,end:$}),[E,$]},[a,f,i,o]),R=n.useCallback(C=>{const[j]=b(C);j&&w(new Date(j))},[w,a,f]),N=n.useCallback(C=>{const[,j]=b(C);j&&p(new Date(j))},[p,a,f]);return!d||!g?null:c===1?t.jsx(se,{children:t.jsx(ne,{value:{start:a,end:f},current:d,markers:l,buttons:i,css:u,part:"both",onChange:R,onCurrentChange:w})}):t.jsx(se,{children:t.jsxs("div",{className:`wx-p2jCaW wx-rangecalendar ${u}`,children:[t.jsx("div",{className:"wx-p2jCaW wx-half",children:t.jsx(ne,{value:{start:a,end:f},current:d,markers:l,buttons:!1,part:"left",onChange:R,onCurrentChange:w})}),t.jsx("div",{className:"wx-p2jCaW wx-half",children:t.jsx(ne,{value:{start:a,end:f},current:g,markers:l,buttons:i,part:"right",onChange:N,onCurrentChange:p})})]})})},mt=["clear","today"],pt=({value:e,onChange:s,id:r,disabled:c=!1,error:l=!1,placeholder:i="",css:u="",title:o="",tooltip:a,format:x="",months:f=2,buttons:v=mt,editable:d=!1,clear:h=!1,dropdown:g})=>{const[k,m]=H.useWritableProp(e),{calendar:w,formats:p}=(n.useContext(U)||Q()).getRaw(),b=x||p?.dateFormat,R=typeof b=="function"?b:O.dateToString(b,w),[N,C]=n.useState(!1),j=n.useCallback(()=>{C(!1)},[]),E=n.useMemo(()=>k?k.start?R(k.start)+(k.end?` - ${R(k.end)}`:""):R(k):"",[k,R]),$=n.useMemo(()=>k&&k.start||null,[k]),S=n.useMemo(()=>k&&k.end||null,[k]),A=n.useCallback(L=>{const V=L.start||L.end?{start:L.start,end:L.end}:null;m&&m(V),(L.start&&L.end||!L.start&&!L.end)&&(s&&s({value:V}),setTimeout(j,1))},[s,j,m]),B=n.useCallback(L=>{if(!d&&!h)return;const{value:V,input:I}=L;if(I)return;const[Y,J]=V.split(" -").map((P,W)=>{const T=P.trim();let M=typeof d=="function"?d(T):T?new Date(T):null,D=W===0?$:S;return isNaN(M)?D||null:M||null});A({start:Y,end:J})},[d,h,$,S,A]);return n.useEffect(()=>{const L=()=>{j()};return window.addEventListener("scroll",L),()=>{window.removeEventListener("scroll",L)}},[j]),t.jsxs("div",{className:`wx-1b0WDQ wx-daterangepicker ${c?"wx-disabled":""} ${l?"wx-error":""}`,onClick:()=>C(!0),children:[t.jsx(le,{css:`wx-date-input ${u}`,title:o,tooltip:a,value:E,id:r,readonly:!d,disabled:c,placeholder:i,error:l,onChange:B,icon:"wxi-calendar",clear:h}),N&&!c&&t.jsx(K,{onCancel:j,...me(g),children:t.jsx(Fe,{onCancel:j,buttons:v,start:$,end:S,months:f,onChange:A})})]})};function ht({hotkey:e=null,toggleButton:s,children:r}){const c=n.useRef(null),[l,i]=n.useState(!1),u=n.useMemo(()=>`wxi-${l?"collapse":"expand"}`,[l]),o=n.useRef(null);return o.current=()=>{const a=c.current;!l&&a?a.requestFullscreen():l&&document.exitFullscreen(),i(x=>!x)},H.useHotkeys({[e]:()=>o.current()},c),n.useEffect(()=>{const a=()=>{i(document.fullscreenElement===c.current)};return document.addEventListener("fullscreenchange",a),()=>{document.removeEventListener("fullscreenchange",a)}},[]),t.jsxs("div",{className:"wx-13aa5W wx-fullscreen",ref:c,tabIndex:-1,children:[r,s?s(o.current,l):t.jsx(z,{css:"wx-13aa5W wx-fullscreen-button",onClick:o.current,children:t.jsx("i",{className:`wx-13aa5W ${u} wx-fullscreen-icon`,children:" "})})]})}function vt({css:e="",title:s="",tooltip:r,children:c,onClick:l}){return c?t.jsx("i",{title:s,role:"img",className:`wx-mdnST1 wx-icon ${e}`,onClick:l,"data-tooltip-text":r,children:c}):t.jsx("i",{title:s,className:`wx-mdnST1 wx-icon ${e}`,onClick:l,"data-tooltip-text":r})}const gt=[];function jt({id:e,value:s=gt,options:r=[],textOptions:c=null,textField:l="label",keepText:i=!1,placeholder:u="",title:o="",tooltip:a,disabled:x=!1,error:f=!1,checkboxes:v=!1,css:d="",onChange:h,children:g,dropdown:k={}}){const m=q(e),w=n.useRef(null),p=n.useRef(null),[b,R]=H.useWritableProp(s),[N,C]=n.useState(""),[j,E]=n.useState(!1),$=n.useRef(null),S=n.useMemo(()=>b?(c||r).filter(P=>b.includes(P.id)):[],[b,c,r]),A=n.useMemo(()=>{const P=r;return N?P.filter(W=>W[l].toLowerCase().includes(N.toLowerCase())):P},[N,r,l]),B=n.useCallback(P=>{w.current=P.navigate,p.current=P.keydown},[]),L=n.useCallback(()=>{A.length?w.current(0):w.current(null)},[A]),V=n.useCallback(P=>{const{id:W}=P;W&&(R(W),i||C(""),h&&h({value:W}),$.current.focus())},[h,i]),I=n.useCallback((P,W)=>{W&&W.stopPropagation();const T=b.filter(M=>M!==P);R(T),h&&h({value:T})},[b,h]),Y=n.useCallback(()=>b&&b.length?A.findIndex(P=>P.id===b[0]):0,[b,A]),J=n.useCallback(()=>{x||($.current.focus(),w.current(Y()))},[x,Y]);return t.jsxs("div",{title:o,className:`wx-12Wj21 wx-multicombo ${d} ${f?"wx-error":""} ${x?"wx-disabled":""} ${S.length?"wx-not-empty":""} ${j&&!x?"wx-focus":""}`,onClick:J,onKeyDown:P=>p.current(P,Y()),"data-tooltip-text":a,children:[t.jsxs("div",{className:"wx-12Wj21 wx-wrapper",children:[t.jsx("div",{className:"wx-12Wj21 wx-tags",children:S.map(P=>t.jsxs("div",{className:"wx-12Wj21 wx-tag",children:[g?H.snippet(g,{option:P}):P[l],!x&&t.jsx("i",{className:"wx-12Wj21 wx-icon wxi-close",onClick:W=>I(P.id,W)})]},P.id))}),t.jsxs("div",{className:"wx-12Wj21 wx-select",children:[t.jsx("input",{className:"wx-12Wj21 wx-input",id:m,type:"text",value:N,onChange:P=>C(P.target.value),onInput:L,placeholder:u,disabled:x,onFocus:()=>E(!0),onBlur:()=>E(!1),ref:$}),t.jsx("i",{className:"wx-12Wj21 wx-icon wxi-angle-down"})]})]}),!x&&t.jsx(re,{items:A,multiselect:!0,onReady:B,onSelect:V,checkboxes:v,value:b,...k,children:({option:P})=>t.jsx(t.Fragment,{children:g?H.snippet(g,{option:P}):P[l]})})]})}const bt=({total:e=0,pageSize:s=20,value:r=1,css:c="",onChange:l})=>{const[i,u]=H.useWritableProp(s),[o,a]=H.useWritableProp(r),x=(n.useContext(U)||Q()).getGroup("core"),f=Math.ceil(e/i),v=(o-1)*i,d=Math.min(o*i,e),h=(m,w)=>{Number.isNaN(m)||(w||a(m),m=Math.max(1,Math.min(m,f)),w&&a(m),m!==o&&setTimeout(()=>{l&&l({value:m,from:(m-1)*i,to:Math.min(m*i,e),pageSize:i})}))};function g(m){switch(m){case"first":h(1);break;case"prev":h(o-1);break;case"next":h(o+1);break;case"last":h(f);break}}const k=m=>{const w=m.target.value*1;Number.isNaN(w)||(u(w),l&&l({value:o,from:v,to:d,pageSize:w}))};return t.jsxs("div",{className:`wx-35Np0p wx-pager ${c}`,children:[t.jsxs("div",{className:"wx-35Np0p wx-left",children:[t.jsxs("span",{children:[x("Rows per page"),": "]}),t.jsx("input",{type:"number",min:1,className:"wx-35Np0p wx-input",value:i,onChange:k})]}),t.jsxs("div",{className:"wx-35Np0p wx-center",children:[t.jsx("i",{className:"wx-35Np0p wx-icon wxi-angle-dbl-left"+(o===1?" wx-disabled":""),onClick:()=>g("first")}),t.jsx("i",{className:"wx-35Np0p wx-icon wxi-angle-left"+(o===1?" wx-disabled":""),onClick:()=>g("prev")}),t.jsx("input",{type:"text",value:o,className:"wx-35Np0p wx-input",onChange:m=>h(m.target.value*1),onBlur:m=>h(m.target.value*1,!0)}),t.jsx("i",{className:"wx-35Np0p wx-icon wxi-angle-right"+(o===f?" wx-disabled":""),onClick:()=>g("next")}),t.jsx("i",{className:"wx-35Np0p wx-icon wxi-angle-dbl-right"+(o===f?" wx-disabled":""),onClick:()=>g("last")})]}),t.jsxs("div",{className:"wx-35Np0p wx-right",children:[x("Total pages"),": ",f]})]})};function Ie({id:e,label:s="",value:r,name:c="",inputValue:l="",disabled:i=!1,css:u="",onChange:o}){const a=n.useId(),x=q(e)||a,[f,v]=n.useState(!1),d=r!==void 0,h=d?r:f;function g(k){const m=k.target.checked;d||v(m),m&&o&&o({value:!0,inputValue:l})}return t.jsxs("div",{className:`wx-3lDF1s wx-radio ${u}`,children:[t.jsx("input",{type:"radio",className:"wx-3lDF1s wx-input",id:x,disabled:i,name:c,value:l,checked:h,onChange:g}),t.jsxs("label",{htmlFor:x,className:"wx-3lDF1s wx-label",children:[t.jsx("span",{className:"wx-3lDF1s wx-circle"}),s&&t.jsx("span",{className:"wx-3lDF1s wx-radio-text",children:s})]})]})}function kt({options:e=[{}],value:s="",onChange:r,type:c="",css:l=""}){const i=O.uid(),[u,o]=n.useState(s);n.useEffect(()=>{o(s)},[s]);function a(x){const f=x.inputValue;o(f),r&&r({value:f})}return t.jsx(te.Provider,{value:null,children:t.jsx("div",{className:`wx-38w70j wx-radiogroup ${c&&`wx-${c}`} ${l}`,children:e.map(x=>t.jsx("div",{className:"wx-38w70j wx-item",children:t.jsx(Ie,{label:x.label,inputValue:x.id,value:u===x.id,name:i,onChange:a})},x.id))})})}function Nt({value:e="",options:s=[],textOptions:r=null,placeholder:c="",disabled:l=!1,error:i=!1,title:u="",tooltip:o,textField:a="label",clear:x=!1,css:f="",children:v,onChange:d,dropdown:h={}}){const g=n.useRef(null),k=n.useRef(null);let[m,w]=H.useWritableProp(e);function p(j){g.current=j.navigate,k.current=j.keydown}const b=n.useMemo(()=>m||m===0?(r||s).find(j=>j.id===m):null,[m,r,s]),R=n.useCallback(({id:j})=>{(j||j===0)&&(w(j),g.current(null),d&&d({value:j}))},[w,d]),N=n.useCallback(j=>{j.stopPropagation(),w(""),d&&d({value:""})},[w,d]),C=n.useCallback(()=>s.findIndex(j=>j.id===m),[s,m]);return t.jsxs("div",{className:`wx-2YgblL wx-richselect ${f} ${i?"wx-2YgblL wx-error":""} ${l?"wx-2YgblL wx-disabled":""} ${v?"":"wx-2YgblL wx-nowrap"}`,title:u,onClick:()=>g.current(C()),onKeyDown:j=>k.current(j,C()),tabIndex:0,"data-tooltip-text":o,children:[t.jsx("div",{className:"wx-2YgblL wx-label",children:b?v?v(b):b[a]:c?t.jsx("span",{className:"wx-2YgblL wx-placeholder",children:c}):" "}),x&&!l&&m?t.jsx("i",{className:"wx-2YgblL wx-icon wxi-close",onClick:N}):t.jsx("i",{className:"wx-2YgblL wx-icon wxi-angle-down"}),!l&&t.jsx(re,{items:s,onReady:p,onSelect:R,...h,children:({option:j})=>v?v(j):j[a]})]})}const Ct=({options:e=[],value:s="",css:r="",children:c,onChange:l})=>{const[i,u]=n.useState(s),o=a=>{u(a),l&&l({value:a})};return n.useEffect(()=>{u(s)},[s]),t.jsx("div",{className:`wx-0hMO7P wx-segmented ${r}`,children:e.map(a=>t.jsx("button",{className:`wx-0hMO7P wx-segment ${a.css} ${a.id===i?"wx-selected":""}`,title:a.title,onClick:()=>o(a.id),"data-tooltip-text":a.tooltip,children:c?H.snippet(c,{option:a}):t.jsxs(t.Fragment,{children:[a.icon&&t.jsx("i",{className:`wx-0hMO7P wx-icon ${a.icon} ${a.label?"":"wx-only"}`}),a.label&&t.jsx("span",{className:"wx-0hMO7P wx-label",children:a.label})]})},a.id))})};function yt({value:e,options:s=[],placeholder:r="",title:c="",tooltip:l,disabled:i=!1,error:u=!1,textField:o="label",clear:a=!1,id:x,css:f="",onChange:v}){const d=q(x),[h,g]=n.useState(e||""),k=n.useCallback(w=>{const p=w.target.value;g(p),v&&v({value:p})},[v]),m=n.useCallback(()=>{g(""),v&&v({value:""})},[v]);return t.jsxs("div",{className:"wx-2yx1Fo wx-select-box "+f,"data-tooltip-text":l,children:[t.jsxs("select",{id:d,value:h,disabled:i,className:`wx-2yx1Fo wx-select ${u?"wx-2yx1Fo wx-error":""}`,title:c,onChange:k,children:[t.jsx("option",{value:"",children:r}),s.map(w=>t.jsx("option",{value:w.id,children:w[o]},w.id))]}),a&&!i&&h?t.jsx("i",{className:"wx-2yx1Fo wx-icon wxi-close",onClick:m}):t.jsx("i",{className:"wx-2yx1Fo wx-icon wxi-angle-down"})]})}function ue({id:e,label:s="",css:r="",min:c=0,max:l=100,value:i=0,step:u=1,title:o="",tooltip:a,disabled:x=!1,onChange:f,width:v=""}){const d=q(e),[h,g]=H.useWritableProp(i),k=n.useRef({value:h,input:h}),m=n.useMemo(()=>(h-c)/(l-c)*100+"%",[h,c,l]),w=n.useMemo(()=>x?"":`linear-gradient(90deg, var(--wx-slider-primary) 0% ${m}, var(--wx-slider-background) ${m} 100%)`,[x,m]);function p({target:C}){const j=C.value*1;g(j),f&&f({value:j,previous:k.current.input,input:!0}),k.current.input=j}function b({target:C}){const j=C.value*1;g(j),f&&f({value:j,previous:k.current.value}),k.current.value=j}n.useEffect(()=>{g(i)},[i]);const R=n.useRef(null);n.useEffect(()=>{if(R.current)return R.current.addEventListener("change",b),()=>{R.current&&R.current.removeEventListener("change",b)}},[R,b]);const N={...v&&{width:v}};return t.jsxs("div",{className:`wx-2EDJ8G wx-slider ${r}`,style:N,title:o,"data-tooltip-text":a,children:[s&&t.jsx("label",{className:"wx-2EDJ8G wx-label",htmlFor:d,children:s}),t.jsx("div",{className:"wx-2EDJ8G wx-inner",children:t.jsx("input",{id:d,className:"wx-2EDJ8G wx-input",type:"range",min:c,max:l,step:u,disabled:x,value:h,onInput:p,style:{background:w},ref:R})})]})}function Rt({id:e,value:s=!1,disabled:r=!1,css:c="",onChange:l}){const i=q(e),[u,o]=H.useWritableProp(s),a=n.useCallback(x=>{const f=x.target.checked;o(f),l&&l({value:f})},[l]);return t.jsxs("label",{className:`wx-2dAR5c wx-switch ${c}`,children:[t.jsx("input",{className:"wx-2dAR5c wx-input",type:"checkbox",checked:u,onChange:a,disabled:r,id:i}),t.jsx("span",{className:"wx-2dAR5c wx-box"})]})}const Mt=({options:e=[],value:s="",type:r="top",css:c="",onChange:l})=>{const[i,u]=H.useWritableProp(s),o=a=>{u(a),l&&l({value:a})};return t.jsx("div",{className:`wx-138fWJ wx-tabs wx-${r} ${c}`,children:e.map(a=>t.jsxs("button",{className:`wx-138fWJ wx-tab ${a.css} ${a.id===i?"wx-active":""}`,title:a.title,onClick:()=>o(a.id),"data-tooltip-text":a.tooltip,children:[a.icon&&t.jsx("i",{className:`wx-138fWJ wx-icon ${a.icon} ${a.label?"":"wx-only"}`}),a.label&&t.jsx("span",{className:"wx-138fWJ wx-label",children:a.label})]},a.id))})},St=({id:e,value:s=0,step:r=1,min:c=0,max:l=1/0,error:i=!1,disabled:u=!1,readonly:o=!1,css:a="",tooltip:x,onChange:f})=>{const v=q(e),[d,h]=H.useWritableProp(s),g=n.useCallback(()=>{if(o||d<=c)return;const p=d-r;h(p),f&&f({value:p})},[d,o,c,r,f]),k=n.useCallback(()=>{if(o||d>=l)return;const p=d+r;h(p),f&&f({value:p})},[d,o,l,r,f]),m=n.useCallback(()=>{if(!o){const p=Math.round(Math.min(l,Math.max(d,c))/r)*r,b=isNaN(p)?Math.max(c,0):p;h(b),f&&f({value:b})}},[o,d,l,c,r,f]),w=n.useCallback(p=>{const b=p.target.value*1;h(b),f&&f({value:b,input:!0})},[f]);return t.jsxs("div",{className:`wx-22t21n wx-counter ${a} ${u?"wx-disabled":""} ${o?"wx-readonly":""} ${i?"wx-error":""}`,"data-tooltip-text":x,children:[t.jsx("button",{"aria-label":"-",className:"wx-22t21n wx-btn wx-btn-dec",disabled:u,onClick:g,children:t.jsx("svg",{className:"wx-22t21n wx-dec",width:"12",height:"2",viewBox:"0 0 12 2",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M11.2501 1.74994H0.750092V0.249939H11.2501V1.74994Z"})})}),t.jsx("input",{id:v,type:"text",className:"wx-22t21n wx-input",disabled:u,readOnly:o,required:!0,value:d,onBlur:m,onInput:w}),t.jsx("button",{"aria-label":"-",className:"wx-22t21n wx-btn wx-btn-inc",disabled:u,onClick:k,children:t.jsx("svg",{className:"wx-22t21n wx-inc",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:`M11.2501
2
+ 6.74994H6.75009V11.2499H5.25009V6.74994H0.750092V5.24994H5.25009V0.749939H6.75009V5.24994H11.2501V6.74994Z`})})})]})};function Dt({notice:e={}}){function s(){e.remove&&e.remove()}return t.jsxs("div",{className:`wx-11sNg5 wx-notice wx-${e.type?e.type:""}`,role:"status","aria-live":"polite",children:[t.jsx("div",{className:"wx-11sNg5 wx-text",children:e.text}),t.jsx("div",{className:"wx-11sNg5 wx-button",children:t.jsx("i",{className:"wx-11sNg5 wxi-close",onClick:s})})]})}function Tt({data:e=[]}){return t.jsx("div",{className:"wx-3nwoO9 wx-notices",children:e.map(s=>t.jsx(Dt,{notice:s},s.id))})}function Le({title:e="",buttons:s=["cancel","ok"],header:r,children:c,footer:l,css:i="",onConfirm:u,onCancel:o}){const a=(n.useContext(U)||Q()).getGroup("core"),x=n.useRef(null);n.useEffect(()=>{x.current?.focus()},[]);function f(d){switch(d.code){case"Enter":{const h=d.target.tagName;if(h==="TEXTAREA"||h==="BUTTON")return;u&&u({event:d});break}case"Escape":o&&o({event:d});break}}function v(d,h){const g={event:d,button:h};h==="cancel"?o&&o(g):u&&u(g)}return t.jsx("div",{className:`wx-1FxkZa wx-modal ${i}`,ref:x,tabIndex:0,onKeyDown:f,children:t.jsxs("div",{className:"wx-1FxkZa wx-window",children:[r||(e?t.jsx("div",{className:"wx-1FxkZa wx-header",children:e}):null),t.jsx("div",{children:c}),l||s&&t.jsx("div",{className:"wx-1FxkZa wx-buttons",children:s.map(d=>t.jsx("div",{className:"wx-1FxkZa wx-button",children:t.jsx(z,{type:`block ${d==="ok"?"primary":"secondary"}`,onClick:h=>v(h,d),children:a(d)})},d))})]})})}function $t({children:e},s){const[r,c]=n.useState(null),[l,i]=n.useState([]);return n.useImperativeHandle(s,()=>({showModal:u=>{const o={...u};return c(o),new Promise((a,x)=>{o.resolve=f=>{c(null),a(f)},o.reject=f=>{c(null),x(f)}})},showNotice:u=>{u={...u},u.id=u.id||O.uid(),u.remove=()=>i(o=>o.filter(a=>a.id!==u.id)),u.expire!=-1&&setTimeout(u.remove,u.expire||5100),i(o=>[...o,u])}}),[]),t.jsxs(t.Fragment,{children:[e,r&&t.jsx(Le,{title:r.title,buttons:r.buttons,onConfirm:r.resolve,onCancel:r.reject,children:r.message}),t.jsx(Tt,{data:l})]})}const Vt=n.forwardRef($t);function Pt(e){let{children:s}=e,r=n.useRef();const c=n.useMemo(()=>({showNotice:l=>r.current.showNotice(l),showModal:l=>r.current.showModal(l)}),[]);return t.jsx(De.Provider,{value:c,children:t.jsx(Vt,{ref:r,children:s})})}function ie({label:e="",position:s="",error:r=!1,type:c="",required:l=!1,id:i,css:u="",children:o,width:a=""}){const x=n.useMemo(()=>i===void 0?O.uid():i,[i]),f={...a&&{width:a}};return t.jsx(te.Provider,{value:x,children:t.jsxs("div",{style:f,className:`wx-2oVUvC wx-field wx-${s} ${u} ${r?"wx-error":""} ${l?"wx-required":""}`.trim(),children:[e&&(x?t.jsx("label",{className:"wx-2oVUvC wx-label",htmlFor:x,children:e}):t.jsx("div",{className:"wx-2oVUvC wx-label",children:e})),t.jsx("div",{className:`wx-2oVUvC wx-field-control wx-${c}`,children:o})]})})}const Ae=({value:e=!1,type:s="",icon:r="",disabled:c=!1,iconActive:l="",onClick:i,title:u="",tooltip:o,css:a="",text:x="",textActive:f="",children:v,active:d,onChange:h})=>{const[g,k]=H.useWritableProp(e),m=n.useMemo(()=>(g?"pressed":"")+(s?" "+s:""),[g,s]),w=n.useCallback(p=>{let b=!g;i&&i(p),p.defaultPrevented||(k(b),h&&h({value:b}))},[g,i,h]);return g&&d?t.jsx(z,{title:u,tooltip:o,text:g&&f||x,css:a,type:m,icon:g&&l||r,onClick:w,disabled:c,children:H.snippet(d,{value:g})}):v?t.jsx(z,{title:u,tooltip:o,text:g&&f||x,css:a,type:m,icon:g&&l||r,onClick:w,disabled:c,children:v}):t.jsx(z,{title:u,tooltip:o,text:g&&f||x,css:a,type:m,icon:g&&l||r,onClick:w,disabled:c})},Ce=new Date(0,0,0,0,0);function Et({value:e=Ce,id:s,title:r="",tooltip:c,css:l="",disabled:i=!1,error:u=!1,format:o="",onChange:a,dropdown:x}){let[f,v]=H.useWritableProp(e);const{calendar:d,formats:h}=(n.useContext(U)||Q()).getRaw(),g=d.clockFormat==12,k=23,m=59,w=n.useMemo(()=>{const y=o||h?.timeFormat;return typeof y=="function"?y:O.dateToString(y,d)},[o,h,d]),p=n.useMemo(()=>w(new Date(0,0,0,1)).indexOf("01")!=-1,[w]),b=(y,F)=>(y<10&&F?`0${y}`:`${y}`).slice(-2),R=y=>b(y,!0),N=y=>`${y}`.replace(/[^\d]/g,"")||0,C=y=>g&&(y=y%12,y===0)?"12":b(y,p),j=n.useCallback((y,F)=>(y=N(y),Math.min(y,F)),[]),[E,$]=n.useState(null),S=f||Ce,A=j(S.getHours(),k),B=j(S.getMinutes(),m),L=A>12,V=C(A),I=R(B),Y=n.useMemo(()=>w(new Date(0,0,0,A,B)),[A,B,w]),J=n.useCallback(()=>{$(!0)},[]),P=n.useCallback(()=>{const y=new Date(S);y.setHours(y.getHours()+(L?-12:12)),v(y),a&&a({value:y})},[S,L,a]),W=n.useCallback(({value:y})=>{if(S.getHours()===y)return;const F=new Date(S);F.setHours(y),v(F),a&&a({value:F})},[S,a]),T=n.useCallback(({value:y})=>{if(S.getMinutes()===y)return;const F=new Date(S);F.setMinutes(y),v(F),a&&a({value:F})},[S,a]),M=n.useCallback(y=>(y=j(y,k),g&&(y=y*1,y===12&&(y=0),L&&(y+=12)),y),[j,g,L]),D=n.useCallback(()=>{$(null)},[]);return t.jsxs("div",{className:`wx-7f497i wx-timepicker ${u?"wx-7f497i wx-error":""} ${i?"wx-7f497i wx-disabled":""}`,onClick:i?void 0:J,style:{cursor:i?"default":"pointer"},children:[t.jsx(le,{id:s,css:`wx-date-input ${l}`,title:r,tooltip:c,value:Y,readonly:!0,disabled:i,error:u,icon:"wxi-clock"}),E&&!i&&t.jsx(K,{onCancel:D,...me(x),children:t.jsxs("div",{className:"wx-7f497i wx-wrapper",children:[t.jsxs("div",{className:"wx-7f497i wx-timer",children:[t.jsx("input",{className:"wx-7f497i wx-digit",value:V,onChange:y=>{const F=M(y.target.value);W({value:F})}}),t.jsx("div",{className:"wx-7f497i wx-separator",children:":"}),t.jsx("input",{className:"wx-7f497i wx-digit",value:I,onChange:y=>{const F=j(y.target.value,m);T({value:F})}}),g&&t.jsx(Ae,{value:L,onClick:P,active:()=>t.jsx("span",{children:"pm"}),children:t.jsx("span",{children:"am"})})]}),t.jsx(ie,{width:"unset",children:t.jsx(ue,{label:d.hours,value:A,width:"unset",onChange:W,max:k})}),t.jsx(ie,{width:"unset",children:t.jsx(ue,{label:d.minutes,value:B,width:"unset",onChange:T,max:m})})]})})]})}function ye(e){return e==="point"?"point":e.split("-")[0]}function Ft(e){if(e==="point")return"center";const s=e.split("-");return s.length===1?"center":s[1]}function oe(e,s,r){const c=getComputedStyle(e).getPropertyValue(s);return parseInt(c)||r}function It(e){const{at:s="top-center",arrow:r=!1,touch:c=!1,overflow:l=!1,delay:i=300,content:u=null,children:o,css:a=""}=e;function x(T){if(l&&T.scrollWidth<=T.clientWidth)return null;const M=T.getAttribute?.("data-tooltip-text");return M||null}const f=e.resolver||x,v=n.useMemo(()=>ye(s),[s]),d=n.useMemo(()=>Ft(s),[s]),h=n.useMemo(()=>s==="point"?"point":`${v}-${d}`,[s,v,d]),g=n.useRef(null),k=n.useRef(!1),[m,w]=n.useState(null),[p,b]=n.useState(null),[R,N]=n.useState(null),[C,j]=n.useState(!1),E=n.useRef(p);n.useEffect(()=>{E.current=p},[p]);const $=n.useMemo(()=>p!==null&&(!!p.result||u!=null),[p,u]);function S(){return oe(m,"--wx-tooltip-point-offset",14)}function A(){return oe(m,"--wx-tooltip-arrow-size",6)}function B(T,M,D,y){if(v==="point")return"50%";const F=y?.getBoundingClientRect()??{top:0,left:0},Z=T/2;let G,_;return v==="top"||v==="bottom"?(_=M.x-(y?.scrollLeft??0)+F.left,d==="start"?G=D.left+T+Z:d==="end"?G=D.right-T-Z:G=D.left+D.width/2):(_=M.y-(y?.scrollTop??0)+F.top,d==="start"?G=D.top+T+Z:d==="end"?G=D.bottom-T-Z:G=D.top+D.height/2),`${G-_}px`}n.useEffect(()=>{if(!m||!p)return void N(null);const T=s==="point"?S():0,M=O.calculatePosition(m,p.anchor,h,p.mouseX+T,p.mouseY+T);if(M===null)return void N(null);const D=p.anchor.getBoundingClientRect(),y=O.getAbsParent(m),F=ye(M.at);let Z="50%";if(M&&r&&s!=="point"){const _=A();F==="top"?M.y-=_:F==="bottom"?M.y+=_:F==="left"?M.x-=_:F==="right"&&(M.x+=_),Z=B(_,M,D,y)}const G=oe(m,"--wx-tooltip-z-index",1002);N({x:Math.round(M.x),y:Math.round(M.y),z:Math.max(M.z,G),side:F,arrowOffset:Z})},[m,p,s,r,v,d,h]);function L(T,M){if(!k.current||("ontouchstart"in window||window.navigator.maxTouchPoints>0)&&!c)return null;for(;T&&T!==g.current;T=T.parentNode){if(T.nodeType!==window.Node.ELEMENT_NODE)continue;const y=f(T,M);if(y!=null)return{result:y,anchor:T,mouseX:M.clientX,mouseY:M.clientY}}return null}const V=n.useRef(void 0),I=n.useRef(!1);function Y(T,...M){clearTimeout(V.current),V.current=setTimeout(T,i,...M)}function J(T){if(T.target.closest(".wx-tooltip-area")!==g.current){k.current=!1,b(null),clearTimeout(V.current);return}k.current=!0;const M=E.current;if(M?.anchor?.contains(T.target)){clearTimeout(V.current),I.current=!1;const D=f(T.target,T);if(D!=null){b({result:D,anchor:T.target,mouseX:T.clientX,mouseY:T.clientY});return}}if(M!==null){const D=L(T.target,T);D?(clearTimeout(V.current),I.current=!1,b(D),j(!1)):I.current||(I.current=!0,Y(()=>{I.current=!1,b(null)}))}else Y(()=>{b(L(T.target,T)),j(!0)})}function P(){Y(()=>{I.current=!1,k.current=!1,b(null)})}n.useEffect(()=>{function T(){clearTimeout(V.current),b(null)}return window.addEventListener("scroll",T,{capture:!0,passive:!0}),()=>{clearTimeout(V.current),window.removeEventListener("scroll",T,{capture:!0})}},[]);const W=["wx-tooltip",a,r&&R?.side==="top"?"wx-arrow-top":"",r&&R?.side==="bottom"?"wx-arrow-bottom":"",r&&R?.side==="left"?"wx-arrow-left":"",r&&R?.side==="right"?"wx-arrow-right":"",C?"":"wx-tooltip-transition","wx-aab5ZNfz"].filter(Boolean).join(" ");return t.jsxs("div",{ref:g,className:"wx-tooltip-area wx-aab5ZNfz",role:"none",onMouseMove:J,onMouseLeave:P,children:[$?t.jsx(de,{children:t.jsx("div",{className:W,role:"tooltip",ref:w,style:{translate:`${R?.x??0}px ${R?.y??0}px`,zIndex:R?.z??20,visibility:R?void 0:"hidden","--wx-arrow-offset":R?.arrowOffset??"50%"},children:t.jsx("div",{className:"wx-tooltip-wrapper wx-aab5ZNfz",children:t.jsx("div",{className:"wx-tooltip-inner wx-aab5ZNfz",children:typeof p.result=="string"?u?t.jsx(u,{data:p.result}):t.jsx("div",{className:"wx-tooltip-text wx-aab5ZNfz",children:p.result}):u?t.jsx(u,{...p.result}):t.jsx("div",{className:"wx-tooltip-text wx-aab5ZNfz",children:p.result?.data})})})})}):null,o]})}function Lt({children:e}){return t.jsx("div",{className:"wx-KgpO9N wx-modal",children:t.jsx("div",{className:"wx-KgpO9N wx-window",children:e})})}function At({position:e="right",css:s="",children:r,onCancel:c}){const l=n.useRef(null);return n.useEffect(()=>O.clickOutside(l.current,c).destroy,[]),t.jsx("div",{ref:l,className:`wx-2L733M wx-sidearea wx-pos-${e} ${s}`,children:r})}const Re="#dfe2e6",Me="#2c2f3c",Wt=.75;function Se(e){if(e=e?.trim()||"",!e)return"";const s=e.split(/\s+/);return(s[0][0]+(s[1]?.[0]||"")).toUpperCase().slice(0,2)}function Ht(e){let s=e.replace("#","");if(s.length===3&&(s=s[0]+s[0]+s[1]+s[1]+s[2]+s[2]),s.length!==6)return Me;const r=parseInt(s.slice(0,2),16)/255,c=parseInt(s.slice(2,4),16)/255,l=parseInt(s.slice(4,6),16)/255;return .299*r+.587*c+.114*l>.5?Me:"#ffffff"}function Bt(e){const{value:s,size:r=32,limit:c,css:l=""}=e,i=n.useRef(null),[u,o]=n.useState(null),a=n.useMemo(()=>s?Array.isArray(s)?s:[s]:[],[s]),x=n.useMemo(()=>{if(u==null||u<=0)return null;const m=1+(u/r-1)/Wt;return Math.max(1,Math.floor(m))},[u,r]),f=n.useMemo(()=>{const m=c!=null?Math.min(a.length,c):a.length;return x!=null?Math.min(m,x):m},[a,c,x]),v=n.useMemo(()=>a.slice(0,f),[a,f]),d=n.useMemo(()=>Math.max(0,a.length-f),[a,f]);n.useEffect(()=>{const m=i.current;if(!m)return;const w=new ResizeObserver(p=>{const b=p[0];b&&o(b.contentRect.width)});return w.observe(m),()=>w.disconnect()},[]);const h=Math.round(r*.4),g={width:r+"px",height:r+"px",minWidth:r+"px",minHeight:r+"px",fontSize:h+"px"};function k(m,w){const p=w===0?"0":`${r*-.25}px`,b=m.avatar?"transparent":m.color||Re,R=m.avatar?"transparent":Ht(m.color||Re);return{marginLeft:p,backgroundColor:b,color:R}}return t.jsx("div",{className:`wx-avatar-root wx-aadkRiRf ${l}`,ref:i,children:v.length>0&&t.jsx("div",{className:"wx-avatar-stack wx-aadkRiRf",children:v.map((m,w)=>t.jsxs("div",{className:["wx-avatar","wx-avatar-item",w===v.length-1&&d>0?"wx-avatar-overflow":"","wx-aadkRiRf"].filter(Boolean).join(" "),style:{...g,...k(m,w)},children:[m.avatar?t.jsx("img",{src:m.avatar,alt:"",loading:"lazy"}):Se(m.name)?t.jsx("span",{className:"wx-aadkRiRf",children:Se(m.name)}):null,w===v.length-1&&d>0&&t.jsxs("span",{className:"wx-avatar-overflow-badge wx-aadkRiRf",children:["+",d]})]},m.id))})})}function Ot(){return t.jsx(t.Fragment,{})}function Yt(e){const{fonts:s=!0,children:r}=e;return t.jsx(ee.Provider,{value:"material",children:t.jsxs(t.Fragment,{children:[r&&t.jsx("div",{className:"wx-theme wx-material-theme",children:r}),s&&t.jsxs(t.Fragment,{children:[t.jsx("link",{rel:"preconnect",href:"https://cdn.svar.dev",crossOrigin:"true"}),t.jsx(Ot,{}),t.jsx("link",{rel:"stylesheet",href:"https://cdn.svar.dev/fonts/wxi/wx-icons.css"})]})]})})}function We(){return t.jsx(t.Fragment,{})}function Jt(e){const{fonts:s=!0,children:r}=e;return t.jsx(ee.Provider,{value:"willow",children:t.jsxs(t.Fragment,{children:[r&&r&&t.jsx("div",{className:"wx-theme wx-willow-theme",children:r}),s&&t.jsxs(t.Fragment,{children:[t.jsx("link",{rel:"preconnect",href:"https://cdn.svar.dev",crossOrigin:"true"}),t.jsx(We,{}),t.jsx("link",{rel:"stylesheet",href:"https://cdn.svar.dev/fonts/wxi/wx-icons.css"})]})]})})}function Gt(e){const{fonts:s=!0,children:r}=e;return t.jsx(ee.Provider,{value:"willow-dark",children:t.jsxs(t.Fragment,{children:[r&&r&&t.jsx("div",{className:"wx-theme wx-willow-dark-theme",children:r}),s&&t.jsxs(t.Fragment,{children:[t.jsx("link",{rel:"preconnect",href:"https://cdn.svar.dev",crossOrigin:"true"}),t.jsx(We,{}),t.jsx("link",{rel:"stylesheet",href:"https://cdn.svar.dev/fonts/wxi/wx-icons.css"})]})]})})}function _t(e){const s=O.uid();e.setAttribute("data-wx-portal-root",s)}O.setEnv(O.env);Object.defineProperty(exports,"locale",{enumerable:!0,get:()=>O.locale});Object.defineProperty(exports,"en",{enumerable:!0,get:()=>xe.en});exports.Avatar=Bt;exports.Button=z;exports.Calendar=Ee;exports.Checkbox=fe;exports.CheckboxGroup=Je;exports.ColorBoard=$e;exports.ColorPicker=Qe;exports.ColorSelect=Ze;exports.Combo=Xe;exports.Counter=St;exports.DatePicker=dt;exports.DateRangePicker=pt;exports.Dropdown=K;exports.Field=ie;exports.Fullscreen=ht;exports.Globals=Pt;exports.Icon=vt;exports.Locale=se;exports.Material=Yt;exports.Modal=Le;exports.ModalArea=Lt;exports.Month=Ve;exports.MultiCombo=jt;exports.Pager=bt;exports.Popup=Te;exports.Portal=de;exports.RadioButton=Ie;exports.RadioButtonGroup=kt;exports.RangeCalendar=Fe;exports.RichSelect=Nt;exports.Segmented=Ct;exports.Select=yt;exports.SideArea=At;exports.Slider=ue;exports.SuggestDropdown=re;exports.Switch=Rt;exports.Tabs=Mt;exports.Text=le;exports.TextArea=Ye;exports.TimePicker=Et;exports.Tooltip=It;exports.TwoState=Ae;exports.Willow=Jt;exports.WillowDark=Gt;exports.context=Oe;exports.popupContainer=_t;
3
3
  //# sourceMappingURL=index.cjs.map