Urara-Blog/node_modules/.pnpm-store/v3/files/12/50770642afffff68e27d0052bf733f472ddfba2bfb67571865c2b5dd50140bb1fef5fd186cd34ed136cea261e1934936b81b20d18e678381450cda81c85403
2022-08-14 01:14:53 +08:00

1 line
No EOL
975 B
Text

import{Encoder as t}from"worktop/buffer";var n=()=>crypto.randomUUID();function r(t){for(var n="",r=t||11,e=a(r);r--;)n+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_"[63&e[r]];return n}var e="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function o(){for(var t,n="",r=16,o=Date.now(),f=e.length,i=a(r);r--;)(t=i[r]/255*f|0)===f&&(t=31),n=e.charAt(t)+n;for(r=10;r--;)o=(o-(t=o%f))/f,n=e.charAt(t)+n;return n}function a(t){return crypto.getRandomValues(new Uint8Array(t))}function f(n){return n?t.encode(n).byteLength:0}async function i(t){let n=t.headers.get("content-type");if(t.body&&n)return~n.indexOf("application/json")?t.json():~n.indexOf("multipart/form-data")||~n.indexOf("application/x-www-form-urlencoded")?t.formData().then(u):~n.indexOf("text/")?t.text():t.arrayBuffer()}function u(t){let n,r,e,o={};for([n,r]of t)o[n]=void 0===(e=o[n])?r:[].concat(e,r);return o}export{i as body,f as byteLength,a as randomize,u as toObject,r as uid,o as ulid,n as uuid};