!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["true-react-platform-helpers"]={})}(this,(function(t){"use strict";const e=t=>"function"==typeof t,r=(t,r)=>e(t)?t(r):r[t],n=(t,e,n)=>[r(t,e),r(t,n)],o=t=>""!==(null!=t?t:"").trim(),i=(t,e)=>(r,n)=>{const i=t(r).reduce(((t,e)=>[...t,...o(e)?[e.toLowerCase()]:[]]),[]),a=n.toLowerCase().trim();return i.some((t=>(null!=e?e:()=>null==t?void 0:t.includes(a))(t,a)))},a=t=>null!=t,u=t=>Array.isArray(t)?t:a(t)?[t]:[];const c=t=>"[object Object]"===Object.prototype.toString.call(t),s=t=>Array.isArray(t)?t.map(s):c(t)?Object.fromEntries(Object.entries(t).map((([t,e])=>[t,s(e)]))):null!=t?t:void 0,l=(t,...r)=>e(t)?t(...r):t,f=t=>!a(t);const p=t=>(null!=t?t:[]).length>0,d=t=>p(t),y=t=>"string"==typeof t,v=[{type:"Date",predicate:t=>t instanceof Date,serialize:t=>t.toISOString(),deserialize:t=>new Date(t)},{type:"BigInt",predicate:t=>"bigint"==typeof t,serialize:t=>String(t),deserialize:t=>BigInt(t)}],b=t=>{var e;return null!=(e=t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))?e:[]},h=(t,e=" ")=>t.filter((t=>y(t)&&o(t))).join(e),_=(t,e)=>t.slice(0,1)[e>0?"toUpperCase":"toLowerCase"]()+t.slice(1).toLowerCase(),g=t=>b(t).join("-").toLowerCase();function m(t,e){return t===e||t!=t&&e!=e}function j(t,e){for(var r=t.length;r--;)if(m(t[r][0],e))return r;return-1}var O=Array.prototype.splice;function A(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e-1},A.prototype.set=function(t,e){var r=this.__data__,n=j(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var w="object"==typeof global&&global&&global.Object===Object&&global,S="object"==typeof self&&self&&self.Object===Object&&self,z=w||S||Function("return this")(),C=z.Symbol,E=Object.prototype,N=E.hasOwnProperty,T=E.toString,P=C?C.toStringTag:void 0;var D=Object.prototype.toString;var I="[object Null]",F="[object Undefined]",x=C?C.toStringTag:void 0;function L(t){return null==t?void 0===t?F:I:x&&x in Object(t)?function(t){var e=N.call(t,P),r=t[P];try{t[P]=void 0;var n=!0}catch{}var o=T.call(t);return n&&(e?t[P]=r:delete t[P]),o}(t):function(t){return D.call(t)}(t)}function M(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var U="[object AsyncFunction]",k="[object Function]",B="[object GeneratorFunction]",$="[object Proxy]";function R(t){if(!M(t))return!1;var e=L(t);return e==k||e==B||e==U||e==$}var J,q=z["__core-js_shared__"],Z=(J=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||""))?"Symbol(src)_1."+J:"";var H=Function.prototype.toString;var K=/^\[object .+?Constructor\]$/,G=Function.prototype,V=Object.prototype,W=G.toString,Y=V.hasOwnProperty,Q=RegExp("^"+W.call(Y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function X(t){return!(!M(t)||function(t){return!!Z&&Z in t}(t))&&(R(t)?Q:K).test(function(t){if(null!=t){try{return H.call(t)}catch{}try{return t+""}catch{}}return""}(t))}function tt(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return X(r)?r:void 0}var et=tt(z,"Map"),rt=tt(Object,"create");var nt=Object.prototype.hasOwnProperty;var ot=Object.prototype.hasOwnProperty;function it(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e-1&&t%1==0&&t<=Tt}function Dt(t){return null!=t&&Pt(t.length)&&!R(t)}var It="object"==typeof t&&t&&!t.nodeType&&t,Ft=It&&"object"==typeof module&&module&&!module.nodeType&&module,xt=Ft&&Ft.exports===It?z.Buffer:void 0,Lt=(xt?xt.isBuffer:void 0)||function(){return!1},Mt="[object Object]",Ut=Function.prototype,kt=Object.prototype,Bt=Ut.toString,$t=kt.hasOwnProperty,Rt=Bt.call(Object);var Jt={};Jt["[object Float32Array]"]=Jt["[object Float64Array]"]=Jt["[object Int8Array]"]=Jt["[object Int16Array]"]=Jt["[object Int32Array]"]=Jt["[object Uint8Array]"]=Jt["[object Uint8ClampedArray]"]=Jt["[object Uint16Array]"]=Jt["[object Uint32Array]"]=!0,Jt["[object Arguments]"]=Jt["[object Array]"]=Jt["[object ArrayBuffer]"]=Jt["[object Boolean]"]=Jt["[object DataView]"]=Jt["[object Date]"]=Jt["[object Error]"]=Jt["[object Function]"]=Jt["[object Map]"]=Jt["[object Number]"]=Jt["[object Object]"]=Jt["[object RegExp]"]=Jt["[object Set]"]=Jt["[object String]"]=Jt["[object WeakMap]"]=!1;var qt="object"==typeof t&&t&&!t.nodeType&&t,Zt=qt&&"object"==typeof module&&module&&!module.nodeType&&module,Ht=Zt&&Zt.exports===qt&&w.process,Kt=function(){try{return Zt&&Zt.require&&Zt.require("util").types||Ht&&Ht.binding&&Ht.binding("util")}catch{}}(),Gt=Kt&&Kt.isTypedArray,Vt=Gt?function(t){return function(e){return t(e)}}(Gt):function(t){return At(t)&&Pt(t.length)&&!!Jt[L(t)]};function Wt(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Yt=Object.prototype.hasOwnProperty;function Qt(t,e,r){var n=t[e];(!Yt.call(t,e)||!m(n,r)||void 0===r&&!(e in t))&<(t,e,r)}var Xt=9007199254740991,te=/^(?:0|[1-9]\d*)$/;function ee(t,e){var r=typeof t;return!!(e=null==e?Xt:e)&&("number"==r||"symbol"!=r&&te.test(t))&&t>-1&&t%1==0&&t0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(pe);function ve(t,e){return ye(function(t,e,r){return e=le(void 0===e?t.length-1:e,0),function(){for(var n=arguments,o=-1,i=le(n.length-e,0),a=Array(i);++o1?r[o-1]:void 0,a=o>2?r[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,a&&function(t,e,r){if(!M(r))return!1;var n=typeof e;return!!("number"==n?Dt(r)&&ee(e,r.length):"string"==n&&e in r)&&m(r[e],t)}(r[0],r[1],a)&&(i=o<3?void 0:i,o=1),e=Object(e);++ne=>{("Enter"===e.code||"NumpadEnter"===e.code)&&t(e)},_e=(t,...e)=>{if(a(t))return h([t,...e.filter(a).map(String)],"-")},ge=t=>null==t?void 0:t.preventDefault(),me=t=>null==t?void 0:t.stopPropagation();t.addClickHandler=(t,e=!0)=>e&&a(t)?{tabIndex:0,onClick:t,onKeyDown:he(t)}:{tabIndex:-1},t.addDataAttributes=(t,e,...r)=>Object.fromEntries(Object.entries({testid:_e(e,...r),...t}).map((([t,e])=>!a(e)||y(e)&&!o(e)?void 0:[`data-${g(t)}`,e])).filter(a)),t.addDataTestId=(...t)=>{const e=_e(...t);return a(e)?{"data-testid":e}:void 0},t.applyAction=l,t.applyGetter=r,t.asserts=function(t,e){if(!t)throw new Error(l(e))},t.booleanCompare=(t,e="ASC")=>(r,o)=>{const[i,a]=n(t,r,o).map((t=>Number(null!=t&&t)));return"DESC"===e?a-i:i-a},t.createFilter=(t,e)=>{const r=i(t,e);return(t,e)=>t.filter((t=>r(t,e)))},t.createItemFilter=i,t.dateCompare=(t,e="ASC")=>(r,o)=>{const[i=0,a=0]=n(t,r,o).map((t=>null==t?void 0:t.getTime()));return"DESC"===e?a-i:i-a},t.delay=t=>new Promise((e=>{setTimeout((()=>{e()}),t)})),t.deserialize=(t,e=[])=>{if(!a(t))return;const r=Object.fromEntries([...v,...e].map((t=>[t.type,t])));try{return JSON.parse(t,((t,n)=>{if(!(t=>"string"==typeof(null==t?void 0:t["@type"])&&"string"==typeof(null==t?void 0:t.value))(n))return n;const{"@type":o,value:i}=n;return a(r[o])?r[o].deserialize(i,e):i}))}catch(t){return void console.error("Deserialization error",t)}},t.doNothing=()=>{},t.extractWords=b,t.getArray=u,t.getChangeFormHandler=t=>r=>n=>{t((t=>{const o=e(n)?n(t[r]):n;return Array.isArray(t)?t.map(((t,e)=>e===r?o:t)):{...t,[r]:o}}))},t.getMap=function(t,e,n){return t.reduce(((t,o)=>({...t,[r(e,o)]:r(null!=n?n:t=>t,o)})),{})},t.getSelectKeyHandler=he,t.getTestId=_e,t.getTransition=(t,e="0.25s ease-in-out")=>({transition:e,transitionProperty:t}),t.getUniqueItems=(t=[],e)=>Array.from(t.reduce(((t,n)=>(t.set(a(e)?r(e,n):n,n),t)),new Map).values()),t.hasDuplicates=t=>new Set(t).size!==t.length,t.indexMap=(t,e)=>Array(t).fill(0).map(((t,r)=>e(r))),t.isArrayEmpty=t=>!d(t),t.isArrayLike=t=>"number"==typeof(null==t?void 0:t.length),t.isArrayLikeNotEmpty=p,t.isArrayNotEmpty=d,t.isEmpty=f,t.isFunction=e,t.isNotEmpty=a,t.isNumberInteger=t=>t%1==0,t.isObject=c,t.isObjectNotEmpty=t=>Object.values(null!=t?t:{}).some(a),t.isReactNodeNotEmpty=t=>y(t)?o(t):a(t)&&"boolean"!=typeof t,t.isString=y,t.isStringEmpty=t=>!o(t),t.isStringNotEmpty=o,t.joinStrings=h,t.mergeRefs=t=>r=>{t.forEach((t=>{e(t)?t(r):a(t)&&(t.current=r)}))},t.mergeStyles=(t,...e)=>be({},t,...e),t.nullToUndefined=s,t.numberCompare=(t,e="ASC")=>(r,o)=>{const[i=0,a=0]=n(t,r,o);return"DESC"===e?a-i:i-a},t.omit=function(t,e){if(!a(t))return;const r=u(e).map(String);return Object.fromEntries(Object.entries(t).filter((([t])=>!r.includes(t))))},t.parseJSON=t=>{try{return a(t)?JSON.parse(t):void 0}catch(t){return void console.error("Ошибка преобразования в JSON",t)}},t.pick=function(t,e){if(a(t))return Object.fromEntries(u(e).map((e=>[e,t[e]])))},t.preventDefault=ge,t.roundNumber=(t,e=2)=>{const r=Math.pow(10,e),n=t*r*(1+Number.EPSILON);return Math.round(n)/r},t.scrollToElement=(t,e)=>{var r;const{gap:n,container:o,...i}=null!=e?e:{},a=null!=o?o:document.body,u=y(t)?a.querySelector(t):t;if(f(u))return;if(f(n))return void u.scrollIntoView({behavior:"smooth",...i});const c=u.getBoundingClientRect().top;let s,l=a;a===document.body?(l=window,s=null!=(r=window.scrollY)?r:document.documentElement.scrollTop):s=a.scrollTop-a.getBoundingClientRect().top,l.scrollTo({behavior:"smooth",top:c+s-n})},t.serialize=(t,e=[])=>{const r=[...e,...v];try{return JSON.stringify(t,(function(t){const n=this[t],o=r.find((({predicate:t})=>t(n)));return a(o)?{"@type":o.type,value:o.serialize(n,e)}:n}))}catch(t){return void console.error("Serialization error",t)}},t.stopEvent=t=>{me(t),ge(t)},t.stopPropagation=me,t.stringCompare=(t,e="ASC")=>(r,o)=>{const[i="",a=""]=n(t,r,o).map((t=>null==t?void 0:t.toLowerCase()));return"DESC"===e?a.localeCompare(i):i.localeCompare(a)},t.toCamelCase=t=>b(t).map(_).join(""),t.toKebabCase=g,t.toNumber=t=>f(t)||Number.isNaN(parseFloat(t))?void 0:parseFloat(t),Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));