wjec-one 4.0.0-alpha.21 → 4.0.0-alpha.23
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/auth/index.d.ts +19 -6
- package/auth/index.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/umd/auth/index.js +1 -1
- package/umd/index.js +1 -1
- package/umd/utils/index.js +1 -1
- package/utils/index.d.ts +2 -1
- package/utils/index.js +1 -1
package/umd/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom/server"),require("immutable")):"function"==typeof define&&define.amd?define(["exports","react","react-dom/server","immutable"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WJECOneUtils={},e.React,e.ReactDOMServer,e.Immutable)}(this,(function(e,t,n,r){"use strict";function o(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 i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){u(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(e,t)||f(e,t)||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.")}()}function s(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||f(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){if(e){if("string"==typeof e)return d(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)?d(e,t):void 0}}function d(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}var m=["a[href]","button","details","input",'[tabIndex]:not([tabIndex="-1"])',"textArea","select","summary"].map((function(e){return"".concat(e,":not([disabled])")})),p={expiration:2592e6,path:"/"},y=["date","format"],v=["January","February","March","April","May","June","July","August","September","October","November","December"],g="dd/MM/yyyy",b="HH:mm",h=function(e){var t=e.date,n=e.format,r=void 0===n?g:n,o=t.getDate(),i=t.getMonth()+1,a=t.getFullYear().toString();return r.replace(/dd/,o.toString().padStart(2,"0")).replace(/d/,o.toString()).replace(/MMM/,v[i-1].substr(0,3)).replace(/MM/,i.toString().padStart(2,"0")).replace(/M/,i.toString()).replace(/yyyy/,a).replace(/yy/,a.substr(2))},S=function(e){var t=e.date,n=e.format,r=void 0===n?b:n,o=e.meridianStrings,i=void 0===o?{am:"am",pm:"pm"}:o,a=/h{1,2}/.test(r),u=a?t.getHours()%12||12:t.getHours();return r.replace(/HH/i,u.toString().padStart(2,"0")).replace(/H/i,u.toString()).replace(/mm/,t.getMinutes().toString().padStart(2,"0")).replace(/SS/,t.getSeconds().toString().padStart(2,"0")).replace(/AM/,a?t.getHours()<12?i.am:i.pm:"")},O=function(e){return new Date(new Date(e).setHours(0,0,0,0))},w=function(e){return"[object Date]"===Object.prototype.toString.call(e)},j=function(e){return"function"==typeof e},D=function(e){return"object"===a(e)&&2===Object.keys(e).length&&Object.hasOwn(e,"key")&&Object.hasOwn(e,"label")},A=function(e){return["boolean","number","string"].includes(a(e))},E=function(e){var t=n.renderToStaticMarkup(e);return/^<svg(.*)<\/svg>$/i.test(t)},M=function(e){var t=e.container,n=void 0===t?document.body:t,r=e.modifyContainer,o=void 0===r?function(){return null}:r,i=e.modifyNode,a=void 0===i?function(){return null}:i,u=e.node,c=document.createElement("div"),l=u.cloneNode(!0);o(c),a(l),c.style.display="inline-block",c.style.position="absolute",c.style.visibility="hidden",c.style.zIndex="-1",c.appendChild(l),n.appendChild(c);var s=c.clientHeight,f=c.clientWidth;return c.parentNode.removeChild(c),{height:s,width:f}},T=function(e){console.error(e)},I=function(e){console.warn(e)},x=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=process.env.NODE_ENV;"development"===n&&t&&T(e)},k=new Uint32Array(2),C=function(e){return"[object Object]"===Object.prototype.toString.call(e)},P=function(e){var t=[];return{addListener:function(n){if(!function(e){return t.find((function(t){return t.listener===e}))}(n)){var r=function(e){return n(e.data)};t.push({listener:n,remove:function(){return e.removeEventListener("message",r)}}),e.addEventListener("message",r)}},removeListener:function(e){var n=t.findIndex((function(t){return t.listener===e})),r=t.splice(n,1)[0];r&&r.remove()}}};e.DAYS=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],e.MONTHS=v,e.assertNever=function(e){throw new Error("Unexpected object: ".concat(e))},e.containsDuplicates=function(e){return new Set(e).size!==e.length},e.createWebWorker=function(e){return e(i(i({},P(self)),{},{postMessage:function(e){return self.postMessage(e,void 0)}})),{path:""}},e.debounce=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];self.clearTimeout(t),t=self.setTimeout((function(){e.apply(void 0,o)}),n)}},e.decrementDate=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.amount,r=void 0===n?1:n,o=t.unit,i=void 0===o?"day":o,a=new Date(e);return"year"===i?a.setFullYear(e.getFullYear()-r):"month"===i?a.setMonth(e.getMonth()-r):a.setDate(e.getDate()-r),a},e.developerError=x,e.developerWarning=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=process.env.NODE_ENV;"development"===n&&t&&I(e)},e.extractContent=function(e,t,n){var r=e;return t&&("function"==typeof t?r=t(e,n):"string"==typeof t&&"object"===a(e)&&Object.hasOwn(e,t)&&(r=e[t])),r},e.extractKey=function(e,t,n){var r=e&&e.toString();if(t)if("function"==typeof t)r=t(e,n);else if("string"==typeof t&&"object"===a(e)&&Object.hasOwn(e,t)){var o=e[t];r="number"==typeof o?o:o.toString()}return r},e.filterValidEntries=function(e){return e.filter((function(e){return e&&null!=e}))},e.findScrollableParent=function(e,t){var n,r=getComputedStyle(e),o=t?/(auto|scroll|hidden)/:/(auto|scroll)/,i="absolute"===r.position;return n="fixed"===r.position||e.parentElement===document.documentElement?document.documentElement:function e(t){var n=getComputedStyle(t);return(!(i=i&&"static"===n.position)||"static"!==n.position)&&o.test(n.overflow+n.overflowY+n.overflowX)||"fixed"===n.position?t:t.parentElement===document.documentElement?document.documentElement:e(t.parentElement)}(e.parentElement),n},e.formatDate=h,e.formatDateTime=function(e){var t=e.date,n=e.format,r=void 0===n?"".concat(g," ").concat(b):n,o=c(e,y),a=S(i(i({},o),{},{date:t,format:r}));return h(i(i({},o),{},{date:t,format:a}))},e.formatTime=S,e.formattedStringToPlainText=function(e){var n=[];return function e(r){var o;o=r,t.isValidElement(o)?t.Children.forEach(r.props.children,e):n.push(null==r?void 0:r.toString())}(e),n.join("")},e.generateId=function(){return crypto.getRandomValues(k).join("-")},e.getCookie=function(e){var t=decodeURIComponent(document.cookie).split(";").map((function(e){return e.trim()})).find((function(t){return 0===t.indexOf(e)}));return t&&t.substring(e.length+1)},e.getDateAtStartOfDay=O,e.getDateAtStartOfMonth=function(e){return O(new Date(new Date(e).setDate(1)))},e.getEnumKeyByValue=function(e,t){return Object.keys(e).find((function(n){return e[n]===t}))},e.getKeyboardFocusableElements=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.documentElement;return Array.from(e.querySelectorAll(m.join(","))).filter((function(e){return!e.hasAttribute("disabled")&&!e.getAttribute("aria-hidden")}))},e.getNumberOfDaysForMonth=function(e){return new Date(e.getFullYear(),e.getMonth()+1,0).getDate()},e.getSelected=function(e,t){return e&&t.includes(e)?e:t.length?t[0]:void 0},e.incrementDate=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.amount,r=void 0===n?1:n,o=t.unit,i=void 0===o?"day":o,a=new Date(e);return"year"===i?a.setFullYear(e.getFullYear()+r):"month"===i?a.setMonth(e.getMonth()+r):a.setDate(e.getDate()+r),a},e.initialiseWebWorker=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new Worker(e),r=P(n);return t.onError&&"function"==typeof t.onError&&(n.onerror=t.onError),i(i({},r),{},{postMessage:function(e){return n.postMessage(e,void 0)},terminate:n.terminate})},e.isArrayEqual=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e.length===t.length&&e.every((function(e,r){return n?t[r]===e:t.includes(e)}))},e.isCallableFunction=j,e.isDate=w,e.isKeyLabelPair=D,e.isKeyLabelPairArray=function(e){return Array.isArray(e)&&e.every(D)},e.isPlainObject=C,e.isPrimitive=A,e.isPrimitiveArray=function(e){return Array.isArray(e)&&e.every(A)},e.isRefObject=function(e){return Object.hasOwn(e,"current")},e.isSvgComponent=E,e.measureDomNode=M,e.measureScrollbarWidth=function(){var e=document.createElement("div"),t=M({node:e}).width;return M({node:e,modifyNode:function(e){return e.style.overflowY="scroll"}}).width-t},e.noop=function(){},e.objectToString=function e(t){var n=t&&Object.keys(t).map((function(n){var r=t[n],o=null!==r&&"object"===a(r)?w(r)?'"'.concat(r.toISOString(),'"'):e(r):null!=r?"string"==typeof r?'"'.concat(r,'"'):r.toString():null===r?"null":"undefined";return Array.isArray(t)?o:"".concat(n,":").concat(o)})).join(",");return n?Array.isArray(t)?"[".concat(n,"]"):"{".concat(n,"}"):""},e.parseDateString=function(e){var t,n,r,o,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=i.format,u=i.shorthand,c=void 0===u||u,s=e&&e.trim(),f="UK"===a||!a&&(c?/^(0|1|2|3)?[0-9]\/(0|1)?[0-9]\/\d{2,4}$/.test(s):/^(0|1|2|3)[0-9]\/(0|1)[0-9]\/\d{4}$/.test(s)),d="US"===a||!a&&(c?/^(0|1)?[0-9]\/(0|1|2|3)?[0-9]\/\d{2,4}$/.test(s):/^(0|1)[0-9]\/(0|1|2|3)[0-9]\/\d{4}$/.test(s)),m=f?"dd/MM/yyyy":"MM/dd/yyyy";if(f){var p=s.split("/").map((function(e){return parseInt(e)})),y=l(p,3);n=y[0],r=y[1],o=y[2]}else if(d){var v=s.split("/").map((function(e){return parseInt(e)})),g=l(v,3);r=g[0],n=g[1],o=g[2]}if(n&&r&&o&&[2,4].includes(o.toString().length)){if(2===o.toString().length){var b=(new Date).getFullYear(),S=100*Math.floor(b/100),O=b-S;o=O<25&&o>49?S-100+o:O>75&&o<50?S+100+o:S+o}t=new Date(o,r-1,n)}var w=m.replace("dd",n&&n.toString().padStart(2,"0")).replace("MM",r&&r.toString().padStart(2,"0")).replace("yyyy",o&&o.toString());return t&&h({date:t,format:m})===w?t:void 0},e.parseTimeString=function(e){var t=l(e&&e.trim().match(/(\d+):(\d+)\s{0,}(am|pm)?/i),4);t[0];var n=t[1],r=t[2],o=t[3],i=void 0!==o;return{hour:parseInt(n)%(i?12:24),meridian:o?o.toLowerCase():void 0,minute:parseInt(r)}},e.preventDefaultBehavior=function(e){return e.preventDefault(),e.stopPropagation(),!1},e.saveBlobAsFile=function(e,t){if(self.navigator&&self.navigator.msSaveBlob)self.navigator.msSaveBlob(e,t);else{var n=document.createElement("a"),r=URL.createObjectURL(e);n.href=r,n.download=t,document.body.appendChild(n),n.click(),n.remove(),URL.revokeObjectURL(r)}},e.setCookie=function(e,t,n){var r=i(i({},p),n),o=r.expiration,a=r.path,u=new Date;u.setTime(u.getTime()+o),document.cookie="".concat(e,"=").concat(t||"",";expires=").concat(u.toUTCString(),";path=").concat(a)},e.setInSafely=function(e,t,n){return t.slice(0,t.length).reduce((function(e,o,i){var a=l(e,2),u=a[0],c=a[1],f=[].concat(s(c),[o]);return i===t.length-1?[u.setIn(f,n),f]:u.getIn(f)?[u,f]:[u.setIn(f,r.Map([])),f]}),[e,[]])[0]},e.smoothScroll=function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.duration,o=void 0===r?500:r,i=n.element,a=void 0===i?document.documentElement:i,u=n.left,c=void 0===u?0:u,l=n.top,s=void 0===l?0:l,f=a===document.documentElement?window:a,d=c-a.scrollLeft,m=s-a.scrollTop,p=function n(r){var i=r-t,a=d*(i/o),u=m*(i/o);e||(e=r),r-e>=o?f.scrollTo(c,s):(f.scrollBy(a,u),t=r,requestAnimationFrame(n))};0===d&&0===m||requestAnimationFrame(p)},e.stripKeys=function e(t,n){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t;return C(t)&&(n.forEach((function(e){delete o[e]})),r&&(o=Object.keys(o).reduce((function(t,r){return i(i({},t),{},u({},r,e(o[r],n)))}),{}))),Array.isArray(t)&&(o=t.map((function(t){return e(t,n,r)}))),o},e.svgComponentToDataURL=function(e){if(!E(e))throw new Error("Only a component that returns SVG markup can be converted to a dataURL");return"url('data:image/svg+xml,".concat(encodeURIComponent(n.renderToStaticMarkup(e)),"')")},e.throttle=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{limit:500},o=r.beforeDelay,i=r.limit,a=void 0===i?500:i;return function(){for(var r=arguments.length,i=new Array(r),u=0;u<r;u++)i[u]=arguments[u];n?(self.clearTimeout(t),j(o)&&o.apply(void 0,i),t=self.setTimeout((function(){Date.now()-n>=a&&(e.apply(void 0,i),n=Date.now())}),a-(Date.now()-n))):(e.apply(void 0,i),n=Date.now())}},e.transparentize=function(e,t){var n="#"===e.charAt(0),r="rgb"===e.substr(0,3);if(!n&&!r||!("number"==typeof t&&t>=0&&t<=1))return x("\n StyleUtils.transparentize only supports colors in hexadecimal or rgb(a) format.\n The desired transparency must be a value between 0 and 1\n "),e;var o,i=t;n?o=(e.length>6?e.substr(1).match(/.{1,2}/g):e.substr(1).match(/./g)).map((function(e){return parseInt("".concat(e).concat(1===e.length?e:""),16)})):o=e.match(/\d+(\.?\d+)?/g).map(parseFloat);if(void 0!==o[3]){var a=r?o[3]:o[3]/255;i=a-a*t}return"rgba(".concat(o.slice(0,3).join(","),",").concat(Math.round(100*i)/100,")")}}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom/server"),require("immutable")):"function"==typeof define&&define.amd?define(["exports","react","react-dom/server","immutable"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WJECOneUtils={},e.React,e.ReactDOMServer,e.Immutable)}(this,(function(e,t,n,r){"use strict";function o(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 i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){u(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(e,t)||f(e,t)||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.")}()}function s(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||f(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){if(e){if("string"==typeof e)return d(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)?d(e,t):void 0}}function d(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}var m=["a[href]","button","details","input",'[tabIndex]:not([tabIndex="-1"])',"textArea","select","summary"].map((function(e){return"".concat(e,":not([disabled])")})),p={expiration:2592e6,path:"/"},y=function(e,t,n){var r=i(i({},p),n),o=r.expiration,a=r.path,u=new Date;u.setTime(u.getTime()+o),document.cookie="".concat(e,"=").concat(t||"",";expires=").concat(u.toUTCString(),";path=").concat(a)},v=["date","format"],g=["January","February","March","April","May","June","July","August","September","October","November","December"],b="dd/MM/yyyy",h="HH:mm",S=function(e){var t=e.date,n=e.format,r=void 0===n?b:n,o=t.getDate(),i=t.getMonth()+1,a=t.getFullYear().toString();return r.replace(/dd/,o.toString().padStart(2,"0")).replace(/d/,o.toString()).replace(/MMM/,g[i-1].substr(0,3)).replace(/MM/,i.toString().padStart(2,"0")).replace(/M/,i.toString()).replace(/yyyy/,a).replace(/yy/,a.substr(2))},O=function(e){var t=e.date,n=e.format,r=void 0===n?h:n,o=e.meridianStrings,i=void 0===o?{am:"am",pm:"pm"}:o,a=/h{1,2}/.test(r),u=a?t.getHours()%12||12:t.getHours();return r.replace(/HH/i,u.toString().padStart(2,"0")).replace(/H/i,u.toString()).replace(/mm/,t.getMinutes().toString().padStart(2,"0")).replace(/SS/,t.getSeconds().toString().padStart(2,"0")).replace(/AM/,a?t.getHours()<12?i.am:i.pm:"")},w=function(e){return new Date(new Date(e).setHours(0,0,0,0))},j=function(e){return"[object Date]"===Object.prototype.toString.call(e)},D=function(e){return"function"==typeof e},A=function(e){return"object"===a(e)&&2===Object.keys(e).length&&Object.hasOwn(e,"key")&&Object.hasOwn(e,"label")},E=function(e){return["boolean","number","string"].includes(a(e))},M=function(e){var t=n.renderToStaticMarkup(e);return/^<svg(.*)<\/svg>$/i.test(t)},T=function(e){var t=e.container,n=void 0===t?document.body:t,r=e.modifyContainer,o=void 0===r?function(){return null}:r,i=e.modifyNode,a=void 0===i?function(){return null}:i,u=e.node,c=document.createElement("div"),l=u.cloneNode(!0);o(c),a(l),c.style.display="inline-block",c.style.position="absolute",c.style.visibility="hidden",c.style.zIndex="-1",c.appendChild(l),n.appendChild(c);var s=c.clientHeight,f=c.clientWidth;return c.parentNode.removeChild(c),{height:s,width:f}},x=function(e){console.error(e)},I=function(e){console.warn(e)},k=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=process.env.NODE_ENV;"development"===n&&t&&x(e)},C=new Uint32Array(2),P=function(e){return"[object Object]"===Object.prototype.toString.call(e)},F=function(e){var t=[];return{addListener:function(n){if(!function(e){return t.find((function(t){return t.listener===e}))}(n)){var r=function(e){return n(e.data)};t.push({listener:n,remove:function(){return e.removeEventListener("message",r)}}),e.addEventListener("message",r)}},removeListener:function(e){var n=t.findIndex((function(t){return t.listener===e})),r=t.splice(n,1)[0];r&&r.remove()}}};e.DAYS=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],e.MONTHS=g,e.assertNever=function(e){throw new Error("Unexpected object: ".concat(e))},e.containsDuplicates=function(e){return new Set(e).size!==e.length},e.createWebWorker=function(e){return e(i(i({},F(self)),{},{postMessage:function(e){return self.postMessage(e,void 0)}})),{path:""}},e.debounce=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];self.clearTimeout(t),t=self.setTimeout((function(){e.apply(void 0,o)}),n)}},e.decrementDate=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.amount,r=void 0===n?1:n,o=t.unit,i=void 0===o?"day":o,a=new Date(e);return"year"===i?a.setFullYear(e.getFullYear()-r):"month"===i?a.setMonth(e.getMonth()-r):a.setDate(e.getDate()-r),a},e.developerError=k,e.developerWarning=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=process.env.NODE_ENV;"development"===n&&t&&I(e)},e.extractContent=function(e,t,n){var r=e;return t&&("function"==typeof t?r=t(e,n):"string"==typeof t&&"object"===a(e)&&Object.hasOwn(e,t)&&(r=e[t])),r},e.extractKey=function(e,t,n){var r=e&&e.toString();if(t)if("function"==typeof t)r=t(e,n);else if("string"==typeof t&&"object"===a(e)&&Object.hasOwn(e,t)){var o=e[t];r="number"==typeof o?o:o.toString()}return r},e.filterValidEntries=function(e){return e.filter((function(e){return e&&null!=e}))},e.findScrollableParent=function(e,t){var n,r=getComputedStyle(e),o=t?/(auto|scroll|hidden)/:/(auto|scroll)/,i="absolute"===r.position;return n="fixed"===r.position||e.parentElement===document.documentElement?document.documentElement:function e(t){var n=getComputedStyle(t);return(!(i=i&&"static"===n.position)||"static"!==n.position)&&o.test(n.overflow+n.overflowY+n.overflowX)||"fixed"===n.position?t:t.parentElement===document.documentElement?document.documentElement:e(t.parentElement)}(e.parentElement),n},e.formatDate=S,e.formatDateTime=function(e){var t=e.date,n=e.format,r=void 0===n?"".concat(b," ").concat(h):n,o=c(e,v),a=O(i(i({},o),{},{date:t,format:r}));return S(i(i({},o),{},{date:t,format:a}))},e.formatTime=O,e.formattedStringToPlainText=function(e){var n=[];return function e(r){var o;o=r,t.isValidElement(o)?t.Children.forEach(r.props.children,e):n.push(null==r?void 0:r.toString())}(e),n.join("")},e.generateId=function(){return crypto.getRandomValues(C).join("-")},e.getCookie=function(e){var t=decodeURIComponent(document.cookie).split(";").map((function(e){return e.trim()})).find((function(t){return 0===t.indexOf(e)}));return t&&t.substring(e.length+1)},e.getDateAtStartOfDay=w,e.getDateAtStartOfMonth=function(e){return w(new Date(new Date(e).setDate(1)))},e.getEnumKeyByValue=function(e,t){return Object.keys(e).find((function(n){return e[n]===t}))},e.getKeyboardFocusableElements=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.documentElement;return Array.from(e.querySelectorAll(m.join(","))).filter((function(e){return!e.hasAttribute("disabled")&&!e.getAttribute("aria-hidden")}))},e.getNumberOfDaysForMonth=function(e){return new Date(e.getFullYear(),e.getMonth()+1,0).getDate()},e.getSelected=function(e,t){return e&&t.includes(e)?e:t.length?t[0]:void 0},e.incrementDate=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.amount,r=void 0===n?1:n,o=t.unit,i=void 0===o?"day":o,a=new Date(e);return"year"===i?a.setFullYear(e.getFullYear()+r):"month"===i?a.setMonth(e.getMonth()+r):a.setDate(e.getDate()+r),a},e.initialiseWebWorker=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new Worker(e),r=F(n);return t.onError&&"function"==typeof t.onError&&(n.onerror=t.onError),i(i({},r),{},{postMessage:function(e){return n.postMessage(e,void 0)},terminate:n.terminate})},e.isArrayEqual=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e.length===t.length&&e.every((function(e,r){return n?t[r]===e:t.includes(e)}))},e.isCallableFunction=D,e.isDate=j,e.isKeyLabelPair=A,e.isKeyLabelPairArray=function(e){return Array.isArray(e)&&e.every(A)},e.isPlainObject=P,e.isPrimitive=E,e.isPrimitiveArray=function(e){return Array.isArray(e)&&e.every(E)},e.isRefObject=function(e){return Object.hasOwn(e,"current")},e.isSvgComponent=M,e.measureDomNode=T,e.measureScrollbarWidth=function(){var e=document.createElement("div"),t=T({node:e}).width;return T({node:e,modifyNode:function(e){return e.style.overflowY="scroll"}}).width-t},e.noop=function(){},e.objectToString=function e(t){var n=t&&Object.keys(t).map((function(n){var r=t[n],o=null!==r&&"object"===a(r)?j(r)?'"'.concat(r.toISOString(),'"'):e(r):null!=r?"string"==typeof r?'"'.concat(r,'"'):r.toString():null===r?"null":"undefined";return Array.isArray(t)?o:"".concat(n,":").concat(o)})).join(",");return n?Array.isArray(t)?"[".concat(n,"]"):"{".concat(n,"}"):""},e.parseDateString=function(e){var t,n,r,o,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=i.format,u=i.shorthand,c=void 0===u||u,s=e&&e.trim(),f="UK"===a||!a&&(c?/^(0|1|2|3)?[0-9]\/(0|1)?[0-9]\/\d{2,4}$/.test(s):/^(0|1|2|3)[0-9]\/(0|1)[0-9]\/\d{4}$/.test(s)),d="US"===a||!a&&(c?/^(0|1)?[0-9]\/(0|1|2|3)?[0-9]\/\d{2,4}$/.test(s):/^(0|1)[0-9]\/(0|1|2|3)[0-9]\/\d{4}$/.test(s)),m=f?"dd/MM/yyyy":"MM/dd/yyyy";if(f){var p=s.split("/").map((function(e){return parseInt(e)})),y=l(p,3);n=y[0],r=y[1],o=y[2]}else if(d){var v=s.split("/").map((function(e){return parseInt(e)})),g=l(v,3);r=g[0],n=g[1],o=g[2]}if(n&&r&&o&&[2,4].includes(o.toString().length)){if(2===o.toString().length){var b=(new Date).getFullYear(),h=100*Math.floor(b/100),O=b-h;o=O<25&&o>49?h-100+o:O>75&&o<50?h+100+o:h+o}t=new Date(o,r-1,n)}var w=m.replace("dd",n&&n.toString().padStart(2,"0")).replace("MM",r&&r.toString().padStart(2,"0")).replace("yyyy",o&&o.toString());return t&&S({date:t,format:m})===w?t:void 0},e.parseTimeString=function(e){var t=l(e&&e.trim().match(/(\d+):(\d+)\s{0,}(am|pm)?/i),4);t[0];var n=t[1],r=t[2],o=t[3],i=void 0!==o;return{hour:parseInt(n)%(i?12:24),meridian:o?o.toLowerCase():void 0,minute:parseInt(r)}},e.preventDefaultBehavior=function(e){return e.preventDefault(),e.stopPropagation(),!1},e.removeCookie=function(e){y(e,void 0,{expiration:-1})},e.saveBlobAsFile=function(e,t){if(self.navigator&&self.navigator.msSaveBlob)self.navigator.msSaveBlob(e,t);else{var n=document.createElement("a"),r=URL.createObjectURL(e);n.href=r,n.download=t,document.body.appendChild(n),n.click(),n.remove(),URL.revokeObjectURL(r)}},e.setCookie=y,e.setInSafely=function(e,t,n){return t.slice(0,t.length).reduce((function(e,o,i){var a=l(e,2),u=a[0],c=a[1],f=[].concat(s(c),[o]);return i===t.length-1?[u.setIn(f,n),f]:u.getIn(f)?[u,f]:[u.setIn(f,r.Map([])),f]}),[e,[]])[0]},e.smoothScroll=function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.duration,o=void 0===r?500:r,i=n.element,a=void 0===i?document.documentElement:i,u=n.left,c=void 0===u?0:u,l=n.top,s=void 0===l?0:l,f=a===document.documentElement?window:a,d=c-a.scrollLeft,m=s-a.scrollTop,p=function n(r){var i=r-t,a=d*(i/o),u=m*(i/o);e||(e=r),r-e>=o?f.scrollTo(c,s):(f.scrollBy(a,u),t=r,requestAnimationFrame(n))};0===d&&0===m||requestAnimationFrame(p)},e.stripKeys=function e(t,n){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t;return P(t)&&(n.forEach((function(e){delete o[e]})),r&&(o=Object.keys(o).reduce((function(t,r){return i(i({},t),{},u({},r,e(o[r],n)))}),{}))),Array.isArray(t)&&(o=t.map((function(t){return e(t,n,r)}))),o},e.svgComponentToDataURL=function(e){if(!M(e))throw new Error("Only a component that returns SVG markup can be converted to a dataURL");return"url('data:image/svg+xml,".concat(encodeURIComponent(n.renderToStaticMarkup(e)),"')")},e.throttle=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{limit:500},o=r.beforeDelay,i=r.limit,a=void 0===i?500:i;return function(){for(var r=arguments.length,i=new Array(r),u=0;u<r;u++)i[u]=arguments[u];n?(self.clearTimeout(t),D(o)&&o.apply(void 0,i),t=self.setTimeout((function(){Date.now()-n>=a&&(e.apply(void 0,i),n=Date.now())}),a-(Date.now()-n))):(e.apply(void 0,i),n=Date.now())}},e.transparentize=function(e,t){var n="#"===e.charAt(0),r="rgb"===e.substr(0,3);if(!n&&!r||!("number"==typeof t&&t>=0&&t<=1))return k("\n StyleUtils.transparentize only supports colors in hexadecimal or rgb(a) format.\n The desired transparency must be a value between 0 and 1\n "),e;var o,i=t;n?o=(e.length>6?e.substr(1).match(/.{1,2}/g):e.substr(1).match(/./g)).map((function(e){return parseInt("".concat(e).concat(1===e.length?e:""),16)})):o=e.match(/\d+(\.?\d+)?/g).map(parseFloat);if(void 0!==o[3]){var a=r?o[3]:o[3]/255;i=a-a*t}return"rgba(".concat(o.slice(0,3).join(","),",").concat(Math.round(100*i)/100,")")}}));
|
package/utils/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ declare type CookieOptions = {
|
|
|
8
8
|
expiration?: number;
|
|
9
9
|
path?: string;
|
|
10
10
|
};
|
|
11
|
+
declare const removeCookie: (name: string) => void;
|
|
11
12
|
declare const setCookie: (name: string, value: string, options?: CookieOptions) => void;
|
|
12
13
|
declare type SmoothScrollOptions = {
|
|
13
14
|
duration?: number;
|
|
@@ -170,4 +171,4 @@ declare const initialiseWebWorker: <T extends WebWorkerFile<any, any>>(workerFil
|
|
|
170
171
|
onError?: Worker['onerror'];
|
|
171
172
|
}) => WebWorker<ExtractWebWorkerProps<T>, ExtractWebWorkerResponse<T>>;
|
|
172
173
|
|
|
173
|
-
export { ContentExtractor, DAYS, ImportExists, KeyExtractor, KeyLabelPair, MONTHS, SVGComponent, Time, WebWorker, WebWorkerFile, assertNever, containsDuplicates, createWebWorker, debounce, decrementDate, developerError, developerWarning, extractContent, extractKey, filterValidEntries, findScrollableParent, formatDate, formatDateTime, formatTime, formattedStringToPlainText, generateId, getCookie, getDateAtStartOfDay, getDateAtStartOfMonth, getEnumKeyByValue, getKeyboardFocusableElements, getNumberOfDaysForMonth, getSelected, incrementDate, initialiseWebWorker, isArrayEqual, isCallableFunction, isDate, isKeyLabelPair, isKeyLabelPairArray, isPlainObject, isPrimitive, isPrimitiveArray, isRefObject, isSvgComponent, measureDomNode, measureScrollbarWidth, noop, objectToString, parseDateString, parseTimeString, preventDefaultBehavior, saveBlobAsFile, setCookie, setInSafely, smoothScroll, stripKeys, svgComponentToDataURL, throttle, transparentize };
|
|
174
|
+
export { ContentExtractor, DAYS, ImportExists, KeyExtractor, KeyLabelPair, MONTHS, SVGComponent, Time, WebWorker, WebWorkerFile, assertNever, containsDuplicates, createWebWorker, debounce, decrementDate, developerError, developerWarning, extractContent, extractKey, filterValidEntries, findScrollableParent, formatDate, formatDateTime, formatTime, formattedStringToPlainText, generateId, getCookie, getDateAtStartOfDay, getDateAtStartOfMonth, getEnumKeyByValue, getKeyboardFocusableElements, getNumberOfDaysForMonth, getSelected, incrementDate, initialiseWebWorker, isArrayEqual, isCallableFunction, isDate, isKeyLabelPair, isKeyLabelPairArray, isPlainObject, isPrimitive, isPrimitiveArray, isRefObject, isSvgComponent, measureDomNode, measureScrollbarWidth, noop, objectToString, parseDateString, parseTimeString, preventDefaultBehavior, removeCookie, saveBlobAsFile, setCookie, setInSafely, smoothScroll, stripKeys, svgComponentToDataURL, throttle, transparentize };
|
package/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"react";import{renderToStaticMarkup as e}from"react-dom/server";import{Map as n}from"immutable";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function o(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){a(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}function c(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(t,e)||f(t,e)||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.")}()}function l(t){return function(t){if(Array.isArray(t))return d(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||f(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){if(t){if("string"==typeof t)return d(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(t,e):void 0}}function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var s=function(t){var e=decodeURIComponent(document.cookie).split(";").map((function(t){return t.trim()})).find((function(e){return 0===e.indexOf(t)}));return e&&e.substring(t.length+1)},m=["a[href]","button","details","input",'[tabIndex]:not([tabIndex="-1"])',"textArea","select","summary"].map((function(t){return"".concat(t,":not([disabled])")})),p=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.documentElement;return Array.from(t.querySelectorAll(m.join(","))).filter((function(t){return!t.hasAttribute("disabled")&&!t.getAttribute("aria-hidden")}))},y={expiration:2592e6,path:"/"},v=function(t,e,n){var r=o(o({},y),n),i=r.expiration,a=r.path,u=new Date;u.setTime(u.getTime()+i),document.cookie="".concat(t,"=").concat(e||"",";expires=").concat(u.toUTCString(),";path=").concat(a)},g=function(){var t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.duration,o=void 0===r?500:r,i=n.element,a=void 0===i?document.documentElement:i,u=n.left,c=void 0===u?0:u,l=n.top,f=void 0===l?0:l,d=a===document.documentElement?window:a,s=c-a.scrollLeft,m=f-a.scrollTop,p=function n(r){var i=r-e,a=s*(i/o),u=m*(i/o);t||(t=r),r-t>=o?d.scrollTo(c,f):(d.scrollBy(a,u),e=r,requestAnimationFrame(n))};0===s&&0===m||requestAnimationFrame(p)},b=["date","format"],h=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],S=["January","February","March","April","May","June","July","August","September","October","November","December"],w=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.amount,r=void 0===n?1:n,o=e.unit,i=void 0===o?"day":o,a=new Date(t);return"year"===i?a.setFullYear(t.getFullYear()-r):"month"===i?a.setMonth(t.getMonth()-r):a.setDate(t.getDate()-r),a},O=function(t){var e=t.date,n=t.format,r=void 0===n?"dd/MM/yyyy":n,o=e.getDate(),i=e.getMonth()+1,a=e.getFullYear().toString();return r.replace(/dd/,o.toString().padStart(2,"0")).replace(/d/,o.toString()).replace(/MMM/,S[i-1].substr(0,3)).replace(/MM/,i.toString().padStart(2,"0")).replace(/M/,i.toString()).replace(/yyyy/,a).replace(/yy/,a.substr(2))},j=function(t){var e=t.date,n=t.format,r=void 0===n?"HH:mm":n,o=t.meridianStrings,i=void 0===o?{am:"am",pm:"pm"}:o,a=/h{1,2}/.test(r),u=a?e.getHours()%12||12:e.getHours();return r.replace(/HH/i,u.toString().padStart(2,"0")).replace(/H/i,u.toString()).replace(/mm/,e.getMinutes().toString().padStart(2,"0")).replace(/SS/,e.getSeconds().toString().padStart(2,"0")).replace(/AM/,a?e.getHours()<12?i.am:i.pm:"")},M=function(t){var e=t.date,n=t.format,r=void 0===n?"".concat("dd/MM/yyyy"," ").concat("HH:mm"):n,i=u(t,b),a=j(o(o({},i),{},{date:e,format:r}));return O(o(o({},i),{},{date:e,format:a}))},A=function(t){return new Date(new Date(t).setHours(0,0,0,0))},E=function(t){return A(new Date(new Date(t).setDate(1)))},D=function(t){return new Date(t.getFullYear(),t.getMonth()+1,0).getDate()},I=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.amount,r=void 0===n?1:n,o=e.unit,i=void 0===o?"day":o,a=new Date(t);return"year"===i?a.setFullYear(t.getFullYear()+r):"month"===i?a.setMonth(t.getMonth()+r):a.setDate(t.getDate()+r),a},x=function(t){return"[object Date]"===Object.prototype.toString.call(t)},k=function(t){var e,n,r,o,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=i.format,u=i.shorthand,l=void 0===u||u,f=t&&t.trim(),d="UK"===a||!a&&(l?/^(0|1|2|3)?[0-9]\/(0|1)?[0-9]\/\d{2,4}$/.test(f):/^(0|1|2|3)[0-9]\/(0|1)[0-9]\/\d{4}$/.test(f)),s="US"===a||!a&&(l?/^(0|1)?[0-9]\/(0|1|2|3)?[0-9]\/\d{2,4}$/.test(f):/^(0|1)[0-9]\/(0|1|2|3)[0-9]\/\d{4}$/.test(f)),m=d?"dd/MM/yyyy":"MM/dd/yyyy";if(d){var p=f.split("/").map((function(t){return parseInt(t)})),y=c(p,3);n=y[0],r=y[1],o=y[2]}else if(s){var v=f.split("/").map((function(t){return parseInt(t)})),g=c(v,3);r=g[0],n=g[1],o=g[2]}if(n&&r&&o&&[2,4].includes(o.toString().length)){if(2===o.toString().length){var b=(new Date).getFullYear(),h=100*Math.floor(b/100),S=b-h;o=S<25&&o>49?h-100+o:S>75&&o<50?h+100+o:h+o}e=new Date(o,r-1,n)}var w=m.replace("dd",n&&n.toString().padStart(2,"0")).replace("MM",r&&r.toString().padStart(2,"0")).replace("yyyy",o&&o.toString());return e&&O({date:e,format:m})===w?e:void 0},T=function(t){var e=c(t&&t.trim().match(/(\d+):(\d+)\s{0,}(am|pm)?/i),4);e[0];var n=e[1],r=e[2],o=e[3],i=void 0!==o;return{hour:parseInt(n)%(i?12:24),meridian:o?o.toLowerCase():void 0,minute:parseInt(r)}},U=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];self.clearTimeout(e),e=self.setTimeout((function(){t.apply(void 0,o)}),n)}},C=function(t,e,n){var r=t&&t.toString();if(e)if("function"==typeof e)r=e(t,n);else if("string"==typeof e&&"object"===i(t)&&Object.hasOwn(t,e)){var o=t[e];r="number"==typeof o?o:o.toString()}return r},F=function(t,e,n){var r=t;return e&&("function"==typeof e?r=e(t,n):"string"==typeof e&&"object"===i(t)&&Object.hasOwn(t,e)&&(r=t[e])),r},H=function(t,e){var n,r=getComputedStyle(t),o=e?/(auto|scroll|hidden)/:/(auto|scroll)/,i="absolute"===r.position;return n="fixed"===r.position||t.parentElement===document.documentElement?document.documentElement:function t(e){var n=getComputedStyle(e);return(!(i=i&&"static"===n.position)||"static"!==n.position)&&o.test(n.overflow+n.overflowY+n.overflowX)||"fixed"===n.position?e:e.parentElement===document.documentElement?document.documentElement:t(e.parentElement)}(t.parentElement),n},P=function(e){var n=[];return function e(r){var o;o=r,t.isValidElement(o)?t.Children.forEach(r.props.children,e):n.push(null==r?void 0:r.toString())}(e),n.join("")},L=function(t,e){return t&&e.includes(t)?t:e.length?e[0]:void 0},N=function(t){return"function"==typeof t},Y=function(t){return"object"===i(t)&&2===Object.keys(t).length&&Object.hasOwn(t,"key")&&Object.hasOwn(t,"label")},R=function(t){return Array.isArray(t)&&t.every(Y)},$=function(t){return["boolean","number","string"].includes(i(t))},V=function(t){return Array.isArray(t)&&t.every($)},q=function(t){var n=e(t);return/^<svg(.*)<\/svg>$/i.test(n)},z=function(t){var e=t.container,n=void 0===e?document.body:e,r=t.modifyContainer,o=void 0===r?function(){return null}:r,i=t.modifyNode,a=void 0===i?function(){return null}:i,u=t.node,c=document.createElement("div"),l=u.cloneNode(!0);o(c),a(l),c.style.display="inline-block",c.style.position="absolute",c.style.visibility="hidden",c.style.zIndex="-1",c.appendChild(l),n.appendChild(c);var f=c.clientHeight,d=c.clientWidth;return c.parentNode.removeChild(c),{height:f,width:d}},B=function(){var t=document.createElement("div"),e=z({node:t}).width;return z({node:t,modifyNode:function(t){return t.style.overflowY="scroll"}}).width-e},J=function t(e){var n=e&&Object.keys(e).map((function(n){var r=e[n],o=null!==r&&"object"===i(r)?x(r)?'"'.concat(r.toISOString(),'"'):t(r):null!=r?"string"==typeof r?'"'.concat(r,'"'):r.toString():null===r?"null":"undefined";return Array.isArray(e)?o:"".concat(n,":").concat(o)})).join(",");return n?Array.isArray(e)?"[".concat(n,"]"):"{".concat(n,"}"):""},W=function(t){return t.preventDefault(),t.stopPropagation(),!1},_=function(t){if(!q(t))throw new Error("Only a component that returns SVG markup can be converted to a dataURL");return"url('data:image/svg+xml,".concat(encodeURIComponent(e(t)),"')")},G=function(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{limit:500},o=r.beforeDelay,i=r.limit,a=void 0===i?500:i;return function(){for(var r=arguments.length,i=new Array(r),u=0;u<r;u++)i[u]=arguments[u];n?(self.clearTimeout(e),N(o)&&o.apply(void 0,i),e=self.setTimeout((function(){Date.now()-n>=a&&(t.apply(void 0,i),n=Date.now())}),a-(Date.now()-n))):(t.apply(void 0,i),n=Date.now())}},K=function(t){console.error(t)},X=function(t){console.warn(t)},Q=function(t){throw new Error("Unexpected object: ".concat(t))},Z=function(t){return new Set(t).size!==t.length},tt=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=process.env.NODE_ENV;"development"===n&&e&&K(t)},et=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=process.env.NODE_ENV;"development"===n&&e&&X(t)},nt=function(t){return t.filter((function(t){return t&&null!=t}))},rt=new Uint32Array(2),ot=function(){return crypto.getRandomValues(rt).join("-")},it=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t.length===e.length&&t.every((function(t,r){return n?e[r]===t:e.includes(t)}))},at=function(){},ut=function(t,e){return Object.keys(t).find((function(n){return t[n]===e}))},ct=function(t){return"[object Object]"===Object.prototype.toString.call(t)},lt=function(t){return Object.hasOwn(t,"current")},ft=function(t,e){if(self.navigator&&self.navigator.msSaveBlob)self.navigator.msSaveBlob(t,e);else{var n=document.createElement("a"),r=URL.createObjectURL(t);n.href=r,n.download=e,document.body.appendChild(n),n.click(),n.remove(),URL.revokeObjectURL(r)}},dt=function t(e,n){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=e;return ct(e)&&(n.forEach((function(t){delete i[t]})),r&&(i=Object.keys(i).reduce((function(e,r){return o(o({},e),{},a({},r,t(i[r],n)))}),{}))),Array.isArray(e)&&(i=e.map((function(e){return t(e,n,r)}))),i},st=function(t,e,r){return e.slice(0,e.length).reduce((function(t,o,i){var a=c(t,2),u=a[0],f=a[1],d=[].concat(l(f),[o]);return i===e.length-1?[u.setIn(d,r),d]:u.getIn(d)?[u,d]:[u.setIn(d,n([])),d]}),[t,[]])[0]},mt=function(t,e){var n="#"===t.charAt(0),r="rgb"===t.substr(0,3);if(!n&&!r||!("number"==typeof e&&e>=0&&e<=1))return tt("\n StyleUtils.transparentize only supports colors in hexadecimal or rgb(a) format.\n The desired transparency must be a value between 0 and 1\n "),t;var o,i=e;n?o=(t.length>6?t.substr(1).match(/.{1,2}/g):t.substr(1).match(/./g)).map((function(t){return parseInt("".concat(t).concat(1===t.length?t:""),16)})):o=t.match(/\d+(\.?\d+)?/g).map(parseFloat);if(void 0!==o[3]){var a=r?o[3]:o[3]/255;i=a-a*e}return"rgba(".concat(o.slice(0,3).join(","),",").concat(Math.round(100*i)/100,")")},pt=function(t){var e=[];return{addListener:function(n){if(!function(t){return e.find((function(e){return e.listener===t}))}(n)){var r=function(t){return n(t.data)};e.push({listener:n,remove:function(){return t.removeEventListener("message",r)}}),t.addEventListener("message",r)}},removeListener:function(t){var n=e.findIndex((function(e){return e.listener===t})),r=e.splice(n,1)[0];r&&r.remove()}}},yt=function(t){return t(o(o({},pt(self)),{},{postMessage:function(t){return self.postMessage(t,void 0)}})),{path:""}},vt=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new Worker(t),r=pt(n);return e.onError&&"function"==typeof e.onError&&(n.onerror=e.onError),o(o({},r),{},{postMessage:function(t){return n.postMessage(t,void 0)},terminate:n.terminate})};export{h as DAYS,S as MONTHS,Q as assertNever,Z as containsDuplicates,yt as createWebWorker,U as debounce,w as decrementDate,tt as developerError,et as developerWarning,F as extractContent,C as extractKey,nt as filterValidEntries,H as findScrollableParent,O as formatDate,M as formatDateTime,j as formatTime,P as formattedStringToPlainText,ot as generateId,s as getCookie,A as getDateAtStartOfDay,E as getDateAtStartOfMonth,ut as getEnumKeyByValue,p as getKeyboardFocusableElements,D as getNumberOfDaysForMonth,L as getSelected,I as incrementDate,vt as initialiseWebWorker,it as isArrayEqual,N as isCallableFunction,x as isDate,Y as isKeyLabelPair,R as isKeyLabelPairArray,ct as isPlainObject,$ as isPrimitive,V as isPrimitiveArray,lt as isRefObject,q as isSvgComponent,z as measureDomNode,B as measureScrollbarWidth,at as noop,J as objectToString,k as parseDateString,T as parseTimeString,W as preventDefaultBehavior,ft as saveBlobAsFile,v as setCookie,st as setInSafely,g as smoothScroll,dt as stripKeys,_ as svgComponentToDataURL,G as throttle,mt as transparentize};
|
|
1
|
+
import t from"react";import{renderToStaticMarkup as e}from"react-dom/server";import{Map as n}from"immutable";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function o(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){a(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}function c(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(t,e)||f(t,e)||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.")}()}function l(t){return function(t){if(Array.isArray(t))return d(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||f(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){if(t){if("string"==typeof t)return d(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(t,e):void 0}}function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var s=function(t){var e=decodeURIComponent(document.cookie).split(";").map((function(t){return t.trim()})).find((function(e){return 0===e.indexOf(t)}));return e&&e.substring(t.length+1)},m=["a[href]","button","details","input",'[tabIndex]:not([tabIndex="-1"])',"textArea","select","summary"].map((function(t){return"".concat(t,":not([disabled])")})),p=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.documentElement;return Array.from(t.querySelectorAll(m.join(","))).filter((function(t){return!t.hasAttribute("disabled")&&!t.getAttribute("aria-hidden")}))},y={expiration:2592e6,path:"/"},v=function(t){g(t,void 0,{expiration:-1})},g=function(t,e,n){var r=o(o({},y),n),i=r.expiration,a=r.path,u=new Date;u.setTime(u.getTime()+i),document.cookie="".concat(t,"=").concat(e||"",";expires=").concat(u.toUTCString(),";path=").concat(a)},b=function(){var t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.duration,o=void 0===r?500:r,i=n.element,a=void 0===i?document.documentElement:i,u=n.left,c=void 0===u?0:u,l=n.top,f=void 0===l?0:l,d=a===document.documentElement?window:a,s=c-a.scrollLeft,m=f-a.scrollTop,p=function n(r){var i=r-e,a=s*(i/o),u=m*(i/o);t||(t=r),r-t>=o?d.scrollTo(c,f):(d.scrollBy(a,u),e=r,requestAnimationFrame(n))};0===s&&0===m||requestAnimationFrame(p)},h=["date","format"],S=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],w=["January","February","March","April","May","June","July","August","September","October","November","December"],O=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.amount,r=void 0===n?1:n,o=e.unit,i=void 0===o?"day":o,a=new Date(t);return"year"===i?a.setFullYear(t.getFullYear()-r):"month"===i?a.setMonth(t.getMonth()-r):a.setDate(t.getDate()-r),a},j=function(t){var e=t.date,n=t.format,r=void 0===n?"dd/MM/yyyy":n,o=e.getDate(),i=e.getMonth()+1,a=e.getFullYear().toString();return r.replace(/dd/,o.toString().padStart(2,"0")).replace(/d/,o.toString()).replace(/MMM/,w[i-1].substr(0,3)).replace(/MM/,i.toString().padStart(2,"0")).replace(/M/,i.toString()).replace(/yyyy/,a).replace(/yy/,a.substr(2))},M=function(t){var e=t.date,n=t.format,r=void 0===n?"HH:mm":n,o=t.meridianStrings,i=void 0===o?{am:"am",pm:"pm"}:o,a=/h{1,2}/.test(r),u=a?e.getHours()%12||12:e.getHours();return r.replace(/HH/i,u.toString().padStart(2,"0")).replace(/H/i,u.toString()).replace(/mm/,e.getMinutes().toString().padStart(2,"0")).replace(/SS/,e.getSeconds().toString().padStart(2,"0")).replace(/AM/,a?e.getHours()<12?i.am:i.pm:"")},A=function(t){var e=t.date,n=t.format,r=void 0===n?"".concat("dd/MM/yyyy"," ").concat("HH:mm"):n,i=u(t,h),a=M(o(o({},i),{},{date:e,format:r}));return j(o(o({},i),{},{date:e,format:a}))},E=function(t){return new Date(new Date(t).setHours(0,0,0,0))},D=function(t){return E(new Date(new Date(t).setDate(1)))},I=function(t){return new Date(t.getFullYear(),t.getMonth()+1,0).getDate()},x=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.amount,r=void 0===n?1:n,o=e.unit,i=void 0===o?"day":o,a=new Date(t);return"year"===i?a.setFullYear(t.getFullYear()+r):"month"===i?a.setMonth(t.getMonth()+r):a.setDate(t.getDate()+r),a},k=function(t){return"[object Date]"===Object.prototype.toString.call(t)},T=function(t){var e,n,r,o,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=i.format,u=i.shorthand,l=void 0===u||u,f=t&&t.trim(),d="UK"===a||!a&&(l?/^(0|1|2|3)?[0-9]\/(0|1)?[0-9]\/\d{2,4}$/.test(f):/^(0|1|2|3)[0-9]\/(0|1)[0-9]\/\d{4}$/.test(f)),s="US"===a||!a&&(l?/^(0|1)?[0-9]\/(0|1|2|3)?[0-9]\/\d{2,4}$/.test(f):/^(0|1)[0-9]\/(0|1|2|3)[0-9]\/\d{4}$/.test(f)),m=d?"dd/MM/yyyy":"MM/dd/yyyy";if(d){var p=f.split("/").map((function(t){return parseInt(t)})),y=c(p,3);n=y[0],r=y[1],o=y[2]}else if(s){var v=f.split("/").map((function(t){return parseInt(t)})),g=c(v,3);r=g[0],n=g[1],o=g[2]}if(n&&r&&o&&[2,4].includes(o.toString().length)){if(2===o.toString().length){var b=(new Date).getFullYear(),h=100*Math.floor(b/100),S=b-h;o=S<25&&o>49?h-100+o:S>75&&o<50?h+100+o:h+o}e=new Date(o,r-1,n)}var w=m.replace("dd",n&&n.toString().padStart(2,"0")).replace("MM",r&&r.toString().padStart(2,"0")).replace("yyyy",o&&o.toString());return e&&j({date:e,format:m})===w?e:void 0},U=function(t){var e=c(t&&t.trim().match(/(\d+):(\d+)\s{0,}(am|pm)?/i),4);e[0];var n=e[1],r=e[2],o=e[3],i=void 0!==o;return{hour:parseInt(n)%(i?12:24),meridian:o?o.toLowerCase():void 0,minute:parseInt(r)}},C=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];self.clearTimeout(e),e=self.setTimeout((function(){t.apply(void 0,o)}),n)}},F=function(t,e,n){var r=t&&t.toString();if(e)if("function"==typeof e)r=e(t,n);else if("string"==typeof e&&"object"===i(t)&&Object.hasOwn(t,e)){var o=t[e];r="number"==typeof o?o:o.toString()}return r},H=function(t,e,n){var r=t;return e&&("function"==typeof e?r=e(t,n):"string"==typeof e&&"object"===i(t)&&Object.hasOwn(t,e)&&(r=t[e])),r},P=function(t,e){var n,r=getComputedStyle(t),o=e?/(auto|scroll|hidden)/:/(auto|scroll)/,i="absolute"===r.position;return n="fixed"===r.position||t.parentElement===document.documentElement?document.documentElement:function t(e){var n=getComputedStyle(e);return(!(i=i&&"static"===n.position)||"static"!==n.position)&&o.test(n.overflow+n.overflowY+n.overflowX)||"fixed"===n.position?e:e.parentElement===document.documentElement?document.documentElement:t(e.parentElement)}(t.parentElement),n},L=function(e){var n=[];return function e(r){var o;o=r,t.isValidElement(o)?t.Children.forEach(r.props.children,e):n.push(null==r?void 0:r.toString())}(e),n.join("")},N=function(t,e){return t&&e.includes(t)?t:e.length?e[0]:void 0},Y=function(t){return"function"==typeof t},R=function(t){return"object"===i(t)&&2===Object.keys(t).length&&Object.hasOwn(t,"key")&&Object.hasOwn(t,"label")},$=function(t){return Array.isArray(t)&&t.every(R)},V=function(t){return["boolean","number","string"].includes(i(t))},q=function(t){return Array.isArray(t)&&t.every(V)},z=function(t){var n=e(t);return/^<svg(.*)<\/svg>$/i.test(n)},B=function(t){var e=t.container,n=void 0===e?document.body:e,r=t.modifyContainer,o=void 0===r?function(){return null}:r,i=t.modifyNode,a=void 0===i?function(){return null}:i,u=t.node,c=document.createElement("div"),l=u.cloneNode(!0);o(c),a(l),c.style.display="inline-block",c.style.position="absolute",c.style.visibility="hidden",c.style.zIndex="-1",c.appendChild(l),n.appendChild(c);var f=c.clientHeight,d=c.clientWidth;return c.parentNode.removeChild(c),{height:f,width:d}},J=function(){var t=document.createElement("div"),e=B({node:t}).width;return B({node:t,modifyNode:function(t){return t.style.overflowY="scroll"}}).width-e},W=function t(e){var n=e&&Object.keys(e).map((function(n){var r=e[n],o=null!==r&&"object"===i(r)?k(r)?'"'.concat(r.toISOString(),'"'):t(r):null!=r?"string"==typeof r?'"'.concat(r,'"'):r.toString():null===r?"null":"undefined";return Array.isArray(e)?o:"".concat(n,":").concat(o)})).join(",");return n?Array.isArray(e)?"[".concat(n,"]"):"{".concat(n,"}"):""},_=function(t){return t.preventDefault(),t.stopPropagation(),!1},G=function(t){if(!z(t))throw new Error("Only a component that returns SVG markup can be converted to a dataURL");return"url('data:image/svg+xml,".concat(encodeURIComponent(e(t)),"')")},K=function(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{limit:500},o=r.beforeDelay,i=r.limit,a=void 0===i?500:i;return function(){for(var r=arguments.length,i=new Array(r),u=0;u<r;u++)i[u]=arguments[u];n?(self.clearTimeout(e),Y(o)&&o.apply(void 0,i),e=self.setTimeout((function(){Date.now()-n>=a&&(t.apply(void 0,i),n=Date.now())}),a-(Date.now()-n))):(t.apply(void 0,i),n=Date.now())}},X=function(t){console.error(t)},Q=function(t){console.warn(t)},Z=function(t){throw new Error("Unexpected object: ".concat(t))},tt=function(t){return new Set(t).size!==t.length},et=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=process.env.NODE_ENV;"development"===n&&e&&X(t)},nt=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=process.env.NODE_ENV;"development"===n&&e&&Q(t)},rt=function(t){return t.filter((function(t){return t&&null!=t}))},ot=new Uint32Array(2),it=function(){return crypto.getRandomValues(ot).join("-")},at=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t.length===e.length&&t.every((function(t,r){return n?e[r]===t:e.includes(t)}))},ut=function(){},ct=function(t,e){return Object.keys(t).find((function(n){return t[n]===e}))},lt=function(t){return"[object Object]"===Object.prototype.toString.call(t)},ft=function(t){return Object.hasOwn(t,"current")},dt=function(t,e){if(self.navigator&&self.navigator.msSaveBlob)self.navigator.msSaveBlob(t,e);else{var n=document.createElement("a"),r=URL.createObjectURL(t);n.href=r,n.download=e,document.body.appendChild(n),n.click(),n.remove(),URL.revokeObjectURL(r)}},st=function t(e,n){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=e;return lt(e)&&(n.forEach((function(t){delete i[t]})),r&&(i=Object.keys(i).reduce((function(e,r){return o(o({},e),{},a({},r,t(i[r],n)))}),{}))),Array.isArray(e)&&(i=e.map((function(e){return t(e,n,r)}))),i},mt=function(t,e,r){return e.slice(0,e.length).reduce((function(t,o,i){var a=c(t,2),u=a[0],f=a[1],d=[].concat(l(f),[o]);return i===e.length-1?[u.setIn(d,r),d]:u.getIn(d)?[u,d]:[u.setIn(d,n([])),d]}),[t,[]])[0]},pt=function(t,e){var n="#"===t.charAt(0),r="rgb"===t.substr(0,3);if(!n&&!r||!("number"==typeof e&&e>=0&&e<=1))return et("\n StyleUtils.transparentize only supports colors in hexadecimal or rgb(a) format.\n The desired transparency must be a value between 0 and 1\n "),t;var o,i=e;n?o=(t.length>6?t.substr(1).match(/.{1,2}/g):t.substr(1).match(/./g)).map((function(t){return parseInt("".concat(t).concat(1===t.length?t:""),16)})):o=t.match(/\d+(\.?\d+)?/g).map(parseFloat);if(void 0!==o[3]){var a=r?o[3]:o[3]/255;i=a-a*e}return"rgba(".concat(o.slice(0,3).join(","),",").concat(Math.round(100*i)/100,")")},yt=function(t){var e=[];return{addListener:function(n){if(!function(t){return e.find((function(e){return e.listener===t}))}(n)){var r=function(t){return n(t.data)};e.push({listener:n,remove:function(){return t.removeEventListener("message",r)}}),t.addEventListener("message",r)}},removeListener:function(t){var n=e.findIndex((function(e){return e.listener===t})),r=e.splice(n,1)[0];r&&r.remove()}}},vt=function(t){return t(o(o({},yt(self)),{},{postMessage:function(t){return self.postMessage(t,void 0)}})),{path:""}},gt=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new Worker(t),r=yt(n);return e.onError&&"function"==typeof e.onError&&(n.onerror=e.onError),o(o({},r),{},{postMessage:function(t){return n.postMessage(t,void 0)},terminate:n.terminate})};export{S as DAYS,w as MONTHS,Z as assertNever,tt as containsDuplicates,vt as createWebWorker,C as debounce,O as decrementDate,et as developerError,nt as developerWarning,H as extractContent,F as extractKey,rt as filterValidEntries,P as findScrollableParent,j as formatDate,A as formatDateTime,M as formatTime,L as formattedStringToPlainText,it as generateId,s as getCookie,E as getDateAtStartOfDay,D as getDateAtStartOfMonth,ct as getEnumKeyByValue,p as getKeyboardFocusableElements,I as getNumberOfDaysForMonth,N as getSelected,x as incrementDate,gt as initialiseWebWorker,at as isArrayEqual,Y as isCallableFunction,k as isDate,R as isKeyLabelPair,$ as isKeyLabelPairArray,lt as isPlainObject,V as isPrimitive,q as isPrimitiveArray,ft as isRefObject,z as isSvgComponent,B as measureDomNode,J as measureScrollbarWidth,ut as noop,W as objectToString,T as parseDateString,U as parseTimeString,_ as preventDefaultBehavior,v as removeCookie,dt as saveBlobAsFile,g as setCookie,mt as setInSafely,b as smoothScroll,st as stripKeys,G as svgComponentToDataURL,K as throttle,pt as transparentize};
|