@svar-ui/react-core 2.4.3 → 2.5.0

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