kdpa-components 1.7.2 → 1.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -279,4 +279,4 @@ function JR(e){return getComputedStyle(e)}function e_(e,t){for(var n in t){var r
279
279
  * limitations under the License.
280
280
  */!function(e,t){var n;function r(e,t){var n=[],r=0;function o(e){return n.push(e),t}function a(){return n[r++]}return{tokenize:function(t){return t.replace(e,o)},detokenize:function(e){return e.replace(new RegExp("("+t+")","g"),a)}}}n=new function(){var e="`TMP`",t="`COMMENT`",n="[^\\u0020-\\u007e]",o="(?:[0-9]*\\.[0-9]+|[0-9]+)",a="direction\\s*:\\s*",i="['\"]?\\s*",s="(^|[^a-zA-Z])",l="\\/\\*\\!?\\s*@noflip\\s*\\*\\/",c="(?:(?:(?:\\\\[0-9a-f]{1,6})(?:\\r\\n|\\s)?)|\\\\[^\\r\\n\\f0-9a-f])",u="(?:[_a-z0-9-]|"+n+"|"+c+")",d=o+"(?:\\s*(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)|"+("-?"+("(?:[_a-z]|"+n+"|"+c+")")+u+"*")+")?",p="((?:-?"+d+")|(?:inherit|auto))",f="(#?"+u+"+|(?:rgba?|hsla?)\\([ \\d.,%-]+\\))",m="(?:[!#$%&*-~]|"+n+"|"+c+")*?",h="(?![a-zA-Z])",b="(?!("+u+"|\\r?\\n|\\s|#|\\:|\\.|\\,|\\+|>|~|\\(|\\)|\\[|\\]|=|\\*=|~=|\\^=|'[^']*'|\"[^\"]*\"|"+t+")*?{)",y="(?!"+m+i+"\\))",v="(?="+m+i+"\\))",g="(\\s*(?:!important\\s*)?[;}])",w=/`TMP`/g,O=new RegExp("\\/\\*[^*]*\\*+([^\\/*][^*]*\\*+)*\\/","gi"),x=new RegExp("("+l+b+"[^;}]+;?)","gi"),T=new RegExp("("+l+"[^\\}]*?})","gi"),k=new RegExp("("+a+")ltr","gi"),E=new RegExp("("+a+")rtl","gi"),C=new RegExp(s+"(left)"+h+y+b,"gi"),S=new RegExp(s+"(right)"+h+y+b,"gi"),P=new RegExp(s+"(left)"+v,"gi"),M=new RegExp(s+"(right)"+v,"gi"),j=new RegExp(s+"(ltr)"+v,"gi"),N=new RegExp(s+"(rtl)"+v,"gi"),D=new RegExp(s+"([ns]?)e-resize","gi"),R=new RegExp(s+"([ns]?)w-resize","gi"),_=new RegExp("((?:margin|padding|border-width)\\s*:\\s*)"+p+"(\\s+)"+p+"(\\s+)"+p+"(\\s+)"+p+g,"gi"),I=new RegExp("((?:-color|border-style)\\s*:\\s*)"+f+"(\\s+)"+f+"(\\s+)"+f+"(\\s+)"+f+g,"gi"),A=new RegExp("(background(?:-position)?\\s*:\\s*(?:[^:;}\\s]+\\s+)*?)("+d+")","gi"),L=new RegExp("(background-position-x\\s*:\\s*)(-?"+o+"%)","gi"),$=new RegExp("(border-radius\\s*:\\s*)"+p+"(?:(?:\\s+"+p+")(?:\\s+"+p+")?(?:\\s+"+p+")?)?(?:(?:(?:\\s*\\/\\s*)"+p+")(?:\\s+"+p+")?(?:\\s+"+p+")?(?:\\s+"+p+")?)?"+g,"gi"),V=new RegExp("(box-shadow\\s*:\\s*(?:inset\\s*)?)"+p,"gi"),F=new RegExp("(text-shadow\\s*:\\s*)"+p+"(\\s*)"+f,"gi"),B=new RegExp("(text-shadow\\s*:\\s*)"+f+"(\\s*)"+p,"gi"),z=new RegExp("(text-shadow\\s*:\\s*)"+p,"gi"),W=new RegExp("(transform\\s*:[^;}]*)(translateX\\s*\\(\\s*)"+p+"(\\s*\\))","gi"),H=new RegExp("(transform\\s*:[^;}]*)(translate\\s*\\(\\s*)"+p+"((?:\\s*,\\s*"+p+"){0,2}\\s*\\))","gi");function U(e,t,n){var r,o;return"%"===n.slice(-1)&&(-1!==(r=n.indexOf("."))?(o=n.length-r-2,n=(n=100-parseFloat(n)).toFixed(o)+"%"):n=100-parseFloat(n)+"%"),t+n}function K(e){switch(e.length){case 4:e=[e[1],e[0],e[3],e[2]];break;case 3:e=[e[1],e[0],e[1],e[2]];break;case 2:e=[e[1],e[0]];break;case 1:e=[e[0]]}return e.join(" ")}function q(e,t){var n=[].slice.call(arguments),r=n.slice(2,6).filter((function(e){return e})),o=n.slice(6,10).filter((function(e){return e})),a=n[10]||"";return t+(o.length?K(r)+" / "+K(o):K(r))+a}function Y(e){return 0===parseFloat(e)?e:"-"===e[0]?e.slice(1):"-"+e}function X(e,t,n){return t+Y(n)}function G(e,t,n,r,o){return t+n+Y(r)+o}function Z(e,t,n,r,o){return t+n+r+Y(o)}return{transform:function(n,o){var a=new r(x,"`NOFLIP_SINGLE`"),i=new r(T,"`NOFLIP_CLASS`"),s=new r(O,t);return n=s.tokenize(i.tokenize(a.tokenize(n.replace("`","%60")))),o.transformDirInUrl&&(n=n.replace(j,"$1"+e).replace(N,"$1ltr").replace(w,"rtl")),o.transformEdgeInUrl&&(n=n.replace(P,"$1"+e).replace(M,"$1left").replace(w,"right")),n=n.replace(k,"$1"+e).replace(E,"$1ltr").replace(w,"rtl").replace(C,"$1"+e).replace(S,"$1left").replace(w,"right").replace(D,"$1$2"+e).replace(R,"$1$2e-resize").replace(w,"w-resize").replace($,q).replace(V,X).replace(F,Z).replace(B,Z).replace(z,X).replace(W,G).replace(H,G).replace(_,"$1$2$3$8$5$6$7$4$9").replace(I,"$1$2$3$8$5$6$7$4$9").replace(A,U).replace(L,U),n=a.detokenize(i.detokenize(s.detokenize(n)))}}},e.exports?t.transform=function(e,t,r){var o;return"object"==typeof t?o=t:(o={},"boolean"==typeof t&&(o.transformDirInUrl=t),"boolean"==typeof r&&(o.transformEdgeInUrl=r)),n.transform(e,o)}:"undefined"!=typeof window&&(window.cssjanus=n)}(Vz,Vz.exports);var Fz=W(Vz.exports);function Bz(e,t,n){switch(e.type){case _t:case Rt:case Nt:return e.return=e.return||e.value;case Dt:e.value=Array.isArray(e.props)?e.props.join(","):e.props,Array.isArray(e.children)&&e.children.forEach((function(e){e.type===Nt&&(e.children=e.value)}))}var r=On(Array.prototype.concat(e.children),Bz);return Ht(r)?e.return=e.value+"{"+r+"}":""}function zz(e,t,n,r){if(e.type===It||"@supports"===e.type||e.type===Dt&&(!e.parent||"@media"===e.parent.type||e.parent.type===Dt)){var o=Fz.transform(Bz(e));e.children=o?bn(o)[0].children:[],e.return=""}}Object.defineProperty(zz,"name",{value:"stylisRTLPlugin"});const Wz=In({key:"kdpa",stylisPlugins:[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case"decl":return void(e.return=Lz(e.value,e.length,n));case"@keyframes":return $z([Az(e,{value:Nz(e.value,"@","@"+Pz)})],r);case"rule":if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(jz(t,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return $z([Az(e,{props:[Nz(t,/:(read-\w+)/,":"+Sz+"$1")]})],r);case"::placeholder":return $z([Az(e,{props:[Nz(t,/:(plac\w+)/,":"+Pz+"input-$1")]}),Az(e,{props:[Nz(t,/:(plac\w+)/,":"+Sz+"$1")]}),Az(e,{props:[Nz(t,/:(plac\w+)/,Cz+"input-$1")]})],r)}return""}))}},zz]});function Hz(t){return e(yr,{value:Wz,children:t.children})}const Uz=o.forwardRef(((t,n)=>e(um,{direction:"up",ref:n,...t})));function Kz({children:t,...n}){return e(Bf,{TransitionComponent:Uz,fullScreen:!0,...n,children:t})}function qz(e){return MT({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}},{tag:"path",attr:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]})(e)}function Yz(e){return MT({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}},{tag:"path",attr:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]})(e)}function Xz({children:n,label:r,expandable:a,defaultOpen:i,...s}){const l=4*r.length,[c,u]=w(i??!0),d=()=>{u((e=>!e))},p=qo();return e("div",{className:"kdpa-segment",children:t(TT,{container:!0,sx:e=>({border:`2px solid ${e.palette.primary.main} !important`,position:"relative",marginTop:"2rem",marginLeft:"0.1rem",marginRight:"0.1rem",borderRadius:"0.357rem !important",padding:"1rem 0.1rem"}),children:[e("span",{className:"kdpa-segment__label",style:{width:`calc(100px + ${l}px)`,direction:p.direction},children:r}),a&&e("div",{className:"kdpa-segment__icon",children:e(c?qz:Yz,{size:20,onClick:d})}),e(kD,{in:!a||c,...s,children:e(o.Fragment,{children:n})})]})})}function Gz(e){return MT({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"polyline",attr:{points:"17 8 12 3 7 8"}},{tag:"line",attr:{x1:"12",y1:"3",x2:"12",y2:"15"}}]})(e)}function Zz({onUpload:n,label:r,multiple:o=!1,...a}){return t("label",{className:"kdpa-file-uploader",htmlFor:"kdpaFileUploader",children:[r&&e("span",{className:"kdpa-file-uploader__label",children:r}),e(hD,{component:"label",htmlFor:"kdpaFileUploader",sx:{padding:"7px 7px",minWidth:"36px"},children:e(Gz,{size:20})}),e("input",{id:"kdpaFileUploader",type:"file",...a,hidden:!0,multiple:!0,onChange:e=>{const t=e.target.files;t&&n(t)}})]})}var Qz=e=>"checkbox"===e.type,Jz=e=>e instanceof Date,eW=e=>null==e;const tW=e=>"object"==typeof e;var nW=e=>!eW(e)&&!Array.isArray(e)&&tW(e)&&!Jz(e),rW=e=>nW(e)&&e.target?Qz(e.target)?e.target.checked:e.target.value:e,oW=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),aW=e=>{const t=e.constructor&&e.constructor.prototype;return nW(t)&&t.hasOwnProperty("isPrototypeOf")},iW="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function sW(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(iW&&(e instanceof Blob||e instanceof FileList)||!n&&!nW(e))return e;if(t=n?[]:{},n||aW(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=sW(e[n]));else t=e}return t}var lW=e=>Array.isArray(e)?e.filter(Boolean):[],cW=e=>void 0===e,uW=(e,t,n)=>{if(!t||!nW(e))return n;const r=lW(t.split(/[,[\].]+?/)).reduce(((e,t)=>eW(e)?e:e[t]),e);return cW(r)||r===e?cW(e[t])?n:e[t]:r};const dW={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},pW={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},fW="max",mW="min",hW="maxLength",bW="minLength",yW="pattern",vW="required",gW="validate",wW=o.createContext(null),OW=()=>o.useContext(wW),xW=e=>{const{children:t,...n}=e;return o.createElement(wW.Provider,{value:n},t)};var TW=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(o,a,{get:()=>{const o=a;return t._proxyFormState[o]!==pW.all&&(t._proxyFormState[o]=!r||pW.all),n&&(n[o]=!0),e[o]}});return o},kW=e=>nW(e)&&!Object.keys(e).length,EW=(e,t,n,r)=>{n(e);const{name:o,...a}=e;return kW(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find((e=>t[e]===(!r||pW.all)))},CW=e=>Array.isArray(e)?e:[e],SW=(e,t,n)=>n&&t?e===t||Array.isArray(e)&&e.some((e=>e&&n&&e===t)):!e||!t||e===t||CW(e).some((e=>e&&(e.startsWith(t)||t.startsWith(e))));function PW(e){const t=o.useRef(e);t.current=e,o.useEffect((()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}}),[e.disabled])}var MW=e=>"string"==typeof e,jW=(e,t,n,r,o)=>MW(e)?(r&&t.watch.add(e),uW(n,e,o)):Array.isArray(e)?e.map((e=>(r&&t.watch.add(e),uW(n,e)))):(r&&(t.watchAll=!0),n);var NW=e=>/^\w*$/.test(e),DW=e=>lW(e.replace(/["|']|\]/g,"").split(/\.|\[/));function RW(e,t,n){let r=-1;const o=NW(t)?[t]:DW(t),a=o.length,i=a-1;for(;++r<a;){const t=o[r];let a=n;if(r!==i){const n=e[t];a=nW(n)||Array.isArray(n)?n:isNaN(+o[r+1])?{}:[]}e[t]=a,e=e[t]}return e}function _W(e){const t=OW(),{name:n,disabled:r,control:a=t.control,shouldUnregister:i}=e,s=oW(a._names.array,n),l=function(e){const t=OW(),{control:n=t.control,name:r,defaultValue:a,disabled:i,exact:s}=e||{},l=o.useRef(r);l.current=r,PW({disabled:i,subject:n._subjects.values,next:e=>{SW(l.current,e.name,s)&&u(sW(jW(l.current,n._names,e.values||n._formValues,!1,a)))}});const[c,u]=o.useState(n._getWatch(r,a));return o.useEffect((()=>n._removeUnmounted())),c}({control:a,name:n,defaultValue:uW(a._formValues,n,uW(a._defaultValues,n,e.defaultValue)),exact:!0}),c=function(e){const t=OW(),{control:n=t.control,disabled:r,name:a,exact:i}=e||{},[s,l]=o.useState(n._formState),c=o.useRef(!0),u=o.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=o.useRef(a);return d.current=a,PW({disabled:r,next:e=>c.current&&SW(d.current,e.name,i)&&EW(e,u.current,n._updateFormState)&&l({...n._formState,...e}),subject:n._subjects.state}),o.useEffect((()=>(c.current=!0,u.current.isValid&&n._updateValid(!0),()=>{c.current=!1})),[n]),TW(s,n,u.current,!1)}({control:a,name:n}),u=o.useRef(a.register(n,{...e.rules,value:l}));return u.current=a.register(n,e.rules),o.useEffect((()=>{const e=a._options.shouldUnregister||i,t=(e,t)=>{const n=uW(a._fields,e);n&&(n._f.mount=t)};if(t(n,!0),e){const e=sW(uW(a._options.defaultValues,n));RW(a._defaultValues,n,e),cW(uW(a._formValues,n))&&RW(a._formValues,n,e)}return()=>{(s?e&&!a._state.action:e)?a.unregister(n):t(n,!1)}}),[n,a,s,i]),o.useEffect((()=>{a._updateDisabledField({disabled:r,fields:a._fields,name:n})}),[r,n,a]),{field:{name:n,value:l,disabled:r,onChange:o.useCallback((e=>u.current.onChange({target:{value:rW(e),name:n},type:dW.CHANGE})),[n]),onBlur:o.useCallback((()=>u.current.onBlur({target:{value:uW(a._formValues,n),name:n},type:dW.BLUR})),[n,a]),ref:e=>{const t=uW(a._fields,n);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!uW(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!uW(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!uW(c.touchedFields,n)},error:{enumerable:!0,get:()=>uW(c.errors,n)}})}}var IW=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{};const AW=(e,t,n)=>{for(const r of n||Object.keys(e)){const n=uW(e,r);if(n){const{_f:e,...r}=n;if(e&&t(e.name)){if(e.ref.focus){e.ref.focus();break}if(e.refs&&e.refs[0].focus){e.refs[0].focus();break}}else nW(r)&&AW(r,t)}}};var LW=e=>({isOnSubmit:!e||e===pW.onSubmit,isOnBlur:e===pW.onBlur,isOnChange:e===pW.onChange,isOnAll:e===pW.all,isOnTouch:e===pW.onTouched}),$W=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))))),VW=(e,t,n)=>{const r=lW(uW(e,n));return RW(r,"root",t[n]),RW(e,n,r),e},FW=e=>"boolean"==typeof e,BW=e=>"file"===e.type,zW=e=>"function"==typeof e,WW=e=>{if(!iW)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},HW=e=>MW(e),UW=e=>"radio"===e.type,KW=e=>e instanceof RegExp;const qW={value:!1,isValid:!1},YW={value:!0,isValid:!0};var XW=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!cW(e[0].attributes.value)?cW(e[0].value)||""===e[0].value?YW:{value:e[0].value,isValid:!0}:YW:qW}return qW};const GW={isValid:!1,value:null};var ZW=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),GW):GW;function QW(e,t,n="validate"){if(HW(e)||Array.isArray(e)&&e.every(HW)||FW(e)&&!e)return{type:n,message:HW(e)?e:"",ref:t}}var JW=e=>nW(e)&&!KW(e)?e:{value:e,message:""},eH=async(e,t,n,r,o)=>{const{ref:a,refs:i,required:s,maxLength:l,minLength:c,min:u,max:d,pattern:p,validate:f,name:m,valueAsNumber:h,mount:b,disabled:y}=e._f,v=uW(t,m);if(!b||y)return{};const g=i?i[0]:a,w=e=>{r&&g.reportValidity&&(g.setCustomValidity(FW(e)?"":e||""),g.reportValidity())},O={},x=UW(a),T=Qz(a),k=x||T,E=(h||BW(a))&&cW(a.value)&&cW(v)||WW(a)&&""===a.value||""===v||Array.isArray(v)&&!v.length,C=IW.bind(null,m,n,O),S=(e,t,n,r=hW,o=bW)=>{const i=e?t:n;O[m]={type:e?r:o,message:i,ref:a,...C(e?r:o,i)}};if(o?!Array.isArray(v)||!v.length:s&&(!k&&(E||eW(v))||FW(v)&&!v||T&&!XW(i).isValid||x&&!ZW(i).isValid)){const{value:e,message:t}=HW(s)?{value:!!s,message:s}:JW(s);if(e&&(O[m]={type:vW,message:t,ref:g,...C(vW,t)},!n))return w(t),O}if(!(E||eW(u)&&eW(d))){let e,t;const r=JW(d),o=JW(u);if(eW(v)||isNaN(v)){const n=a.valueAsDate||new Date(v),i=e=>new Date((new Date).toDateString()+" "+e),s="time"==a.type,l="week"==a.type;MW(r.value)&&v&&(e=s?i(v)>i(r.value):l?v>r.value:n>new Date(r.value)),MW(o.value)&&v&&(t=s?i(v)<i(o.value):l?v<o.value:n<new Date(o.value))}else{const n=a.valueAsNumber||(v?+v:v);eW(r.value)||(e=n>r.value),eW(o.value)||(t=n<o.value)}if((e||t)&&(S(!!e,r.message,o.message,fW,mW),!n))return w(O[m].message),O}if((l||c)&&!E&&(MW(v)||o&&Array.isArray(v))){const e=JW(l),t=JW(c),r=!eW(e.value)&&v.length>+e.value,o=!eW(t.value)&&v.length<+t.value;if((r||o)&&(S(r,e.message,t.message),!n))return w(O[m].message),O}if(p&&!E&&MW(v)){const{value:e,message:t}=JW(p);if(KW(e)&&!v.match(e)&&(O[m]={type:yW,message:t,ref:a,...C(yW,t)},!n))return w(t),O}if(f)if(zW(f)){const e=QW(await f(v,t),g);if(e&&(O[m]={...e,...C(gW,e.message)},!n))return w(e.message),O}else if(nW(f)){let e={};for(const r in f){if(!kW(e)&&!n)break;const o=QW(await f[r](v,t),g,r);o&&(e={...o,...C(r,o.message)},w(o.message),n&&(O[m]=e))}if(!kW(e)&&(O[m]={ref:g,...e},!n))return O}return w(!0),O};function tH(e,t){const n=Array.isArray(t)?t:NW(t)?[t]:DW(t),r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=cW(e)?r++:e[t[r++]];return e}(e,n),o=n.length-1,a=n[o];return r&&delete r[a],0!==o&&(nW(r)&&kW(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!cW(e[t]))return!1;return!0}(r))&&tH(e,n.slice(0,-1)),e}function nH(){let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}}var rH=e=>eW(e)||!tW(e);function oH(e,t){if(rH(e)||rH(t))return e===t;if(Jz(e)&&Jz(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const n=e[o];if(!r.includes(o))return!1;if("ref"!==o){const e=t[o];if(Jz(n)&&Jz(e)||nW(n)&&nW(e)||Array.isArray(n)&&Array.isArray(e)?!oH(n,e):n!==e)return!1}}return!0}var aH=e=>"select-multiple"===e.type,iH=e=>UW(e)||Qz(e),sH=e=>WW(e)&&e.isConnected,lH=e=>{for(const t in e)if(zW(e[t]))return!0;return!1};function cH(e,t={}){const n=Array.isArray(e);if(nW(e)||n)for(const n in e)Array.isArray(e[n])||nW(e[n])&&!lH(e[n])?(t[n]=Array.isArray(e[n])?[]:{},cH(e[n],t[n])):eW(e[n])||(t[n]=!0);return t}function uH(e,t,n){const r=Array.isArray(e);if(nW(e)||r)for(const r in e)Array.isArray(e[r])||nW(e[r])&&!lH(e[r])?cW(t)||rH(n[r])?n[r]=Array.isArray(e[r])?cH(e[r],[]):{...cH(e[r])}:uH(e[r],eW(t)?{}:t[r],n[r]):n[r]=!oH(e[r],t[r]);return n}var dH=(e,t)=>uH(e,t,cH(t)),pH=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>cW(e)?e:t?""===e?NaN:e?+e:e:n&&MW(e)?new Date(e):r?r(e):e;function fH(e){const t=e.ref;if(!(e.refs?e.refs.every((e=>e.disabled)):t.disabled))return BW(t)?t.files:UW(t)?ZW(e.refs).value:aH(t)?[...t.selectedOptions].map((({value:e})=>e)):Qz(t)?XW(e.refs).value:pH(cW(t.value)?e.ref.value:t.value,e)}var mH=(e,t,n,r)=>{const o={};for(const n of e){const e=uW(t,n);e&&RW(o,n,e._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},hH=e=>cW(e)?e:KW(e)?e.source:nW(e)?KW(e.value)?e.value.source:e.value:e,bH=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function yH(e,t,n){const r=uW(e,n);if(r||NW(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const r=o.join("."),a=uW(t,r),i=uW(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(i&&i.type)return{name:r,error:i};o.pop()}return{name:n}}var vH=(e,t,n,r,o)=>!o.isOnAll&&(!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:!(n?r.isOnChange:o.isOnChange)||e),gH=(e,t)=>!lW(uW(e,t)).length&&tH(e,t);const wH={mode:pW.onSubmit,reValidateMode:pW.onChange,shouldFocusError:!0};function OH(e={},t){let n,r={...wH,...e},o={submitCount:0,isDirty:!1,isLoading:zW(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},a={},i=(nW(r.defaultValues)||nW(r.values))&&sW(r.defaultValues||r.values)||{},s=r.shouldUnregister?{}:sW(i),l={action:!1,mount:!1,watch:!1},c={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u=0;const d={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},p={values:nH(),array:nH(),state:nH()},f=e.resetOptions&&e.resetOptions.keepDirtyValues,m=LW(r.mode),h=LW(r.reValidateMode),b=r.criteriaMode===pW.all,y=async e=>{if(d.isValid||e){const e=r.resolver?kW((await x()).errors):await T(a,!0);e!==o.isValid&&p.state.next({isValid:e})}},v=e=>d.isValidating&&p.state.next({isValidating:e}),g=(e,t,n,r)=>{const o=uW(a,e);if(o){const a=uW(s,e,cW(n)?uW(i,e):n);cW(a)||r&&r.defaultChecked||t?RW(s,e,t?a:fH(o._f)):C(e,a),l.mount&&y()}},w=(e,t,n,r,a)=>{let s=!1,l=!1;const c={name:e};if(!n||r){d.isDirty&&(l=o.isDirty,o.isDirty=c.isDirty=k(),s=l!==c.isDirty);const n=oH(uW(i,e),t);l=uW(o.dirtyFields,e),n?tH(o.dirtyFields,e):RW(o.dirtyFields,e,!0),c.dirtyFields=o.dirtyFields,s=s||d.dirtyFields&&l!==!n}if(n){const t=uW(o.touchedFields,e);t||(RW(o.touchedFields,e,n),c.touchedFields=o.touchedFields,s=s||d.touchedFields&&t!==n)}return s&&a&&p.state.next(c),s?c:{}},O=(t,r,a,i)=>{const s=uW(o.errors,t),l=d.isValid&&FW(r)&&o.isValid!==r;var c;if(e.delayError&&a?(c=()=>((e,t)=>{RW(o.errors,e,t),p.state.next({errors:o.errors})})(t,a),n=e=>{clearTimeout(u),u=setTimeout(c,e)},n(e.delayError)):(clearTimeout(u),n=null,a?RW(o.errors,t,a):tH(o.errors,t)),(a?!oH(s,a):s)||!kW(i)||l){const e={...i,...l&&FW(r)?{isValid:r}:{},errors:o.errors,name:t};o={...o,...e},p.state.next(e)}v(!1)},x=async e=>r.resolver(s,r.context,mH(e||c.mount,a,r.criteriaMode,r.shouldUseNativeValidation)),T=async(e,t,n={valid:!0})=>{for(const a in e){const i=e[a];if(i){const{_f:e,...a}=i;if(e){const a=c.array.has(e.name),l=await eH(i,s,b,r.shouldUseNativeValidation&&!t,a);if(l[e.name]&&(n.valid=!1,t))break;!t&&(uW(l,e.name)?a?VW(o.errors,l,e.name):RW(o.errors,e.name,l[e.name]):tH(o.errors,e.name))}a&&await T(a,t,n)}}return n.valid},k=(e,t)=>(e&&t&&RW(s,e,t),!oH(N(),i)),E=(e,t,n)=>jW(e,c,{...l.mount?s:cW(t)?i:MW(e)?{[e]:t}:t},n,t),C=(e,t,n={})=>{const r=uW(a,e);let o=t;if(r){const n=r._f;n&&(!n.disabled&&RW(s,e,pH(t,n)),o=WW(n.ref)&&eW(t)?"":t,aH(n.ref)?[...n.ref.options].forEach((e=>e.selected=o.includes(e.value))):n.refs?Qz(n.ref)?n.refs.length>1?n.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(o)?!!o.find((t=>t===e.value)):o===e.value))):n.refs[0]&&(n.refs[0].checked=!!o):n.refs.forEach((e=>e.checked=e.value===o)):BW(n.ref)?n.ref.value="":(n.ref.value=o,n.ref.type||p.values.next({name:e,values:{...s}})))}(n.shouldDirty||n.shouldTouch)&&w(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&j(e)},S=(e,t,n)=>{for(const r in t){const o=t[r],i=`${e}.${r}`,s=uW(a,i);!c.array.has(e)&&rH(o)&&(!s||s._f)||Jz(o)?C(i,o,n):S(i,o,n)}},P=(e,n,r={})=>{const u=uW(a,e),f=c.array.has(e),m=sW(n);RW(s,e,m),f?(p.array.next({name:e,values:{...s}}),(d.isDirty||d.dirtyFields)&&r.shouldDirty&&p.state.next({name:e,dirtyFields:dH(i,s),isDirty:k(e,m)})):!u||u._f||eW(m)?C(e,m,r):S(e,m,r),$W(e,c)&&p.state.next({...o}),p.values.next({name:e,values:{...s}}),!l.mount&&t()},M=async e=>{const t=e.target;let i=t.name,l=!0;const u=uW(a,i);if(u){let f,g;const k=t.type?fH(u._f):rW(e),E=e.type===dW.BLUR||e.type===dW.FOCUS_OUT,C=!bH(u._f)&&!r.resolver&&!uW(o.errors,i)&&!u._f.deps||vH(E,uW(o.touchedFields,i),o.isSubmitted,h,m),S=$W(i,c,E);RW(s,i,k),E?(u._f.onBlur&&u._f.onBlur(e),n&&n(0)):u._f.onChange&&u._f.onChange(e);const P=w(i,k,E,!1),M=!kW(P)||S;if(!E&&p.values.next({name:i,type:e.type,values:{...s}}),C)return d.isValid&&y(),M&&p.state.next({name:i,...S?{}:P});if(!E&&S&&p.state.next({...o}),v(!0),r.resolver){const{errors:e}=await x([i]),t=yH(o.errors,a,i),n=yH(e,a,t.name||i);f=n.error,i=n.name,g=kW(e)}else f=(await eH(u,s,b,r.shouldUseNativeValidation))[i],l=isNaN(k)||k===uW(s,i,k),l&&(f?g=!1:d.isValid&&(g=await T(a,!0)));l&&(u._f.deps&&j(u._f.deps),O(i,g,f,P))}},j=async(e,t={})=>{let n,i;const s=CW(e);if(v(!0),r.resolver){const t=await(async e=>{const{errors:t}=await x(e);if(e)for(const n of e){const e=uW(t,n);e?RW(o.errors,n,e):tH(o.errors,n)}else o.errors=t;return t})(cW(e)?e:s);n=kW(t),i=e?!s.some((e=>uW(t,e))):n}else e?(i=(await Promise.all(s.map((async e=>{const t=uW(a,e);return await T(t&&t._f?{[e]:t}:t)})))).every(Boolean),(i||o.isValid)&&y()):i=n=await T(a);return p.state.next({...!MW(e)||d.isValid&&n!==o.isValid?{}:{name:e},...r.resolver||!e?{isValid:n}:{},errors:o.errors,isValidating:!1}),t.shouldFocus&&!i&&AW(a,(e=>e&&uW(o.errors,e)),e?s:c.mount),i},N=e=>{const t={...i,...l.mount?s:{}};return cW(e)?t:MW(e)?uW(t,e):e.map((e=>uW(t,e)))},D=(e,t)=>({invalid:!!uW((t||o).errors,e),isDirty:!!uW((t||o).dirtyFields,e),isTouched:!!uW((t||o).touchedFields,e),error:uW((t||o).errors,e)}),R=(e,t,n)=>{const r=(uW(a,e,{_f:{}})._f||{}).ref;RW(o.errors,e,{...t,ref:r}),p.state.next({name:e,errors:o.errors,isValid:!1}),n&&n.shouldFocus&&r&&r.focus&&r.focus()},_=(e,t={})=>{for(const n of e?CW(e):c.mount)c.mount.delete(n),c.array.delete(n),t.keepValue||(tH(a,n),tH(s,n)),!t.keepError&&tH(o.errors,n),!t.keepDirty&&tH(o.dirtyFields,n),!t.keepTouched&&tH(o.touchedFields,n),!r.shouldUnregister&&!t.keepDefaultValue&&tH(i,n);p.values.next({values:{...s}}),p.state.next({...o,...t.keepDirty?{isDirty:k()}:{}}),!t.keepIsValid&&y()},I=({disabled:e,name:t,field:n,fields:r})=>{if(FW(e)){const o=e?void 0:uW(s,t,fH(n?n._f:uW(r,t)._f));RW(s,t,o),w(t,o,!1,!1,!0)}},A=(e,t={})=>{let n=uW(a,e);const o=FW(t.disabled);return RW(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),c.mount.add(e),n?I({field:n,disabled:t.disabled,name:e}):g(e,!0,t.value),{...o?{disabled:t.disabled}:{},...r.progressive?{required:!!t.required,min:hH(t.min),max:hH(t.max),minLength:hH(t.minLength),maxLength:hH(t.maxLength),pattern:hH(t.pattern)}:{},name:e,onChange:M,onBlur:M,ref:o=>{if(o){A(e,t),n=uW(a,e);const r=cW(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,s=iH(r),l=n._f.refs||[];if(s?l.find((e=>e===r)):r===n._f.ref)return;RW(a,e,{_f:{...n._f,...s?{refs:[...l.filter(sH),r,...Array.isArray(uW(i,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),g(e,!1,void 0,r)}else n=uW(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!oW(c.array,e)||!l.action)&&c.unMount.add(e)}}},L=()=>r.shouldFocusError&&AW(a,(e=>e&&uW(o.errors,e)),c.mount),$=(e,t)=>async n=>{n&&(n.preventDefault&&n.preventDefault(),n.persist&&n.persist());let i=sW(s);if(p.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await x();o.errors=e,i=t}else await T(a);tH(o.errors,"root"),kW(o.errors)?(p.state.next({errors:{}}),await e(i,n)):(t&&await t({...o.errors},n),L(),setTimeout(L)),p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:kW(o.errors),submitCount:o.submitCount+1,errors:o.errors})},V=(n,r={})=>{const u=n?sW(n):i,m=sW(u),h=n&&!kW(n)?m:i;if(r.keepDefaultValues||(i=u),!r.keepValues){if(r.keepDirtyValues||f)for(const e of c.mount)uW(o.dirtyFields,e)?RW(h,e,uW(s,e)):P(e,uW(h,e));else{if(iW&&cW(n))for(const e of c.mount){const t=uW(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(WW(e)){const t=e.closest("form");if(t){t.reset();break}}}}a={}}s=e.shouldUnregister?r.keepDefaultValues?sW(i):{}:sW(h),p.array.next({values:{...h}}),p.values.next({values:{...h}})}c={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!l.mount&&t(),l.mount=!d.isValid||!!r.keepIsValid,l.watch=!!e.shouldUnregister,p.state.next({submitCount:r.keepSubmitCount?o.submitCount:0,isDirty:r.keepDirty?o.isDirty:!(!r.keepDefaultValues||oH(n,i)),isSubmitted:!!r.keepIsSubmitted&&o.isSubmitted,dirtyFields:r.keepDirtyValues?o.dirtyFields:r.keepDefaultValues&&n?dH(i,n):{},touchedFields:r.keepTouched?o.touchedFields:{},errors:r.keepErrors?o.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})},F=(e,t)=>V(zW(e)?e(s):e,t);return{control:{register:A,unregister:_,getFieldState:D,handleSubmit:$,setError:R,_executeSchema:x,_getWatch:E,_getDirty:k,_updateValid:y,_removeUnmounted:()=>{for(const e of c.unMount){const t=uW(a,e);t&&(t._f.refs?t._f.refs.every((e=>!sH(e))):!sH(t._f.ref))&&_(e)}c.unMount=new Set},_updateFieldArray:(e,t=[],n,r,c=!0,u=!0)=>{if(r&&n){if(l.action=!0,u&&Array.isArray(uW(a,e))){const t=n(uW(a,e),r.argA,r.argB);c&&RW(a,e,t)}if(u&&Array.isArray(uW(o.errors,e))){const t=n(uW(o.errors,e),r.argA,r.argB);c&&RW(o.errors,e,t),gH(o.errors,e)}if(d.touchedFields&&u&&Array.isArray(uW(o.touchedFields,e))){const t=n(uW(o.touchedFields,e),r.argA,r.argB);c&&RW(o.touchedFields,e,t)}d.dirtyFields&&(o.dirtyFields=dH(i,s)),p.state.next({name:e,isDirty:k(e,t),dirtyFields:o.dirtyFields,errors:o.errors,isValid:o.isValid})}else RW(s,e,t)},_updateDisabledField:I,_getFieldArray:t=>lW(uW(l.mount?s:i,t,e.shouldUnregister?uW(i,t,[]):[])),_reset:V,_resetDefaultValues:()=>zW(r.defaultValues)&&r.defaultValues().then((e=>{F(e,r.resetOptions),p.state.next({isLoading:!1})})),_updateFormState:e=>{o={...o,...e}},_subjects:p,_proxyFormState:d,get _fields(){return a},get _formValues(){return s},get _state(){return l},set _state(e){l=e},get _defaultValues(){return i},get _names(){return c},set _names(e){c=e},get _formState(){return o},set _formState(e){o=e},get _options(){return r},set _options(e){r={...r,...e}}},trigger:j,register:A,handleSubmit:$,watch:(e,t)=>zW(e)?p.values.subscribe({next:n=>e(E(void 0,t),n)}):E(e,t,!0),setValue:P,getValues:N,reset:F,resetField:(e,t={})=>{uW(a,e)&&(cW(t.defaultValue)?P(e,uW(i,e)):(P(e,t.defaultValue),RW(i,e,t.defaultValue)),t.keepTouched||tH(o.touchedFields,e),t.keepDirty||(tH(o.dirtyFields,e),o.isDirty=t.defaultValue?k(e,uW(i,e)):k()),t.keepError||(tH(o.errors,e),d.isValid&&y()),p.state.next({...o}))},clearErrors:e=>{e&&CW(e).forEach((e=>tH(o.errors,e))),p.state.next({errors:e?o.errors:{}})},unregister:_,setError:R,setFocus:(e,t={})=>{const n=uW(a,e),r=n&&n._f;if(r){const e=r.refs?r.refs[0]:r.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},getFieldState:D}}var xH=s((function({children:t,onSubmit:n,defaultValues:r,errorHandlingMode:a="onChange"},i){const s=function(e={}){const t=o.useRef(),n=o.useRef(),[r,a]=o.useState({isDirty:!1,isValidating:!1,isLoading:zW(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:zW(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...OH(e,(()=>a((e=>({...e}))))),formState:r});const i=t.current.control;return i._options=e,PW({subject:i._subjects.state,next:e=>{EW(e,i._proxyFormState,i._updateFormState,!0)&&a({...i._formState})}}),o.useEffect((()=>{e.values&&!oH(e.values,n.current)?(i._reset(e.values,i._options.resetOptions),n.current=e.values):i._resetDefaultValues()}),[e.values,i]),o.useEffect((()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()})),t.current.formState=TW(r,i),t.current}({mode:a,defaultValues:r});return g(i,(()=>({formState:s}))),e(xW,{...s,children:e("form",{onSubmit:s.handleSubmit(n),children:t})})}));function TH({name:n="",rules:r={},Component:o,...a}){const{control:i}=OW(),{field:s,fieldState:{error:l}}=_W({control:i,name:n,rules:r,shouldUnregister:!0,defaultValue:a?.defaultValue});return t("div",{children:[e(o,{...s,...a,onChange:function(...e){
