@hostlink/light 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Collection.d.ts +1 -0
- package/dist/light.js +33 -28
- package/dist/light.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/Collection.d.ts
CHANGED
package/dist/light.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var Xt = Object.defineProperty;
|
|
2
2
|
var Yt = (e, t, r) => t in e ? Xt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
-
var
|
|
3
|
+
var w = (e, t, r) => Yt(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
4
|
import { jsonToGraphQLQuery as Dt, VariableType as W } from "json-to-graphql-query";
|
|
5
5
|
import Zt from "axios";
|
|
6
6
|
function Nt(e) {
|
|
@@ -19,11 +19,11 @@ function Bt(e) {
|
|
|
19
19
|
"_"
|
|
20
20
|
).replace(/=/g, "");
|
|
21
21
|
}
|
|
22
|
-
var l = "copy",
|
|
22
|
+
var l = "copy", A = "convert";
|
|
23
23
|
function C(e, t, r) {
|
|
24
24
|
if (t === l)
|
|
25
25
|
return r;
|
|
26
|
-
if (t ===
|
|
26
|
+
if (t === A)
|
|
27
27
|
return e(r);
|
|
28
28
|
if (t instanceof Array)
|
|
29
29
|
return r.map((n) => C(e, t[0], n));
|
|
@@ -73,7 +73,7 @@ function b(e) {
|
|
|
73
73
|
}
|
|
74
74
|
var qt = {
|
|
75
75
|
type: h(l),
|
|
76
|
-
id: h(
|
|
76
|
+
id: h(A),
|
|
77
77
|
transports: b(l)
|
|
78
78
|
}, xt = {
|
|
79
79
|
appid: b(l),
|
|
@@ -87,11 +87,11 @@ var qt = {
|
|
|
87
87
|
publicKey: h({
|
|
88
88
|
rp: h(l),
|
|
89
89
|
user: h({
|
|
90
|
-
id: h(
|
|
90
|
+
id: h(A),
|
|
91
91
|
name: h(l),
|
|
92
92
|
displayName: h(l)
|
|
93
93
|
}),
|
|
94
|
-
challenge: h(
|
|
94
|
+
challenge: h(A),
|
|
95
95
|
pubKeyCredParams: h(l),
|
|
96
96
|
timeout: b(l),
|
|
97
97
|
excludeCredentials: b([qt]),
|
|
@@ -103,11 +103,11 @@ var qt = {
|
|
|
103
103
|
}, tr = {
|
|
104
104
|
type: h(l),
|
|
105
105
|
id: h(l),
|
|
106
|
-
rawId: h(
|
|
106
|
+
rawId: h(A),
|
|
107
107
|
authenticatorAttachment: b(l),
|
|
108
108
|
response: h({
|
|
109
|
-
clientDataJSON: h(
|
|
110
|
-
attestationObject: h(
|
|
109
|
+
clientDataJSON: h(A),
|
|
110
|
+
attestationObject: h(A),
|
|
111
111
|
transports: H(
|
|
112
112
|
l,
|
|
113
113
|
(e) => {
|
|
@@ -123,7 +123,7 @@ var qt = {
|
|
|
123
123
|
}, rr = {
|
|
124
124
|
mediation: b(l),
|
|
125
125
|
publicKey: h({
|
|
126
|
-
challenge: h(
|
|
126
|
+
challenge: h(A),
|
|
127
127
|
timeout: b(l),
|
|
128
128
|
rpId: b(l),
|
|
129
129
|
allowCredentials: b([qt]),
|
|
@@ -134,13 +134,13 @@ var qt = {
|
|
|
134
134
|
}, er = {
|
|
135
135
|
type: h(l),
|
|
136
136
|
id: h(l),
|
|
137
|
-
rawId: h(
|
|
137
|
+
rawId: h(A),
|
|
138
138
|
authenticatorAttachment: b(l),
|
|
139
139
|
response: h({
|
|
140
|
-
clientDataJSON: h(
|
|
141
|
-
authenticatorData: h(
|
|
142
|
-
signature: h(
|
|
143
|
-
userHandle: h(
|
|
140
|
+
clientDataJSON: h(A),
|
|
141
|
+
authenticatorData: h(A),
|
|
142
|
+
signature: h(A),
|
|
143
|
+
userHandle: h(A)
|
|
144
144
|
}),
|
|
145
145
|
clientExtensionResults: H(
|
|
146
146
|
Kt,
|
|
@@ -2164,17 +2164,18 @@ const io = /* @__PURE__ */ wr(no), zt = [
|
|
|
2164
2164
|
];
|
|
2165
2165
|
class S {
|
|
2166
2166
|
constructor(t, r, n) {
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2167
|
+
w(this, "data_path");
|
|
2168
|
+
w(this, "axios");
|
|
2169
|
+
w(this, "filters");
|
|
2170
|
+
w(this, "steps");
|
|
2171
|
+
w(this, "fields");
|
|
2172
|
+
w(this, "already_limit", !1);
|
|
2173
|
+
w(this, "already_offset", !1);
|
|
2174
|
+
w(this, "limit", null);
|
|
2175
|
+
w(this, "offset", null);
|
|
2176
|
+
w(this, "_sort", null);
|
|
2177
|
+
w(this, "_sortDesc", !1);
|
|
2178
|
+
w(this, "meta", {});
|
|
2178
2179
|
this.data_path = t, this.axios = n, this.filters = {}, this.steps = [], this.fields = r;
|
|
2179
2180
|
}
|
|
2180
2181
|
}
|
|
@@ -2191,7 +2192,11 @@ S.prototype.clone = function() {
|
|
|
2191
2192
|
return e.steps = [...this.steps], e;
|
|
2192
2193
|
};
|
|
2193
2194
|
S.prototype.fetchData = async function() {
|
|
2194
|
-
let e = {
|
|
2195
|
+
let e = {
|
|
2196
|
+
meta: {
|
|
2197
|
+
total: !0
|
|
2198
|
+
}
|
|
2199
|
+
};
|
|
2195
2200
|
e.__args = this.buildArgs(), e.data = this.fields, this.already_limit && (e.data.__args = e.data.__args || {}, e.data.__args.limit = this.limit), this.already_offset && (e.data.__args = e.data.__args || {}, e.data.__args.offset = this.offset);
|
|
2196
2201
|
const t = this.data_path.split(".");
|
|
2197
2202
|
let r = {}, n = r, i = t[t.length - 1];
|
|
@@ -2205,7 +2210,7 @@ S.prototype.fetchData = async function() {
|
|
|
2205
2210
|
let o = await O(this.axios, r);
|
|
2206
2211
|
for (const u of t)
|
|
2207
2212
|
o = o[u];
|
|
2208
|
-
return io(o.data);
|
|
2213
|
+
return this.meta = o.meta, io(o.data);
|
|
2209
2214
|
};
|
|
2210
2215
|
S.prototype.processData = async function() {
|
|
2211
2216
|
let e = null;
|
package/dist/light.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(g,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("json-to-graphql-query"),require("axios")):typeof define=="function"&&define.amd?define(["exports","json-to-graphql-query","axios"],w):(g=typeof globalThis<"u"?globalThis:g||self,w(g.light={},g.jsonToGraphqlQuery,g.axios))})(this,function(g,w,C){"use strict";var ao=Object.defineProperty;var uo=(g,w,C)=>w in g?ao(g,w,{enumerable:!0,configurable:!0,writable:!0,value:C}):g[w]=C;var j=(g,w,C)=>uo(g,typeof w!="symbol"?w+"":w,C);function mt(e){const t="==".slice(0,(4-e.length%4)%4),r=e.replace(/-/g,"+").replace(/_/g,"/")+t,n=atob(r),i=new ArrayBuffer(n.length),s=new Uint8Array(i);for(let o=0;o<n.length;o++)s[o]=n.charCodeAt(o);return i}function dt(e){const t=new Uint8Array(e);let r="";for(const s of t)r+=String.fromCharCode(s);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var f="copy",_="convert";function F(e,t,r){if(t===f)return r;if(t===_)return e(r);if(t instanceof Array)return r.map(n=>F(e,t[0],n));if(t instanceof Object){const n={};for(const[i,s]of Object.entries(t)){if(s.derive){const o=s.derive(r);o!==void 0&&(r[i]=o)}if(!(i in r)){if(s.required)throw new Error(`Missing key: ${i}`);continue}if(r[i]==null){n[i]=null;continue}n[i]=F(e,s.schema,r[i])}return n}}function V(e,t){return{required:!0,schema:e,derive:t}}function h(e){return{required:!0,schema:e}}function v(e){return{required:!1,schema:e}}var vt={type:h(f),id:h(_),transports:v(f)},bt={appid:v(f),appidExclude:v(f),credProps:v(f)},gt={appid:v(f),appidExclude:v(f),credProps:v(f)},Yt={publicKey:h({rp:h(f),user:h({id:h(_),name:h(f),displayName:h(f)}),challenge:h(_),pubKeyCredParams:h(f),timeout:v(f),excludeCredentials:v([vt]),authenticatorSelection:v(f),attestation:v(f),extensions:v(bt)}),signal:v(f)},Zt={type:h(f),id:h(f),rawId:h(_),authenticatorAttachment:v(f),response:h({clientDataJSON:h(_),attestationObject:h(_),transports:V(f,e=>{var t;return((t=e.getTransports)==null?void 0:t.call(e))||[]})}),clientExtensionResults:V(gt,e=>e.getClientExtensionResults())},kt={mediation:v(f),publicKey:h({challenge:h(_),timeout:v(f),rpId:v(f),allowCredentials:v([vt]),userVerification:v(f),extensions:v(bt)}),signal:v(f)},tr={type:h(f),id:h(f),rawId:h(_),authenticatorAttachment:v(f),response:h({clientDataJSON:h(_),authenticatorData:h(_),signature:h(_),userHandle:h(_)}),clientExtensionResults:V(gt,e=>e.getClientExtensionResults())};function rr(e){return F(mt,Yt,e)}function er(e){return F(dt,Zt,e)}function nr(e){return F(mt,kt,e)}function ir(e){return F(dt,tr,e)}async function sr(e){const t=await navigator.credentials.create(e);return t.toJSON=()=>er(t),t}async function or(e){const t=await navigator.credentials.get(e);return t.toJSON=()=>ir(t),t}const ar=e=>({login:async t=>{const n=(await O(e,{webAuthnRequestOptions:{__args:{username:t}}})).webAuthnRequestOptions,i=nr({publicKey:n}),s=await or(i);await p(e,"webAuthnAssertion",{username:t,assertion:s.toJSON()})},register:async()=>{const t=await O(e,{webAuthnCreationOptions:!0}),r=rr({publicKey:t.webAuthnCreationOptions}),n=await sr(r);await p(e,"webAuthnRegister",{registration:n.toJSON()})}}),ur=e=>({WebAuthn:ar(e),facebookLogin:t=>p(e,"facebookLogin",{access_token:t}),microsoftLogin:t=>p(e,"microsoftLogin",{access_token:t}),googleLogin:t=>p(e,"googleLogin",{credential:t}),login:(t,r,n="")=>p(e,"login",{username:t,password:r,code:n}),logout:()=>p(e,"logout"),changeExpiredPassword:(t,r,n)=>p(e,"changeExpiredPassword",{username:t,old_password:r,new_password:n}),updatePassword:(t,r)=>p(e,"updatePassword",{old_password:t,new_password:r}),resetPassword:(t,r,n)=>p(e,"resetPassword",{username:t,password:r,code:n}),forgetPassword:(t,r)=>p(e,"forgetPassword",{username:t,email:r}),verifyCode(t,r){return p(e,"forgetPasswordVerifyCode",{username:t,code:r})},granted:async t=>(await O(e,{granted:{__args:{rights:t}}})).granted}),wt=(e,t,r)=>{const n=t,i=e,s=r;let o="list"+t;const u=a=>s[a]?s[a]():null;return{field:u,$fields:s,setDataPath(a){return o=a,o},getDataPath(){return o},gqlFields(a){const c=[];for(const y of a)if(typeof y=="string"){const b=u(y);b&&c.push(b.getGQLField())}else typeof y=="object"&&c.push(y);return c},async update(a,c){return await p(i,"update"+n,{id:a,data:c})},async delete(a){return await p(i,"delete"+n,{id:a})},async add(a){return await p(i,"add"+n,{data:a})},fields(a){let c=[];for(let y of a){const b=u(y);b&&c.push(b)}return c},async get(a,c){return(await O(i,{["list"+n]:{__args:{filters:a},data:{__args:{limit:1},...B(c)}}}))["list"+n].data[0]},async list(a,c){return(await O(i,{["list"+n]:{__args:{filters:a},data:{...B(c)}}}))["list"+n].data}}};function cr(e){e="<~"+e+"~>";var t,r,n,i,s,o=String,u=255;for(e.slice(0,2)==="<~"&&e.slice(-2),e=e.slice(2,-2).replace(/\s/g,"").replace("z","!!!!!"),t="uuuuu".slice(e.length%5||5),e+=t,n=[],i=0,s=e.length;s>i;i+=5)r=52200625*(e.charCodeAt(i)-33)+614125*(e.charCodeAt(i+1)-33)+7225*(e.charCodeAt(i+2)-33)+85*(e.charCodeAt(i+3)-33)+(e.charCodeAt(i+4)-33),n.push(u&r>>24,u&r>>16,u&r>>8,u&r);return function(a,c){for(var y=c;y>0;y--)a.pop()}(n,t.length),o.fromCharCode.apply(o,n)}const q=(e="")=>{const t=e,r=(n="application/octet-stream")=>{const i=new Uint8Array(t.length);for(let u=0;u<t.length;u++)i[u]=t.charCodeAt(u);const s=new Blob([i],{type:n});return URL.createObjectURL(s)};return{getContent:()=>t,getURL:r,download:n=>{const i=document.createElement("a");i.download=n,i.href=r(),document.body.appendChild(i),i.click(),document.body.removeChild(i)},open:n=>{window.open(r(n),"_blank")}}},fr={fromBase85:e=>q(cr(e)),fromBase64:e=>q(atob(e)),fromString:e=>q(e)},L=e=>{let t={};return typeof e=="string"?(t[e]=!0,t):e instanceof Array?(e.forEach(r=>{Object.entries(L(r)).forEach(([n,i])=>{t[n]=i})}),t):(Object.entries(e).forEach(([r,n])=>{if(r=="__args"||r=="__aliasFor"||r=="__variables"||r=="__directives"||r=="__all_on"||r=="__name"){t[r]=n;return}if(typeof n=="boolean"){t[r]=n;return}t[r]=L(n)}),t)},B=e=>L(e),O=async(e,t)=>{let r=w.jsonToGraphQLQuery(B(t));const n=await e.post("",{query:`{ ${r} }`});if(n.data.errors)throw new Error(n.data.errors[0].message);return n.data.data};function lr(e){for(let t=0;t<e.length;t++)if(e[t]instanceof File)return!0;return!1}function hr(e){for(let t in e)if(e[t]instanceof File)return!0;return!1}const p=async(e,t,r=null,n=[])=>{let i={[t]:{}};const s=new FormData;let o=!1;if(r){const c={},y={},b={};let l=0;Object.entries(r).forEach(([m,A])=>{if(A instanceof Array&&lr(A)){o=!0;let P=0;A.forEach(N=>{N instanceof File&&(c[m]=new w.VariableType(m),y[l]=["variables."+m+"."+P],s.append(l.toString(),N),l++)}),b[m]="[Upload!]!"}else A instanceof File?(o=!0,c[m]=new w.VariableType(m),y[l]=["variables."+m],s.append(l.toString(),A),b[m]="Upload!",l++):A instanceof Object&&hr(A)?(o=!0,c[m]={},Object.entries(A).forEach(([P,N])=>{N instanceof File?(c[m][P]=new w.VariableType(P),y[l]=["variables."+P],s.append(l.toString(),N),b[P]="Upload!",l++):c[m][P]=N})):A!==void 0&&(c[m]=A)}),i[t].__args=c,i.__variables=b,o&&s.append("map",JSON.stringify(y))}Object.entries(B(n)).forEach(([c,y])=>{i[t][c]=y}),Object.entries(i[t]).length===0&&(i[t]=!0);let u=null;const a=w.jsonToGraphQLQuery({mutation:i});if(o?(s.append("operations",JSON.stringify({query:a})),u=await e.post("",s)):u=await e.post("",{query:a}),u.data.errors)throw new Error(u.data.errors[0].message);return u.data.data[t]},pr=e=>({uploadTempFile:t=>p(e,"fsUploadTempFile",{file:t},{name:!0,path:!0,size:!0,mime:!0}),folders:{list:async t=>(await O(e,{fsListFolders:{__args:{path:t},name:!0,path:!0}})).fsListFolders,create:t=>p(e,"fsCreateFolder",{path:t}),delete:t=>p(e,"fsDeleteFolder",{path:t}),rename:(t,r)=>p(e,"fsRenameFolder",{path:t,name:r})},files:{list:async t=>(await O(e,{fsListFiles:{__args:{path:t},name:!0,path:!0,size:!0,mime:!0,canPreview:!0,imagePath:!0}})).fsListFiles,read:async t=>{let r=await O(e,{fsFile:{__args:{path:t},base64Content:!0}});return window.atob(r.fsFile.base64Content)},write:(t,r)=>p(e,"fsWriteFile",{path:t,content:r}),delete:t=>p(e,"fsDeleteFile",{path:t}),rename:(t,r)=>p(e,"fsRenameFile",{path:t,name:r}),move:(t,r)=>p(e,"fsMoveFile",{source:t,target:r})}}),yr=e=>({get:async t=>(await e({config:{__args:{name:t}}})).config}),mr=e=>({send:(t,r,n)=>p(e,"sendMail",{email:t,subject:r,message:n})}),dr=e=>({list:async()=>(await O(e,{listUser:{data:{user_id:!0,username:!0,first_name:!0,last_name:!0,status:!0}}})).listUser.data}),vr=()=>{const e={};return{create(t,r){e[t]={};for(const n of Object.entries(r)){const[i,s]=n;e[t][i]=()=>({name:s.name?s.name:i,raw:s,getName:()=>s.name?s.name:i,getGQLField:()=>s.gqlField!==void 0?s.gqlField:s.name||i,getRaw(){return s},getValue(o){return s.field&&typeof s.field=="function"?s.field(o):s.field&&typeof s.field=="string"?o[s.field]:o[this.getName()]},getFormattedValue(o){const u=this.getValue(o);return s.format?s.format(u):u}})}return e[t]},get(t){return e[t]}}},br=e=>({list:async()=>(await O(e,{listRole:{name:!0}})).listRole});function gr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var At={exports:{}},wr=function(){var t=this,r=-1;return{next:function(){return r+=1,{value:t.items[r],done:r>=t.items.length}}}},Ar=function(){return this.items};function H(e){"@babel/helpers - typeof";return H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},H(e)}var d={isArray:function(t){return Array.isArray(t)},isObject:function(t){return H(t)==="object"&&Array.isArray(t)===!1&&t!==null},isFunction:function(t){return typeof t=="function"}},_r=d,Or=_r.isFunction,_t=function(t){return t===void 0?this.sum()/this.items.length:Or(t)?new this.constructor(this.items).sum(t)/this.items.length:new this.constructor(this.items).pluck(t).sum()/this.items.length},Sr=_t,$r=Sr;function Q(e){"@babel/helpers - typeof";return Q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q(e)}var jr=function(t){var r=this,n=[],i=0;if(Array.isArray(this.items))do{var s=this.items.slice(i,i+t),o=new this.constructor(s);n.push(o),i+=t}while(i<this.items.length);else if(Q(this.items)==="object"){var u=Object.keys(this.items),a=function(){var y=u.slice(i,i+t),b=new r.constructor({});y.forEach(function(l){return b.put(l,r.items[l])}),n.push(b),i+=t};do a();while(i<u.length)}else n.push(new this.constructor([this.items]));return new this.constructor(n)};function Er(e){return Cr(e)||Pr(e)||Tr(e)||Ir()}function Ir(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1
|
+
(function(g,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("json-to-graphql-query"),require("axios")):typeof define=="function"&&define.amd?define(["exports","json-to-graphql-query","axios"],w):(g=typeof globalThis<"u"?globalThis:g||self,w(g.light={},g.jsonToGraphqlQuery,g.axios))})(this,function(g,w,C){"use strict";var ao=Object.defineProperty;var uo=(g,w,C)=>w in g?ao(g,w,{enumerable:!0,configurable:!0,writable:!0,value:C}):g[w]=C;var S=(g,w,C)=>uo(g,typeof w!="symbol"?w+"":w,C);function mt(e){const t="==".slice(0,(4-e.length%4)%4),r=e.replace(/-/g,"+").replace(/_/g,"/")+t,n=atob(r),i=new ArrayBuffer(n.length),s=new Uint8Array(i);for(let o=0;o<n.length;o++)s[o]=n.charCodeAt(o);return i}function dt(e){const t=new Uint8Array(e);let r="";for(const s of t)r+=String.fromCharCode(s);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var f="copy",_="convert";function F(e,t,r){if(t===f)return r;if(t===_)return e(r);if(t instanceof Array)return r.map(n=>F(e,t[0],n));if(t instanceof Object){const n={};for(const[i,s]of Object.entries(t)){if(s.derive){const o=s.derive(r);o!==void 0&&(r[i]=o)}if(!(i in r)){if(s.required)throw new Error(`Missing key: ${i}`);continue}if(r[i]==null){n[i]=null;continue}n[i]=F(e,s.schema,r[i])}return n}}function V(e,t){return{required:!0,schema:e,derive:t}}function h(e){return{required:!0,schema:e}}function v(e){return{required:!1,schema:e}}var vt={type:h(f),id:h(_),transports:v(f)},bt={appid:v(f),appidExclude:v(f),credProps:v(f)},gt={appid:v(f),appidExclude:v(f),credProps:v(f)},Yt={publicKey:h({rp:h(f),user:h({id:h(_),name:h(f),displayName:h(f)}),challenge:h(_),pubKeyCredParams:h(f),timeout:v(f),excludeCredentials:v([vt]),authenticatorSelection:v(f),attestation:v(f),extensions:v(bt)}),signal:v(f)},Zt={type:h(f),id:h(f),rawId:h(_),authenticatorAttachment:v(f),response:h({clientDataJSON:h(_),attestationObject:h(_),transports:V(f,e=>{var t;return((t=e.getTransports)==null?void 0:t.call(e))||[]})}),clientExtensionResults:V(gt,e=>e.getClientExtensionResults())},kt={mediation:v(f),publicKey:h({challenge:h(_),timeout:v(f),rpId:v(f),allowCredentials:v([vt]),userVerification:v(f),extensions:v(bt)}),signal:v(f)},tr={type:h(f),id:h(f),rawId:h(_),authenticatorAttachment:v(f),response:h({clientDataJSON:h(_),authenticatorData:h(_),signature:h(_),userHandle:h(_)}),clientExtensionResults:V(gt,e=>e.getClientExtensionResults())};function rr(e){return F(mt,Yt,e)}function er(e){return F(dt,Zt,e)}function nr(e){return F(mt,kt,e)}function ir(e){return F(dt,tr,e)}async function sr(e){const t=await navigator.credentials.create(e);return t.toJSON=()=>er(t),t}async function or(e){const t=await navigator.credentials.get(e);return t.toJSON=()=>ir(t),t}const ar=e=>({login:async t=>{const n=(await O(e,{webAuthnRequestOptions:{__args:{username:t}}})).webAuthnRequestOptions,i=nr({publicKey:n}),s=await or(i);await p(e,"webAuthnAssertion",{username:t,assertion:s.toJSON()})},register:async()=>{const t=await O(e,{webAuthnCreationOptions:!0}),r=rr({publicKey:t.webAuthnCreationOptions}),n=await sr(r);await p(e,"webAuthnRegister",{registration:n.toJSON()})}}),ur=e=>({WebAuthn:ar(e),facebookLogin:t=>p(e,"facebookLogin",{access_token:t}),microsoftLogin:t=>p(e,"microsoftLogin",{access_token:t}),googleLogin:t=>p(e,"googleLogin",{credential:t}),login:(t,r,n="")=>p(e,"login",{username:t,password:r,code:n}),logout:()=>p(e,"logout"),changeExpiredPassword:(t,r,n)=>p(e,"changeExpiredPassword",{username:t,old_password:r,new_password:n}),updatePassword:(t,r)=>p(e,"updatePassword",{old_password:t,new_password:r}),resetPassword:(t,r,n)=>p(e,"resetPassword",{username:t,password:r,code:n}),forgetPassword:(t,r)=>p(e,"forgetPassword",{username:t,email:r}),verifyCode(t,r){return p(e,"forgetPasswordVerifyCode",{username:t,code:r})},granted:async t=>(await O(e,{granted:{__args:{rights:t}}})).granted}),wt=(e,t,r)=>{const n=t,i=e,s=r;let o="list"+t;const u=a=>s[a]?s[a]():null;return{field:u,$fields:s,setDataPath(a){return o=a,o},getDataPath(){return o},gqlFields(a){const c=[];for(const y of a)if(typeof y=="string"){const b=u(y);b&&c.push(b.getGQLField())}else typeof y=="object"&&c.push(y);return c},async update(a,c){return await p(i,"update"+n,{id:a,data:c})},async delete(a){return await p(i,"delete"+n,{id:a})},async add(a){return await p(i,"add"+n,{data:a})},fields(a){let c=[];for(let y of a){const b=u(y);b&&c.push(b)}return c},async get(a,c){return(await O(i,{["list"+n]:{__args:{filters:a},data:{__args:{limit:1},...B(c)}}}))["list"+n].data[0]},async list(a,c){return(await O(i,{["list"+n]:{__args:{filters:a},data:{...B(c)}}}))["list"+n].data}}};function cr(e){e="<~"+e+"~>";var t,r,n,i,s,o=String,u=255;for(e.slice(0,2)==="<~"&&e.slice(-2),e=e.slice(2,-2).replace(/\s/g,"").replace("z","!!!!!"),t="uuuuu".slice(e.length%5||5),e+=t,n=[],i=0,s=e.length;s>i;i+=5)r=52200625*(e.charCodeAt(i)-33)+614125*(e.charCodeAt(i+1)-33)+7225*(e.charCodeAt(i+2)-33)+85*(e.charCodeAt(i+3)-33)+(e.charCodeAt(i+4)-33),n.push(u&r>>24,u&r>>16,u&r>>8,u&r);return function(a,c){for(var y=c;y>0;y--)a.pop()}(n,t.length),o.fromCharCode.apply(o,n)}const q=(e="")=>{const t=e,r=(n="application/octet-stream")=>{const i=new Uint8Array(t.length);for(let u=0;u<t.length;u++)i[u]=t.charCodeAt(u);const s=new Blob([i],{type:n});return URL.createObjectURL(s)};return{getContent:()=>t,getURL:r,download:n=>{const i=document.createElement("a");i.download=n,i.href=r(),document.body.appendChild(i),i.click(),document.body.removeChild(i)},open:n=>{window.open(r(n),"_blank")}}},fr={fromBase85:e=>q(cr(e)),fromBase64:e=>q(atob(e)),fromString:e=>q(e)},L=e=>{let t={};return typeof e=="string"?(t[e]=!0,t):e instanceof Array?(e.forEach(r=>{Object.entries(L(r)).forEach(([n,i])=>{t[n]=i})}),t):(Object.entries(e).forEach(([r,n])=>{if(r=="__args"||r=="__aliasFor"||r=="__variables"||r=="__directives"||r=="__all_on"||r=="__name"){t[r]=n;return}if(typeof n=="boolean"){t[r]=n;return}t[r]=L(n)}),t)},B=e=>L(e),O=async(e,t)=>{let r=w.jsonToGraphQLQuery(B(t));const n=await e.post("",{query:`{ ${r} }`});if(n.data.errors)throw new Error(n.data.errors[0].message);return n.data.data};function lr(e){for(let t=0;t<e.length;t++)if(e[t]instanceof File)return!0;return!1}function hr(e){for(let t in e)if(e[t]instanceof File)return!0;return!1}const p=async(e,t,r=null,n=[])=>{let i={[t]:{}};const s=new FormData;let o=!1;if(r){const c={},y={},b={};let l=0;Object.entries(r).forEach(([m,A])=>{if(A instanceof Array&&lr(A)){o=!0;let P=0;A.forEach(N=>{N instanceof File&&(c[m]=new w.VariableType(m),y[l]=["variables."+m+"."+P],s.append(l.toString(),N),l++)}),b[m]="[Upload!]!"}else A instanceof File?(o=!0,c[m]=new w.VariableType(m),y[l]=["variables."+m],s.append(l.toString(),A),b[m]="Upload!",l++):A instanceof Object&&hr(A)?(o=!0,c[m]={},Object.entries(A).forEach(([P,N])=>{N instanceof File?(c[m][P]=new w.VariableType(P),y[l]=["variables."+P],s.append(l.toString(),N),b[P]="Upload!",l++):c[m][P]=N})):A!==void 0&&(c[m]=A)}),i[t].__args=c,i.__variables=b,o&&s.append("map",JSON.stringify(y))}Object.entries(B(n)).forEach(([c,y])=>{i[t][c]=y}),Object.entries(i[t]).length===0&&(i[t]=!0);let u=null;const a=w.jsonToGraphQLQuery({mutation:i});if(o?(s.append("operations",JSON.stringify({query:a})),u=await e.post("",s)):u=await e.post("",{query:a}),u.data.errors)throw new Error(u.data.errors[0].message);return u.data.data[t]},pr=e=>({uploadTempFile:t=>p(e,"fsUploadTempFile",{file:t},{name:!0,path:!0,size:!0,mime:!0}),folders:{list:async t=>(await O(e,{fsListFolders:{__args:{path:t},name:!0,path:!0}})).fsListFolders,create:t=>p(e,"fsCreateFolder",{path:t}),delete:t=>p(e,"fsDeleteFolder",{path:t}),rename:(t,r)=>p(e,"fsRenameFolder",{path:t,name:r})},files:{list:async t=>(await O(e,{fsListFiles:{__args:{path:t},name:!0,path:!0,size:!0,mime:!0,canPreview:!0,imagePath:!0}})).fsListFiles,read:async t=>{let r=await O(e,{fsFile:{__args:{path:t},base64Content:!0}});return window.atob(r.fsFile.base64Content)},write:(t,r)=>p(e,"fsWriteFile",{path:t,content:r}),delete:t=>p(e,"fsDeleteFile",{path:t}),rename:(t,r)=>p(e,"fsRenameFile",{path:t,name:r}),move:(t,r)=>p(e,"fsMoveFile",{source:t,target:r})}}),yr=e=>({get:async t=>(await e({config:{__args:{name:t}}})).config}),mr=e=>({send:(t,r,n)=>p(e,"sendMail",{email:t,subject:r,message:n})}),dr=e=>({list:async()=>(await O(e,{listUser:{data:{user_id:!0,username:!0,first_name:!0,last_name:!0,status:!0}}})).listUser.data}),vr=()=>{const e={};return{create(t,r){e[t]={};for(const n of Object.entries(r)){const[i,s]=n;e[t][i]=()=>({name:s.name?s.name:i,raw:s,getName:()=>s.name?s.name:i,getGQLField:()=>s.gqlField!==void 0?s.gqlField:s.name||i,getRaw(){return s},getValue(o){return s.field&&typeof s.field=="function"?s.field(o):s.field&&typeof s.field=="string"?o[s.field]:o[this.getName()]},getFormattedValue(o){const u=this.getValue(o);return s.format?s.format(u):u}})}return e[t]},get(t){return e[t]}}},br=e=>({list:async()=>(await O(e,{listRole:{name:!0}})).listRole});function gr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var At={exports:{}},wr=function(){var t=this,r=-1;return{next:function(){return r+=1,{value:t.items[r],done:r>=t.items.length}}}},Ar=function(){return this.items};function H(e){"@babel/helpers - typeof";return H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},H(e)}var d={isArray:function(t){return Array.isArray(t)},isObject:function(t){return H(t)==="object"&&Array.isArray(t)===!1&&t!==null},isFunction:function(t){return typeof t=="function"}},_r=d,Or=_r.isFunction,_t=function(t){return t===void 0?this.sum()/this.items.length:Or(t)?new this.constructor(this.items).sum(t)/this.items.length:new this.constructor(this.items).pluck(t).sum()/this.items.length},Sr=_t,$r=Sr;function Q(e){"@babel/helpers - typeof";return Q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q(e)}var jr=function(t){var r=this,n=[],i=0;if(Array.isArray(this.items))do{var s=this.items.slice(i,i+t),o=new this.constructor(s);n.push(o),i+=t}while(i<this.items.length);else if(Q(this.items)==="object"){var u=Object.keys(this.items),a=function(){var y=u.slice(i,i+t),b=new r.constructor({});y.forEach(function(l){return b.put(l,r.items[l])}),n.push(b),i+=t};do a();while(i<u.length)}else n.push(new this.constructor([this.items]));return new this.constructor(n)};function Er(e){return Cr(e)||Pr(e)||Tr(e)||Ir()}function Ir(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tr(e,t){if(e){if(typeof e=="string")return G(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return G(e,t)}}function Pr(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Cr(e){if(Array.isArray(e))return G(e)}function G(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Fr=function(){var t;return new this.constructor((t=[]).concat.apply(t,Er(this.items)))};function Dr(e,t){return xr(e)||qr(e,t)||Br(e,t)||Nr()}function Nr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Br(e,t){if(e){if(typeof e=="string")return Ot(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ot(e,t)}}function Ot(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function qr(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,s=!1,o,u;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));i=!0);}catch(a){s=!0,u=a}finally{try{!i&&r.return!=null&&r.return()}finally{if(s)throw u}}return n}}function xr(e){if(Array.isArray(e))return e}function x(e){"@babel/helpers - typeof";return x=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},x(e)}var Kr=function(t){var r=this,n=t;n instanceof this.constructor&&(n=t.all());var i={};if(Array.isArray(this.items)&&Array.isArray(n))this.items.forEach(function(u,a){i[u]=n[a]});else if(x(this.items)==="object"&&x(n)==="object")Object.keys(this.items).forEach(function(u,a){i[r.items[u]]=n[Object.keys(n)[a]]});else if(Array.isArray(this.items))i[this.items[0]]=n;else if(typeof this.items=="string"&&Array.isArray(n)){var s=n,o=Dr(s,1);i[this.items]=o[0]}else typeof this.items=="string"&&(i[this.items]=n);return new this.constructor(i)};function Ur(e){return Jr(e)||Rr(e)||Mr(e)||Wr()}function Wr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
4
4
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mr(e,t){if(e){if(typeof e=="string")return z(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return z(e,t)}}function Rr(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Jr(e){if(Array.isArray(e))return z(e)}function z(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var St=function(t){var r;if(Array.isArray(t)){var n;r=[],(n=r).push.apply(n,Ur(t))}else r={},Object.keys(t).forEach(function(i){r[i]=t[i]});return r};function K(e){"@babel/helpers - typeof";return K=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},K(e)}var Vr=St,Lr=function(t){var r=t;t instanceof this.constructor?r=t.all():K(t)==="object"&&(r=[],Object.keys(t).forEach(function(i){r.push(t[i])}));var n=Vr(this.items);return r.forEach(function(i){K(i)==="object"?Object.keys(i).forEach(function(s){return n.push(i[s])}):n.push(i)}),new this.constructor(n)};function $t(e){return zr(e)||Gr(e)||Qr(e)||Hr()}function Hr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
@@ -10,4 +10,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
10
10
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function En(e,t){if(e){if(typeof e=="string")return Ct(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ct(e,t)}}function Ct(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function In(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,s=!1,o,u;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));i=!0);}catch(a){s=!0,u=a}finally{try{!i&&r.return!=null&&r.return()}finally{if(s)throw u}}return n}}function Tn(e){if(Array.isArray(e))return e}var Pn=function(t){var r={};return this.items.forEach(function(n,i){var s=t(n,i),o=$n(s,2),u=o[0],a=o[1];r[u]===void 0?r[u]=[a]:r[u].push(a)}),new this.constructor(r)};function Ft(e,t){return Nn(e)||Dn(e,t)||Fn(e,t)||Cn()}function Cn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
11
11
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fn(e,t){if(e){if(typeof e=="string")return Dt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Dt(e,t)}}function Dt(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Dn(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,s=!1,o,u;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));i=!0);}catch(a){s=!0,u=a}finally{try{!i&&r.return!=null&&r.return()}finally{if(s)throw u}}return n}}function Nn(e){if(Array.isArray(e))return e}var Bn=function(t){var r=this,n={};return Array.isArray(this.items)?this.items.forEach(function(i,s){var o=t(i,s),u=Ft(o,2),a=u[0],c=u[1];n[a]=c}):Object.keys(this.items).forEach(function(i){var s=t(r.items[i],i),o=Ft(s,2),u=o[0],a=o[1];n[u]=a}),new this.constructor(n)};function Nt(e){return Un(e)||Kn(e)||xn(e)||qn()}function qn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
12
12
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xn(e,t){if(e){if(typeof e=="string")return st(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return st(e,t)}}function Kn(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Un(e){if(Array.isArray(e))return st(e)}function st(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Wn=function(t){if(typeof t=="string"){var r=this.items.filter(function(n){return n[t]!==void 0});return Math.max.apply(Math,Nt(r.map(function(n){return n[t]})))}return Math.max.apply(Math,Nt(this.items))},Mn=function(t){var r=this.items.length;return t===void 0?r%2===0?(this.items[r/2-1]+this.items[r/2])/2:this.items[Math.floor(r/2)]:r%2===0?(this.items[r/2-1][t]+this.items[r/2][t])/2:this.items[Math.floor(r/2)][t]},Rn=function(t){var r=t;if(typeof r=="string"&&(r=[r]),Array.isArray(this.items)&&Array.isArray(r))return new this.constructor(this.items.concat(r));var n=JSON.parse(JSON.stringify(this.items));return Object.keys(r).forEach(function(i){n[i]=r[i]}),new this.constructor(n)};function M(e){"@babel/helpers - typeof";return M=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(e)}function Bt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function qt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Bt(Object(r),!0).forEach(function(n){Jn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Jn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Vn=function(t){var r=function n(i,s){var o={},u=Object.keys(qt(qt({},i),s));return u.forEach(function(a){i[a]===void 0&&s[a]!==void 0?o[a]=s[a]:i[a]!==void 0&&s[a]===void 0?o[a]=i[a]:i[a]!==void 0&&s[a]!==void 0&&(i[a]===s[a]?o[a]=i[a]:!Array.isArray(i[a])&&M(i[a])==="object"&&!Array.isArray(s[a])&&M(s[a])==="object"?o[a]=n(i[a],s[a]):o[a]=[].concat(i[a],s[a]))}),o};return t?t.constructor.name==="Collection"?new this.constructor(r(this.items,t.all())):new this.constructor(r(this.items,t)):this};function xt(e){return Gn(e)||Qn(e)||Hn(e)||Ln()}function Ln(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
13
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hn(e,t){if(e){if(typeof e=="string")return ot(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ot(e,t)}}function Qn(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Gn(e){if(Array.isArray(e))return ot(e)}function ot(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var zn=function(t){if(t!==void 0){var r=this.items.filter(function(n){return n[t]!==void 0});return Math.min.apply(Math,xt(r.map(function(n){return n[t]})))}return Math.min.apply(Math,xt(this.items))},Xn=function(t){var r=[],n=1;return this.items.length?(this.items.forEach(function(i){var s=r.filter(function(u){return t!==void 0?u.key===i[t]:u.key===i});if(!s.length)t!==void 0?r.push({key:i[t],count:1}):r.push({key:i,count:1});else{s[0].count+=1;var o=s[0].count;o>n&&(n=o)}}),r.filter(function(i){return i.count===n}).map(function(i){return i.key})):null},Yn=E,Zn=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=Yn(this.items),i=n.slice(r).filter(function(s,o){return o%t===0});return new this.constructor(i)},kn=W,ti=function(){for(var t=this,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];var s=kn(n);if(Array.isArray(this.items)){var o=this.items.filter(function(a){return s.indexOf(a)!==-1});return new this.constructor(o)}var u={};return Object.keys(this.items).forEach(function(a){s.indexOf(a)!==-1&&(u[a]=t.items[a])}),new this.constructor(u)},ri=St,ei=function(t,r){var n=Math.abs(t),i=this.count();if(n<=i)return this;for(var s=n-i,o=ri(this.items),u=Array.isArray(this.items),a=t<0,c=0;c<s;)u?a?o.unshift(r):o.push(r):o[c]!==void 0?s+=1:o[c]=r,c+=1;return new this.constructor(o)},ni=function(t){var r=this,n;return Array.isArray(this.items)?(n=[new this.constructor([]),new this.constructor([])],this.items.forEach(function(i){t(i)===!0?n[0].push(i):n[1].push(i)})):(n=[new this.constructor({}),new this.constructor({})],Object.keys(this.items).forEach(function(i){var s=r.items[i];t(s)===!0?n[0].put(i,s):n[1].put(i,s)})),new this.constructor(n)},ii=function(t){return t(this)},Kt=d,si=Kt.isArray,oi=Kt.isObject,R=I,ai=function(t){var r={};return t.forEach(function(n,i){function s(o,u){oi(o)?Object.keys(o).forEach(function(a){s(o[a],"".concat(u,".").concat(a))}):si(o)&&o.forEach(function(a,c){s(a,"".concat(u,".").concat(c))}),r[u]=o}s(n,i)}),r},ui=function(t,r){if(t.indexOf("*")!==-1){var n=ai(this.items),i=[];if(r!==void 0){var s=new RegExp("0.".concat(r),"g"),o="0.".concat(r).split(".").length;Object.keys(n).forEach(function(l){var m=l.match(s);if(m){var A=m[0];A.split(".").length===o&&i.push(n[A])}})}var u=[],a=new RegExp("0.".concat(t),"g"),c="0.".concat(t).split(".").length;if(Object.keys(n).forEach(function(l){var m=l.match(a);if(m){var A=m[0];A.split(".").length===c&&u.push(n[A])}}),r!==void 0){var y={};return this.items.forEach(function(l,m){y[i[m]||""]=u}),new this.constructor(y)}return new this.constructor([u])}if(r!==void 0){var b={};return this.items.forEach(function(l){R(l,t)!==void 0?b[l[r]||""]=R(l,t):b[l[r]||""]=null}),new this.constructor(b)}return this.map(function(l){return R(l,t)!==void 0?R(l,t):null})},ci=W,Ut=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];ci(n).forEach(function(s){delete t[s]})},Wt=d,fi=Wt.isArray,li=Wt.isObject,Mt=Ut,hi=function(){var t=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;if(this.isEmpty())return null;if(fi(this.items))return r===1?this.items.pop():new this.constructor(this.items.splice(-r));if(li(this.items)){var n=Object.keys(this.items);if(r===1){var i=n[n.length-1],s=this.items[i];return Mt(this.items,i),s}var o=n.slice(-r),u=o.reduce(function(a,c){return a[c]=t.items[c],a},{});return Mt(this.items,o),new this.constructor(u)}return null},pi=function(t,r){return r!==void 0?this.put(r,t):(this.items.unshift(t),this)},yi=d,mi=yi.isFunction,di=function(t,r){var n=this.items[t]||null;return!n&&r!==void 0&&(mi(r)?n=r():n=r),delete this.items[t],n},vi=function(){var t;return(t=this.items).push.apply(t,arguments),this},bi=function(t,r){return this.items[t]=r,this},gi=E,wi=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=gi(this.items),n=new this.constructor(r).shuffle();return t!==parseInt(t,10)?n.first():n.take(t)},Ai=function(t,r){var n=this,i=null;return r!==void 0&&(i=r),Array.isArray(this.items)?this.items.forEach(function(s){i=t(i,s)}):Object.keys(this.items).forEach(function(s){i=t(i,n.items[s],s)}),i},_i=function(t){return new this.constructor(this.items).filter(function(r){return!t(r)})};function Rt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function J(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Rt(Object(r),!0).forEach(function(n){Oi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Oi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Si=function(t){if(!t)return this;if(Array.isArray(t)){var r=this.items.map(function(s,o){return t[o]||s});return new this.constructor(r)}if(t.constructor.name==="Collection"){var n=J(J({},this.items),t.all());return new this.constructor(n)}var i=J(J({},this.items),t);return new this.constructor(i)};function T(e){"@babel/helpers - typeof";return T=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},T(e)}function Jt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function D(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Jt(Object(r),!0).forEach(function(n){$i(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ji=function(t){var r=function n(i,s){var o=D({},i),u=Object.keys(D(D({},i),s));return u.forEach(function(a){!Array.isArray(s[a])&&T(s[a])==="object"?o[a]=n(i[a],s[a]):i[a]===void 0&&s[a]!==void 0?T(i[a])==="object"?o[a]=D({},s[a]):o[a]=s[a]:i[a]!==void 0&&s[a]===void 0?T(i[a])==="object"?o[a]=D({},i[a]):o[a]=i[a]:i[a]!==void 0&&s[a]!==void 0&&(T(s[a])==="object"?o[a]=D({},s[a]):o[a]=s[a])}),o};return t?!Array.isArray(t)&&T(t)!=="object"?new this.constructor(r(this.items,[t])):t.constructor.name==="Collection"?new this.constructor(r(this.items,t.all())):new this.constructor(r(this.items,t)):this},Ei=function(){var t=[].concat(this.items).reverse();return new this.constructor(t)},at=d,Ii=at.isArray,Ti=at.isObject,Pi=at.isFunction,Ci=function(t,r){var n=this,i,s=function(u,a){return Pi(t)?t(n.items[a],a):r?n.items[a]===t:n.items[a]==t};return Ii(this.items)?i=this.items.findIndex(s):Ti(this.items)&&(i=Object.keys(this.items).find(function(o){return s(n.items[o],o)})),i===void 0||i<0?!1:i},Vt=d,Fi=Vt.isArray,Di=Vt.isObject,Ni=Ut,Bi=function(){var t=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;if(this.isEmpty())return null;if(Fi(this.items))return r===1?this.items.shift():new this.constructor(this.items.splice(0,r));if(Di(this.items)){if(r===1){var n=Object.keys(this.items)[0],i=this.items[n];return delete this.items[n],i}var s=Object.keys(this.items),o=s.slice(0,r),u=o.reduce(function(a,c){return a[c]=t.items[c],a},{});return Ni(this.items,o),new this.constructor(u)}return null},qi=E,xi=function(){var t=qi(this.items),r,n,i;for(i=t.length;i;i-=1)r=Math.floor(Math.random()*i),n=t[i-1],t[i-1]=t[r],t[r]=n;return this.items=t,this},Ki=d,Ui=Ki.isObject,Wi=function(t){var r=this;return Ui(this.items)?new this.constructor(Object.keys(this.items).reduce(function(n,i,s){return s+1>t&&(n[i]=r.items[i]),n},{})):new this.constructor(this.items.slice(t))},ut=d,Mi=ut.isArray,Ri=ut.isObject,Ji=ut.isFunction,Vi=function(t){var r=this,n=null,i,s=function(u){return u===t};return Ji(t)&&(s=t),Mi(this.items)&&(i=this.items.filter(function(o){return n!==!0&&(n=s(o)),n})),Ri(this.items)&&(i=Object.keys(this.items).reduce(function(o,u){return n!==!0&&(n=s(r.items[u])),n!==!1&&(o[u]=r.items[u]),o},{})),new this.constructor(i)},ct=d,Li=ct.isArray,Hi=ct.isObject,Qi=ct.isFunction,Gi=function(t){var r=this,n=null,i,s=function(u){return u===t};return Qi(t)&&(s=t),Li(this.items)&&(i=this.items.filter(function(o){return n!==!0&&(n=!s(o)),n})),Hi(this.items)&&(i=Object.keys(this.items).reduce(function(o,u){return n!==!0&&(n=!s(r.items[u])),n!==!1&&(o[u]=r.items[u]),o},{})),new this.constructor(i)},zi=function(t,r){var n=this.items.slice(t);return r!==void 0&&(n=n.slice(0,r)),new this.constructor(n)},Xi=d,Yi=Xi.isFunction,Zi=function(t,r,n){var i;if(Yi(t)?i=this.filter(t):i=this.where(t,r,n),i.isEmpty())throw new Error("Item not found.");if(i.count()>1)throw new Error("Multiple items found.");return i.first()},ki=jt,ts=ki,rs=function(t){var r=[].concat(this.items);return t===void 0?this.every(function(n){return typeof n=="number"})?r.sort(function(n,i){return n-i}):r.sort():r.sort(t),new this.constructor(r)},es=function(){return this.sort().reverse()},ns=I,is=d,ss=is.isFunction,os=function(t){var r=[].concat(this.items),n=function(s){return ss(t)?t(s):ns(s,t)};return r.sort(function(i,s){var o=n(i),u=n(s);return o==null?1:u==null||o<u?-1:o>u?1:0}),new this.constructor(r)},as=function(t){return this.sortBy(t).reverse()},us=function(){var t=this,r={};return Object.keys(this.items).sort().forEach(function(n){r[n]=t.items[n]}),new this.constructor(r)},cs=function(){var t=this,r={};return Object.keys(this.items).sort().reverse().forEach(function(n){r[n]=t.items[n]}),new this.constructor(r)},fs=function(t,r,n){var i=this.slice(t,r);if(this.items=this.diff(i.all()).all(),Array.isArray(n))for(var s=0,o=n.length;s<o;s+=1)this.items.splice(t+s,0,n[s]);return i},ls=function(t){for(var r=Math.round(this.items.length/t),n=JSON.parse(JSON.stringify(this.items)),i=[],s=0;s<t;s+=1)i.push(new this.constructor(n.splice(0,r)));return new this.constructor(i)},hs=E,ps=d,ys=ps.isFunction,ms=function(t){var r=hs(this.items),n=0;if(t===void 0)for(var i=0,s=r.length;i<s;i+=1)n+=parseFloat(r[i]);else if(ys(t))for(var o=0,u=r.length;o<u;o+=1)n+=parseFloat(t(r[o]));else for(var a=0,c=r.length;a<c;a+=1)n+=parseFloat(r[a][t]);return parseFloat(n.toPrecision(12))};function ft(e){"@babel/helpers - typeof";return ft=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ft(e)}var ds=function(t){var r=this;if(!Array.isArray(this.items)&&ft(this.items)==="object"){var n=Object.keys(this.items),i;t<0?i=n.slice(t):i=n.slice(0,t);var s={};return n.forEach(function(o){i.indexOf(o)!==-1&&(s[o]=r.items[o])}),new this.constructor(s)}return t<0?new this.constructor(this.items.slice(t)):new this.constructor(this.items.slice(0,t))},lt=d,vs=lt.isArray,bs=lt.isObject,gs=lt.isFunction,ws=function(t){var r=this,n=null,i,s=function(u){return u===t};return gs(t)&&(s=t),vs(this.items)&&(i=this.items.filter(function(o){return n!==!1&&(n=!s(o)),n})),bs(this.items)&&(i=Object.keys(this.items).reduce(function(o,u){return n!==!1&&(n=!s(r.items[u])),n!==!1&&(o[u]=r.items[u]),o},{})),new this.constructor(i)},ht=d,As=ht.isArray,_s=ht.isObject,Os=ht.isFunction,Ss=function(t){var r=this,n=null,i,s=function(u){return u===t};return Os(t)&&(s=t),As(this.items)&&(i=this.items.filter(function(o){return n!==!1&&(n=s(o)),n})),_s(this.items)&&(i=Object.keys(this.items).reduce(function(o,u){return n!==!1&&(n=s(r.items[u])),n!==!1&&(o[u]=r.items[u]),o},{})),new this.constructor(i)},$s=function(t){return t(this),this},js=function(t,r){for(var n=1;n<=t;n+=1)this.items.push(r(n));return this},Es=function(){var t=this.constructor;function r(i,s){var o=[];i instanceof t?(i.items.forEach(function(u){return r(u,o)}),s.push(o)):Array.isArray(i)?(i.forEach(function(u){return r(u,o)}),s.push(o)):s.push(i)}if(Array.isArray(this.items)){var n=[];return this.items.forEach(function(i){r(i,n)}),n}return this.values().all()};function pt(e){"@babel/helpers - typeof";return pt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pt(e)}var Is=function(){return pt(this.items)==="object"&&!Array.isArray(this.items)?JSON.stringify(this.all()):JSON.stringify(this.toArray())},Ts=function(t){var r=this;if(Array.isArray(this.items))this.items=this.items.map(t);else{var n={};Object.keys(this.items).forEach(function(i){n[i]=t(r.items[i],i)}),this.items=n}return this};function Lt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ht(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Lt(Object(r),!0).forEach(function(n){Ps(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ps(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Cs=function(){var t=this;if(Array.isArray(this.items))return this;var r={};return Object.keys(this.items).forEach(function(n){if(n.indexOf(".")!==-1){var i=r;n.split(".").reduce(function(s,o,u,a){return s[o]||(s[o]={}),u===a.length-1&&(s[o]=t.items[n]),s[o]},i),r=Ht(Ht({},r),i)}else r[n]=t.items[n]}),new this.constructor(r)},Fs=function(t,r,n){t?n(this):r(this)},Qt=function(t,r){if(Array.isArray(this.items)&&this.items.length)return t(this);if(Object.keys(this.items).length)return t(this);if(r!==void 0){if(Array.isArray(this.items)&&!this.items.length)return r(this);if(!Object.keys(this.items).length)return r(this)}return this},Gt=function(t,r){if(Array.isArray(this.items)&&!this.items.length)return t(this);if(!Object.keys(this.items).length)return t(this);if(r!==void 0){if(Array.isArray(this.items)&&this.items.length)return r(this);if(Object.keys(this.items).length)return r(this)}return this},Ds=function(t){var r=this,n=JSON.parse(JSON.stringify(this.items));return Object.keys(t).forEach(function(i){r.items[i]===void 0&&(n[i]=t[i])}),new this.constructor(n)},Ns=d,Bs=Ns.isFunction,qs=function(t){var r;if(t===void 0)r=this.items.filter(function(u,a,c){return c.indexOf(u)===a});else{r=[];for(var n=[],i=0,s=this.items.length;i<s;i+=1){var o=void 0;Bs(t)?o=t(this.items[i]):o=this.items[i][t],n.indexOf(o)===-1&&(r.push(this.items[i]),n.push(o))}}return new this.constructor(r)},xs=function(t){return t instanceof this.constructor?t.all():t},Ks=E,Us=function(){return new this.constructor(Ks(this.items))},Ws=function(t,r,n){return t?r(this,t):n?n(this,t):this},Ms=E,S=I,Rs=function(t,r,n){var i=r,s=n,o=Ms(this.items);if(r===void 0||r===!0)return new this.constructor(o.filter(function(a){return S(a,t)}));if(r===!1)return new this.constructor(o.filter(function(a){return!S(a,t)}));n===void 0&&(s=r,i="===");var u=o.filter(function(a){switch(i){case"==":return S(a,t)===Number(s)||S(a,t)===s.toString();default:case"===":return S(a,t)===s;case"!=":case"<>":return S(a,t)!==Number(s)&&S(a,t)!==s.toString();case"!==":return S(a,t)!==s;case"<":return S(a,t)<s;case"<=":return S(a,t)<=s;case">":return S(a,t)>s;case">=":return S(a,t)>=s}});return new this.constructor(u)},Js=function(t,r){return this.where(t,">=",r[0]).where(t,"<=",r[r.length-1])},Vs=E,Ls=I,Hs=function(t,r){var n=Vs(r),i=this.items.filter(function(s){return n.indexOf(Ls(s,t))!==-1});return new this.constructor(i)},Qs=function(t){return this.filter(function(r){return r instanceof t})},zt=I,Gs=function(t,r){return this.filter(function(n){return zt(n,t)<r[0]||zt(n,t)>r[r.length-1]})},zs=E,Xs=I,Ys=function(t,r){var n=zs(r),i=this.items.filter(function(s){return n.indexOf(Xs(s,t))===-1});return new this.constructor(i)},Zs=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.where(t,"===",null)},ks=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.where(t,"!==",null)};function yt(e){"@babel/helpers - typeof";return yt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yt(e)}var to=function(t){return t instanceof this.constructor?t:yt(t)==="object"?new this.constructor(t):new this.constructor([t])},ro=function(t){var r=this,n=t;n instanceof this.constructor&&(n=n.all());var i=this.items.map(function(s,o){return new r.constructor([s,n[o]])});return new this.constructor(i)};(function(e){function t(s){"@babel/helpers - typeof";return t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},t(s)}function r(s){s!==void 0&&!Array.isArray(s)&&t(s)!=="object"?this.items=[s]:s instanceof this.constructor?this.items=s.all():this.items=s||[]}var n=wr;typeof Symbol<"u"&&(r.prototype[Symbol.iterator]=n),r.prototype.toJSON=function(){return this.items},r.prototype.all=Ar,r.prototype.average=_t,r.prototype.avg=$r,r.prototype.chunk=jr,r.prototype.collapse=Fr,r.prototype.combine=Kr,r.prototype.concat=Lr,r.prototype.contains=jt,r.prototype.containsOneItem=ie,r.prototype.count=se,r.prototype.countBy=oe,r.prototype.crossJoin=ae,r.prototype.dd=ue,r.prototype.diff=ce,r.prototype.diffAssoc=fe,r.prototype.diffKeys=le,r.prototype.diffUsing=he,r.prototype.doesntContain=pe,r.prototype.dump=ye,r.prototype.duplicates=me,r.prototype.each=de,r.prototype.eachSpread=_e,r.prototype.every=Se,r.prototype.except=je,r.prototype.filter=Te,r.prototype.first=Ce,r.prototype.firstOrFail=Ne,r.prototype.firstWhere=Be,r.prototype.flatMap=qe,r.prototype.flatten=xe,r.prototype.flip=Ke,r.prototype.forPage=Ue,r.prototype.forget=We,r.prototype.get=Je,r.prototype.groupBy=He,r.prototype.has=Ge,r.prototype.implode=ze,r.prototype.intersect=Xe,r.prototype.intersectByKeys=Ye,r.prototype.isEmpty=Ze,r.prototype.isNotEmpty=ke,r.prototype.join=tn,r.prototype.keyBy=sn,r.prototype.keys=on,r.prototype.last=un,r.prototype.macro=cn,r.prototype.make=fn,r.prototype.map=ln,r.prototype.mapSpread=vn,r.prototype.mapToDictionary=On,r.prototype.mapInto=Sn,r.prototype.mapToGroups=Pn,r.prototype.mapWithKeys=Bn,r.prototype.max=Wn,r.prototype.median=Mn,r.prototype.merge=Rn,r.prototype.mergeRecursive=Vn,r.prototype.min=zn,r.prototype.mode=Xn,r.prototype.nth=Zn,r.prototype.only=ti,r.prototype.pad=ei,r.prototype.partition=ni,r.prototype.pipe=ii,r.prototype.pluck=ui,r.prototype.pop=hi,r.prototype.prepend=pi,r.prototype.pull=di,r.prototype.push=vi,r.prototype.put=bi,r.prototype.random=wi,r.prototype.reduce=Ai,r.prototype.reject=_i,r.prototype.replace=Si,r.prototype.replaceRecursive=ji,r.prototype.reverse=Ei,r.prototype.search=Ci,r.prototype.shift=Bi,r.prototype.shuffle=xi,r.prototype.skip=Wi,r.prototype.skipUntil=Vi,r.prototype.skipWhile=Gi,r.prototype.slice=zi,r.prototype.sole=Zi,r.prototype.some=ts,r.prototype.sort=rs,r.prototype.sortDesc=es,r.prototype.sortBy=os,r.prototype.sortByDesc=as,r.prototype.sortKeys=us,r.prototype.sortKeysDesc=cs,r.prototype.splice=fs,r.prototype.split=ls,r.prototype.sum=ms,r.prototype.take=ds,r.prototype.takeUntil=ws,r.prototype.takeWhile=Ss,r.prototype.tap=$s,r.prototype.times=js,r.prototype.toArray=Es,r.prototype.toJson=Is,r.prototype.transform=Ts,r.prototype.undot=Cs,r.prototype.unless=Fs,r.prototype.unlessEmpty=Qt,r.prototype.unlessNotEmpty=Gt,r.prototype.union=Ds,r.prototype.unique=qs,r.prototype.unwrap=xs,r.prototype.values=Us,r.prototype.when=Ws,r.prototype.whenEmpty=Gt,r.prototype.whenNotEmpty=Qt,r.prototype.where=Rs,r.prototype.whereBetween=Js,r.prototype.whereIn=Hs,r.prototype.whereInstanceOf=Qs,r.prototype.whereNotBetween=Gs,r.prototype.whereNotIn=Ys,r.prototype.whereNull=Zs,r.prototype.whereNotNull=ks,r.prototype.wrap=to,r.prototype.zip=ro;var i=function(o){return new r(o)};e.exports=i,e.exports.collect=i,e.exports.default=i,e.exports.Collection=r})(At);var eo=At.exports;const no=gr(eo),Xt=["chunk","shuffle","splice","sortBy","map","reverse","groupBy","implode","keyBy","keys","mapToDictionary","mapWithKeys","nth","skipUntil","skipWhile","takeUntil","takeWhile","unique"],io=["forPage","sortByDesc","sortBy","skip","take","splice","whereBetween","whereIn","whereNotBetween","whereNotIn","first"],so=["avg","count","countBy","dd","each","every","filter","firstWhere","isEmpty","isNotEmpty","last","mapToGroups","max","median","min","mode","contains","sole","sort","split","sum","toJson"];class ${constructor(t,r,n){j(this,"data_path");j(this,"axios");j(this,"filters");j(this,"steps");j(this,"fields");j(this,"already_limit",!1);j(this,"already_offset",!1);j(this,"limit",null);j(this,"offset",null);j(this,"_sort",null);j(this,"_sortDesc",!1);this.data_path=t,this.axios=n,this.filters={},this.steps=[],this.fields=r}}$.prototype.dataPath=function(e){const t=this.clone();return t.data_path=e,t},$.prototype.buildArgs=function(){let e={};return Object.keys(this.filters).length>0&&(e.filters=this.filters),this._sort&&(e.sort=this._sort,this._sortDesc&&(e.sort+=":desc")),e},$.prototype.clone=function(){const e=Object.create(this);return e.steps=[...this.steps],e},$.prototype.fetchData=async function(){let e={};e.__args=this.buildArgs(),e.data=this.fields,this.already_limit&&(e.data.__args=e.data.__args||{},e.data.__args.limit=this.limit),this.already_offset&&(e.data.__args=e.data.__args||{},e.data.__args.offset=this.offset);const t=this.data_path.split(".");let r={},n=r,i=t[t.length-1];for(const u of t){if(u===i){n[u]=e;break}n[u]={},n=n[u]}let o=await O(this.axios,r);for(const u of t)o=o[u];return no(o.data)},$.prototype.processData=async function(){let e=null;for(const t of this.steps){if(Xt.includes(t.type)){e||(e=await this.fetchData()),e=e[t.type](...t.args);continue}t.type==="forPage"&&(e?e=e.forPage(t.args[0],t.args[1]):this.already_limit||this.already_offset?(e=await this.fetchData(),e=e.forPage(t.args[0],t.args[1])):(this.offset=(t.args[0]-1)*t.args[1],this.limit=t.args[1]),this.already_limit=!0,this.already_offset=!0),t.type==="where"&&(e?e=e.where(t.field,t.operator,t.value):t.operator==="=="&&(this.filters[t.field]=t.value)),t.type==="whereIn"&&(e?e=e.whereIn(...t.args):this.filters[t.args[0]]={in:t.args[1]}),t.type==="whereNotBetween"&&(e?e=e.whereNotBetween(...t.args):this.filters[t.args[0]]={notBetween:t.args[1]}),t.type==="whereNotIn"&&(e?e=e.whereNotIn(...t.args):this.filters[t.args[0]]={notIn:t.args[1]}),t.type=="whereBetween"&&(e?e=e.whereBetween(...t.args):this.filters[t.args[0]]={between:t.args[1]}),t.type==="sortByDesc"&&(e?e=e.sortByDesc(t.args[0]):this.already_limit||this.already_offset?(e=await this.fetchData(),e=e.sortByDesc(t.args[0])):(this._sort=t.args[0],this._sortDesc=!0)),t.type==="sortBy"&&(e?e=e.sortBy(t.args[0]):this.already_limit||this.already_offset?(e=await this.fetchData(),e=e.sortBy(t.args[0])):this._sort=t.args[0]),t.type==="skip"&&(e?e=e.skip(t.args[0]):this.already_offset||this.already_limit?(e=await this.fetchData(),e=e.skip(t.args[0])):this.offset=t.args[0],this.already_offset=!0),t.type==="take"&&(e?e=e.take(...t.args):this.already_offset||this.already_limit?(e=await this.fetchData(),e=e.take(t.args[0])):this.limit=t.args[0],this.already_limit=!0),t.type==="splice"&&(e?e=e.splice(...t.args):(this.offset=t.args[0],this.limit=t.args[1]),this.already_limit=!0,this.already_offset=!0)}return e||(e=await this.fetchData()),e},$.prototype.all=async function(){return(await this.processData()).all()};for(const e of[...Xt,...io])$.prototype[e]=function(...t){const r=this.clone();return r.steps.push({type:e,args:t}),r};for(const e of so)$.prototype[e]=async function(...t){return(await this.clone().processData())[e](...t)};$.prototype.average=$.prototype.avg,$.prototype.first=async function(){return this.take(1),(await this.processData()).first()};const oo=e=>{const t=C.create({baseURL:e,withCredentials:!0}),r=(s,o=null,u=[])=>p(t,s,o,u),n=s=>O(t,s),i=vr();return{baseURL:e,axios:t,auth:ur(t),mutation:r,query:n,config:yr(n),mail:mr(t),users:dr(t),fs:pr(t),models:i,model(s){return wt(t,s,i.get(s))},roles:br(t),collect:(s,o)=>{const u=wt(t,s,i.get(s)).getDataPath();return new $(u,o,t)}}};g.File=fr,g.createClient=oo,g.file=q,g.mutation=p,g.query=O,g.toQuery=B,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
|
13
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hn(e,t){if(e){if(typeof e=="string")return ot(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ot(e,t)}}function Qn(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Gn(e){if(Array.isArray(e))return ot(e)}function ot(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var zn=function(t){if(t!==void 0){var r=this.items.filter(function(n){return n[t]!==void 0});return Math.min.apply(Math,xt(r.map(function(n){return n[t]})))}return Math.min.apply(Math,xt(this.items))},Xn=function(t){var r=[],n=1;return this.items.length?(this.items.forEach(function(i){var s=r.filter(function(u){return t!==void 0?u.key===i[t]:u.key===i});if(!s.length)t!==void 0?r.push({key:i[t],count:1}):r.push({key:i,count:1});else{s[0].count+=1;var o=s[0].count;o>n&&(n=o)}}),r.filter(function(i){return i.count===n}).map(function(i){return i.key})):null},Yn=E,Zn=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=Yn(this.items),i=n.slice(r).filter(function(s,o){return o%t===0});return new this.constructor(i)},kn=W,ti=function(){for(var t=this,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];var s=kn(n);if(Array.isArray(this.items)){var o=this.items.filter(function(a){return s.indexOf(a)!==-1});return new this.constructor(o)}var u={};return Object.keys(this.items).forEach(function(a){s.indexOf(a)!==-1&&(u[a]=t.items[a])}),new this.constructor(u)},ri=St,ei=function(t,r){var n=Math.abs(t),i=this.count();if(n<=i)return this;for(var s=n-i,o=ri(this.items),u=Array.isArray(this.items),a=t<0,c=0;c<s;)u?a?o.unshift(r):o.push(r):o[c]!==void 0?s+=1:o[c]=r,c+=1;return new this.constructor(o)},ni=function(t){var r=this,n;return Array.isArray(this.items)?(n=[new this.constructor([]),new this.constructor([])],this.items.forEach(function(i){t(i)===!0?n[0].push(i):n[1].push(i)})):(n=[new this.constructor({}),new this.constructor({})],Object.keys(this.items).forEach(function(i){var s=r.items[i];t(s)===!0?n[0].put(i,s):n[1].put(i,s)})),new this.constructor(n)},ii=function(t){return t(this)},Kt=d,si=Kt.isArray,oi=Kt.isObject,R=I,ai=function(t){var r={};return t.forEach(function(n,i){function s(o,u){oi(o)?Object.keys(o).forEach(function(a){s(o[a],"".concat(u,".").concat(a))}):si(o)&&o.forEach(function(a,c){s(a,"".concat(u,".").concat(c))}),r[u]=o}s(n,i)}),r},ui=function(t,r){if(t.indexOf("*")!==-1){var n=ai(this.items),i=[];if(r!==void 0){var s=new RegExp("0.".concat(r),"g"),o="0.".concat(r).split(".").length;Object.keys(n).forEach(function(l){var m=l.match(s);if(m){var A=m[0];A.split(".").length===o&&i.push(n[A])}})}var u=[],a=new RegExp("0.".concat(t),"g"),c="0.".concat(t).split(".").length;if(Object.keys(n).forEach(function(l){var m=l.match(a);if(m){var A=m[0];A.split(".").length===c&&u.push(n[A])}}),r!==void 0){var y={};return this.items.forEach(function(l,m){y[i[m]||""]=u}),new this.constructor(y)}return new this.constructor([u])}if(r!==void 0){var b={};return this.items.forEach(function(l){R(l,t)!==void 0?b[l[r]||""]=R(l,t):b[l[r]||""]=null}),new this.constructor(b)}return this.map(function(l){return R(l,t)!==void 0?R(l,t):null})},ci=W,Ut=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];ci(n).forEach(function(s){delete t[s]})},Wt=d,fi=Wt.isArray,li=Wt.isObject,Mt=Ut,hi=function(){var t=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;if(this.isEmpty())return null;if(fi(this.items))return r===1?this.items.pop():new this.constructor(this.items.splice(-r));if(li(this.items)){var n=Object.keys(this.items);if(r===1){var i=n[n.length-1],s=this.items[i];return Mt(this.items,i),s}var o=n.slice(-r),u=o.reduce(function(a,c){return a[c]=t.items[c],a},{});return Mt(this.items,o),new this.constructor(u)}return null},pi=function(t,r){return r!==void 0?this.put(r,t):(this.items.unshift(t),this)},yi=d,mi=yi.isFunction,di=function(t,r){var n=this.items[t]||null;return!n&&r!==void 0&&(mi(r)?n=r():n=r),delete this.items[t],n},vi=function(){var t;return(t=this.items).push.apply(t,arguments),this},bi=function(t,r){return this.items[t]=r,this},gi=E,wi=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=gi(this.items),n=new this.constructor(r).shuffle();return t!==parseInt(t,10)?n.first():n.take(t)},Ai=function(t,r){var n=this,i=null;return r!==void 0&&(i=r),Array.isArray(this.items)?this.items.forEach(function(s){i=t(i,s)}):Object.keys(this.items).forEach(function(s){i=t(i,n.items[s],s)}),i},_i=function(t){return new this.constructor(this.items).filter(function(r){return!t(r)})};function Rt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function J(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Rt(Object(r),!0).forEach(function(n){Oi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Oi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Si=function(t){if(!t)return this;if(Array.isArray(t)){var r=this.items.map(function(s,o){return t[o]||s});return new this.constructor(r)}if(t.constructor.name==="Collection"){var n=J(J({},this.items),t.all());return new this.constructor(n)}var i=J(J({},this.items),t);return new this.constructor(i)};function T(e){"@babel/helpers - typeof";return T=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},T(e)}function Jt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function D(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Jt(Object(r),!0).forEach(function(n){$i(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ji=function(t){var r=function n(i,s){var o=D({},i),u=Object.keys(D(D({},i),s));return u.forEach(function(a){!Array.isArray(s[a])&&T(s[a])==="object"?o[a]=n(i[a],s[a]):i[a]===void 0&&s[a]!==void 0?T(i[a])==="object"?o[a]=D({},s[a]):o[a]=s[a]:i[a]!==void 0&&s[a]===void 0?T(i[a])==="object"?o[a]=D({},i[a]):o[a]=i[a]:i[a]!==void 0&&s[a]!==void 0&&(T(s[a])==="object"?o[a]=D({},s[a]):o[a]=s[a])}),o};return t?!Array.isArray(t)&&T(t)!=="object"?new this.constructor(r(this.items,[t])):t.constructor.name==="Collection"?new this.constructor(r(this.items,t.all())):new this.constructor(r(this.items,t)):this},Ei=function(){var t=[].concat(this.items).reverse();return new this.constructor(t)},at=d,Ii=at.isArray,Ti=at.isObject,Pi=at.isFunction,Ci=function(t,r){var n=this,i,s=function(u,a){return Pi(t)?t(n.items[a],a):r?n.items[a]===t:n.items[a]==t};return Ii(this.items)?i=this.items.findIndex(s):Ti(this.items)&&(i=Object.keys(this.items).find(function(o){return s(n.items[o],o)})),i===void 0||i<0?!1:i},Vt=d,Fi=Vt.isArray,Di=Vt.isObject,Ni=Ut,Bi=function(){var t=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;if(this.isEmpty())return null;if(Fi(this.items))return r===1?this.items.shift():new this.constructor(this.items.splice(0,r));if(Di(this.items)){if(r===1){var n=Object.keys(this.items)[0],i=this.items[n];return delete this.items[n],i}var s=Object.keys(this.items),o=s.slice(0,r),u=o.reduce(function(a,c){return a[c]=t.items[c],a},{});return Ni(this.items,o),new this.constructor(u)}return null},qi=E,xi=function(){var t=qi(this.items),r,n,i;for(i=t.length;i;i-=1)r=Math.floor(Math.random()*i),n=t[i-1],t[i-1]=t[r],t[r]=n;return this.items=t,this},Ki=d,Ui=Ki.isObject,Wi=function(t){var r=this;return Ui(this.items)?new this.constructor(Object.keys(this.items).reduce(function(n,i,s){return s+1>t&&(n[i]=r.items[i]),n},{})):new this.constructor(this.items.slice(t))},ut=d,Mi=ut.isArray,Ri=ut.isObject,Ji=ut.isFunction,Vi=function(t){var r=this,n=null,i,s=function(u){return u===t};return Ji(t)&&(s=t),Mi(this.items)&&(i=this.items.filter(function(o){return n!==!0&&(n=s(o)),n})),Ri(this.items)&&(i=Object.keys(this.items).reduce(function(o,u){return n!==!0&&(n=s(r.items[u])),n!==!1&&(o[u]=r.items[u]),o},{})),new this.constructor(i)},ct=d,Li=ct.isArray,Hi=ct.isObject,Qi=ct.isFunction,Gi=function(t){var r=this,n=null,i,s=function(u){return u===t};return Qi(t)&&(s=t),Li(this.items)&&(i=this.items.filter(function(o){return n!==!0&&(n=!s(o)),n})),Hi(this.items)&&(i=Object.keys(this.items).reduce(function(o,u){return n!==!0&&(n=!s(r.items[u])),n!==!1&&(o[u]=r.items[u]),o},{})),new this.constructor(i)},zi=function(t,r){var n=this.items.slice(t);return r!==void 0&&(n=n.slice(0,r)),new this.constructor(n)},Xi=d,Yi=Xi.isFunction,Zi=function(t,r,n){var i;if(Yi(t)?i=this.filter(t):i=this.where(t,r,n),i.isEmpty())throw new Error("Item not found.");if(i.count()>1)throw new Error("Multiple items found.");return i.first()},ki=jt,ts=ki,rs=function(t){var r=[].concat(this.items);return t===void 0?this.every(function(n){return typeof n=="number"})?r.sort(function(n,i){return n-i}):r.sort():r.sort(t),new this.constructor(r)},es=function(){return this.sort().reverse()},ns=I,is=d,ss=is.isFunction,os=function(t){var r=[].concat(this.items),n=function(s){return ss(t)?t(s):ns(s,t)};return r.sort(function(i,s){var o=n(i),u=n(s);return o==null?1:u==null||o<u?-1:o>u?1:0}),new this.constructor(r)},as=function(t){return this.sortBy(t).reverse()},us=function(){var t=this,r={};return Object.keys(this.items).sort().forEach(function(n){r[n]=t.items[n]}),new this.constructor(r)},cs=function(){var t=this,r={};return Object.keys(this.items).sort().reverse().forEach(function(n){r[n]=t.items[n]}),new this.constructor(r)},fs=function(t,r,n){var i=this.slice(t,r);if(this.items=this.diff(i.all()).all(),Array.isArray(n))for(var s=0,o=n.length;s<o;s+=1)this.items.splice(t+s,0,n[s]);return i},ls=function(t){for(var r=Math.round(this.items.length/t),n=JSON.parse(JSON.stringify(this.items)),i=[],s=0;s<t;s+=1)i.push(new this.constructor(n.splice(0,r)));return new this.constructor(i)},hs=E,ps=d,ys=ps.isFunction,ms=function(t){var r=hs(this.items),n=0;if(t===void 0)for(var i=0,s=r.length;i<s;i+=1)n+=parseFloat(r[i]);else if(ys(t))for(var o=0,u=r.length;o<u;o+=1)n+=parseFloat(t(r[o]));else for(var a=0,c=r.length;a<c;a+=1)n+=parseFloat(r[a][t]);return parseFloat(n.toPrecision(12))};function ft(e){"@babel/helpers - typeof";return ft=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ft(e)}var ds=function(t){var r=this;if(!Array.isArray(this.items)&&ft(this.items)==="object"){var n=Object.keys(this.items),i;t<0?i=n.slice(t):i=n.slice(0,t);var s={};return n.forEach(function(o){i.indexOf(o)!==-1&&(s[o]=r.items[o])}),new this.constructor(s)}return t<0?new this.constructor(this.items.slice(t)):new this.constructor(this.items.slice(0,t))},lt=d,vs=lt.isArray,bs=lt.isObject,gs=lt.isFunction,ws=function(t){var r=this,n=null,i,s=function(u){return u===t};return gs(t)&&(s=t),vs(this.items)&&(i=this.items.filter(function(o){return n!==!1&&(n=!s(o)),n})),bs(this.items)&&(i=Object.keys(this.items).reduce(function(o,u){return n!==!1&&(n=!s(r.items[u])),n!==!1&&(o[u]=r.items[u]),o},{})),new this.constructor(i)},ht=d,As=ht.isArray,_s=ht.isObject,Os=ht.isFunction,Ss=function(t){var r=this,n=null,i,s=function(u){return u===t};return Os(t)&&(s=t),As(this.items)&&(i=this.items.filter(function(o){return n!==!1&&(n=s(o)),n})),_s(this.items)&&(i=Object.keys(this.items).reduce(function(o,u){return n!==!1&&(n=s(r.items[u])),n!==!1&&(o[u]=r.items[u]),o},{})),new this.constructor(i)},$s=function(t){return t(this),this},js=function(t,r){for(var n=1;n<=t;n+=1)this.items.push(r(n));return this},Es=function(){var t=this.constructor;function r(i,s){var o=[];i instanceof t?(i.items.forEach(function(u){return r(u,o)}),s.push(o)):Array.isArray(i)?(i.forEach(function(u){return r(u,o)}),s.push(o)):s.push(i)}if(Array.isArray(this.items)){var n=[];return this.items.forEach(function(i){r(i,n)}),n}return this.values().all()};function pt(e){"@babel/helpers - typeof";return pt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pt(e)}var Is=function(){return pt(this.items)==="object"&&!Array.isArray(this.items)?JSON.stringify(this.all()):JSON.stringify(this.toArray())},Ts=function(t){var r=this;if(Array.isArray(this.items))this.items=this.items.map(t);else{var n={};Object.keys(this.items).forEach(function(i){n[i]=t(r.items[i],i)}),this.items=n}return this};function Lt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ht(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Lt(Object(r),!0).forEach(function(n){Ps(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ps(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Cs=function(){var t=this;if(Array.isArray(this.items))return this;var r={};return Object.keys(this.items).forEach(function(n){if(n.indexOf(".")!==-1){var i=r;n.split(".").reduce(function(s,o,u,a){return s[o]||(s[o]={}),u===a.length-1&&(s[o]=t.items[n]),s[o]},i),r=Ht(Ht({},r),i)}else r[n]=t.items[n]}),new this.constructor(r)},Fs=function(t,r,n){t?n(this):r(this)},Qt=function(t,r){if(Array.isArray(this.items)&&this.items.length)return t(this);if(Object.keys(this.items).length)return t(this);if(r!==void 0){if(Array.isArray(this.items)&&!this.items.length)return r(this);if(!Object.keys(this.items).length)return r(this)}return this},Gt=function(t,r){if(Array.isArray(this.items)&&!this.items.length)return t(this);if(!Object.keys(this.items).length)return t(this);if(r!==void 0){if(Array.isArray(this.items)&&this.items.length)return r(this);if(Object.keys(this.items).length)return r(this)}return this},Ds=function(t){var r=this,n=JSON.parse(JSON.stringify(this.items));return Object.keys(t).forEach(function(i){r.items[i]===void 0&&(n[i]=t[i])}),new this.constructor(n)},Ns=d,Bs=Ns.isFunction,qs=function(t){var r;if(t===void 0)r=this.items.filter(function(u,a,c){return c.indexOf(u)===a});else{r=[];for(var n=[],i=0,s=this.items.length;i<s;i+=1){var o=void 0;Bs(t)?o=t(this.items[i]):o=this.items[i][t],n.indexOf(o)===-1&&(r.push(this.items[i]),n.push(o))}}return new this.constructor(r)},xs=function(t){return t instanceof this.constructor?t.all():t},Ks=E,Us=function(){return new this.constructor(Ks(this.items))},Ws=function(t,r,n){return t?r(this,t):n?n(this,t):this},Ms=E,$=I,Rs=function(t,r,n){var i=r,s=n,o=Ms(this.items);if(r===void 0||r===!0)return new this.constructor(o.filter(function(a){return $(a,t)}));if(r===!1)return new this.constructor(o.filter(function(a){return!$(a,t)}));n===void 0&&(s=r,i="===");var u=o.filter(function(a){switch(i){case"==":return $(a,t)===Number(s)||$(a,t)===s.toString();default:case"===":return $(a,t)===s;case"!=":case"<>":return $(a,t)!==Number(s)&&$(a,t)!==s.toString();case"!==":return $(a,t)!==s;case"<":return $(a,t)<s;case"<=":return $(a,t)<=s;case">":return $(a,t)>s;case">=":return $(a,t)>=s}});return new this.constructor(u)},Js=function(t,r){return this.where(t,">=",r[0]).where(t,"<=",r[r.length-1])},Vs=E,Ls=I,Hs=function(t,r){var n=Vs(r),i=this.items.filter(function(s){return n.indexOf(Ls(s,t))!==-1});return new this.constructor(i)},Qs=function(t){return this.filter(function(r){return r instanceof t})},zt=I,Gs=function(t,r){return this.filter(function(n){return zt(n,t)<r[0]||zt(n,t)>r[r.length-1]})},zs=E,Xs=I,Ys=function(t,r){var n=zs(r),i=this.items.filter(function(s){return n.indexOf(Xs(s,t))===-1});return new this.constructor(i)},Zs=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.where(t,"===",null)},ks=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.where(t,"!==",null)};function yt(e){"@babel/helpers - typeof";return yt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yt(e)}var to=function(t){return t instanceof this.constructor?t:yt(t)==="object"?new this.constructor(t):new this.constructor([t])},ro=function(t){var r=this,n=t;n instanceof this.constructor&&(n=n.all());var i=this.items.map(function(s,o){return new r.constructor([s,n[o]])});return new this.constructor(i)};(function(e){function t(s){"@babel/helpers - typeof";return t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},t(s)}function r(s){s!==void 0&&!Array.isArray(s)&&t(s)!=="object"?this.items=[s]:s instanceof this.constructor?this.items=s.all():this.items=s||[]}var n=wr;typeof Symbol<"u"&&(r.prototype[Symbol.iterator]=n),r.prototype.toJSON=function(){return this.items},r.prototype.all=Ar,r.prototype.average=_t,r.prototype.avg=$r,r.prototype.chunk=jr,r.prototype.collapse=Fr,r.prototype.combine=Kr,r.prototype.concat=Lr,r.prototype.contains=jt,r.prototype.containsOneItem=ie,r.prototype.count=se,r.prototype.countBy=oe,r.prototype.crossJoin=ae,r.prototype.dd=ue,r.prototype.diff=ce,r.prototype.diffAssoc=fe,r.prototype.diffKeys=le,r.prototype.diffUsing=he,r.prototype.doesntContain=pe,r.prototype.dump=ye,r.prototype.duplicates=me,r.prototype.each=de,r.prototype.eachSpread=_e,r.prototype.every=Se,r.prototype.except=je,r.prototype.filter=Te,r.prototype.first=Ce,r.prototype.firstOrFail=Ne,r.prototype.firstWhere=Be,r.prototype.flatMap=qe,r.prototype.flatten=xe,r.prototype.flip=Ke,r.prototype.forPage=Ue,r.prototype.forget=We,r.prototype.get=Je,r.prototype.groupBy=He,r.prototype.has=Ge,r.prototype.implode=ze,r.prototype.intersect=Xe,r.prototype.intersectByKeys=Ye,r.prototype.isEmpty=Ze,r.prototype.isNotEmpty=ke,r.prototype.join=tn,r.prototype.keyBy=sn,r.prototype.keys=on,r.prototype.last=un,r.prototype.macro=cn,r.prototype.make=fn,r.prototype.map=ln,r.prototype.mapSpread=vn,r.prototype.mapToDictionary=On,r.prototype.mapInto=Sn,r.prototype.mapToGroups=Pn,r.prototype.mapWithKeys=Bn,r.prototype.max=Wn,r.prototype.median=Mn,r.prototype.merge=Rn,r.prototype.mergeRecursive=Vn,r.prototype.min=zn,r.prototype.mode=Xn,r.prototype.nth=Zn,r.prototype.only=ti,r.prototype.pad=ei,r.prototype.partition=ni,r.prototype.pipe=ii,r.prototype.pluck=ui,r.prototype.pop=hi,r.prototype.prepend=pi,r.prototype.pull=di,r.prototype.push=vi,r.prototype.put=bi,r.prototype.random=wi,r.prototype.reduce=Ai,r.prototype.reject=_i,r.prototype.replace=Si,r.prototype.replaceRecursive=ji,r.prototype.reverse=Ei,r.prototype.search=Ci,r.prototype.shift=Bi,r.prototype.shuffle=xi,r.prototype.skip=Wi,r.prototype.skipUntil=Vi,r.prototype.skipWhile=Gi,r.prototype.slice=zi,r.prototype.sole=Zi,r.prototype.some=ts,r.prototype.sort=rs,r.prototype.sortDesc=es,r.prototype.sortBy=os,r.prototype.sortByDesc=as,r.prototype.sortKeys=us,r.prototype.sortKeysDesc=cs,r.prototype.splice=fs,r.prototype.split=ls,r.prototype.sum=ms,r.prototype.take=ds,r.prototype.takeUntil=ws,r.prototype.takeWhile=Ss,r.prototype.tap=$s,r.prototype.times=js,r.prototype.toArray=Es,r.prototype.toJson=Is,r.prototype.transform=Ts,r.prototype.undot=Cs,r.prototype.unless=Fs,r.prototype.unlessEmpty=Qt,r.prototype.unlessNotEmpty=Gt,r.prototype.union=Ds,r.prototype.unique=qs,r.prototype.unwrap=xs,r.prototype.values=Us,r.prototype.when=Ws,r.prototype.whenEmpty=Gt,r.prototype.whenNotEmpty=Qt,r.prototype.where=Rs,r.prototype.whereBetween=Js,r.prototype.whereIn=Hs,r.prototype.whereInstanceOf=Qs,r.prototype.whereNotBetween=Gs,r.prototype.whereNotIn=Ys,r.prototype.whereNull=Zs,r.prototype.whereNotNull=ks,r.prototype.wrap=to,r.prototype.zip=ro;var i=function(o){return new r(o)};e.exports=i,e.exports.collect=i,e.exports.default=i,e.exports.Collection=r})(At);var eo=At.exports;const no=gr(eo),Xt=["chunk","shuffle","splice","sortBy","map","reverse","groupBy","implode","keyBy","keys","mapToDictionary","mapWithKeys","nth","skipUntil","skipWhile","takeUntil","takeWhile","unique"],io=["forPage","sortByDesc","sortBy","skip","take","splice","whereBetween","whereIn","whereNotBetween","whereNotIn","first"],so=["avg","count","countBy","dd","each","every","filter","firstWhere","isEmpty","isNotEmpty","last","mapToGroups","max","median","min","mode","contains","sole","sort","split","sum","toJson"];class j{constructor(t,r,n){S(this,"data_path");S(this,"axios");S(this,"filters");S(this,"steps");S(this,"fields");S(this,"already_limit",!1);S(this,"already_offset",!1);S(this,"limit",null);S(this,"offset",null);S(this,"_sort",null);S(this,"_sortDesc",!1);S(this,"meta",{});this.data_path=t,this.axios=n,this.filters={},this.steps=[],this.fields=r}}j.prototype.dataPath=function(e){const t=this.clone();return t.data_path=e,t},j.prototype.buildArgs=function(){let e={};return Object.keys(this.filters).length>0&&(e.filters=this.filters),this._sort&&(e.sort=this._sort,this._sortDesc&&(e.sort+=":desc")),e},j.prototype.clone=function(){const e=Object.create(this);return e.steps=[...this.steps],e},j.prototype.fetchData=async function(){let e={meta:{total:!0}};e.__args=this.buildArgs(),e.data=this.fields,this.already_limit&&(e.data.__args=e.data.__args||{},e.data.__args.limit=this.limit),this.already_offset&&(e.data.__args=e.data.__args||{},e.data.__args.offset=this.offset);const t=this.data_path.split(".");let r={},n=r,i=t[t.length-1];for(const u of t){if(u===i){n[u]=e;break}n[u]={},n=n[u]}let o=await O(this.axios,r);for(const u of t)o=o[u];return this.meta=o.meta,no(o.data)},j.prototype.processData=async function(){let e=null;for(const t of this.steps){if(Xt.includes(t.type)){e||(e=await this.fetchData()),e=e[t.type](...t.args);continue}t.type==="forPage"&&(e?e=e.forPage(t.args[0],t.args[1]):this.already_limit||this.already_offset?(e=await this.fetchData(),e=e.forPage(t.args[0],t.args[1])):(this.offset=(t.args[0]-1)*t.args[1],this.limit=t.args[1]),this.already_limit=!0,this.already_offset=!0),t.type==="where"&&(e?e=e.where(t.field,t.operator,t.value):t.operator==="=="&&(this.filters[t.field]=t.value)),t.type==="whereIn"&&(e?e=e.whereIn(...t.args):this.filters[t.args[0]]={in:t.args[1]}),t.type==="whereNotBetween"&&(e?e=e.whereNotBetween(...t.args):this.filters[t.args[0]]={notBetween:t.args[1]}),t.type==="whereNotIn"&&(e?e=e.whereNotIn(...t.args):this.filters[t.args[0]]={notIn:t.args[1]}),t.type=="whereBetween"&&(e?e=e.whereBetween(...t.args):this.filters[t.args[0]]={between:t.args[1]}),t.type==="sortByDesc"&&(e?e=e.sortByDesc(t.args[0]):this.already_limit||this.already_offset?(e=await this.fetchData(),e=e.sortByDesc(t.args[0])):(this._sort=t.args[0],this._sortDesc=!0)),t.type==="sortBy"&&(e?e=e.sortBy(t.args[0]):this.already_limit||this.already_offset?(e=await this.fetchData(),e=e.sortBy(t.args[0])):this._sort=t.args[0]),t.type==="skip"&&(e?e=e.skip(t.args[0]):this.already_offset||this.already_limit?(e=await this.fetchData(),e=e.skip(t.args[0])):this.offset=t.args[0],this.already_offset=!0),t.type==="take"&&(e?e=e.take(...t.args):this.already_offset||this.already_limit?(e=await this.fetchData(),e=e.take(t.args[0])):this.limit=t.args[0],this.already_limit=!0),t.type==="splice"&&(e?e=e.splice(...t.args):(this.offset=t.args[0],this.limit=t.args[1]),this.already_limit=!0,this.already_offset=!0)}return e||(e=await this.fetchData()),e},j.prototype.all=async function(){return(await this.processData()).all()};for(const e of[...Xt,...io])j.prototype[e]=function(...t){const r=this.clone();return r.steps.push({type:e,args:t}),r};for(const e of so)j.prototype[e]=async function(...t){return(await this.clone().processData())[e](...t)};j.prototype.average=j.prototype.avg,j.prototype.first=async function(){return this.take(1),(await this.processData()).first()};const oo=e=>{const t=C.create({baseURL:e,withCredentials:!0}),r=(s,o=null,u=[])=>p(t,s,o,u),n=s=>O(t,s),i=vr();return{baseURL:e,axios:t,auth:ur(t),mutation:r,query:n,config:yr(n),mail:mr(t),users:dr(t),fs:pr(t),models:i,model(s){return wt(t,s,i.get(s))},roles:br(t),collect:(s,o)=>{const u=wt(t,s,i.get(s)).getDataPath();return new j(u,o,t)}}};g.File=fr,g.createClient=oo,g.file=q,g.mutation=p,g.query=O,g.toQuery=B,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|