UNPKG

@aplus-frontend/ui

Version:

2 lines (1 loc) 1.44 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../interface.js");function u(e,t){if(e===!0){if(typeof t=="string")return[{path:t,fileName:t}];if(Array.isArray(t))return t.map(r=>({path:r?.[n.ApDownLoadNeedNameKeyDefault.pathKey]??r,fileName:r?.[n.ApDownLoadNeedNameKeyDefault.nameKey]??r}));if(typeof t=="object")return[{path:t?.[n.ApDownLoadNeedNameKeyDefault.pathKey],fileName:t?.[n.ApDownLoadNeedNameKeyDefault.nameKey]}]}else if(typeof e=="object"){if(typeof t=="string")return[{path:t,fileName:t}];if(Array.isArray(t))return t.map(r=>({path:r?.[e?.pathKey||n.ApDownLoadNeedNameKeyDefault.pathKey]??r,fileName:r?.[e?.nameKey||n.ApDownLoadNeedNameKeyDefault.nameKey]??r}));if(typeof t=="object")return[{path:t?.[e?.pathKey||n.ApDownLoadNeedNameKeyDefault.pathKey],fileName:t?.[e?.nameKey||n.ApDownLoadNeedNameKeyDefault.nameKey]}]}else{if(typeof t=="string")return[{path:t,fileName:t}];if(Array.isArray(t))return t.map(r=>typeof r=="string"?{path:r,fileName:r}:r);if(typeof t=="object")return[t]}return[]}function s(e,t){e.length===4&&(e=`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`);const r=parseInt(e.slice(1,3),16),a=parseInt(e.slice(3,5),16),p=parseInt(e.slice(5,7),16),y=Math.round(t*255).toString(16).padStart(2,"0");return`#${r.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}${p.toString(16).padStart(2,"0")}${y}`}exports.getFileInfo=u;exports.getHexWithOpacity=s;