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MAAO,EAAM,KAC/B,MACK,KAAK,OAAQ,EAAM,UACnB,KAAK,KAAM,EAAI,UAEpB,MAAM,EAAO,KAAK,SAAS,GACrB,EAAW,EAAK,QAAQ,EAAM,IAC9B,EAAS,EAAG,QAAQ,EAAM,IAE1B,EAAK,WAAW,EAAU,EAAQ,CAAC,KAElC,SAAe,QAAQ,KAAK,CAC/B,KAAK,EAAI,SACT,KAAK,EAAI,SAGb,GAAI,EACA,MAAM,CAAK","file":"/npm/flop@12.0.1/lib/flop.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/flop@12.0.1/lib/flop.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nconst {rename, mkdir} = require('node:fs/promises');\nconst path = require('node:path');\n\nconst {once} = require('node:events');\n\nconst size = require('trammel');\nconst check = require('checkup');\nconst copymitter = require('copymitter');\nconst remy = require('remy');\nconst tryToCatch = require('try-to-catch');\n\nconst {read} = require('win32');\n\nconst flop = exports;\n\nconst isStr = (a) => typeof a === 'string';\n\nmodule.exports.create = async (path) => {\n    check.type('path', path, 'string');\n    \n    await mkdir(path, {\n        recursive: true,\n    });\n};\n\nmodule.exports.read = async (path, type, options = {}) => {\n    options = isStr(type) ? {} : type;\n    \n    check.type('path', path, 'string');\n    \n    switch(type) {\n    case 'size':\n        return await size(path);\n    \n    case 'size raw':\n        return await size(path, {\n            type: 'raw',\n        });\n    \n    case 'raw':\n        options.type = 'raw';\n        return await read(path, options);\n    \n    default:\n        return await read(path, options);\n    }\n};\n\nmodule.exports.remove = async (path, files) => {\n    check.type('path', path, 'string');\n    \n    const rm = remy(path, files);\n    \n    const [error] = await Promise.race([\n        once(rm, 'error'),\n        once(rm, 'end'),\n    ]);\n    \n    if (error)\n        throw error;\n};\n\nmodule.exports.move = async (from, to) => {\n    check\n        .type('from', from, 'string')\n        .type('to', to, 'string');\n    \n    const [error] = await tryToCatch(rename, from, to);\n    const regexp = /EXDEV|ENOTEMPTY/;\n    \n    if (!error)\n        return;\n    \n    if (!regexp.test(error.code))\n        throw error;\n    \n    await flop.copy(from, to);\n    await flop.remove(from);\n};\n\nmodule.exports.copy = async (from, to) => {\n    check\n        .type('from', from, 'string')\n        .type('to', to, 'string');\n    \n    const name = path.basename(from);\n    const fromPart = from.replace(name, '');\n    const toPart = to.replace(name, '');\n    \n    const cp = copymitter(fromPart, toPart, [name]);\n    \n    const [error] = await Promise.race([\n        once(cp, 'error'),\n        once(cp, 'end'),\n    ]);\n    \n    if (error)\n        throw error;\n};\n"]}