PromoCursed/node_modules/.cache/babel-loader/e6dc8e9615fa6e2ab4e1ce8ee30957b83b33c5a9439ec1b98d0135637539cfcf.json

1 line
3.4 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import * as React from 'react';\nconst AUTO_INTERVAL = 200;\nconst STEP_BUCKETS = [[30, 0.05], [70, 0.03], [96, 0.01]];\nexport default function usePercent(spinning, percent) {\n const [mockPercent, setMockPercent] = React.useState(0);\n const mockIntervalRef = React.useRef();\n const isAuto = percent === 'auto';\n React.useEffect(() => {\n if (isAuto && spinning) {\n setMockPercent(0);\n mockIntervalRef.current = setInterval(() => {\n setMockPercent(prev => {\n const restPTG = 100 - prev;\n for (let i = 0; i < STEP_BUCKETS.length; i += 1) {\n const [limit, stepPtg] = STEP_BUCKETS[i];\n if (prev <= limit) {\n return prev + restPTG * stepPtg;\n }\n }\n return prev;\n });\n }, AUTO_INTERVAL);\n }\n return () => {\n clearInterval(mockIntervalRef.current);\n };\n }, [isAuto, spinning]);\n return isAuto ? mockPercent : percent;\n}","map":{"version":3,"names":["React","AUTO_INTERVAL","STEP_BUCKETS","usePercent","spinning","percent","mockPercent","setMockPercent","useState","mockIntervalRef","useRef","isAuto","useEffect","current","setInterval","prev","restPTG","i","length","limit","stepPtg","clearInterval"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/spin/usePercent.js"],"sourcesContent":["import * as React from 'react';\nconst AUTO_INTERVAL = 200;\nconst STEP_BUCKETS = [[30, 0.05], [70, 0.03], [96, 0.01]];\nexport default function usePercent(spinning, percent) {\n const [mockPercent, setMockPercent] = React.useState(0);\n const mockIntervalRef = React.useRef();\n const isAuto = percent === 'auto';\n React.useEffect(() => {\n if (isAuto && spinning) {\n setMockPercent(0);\n mockIntervalRef.current = setInterval(() => {\n setMockPercent(prev => {\n const restPTG = 100 - prev;\n for (let i = 0; i < STEP_BUCKETS.length; i += 1) {\n const [limit, stepPtg] = STEP_BUCKETS[i];\n if (prev <= limit) {\n return prev + restPTG * stepPtg;\n }\n }\n return prev;\n });\n }, AUTO_INTERVAL);\n }\n return () => {\n clearInterval(mockIntervalRef.current);\n };\n }, [isAuto, spinning]);\n return isAuto ? mockPercent : percent;\n}"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,MAAMC,aAAa,GAAG,GAAG;AACzB,MAAMC,YAAY,GAAG,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;AACzD,eAAe,SAASC,UAAUA,CAACC,QAAQ,EAAEC,OAAO,EAAE;EACpD,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGP,KAAK,CAACQ,QAAQ,CAAC,CAAC,CAAC;EACvD,MAAMC,eAAe,GAAGT,KAAK,CAACU,MAAM,CAAC,CAAC;EACtC,MAAMC,MAAM,GAAGN,OAAO,KAAK,MAAM;EACjCL,KAAK,CAACY,SAAS,CAAC,MAAM;IACpB,IAAID,MAAM,IAAIP,QAAQ,EAAE;MACtBG,cAAc,CAAC,CAAC,CAAC;MACjBE,eAAe,CAACI,OAAO,GAAGC,WAAW,CAAC,MAAM;QAC1CP,cAAc,CAACQ,IAAI,IAAI;UACrB,MAAMC,OAAO,GAAG,GAAG,GAAGD,IAAI;UAC1B,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGf,YAAY,CAACgB,MAAM,EAAED,CAAC,IAAI,CAAC,EAAE;YAC/C,MAAM,CAACE,KAAK,EAAEC,OAAO,CAAC,GAAGlB,YAAY,CAACe,CAAC,CAAC;YACxC,IAAIF,IAAI,IAAII,KAAK,EAAE;cACjB,OAAOJ,IAAI,GAAGC,OAAO,GAAGI,OAAO;YACjC;UACF;UACA,OAAOL,IAAI;QACb,CAAC,CAAC;MACJ,CAAC,EAAEd,aAAa,CAAC;IACnB;IACA,OAAO,MAAM;MACXoB,aAAa,CAACZ,eAAe,CAACI,OAAO,CAAC;IACxC,CAAC;EACH,CAAC,EAAE,CAACF,MAAM,EAAEP,QAAQ,CAAC,CAAC;EACtB,OAAOO,MAAM,GAAGL,WAAW,GAAGD,OAAO;AACvC","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}