@svar-ui/react-core 2.6.1 → 2.6.2

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