@svar-ui/react-core 2.2.0 → 2.3.1

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
@@ -1,5 +1,5 @@
1
1
  <div align="center">
2
-
2
+
3
3
  # SVAR React Core | UI Component Library
4
4
 
5
5
  </div>
@@ -18,10 +18,12 @@
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. The components are easily customizable and come with built-in light and dark themes.
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.
22
+
23
+ The library is fully compatible with React 18 and 19.
22
24
 
23
25
  <div align="center">
24
-
26
+
25
27
  <img src="https://svar.dev/images/github/github-core.png" alt="SVAR Core - React UI Library" style="width: 752px;">
26
28
 
27
29
  </div>
@@ -42,6 +44,7 @@ To start using the components from the **Core** package, simply import the packa
42
44
 
43
45
  ```jsx
44
46
  import { Button } from "@svar-ui/react-core";
47
+ import "@svar-ui/react-core/all.css";
45
48
 
46
49
  const myComponent => (<Button>Click me</Button>);
47
50
  ```
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),W=require("@svar-ui/lib-react"),T=require("@svar-ui/lib-dom"),se=require("@svar-ui/core-locales"),ge=require("react-dom");function Ne({value:t="",id:l=T.uid(),placeholder:s="",title:c="",disabled:r=!1,error:i=!1,readonly:u=!1,onChange:a}){const[o,x]=W.useWritableProp(t),f=n.useCallback(p=>{const v=p.target.value;x(v),a&&a({value:v,input:!0})},[a]),d=n.useCallback(p=>{const v=p.target.value;x(v),a&&a({value:v})},[a]),m=n.useRef(null);return n.useEffect(()=>{const p=d,v=m.current;return v.addEventListener("change",p),()=>{v&&v.removeEventListener("change",p)}},[d]),e.jsx("textarea",{className:`wx-3yFVAC wx-textarea ${i?"wx-error":""}`,id:l,disabled:r,placeholder:s,readOnly:u,title:c,value:o,onInput:f,ref:m})}function _({type:t="",css:l="",icon:s="",disabled:c=!1,title:r="",text:i="",children:u,onClick:a}){const o=n.useMemo(()=>{let f=t?t.split(" ").filter(d=>d!=="").map(d=>"wx-"+d).join(" "):"";return l+(l?" ":"")+f},[t,l]),x=f=>{a&&a(f)};return e.jsxs("button",{title:r,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 ne({id:t=T.uid(),label:l="",inputValue:s="",value:c=!1,onChange:r,disabled:i=!1}){const[u,a]=W.useWritableProp(c),o=({target:x})=>{const f=x.checked;a(f),r&&r({value:f,inputValue:s})};return e.jsxs("div",{className:"wx-2IvefP wx-checkbox",children:[e.jsx("input",{type:"checkbox",id:t,disabled:i,className:"wx-2IvefP wx-check",checked:u,value:s,onChange:o}),e.jsxs("label",{htmlFor:t,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 Ce({options:t=[],value:l=[],type:s="",onChange:c}){const r=n.useCallback(i=>{let u;i.value?u=[...l,i.inputValue]:u=l.filter(a=>a!==i.inputValue),c&&c({value:u})},[l,c]);return 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(ne,{label:i.label,inputValue:i.id,value:l.includes(i.id),onChange:r})},i.id))})}function J({position:t="bottom",align:l="start",autoFit:s=!0,onCancel:c=null,width:r="100%",children:i}){const u=n.useRef(null),[a,o]=n.useState(t),[x,f]=n.useState(l);return n.useEffect(()=>{o(t)},[t]),n.useEffect(()=>{f(l)},[l]),n.useEffect(()=>{if(s){const d=u.current;if(d){const m=d.getBoundingClientRect(),p=document.body.getBoundingClientRect();m.right>=p.right&&f("end"),m.bottom>=p.bottom&&o("top")}}},[s,x,a]),n.useEffect(()=>{const d=m=>{c&&c(m)};if(u.current)return T.clickOutside(u.current,d).destroy},[c]),e.jsx("div",{ref:u,className:`wx-32GZ52 wx-dropdown wx-${a}-${x}`,style:{width:r},children:i})}const ye=["#00a037","#37a9ef","#f5a623","#ff4c3b","#a0a0a0","#000000","#ffffff"];function Se({colors:t=ye,value:l="",onChange:s,id:c=T.uid(),clear:r=!1,placeholder:i="",title:u="",disabled:a=!1,error:o=!1}){const[x,f]=n.useState(l),[d,m]=n.useState(!1),p=n.useCallback((h,j)=>{h.stopPropagation(),f(j),m(!1),s&&s({value:j})},[s]),v=n.useCallback(h=>{h.stopPropagation(),f(""),s&&s({value:""})},[s]),w=n.useCallback(()=>{if(a)return!1;m(!0)},[a]);return e.jsxs("div",{className:"wx-121TgJ wx-colorselect",onClick:w,children:[e.jsx("input",{className:"wx-121TgJ wx-input"+(o?" wx-error":"")+(d?" wx-focus":""),title:u,value:x,readOnly:!0,id:c,placeholder:i,disabled:a}),r&&x&&!a&&e.jsx("i",{className:"wx-121TgJ wx-clear wxi-close",onClick:v}),x?e.jsx("div",{className:"wx-121TgJ wx-color wx-selected",style:{backgroundColor:x||"#00a037"}}):e.jsx("div",{className:"wx-121TgJ wx-empty wx-selected"}),d&&e.jsx(J,{onCancel:()=>m(!1),children:e.jsxs("div",{className:"wx-121TgJ wx-colors",children:[e.jsx("div",{className:"wx-121TgJ wx-empty",onClick:h=>p(h,"")}),t.map((h,j)=>e.jsx("div",{className:"wx-121TgJ wx-color",style:{backgroundColor:h},onClick:k=>p(k,h)},j))]})})]})}function ae(t,l){const s=t.firstChild,{moveBlockSlider:c,moveLineSlider:r}=l||{};function i(o){u(o),s.focus(),window.addEventListener("mousemove",u),window.addEventListener("mouseup",a)}function u(o){let x,f,d,m;const p=t.getBoundingClientRect();x=p.left,f=p.top,d=o.clientX-x,m=o.clientY-f,c&&l.moveBlockSlider(d,m),r&&l.moveLineSlider(d)}function a(){s.blur(),window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",a)}return t.addEventListener("mousedown",i),{destroy(){t.removeEventListener("mousedown",i)}}}const Q={_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,r]=l;return s=this.hexToDec(s),c=this.hexToDec(c),r=this.hexToDec(r),[s,c,r]},hsvToRgb(t,l,s){let c,r,i,u,a,o,x,f;switch(c=Math.floor(t/60)%6,r=t/60-c,i=s*(1-l),u=s*(1-r*l),a=s*(1-(1-r)*l),o=0,x=0,f=0,c){case 0:o=s,x=a,f=i;break;case 1:o=u,x=s,f=i;break;case 2:o=i,x=s,f=a;break;case 3:o=i,x=u,f=s;break;case 4:o=a,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,r,i;t/=255,l/=255,s/=255;let u=Math.min(t,l,s),a=Math.max(t,l,s);return r=0,c=a===0?0:1-u/a,i=a,a===u?r=0:a===t&&l>=s?r=60*(l-s)/(a-u)+0:a===t&&l<s?r=60*(l-s)/(a-u)+360:a===l?r=60*(s-t)/(a-u)+120:a===s&&(r=60*(t-l)/(a-u)+240),[r,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()}},De=t=>/^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(t);function re(t){return t?(t=t.toString(16),t.charAt(0)==="#"&&(t=t.slice(1)),De(t)?(t.length===3&&(t=t.slice(0,3).split("").reduce((l,s)=>l+s+s,"")),`#${t.toUpperCase()}`):null):null}const q=n.createContext("willow"),de=n.createContext({}),A=n.createContext(null),Me=Object.freeze(Object.defineProperty({__proto__:null,helpers:de,i18n:A,theme:q},Symbol.toStringTag,{value:"Module"}));function Y(){return T.locale(se.en)}const ce="Block",oe="Line";function we({value:t="#65D3B3",button:l=!1,onChange:s}){const c=(n.useContext(A)||Y()).getGroup("core"),r=n.useRef(null),i=n.useRef(null),[u,a]=n.useState(),[o,x]=n.useState(),[f,d]=n.useState(),[m,p]=n.useState(),[v,w]=W.useWritableProp(t),h=n.useMemo(()=>re(v)||"#65D3B3",[v]),j=n.useMemo(()=>Q.hvsToHex(f||0,1,1),[f]),k=n.useCallback((N,C)=>{const{width:V,height:$}=r.current.getBoundingClientRect();C<0?C=0:C>$&&(C=$),N<0?N=0:N>V&&(N=V),a(C),x(N);let E,M;Q.hexToHvs(h);const L=V/100,B=$/100;E=Math.ceil(N/L)/100,M=Math.ceil(Math.abs(C/B-100))/100;const O=Q.hvsToHex(f||0,E,M);w(O),s&&s({value:O,input:!0})},[h,f,s]),R=n.useCallback(N=>{const C=i.current.getBoundingClientRect().width;N<0?N=0:N>C&&(N=C);const V=Math.round(N*359/C),$=Math.max(Math.min(V,359),0);d($),p(N);let E,M;[,E,M]=Q.hexToHvs(h);const L=Q.hvsToHex($,E,M);w(L),s&&s({value:L,input:!0})},[h,s]),b=n.useCallback(()=>{const[N,C,V]=Q.hexToHvs(h);if(d(N),r.current){const{width:$,height:E}=r.current.getBoundingClientRect();i.current&&p(N*i.current.getBoundingClientRect().width/359),x(C*$),a(Math.abs(E*(V-1)))}},[h]),y=n.useCallback(({target:N})=>{const C=re(N.value);w(C),s&&s({value:C,input:!0}),C&&b()},[s,b]),D=n.useCallback(N=>{N.stopPropagation(),s&&s({value:h})},[h,s]),P=n.useCallback(N=>{const C=N.target,V=C.getAttribute("data-slider")===ce,$=C.getAttribute("data-slider")===oe;let E=window.getComputedStyle(C),M=parseFloat(E.left),L=parseFloat(E.top);const B=N.code;if(V){switch(B){case"ArrowLeft":{M--;break}case"ArrowRight":{M++;break}case"ArrowDown":{L++;break}case"ArrowUp":{L--;break}default:return}k(M,L)}if($){if(B==="ArrowLeft"||B==="ArrowDown")M--;else if(B==="ArrowRight"||B==="ArrowUp")M++;else return;R(M)}N.preventDefault()},[k,R]);n.useEffect(()=>{b()},[b]),n.useEffect(()=>{v!==v&&(w(v),b())},[v,v,b]),n.useEffect(()=>{r.current&&ae(r.current,{moveBlockSlider:k}),i.current&&ae(i.current,{moveLineSlider:R})},[k,R]),n.useEffect(()=>{v!==v&&s&&s({value:v,input:!0})},[v,s]),n.useEffect(()=>{h&&r.current&&b()},[h,b]);const g="wx-1yoKzq";return e.jsxs("div",{className:g+" wx-colorboard",children:[e.jsx("div",{className:g+" wx-color-block",style:{background:j},ref:r,children:e.jsx("div",{className:g+" wx-color-block-slider wx-slider",style:{background:h,top:u+"px",left:o+"px"},tabIndex:0,"data-slider":ce,onKeyDown:P})}),e.jsx("div",{className:g+" wx-color-line",ref:i,children:e.jsx("div",{className:g+" wx-color-line-slider wx-slider",style:{background:j,left:m+"px"},tabIndex:0,"data-slider":oe,onKeyDown:P})}),e.jsxs("div",{className:g+" wx-color-controls",children:[e.jsx("div",{className:g+" wx-color",style:{background:h}}),e.jsx("input",{type:"text",className:g+" wx-text",value:v,onChange:y})]}),l&&e.jsx(_,{onClick:D,type:"secondary",children:c("select")})]})}function Re({value:t="",id:l=void 0,placeholder:s="",title:c="",disabled:r=!1,error:i=!1,clear:u=!1,onChange:a}){let[o,x]=W.useWritableProp(t);const[f,d]=n.useState(!1),m=l||T.uid();function p(){if(r)return!1;d(!0)}function v(h){if(h.input)return;d(!1);const j=h.value;x(j),a&&a({value:j})}function w(h){h.stopPropagation(),x(""),a&&a({value:""})}return e.jsxs("div",{className:"wx-mmT8WH wx-colorpicker",onClick:p,children:[e.jsx("input",{className:"wx-mmT8WH wx-input"+(i?" wx-error":"")+(f?" wx-focus":""),title:c,value:o,readOnly:!0,id:m,placeholder:s,disabled:r}),e.jsx("div",{className:"wx-mmT8WH wx-color",style:{background:o}}),u&&!r&&o&&e.jsx("i",{className:"wx-mmT8WH wxi-close",onClick:w}),f&&e.jsx(J,{onCancel:()=>d(!1),children:e.jsx(we,{value:o,button:"true",onChange:v})})]})}function Pe(){let t=null,l=!1,s,c,r,i;const u=(m,p,v,w)=>{s=m,c=p,r=v,i=w},a=m=>{t=m,l=t!==null,r(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&&(a(v),s?o(v,p):requestAnimationFrame(()=>o(v,p)))};return{move:m=>{const p=T.locateID(m),v=c.findIndex(w=>w.id==p);v!==t&&a(v)},keydown:(m,p)=>{switch(m.code){case"Enter":l?i():a(0);break;case"Space":l||a(0);break;case"Escape":r(t=null);break;case"Tab":r(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 K({items:t=[],children:l,onSelect:s,onReady:c}){const r=n.useRef(),i=n.useRef(Pe()),[u,a]=n.useState(null),o=n.useRef(u),x=(n.useContext(A)||Y()).getGroup("core"),f=d=>{d&&d.stopPropagation(),s&&s({id:t[o.current]?.id})};return n.useEffect(()=>{i.current.init(r.current,t,d=>{a(d),o.current=d},f)},[t,!!r.current]),n.useEffect(()=>{c&&c(i.current)},[]),u===null?null:e.jsx(J,{onCancel:()=>i.current.navigate(null),children:e.jsx("div",{className:"wx-233fr7 wx-list",ref:r,onClick:f,onMouseMove:i.current.move,children:t.length?t.map((d,m)=>e.jsx("div",{className:`wx-233fr7 wx-item ${m===u?"wx-focus":""}`,"data-id":d.id,children:l?W.snippet(l,{option:d}):d.label},d.id)):e.jsx("div",{className:"wx-233fr7 wx-no-data",children:x("No data")})})})}function Te({value:t="",onValueChange:l,id:s=T.uid(),options:c=[],textOptions:r=null,textField:i="label",placeholder:u="",title:a="",disabled:o=!1,error:x=!1,clear:f=!1,children:d,onChange:m}){const p=n.useRef(null),v=n.useRef(null),[w,h]=W.useWritableProp(t),[j,k]=n.useState(!1),[R,b]=n.useState(""),y=n.useRef(null),[D,P]=n.useState(!1),g=n.useMemo(()=>{if(j)return R;if(w||w===0){const F=(r||c).find(I=>I.id===w);if(F)return F[i]}return""},[j,R,w,r,c,i]),N=n.useMemo(()=>!g||!j?c:c.filter(F=>F[i].toLowerCase().includes(g.toLowerCase())),[g,j,c,i]),C=n.useCallback(()=>N.findIndex(F=>F.id===w),[N,w]),V=n.useCallback(F=>{p.current=F.navigate,v.current=F.keydown},[]),$=n.useCallback((F,I)=>{if(F||F===0){let S=c.find(H=>H.id===F);if(k(!1),I&&p.current(null),S&&w!==S.id){const H=S.id;h(H),l&&l(H),m&&m({value:H})}}!D&&I&&y.current.focus()},[c,w,D,l,m]),E=n.useCallback(({id:F})=>{$(F,!0)},[$]),M=n.useCallback(F=>{F&&F.stopPropagation(),h(""),k(!1),l&&l(""),m&&m({value:""})},[l,m]),L=n.useCallback(F=>{if(!c.length)return;if(F===""&&f){M();return}let I=c.find(H=>H[i]===F);I||(I=c.find(H=>H[i].toLowerCase().includes(F.toLowerCase())));const S=I?I.id:w||c[0].id;$(S,!1)},[c,i,f,w,$,M]),B=n.useCallback(()=>{b(y.current.value),k(!0),N.length?p.current(0):p.current(null)},[N.length,p]),O=n.useCallback(()=>{P(!0)},[]),G=n.useCallback(()=>{P(!1),setTimeout(()=>{D||L(g)},200)},[D,L,g]);return e.jsxs("div",{className:"wx-1j11Jk wx-combo",onClick:()=>p.current(C()),onKeyDown:F=>v.current(F,C()),title:a,children:[e.jsx("input",{className:"wx-1j11Jk wx-input "+(x?"wx-error":""),id:s,ref:y,value:g,disabled:o,placeholder:u,onFocus:O,onBlur:G,onInput:B}),f&&!o&&w?e.jsx("i",{className:"wx-1j11Jk wx-icon wxi-close",onClick:M}):e.jsx("i",{className:"wx-1j11Jk wx-icon wxi-angle-down"}),!o&&e.jsx(K,{items:N,onReady:V,onSelect:E,children:({option:F})=>e.jsx(e.Fragment,{children:d?d({option:F}):F[i]})})]})}function Z({value:t="",id:l=T.uid(),readonly:s=!1,focus:c=!1,select:r=!1,type:i="text",placeholder:u="",disabled:a=!1,error:o=!1,inputStyle:x={},title:f="",css:d="",icon:m,clear:p=!1,onChange:v}){const[w,h]=W.useWritableProp(t),j=n.useRef(null),k=n.useMemo(()=>m&&d.indexOf("wx-icon-left")===-1?"wx-icon-right "+d:d,[m,d]),R=n.useMemo(()=>m&&d.indexOf("wx-icon-left")!==-1,[m,d]);n.useEffect(()=>{const g=setTimeout(()=>{c&&j.current&&j.current.focus(),r&&j.current&&j.current.select()},1);return()=>clearTimeout(g)},[c,r]);const b=n.useCallback(g=>{const N=g.target.value;h(N),v&&v({value:N,input:!0})},[v]),y=n.useCallback(g=>v&&v({value:g.target.value}),[v]);function D(g){g.stopPropagation(),h(""),v&&v({value:""})}let P=i;return i!=="password"&&i!=="number"&&(P="text"),n.useEffect(()=>{const g=y,N=j.current;return N.addEventListener("change",g),()=>{N&&N.removeEventListener("change",g)}},[y]),e.jsxs("div",{className:`wx-hQ64J4 wx-text ${k} ${o?"wx-error":""} ${a?"wx-disabled":""} ${p?"wx-clear":""}`,children:[e.jsx("input",{className:"wx-hQ64J4 wx-input",ref:j,id:l,readOnly:s,disabled:a,placeholder:u,type:P,style:x,title:f,value:w,onInput:b}),p&&!a&&w?e.jsxs(e.Fragment,{children:[e.jsx("i",{className:"wx-hQ64J4 wx-icon wxi-close",onClick:D}),R&&e.jsx("i",{className:`wx-hQ64J4 wx-icon ${m}`})]}):m?e.jsx("i",{className:`wx-hQ64J4 wx-icon ${m}`}):null]})}function Ve({date:t,type:l,part:s,onShift:c}){const{calendar:r,formats:i}=n.useContext(A).getRaw(),u=t.getFullYear(),a=n.useMemo(()=>{switch(l){case"month":return T.dateToString(i.monthYearFormat,r)(t);case"year":return T.dateToString(i.yearFormat,r)(t);case"duodecade":{const{start:x,end:f}=T.getDuodecade(u),d=T.dateToString(i.yearFormat,r);return`${d(new Date(x,0,1))} - ${d(new Date(f,11,31))}`}default:return""}},[t,l,u,r,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:a}),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 le({onClick:t,children:l}){return e.jsx("button",{className:"wx-3s8W4d wx-button",onClick:t,children:l})}function fe({value:t,current:l,part:s="",markers:c=null,onCancel:r,onChange:i}){const u=(n.useContext(A)||Y()).getRaw().calendar,a=(u.weekStart||7)%7,o=u.dayShort.slice(a).concat(u.dayShort.slice(0,a)),x=(b,y,D)=>new Date(b.getFullYear(),b.getMonth()+(y||0),b.getDate()+(D||0));let f=s!=="normal";function d(b){const y=b.getDay();return y===0||y===6}function m(){const b=x(l,0,1-l.getDate());return b.setDate(b.getDate()-(b.getDay()-(a-7))%7),b}function p(){const b=x(l,1,-l.getDate());return b.setDate(b.getDate()+(6-b.getDay()+a)%7),b}const v=n.useRef(0);function w(b,y){y.timeStamp!==v.current&&(v.current=y.timeStamp,y.stopPropagation(),i&&i(new Date(new Date(b))),r&&r())}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 b=m(),y=p(),D=l.getMonth();let P=[];for(let g=b;g<=y;g.setDate(g.getDate()+1)){const N={day:g.getDate(),in:g.getMonth()===D,date:g.valueOf()};let C="";if(C+=N.in?"":" wx-inactive",C+=h.indexOf(N.date)>-1?" wx-selected":"",f){const V=N.date==h[0],$=N.date==h[1];V&&!$?C+=" wx-left":$&&!V&&(C+=" wx-right"),N.date>h[0]&&N.date<h[1]&&(C+=" wx-inrange")}if(C+=d(g)?" wx-weekend":"",c){const V=c(g);V&&(C+=" "+V)}P.push({...N,css:C})}return P},[l,h,f,c]),k=n.useRef(null);let R=n.useRef({});return R.current.click=w,n.useEffect(()=>{T.delegateClick(k.current,R.current)},[]),e.jsxs("div",{children:[e.jsx("div",{className:"wx-398RBS wx-weekdays",children:o.map(b=>e.jsx("div",{className:"wx-398RBS wx-weekday",children:b},b))}),e.jsx("div",{className:"wx-398RBS wx-days",ref:k,children:j.map(b=>e.jsx("div",{className:`wx-398RBS wx-day ${b.css} ${b.in?"":"wx-out"}`,"data-id":b.date,children:b.day},b.date))})]})}function $e({value:t,current:l,part:s,onCancel:c,onChange:r,onShift:i}){const[u,a]=W.useWritableProp(t||new Date),[o,x]=W.useWritableProp(l||new Date),f=n.useContext(A).getRaw().calendar,d=f.monthShort||[],m=n.useMemo(()=>o.getMonth(),[o]),p=n.useCallback((h,j)=>{if(h!=null){j.stopPropagation();const k=new Date(o);k.setMonth(h),x(k),i&&i({current:k})}s==="normal"&&a(new Date(o)),c&&c()},[o,s,i,c]),v=n.useCallback(()=>{const h=new Date(me(u,s)||o);h.setMonth(o.getMonth()),h.setFullYear(o.getFullYear()),r&&r(h)},[u,o,s,r]),w=n.useCallback(h=>{const j=h.target.closest("[data-id]");if(j){const k=parseInt(j.getAttribute("data-id"),10);p(k,h)}},[p]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"wx-34U8T8 wx-months",onClick:w,children:d.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(le,{onClick:v,children:f.done})})]})}const X="wx-1XEF33",Fe=({value:t,current:l,onCancel:s,onChange:c,onShift:r,part:i})=>{const u=n.useContext(A).getRaw().calendar,[a,o]=W.useWritableProp(l),[x,f]=W.useWritableProp(t),d=n.useMemo(()=>a.getFullYear(),[a]),m=n.useMemo(()=>{const{start:j,end:k}=T.getDuodecade(d),R=[];for(let b=j;b<=k;++b)R.push(b);return R},[d]),p={click:v};function v(j,k){if(j){k.stopPropagation();const R=new Date(a);R.setFullYear(j),o(R),r&&r({current:R})}i==="normal"&&f(new Date(a)),s&&s()}function w(){const j=new Date(me(x,i)||a);j.setFullYear(a.getFullYear()),c&&c(j)}const h=n.useRef(null);return n.useEffect(()=>{h.current&&T.delegateClick(h.current,p)},[]),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:X+" wx-years",ref:h,children:m.map((j,k)=>e.jsx("div",{className:X+` wx-year ${d==j?"wx-current":""} ${k===0?"wx-prev-decade":""} ${k===11?"wx-next-decade":""}`,"data-id":j,children:j},k))}),e.jsx("div",{className:X+" wx-buttons",children:e.jsx(le,{onClick:w,children:u.done})})]})},ue={month:{component:fe,next:Le,prev:Ee},year:{component:$e,next:We,prev:He},duodecade:{component:Fe,next:Ie,prev:Be}};function Ee(t){return t=new Date(t),t.setMonth(t.getMonth()-1),t}function Le(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 We(t){return t=new Date(t),t.setFullYear(t.getFullYear()+1),t}function Be(t){return t=new Date(t),t.setFullYear(t.getFullYear()-10),t}function Ie(t){return t=new Date(t),t.setFullYear(t.getFullYear()+10),t}function me(t,l){let s;if(l==="normal")s=t;else{const{start:c,end:r}=t;l==="left"?s=c:l=="right"?s=r:s=c&&r}return s}const Ae=["clear","today"];function Oe(t){if(t==="done")return-1;if(t==="clear")return null;if(t==="today")return new Date}function U({value:t,current:l,onCurrentChange:s,part:c="normal",markers:r=null,buttons:i,onShift:u,onChange:a}){const o=n.useContext(A).getGroup("calendar"),[x,f]=n.useState("month"),d=Array.isArray(i)?i:i?Ae:[],m=(j,k)=>{j.preventDefault(),a&&a({value:k})},p=()=>{x==="duodecade"?f("year"):x==="year"&&f("month")},v=j=>{const{diff:k,current:R}=j;if(k===0){x==="month"?f("year"):x==="year"&&f("duodecade");return}if(k){const b=ue[x];s(k>0?b.next(l):b.prev(l))}else R&&s(R);u&&u()},w=j=>{f("month"),a&&a({select:!0,value:j})},h=n.useMemo(()=>ue[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(Ve,{date:l,part:c,type:x,onShift:v}),e.jsxs("div",{children:[e.jsx(h,{value:t,current:l,onCurrentChange:s,part:c,markers:r,onCancel:p,onChange:w,onShift:v}),x==="month"&&d.length>0&&e.jsx("div",{className:"wx-2Gr4AS wx-buttons",children:d.map(j=>e.jsx("div",{className:"wx-2Gr4AS wx-button-item",children:e.jsx(le,{onClick:k=>m(k,Oe(j)),children:o(j)})},j))})]})]})})}function z(t){let{words:l=null,optional:s=!1,children:c}=t,r=n.useContext(A);const i=n.useMemo(()=>{let u=r;return(!u||!u.extend)&&(u=T.locale(se.en)),u=u.extend(l,s),u},[l,s,r]);return e.jsx(A.Provider,{value:i,children:c})}function ie(t,l,s,c){if(!t||c){const r=l?new Date(l):new Date;r.setDate(1),s(r)}else if(t.getDate()!==1){const r=new Date(t);r.setDate(1),s(r)}}const Ye=["clear","today"];function pe({value:t,current:l,markers:s=null,buttons:c=Ye,onChange:r}){const[i,u]=W.useWritableProp(t),[a,o]=W.useWritableProp(l);n.useEffect(()=>{ie(a,i,o,!1)},[i,a]);const x=n.useCallback(d=>{const m=d.value;m?(u(new Date(m)),ie(a,new Date(m),o,!0)):u(null),r&&r({value:m?new Date(m):null})},[r,a]),f=n.useCallback(d=>{o(d)},[o]);return a?e.jsx(z,{children:e.jsx(U,{value:i,current:a,markers:s,buttons:c,onChange:x,onCurrentChange:f})}):null}const Je=["clear","today"];function Ge({value:t,id:l=T.uid(),disabled:s=!1,error:c=!1,width:r="unset",align:i="start",placeholder:u="",format:a="",buttons:o=Je,css:x="",title:f="",editable:d=!1,clear:m=!1,onChange:p}){const{calendar:v,formats:w}=(n.useContext(A)||Y()).getRaw(),h=a||w?.dateFormat;let j=typeof h=="function"?h:T.dateToString(h,v);const[k,R]=n.useState(t),[b,y]=n.useState(!1);n.useEffect(()=>{R(t)},[t]);function D(){y(!1)}function P(C){const V=C===k||C&&k&&C.valueOf()===k.valueOf()||!C&&!k;R(C),V||p&&p({value:C}),setTimeout(D,1)}const g=n.useMemo(()=>k?j(k):"",[k,j]);function N({value:C,input:V}){if(!d&&!m||V)return;let $=typeof d=="function"?d(C):C?new Date(C):null;$=isNaN($)?k||null:$||null,P($)}return n.useEffect(()=>{const C=D;return window.addEventListener("scroll",C),()=>window.removeEventListener("scroll",C)},[]),e.jsxs("div",{className:"wx-1lKOFG wx-datepicker",onClick:()=>y(!0),children:[e.jsx(Z,{css:x,title:f,value:g,id:l,readonly:!d,disabled:s,error:c,placeholder:u,onInput:D,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}),b&&!s&&e.jsx(J,{onCancel:D,width:r,align:i,autoFit:!!i,children:e.jsx(pe,{buttons:o,value:k,onChange:C=>P(C.value)})})]})}const Qe=["clear","today"],he=({start:t,end:l,current:s,months:c=2,markers:r=null,buttons:i=Qe,onChange:u})=>{const[a,o]=W.useWritableProp(t),[x,f]=W.useWritableProp(l),[d,m]=n.useState(),[p,v]=n.useState(),w=n.useCallback((y,D,P)=>{const g=new Date(y);return g.setMonth(g.getMonth()+D),P&&g.valueOf()===P.valueOf()?P:g},[]),h=n.useCallback(y=>{m(()=>{const D=new Date(y);return D.setDate(1),v(w(D,1)),D})},[w]),j=n.useCallback(y=>{v(()=>{const D=new Date(y);return D.setDate(1),m(w(D,-1)),D})},[w]);n.useEffect(()=>{const y=a;d||h(y?new Date(y):s||new Date)},[a,s,d,h]);const k=n.useCallback(y=>{const D=y.value;let P=a,g=x;const N=D===-1;return N||(y.select?!a||x?(o(P=D),f(g=null)):a>D?(f(g=a),o(P=D)):f(g=D):D?(o(P=new Date(D)),f(g=new Date(D))):(o(P=null),f(g=null))),(N||!i.includes("done"))&&u&&u({start:P,end:g}),[P,g]},[a,x,i,u]),R=n.useCallback(y=>{const[D]=k(y);D&&h(new Date(D))},[h,a,x]),b=n.useCallback(y=>{const[,D]=k(y);D&&j(new Date(D))},[j,a,x]);return!d||!p?null:c===1?e.jsx(z,{children:e.jsx(U,{value:{start:a,end:x},current:d,setCurrent:h,markers:r,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(U,{value:{start:a,end:x},current:d,setCurrent:h,markers:r,buttons:!1,part:"left",onChange:R,onCurrentChange:y=>h(y)})}),e.jsx("div",{className:"wx-p2jCaW wx-half",children:e.jsx(U,{value:{start:a,end:x},current:p,setCurrent:j,markers:r,buttons:i,part:"right",onChange:b,onCurrentChange:y=>j(y)})})]})})},_e=["clear","today"],qe=({value:t,onChange:l,id:s,disabled:c=!1,error:r=!1,width:i="unset",align:u="start",placeholder:a="",css:o="",title:x="",format:f="",months:d=2,buttons:m=_e,editable:p=!1,clear:v=!1})=>{const[w,h]=W.useWritableProp(t),{calendar:j,formats:k}=(n.useContext(A)||Y()).getRaw(),R=f||k?.dateFormat,b=typeof R=="function"?R:T.dateToString(R,j),[y,D]=n.useState(!1),P=n.useCallback(()=>{D(!1)},[]),g=n.useMemo(()=>w?w.start?b(w.start)+(w.end?` - ${b(w.end)}`:""):b(w):"",[w,b]),N=n.useMemo(()=>w&&w.start||null,[w]),C=n.useMemo(()=>w&&w.end||null,[w]),V=n.useCallback(E=>{const M=E.start||E.end?{start:E.start,end:E.end}:null;h&&h(M),(E.start&&E.end||!E.start&&!E.end)&&(l&&l({value:M}),setTimeout(P,1))},[l,P,h]),$=n.useCallback(E=>{if(!p&&!v)return;const{value:M,input:L}=E;if(L)return;const[B,O]=M.split(" -").map((G,F)=>{const I=G.trim();let S=typeof p=="function"?p(I):I?new Date(I):null,H=F===0?N:C;return isNaN(S)?H||null:S||null});V({start:B,end:O})},[p,v,N,C,V]);return n.useEffect(()=>{const E=()=>{P()};return window.addEventListener("scroll",E),()=>{window.removeEventListener("scroll",E)}},[P]),e.jsxs("div",{className:`wx-1b0WDQ wx-daterangepicker ${c?"wx-disabled":""} ${r?"wx-error":""}`,onClick:()=>D(!0),children:[e.jsx(Z,{css:o,title:x,value:g,id:s,readonly:!p,disabled:c,placeholder:a,error:r,onChange:$,icon:"wxi-calendar",inputStyle:{cursor:"pointer",width:"100%",paddingRight:"calc(var(--wx-input-icon-size) + var(--wx-input-icon-indent) * 2)"},clear:v}),y&&!c&&e.jsx(J,{onCancel:P,width:i,align:u,autoFit:!!u,children:e.jsx(he,{onCancel:P,buttons:m,start:N,end:C,months:d,onChange:V})})]})};function Ue({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 ze=[];function Ke({id:t=T.uid(),value:l=ze,onValueChange:s,options:c=[],textOptions:r=null,textField:i="label",placeholder:u="",title:a="",disabled:o=!1,error:x=!1,checkboxes:f=!1,onChange:d,children:m}){const p=n.useRef(null),v=n.useRef(null),[w,h]=W.useWritableProp(l),[j,k]=n.useState(""),[R,b]=n.useState(!1),y=n.useRef(null),D=n.useMemo(()=>w?(r||c).filter(M=>w.includes(M.id)):[],[w,r,c]),P=n.useMemo(()=>{const M=c;return j?M.filter(L=>L[i].toLowerCase().includes(j.toLowerCase())):M},[j,c,i]),g=n.useCallback(M=>{p.current=M.navigate,v.current=M.keydown},[]),N=n.useCallback(()=>{P.length?p.current(0):p.current(null)},[P]),C=n.useCallback(M=>{const{id:L}=M;if(L){let B;w?w.includes(L)?B=w.filter(O=>O!==L):B=[...w,L]:B=[L],h(B),s&&s(B),d&&d({value:B})}},[w,s,d]),V=n.useCallback((M,L)=>{L&&L.stopPropagation();const B=w.filter(O=>O!==M);h(B),s&&s(B),d&&d({value:B}),b(!0)},[w,s,d]),$=n.useCallback(()=>w&&w.length?P.findIndex(M=>M.id===w[0]):0,[w,P]),E=n.useCallback(()=>{o||(y.current.focus(),p.current($()))},[o,$]);return e.jsxs("div",{title:a,className:`wx-12Wj21 wx-multicombo ${x?"wx-error":""} ${o?"wx-disabled":""} ${D.length?"wx-not-empty":""} ${R&&!o?"wx-focus":""}`,onClick:E,onKeyDown:M=>v.current(M,$()),children:[e.jsxs("div",{className:"wx-12Wj21 wx-wrapper",children:[e.jsx("div",{className:"wx-12Wj21 wx-tags",children:D.map(M=>e.jsxs("div",{className:"wx-12Wj21 wx-tag",children:[m?W.snippet(m,{option:M}):M[i],!o&&e.jsx("i",{className:"wx-12Wj21 wx-icon wxi-close",onClick:L=>V(M.id,L)})]},M.id))}),e.jsxs("div",{className:"wx-12Wj21 wx-select",children:[e.jsx("input",{className:"wx-12Wj21 wx-input",id:t,type:"text",value:j,onChange:M=>k(M.target.value),onInput:N,placeholder:u,disabled:o,onFocus:()=>b(!0),onBlur:()=>b(!1),ref:y}),e.jsx("i",{className:"wx-12Wj21 wx-icon wxi-angle-down"})]})]}),!o&&e.jsx(K,{items:P,onReady:g,onSelect:C,children:({option:M})=>e.jsxs(e.Fragment,{children:[f&&e.jsx(ne,{style:{marginRight:"8px",pointerEvents:"none"},name:M.id,value:w&&w.includes(M.id)}),m?W.snippet(m,{option:M}):M[i]]})})]})}function Ze({left:t=0,top:l=0,at:s="bottom",parent:c=null,onCancel:r,children:i}){const[u,a]=n.useState(0),[o,x]=n.useState(0),[f,d]=n.useState("auto"),[m,p]=n.useState(!1),v=n.useRef(null),w=n.useCallback(()=>{if(!v.current)return;const h=T.calculatePosition(v.current,c,s,t,l);h&&(a(h.x),x(h.y),d(h.width),p(!0))},[v,c,s,t,l]);return n.useEffect(()=>{requestAnimationFrame(w)},[]),n.useEffect(()=>{w(c)},[c,s,t,l]),n.useEffect(()=>{const h=j=>{r&&r(j)};if(v.current)return T.clickOutside(v.current,h).destroy},[r]),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 Xe=({total:t=0,pageSize:l=20,value:s=1,onChange:c})=>{const[r,i]=W.useWritableProp(l),[u,a]=W.useWritableProp(s),o=(n.useContext(A)||Y()).getGroup("core"),x=Math.ceil(t/r),f=(u-1)*r,d=Math.min(u*r,t),m=(w,h)=>{Number.isNaN(w)||(h||a(w),w=Math.max(1,Math.min(w,x)),h&&a(w),w!==u&&setTimeout(()=>{c&&c({value:w,from:(w-1)*r,to:Math.min(w*r,t),pageSize:r})}))};function p(w){switch(w){case"first":m(1);break;case"prev":m(u-1);break;case"next":m(u+1);break;case"last":m(x);break}}const v=w=>{const h=w.target.value*1;Number.isNaN(h)||(i(h),c&&c({value:u,from:f,to:d,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:r,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:w=>m(w.target.value*1),onBlur:w=>m(w.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 ve({id:t=T.uid(),label:l="",value:s,name:c="",inputValue:r="",disabled:i=!1,onChange:u}){const[a,o]=n.useState(!1),x=s!==void 0,f=x?s:a;function d(m){const p=m.target.checked;x||o(p),p&&u&&u({value:!0,inputValue:r})}return e.jsxs("div",{className:"wx-3lDF1s wx-radio",children:[e.jsx("input",{type:"radio",className:"wx-3lDF1s wx-input",id:t,disabled:i,name:c,value:r,checked:f,onChange:d}),e.jsxs("label",{htmlFor:t,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 et({options:t=[{}],value:l="",onChange:s,type:c=""}){const r=T.uid(),[i,u]=n.useState(l);n.useEffect(()=>{u(l)},[l]);function a(o){const x=o.inputValue;u(x),s&&s({value:x})}return 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(ve,{label:o.label,inputValue:o.id,value:i===o.id,name:r,onChange:a})},o.id))})}function tt({value:t="",options:l=[],textOptions:s=null,placeholder:c="",disabled:r=!1,error:i=!1,title:u="",textField:a="label",clear:o=!1,children:x,onChange:f}){const d=n.useRef(null),m=n.useRef(null);let[p,v]=W.useWritableProp(t);function w(b){d.current=b.navigate,m.current=b.keydown}const h=n.useMemo(()=>p||p===0?(s||l).find(b=>b.id===p):null,[p,s,l]),j=n.useCallback(({id:b})=>{(b||b===0)&&(v(b),d.current(null),f&&f({value:b}))},[v,f]),k=n.useCallback(b=>{b.stopPropagation(),v(""),f&&f({value:""})},[v,f]),R=n.useCallback(()=>l.findIndex(b=>b.id===p),[l,p]);return e.jsxs("div",{className:`wx-2YgblL wx-richselect ${i?"wx-2YgblL wx-error":""} ${r?"wx-2YgblL wx-disabled":""} ${x?"":"wx-2YgblL wx-nowrap"}`,title:u,onClick:()=>d.current(R()),onKeyDown:b=>m.current(b,R()),tabIndex:0,children:[e.jsx("div",{className:"wx-2YgblL wx-label",children:h?x?x(h):h[a]:c?e.jsx("span",{className:"wx-2YgblL wx-placeholder",children:c}):" "}),o&&!r&&p?e.jsx("i",{className:"wx-2YgblL wx-icon wxi-close",onClick:k}):e.jsx("i",{className:"wx-2YgblL wx-icon wxi-angle-down"}),!r&&e.jsx(K,{items:l,onReady:w,onSelect:j,children:({option:b})=>x?x(b):b[a]})]})}const st=({options:t=[],value:l="",css:s="",children:c,onChange:r})=>{const[i,u]=n.useState(l),a=o=>{u(o),r&&r({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||o.label,onClick:()=>a(o.id),children:c?W.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 nt({value:t,options:l=[],placeholder:s="",title:c="",disabled:r=!1,error:i=!1,textField:u="label",clear:a=!1,id:o=T.uid(),onChange:x}){const[f,d]=n.useState(t||""),m=n.useCallback(v=>{const w=v.target.value;d(w),x&&x({value:w})},[x]),p=n.useCallback(()=>{d(""),x&&x({value:""})},[x]);return e.jsxs("div",{className:"wx-2yx1Fo wx-select-box",children:[e.jsxs("select",{id:o,value:f,disabled:r,className:`wx-2yx1Fo wx-select ${i?"wx-2yx1Fo wx-error":""}`,title:c,onChange:m,children:[e.jsx("option",{value:"",children:s}),l.map(v=>e.jsx("option",{value:v.id,children:v[u]},v.id))]}),a&&!r&&f?e.jsx("i",{className:"wx-2yx1Fo wx-icon wxi-close",onClick:p}):e.jsx("i",{className:"wx-2yx1Fo wx-icon wxi-angle-down"})]})}function ee({id:t=T.uid(),label:l="",css:s="",min:c=0,max:r=100,value:i=0,step:u=1,title:a="",disabled:o=!1,onChange:x}){const[f,d]=n.useState(i),[m,p]=n.useState(f),v=n.useMemo(()=>(f-c)/(r-c)*100+"%",[f,c,r]),w=n.useMemo(()=>o?"":`linear-gradient(90deg, var(--wx-slider-primary) 0% ${v}, var(--wx-slider-background) ${v} 100%)`,[o,v]);function h({target:k}){const R=k.value||0;d(R),m!==R&&(x&&x({value:R,previous:m,input:!0}),p(R))}function j({target:k}){const R=k.value*1;d(R),x&&x({value:R})}return n.useEffect(()=>{d(i)},[i]),e.jsxs("div",{className:`wx-2EDJ8G wx-slider ${s}`,title:a,children:[l&&e.jsx("label",{className:"wx-2EDJ8G wx-label",htmlFor:t,children:l}),e.jsx("div",{className:"wx-2EDJ8G wx-inner",children:e.jsx("input",{id:t,className:"wx-2EDJ8G wx-input",type:"range",min:c,max:r,step:u,disabled:o,value:f,onInput:h,onChange:j,style:{background:w}})})]})}function lt({id:t=T.uid(),value:l=!1,disabled:s=!1,onChange:c}){const[r,i]=n.useState(l),u=n.useCallback(a=>{const o=a.target.checked;i(o),c&&c({value:o})},[c]);return e.jsxs("label",{className:"wx-2dAR5c wx-switch",children:[e.jsx("input",{className:"wx-2dAR5c wx-input",type:"checkbox",checked:r,onChange:u,disabled:s,id:t}),e.jsx("span",{className:"wx-2dAR5c wx-box"})]})}const at=({options:t=[],value:l="",type:s="top",css:c="",onChange:r})=>{const[i,u]=W.useWritableProp(l),a=o=>{u(o),r&&r({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":""}`,onClick:()=>a(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))})},rt=({id:t=T.uid(),value:l=0,step:s=1,min:c=0,max:r=1/0,error:i=!1,disabled:u=!1,readonly:a=!1,onChange:o})=>{const[x,f]=n.useState(l),d=n.useCallback(()=>{if(a||x<=c)return;const w=x-s;f(w),o&&o({value:w})},[x,a,c,s,o]),m=n.useCallback(()=>{if(a||x>=r)return;const w=x+s;f(w),o&&o({value:w})},[x,a,r,s,o]),p=n.useCallback(()=>{if(!a){const w=Math.round(Math.min(r,Math.max(x,c))/s)*s,h=isNaN(w)?Math.max(c,0):w;f(h),o&&o({value:h})}},[a,x,r,c,s,o]),v=n.useCallback(w=>{const h=w.target.value*1;f(h),o&&o({value:h,input:!0})},[o]);return e.jsxs("div",{className:`wx-22t21n wx-counter ${u?"wx-disabled":""} ${a?"wx-readonly":""} ${i?"wx-error":""}`,children:[e.jsx("button",{"aria-label":"-",className:"wx-22t21n wx-btn wx-btn-dec",disabled:u,onClick:d,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:t,type:"text",className:"wx-22t21n wx-input",disabled:u,readOnly:a,required:!0,value:x,onBlur:p,onInput:v}),e.jsx("button",{"aria-label":"-",className:"wx-22t21n wx-btn wx-btn-inc",disabled:u,onClick:m,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 ct({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 ot({data:t=[]}){return e.jsx("div",{className:"wx-3nwoO9 wx-notices",children:t.map(l=>e.jsx(ct,{notice:l},l.id))})}function je({title:t="",buttons:l=["cancel","ok"],header:s,children:c,footer:r,onConfirm:i,onCancel:u}){const a=(n.useContext(A)||Y()).getGroup("core"),o=n.useRef(null);n.useEffect(()=>{o.current?.focus()},[]);function x(d){switch(d.code){case"Enter":{const m=d.target.tagName;if(m==="TEXTAREA"||m==="BUTTON")return;i&&i({ev:d});break}case"Escape":u&&u({ev:d});break}}function f(d,m){const p={ev:d,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}),r||e.jsx("div",{className:"wx-1FxkZa wx-buttons",children:l.map(d=>e.jsx("div",{className:"wx-1FxkZa wx-button",children:e.jsx(_,{type:`block ${d==="ok"?"primary":"secondary"}`,onClick:m=>f(m,d),children:a(d)})},d))})]})})}function ut({children:t},l){const[s,c]=n.useState(null),[r,i]=n.useState([]);return n.useImperativeHandle(l,()=>({showModal:u=>{const a={...u};return c(a),new Promise((o,x)=>{a.resolve=f=>{c(null),o(f)},a.reject=f=>{c(null),x(f)}})},showNotice:u=>{u={...u},u.id=u.id||T.uid(),u.remove=()=>i(a=>a.filter(o=>o.id!==u.id)),u.expire!=-1&&setTimeout(u.remove,u.expire||5100),i(a=>[...a,u])}}),[]),e.jsxs(e.Fragment,{children:[t,s&&e.jsx(je,{title:s.title,buttons:s.buttons,onConfirm:s.resolve,onCancel:s.reject,children:s.message}),e.jsx(ot,{data:r})]})}const it=n.forwardRef(ut);function xt(t){let{children:l}=t,s=n.useRef();const c=n.useMemo(()=>({showNotice:r=>s.current.showNotice(r),showModal:r=>s.current.showModal(r)}),[]);return e.jsx(de.Provider,{value:c,children:e.jsx(it,{ref:s,children:l})})}function te({label:t="",position:l="",css:s="",error:c=!1,type:r="",required:i=!1,children:u}){const a=n.useMemo(()=>T.uid(),[]);return 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:a,children:t}),e.jsx("div",{className:`wx-2oVUvC wx-field-control wx-${r}`,children:W.snippet(u,{id:a})})]})}const be=({value:t=!1,type:l="",icon:s=null,disabled:c=null,iconActive:r=null,onClick:i,title:u="",css:a="",text:o="",textActive:x="",children:f,active:d,onChange:m})=>{const[p,v]=W.useWritableProp(t),w=n.useMemo(()=>(p?"pressed":"")+(l?" "+l:""),[p,l]),h=n.useCallback(j=>{let k=!p;i&&i(j),j.defaultPrevented||(v(k),m&&m({value:k}))},[p,i,m]);return p&&d?e.jsx(_,{title:u,text:p&&x||o,css:a,type:w,icon:p&&r||s,onClick:h,disabled:c,children:W.snippet(d,{value:p})}):f?e.jsx(_,{title:u,text:p&&x||o,css:a,type:w,icon:p&&r||s,onClick:h,disabled:c,children:f}):e.jsx(_,{title:u,text:p&&x||o,css:a,type:w,icon:p&&r||s,onClick:h,disabled:c})},xe=new Date(0,0,0,0,0);function dt({value:t=xe,id:l,title:s="",css:c="",disabled:r=!1,error:i=!1,format:u="",onChange:a}){let[o,x]=W.useWritableProp(t);const{calendar:f,formats:d}=(n.useContext(A)||Y()).getRaw(),m=f.clockFormat==12,p=23,v=59,w=n.useMemo(()=>{const S=u||d?.timeFormat;return typeof S=="function"?S:T.dateToString(S,f)},[u,d,f]),h=n.useMemo(()=>w(new Date(0,0,0,1)).indexOf("01")!=-1,[w]),j=(S,H)=>(S<10&&H?`0${S}`:`${S}`).slice(-2),k=S=>j(S,!0),R=S=>`${S}`.replace(/[^\d]/g,"")||0,b=S=>m&&(S=S%12,S===0)?"12":j(S,h),y=n.useCallback((S,H)=>(S=R(S),Math.min(S,H)),[]),[D,P]=n.useState(null),g=o||xe,N=y(g.getHours(),p),C=y(g.getMinutes(),v),V=N>12,$=b(N),E=k(C),M=n.useMemo(()=>w(new Date(0,0,0,N,C)),[N,C,w]),L=n.useCallback(()=>{P(!0)},[]),B=n.useCallback(()=>{const S=new Date(g);S.setHours(S.getHours()+(V?-12:12)),x(S),a&&a({value:S})},[g,V,a]),O=n.useCallback(({value:S})=>{if(g.getHours()===S)return;const H=new Date(g);H.setHours(S),x(H),a&&a({value:H})},[g,a]),G=n.useCallback(({value:S})=>{if(g.getMinutes()===S)return;const H=new Date(g);H.setMinutes(S),x(H),a&&a({value:H})},[g,a]),F=n.useCallback(S=>(S=y(S,p),m&&(S=S*1,S===12&&(S=0),V&&(S+=12)),S),[y,m,V]),I=n.useCallback(()=>{P(null)},[]);return e.jsxs("div",{className:`wx-7f497i wx-timepicker ${i?"wx-7f497i wx-error":""} ${r?"wx-7f497i wx-disabled":""}`,onClick:r?void 0:L,style:{cursor:r?"default":"pointer"},children:[e.jsx(Z,{id:l,css:c,title:s,value:M,readonly:!0,disabled:r,error:i,icon:"wxi-clock",inputStyle:{cursor:"pointer",width:"100%",paddingRight:"calc(var(--wx-input-icon-size) + var(--wx-input-icon-indent) * 2)"}}),D&&!r&&e.jsx(J,{onCancel:I,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:$,onChange:S=>{const H=F(S.target.value);O({value:H})}}),e.jsx("div",{className:"wx-7f497i wx-separator",children:":"}),e.jsx("input",{className:"wx-7f497i wx-digit",value:E,onChange:S=>{const H=y(S.target.value,v);G({value:H})}}),m&&e.jsx(be,{value:V,onClick:B,active:()=>e.jsx("span",{children:"pm"}),children:e.jsx("span",{children:"am"})})]}),e.jsx(te,{width:"unset",children:e.jsx(ee,{label:f.hours,value:N,onChange:O,max:p})}),e.jsx(te,{width:"unset",children:e.jsx(ee,{label:f.minutes,value:C,onChange:G,max:v})})]})})]})}function wt({children:t}){return e.jsx("div",{className:"wx-KgpO9N wx-modal",children:e.jsx("div",{className:"wx-KgpO9N wx-window",children:t})})}function ft({position:t="right",children:l,onCancel:s}){const c=n.useRef(null);return n.useEffect(()=>T.clickOutside(c.current,s).destroy,[]),e.jsx("div",{ref:c,className:`wx-2L733M wx-sidearea wx-pos-${t}`,children:l})}function mt({theme:t="",target:l,children:s}){const c=n.useRef(null),r=n.useRef(null),[i,u]=n.useState(null);c.current||(c.current=document.createElement("div"));const a=n.useContext(q);return n.useEffect(()=>{u(l||pt(r.current)||document.body)},[r.current]),e.jsxs(e.Fragment,{children:[e.jsx("span",{ref:r,style:{display:"none"}}),r.current&&i?ge.createPortal(e.jsx("div",{className:`wx-3ZWsT0 wx-${t||a}-theme`,children:s}),i):null]})}function pt(t){for(;t&&t!==document.body&&!t.getAttribute("data-wx-portal-root");)t=t.parentNode;return t}function ht(){return e.jsx(e.Fragment,{})}function vt(t){const{fonts:l=!0,children:s}=t;return e.jsx(q.Provider,{value:"material",children:e.jsxs(e.Fragment,{children:[s&&e.jsx("div",{className:"wx-material-theme",children:s}),l&&e.jsxs(e.Fragment,{children:[e.jsx("link",{rel:"preconnect",href:"https://cdn.webix.com",crossOrigin:"true"}),e.jsx(ht,{}),e.jsx("link",{rel:"stylesheet",href:"https://webix.io/dev/fonts/wxi/wx-icons.css"})]})]})})}function ke(){return e.jsx(e.Fragment,{})}function jt(t){const{fonts:l=!0,children:s}=t;return e.jsx(q.Provider,{value:"willow",children:e.jsxs(e.Fragment,{children:[s&&s&&e.jsx("div",{className:"wx-willow-theme",children:s}),l&&e.jsxs(e.Fragment,{children:[e.jsx("link",{rel:"preconnect",href:"https://cdn.webix.com",crossOrigin:"true"}),e.jsx(ke,{}),e.jsx("link",{rel:"stylesheet",href:"https://webix.io/dev/fonts/wxi/wx-icons.css"})]})]})})}function bt(t){const{fonts:l=!0,children:s}=t;return e.jsx(q.Provider,{value:"willow-dark",children:e.jsxs(e.Fragment,{children:[s&&s&&e.jsx("div",{className:"wx-willow-dark-theme",children:s}),l&&e.jsxs(e.Fragment,{children:[e.jsx("link",{rel:"preconnect",href:"https://cdn.webix.com",crossOrigin:"true"}),e.jsx(ke,{}),e.jsx("link",{rel:"stylesheet",href:"https://webix.io/dev/fonts/wxi/wx-icons.css"})]})]})})}function kt(t){const l=T.uid();t.setAttribute("data-wx-portal-root",l)}T.setEnv(T.env);Object.defineProperty(exports,"locale",{enumerable:!0,get:()=>T.locale});Object.defineProperty(exports,"en",{enumerable:!0,get:()=>se.en});exports.Button=_;exports.Calendar=pe;exports.Checkbox=ne;exports.CheckboxGroup=Ce;exports.ColorBoard=we;exports.ColorPicker=Re;exports.ColorSelect=Se;exports.Combo=Te;exports.Counter=rt;exports.DatePicker=Ge;exports.DateRangePicker=qe;exports.Dropdown=J;exports.Field=te;exports.Globals=xt;exports.Icon=Ue;exports.Locale=z;exports.Material=vt;exports.Modal=je;exports.ModalArea=wt;exports.Month=fe;exports.MultiCombo=Ke;exports.Pager=Xe;exports.Popup=Ze;exports.Portal=mt;exports.RadioButton=ve;exports.RadioButtonGroup=et;exports.RangeCalendar=he;exports.RichSelect=tt;exports.Segmented=st;exports.Select=nt;exports.SideArea=ft;exports.Slider=ee;exports.SuggestDropdown=K;exports.Switch=lt;exports.Tabs=at;exports.Text=Z;exports.TextArea=Ne;exports.TimePicker=dt;exports.TwoState=be;exports.Willow=jt;exports.WillowDark=bt;exports.context=Me;exports.popupContainer=kt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),E=require("@svar-ui/lib-react"),T=require("@svar-ui/lib-dom"),se=require("@svar-ui/core-locales"),ge=require("react-dom");function Ne({value:t="",id:l=T.uid(),placeholder:s="",title:c="",disabled:a=!1,error:i=!1,readonly:u=!1,onChange:r}){const[o,x]=E.useWritableProp(t),w=n.useCallback(p=>{const v=p.target.value;x(v),r&&r({value:v,input:!0})},[r]),d=n.useCallback(p=>{const v=p.target.value;x(v),r&&r({value:v})},[r]),m=n.useRef(null);return n.useEffect(()=>{const p=d,v=m.current;return v.addEventListener("change",p),()=>{v&&v.removeEventListener("change",p)}},[d]),e.jsx("textarea",{className:`wx-3yFVAC wx-textarea ${i?"wx-error":""}`,id:l,disabled:a,placeholder:s,readOnly:u,title:c,value:o,onInput:w,ref:m})}function _({type:t="",css:l="",icon:s="",disabled:c=!1,title:a="",text:i="",children:u,onClick:r}){const o=n.useMemo(()=>{let w=t?t.split(" ").filter(d=>d!=="").map(d=>"wx-"+d).join(" "):"";return l+(l?" ":"")+w},[t,l]),x=w=>{r&&r(w)};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 ne({id:t=T.uid(),label:l="",inputValue:s="",value:c=!1,onChange:a,disabled:i=!1}){const[u,r]=E.useWritableProp(c),o=({target:x})=>{const w=x.checked;r(w),a&&a({value:w,inputValue:s})};return e.jsxs("div",{className:"wx-2IvefP wx-checkbox",children:[e.jsx("input",{type:"checkbox",id:t,disabled:i,className:"wx-2IvefP wx-check",checked:u,value:s,onChange:o}),e.jsxs("label",{htmlFor:t,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 Ce({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("div",{className:`wx-q8xwRD wx-checkboxgroup ${s&&`wx-${s}`}`,children:t.map(i=>e.jsx("div",{className:"wx-q8xwRD wx-item",children:e.jsx(ne,{label:i.label,inputValue:i.id,value:l.includes(i.id),onChange:a})},i.id))})}function J({position:t="bottom",align:l="start",autoFit:s=!0,onCancel:c,width:a="100%",children:i}){const u=n.useRef(null),[r,o]=n.useState(t),[x,w]=n.useState(l);return n.useEffect(()=>{o(t)},[t]),n.useEffect(()=>{w(l)},[l]),n.useEffect(()=>{if(s){const d=u.current;if(d){const m=d.getBoundingClientRect(),p=T.env.getTopNode(d).getBoundingClientRect();m.right>=p.right&&w("end"),m.bottom>=p.bottom&&o("top")}}},[s,x,r]),n.useEffect(()=>{const d=m=>{c&&c(m)};if(u.current)return T.clickOutside(u.current,d).destroy},[c]),e.jsx("div",{ref:u,className:`wx-32GZ52 wx-dropdown wx-${r}-${x}`,style:{width:a},children:i})}const ye=["#00a037","#37a9ef","#f5a623","#ff4c3b","#a0a0a0","#000000","#ffffff"];function De({colors:t=ye,value:l="",onChange:s,id:c=T.uid(),clear:a=!1,placeholder:i="",title:u="",disabled:r=!1,error:o=!1}){const[x,w]=n.useState(l),[d,m]=n.useState(!1),p=n.useCallback((h,j)=>{h.stopPropagation(),w(j),m(!1),s&&s({value:j})},[s]),v=n.useCallback(h=>{h.stopPropagation(),w(""),s&&s({value:""})},[s]),f=n.useCallback(()=>{if(r)return!1;m(!0)},[r]);return e.jsxs("div",{className:"wx-121TgJ wx-colorselect",onClick:f,children:[e.jsx("input",{className:"wx-121TgJ wx-input"+(o?" wx-error":"")+(d?" wx-focus":""),title:u,value:x,readOnly:!0,id:c,placeholder:i,disabled:r}),a&&x&&!r&&e.jsx("i",{className:"wx-121TgJ wx-clear wxi-close",onClick:v}),x?e.jsx("div",{className:"wx-121TgJ wx-color wx-selected",style:{backgroundColor:x||"#00a037"}}):e.jsx("div",{className:"wx-121TgJ wx-empty wx-selected"}),d&&e.jsx(J,{onCancel:()=>m(!1),children:e.jsxs("div",{className:"wx-121TgJ wx-colors",children:[e.jsx("div",{className:"wx-121TgJ wx-empty",onClick:h=>p(h,"")}),t.map((h,j)=>e.jsx("div",{className:"wx-121TgJ wx-color",style:{backgroundColor:h},onClick:k=>p(k,h)},j))]})})]})}function ae(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,w,d,m;const p=t.getBoundingClientRect();x=p.left,w=p.top,d=o.clientX-x,m=o.clientY-w,c&&l.moveBlockSlider(d,m),a&&l.moveLineSlider(d)}function r(){s.blur(),window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",r)}return t.addEventListener("mousedown",i),{destroy(){t.removeEventListener("mousedown",i)}}}const Q={_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,w;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,w=0,c){case 0:o=s,x=r,w=i;break;case 1:o=u,x=s,w=i;break;case 2:o=i,x=s,w=r;break;case 3:o=i,x=u,w=s;break;case 4:o=r,x=i,w=s;break;case 5:o=s,x=i,w=u;break}return o=Math.floor(o*255),x=Math.floor(x*255),w=Math.floor(w*255),[o,x,w]},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()}},Se=t=>/^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(t);function re(t){return t?(t=t.toString(16),t.charAt(0)==="#"&&(t=t.slice(1)),Se(t)?(t.length===3&&(t=t.slice(0,3).split("").reduce((l,s)=>l+s+s,"")),`#${t.toUpperCase()}`):null):null}const q=n.createContext("willow"),de=n.createContext({}),A=n.createContext(null),Me=Object.freeze(Object.defineProperty({__proto__:null,helpers:de,i18n:A,theme:q},Symbol.toStringTag,{value:"Module"}));function Y(){return T.locale(se.en)}const ce="Block",oe="Line";function fe({value:t="#65D3B3",button:l=!1,onChange:s}){const c=(n.useContext(A)||Y()).getGroup("core"),a=n.useRef(null),i=n.useRef(null),[u,r]=n.useState(),[o,x]=n.useState(),[w,d]=n.useState(),[m,p]=n.useState(),[v,f]=E.useWritableProp(t),h=n.useMemo(()=>re(v)||"#65D3B3",[v]),j=n.useMemo(()=>Q.hvsToHex(w||0,1,1),[w]),k=n.useCallback((N,C)=>{const{width:V,height:$}=a.current.getBoundingClientRect();C<0?C=0:C>$&&(C=$),N<0?N=0:N>V&&(N=V),r(C),x(N);let L,M;Q.hexToHvs(h);const W=V/100,B=$/100;L=Math.ceil(N/W)/100,M=Math.ceil(Math.abs(C/B-100))/100;const O=Q.hvsToHex(w||0,L,M);f(O),s&&s({value:O,input:!0})},[h,w,s]),R=n.useCallback(N=>{const C=i.current.getBoundingClientRect().width;N<0?N=0:N>C&&(N=C);const V=Math.round(N*359/C),$=Math.max(Math.min(V,359),0);d($),p(N);let L,M;[,L,M]=Q.hexToHvs(h);const W=Q.hvsToHex($,L,M);f(W),s&&s({value:W,input:!0})},[h,s]),b=n.useCallback(()=>{const[N,C,V]=Q.hexToHvs(h);if(d(N),a.current){const{width:$,height:L}=a.current.getBoundingClientRect();i.current&&p(N*i.current.getBoundingClientRect().width/359),x(C*$),r(Math.abs(L*(V-1)))}},[h]),y=n.useCallback(({target:N})=>{const C=re(N.value);f(C),s&&s({value:C,input:!0}),C&&b()},[s,b]),S=n.useCallback(N=>{N.stopPropagation(),s&&s({value:h})},[h,s]),P=n.useCallback(N=>{const C=N.target,V=C.getAttribute("data-slider")===ce,$=C.getAttribute("data-slider")===oe;let L=window.getComputedStyle(C),M=parseFloat(L.left),W=parseFloat(L.top);const B=N.code;if(V){switch(B){case"ArrowLeft":{M--;break}case"ArrowRight":{M++;break}case"ArrowDown":{W++;break}case"ArrowUp":{W--;break}default:return}k(M,W)}if($){if(B==="ArrowLeft"||B==="ArrowDown")M--;else if(B==="ArrowRight"||B==="ArrowUp")M++;else return;R(M)}N.preventDefault()},[k,R]);n.useEffect(()=>{b()},[b]),n.useEffect(()=>{v!==v&&(f(v),b())},[v,v,b]),n.useEffect(()=>{a.current&&ae(a.current,{moveBlockSlider:k}),i.current&&ae(i.current,{moveLineSlider:R})},[k,R]),n.useEffect(()=>{v!==v&&s&&s({value:v,input:!0})},[v,s]),n.useEffect(()=>{h&&a.current&&b()},[h,b]);const g="wx-1yoKzq";return e.jsxs("div",{className:g+" wx-colorboard",children:[e.jsx("div",{className:g+" wx-color-block",style:{background:j},ref:a,children:e.jsx("div",{className:g+" wx-color-block-slider wx-slider",style:{background:h,top:u+"px",left:o+"px"},tabIndex:0,"data-slider":ce,onKeyDown:P})}),e.jsx("div",{className:g+" wx-color-line",ref:i,children:e.jsx("div",{className:g+" wx-color-line-slider wx-slider",style:{background:j,left:m+"px"},tabIndex:0,"data-slider":oe,onKeyDown:P})}),e.jsxs("div",{className:g+" wx-color-controls",children:[e.jsx("div",{className:g+" wx-color",style:{background:h}}),e.jsx("input",{type:"text",className:g+" wx-text",value:v,onChange:y})]}),l&&e.jsx(_,{onClick:S,type:"secondary",children:c("select")})]})}function Re({value:t="",id:l=void 0,placeholder:s="",title:c="",disabled:a=!1,error:i=!1,clear:u=!1,onChange:r}){let[o,x]=E.useWritableProp(t);const[w,d]=n.useState(!1),m=l||T.uid();function p(){if(a)return!1;d(!0)}function v(h){if(h.input)return;d(!1);const j=h.value;x(j),r&&r({value:j})}function f(h){h.stopPropagation(),x(""),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:o,readOnly:!0,id:m,placeholder:s,disabled:a}),e.jsx("div",{className:"wx-mmT8WH wx-color",style:{background:o}}),u&&!a&&o&&e.jsx("i",{className:"wx-mmT8WH wxi-close",onClick:f}),w&&e.jsx(J,{onCancel:()=>d(!1),children:e.jsx(fe,{value:o,button:"true",onChange:v})})]})}function Pe(){let t=null,l=!1,s,c,a,i;const u=(m,p,v,f)=>{s=m,c=p,a=v,i=f},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=T.locateID(m),v=c.findIndex(f=>f.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 K({items:t=[],children:l,onSelect:s,onReady:c}){const a=n.useRef(),i=n.useRef(Pe()),[u,r]=n.useState(null),o=n.useRef(u),x=(n.useContext(A)||Y()).getGroup("core"),w=d=>{d&&d.stopPropagation(),s&&s({id:t[o.current]?.id})};return n.useEffect(()=>{i.current.init(a.current,t,d=>{r(d),o.current=d},w)},[t,!!a.current]),n.useEffect(()=>{c&&c(i.current)},[]),u===null?null:e.jsx(J,{onCancel:()=>i.current.navigate(null),children:e.jsx("div",{className:"wx-233fr7 wx-list",ref:a,onClick:w,onMouseMove:i.current.move,children:t.length?t.map((d,m)=>e.jsx("div",{className:`wx-233fr7 wx-item ${m===u?"wx-focus":""}`,"data-id":d.id,children:l?E.snippet(l,{option:d}):d.label},d.id)):e.jsx("div",{className:"wx-233fr7 wx-no-data",children:x("No data")})})})}function Te({value:t="",onValueChange:l,id:s=T.uid(),options:c=[],textOptions:a=null,textField:i="label",placeholder:u="",title:r="",disabled:o=!1,error:x=!1,clear:w=!1,children:d,onChange:m}){const p=n.useRef(null),v=n.useRef(null),[f,h]=E.useWritableProp(t),[j,k]=n.useState(!1),[R,b]=n.useState(""),y=n.useRef(null),[S,P]=n.useState(!1),g=n.useMemo(()=>{if(j)return R;if(f||f===0){const F=(a||c).find(I=>I.id===f);if(F)return F[i]}return""},[j,R,f,a,c,i]),N=n.useMemo(()=>!g||!j?c:c.filter(F=>F[i].toLowerCase().includes(g.toLowerCase())),[g,j,c,i]),C=n.useCallback(()=>N.findIndex(F=>F.id===f),[N,f]),V=n.useCallback(F=>{p.current=F.navigate,v.current=F.keydown},[]),$=n.useCallback((F,I)=>{if(F||F===0){let D=c.find(H=>H.id===F);if(k(!1),I&&p.current(null),D&&f!==D.id){const H=D.id;h(H),l&&l(H),m&&m({value:H})}}!S&&I&&y.current.focus()},[c,f,S,l,m]),L=n.useCallback(({id:F})=>{$(F,!0)},[$]),M=n.useCallback(F=>{F&&F.stopPropagation(),h(""),k(!1),l&&l(""),m&&m({value:""})},[l,m]),W=n.useCallback(F=>{if(!c.length)return;if(F===""&&w){M();return}let I=c.find(H=>H[i]===F);I||(I=c.find(H=>H[i].toLowerCase().includes(F.toLowerCase())));const D=I?I.id:f||c[0].id;$(D,!1)},[c,i,w,f,$,M]),B=n.useCallback(()=>{b(y.current.value),k(!0),N.length?p.current(0):p.current(null)},[N.length,p]),O=n.useCallback(()=>{P(!0)},[]),G=n.useCallback(()=>{P(!1),setTimeout(()=>{S||W(g)},200)},[S,W,g]);return e.jsxs("div",{className:"wx-1j11Jk wx-combo",onClick:()=>p.current(C()),onKeyDown:F=>v.current(F,C()),title:r,children:[e.jsx("input",{className:"wx-1j11Jk wx-input "+(x?"wx-error":""),id:s,ref:y,value:g,disabled:o,placeholder:u,onFocus:O,onBlur:G,onInput:B}),w&&!o&&f?e.jsx("i",{className:"wx-1j11Jk wx-icon wxi-close",onClick:M}):e.jsx("i",{className:"wx-1j11Jk wx-icon wxi-angle-down"}),!o&&e.jsx(K,{items:N,onReady:V,onSelect:L,children:({option:F})=>e.jsx(e.Fragment,{children:d?d({option:F}):F[i]})})]})}function Z({value:t="",id:l=T.uid(),readonly:s=!1,focus:c=!1,select:a=!1,type:i="text",placeholder:u="",disabled:r=!1,error:o=!1,inputStyle:x={},title:w="",css:d="",icon:m="",clear:p=!1,onChange:v}){const[f,h]=E.useWritableProp(t),j=n.useRef(null),k=n.useMemo(()=>m&&d.indexOf("wx-icon-left")===-1?"wx-icon-right "+d:d,[m,d]),R=n.useMemo(()=>m&&d.indexOf("wx-icon-left")!==-1,[m,d]);n.useEffect(()=>{const g=setTimeout(()=>{c&&j.current&&j.current.focus(),a&&j.current&&j.current.select()},1);return()=>clearTimeout(g)},[c,a]);const b=n.useCallback(g=>{const N=g.target.value;h(N),v&&v({value:N,input:!0})},[v]),y=n.useCallback(g=>v&&v({value:g.target.value}),[v]);function S(g){g.stopPropagation(),h(""),v&&v({value:""})}let P=i;return i!=="password"&&i!=="number"&&(P="text"),n.useEffect(()=>{const g=y,N=j.current;return N.addEventListener("change",g),()=>{N&&N.removeEventListener("change",g)}},[y]),e.jsxs("div",{className:`wx-hQ64J4 wx-text ${k} ${o?"wx-error":""} ${r?"wx-disabled":""} ${p?"wx-clear":""}`,children:[e.jsx("input",{className:"wx-hQ64J4 wx-input",ref:j,id:l,readOnly:s,disabled:r,placeholder:u,type:P,style:x,title:w,value:f,onInput:b}),p&&!r&&f?e.jsxs(e.Fragment,{children:[e.jsx("i",{className:"wx-hQ64J4 wx-icon wxi-close",onClick:S}),R&&e.jsx("i",{className:`wx-hQ64J4 wx-icon ${m}`})]}):m?e.jsx("i",{className:`wx-hQ64J4 wx-icon ${m}`}):null]})}function Ve({date:t,type:l,part:s,onShift:c}){const{calendar:a,formats:i}=n.useContext(A).getRaw(),u=t.getFullYear(),r=n.useMemo(()=>{switch(l){case"month":return T.dateToString(i.monthYearFormat,a)(t);case"year":return T.dateToString(i.yearFormat,a)(t);case"duodecade":{const{start:x,end:w}=T.getDuodecade(u),d=T.dateToString(i.yearFormat,a);return`${d(new Date(x,0,1))} - ${d(new Date(w,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 le({onClick:t,children:l}){return e.jsx("button",{className:"wx-3s8W4d wx-button",onClick:t,children:l})}function we({value:t,current:l,part:s="",markers:c=null,onCancel:a,onChange:i}){const u=(n.useContext(A)||Y()).getRaw().calendar,r=(u.weekStart||7)%7,o=u.dayShort.slice(r).concat(u.dayShort.slice(0,r)),x=(b,y,S)=>new Date(b.getFullYear(),b.getMonth()+(y||0),b.getDate()+(S||0));let w=s!=="normal";function d(b){const y=b.getDay();return y===0||y===6}function m(){const b=x(l,0,1-l.getDate());return b.setDate(b.getDate()-(b.getDay()-(r-7))%7),b}function p(){const b=x(l,1,-l.getDate());return b.setDate(b.getDate()+(6-b.getDay()+r)%7),b}const v=n.useRef(0);function f(b,y){y.timeStamp!==v.current&&(v.current=y.timeStamp,y.stopPropagation(),i&&i(new Date(new Date(b))),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 b=m(),y=p(),S=l.getMonth();let P=[];for(let g=b;g<=y;g.setDate(g.getDate()+1)){const N={day:g.getDate(),in:g.getMonth()===S,date:g.valueOf()};let C="";if(C+=N.in?"":" wx-inactive",C+=h.indexOf(N.date)>-1?" wx-selected":"",w){const V=N.date==h[0],$=N.date==h[1];V&&!$?C+=" wx-left":$&&!V&&(C+=" wx-right"),N.date>h[0]&&N.date<h[1]&&(C+=" wx-inrange")}if(C+=d(g)?" wx-weekend":"",c){const V=c(g);V&&(C+=" "+V)}P.push({...N,css:C})}return P},[l,h,w,c]),k=n.useRef(null);let R=n.useRef({});return R.current.click=f,n.useEffect(()=>{T.delegateClick(k.current,R.current)},[]),e.jsxs("div",{children:[e.jsx("div",{className:"wx-398RBS wx-weekdays",children:o.map(b=>e.jsx("div",{className:"wx-398RBS wx-weekday",children:b},b))}),e.jsx("div",{className:"wx-398RBS wx-days",ref:k,children:j.map(b=>e.jsx("div",{className:`wx-398RBS wx-day ${b.css} ${b.in?"":"wx-out"}`,"data-id":b.date,children:b.day},b.date))})]})}function $e({value:t,current:l,part:s,onCancel:c,onChange:a,onShift:i}){const[u,r]=E.useWritableProp(t||new Date),[o,x]=E.useWritableProp(l||new Date),w=n.useContext(A).getRaw().calendar,d=w.monthShort||[],m=n.useMemo(()=>o.getMonth(),[o]),p=n.useCallback((h,j)=>{if(h!=null){j.stopPropagation();const k=new Date(o);k.setMonth(h),x(k),i&&i({current:k})}s==="normal"&&r(new Date(o)),c&&c()},[o,s,i,c]),v=n.useCallback(()=>{const h=new Date(me(u,s)||o);h.setMonth(o.getMonth()),h.setFullYear(o.getFullYear()),a&&a(h)},[u,o,s,a]),f=n.useCallback(h=>{const j=h.target.closest("[data-id]");if(j){const k=parseInt(j.getAttribute("data-id"),10);p(k,h)}},[p]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"wx-34U8T8 wx-months",onClick:f,children:d.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(le,{onClick:v,children:w.done})})]})}const X="wx-1XEF33",Fe=({value:t,current:l,onCancel:s,onChange:c,onShift:a,part:i})=>{const u=n.useContext(A).getRaw().calendar,[r,o]=E.useWritableProp(l),[x,w]=E.useWritableProp(t),d=n.useMemo(()=>r.getFullYear(),[r]),m=n.useMemo(()=>{const{start:j,end:k}=T.getDuodecade(d),R=[];for(let b=j;b<=k;++b)R.push(b);return R},[d]),p={click:v};function v(j,k){if(j){k.stopPropagation();const R=new Date(r);R.setFullYear(j),o(R),a&&a({current:R})}i==="normal"&&w(new Date(r)),s&&s()}function f(){const j=new Date(me(x,i)||r);j.setFullYear(r.getFullYear()),c&&c(j)}const h=n.useRef(null);return n.useEffect(()=>{h.current&&T.delegateClick(h.current,p)},[]),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:X+" wx-years",ref:h,children:m.map((j,k)=>e.jsx("div",{className:X+` wx-year ${d==j?"wx-current":""} ${k===0?"wx-prev-decade":""} ${k===11?"wx-next-decade":""}`,"data-id":j,children:j},k))}),e.jsx("div",{className:X+" wx-buttons",children:e.jsx(le,{onClick:f,children:u.done})})]})},ue={month:{component:we,next:Le,prev:Ee},year:{component:$e,next:He,prev:We},duodecade:{component:Fe,next:Ie,prev:Be}};function Ee(t){return t=new Date(t),t.setMonth(t.getMonth()-1),t}function Le(t){return t=new Date(t),t.setMonth(t.getMonth()+1),t}function We(t){return t=new Date(t),t.setFullYear(t.getFullYear()-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()-10),t}function Ie(t){return t=new Date(t),t.setFullYear(t.getFullYear()+10),t}function me(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 Ae=["clear","today"];function Oe(t){if(t==="done")return-1;if(t==="clear")return null;if(t==="today")return new Date}function U({value:t,current:l,onCurrentChange:s,part:c="normal",markers:a=null,buttons:i,onShift:u,onChange:r}){const o=n.useContext(A).getGroup("calendar"),[x,w]=n.useState("month"),d=Array.isArray(i)?i:i?Ae:[],m=(j,k)=>{j.preventDefault(),r&&r({value:k})},p=()=>{x==="duodecade"?w("year"):x==="year"&&w("month")},v=j=>{const{diff:k,current:R}=j;if(k===0){x==="month"?w("year"):x==="year"&&w("duodecade");return}if(k){const b=ue[x];s(k>0?b.next(l):b.prev(l))}else R&&s(R);u&&u()},f=j=>{w("month"),r&&r({select:!0,value:j})},h=n.useMemo(()=>ue[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(Ve,{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:f,onShift:v}),x==="month"&&d.length>0&&e.jsx("div",{className:"wx-2Gr4AS wx-buttons",children:d.map(j=>e.jsx("div",{className:"wx-2Gr4AS wx-button-item",children:e.jsx(le,{onClick:k=>m(k,Oe(j)),children:o(j)})},j))})]})]})})}function z(t){let{words:l=null,optional:s=!1,children:c}=t,a=n.useContext(A);const i=n.useMemo(()=>{let u=a;return(!u||!u.extend)&&(u=T.locale(se.en)),l!==null&&(u=u.extend(l,s)),u},[l,s,a]);return e.jsx(A.Provider,{value:i,children:c})}function ie(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 Ye=["clear","today"];function pe({value:t,current:l,markers:s=null,buttons:c=Ye,onChange:a}){const[i,u]=E.useWritableProp(t),[r,o]=E.useWritableProp(l);n.useEffect(()=>{ie(r,i,o,!1)},[i,r]);const x=n.useCallback(d=>{const m=d.value;m?(u(new Date(m)),ie(r,new Date(m),o,!0)):u(null),a&&a({value:m?new Date(m):null})},[a,r]),w=n.useCallback(d=>{o(d)},[o]);return r?e.jsx(z,{children:e.jsx(U,{value:i,current:r,markers:s,buttons:c,onChange:x,onCurrentChange:w})}):null}const Je=["clear","today"];function Ge({value:t,id:l=T.uid(),disabled:s=!1,error:c=!1,width:a="unset",align:i="start",placeholder:u="",format:r="",buttons:o=Je,css:x="",title:w="",editable:d=!1,clear:m=!1,onChange:p}){const{calendar:v,formats:f}=(n.useContext(A)||Y()).getRaw(),h=r||f?.dateFormat;let j=typeof h=="function"?h:T.dateToString(h,v);const[k,R]=n.useState(t),[b,y]=n.useState(!1);n.useEffect(()=>{R(t)},[t]);function S(){y(!1)}function P(C){const V=C===k||C&&k&&C.valueOf()===k.valueOf()||!C&&!k;R(C),V||p&&p({value:C}),setTimeout(S,1)}const g=n.useMemo(()=>k?j(k):"",[k,j]);function N({value:C,input:V}){if(!d&&!m||V)return;let $=typeof d=="function"?d(C):C?new Date(C):null;$=isNaN($)?k||null:$||null,P($)}return n.useEffect(()=>{const C=S;return window.addEventListener("scroll",C),()=>window.removeEventListener("scroll",C)},[]),e.jsxs("div",{className:"wx-1lKOFG wx-datepicker",onClick:()=>y(!0),children:[e.jsx(Z,{css:x,title:w,value:g,id:l,readonly:!d,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}),b&&!s&&e.jsx(J,{onCancel:S,width:a,align:i,autoFit:!!i,children:e.jsx(pe,{buttons:o,value:k,onChange:C=>P(C.value)})})]})}const Qe=["clear","today"],he=({start:t,end:l,current:s,months:c=2,markers:a=null,buttons:i=Qe,onChange:u})=>{const[r,o]=E.useWritableProp(t),[x,w]=E.useWritableProp(l),[d,m]=n.useState(),[p,v]=n.useState(),f=n.useCallback((y,S,P)=>{const g=new Date(y);return g.setMonth(g.getMonth()+S),P&&g.valueOf()===P.valueOf()?P:g},[]),h=n.useCallback(y=>{m(()=>{const S=new Date(y);return S.setDate(1),v(f(S,1)),S})},[f]),j=n.useCallback(y=>{v(()=>{const S=new Date(y);return S.setDate(1),m(f(S,-1)),S})},[f]);n.useEffect(()=>{const y=r;d||h(y?new Date(y):s||new Date)},[r,s,d,h]);const k=n.useCallback(y=>{const S=y.value;let P=r,g=x;const N=S===-1;return N||(y.select?!r||x?(o(P=S),w(g=null)):r>S?(w(g=r),o(P=S)):w(g=S):S?(o(P=new Date(S)),w(g=new Date(S))):(o(P=null),w(g=null))),(N||!i.includes("done"))&&u&&u({start:P,end:g}),[P,g]},[r,x,i,u]),R=n.useCallback(y=>{const[S]=k(y);S&&h(new Date(S))},[h,r,x]),b=n.useCallback(y=>{const[,S]=k(y);S&&j(new Date(S))},[j,r,x]);return!d||!p?null:c===1?e.jsx(z,{children:e.jsx(U,{value:{start:r,end:x},current:d,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(U,{value:{start:r,end:x},current:d,setCurrent:h,markers:a,buttons:!1,part:"left",onChange:R,onCurrentChange:y=>h(y)})}),e.jsx("div",{className:"wx-p2jCaW wx-half",children:e.jsx(U,{value:{start:r,end:x},current:p,setCurrent:j,markers:a,buttons:i,part:"right",onChange:b,onCurrentChange:y=>j(y)})})]})})},_e=["clear","today"],qe=({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:w="",months:d=2,buttons:m=_e,editable:p=!1,clear:v=!1})=>{const[f,h]=E.useWritableProp(t),{calendar:j,formats:k}=(n.useContext(A)||Y()).getRaw(),R=w||k?.dateFormat,b=typeof R=="function"?R:T.dateToString(R,j),[y,S]=n.useState(!1),P=n.useCallback(()=>{S(!1)},[]),g=n.useMemo(()=>f?f.start?b(f.start)+(f.end?` - ${b(f.end)}`:""):b(f):"",[f,b]),N=n.useMemo(()=>f&&f.start||null,[f]),C=n.useMemo(()=>f&&f.end||null,[f]),V=n.useCallback(L=>{const M=L.start||L.end?{start:L.start,end:L.end}:null;h&&h(M),(L.start&&L.end||!L.start&&!L.end)&&(l&&l({value:M}),setTimeout(P,1))},[l,P,h]),$=n.useCallback(L=>{if(!p&&!v)return;const{value:M,input:W}=L;if(W)return;const[B,O]=M.split(" -").map((G,F)=>{const I=G.trim();let D=typeof p=="function"?p(I):I?new Date(I):null,H=F===0?N:C;return isNaN(D)?H||null:D||null});V({start:B,end:O})},[p,v,N,C,V]);return n.useEffect(()=>{const L=()=>{P()};return window.addEventListener("scroll",L),()=>{window.removeEventListener("scroll",L)}},[P]),e.jsxs("div",{className:`wx-1b0WDQ wx-daterangepicker ${c?"wx-disabled":""} ${a?"wx-error":""}`,onClick:()=>S(!0),children:[e.jsx(Z,{css:o,title:x,value:g,id:s,readonly:!p,disabled:c,placeholder:r,error:a,onChange:$,icon:"wxi-calendar",inputStyle:{cursor:"pointer",width:"100%",paddingRight:"calc(var(--wx-input-icon-size) + var(--wx-input-icon-indent) * 2)"},clear:v}),y&&!c&&e.jsx(J,{onCancel:P,width:i,align:u,autoFit:!!u,children:e.jsx(he,{onCancel:P,buttons:m,start:N,end:C,months:d,onChange:V})})]})};function Ue({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 ze=[];function Ke({id:t=T.uid(),value:l=ze,onValueChange:s,options:c=[],textOptions:a=null,textField:i="label",placeholder:u="",title:r="",disabled:o=!1,error:x=!1,checkboxes:w=!1,onChange:d,children:m}){const p=n.useRef(null),v=n.useRef(null),[f,h]=E.useWritableProp(l),[j,k]=n.useState(""),[R,b]=n.useState(!1),y=n.useRef(null),S=n.useMemo(()=>f?(a||c).filter(M=>f.includes(M.id)):[],[f,a,c]),P=n.useMemo(()=>{const M=c;return j?M.filter(W=>W[i].toLowerCase().includes(j.toLowerCase())):M},[j,c,i]),g=n.useCallback(M=>{p.current=M.navigate,v.current=M.keydown},[]),N=n.useCallback(()=>{P.length?p.current(0):p.current(null)},[P]),C=n.useCallback(M=>{const{id:W}=M;if(W){let B;f?f.includes(W)?B=f.filter(O=>O!==W):B=[...f,W]:B=[W],h(B),s&&s(B),d&&d({value:B}),y.current.focus()}},[f,s,d]),V=n.useCallback((M,W)=>{W&&W.stopPropagation();const B=f.filter(O=>O!==M);h(B),s&&s(B),d&&d({value:B})},[f,s,d]),$=n.useCallback(()=>f&&f.length?P.findIndex(M=>M.id===f[0]):0,[f,P]),L=n.useCallback(()=>{o||(y.current.focus(),p.current($()))},[o,$]);return e.jsxs("div",{title:r,className:`wx-12Wj21 wx-multicombo ${x?"wx-error":""} ${o?"wx-disabled":""} ${S.length?"wx-not-empty":""} ${R&&!o?"wx-focus":""}`,onClick:L,onKeyDown:M=>v.current(M,$()),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:[m?E.snippet(m,{option:M}):M[i],!o&&e.jsx("i",{className:"wx-12Wj21 wx-icon wxi-close",onClick:W=>V(M.id,W)})]},M.id))}),e.jsxs("div",{className:"wx-12Wj21 wx-select",children:[e.jsx("input",{className:"wx-12Wj21 wx-input",id:t,type:"text",value:j,onChange:M=>k(M.target.value),onInput:N,placeholder:u,disabled:o,onFocus:()=>b(!0),onBlur:()=>b(!1),ref:y}),e.jsx("i",{className:"wx-12Wj21 wx-icon wxi-angle-down"})]})]}),!o&&e.jsx(K,{items:P,onReady:g,onSelect:C,children:({option:M})=>e.jsxs(e.Fragment,{children:[w&&e.jsx(ne,{style:{marginRight:"8px",pointerEvents:"none"},name:M.id,value:f&&f.includes(M.id)}),m?E.snippet(m,{option:M}):M[i]]})})]})}function Ze({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),[w,d]=n.useState("auto"),[m,p]=n.useState(!1),v=n.useRef(null),f=n.useCallback(()=>{if(!v.current)return;const h=T.calculatePosition(v.current,c,s,t,l);h&&(r(h.x),x(h.y),d(h.width),p(!0))},[v,c,s,t,l]);return n.useEffect(()=>{requestAnimationFrame(f)},[]),n.useEffect(()=>{f(c)},[c,s,t,l]),n.useEffect(()=>{const h=j=>{a&&a(j)};if(v.current)return T.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:w},children:i})}const Xe=({total:t=0,pageSize:l=20,value:s=1,onChange:c})=>{const[a,i]=E.useWritableProp(l),[u,r]=E.useWritableProp(s),o=(n.useContext(A)||Y()).getGroup("core"),x=Math.ceil(t/a),w=(u-1)*a,d=Math.min(u*a,t),m=(f,h)=>{Number.isNaN(f)||(h||r(f),f=Math.max(1,Math.min(f,x)),h&&r(f),f!==u&&setTimeout(()=>{c&&c({value:f,from:(f-1)*a,to:Math.min(f*a,t),pageSize:a})}))};function p(f){switch(f){case"first":m(1);break;case"prev":m(u-1);break;case"next":m(u+1);break;case"last":m(x);break}}const v=f=>{const h=f.target.value*1;Number.isNaN(h)||(i(h),c&&c({value:u,from:w,to:d,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:f=>m(f.target.value*1),onBlur:f=>m(f.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 ve({id:t=T.uid(),label:l="",value:s,name:c="",inputValue:a="",disabled:i=!1,onChange:u}){const[r,o]=n.useState(!1),x=s!==void 0,w=x?s:r;function d(m){const p=m.target.checked;x||o(p),p&&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:t,disabled:i,name:c,value:a,checked:w,onChange:d}),e.jsxs("label",{htmlFor:t,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 et({options:t=[{}],value:l="",onChange:s,type:c=""}){const a=T.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("div",{className:`wx-38w70j wx-radiogroup ${c&&`wx-${c}`}`,children:t.map(o=>e.jsx("div",{className:"wx-38w70j wx-item",children:e.jsx(ve,{label:o.label,inputValue:o.id,value:i===o.id,name:a,onChange:r})},o.id))})}function tt({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:w}){const d=n.useRef(null),m=n.useRef(null);let[p,v]=E.useWritableProp(t);function f(b){d.current=b.navigate,m.current=b.keydown}const h=n.useMemo(()=>p||p===0?(s||l).find(b=>b.id===p):null,[p,s,l]),j=n.useCallback(({id:b})=>{(b||b===0)&&(v(b),d.current(null),w&&w({value:b}))},[v,w]),k=n.useCallback(b=>{b.stopPropagation(),v(""),w&&w({value:""})},[v,w]),R=n.useCallback(()=>l.findIndex(b=>b.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:()=>d.current(R()),onKeyDown:b=>m.current(b,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:k}):e.jsx("i",{className:"wx-2YgblL wx-icon wxi-angle-down"}),!a&&e.jsx(K,{items:l,onReady:f,onSelect:j,children:({option:b})=>x?x(b):b[r]})]})}const st=({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?E.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 nt({value:t,options:l=[],placeholder:s="",title:c="",disabled:a=!1,error:i=!1,textField:u="label",clear:r=!1,id:o=T.uid(),onChange:x}){const[w,d]=n.useState(t||""),m=n.useCallback(v=>{const f=v.target.value;d(f),x&&x({value:f})},[x]),p=n.useCallback(()=>{d(""),x&&x({value:""})},[x]);return e.jsxs("div",{className:"wx-2yx1Fo wx-select-box",children:[e.jsxs("select",{id:o,value:w,disabled:a,className:`wx-2yx1Fo wx-select ${i?"wx-2yx1Fo wx-error":""}`,title:c,onChange:m,children:[e.jsx("option",{value:"",children:s}),l.map(v=>e.jsx("option",{value:v.id,children:v[u]},v.id))]}),r&&!a&&w?e.jsx("i",{className:"wx-2yx1Fo wx-icon wxi-close",onClick:p}):e.jsx("i",{className:"wx-2yx1Fo wx-icon wxi-angle-down"})]})}function ee({id:t=T.uid(),label:l="",css:s="",min:c=0,max:a=100,value:i=0,step:u=1,title:r="",disabled:o=!1,onChange:x}){const[w,d]=E.useWritableProp(i),m=n.useRef({value:w,input:w}),p=n.useMemo(()=>(w-c)/(a-c)*100+"%",[w,c,a]),v=n.useMemo(()=>o?"":`linear-gradient(90deg, var(--wx-slider-primary) 0% ${p}, var(--wx-slider-background) ${p} 100%)`,[o,p]);function f({target:k}){const R=k.value*1;d(R),x&&x({value:R,previous:m.current.input,input:!0}),m.current.input=R}function h({target:k}){const R=k.value*1;d(R),x&&x({value:R,previous:m.current.value}),m.current.value=R}n.useEffect(()=>{d(i)},[i]);const j=n.useRef(null);return n.useEffect(()=>{if(j.current)return j.current.addEventListener("change",h),()=>{j.current&&j.current.removeEventListener("change",h)}},[j,h]),e.jsxs("div",{className:`wx-2EDJ8G wx-slider ${s}`,title:r,children:[l&&e.jsx("label",{className:"wx-2EDJ8G wx-label",htmlFor:t,children:l}),e.jsx("div",{className:"wx-2EDJ8G wx-inner",children:e.jsx("input",{id:t,className:"wx-2EDJ8G wx-input",type:"range",min:c,max:a,step:u,disabled:o,value:w,onInput:f,style:{background:v},ref:j})})]})}function lt({id:t=T.uid(),value:l=!1,disabled:s=!1,onChange:c}){const[a,i]=E.useWritableProp(l),u=n.useCallback(r=>{const o=r.target.checked;i(o),c&&c({value:o})},[c]);return e.jsxs("label",{className:"wx-2dAR5c wx-switch",children:[e.jsx("input",{className:"wx-2dAR5c wx-input",type:"checkbox",checked:a,onChange:u,disabled:s,id:t}),e.jsx("span",{className:"wx-2dAR5c wx-box"})]})}const at=({options:t=[],value:l="",type:s="top",css:c="",onChange:a})=>{const[i,u]=E.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))})},rt=({id:t=T.uid(),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,w]=E.useWritableProp(l),d=n.useCallback(()=>{if(r||x<=c)return;const f=x-s;w(f),o&&o({value:f})},[x,r,c,s,o]),m=n.useCallback(()=>{if(r||x>=a)return;const f=x+s;w(f),o&&o({value:f})},[x,r,a,s,o]),p=n.useCallback(()=>{if(!r){const f=Math.round(Math.min(a,Math.max(x,c))/s)*s,h=isNaN(f)?Math.max(c,0):f;w(h),o&&o({value:h})}},[r,x,a,c,s,o]),v=n.useCallback(f=>{const h=f.target.value*1;w(h),o&&o({value:h,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:d,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:t,type:"text",className:"wx-22t21n wx-input",disabled:u,readOnly:r,required:!0,value:x,onBlur:p,onInput:v}),e.jsx("button",{"aria-label":"-",className:"wx-22t21n wx-btn wx-btn-inc",disabled:u,onClick:m,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 ct({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 ot({data:t=[]}){return e.jsx("div",{className:"wx-3nwoO9 wx-notices",children:t.map(l=>e.jsx(ct,{notice:l},l.id))})}function je({title:t="",buttons:l=["cancel","ok"],header:s,children:c,footer:a,onConfirm:i,onCancel:u}){const r=(n.useContext(A)||Y()).getGroup("core"),o=n.useRef(null);n.useEffect(()=>{o.current?.focus()},[]);function x(d){switch(d.code){case"Enter":{const m=d.target.tagName;if(m==="TEXTAREA"||m==="BUTTON")return;i&&i({event:d});break}case"Escape":u&&u({event:d});break}}function w(d,m){const p={event:d,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(d=>e.jsx("div",{className:"wx-1FxkZa wx-button",children:e.jsx(_,{type:`block ${d==="ok"?"primary":"secondary"}`,onClick:m=>w(m,d),children:r(d)})},d))})]})})}function ut({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=w=>{c(null),o(w)},r.reject=w=>{c(null),x(w)}})},showNotice:u=>{u={...u},u.id=u.id||T.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(je,{title:s.title,buttons:s.buttons,onConfirm:s.resolve,onCancel:s.reject,children:s.message}),e.jsx(ot,{data:a})]})}const it=n.forwardRef(ut);function xt(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(de.Provider,{value:c,children:e.jsx(it,{ref:s,children:l})})}function te({label:t="",position:l="",css:s="",error:c=!1,type:a="",required:i=!1,children:u}){const r=n.useMemo(()=>T.uid(),[]);return 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,children:t}),e.jsx("div",{className:`wx-2oVUvC wx-field-control wx-${a}`,children:E.snippet(u,{id:r})})]})}const be=({value:t=!1,type:l="",icon:s="",disabled:c=!1,iconActive:a="",onClick:i,title:u="",css:r="",text:o="",textActive:x="",children:w,active:d,onChange:m})=>{const[p,v]=E.useWritableProp(t),f=n.useMemo(()=>(p?"pressed":"")+(l?" "+l:""),[p,l]),h=n.useCallback(j=>{let k=!p;i&&i(j),j.defaultPrevented||(v(k),m&&m({value:k}))},[p,i,m]);return p&&d?e.jsx(_,{title:u,text:p&&x||o,css:r,type:f,icon:p&&a||s,onClick:h,disabled:c,children:E.snippet(d,{value:p})}):w?e.jsx(_,{title:u,text:p&&x||o,css:r,type:f,icon:p&&a||s,onClick:h,disabled:c,children:w}):e.jsx(_,{title:u,text:p&&x||o,css:r,type:f,icon:p&&a||s,onClick:h,disabled:c})},xe=new Date(0,0,0,0,0);function dt({value:t=xe,id:l,title:s="",css:c="",disabled:a=!1,error:i=!1,format:u="",onChange:r}){let[o,x]=E.useWritableProp(t);const{calendar:w,formats:d}=(n.useContext(A)||Y()).getRaw(),m=w.clockFormat==12,p=23,v=59,f=n.useMemo(()=>{const D=u||d?.timeFormat;return typeof D=="function"?D:T.dateToString(D,w)},[u,d,w]),h=n.useMemo(()=>f(new Date(0,0,0,1)).indexOf("01")!=-1,[f]),j=(D,H)=>(D<10&&H?`0${D}`:`${D}`).slice(-2),k=D=>j(D,!0),R=D=>`${D}`.replace(/[^\d]/g,"")||0,b=D=>m&&(D=D%12,D===0)?"12":j(D,h),y=n.useCallback((D,H)=>(D=R(D),Math.min(D,H)),[]),[S,P]=n.useState(null),g=o||xe,N=y(g.getHours(),p),C=y(g.getMinutes(),v),V=N>12,$=b(N),L=k(C),M=n.useMemo(()=>f(new Date(0,0,0,N,C)),[N,C,f]),W=n.useCallback(()=>{P(!0)},[]),B=n.useCallback(()=>{const D=new Date(g);D.setHours(D.getHours()+(V?-12:12)),x(D),r&&r({value:D})},[g,V,r]),O=n.useCallback(({value:D})=>{if(g.getHours()===D)return;const H=new Date(g);H.setHours(D),x(H),r&&r({value:H})},[g,r]),G=n.useCallback(({value:D})=>{if(g.getMinutes()===D)return;const H=new Date(g);H.setMinutes(D),x(H),r&&r({value:H})},[g,r]),F=n.useCallback(D=>(D=y(D,p),m&&(D=D*1,D===12&&(D=0),V&&(D+=12)),D),[y,m,V]),I=n.useCallback(()=>{P(null)},[]);return e.jsxs("div",{className:`wx-7f497i wx-timepicker ${i?"wx-7f497i wx-error":""} ${a?"wx-7f497i wx-disabled":""}`,onClick:a?void 0:W,style:{cursor:a?"default":"pointer"},children:[e.jsx(Z,{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(J,{onCancel:I,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:$,onChange:D=>{const H=F(D.target.value);O({value:H})}}),e.jsx("div",{className:"wx-7f497i wx-separator",children:":"}),e.jsx("input",{className:"wx-7f497i wx-digit",value:L,onChange:D=>{const H=y(D.target.value,v);G({value:H})}}),m&&e.jsx(be,{value:V,onClick:B,active:()=>e.jsx("span",{children:"pm"}),children:e.jsx("span",{children:"am"})})]}),e.jsx(te,{width:"unset",children:e.jsx(ee,{label:w.hours,value:N,onChange:O,max:p})}),e.jsx(te,{width:"unset",children:e.jsx(ee,{label:w.minutes,value:C,onChange:G,max:v})})]})})]})}function ft({children:t}){return e.jsx("div",{className:"wx-KgpO9N wx-modal",children:e.jsx("div",{className:"wx-KgpO9N wx-window",children:t})})}function wt({position:t="right",children:l,onCancel:s}){const c=n.useRef(null);return n.useEffect(()=>T.clickOutside(c.current,s).destroy,[]),e.jsx("div",{ref:c,className:`wx-2L733M wx-sidearea wx-pos-${t}`,children:l})}function mt({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(q);return n.useEffect(()=>{u(l||pt(a.current)||T.env.getTopNode(a.current))},[a.current]),e.jsxs(e.Fragment,{children:[e.jsx("span",{ref:a,style:{display:"none"}}),a.current&&i?ge.createPortal(e.jsx("div",{className:`wx-3ZWsT0 wx-${t||r}-theme`,children:s}),i):null]})}function pt(t){const l=T.env.getTopNode(t);for(;t&&t!==l&&!t.getAttribute("data-wx-portal-root");)t=t.parentNode;return t}function ht(){return e.jsx(e.Fragment,{})}function vt(t){const{fonts:l=!0,children:s}=t;return e.jsx(q.Provider,{value:"material",children:e.jsxs(e.Fragment,{children:[s&&e.jsx("div",{className:"wx-material-theme",children:s}),l&&e.jsxs(e.Fragment,{children:[e.jsx("link",{rel:"preconnect",href:"https://cdn.webix.com",crossOrigin:"true"}),e.jsx(ht,{}),e.jsx("link",{rel:"stylesheet",href:"https://webix.io/dev/fonts/wxi/wx-icons.css"})]})]})})}function ke(){return e.jsx(e.Fragment,{})}function jt(t){const{fonts:l=!0,children:s}=t;return e.jsx(q.Provider,{value:"willow",children:e.jsxs(e.Fragment,{children:[s&&s&&e.jsx("div",{className:"wx-willow-theme",children:s}),l&&e.jsxs(e.Fragment,{children:[e.jsx("link",{rel:"preconnect",href:"https://cdn.webix.com",crossOrigin:"true"}),e.jsx(ke,{}),e.jsx("link",{rel:"stylesheet",href:"https://webix.io/dev/fonts/wxi/wx-icons.css"})]})]})})}function bt(t){const{fonts:l=!0,children:s}=t;return e.jsx(q.Provider,{value:"willow-dark",children:e.jsxs(e.Fragment,{children:[s&&s&&e.jsx("div",{className:"wx-willow-dark-theme",children:s}),l&&e.jsxs(e.Fragment,{children:[e.jsx("link",{rel:"preconnect",href:"https://cdn.webix.com",crossOrigin:"true"}),e.jsx(ke,{}),e.jsx("link",{rel:"stylesheet",href:"https://webix.io/dev/fonts/wxi/wx-icons.css"})]})]})})}function kt(t){const l=T.uid();t.setAttribute("data-wx-portal-root",l)}T.setEnv(T.env);Object.defineProperty(exports,"locale",{enumerable:!0,get:()=>T.locale});Object.defineProperty(exports,"en",{enumerable:!0,get:()=>se.en});exports.Button=_;exports.Calendar=pe;exports.Checkbox=ne;exports.CheckboxGroup=Ce;exports.ColorBoard=fe;exports.ColorPicker=Re;exports.ColorSelect=De;exports.Combo=Te;exports.Counter=rt;exports.DatePicker=Ge;exports.DateRangePicker=qe;exports.Dropdown=J;exports.Field=te;exports.Globals=xt;exports.Icon=Ue;exports.Locale=z;exports.Material=vt;exports.Modal=je;exports.ModalArea=ft;exports.Month=we;exports.MultiCombo=Ke;exports.Pager=Xe;exports.Popup=Ze;exports.Portal=mt;exports.RadioButton=ve;exports.RadioButtonGroup=et;exports.RangeCalendar=he;exports.RichSelect=tt;exports.Segmented=st;exports.Select=nt;exports.SideArea=wt;exports.Slider=ee;exports.SuggestDropdown=K;exports.Switch=lt;exports.Tabs=at;exports.Text=Z;exports.TextArea=Ne;exports.TimePicker=dt;exports.TwoState=be;exports.Willow=jt;exports.WillowDark=bt;exports.context=Me;exports.popupContainer=kt;