281
281
  //! this will change in the future
282
- a.autoComplete?s.onChange(e[1]):s.onChange(...e),a?.onChange?.(...e)}}),l&&l.message&&e("span",{style:{color:"red"},children:l.message})]})}function kH(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function EH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function CH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?EH(Object(n),!0).forEach((function(t){kH(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):EH(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function SH(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function PH(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function MH(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function NH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jH(Object(n),!0).forEach((function(t){MH(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jH(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function DH(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return o.length>=e.length?e.apply(this,o):function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return t.apply(n,[].concat(o,r))}}}function RH(e){return{}.toString.call(e).includes("Object")}function _H(e){return"function"==typeof e}var IH=DH((function(e,t){throw new Error(e[t]||e.default)}))({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),AH={changes:function(e,t){return RH(t)||IH("changeType"),Object.keys(t).some((function(t){return n=e,r=t,!Object.prototype.hasOwnProperty.call(n,r);var n,r}))&&IH("changeField"),t},selector:function(e){_H(e)||IH("selectorType")},handler:function(e){_H(e)||RH(e)||IH("handlerType"),RH(e)&&Object.values(e).some((function(e){return!_H(e)}))&&IH("handlersType")},initial:function(e){e||IH("initialIsRequired"),RH(e)||IH("initialType"),function(e){return!Object.keys(e).length}(e)&&IH("initialContent")}};function LH(e,t){return _H(t)?t(e.current):t}function $H(e,t){return e.current=NH(NH({},e.current),t),t}function VH(e,t,n){return _H(t)?t(e.current):Object.keys(n).forEach((function(n){var r;return null===(r=t[n])||void 0===r?void 0:r.call(t,e.current[n])})),n}var FH={create:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};AH.initial(e),AH.handler(t);var n={current:e},r=DH(VH)(n,t),o=DH($H)(n),a=DH(AH.changes)(e),i=DH(LH)(n);return[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e};return AH.selector(e),e(n.current)},function(e){!function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight((function(e,t){return t(e)}),e)}}(r,o,a,i)(e)}]}};var BH,zH={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},WH=(BH=function(e,t){throw new Error(e[t]||e.default)},function e(){for(var t=this,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return r.length>=BH.length?BH.apply(this,r):function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return e.apply(t,[].concat(r,o))}})(zH),HH={config:function(e){var t;return e||WH("configIsRequired"),t=e,{}.toString.call(t).includes("Object")||WH("configType"),e.urls?(console.warn(zH.deprecation),{paths:{vs:e.urls.monacoBase}}):e}};function UH(e,t){return Object.keys(t).forEach((function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],UH(e[n],t[n]))})),CH(CH({},e),t)}var KH={type:"cancelation",msg:"operation is manually canceled"};function qH(e){var t=!1,n=new Promise((function(n,r){e.then((function(e){return t?r(KH):n(e)})),e.catch(r)}));return n.cancel=function(){return t=!0},n}var YH,XH,GH=FH.create({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.36.1/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}),ZH=(XH=2,function(e){if(Array.isArray(e))return e}(YH=GH)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(r=(i=s.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw a}}return n}}(YH,XH)||function(e,t){if(e){if("string"==typeof e)return PH(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?PH(e,t):void 0}}(YH,XH)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),QH=ZH[0],JH=ZH[1];function eU(e){return document.body.appendChild(e)}function tU(e){var t,n,r=QH((function(e){return{config:e.config,reject:e.reject}})),o=(t="".concat(r.config.paths.vs,"/loader.js"),n=document.createElement("script"),t&&(n.src=t),n);return o.onload=function(){return e()},o.onerror=r.reject,o}function nU(){var e=QH((function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}})),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],(function(t){rU(t),e.resolve(t)}),(function(t){e.reject(t)}))}function rU(e){QH().monaco||JH({monaco:e})}var oU=new Promise((function(e,t){return JH({resolve:e,reject:t})})),aU={config:function(e){var t=HH.config(e),n=t.monaco,r=SH(t,["monaco"]);JH((function(e){return{config:UH(e.config,r),monaco:n}}))},init:function(){var e=QH((function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}}));if(!e.isInitialized){if(JH({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),qH(oU);if(window.monaco&&window.monaco.editor)return rU(window.monaco),e.resolve(window.monaco),qH(oU);!function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight((function(e,t){return t(e)}),e)}}(eU,tU)(nU)}return qH(oU)},__getMonacoInstance:function(){return QH((function(e){return e.monaco}))}},iU={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},sU={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}};var lU=function({children:e}){return o.createElement("div",{style:sU.container},e)},cU=lU;var uU=function({width:e,height:t,isEditorReady:n,loading:r,_ref:a,className:i,wrapperProps:s}){return o.createElement("section",{style:{...iU.wrapper,width:e,height:t},...s},!n&&o.createElement(cU,null,r),o.createElement("div",{ref:a,style:{...iU.fullWidth,...!n&&iU.hide},className:i}))},dU=x(uU);var pU=function(e){h(e,[])};var fU=function(e,t,n=!0){let r=d(!0);h(r.current||!n?()=>{r.current=!1}:e,t)};function mU(){}function hU(e,t,n,r){return function(e,t){return e.editor.getModel(bU(e,t))}(e,r)||function(e,t,n,r){return e.editor.createModel(t,n,r?bU(e,r):void 0)}(e,t,n,r)}function bU(e,t){return e.Uri.parse(t)}var yU=function({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:a,originalModelPath:i,modifiedModelPath:s,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:c=!1,theme:u="light",loading:p="Loading...",options:f={},height:m="100%",width:b="100%",className:y,wrapperProps:g={},beforeMount:O=mU,onMount:x=mU}){let[T,k]=w(!1),[E,C]=w(!0),S=d(null),P=d(null),M=d(null),j=d(x),N=d(O),D=d(!1);pU((()=>{let e=aU.init();return e.then((e=>(P.current=e)&&C(!1))).catch((e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e))),()=>S.current?function(){let e=S.current?.getModel();l||e?.original?.dispose(),c||e?.modified?.dispose(),S.current?.dispose()}():e.cancel()})),fU((()=>{let e=S.current.getModifiedEditor();e.getOption(P.current.editor.EditorOption.readOnly)?e.setValue(t||""):t!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),e.pushUndoStop())}),[t],T),fU((()=>{S.current?.getModel()?.original.setValue(e||"")}),[e],T),fU((()=>{let{original:e,modified:t}=S.current.getModel();P.current.editor.setModelLanguage(e,r||n||"text"),P.current.editor.setModelLanguage(t,a||n||"text")}),[n,r,a],T),fU((()=>{P.current?.editor.setTheme(u)}),[u],T),fU((()=>{S.current?.updateOptions(f)}),[f],T);let R=v((()=>{if(!P.current)return;N.current(P.current);let o=hU(P.current,e||"",r||n||"text",i||""),l=hU(P.current,t||"",a||n||"text",s||"");S.current?.setModel({original:o,modified:l})}),[n,t,a,e,r,i,s]),_=v((()=>{!D.current&&M.current&&(S.current=P.current.editor.createDiffEditor(M.current,{automaticLayout:!0,...f}),R(),P.current?.editor.setTheme(u),k(!0),D.current=!0)}),[f,u,R]);return h((()=>{T&&j.current(S.current,P.current)}),[T]),h((()=>{!E&&!T&&_()}),[E,T,_]),fU((()=>{if(S.current&&P.current){let t=S.current.getOriginalEditor(),o=hU(P.current,e||"",r||n||"text",i||"");o!==t.getModel()&&t.setModel(o)}}),[i],T),fU((()=>{if(S.current&&P.current){let e=S.current.getModifiedEditor(),r=hU(P.current,t||"",a||n||"text",s||"");r!==e.getModel()&&e.setModel(r)}}),[s],T),o.createElement(dU,{width:b,height:m,isEditorReady:T,loading:p,_ref:M,className:y,wrapperProps:g})};x(yU);var vU=function(e){let t=d();return h((()=>{t.current=e}),[e]),t.current},gU=new Map;var wU=function({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:a,path:i,theme:s="light",line:l,loading:c="Loading...",options:u={},overrideServices:p={},saveViewState:f=!0,keepCurrentModel:m=!1,width:b="100%",height:y="100%",className:g,wrapperProps:O={},beforeMount:x=mU,onMount:T=mU,onChange:k,onValidate:E=mU}){let[C,S]=w(!1),[P,M]=w(!0),j=d(null),N=d(null),D=d(null),R=d(T),_=d(x),I=d(),A=d(r),L=vU(i),$=d(!1),V=d(!1);pU((()=>{let e=aU.init();return e.then((e=>(j.current=e)&&M(!1))).catch((e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e))),()=>N.current?(I.current?.dispose(),m?f&&gU.set(i,N.current.saveViewState()):N.current.getModel()?.dispose(),void N.current.dispose()):e.cancel()})),fU((()=>{let o=hU(j.current,e||r||"",t||a||"",i||n||"");o!==N.current?.getModel()&&(f&&gU.set(L,N.current?.saveViewState()),N.current?.setModel(o),f&&N.current?.restoreViewState(gU.get(i)))}),[i],C),fU((()=>{N.current?.updateOptions(u)}),[u],C),fU((()=>{!N.current||void 0===r||(N.current.getOption(j.current.editor.EditorOption.readOnly)?N.current.setValue(r):r!==N.current.getValue()&&(V.current=!0,N.current.executeEdits("",[{range:N.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),N.current.pushUndoStop(),V.current=!1))}),[r],C),fU((()=>{let e=N.current?.getModel();e&&a&&j.current?.editor.setModelLanguage(e,a)}),[a],C),fU((()=>{void 0!==l&&N.current?.revealLine(l)}),[l],C),fU((()=>{j.current?.editor.setTheme(s)}),[s],C);let F=v((()=>{if(D.current&&j.current&&!$.current){_.current(j.current);let o=i||n,l=hU(j.current,r||e||"",t||a||"",o||"");N.current=j.current?.editor.create(D.current,{model:l,automaticLayout:!0,...u},p),f&&N.current.restoreViewState(gU.get(o)),j.current.editor.setTheme(s),S(!0),$.current=!0}}),[e,t,n,r,a,i,u,p,f,s]);return h((()=>{C&&R.current(N.current,j.current)}),[C]),h((()=>{!P&&!C&&F()}),[P,C,F]),A.current=r,h((()=>{C&&k&&(I.current?.dispose(),I.current=N.current?.onDidChangeModelContent((e=>{V.current||k(N.current.getValue(),e)})))}),[C,k]),h((()=>{if(C){let e=j.current.editor.onDidChangeMarkers((e=>{let t=N.current.getModel()?.uri;if(t&&e.find((e=>e.path===t.path))){let e=j.current.editor.getModelMarkers({resource:t});E?.(e)}}));return()=>{e?.dispose()}}return()=>{}}),[C,E]),o.createElement(dU,{width:b,height:y,isEditorReady:C,loading:c,_ref:D,className:g,wrapperProps:O})},OU=x(wU);function xU(t){return e("div",{style:{direction:"ltr"},children:e(OU,{...t})})}function TU(t){return e(P,{striped:!0,...t})}export{xz as KdpaAccordion,kz as KdpaAccordionDetails,Tz as KdpaAccordionSummary,pw as KdpaAlert,fw as KdpaAlertTitle,dD as KdpaAutoComplete,$T as KdpaAvatar,gT as KdpaBadge,pD as KdpaButton,bD as KdpaCheckBox,DT as KdpaChip,SD as KdpaCircularProgress,xU as KdpaCodeEditor,kD as KdpaCollapse,RD as KdpaCollapseTransitions,SI as KdpaCopyToClipboard,TU as KdpaDataGrid,AN as KdpaDatePicker,iD as KdpaDateTimePicker,ED as KdpaDivider,GR as KdpaDropZone,ND as KdpaFade,Zz as KdpaFileUploader,xH as KdpaFormContainer,sD as KdpaFormControl,lD as KdpaFormControlLabel,TH as KdpaFormField,Kz as KdpaFullScreenDialog,TT as KdpaGrid,xT as KdpaGridBadge,DD as KdpaGrow,fD as KdpaIconButton,MI as KdpaInlineSpinner,RT as KdpaInput,_T as KdpaInputLabel,IT as KdpaInputMultiline,E_ as KdpaLazyDrop,jI as KdpaLoading,uD as KdpaMenuItem,yA as KdpaModalImage,wT as KdpaMuiBadge,gA as KdpaPaginationGrid,mD as KdpaPrimaryButton,AT as KdpaRadio,LT as KdpaRadioGroup,Hz as KdpaRtlProvider,hD as KdpaSecondaryButton,Xz as KdpaSegment,cD as KdpaSelect,NI as KdpaSkeleton,_D as KdpaSlide,vA as KdpaSlider,OD as KdpaSweetAlertConfirm,xD as KdpaSweetAlertDelete,TD as KdpaSweetAlertOK,VT as KdpaSwitch,MD as KdpaTab,jD as KdpaTabs,Ez as KdpaThemeProvider,Kj as KdpaTimePicker,OT as KdpaTooltip,TA as KdpaTree,Oz as KdpaTreeSelect,CD as KdpaTypography,ID as KdpaZoom};
282
+ a.autoComplete?s.onChange(e[1]):s.onChange(...e),a?.onChange?.(...e)}}),l&&l.message&&e("span",{style:{color:"red"},children:l.message})]})}function kH(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function EH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function CH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?EH(Object(n),!0).forEach((function(t){kH(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):EH(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function SH(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function PH(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function MH(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function NH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jH(Object(n),!0).forEach((function(t){MH(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jH(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function DH(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return o.length>=e.length?e.apply(this,o):function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return t.apply(n,[].concat(o,r))}}}function RH(e){return{}.toString.call(e).includes("Object")}function _H(e){return"function"==typeof e}var IH=DH((function(e,t){throw new Error(e[t]||e.default)}))({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),AH={changes:function(e,t){return RH(t)||IH("changeType"),Object.keys(t).some((function(t){return n=e,r=t,!Object.prototype.hasOwnProperty.call(n,r);var n,r}))&&IH("changeField"),t},selector:function(e){_H(e)||IH("selectorType")},handler:function(e){_H(e)||RH(e)||IH("handlerType"),RH(e)&&Object.values(e).some((function(e){return!_H(e)}))&&IH("handlersType")},initial:function(e){e||IH("initialIsRequired"),RH(e)||IH("initialType"),function(e){return!Object.keys(e).length}(e)&&IH("initialContent")}};function LH(e,t){return _H(t)?t(e.current):t}function $H(e,t){return e.current=NH(NH({},e.current),t),t}function VH(e,t,n){return _H(t)?t(e.current):Object.keys(n).forEach((function(n){var r;return null===(r=t[n])||void 0===r?void 0:r.call(t,e.current[n])})),n}var FH={create:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};AH.initial(e),AH.handler(t);var n={current:e},r=DH(VH)(n,t),o=DH($H)(n),a=DH(AH.changes)(e),i=DH(LH)(n);return[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e};return AH.selector(e),e(n.current)},function(e){!function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight((function(e,t){return t(e)}),e)}}(r,o,a,i)(e)}]}};var BH,zH={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},WH=(BH=function(e,t){throw new Error(e[t]||e.default)},function e(){for(var t=this,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return r.length>=BH.length?BH.apply(this,r):function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return e.apply(t,[].concat(r,o))}})(zH),HH={config:function(e){var t;return e||WH("configIsRequired"),t=e,{}.toString.call(t).includes("Object")||WH("configType"),e.urls?(console.warn(zH.deprecation),{paths:{vs:e.urls.monacoBase}}):e}};function UH(e,t){return Object.keys(t).forEach((function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],UH(e[n],t[n]))})),CH(CH({},e),t)}var KH={type:"cancelation",msg:"operation is manually canceled"};function qH(e){var t=!1,n=new Promise((function(n,r){e.then((function(e){return t?r(KH):n(e)})),e.catch(r)}));return n.cancel=function(){return t=!0},n}var YH,XH,GH=FH.create({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.36.1/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}),ZH=(XH=2,function(e){if(Array.isArray(e))return e}(YH=GH)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(r=(i=s.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw a}}return n}}(YH,XH)||function(e,t){if(e){if("string"==typeof e)return PH(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?PH(e,t):void 0}}(YH,XH)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),QH=ZH[0],JH=ZH[1];function eU(e){return document.body.appendChild(e)}function tU(e){var t,n,r=QH((function(e){return{config:e.config,reject:e.reject}})),o=(t="".concat(r.config.paths.vs,"/loader.js"),n=document.createElement("script"),t&&(n.src=t),n);return o.onload=function(){return e()},o.onerror=r.reject,o}function nU(){var e=QH((function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}})),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],(function(t){rU(t),e.resolve(t)}),(function(t){e.reject(t)}))}function rU(e){QH().monaco||JH({monaco:e})}var oU=new Promise((function(e,t){return JH({resolve:e,reject:t})})),aU={config:function(e){var t=HH.config(e),n=t.monaco,r=SH(t,["monaco"]);JH((function(e){return{config:UH(e.config,r),monaco:n}}))},init:function(){var e=QH((function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}}));if(!e.isInitialized){if(JH({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),qH(oU);if(window.monaco&&window.monaco.editor)return rU(window.monaco),e.resolve(window.monaco),qH(oU);!function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight((function(e,t){return t(e)}),e)}}(eU,tU)(nU)}return qH(oU)},__getMonacoInstance:function(){return QH((function(e){return e.monaco}))}},iU={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},sU={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}};var lU=function({children:e}){return o.createElement("div",{style:sU.container},e)},cU=lU;var uU=function({width:e,height:t,isEditorReady:n,loading:r,_ref:a,className:i,wrapperProps:s}){return o.createElement("section",{style:{...iU.wrapper,width:e,height:t},...s},!n&&o.createElement(cU,null,r),o.createElement("div",{ref:a,style:{...iU.fullWidth,...!n&&iU.hide},className:i}))},dU=x(uU);var pU=function(e){h(e,[])};var fU=function(e,t,n=!0){let r=d(!0);h(r.current||!n?()=>{r.current=!1}:e,t)};function mU(){}function hU(e,t,n,r){return function(e,t){return e.editor.getModel(bU(e,t))}(e,r)||function(e,t,n,r){return e.editor.createModel(t,n,r?bU(e,r):void 0)}(e,t,n,r)}function bU(e,t){return e.Uri.parse(t)}var yU=function({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:a,originalModelPath:i,modifiedModelPath:s,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:c=!1,theme:u="light",loading:p="Loading...",options:f={},height:m="100%",width:b="100%",className:y,wrapperProps:g={},beforeMount:O=mU,onMount:x=mU}){let[T,k]=w(!1),[E,C]=w(!0),S=d(null),P=d(null),M=d(null),j=d(x),N=d(O),D=d(!1);pU((()=>{let e=aU.init();return e.then((e=>(P.current=e)&&C(!1))).catch((e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e))),()=>S.current?function(){let e=S.current?.getModel();l||e?.original?.dispose(),c||e?.modified?.dispose(),S.current?.dispose()}():e.cancel()})),fU((()=>{let e=S.current.getModifiedEditor();e.getOption(P.current.editor.EditorOption.readOnly)?e.setValue(t||""):t!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),e.pushUndoStop())}),[t],T),fU((()=>{S.current?.getModel()?.original.setValue(e||"")}),[e],T),fU((()=>{let{original:e,modified:t}=S.current.getModel();P.current.editor.setModelLanguage(e,r||n||"text"),P.current.editor.setModelLanguage(t,a||n||"text")}),[n,r,a],T),fU((()=>{P.current?.editor.setTheme(u)}),[u],T),fU((()=>{S.current?.updateOptions(f)}),[f],T);let R=v((()=>{if(!P.current)return;N.current(P.current);let o=hU(P.current,e||"",r||n||"text",i||""),l=hU(P.current,t||"",a||n||"text",s||"");S.current?.setModel({original:o,modified:l})}),[n,t,a,e,r,i,s]),_=v((()=>{!D.current&&M.current&&(S.current=P.current.editor.createDiffEditor(M.current,{automaticLayout:!0,...f}),R(),P.current?.editor.setTheme(u),k(!0),D.current=!0)}),[f,u,R]);return h((()=>{T&&j.current(S.current,P.current)}),[T]),h((()=>{!E&&!T&&_()}),[E,T,_]),fU((()=>{if(S.current&&P.current){let t=S.current.getOriginalEditor(),o=hU(P.current,e||"",r||n||"text",i||"");o!==t.getModel()&&t.setModel(o)}}),[i],T),fU((()=>{if(S.current&&P.current){let e=S.current.getModifiedEditor(),r=hU(P.current,t||"",a||n||"text",s||"");r!==e.getModel()&&e.setModel(r)}}),[s],T),o.createElement(dU,{width:b,height:m,isEditorReady:T,loading:p,_ref:M,className:y,wrapperProps:g})};x(yU);var vU=function(e){let t=d();return h((()=>{t.current=e}),[e]),t.current},gU=new Map;var wU=function({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:a,path:i,theme:s="light",line:l,loading:c="Loading...",options:u={},overrideServices:p={},saveViewState:f=!0,keepCurrentModel:m=!1,width:b="100%",height:y="100%",className:g,wrapperProps:O={},beforeMount:x=mU,onMount:T=mU,onChange:k,onValidate:E=mU}){let[C,S]=w(!1),[P,M]=w(!0),j=d(null),N=d(null),D=d(null),R=d(T),_=d(x),I=d(),A=d(r),L=vU(i),$=d(!1),V=d(!1);pU((()=>{let e=aU.init();return e.then((e=>(j.current=e)&&M(!1))).catch((e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e))),()=>N.current?(I.current?.dispose(),m?f&&gU.set(i,N.current.saveViewState()):N.current.getModel()?.dispose(),void N.current.dispose()):e.cancel()})),fU((()=>{let o=hU(j.current,e||r||"",t||a||"",i||n||"");o!==N.current?.getModel()&&(f&&gU.set(L,N.current?.saveViewState()),N.current?.setModel(o),f&&N.current?.restoreViewState(gU.get(i)))}),[i],C),fU((()=>{N.current?.updateOptions(u)}),[u],C),fU((()=>{!N.current||void 0===r||(N.current.getOption(j.current.editor.EditorOption.readOnly)?N.current.setValue(r):r!==N.current.getValue()&&(V.current=!0,N.current.executeEdits("",[{range:N.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),N.current.pushUndoStop(),V.current=!1))}),[r],C),fU((()=>{let e=N.current?.getModel();e&&a&&j.current?.editor.setModelLanguage(e,a)}),[a],C),fU((()=>{void 0!==l&&N.current?.revealLine(l)}),[l],C),fU((()=>{j.current?.editor.setTheme(s)}),[s],C);let F=v((()=>{if(D.current&&j.current&&!$.current){_.current(j.current);let o=i||n,l=hU(j.current,r||e||"",t||a||"",o||"");N.current=j.current?.editor.create(D.current,{model:l,automaticLayout:!0,...u},p),f&&N.current.restoreViewState(gU.get(o)),j.current.editor.setTheme(s),S(!0),$.current=!0}}),[e,t,n,r,a,i,u,p,f,s]);return h((()=>{C&&R.current(N.current,j.current)}),[C]),h((()=>{!P&&!C&&F()}),[P,C,F]),A.current=r,h((()=>{C&&k&&(I.current?.dispose(),I.current=N.current?.onDidChangeModelContent((e=>{V.current||k(N.current.getValue(),e)})))}),[C,k]),h((()=>{if(C){let e=j.current.editor.onDidChangeMarkers((e=>{let t=N.current.getModel()?.uri;if(t&&e.find((e=>e.path===t.path))){let e=j.current.editor.getModelMarkers({resource:t});E?.(e)}}));return()=>{e?.dispose()}}return()=>{}}),[C,E]),o.createElement(dU,{width:b,height:y,isEditorReady:C,loading:c,_ref:D,className:g,wrapperProps:O})},OU=x(wU);function xU(t){return e("div",{style:{direction:"ltr"},children:e(OU,{...t})})}function TU(t){return e("div",{children:e(P,{striped:!0,...t})})}export{xz as KdpaAccordion,kz as KdpaAccordionDetails,Tz as KdpaAccordionSummary,pw as KdpaAlert,fw as KdpaAlertTitle,dD as KdpaAutoComplete,$T as KdpaAvatar,gT as KdpaBadge,pD as KdpaButton,bD as KdpaCheckBox,DT as KdpaChip,SD as KdpaCircularProgress,xU as KdpaCodeEditor,kD as KdpaCollapse,RD as KdpaCollapseTransitions,SI as KdpaCopyToClipboard,TU as KdpaDataGrid,AN as KdpaDatePicker,iD as KdpaDateTimePicker,ED as KdpaDivider,GR as KdpaDropZone,ND as KdpaFade,Zz as KdpaFileUploader,xH as KdpaFormContainer,sD as KdpaFormControl,lD as KdpaFormControlLabel,TH as KdpaFormField,Kz as KdpaFullScreenDialog,TT as KdpaGrid,xT as KdpaGridBadge,DD as KdpaGrow,fD as KdpaIconButton,MI as KdpaInlineSpinner,RT as KdpaInput,_T as KdpaInputLabel,IT as KdpaInputMultiline,E_ as KdpaLazyDrop,jI as KdpaLoading,uD as KdpaMenuItem,yA as KdpaModalImage,wT as KdpaMuiBadge,gA as KdpaPaginationGrid,mD as KdpaPrimaryButton,AT as KdpaRadio,LT as KdpaRadioGroup,Hz as KdpaRtlProvider,hD as KdpaSecondaryButton,Xz as KdpaSegment,cD as KdpaSelect,NI as KdpaSkeleton,_D as KdpaSlide,vA as KdpaSlider,OD as KdpaSweetAlertConfirm,xD as KdpaSweetAlertDelete,TD as KdpaSweetAlertOK,VT as KdpaSwitch,MD as KdpaTab,jD as KdpaTabs,Ez as KdpaThemeProvider,Kj as KdpaTimePicker,OT as KdpaTooltip,TA as KdpaTree,Oz as KdpaTreeSelect,CD as KdpaTypography,ID as KdpaZoom};
@@ -1 +1 @@
1
- {"version":3,"file":"KdpaDataGrid.d.ts","sourceRoot":"","sources":["../../../../src/components/DataGrid/KdpaDataGrid.tsx"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,CAAC;AAEzB,iBAAS,YAAY,CAAC,KAAK,EAAE,GAAG,2CAE/B;AAED,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"KdpaDataGrid.d.ts","sourceRoot":"","sources":["../../../../src/components/DataGrid/KdpaDataGrid.tsx"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,CAAC;AAEzB,iBAAS,YAAY,CAAC,KAAK,EAAE,GAAG,2CAM/B;AAED,eAAe,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kdpa-components",
3
- "version": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",