{"ast":null,"code":"import isVisible from \"rc-util/es/Dom/isVisible\";\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport raf from \"rc-util/es/raf\";\nvar scrollIds = new Map();\n\n/** Trigger when element is visible in view */\nexport function waitElementReady(element, callback) {\n var id;\n function tryOrNextFrame() {\n if (isVisible(element)) {\n callback();\n } else {\n id = raf(function () {\n tryOrNextFrame();\n });\n }\n }\n tryOrNextFrame();\n return function () {\n raf.cancel(id);\n };\n}\n\n/* eslint-disable no-param-reassign */\nexport function scrollTo(element, to, duration) {\n if (scrollIds.get(element)) {\n cancelAnimationFrame(scrollIds.get(element));\n }\n\n // jump to target if duration zero\n if (duration <= 0) {\n scrollIds.set(element, requestAnimationFrame(function () {\n element.scrollTop = to;\n }));\n return;\n }\n var difference = to - element.scrollTop;\n var perTick = difference / duration * 10;\n scrollIds.set(element, requestAnimationFrame(function () {\n element.scrollTop += perTick;\n if (element.scrollTop !== to) {\n scrollTo(element, to, duration - 10);\n }\n }));\n}\n/* eslint-enable */\n\nexport function createKeyDownHandler(event, _ref) {\n var onLeftRight = _ref.onLeftRight,\n onCtrlLeftRight = _ref.onCtrlLeftRight,\n onUpDown = _ref.onUpDown,\n onPageUpDown = _ref.onPageUpDown,\n onEnter = _ref.onEnter;\n var which = event.which,\n ctrlKey = event.ctrlKey,\n metaKey = event.metaKey;\n switch (which) {\n case KeyCode.LEFT:\n if (ctrlKey || metaKey) {\n if (onCtrlLeftRight) {\n onCtrlLeftRight(-1);\n return true;\n }\n } else if (onLeftRight) {\n onLeftRight(-1);\n return true;\n }\n /* istanbul ignore next */\n break;\n case KeyCode.RIGHT:\n if (ctrlKey || metaKey) {\n if (onCtrlLeftRight) {\n onCtrlLeftRight(1);\n return true;\n }\n } else if (onLeftRight) {\n onLeftRight(1);\n return true;\n }\n /* istanbul ignore next */\n break;\n case KeyCode.UP:\n if (onUpDown) {\n onUpDown(-1);\n return true;\n }\n /* istanbul ignore next */\n break;\n case KeyCode.DOWN:\n if (onUpDown) {\n onUpDown(1);\n return true;\n }\n /* istanbul ignore next */\n break;\n case KeyCode.PAGE_UP:\n if (onPageUpDown) {\n onPageUpDown(-1);\n return true;\n }\n /* istanbul ignore next */\n break;\n case KeyCode.PAGE_DOWN:\n if (onPageUpDown) {\n onPageUpDown(1);\n return true;\n }\n /* istanbul ignore next */\n break;\n case KeyCode.ENTER:\n if (onEnter) {\n onEnter();\n return true;\n }\n /* istanbul ignore next */\n break;\n }\n return false;\n}\n\n// ===================== Format =====================\nexport function getDefaultFormat(format, picker, showTime, use12Hours) {\n var mergedFormat = format;\n if (!mergedFormat) {\n switch (picker) {\n case 'time':\n mergedFormat = use12Hours ? 'hh:mm:ss a' : 'HH:mm:ss';\n break;\n case 'week':\n mergedFormat = 'gggg-wo';\n break;\n case 'month':\n mergedFormat = 'YYYY-MM';\n break;\n case 'quarter':\n mergedFormat = 'YYYY-[Q]Q';\n break;\n case 'year':\n mergedFormat = 'YYYY';\n break;\n default:\n mergedFormat = showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD';\n }\n }\n return mergedFormat;\n}\n\n// ====================== Mode ======================\nexport function elementsContains(elements, target) {\n return elements.some(function (ele) {\n return ele && ele.contains(target);\n });\n}\nexport function getRealPlacement(placement, rtl) {\n if (placement !== undefined) {\n return placement;\n }\n return rtl ? 'bottomRight' : 'bottomLeft';\n}\nexport function getoffsetUnit(placement, rtl) {\n var realPlacement = getRealPlacement(placement, rtl);\n var placementRight = realPlacement === null || realPlacement === void 0 ? void 0 : realPlacement.toLowerCase().endsWith('right');\n var offsetUnit = placementRight ? 'insetInlineEnd' : 'insetInlineStart';\n if (rtl) {\n offsetUnit = ['insetInlineStart', 'insetInlineEnd'].find(function (unit) {\n return unit !== offsetUnit;\n });\n }\n return offsetUnit;\n}","map":{"version":3,"names":["isVisible","KeyCode","raf","scrollIds","Map","waitElementReady","element","callback","id","tryOrNextFrame","cancel","scrollTo","to","duration","get","cancelAnimationFrame","set","requestAnimationFrame","scrollTop","difference","perTick","createKeyDownHandler","event","_ref","onLeftRight","onCtrlLeftRight","onUpDown","onPageUpDown","onEnter","which","ctrlKey","metaKey","LEFT","RIGHT","UP","DOWN","PAGE_UP","PAGE_DOWN","ENTER","getDefaultFormat","format","picker","showTime","use12Hours","mergedFormat","elementsContains","elements","target","some","ele","contains","getRealPlacement","placement","rtl","undefined","getoffsetUnit","realPlacement","placementRight","toLowerCase","endsWith","offsetUnit","find","unit"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-picker/es/utils/uiUtil.js"],"sourcesContent":["import isVisible from \"rc-util/es/Dom/isVisible\";\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport raf from \"rc-util/es/raf\";\nvar scrollIds = new Map();\n\n/** Trigger when element is visible in view */\nexport function waitElementReady(element, callback) {\n var id;\n function tryOrNextFrame() {\n if (isVisible(element)) {\n callback();\n } else {\n id = raf(function () {\n tryOrNextFrame();\n });\n }\n }\n tryOrNextFrame();\n return function () {\n raf.cancel(id);\n };\n}\n\n/* eslint-disable no-param-reassign */\nexport function scrollTo(element, to, duration) {\n if (scrollIds.get(element)) {\n cancelAnimationFrame(scrollIds.get(element));\n }\n\n // jump to target if duration zero\n if (duration <= 0) {\n scrollIds.set(element, requestAnimationFrame(function () {\n element.scrollTop = to;\n }));\n return;\n }\n var difference = to - element.scrollTop;\n var perTick = difference / duration * 10;\n scrollIds.set(element, requestAnimationFrame(function () {\n element.scrollTop += perTick;\n if (element.scrollTop !== to) {\n scrollTo(element, to, duration - 10);\n }\n }));\n}\n/* eslint-enable */\n\nexport function createKeyDownHandler(event, _ref) {\n var onLeftRight = _ref.onLeftRight,\n onCtrlLeftRight = _ref.onCtrlLeftRight,\n onUpDown = _ref.onUpDown,\n onPageUpDown = _ref.onPageUpDown,\n onEnter = _ref.onEnter;\n var which = event.which,\n ctrlKey = event.ctrlKey,\n metaKey = event.metaKey;\n switch (which) {\n case KeyCode.LEFT:\n if (ctrlKey || metaKey) {\n if (onCtrlLeftRight) {\n onCtrlLeftRight(-1);\n return true;\n }\n } else if (onLeftRight) {\n onLeftRight(-1);\n return true;\n }\n /* istanbul ignore next */\n break;\n case KeyCode.RIGHT:\n if (ctrlKey || metaKey) {\n if (onCtrlLeftRight) {\n onCtrlLeftRight(1);\n return true;\n }\n } else if (onLeftRight) {\n onLeftRight(1);\n return true;\n }\n /* istanbul ignore next */\n break;\n case KeyCode.UP:\n if (onUpDown) {\n onUpDown(-1);\n return true;\n }\n /* istanbul ignore next */\n break;\n case KeyCode.DOWN:\n if (onUpDown) {\n onUpDown(1);\n return true;\n }\n /* istanbul ignore next */\n break;\n case KeyCode.PAGE_UP:\n if (onPageUpDown) {\n onPageUpDown(-1);\n return true;\n }\n /* istanbul ignore next */\n break;\n case KeyCode.PAGE_DOWN:\n if (onPageUpDown) {\n onPageUpDown(1);\n return true;\n }\n /* istanbul ignore next */\n break;\n case KeyCode.ENTER:\n if (onEnter) {\n onEnter();\n return true;\n }\n /* istanbul ignore next */\n break;\n }\n return false;\n}\n\n// ===================== Format =====================\nexport function getDefaultFormat(format, picker, showTime, use12Hours) {\n var mergedFormat = format;\n if (!mergedFormat) {\n switch (picker) {\n case 'time':\n mergedFormat = use12Hours ? 'hh:mm:ss a' : 'HH:mm:ss';\n break;\n case 'week':\n mergedFormat = 'gggg-wo';\n break;\n case 'month':\n mergedFormat = 'YYYY-MM';\n break;\n case 'quarter':\n mergedFormat = 'YYYY-[Q]Q';\n break;\n case 'year':\n mergedFormat = 'YYYY';\n break;\n default:\n mergedFormat = showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD';\n }\n }\n return mergedFormat;\n}\n\n// ====================== Mode ======================\nexport function elementsContains(elements, target) {\n return elements.some(function (ele) {\n return ele && ele.contains(target);\n });\n}\nexport function getRealPlacement(placement, rtl) {\n if (placement !== undefined) {\n return placement;\n }\n return rtl ? 'bottomRight' : 'bottomLeft';\n}\nexport function getoffsetUnit(placement, rtl) {\n var realPlacement = getRealPlacement(placement, rtl);\n var placementRight = realPlacement === null || realPlacement === void 0 ? void 0 : realPlacement.toLowerCase().endsWith('right');\n var offsetUnit = placementRight ? 'insetInlineEnd' : 'insetInlineStart';\n if (rtl) {\n offsetUnit = ['insetInlineStart', 'insetInlineEnd'].find(function (unit) {\n return unit !== offsetUnit;\n });\n }\n return offsetUnit;\n}"],"mappings":"AAAA,OAAOA,SAAS,MAAM,0BAA0B;AAChD,OAAOC,OAAO,MAAM,oBAAoB;AACxC,OAAOC,GAAG,MAAM,gBAAgB;AAChC,IAAIC,SAAS,GAAG,IAAIC,GAAG,CAAC,CAAC;;AAEzB;AACA,OAAO,SAASC,gBAAgBA,CAACC,OAAO,EAAEC,QAAQ,EAAE;EAClD,IAAIC,EAAE;EACN,SAASC,cAAcA,CAAA,EAAG;IACxB,IAAIT,SAAS,CAACM,OAAO,CAAC,EAAE;MACtBC,QAAQ,CAAC,CAAC;IACZ,CAAC,MAAM;MACLC,EAAE,GAAGN,GAAG,CAAC,YAAY;QACnBO,cAAc,CAAC,CAAC;MAClB,CAAC,CAAC;IACJ;EACF;EACAA,cAAc,CAAC,CAAC;EAChB,OAAO,YAAY;IACjBP,GAAG,CAACQ,MAAM,CAACF,EAAE,CAAC;EAChB,CAAC;AACH;;AAEA;AACA,OAAO,SAASG,QAAQA,CAACL,OAAO,EAAEM,EAAE,EAAEC,QAAQ,EAAE;EAC9C,IAAIV,SAAS,CAACW,GAAG,CAACR,OAAO,CAAC,EAAE;IAC1BS,oBAAoB,CAACZ,SAAS,CAACW,GAAG,CAACR,OAAO,CAAC,CAAC;EAC9C;;EAEA;EACA,IAAIO,QAAQ,IAAI,CAAC,EAAE;IACjBV,SAAS,CAACa,GAAG,CAACV,OAAO,EAAEW,qBAAqB,CAAC,YAAY;MACvDX,OAAO,CAACY,SAAS,GAAGN,EAAE;IACxB,CAAC,CAAC,CAAC;IACH;EACF;EACA,IAAIO,UAAU,GAAGP,EAAE,GAAGN,OAAO,CAACY,SAAS;EACvC,IAA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