define(["require","exports","@faker-js/faker"],(function(k,u,a){"use strict";if(typeof M>"u")var M=window.Vue;const y=20,w=async(e,s,t,l)=>{if(e.delay){e.showLog&&console.log("genMock pause",e.delay);const{sleep:n}=await new Promise((c,d)=>k(["../utils/system.amd"],c,d));let o=n(e.delay);l&&(o=Promise.race([o,new Promise((c,d)=>{l.addEventListener("abort",()=>{d(new DOMException("The operation was aborted from API mocker.","AbortError"))})})])),await o}const r={result:g(e,s,t),errors:void 0,nextOffset:void 0,total:void 0};if(delete r.errors,delete r.nextOffset,delete r.total,Array.isArray(r.result)&&e.total&&t&&t.limit){e.useFilter&&(r.result=r.result.filter(o=>e.useFilter?.(o,t)));const n=t.offset??0;r.result.length>t.limit+n&&(r.nextOffset=t.limit+n,r.total=e.total),r.result=r.result.slice(n,n+t.limit)}return e.showLog&&console.log("genMock complete",r),r},g=(e,s,t)=>{let l=e.seed??0;if(l===-1&&(l=Math.random()),e.result instanceof Function)return a.faker.seed(l),f(e.result,0,s,t);if(Array.isArray(e.result)){const r=e.result[0],n=[],o=e.total??t?.limit??y;for(let c=0;c<o;c++)n.push(i(r,c,l,s,t));return n}return i(e.result,0,l,s,t)},i=(e,s,t,l,r)=>{const n={};for(const o in e){const c=e[o];l&&!l.includes(o)||(a.faker.seed(t+s),n[o]=f(c,s,l,r))}return n},f=(e,s=0,t,l)=>e(s,t,l);u.genMockItem=i,u.genMockResponse=w,u.genMockResult=g,u.genMockValue=f,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})}));
//# sourceMappingURL=index-DLUtoTUg.amd.js.map
